flipbookengine 0.5.4 → 0.6.5

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.
@@ -1,13 +1,13 @@
1
- var ye = Object.defineProperty;
2
- var Nt = (e) => {
1
+ var ke = Object.defineProperty;
2
+ var _t = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var be = (e, t, s) => t in e ? ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
6
- var m = (e, t, s) => be(e, typeof t != "symbol" ? t + "" : t, s), yt = (e, t, s) => t.has(e) || Nt("Cannot " + s);
7
- var _ = (e, t, s) => (yt(e, t, "read from private field"), s ? s.call(e) : t.get(e)), rt = (e, t, s) => t.has(e) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), at = (e, t, s, o) => (yt(e, t, "write to private field"), o ? o.call(e, s) : t.set(e, s), s), J = (e, t, s) => (yt(e, t, "access private method"), s);
8
- import * as Bt from "pdfjs-dist";
9
- var xe = Symbol.for("preact-signals");
10
- function It() {
5
+ var Ce = (e, t, i) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
6
+ var v = (e, t, i) => Ce(e, typeof t != "symbol" ? t + "" : t, i), yt = (e, t, i) => t.has(e) || _t("Cannot " + i);
7
+ var B = (e, t, i) => (yt(e, t, "read from private field"), i ? i.call(e) : t.get(e)), rt = (e, t, i) => t.has(e) ? _t("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), at = (e, t, i, o) => (yt(e, t, "write to private field"), o ? o.call(e, i) : t.set(e, i), i), J = (e, t, i) => (yt(e, t, "access private method"), i);
8
+ import * as Gt from "pdfjs-dist";
9
+ var Ae = Symbol.for("preact-signals");
10
+ function zt() {
11
11
  if (j > 1)
12
12
  j--;
13
13
  else {
@@ -17,155 +17,155 @@ function It() {
17
17
  for (ct = void 0; r !== void 0; )
18
18
  r.S.v === r.v && (r.S.i = r.i), r = r.o;
19
19
  }(); tt !== void 0; ) {
20
- var s = tt;
21
- for (tt = void 0, lt++; s !== void 0; ) {
22
- var o = s.u;
23
- if (s.u = void 0, s.f &= -3, !(8 & s.f) && ie(s)) try {
24
- s.c();
20
+ var i = tt;
21
+ for (tt = void 0, lt++; i !== void 0; ) {
22
+ var o = i.u;
23
+ if (i.u = void 0, i.f &= -3, !(8 & i.f) && ne(i)) try {
24
+ i.c();
25
25
  } catch (r) {
26
26
  t || (e = r, t = !0);
27
27
  }
28
- s = o;
28
+ i = o;
29
29
  }
30
30
  }
31
31
  if (lt = 0, j--, t) throw e;
32
32
  }
33
33
  }
34
- var k = void 0;
34
+ var M = void 0;
35
35
  function wt(e) {
36
- var t = k;
37
- k = void 0;
36
+ var t = M;
37
+ M = void 0;
38
38
  try {
39
39
  return e();
40
40
  } finally {
41
- k = t;
41
+ M = t;
42
42
  }
43
43
  }
44
- var tt = void 0, j = 0, lt = 0, _t = 0, ct = void 0, dt = 0;
45
- function ee(e) {
46
- if (k !== void 0) {
44
+ var tt = void 0, j = 0, lt = 0, Ut = 0, ct = void 0, dt = 0;
45
+ function se(e) {
46
+ if (M !== void 0) {
47
47
  var t = e.n;
48
- if (t === void 0 || t.t !== k)
49
- return t = { i: 0, S: e, p: k.s, n: void 0, t: k, e: void 0, x: void 0, r: t }, k.s !== void 0 && (k.s.n = t), k.s = t, e.n = t, 32 & k.f && e.S(t), t;
48
+ if (t === void 0 || t.t !== M)
49
+ return t = { i: 0, S: e, p: M.s, n: void 0, t: M, e: void 0, x: void 0, r: t }, M.s !== void 0 && (M.s.n = t), M.s = t, e.n = t, 32 & M.f && e.S(t), t;
50
50
  if (t.i === -1)
51
- return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = k.s, t.n = void 0, k.s.n = t, k.s = t), t;
51
+ return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = M.s, t.n = void 0, M.s.n = t, M.s = t), t;
52
52
  }
53
53
  }
54
- function I(e, t) {
54
+ function z(e, t) {
55
55
  this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
56
56
  }
57
- I.prototype.brand = xe;
58
- I.prototype.h = function() {
57
+ z.prototype.brand = Ae;
58
+ z.prototype.h = function() {
59
59
  return !0;
60
60
  };
61
- I.prototype.S = function(e) {
62
- var t = this, s = this.t;
63
- s !== e && e.e === void 0 && (e.x = s, this.t = e, s !== void 0 ? s.e = e : wt(function() {
61
+ z.prototype.S = function(e) {
62
+ var t = this, i = this.t;
63
+ i !== e && e.e === void 0 && (e.x = i, this.t = e, i !== void 0 ? i.e = e : wt(function() {
64
64
  var o;
65
65
  (o = t.W) == null || o.call(t);
66
66
  }));
67
67
  };
68
- I.prototype.U = function(e) {
68
+ z.prototype.U = function(e) {
69
69
  var t = this;
70
70
  if (this.t !== void 0) {
71
- var s = e.e, o = e.x;
72
- s !== void 0 && (s.x = o, e.e = void 0), o !== void 0 && (o.e = s, e.x = void 0), e === this.t && (this.t = o, o === void 0 && wt(function() {
71
+ var i = e.e, o = e.x;
72
+ i !== void 0 && (i.x = o, e.e = void 0), o !== void 0 && (o.e = i, e.x = void 0), e === this.t && (this.t = o, o === void 0 && wt(function() {
73
73
  var r;
74
74
  (r = t.Z) == null || r.call(t);
75
75
  }));
76
76
  }
77
77
  };
78
- I.prototype.subscribe = function(e) {
78
+ z.prototype.subscribe = function(e) {
79
79
  var t = this;
80
- return G(function() {
81
- var s = t.value;
80
+ return _(function() {
81
+ var i = t.value;
82
82
  wt(function() {
83
- return e(s);
83
+ return e(i);
84
84
  });
85
85
  }, { name: "sub" });
86
86
  };
87
- I.prototype.valueOf = function() {
87
+ z.prototype.valueOf = function() {
88
88
  return this.value;
89
89
  };
90
- I.prototype.toString = function() {
90
+ z.prototype.toString = function() {
91
91
  return this.value + "";
92
92
  };
93
- I.prototype.toJSON = function() {
93
+ z.prototype.toJSON = function() {
94
94
  return this.value;
95
95
  };
96
- I.prototype.peek = function() {
96
+ z.prototype.peek = function() {
97
97
  var e = this;
98
98
  return wt(function() {
99
99
  return e.value;
100
100
  });
101
101
  };
102
- Object.defineProperty(I.prototype, "value", { get: function() {
103
- var e = ee(this);
102
+ Object.defineProperty(z.prototype, "value", { get: function() {
103
+ var e = se(this);
104
104
  return e !== void 0 && (e.i = this.i), this.v;
105
105
  }, set: function(e) {
106
106
  if (e !== this.v) {
107
107
  if (lt > 100) throw new Error("Cycle detected");
108
- (function(s) {
109
- j !== 0 && lt === 0 && s.l !== _t && (s.l = _t, ct = { S: s, v: s.v, i: s.i, o: ct });
108
+ (function(i) {
109
+ j !== 0 && lt === 0 && i.l !== Ut && (i.l = Ut, ct = { S: i, v: i.v, i: i.i, o: ct });
110
110
  })(this), this.v = e, this.i++, dt++, j++;
111
111
  try {
112
112
  for (var t = this.t; t !== void 0; t = t.x) t.t.N();
113
113
  } finally {
114
- It();
114
+ zt();
115
115
  }
116
116
  }
117
117
  } });
118
- function M(e, t) {
119
- return new I(e, t);
118
+ function D(e, t) {
119
+ return new z(e, t);
120
120
  }
121
- function ie(e) {
121
+ function ne(e) {
122
122
  for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
123
123
  return !1;
124
124
  }
125
- function se(e) {
125
+ function oe(e) {
126
126
  for (var t = e.s; t !== void 0; t = t.n) {
127
- var s = t.S.n;
128
- if (s !== void 0 && (t.r = s), t.S.n = t, t.i = -1, t.n === void 0) {
127
+ var i = t.S.n;
128
+ if (i !== void 0 && (t.r = i), t.S.n = t, t.i = -1, t.n === void 0) {
129
129
  e.s = t;
130
130
  break;
131
131
  }
132
132
  }
133
133
  }
134
- function ne(e) {
135
- for (var t = e.s, s = void 0; t !== void 0; ) {
134
+ function re(e) {
135
+ for (var t = e.s, i = void 0; t !== void 0; ) {
136
136
  var o = t.p;
137
- t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : s = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
137
+ t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : i = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
138
138
  }
139
- e.s = s;
139
+ e.s = i;
140
140
  }
141
141
  function q(e, t) {
142
- I.call(this, void 0, t), this.x = e, this.s = void 0, this.g = dt - 1, this.f = 4;
142
+ z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = dt - 1, this.f = 4;
143
143
  }
144
- q.prototype = new I();
144
+ q.prototype = new z();
145
145
  q.prototype.h = function() {
146
146
  if (this.f &= -3, 1 & this.f) return !1;
147
147
  if ((36 & this.f) == 32 || (this.f &= -5, this.g === dt)) return !0;
148
- if (this.g = dt, this.f |= 1, this.i > 0 && !ie(this))
148
+ if (this.g = dt, this.f |= 1, this.i > 0 && !ne(this))
149
149
  return this.f &= -2, !0;
150
- var e = k;
150
+ var e = M;
151
151
  try {
152
- se(this), k = this;
152
+ oe(this), M = this;
153
153
  var t = this.x();
154
154
  (16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
155
- } catch (s) {
156
- this.v = s, this.f |= 16, this.i++;
155
+ } catch (i) {
156
+ this.v = i, this.f |= 16, this.i++;
157
157
  }
158
- return k = e, ne(this), this.f &= -2, !0;
158
+ return M = e, re(this), this.f &= -2, !0;
159
159
  };
160
160
  q.prototype.S = function(e) {
161
161
  if (this.t === void 0) {
162
162
  this.f |= 36;
163
163
  for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
164
164
  }
165
- I.prototype.S.call(this, e);
165
+ z.prototype.S.call(this, e);
166
166
  };
167
167
  q.prototype.U = function(e) {
168
- if (this.t !== void 0 && (I.prototype.U.call(this, e), this.t === void 0)) {
168
+ if (this.t !== void 0 && (z.prototype.U.call(this, e), this.t === void 0)) {
169
169
  this.f &= -33;
170
170
  for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
171
171
  }
@@ -178,35 +178,35 @@ q.prototype.N = function() {
178
178
  };
179
179
  Object.defineProperty(q.prototype, "value", { get: function() {
180
180
  if (1 & this.f) throw new Error("Cycle detected");
181
- var e = ee(this);
181
+ var e = se(this);
182
182
  if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
183
183
  return this.v;
184
184
  } });
185
185
  function w(e, t) {
186
186
  return new q(e, t);
187
187
  }
188
- function oe(e) {
188
+ function ae(e) {
189
189
  var t = e.m;
190
190
  if (e.m = void 0, typeof t == "function") {
191
191
  j++;
192
- var s = k;
193
- k = void 0;
192
+ var i = M;
193
+ M = void 0;
194
194
  try {
195
195
  t();
196
196
  } catch (o) {
197
- throw e.f &= -2, e.f |= 8, Lt(e), o;
197
+ throw e.f &= -2, e.f |= 8, Ft(e), o;
198
198
  } finally {
199
- k = s, It();
199
+ M = i, zt();
200
200
  }
201
201
  }
202
202
  }
203
- function Lt(e) {
203
+ function Ft(e) {
204
204
  for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
205
- e.x = void 0, e.s = void 0, oe(e);
205
+ e.x = void 0, e.s = void 0, ae(e);
206
206
  }
207
- function Pe(e) {
208
- if (k !== this) throw new Error("Out-of-order effect");
209
- ne(this), k = e, this.f &= -2, 8 & this.f && Lt(this), It();
207
+ function Ee(e) {
208
+ if (M !== this) throw new Error("Out-of-order effect");
209
+ re(this), M = e, this.f &= -2, 8 & this.f && Ft(this), zt();
210
210
  }
211
211
  function X(e, t) {
212
212
  this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t == null ? void 0 : t.name;
@@ -223,69 +223,69 @@ X.prototype.c = function() {
223
223
  };
224
224
  X.prototype.S = function() {
225
225
  if (1 & this.f) throw new Error("Cycle detected");
226
- this.f |= 1, this.f &= -9, oe(this), se(this), j++;
227
- var e = k;
228
- return k = this, Pe.bind(this, e);
226
+ this.f |= 1, this.f &= -9, ae(this), oe(this), j++;
227
+ var e = M;
228
+ return M = this, Ee.bind(this, e);
229
229
  };
230
230
  X.prototype.N = function() {
231
231
  2 & this.f || (this.f |= 2, this.u = tt, tt = this);
232
232
  };
233
233
  X.prototype.d = function() {
234
- this.f |= 8, 1 & this.f || Lt(this);
234
+ this.f |= 8, 1 & this.f || Ft(this);
235
235
  };
236
236
  X.prototype.dispose = function() {
237
237
  this.d();
238
238
  };
239
- function G(e, t) {
240
- var s = new X(e, t);
239
+ function _(e, t) {
240
+ var i = new X(e, t);
241
241
  try {
242
- s.c();
242
+ i.c();
243
243
  } catch (r) {
244
- throw s.d(), r;
244
+ throw i.d(), r;
245
245
  }
246
- var o = s.d.bind(s);
246
+ var o = i.d.bind(i);
247
247
  return o[Symbol.dispose] = o, o;
248
248
  }
249
- var re = /* @__PURE__ */ Symbol.for("Serenity.initPropHook");
250
- function Se(e) {
249
+ var he = /* @__PURE__ */ Symbol.for("Serenity.initPropHook");
250
+ function Me(e) {
251
251
  return !!(e && typeof e.nodeType == "number");
252
252
  }
253
253
  function vt(e) {
254
254
  return typeof e == "string";
255
255
  }
256
- function ae(e) {
256
+ function le(e) {
257
257
  return typeof e == "number";
258
258
  }
259
- function z(e) {
259
+ function W(e) {
260
260
  return typeof e == "object" && e !== null;
261
261
  }
262
- function Ce(e) {
262
+ function De(e) {
263
263
  return !!(e && e.isComponent);
264
264
  }
265
- function zt(e) {
266
- return z(e) && typeof e.length == "number" && typeof e.nodeType != "number";
265
+ function Ot(e) {
266
+ return W(e) && typeof e.length == "number" && typeof e.nodeType != "number";
267
267
  }
268
- function ke(e) {
269
- return typeof e == "function" && typeof e[re] == "function";
268
+ function Re(e) {
269
+ return typeof e == "function" && typeof e[he] == "function";
270
270
  }
271
271
  function it(e) {
272
272
  return e != null && typeof e != "boolean";
273
273
  }
274
274
  function st(e) {
275
- return Array.isArray(e) ? e.map(st).filter(Boolean).join(" ") : z(e) ? Symbol.iterator in e ? st(Array.from(e)) : Object.keys(e).filter((t) => e[t]).join(" ") : it(e) ? "" + e : "";
275
+ return Array.isArray(e) ? e.map(st).filter(Boolean).join(" ") : W(e) ? Symbol.iterator in e ? st(Array.from(e)) : Object.keys(e).filter((t) => e[t]).join(" ") : it(e) ? "" + e : "";
276
276
  }
277
- function Te(e) {
277
+ function Ie(e) {
278
278
  return e != null && typeof e == "object" && "current" in e;
279
279
  }
280
- function Ft(e, t) {
281
- Te(e) ? e.current = t : typeof e == "function" && e(t);
280
+ function Wt(e, t) {
281
+ Ie(e) ? e.current = t : typeof e == "function" && e(t);
282
282
  }
283
- function Ae(e, t, s) {
284
- t = { ...t, children: s };
283
+ function Le(e, t, i) {
284
+ t = { ...t, children: i };
285
285
  const o = new e(t), r = o.render();
286
- return "ref" in t && Ft(t.ref, o), r;
286
+ return "ref" in t && Wt(t.ref, o), r;
287
287
  }
288
- var Ee = "http://www.w3.org/1998/Math/MathML", Me = /* @__PURE__ */ new Set(["math", "annotation", "annotation-xml", "maction", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics", "menclose", "mfenced"]), De = /* @__PURE__ */ new Set([
288
+ var ze = "http://www.w3.org/1998/Math/MathML", Fe = /* @__PURE__ */ new Set(["math", "annotation", "annotation-xml", "maction", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics", "menclose", "mfenced"]), Oe = /* @__PURE__ */ new Set([
289
289
  // "a",
290
290
  "animate",
291
291
  "animateMotion",
@@ -350,30 +350,30 @@ var Ee = "http://www.w3.org/1998/Math/MathML", Me = /* @__PURE__ */ new Set(["ma
350
350
  "tspan",
351
351
  "use",
352
352
  "view"
353
- ]), Gt = /^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/, Re = "http://www.w3.org/2000/svg", Ut = /* @__PURE__ */ Symbol.for("Serenity.jsxNamespaceURI");
354
- function Ie(e) {
355
- const t = globalThis[Ut];
356
- return arguments.length && (globalThis[Ut] = e), t;
353
+ ]), jt = /^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/, We = "http://www.w3.org/2000/svg", Vt = /* @__PURE__ */ Symbol.for("Serenity.jsxNamespaceURI");
354
+ function Ne(e) {
355
+ const t = globalThis[Vt];
356
+ return arguments.length && (globalThis[Vt] = e), t;
357
357
  }
358
- var Le = /* @__PURE__ */ Symbol.for("Serenity.jsxTypeKey"), ze = "ShadowRoot";
359
- function Fe(e) {
360
- return e != null && e[Le] === ze;
358
+ var $e = /* @__PURE__ */ Symbol.for("Serenity.jsxTypeKey"), He = "ShadowRoot";
359
+ function Be(e) {
360
+ return e != null && e[$e] === He;
361
361
  }
362
- var bt = /* @__PURE__ */ Symbol.for("Serenity.disposingListeners"), xt = /* @__PURE__ */ Symbol.for("Serenity.lifecycleRoot");
363
- function Ot() {
362
+ var bt = /* @__PURE__ */ Symbol.for("Serenity.disposingListeners"), Pt = /* @__PURE__ */ Symbol.for("Serenity.lifecycleRoot");
363
+ function Nt() {
364
364
  return globalThis[bt] || (globalThis[bt] = /* @__PURE__ */ new WeakMap());
365
365
  }
366
- function Wt(e) {
367
- e && e.target && (!e.currentTarget || e.currentTarget === e.target) && Oe(e == null ? void 0 : e.target);
366
+ function $t(e) {
367
+ e && e.target && (!e.currentTarget || e.currentTarget === e.target) && _e(e == null ? void 0 : e.target);
368
368
  }
369
- function Oe(e, t) {
369
+ function _e(e, t) {
370
370
  if (!e)
371
371
  return;
372
- const s = Ot();
372
+ const i = Nt();
373
373
  function o(r) {
374
- const h = s.get(r);
374
+ const h = i.get(r);
375
375
  if (h) {
376
- s.delete(r), r.removeEventListener("disposing", Wt);
376
+ i.delete(r), r.removeEventListener("disposing", $t);
377
377
  for (const u of h)
378
378
  try {
379
379
  u.callback(r);
@@ -383,70 +383,70 @@ function Oe(e, t) {
383
383
  }
384
384
  o(e);
385
385
  }
386
- function kt(e, t, s) {
386
+ function At(e, t, i) {
387
387
  if (!e || !t)
388
388
  return e;
389
- const o = Ot();
389
+ const o = Nt();
390
390
  let r = o.get(e);
391
391
  if (!r)
392
392
  return typeof e.addEventListener != "function" || (o.set(e, r = [{
393
393
  callback: t,
394
- regKey: s
395
- }]), e.addEventListener("disposing", Wt, { once: !0 })), e;
394
+ regKey: i
395
+ }]), e.addEventListener("disposing", $t, { once: !0 })), e;
396
396
  const h = r.find((u) => u.callback === t);
397
- return h ? (h.regKey, e) : (r.push({ callback: t, regKey: s }), e);
397
+ return h ? (h.regKey, e) : (r.push({ callback: t, regKey: i }), e);
398
398
  }
399
- function jt(e, t, s) {
399
+ function Zt(e, t, i) {
400
400
  if (!e || !t)
401
401
  return e;
402
- const o = Ot(), r = o.get(e);
402
+ const o = Nt(), r = o.get(e);
403
403
  if (r) {
404
404
  for (let h = r.length - 1; h >= 0; h--) {
405
405
  const u = r[h];
406
406
  t && t === u.callback && r.splice(h, 1);
407
407
  }
408
- r.length === 0 && (o.delete(e), typeof e.removeEventListener == "function" && e.removeEventListener("disposing", Wt));
408
+ r.length === 0 && (o.delete(e), typeof e.removeEventListener == "function" && e.removeEventListener("disposing", $t));
409
409
  }
410
410
  return e;
411
411
  }
412
- function We(...e) {
412
+ function Ge(...e) {
413
413
  if (e.length > 0) {
414
- const t = globalThis[xt] || null;
415
- return globalThis[xt] = e[0] || null, t;
414
+ const t = globalThis[Pt] || null;
415
+ return globalThis[Pt] = e[0] || null, t;
416
416
  }
417
- return globalThis[xt] || null;
417
+ return globalThis[Pt] || null;
418
418
  }
419
419
  function Z(e) {
420
420
  return e != null && typeof e == "object" && typeof e.subscribe == "function" && typeof e.peek == "function" && "value" in e;
421
421
  }
422
- var ot, O, U, Tt, At, te, $e = (te = class {
423
- constructor(e, t, s) {
424
- rt(this, U);
422
+ var ot, $, G, Et, Mt, ie, Ue = (ie = class {
423
+ constructor(e, t, i) {
424
+ rt(this, G);
425
425
  rt(this, ot);
426
- rt(this, O);
427
- this.signal = e, this.isInitial = !0, this.hasChanged = !1, this.lifecycleRoot = t, at(this, O, s);
426
+ rt(this, $);
427
+ this.signal = e, this.isInitial = !0, this.hasChanged = !1, this.lifecycleRoot = t, at(this, $, i);
428
428
  }
429
429
  get lifecycleNode() {
430
- return _(this, O);
430
+ return B(this, $);
431
431
  }
432
432
  get effectDisposer() {
433
- return _(this, ot);
433
+ return B(this, ot);
434
434
  }
435
435
  set effectDisposer(e) {
436
- J(this, U, Tt).call(this), at(this, ot, e), J(this, U, At).call(this);
436
+ J(this, G, Et).call(this), at(this, ot, e), J(this, G, Mt).call(this);
437
437
  }
438
438
  set lifecycleNode(e) {
439
- e !== _(this, O) && (J(this, U, Tt).call(this), at(this, O, e), J(this, U, At).call(this));
439
+ e !== B(this, $) && (J(this, G, Et).call(this), at(this, $, e), J(this, G, Mt).call(this));
440
440
  }
441
- }, ot = new WeakMap(), O = new WeakMap(), U = new WeakSet(), Tt = function() {
441
+ }, ot = new WeakMap(), $ = new WeakMap(), G = new WeakSet(), Et = function() {
442
442
  var e;
443
- jt(_(this, O), this.effectDisposer), jt(_(this, O), (e = this.signal) == null ? void 0 : e.derivedDisposer);
444
- }, At = function() {
443
+ Zt(B(this, $), this.effectDisposer), Zt(B(this, $), (e = this.signal) == null ? void 0 : e.derivedDisposer);
444
+ }, Mt = function() {
445
445
  var e;
446
- kt(_(this, O), this.effectDisposer), kt(_(this, O), (e = this.signal) == null ? void 0 : e.derivedDisposer);
447
- }, te);
448
- function nt(e, t, s) {
449
- const o = s != null && s.useLifecycleRoot ? We() : void 0, r = new $e(e, o, s == null ? void 0 : s.lifecycleNode), h = r.signal.subscribe(function(u) {
446
+ At(B(this, $), this.effectDisposer), At(B(this, $), (e = this.signal) == null ? void 0 : e.derivedDisposer);
447
+ }, ie);
448
+ function nt(e, t, i) {
449
+ const o = i != null && i.useLifecycleRoot ? Ge() : void 0, r = new Ue(e, o, i == null ? void 0 : i.lifecycleNode), h = r.signal.subscribe(function(u) {
450
450
  r.newValue = u, r.isInitial && (this != null && this.dispose) && (r.effectDisposer = this.dispose.bind(this)), r.hasChanged = !r.isInitial && r.prevValue !== r.newValue;
451
451
  try {
452
452
  t(r);
@@ -456,78 +456,78 @@ function nt(e, t, s) {
456
456
  });
457
457
  return h && !r.effectDisposer && (r.effectDisposer = h), r.effectDisposer;
458
458
  }
459
- function Vt(e, t) {
459
+ function qt(e, t) {
460
460
  e instanceof window.HTMLTemplateElement ? e.content.appendChild(t) : e.appendChild(t);
461
461
  }
462
- var Pt = 0, Et = "__domwisefrag_";
463
- function he(e) {
464
- return e instanceof Comment && e.data.startsWith(Et);
462
+ var xt = 0, Dt = "__domwisefrag_";
463
+ function ce(e) {
464
+ return e instanceof Comment && e.data.startsWith(Dt);
465
465
  }
466
- function Zt(e) {
467
- return e instanceof DocumentFragment && he(e.firstChild);
466
+ function Xt(e) {
467
+ return e instanceof DocumentFragment && ce(e.firstChild);
468
468
  }
469
- function He(e, t) {
470
- var s;
471
- typeof e.replaceWith == "function" ? e.replaceWith(t) : (s = e.parentNode) == null || s.replaceChild(t, e);
469
+ function je(e, t) {
470
+ var i;
471
+ typeof e.replaceWith == "function" ? e.replaceWith(t) : (i = e.parentNode) == null || i.replaceChild(t, e);
472
472
  }
473
- function qt(e) {
474
- return e instanceof DocumentFragment ? (++Pt, e.prepend(document.createComment(Et + Pt)), e.append(document.createComment(Et + Pt)), e) : e instanceof Node ? e : it(e) ? document.createTextNode(e) : document.createComment("");
473
+ function Yt(e) {
474
+ return e instanceof DocumentFragment ? (++xt, e.prepend(document.createComment(Dt + xt)), e.append(document.createComment(Dt + xt)), e) : e instanceof Node ? e : it(e) ? document.createTextNode(e) : document.createComment("");
475
475
  }
476
- function Ne(e, t) {
477
- let s;
476
+ function Ve(e, t) {
477
+ let i;
478
478
  nt(t, (o) => {
479
479
  var u;
480
480
  if (o.isInitial) {
481
- s = qt(o.newValue);
482
- let g = Zt(s) ? s.firstChild : s;
483
- ut(e, s), o.lifecycleNode = (s = g) ?? e;
481
+ i = Yt(o.newValue);
482
+ let c = Xt(i) ? i.firstChild : i;
483
+ ut(e, i), o.lifecycleNode = (i = c) ?? e;
484
484
  return;
485
485
  }
486
486
  if (!o.hasChanged)
487
487
  return;
488
- const r = qt(o.newValue);
489
- if (he(s)) {
490
- let g;
491
- for (; (g = s.nextSibling) && ((u = g.parentNode) == null || u.removeChild(g), !(g instanceof Comment && g.data === s.data)); )
488
+ const r = Yt(o.newValue);
489
+ if (ce(i)) {
490
+ let c;
491
+ for (; (c = i.nextSibling) && ((u = c.parentNode) == null || u.removeChild(c), !(c instanceof Comment && c.data === i.data)); )
492
492
  ;
493
493
  }
494
- let h = Zt(r) ? r.firstChild : r;
495
- He(s, r), o.lifecycleNode = (s = h) ?? e;
494
+ let h = Xt(r) ? r.firstChild : r;
495
+ je(i, r), o.lifecycleNode = (i = h) ?? e;
496
496
  });
497
497
  }
498
498
  function ut(e, t) {
499
499
  if (it(t))
500
- if (zt(t))
501
- for (const s of [...t])
502
- ut(e, s);
503
- else if (vt(t) || ae(t))
504
- Vt(e, document.createTextNode(t));
505
- else if (Se(t))
506
- Vt(e, t);
507
- else if (Fe(t)) {
508
- const s = e.attachShadow(t.attr);
509
- ut(s, t.children), Ft(t.ref, s);
510
- } else Z(t) && Ne(e, t);
500
+ if (Ot(t))
501
+ for (const i of [...t])
502
+ ut(e, i);
503
+ else if (vt(t) || le(t))
504
+ qt(e, document.createTextNode(t));
505
+ else if (Me(t))
506
+ qt(e, t);
507
+ else if (Be(t)) {
508
+ const i = e.attachShadow(t.attr);
509
+ ut(i, t.children), Wt(t.ref, i);
510
+ } else Z(t) && Ve(e, t);
511
511
  }
512
- function le(e) {
513
- return e == null || (zt(e) ? e = Array.from(e).map((t) => Z(t) ? t.peek() : t) : z(e) && (e = { ...e }, Object.entries(e).forEach(([t, s]) => {
514
- Z(s) && (e[t] = s.peek());
512
+ function de(e) {
513
+ return e == null || (Ot(e) ? e = Array.from(e).map((t) => Z(t) ? t.peek() : t) : W(e) && (e = { ...e }, Object.entries(e).forEach(([t, i]) => {
514
+ Z(i) && (e[t] = i.peek());
515
515
  }))), e;
516
516
  }
517
- function Be(e, t) {
517
+ function Ze(e, t) {
518
518
  if (t == null || t === !1 || t === !0)
519
519
  return;
520
- t = le(t);
521
- const s = (st(t) ?? "").split(" ");
522
- for (let o of s)
520
+ t = de(t);
521
+ const i = (st(t) ?? "").split(" ");
522
+ for (let o of i)
523
523
  o && e.classList.remove(o);
524
524
  }
525
- function _e(e, t, s) {
525
+ function qe(e, t, i) {
526
526
  if (t == null || t === !1) {
527
- Be(e, s);
527
+ Ze(e, i);
528
528
  return;
529
529
  }
530
- s = le(s), zt(t) ? t = Array.from(t).map((o) => {
530
+ i = de(i), Ot(t) ? t = Array.from(t).map((o) => {
531
531
  let r = o;
532
532
  return Z(o) && nt(o, (h) => {
533
533
  if (h.isInitial) {
@@ -538,7 +538,7 @@ function _e(e, t, s) {
538
538
  }, {
539
539
  lifecycleNode: e
540
540
  }), r;
541
- }) : z(t) && (t = { ...t }, Object.entries(t).forEach(([o, r]) => {
541
+ }) : W(t) && (t = { ...t }, Object.entries(t).forEach(([o, r]) => {
542
542
  Z(r) && nt(r, (h) => {
543
543
  if (h.isInitial) {
544
544
  t[o] = h.newValue;
@@ -548,22 +548,22 @@ function _e(e, t, s) {
548
548
  }, {
549
549
  lifecycleNode: e
550
550
  });
551
- })), St(e, t, s);
551
+ })), St(e, t, i);
552
552
  }
553
- function St(e, t, s) {
553
+ function St(e, t, i) {
554
554
  const o = (st(t) ?? "").split(" ");
555
- if (s) {
556
- const r = (st(s) ?? "").split(" ");
555
+ if (i) {
556
+ const r = (st(i) ?? "").split(" ");
557
557
  for (let h of r)
558
558
  h && !o.includes(h) && e.classList.remove(h);
559
559
  }
560
560
  for (let r of o)
561
561
  r && e.classList.add(r);
562
562
  }
563
- function Ge(e, t) {
563
+ function Xe(e, t) {
564
564
  return e + t.charAt(0).toUpperCase() + t.substring(1);
565
565
  }
566
- var Ue = /* @__PURE__ */ (() => {
566
+ var Ye = /* @__PURE__ */ (() => {
567
567
  let e = {
568
568
  animationIterationCount: 0,
569
569
  borderImageOutset: 0,
@@ -610,51 +610,51 @@ var Ue = /* @__PURE__ */ (() => {
610
610
  strokeWidth: 0
611
611
  };
612
612
  const t = ["Webkit", "ms", "Moz", "O"];
613
- return Object.keys(e).forEach((s) => {
613
+ return Object.keys(e).forEach((i) => {
614
614
  t.forEach((o) => {
615
- e[Ge(o, s)] = 0;
615
+ e[Xe(o, i)] = 0;
616
616
  });
617
617
  }), e;
618
618
  })();
619
- function Mt(e, t, s) {
620
- t.indexOf("-") === 0 ? e.style.setProperty(t, s) : ae(s) && Ue[t] !== 0 ? e.style[t] = s + "px" : e.style[t] = s;
619
+ function Rt(e, t, i) {
620
+ t.indexOf("-") === 0 ? e.style.setProperty(t, i) : le(i) && Ye[t] !== 0 ? e.style[t] = i + "px" : e.style[t] = i;
621
621
  }
622
- function Xt(e, t) {
622
+ function Qt(e, t) {
623
623
  if (!(t == null || t === !1 || t === !0)) {
624
624
  if (vt(t)) {
625
625
  e.removeAttribute("style");
626
626
  return;
627
627
  }
628
- z(t) && Object.keys(t).forEach((s) => {
629
- Mt(e, s, "");
628
+ W(t) && Object.keys(t).forEach((i) => {
629
+ Rt(e, i, "");
630
630
  });
631
631
  }
632
632
  }
633
- function je(e, t, s) {
633
+ function Qe(e, t, i) {
634
634
  if (t == null || t === !1 || t === !0) {
635
- Xt(e, s);
635
+ Qt(e, i);
636
636
  return;
637
637
  }
638
638
  if (vt(t)) {
639
639
  e.setAttribute("style", t);
640
640
  return;
641
641
  }
642
- if (z(t)) {
643
- z(s) ? (t = { ...t }, Object.keys(s).forEach((o) => {
642
+ if (W(t)) {
643
+ W(i) ? (t = { ...t }, Object.keys(i).forEach((o) => {
644
644
  o in t || (t[o] = "");
645
- })) : Xt(e, s), Object.entries(t).forEach(([o, r]) => {
646
- Z(r) ? nt(r, (h) => Mt(e, o, h.newValue), {
645
+ })) : Qt(e, i), Object.entries(t).forEach(([o, r]) => {
646
+ Z(r) ? nt(r, (h) => Rt(e, o, h.newValue), {
647
647
  lifecycleNode: e
648
- }) : Mt(e, o, r);
648
+ }) : Rt(e, o, r);
649
649
  });
650
650
  return;
651
651
  }
652
652
  }
653
- var Ve = "http://www.w3.org/1999/xlink", Ze = "http://www.w3.org/XML/1998/namespace";
653
+ var Ke = "http://www.w3.org/1999/xlink", Je = "http://www.w3.org/XML/1998/namespace";
654
654
  function ht(e, t) {
655
- return e.replace(/[A-Z]/g, (s) => t + s.toLowerCase());
655
+ return e.replace(/[A-Z]/g, (i) => t + i.toLowerCase());
656
656
  }
657
- var qe = /* @__PURE__ */ new Map([
657
+ var ti = /* @__PURE__ */ new Map([
658
658
  ["autoComplete", "autocomplete"],
659
659
  ["autoFocus", "autofocus"],
660
660
  ["className", "class"],
@@ -673,58 +673,58 @@ var qe = /* @__PURE__ */ new Map([
673
673
  ["onDoubleClick", "onDblClick"],
674
674
  ["onDoubleClickCapture", "onDblClickCapture"]
675
675
  ]);
676
- function Yt(e, t, s, o) {
676
+ function Kt(e, t, i, o) {
677
677
  switch (t) {
678
678
  case "dataset":
679
679
  o != null && Object.entries(o).forEach(([h, u]) => {
680
680
  u != null && delete e.dataset[h];
681
- }), Object.entries(s).forEach(([h, u]) => {
681
+ }), Object.entries(i).forEach(([h, u]) => {
682
682
  u != null && (e.dataset[h] = u);
683
683
  });
684
684
  return;
685
685
  case "textContent":
686
- it(s) ? e[t] = s : it(o) && (e[t] = "");
686
+ it(i) ? e[t] = i : it(o) && (e[t] = "");
687
687
  return;
688
688
  case "dangerouslySetInnerHTML":
689
- z(s) ? e.innerHTML = s.__html : z(o) && (e.innerHTML = "");
689
+ W(i) ? e.innerHTML = i.__html : W(o) && (e.innerHTML = "");
690
690
  return;
691
691
  case "value":
692
- if (s == null) {
692
+ if (i == null) {
693
693
  o != null && (e[t] = null);
694
694
  return;
695
695
  } else {
696
696
  if (e instanceof window.HTMLSelectElement)
697
697
  return;
698
698
  if (e instanceof window.HTMLTextAreaElement) {
699
- e.value = s;
699
+ e.value = i;
700
700
  return;
701
701
  }
702
702
  }
703
703
  break;
704
704
  case "class":
705
- _e(e, s, o);
705
+ qe(e, i, o);
706
706
  return;
707
707
  case "spellcheck":
708
- e.spellcheck = s === "" || s === !0 || s === "true" ? !0 : s === !1 || s === "false" ? !1 : s;
708
+ e.spellcheck = i === "" || i === !0 || i === "true" ? !0 : i === !1 || i === "false" ? !1 : i;
709
709
  return;
710
710
  case "draggable":
711
- s === !1 || s === "false" ? s = "false" : s === "" ? s = null : (s === !0 || s === "true") && (s = "true");
711
+ i === !1 || i === "false" ? i = "false" : i === "" ? i = null : (i === !0 || i === "true") && (i = "true");
712
712
  break;
713
713
  case "contenteditable":
714
- s === !1 ? s = "false" : (s === "" || s === !0) && (s = "true");
714
+ i === !1 ? i = "false" : (i === "" || i === !0) && (i = "true");
715
715
  break;
716
716
  case "ref":
717
717
  case "namespaceURI":
718
718
  return;
719
719
  case "style":
720
- je(e, s, o);
720
+ Qe(e, i, o);
721
721
  return;
722
722
  case "on":
723
723
  case "onCapture":
724
724
  const r = t === "onCapture";
725
725
  o != null && Object.entries(o).forEach(([h, u]) => {
726
- (s == null || s[h] !== u) && e.removeEventListener(h, u, r);
727
- }), Object.entries(s).forEach(([h, u]) => {
726
+ (i == null || i[h] !== u) && e.removeEventListener(h, u, r);
727
+ }), Object.entries(i).forEach(([h, u]) => {
728
728
  (o == null || o[h] !== u) && e.addEventListener(h, u, r);
729
729
  });
730
730
  return;
@@ -735,84 +735,84 @@ function Yt(e, t, s, o) {
735
735
  case "xlinkShow":
736
736
  case "xlinkTitle":
737
737
  case "xlinkType":
738
- e.setAttributeNS(Ve, ht(t, ":"), s);
738
+ e.setAttributeNS(Ke, ht(t, ":"), i);
739
739
  return;
740
740
  case "xmlnsXlink":
741
- e.setAttribute("xmlns:xlink", s);
741
+ e.setAttribute("xmlns:xlink", i);
742
742
  return;
743
743
  case "xmlBase":
744
744
  case "xmlLang":
745
745
  case "xmlSpace":
746
- e.setAttributeNS(Ze, ht(t, ":"), s);
746
+ e.setAttributeNS(Je, ht(t, ":"), i);
747
747
  return;
748
748
  }
749
- if (typeof s == "function") {
749
+ if (typeof i == "function") {
750
750
  if (t[0] === "o" && t[1] === "n") {
751
- if (o != null && o === s)
751
+ if (o != null && o === i)
752
752
  return;
753
753
  let r = t.toLowerCase();
754
754
  const h = r.endsWith("capture");
755
755
  let u;
756
- !h && (e[r] === null || o != null && e[r] === o) ? (e[r] = s, kt(e, Ye.bind(e, r))) : h ? (u = r.substring(2, r.length - 7), o != null && e.removeEventListener(u, o, !0), e.addEventListener(u, s, !0)) : (r in window ? u = r.substring(2) : u = r[2] + t.slice(3), o != null && e.removeEventListener(u, o), e.addEventListener(u, s));
756
+ !h && (e[r] === null || o != null && e[r] === o) ? (e[r] = i, At(e, ii.bind(e, r))) : h ? (u = r.substring(2, r.length - 7), o != null && e.removeEventListener(u, o, !0), e.addEventListener(u, i, !0)) : (r in window ? u = r.substring(2) : u = r[2] + t.slice(3), o != null && e.removeEventListener(u, o), e.addEventListener(u, i));
757
757
  } else
758
- console.warn(`A function was provided for JSX ${e.tagName} element ${t} which does not start with "on":`, s, e.tagName);
758
+ console.warn(`A function was provided for JSX ${e.tagName} element ${t} which does not start with "on":`, i, e.tagName);
759
759
  return;
760
760
  }
761
- if (z(o)) {
762
- if (o === s)
761
+ if (W(o)) {
762
+ if (o === i)
763
763
  return;
764
764
  delete e[t];
765
765
  }
766
766
  if (o === !0) {
767
- if (o === s)
767
+ if (o === i)
768
768
  return;
769
769
  e.removeAttribute(t);
770
770
  }
771
771
  if (o !== !1 && o != null) {
772
- if (o === s)
772
+ if (o === i)
773
773
  return;
774
- e instanceof SVGElement && !Gt.test(t) ? e.removeAttributeNS(ht(t, "-"), s) : e.removeAttribute(t);
774
+ e instanceof SVGElement && !jt.test(t) ? e.removeAttributeNS(ht(t, "-"), i) : e.removeAttribute(t);
775
775
  }
776
- if (z(s)) {
777
- e[t] = s;
776
+ if (W(i)) {
777
+ e[t] = i;
778
778
  return;
779
779
  }
780
- if (s === !0) {
780
+ if (i === !0) {
781
781
  e.setAttribute(t, "");
782
782
  return;
783
783
  }
784
- s !== !1 && s != null && (e instanceof SVGElement && !Gt.test(t) ? e.setAttribute(ht(t, "-"), s) : e.setAttribute(t, s));
784
+ i !== !1 && i != null && (e instanceof SVGElement && !jt.test(t) ? e.setAttribute(ht(t, "-"), i) : e.setAttribute(t, i));
785
785
  }
786
- function Xe(e, t) {
787
- for (let [s, o] of Object.entries(t))
788
- s = qe.get(s) ?? s, Z(o) ? nt(o, (r) => Yt(e, s, r.newValue, r.prevValue), {
786
+ function ei(e, t) {
787
+ for (let [i, o] of Object.entries(t))
788
+ i = ti.get(i) ?? i, Z(o) ? nt(o, (r) => Kt(e, i, r.newValue, r.prevValue), {
789
789
  lifecycleNode: e
790
- }) : ke(o) ? o[re](e, s) : Yt(e, s, o);
790
+ }) : Re(o) ? o[he](e, i) : Kt(e, i, o);
791
791
  return e;
792
792
  }
793
- function Ye(e) {
793
+ function ii(e) {
794
794
  this[e] = null;
795
795
  }
796
- function p(e, t) {
797
- let { children: s, ...o } = t || {}, r = o.namespaceURI;
798
- r || (De.has(e) ? r = Re : Me.has(e) ? r = Ee : r = Ie());
796
+ function g(e, t) {
797
+ let { children: i, ...o } = t || {}, r = o.namespaceURI;
798
+ r || (Oe.has(e) ? r = We : Fe.has(e) ? r = ze : r = Ne());
799
799
  let h;
800
800
  if (vt(e)) {
801
- if (h = r ? document.createElementNS(r, e) : document.createElement(e), Xe(h, o), ut(h, s), h instanceof window.HTMLSelectElement && o.value != null)
801
+ if (h = r ? document.createElementNS(r, e) : document.createElement(e), ei(h, o), ut(h, i), h instanceof window.HTMLSelectElement && o.value != null)
802
802
  if (o.multiple === !0 && Array.isArray(o.value)) {
803
- const u = o.value.map((g) => String(g));
804
- h.querySelectorAll("option").forEach((g) => g.selected = u.includes(g.value));
803
+ const u = o.value.map((c) => String(c));
804
+ h.querySelectorAll("option").forEach((c) => c.selected = u.includes(c.value));
805
805
  } else
806
806
  h.value = o.value;
807
- Ft(o.ref, h);
807
+ Wt(o.ref, h);
808
808
  } else if (typeof e == "function")
809
- z(e.defaultProps) && (o = { ...e.defaultProps, ...o }), h = Ce(e) ? Ae(e, o, s) : e({ ...o, children: s });
809
+ W(e.defaultProps) && (o = { ...e.defaultProps, ...o }), h = De(e) ? Le(e, o, i) : e({ ...o, children: i });
810
810
  else
811
811
  throw new TypeError(`Invalid JSX element type: ${e}`);
812
812
  return h;
813
813
  }
814
- var Qe = /* @__PURE__ */ Symbol.for("preact-signals");
815
- function $t() {
814
+ var si = /* @__PURE__ */ Symbol.for("preact-signals");
815
+ function Ht() {
816
816
  if (V > 1)
817
817
  V--;
818
818
  else {
@@ -822,158 +822,158 @@ function $t() {
822
822
  for (pt = void 0; r !== void 0; )
823
823
  r.S.v === r.v && (r.S.i = r.i), r = r.o;
824
824
  }(); et !== void 0; ) {
825
- var s = et;
826
- for (et = void 0, gt++; s !== void 0; ) {
827
- var o = s.u;
828
- if (s.u = void 0, s.f &= -3, !(8 & s.f) && ue(s)) try {
829
- s.c();
825
+ var i = et;
826
+ for (et = void 0, gt++; i !== void 0; ) {
827
+ var o = i.u;
828
+ if (i.u = void 0, i.f &= -3, !(8 & i.f) && pe(i)) try {
829
+ i.c();
830
830
  } catch (r) {
831
831
  t || (e = r, t = !0);
832
832
  }
833
- s = o;
833
+ i = o;
834
834
  }
835
835
  }
836
836
  if (gt = 0, V--, t) throw e;
837
837
  }
838
838
  }
839
- var S = void 0;
840
- function ce(e) {
841
- var t = S;
842
- S = void 0;
839
+ var x = void 0;
840
+ function ue(e) {
841
+ var t = x;
842
+ x = void 0;
843
843
  try {
844
844
  return e();
845
845
  } finally {
846
- S = t;
846
+ x = t;
847
847
  }
848
848
  }
849
- var et = void 0, V = 0, gt = 0, Qt = 0, pt = void 0, ft = 0;
850
- function de(e) {
851
- if (S !== void 0) {
849
+ var et = void 0, V = 0, gt = 0, Jt = 0, pt = void 0, ft = 0;
850
+ function ge(e) {
851
+ if (x !== void 0) {
852
852
  var t = e.n;
853
- if (t === void 0 || t.t !== S)
854
- return t = { i: 0, S: e, p: S.s, n: void 0, t: S, e: void 0, x: void 0, r: t }, S.s !== void 0 && (S.s.n = t), S.s = t, e.n = t, 32 & S.f && e.S(t), t;
853
+ if (t === void 0 || t.t !== x)
854
+ return t = { i: 0, S: e, p: x.s, n: void 0, t: x, e: void 0, x: void 0, r: t }, x.s !== void 0 && (x.s.n = t), x.s = t, e.n = t, 32 & x.f && e.S(t), t;
855
855
  if (t.i === -1)
856
- return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = S.s, t.n = void 0, S.s.n = t, S.s = t), t;
856
+ return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = x.s, t.n = void 0, x.s.n = t, x.s = t), t;
857
857
  }
858
858
  }
859
- function L(e, t) {
859
+ function F(e, t) {
860
860
  this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
861
861
  }
862
- L.prototype.brand = Qe;
863
- L.prototype.h = function() {
862
+ F.prototype.brand = si;
863
+ F.prototype.h = function() {
864
864
  return !0;
865
865
  };
866
- L.prototype.S = function(e) {
867
- var t = this, s = this.t;
868
- s !== e && e.e === void 0 && (e.x = s, this.t = e, s !== void 0 ? s.e = e : ce(function() {
866
+ F.prototype.S = function(e) {
867
+ var t = this, i = this.t;
868
+ i !== e && e.e === void 0 && (e.x = i, this.t = e, i !== void 0 ? i.e = e : ue(function() {
869
869
  var o;
870
870
  (o = t.W) == null || o.call(t);
871
871
  }));
872
872
  };
873
- L.prototype.U = function(e) {
873
+ F.prototype.U = function(e) {
874
874
  var t = this;
875
875
  if (this.t !== void 0) {
876
- var s = e.e, o = e.x;
877
- s !== void 0 && (s.x = o, e.e = void 0), o !== void 0 && (o.e = s, e.x = void 0), e === this.t && (this.t = o, o === void 0 && ce(function() {
876
+ var i = e.e, o = e.x;
877
+ i !== void 0 && (i.x = o, e.e = void 0), o !== void 0 && (o.e = i, e.x = void 0), e === this.t && (this.t = o, o === void 0 && ue(function() {
878
878
  var r;
879
879
  (r = t.Z) == null || r.call(t);
880
880
  }));
881
881
  }
882
882
  };
883
- L.prototype.subscribe = function(e) {
883
+ F.prototype.subscribe = function(e) {
884
884
  var t = this;
885
- return Je(function() {
886
- var s = t.value, o = S;
887
- S = void 0;
885
+ return oi(function() {
886
+ var i = t.value, o = x;
887
+ x = void 0;
888
888
  try {
889
- e(s);
889
+ e(i);
890
890
  } finally {
891
- S = o;
891
+ x = o;
892
892
  }
893
893
  }, { name: "sub" });
894
894
  };
895
- L.prototype.valueOf = function() {
895
+ F.prototype.valueOf = function() {
896
896
  return this.value;
897
897
  };
898
- L.prototype.toString = function() {
898
+ F.prototype.toString = function() {
899
899
  return this.value + "";
900
900
  };
901
- L.prototype.toJSON = function() {
901
+ F.prototype.toJSON = function() {
902
902
  return this.value;
903
903
  };
904
- L.prototype.peek = function() {
905
- var e = S;
906
- S = void 0;
904
+ F.prototype.peek = function() {
905
+ var e = x;
906
+ x = void 0;
907
907
  try {
908
908
  return this.value;
909
909
  } finally {
910
- S = e;
910
+ x = e;
911
911
  }
912
912
  };
913
- Object.defineProperty(L.prototype, "value", { get: function() {
914
- var e = de(this);
913
+ Object.defineProperty(F.prototype, "value", { get: function() {
914
+ var e = ge(this);
915
915
  return e !== void 0 && (e.i = this.i), this.v;
916
916
  }, set: function(e) {
917
917
  if (e !== this.v) {
918
918
  if (gt > 100) throw new Error("Cycle detected");
919
- (function(s) {
920
- V !== 0 && gt === 0 && s.l !== Qt && (s.l = Qt, pt = { S: s, v: s.v, i: s.i, o: pt });
919
+ (function(i) {
920
+ V !== 0 && gt === 0 && i.l !== Jt && (i.l = Jt, pt = { S: i, v: i.v, i: i.i, o: pt });
921
921
  })(this), this.v = e, this.i++, ft++, V++;
922
922
  try {
923
923
  for (var t = this.t; t !== void 0; t = t.x) t.t.N();
924
924
  } finally {
925
- $t();
925
+ Ht();
926
926
  }
927
927
  }
928
928
  } });
929
- function ue(e) {
929
+ function pe(e) {
930
930
  for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
931
931
  return !1;
932
932
  }
933
- function ge(e) {
933
+ function fe(e) {
934
934
  for (var t = e.s; t !== void 0; t = t.n) {
935
- var s = t.S.n;
936
- if (s !== void 0 && (t.r = s), t.S.n = t, t.i = -1, t.n === void 0) {
935
+ var i = t.S.n;
936
+ if (i !== void 0 && (t.r = i), t.S.n = t, t.i = -1, t.n === void 0) {
937
937
  e.s = t;
938
938
  break;
939
939
  }
940
940
  }
941
941
  }
942
- function pe(e) {
943
- for (var t = e.s, s = void 0; t !== void 0; ) {
942
+ function me(e) {
943
+ for (var t = e.s, i = void 0; t !== void 0; ) {
944
944
  var o = t.p;
945
- t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : s = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
945
+ t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : i = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
946
946
  }
947
- e.s = s;
947
+ e.s = i;
948
948
  }
949
949
  function Y(e, t) {
950
- L.call(this, void 0), this.x = e, this.s = void 0, this.g = ft - 1, this.f = 4, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
950
+ F.call(this, void 0), this.x = e, this.s = void 0, this.g = ft - 1, this.f = 4, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
951
951
  }
952
- Y.prototype = new L();
952
+ Y.prototype = new F();
953
953
  Y.prototype.h = function() {
954
954
  if (this.f &= -3, 1 & this.f) return !1;
955
955
  if ((36 & this.f) == 32 || (this.f &= -5, this.g === ft)) return !0;
956
- if (this.g = ft, this.f |= 1, this.i > 0 && !ue(this))
956
+ if (this.g = ft, this.f |= 1, this.i > 0 && !pe(this))
957
957
  return this.f &= -2, !0;
958
- var e = S;
958
+ var e = x;
959
959
  try {
960
- ge(this), S = this;
960
+ fe(this), x = this;
961
961
  var t = this.x();
962
962
  (16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
963
- } catch (s) {
964
- this.v = s, this.f |= 16, this.i++;
963
+ } catch (i) {
964
+ this.v = i, this.f |= 16, this.i++;
965
965
  }
966
- return S = e, pe(this), this.f &= -2, !0;
966
+ return x = e, me(this), this.f &= -2, !0;
967
967
  };
968
968
  Y.prototype.S = function(e) {
969
969
  if (this.t === void 0) {
970
970
  this.f |= 36;
971
971
  for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
972
972
  }
973
- L.prototype.S.call(this, e);
973
+ F.prototype.S.call(this, e);
974
974
  };
975
975
  Y.prototype.U = function(e) {
976
- if (this.t !== void 0 && (L.prototype.U.call(this, e), this.t === void 0)) {
976
+ if (this.t !== void 0 && (F.prototype.U.call(this, e), this.t === void 0)) {
977
977
  this.f &= -33;
978
978
  for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
979
979
  }
@@ -986,32 +986,32 @@ Y.prototype.N = function() {
986
986
  };
987
987
  Object.defineProperty(Y.prototype, "value", { get: function() {
988
988
  if (1 & this.f) throw new Error("Cycle detected");
989
- var e = de(this);
989
+ var e = ge(this);
990
990
  if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
991
991
  return this.v;
992
992
  } });
993
- function fe(e) {
993
+ function we(e) {
994
994
  var t = e.m;
995
995
  if (e.m = void 0, typeof t == "function") {
996
996
  V++;
997
- var s = S;
998
- S = void 0;
997
+ var i = x;
998
+ x = void 0;
999
999
  try {
1000
1000
  t();
1001
1001
  } catch (o) {
1002
- throw e.f &= -2, e.f |= 8, Ht(e), o;
1002
+ throw e.f &= -2, e.f |= 8, Bt(e), o;
1003
1003
  } finally {
1004
- S = s, $t();
1004
+ x = i, Ht();
1005
1005
  }
1006
1006
  }
1007
1007
  }
1008
- function Ht(e) {
1008
+ function Bt(e) {
1009
1009
  for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
1010
- e.x = void 0, e.s = void 0, fe(e);
1010
+ e.x = void 0, e.s = void 0, we(e);
1011
1011
  }
1012
- function Ke(e) {
1013
- if (S !== this) throw new Error("Out-of-order effect");
1014
- pe(this), S = e, this.f &= -2, 8 & this.f && Ht(this), $t();
1012
+ function ni(e) {
1013
+ if (x !== this) throw new Error("Out-of-order effect");
1014
+ me(this), x = e, this.f &= -2, 8 & this.f && Bt(this), Ht();
1015
1015
  }
1016
1016
  function Q(e, t) {
1017
1017
  this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t == null ? void 0 : t.name;
@@ -1028,30 +1028,30 @@ Q.prototype.c = function() {
1028
1028
  };
1029
1029
  Q.prototype.S = function() {
1030
1030
  if (1 & this.f) throw new Error("Cycle detected");
1031
- this.f |= 1, this.f &= -9, fe(this), ge(this), V++;
1032
- var e = S;
1033
- return S = this, Ke.bind(this, e);
1031
+ this.f |= 1, this.f &= -9, we(this), fe(this), V++;
1032
+ var e = x;
1033
+ return x = this, ni.bind(this, e);
1034
1034
  };
1035
1035
  Q.prototype.N = function() {
1036
1036
  2 & this.f || (this.f |= 2, this.u = et, et = this);
1037
1037
  };
1038
1038
  Q.prototype.d = function() {
1039
- this.f |= 8, 1 & this.f || Ht(this);
1039
+ this.f |= 8, 1 & this.f || Bt(this);
1040
1040
  };
1041
1041
  Q.prototype.dispose = function() {
1042
1042
  this.d();
1043
1043
  };
1044
- function Je(e, t) {
1045
- var s = new Q(e, t);
1044
+ function oi(e, t) {
1045
+ var i = new Q(e, t);
1046
1046
  try {
1047
- s.c();
1047
+ i.c();
1048
1048
  } catch (r) {
1049
- throw s.d(), r;
1049
+ throw i.d(), r;
1050
1050
  }
1051
- var o = s.d.bind(s);
1051
+ var o = i.d.bind(i);
1052
1052
  return o[Symbol.dispose] = o, o;
1053
1053
  }
1054
- const ti = {
1054
+ const ri = {
1055
1055
  emptyStateTitle: "No data available.",
1056
1056
  thumbnails: "Thumbnails",
1057
1057
  singlePageMode: "Single Page Mode",
@@ -1064,8 +1064,9 @@ const ti = {
1064
1064
  settings: "Settings",
1065
1065
  downloadCatalog: "Download Catalog",
1066
1066
  play: "Play",
1067
- pause: "Pause"
1068
- }, ei = {
1067
+ pause: "Pause",
1068
+ tableOfContents: "Table of Contents"
1069
+ }, ai = {
1069
1070
  emptyStateTitle: "Veri bulunamadi.",
1070
1071
  thumbnails: "Küçük Resimler",
1071
1072
  singlePageMode: "Tek Sayfa Modu",
@@ -1078,25 +1079,26 @@ const ti = {
1078
1079
  settings: "Ayarlar",
1079
1080
  downloadCatalog: "Kataloğu İndir",
1080
1081
  play: "Otomatik Oynat",
1081
- pause: "Duraklat"
1082
- }, Ct = {
1083
- en: ti,
1084
- tr: ei
1082
+ pause: "Duraklat",
1083
+ tableOfContents: "İçindekiler"
1084
+ }, Tt = {
1085
+ en: ri,
1086
+ tr: ai
1085
1087
  };
1086
- function ii(e = {}) {
1088
+ function ve(e = {}) {
1087
1089
  var r;
1088
- const t = e.locale ?? "en", s = Ct[t] ?? Ct.en, o = ((r = e.messages) == null ? void 0 : r[t]) ?? {};
1090
+ const t = e.locale ?? "en", i = Tt[t] ?? Tt.en, o = ((r = e.messages) == null ? void 0 : r[t]) ?? {};
1089
1091
  return {
1090
- ...Ct.en,
1091
- ...s,
1092
+ ...Tt.en,
1093
+ ...i,
1092
1094
  ...o
1093
1095
  };
1094
1096
  }
1095
- function si(e) {
1096
- const t = w(() => ii({ locale: e.store.locale.value, messages: e.store.messages.value }));
1097
- return /* @__PURE__ */ p("div", { class: "bk-toolbar", role: "toolbar", "aria-label": "Flipbook controls", children: [
1098
- /* @__PURE__ */ p("div", { class: "bk-btn-group", children: [
1099
- /* @__PURE__ */ p(
1097
+ function hi(e) {
1098
+ const t = w(() => ve({ locale: e.store.locale.value, messages: e.store.messages.value }));
1099
+ return /* @__PURE__ */ g("div", { class: "bk-toolbar", role: "toolbar", "aria-label": "Flipbook controls", children: [
1100
+ /* @__PURE__ */ g("div", { class: "bk-btn-group", children: [
1101
+ /* @__PURE__ */ g(
1100
1102
  "button",
1101
1103
  {
1102
1104
  type: "button",
@@ -1105,15 +1107,34 @@ function si(e) {
1105
1107
  "aria-label": w(() => t.value.thumbnails || "Thumbnails"),
1106
1108
  "aria-pressed": w(() => e.store.showThumbs.value ? "true" : "false"),
1107
1109
  title: w(() => t.value.thumbnails || "Thumbnails"),
1108
- children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1109
- /* @__PURE__ */ p("rect", { x: "3", y: "3", width: "7", height: "7" }),
1110
- /* @__PURE__ */ p("rect", { x: "14", y: "3", width: "7", height: "7" }),
1111
- /* @__PURE__ */ p("rect", { x: "14", y: "14", width: "7", height: "7" }),
1112
- /* @__PURE__ */ p("rect", { x: "3", y: "14", width: "7", height: "7" })
1110
+ children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1111
+ /* @__PURE__ */ g("rect", { x: "3", y: "3", width: "7", height: "7" }),
1112
+ /* @__PURE__ */ g("rect", { x: "14", y: "3", width: "7", height: "7" }),
1113
+ /* @__PURE__ */ g("rect", { x: "14", y: "14", width: "7", height: "7" }),
1114
+ /* @__PURE__ */ g("rect", { x: "3", y: "14", width: "7", height: "7" })
1113
1115
  ] })
1114
1116
  }
1115
1117
  ),
1116
- /* @__PURE__ */ p(
1118
+ w(() => e.store.toc.value.length ? /* @__PURE__ */ g(
1119
+ "button",
1120
+ {
1121
+ type: "button",
1122
+ class: w(() => e.store.showToc.value ? "bk-btn active" : "bk-btn"),
1123
+ onClick: e.onToggleToc,
1124
+ "aria-label": w(() => t.value.tableOfContents || "Table of Contents"),
1125
+ "aria-pressed": w(() => e.store.showToc.value ? "true" : "false"),
1126
+ title: w(() => t.value.tableOfContents || "Table of Contents"),
1127
+ children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1128
+ /* @__PURE__ */ g("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
1129
+ /* @__PURE__ */ g("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
1130
+ /* @__PURE__ */ g("line", { x1: "8", y1: "18", x2: "21", y2: "18" }),
1131
+ /* @__PURE__ */ g("line", { x1: "3", y1: "6", x2: "3.01", y2: "6" }),
1132
+ /* @__PURE__ */ g("line", { x1: "3", y1: "12", x2: "3.01", y2: "12" }),
1133
+ /* @__PURE__ */ g("line", { x1: "3", y1: "18", x2: "3.01", y2: "18" })
1134
+ ] })
1135
+ }
1136
+ ) : null),
1137
+ /* @__PURE__ */ g(
1117
1138
  "button",
1118
1139
  {
1119
1140
  type: "button",
@@ -1122,16 +1143,16 @@ function si(e) {
1122
1143
  "aria-label": w(() => t.value.singlePageMode || "Single Page"),
1123
1144
  "aria-pressed": w(() => e.store.isSingleMode.value ? "true" : "false"),
1124
1145
  title: w(() => t.value.singlePageMode || "Single Page"),
1125
- children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1126
- /* @__PURE__ */ p("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1127
- /* @__PURE__ */ p("polyline", { points: "14 2 14 8 20 8" }),
1128
- /* @__PURE__ */ p("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1129
- /* @__PURE__ */ p("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1130
- /* @__PURE__ */ p("polyline", { points: "10 9 9 9 8 9" })
1146
+ children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1147
+ /* @__PURE__ */ g("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1148
+ /* @__PURE__ */ g("polyline", { points: "14 2 14 8 20 8" }),
1149
+ /* @__PURE__ */ g("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1150
+ /* @__PURE__ */ g("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1151
+ /* @__PURE__ */ g("polyline", { points: "10 9 9 9 8 9" })
1131
1152
  ] })
1132
1153
  }
1133
1154
  ),
1134
- /* @__PURE__ */ p(
1155
+ /* @__PURE__ */ g(
1135
1156
  "button",
1136
1157
  {
1137
1158
  type: "button",
@@ -1141,34 +1162,34 @@ function si(e) {
1141
1162
  "aria-pressed": w(() => e.store.isAutoPlaying.value ? "true" : "false"),
1142
1163
  title: w(() => e.store.isAutoPlaying.value ? t.value.pause || "Pause" : t.value.play || "Play"),
1143
1164
  children: [
1144
- /* @__PURE__ */ p("svg", { style: { display: w(() => e.store.isAutoPlaying.value ? "block" : "none") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1145
- /* @__PURE__ */ p("rect", { x: "6", y: "4", width: "4", height: "16" }),
1146
- /* @__PURE__ */ p("rect", { x: "14", y: "4", width: "4", height: "16" })
1165
+ /* @__PURE__ */ g("svg", { style: { display: w(() => e.store.isAutoPlaying.value ? "block" : "none") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1166
+ /* @__PURE__ */ g("rect", { x: "6", y: "4", width: "4", height: "16" }),
1167
+ /* @__PURE__ */ g("rect", { x: "14", y: "4", width: "4", height: "16" })
1147
1168
  ] }),
1148
- /* @__PURE__ */ p("svg", { style: { display: w(() => e.store.isAutoPlaying.value ? "none" : "block") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ p("polygon", { points: "5 3 19 12 5 21 5 3" }) })
1169
+ /* @__PURE__ */ g("svg", { style: { display: w(() => e.store.isAutoPlaying.value ? "none" : "block") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("polygon", { points: "5 3 19 12 5 21 5 3" }) })
1149
1170
  ]
1150
1171
  }
1151
1172
  )
1152
1173
  ] }),
1153
- /* @__PURE__ */ p("div", { class: "bk-btn-group bk-btn-group--center", children: [
1154
- /* @__PURE__ */ p("button", { type: "button", class: "bk-btn", onClick: e.onPrevPage, "aria-label": w(() => t.value.previous || "Previous"), title: w(() => t.value.previous || "Previous"), children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ p("polyline", { points: "15 18 9 12 15 6" }) }) }),
1155
- /* @__PURE__ */ p("span", { class: "bz-page-info", "aria-live": "polite", "aria-atomic": "true", children: w(() => {
1156
- const s = e.store.currentPage.value, o = e.store.totalPages.value;
1157
- if (e.store.isSingleMode.value || s === 0 || s >= o - 1)
1158
- return `${s + 1} / ${o}`;
1159
- const r = s % 2 === 1 ? s : s - 1;
1174
+ /* @__PURE__ */ g("div", { class: "bk-btn-group bk-btn-group--center", children: [
1175
+ /* @__PURE__ */ g("button", { type: "button", class: "bk-btn", onClick: e.onPrevPage, "aria-label": w(() => t.value.previous || "Previous"), title: w(() => t.value.previous || "Previous"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" }) }) }),
1176
+ /* @__PURE__ */ g("span", { class: "bz-page-info", "aria-live": "polite", "aria-atomic": "true", children: w(() => {
1177
+ const i = e.store.currentPage.value, o = e.store.totalPages.value;
1178
+ if (e.store.isSingleMode.value || i === 0 || i >= o - 1)
1179
+ return `${i + 1} / ${o}`;
1180
+ const r = i % 2 === 1 ? i : i - 1;
1160
1181
  return `${r + 1}-${r + 2} / ${o}`;
1161
1182
  }) }),
1162
- /* @__PURE__ */ p("button", { type: "button", class: "bk-btn", onClick: e.onNextPage, "aria-label": w(() => t.value.next || "Next"), title: w(() => t.value.next || "Next"), children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ p("polyline", { points: "9 18 15 12 9 6" }) }) })
1183
+ /* @__PURE__ */ g("button", { type: "button", class: "bk-btn", onClick: e.onNextPage, "aria-label": w(() => t.value.next || "Next"), title: w(() => t.value.next || "Next"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("polyline", { points: "9 18 15 12 9 6" }) }) })
1163
1184
  ] }),
1164
- /* @__PURE__ */ p("div", { class: "bk-btn-group", children: [
1165
- /* @__PURE__ */ p("button", { type: "button", class: "bk-btn", onClick: e.onZoomIn, "aria-label": w(() => t.value.zoomIn || "Zoom In"), title: w(() => t.value.zoomIn || "Zoom In"), children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1166
- /* @__PURE__ */ p("circle", { cx: "11", cy: "11", r: "8" }),
1167
- /* @__PURE__ */ p("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1168
- /* @__PURE__ */ p("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
1169
- /* @__PURE__ */ p("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1185
+ /* @__PURE__ */ g("div", { class: "bk-btn-group", children: [
1186
+ /* @__PURE__ */ g("button", { type: "button", class: "bk-btn", onClick: e.onZoomIn, "aria-label": w(() => t.value.zoomIn || "Zoom In"), title: w(() => t.value.zoomIn || "Zoom In"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1187
+ /* @__PURE__ */ g("circle", { cx: "11", cy: "11", r: "8" }),
1188
+ /* @__PURE__ */ g("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1189
+ /* @__PURE__ */ g("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
1190
+ /* @__PURE__ */ g("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1170
1191
  ] }) }),
1171
- /* @__PURE__ */ p(
1192
+ /* @__PURE__ */ g(
1172
1193
  "button",
1173
1194
  {
1174
1195
  type: "button",
@@ -1176,20 +1197,20 @@ function si(e) {
1176
1197
  onClick: e.onZoomOut,
1177
1198
  "aria-label": w(() => t.value.zoomOut || "Zoom Out"),
1178
1199
  title: w(() => t.value.zoomOut || "Zoom Out"),
1179
- children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1180
- /* @__PURE__ */ p("circle", { cx: "11", cy: "11", r: "8" }),
1181
- /* @__PURE__ */ p("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1182
- /* @__PURE__ */ p("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1200
+ children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1201
+ /* @__PURE__ */ g("circle", { cx: "11", cy: "11", r: "8" }),
1202
+ /* @__PURE__ */ g("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1203
+ /* @__PURE__ */ g("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1183
1204
  ] })
1184
1205
  }
1185
1206
  ),
1186
- /* @__PURE__ */ p("button", { type: "button", class: "bk-btn bk-btn--fullscreen", onClick: e.onToggleFullscreen, "aria-label": w(() => t.value.fullscreen || "Fullscreen"), title: w(() => t.value.fullscreen || "Fullscreen"), children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ p("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) }) }),
1187
- w(() => e.store.allowDownload.value && e.store.hasDownloadUrl.value && e.onDownload ? /* @__PURE__ */ p("button", { type: "button", class: "bk-btn bk-btn--download", onClick: e.onDownload, "aria-label": w(() => t.value.downloadCatalog || "Download"), title: w(() => t.value.downloadCatalog || "Download"), children: /* @__PURE__ */ p("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1188
- /* @__PURE__ */ p("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1189
- /* @__PURE__ */ p("polyline", { points: "7 10 12 15 17 10" }),
1190
- /* @__PURE__ */ p("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
1207
+ /* @__PURE__ */ g("button", { type: "button", class: "bk-btn bk-btn--fullscreen", onClick: e.onToggleFullscreen, "aria-label": w(() => t.value.fullscreen || "Fullscreen"), title: w(() => t.value.fullscreen || "Fullscreen"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) }) }),
1208
+ w(() => e.store.allowDownload.value && e.store.hasDownloadUrl.value && e.onDownload ? /* @__PURE__ */ g("button", { type: "button", class: "bk-btn bk-btn--download", onClick: e.onDownload, "aria-label": w(() => t.value.downloadCatalog || "Download"), title: w(() => t.value.downloadCatalog || "Download"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1209
+ /* @__PURE__ */ g("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1210
+ /* @__PURE__ */ g("polyline", { points: "7 10 12 15 17 10" }),
1211
+ /* @__PURE__ */ g("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
1191
1212
  ] }) }) : null),
1192
- /* @__PURE__ */ p(
1213
+ /* @__PURE__ */ g(
1193
1214
  "button",
1194
1215
  {
1195
1216
  type: "button",
@@ -1199,15 +1220,15 @@ function si(e) {
1199
1220
  "aria-pressed": w(() => e.store.soundEnabled.value ? "true" : "false"),
1200
1221
  title: "Sound",
1201
1222
  children: [
1202
- /* @__PURE__ */ p("svg", { style: { display: w(() => e.store.soundEnabled.value ? "block" : "none") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1203
- /* @__PURE__ */ p("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1204
- /* @__PURE__ */ p("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
1205
- /* @__PURE__ */ p("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
1223
+ /* @__PURE__ */ g("svg", { style: { display: w(() => e.store.soundEnabled.value ? "block" : "none") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1224
+ /* @__PURE__ */ g("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1225
+ /* @__PURE__ */ g("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
1226
+ /* @__PURE__ */ g("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
1206
1227
  ] }),
1207
- /* @__PURE__ */ p("svg", { style: { display: w(() => e.store.soundEnabled.value ? "none" : "block") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1208
- /* @__PURE__ */ p("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1209
- /* @__PURE__ */ p("line", { x1: "23", y1: "9", x2: "17", y2: "15" }),
1210
- /* @__PURE__ */ p("line", { x1: "17", y1: "9", x2: "23", y2: "15" })
1228
+ /* @__PURE__ */ g("svg", { style: { display: w(() => e.store.soundEnabled.value ? "none" : "block") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
1229
+ /* @__PURE__ */ g("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1230
+ /* @__PURE__ */ g("line", { x1: "23", y1: "9", x2: "17", y2: "15" }),
1231
+ /* @__PURE__ */ g("line", { x1: "17", y1: "9", x2: "23", y2: "15" })
1211
1232
  ] })
1212
1233
  ]
1213
1234
  }
@@ -1215,49 +1236,85 @@ function si(e) {
1215
1236
  ] })
1216
1237
  ] });
1217
1238
  }
1218
- function ni(e) {
1219
- return /* @__PURE__ */ p("div", { class: "bk-thumbs", style: w(() => e.store.showThumbs.value ? "display:flex;" : "display:none;"), children: e.store.pages.value.map((t, s) => {
1239
+ function li(e) {
1240
+ return /* @__PURE__ */ g("div", { class: "bk-thumbs", style: w(() => e.store.showThumbs.value ? "display:flex;" : "display:none;"), children: e.store.pages.value.map((t, i) => {
1220
1241
  const o = () => {
1221
1242
  const r = e.store.currentPage.value;
1222
1243
  if (e.store.isSingleMode.value || r === 0 || r >= e.store.pages.value.length - 1)
1223
- return r === s;
1244
+ return r === i;
1224
1245
  const h = r % 2 === 1 ? r : r - 1;
1225
- return s === h || s === h + 1;
1246
+ return i === h || i === h + 1;
1226
1247
  };
1227
- return /* @__PURE__ */ p(
1248
+ return /* @__PURE__ */ g(
1228
1249
  "div",
1229
1250
  {
1230
1251
  class: w(() => `thumb-item ${o() ? "active" : ""}`),
1231
1252
  role: "button",
1232
1253
  tabindex: "0",
1233
- "aria-label": `Go to page ${s + 1}`,
1254
+ "aria-label": `Go to page ${i + 1}`,
1234
1255
  "aria-current": w(() => o() ? "page" : void 0),
1235
- onClick: () => e.onThumbClick(s),
1256
+ onClick: () => e.onThumbClick(i),
1236
1257
  onKeyDown: (r) => {
1237
- (r.key === "Enter" || r.key === " ") && (r.preventDefault(), e.onThumbClick(s));
1258
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), e.onThumbClick(i));
1238
1259
  },
1239
- children: [
1240
- /* @__PURE__ */ p("div", { class: "thumb-img-wrapper", children: /* @__PURE__ */ p(
1260
+ children: /* @__PURE__ */ g("div", { class: "thumb-img-wrapper", children: [
1261
+ /* @__PURE__ */ g(
1241
1262
  "img",
1242
1263
  {
1243
- "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
1244
- class: "thumb-img",
1264
+ "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.sourcePageNumber ?? t.pageNumber : void 0,
1265
+ class: `thumb-img ${t.cropMode !== "full" ? "thumb-img--split thumb-img--" + t.cropMode : ""}`,
1245
1266
  src: t.thumb || t.low || t.normal,
1246
- alt: `Page ${s + 1}`,
1267
+ alt: `Page ${i + 1}`,
1247
1268
  loading: "lazy",
1248
1269
  onError: (r) => {
1249
1270
  r.currentTarget.style.display = "none";
1250
1271
  }
1251
1272
  }
1252
- ) }),
1253
- /* @__PURE__ */ p("span", { children: s + 1 })
1254
- ]
1273
+ ),
1274
+ /* @__PURE__ */ g("span", { class: "thumb-page-number", children: i + 1 })
1275
+ ] })
1255
1276
  }
1256
1277
  );
1257
1278
  }) });
1258
1279
  }
1259
- function oi(e) {
1260
- return /* @__PURE__ */ p(
1280
+ function ye(e, t, i) {
1281
+ return /* @__PURE__ */ g("ol", { class: "bk-toc-list", children: e.map((o) => {
1282
+ var r;
1283
+ return /* @__PURE__ */ g("li", { class: "bk-toc-item", children: [
1284
+ /* @__PURE__ */ g(
1285
+ "button",
1286
+ {
1287
+ type: "button",
1288
+ class: w(() => t.currentPage.value === o.pageIndex ? "bk-toc-entry active" : "bk-toc-entry"),
1289
+ "aria-current": w(() => t.currentPage.value === o.pageIndex ? "page" : void 0),
1290
+ onClick: () => i(o.pageIndex),
1291
+ children: [
1292
+ /* @__PURE__ */ g("span", { class: "bk-toc-title", children: o.title }),
1293
+ /* @__PURE__ */ g("span", { class: "bk-toc-page", children: o.pageIndex + 1 })
1294
+ ]
1295
+ }
1296
+ ),
1297
+ (r = o.children) != null && r.length ? ye(o.children, t, i) : null
1298
+ ] });
1299
+ }) });
1300
+ }
1301
+ function ci(e) {
1302
+ const t = w(() => ve({ locale: e.store.locale.value, messages: e.store.messages.value }));
1303
+ return /* @__PURE__ */ g(
1304
+ "nav",
1305
+ {
1306
+ class: "bk-toc",
1307
+ "aria-label": w(() => t.value.tableOfContents || "Table of Contents"),
1308
+ style: w(() => e.store.showToc.value && e.store.toc.value.length ? "display:flex;" : "display:none;"),
1309
+ children: [
1310
+ /* @__PURE__ */ g("div", { class: "bk-toc-heading", children: w(() => t.value.tableOfContents || "Table of Contents") }),
1311
+ ye(e.store.toc.value, e.store, e.onEntryClick)
1312
+ ]
1313
+ }
1314
+ );
1315
+ }
1316
+ function di(e) {
1317
+ return /* @__PURE__ */ g(
1261
1318
  "div",
1262
1319
  {
1263
1320
  role: "region",
@@ -1267,56 +1324,56 @@ function oi(e) {
1267
1324
  return e.store.isDoublePageLayout.value && (t += "double-mode "), e.store.isFrontCover.value && (t += "bk-is-cover "), e.store.isBackCover.value && (t += "bk-is-back-cover "), e.store.zoomState.value.isActive && (t += "zoomed "), t.trim();
1268
1325
  }),
1269
1326
  ref: e.bookWrapperRef,
1270
- children: /* @__PURE__ */ p(
1327
+ children: /* @__PURE__ */ g(
1271
1328
  "div",
1272
1329
  {
1273
1330
  class: "bk-book-sizer",
1274
1331
  ref: e.bookSizerRef,
1275
1332
  children: [
1276
- /* @__PURE__ */ p(
1333
+ /* @__PURE__ */ g(
1277
1334
  "div",
1278
1335
  {
1279
1336
  ref: e.bookContainerRef,
1280
1337
  class: w(() => "bk-book " + (e.store.flipState.value !== "read" ? "is-flipping" : "")),
1281
1338
  style: w(() => `display: ${e.store.isSingleMode.value ? "none" : "block"};`),
1282
- children: e.store.pages.value.map((t, s) => {
1283
- const o = s === 0 || s === e.store.pages.value.length - 1;
1284
- return /* @__PURE__ */ p(
1339
+ children: e.store.pages.value.map((t, i) => {
1340
+ const o = i === 0 || i === e.store.pages.value.length - 1;
1341
+ return /* @__PURE__ */ g(
1285
1342
  "div",
1286
1343
  {
1287
- class: `bz-page ${s === 0 ? "bz-page--cover" : ""} ${s === e.store.pages.value.length - 1 ? "bz-page--back" : ""}`,
1344
+ class: `bz-page ${i === 0 ? "bz-page--cover" : ""} ${i === e.store.pages.value.length - 1 ? "bz-page--back" : ""}`,
1288
1345
  "data-density": o ? "hard" : "soft",
1289
- "data-idx": s,
1290
- children: /* @__PURE__ */ p("div", { class: "bz-page-content", style: "position:relative; width:100%; height:100%; overflow:hidden;", children: [
1291
- /* @__PURE__ */ p(
1346
+ "data-idx": i,
1347
+ children: /* @__PURE__ */ g("div", { class: "bz-page-content", style: "position:relative; width:100%; height:100%; overflow:hidden;", children: [
1348
+ /* @__PURE__ */ g(
1292
1349
  "img",
1293
1350
  {
1294
- "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
1351
+ "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.sourcePageNumber ?? t.pageNumber : void 0,
1295
1352
  src: t.low || t.normal,
1296
1353
  "data-src": t.normal,
1297
1354
  class: `page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
1298
- alt: `Page ${s + 1}`,
1355
+ alt: `Page ${i + 1}`,
1299
1356
  loading: "lazy"
1300
1357
  }
1301
1358
  ),
1302
- /* @__PURE__ */ p("div", { class: "page-shadow" })
1359
+ /* @__PURE__ */ g("div", { class: "page-shadow" })
1303
1360
  ] })
1304
1361
  }
1305
1362
  );
1306
1363
  })
1307
1364
  }
1308
1365
  ),
1309
- /* @__PURE__ */ p(
1366
+ /* @__PURE__ */ g(
1310
1367
  "div",
1311
1368
  {
1312
1369
  class: "bk-single-view",
1313
1370
  style: w(() => `display: ${e.store.isSingleMode.value ? "flex" : "none"}; width: 100%; height: 100%; justify-content: center; align-items: center; position: absolute; top: 0; left: 0; z-index: 10;`),
1314
1371
  children: w(() => {
1315
1372
  const t = e.store.pages.value[e.store.currentPage.value];
1316
- return t ? /* @__PURE__ */ p(
1373
+ return t ? /* @__PURE__ */ g(
1317
1374
  "img",
1318
1375
  {
1319
- "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
1376
+ "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.sourcePageNumber ?? t.pageNumber : void 0,
1320
1377
  class: `bk-single-img page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
1321
1378
  src: e.store.zoomState.value.isActive ? t.normal : t.low || t.normal,
1322
1379
  alt: `Page ${e.store.currentPage.value + 1}`,
@@ -1332,10 +1389,10 @@ function oi(e) {
1332
1389
  }
1333
1390
  );
1334
1391
  }
1335
- function ri(e) {
1336
- const t = w(() => e.store.showArrows.value && e.store.currentPage.value > 0), s = w(() => !e.store.showArrows.value || e.store.totalPages.value <= 1 ? !1 : e.store.currentPage.value < e.store.totalPages.value - 1);
1337
- return /* @__PURE__ */ p("div", { class: "bk-nav-arrows", style: w(() => e.store.showArrows.value ? "display: flex;" : "display: none;"), children: [
1338
- /* @__PURE__ */ p(
1392
+ function ui(e) {
1393
+ const t = w(() => e.store.showArrows.value && e.store.currentPage.value > 0), i = w(() => !e.store.showArrows.value || e.store.totalPages.value <= 1 ? !1 : e.store.currentPage.value < e.store.totalPages.value - 1);
1394
+ return /* @__PURE__ */ g("div", { class: "bk-nav-arrows", style: w(() => e.store.showArrows.value ? "display: flex;" : "display: none;"), children: [
1395
+ /* @__PURE__ */ g(
1339
1396
  "button",
1340
1397
  {
1341
1398
  type: "button",
@@ -1345,55 +1402,59 @@ function ri(e) {
1345
1402
  o.preventDefault(), e.onPrevPage();
1346
1403
  },
1347
1404
  "aria-label": "Previous Page",
1348
- children: /* @__PURE__ */ p("div", { class: "bk-arrow-icon bk-arrow-left" })
1405
+ children: /* @__PURE__ */ g("div", { class: "bk-arrow-icon bk-arrow-left" })
1349
1406
  }
1350
1407
  ),
1351
- /* @__PURE__ */ p(
1408
+ /* @__PURE__ */ g(
1352
1409
  "button",
1353
1410
  {
1354
1411
  type: "button",
1355
1412
  class: "bk-nav-arrow bk-nav-next",
1356
- style: w(() => s.value ? "visibility: visible;" : "visibility: hidden;"),
1413
+ style: w(() => i.value ? "visibility: visible;" : "visibility: hidden;"),
1357
1414
  onClick: (o) => {
1358
1415
  o.preventDefault(), e.onNextPage();
1359
1416
  },
1360
1417
  "aria-label": "Next Page",
1361
- children: /* @__PURE__ */ p("div", { class: "bk-arrow-icon bk-arrow-right" })
1418
+ children: /* @__PURE__ */ g("div", { class: "bk-arrow-icon bk-arrow-right" })
1362
1419
  }
1363
1420
  )
1364
1421
  ] });
1365
1422
  }
1366
- function ai(e) {
1423
+ function gi(e) {
1367
1424
  const t = () => {
1368
1425
  e.store.showThumbs.value = !e.store.showThumbs.value;
1369
- }, s = () => {
1370
- e.store.isSingleMode.value = !e.store.isSingleMode.value;
1426
+ }, i = () => {
1427
+ e.store.showToc.value = !e.store.showToc.value;
1371
1428
  }, o = () => {
1372
- e.store.isAutoPlaying.value = !e.store.isAutoPlaying.value;
1429
+ e.store.isSingleMode.value = !e.store.isSingleMode.value;
1373
1430
  }, r = () => {
1374
- var b;
1375
- (b = e.interactionManagerRef.current) == null || b.zoomIn();
1431
+ e.store.isAutoPlaying.value = !e.store.isAutoPlaying.value;
1376
1432
  }, h = () => {
1377
- var b;
1378
- (b = e.interactionManagerRef.current) == null || b.zoomOut();
1379
- }, u = () => e.onToggleFullscreen(), g = (b) => {
1380
- var D;
1381
- e.store.currentPage.value !== b && (e.store.currentPage.value = b, (D = e.pageFlipAdapterRef.current) == null || D.playSound());
1382
- }, x = () => {
1383
- var b;
1384
- (b = e.pageFlipAdapterRef.current) == null || b.turnToNextPage();
1385
- }, P = () => {
1386
- var b;
1387
- (b = e.pageFlipAdapterRef.current) == null || b.turnToPrevPage();
1433
+ var S;
1434
+ (S = e.interactionManagerRef.current) == null || S.zoomIn();
1435
+ }, u = () => {
1436
+ var S;
1437
+ (S = e.interactionManagerRef.current) == null || S.zoomOut();
1438
+ }, c = () => e.onToggleFullscreen(), b = (S) => {
1439
+ e.store.currentPage.value = S, e.store.showToc.value = !1;
1440
+ }, P = (S) => {
1441
+ var T;
1442
+ e.store.currentPage.value !== S && (e.store.currentPage.value = S, (T = e.pageFlipAdapterRef.current) == null || T.playSound());
1443
+ }, k = () => {
1444
+ var S;
1445
+ (S = e.pageFlipAdapterRef.current) == null || S.turnToNextPage();
1446
+ }, I = () => {
1447
+ var S;
1448
+ (S = e.pageFlipAdapterRef.current) == null || S.turnToPrevPage();
1388
1449
  };
1389
- return /* @__PURE__ */ p(
1450
+ return /* @__PURE__ */ g(
1390
1451
  "div",
1391
1452
  {
1392
1453
  class: w(() => `bk-wrapper bk-theme-${e.store.themeMode.value} ${e.className || ""}`),
1393
1454
  children: [
1394
- /* @__PURE__ */ p("div", { class: "bk-main-area", children: [
1395
- /* @__PURE__ */ p(
1396
- oi,
1455
+ /* @__PURE__ */ g("div", { class: "bk-main-area", children: [
1456
+ /* @__PURE__ */ g(
1457
+ di,
1397
1458
  {
1398
1459
  store: e.store,
1399
1460
  bookWrapperRef: e.bookWrapperRef,
@@ -1401,78 +1462,80 @@ function ai(e) {
1401
1462
  bookContainerRef: e.bookContainerRef
1402
1463
  }
1403
1464
  ),
1404
- /* @__PURE__ */ p(
1405
- ri,
1465
+ /* @__PURE__ */ g(
1466
+ ui,
1406
1467
  {
1407
1468
  store: e.store,
1408
- onPrevPage: P,
1409
- onNextPage: x
1469
+ onPrevPage: I,
1470
+ onNextPage: k
1410
1471
  }
1411
1472
  ),
1412
- e.store.whiteLabel.value ? null : /* @__PURE__ */ p("div", { class: "bk-watermark", children: [
1473
+ e.store.whiteLabel.value ? null : /* @__PURE__ */ g("div", { class: "bk-watermark", children: [
1413
1474
  "Powered by ",
1414
- /* @__PURE__ */ p("a", { href: "https://flipbookengine.com", target: "_blank", rel: "noopener", style: "text-decoration: underline;", children: "FlipbookEngine" })
1415
- ] })
1475
+ /* @__PURE__ */ g("a", { href: "https://flipbookengine.com", target: "_blank", rel: "noopener", style: "text-decoration: underline;", children: "FlipbookEngine" })
1476
+ ] }),
1477
+ /* @__PURE__ */ g(ci, { store: e.store, onEntryClick: b })
1416
1478
  ] }),
1417
- /* @__PURE__ */ p(
1418
- si,
1479
+ /* @__PURE__ */ g(
1480
+ hi,
1419
1481
  {
1420
1482
  store: e.store,
1421
1483
  onToggleThumbs: t,
1422
- onToggleSingleMode: s,
1423
- onZoomIn: r,
1424
- onZoomOut: h,
1484
+ onToggleToc: i,
1485
+ onToggleSingleMode: o,
1486
+ onZoomIn: h,
1487
+ onZoomOut: u,
1425
1488
  onDownload: e.onDownload,
1426
- onNextPage: x,
1427
- onPrevPage: P,
1489
+ onNextPage: k,
1490
+ onPrevPage: I,
1428
1491
  onSoundToggle: () => e.store.soundEnabled.value = !e.store.soundEnabled.value,
1429
- onToggleAutoPlay: o,
1430
- onToggleFullscreen: u
1492
+ onToggleAutoPlay: r,
1493
+ onToggleFullscreen: c
1431
1494
  }
1432
1495
  ),
1433
- /* @__PURE__ */ p(
1434
- ni,
1496
+ /* @__PURE__ */ g(
1497
+ li,
1435
1498
  {
1436
1499
  store: e.store,
1437
- onThumbClick: g
1500
+ onThumbClick: P
1438
1501
  }
1439
1502
  )
1440
1503
  ]
1441
1504
  }
1442
1505
  );
1443
1506
  }
1444
- var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Dt = { exports: {} };
1507
+ var pi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, It = { exports: {} };
1445
1508
  (function(e, t) {
1446
- (function(s, o) {
1509
+ (function(i, o) {
1447
1510
  o(t);
1448
- })(hi, function(s) {
1511
+ })(pi, function(i) {
1449
1512
  class o {
1450
- constructor(i, n) {
1451
- this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = n, this.nowDrawingDensity = this.createdDensity, this.render = i;
1513
+ constructor(s, n) {
1514
+ this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = n, this.nowDrawingDensity = this.createdDensity, this.render = s;
1452
1515
  }
1453
- setDensity(i) {
1454
- this.createdDensity = i, this.nowDrawingDensity = i;
1516
+ setDensity(s) {
1517
+ this.createdDensity = s, this.nowDrawingDensity = s;
1455
1518
  }
1456
- setDrawingDensity(i) {
1457
- this.nowDrawingDensity = i;
1519
+ setDrawingDensity(s) {
1520
+ this.nowDrawingDensity = s;
1458
1521
  }
1459
- setPosition(i) {
1460
- this.state.position = i;
1522
+ setPosition(s) {
1523
+ this.state.position = s;
1461
1524
  }
1462
- setAngle(i) {
1463
- this.state.angle = i;
1525
+ setAngle(s) {
1526
+ this.state.angle = s;
1464
1527
  }
1465
- setArea(i) {
1466
- this.state.area = i;
1528
+ setArea(s) {
1529
+ this.state.area = s;
1467
1530
  }
1468
- setHardDrawingAngle(i) {
1469
- this.state.hardDrawingAngle = i;
1531
+ setHardDrawingAngle(s) {
1532
+ this.state.hardDrawingAngle = s;
1470
1533
  }
1471
- setHardAngle(i) {
1472
- this.state.hardAngle = i, this.state.hardDrawingAngle = i;
1534
+ setHardAngle(s) {
1535
+ this.state.hardAngle = s, this.state.hardDrawingAngle = s;
1473
1536
  }
1474
- setOrientation(i) {
1475
- this.orientation = i;
1537
+ setOrientation(s) {
1538
+ this.orientation = s;
1476
1539
  }
1477
1540
  getDrawingDensity() {
1478
1541
  return this.nowDrawingDensity;
@@ -1485,23 +1548,23 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1485
1548
  }
1486
1549
  }
1487
1550
  class r extends o {
1488
- constructor(i, n, a) {
1489
- super(i, a), this.image = null, this.isLoad = !1, this.loadingAngle = 0, this.image = new Image(), this.image.src = n;
1551
+ constructor(s, n, a) {
1552
+ super(s, a), this.image = null, this.isLoad = !1, this.loadingAngle = 0, this.image = new Image(), this.image.src = n;
1490
1553
  }
1491
- draw(i) {
1554
+ draw(s) {
1492
1555
  const n = this.render.getContext(), a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, d = this.render.getRect().height;
1493
1556
  n.save(), n.translate(a.x, a.y), n.beginPath();
1494
- for (let c of this.state.area) c !== null && (c = this.render.convertToGlobal(c), n.lineTo(c.x - a.x, c.y - a.y));
1557
+ for (let p of this.state.area) p !== null && (p = this.render.convertToGlobal(p), n.lineTo(p.x - a.x, p.y - a.y));
1495
1558
  n.rotate(this.state.angle), n.clip(), this.isLoad ? n.drawImage(this.image, 0, 0, l, d) : this.drawLoader(n, { x: 0, y: 0 }, l, d), n.restore();
1496
1559
  }
1497
- simpleDraw(i) {
1498
- const n = this.render.getRect(), a = this.render.getContext(), l = n.pageWidth, d = n.height, c = i === 1 ? n.left + n.pageWidth : n.left, v = n.top;
1499
- this.isLoad ? a.drawImage(this.image, c, v, l, d) : this.drawLoader(a, { x: c, y: v }, l, d);
1560
+ simpleDraw(s) {
1561
+ const n = this.render.getRect(), a = this.render.getContext(), l = n.pageWidth, d = n.height, p = s === 1 ? n.left + n.pageWidth : n.left, y = n.top;
1562
+ this.isLoad ? a.drawImage(this.image, p, y, l, d) : this.drawLoader(a, { x: p, y }, l, d);
1500
1563
  }
1501
- drawLoader(i, n, a, l) {
1502
- i.beginPath(), i.strokeStyle = "rgb(200, 200, 200)", i.fillStyle = "rgb(255, 255, 255)", i.lineWidth = 1, i.rect(n.x + 1, n.y + 1, a - 1, l - 1), i.stroke(), i.fill();
1564
+ drawLoader(s, n, a, l) {
1565
+ s.beginPath(), s.strokeStyle = "rgb(200, 200, 200)", s.fillStyle = "rgb(255, 255, 255)", s.lineWidth = 1, s.rect(n.x + 1, n.y + 1, a - 1, l - 1), s.stroke(), s.fill();
1503
1566
  const d = { x: n.x + a / 2, y: n.y + l / 2 };
1504
- i.beginPath(), i.lineWidth = 10, i.arc(d.x, d.y, 20, this.loadingAngle, 3 * Math.PI / 2 + this.loadingAngle), i.stroke(), i.closePath(), this.loadingAngle += 0.07, this.loadingAngle >= 2 * Math.PI && (this.loadingAngle = 0);
1567
+ s.beginPath(), s.lineWidth = 10, s.arc(d.x, d.y, 20, this.loadingAngle, 3 * Math.PI / 2 + this.loadingAngle), s.stroke(), s.closePath(), this.loadingAngle += 0.07, this.loadingAngle >= 2 * Math.PI && (this.loadingAngle = 0);
1505
1568
  }
1506
1569
  load() {
1507
1570
  this.isLoad || (this.image.onload = () => {
@@ -1518,8 +1581,8 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1518
1581
  }
1519
1582
  }
1520
1583
  class h {
1521
- constructor(i, n) {
1522
- this.pages = [], this.currentPageIndex = 0, this.currentSpreadIndex = 0, this.landscapeSpread = [], this.portraitSpread = [], this.render = n, this.app = i, this.currentPageIndex = 0, this.isShowCover = this.app.getSettings().showCover;
1584
+ constructor(s, n) {
1585
+ this.pages = [], this.currentPageIndex = 0, this.currentSpreadIndex = 0, this.landscapeSpread = [], this.portraitSpread = [], this.render = n, this.app = s, this.currentPageIndex = 0, this.isShowCover = this.app.getSettings().showCover;
1523
1586
  }
1524
1587
  destroy() {
1525
1588
  this.pages = [];
@@ -1527,16 +1590,16 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1527
1590
  createSpread() {
1528
1591
  this.landscapeSpread = [], this.portraitSpread = [];
1529
1592
  for (let n = 0; n < this.pages.length; n++) this.portraitSpread.push([n]);
1530
- let i = 0;
1531
- this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([i]), i++);
1532
- for (let n = i; n < this.pages.length; n += 2) n < this.pages.length - 1 ? this.landscapeSpread.push([n, n + 1]) : (this.landscapeSpread.push([n]), this.pages[n].setDensity("hard"));
1593
+ let s = 0;
1594
+ this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([s]), s++);
1595
+ for (let n = s; n < this.pages.length; n += 2) n < this.pages.length - 1 ? this.landscapeSpread.push([n, n + 1]) : (this.landscapeSpread.push([n]), this.pages[n].setDensity("hard"));
1533
1596
  }
1534
1597
  getSpread() {
1535
1598
  return this.render.getOrientation() === "landscape" ? this.landscapeSpread : this.portraitSpread;
1536
1599
  }
1537
- getSpreadIndexByPage(i) {
1600
+ getSpreadIndexByPage(s) {
1538
1601
  const n = this.getSpread();
1539
- for (let a = 0; a < n.length; a++) if (i === n[a][0] || i === n[a][1]) return a;
1602
+ for (let a = 0; a < n.length; a++) if (s === n[a][0] || s === n[a][1]) return a;
1540
1603
  return null;
1541
1604
  }
1542
1605
  getPageCount() {
@@ -1545,32 +1608,32 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1545
1608
  getPages() {
1546
1609
  return this.pages;
1547
1610
  }
1548
- getPage(i) {
1549
- if (i >= 0 && i < this.pages.length) return this.pages[i];
1611
+ getPage(s) {
1612
+ if (s >= 0 && s < this.pages.length) return this.pages[s];
1550
1613
  throw new Error("Invalid page number");
1551
1614
  }
1552
- nextBy(i) {
1553
- const n = this.pages.indexOf(i);
1615
+ nextBy(s) {
1616
+ const n = this.pages.indexOf(s);
1554
1617
  return n < this.pages.length - 1 ? this.pages[n + 1] : null;
1555
1618
  }
1556
- prevBy(i) {
1557
- const n = this.pages.indexOf(i);
1619
+ prevBy(s) {
1620
+ const n = this.pages.indexOf(s);
1558
1621
  return n > 0 ? this.pages[n - 1] : null;
1559
1622
  }
1560
- getFlippingPage(i) {
1623
+ getFlippingPage(s) {
1561
1624
  const n = this.currentSpreadIndex;
1562
- if (this.render.getOrientation() === "portrait") return i === 0 ? this.pages[n].newTemporaryCopy() : this.pages[n - 1];
1625
+ if (this.render.getOrientation() === "portrait") return s === 0 ? this.pages[n].newTemporaryCopy() : this.pages[n - 1];
1563
1626
  {
1564
- const a = i === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
1565
- return a.length === 1 || i === 0 ? this.pages[a[0]] : this.pages[a[1]];
1627
+ const a = s === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
1628
+ return a.length === 1 || s === 0 ? this.pages[a[0]] : this.pages[a[1]];
1566
1629
  }
1567
1630
  }
1568
- getBottomPage(i) {
1631
+ getBottomPage(s) {
1569
1632
  const n = this.currentSpreadIndex;
1570
- if (this.render.getOrientation() === "portrait") return i === 0 ? this.pages[n + 1] : this.pages[n - 1];
1633
+ if (this.render.getOrientation() === "portrait") return s === 0 ? this.pages[n + 1] : this.pages[n - 1];
1571
1634
  {
1572
- const a = i === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
1573
- return a.length === 1 ? this.pages[a[0]] : i === 0 ? this.pages[a[1]] : this.pages[a[0]];
1635
+ const a = s === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
1636
+ return a.length === 1 ? this.pages[a[0]] : s === 0 ? this.pages[a[1]] : this.pages[a[0]];
1574
1637
  }
1575
1638
  }
1576
1639
  showNext() {
@@ -1582,84 +1645,84 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1582
1645
  getCurrentPageIndex() {
1583
1646
  return this.currentPageIndex;
1584
1647
  }
1585
- show(i = null) {
1586
- if (i === null && (i = this.currentPageIndex), i < 0 || i >= this.pages.length) return;
1587
- const n = this.getSpreadIndexByPage(i);
1648
+ show(s = null) {
1649
+ if (s === null && (s = this.currentPageIndex), s < 0 || s >= this.pages.length) return;
1650
+ const n = this.getSpreadIndexByPage(s);
1588
1651
  n !== null && (this.currentSpreadIndex = n, this.showSpread());
1589
1652
  }
1590
1653
  getCurrentSpreadIndex() {
1591
1654
  return this.currentSpreadIndex;
1592
1655
  }
1593
- setCurrentSpreadIndex(i) {
1594
- if (!(i >= 0 && i < this.getSpread().length)) throw new Error("Invalid page");
1595
- this.currentSpreadIndex = i;
1656
+ setCurrentSpreadIndex(s) {
1657
+ if (!(s >= 0 && s < this.getSpread().length)) throw new Error("Invalid page");
1658
+ this.currentSpreadIndex = s;
1596
1659
  }
1597
1660
  showSpread() {
1598
- const i = this.getSpread()[this.currentSpreadIndex];
1599
- i.length === 2 ? (this.render.setLeftPage(this.pages[i[0]]), this.render.setRightPage(this.pages[i[1]])) : this.render.getOrientation() === "landscape" && i[0] === this.pages.length - 1 ? (this.render.setLeftPage(this.pages[i[0]]), this.render.setRightPage(null)) : (this.render.setLeftPage(null), this.render.setRightPage(this.pages[i[0]])), this.currentPageIndex = i[0], this.app.updatePageIndex(this.currentPageIndex);
1661
+ const s = this.getSpread()[this.currentSpreadIndex];
1662
+ s.length === 2 ? (this.render.setLeftPage(this.pages[s[0]]), this.render.setRightPage(this.pages[s[1]])) : this.render.getOrientation() === "landscape" && s[0] === this.pages.length - 1 ? (this.render.setLeftPage(this.pages[s[0]]), this.render.setRightPage(null)) : (this.render.setLeftPage(null), this.render.setRightPage(this.pages[s[0]])), this.currentPageIndex = s[0], this.app.updatePageIndex(this.currentPageIndex);
1600
1663
  }
1601
1664
  }
1602
1665
  class u extends h {
1603
- constructor(i, n, a) {
1604
- super(i, n), this.imagesHref = a;
1666
+ constructor(s, n, a) {
1667
+ super(s, n), this.imagesHref = a;
1605
1668
  }
1606
1669
  load() {
1607
- for (const i of this.imagesHref) {
1608
- const n = new r(this.render, i, "soft");
1670
+ for (const s of this.imagesHref) {
1671
+ const n = new r(this.render, s, "soft");
1609
1672
  n.load(), this.pages.push(n);
1610
1673
  }
1611
1674
  this.createSpread();
1612
1675
  }
1613
1676
  }
1614
- class g {
1615
- static GetDistanceBetweenTwoPoint(i, n) {
1616
- return i === null || n === null ? 1 / 0 : Math.sqrt(Math.pow(n.x - i.x, 2) + Math.pow(n.y - i.y, 2));
1617
- }
1618
- static GetSegmentLength(i) {
1619
- return g.GetDistanceBetweenTwoPoint(i[0], i[1]);
1620
- }
1621
- static GetAngleBetweenTwoLine(i, n) {
1622
- const a = i[0].y - i[1].y, l = n[0].y - n[1].y, d = i[1].x - i[0].x, c = n[1].x - n[0].x;
1623
- return Math.acos((a * l + d * c) / (Math.sqrt(a * a + d * d) * Math.sqrt(l * l + c * c)));
1624
- }
1625
- static PointInRect(i, n) {
1626
- return n === null ? null : n.x >= i.left && n.x <= i.width + i.left && n.y >= i.top && n.y <= i.top + i.height ? n : null;
1627
- }
1628
- static GetRotatedPoint(i, n, a) {
1629
- return { x: i.x * Math.cos(a) + i.y * Math.sin(a) + n.x, y: i.y * Math.cos(a) - i.x * Math.sin(a) + n.y };
1630
- }
1631
- static LimitPointToCircle(i, n, a) {
1632
- if (g.GetDistanceBetweenTwoPoint(i, a) <= n) return a;
1633
- const l = i.x, d = i.y, c = a.x, v = a.y;
1634
- let y = Math.sqrt(Math.pow(n, 2) * Math.pow(l - c, 2) / (Math.pow(l - c, 2) + Math.pow(d - v, 2))) + l;
1635
- a.x < 0 && (y *= -1);
1636
- let A = (y - l) * (d - v) / (l - c) + d;
1637
- return l - c + d === 0 && (A = n), { x: y, y: A };
1638
- }
1639
- static GetIntersectBetweenTwoSegment(i, n, a) {
1640
- return g.PointInRect(i, g.GetIntersectBeetwenTwoLine(n, a));
1641
- }
1642
- static GetIntersectBeetwenTwoLine(i, n) {
1643
- const a = i[0].y - i[1].y, l = n[0].y - n[1].y, d = i[1].x - i[0].x, c = n[1].x - n[0].x, v = i[0].x * i[1].y - i[1].x * i[0].y, y = n[0].x * n[1].y - n[1].x * n[0].y, A = a * y - l * v, R = d * y - c * v, W = -(v * c - y * d) / (a * c - l * d), K = -(a * y - l * v) / (a * c - l * d);
1644
- if (isFinite(W) && isFinite(K)) return { x: W, y: K };
1645
- if (Math.abs(A - R) < 0.1) throw new Error("Segment included");
1677
+ class c {
1678
+ static GetDistanceBetweenTwoPoint(s, n) {
1679
+ return s === null || n === null ? 1 / 0 : Math.sqrt(Math.pow(n.x - s.x, 2) + Math.pow(n.y - s.y, 2));
1680
+ }
1681
+ static GetSegmentLength(s) {
1682
+ return c.GetDistanceBetweenTwoPoint(s[0], s[1]);
1683
+ }
1684
+ static GetAngleBetweenTwoLine(s, n) {
1685
+ const a = s[0].y - s[1].y, l = n[0].y - n[1].y, d = s[1].x - s[0].x, p = n[1].x - n[0].x;
1686
+ return Math.acos((a * l + d * p) / (Math.sqrt(a * a + d * d) * Math.sqrt(l * l + p * p)));
1687
+ }
1688
+ static PointInRect(s, n) {
1689
+ return n === null ? null : n.x >= s.left && n.x <= s.width + s.left && n.y >= s.top && n.y <= s.top + s.height ? n : null;
1690
+ }
1691
+ static GetRotatedPoint(s, n, a) {
1692
+ return { x: s.x * Math.cos(a) + s.y * Math.sin(a) + n.x, y: s.y * Math.cos(a) - s.x * Math.sin(a) + n.y };
1693
+ }
1694
+ static LimitPointToCircle(s, n, a) {
1695
+ if (c.GetDistanceBetweenTwoPoint(s, a) <= n) return a;
1696
+ const l = s.x, d = s.y, p = a.x, y = a.y;
1697
+ let f = Math.sqrt(Math.pow(n, 2) * Math.pow(l - p, 2) / (Math.pow(l - p, 2) + Math.pow(d - y, 2))) + l;
1698
+ a.x < 0 && (f *= -1);
1699
+ let E = (f - l) * (d - y) / (l - p) + d;
1700
+ return l - p + d === 0 && (E = n), { x: f, y: E };
1701
+ }
1702
+ static GetIntersectBetweenTwoSegment(s, n, a) {
1703
+ return c.PointInRect(s, c.GetIntersectBeetwenTwoLine(n, a));
1704
+ }
1705
+ static GetIntersectBeetwenTwoLine(s, n) {
1706
+ const a = s[0].y - s[1].y, l = n[0].y - n[1].y, d = s[1].x - s[0].x, p = n[1].x - n[0].x, y = s[0].x * s[1].y - s[1].x * s[0].y, f = n[0].x * n[1].y - n[1].x * n[0].y, E = a * f - l * y, R = d * f - p * y, O = -(y * p - f * d) / (a * p - l * d), K = -(a * f - l * y) / (a * p - l * d);
1707
+ if (isFinite(O) && isFinite(K)) return { x: O, y: K };
1708
+ if (Math.abs(E - R) < 0.1) throw new Error("Segment included");
1646
1709
  return null;
1647
1710
  }
1648
- static GetCordsFromTwoPoint(i, n) {
1649
- const a = Math.abs(i.x - n.x), l = Math.abs(i.y - n.y), d = Math.max(a, l), c = [i];
1650
- function v(y, A, R, W, K) {
1651
- return A > y ? y + K * (R / W) : A < y ? y - K * (R / W) : y;
1711
+ static GetCordsFromTwoPoint(s, n) {
1712
+ const a = Math.abs(s.x - n.x), l = Math.abs(s.y - n.y), d = Math.max(a, l), p = [s];
1713
+ function y(f, E, R, O, K) {
1714
+ return E > f ? f + K * (R / O) : E < f ? f - K * (R / O) : f;
1652
1715
  }
1653
- for (let y = 1; y <= d; y += 1) c.push({ x: v(i.x, n.x, a, d, y), y: v(i.y, n.y, l, d, y) });
1654
- return c;
1716
+ for (let f = 1; f <= d; f += 1) p.push({ x: y(s.x, n.x, a, d, f), y: y(s.y, n.y, l, d, f) });
1717
+ return p;
1655
1718
  }
1656
1719
  }
1657
- class x extends o {
1658
- constructor(i, n, a) {
1659
- super(i, a), this.copiedElement = null, this.temporaryCopy = null, this.isLoad = !1, this.element = n, this.element.classList.add("stf__item"), this.element.classList.add("--" + a);
1720
+ class b extends o {
1721
+ constructor(s, n, a) {
1722
+ super(s, a), this.copiedElement = null, this.temporaryCopy = null, this.isLoad = !1, this.element = n, this.element.classList.add("stf__item"), this.element.classList.add("--" + a);
1660
1723
  }
1661
1724
  newTemporaryCopy() {
1662
- return this.nowDrawingDensity === "hard" ? this : (this.temporaryCopy === null && (this.copiedElement = this.element.cloneNode(!0), this.element.parentElement.appendChild(this.copiedElement), this.temporaryCopy = new x(this.render, this.copiedElement, this.nowDrawingDensity)), this.getTemporaryCopy());
1725
+ return this.nowDrawingDensity === "hard" ? this : (this.temporaryCopy === null && (this.copiedElement = this.element.cloneNode(!0), this.element.parentElement.appendChild(this.copiedElement), this.temporaryCopy = new b(this.render, this.copiedElement, this.nowDrawingDensity)), this.getTemporaryCopy());
1663
1726
  }
1664
1727
  getTemporaryCopy() {
1665
1728
  return this.temporaryCopy;
@@ -1667,10 +1730,10 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1667
1730
  hideTemporaryCopy() {
1668
1731
  this.temporaryCopy !== null && (this.copiedElement.remove(), this.copiedElement = null, this.temporaryCopy = null);
1669
1732
  }
1670
- draw(i) {
1671
- const n = i || this.nowDrawingDensity, a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, d = this.render.getRect().height;
1733
+ draw(s) {
1734
+ const n = s || this.nowDrawingDensity, a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, d = this.render.getRect().height;
1672
1735
  this.element.classList.remove("--simple");
1673
- const c = `
1736
+ const p = `
1674
1737
  display: block;
1675
1738
  z-index: ${this.element.style.zIndex};
1676
1739
  left: 0;
@@ -1678,10 +1741,10 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1678
1741
  width: ${l}px;
1679
1742
  height: ${d}px;
1680
1743
  `;
1681
- n === "hard" ? this.drawHard(c) : this.drawSoft(a, c);
1744
+ n === "hard" ? this.drawHard(p) : this.drawSoft(a, p);
1682
1745
  }
1683
- drawHard(i = "") {
1684
- const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, l = i + `
1746
+ drawHard(s = "") {
1747
+ const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, l = s + `
1685
1748
  backface-visibility: hidden;
1686
1749
  -webkit-backface-visibility: hidden;
1687
1750
  clip-path: none;
@@ -1691,24 +1754,24 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1691
1754
  transform: translate3d(${n}px, 0, 0) rotateY(${a}deg);`);
1692
1755
  this.element.style.cssText = l;
1693
1756
  }
1694
- drawSoft(i, n = "") {
1757
+ drawSoft(s, n = "") {
1695
1758
  let a = "polygon( ";
1696
1759
  for (const d of this.state.area) if (d !== null) {
1697
- let c = this.render.getDirection() === 1 ? { x: -d.x + this.state.position.x, y: d.y - this.state.position.y } : { x: d.x - this.state.position.x, y: d.y - this.state.position.y };
1698
- c = g.GetRotatedPoint(c, { x: 0, y: 0 }, this.state.angle), a += c.x + "px " + c.y + "px, ";
1760
+ let p = this.render.getDirection() === 1 ? { x: -d.x + this.state.position.x, y: d.y - this.state.position.y } : { x: d.x - this.state.position.x, y: d.y - this.state.position.y };
1761
+ p = c.GetRotatedPoint(p, { x: 0, y: 0 }, this.state.angle), a += p.x + "px " + p.y + "px, ";
1699
1762
  }
1700
1763
  a = a.slice(0, -2), a += ")";
1701
- const l = n + `transform-origin: 0 0; clip-path: ${a}; -webkit-clip-path: ${a};` + (this.render.isSafari() && this.state.angle === 0 ? `transform: translate(${i.x}px, ${i.y}px);` : `transform: translate3d(${i.x}px, ${i.y}px, 0) rotate(${this.state.angle}rad);`);
1764
+ const l = n + `transform-origin: 0 0; clip-path: ${a}; -webkit-clip-path: ${a};` + (this.render.isSafari() && this.state.angle === 0 ? `transform: translate(${s.x}px, ${s.y}px);` : `transform: translate3d(${s.x}px, ${s.y}px, 0) rotate(${this.state.angle}rad);`);
1702
1765
  this.element.style.cssText = l;
1703
1766
  }
1704
- simpleDraw(i) {
1705
- const n = this.render.getRect(), a = n.pageWidth, l = n.height, d = i === 1 ? n.left + n.pageWidth : n.left, c = n.top;
1767
+ simpleDraw(s) {
1768
+ const n = this.render.getRect(), a = n.pageWidth, l = n.height, d = s === 1 ? n.left + n.pageWidth : n.left, p = n.top;
1706
1769
  this.element.classList.add("--simple"), this.element.style.cssText = `
1707
1770
  position: absolute;
1708
1771
  display: block;
1709
1772
  height: ${l}px;
1710
1773
  left: ${d}px;
1711
- top: ${c}px;
1774
+ top: ${p}px;
1712
1775
  width: ${a}px;
1713
1776
  z-index: ${this.render.getSettings().startZIndex + 1};`;
1714
1777
  }
@@ -1718,44 +1781,44 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1718
1781
  load() {
1719
1782
  this.isLoad = !0;
1720
1783
  }
1721
- setOrientation(i) {
1722
- super.setOrientation(i), this.element.classList.remove("--left", "--right"), this.element.classList.add(i === 1 ? "--right" : "--left");
1784
+ setOrientation(s) {
1785
+ super.setOrientation(s), this.element.classList.remove("--left", "--right"), this.element.classList.add(s === 1 ? "--right" : "--left");
1723
1786
  }
1724
- setDrawingDensity(i) {
1725
- this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" + i), super.setDrawingDensity(i);
1787
+ setDrawingDensity(s) {
1788
+ this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" + s), super.setDrawingDensity(s);
1726
1789
  }
1727
1790
  }
1728
1791
  class P extends h {
1729
- constructor(i, n, a, l) {
1730
- super(i, n), this.element = a, this.pagesElement = l;
1792
+ constructor(s, n, a, l) {
1793
+ super(s, n), this.element = a, this.pagesElement = l;
1731
1794
  }
1732
1795
  load() {
1733
- for (const i of this.pagesElement) {
1734
- const n = new x(this.render, i, i.dataset.density === "hard" ? "hard" : "soft");
1796
+ for (const s of this.pagesElement) {
1797
+ const n = new b(this.render, s, s.dataset.density === "hard" ? "hard" : "soft");
1735
1798
  n.load(), this.pages.push(n);
1736
1799
  }
1737
1800
  this.createSpread();
1738
1801
  }
1739
1802
  }
1740
- class b {
1741
- constructor(i, n, a, l) {
1742
- this.direction = i, this.corner = n, this.topIntersectPoint = null, this.sideIntersectPoint = null, this.bottomIntersectPoint = null, this.pageWidth = parseInt(a, 10), this.pageHeight = parseInt(l, 10);
1803
+ class k {
1804
+ constructor(s, n, a, l) {
1805
+ this.direction = s, this.corner = n, this.topIntersectPoint = null, this.sideIntersectPoint = null, this.bottomIntersectPoint = null, this.pageWidth = parseInt(a, 10), this.pageHeight = parseInt(l, 10);
1743
1806
  }
1744
- calc(i) {
1807
+ calc(s) {
1745
1808
  try {
1746
- return this.position = this.calcAngleAndPosition(i), this.calculateIntersectPoint(this.position), !0;
1809
+ return this.position = this.calcAngleAndPosition(s), this.calculateIntersectPoint(this.position), !0;
1747
1810
  } catch {
1748
1811
  return !1;
1749
1812
  }
1750
1813
  }
1751
1814
  getFlippingClipArea() {
1752
- const i = [];
1815
+ const s = [];
1753
1816
  let n = !1;
1754
- return i.push(this.rect.topLeft), i.push(this.topIntersectPoint), this.sideIntersectPoint === null ? n = !0 : (i.push(this.sideIntersectPoint), this.bottomIntersectPoint === null && (n = !1)), i.push(this.bottomIntersectPoint), (n || this.corner === "bottom") && i.push(this.rect.bottomLeft), i;
1817
+ return s.push(this.rect.topLeft), s.push(this.topIntersectPoint), this.sideIntersectPoint === null ? n = !0 : (s.push(this.sideIntersectPoint), this.bottomIntersectPoint === null && (n = !1)), s.push(this.bottomIntersectPoint), (n || this.corner === "bottom") && s.push(this.rect.bottomLeft), s;
1755
1818
  }
1756
1819
  getBottomClipArea() {
1757
- const i = [];
1758
- return i.push(this.topIntersectPoint), this.corner === "top" ? i.push({ x: this.pageWidth, y: 0 }) : (this.topIntersectPoint !== null && i.push({ x: this.pageWidth, y: 0 }), i.push({ x: this.pageWidth, y: this.pageHeight })), this.sideIntersectPoint !== null ? g.GetDistanceBetweenTwoPoint(this.sideIntersectPoint, this.topIntersectPoint) >= 10 && i.push(this.sideIntersectPoint) : this.corner === "top" && i.push({ x: this.pageWidth, y: this.pageHeight }), i.push(this.bottomIntersectPoint), i.push(this.topIntersectPoint), i;
1820
+ const s = [];
1821
+ return s.push(this.topIntersectPoint), this.corner === "top" ? s.push({ x: this.pageWidth, y: 0 }) : (this.topIntersectPoint !== null && s.push({ x: this.pageWidth, y: 0 }), s.push({ x: this.pageWidth, y: this.pageHeight })), this.sideIntersectPoint !== null ? c.GetDistanceBetweenTwoPoint(this.sideIntersectPoint, this.topIntersectPoint) >= 10 && s.push(this.sideIntersectPoint) : this.corner === "top" && s.push({ x: this.pageWidth, y: this.pageHeight }), s.push(this.bottomIntersectPoint), s.push(this.topIntersectPoint), s;
1759
1822
  }
1760
1823
  getAngle() {
1761
1824
  return this.direction === 0 ? -this.angle : this.angle;
@@ -1785,126 +1848,126 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1785
1848
  return this.corner === "top" ? this.topIntersectPoint : this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.topIntersectPoint;
1786
1849
  }
1787
1850
  getShadowAngle() {
1788
- const i = g.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
1789
- return this.direction === 0 ? i : Math.PI - i;
1851
+ const s = c.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
1852
+ return this.direction === 0 ? s : Math.PI - s;
1790
1853
  }
1791
- calcAngleAndPosition(i) {
1792
- let n = i;
1854
+ calcAngleAndPosition(s) {
1855
+ let n = s;
1793
1856
  if (this.updateAngleAndGeometry(n), n = this.corner === "top" ? this.checkPositionAtCenterLine(n, { x: 0, y: 0 }, { x: 0, y: this.pageHeight }) : this.checkPositionAtCenterLine(n, { x: 0, y: this.pageHeight }, { x: 0, y: 0 }), Math.abs(n.x - this.pageWidth) < 1 && Math.abs(n.y) < 1) throw new Error("Point is too small");
1794
1857
  return n;
1795
1858
  }
1796
- updateAngleAndGeometry(i) {
1797
- this.angle = this.calculateAngle(i), this.rect = this.getPageRect(i);
1859
+ updateAngleAndGeometry(s) {
1860
+ this.angle = this.calculateAngle(s), this.rect = this.getPageRect(s);
1798
1861
  }
1799
- calculateAngle(i) {
1800
- const n = this.pageWidth - i.x + 1, a = this.corner === "bottom" ? this.pageHeight - i.y : i.y;
1862
+ calculateAngle(s) {
1863
+ const n = this.pageWidth - s.x + 1, a = this.corner === "bottom" ? this.pageHeight - s.y : s.y;
1801
1864
  let l = 2 * Math.acos(n / Math.sqrt(a * a + n * n));
1802
1865
  a < 0 && (l = -l);
1803
1866
  const d = Math.PI - l;
1804
1867
  if (!isFinite(l) || d >= 0 && d < 3e-3) throw new Error("The G point is too small");
1805
1868
  return this.corner === "bottom" && (l = -l), l;
1806
1869
  }
1807
- getPageRect(i) {
1808
- return this.corner === "top" ? this.getRectFromBasePoint([{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }, { x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }], i) : this.getRectFromBasePoint([{ x: 0, y: -this.pageHeight }, { x: this.pageWidth, y: -this.pageHeight }, { x: 0, y: 0 }, { x: this.pageWidth, y: 0 }], i);
1870
+ getPageRect(s) {
1871
+ return this.corner === "top" ? this.getRectFromBasePoint([{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }, { x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }], s) : this.getRectFromBasePoint([{ x: 0, y: -this.pageHeight }, { x: this.pageWidth, y: -this.pageHeight }, { x: 0, y: 0 }, { x: this.pageWidth, y: 0 }], s);
1809
1872
  }
1810
- getRectFromBasePoint(i, n) {
1811
- return { topLeft: this.getRotatedPoint(i[0], n), topRight: this.getRotatedPoint(i[1], n), bottomLeft: this.getRotatedPoint(i[2], n), bottomRight: this.getRotatedPoint(i[3], n) };
1873
+ getRectFromBasePoint(s, n) {
1874
+ return { topLeft: this.getRotatedPoint(s[0], n), topRight: this.getRotatedPoint(s[1], n), bottomLeft: this.getRotatedPoint(s[2], n), bottomRight: this.getRotatedPoint(s[3], n) };
1812
1875
  }
1813
- getRotatedPoint(i, n) {
1814
- return { x: i.x * Math.cos(this.angle) + i.y * Math.sin(this.angle) + n.x, y: i.y * Math.cos(this.angle) - i.x * Math.sin(this.angle) + n.y };
1876
+ getRotatedPoint(s, n) {
1877
+ return { x: s.x * Math.cos(this.angle) + s.y * Math.sin(this.angle) + n.x, y: s.y * Math.cos(this.angle) - s.x * Math.sin(this.angle) + n.y };
1815
1878
  }
1816
- calculateIntersectPoint(i) {
1879
+ calculateIntersectPoint(s) {
1817
1880
  const n = { left: -1, top: -1, width: this.pageWidth + 2, height: this.pageHeight + 2 };
1818
- this.corner === "top" ? (this.topIntersectPoint = g.GetIntersectBetweenTwoSegment(n, [i, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = g.GetIntersectBetweenTwoSegment(n, [i, this.rect.bottomLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = g.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }])) : (this.topIntersectPoint = g.GetIntersectBetweenTwoSegment(n, [this.rect.topLeft, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = g.GetIntersectBetweenTwoSegment(n, [i, this.rect.topLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = g.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }]));
1881
+ this.corner === "top" ? (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [s, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [s, this.rect.bottomLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }])) : (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [this.rect.topLeft, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [s, this.rect.topLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }]));
1819
1882
  }
1820
- checkPositionAtCenterLine(i, n, a) {
1821
- let l = i;
1822
- const d = g.LimitPointToCircle(n, this.pageWidth, l);
1883
+ checkPositionAtCenterLine(s, n, a) {
1884
+ let l = s;
1885
+ const d = c.LimitPointToCircle(n, this.pageWidth, l);
1823
1886
  l !== d && (l = d, this.updateAngleAndGeometry(l));
1824
- const c = Math.sqrt(Math.pow(this.pageWidth, 2) + Math.pow(this.pageHeight, 2));
1825
- let v = this.rect.bottomRight, y = this.rect.topLeft;
1826
- if (this.corner === "bottom" && (v = this.rect.topRight, y = this.rect.bottomLeft), v.x <= 0) {
1827
- const A = g.LimitPointToCircle(a, c, y);
1828
- A !== l && (l = A, this.updateAngleAndGeometry(l));
1887
+ const p = Math.sqrt(Math.pow(this.pageWidth, 2) + Math.pow(this.pageHeight, 2));
1888
+ let y = this.rect.bottomRight, f = this.rect.topLeft;
1889
+ if (this.corner === "bottom" && (y = this.rect.topRight, f = this.rect.bottomLeft), y.x <= 0) {
1890
+ const E = c.LimitPointToCircle(a, p, f);
1891
+ E !== l && (l = E, this.updateAngleAndGeometry(l));
1829
1892
  }
1830
1893
  return l;
1831
1894
  }
1832
1895
  getSegmentToShadowLine() {
1833
- const i = this.getShadowStartPoint();
1834
- return [i, i !== this.sideIntersectPoint && this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.bottomIntersectPoint];
1896
+ const s = this.getShadowStartPoint();
1897
+ return [s, s !== this.sideIntersectPoint && this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.bottomIntersectPoint];
1835
1898
  }
1836
1899
  }
1837
- class D {
1838
- constructor(i, n) {
1839
- this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render = i, this.app = n;
1900
+ class I {
1901
+ constructor(s, n) {
1902
+ this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render = s, this.app = n;
1840
1903
  }
1841
- fold(i) {
1842
- this.setState("user_fold"), this.calc === null && this.start(i), this.do(this.render.convertToPage(i));
1904
+ fold(s) {
1905
+ this.setState("user_fold"), this.calc === null && this.start(s), this.do(this.render.convertToPage(s));
1843
1906
  }
1844
- flip(i) {
1845
- if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(i) || (this.calc !== null && this.render.finishAnimation(), !this.start(i))) return;
1907
+ flip(s) {
1908
+ if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(s) || (this.calc !== null && this.render.finishAnimation(), !this.start(s))) return;
1846
1909
  const n = this.getBoundsRect();
1847
1910
  this.setState("flipping");
1848
1911
  const a = n.height / 10, l = this.calc.getCorner() === "bottom" ? n.height - a : a, d = this.calc.getCorner() === "bottom" ? n.height : 0;
1849
1912
  this.calc.calc({ x: n.pageWidth - a, y: l }), this.animateFlippingTo({ x: n.pageWidth - a, y: l }, { x: -n.pageWidth, y: d }, !0);
1850
1913
  }
1851
- start(i) {
1914
+ start(s) {
1852
1915
  this.reset();
1853
- const n = this.render.convertToBook(i), a = this.getBoundsRect(), l = this.getDirectionByPoint(n), d = n.y >= a.height / 2 ? "bottom" : "top";
1916
+ const n = this.render.convertToBook(s), a = this.getBoundsRect(), l = this.getDirectionByPoint(n), d = n.y >= a.height / 2 ? "bottom" : "top";
1854
1917
  if (!this.checkDirection(l)) return !1;
1855
1918
  try {
1856
1919
  if (this.flippingPage = this.app.getPageCollection().getFlippingPage(l), this.bottomPage = this.app.getPageCollection().getBottomPage(l), this.render.getOrientation() === "landscape") if (l === 1) {
1857
- const c = this.app.getPageCollection().nextBy(this.flippingPage);
1858
- c !== null && this.flippingPage.getDensity() !== c.getDensity() && (this.flippingPage.setDrawingDensity("hard"), c.setDrawingDensity("hard"));
1920
+ const p = this.app.getPageCollection().nextBy(this.flippingPage);
1921
+ p !== null && this.flippingPage.getDensity() !== p.getDensity() && (this.flippingPage.setDrawingDensity("hard"), p.setDrawingDensity("hard"));
1859
1922
  } else {
1860
- const c = this.app.getPageCollection().prevBy(this.flippingPage);
1861
- c !== null && this.flippingPage.getDensity() !== c.getDensity() && (this.flippingPage.setDrawingDensity("hard"), c.setDrawingDensity("hard"));
1923
+ const p = this.app.getPageCollection().prevBy(this.flippingPage);
1924
+ p !== null && this.flippingPage.getDensity() !== p.getDensity() && (this.flippingPage.setDrawingDensity("hard"), p.setDrawingDensity("hard"));
1862
1925
  }
1863
- return this.render.setDirection(l), this.calc = new b(l, d, a.pageWidth.toString(10), a.height.toString(10)), !0;
1926
+ return this.render.setDirection(l), this.calc = new k(l, d, a.pageWidth.toString(10), a.height.toString(10)), !0;
1864
1927
  } catch {
1865
1928
  return !1;
1866
1929
  }
1867
1930
  }
1868
- do(i) {
1869
- if (this.calc !== null && this.calc.calc(i)) {
1931
+ do(s) {
1932
+ if (this.calc !== null && this.calc.calc(s)) {
1870
1933
  const n = this.calc.getFlippingProgress();
1871
1934
  this.bottomPage.setArea(this.calc.getBottomClipArea()), this.bottomPage.setPosition(this.calc.getBottomPagePosition()), this.bottomPage.setAngle(0), this.bottomPage.setHardAngle(0), this.flippingPage.setArea(this.calc.getFlippingClipArea()), this.flippingPage.setPosition(this.calc.getActiveCorner()), this.flippingPage.setAngle(this.calc.getAngle()), this.calc.getDirection() === 0 ? this.flippingPage.setHardAngle(90 * (200 - 2 * n) / 100) : this.flippingPage.setHardAngle(-90 * (200 - 2 * n) / 100), this.render.setPageRect(this.calc.getRect()), this.render.setBottomPage(this.bottomPage), this.render.setFlippingPage(this.flippingPage), this.render.setShadowData(this.calc.getShadowStartPoint(), this.calc.getShadowAngle(), n, this.calc.getDirection());
1872
1935
  }
1873
1936
  }
1874
- flipToPage(i, n) {
1875
- const a = this.app.getPageCollection().getCurrentSpreadIndex(), l = this.app.getPageCollection().getSpreadIndexByPage(i);
1937
+ flipToPage(s, n) {
1938
+ const a = this.app.getPageCollection().getCurrentSpreadIndex(), l = this.app.getPageCollection().getSpreadIndexByPage(s);
1876
1939
  try {
1877
1940
  l > a && (this.app.getPageCollection().setCurrentSpreadIndex(l - 1), this.flipNext(n)), l < a && (this.app.getPageCollection().setCurrentSpreadIndex(l + 1), this.flipPrev(n));
1878
1941
  } catch {
1879
1942
  }
1880
1943
  }
1881
- flipNext(i) {
1882
- this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y: i === "top" ? 1 : this.render.getRect().height - 2 });
1944
+ flipNext(s) {
1945
+ this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y: s === "top" ? 1 : this.render.getRect().height - 2 });
1883
1946
  }
1884
- flipPrev(i) {
1885
- this.flip({ x: 10, y: i === "top" ? 1 : this.render.getRect().height - 2 });
1947
+ flipPrev(s) {
1948
+ this.flip({ x: 10, y: s === "top" ? 1 : this.render.getRect().height - 2 });
1886
1949
  }
1887
1950
  stopMove() {
1888
1951
  if (this.calc === null) return;
1889
- const i = this.calc.getPosition(), n = this.getBoundsRect(), a = this.calc.getCorner() === "bottom" ? n.height : 0;
1890
- i.x <= 0 ? this.animateFlippingTo(i, { x: -n.pageWidth, y: a }, !0) : this.animateFlippingTo(i, { x: n.pageWidth, y: a }, !1);
1952
+ const s = this.calc.getPosition(), n = this.getBoundsRect(), a = this.calc.getCorner() === "bottom" ? n.height : 0;
1953
+ s.x <= 0 ? this.animateFlippingTo(s, { x: -n.pageWidth, y: a }, !0) : this.animateFlippingTo(s, { x: n.pageWidth, y: a }, !1);
1891
1954
  }
1892
- showCorner(i) {
1955
+ showCorner(s) {
1893
1956
  if (!this.checkState("read", "fold_corner")) return;
1894
1957
  const n = this.getBoundsRect(), a = n.pageWidth;
1895
- if (this.isPointOnCorners(i)) if (this.calc === null) {
1896
- if (!this.start(i)) return;
1958
+ if (this.isPointOnCorners(s)) if (this.calc === null) {
1959
+ if (!this.start(s)) return;
1897
1960
  this.setState("fold_corner"), this.calc.calc({ x: a - 1, y: 1 });
1898
- const l = 50, d = this.calc.getCorner() === "bottom" ? n.height - 1 : 1, c = this.calc.getCorner() === "bottom" ? n.height - l : l;
1899
- this.animateFlippingTo({ x: a - 1, y: d }, { x: a - l, y: c }, !1, !1);
1900
- } else this.do(this.render.convertToPage(i));
1961
+ const l = 50, d = this.calc.getCorner() === "bottom" ? n.height - 1 : 1, p = this.calc.getCorner() === "bottom" ? n.height - l : l;
1962
+ this.animateFlippingTo({ x: a - 1, y: d }, { x: a - l, y: p }, !1, !1);
1963
+ } else this.do(this.render.convertToPage(s));
1901
1964
  else this.setState("read"), this.render.finishAnimation(), this.stopMove();
1902
1965
  }
1903
- animateFlippingTo(i, n, a, l = !0) {
1904
- const d = g.GetCordsFromTwoPoint(i, n), c = [];
1905
- for (const y of d) c.push(() => this.do(y));
1906
- const v = this.getAnimationDuration(d.length);
1907
- this.render.startAnimation(c, v, () => {
1966
+ animateFlippingTo(s, n, a, l = !0) {
1967
+ const d = c.GetCordsFromTwoPoint(s, n), p = [];
1968
+ for (const f of d) p.push(() => this.do(f));
1969
+ const y = this.getAnimationDuration(d.length);
1970
+ this.render.startAnimation(p, y, () => {
1908
1971
  this.calc && (a && (this.calc.getDirection() === 1 ? this.app.turnToPrevPage() : this.app.turnToNextPage()), l && (this.render.setBottomPage(null), this.render.setFlippingPage(null), this.render.clearShadow(), this.setState("read"), this.reset()));
1909
1972
  });
1910
1973
  }
@@ -1914,22 +1977,22 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1914
1977
  getState() {
1915
1978
  return this.state;
1916
1979
  }
1917
- setState(i) {
1918
- this.state !== i && (this.app.updateState(i), this.state = i);
1980
+ setState(s) {
1981
+ this.state !== s && (this.app.updateState(s), this.state = s);
1919
1982
  }
1920
- getDirectionByPoint(i) {
1983
+ getDirectionByPoint(s) {
1921
1984
  const n = this.getBoundsRect();
1922
1985
  if (this.render.getOrientation() === "portrait") {
1923
- if (i.x - n.pageWidth <= n.width / 5) return 1;
1924
- } else if (i.x < n.width / 2) return 1;
1986
+ if (s.x - n.pageWidth <= n.width / 5) return 1;
1987
+ } else if (s.x < n.width / 2) return 1;
1925
1988
  return 0;
1926
1989
  }
1927
- getAnimationDuration(i) {
1990
+ getAnimationDuration(s) {
1928
1991
  const n = this.app.getSettings().flippingTime;
1929
- return i >= 1e3 ? n : i / 1e3 * n;
1992
+ return s >= 1e3 ? n : s / 1e3 * n;
1930
1993
  }
1931
- checkDirection(i) {
1932
- return i === 0 ? this.app.getCurrentPageIndex() < this.app.getPageCount() - 1 : this.app.getCurrentPageIndex() >= 1;
1994
+ checkDirection(s) {
1995
+ return s === 0 ? this.app.getCurrentPageIndex() < this.app.getPageCount() - 1 : this.app.getCurrentPageIndex() >= 1;
1933
1996
  }
1934
1997
  reset() {
1935
1998
  this.calc = null, this.flippingPage = null, this.bottomPage = null;
@@ -1937,56 +2000,56 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1937
2000
  getBoundsRect() {
1938
2001
  return this.render.getRect();
1939
2002
  }
1940
- checkState(...i) {
1941
- for (const n of i) if (this.state === n) return !0;
2003
+ checkState(...s) {
2004
+ for (const n of s) if (this.state === n) return !0;
1942
2005
  return !1;
1943
2006
  }
1944
- isPointOnCorners(i) {
1945
- const n = this.getBoundsRect(), a = n.pageWidth, l = Math.sqrt(Math.pow(a, 2) + Math.pow(n.height, 2)) / 5, d = this.render.convertToBook(i);
2007
+ isPointOnCorners(s) {
2008
+ const n = this.getBoundsRect(), a = n.pageWidth, l = Math.sqrt(Math.pow(a, 2) + Math.pow(n.height, 2)) / 5, d = this.render.convertToBook(s);
1946
2009
  return d.x > 0 && d.y > 0 && d.x < n.width && d.y < n.height && (d.x < l || d.x > n.width - l) && (d.y < l || d.y > n.height - l);
1947
2010
  }
1948
2011
  }
1949
- class $ {
1950
- constructor(i, n) {
1951
- this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = n, this.app = i;
2012
+ class S {
2013
+ constructor(s, n) {
2014
+ this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = n, this.app = s;
1952
2015
  const a = new RegExp("Version\\/[\\d\\.]+.*Safari/");
1953
2016
  this.safari = a.exec(window.navigator.userAgent) !== null;
1954
2017
  }
1955
- render(i) {
2018
+ render(s) {
1956
2019
  if (this.animation !== null) {
1957
- const n = Math.round((i - this.animation.startedAt) / this.animation.durationFrame);
2020
+ const n = Math.round((s - this.animation.startedAt) / this.animation.durationFrame);
1958
2021
  n < this.animation.frames.length ? this.animation.frames[n]() : (this.animation.onAnimateEnd(), this.animation = null);
1959
2022
  }
1960
- this.timer = i, this.drawFrame();
2023
+ this.timer = s, this.drawFrame();
1961
2024
  }
1962
2025
  start() {
1963
2026
  this.update();
1964
- const i = (n) => {
1965
- this.render(n), requestAnimationFrame(i);
2027
+ const s = (n) => {
2028
+ this.render(n), requestAnimationFrame(s);
1966
2029
  };
1967
- requestAnimationFrame(i);
2030
+ requestAnimationFrame(s);
1968
2031
  }
1969
- startAnimation(i, n, a) {
1970
- this.finishAnimation(), this.animation = { frames: i, duration: n, durationFrame: n / i.length, onAnimateEnd: a, startedAt: this.timer };
2032
+ startAnimation(s, n, a) {
2033
+ this.finishAnimation(), this.animation = { frames: s, duration: n, durationFrame: n / s.length, onAnimateEnd: a, startedAt: this.timer };
1971
2034
  }
1972
2035
  finishAnimation() {
1973
2036
  this.animation !== null && (this.animation.frames[this.animation.frames.length - 1](), this.animation.onAnimateEnd !== null && this.animation.onAnimateEnd()), this.animation = null;
1974
2037
  }
1975
2038
  update() {
1976
2039
  this.boundsRect = null;
1977
- const i = this.calculateBoundsRect();
1978
- this.orientation !== i && (this.orientation = i, this.app.updateOrientation(i));
2040
+ const s = this.calculateBoundsRect();
2041
+ this.orientation !== s && (this.orientation = s, this.app.updateOrientation(s));
1979
2042
  }
1980
2043
  calculateBoundsRect() {
1981
- let i = "landscape";
2044
+ let s = "landscape";
1982
2045
  const n = this.getBlockWidth(), a = n / 2, l = this.getBlockHeight() / 2, d = this.setting.width / this.setting.height;
1983
- let c = this.setting.width, v = this.setting.height, y = a - c;
1984
- return this.setting.size === "stretch" ? (n < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (i = "portrait"), c = i === "portrait" ? this.getBlockWidth() : this.getBlockWidth() / 2, c > this.setting.maxWidth && (c = this.setting.maxWidth), v = c / d, v > this.getBlockHeight() && (v = this.getBlockHeight(), c = v * d), y = i === "portrait" ? a - c / 2 - c : a - c) : n < 2 * c && this.app.getSettings().usePortrait && (i = "portrait", y = a - c / 2 - c), this.boundsRect = { left: y, top: l - v / 2, width: 2 * c, height: v, pageWidth: c }, i;
2046
+ let p = this.setting.width, y = this.setting.height, f = a - p;
2047
+ return this.setting.size === "stretch" ? (n < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (s = "portrait"), p = s === "portrait" ? this.getBlockWidth() : this.getBlockWidth() / 2, p > this.setting.maxWidth && (p = this.setting.maxWidth), y = p / d, y > this.getBlockHeight() && (y = this.getBlockHeight(), p = y * d), f = s === "portrait" ? a - p / 2 - p : a - p) : n < 2 * p && this.app.getSettings().usePortrait && (s = "portrait", f = a - p / 2 - p), this.boundsRect = { left: f, top: l - y / 2, width: 2 * p, height: y, pageWidth: p }, s;
1985
2048
  }
1986
- setShadowData(i, n, a, l) {
2049
+ setShadowData(s, n, a, l) {
1987
2050
  if (!this.app.getSettings().drawShadow) return;
1988
2051
  const d = 100 * this.getSettings().maxShadowOpacity;
1989
- this.shadow = { pos: i, angle: n, width: 3 * this.getRect().pageWidth / 4 * a / 100, opacity: (100 - a) * d / 100 / 100, direction: l, progress: 2 * a };
2052
+ this.shadow = { pos: s, angle: n, width: 3 * this.getRect().pageWidth / 4 * a / 100, opacity: (100 - a) * d / 100 / 100, direction: l, progress: 2 * a };
1990
2053
  }
1991
2054
  clearShadow() {
1992
2055
  this.shadow = null;
@@ -2009,48 +2072,48 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2009
2072
  getOrientation() {
2010
2073
  return this.orientation;
2011
2074
  }
2012
- setPageRect(i) {
2013
- this.pageRect = i;
2075
+ setPageRect(s) {
2076
+ this.pageRect = s;
2014
2077
  }
2015
- setDirection(i) {
2016
- this.direction = i;
2078
+ setDirection(s) {
2079
+ this.direction = s;
2017
2080
  }
2018
- setRightPage(i) {
2019
- i !== null && i.setOrientation(1), this.rightPage = i;
2081
+ setRightPage(s) {
2082
+ s !== null && s.setOrientation(1), this.rightPage = s;
2020
2083
  }
2021
- setLeftPage(i) {
2022
- i !== null && i.setOrientation(0), this.leftPage = i;
2084
+ setLeftPage(s) {
2085
+ s !== null && s.setOrientation(0), this.leftPage = s;
2023
2086
  }
2024
- setBottomPage(i) {
2025
- i !== null && i.setOrientation(this.direction === 1 ? 0 : 1), this.bottomPage = i;
2087
+ setBottomPage(s) {
2088
+ s !== null && s.setOrientation(this.direction === 1 ? 0 : 1), this.bottomPage = s;
2026
2089
  }
2027
- setFlippingPage(i) {
2028
- i !== null && i.setOrientation(this.direction === 0 && this.orientation !== "portrait" ? 0 : 1), this.flippingPage = i;
2090
+ setFlippingPage(s) {
2091
+ s !== null && s.setOrientation(this.direction === 0 && this.orientation !== "portrait" ? 0 : 1), this.flippingPage = s;
2029
2092
  }
2030
- convertToBook(i) {
2093
+ convertToBook(s) {
2031
2094
  const n = this.getRect();
2032
- return { x: i.x - n.left, y: i.y - n.top };
2095
+ return { x: s.x - n.left, y: s.y - n.top };
2033
2096
  }
2034
2097
  isSafari() {
2035
2098
  return this.safari;
2036
2099
  }
2037
- convertToPage(i, n) {
2100
+ convertToPage(s, n) {
2038
2101
  n || (n = this.direction);
2039
2102
  const a = this.getRect();
2040
- return { x: n === 0 ? i.x - a.left - a.width / 2 : a.width / 2 - i.x + a.left, y: i.y - a.top };
2103
+ return { x: n === 0 ? s.x - a.left - a.width / 2 : a.width / 2 - s.x + a.left, y: s.y - a.top };
2041
2104
  }
2042
- convertToGlobal(i, n) {
2043
- if (n || (n = this.direction), i == null) return null;
2105
+ convertToGlobal(s, n) {
2106
+ if (n || (n = this.direction), s == null) return null;
2044
2107
  const a = this.getRect();
2045
- return { x: n === 0 ? i.x + a.left + a.width / 2 : a.width / 2 - i.x + a.left, y: i.y + a.top };
2108
+ return { x: n === 0 ? s.x + a.left + a.width / 2 : a.width / 2 - s.x + a.left, y: s.y + a.top };
2046
2109
  }
2047
- convertRectToGlobal(i, n) {
2048
- return n || (n = this.direction), { topLeft: this.convertToGlobal(i.topLeft, n), topRight: this.convertToGlobal(i.topRight, n), bottomLeft: this.convertToGlobal(i.bottomLeft, n), bottomRight: this.convertToGlobal(i.bottomRight, n) };
2110
+ convertRectToGlobal(s, n) {
2111
+ return n || (n = this.direction), { topLeft: this.convertToGlobal(s.topLeft, n), topRight: this.convertToGlobal(s.topRight, n), bottomLeft: this.convertToGlobal(s.bottomLeft, n), bottomRight: this.convertToGlobal(s.bottomRight, n) };
2049
2112
  }
2050
2113
  }
2051
- class C extends $ {
2052
- constructor(i, n, a) {
2053
- super(i, n), this.canvas = a, this.ctx = a.getContext("2d");
2114
+ class T extends S {
2115
+ constructor(s, n, a) {
2116
+ super(s, n), this.canvas = a, this.ctx = a.getContext("2d");
2054
2117
  }
2055
2118
  getContext() {
2056
2119
  return this.ctx;
@@ -2059,79 +2122,79 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2059
2122
  }
2060
2123
  drawFrame() {
2061
2124
  this.clear(), this.orientation !== "portrait" && this.leftPage != null && this.leftPage.simpleDraw(0), this.rightPage != null && this.rightPage.simpleDraw(1), this.bottomPage != null && this.bottomPage.draw(), this.drawBookShadow(), this.flippingPage != null && this.flippingPage.draw(), this.shadow != null && (this.drawOuterShadow(), this.drawInnerShadow());
2062
- const i = this.getRect();
2063
- this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(i.left + i.pageWidth, i.top, i.width, i.height), this.ctx.clip());
2125
+ const s = this.getRect();
2126
+ this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(s.left + s.pageWidth, s.top, s.width, s.height), this.ctx.clip());
2064
2127
  }
2065
2128
  drawBookShadow() {
2066
- const i = this.getRect();
2129
+ const s = this.getRect();
2067
2130
  this.ctx.save(), this.ctx.beginPath();
2068
- const n = i.width / 20;
2069
- this.ctx.rect(i.left, i.top, i.width, i.height);
2070
- const a = { x: i.left + i.width / 2 - n / 2, y: 0 };
2131
+ const n = s.width / 20;
2132
+ this.ctx.rect(s.left, s.top, s.width, s.height);
2133
+ const a = { x: s.left + s.width / 2 - n / 2, y: 0 };
2071
2134
  this.ctx.translate(a.x, a.y);
2072
2135
  const l = this.ctx.createLinearGradient(0, 0, n, 0);
2073
- l.addColorStop(0, "rgba(0, 0, 0, 0)"), l.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), l.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), l.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), l.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), l.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = l, this.ctx.fillRect(0, 0, n, 2 * i.height), this.ctx.restore();
2136
+ l.addColorStop(0, "rgba(0, 0, 0, 0)"), l.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), l.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), l.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), l.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), l.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = l, this.ctx.fillRect(0, 0, n, 2 * s.height), this.ctx.restore();
2074
2137
  }
2075
2138
  drawOuterShadow() {
2076
- const i = this.getRect();
2077
- this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(i.left, i.top, i.width, i.height);
2139
+ const s = this.getRect();
2140
+ this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(s.left, s.top, s.width, s.height);
2078
2141
  const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y });
2079
2142
  this.ctx.translate(n.x, n.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
2080
2143
  const a = this.ctx.createLinearGradient(0, 0, this.shadow.width, 0);
2081
- this.shadow.direction === 0 ? (this.ctx.translate(0, -100), a.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), a.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), a.addColorStop(0, "rgba(0, 0, 0, 0)"), a.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = a, this.ctx.fillRect(0, 0, this.shadow.width, 2 * i.height), this.ctx.restore();
2144
+ this.shadow.direction === 0 ? (this.ctx.translate(0, -100), a.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), a.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), a.addColorStop(0, "rgba(0, 0, 0, 0)"), a.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = a, this.ctx.fillRect(0, 0, this.shadow.width, 2 * s.height), this.ctx.restore();
2082
2145
  }
2083
2146
  drawInnerShadow() {
2084
- const i = this.getRect();
2147
+ const s = this.getRect();
2085
2148
  this.ctx.save(), this.ctx.beginPath();
2086
2149
  const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.convertRectToGlobal(this.pageRect);
2087
2150
  this.ctx.moveTo(a.topLeft.x, a.topLeft.y), this.ctx.lineTo(a.topRight.x, a.topRight.y), this.ctx.lineTo(a.bottomRight.x, a.bottomRight.y), this.ctx.lineTo(a.bottomLeft.x, a.bottomLeft.y), this.ctx.translate(n.x, n.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
2088
2151
  const l = 3 * this.shadow.width / 4, d = this.ctx.createLinearGradient(0, 0, l, 0);
2089
- this.shadow.direction === 0 ? (this.ctx.translate(-l, -100), d.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), d.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = d, this.ctx.fillRect(0, 0, l, 2 * i.height), this.ctx.restore();
2152
+ this.shadow.direction === 0 ? (this.ctx.translate(-l, -100), d.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), d.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = d, this.ctx.fillRect(0, 0, l, 2 * s.height), this.ctx.restore();
2090
2153
  }
2091
2154
  clear() {
2092
2155
  this.ctx.fillStyle = "white", this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
2093
2156
  }
2094
2157
  }
2095
- class T {
2096
- constructor(i, n, a) {
2158
+ class A {
2159
+ constructor(s, n, a) {
2097
2160
  this.touchPoint = null, this.swipeTimeout = 250, this.onResize = () => {
2098
2161
  this.update();
2099
2162
  }, this.onMouseDown = (d) => {
2100
2163
  if (this.checkTarget(d.target)) {
2101
- const c = this.getMousePos(d.clientX, d.clientY);
2102
- this.app.startUserTouch(c), d.preventDefault();
2164
+ const p = this.getMousePos(d.clientX, d.clientY);
2165
+ this.app.startUserTouch(p), d.preventDefault();
2103
2166
  }
2104
2167
  }, this.onTouchStart = (d) => {
2105
2168
  if (this.checkTarget(d.target) && d.changedTouches.length > 0) {
2106
- const c = d.changedTouches[0], v = this.getMousePos(c.clientX, c.clientY);
2107
- this.touchPoint = { point: v, time: Date.now() }, setTimeout(() => {
2108
- this.touchPoint !== null && this.app.startUserTouch(v);
2169
+ const p = d.changedTouches[0], y = this.getMousePos(p.clientX, p.clientY);
2170
+ this.touchPoint = { point: y, time: Date.now() }, setTimeout(() => {
2171
+ this.touchPoint !== null && this.app.startUserTouch(y);
2109
2172
  }, this.swipeTimeout), this.app.getSettings().mobileScrollSupport || d.preventDefault();
2110
2173
  }
2111
2174
  }, this.onMouseUp = (d) => {
2112
- const c = this.getMousePos(d.clientX, d.clientY);
2113
- this.app.userStop(c);
2175
+ const p = this.getMousePos(d.clientX, d.clientY);
2176
+ this.app.userStop(p);
2114
2177
  }, this.onMouseMove = (d) => {
2115
- const c = this.getMousePos(d.clientX, d.clientY);
2116
- this.app.userMove(c, !1);
2178
+ const p = this.getMousePos(d.clientX, d.clientY);
2179
+ this.app.userMove(p, !1);
2117
2180
  }, this.onTouchMove = (d) => {
2118
2181
  if (d.changedTouches.length > 0) {
2119
- const c = d.changedTouches[0], v = this.getMousePos(c.clientX, c.clientY);
2120
- this.app.getSettings().mobileScrollSupport ? (this.touchPoint !== null && (Math.abs(this.touchPoint.point.x - v.x) > 10 || this.app.getState() !== "read") && d.cancelable && this.app.userMove(v, !0), this.app.getState() !== "read" && d.preventDefault()) : this.app.userMove(v, !0);
2182
+ const p = d.changedTouches[0], y = this.getMousePos(p.clientX, p.clientY);
2183
+ this.app.getSettings().mobileScrollSupport ? (this.touchPoint !== null && (Math.abs(this.touchPoint.point.x - y.x) > 10 || this.app.getState() !== "read") && d.cancelable && this.app.userMove(y, !0), this.app.getState() !== "read" && d.preventDefault()) : this.app.userMove(y, !0);
2121
2184
  }
2122
2185
  }, this.onTouchEnd = (d) => {
2123
2186
  if (d.changedTouches.length > 0) {
2124
- const c = d.changedTouches[0], v = this.getMousePos(c.clientX, c.clientY);
2125
- let y = !1;
2187
+ const p = d.changedTouches[0], y = this.getMousePos(p.clientX, p.clientY);
2188
+ let f = !1;
2126
2189
  if (this.touchPoint !== null) {
2127
- const A = v.x - this.touchPoint.point.x, R = Math.abs(v.y - this.touchPoint.point.y);
2128
- Math.abs(A) > this.swipeDistance && R < 2 * this.swipeDistance && Date.now() - this.touchPoint.time < this.swipeTimeout && (A > 0 ? this.app.flipPrev(this.touchPoint.point.y < this.app.getRender().getRect().height / 2 ? "top" : "bottom") : this.app.flipNext(this.touchPoint.point.y < this.app.getRender().getRect().height / 2 ? "top" : "bottom"), y = !0), this.touchPoint = null;
2190
+ const E = y.x - this.touchPoint.point.x, R = Math.abs(y.y - this.touchPoint.point.y);
2191
+ Math.abs(E) > this.swipeDistance && R < 2 * this.swipeDistance && Date.now() - this.touchPoint.time < this.swipeTimeout && (E > 0 ? this.app.flipPrev(this.touchPoint.point.y < this.app.getRender().getRect().height / 2 ? "top" : "bottom") : this.app.flipNext(this.touchPoint.point.y < this.app.getRender().getRect().height / 2 ? "top" : "bottom"), f = !0), this.touchPoint = null;
2129
2192
  }
2130
- this.app.userStop(v, y);
2193
+ this.app.userStop(y, f);
2131
2194
  }
2132
- }, this.parentElement = i, i.classList.add("stf__parent"), i.insertAdjacentHTML("afterbegin", '<div class="stf__wrapper"></div>'), this.wrapper = i.querySelector(".stf__wrapper"), this.app = n;
2195
+ }, this.parentElement = s, s.classList.add("stf__parent"), s.insertAdjacentHTML("afterbegin", '<div class="stf__wrapper"></div>'), this.wrapper = s.querySelector(".stf__wrapper"), this.app = n;
2133
2196
  const l = this.app.getSettings().usePortrait ? 1 : 2;
2134
- i.style.minWidth = a.minWidth * l + "px", i.style.minHeight = a.minHeight + "px", a.size === "fixed" && (i.style.minWidth = a.width * l + "px", i.style.minHeight = a.height + "px"), a.autoSize && (i.style.width = "100%", i.style.maxWidth = 2 * a.maxWidth + "px"), i.style.display = "block", window.addEventListener("resize", this.onResize, !1), this.swipeDistance = a.swipeDistance;
2197
+ s.style.minWidth = a.minWidth * l + "px", s.style.minHeight = a.minHeight + "px", a.size === "fixed" && (s.style.minWidth = a.width * l + "px", s.style.minHeight = a.height + "px"), a.autoSize && (s.style.width = "100%", s.style.maxWidth = 2 * a.maxWidth + "px"), s.style.display = "block", window.addEventListener("resize", this.onResize, !1), this.swipeDistance = a.swipeDistance;
2135
2198
  }
2136
2199
  destroy() {
2137
2200
  this.app.getSettings().useMouseEvents && this.removeHandlers(), this.distElement.remove(), this.wrapper.remove();
@@ -2142,8 +2205,8 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2142
2205
  getWrapper() {
2143
2206
  return this.wrapper;
2144
2207
  }
2145
- setOrientationStyle(i) {
2146
- this.wrapper.classList.remove("--portrait", "--landscape"), i === "portrait" ? (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / this.app.getSettings().width * 100 + "%"), this.wrapper.classList.add("--portrait")) : (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / (2 * this.app.getSettings().width) * 100 + "%"), this.wrapper.classList.add("--landscape")), this.update();
2208
+ setOrientationStyle(s) {
2209
+ this.wrapper.classList.remove("--portrait", "--landscape"), s === "portrait" ? (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / this.app.getSettings().width * 100 + "%"), this.wrapper.classList.add("--portrait")) : (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / (2 * this.app.getSettings().width) * 100 + "%"), this.wrapper.classList.add("--landscape")), this.update();
2147
2210
  }
2148
2211
  removeHandlers() {
2149
2212
  window.removeEventListener("resize", this.onResize), this.distElement.removeEventListener("mousedown", this.onMouseDown), this.distElement.removeEventListener("touchstart", this.onTouchStart), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("touchend", this.onTouchEnd);
@@ -2151,38 +2214,38 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2151
2214
  setHandlers() {
2152
2215
  window.addEventListener("resize", this.onResize, !1), this.app.getSettings().useMouseEvents && (this.distElement.addEventListener("mousedown", this.onMouseDown), this.distElement.addEventListener("touchstart", this.onTouchStart), window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("touchmove", this.onTouchMove, { passive: !this.app.getSettings().mobileScrollSupport }), window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("touchend", this.onTouchEnd));
2153
2216
  }
2154
- getMousePos(i, n) {
2217
+ getMousePos(s, n) {
2155
2218
  const a = this.distElement.getBoundingClientRect();
2156
- return { x: i - a.left, y: n - a.top };
2219
+ return { x: s - a.left, y: n - a.top };
2157
2220
  }
2158
- checkTarget(i) {
2159
- return !this.app.getSettings().clickEventForward || !["a", "button"].includes(i.tagName.toLowerCase());
2221
+ checkTarget(s) {
2222
+ return !this.app.getSettings().clickEventForward || !["a", "button"].includes(s.tagName.toLowerCase());
2160
2223
  }
2161
2224
  }
2162
- class F extends T {
2163
- constructor(i, n, a, l) {
2164
- super(i, n, a), this.wrapper.insertAdjacentHTML("afterbegin", '<div class="stf__block"></div>'), this.distElement = i.querySelector(".stf__block"), this.items = l;
2225
+ class L extends A {
2226
+ constructor(s, n, a, l) {
2227
+ super(s, n, a), this.wrapper.insertAdjacentHTML("afterbegin", '<div class="stf__block"></div>'), this.distElement = s.querySelector(".stf__block"), this.items = l;
2165
2228
  for (const d of l) this.distElement.appendChild(d);
2166
2229
  this.setHandlers();
2167
2230
  }
2168
2231
  clear() {
2169
- for (const i of this.items) this.parentElement.appendChild(i);
2232
+ for (const s of this.items) this.parentElement.appendChild(s);
2170
2233
  }
2171
- updateItems(i) {
2234
+ updateItems(s) {
2172
2235
  this.removeHandlers(), this.distElement.innerHTML = "";
2173
- for (const n of i) this.distElement.appendChild(n);
2174
- this.items = i, this.setHandlers();
2236
+ for (const n of s) this.distElement.appendChild(n);
2237
+ this.items = s, this.setHandlers();
2175
2238
  }
2176
2239
  update() {
2177
2240
  this.app.getRender().update();
2178
2241
  }
2179
2242
  }
2180
- class B extends T {
2181
- constructor(i, n, a) {
2182
- super(i, n, a), this.wrapper.innerHTML = '<canvas class="stf__canvas"></canvas>', this.canvas = i.querySelectorAll("canvas")[0], this.distElement = this.canvas, this.resizeCanvas(), this.setHandlers();
2243
+ class U extends A {
2244
+ constructor(s, n, a) {
2245
+ super(s, n, a), this.wrapper.innerHTML = '<canvas class="stf__canvas"></canvas>', this.canvas = s.querySelectorAll("canvas")[0], this.distElement = this.canvas, this.resizeCanvas(), this.setHandlers();
2183
2246
  }
2184
2247
  resizeCanvas() {
2185
- const i = getComputedStyle(this.canvas), n = parseInt(i.getPropertyValue("width"), 10), a = parseInt(i.getPropertyValue("height"), 10);
2248
+ const s = getComputedStyle(this.canvas), n = parseInt(s.getPropertyValue("width"), 10), a = parseInt(s.getPropertyValue("height"), 10);
2186
2249
  this.canvas.width = n, this.canvas.height = a;
2187
2250
  }
2188
2251
  getCanvas() {
@@ -2192,9 +2255,9 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2192
2255
  this.resizeCanvas(), this.app.getRender().update();
2193
2256
  }
2194
2257
  }
2195
- class H extends $ {
2196
- constructor(i, n, a) {
2197
- super(i, n), this.outerShadow = null, this.innerShadow = null, this.hardShadow = null, this.hardInnerShadow = null, this.element = a, this.createShadows();
2258
+ class N extends S {
2259
+ constructor(s, n, a) {
2260
+ super(s, n), this.outerShadow = null, this.innerShadow = null, this.hardShadow = null, this.hardInnerShadow = null, this.element = a, this.createShadows();
2198
2261
  }
2199
2262
  createShadows() {
2200
2263
  this.element.insertAdjacentHTML("beforeend", `<div class="stf__outerShadow"></div>
@@ -2209,82 +2272,82 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2209
2272
  this.element.querySelector(".stf__outerShadow") || this.createShadows();
2210
2273
  }
2211
2274
  drawHardInnerShadow() {
2212
- const i = this.getRect(), n = this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress;
2213
- let a = (100 - n) * (2.5 * i.pageWidth) / 100 + 20;
2214
- a > i.pageWidth && (a = i.pageWidth);
2275
+ const s = this.getRect(), n = this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress;
2276
+ let a = (100 - n) * (2.5 * s.pageWidth) / 100 + 20;
2277
+ a > s.pageWidth && (a = s.pageWidth);
2215
2278
  let l = `
2216
2279
  display: block;
2217
2280
  z-index: ${(this.getSettings().startZIndex + 5).toString(10)};
2218
2281
  width: ${a}px;
2219
- height: ${i.height}px;
2282
+ height: ${s.height}px;
2220
2283
  background: linear-gradient(to right,
2221
2284
  rgba(0, 0, 0, ${this.shadow.opacity * n / 100}) 5%,
2222
2285
  rgba(0, 0, 0, 0) 100%);
2223
- left: ${i.left + i.width / 2}px;
2286
+ left: ${s.left + s.width / 2}px;
2224
2287
  transform-origin: 0 0;
2225
2288
  `;
2226
2289
  l += this.getDirection() === 0 && this.shadow.progress > 100 || this.getDirection() === 1 && this.shadow.progress <= 100 ? "transform: translate3d(0, 0, 0);" : "transform: translate3d(0, 0, 0) rotateY(180deg);", this.hardInnerShadow.style.cssText = l;
2227
2290
  }
2228
2291
  drawHardOuterShadow() {
2229
- const i = this.getRect();
2230
- let n = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 * i.pageWidth) / 100 + 20;
2231
- n > i.pageWidth && (n = i.pageWidth);
2292
+ const s = this.getRect();
2293
+ let n = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 * s.pageWidth) / 100 + 20;
2294
+ n > s.pageWidth && (n = s.pageWidth);
2232
2295
  let a = `
2233
2296
  display: block;
2234
2297
  z-index: ${(this.getSettings().startZIndex + 4).toString(10)};
2235
2298
  width: ${n}px;
2236
- height: ${i.height}px;
2299
+ height: ${s.height}px;
2237
2300
  background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);
2238
- left: ${i.left + i.width / 2}px;
2301
+ left: ${s.left + s.width / 2}px;
2239
2302
  transform-origin: 0 0;
2240
2303
  `;
2241
2304
  a += this.getDirection() === 0 && this.shadow.progress > 100 || this.getDirection() === 1 && this.shadow.progress <= 100 ? "transform: translate3d(0, 0, 0) rotateY(180deg);" : "transform: translate3d(0, 0, 0);", this.hardShadow.style.cssText = a;
2242
2305
  }
2243
2306
  drawInnerShadow() {
2244
- const i = this.getRect(), n = 3 * this.shadow.width / 4, a = this.getDirection() === 0 ? n : 0, l = this.getDirection() === 0 ? "to left" : "to right", d = this.convertToGlobal(this.shadow.pos), c = this.shadow.angle + 3 * Math.PI / 2, v = [this.pageRect.topLeft, this.pageRect.topRight, this.pageRect.bottomRight, this.pageRect.bottomLeft];
2245
- let y = "polygon( ";
2246
- for (const R of v) {
2247
- let W = this.getDirection() === 1 ? { x: -R.x + this.shadow.pos.x, y: R.y - this.shadow.pos.y } : { x: R.x - this.shadow.pos.x, y: R.y - this.shadow.pos.y };
2248
- W = g.GetRotatedPoint(W, { x: a, y: 100 }, c), y += W.x + "px " + W.y + "px, ";
2307
+ const s = this.getRect(), n = 3 * this.shadow.width / 4, a = this.getDirection() === 0 ? n : 0, l = this.getDirection() === 0 ? "to left" : "to right", d = this.convertToGlobal(this.shadow.pos), p = this.shadow.angle + 3 * Math.PI / 2, y = [this.pageRect.topLeft, this.pageRect.topRight, this.pageRect.bottomRight, this.pageRect.bottomLeft];
2308
+ let f = "polygon( ";
2309
+ for (const R of y) {
2310
+ let O = this.getDirection() === 1 ? { x: -R.x + this.shadow.pos.x, y: R.y - this.shadow.pos.y } : { x: R.x - this.shadow.pos.x, y: R.y - this.shadow.pos.y };
2311
+ O = c.GetRotatedPoint(O, { x: a, y: 100 }, p), f += O.x + "px " + O.y + "px, ";
2249
2312
  }
2250
- y = y.slice(0, -2), y += ")";
2251
- const A = `
2313
+ f = f.slice(0, -2), f += ")";
2314
+ const E = `
2252
2315
  display: block;
2253
2316
  z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
2254
2317
  width: ${n}px;
2255
- height: ${2 * i.height}px;
2318
+ height: ${2 * s.height}px;
2256
2319
  background: linear-gradient(${l},
2257
2320
  rgba(0, 0, 0, ${this.shadow.opacity}) 5%,
2258
2321
  rgba(0, 0, 0, 0.05) 15%,
2259
2322
  rgba(0, 0, 0, ${this.shadow.opacity}) 35%,
2260
2323
  rgba(0, 0, 0, 0) 100%);
2261
2324
  transform-origin: ${a}px 100px;
2262
- transform: translate3d(${d.x - a}px, ${d.y - 100}px, 0) rotate(${c}rad);
2263
- clip-path: ${y};
2264
- -webkit-clip-path: ${y};
2325
+ transform: translate3d(${d.x - a}px, ${d.y - 100}px, 0) rotate(${p}rad);
2326
+ clip-path: ${f};
2327
+ -webkit-clip-path: ${f};
2265
2328
  `;
2266
- this.innerShadow.style.cssText = A;
2329
+ this.innerShadow.style.cssText = E;
2267
2330
  }
2268
2331
  drawOuterShadow() {
2269
- const i = this.getRect(), n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.shadow.angle + 3 * Math.PI / 2, l = this.getDirection() === 1 ? this.shadow.width : 0, d = this.getDirection() === 0 ? "to right" : "to left", c = [{ x: 0, y: 0 }, { x: i.pageWidth, y: 0 }, { x: i.pageWidth, y: i.height }, { x: 0, y: i.height }];
2270
- let v = "polygon( ";
2271
- for (const A of c) if (A !== null) {
2272
- let R = this.getDirection() === 1 ? { x: -A.x + this.shadow.pos.x, y: A.y - this.shadow.pos.y } : { x: A.x - this.shadow.pos.x, y: A.y - this.shadow.pos.y };
2273
- R = g.GetRotatedPoint(R, { x: l, y: 100 }, a), v += R.x + "px " + R.y + "px, ";
2332
+ const s = this.getRect(), n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.shadow.angle + 3 * Math.PI / 2, l = this.getDirection() === 1 ? this.shadow.width : 0, d = this.getDirection() === 0 ? "to right" : "to left", p = [{ x: 0, y: 0 }, { x: s.pageWidth, y: 0 }, { x: s.pageWidth, y: s.height }, { x: 0, y: s.height }];
2333
+ let y = "polygon( ";
2334
+ for (const E of p) if (E !== null) {
2335
+ let R = this.getDirection() === 1 ? { x: -E.x + this.shadow.pos.x, y: E.y - this.shadow.pos.y } : { x: E.x - this.shadow.pos.x, y: E.y - this.shadow.pos.y };
2336
+ R = c.GetRotatedPoint(R, { x: l, y: 100 }, a), y += R.x + "px " + R.y + "px, ";
2274
2337
  }
2275
- v = v.slice(0, -2), v += ")";
2276
- const y = `
2338
+ y = y.slice(0, -2), y += ")";
2339
+ const f = `
2277
2340
  display: block;
2278
2341
  z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
2279
2342
  width: ${this.shadow.width}px;
2280
- height: ${2 * i.height}px;
2343
+ height: ${2 * s.height}px;
2281
2344
  background: linear-gradient(${d}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));
2282
2345
  transform-origin: ${l}px 100px;
2283
2346
  transform: translate3d(${n.x - l}px, ${n.y - 100}px, 0) rotate(${a}rad);
2284
- clip-path: ${v};
2285
- -webkit-clip-path: ${v};
2347
+ clip-path: ${y};
2348
+ -webkit-clip-path: ${y};
2286
2349
  `;
2287
- this.outerShadow.style.cssText = y;
2350
+ this.outerShadow.style.cssText = f;
2288
2351
  }
2289
2352
  drawLeftPage() {
2290
2353
  this.orientation !== "portrait" && this.leftPage !== null && (this.direction === 1 && this.flippingPage !== null && this.flippingPage.getDrawingDensity() === "hard" ? (this.leftPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.leftPage.setHardDrawingAngle(180 + this.flippingPage.getHardAngle()), this.leftPage.draw(this.flippingPage.getDrawingDensity())) : this.leftPage.simpleDraw(0));
@@ -2294,37 +2357,37 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2294
2357
  }
2295
2358
  drawBottomPage() {
2296
2359
  if (this.bottomPage === null) return;
2297
- const i = this.flippingPage != null ? this.flippingPage.getDrawingDensity() : null;
2298
- this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(i));
2360
+ const s = this.flippingPage != null ? this.flippingPage.getDrawingDensity() : null;
2361
+ this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(s));
2299
2362
  }
2300
2363
  drawFrame() {
2301
2364
  this.clear(), this.drawLeftPage(), this.drawRightPage(), this.drawBottomPage(), this.flippingPage != null && (this.flippingPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.flippingPage.draw()), this.shadow != null && this.flippingPage !== null && (this.flippingPage.getDrawingDensity() === "soft" ? (this.drawOuterShadow(), this.drawInnerShadow()) : (this.drawHardOuterShadow(), this.drawHardInnerShadow()));
2302
2365
  }
2303
2366
  clear() {
2304
- for (const i of this.app.getPageCollection().getPages()) i !== this.leftPage && i !== this.rightPage && i !== this.flippingPage && i !== this.bottomPage && (i.getElement().style.cssText = "display: none"), i.getTemporaryCopy() !== this.flippingPage && i.hideTemporaryCopy();
2367
+ for (const s of this.app.getPageCollection().getPages()) s !== this.leftPage && s !== this.rightPage && s !== this.flippingPage && s !== this.bottomPage && (s.getElement().style.cssText = "display: none"), s.getTemporaryCopy() !== this.flippingPage && s.hideTemporaryCopy();
2305
2368
  }
2306
2369
  update() {
2307
2370
  super.update(), this.rightPage !== null && this.rightPage.setOrientation(1), this.leftPage !== null && this.leftPage.setOrientation(0);
2308
2371
  }
2309
2372
  }
2310
- class N {
2373
+ class H {
2311
2374
  constructor() {
2312
2375
  this._default = { startPage: 0, size: "fixed", width: 0, height: 0, minWidth: 0, maxWidth: 0, minHeight: 0, maxHeight: 0, drawShadow: !0, flippingTime: 1e3, usePortrait: !0, startZIndex: 0, autoSize: !0, maxShadowOpacity: 1, showCover: !1, mobileScrollSupport: !0, swipeDistance: 30, clickEventForward: !0, useMouseEvents: !0, showPageCorners: !0, disableFlipByClick: !1 };
2313
2376
  }
2314
- getSettings(i) {
2377
+ getSettings(s) {
2315
2378
  const n = this._default;
2316
- if (Object.assign(n, i), n.size !== "stretch" && n.size !== "fixed") throw new Error('Invalid size type. Available only "fixed" and "stretch" value');
2379
+ if (Object.assign(n, s), n.size !== "stretch" && n.size !== "fixed") throw new Error('Invalid size type. Available only "fixed" and "stretch" value');
2317
2380
  if (n.width <= 0 || n.height <= 0) throw new Error("Invalid width or height");
2318
2381
  if (n.flippingTime <= 0) throw new Error("Invalid flipping time");
2319
2382
  return n.size === "stretch" ? (n.minWidth <= 0 && (n.minWidth = 100), n.maxWidth < n.minWidth && (n.maxWidth = 2e3), n.minHeight <= 0 && (n.minHeight = 100), n.maxHeight < n.minHeight && (n.maxHeight = 2e3)) : (n.minWidth = n.width, n.maxWidth = n.width, n.minHeight = n.height, n.maxHeight = n.height), n;
2320
2383
  }
2321
2384
  }
2322
- (function(f, i) {
2323
- i === void 0 && (i = {});
2324
- var n = i.insertAt;
2385
+ (function(m, s) {
2386
+ s === void 0 && (s = {});
2387
+ var n = s.insertAt;
2325
2388
  if (typeof document < "u") {
2326
2389
  var a = document.head || document.getElementsByTagName("head")[0], l = document.createElement("style");
2327
- l.type = "text/css", n === "top" && a.firstChild ? a.insertBefore(l, a.firstChild) : a.appendChild(l), l.styleSheet ? l.styleSheet.cssText = f : l.appendChild(document.createTextNode(f));
2390
+ l.type = "text/css", n === "top" && a.firstChild ? a.insertBefore(l, a.firstChild) : a.appendChild(l), l.styleSheet ? l.styleSheet.cssText = m : l.appendChild(document.createTextNode(m));
2328
2391
  }
2329
2392
  })(`.stf__parent {
2330
2393
  position: relative;
@@ -2386,22 +2449,22 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2386
2449
  position: absolute;
2387
2450
  left: 0;
2388
2451
  top: 0;
2389
- }`), s.PageFlip = class extends class {
2452
+ }`), i.PageFlip = class extends class {
2390
2453
  constructor() {
2391
2454
  this.events = /* @__PURE__ */ new Map();
2392
2455
  }
2393
- on(f, i) {
2394
- return this.events.has(f) ? this.events.get(f).push(i) : this.events.set(f, [i]), this;
2456
+ on(m, s) {
2457
+ return this.events.has(m) ? this.events.get(m).push(s) : this.events.set(m, [s]), this;
2395
2458
  }
2396
- off(f) {
2397
- this.events.delete(f);
2459
+ off(m) {
2460
+ this.events.delete(m);
2398
2461
  }
2399
- trigger(f, i, n = null) {
2400
- if (this.events.has(f)) for (const a of this.events.get(f)) a({ data: n, object: i });
2462
+ trigger(m, s, n = null) {
2463
+ if (this.events.has(m)) for (const a of this.events.get(m)) a({ data: n, object: s });
2401
2464
  }
2402
2465
  } {
2403
- constructor(f, i) {
2404
- super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new N().getSettings(i), this.block = f;
2466
+ constructor(m, s) {
2467
+ super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new H().getSettings(s), this.block = m;
2405
2468
  }
2406
2469
  destroy() {
2407
2470
  this.ui.destroy(), this.block.remove();
@@ -2409,25 +2472,25 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2409
2472
  update() {
2410
2473
  this.render.update(), this.pages.show();
2411
2474
  }
2412
- loadFromImages(f) {
2413
- this.ui = new B(this.block, this, this.setting);
2414
- const i = this.ui.getCanvas();
2415
- this.render = new C(this, this.setting, i), this.flipController = new D(this.render, this), this.pages = new u(this, this.render, f), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2475
+ loadFromImages(m) {
2476
+ this.ui = new U(this.block, this, this.setting);
2477
+ const s = this.ui.getCanvas();
2478
+ this.render = new T(this, this.setting, s), this.flipController = new I(this.render, this), this.pages = new u(this, this.render, m), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2416
2479
  this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
2417
2480
  }, 1);
2418
2481
  }
2419
- loadFromHTML(f) {
2420
- this.ui = new F(this.block, this, this.setting, f), this.render = new H(this, this.setting, this.ui.getDistElement()), this.flipController = new D(this.render, this), this.pages = new P(this, this.render, this.ui.getDistElement(), f), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2482
+ loadFromHTML(m) {
2483
+ this.ui = new L(this.block, this, this.setting, m), this.render = new N(this, this.setting, this.ui.getDistElement()), this.flipController = new I(this.render, this), this.pages = new P(this, this.render, this.ui.getDistElement(), m), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2421
2484
  this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
2422
2485
  }, 1);
2423
2486
  }
2424
- updateFromImages(f) {
2425
- const i = this.pages.getCurrentPageIndex();
2426
- this.pages.destroy(), this.pages = new u(this, this.render, f), this.pages.load(), this.pages.show(i), this.trigger("update", this, { page: i, mode: this.render.getOrientation() });
2487
+ updateFromImages(m) {
2488
+ const s = this.pages.getCurrentPageIndex();
2489
+ this.pages.destroy(), this.pages = new u(this, this.render, m), this.pages.load(), this.pages.show(s), this.trigger("update", this, { page: s, mode: this.render.getOrientation() });
2427
2490
  }
2428
- updateFromHtml(f) {
2429
- const i = this.pages.getCurrentPageIndex();
2430
- this.pages.destroy(), this.pages = new P(this, this.render, this.ui.getDistElement(), f), this.pages.load(), this.ui.updateItems(f), this.render.reload(), this.pages.show(i), this.trigger("update", this, { page: i, mode: this.render.getOrientation() });
2491
+ updateFromHtml(m) {
2492
+ const s = this.pages.getCurrentPageIndex();
2493
+ this.pages.destroy(), this.pages = new P(this, this.render, this.ui.getDistElement(), m), this.pages.load(), this.ui.updateItems(m), this.render.reload(), this.pages.show(s), this.trigger("update", this, { page: s, mode: this.render.getOrientation() });
2431
2494
  }
2432
2495
  clear() {
2433
2496
  this.pages.destroy(), this.ui.clear();
@@ -2438,26 +2501,26 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2438
2501
  turnToNextPage() {
2439
2502
  this.pages.showNext();
2440
2503
  }
2441
- turnToPage(f) {
2442
- this.pages.show(f);
2504
+ turnToPage(m) {
2505
+ this.pages.show(m);
2443
2506
  }
2444
- flipNext(f = "top") {
2445
- this.flipController.flipNext(f);
2507
+ flipNext(m = "top") {
2508
+ this.flipController.flipNext(m);
2446
2509
  }
2447
- flipPrev(f = "top") {
2448
- this.flipController.flipPrev(f);
2510
+ flipPrev(m = "top") {
2511
+ this.flipController.flipPrev(m);
2449
2512
  }
2450
- flip(f, i = "top") {
2451
- this.flipController.flipToPage(f, i);
2513
+ flip(m, s = "top") {
2514
+ this.flipController.flipToPage(m, s);
2452
2515
  }
2453
- updateState(f) {
2454
- this.trigger("changeState", this, f);
2516
+ updateState(m) {
2517
+ this.trigger("changeState", this, m);
2455
2518
  }
2456
- updatePageIndex(f) {
2457
- this.trigger("flip", this, f);
2519
+ updatePageIndex(m) {
2520
+ this.trigger("flip", this, m);
2458
2521
  }
2459
- updateOrientation(f) {
2460
- this.ui.setOrientationStyle(f), this.update(), this.trigger("changeOrientation", this, f);
2522
+ updateOrientation(m) {
2523
+ this.ui.setOrientationStyle(m), this.update(), this.trigger("changeOrientation", this, m);
2461
2524
  }
2462
2525
  getPageCount() {
2463
2526
  return this.pages.getPageCount();
@@ -2465,8 +2528,8 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2465
2528
  getCurrentPageIndex() {
2466
2529
  return this.pages.getCurrentPageIndex();
2467
2530
  }
2468
- getPage(f) {
2469
- return this.pages.getPage(f);
2531
+ getPage(m) {
2532
+ return this.pages.getPage(m);
2470
2533
  }
2471
2534
  getRender() {
2472
2535
  return this.render;
@@ -2492,21 +2555,21 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2492
2555
  getPageCollection() {
2493
2556
  return this.pages;
2494
2557
  }
2495
- startUserTouch(f) {
2496
- this.mousePosition = f, this.isUserTouch = !0, this.isUserMove = !1;
2558
+ startUserTouch(m) {
2559
+ this.mousePosition = m, this.isUserTouch = !0, this.isUserMove = !1;
2497
2560
  }
2498
- userMove(f, i) {
2499
- this.isUserTouch || i || !this.setting.showPageCorners ? this.isUserTouch && g.GetDistanceBetweenTwoPoint(this.mousePosition, f) > 5 && (this.isUserMove = !0, this.flipController.fold(f)) : this.flipController.showCorner(f);
2561
+ userMove(m, s) {
2562
+ this.isUserTouch || s || !this.setting.showPageCorners ? this.isUserTouch && c.GetDistanceBetweenTwoPoint(this.mousePosition, m) > 5 && (this.isUserMove = !0, this.flipController.fold(m)) : this.flipController.showCorner(m);
2500
2563
  }
2501
- userStop(f, i = !1) {
2502
- this.isUserTouch && (this.isUserTouch = !1, i || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(f)));
2564
+ userStop(m, s = !1) {
2565
+ this.isUserTouch && (this.isUserTouch = !1, s || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(m)));
2503
2566
  }
2504
- }, Object.defineProperty(s, "__esModule", { value: !0 });
2567
+ }, Object.defineProperty(i, "__esModule", { value: !0 });
2505
2568
  });
2506
- })(Dt, Dt.exports);
2507
- var li = Dt.exports;
2569
+ })(It, It.exports);
2570
+ var fi = It.exports;
2508
2571
  /**
2509
- * @license FlipbookEngine v0.5.4
2572
+ * @license FlipbookEngine v0.6.5
2510
2573
  * Copyright (c) 2026 Murat Dogan
2511
2574
  *
2512
2575
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
@@ -2519,32 +2582,32 @@ var li = Dt.exports;
2519
2582
  * you must purchase a Commercial License from:
2520
2583
  * https://flipbookengine.com/pricing
2521
2584
  */
2522
- function ci() {
2585
+ function mi() {
2523
2586
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2524
2587
  }
2525
- function di(e, t = ci()) {
2588
+ function wi(e, t = mi()) {
2526
2589
  return t ? 0 : typeof e == "number" && e >= 0 ? e : 1e3;
2527
2590
  }
2528
- class ui {
2529
- constructor(t, s, o) {
2530
- m(this, "pageFlip", null);
2531
- m(this, "bookContainer");
2532
- m(this, "options");
2533
- m(this, "store");
2534
- m(this, "unsubs", []);
2535
- m(this, "audioEl", null);
2536
- m(this, "audioUnlockHandler", null);
2537
- m(this, "isLibraryFlipping", !1);
2538
- m(this, "autoPlayTimer", null);
2539
- m(this, "layoutUpdateTimer", null);
2540
- this.bookContainer = t, this.options = s, this.store = o, s.soundUrl && (this.audioEl = new Audio(s.soundUrl), this.unlockAudio());
2591
+ class vi {
2592
+ constructor(t, i, o) {
2593
+ v(this, "pageFlip", null);
2594
+ v(this, "bookContainer");
2595
+ v(this, "options");
2596
+ v(this, "store");
2597
+ v(this, "unsubs", []);
2598
+ v(this, "audioEl", null);
2599
+ v(this, "audioUnlockHandler", null);
2600
+ v(this, "isLibraryFlipping", !1);
2601
+ v(this, "autoPlayTimer", null);
2602
+ v(this, "layoutUpdateTimer", null);
2603
+ this.bookContainer = t, this.options = i, this.store = o, i.soundUrl && (this.audioEl = new Audio(i.soundUrl), this.unlockAudio());
2541
2604
  }
2542
2605
  unlockAudio() {
2543
2606
  if (!this.audioEl) return;
2544
2607
  const t = () => {
2545
2608
  if (this.audioEl) {
2546
- const s = this.audioEl.play();
2547
- s && typeof s.then == "function" && s.then(() => {
2609
+ const i = this.audioEl.play();
2610
+ i && typeof i.then == "function" && i.then(() => {
2548
2611
  this.audioEl.pause(), this.audioEl.currentTime = 0;
2549
2612
  }).catch(() => {
2550
2613
  });
@@ -2553,10 +2616,10 @@ class ui {
2553
2616
  };
2554
2617
  this.audioUnlockHandler = t, document.addEventListener("touchstart", t, { once: !0 }), document.addEventListener("click", t, { once: !0 });
2555
2618
  }
2556
- init(t, s) {
2557
- this.pageFlip = new li.PageFlip(this.bookContainer, {
2619
+ init(t, i) {
2620
+ this.pageFlip = new fi.PageFlip(this.bookContainer, {
2558
2621
  width: t,
2559
- height: s,
2622
+ height: i,
2560
2623
  size: "stretch",
2561
2624
  minWidth: 100,
2562
2625
  maxWidth: 3e3,
@@ -2565,9 +2628,10 @@ class ui {
2565
2628
  drawShadow: !0,
2566
2629
  showCover: !0,
2567
2630
  usePortrait: !0,
2568
- mobileScrollSupport: !1,
2631
+ // Keep native mobile scrolling available; this avoids preventDefault on non-cancelable touchstart events.
2632
+ mobileScrollSupport: !0,
2569
2633
  maxShadowOpacity: this.options.maxShadowOpacity || 0.5,
2570
- flippingTime: di(this.options.flippingTime)
2634
+ flippingTime: wi(this.options.flippingTime)
2571
2635
  });
2572
2636
  const o = this.bookContainer.querySelectorAll(".bz-page");
2573
2637
  this.pageFlip.loadFromHTML(Array.from(o)), this.bindEvents(), this.setupSignalSync();
@@ -2583,24 +2647,24 @@ class ui {
2583
2647
  }
2584
2648
  setupSignalSync() {
2585
2649
  this.unsubs.push(
2586
- G(() => {
2587
- const t = this.store.currentPage.value, s = this.store.flipState.peek();
2588
- if (!this.pageFlip || this.isLibraryFlipping || s !== "read") return;
2650
+ _(() => {
2651
+ const t = this.store.currentPage.value, i = this.store.flipState.peek();
2652
+ if (!this.pageFlip || this.isLibraryFlipping || i !== "read") return;
2589
2653
  const o = this.pageFlip.getCurrentPageIndex();
2590
2654
  if (o !== t && !this.store.isSingleMode.value) {
2591
- const r = (g) => g === 0 ? 0 : Math.ceil(g / 2), h = r(t), u = r(o);
2655
+ const r = (c) => c === 0 ? 0 : Math.ceil(c / 2), h = r(t), u = r(o);
2592
2656
  h === u + 1 ? this.pageFlip.flipNext() : h === u - 1 ? this.pageFlip.flipPrev() : h !== u && this.pageFlip.turnToPage(t);
2593
2657
  }
2594
2658
  })
2595
2659
  ), this.unsubs.push(
2596
- G(() => {
2660
+ _(() => {
2597
2661
  this.store.isSingleMode.value, this.pageFlip && (this.layoutUpdateTimer && clearTimeout(this.layoutUpdateTimer), this.layoutUpdateTimer = setTimeout(() => {
2598
2662
  this.layoutUpdateTimer = null, this.pageFlip && this.pageFlip.update(), window.dispatchEvent(new Event("resize"));
2599
2663
  }, 50));
2600
2664
  })
2601
2665
  ), this.unsubs.push(
2602
- G(() => {
2603
- const t = this.store.isAutoPlaying.value, s = this.store.autoPlayInterval.value || 3e3;
2666
+ _(() => {
2667
+ const t = this.store.isAutoPlaying.value, i = this.store.autoPlayInterval.value || 3e3;
2604
2668
  this.autoPlayTimer && (clearInterval(this.autoPlayTimer), this.autoPlayTimer = null), t && (this.autoPlayTimer = setInterval(() => {
2605
2669
  const o = this.store.pages.value.length - 1;
2606
2670
  if (this.store.currentPage.peek() >= o || this.store.currentPage.peek() >= o - 1 && !this.store.isSingleMode.peek()) {
@@ -2608,7 +2672,7 @@ class ui {
2608
2672
  return;
2609
2673
  }
2610
2674
  this.turnToNextPage();
2611
- }, s));
2675
+ }, i));
2612
2676
  })
2613
2677
  );
2614
2678
  }
@@ -2628,7 +2692,7 @@ class ui {
2628
2692
  if (this.store.soundEnabled.value && this.audioEl) {
2629
2693
  this.audioEl.currentTime = 0;
2630
2694
  const t = this.audioEl.play();
2631
- t && typeof t.catch == "function" && t.catch((s) => console.warn("Flipbook Audio Play Error:", s));
2695
+ t && typeof t.catch == "function" && t.catch((i) => console.warn("Flipbook Audio Play Error:", i));
2632
2696
  }
2633
2697
  }
2634
2698
  update() {
@@ -2639,7 +2703,7 @@ class ui {
2639
2703
  }
2640
2704
  }
2641
2705
  /**
2642
- * @license FlipbookEngine v0.5.4
2706
+ * @license FlipbookEngine v0.6.5
2643
2707
  * Copyright (c) 2026 Murat Dogan
2644
2708
  *
2645
2709
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
@@ -2652,26 +2716,26 @@ class ui {
2652
2716
  * you must purchase a Commercial License from:
2653
2717
  * https://flipbookengine.com/pricing
2654
2718
  */
2655
- class gi {
2656
- constructor(t, s) {
2657
- m(this, "wrapperElement", null);
2658
- m(this, "sizerElement", null);
2659
- m(this, "pageViewport");
2660
- m(this, "store");
2661
- m(this, "resizeObserver", null);
2662
- m(this, "orientationMediaQuery", null);
2663
- m(this, "orientationChangeHandler", null);
2664
- m(this, "unsubs", []);
2665
- m(this, "updateTimer", null);
2666
- m(this, "onResizeCallback");
2667
- this.pageViewport = t, this.store = s;
2668
- }
2669
- init(t, s) {
2670
- this.wrapperElement = t, this.sizerElement = s, this.setupResizeObserver(), this.setupOrientationMedia(), this.setupStateSync(), this.updateBookAspectRatio();
2719
+ class yi {
2720
+ constructor(t, i) {
2721
+ v(this, "wrapperElement", null);
2722
+ v(this, "sizerElement", null);
2723
+ v(this, "pageViewport");
2724
+ v(this, "store");
2725
+ v(this, "resizeObserver", null);
2726
+ v(this, "orientationMediaQuery", null);
2727
+ v(this, "orientationChangeHandler", null);
2728
+ v(this, "unsubs", []);
2729
+ v(this, "updateTimer", null);
2730
+ v(this, "onResizeCallback");
2731
+ this.pageViewport = t, this.store = i;
2732
+ }
2733
+ init(t, i) {
2734
+ this.wrapperElement = t, this.sizerElement = i, this.setupResizeObserver(), this.setupOrientationMedia(), this.setupStateSync(), this.updateBookAspectRatio();
2671
2735
  }
2672
2736
  setupStateSync() {
2673
2737
  this.unsubs.push(
2674
- G(() => {
2738
+ _(() => {
2675
2739
  this.store.isSingleMode.value, this.store.orientation.value, this.scheduleAspectRatioUpdate();
2676
2740
  })
2677
2741
  );
@@ -2684,21 +2748,21 @@ class gi {
2684
2748
  setupOrientationMedia() {
2685
2749
  if (typeof window < "u" && window.matchMedia) {
2686
2750
  this.orientationMediaQuery = window.matchMedia("(orientation: portrait)");
2687
- const t = (s) => {
2688
- s.matches, this.updateBookAspectRatio();
2751
+ const t = (i) => {
2752
+ i.matches, this.updateBookAspectRatio();
2689
2753
  };
2690
2754
  this.orientationChangeHandler = t, this.orientationMediaQuery.addEventListener ? this.orientationMediaQuery.addEventListener("change", t) : this.orientationMediaQuery.addListener(t), t(this.orientationMediaQuery);
2691
2755
  }
2692
2756
  }
2693
2757
  updateBookAspectRatio() {
2694
2758
  if (!this.wrapperElement || !this.sizerElement) return;
2695
- const t = this.wrapperElement.clientWidth, s = this.wrapperElement.clientHeight;
2696
- if (t === 0 || s === 0) return;
2759
+ const t = this.wrapperElement.clientWidth, i = this.wrapperElement.clientHeight;
2760
+ if (t === 0 || i === 0) return;
2697
2761
  const o = this.pageViewport.width, r = this.pageViewport.height, u = this.store.isDoublePageLayout.value ? o * 2 / r : o / r;
2698
- let g = t, x = t / u;
2699
- x > s && (x = s, g = s * u);
2700
- let P = Math.ceil(g);
2701
- P % 2 !== 0 && (P += 1), this.sizerElement.style.width = `${P}px`, this.sizerElement.style.height = `${Math.floor(x)}px`, this.sizerElement.style.aspectRatio = "", this.onResizeCallback && this.onResizeCallback();
2762
+ let c = t, b = t / u;
2763
+ b > i && (b = i, c = i * u);
2764
+ let P = Math.ceil(c);
2765
+ P % 2 !== 0 && (P += 1), this.sizerElement.style.width = `${P}px`, this.sizerElement.style.height = `${Math.floor(b)}px`, this.sizerElement.style.aspectRatio = "", this.onResizeCallback && this.onResizeCallback();
2702
2766
  }
2703
2767
  destroy() {
2704
2768
  this.updateTimer && (clearTimeout(this.updateTimer), this.updateTimer = null), this.unsubs.forEach((t) => t()), this.unsubs = [], this.resizeObserver && this.wrapperElement && (this.resizeObserver.unobserve(this.wrapperElement), this.resizeObserver.disconnect(), this.resizeObserver = null), this.orientationMediaQuery && (this.orientationChangeHandler && (this.orientationMediaQuery.removeEventListener ? this.orientationMediaQuery.removeEventListener("change", this.orientationChangeHandler) : this.orientationMediaQuery.removeListener(this.orientationChangeHandler)), this.orientationChangeHandler = null, this.orientationMediaQuery = null);
@@ -2710,7 +2774,7 @@ class gi {
2710
2774
  }
2711
2775
  }
2712
2776
  /**
2713
- * @license FlipbookEngine v0.5.4
2777
+ * @license FlipbookEngine v0.6.5
2714
2778
  * Copyright (c) 2026 Murat Dogan
2715
2779
  *
2716
2780
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
@@ -2723,16 +2787,16 @@ class gi {
2723
2787
  * you must purchase a Commercial License from:
2724
2788
  * https://flipbookengine.com/pricing
2725
2789
  */
2726
- class pi {
2727
- constructor(t, s, o) {
2728
- m(this, "container");
2729
- m(this, "pageFlipAdapter");
2730
- m(this, "store");
2731
- m(this, "touchStartX", null);
2732
- m(this, "unsubs", []);
2733
- m(this, "listenerAbortController");
2790
+ class bi {
2791
+ constructor(t, i, o) {
2792
+ v(this, "container");
2793
+ v(this, "pageFlipAdapter");
2794
+ v(this, "store");
2795
+ v(this, "touchStartX", null);
2796
+ v(this, "unsubs", []);
2797
+ v(this, "listenerAbortController");
2734
2798
  var h;
2735
- this.container = t, this.pageFlipAdapter = s, this.store = o;
2799
+ this.container = t, this.pageFlipAdapter = i, this.store = o;
2736
2800
  const r = ((h = t.ownerDocument.defaultView) == null ? void 0 : h.AbortController) ?? globalThis.AbortController;
2737
2801
  this.listenerAbortController = new r();
2738
2802
  }
@@ -2741,7 +2805,7 @@ class pi {
2741
2805
  }
2742
2806
  setupStateSync() {
2743
2807
  this.unsubs.push(
2744
- G(() => {
2808
+ _(() => {
2745
2809
  this.store.isZoomed.value = this.store.zoomState.value.isActive, this.store.zoomState.value.isActive ? (this.container.style.transform = `translate(${this.store.zoomState.value.translateX}px, ${this.store.zoomState.value.translateY}px) scale(${this.store.zoomState.value.scale})`, this.container.style.transition = "none") : (this.container.style.transform = "", this.container.style.transition = "transform 0.3s ease");
2746
2810
  })
2747
2811
  );
@@ -2755,19 +2819,19 @@ class pi {
2755
2819
  }, { passive: !1, signal: this.listenerAbortController.signal });
2756
2820
  }
2757
2821
  bindMouseDrag() {
2758
- let t = !1, s = 0, o = 0, r = 0, h = 0;
2822
+ let t = !1, i = 0, o = 0, r = 0, h = 0;
2759
2823
  this.container.addEventListener("mousedown", (u) => {
2760
- this.store.zoomState.value.isActive && (t = !0, s = u.clientX, o = u.clientY, r = this.store.zoomState.value.translateX, h = this.store.zoomState.value.translateY, this.container.style.cursor = "grabbing");
2824
+ this.store.zoomState.value.isActive && (t = !0, i = u.clientX, o = u.clientY, r = this.store.zoomState.value.translateX, h = this.store.zoomState.value.translateY, this.container.style.cursor = "grabbing");
2761
2825
  }, { signal: this.listenerAbortController.signal }), window.addEventListener("mousemove", (u) => {
2762
2826
  if (!t || !this.store.zoomState.value.isActive) return;
2763
- const g = u.clientX - s, x = u.clientY - o;
2764
- this.updateZoomPan(r + g, h + x);
2827
+ const c = u.clientX - i, b = u.clientY - o;
2828
+ this.updateZoomPan(r + c, h + b);
2765
2829
  }, { signal: this.listenerAbortController.signal }), window.addEventListener("mouseup", () => {
2766
2830
  t && (t = !1, this.container.style.cursor = this.store.zoomState.value.isActive ? "grab" : "");
2767
2831
  }, { signal: this.listenerAbortController.signal });
2768
2832
  }
2769
2833
  bindTouch() {
2770
- let t = !1, s = 0, o = 0;
2834
+ let t = !1, i = 0, o = 0;
2771
2835
  this.container.addEventListener("touchstart", (r) => {
2772
2836
  if (r.touches.length === 1)
2773
2837
  if (!this.store.zoomState.value.isActive)
@@ -2775,13 +2839,13 @@ class pi {
2775
2839
  else {
2776
2840
  t = !0, this.touchStartX = r.touches[0].clientX;
2777
2841
  const h = r.touches[0].clientY;
2778
- s = this.store.zoomState.value.translateX, o = this.store.zoomState.value.translateY, this.container._touchStartY = h;
2842
+ i = this.store.zoomState.value.translateX, o = this.store.zoomState.value.translateY, this.container._touchStartY = h;
2779
2843
  }
2780
2844
  }, { passive: !0, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchmove", (r) => {
2781
2845
  if (t && this.store.zoomState.value.isActive && r.touches.length === 1 && this.touchStartX !== null) {
2782
2846
  r.preventDefault();
2783
2847
  const h = r.touches[0].clientX - this.touchStartX, u = r.touches[0].clientY - this.container._touchStartY;
2784
- this.updateZoomPan(s + h, o + u);
2848
+ this.updateZoomPan(i + h, o + u);
2785
2849
  }
2786
2850
  }, { passive: !1, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchend", (r) => {
2787
2851
  if (this.touchStartX !== null && !this.store.zoomState.value.isActive && this.store.isSingleMode.value && r.changedTouches.length === 1) {
@@ -2803,126 +2867,159 @@ class pi {
2803
2867
  let t = this.store.zoomState.value.scale - 0.5;
2804
2868
  t <= 1 ? (t = 1, this.store.zoomState.value = { ...this.store.zoomState.value, isActive: !1, translateX: 0, translateY: 0, scale: 1 }, this.container.style.cursor = "") : this.store.zoomState.value = { ...this.store.zoomState.value, isActive: !0, scale: t };
2805
2869
  }
2806
- updateZoomPan(t, s) {
2870
+ updateZoomPan(t, i) {
2807
2871
  this.store.zoomState.value = {
2808
2872
  ...this.store.zoomState.value,
2809
2873
  translateX: t,
2810
- translateY: s
2874
+ translateY: i
2811
2875
  };
2812
2876
  }
2813
2877
  destroy() {
2814
2878
  this.listenerAbortController.abort(), this.unsubs.forEach((t) => t()), this.unsubs = [];
2815
2879
  }
2816
2880
  }
2881
+ function be(e, t, i) {
2882
+ if (!e || typeof e.title != "string" || !e.title.trim() || !Number.isFinite(e.pageIndex)) return null;
2883
+ const o = Math.max(0, t - 1), r = Array.isArray(e.children) ? e.children.map((h, u) => be(h, t, i + "-" + u)).filter((h) => h !== null) : [];
2884
+ return {
2885
+ id: e.id ?? i,
2886
+ title: e.title.trim(),
2887
+ pageIndex: Math.max(0, Math.min(o, Math.trunc(e.pageIndex))),
2888
+ ...r.length ? { children: r } : {}
2889
+ };
2890
+ }
2891
+ function Pe(e, t) {
2892
+ return Array.isArray(e) ? e.map((i, o) => be(i, t, "toc-" + o)).filter((i) => i !== null) : [];
2893
+ }
2817
2894
  /**
2818
- * @license FlipbookEngine v0.5.4
2895
+ * @license FlipbookEngine v0.6.5
2819
2896
  * Copyright (c) 2026 Murat Dogan
2820
2897
  *
2821
2898
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
2822
2899
  */
2823
- const Kt = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
2824
- function me() {
2825
- const e = M(0), t = M(0), s = M(!1), o = M(!0), r = M(!0), h = M("landscape"), u = M("read"), g = M("auto"), x = M(!0), P = M(!1), b = M("#7367f0"), D = M(!1), $ = M(!1), C = M(!1), T = M(3e3), F = M(!0), B = M("en"), H = M({}), N = M(Kt()), f = M([]), i = w(() => !s.value && h.value === "landscape"), n = w(() => i.value && e.value === 0), a = w(() => i.value && e.value >= t.value - 1);
2826
- return { currentPage: e, totalPages: t, isSingleMode: s, showThumbs: o, showArrows: r, orientation: h, flipState: u, themeMode: g, allowDownload: x, hasDownloadUrl: P, primaryColor: b, whiteLabel: D, isZoomed: $, isAutoPlaying: C, autoPlayInterval: T, soundEnabled: F, locale: B, messages: H, zoomState: N, pages: f, isDoublePageLayout: i, isFrontCover: n, isBackCover: a, init: (c, v, y, A) => {
2827
- t.value = v, f.value = y, P.value = A, c.theme !== void 0 && (g.value = c.theme), c.primaryColor !== void 0 && (b.value = c.primaryColor), c.showThumbs !== void 0 && (o.value = c.showThumbs), c.showArrows !== void 0 && (r.value = c.showArrows), c.allowDownload !== void 0 && (x.value = c.allowDownload), c.whiteLabel !== void 0 && (D.value = c.whiteLabel), c.soundEnabled !== void 0 && (F.value = c.soundEnabled), c.locale !== void 0 && (B.value = c.locale), c.messages !== void 0 && (H.value = c.messages), c.isSingleMode !== void 0 && (s.value = c.isSingleMode), c.singleMode !== void 0 && (s.value = c.singleMode), c.autoPlay !== void 0 && (C.value = c.autoPlay), c.autoPlayInterval !== void 0 && (T.value = c.autoPlayInterval), e.value = 0;
2900
+ const te = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
2901
+ function xe() {
2902
+ const e = D(0), t = D(0), i = D(!1), o = D(!1), r = D(!1), h = D(!0), u = D("landscape"), c = D("read"), b = D("auto"), P = D(!0), k = D(!1), I = D("#7367f0"), S = D(!1), T = D(!1), A = D(!1), L = D(3e3), U = D(!0), N = D("en"), H = D({}), m = D(te()), s = D([]), n = D([]), a = w(() => !i.value && u.value === "landscape"), l = w(() => a.value && e.value === 0), d = w(() => a.value && e.value >= t.value - 1);
2903
+ return { currentPage: e, totalPages: t, isSingleMode: i, showThumbs: o, showToc: r, showArrows: h, orientation: u, flipState: c, themeMode: b, allowDownload: P, hasDownloadUrl: k, primaryColor: I, whiteLabel: S, isZoomed: T, isAutoPlaying: A, autoPlayInterval: L, soundEnabled: U, locale: N, messages: H, zoomState: m, pages: s, toc: n, isDoublePageLayout: a, isFrontCover: l, isBackCover: d, init: (f, E, R, O) => {
2904
+ t.value = E, s.value = R, k.value = O, f.theme !== void 0 && (b.value = f.theme), f.primaryColor !== void 0 && (I.value = f.primaryColor), f.showThumbs !== void 0 && (o.value = f.showThumbs), f.showToc !== void 0 && (r.value = f.showToc), n.value = Pe(f.toc ?? [], E), f.showArrows !== void 0 && (h.value = f.showArrows), f.allowDownload !== void 0 && (P.value = f.allowDownload), f.whiteLabel !== void 0 && (S.value = f.whiteLabel), f.soundEnabled !== void 0 && (U.value = f.soundEnabled), f.locale !== void 0 && (N.value = f.locale), f.messages !== void 0 && (H.value = f.messages), f.isSingleMode !== void 0 && (i.value = f.isSingleMode), f.singleMode !== void 0 && (i.value = f.singleMode), f.autoPlay !== void 0 && (A.value = f.autoPlay), f.autoPlayInterval !== void 0 && (L.value = f.autoPlayInterval), e.value = 0;
2828
2905
  }, reset: () => {
2829
- e.value = 0, t.value = 0, s.value = !1, o.value = !0, r.value = !0, h.value = "landscape", u.value = "read", g.value = "auto", x.value = !0, P.value = !1, b.value = "#7367f0", D.value = !1, $.value = !1, C.value = !1, T.value = 3e3, F.value = !0, B.value = "en", H.value = {}, N.value = Kt(), f.value = [];
2906
+ e.value = 0, t.value = 0, i.value = !1, o.value = !1, h.value = !0, u.value = "landscape", c.value = "read", b.value = "auto", P.value = !0, k.value = !1, I.value = "#7367f0", S.value = !1, T.value = !1, A.value = !1, L.value = 3e3, U.value = !0, N.value = "en", H.value = {}, m.value = te(), s.value = [], n.value = [];
2830
2907
  } };
2831
2908
  }
2832
- const E = me();
2833
- E.currentPage;
2834
- E.totalPages;
2835
- E.isSingleMode;
2836
- E.showThumbs;
2837
- E.showArrows;
2838
- E.orientation;
2839
- E.flipState;
2840
- E.themeMode;
2841
- E.allowDownload;
2842
- E.hasDownloadUrl;
2843
- E.primaryColor;
2844
- E.whiteLabel;
2845
- E.isZoomed;
2846
- E.isAutoPlaying;
2847
- E.autoPlayInterval;
2848
- E.soundEnabled;
2849
- E.locale;
2850
- E.messages;
2851
- E.zoomState;
2852
- E.pages;
2853
- E.isDoublePageLayout;
2854
- E.isFrontCover;
2855
- E.isBackCover;
2856
- function fi(e) {
2909
+ const C = xe();
2910
+ C.currentPage;
2911
+ C.totalPages;
2912
+ C.isSingleMode;
2913
+ C.showThumbs;
2914
+ C.showToc;
2915
+ C.showArrows;
2916
+ C.orientation;
2917
+ C.flipState;
2918
+ C.themeMode;
2919
+ C.allowDownload;
2920
+ C.hasDownloadUrl;
2921
+ C.primaryColor;
2922
+ C.whiteLabel;
2923
+ C.isZoomed;
2924
+ C.isAutoPlaying;
2925
+ C.autoPlayInterval;
2926
+ C.soundEnabled;
2927
+ C.locale;
2928
+ C.messages;
2929
+ C.zoomState;
2930
+ C.pages;
2931
+ C.toc;
2932
+ C.isDoublePageLayout;
2933
+ C.isFrontCover;
2934
+ C.isBackCover;
2935
+ function Pi(e) {
2857
2936
  if (!e || typeof e != "object") return !1;
2858
2937
  const t = e;
2859
2938
  return typeof t.normal == "string" && typeof t.low == "string" && typeof t.thumb == "string";
2860
2939
  }
2861
- function mi(e) {
2940
+ function xi(e) {
2862
2941
  return Array.isArray(e.pageNumbers) && e.pageNumbers.length > 0 ? e.pageNumbers : typeof e.pageNumber == "number" ? e.kind === "spread" ? [e.pageNumber, e.pageNumber + 1] : [e.pageNumber] : [];
2863
2942
  }
2864
- function wi(e) {
2943
+ function Si(e) {
2865
2944
  return e === "rtl" ? ["right", "left"] : ["left", "right"];
2866
2945
  }
2867
- function vi(e) {
2946
+ function Ti(e) {
2868
2947
  const t = [];
2869
- let s = 1;
2948
+ let i = 1;
2870
2949
  return e.forEach((o, r) => {
2871
- const h = o.kind ?? "single", u = o.id ?? `asset-${r}`, g = o.splitDirection ?? "ltr", x = mi(o);
2950
+ const h = o.kind ?? "single", u = o.id ?? `asset-${r}`, c = o.splitDirection ?? "ltr", b = xi(o);
2872
2951
  if (h === "spread") {
2873
- const b = x.length >= 2 ? x.slice(0, 2) : [s, s + 1], D = wi(g);
2874
- b.forEach(($, C) => {
2952
+ const k = b.length >= 2 ? b.slice(0, 2) : [i, i + 1], I = Si(c);
2953
+ k.forEach((S, T) => {
2875
2954
  t.push({
2876
2955
  index: t.length,
2877
2956
  assetId: u,
2878
- pageNumber: $,
2879
- cropMode: D[C] ?? "full",
2957
+ pageNumber: S,
2958
+ sourcePageNumber: S,
2959
+ cropMode: I[T] ?? "full",
2880
2960
  normal: o.normal,
2881
2961
  low: o.low,
2882
2962
  thumb: o.thumb
2883
2963
  });
2884
- }), s = b[b.length - 1] + 1;
2964
+ }), i = k[k.length - 1] + 1;
2885
2965
  return;
2886
2966
  }
2887
- const P = x[0] ?? s;
2967
+ const P = b[0] ?? i;
2888
2968
  t.push({
2889
2969
  index: t.length,
2890
2970
  assetId: u,
2891
2971
  pageNumber: P,
2972
+ sourcePageNumber: P,
2892
2973
  cropMode: "full",
2893
2974
  normal: o.normal,
2894
2975
  low: o.low,
2895
2976
  thumb: o.thumb
2896
- }), s = P + 1;
2977
+ }), i = P + 1;
2897
2978
  }), t;
2898
2979
  }
2899
- function Jt(e, t) {
2900
- e.classList.add("bk-container"), e.classList.remove("bk-theme-light", "bk-theme-dark"), t.theme === "light" && e.classList.add("bk-theme-light"), t.theme === "dark" && e.classList.add("bk-theme-dark"), t.primaryColor && e.style.setProperty("--flipbook-accent", t.primaryColor);
2901
- const s = t.cssVariables ?? {};
2902
- Object.entries(s).forEach(([o, r]) => {
2903
- const h = o.startsWith("--") ? o : `--${o}`;
2904
- e.style.setProperty(h, r);
2980
+ function ki(e) {
2981
+ return e ? 'url("' + e.replace(/["\\\r\n]/g, (i) => "\\" + i) + '")' : void 0;
2982
+ }
2983
+ function ee(e, t) {
2984
+ e.classList.add("bk-container"), e.classList.remove("bk-theme-light", "bk-theme-dark"), e.classList.add("bk-theme-" + (t.theme ?? "auto")), t.primaryColor && e.style.setProperty("--flipbook-accent", t.primaryColor);
2985
+ const i = t.background ?? {}, o = t.backgroundColor || t.backgroundImage ? { color: t.backgroundColor, image: t.backgroundImage } : void 0, r = (u, c) => {
2986
+ const b = {
2987
+ ["--flipbook-bg-" + u + "-color"]: c == null ? void 0 : c.color,
2988
+ ["--flipbook-bg-" + u + "-image"]: ki(c == null ? void 0 : c.image),
2989
+ ["--flipbook-bg-" + u + "-size"]: c == null ? void 0 : c.size,
2990
+ ["--flipbook-bg-" + u + "-position"]: c == null ? void 0 : c.position,
2991
+ ["--flipbook-bg-" + u + "-repeat"]: c == null ? void 0 : c.repeat
2992
+ };
2993
+ Object.entries(b).forEach(([P, k]) => {
2994
+ k ? e.style.setProperty(P, k) : e.style.removeProperty(P);
2995
+ });
2996
+ };
2997
+ r("light", i.light ?? o), r("dark", i.dark);
2998
+ const h = t.cssVariables ?? {};
2999
+ Object.entries(h).forEach(([u, c]) => {
3000
+ const b = u.startsWith("--") ? u : "--" + u;
3001
+ e.style.setProperty(b, c);
2905
3002
  });
2906
3003
  }
2907
- class yi {
3004
+ class Ci {
2908
3005
  constructor(t = 32) {
2909
- m(this, "entries", /* @__PURE__ */ new Map());
2910
- m(this, "hits", 0);
2911
- m(this, "misses", 0);
3006
+ v(this, "entries", /* @__PURE__ */ new Map());
3007
+ v(this, "hits", 0);
3008
+ v(this, "misses", 0);
2912
3009
  if (this.maxEntries = t, !Number.isInteger(t) || t < 0)
2913
3010
  throw new RangeError("PDF render cache size must be a non-negative integer.");
2914
3011
  }
2915
3012
  get(t) {
2916
- const s = this.entries.get(t);
2917
- if (s === void 0) {
3013
+ const i = this.entries.get(t);
3014
+ if (i === void 0) {
2918
3015
  this.misses++;
2919
3016
  return;
2920
3017
  }
2921
- return this.hits++, this.entries.delete(t), this.entries.set(t, s), s;
3018
+ return this.hits++, this.entries.delete(t), this.entries.set(t, i), i;
2922
3019
  }
2923
- set(t, s) {
2924
- if (!(this.maxEntries === 0 || !s))
2925
- for (this.entries.delete(t), this.entries.set(t, s); this.entries.size > this.maxEntries; ) {
3020
+ set(t, i) {
3021
+ if (!(this.maxEntries === 0 || !i))
3022
+ for (this.entries.delete(t), this.entries.set(t, i); this.entries.size > this.maxEntries; ) {
2926
3023
  const o = this.entries.keys().next().value;
2927
3024
  if (o === void 0) break;
2928
3025
  this.entries.delete(o);
@@ -2938,101 +3035,116 @@ class yi {
2938
3035
  return { size: this.size, maxEntries: this.maxEntries, hits: this.hits, misses: this.misses };
2939
3036
  }
2940
3037
  }
2941
- class bi {
3038
+ const kt = 1190.55, Ct = 841.89;
3039
+ function Ai(e, t) {
3040
+ const i = Math.max(e, t), o = Math.min(e, t), r = i / o, h = Math.abs(i - kt) / kt <= 0.08 && Math.abs(o - Ct) / Ct <= 0.08;
3041
+ return e >= t && h && Math.abs(r - kt / Ct) <= 0.04;
3042
+ }
3043
+ class Ei {
2942
3044
  constructor(t = {}) {
2943
- m(this, "pdfDoc", null);
2944
- m(this, "loadingTask", null);
2945
- m(this, "options");
2946
- m(this, "cache");
2947
- const s = Number.isFinite(t.cacheSize) ? Math.max(0, Math.floor(t.cacheSize)) : 32;
3045
+ v(this, "pdfDoc", null);
3046
+ v(this, "loadingTask", null);
3047
+ v(this, "options");
3048
+ v(this, "cache");
3049
+ const i = Number.isFinite(t.cacheSize) ? Math.max(0, Math.floor(t.cacheSize)) : 32;
2948
3050
  this.options = {
2949
3051
  scale: t.scale || 1.5,
2950
3052
  quality: t.quality || 0.85,
2951
3053
  format: t.format || "image/webp",
2952
3054
  workerSrc: t.workerSrc || "",
2953
3055
  concurrency: Math.max(1, Math.floor(t.concurrency || 3)),
2954
- cacheSize: s
2955
- }, this.cache = new yi(this.options.cacheSize), this.options.workerSrc && (Bt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
3056
+ cacheSize: i
3057
+ }, this.cache = new Ci(this.options.cacheSize), this.options.workerSrc && (Gt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
2956
3058
  }
2957
3059
  /** Loads a PDF document and cancels PDF.js loading when the signal aborts. */
2958
- async loadDocument(t, s) {
2959
- this.throwIfAborted(s), this.cache.clear();
2960
- const o = Bt.getDocument(t);
3060
+ async loadDocument(t, i) {
3061
+ this.throwIfAborted(i), this.cache.clear();
3062
+ const o = Gt.getDocument(t);
2961
3063
  this.loadingTask = o;
2962
3064
  const r = () => {
2963
3065
  var h;
2964
3066
  return (h = o.destroy) == null ? void 0 : h.call(o);
2965
3067
  };
2966
- s == null || s.addEventListener("abort", r, { once: !0 });
3068
+ i == null || i.addEventListener("abort", r, { once: !0 });
2967
3069
  try {
2968
- return this.pdfDoc = await o.promise, this.throwIfAborted(s), this.pdfDoc.numPages;
3070
+ return this.pdfDoc = await o.promise, this.throwIfAborted(i), this.pdfDoc.numPages;
2969
3071
  } catch (h) {
2970
- throw s != null && s.aborted ? this.createAbortError() : h;
3072
+ throw i != null && i.aborted ? this.createAbortError() : h;
2971
3073
  } finally {
2972
- s == null || s.removeEventListener("abort", r), this.loadingTask === o && (this.loadingTask = null);
3074
+ i == null || i.removeEventListener("abort", r), this.loadingTask === o && (this.loadingTask = null);
2973
3075
  }
2974
3076
  }
2975
3077
  /** Renders a specific page to a Data URL. The page index is 1-based. */
2976
- async renderPageToDataUrl(t, s) {
3078
+ async renderPageToDataUrl(t, i) {
2977
3079
  if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
2978
- this.throwIfAborted(s);
3080
+ this.throwIfAborted(i);
2979
3081
  const o = this.cache.get(t);
2980
3082
  if (o !== void 0) return o;
2981
3083
  try {
2982
3084
  const r = await this.pdfDoc.getPage(t);
2983
- this.throwIfAborted(s);
3085
+ this.throwIfAborted(i);
2984
3086
  const h = r.getViewport({ scale: this.options.scale }), u = document.createElement("canvas");
2985
3087
  u.width = h.width, u.height = h.height;
2986
- const g = u.getContext("2d");
2987
- if (g) {
2988
- const x = r.render({ canvasContext: g, viewport: h }), P = () => {
2989
- var D;
2990
- return (D = x.cancel) == null ? void 0 : D.call(x);
3088
+ const c = u.getContext("2d");
3089
+ if (c) {
3090
+ const b = r.render({ canvasContext: c, viewport: h }), P = () => {
3091
+ var I;
3092
+ return (I = b.cancel) == null ? void 0 : I.call(b);
2991
3093
  };
2992
- s == null || s.addEventListener("abort", P, { once: !0 });
3094
+ i == null || i.addEventListener("abort", P, { once: !0 });
2993
3095
  try {
2994
- await x.promise, this.throwIfAborted(s);
3096
+ await b.promise, this.throwIfAborted(i);
2995
3097
  } finally {
2996
- s == null || s.removeEventListener("abort", P);
3098
+ i == null || i.removeEventListener("abort", P);
2997
3099
  }
2998
- const b = u.toDataURL(this.options.format, this.options.quality);
2999
- return this.cache.set(t, b), b;
3100
+ const k = u.toDataURL(this.options.format, this.options.quality);
3101
+ return this.cache.set(t, k), k;
3000
3102
  }
3001
3103
  throw new Error("Unable to create a PDF canvas rendering context.");
3002
3104
  } catch (r) {
3003
- throw s != null && s.aborted ? this.createAbortError() : r;
3105
+ throw i != null && i.aborted ? this.createAbortError() : r;
3106
+ }
3107
+ }
3108
+ /** Returns source page dimensions and whether the page should be split. */
3109
+ async getPageLayouts(t = "auto") {
3110
+ if (!this.pdfDoc) return [];
3111
+ const i = [];
3112
+ for (let o = 1; o <= this.pdfDoc.numPages; o++) {
3113
+ const h = (await this.pdfDoc.getPage(o)).getViewport({ scale: 1 }), u = t === "split" ? h.width >= h.height : t === "auto" && Ai(h.width, h.height);
3114
+ i.push({ width: h.width, height: h.height, split: u });
3004
3115
  }
3116
+ return i;
3005
3117
  }
3006
- /** Calculates the best viewport dimensions based on the first page. */
3007
- async calculateViewportDimensions(t = 420) {
3118
+ /** Calculates the best viewport dimensions based on the first logical page. */
3119
+ async calculateViewportDimensions(t = 420, i) {
3008
3120
  if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
3009
- const o = (await this.pdfDoc.getPage(1)).getViewport({ scale: 1 }), r = o.width / o.height;
3010
- return r >= 1 ? { width: Math.round(t * r), height: t } : { width: t, height: Math.round(t / r) };
3121
+ const o = await this.pdfDoc.getPage(1), r = i ? { width: i.split ? i.width / 2 : i.width, height: i.height } : o.getViewport({ scale: 1 }), h = r.width / r.height;
3122
+ return h >= 1 ? { width: Math.round(t * h), height: t } : { width: t, height: Math.round(t / h) };
3011
3123
  }
3012
3124
  /** Renders pages concurrently with a bounded worker pool and preserves page order. */
3013
- async renderAllPages(t, s) {
3125
+ async renderAllPages(t, i) {
3014
3126
  if (!this.pdfDoc) return [];
3015
3127
  this.throwIfAborted(t);
3016
3128
  const o = this.pdfDoc.numPages, r = new Array(o);
3017
3129
  let h = 1, u = 0;
3018
- const g = async () => {
3130
+ const c = async () => {
3019
3131
  for (; ; ) {
3020
3132
  this.throwIfAborted(t);
3021
3133
  const P = h++;
3022
3134
  if (P > o) return;
3023
- const b = await this.renderPageToDataUrl(P, t);
3135
+ const k = await this.renderPageToDataUrl(P, t);
3024
3136
  r[P - 1] = {
3025
3137
  index: P - 1,
3026
3138
  assetId: `pdf-page-${P}`,
3027
3139
  pageNumber: P,
3028
3140
  cropMode: "full",
3029
- normal: b,
3030
- low: b,
3031
- thumb: b
3032
- }, u++, s == null || s({ completed: u, total: o });
3141
+ normal: k,
3142
+ low: k,
3143
+ thumb: k
3144
+ }, u++, i == null || i({ completed: u, total: o });
3033
3145
  }
3034
- }, x = Math.min(this.options.concurrency, o);
3035
- return await Promise.all(Array.from({ length: x }, () => g())), this.throwIfAborted(t), r;
3146
+ }, b = Math.min(this.options.concurrency, o);
3147
+ return await Promise.all(Array.from({ length: b }, () => c())), this.throwIfAborted(t), r;
3036
3148
  }
3037
3149
  getCacheStats() {
3038
3150
  return this.cache.getStats();
@@ -3045,12 +3157,12 @@ class bi {
3045
3157
  return t.name = "AbortError", t;
3046
3158
  }
3047
3159
  destroy() {
3048
- var t, s, o, r;
3049
- (s = (t = this.loadingTask) == null ? void 0 : t.destroy) == null || s.call(t), this.loadingTask = null, this.pdfDoc && ((r = (o = this.pdfDoc).destroy) == null || r.call(o), this.pdfDoc = null), this.cache.clear();
3160
+ var t, i, o, r;
3161
+ (i = (t = this.loadingTask) == null ? void 0 : t.destroy) == null || i.call(t), this.loadingTask = null, this.pdfDoc && ((r = (o = this.pdfDoc).destroy) == null || r.call(o), this.pdfDoc = null), this.cache.clear();
3050
3162
  }
3051
3163
  }
3052
3164
  /**
3053
- * @license FlipbookEngine v0.5.4
3165
+ * @license FlipbookEngine v0.6.5
3054
3166
  * Copyright (c) 2026 Murat Dogan
3055
3167
  *
3056
3168
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
@@ -3064,30 +3176,32 @@ class bi {
3064
3176
  * https://flipbookengine.com/pricing
3065
3177
  */
3066
3178
  const mt = class mt {
3067
- constructor(t, s = {}) {
3068
- m(this, "container", null);
3069
- m(this, "options");
3070
- m(this, "store", me());
3179
+ constructor(t, i = {}) {
3180
+ v(this, "container", null);
3181
+ v(this, "options");
3182
+ v(this, "store", xe());
3071
3183
  // Core Managers
3072
- m(this, "pageFlipAdapter", null);
3073
- m(this, "layoutManager", null);
3074
- m(this, "interactionManager", null);
3075
- m(this, "pdfRenderer", null);
3076
- m(this, "listeners", {});
3077
- m(this, "initializationTimer", null);
3078
- m(this, "initGeneration", 0);
3079
- m(this, "initAbortController", null);
3080
- m(this, "eventsReady", !1);
3081
- m(this, "lastEventState", { currentPage: 0, zoom: 1, zoomActive: !1, showThumbs: !0, isSingle: !1, orientation: "" });
3082
- m(this, "eventSyncStop", null);
3083
- m(this, "qualityObserver", null);
3084
- m(this, "pdfLazyStop", null);
3085
- m(this, "hasActiveSession", !1);
3086
- m(this, "pdfPageRequests", /* @__PURE__ */ new Map());
3087
- m(this, "pdfRenderedPages", /* @__PURE__ */ new Set());
3184
+ v(this, "pageFlipAdapter", null);
3185
+ v(this, "layoutManager", null);
3186
+ v(this, "interactionManager", null);
3187
+ v(this, "pdfRenderer", null);
3188
+ v(this, "listeners", {});
3189
+ v(this, "initializationTimer", null);
3190
+ v(this, "initGeneration", 0);
3191
+ v(this, "initAbortController", null);
3192
+ v(this, "eventsReady", !1);
3193
+ v(this, "lastEventState", { currentPage: 0, zoom: 1, zoomActive: !1, showThumbs: !1, showToc: !1, isSingle: !1, orientation: "" });
3194
+ v(this, "eventSyncStop", null);
3195
+ v(this, "qualityObserver", null);
3196
+ v(this, "pdfLazyStop", null);
3197
+ v(this, "hasActiveSession", !1);
3198
+ v(this, "pdfPageRequests", /* @__PURE__ */ new Map());
3199
+ v(this, "pdfRenderedPages", /* @__PURE__ */ new Set());
3200
+ v(this, "pdfRenderedSources", /* @__PURE__ */ new Map());
3201
+ v(this, "pdfSourcePageCount", 0);
3088
3202
  this.selector = t, this.options = {
3089
3203
  allowDownload: !0,
3090
- showThumbs: !0,
3204
+ showThumbs: !1,
3091
3205
  primaryColor: "#7367f0",
3092
3206
  theme: "auto",
3093
3207
  soundUrl: "https://flipbookengine.com/Content/page-flip.mp3",
@@ -3097,32 +3211,33 @@ const mt = class mt {
3097
3211
  pdfRenderFormat: "image/webp",
3098
3212
  pdfRenderConcurrency: 3,
3099
3213
  pdfRenderCacheSize: 32,
3100
- ...s
3214
+ pdfPageMode: "auto",
3215
+ ...i
3101
3216
  }, this.setupEventSync();
3102
3217
  }
3103
- async init(t, s) {
3218
+ async init(t, i) {
3104
3219
  if (typeof this.selector == "string" ? this.container = document.querySelector(this.selector) : this.container = this.selector, !this.container) return;
3105
3220
  this.eventsReady = !1, this.destroy(!0);
3106
3221
  const o = this.initGeneration, r = new AbortController();
3107
3222
  this.initAbortController = r;
3108
3223
  let h = [], u = { ...mt.DEFAULT_PAGE_VIEWPORT };
3109
- if (s && s.length > 0) {
3224
+ if (i && i.length > 0) {
3110
3225
  if (r.signal.aborted) return;
3111
- const C = s.filter(fi);
3112
- h = vi(C);
3113
- const T = h[0];
3114
- if (T) {
3115
- const F = await this.loadImageSize(T.low || T.normal);
3116
- if (F) {
3117
- const H = (T.cropMode !== "full" ? F.width / 2 : F.width) / F.height, N = 420;
3118
- u = H >= 1 ? { width: Math.round(N * H), height: N } : { width: N, height: Math.round(N / H) };
3226
+ const T = i.filter(Pi);
3227
+ h = Ti(T);
3228
+ const A = h[0];
3229
+ if (A) {
3230
+ const L = await this.loadImageSize(A.low || A.normal);
3231
+ if (L) {
3232
+ const N = (A.cropMode !== "full" ? L.width / 2 : L.width) / L.height, H = 420;
3233
+ u = N >= 1 ? { width: Math.round(H * N), height: H } : { width: H, height: Math.round(H / N) };
3119
3234
  }
3120
3235
  }
3121
3236
  } else if (t) {
3122
3237
  if (r.signal.aborted) return;
3123
- let C = "load";
3238
+ let T = "load";
3124
3239
  try {
3125
- this.pdfRenderer = new bi({
3240
+ this.pdfRenderer = new Ei({
3126
3241
  scale: this.options.pdfRenderScale,
3127
3242
  quality: this.options.pdfRenderQuality,
3128
3243
  format: this.options.pdfRenderFormat,
@@ -3130,26 +3245,28 @@ const mt = class mt {
3130
3245
  cacheSize: this.options.pdfRenderCacheSize,
3131
3246
  workerSrc: this.options.pdfWorkerSrc
3132
3247
  }), this.emit("progress", { phase: "loading", completed: 0, total: 0 });
3133
- const T = await this.pdfRenderer.loadDocument(t, r.signal);
3134
- C = "render", this.emit("progress", { phase: "loading", completed: 1, total: T }), u = await this.pdfRenderer.calculateViewportDimensions(), h = Array.from({ length: T }, (F, B) => this.createPdfPlaceholder(B + 1));
3135
- } catch (T) {
3136
- r.signal.aborted || (console.error("PDF load failed:", T), this.emit("error", {
3137
- code: C === "load" ? "PDF_LOAD_FAILED" : "PDF_RENDER_FAILED",
3138
- message: T instanceof Error ? T.message : "Unable to load PDF.",
3139
- cause: T
3248
+ const A = await this.pdfRenderer.loadDocument(t, r.signal);
3249
+ T = "render", this.emit("progress", { phase: "loading", completed: 1, total: A });
3250
+ const L = await this.pdfRenderer.getPageLayouts(this.options.pdfPageMode);
3251
+ u = L.length ? await this.pdfRenderer.calculateViewportDimensions(420, L[0]) : await this.pdfRenderer.calculateViewportDimensions(), h = L.length ? this.createPdfPlaceholders(L) : Array.from({ length: A }, (U, N) => this.createPdfPlaceholder(N + 1)), this.pdfSourcePageCount = A;
3252
+ } catch (A) {
3253
+ r.signal.aborted || (console.error("PDF load failed:", A), this.emit("error", {
3254
+ code: T === "load" ? "PDF_LOAD_FAILED" : "PDF_RENDER_FAILED",
3255
+ message: A instanceof Error ? A.message : "Unable to load PDF.",
3256
+ cause: A
3140
3257
  }));
3141
3258
  return;
3142
3259
  }
3143
3260
  }
3144
3261
  if (r.signal.aborted || o !== this.initGeneration || !h.length) return;
3145
- this.store.init(this.options, h.length, h, !!t), Jt(this.container, this.options), this.container.innerHTML = "";
3146
- let g, x, P;
3147
- const b = { current: null }, D = { current: null }, $ = ai({
3148
- pageFlipAdapterRef: b,
3149
- interactionManagerRef: D,
3150
- bookWrapperRef: (C) => g = C,
3151
- bookSizerRef: (C) => x = C,
3152
- bookContainerRef: (C) => P = C,
3262
+ this.store.init(this.options, h.length, h, !!t), ee(this.container, this.options), this.container.innerHTML = "";
3263
+ let c, b, P;
3264
+ const k = { current: null }, I = { current: null }, S = gi({
3265
+ pageFlipAdapterRef: k,
3266
+ interactionManagerRef: I,
3267
+ bookWrapperRef: (T) => c = T,
3268
+ bookSizerRef: (T) => b = T,
3269
+ bookContainerRef: (T) => P = T,
3153
3270
  className: this.options.className,
3154
3271
  store: this.store,
3155
3272
  onToggleFullscreen: () => this.toggleFullscreen(),
@@ -3157,91 +3274,108 @@ const mt = class mt {
3157
3274
  t && (this.options.onDownload ? this.options.onDownload(t) : window.open(t, "_blank"));
3158
3275
  }
3159
3276
  });
3160
- this.container.appendChild($), this.setupQualityLoading(), this.layoutManager = new gi(u, this.store), this.layoutManager.onResizeCallback = () => {
3277
+ this.container.appendChild(S), this.setupQualityLoading(), this.layoutManager = new yi(u, this.store), this.layoutManager.onResizeCallback = () => {
3161
3278
  this.pageFlipAdapter && this.pageFlipAdapter.update();
3162
- }, this.layoutManager.init(g, x), this.pageFlipAdapter = new ui(P, this.options, this.store), b.current = this.pageFlipAdapter, await new Promise((C) => {
3163
- const T = () => {
3164
- r.signal.removeEventListener("abort", T), C();
3279
+ }, this.layoutManager.init(c, b), this.pageFlipAdapter = new vi(P, this.options, this.store), k.current = this.pageFlipAdapter, await new Promise((T) => {
3280
+ const A = () => {
3281
+ r.signal.removeEventListener("abort", A), T();
3165
3282
  };
3166
- r.signal.addEventListener("abort", T, { once: !0 }), this.initializationTimer = setTimeout(async () => {
3167
- if (this.initializationTimer = null, r.signal.removeEventListener("abort", T), r.signal.aborted || o !== this.initGeneration || !this.pageFlipAdapter) {
3168
- C();
3283
+ r.signal.addEventListener("abort", A, { once: !0 }), this.initializationTimer = setTimeout(async () => {
3284
+ if (this.initializationTimer = null, r.signal.removeEventListener("abort", A), r.signal.aborted || o !== this.initGeneration || !this.pageFlipAdapter) {
3285
+ T();
3169
3286
  return;
3170
3287
  }
3171
- if (this.pageFlipAdapter.init(u.width, u.height), this.interactionManager = new pi(g, this.pageFlipAdapter, this.store), this.interactionManager.init(), D.current = this.interactionManager, this.setupPdfLazyLoading(), this.pdfRenderer && t)
3288
+ if (this.pageFlipAdapter.init(u.width, u.height), this.interactionManager = new bi(c, this.pageFlipAdapter, this.store), this.interactionManager.init(), I.current = this.interactionManager, this.setupPdfLazyLoading(), this.pdfRenderer && t)
3172
3289
  try {
3173
3290
  await this.renderPdfPage(1, r.signal);
3174
3291
  } catch {
3175
- C();
3292
+ T();
3176
3293
  return;
3177
3294
  }
3178
3295
  if (r.signal.aborted || o !== this.initGeneration) {
3179
- C();
3296
+ T();
3180
3297
  return;
3181
3298
  }
3182
- this.eventsReady = !0, this.captureEventState(), this.hasActiveSession = !0, this.emit("init", { totalPages: h.length }), C();
3299
+ this.eventsReady = !0, this.captureEventState(), this.hasActiveSession = !0, this.emit("init", { totalPages: h.length }), T();
3183
3300
  }, 10);
3184
3301
  }), this.initAbortController === r && (this.initAbortController = null);
3185
3302
  }
3186
3303
  createPdfPlaceholder(t) {
3187
- const s = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
3188
- return {
3189
- index: t - 1,
3190
- assetId: "pdf-page-" + t,
3191
- pageNumber: t,
3192
- cropMode: "full",
3193
- normal: s,
3194
- low: s,
3195
- thumb: s
3196
- };
3304
+ const i = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
3305
+ return { index: t - 1, assetId: "pdf-page-" + t + "-full", pageNumber: t, sourcePageNumber: t, cropMode: "full", normal: i, low: i, thumb: i };
3306
+ }
3307
+ createPdfPlaceholders(t) {
3308
+ const i = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", o = [];
3309
+ return t.forEach((r, h) => {
3310
+ const u = h + 1;
3311
+ (r.split ? ["left", "right"] : ["full"]).forEach((b) => {
3312
+ const P = o.length + 1;
3313
+ o.push({
3314
+ index: o.length,
3315
+ assetId: `pdf-page-${u}-${b}`,
3316
+ pageNumber: P,
3317
+ sourcePageNumber: u,
3318
+ cropMode: b,
3319
+ normal: i,
3320
+ low: i,
3321
+ thumb: i
3322
+ });
3323
+ });
3324
+ }), o;
3197
3325
  }
3198
- renderPdfPage(t, s) {
3326
+ renderPdfPage(t, i) {
3199
3327
  const o = this.pdfRenderer, r = this.initGeneration;
3200
3328
  if (!o) return Promise.resolve("");
3201
3329
  const h = this.pdfPageRequests.get(t);
3202
3330
  if (h) return h;
3203
- if (this.pdfRenderedPages.has(t)) return Promise.resolve("");
3204
- const u = o.renderPageToDataUrl(t, s).then((g) => {
3205
- var x;
3206
- if (r !== this.initGeneration || s != null && s.aborted) throw this.createAbortError();
3207
- if (!g) throw new Error("PDF page " + t + " produced no image.");
3208
- return this.pdfRenderedPages.add(t), (x = this.container) == null || x.querySelectorAll('img[data-pdf-page="' + t + '"]').forEach((P) => {
3209
- P.src = g, delete P.dataset.pdfPage;
3210
- }), this.emit("progress", {
3331
+ if (this.pdfRenderedPages.has(t)) {
3332
+ const c = this.pdfRenderedSources.get(t);
3333
+ return c && this.hydratePdfImages(t, c), Promise.resolve(c || "");
3334
+ }
3335
+ const u = o.renderPageToDataUrl(t, i).then((c) => {
3336
+ if (r !== this.initGeneration || i != null && i.aborted) throw this.createAbortError();
3337
+ if (!c) throw new Error("PDF page " + t + " produced no image.");
3338
+ return this.pdfRenderedPages.add(t), this.pdfRenderedSources.set(t, c), this.hydratePdfImages(t, c), this.emit("progress", {
3211
3339
  phase: "rendering",
3212
3340
  completed: this.pdfRenderedPages.size,
3213
- total: this.store.totalPages.value
3214
- }), g;
3215
- }).catch((g) => {
3216
- throw r !== this.initGeneration && (g == null ? void 0 : g.name) !== "AbortError" ? this.createAbortError() : ((g == null ? void 0 : g.name) === "AbortError" || this.emit("error", {
3341
+ total: this.pdfSourcePageCount || this.store.totalPages.value
3342
+ }), c;
3343
+ }).catch((c) => {
3344
+ throw r !== this.initGeneration && (c == null ? void 0 : c.name) !== "AbortError" ? this.createAbortError() : ((c == null ? void 0 : c.name) === "AbortError" || this.emit("error", {
3217
3345
  code: "PDF_RENDER_FAILED",
3218
- message: g instanceof Error ? g.message : "Unable to render PDF page.",
3219
- cause: g
3220
- }), g);
3346
+ message: c instanceof Error ? c.message : "Unable to render PDF page.",
3347
+ cause: c
3348
+ }), c);
3221
3349
  }).finally(() => {
3222
3350
  this.pdfPageRequests.get(t) === u && this.pdfPageRequests.delete(t);
3223
3351
  });
3224
3352
  return this.pdfPageRequests.set(t, u), u;
3225
3353
  }
3354
+ hydratePdfImages(t, i) {
3355
+ var o;
3356
+ (o = this.container) == null || o.querySelectorAll("img").forEach((r) => {
3357
+ r.dataset.pdfPage === String(t) && (r.src = i, delete r.dataset.pdfPage);
3358
+ });
3359
+ }
3226
3360
  setupPdfLazyLoading() {
3227
3361
  var t;
3228
- (t = this.pdfLazyStop) == null || t.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop = G(() => {
3229
- const s = this.store.currentPage.value + 1, o = this.store.totalPages.value;
3230
- [s, s + 1].filter((r) => r <= o).forEach((r) => {
3231
- this.renderPdfPage(r).catch(() => {
3362
+ (t = this.pdfLazyStop) == null || t.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop = _(() => {
3363
+ const i = this.store.pages.value[this.store.currentPage.value], o = this.store.pages.value[this.store.currentPage.value + 1];
3364
+ (/* @__PURE__ */ new Set([(i == null ? void 0 : i.sourcePageNumber) ?? (i == null ? void 0 : i.pageNumber), (o == null ? void 0 : o.sourcePageNumber) ?? (o == null ? void 0 : o.pageNumber)])).forEach((h) => {
3365
+ h && this.renderPdfPage(h).catch(() => {
3232
3366
  });
3233
3367
  });
3234
3368
  }));
3235
3369
  }
3236
3370
  loadImageSize(t) {
3237
- return new Promise((s) => {
3371
+ return new Promise((i) => {
3238
3372
  const o = new Image();
3239
- o.onload = () => s({ width: o.naturalWidth || o.width, height: o.naturalHeight || o.height }), o.onerror = () => s(null), o.src = t;
3373
+ o.onload = () => i({ width: o.naturalWidth || o.width, height: o.naturalHeight || o.height }), o.onerror = () => i(null), o.src = t;
3240
3374
  });
3241
3375
  }
3242
3376
  goToPage(t) {
3243
- const s = Math.max(0, this.store.totalPages.value - 1);
3244
- this.store.currentPage.value = Math.max(0, Math.min(s, Math.trunc(t)));
3377
+ const i = Math.max(0, this.store.totalPages.value - 1);
3378
+ this.store.currentPage.value = Math.max(0, Math.min(i, Math.trunc(t)));
3245
3379
  }
3246
3380
  getTotalPages() {
3247
3381
  return this.store.totalPages.value;
@@ -3253,7 +3387,7 @@ const mt = class mt {
3253
3387
  return this.store.zoomState.value.scale;
3254
3388
  }
3255
3389
  setZoom(t) {
3256
- const s = Number.isFinite(t) ? t : 1, o = Math.max(0.5, Math.min(5, s));
3390
+ const i = Number.isFinite(t) ? t : 1, o = Math.max(0.5, Math.min(5, i));
3257
3391
  this.store.zoomState.value = {
3258
3392
  ...this.store.zoomState.value,
3259
3393
  scale: o,
@@ -3265,55 +3399,59 @@ const mt = class mt {
3265
3399
  this.pageFlipAdapter && this.pageFlipAdapter.turnToNextPage();
3266
3400
  }
3267
3401
  toggleFullscreen() {
3268
- var s, o;
3402
+ var i, o;
3269
3403
  const t = this.container;
3270
- t && (document.fullscreenElement ? (o = document.exitFullscreen) == null || o.call(document).catch((r) => console.warn("Exit fullscreen err:", r)) : (s = t.requestFullscreen) == null || s.call(t).catch((r) => console.warn("Fullscreen err:", r)));
3404
+ t && (document.fullscreenElement ? (o = document.exitFullscreen) == null || o.call(document).catch((r) => console.warn("Exit fullscreen err:", r)) : (i = t.requestFullscreen) == null || i.call(t).catch((r) => console.warn("Fullscreen err:", r)));
3271
3405
  }
3272
- setLocale(t, s) {
3273
- const o = s ? { ...this.options.messages, [t]: s[t] ?? s } : this.options.messages;
3406
+ setLocale(t, i) {
3407
+ const o = i ? { ...this.options.messages, [t]: i[t] ?? i } : this.options.messages;
3274
3408
  this.options = { ...this.options, locale: t, messages: o }, this.store.locale.value = t, o && (this.store.messages.value = o);
3275
3409
  }
3276
3410
  prevPage() {
3277
3411
  this.pageFlipAdapter && this.pageFlipAdapter.turnToPrevPage();
3278
3412
  }
3279
3413
  setSingleMode(t) {
3280
- this.store.isSingleMode.value = t;
3414
+ this.store.isSingleMode.value = t, t && this.pdfRenderer && setTimeout(() => {
3415
+ const i = this.store.pages.value[this.store.currentPage.value], o = (i == null ? void 0 : i.sourcePageNumber) ?? (i == null ? void 0 : i.pageNumber);
3416
+ o && this.renderPdfPage(o).catch(() => {
3417
+ });
3418
+ }, 0);
3281
3419
  }
3282
3420
  updateOptions(t) {
3283
- this.options = { ...this.options, ...t }, t.theme !== void 0 && (this.store.themeMode.value = t.theme), t.primaryColor !== void 0 && (this.store.primaryColor.value = t.primaryColor), t.showThumbs !== void 0 && (this.store.showThumbs.value = t.showThumbs), t.showArrows !== void 0 && (this.store.showArrows.value = t.showArrows), t.allowDownload !== void 0 && (this.store.allowDownload.value = t.allowDownload), t.whiteLabel !== void 0 && (this.store.whiteLabel.value = t.whiteLabel), t.soundEnabled !== void 0 && (this.store.soundEnabled.value = t.soundEnabled), t.locale !== void 0 && (this.store.locale.value = t.locale), t.messages !== void 0 && (this.store.messages.value = t.messages), t.singleMode !== void 0 && (this.store.isSingleMode.value = t.singleMode), t.isSingleMode !== void 0 && (this.store.isSingleMode.value = t.isSingleMode), t.autoPlay !== void 0 && (this.store.isAutoPlaying.value = t.autoPlay), t.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = t.autoPlayInterval), this.container && Jt(this.container, this.options);
3421
+ this.options = { ...this.options, ...t }, t.theme !== void 0 && (this.store.themeMode.value = t.theme), t.primaryColor !== void 0 && (this.store.primaryColor.value = t.primaryColor), t.showThumbs !== void 0 && (this.store.showThumbs.value = t.showThumbs), t.showToc !== void 0 && (this.store.showToc.value = t.showToc), t.toc !== void 0 && (this.store.toc.value = Pe(t.toc, this.store.totalPages.value)), t.showArrows !== void 0 && (this.store.showArrows.value = t.showArrows), t.allowDownload !== void 0 && (this.store.allowDownload.value = t.allowDownload), t.whiteLabel !== void 0 && (this.store.whiteLabel.value = t.whiteLabel), t.soundEnabled !== void 0 && (this.store.soundEnabled.value = t.soundEnabled), t.locale !== void 0 && (this.store.locale.value = t.locale), t.messages !== void 0 && (this.store.messages.value = t.messages), t.singleMode !== void 0 && (this.store.isSingleMode.value = t.singleMode), t.isSingleMode !== void 0 && (this.store.isSingleMode.value = t.isSingleMode), t.autoPlay !== void 0 && (this.store.isAutoPlaying.value = t.autoPlay), t.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = t.autoPlayInterval), this.container && ee(this.container, this.options);
3284
3422
  }
3285
- async setPages(t, s) {
3423
+ async setPages(t, i) {
3286
3424
  if (!(t != null && t.length)) {
3287
- s && await this.init(s);
3425
+ i && await this.init(i);
3288
3426
  return;
3289
3427
  }
3290
- await this.init(s || "", t);
3428
+ await this.init(i || "", t);
3291
3429
  }
3292
3430
  setupQualityLoading() {
3293
3431
  var r;
3294
3432
  if (this.teardownQualityLoading(), !this.container) return;
3295
- const t = Array.from(this.container.querySelectorAll("img[data-src], img[data-pdf-page]")), s = (h) => {
3433
+ const t = Array.from(this.container.querySelectorAll("img[data-src], img[data-pdf-page]")), i = (h) => {
3296
3434
  const u = Number(h.dataset.pdfPage);
3297
3435
  if (Number.isInteger(u) && u > 0) {
3298
3436
  this.renderPdfPage(u).catch(() => {
3299
3437
  });
3300
3438
  return;
3301
3439
  }
3302
- const g = h.dataset.src;
3303
- g && (h.src = g, delete h.dataset.src);
3440
+ const c = h.dataset.src;
3441
+ c && (h.src = c, delete h.dataset.src);
3304
3442
  }, o = (r = this.container.ownerDocument.defaultView) == null ? void 0 : r.IntersectionObserver;
3305
3443
  if (!o) {
3306
3444
  const h = /* @__PURE__ */ new Set();
3307
3445
  t.forEach((u) => {
3308
- const g = Number(u.dataset.pdfPage);
3309
- Number.isInteger(g) && g > 0 ? h.size < 2 && (h.add(g), s(u)) : s(u);
3446
+ const c = Number(u.dataset.pdfPage);
3447
+ Number.isInteger(c) && c > 0 ? h.size < 2 && (h.add(c), i(u)) : i(u);
3310
3448
  });
3311
3449
  return;
3312
3450
  }
3313
3451
  this.qualityObserver = new o((h) => {
3314
3452
  h.forEach((u) => {
3315
- var g;
3316
- u.isIntersecting && (s(u.target), (g = this.qualityObserver) == null || g.unobserve(u.target));
3453
+ var c;
3454
+ u.isIntersecting && (i(u.target), (c = this.qualityObserver) == null || c.unobserve(u.target));
3317
3455
  });
3318
3456
  }, { root: this.container, rootMargin: "240px" }), t.forEach((h) => {
3319
3457
  var u;
@@ -3325,12 +3463,13 @@ const mt = class mt {
3325
3463
  (t = this.qualityObserver) == null || t.disconnect(), this.qualityObserver = null;
3326
3464
  }
3327
3465
  setupEventSync() {
3328
- this.eventSyncStop = G(() => {
3466
+ this.eventSyncStop = _(() => {
3329
3467
  const t = {
3330
3468
  currentPage: this.store.currentPage.value,
3331
3469
  zoom: this.store.zoomState.value.scale,
3332
3470
  zoomActive: this.store.zoomState.value.isActive,
3333
3471
  showThumbs: this.store.showThumbs.value,
3472
+ showToc: this.store.showToc.value,
3334
3473
  isSingle: this.store.isSingleMode.value,
3335
3474
  orientation: this.store.orientation.value
3336
3475
  };
@@ -3343,7 +3482,7 @@ const mt = class mt {
3343
3482
  pageNumber: t.currentPage + 1,
3344
3483
  totalPages: this.store.totalPages.value,
3345
3484
  isSingle: t.isSingle
3346
- }), (t.zoom !== this.lastEventState.zoom || t.zoomActive !== this.lastEventState.zoomActive) && this.emit("zoomChange", { zoom: t.zoom, isActive: t.zoomActive }), t.showThumbs !== this.lastEventState.showThumbs && this.emit("thumbsToggle", { showThumbs: t.showThumbs }), t.isSingle !== this.lastEventState.isSingle && this.emit("singlePageModeChange", { isSingle: t.isSingle }), t.orientation !== this.lastEventState.orientation && this.emit("orientationChange", { orientation: t.orientation }), this.lastEventState = t;
3485
+ }), (t.zoom !== this.lastEventState.zoom || t.zoomActive !== this.lastEventState.zoomActive) && this.emit("zoomChange", { zoom: t.zoom, isActive: t.zoomActive }), t.showThumbs !== this.lastEventState.showThumbs && this.emit("thumbsToggle", { showThumbs: t.showThumbs }), t.showToc !== this.lastEventState.showToc && this.emit("tocToggle", { showToc: t.showToc }), t.isSingle !== this.lastEventState.isSingle && this.emit("singlePageModeChange", { isSingle: t.isSingle }), t.orientation !== this.lastEventState.orientation && this.emit("orientationChange", { orientation: t.orientation }), this.lastEventState = t;
3347
3486
  });
3348
3487
  }
3349
3488
  captureEventState() {
@@ -3352,42 +3491,45 @@ const mt = class mt {
3352
3491
  zoom: this.store.zoomState.value.scale,
3353
3492
  zoomActive: this.store.zoomState.value.isActive,
3354
3493
  showThumbs: this.store.showThumbs.value,
3494
+ showToc: this.store.showToc.value,
3355
3495
  isSingle: this.store.isSingleMode.value,
3356
3496
  orientation: this.store.orientation.value
3357
3497
  };
3358
3498
  }
3359
3499
  destroy(t = !1) {
3360
3500
  var o, r;
3361
- const s = this.hasActiveSession || !!this.initAbortController || !!this.pageFlipAdapter || !!this.layoutManager || !!this.interactionManager || !!this.pdfRenderer;
3362
- this.initGeneration++, (o = this.initAbortController) == null || o.abort(), this.initAbortController = null, this.initializationTimer && (clearTimeout(this.initializationTimer), this.initializationTimer = null), this.pageFlipAdapter && this.pageFlipAdapter.destroy(), this.layoutManager && this.layoutManager.destroy(), this.interactionManager && this.interactionManager.destroy(), this.teardownQualityLoading(), (r = this.pdfLazyStop) == null || r.call(this), this.pdfLazyStop = null, this.pdfPageRequests.clear(), this.pdfRenderedPages.clear(), this.pdfRenderer && this.pdfRenderer.destroy(), this.pageFlipAdapter = null, this.layoutManager = null, this.interactionManager = null, this.pdfRenderer = null, this.eventsReady = !1, this.hasActiveSession = !1, this.store.reset(), !t && this.container && (this.container.innerHTML = ""), s && this.emit("destroy", void 0);
3501
+ const i = this.hasActiveSession || !!this.initAbortController || !!this.pageFlipAdapter || !!this.layoutManager || !!this.interactionManager || !!this.pdfRenderer;
3502
+ this.initGeneration++, (o = this.initAbortController) == null || o.abort(), this.initAbortController = null, this.initializationTimer && (clearTimeout(this.initializationTimer), this.initializationTimer = null), this.pageFlipAdapter && this.pageFlipAdapter.destroy(), this.layoutManager && this.layoutManager.destroy(), this.interactionManager && this.interactionManager.destroy(), this.teardownQualityLoading(), (r = this.pdfLazyStop) == null || r.call(this), this.pdfLazyStop = null, this.pdfPageRequests.clear(), this.pdfRenderedPages.clear(), this.pdfRenderedSources.clear(), this.pdfSourcePageCount = 0, this.pdfRenderer && this.pdfRenderer.destroy(), this.pageFlipAdapter = null, this.layoutManager = null, this.interactionManager = null, this.pdfRenderer = null, this.eventsReady = !1, this.hasActiveSession = !1, this.store.reset(), !t && this.container && (this.container.innerHTML = ""), i && this.emit("destroy", void 0);
3363
3503
  }
3364
3504
  createAbortError() {
3365
3505
  const t = new Error("Flipbook initialization was aborted.");
3366
3506
  return t.name = "AbortError", t;
3367
3507
  }
3368
- on(t, s) {
3508
+ on(t, i) {
3369
3509
  const o = this.listeners[t] ?? /* @__PURE__ */ new Set();
3370
- return o.add(s), this.listeners[t] = o, () => this.off(t, s);
3510
+ return o.add(i), this.listeners[t] = o, () => this.off(t, i);
3371
3511
  }
3372
- off(t, s) {
3512
+ off(t, i) {
3373
3513
  var o;
3374
- (o = this.listeners[t]) == null || o.delete(s);
3514
+ (o = this.listeners[t]) == null || o.delete(i);
3375
3515
  }
3376
- emit(t, s) {
3516
+ emit(t, i) {
3377
3517
  var o;
3378
3518
  (o = this.listeners[t]) == null || o.forEach((r) => {
3379
- r(s);
3519
+ r(i);
3380
3520
  });
3381
3521
  }
3382
3522
  };
3383
- m(mt, "DEFAULT_PAGE_VIEWPORT", { width: 420, height: 594 });
3384
- let Rt = mt;
3385
- const we = globalThis, ve = we.FlipbookEngine || {};
3386
- ve.FlipbookEngine = Rt;
3387
- we.FlipbookEngine = ve;
3523
+ v(mt, "DEFAULT_PAGE_VIEWPORT", { width: 420, height: 594 });
3524
+ let Lt = mt;
3525
+ const Se = globalThis, Te = Se.FlipbookEngine || {};
3526
+ Te.FlipbookEngine = Lt;
3527
+ Se.FlipbookEngine = Te;
3388
3528
  export {
3389
- Rt as F,
3390
- fi as i,
3391
- vi as n
3529
+ Lt as F,
3530
+ Pi as a,
3531
+ Pe as b,
3532
+ Ai as i,
3533
+ Ti as n
3392
3534
  };
3393
- //# sourceMappingURL=engine-7jWE07Zq.js.map
3535
+ //# sourceMappingURL=engine-DhQ2zxpm.js.map