flipbookengine 0.4.0 → 0.5.1

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,15 +1,15 @@
1
1
  var ve = Object.defineProperty;
2
- var Ht = (e) => {
2
+ var Nt = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
5
  var ye = (e, t, s) => t in e ? ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
6
- var v = (e, t, s) => ye(e, typeof t != "symbol" ? t + "" : t, s), yt = (e, t, s) => t.has(e) || Ht("Cannot " + s);
7
- var B = (e, t, s) => (yt(e, t, "read from private field"), s ? s.call(e) : t.get(e)), rt = (e, t, s) => t.has(e) ? Ht("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);
6
+ var m = (e, t, s) => ye(e, typeof t != "symbol" ? t + "" : t, s), yt = (e, t, s) => t.has(e) || Nt("Cannot " + s);
7
+ var B = (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
8
  import * as Bt from "pdfjs-dist";
9
9
  var be = Symbol.for("preact-signals");
10
- function Rt() {
11
- if (U > 1)
12
- U--;
10
+ function It() {
11
+ if (j > 1)
12
+ j--;
13
13
  else {
14
14
  var e, t = !1;
15
15
  for (function() {
@@ -28,27 +28,27 @@ function Rt() {
28
28
  s = o;
29
29
  }
30
30
  }
31
- if (lt = 0, U--, t) throw e;
31
+ if (lt = 0, j--, t) throw e;
32
32
  }
33
33
  }
34
- var k = void 0;
34
+ var C = void 0;
35
35
  function wt(e) {
36
- var t = k;
37
- k = void 0;
36
+ var t = C;
37
+ C = void 0;
38
38
  try {
39
39
  return e();
40
40
  } finally {
41
- k = t;
41
+ C = t;
42
42
  }
43
43
  }
44
- var tt = void 0, U = 0, lt = 0, _t = 0, ct = void 0, dt = 0;
44
+ var tt = void 0, j = 0, lt = 0, _t = 0, ct = void 0, dt = 0;
45
45
  function te(e) {
46
- if (k !== void 0) {
46
+ if (C !== 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 !== C)
49
+ return t = { i: 0, S: e, p: C.s, n: void 0, t: C, e: void 0, x: void 0, r: t }, C.s !== void 0 && (C.s.n = t), C.s = t, e.n = t, 32 & C.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 = C.s, t.n = void 0, C.s.n = t, C.s = t), t;
52
52
  }
53
53
  }
54
54
  function I(e, t) {
@@ -77,7 +77,7 @@ I.prototype.U = function(e) {
77
77
  };
78
78
  I.prototype.subscribe = function(e) {
79
79
  var t = this;
80
- return j(function() {
80
+ return _(function() {
81
81
  var s = t.value;
82
82
  wt(function() {
83
83
  return e(s);
@@ -106,12 +106,12 @@ Object.defineProperty(I.prototype, "value", { get: function() {
106
106
  if (e !== this.v) {
107
107
  if (lt > 100) throw new Error("Cycle detected");
108
108
  (function(s) {
109
- U !== 0 && lt === 0 && s.l !== _t && (s.l = _t, ct = { S: s, v: s.v, i: s.i, o: ct });
110
- })(this), this.v = e, this.i++, dt++, U++;
109
+ j !== 0 && lt === 0 && s.l !== _t && (s.l = _t, ct = { S: s, v: s.v, i: s.i, o: ct });
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
- Rt();
114
+ It();
115
115
  }
116
116
  }
117
117
  } });
@@ -138,65 +138,65 @@ function se(e) {
138
138
  }
139
139
  e.s = s;
140
140
  }
141
- function X(e, t) {
141
+ function q(e, t) {
142
142
  I.call(this, void 0, t), this.x = e, this.s = void 0, this.g = dt - 1, this.f = 4;
143
143
  }
144
- X.prototype = new I();
145
- X.prototype.h = function() {
144
+ q.prototype = new I();
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
148
  if (this.g = dt, this.f |= 1, this.i > 0 && !ee(this))
149
149
  return this.f &= -2, !0;
150
- var e = k;
150
+ var e = C;
151
151
  try {
152
- ie(this), k = this;
152
+ ie(this), C = 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
155
  } catch (s) {
156
156
  this.v = s, this.f |= 16, this.i++;
157
157
  }
158
- return k = e, se(this), this.f &= -2, !0;
158
+ return C = e, se(this), this.f &= -2, !0;
159
159
  };
160
- X.prototype.S = function(e) {
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
165
  I.prototype.S.call(this, e);
166
166
  };
167
- X.prototype.U = function(e) {
167
+ q.prototype.U = function(e) {
168
168
  if (this.t !== void 0 && (I.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
  }
172
172
  };
173
- X.prototype.N = function() {
173
+ q.prototype.N = function() {
174
174
  if (!(2 & this.f)) {
175
175
  this.f |= 6;
176
176
  for (var e = this.t; e !== void 0; e = e.x) e.t.N();
177
177
  }
178
178
  };
179
- Object.defineProperty(X.prototype, "value", { get: function() {
179
+ Object.defineProperty(q.prototype, "value", { get: function() {
180
180
  if (1 & this.f) throw new Error("Cycle detected");
181
181
  var e = te(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
- function m(e, t) {
186
- return new X(e, t);
185
+ function w(e, t) {
186
+ return new q(e, t);
187
187
  }
188
188
  function ne(e) {
189
189
  var t = e.m;
190
190
  if (e.m = void 0, typeof t == "function") {
191
- U++;
192
- var s = k;
193
- k = void 0;
191
+ j++;
192
+ var s = C;
193
+ C = void 0;
194
194
  try {
195
195
  t();
196
196
  } catch (o) {
197
197
  throw e.f &= -2, e.f |= 8, Lt(e), o;
198
198
  } finally {
199
- k = s, Rt();
199
+ C = s, It();
200
200
  }
201
201
  }
202
202
  }
@@ -205,13 +205,13 @@ function Lt(e) {
205
205
  e.x = void 0, e.s = void 0, ne(e);
206
206
  }
207
207
  function xe(e) {
208
- if (k !== this) throw new Error("Out-of-order effect");
209
- se(this), k = e, this.f &= -2, 8 & this.f && Lt(this), Rt();
208
+ if (C !== this) throw new Error("Out-of-order effect");
209
+ se(this), C = e, this.f &= -2, 8 & this.f && Lt(this), It();
210
210
  }
211
- function q(e, t) {
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;
213
213
  }
214
- q.prototype.c = function() {
214
+ X.prototype.c = function() {
215
215
  var e = this.S();
216
216
  try {
217
217
  if (8 & this.f || this.x === void 0) return;
@@ -221,23 +221,23 @@ q.prototype.c = function() {
221
221
  e();
222
222
  }
223
223
  };
224
- q.prototype.S = function() {
224
+ X.prototype.S = function() {
225
225
  if (1 & this.f) throw new Error("Cycle detected");
226
- this.f |= 1, this.f &= -9, ne(this), ie(this), U++;
227
- var e = k;
228
- return k = this, xe.bind(this, e);
226
+ this.f |= 1, this.f &= -9, ne(this), ie(this), j++;
227
+ var e = C;
228
+ return C = this, xe.bind(this, e);
229
229
  };
230
- q.prototype.N = function() {
230
+ X.prototype.N = function() {
231
231
  2 & this.f || (this.f |= 2, this.u = tt, tt = this);
232
232
  };
233
- q.prototype.d = function() {
233
+ X.prototype.d = function() {
234
234
  this.f |= 8, 1 & this.f || Lt(this);
235
235
  };
236
- q.prototype.dispose = function() {
236
+ X.prototype.dispose = function() {
237
237
  this.d();
238
238
  };
239
- function j(e, t) {
240
- var s = new q(e, t);
239
+ function _(e, t) {
240
+ var s = new X(e, t);
241
241
  try {
242
242
  s.c();
243
243
  } catch (r) {
@@ -247,7 +247,7 @@ function j(e, t) {
247
247
  return o[Symbol.dispose] = o, o;
248
248
  }
249
249
  var oe = /* @__PURE__ */ Symbol.for("Serenity.initPropHook");
250
- function Se(e) {
250
+ function Pe(e) {
251
251
  return !!(e && typeof e.nodeType == "number");
252
252
  }
253
253
  function vt(e) {
@@ -259,13 +259,13 @@ function re(e) {
259
259
  function z(e) {
260
260
  return typeof e == "object" && e !== null;
261
261
  }
262
- function Pe(e) {
262
+ function Se(e) {
263
263
  return !!(e && e.isComponent);
264
264
  }
265
265
  function zt(e) {
266
266
  return z(e) && typeof e.length == "number" && typeof e.nodeType != "number";
267
267
  }
268
- function ke(e) {
268
+ function Ce(e) {
269
269
  return typeof e == "function" && typeof e[oe] == "function";
270
270
  }
271
271
  function it(e) {
@@ -274,11 +274,11 @@ function it(e) {
274
274
  function st(e) {
275
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 : "";
276
276
  }
277
- function Ce(e) {
277
+ function ke(e) {
278
278
  return e != null && typeof e == "object" && "current" in e;
279
279
  }
280
280
  function Ft(e, t) {
281
- Ce(e) ? e.current = t : typeof e == "function" && e(t);
281
+ ke(e) ? e.current = t : typeof e == "function" && e(t);
282
282
  }
283
283
  function Te(e, t, s) {
284
284
  t = { ...t, children: s };
@@ -351,13 +351,13 @@ var Ae = "http://www.w3.org/1998/Math/MathML", Ee = /* @__PURE__ */ new Set(["ma
351
351
  "use",
352
352
  "view"
353
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)/, De = "http://www.w3.org/2000/svg", Ut = /* @__PURE__ */ Symbol.for("Serenity.jsxNamespaceURI");
354
- function Ie(e) {
354
+ function Re(e) {
355
355
  const t = globalThis[Ut];
356
356
  return arguments.length && (globalThis[Ut] = e), t;
357
357
  }
358
- var Re = /* @__PURE__ */ Symbol.for("Serenity.jsxTypeKey"), Le = "ShadowRoot";
358
+ var Ie = /* @__PURE__ */ Symbol.for("Serenity.jsxTypeKey"), Le = "ShadowRoot";
359
359
  function ze(e) {
360
- return e != null && e[Re] === Le;
360
+ return e != null && e[Ie] === Le;
361
361
  }
362
362
  var bt = /* @__PURE__ */ Symbol.for("Serenity.disposingListeners"), xt = /* @__PURE__ */ Symbol.for("Serenity.lifecycleRoot");
363
363
  function Ot() {
@@ -371,19 +371,19 @@ function Fe(e, t) {
371
371
  return;
372
372
  const s = Ot();
373
373
  function o(r) {
374
- const c = s.get(r);
375
- if (c) {
374
+ const l = s.get(r);
375
+ if (l) {
376
376
  s.delete(r), r.removeEventListener("disposing", Wt);
377
- for (const g of c)
377
+ for (const d of l)
378
378
  try {
379
- g.callback(r);
379
+ d.callback(r);
380
380
  } catch {
381
381
  }
382
382
  }
383
383
  }
384
384
  o(e);
385
385
  }
386
- function Ct(e, t, s) {
386
+ function kt(e, t, s) {
387
387
  if (!e || !t)
388
388
  return e;
389
389
  const o = Ot();
@@ -393,17 +393,17 @@ function Ct(e, t, s) {
393
393
  callback: t,
394
394
  regKey: s
395
395
  }]), e.addEventListener("disposing", Wt, { once: !0 })), e;
396
- const c = r.find((g) => g.callback === t);
397
- return c ? (c.regKey, e) : (r.push({ callback: t, regKey: s }), e);
396
+ const l = r.find((d) => d.callback === t);
397
+ return l ? (l.regKey, e) : (r.push({ callback: t, regKey: s }), e);
398
398
  }
399
399
  function jt(e, t, s) {
400
400
  if (!e || !t)
401
401
  return e;
402
402
  const o = Ot(), r = o.get(e);
403
403
  if (r) {
404
- for (let c = r.length - 1; c >= 0; c--) {
405
- const g = r[c];
406
- t && t === g.callback && r.splice(c, 1);
404
+ for (let l = r.length - 1; l >= 0; l--) {
405
+ const d = r[l];
406
+ t && t === d.callback && r.splice(l, 1);
407
407
  }
408
408
  r.length === 0 && (o.delete(e), typeof e.removeEventListener == "function" && e.removeEventListener("disposing", Wt));
409
409
  }
@@ -419,47 +419,47 @@ function Oe(...e) {
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, _, Tt, At, Jt, We = (Jt = class {
422
+ var ot, F, G, Tt, At, Jt, We = (Jt = class {
423
423
  constructor(e, t, s) {
424
- rt(this, _);
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, F);
427
+ this.signal = e, this.isInitial = !0, this.hasChanged = !1, this.lifecycleRoot = t, at(this, F, s);
428
428
  }
429
429
  get lifecycleNode() {
430
- return B(this, O);
430
+ return B(this, F);
431
431
  }
432
432
  get effectDisposer() {
433
433
  return B(this, ot);
434
434
  }
435
435
  set effectDisposer(e) {
436
- J(this, _, Tt).call(this), at(this, ot, e), J(this, _, At).call(this);
436
+ J(this, G, Tt).call(this), at(this, ot, e), J(this, G, At).call(this);
437
437
  }
438
438
  set lifecycleNode(e) {
439
- e !== B(this, O) && (J(this, _, Tt).call(this), at(this, O, e), J(this, _, At).call(this));
439
+ e !== B(this, F) && (J(this, G, Tt).call(this), at(this, F, e), J(this, G, At).call(this));
440
440
  }
441
- }, ot = new WeakMap(), O = new WeakMap(), _ = new WeakSet(), Tt = function() {
441
+ }, ot = new WeakMap(), F = new WeakMap(), G = new WeakSet(), Tt = function() {
442
442
  var e;
443
- jt(B(this, O), this.effectDisposer), jt(B(this, O), (e = this.signal) == null ? void 0 : e.derivedDisposer);
443
+ jt(B(this, F), this.effectDisposer), jt(B(this, F), (e = this.signal) == null ? void 0 : e.derivedDisposer);
444
444
  }, At = function() {
445
445
  var e;
446
- Ct(B(this, O), this.effectDisposer), Ct(B(this, O), (e = this.signal) == null ? void 0 : e.derivedDisposer);
446
+ kt(B(this, F), this.effectDisposer), kt(B(this, F), (e = this.signal) == null ? void 0 : e.derivedDisposer);
447
447
  }, Jt);
448
448
  function nt(e, t, s) {
449
- const o = s != null && s.useLifecycleRoot ? Oe() : void 0, r = new We(e, o, s == null ? void 0 : s.lifecycleNode), c = r.signal.subscribe(function(g) {
450
- r.newValue = g, r.isInitial && (this != null && this.dispose) && (r.effectDisposer = this.dispose.bind(this)), r.hasChanged = !r.isInitial && r.prevValue !== r.newValue;
449
+ const o = s != null && s.useLifecycleRoot ? Oe() : void 0, r = new We(e, o, s == null ? void 0 : s.lifecycleNode), l = r.signal.subscribe(function(d) {
450
+ r.newValue = d, 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);
453
453
  } finally {
454
454
  r.prevValue = r.newValue, r.isInitial = !1;
455
455
  }
456
456
  });
457
- return c && !r.effectDisposer && (r.effectDisposer = c), r.effectDisposer;
457
+ return l && !r.effectDisposer && (r.effectDisposer = l), r.effectDisposer;
458
458
  }
459
459
  function Vt(e, t) {
460
460
  e instanceof window.HTMLTemplateElement ? e.content.appendChild(t) : e.appendChild(t);
461
461
  }
462
- var St = 0, Et = "__domwisefrag_";
462
+ var Pt = 0, Et = "__domwisefrag_";
463
463
  function ae(e) {
464
464
  return e instanceof Comment && e.data.startsWith(Et);
465
465
  }
@@ -470,29 +470,29 @@ function $e(e, t) {
470
470
  var s;
471
471
  typeof e.replaceWith == "function" ? e.replaceWith(t) : (s = e.parentNode) == null || s.replaceChild(t, e);
472
472
  }
473
- function Xt(e) {
474
- return e instanceof DocumentFragment ? (++St, e.prepend(document.createComment(Et + St)), e.append(document.createComment(Et + St)), e) : e instanceof Node ? e : it(e) ? document.createTextNode(e) : document.createComment("");
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("");
475
475
  }
476
- function Ne(e, t) {
476
+ function He(e, t) {
477
477
  let s;
478
478
  nt(t, (o) => {
479
- var g;
479
+ var d;
480
480
  if (o.isInitial) {
481
- s = Xt(o.newValue);
482
- let f = Zt(s) ? s.firstChild : s;
483
- ut(e, s), o.lifecycleNode = (s = f) ?? e;
481
+ s = qt(o.newValue);
482
+ let p = Zt(s) ? s.firstChild : s;
483
+ ut(e, s), o.lifecycleNode = (s = p) ?? e;
484
484
  return;
485
485
  }
486
486
  if (!o.hasChanged)
487
487
  return;
488
- const r = Xt(o.newValue);
488
+ const r = qt(o.newValue);
489
489
  if (ae(s)) {
490
- let f;
491
- for (; (f = s.nextSibling) && ((g = f.parentNode) == null || g.removeChild(f), !(f instanceof Comment && f.data === s.data)); )
490
+ let p;
491
+ for (; (p = s.nextSibling) && ((d = p.parentNode) == null || d.removeChild(p), !(p instanceof Comment && p.data === s.data)); )
492
492
  ;
493
493
  }
494
- let c = Zt(r) ? r.firstChild : r;
495
- $e(s, r), o.lifecycleNode = (s = c) ?? e;
494
+ let l = Zt(r) ? r.firstChild : r;
495
+ $e(s, r), o.lifecycleNode = (s = l) ?? e;
496
496
  });
497
497
  }
498
498
  function ut(e, t) {
@@ -502,19 +502,19 @@ function ut(e, t) {
502
502
  ut(e, s);
503
503
  else if (vt(t) || re(t))
504
504
  Vt(e, document.createTextNode(t));
505
- else if (Se(t))
505
+ else if (Pe(t))
506
506
  Vt(e, t);
507
507
  else if (ze(t)) {
508
508
  const s = e.attachShadow(t.attr);
509
509
  ut(s, t.children), Ft(t.ref, s);
510
- } else Z(t) && Ne(e, t);
510
+ } else Z(t) && He(e, t);
511
511
  }
512
512
  function he(e) {
513
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
514
  Z(s) && (e[t] = s.peek());
515
515
  }))), e;
516
516
  }
517
- function He(e, t) {
517
+ function Ne(e, t) {
518
518
  if (t == null || t === !1 || t === !0)
519
519
  return;
520
520
  t = he(t);
@@ -524,38 +524,38 @@ function He(e, t) {
524
524
  }
525
525
  function Be(e, t, s) {
526
526
  if (t == null || t === !1) {
527
- He(e, s);
527
+ Ne(e, s);
528
528
  return;
529
529
  }
530
530
  s = he(s), zt(t) ? t = Array.from(t).map((o) => {
531
531
  let r = o;
532
- return Z(o) && nt(o, (c) => {
533
- if (c.isInitial) {
534
- r = c.newValue;
532
+ return Z(o) && nt(o, (l) => {
533
+ if (l.isInitial) {
534
+ r = l.newValue;
535
535
  return;
536
536
  }
537
- Pt(e, c.newValue, c.prevValue);
537
+ St(e, l.newValue, l.prevValue);
538
538
  }, {
539
539
  lifecycleNode: e
540
540
  }), r;
541
541
  }) : z(t) && (t = { ...t }, Object.entries(t).forEach(([o, r]) => {
542
- Z(r) && nt(r, (c) => {
543
- if (c.isInitial) {
544
- t[o] = c.newValue;
542
+ Z(r) && nt(r, (l) => {
543
+ if (l.isInitial) {
544
+ t[o] = l.newValue;
545
545
  return;
546
546
  }
547
- Pt(e, !!c.newValue && o, !!c.prevValue && o);
547
+ St(e, !!l.newValue && o, !!l.prevValue && o);
548
548
  }, {
549
549
  lifecycleNode: e
550
550
  });
551
- })), Pt(e, t, s);
551
+ })), St(e, t, s);
552
552
  }
553
- function Pt(e, t, s) {
553
+ function St(e, t, s) {
554
554
  const o = (st(t) ?? "").split(" ");
555
555
  if (s) {
556
556
  const r = (st(s) ?? "").split(" ");
557
- for (let c of r)
558
- c && !o.includes(c) && e.classList.remove(c);
557
+ for (let l of r)
558
+ l && !o.includes(l) && e.classList.remove(l);
559
559
  }
560
560
  for (let r of o)
561
561
  r && e.classList.add(r);
@@ -619,7 +619,7 @@ var Ge = /* @__PURE__ */ (() => {
619
619
  function Mt(e, t, s) {
620
620
  t.indexOf("-") === 0 ? e.style.setProperty(t, s) : re(s) && Ge[t] !== 0 ? e.style[t] = s + "px" : e.style[t] = s;
621
621
  }
622
- function qt(e, t) {
622
+ function Xt(e, t) {
623
623
  if (!(t == null || t === !1 || t === !0)) {
624
624
  if (vt(t)) {
625
625
  e.removeAttribute("style");
@@ -632,7 +632,7 @@ function qt(e, t) {
632
632
  }
633
633
  function Ue(e, t, s) {
634
634
  if (t == null || t === !1 || t === !0) {
635
- qt(e, s);
635
+ Xt(e, s);
636
636
  return;
637
637
  }
638
638
  if (vt(t)) {
@@ -642,8 +642,8 @@ function Ue(e, t, s) {
642
642
  if (z(t)) {
643
643
  z(s) ? (t = { ...t }, Object.keys(s).forEach((o) => {
644
644
  o in t || (t[o] = "");
645
- })) : qt(e, s), Object.entries(t).forEach(([o, r]) => {
646
- Z(r) ? nt(r, (c) => Mt(e, o, c.newValue), {
645
+ })) : Xt(e, s), Object.entries(t).forEach(([o, r]) => {
646
+ Z(r) ? nt(r, (l) => Mt(e, o, l.newValue), {
647
647
  lifecycleNode: e
648
648
  }) : Mt(e, o, r);
649
649
  });
@@ -676,10 +676,10 @@ var Ze = /* @__PURE__ */ new Map([
676
676
  function Yt(e, t, s, o) {
677
677
  switch (t) {
678
678
  case "dataset":
679
- o != null && Object.entries(o).forEach(([c, g]) => {
680
- g != null && delete e.dataset[c];
681
- }), Object.entries(s).forEach(([c, g]) => {
682
- g != null && (e.dataset[c] = g);
679
+ o != null && Object.entries(o).forEach(([l, d]) => {
680
+ d != null && delete e.dataset[l];
681
+ }), Object.entries(s).forEach(([l, d]) => {
682
+ d != null && (e.dataset[l] = d);
683
683
  });
684
684
  return;
685
685
  case "textContent":
@@ -722,10 +722,10 @@ function Yt(e, t, s, o) {
722
722
  case "on":
723
723
  case "onCapture":
724
724
  const r = t === "onCapture";
725
- o != null && Object.entries(o).forEach(([c, g]) => {
726
- (s == null || s[c] !== g) && e.removeEventListener(c, g, r);
727
- }), Object.entries(s).forEach(([c, g]) => {
728
- (o == null || o[c] !== g) && e.addEventListener(c, g, r);
725
+ o != null && Object.entries(o).forEach(([l, d]) => {
726
+ (s == null || s[l] !== d) && e.removeEventListener(l, d, r);
727
+ }), Object.entries(s).forEach(([l, d]) => {
728
+ (o == null || o[l] !== d) && e.addEventListener(l, d, r);
729
729
  });
730
730
  return;
731
731
  case "xlinkActuate":
@@ -751,9 +751,9 @@ function Yt(e, t, s, o) {
751
751
  if (o != null && o === s)
752
752
  return;
753
753
  let r = t.toLowerCase();
754
- const c = r.endsWith("capture");
755
- let g;
756
- !c && (e[r] === null || o != null && e[r] === o) ? (e[r] = s, Ct(e, qe.bind(e, r))) : c ? (g = r.substring(2, r.length - 7), o != null && e.removeEventListener(g, o, !0), e.addEventListener(g, s, !0)) : (r in window ? g = r.substring(2) : g = r[2] + t.slice(3), o != null && e.removeEventListener(g, o), e.addEventListener(g, s));
754
+ const l = r.endsWith("capture");
755
+ let d;
756
+ !l && (e[r] === null || o != null && e[r] === o) ? (e[r] = s, kt(e, Xe.bind(e, r))) : l ? (d = r.substring(2, r.length - 7), o != null && e.removeEventListener(d, o, !0), e.addEventListener(d, s, !0)) : (r in window ? d = r.substring(2) : d = r[2] + t.slice(3), o != null && e.removeEventListener(d, o), e.addEventListener(d, s));
757
757
  } else
758
758
  console.warn(`A function was provided for JSX ${e.tagName} element ${t} which does not start with "on":`, s, e.tagName);
759
759
  return;
@@ -783,33 +783,33 @@ function Yt(e, t, s, o) {
783
783
  }
784
784
  s !== !1 && s != null && (e instanceof SVGElement && !Gt.test(t) ? e.setAttribute(ht(t, "-"), s) : e.setAttribute(t, s));
785
785
  }
786
- function Xe(e, t) {
786
+ function qe(e, t) {
787
787
  for (let [s, o] of Object.entries(t))
788
788
  s = Ze.get(s) ?? s, Z(o) ? nt(o, (r) => Yt(e, s, r.newValue, r.prevValue), {
789
789
  lifecycleNode: e
790
- }) : ke(o) ? o[oe](e, s) : Yt(e, s, o);
790
+ }) : Ce(o) ? o[oe](e, s) : Yt(e, s, o);
791
791
  return e;
792
792
  }
793
- function qe(e) {
793
+ function Xe(e) {
794
794
  this[e] = null;
795
795
  }
796
- function u(e, t) {
796
+ function g(e, t) {
797
797
  let { children: s, ...o } = t || {}, r = o.namespaceURI;
798
- r || (Me.has(e) ? r = De : Ee.has(e) ? r = Ae : r = Ie());
799
- let c;
798
+ r || (Me.has(e) ? r = De : Ee.has(e) ? r = Ae : r = Re());
799
+ let l;
800
800
  if (vt(e)) {
801
- if (c = r ? document.createElementNS(r, e) : document.createElement(e), Xe(c, o), ut(c, s), c instanceof window.HTMLSelectElement && o.value != null)
801
+ if (l = r ? document.createElementNS(r, e) : document.createElement(e), qe(l, o), ut(l, s), l instanceof window.HTMLSelectElement && o.value != null)
802
802
  if (o.multiple === !0 && Array.isArray(o.value)) {
803
- const g = o.value.map((f) => String(f));
804
- c.querySelectorAll("option").forEach((f) => f.selected = g.includes(f.value));
803
+ const d = o.value.map((p) => String(p));
804
+ l.querySelectorAll("option").forEach((p) => p.selected = d.includes(p.value));
805
805
  } else
806
- c.value = o.value;
807
- Ft(o.ref, c);
806
+ l.value = o.value;
807
+ Ft(o.ref, l);
808
808
  } else if (typeof e == "function")
809
- z(e.defaultProps) && (o = { ...e.defaultProps, ...o }), c = Pe(e) ? Te(e, o, s) : e({ ...o, children: s });
809
+ z(e.defaultProps) && (o = { ...e.defaultProps, ...o }), l = Se(e) ? Te(e, o, s) : e({ ...o, children: s });
810
810
  else
811
811
  throw new TypeError(`Invalid JSX element type: ${e}`);
812
- return c;
812
+ return l;
813
813
  }
814
814
  var Ye = /* @__PURE__ */ Symbol.for("preact-signals");
815
815
  function $t() {
@@ -836,41 +836,41 @@ function $t() {
836
836
  if (gt = 0, V--, t) throw e;
837
837
  }
838
838
  }
839
- var x = void 0;
839
+ var P = void 0;
840
840
  function le(e) {
841
- var t = x;
842
- x = void 0;
841
+ var t = P;
842
+ P = void 0;
843
843
  try {
844
844
  return e();
845
845
  } finally {
846
- x = t;
846
+ P = t;
847
847
  }
848
848
  }
849
849
  var et = void 0, V = 0, gt = 0, Qt = 0, pt = void 0, ft = 0;
850
850
  function ce(e) {
851
- if (x !== void 0) {
851
+ if (P !== void 0) {
852
852
  var t = e.n;
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;
853
+ if (t === void 0 || t.t !== P)
854
+ return t = { i: 0, S: e, p: P.s, n: void 0, t: P, e: void 0, x: void 0, r: t }, P.s !== void 0 && (P.s.n = t), P.s = t, e.n = t, 32 & P.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 = x.s, t.n = void 0, x.s.n = t, x.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 = P.s, t.n = void 0, P.s.n = t, P.s = t), t;
857
857
  }
858
858
  }
859
- function R(e, t) {
859
+ function L(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
- R.prototype.brand = Ye;
863
- R.prototype.h = function() {
862
+ L.prototype.brand = Ye;
863
+ L.prototype.h = function() {
864
864
  return !0;
865
865
  };
866
- R.prototype.S = function(e) {
866
+ L.prototype.S = function(e) {
867
867
  var t = this, s = this.t;
868
868
  s !== e && e.e === void 0 && (e.x = s, this.t = e, s !== void 0 ? s.e = e : le(function() {
869
869
  var o;
870
870
  (o = t.W) == null || o.call(t);
871
871
  }));
872
872
  };
873
- R.prototype.U = function(e) {
873
+ L.prototype.U = function(e) {
874
874
  var t = this;
875
875
  if (this.t !== void 0) {
876
876
  var s = e.e, o = e.x;
@@ -880,37 +880,37 @@ R.prototype.U = function(e) {
880
880
  }));
881
881
  }
882
882
  };
883
- R.prototype.subscribe = function(e) {
883
+ L.prototype.subscribe = function(e) {
884
884
  var t = this;
885
885
  return Ke(function() {
886
- var s = t.value, o = x;
887
- x = void 0;
886
+ var s = t.value, o = P;
887
+ P = void 0;
888
888
  try {
889
889
  e(s);
890
890
  } finally {
891
- x = o;
891
+ P = o;
892
892
  }
893
893
  }, { name: "sub" });
894
894
  };
895
- R.prototype.valueOf = function() {
895
+ L.prototype.valueOf = function() {
896
896
  return this.value;
897
897
  };
898
- R.prototype.toString = function() {
898
+ L.prototype.toString = function() {
899
899
  return this.value + "";
900
900
  };
901
- R.prototype.toJSON = function() {
901
+ L.prototype.toJSON = function() {
902
902
  return this.value;
903
903
  };
904
- R.prototype.peek = function() {
905
- var e = x;
906
- x = void 0;
904
+ L.prototype.peek = function() {
905
+ var e = P;
906
+ P = void 0;
907
907
  try {
908
908
  return this.value;
909
909
  } finally {
910
- x = e;
910
+ P = e;
911
911
  }
912
912
  };
913
- Object.defineProperty(R.prototype, "value", { get: function() {
913
+ Object.defineProperty(L.prototype, "value", { get: function() {
914
914
  var e = ce(this);
915
915
  return e !== void 0 && (e.i = this.i), this.v;
916
916
  }, set: function(e) {
@@ -947,33 +947,33 @@ function ge(e) {
947
947
  e.s = s;
948
948
  }
949
949
  function Y(e, t) {
950
- R.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
+ 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;
951
951
  }
952
- Y.prototype = new R();
952
+ Y.prototype = new L();
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
956
  if (this.g = ft, this.f |= 1, this.i > 0 && !de(this))
957
957
  return this.f &= -2, !0;
958
- var e = x;
958
+ var e = P;
959
959
  try {
960
- ue(this), x = this;
960
+ ue(this), P = 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
963
  } catch (s) {
964
964
  this.v = s, this.f |= 16, this.i++;
965
965
  }
966
- return x = e, ge(this), this.f &= -2, !0;
966
+ return P = e, ge(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
- R.prototype.S.call(this, e);
973
+ L.prototype.S.call(this, e);
974
974
  };
975
975
  Y.prototype.U = function(e) {
976
- if (this.t !== void 0 && (R.prototype.U.call(this, e), this.t === void 0)) {
976
+ if (this.t !== void 0 && (L.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
  }
@@ -994,24 +994,24 @@ function pe(e) {
994
994
  var t = e.m;
995
995
  if (e.m = void 0, typeof t == "function") {
996
996
  V++;
997
- var s = x;
998
- x = void 0;
997
+ var s = P;
998
+ P = void 0;
999
999
  try {
1000
1000
  t();
1001
1001
  } catch (o) {
1002
- throw e.f &= -2, e.f |= 8, Nt(e), o;
1002
+ throw e.f &= -2, e.f |= 8, Ht(e), o;
1003
1003
  } finally {
1004
- x = s, $t();
1004
+ P = s, $t();
1005
1005
  }
1006
1006
  }
1007
1007
  }
1008
- function Nt(e) {
1008
+ function Ht(e) {
1009
1009
  for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
1010
1010
  e.x = void 0, e.s = void 0, pe(e);
1011
1011
  }
1012
1012
  function Qe(e) {
1013
- if (x !== this) throw new Error("Out-of-order effect");
1014
- ge(this), x = e, this.f &= -2, 8 & this.f && Nt(this), $t();
1013
+ if (P !== this) throw new Error("Out-of-order effect");
1014
+ ge(this), P = e, this.f &= -2, 8 & this.f && Ht(this), $t();
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;
@@ -1029,14 +1029,14 @@ Q.prototype.c = function() {
1029
1029
  Q.prototype.S = function() {
1030
1030
  if (1 & this.f) throw new Error("Cycle detected");
1031
1031
  this.f |= 1, this.f &= -9, pe(this), ue(this), V++;
1032
- var e = x;
1033
- return x = this, Qe.bind(this, e);
1032
+ var e = P;
1033
+ return P = this, Qe.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 || Nt(this);
1039
+ this.f |= 8, 1 & this.f || Ht(this);
1040
1040
  };
1041
1041
  Q.prototype.dispose = function() {
1042
1042
  this.d();
@@ -1079,135 +1079,135 @@ const Je = {
1079
1079
  downloadCatalog: "Kataloğu İndir",
1080
1080
  play: "Otomatik Oynat",
1081
1081
  pause: "Duraklat"
1082
- }, kt = {
1082
+ }, Ct = {
1083
1083
  en: Je,
1084
1084
  tr: ti
1085
1085
  };
1086
1086
  function ei(e = {}) {
1087
1087
  var r;
1088
- const t = e.locale ?? "en", s = kt[t] ?? kt.en, o = ((r = e.messages) == null ? void 0 : r[t]) ?? {};
1088
+ const t = e.locale ?? "en", s = Ct[t] ?? Ct.en, o = ((r = e.messages) == null ? void 0 : r[t]) ?? {};
1089
1089
  return {
1090
- ...kt.en,
1090
+ ...Ct.en,
1091
1091
  ...s,
1092
1092
  ...o
1093
1093
  };
1094
1094
  }
1095
1095
  function ii(e) {
1096
- const t = m(() => ei({ locale: e.store.locale.value, messages: e.store.messages.value }));
1097
- return /* @__PURE__ */ u("div", { class: "bk-toolbar", role: "toolbar", "aria-label": "Flipbook controls", children: [
1098
- /* @__PURE__ */ u("div", { class: "bk-btn-group", children: [
1099
- /* @__PURE__ */ u(
1096
+ const t = w(() => ei({ locale: e.store.locale.value, messages: e.store.messages.value }));
1097
+ return /* @__PURE__ */ g("div", { class: "bk-toolbar", role: "toolbar", "aria-label": "Flipbook controls", children: [
1098
+ /* @__PURE__ */ g("div", { class: "bk-btn-group", children: [
1099
+ /* @__PURE__ */ g(
1100
1100
  "button",
1101
1101
  {
1102
1102
  type: "button",
1103
- class: m(() => `bk-btn ${e.store.showThumbs.value ? "active" : ""}`),
1103
+ class: w(() => `bk-btn ${e.store.showThumbs.value ? "active" : ""}`),
1104
1104
  onClick: e.onToggleThumbs,
1105
- "aria-label": m(() => t.value.thumbnails || "Thumbnails"),
1106
- "aria-pressed": m(() => e.store.showThumbs.value ? "true" : "false"),
1107
- title: m(() => t.value.thumbnails || "Thumbnails"),
1108
- children: /* @__PURE__ */ u("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__ */ u("rect", { x: "3", y: "3", width: "7", height: "7" }),
1110
- /* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7" }),
1111
- /* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7" }),
1112
- /* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7" })
1105
+ "aria-label": w(() => t.value.thumbnails || "Thumbnails"),
1106
+ "aria-pressed": w(() => e.store.showThumbs.value ? "true" : "false"),
1107
+ title: w(() => t.value.thumbnails || "Thumbnails"),
1108
+ 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: [
1109
+ /* @__PURE__ */ g("rect", { x: "3", y: "3", width: "7", height: "7" }),
1110
+ /* @__PURE__ */ g("rect", { x: "14", y: "3", width: "7", height: "7" }),
1111
+ /* @__PURE__ */ g("rect", { x: "14", y: "14", width: "7", height: "7" }),
1112
+ /* @__PURE__ */ g("rect", { x: "3", y: "14", width: "7", height: "7" })
1113
1113
  ] })
1114
1114
  }
1115
1115
  ),
1116
- /* @__PURE__ */ u(
1116
+ /* @__PURE__ */ g(
1117
1117
  "button",
1118
1118
  {
1119
1119
  type: "button",
1120
- class: m(() => `bk-btn bz-hide-mobile ${e.store.isSingleMode.value ? "active" : ""}`),
1120
+ class: w(() => `bk-btn bz-hide-mobile ${e.store.isSingleMode.value ? "active" : ""}`),
1121
1121
  onClick: e.onToggleSingleMode,
1122
- "aria-label": m(() => t.value.singlePageMode || "Single Page"),
1123
- "aria-pressed": m(() => e.store.isSingleMode.value ? "true" : "false"),
1124
- title: m(() => t.value.singlePageMode || "Single Page"),
1125
- children: /* @__PURE__ */ u("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__ */ u("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1127
- /* @__PURE__ */ u("polyline", { points: "14 2 14 8 20 8" }),
1128
- /* @__PURE__ */ u("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1129
- /* @__PURE__ */ u("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1130
- /* @__PURE__ */ u("polyline", { points: "10 9 9 9 8 9" })
1122
+ "aria-label": w(() => t.value.singlePageMode || "Single Page"),
1123
+ "aria-pressed": w(() => e.store.isSingleMode.value ? "true" : "false"),
1124
+ title: w(() => t.value.singlePageMode || "Single Page"),
1125
+ 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: [
1126
+ /* @__PURE__ */ g("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1127
+ /* @__PURE__ */ g("polyline", { points: "14 2 14 8 20 8" }),
1128
+ /* @__PURE__ */ g("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1129
+ /* @__PURE__ */ g("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1130
+ /* @__PURE__ */ g("polyline", { points: "10 9 9 9 8 9" })
1131
1131
  ] })
1132
1132
  }
1133
1133
  ),
1134
- /* @__PURE__ */ u(
1134
+ /* @__PURE__ */ g(
1135
1135
  "button",
1136
1136
  {
1137
1137
  type: "button",
1138
- class: m(() => `bk-btn ${e.store.isAutoPlaying.value ? "active" : ""}`),
1138
+ class: w(() => `bk-btn ${e.store.isAutoPlaying.value ? "active" : ""}`),
1139
1139
  onClick: e.onToggleAutoPlay,
1140
- "aria-label": m(() => e.store.isAutoPlaying.value ? t.value.pause || "Pause" : t.value.play || "Play"),
1141
- "aria-pressed": m(() => e.store.isAutoPlaying.value ? "true" : "false"),
1142
- title: m(() => e.store.isAutoPlaying.value ? t.value.pause || "Pause" : t.value.play || "Play"),
1140
+ "aria-label": w(() => e.store.isAutoPlaying.value ? t.value.pause || "Pause" : t.value.play || "Play"),
1141
+ "aria-pressed": w(() => e.store.isAutoPlaying.value ? "true" : "false"),
1142
+ title: w(() => e.store.isAutoPlaying.value ? t.value.pause || "Pause" : t.value.play || "Play"),
1143
1143
  children: [
1144
- /* @__PURE__ */ u("svg", { style: { display: m(() => 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__ */ u("rect", { x: "6", y: "4", width: "4", height: "16" }),
1146
- /* @__PURE__ */ u("rect", { x: "14", y: "4", width: "4", height: "16" })
1144
+ /* @__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: [
1145
+ /* @__PURE__ */ g("rect", { x: "6", y: "4", width: "4", height: "16" }),
1146
+ /* @__PURE__ */ g("rect", { x: "14", y: "4", width: "4", height: "16" })
1147
1147
  ] }),
1148
- /* @__PURE__ */ u("svg", { style: { display: m(() => 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__ */ u("polygon", { points: "5 3 19 12 5 21 5 3" }) })
1148
+ /* @__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
1149
  ]
1150
1150
  }
1151
1151
  )
1152
1152
  ] }),
1153
- /* @__PURE__ */ u("div", { class: "bk-btn-group bk-btn-group--center", children: [
1154
- /* @__PURE__ */ u("button", { type: "button", class: "bk-btn", onClick: e.onPrevPage, "aria-label": m(() => t.value.previous || "Previous"), title: m(() => t.value.previous || "Previous"), children: /* @__PURE__ */ u("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__ */ u("polyline", { points: "15 18 9 12 15 6" }) }) }),
1155
- /* @__PURE__ */ u("span", { class: "bz-page-info", "aria-live": "polite", "aria-atomic": "true", children: m(() => {
1153
+ /* @__PURE__ */ g("div", { class: "bk-btn-group bk-btn-group--center", children: [
1154
+ /* @__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" }) }) }),
1155
+ /* @__PURE__ */ g("span", { class: "bz-page-info", "aria-live": "polite", "aria-atomic": "true", children: w(() => {
1156
1156
  const s = e.store.currentPage.value, o = e.store.totalPages.value;
1157
1157
  if (e.store.isSingleMode.value || s === 0 || s >= o - 1)
1158
1158
  return `${s + 1} / ${o}`;
1159
1159
  const r = s % 2 === 1 ? s : s - 1;
1160
1160
  return `${r + 1}-${r + 2} / ${o}`;
1161
1161
  }) }),
1162
- /* @__PURE__ */ u("button", { type: "button", class: "bk-btn", onClick: e.onNextPage, "aria-label": m(() => t.value.next || "Next"), title: m(() => t.value.next || "Next"), children: /* @__PURE__ */ u("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__ */ u("polyline", { points: "9 18 15 12 9 6" }) }) })
1162
+ /* @__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
1163
  ] }),
1164
- /* @__PURE__ */ u("div", { class: "bk-btn-group", children: [
1165
- /* @__PURE__ */ u("button", { type: "button", class: "bk-btn", onClick: e.onZoomIn, "aria-label": m(() => t.value.zoomIn || "Zoom In"), title: m(() => t.value.zoomIn || "Zoom In"), children: /* @__PURE__ */ u("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__ */ u("circle", { cx: "11", cy: "11", r: "8" }),
1167
- /* @__PURE__ */ u("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1168
- /* @__PURE__ */ u("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
1169
- /* @__PURE__ */ u("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1164
+ /* @__PURE__ */ g("div", { class: "bk-btn-group", children: [
1165
+ /* @__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: [
1166
+ /* @__PURE__ */ g("circle", { cx: "11", cy: "11", r: "8" }),
1167
+ /* @__PURE__ */ g("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1168
+ /* @__PURE__ */ g("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
1169
+ /* @__PURE__ */ g("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1170
1170
  ] }) }),
1171
- /* @__PURE__ */ u(
1171
+ /* @__PURE__ */ g(
1172
1172
  "button",
1173
1173
  {
1174
1174
  type: "button",
1175
- class: m(() => `bk-btn ${e.store.isZoomed.value ? "active" : ""}`),
1175
+ class: w(() => `bk-btn ${e.store.isZoomed.value ? "active" : ""}`),
1176
1176
  onClick: e.onZoomOut,
1177
- "aria-label": m(() => t.value.zoomOut || "Zoom Out"),
1178
- title: m(() => t.value.zoomOut || "Zoom Out"),
1179
- children: /* @__PURE__ */ u("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__ */ u("circle", { cx: "11", cy: "11", r: "8" }),
1181
- /* @__PURE__ */ u("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1182
- /* @__PURE__ */ u("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1177
+ "aria-label": w(() => t.value.zoomOut || "Zoom Out"),
1178
+ title: w(() => t.value.zoomOut || "Zoom Out"),
1179
+ 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: [
1180
+ /* @__PURE__ */ g("circle", { cx: "11", cy: "11", r: "8" }),
1181
+ /* @__PURE__ */ g("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
1182
+ /* @__PURE__ */ g("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
1183
1183
  ] })
1184
1184
  }
1185
1185
  ),
1186
- /* @__PURE__ */ u("button", { type: "button", class: "bk-btn bk-btn--fullscreen", onClick: e.onToggleFullscreen, "aria-label": m(() => t.value.fullscreen || "Fullscreen"), title: m(() => t.value.fullscreen || "Fullscreen"), children: /* @__PURE__ */ u("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__ */ u("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
- m(() => e.store.allowDownload.value && e.store.hasDownloadUrl.value && e.onDownload ? /* @__PURE__ */ u("button", { type: "button", class: "bk-btn bk-btn--download", onClick: e.onDownload, "aria-label": m(() => t.value.downloadCatalog || "Download"), title: m(() => t.value.downloadCatalog || "Download"), children: /* @__PURE__ */ u("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__ */ u("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1189
- /* @__PURE__ */ u("polyline", { points: "7 10 12 15 17 10" }),
1190
- /* @__PURE__ */ u("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
1186
+ /* @__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" }) }) }),
1187
+ 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: [
1188
+ /* @__PURE__ */ g("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1189
+ /* @__PURE__ */ g("polyline", { points: "7 10 12 15 17 10" }),
1190
+ /* @__PURE__ */ g("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
1191
1191
  ] }) }) : null),
1192
- /* @__PURE__ */ u(
1192
+ /* @__PURE__ */ g(
1193
1193
  "button",
1194
1194
  {
1195
1195
  type: "button",
1196
- class: m(() => `bk-btn ${e.store.soundEnabled.value ? "" : "muted"}`),
1196
+ class: w(() => `bk-btn ${e.store.soundEnabled.value ? "" : "muted"}`),
1197
1197
  onClick: e.onSoundToggle,
1198
1198
  "aria-label": "Sound",
1199
- "aria-pressed": m(() => e.store.soundEnabled.value ? "true" : "false"),
1199
+ "aria-pressed": w(() => e.store.soundEnabled.value ? "true" : "false"),
1200
1200
  title: "Sound",
1201
1201
  children: [
1202
- /* @__PURE__ */ u("svg", { style: { display: m(() => 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__ */ u("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1204
- /* @__PURE__ */ u("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
1205
- /* @__PURE__ */ u("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
1202
+ /* @__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: [
1203
+ /* @__PURE__ */ g("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1204
+ /* @__PURE__ */ g("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
1205
+ /* @__PURE__ */ g("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
1206
1206
  ] }),
1207
- /* @__PURE__ */ u("svg", { style: { display: m(() => 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__ */ u("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1209
- /* @__PURE__ */ u("line", { x1: "23", y1: "9", x2: "17", y2: "15" }),
1210
- /* @__PURE__ */ u("line", { x1: "17", y1: "9", x2: "23", y2: "15" })
1207
+ /* @__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: [
1208
+ /* @__PURE__ */ g("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1209
+ /* @__PURE__ */ g("line", { x1: "23", y1: "9", x2: "17", y2: "15" }),
1210
+ /* @__PURE__ */ g("line", { x1: "17", y1: "9", x2: "23", y2: "15" })
1211
1211
  ] })
1212
1212
  ]
1213
1213
  }
@@ -1216,30 +1216,31 @@ function ii(e) {
1216
1216
  ] });
1217
1217
  }
1218
1218
  function si(e) {
1219
- return /* @__PURE__ */ u("div", { class: "bk-thumbs", style: m(() => e.store.showThumbs.value ? "display:flex;" : "display:none;"), children: e.store.pages.value.map((t, s) => {
1219
+ return /* @__PURE__ */ g("div", { class: "bk-thumbs", style: w(() => e.store.showThumbs.value ? "display:flex;" : "display:none;"), children: e.store.pages.value.map((t, s) => {
1220
1220
  const o = () => {
1221
1221
  const r = e.store.currentPage.value;
1222
1222
  if (e.store.isSingleMode.value || r === 0 || r >= e.store.pages.value.length - 1)
1223
1223
  return r === s;
1224
- const c = r % 2 === 1 ? r : r - 1;
1225
- return s === c || s === c + 1;
1224
+ const l = r % 2 === 1 ? r : r - 1;
1225
+ return s === l || s === l + 1;
1226
1226
  };
1227
- return /* @__PURE__ */ u(
1227
+ return /* @__PURE__ */ g(
1228
1228
  "div",
1229
1229
  {
1230
- class: m(() => `thumb-item ${o() ? "active" : ""}`),
1230
+ class: w(() => `thumb-item ${o() ? "active" : ""}`),
1231
1231
  role: "button",
1232
1232
  tabindex: "0",
1233
1233
  "aria-label": `Go to page ${s + 1}`,
1234
- "aria-current": m(() => o() ? "page" : void 0),
1234
+ "aria-current": w(() => o() ? "page" : void 0),
1235
1235
  onClick: () => e.onThumbClick(s),
1236
1236
  onKeyDown: (r) => {
1237
1237
  (r.key === "Enter" || r.key === " ") && (r.preventDefault(), e.onThumbClick(s));
1238
1238
  },
1239
1239
  children: [
1240
- /* @__PURE__ */ u("div", { class: "thumb-img-wrapper", children: /* @__PURE__ */ u(
1240
+ /* @__PURE__ */ g("div", { class: "thumb-img-wrapper", children: /* @__PURE__ */ g(
1241
1241
  "img",
1242
1242
  {
1243
+ "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
1243
1244
  class: "thumb-img",
1244
1245
  src: t.thumb || t.low || t.normal,
1245
1246
  alt: `Page ${s + 1}`,
@@ -1249,47 +1250,48 @@ function si(e) {
1249
1250
  }
1250
1251
  }
1251
1252
  ) }),
1252
- /* @__PURE__ */ u("span", { children: s + 1 })
1253
+ /* @__PURE__ */ g("span", { children: s + 1 })
1253
1254
  ]
1254
1255
  }
1255
1256
  );
1256
1257
  }) });
1257
1258
  }
1258
1259
  function ni(e) {
1259
- return /* @__PURE__ */ u(
1260
+ return /* @__PURE__ */ g(
1260
1261
  "div",
1261
1262
  {
1262
1263
  role: "region",
1263
1264
  "aria-label": "Flipbook viewer",
1264
- class: m(() => {
1265
+ class: w(() => {
1265
1266
  let t = "bk-book-wrapper ";
1266
1267
  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();
1267
1268
  }),
1268
1269
  ref: e.bookWrapperRef,
1269
- children: /* @__PURE__ */ u(
1270
+ children: /* @__PURE__ */ g(
1270
1271
  "div",
1271
1272
  {
1272
1273
  class: "bk-book-sizer",
1273
1274
  ref: e.bookSizerRef,
1274
1275
  children: [
1275
- /* @__PURE__ */ u(
1276
+ /* @__PURE__ */ g(
1276
1277
  "div",
1277
1278
  {
1278
1279
  ref: e.bookContainerRef,
1279
- class: m(() => "bk-book " + (e.store.flipState.value !== "read" ? "is-flipping" : "")),
1280
- style: m(() => `display: ${e.store.isSingleMode.value ? "none" : "block"};`),
1280
+ class: w(() => "bk-book " + (e.store.flipState.value !== "read" ? "is-flipping" : "")),
1281
+ style: w(() => `display: ${e.store.isSingleMode.value ? "none" : "block"};`),
1281
1282
  children: e.store.pages.value.map((t, s) => {
1282
1283
  const o = s === 0 || s === e.store.pages.value.length - 1;
1283
- return /* @__PURE__ */ u(
1284
+ return /* @__PURE__ */ g(
1284
1285
  "div",
1285
1286
  {
1286
1287
  class: `bz-page ${s === 0 ? "bz-page--cover" : ""} ${s === e.store.pages.value.length - 1 ? "bz-page--back" : ""}`,
1287
1288
  "data-density": o ? "hard" : "soft",
1288
1289
  "data-idx": s,
1289
- children: /* @__PURE__ */ u("div", { class: "bz-page-content", style: "position:relative; width:100%; height:100%; overflow:hidden;", children: [
1290
- /* @__PURE__ */ u(
1290
+ children: /* @__PURE__ */ g("div", { class: "bz-page-content", style: "position:relative; width:100%; height:100%; overflow:hidden;", children: [
1291
+ /* @__PURE__ */ g(
1291
1292
  "img",
1292
1293
  {
1294
+ "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
1293
1295
  src: t.low || t.normal,
1294
1296
  "data-src": t.normal,
1295
1297
  class: `page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
@@ -1297,23 +1299,24 @@ function ni(e) {
1297
1299
  loading: "lazy"
1298
1300
  }
1299
1301
  ),
1300
- /* @__PURE__ */ u("div", { class: "page-shadow" })
1302
+ /* @__PURE__ */ g("div", { class: "page-shadow" })
1301
1303
  ] })
1302
1304
  }
1303
1305
  );
1304
1306
  })
1305
1307
  }
1306
1308
  ),
1307
- /* @__PURE__ */ u(
1309
+ /* @__PURE__ */ g(
1308
1310
  "div",
1309
1311
  {
1310
1312
  class: "bk-single-view",
1311
- style: m(() => `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;`),
1312
- children: m(() => {
1313
+ 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
+ children: w(() => {
1313
1315
  const t = e.store.pages.value[e.store.currentPage.value];
1314
- return t ? /* @__PURE__ */ u(
1316
+ return t ? /* @__PURE__ */ g(
1315
1317
  "img",
1316
1318
  {
1319
+ "data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
1317
1320
  class: `bk-single-img page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
1318
1321
  src: e.store.zoomState.value.isActive ? t.normal : t.low || t.normal,
1319
1322
  alt: `Page ${e.store.currentPage.value + 1}`,
@@ -1330,32 +1333,32 @@ function ni(e) {
1330
1333
  );
1331
1334
  }
1332
1335
  function oi(e) {
1333
- const t = m(() => e.store.showArrows.value && e.store.currentPage.value > 0), s = m(() => !e.store.showArrows.value || e.store.totalPages.value <= 1 ? !1 : e.store.currentPage.value < e.store.totalPages.value - 1);
1334
- return /* @__PURE__ */ u("div", { class: "bk-nav-arrows", style: m(() => e.store.showArrows.value ? "display: flex;" : "display: none;"), children: [
1335
- /* @__PURE__ */ u(
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__ */ g("div", { class: "bk-nav-arrows", style: w(() => e.store.showArrows.value ? "display: flex;" : "display: none;"), children: [
1338
+ /* @__PURE__ */ g(
1336
1339
  "button",
1337
1340
  {
1338
1341
  type: "button",
1339
1342
  class: "bk-nav-arrow bk-nav-prev",
1340
- style: m(() => t.value ? "visibility: visible;" : "visibility: hidden;"),
1343
+ style: w(() => t.value ? "visibility: visible;" : "visibility: hidden;"),
1341
1344
  onClick: (o) => {
1342
1345
  o.preventDefault(), e.onPrevPage();
1343
1346
  },
1344
1347
  "aria-label": "Previous Page",
1345
- children: /* @__PURE__ */ u("div", { class: "bk-arrow-icon bk-arrow-left" })
1348
+ children: /* @__PURE__ */ g("div", { class: "bk-arrow-icon bk-arrow-left" })
1346
1349
  }
1347
1350
  ),
1348
- /* @__PURE__ */ u(
1351
+ /* @__PURE__ */ g(
1349
1352
  "button",
1350
1353
  {
1351
1354
  type: "button",
1352
1355
  class: "bk-nav-arrow bk-nav-next",
1353
- style: m(() => s.value ? "visibility: visible;" : "visibility: hidden;"),
1356
+ style: w(() => s.value ? "visibility: visible;" : "visibility: hidden;"),
1354
1357
  onClick: (o) => {
1355
1358
  o.preventDefault(), e.onNextPage();
1356
1359
  },
1357
1360
  "aria-label": "Next Page",
1358
- children: /* @__PURE__ */ u("div", { class: "bk-arrow-icon bk-arrow-right" })
1361
+ children: /* @__PURE__ */ g("div", { class: "bk-arrow-icon bk-arrow-right" })
1359
1362
  }
1360
1363
  )
1361
1364
  ] });
@@ -1370,26 +1373,26 @@ function ri(e) {
1370
1373
  }, r = () => {
1371
1374
  var b;
1372
1375
  (b = e.interactionManagerRef.current) == null || b.zoomIn();
1373
- }, c = () => {
1376
+ }, l = () => {
1374
1377
  var b;
1375
1378
  (b = e.interactionManagerRef.current) == null || b.zoomOut();
1376
- }, g = () => e.onToggleFullscreen(), f = (b) => {
1377
- var L;
1378
- e.store.currentPage.value !== b && (e.store.currentPage.value = b, (L = e.pageFlipAdapterRef.current) == null || L.playSound());
1379
- }, P = () => {
1379
+ }, d = () => e.onToggleFullscreen(), p = (b) => {
1380
+ var D;
1381
+ e.store.currentPage.value !== b && (e.store.currentPage.value = b, (D = e.pageFlipAdapterRef.current) == null || D.playSound());
1382
+ }, x = () => {
1380
1383
  var b;
1381
1384
  (b = e.pageFlipAdapterRef.current) == null || b.turnToNextPage();
1382
1385
  }, S = () => {
1383
1386
  var b;
1384
1387
  (b = e.pageFlipAdapterRef.current) == null || b.turnToPrevPage();
1385
1388
  };
1386
- return /* @__PURE__ */ u(
1389
+ return /* @__PURE__ */ g(
1387
1390
  "div",
1388
1391
  {
1389
- class: m(() => `bk-wrapper bk-theme-${e.store.themeMode.value} ${e.className || ""}`),
1392
+ class: w(() => `bk-wrapper bk-theme-${e.store.themeMode.value} ${e.className || ""}`),
1390
1393
  children: [
1391
- /* @__PURE__ */ u("div", { class: "bk-main-area", children: [
1392
- /* @__PURE__ */ u(
1394
+ /* @__PURE__ */ g("div", { class: "bk-main-area", children: [
1395
+ /* @__PURE__ */ g(
1393
1396
  ni,
1394
1397
  {
1395
1398
  store: e.store,
@@ -1398,40 +1401,40 @@ function ri(e) {
1398
1401
  bookContainerRef: e.bookContainerRef
1399
1402
  }
1400
1403
  ),
1401
- /* @__PURE__ */ u(
1404
+ /* @__PURE__ */ g(
1402
1405
  oi,
1403
1406
  {
1404
1407
  store: e.store,
1405
1408
  onPrevPage: S,
1406
- onNextPage: P
1409
+ onNextPage: x
1407
1410
  }
1408
1411
  ),
1409
- e.store.whiteLabel.value ? null : /* @__PURE__ */ u("div", { class: "bk-watermark", children: [
1412
+ e.store.whiteLabel.value ? null : /* @__PURE__ */ g("div", { class: "bk-watermark", children: [
1410
1413
  "Powered by ",
1411
- /* @__PURE__ */ u("a", { href: "https://flipbookengine.com", target: "_blank", rel: "noopener", style: "text-decoration: underline;", children: "FlipbookEngine" })
1414
+ /* @__PURE__ */ g("a", { href: "https://flipbookengine.com", target: "_blank", rel: "noopener", style: "text-decoration: underline;", children: "FlipbookEngine" })
1412
1415
  ] })
1413
1416
  ] }),
1414
- /* @__PURE__ */ u(
1417
+ /* @__PURE__ */ g(
1415
1418
  ii,
1416
1419
  {
1417
1420
  store: e.store,
1418
1421
  onToggleThumbs: t,
1419
1422
  onToggleSingleMode: s,
1420
1423
  onZoomIn: r,
1421
- onZoomOut: c,
1424
+ onZoomOut: l,
1422
1425
  onDownload: e.onDownload,
1423
- onNextPage: P,
1426
+ onNextPage: x,
1424
1427
  onPrevPage: S,
1425
1428
  onSoundToggle: () => e.store.soundEnabled.value = !e.store.soundEnabled.value,
1426
1429
  onToggleAutoPlay: o,
1427
- onToggleFullscreen: g
1430
+ onToggleFullscreen: d
1428
1431
  }
1429
1432
  ),
1430
- /* @__PURE__ */ u(
1433
+ /* @__PURE__ */ g(
1431
1434
  si,
1432
1435
  {
1433
1436
  store: e.store,
1434
- onThumbClick: f
1437
+ onThumbClick: p
1435
1438
  }
1436
1439
  )
1437
1440
  ]
@@ -1486,18 +1489,18 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1486
1489
  super(i, a), this.image = null, this.isLoad = !1, this.loadingAngle = 0, this.image = new Image(), this.image.src = n;
1487
1490
  }
1488
1491
  draw(i) {
1489
- const n = this.render.getContext(), a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, h = this.render.getRect().height;
1492
+ const n = this.render.getContext(), a = this.render.convertToGlobal(this.state.position), c = this.render.getRect().pageWidth, h = this.render.getRect().height;
1490
1493
  n.save(), n.translate(a.x, a.y), n.beginPath();
1491
- for (let d of this.state.area) d !== null && (d = this.render.convertToGlobal(d), n.lineTo(d.x - a.x, d.y - a.y));
1492
- n.rotate(this.state.angle), n.clip(), this.isLoad ? n.drawImage(this.image, 0, 0, l, h) : this.drawLoader(n, { x: 0, y: 0 }, l, h), n.restore();
1494
+ for (let u of this.state.area) u !== null && (u = this.render.convertToGlobal(u), n.lineTo(u.x - a.x, u.y - a.y));
1495
+ n.rotate(this.state.angle), n.clip(), this.isLoad ? n.drawImage(this.image, 0, 0, c, h) : this.drawLoader(n, { x: 0, y: 0 }, c, h), n.restore();
1493
1496
  }
1494
1497
  simpleDraw(i) {
1495
- const n = this.render.getRect(), a = this.render.getContext(), l = n.pageWidth, h = n.height, d = i === 1 ? n.left + n.pageWidth : n.left, w = n.top;
1496
- this.isLoad ? a.drawImage(this.image, d, w, l, h) : this.drawLoader(a, { x: d, y: w }, l, h);
1498
+ const n = this.render.getRect(), a = this.render.getContext(), c = n.pageWidth, h = n.height, u = i === 1 ? n.left + n.pageWidth : n.left, v = n.top;
1499
+ this.isLoad ? a.drawImage(this.image, u, v, c, h) : this.drawLoader(a, { x: u, y: v }, c, h);
1497
1500
  }
1498
- drawLoader(i, n, a, l) {
1499
- 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();
1500
- const h = { x: n.x + a / 2, y: n.y + l / 2 };
1501
+ drawLoader(i, n, a, c) {
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, c - 1), i.stroke(), i.fill();
1503
+ const h = { x: n.x + a / 2, y: n.y + c / 2 };
1501
1504
  i.beginPath(), i.lineWidth = 10, i.arc(h.x, h.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);
1502
1505
  }
1503
1506
  load() {
@@ -1514,7 +1517,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1514
1517
  hideTemporaryCopy() {
1515
1518
  }
1516
1519
  }
1517
- class c {
1520
+ class l {
1518
1521
  constructor(i, n) {
1519
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;
1520
1523
  }
@@ -1596,7 +1599,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1596
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);
1597
1600
  }
1598
1601
  }
1599
- class g extends c {
1602
+ class d extends l {
1600
1603
  constructor(i, n, a) {
1601
1604
  super(i, n), this.imagesHref = a;
1602
1605
  }
@@ -1608,16 +1611,16 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1608
1611
  this.createSpread();
1609
1612
  }
1610
1613
  }
1611
- class f {
1614
+ class p {
1612
1615
  static GetDistanceBetweenTwoPoint(i, n) {
1613
1616
  return i === null || n === null ? 1 / 0 : Math.sqrt(Math.pow(n.x - i.x, 2) + Math.pow(n.y - i.y, 2));
1614
1617
  }
1615
1618
  static GetSegmentLength(i) {
1616
- return f.GetDistanceBetweenTwoPoint(i[0], i[1]);
1619
+ return p.GetDistanceBetweenTwoPoint(i[0], i[1]);
1617
1620
  }
1618
1621
  static GetAngleBetweenTwoLine(i, n) {
1619
- const a = i[0].y - i[1].y, l = n[0].y - n[1].y, h = i[1].x - i[0].x, d = n[1].x - n[0].x;
1620
- return Math.acos((a * l + h * d) / (Math.sqrt(a * a + h * h) * Math.sqrt(l * l + d * d)));
1622
+ const a = i[0].y - i[1].y, c = n[0].y - n[1].y, h = i[1].x - i[0].x, u = n[1].x - n[0].x;
1623
+ return Math.acos((a * c + h * u) / (Math.sqrt(a * a + h * h) * Math.sqrt(c * c + u * u)));
1621
1624
  }
1622
1625
  static PointInRect(i, n) {
1623
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;
@@ -1626,37 +1629,37 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1626
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 };
1627
1630
  }
1628
1631
  static LimitPointToCircle(i, n, a) {
1629
- if (f.GetDistanceBetweenTwoPoint(i, a) <= n) return a;
1630
- const l = i.x, h = i.y, d = a.x, w = a.y;
1631
- let y = Math.sqrt(Math.pow(n, 2) * Math.pow(l - d, 2) / (Math.pow(l - d, 2) + Math.pow(h - w, 2))) + l;
1632
+ if (p.GetDistanceBetweenTwoPoint(i, a) <= n) return a;
1633
+ const c = i.x, h = i.y, u = a.x, v = a.y;
1634
+ let y = Math.sqrt(Math.pow(n, 2) * Math.pow(c - u, 2) / (Math.pow(c - u, 2) + Math.pow(h - v, 2))) + c;
1632
1635
  a.x < 0 && (y *= -1);
1633
- let E = (y - l) * (h - w) / (l - d) + h;
1634
- return l - d + h === 0 && (E = n), { x: y, y: E };
1636
+ let E = (y - c) * (h - v) / (c - u) + h;
1637
+ return c - u + h === 0 && (E = n), { x: y, y: E };
1635
1638
  }
1636
1639
  static GetIntersectBetweenTwoSegment(i, n, a) {
1637
- return f.PointInRect(i, f.GetIntersectBeetwenTwoLine(n, a));
1640
+ return p.PointInRect(i, p.GetIntersectBeetwenTwoLine(n, a));
1638
1641
  }
1639
1642
  static GetIntersectBeetwenTwoLine(i, n) {
1640
- const a = i[0].y - i[1].y, l = n[0].y - n[1].y, h = i[1].x - i[0].x, d = n[1].x - n[0].x, w = 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, E = a * y - l * w, D = h * y - d * w, W = -(w * d - y * h) / (a * d - l * h), K = -(a * y - l * w) / (a * d - l * h);
1643
+ const a = i[0].y - i[1].y, c = n[0].y - n[1].y, h = i[1].x - i[0].x, u = 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, E = a * y - c * v, R = h * y - u * v, W = -(v * u - y * h) / (a * u - c * h), K = -(a * y - c * v) / (a * u - c * h);
1641
1644
  if (isFinite(W) && isFinite(K)) return { x: W, y: K };
1642
- if (Math.abs(E - D) < 0.1) throw new Error("Segment included");
1645
+ if (Math.abs(E - R) < 0.1) throw new Error("Segment included");
1643
1646
  return null;
1644
1647
  }
1645
1648
  static GetCordsFromTwoPoint(i, n) {
1646
- const a = Math.abs(i.x - n.x), l = Math.abs(i.y - n.y), h = Math.max(a, l), d = [i];
1647
- function w(y, E, D, W, K) {
1648
- return E > y ? y + K * (D / W) : E < y ? y - K * (D / W) : y;
1649
+ const a = Math.abs(i.x - n.x), c = Math.abs(i.y - n.y), h = Math.max(a, c), u = [i];
1650
+ function v(y, E, R, W, K) {
1651
+ return E > y ? y + K * (R / W) : E < y ? y - K * (R / W) : y;
1649
1652
  }
1650
- for (let y = 1; y <= h; y += 1) d.push({ x: w(i.x, n.x, a, h, y), y: w(i.y, n.y, l, h, y) });
1651
- return d;
1653
+ for (let y = 1; y <= h; y += 1) u.push({ x: v(i.x, n.x, a, h, y), y: v(i.y, n.y, c, h, y) });
1654
+ return u;
1652
1655
  }
1653
1656
  }
1654
- class P extends o {
1657
+ class x extends o {
1655
1658
  constructor(i, n, a) {
1656
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);
1657
1660
  }
1658
1661
  newTemporaryCopy() {
1659
- return this.nowDrawingDensity === "hard" ? this : (this.temporaryCopy === null && (this.copiedElement = this.element.cloneNode(!0), this.element.parentElement.appendChild(this.copiedElement), this.temporaryCopy = new P(this.render, this.copiedElement, this.nowDrawingDensity)), this.getTemporaryCopy());
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());
1660
1663
  }
1661
1664
  getTemporaryCopy() {
1662
1665
  return this.temporaryCopy;
@@ -1665,20 +1668,20 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1665
1668
  this.temporaryCopy !== null && (this.copiedElement.remove(), this.copiedElement = null, this.temporaryCopy = null);
1666
1669
  }
1667
1670
  draw(i) {
1668
- const n = i || this.nowDrawingDensity, a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, h = this.render.getRect().height;
1671
+ const n = i || this.nowDrawingDensity, a = this.render.convertToGlobal(this.state.position), c = this.render.getRect().pageWidth, h = this.render.getRect().height;
1669
1672
  this.element.classList.remove("--simple");
1670
- const d = `
1673
+ const u = `
1671
1674
  display: block;
1672
1675
  z-index: ${this.element.style.zIndex};
1673
1676
  left: 0;
1674
1677
  top: 0;
1675
- width: ${l}px;
1678
+ width: ${c}px;
1676
1679
  height: ${h}px;
1677
1680
  `;
1678
- n === "hard" ? this.drawHard(d) : this.drawSoft(a, d);
1681
+ n === "hard" ? this.drawHard(u) : this.drawSoft(a, u);
1679
1682
  }
1680
1683
  drawHard(i = "") {
1681
- const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, l = i + `
1684
+ const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, c = i + `
1682
1685
  backface-visibility: hidden;
1683
1686
  -webkit-backface-visibility: hidden;
1684
1687
  clip-path: none;
@@ -1686,26 +1689,26 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1686
1689
  ` + (this.orientation === 0 ? `transform-origin: ${this.render.getRect().pageWidth}px 0;
1687
1690
  transform: translate3d(0, 0, 0) rotateY(${a}deg);` : `transform-origin: 0 0;
1688
1691
  transform: translate3d(${n}px, 0, 0) rotateY(${a}deg);`);
1689
- this.element.style.cssText = l;
1692
+ this.element.style.cssText = c;
1690
1693
  }
1691
1694
  drawSoft(i, n = "") {
1692
1695
  let a = "polygon( ";
1693
1696
  for (const h of this.state.area) if (h !== null) {
1694
- let d = this.render.getDirection() === 1 ? { x: -h.x + this.state.position.x, y: h.y - this.state.position.y } : { x: h.x - this.state.position.x, y: h.y - this.state.position.y };
1695
- d = f.GetRotatedPoint(d, { x: 0, y: 0 }, this.state.angle), a += d.x + "px " + d.y + "px, ";
1697
+ let u = this.render.getDirection() === 1 ? { x: -h.x + this.state.position.x, y: h.y - this.state.position.y } : { x: h.x - this.state.position.x, y: h.y - this.state.position.y };
1698
+ u = p.GetRotatedPoint(u, { x: 0, y: 0 }, this.state.angle), a += u.x + "px " + u.y + "px, ";
1696
1699
  }
1697
1700
  a = a.slice(0, -2), a += ")";
1698
- 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);`);
1699
- this.element.style.cssText = l;
1701
+ const c = 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);`);
1702
+ this.element.style.cssText = c;
1700
1703
  }
1701
1704
  simpleDraw(i) {
1702
- const n = this.render.getRect(), a = n.pageWidth, l = n.height, h = i === 1 ? n.left + n.pageWidth : n.left, d = n.top;
1705
+ const n = this.render.getRect(), a = n.pageWidth, c = n.height, h = i === 1 ? n.left + n.pageWidth : n.left, u = n.top;
1703
1706
  this.element.classList.add("--simple"), this.element.style.cssText = `
1704
1707
  position: absolute;
1705
1708
  display: block;
1706
- height: ${l}px;
1709
+ height: ${c}px;
1707
1710
  left: ${h}px;
1708
- top: ${d}px;
1711
+ top: ${u}px;
1709
1712
  width: ${a}px;
1710
1713
  z-index: ${this.render.getSettings().startZIndex + 1};`;
1711
1714
  }
@@ -1722,21 +1725,21 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1722
1725
  this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" + i), super.setDrawingDensity(i);
1723
1726
  }
1724
1727
  }
1725
- class S extends c {
1726
- constructor(i, n, a, l) {
1727
- super(i, n), this.element = a, this.pagesElement = l;
1728
+ class S extends l {
1729
+ constructor(i, n, a, c) {
1730
+ super(i, n), this.element = a, this.pagesElement = c;
1728
1731
  }
1729
1732
  load() {
1730
1733
  for (const i of this.pagesElement) {
1731
- const n = new P(this.render, i, i.dataset.density === "hard" ? "hard" : "soft");
1734
+ const n = new x(this.render, i, i.dataset.density === "hard" ? "hard" : "soft");
1732
1735
  n.load(), this.pages.push(n);
1733
1736
  }
1734
1737
  this.createSpread();
1735
1738
  }
1736
1739
  }
1737
1740
  class b {
1738
- constructor(i, n, a, l) {
1739
- 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);
1741
+ constructor(i, n, a, c) {
1742
+ this.direction = i, this.corner = n, this.topIntersectPoint = null, this.sideIntersectPoint = null, this.bottomIntersectPoint = null, this.pageWidth = parseInt(a, 10), this.pageHeight = parseInt(c, 10);
1740
1743
  }
1741
1744
  calc(i) {
1742
1745
  try {
@@ -1752,7 +1755,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1752
1755
  }
1753
1756
  getBottomClipArea() {
1754
1757
  const i = [];
1755
- 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 ? f.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;
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 ? p.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;
1756
1759
  }
1757
1760
  getAngle() {
1758
1761
  return this.direction === 0 ? -this.angle : this.angle;
@@ -1782,7 +1785,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1782
1785
  return this.corner === "top" ? this.topIntersectPoint : this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.topIntersectPoint;
1783
1786
  }
1784
1787
  getShadowAngle() {
1785
- const i = f.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
1788
+ const i = p.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
1786
1789
  return this.direction === 0 ? i : Math.PI - i;
1787
1790
  }
1788
1791
  calcAngleAndPosition(i) {
@@ -1795,11 +1798,11 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1795
1798
  }
1796
1799
  calculateAngle(i) {
1797
1800
  const n = this.pageWidth - i.x + 1, a = this.corner === "bottom" ? this.pageHeight - i.y : i.y;
1798
- let l = 2 * Math.acos(n / Math.sqrt(a * a + n * n));
1799
- a < 0 && (l = -l);
1800
- const h = Math.PI - l;
1801
- if (!isFinite(l) || h >= 0 && h < 3e-3) throw new Error("The G point is too small");
1802
- return this.corner === "bottom" && (l = -l), l;
1801
+ let c = 2 * Math.acos(n / Math.sqrt(a * a + n * n));
1802
+ a < 0 && (c = -c);
1803
+ const h = Math.PI - c;
1804
+ if (!isFinite(c) || h >= 0 && h < 3e-3) throw new Error("The G point is too small");
1805
+ return this.corner === "bottom" && (c = -c), c;
1803
1806
  }
1804
1807
  getPageRect(i) {
1805
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);
@@ -1812,26 +1815,26 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1812
1815
  }
1813
1816
  calculateIntersectPoint(i) {
1814
1817
  const n = { left: -1, top: -1, width: this.pageWidth + 2, height: this.pageHeight + 2 };
1815
- this.corner === "top" ? (this.topIntersectPoint = f.GetIntersectBetweenTwoSegment(n, [i, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = f.GetIntersectBetweenTwoSegment(n, [i, this.rect.bottomLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = f.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }])) : (this.topIntersectPoint = f.GetIntersectBetweenTwoSegment(n, [this.rect.topLeft, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = f.GetIntersectBetweenTwoSegment(n, [i, this.rect.topLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = f.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }]));
1818
+ this.corner === "top" ? (this.topIntersectPoint = p.GetIntersectBetweenTwoSegment(n, [i, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = p.GetIntersectBetweenTwoSegment(n, [i, this.rect.bottomLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = p.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }])) : (this.topIntersectPoint = p.GetIntersectBetweenTwoSegment(n, [this.rect.topLeft, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = p.GetIntersectBetweenTwoSegment(n, [i, this.rect.topLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = p.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }]));
1816
1819
  }
1817
1820
  checkPositionAtCenterLine(i, n, a) {
1818
- let l = i;
1819
- const h = f.LimitPointToCircle(n, this.pageWidth, l);
1820
- l !== h && (l = h, this.updateAngleAndGeometry(l));
1821
- const d = Math.sqrt(Math.pow(this.pageWidth, 2) + Math.pow(this.pageHeight, 2));
1822
- let w = this.rect.bottomRight, y = this.rect.topLeft;
1823
- if (this.corner === "bottom" && (w = this.rect.topRight, y = this.rect.bottomLeft), w.x <= 0) {
1824
- const E = f.LimitPointToCircle(a, d, y);
1825
- E !== l && (l = E, this.updateAngleAndGeometry(l));
1821
+ let c = i;
1822
+ const h = p.LimitPointToCircle(n, this.pageWidth, c);
1823
+ c !== h && (c = h, this.updateAngleAndGeometry(c));
1824
+ const u = 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 E = p.LimitPointToCircle(a, u, y);
1828
+ E !== c && (c = E, this.updateAngleAndGeometry(c));
1826
1829
  }
1827
- return l;
1830
+ return c;
1828
1831
  }
1829
1832
  getSegmentToShadowLine() {
1830
1833
  const i = this.getShadowStartPoint();
1831
1834
  return [i, i !== this.sideIntersectPoint && this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.bottomIntersectPoint];
1832
1835
  }
1833
1836
  }
1834
- class L {
1837
+ class D {
1835
1838
  constructor(i, n) {
1836
1839
  this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render = i, this.app = n;
1837
1840
  }
@@ -1842,22 +1845,22 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1842
1845
  if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(i) || (this.calc !== null && this.render.finishAnimation(), !this.start(i))) return;
1843
1846
  const n = this.getBoundsRect();
1844
1847
  this.setState("flipping");
1845
- const a = n.height / 10, l = this.calc.getCorner() === "bottom" ? n.height - a : a, h = this.calc.getCorner() === "bottom" ? n.height : 0;
1846
- this.calc.calc({ x: n.pageWidth - a, y: l }), this.animateFlippingTo({ x: n.pageWidth - a, y: l }, { x: -n.pageWidth, y: h }, !0);
1848
+ const a = n.height / 10, c = this.calc.getCorner() === "bottom" ? n.height - a : a, h = this.calc.getCorner() === "bottom" ? n.height : 0;
1849
+ this.calc.calc({ x: n.pageWidth - a, y: c }), this.animateFlippingTo({ x: n.pageWidth - a, y: c }, { x: -n.pageWidth, y: h }, !0);
1847
1850
  }
1848
1851
  start(i) {
1849
1852
  this.reset();
1850
- const n = this.render.convertToBook(i), a = this.getBoundsRect(), l = this.getDirectionByPoint(n), h = n.y >= a.height / 2 ? "bottom" : "top";
1851
- if (!this.checkDirection(l)) return !1;
1853
+ const n = this.render.convertToBook(i), a = this.getBoundsRect(), c = this.getDirectionByPoint(n), h = n.y >= a.height / 2 ? "bottom" : "top";
1854
+ if (!this.checkDirection(c)) return !1;
1852
1855
  try {
1853
- if (this.flippingPage = this.app.getPageCollection().getFlippingPage(l), this.bottomPage = this.app.getPageCollection().getBottomPage(l), this.render.getOrientation() === "landscape") if (l === 1) {
1854
- const d = this.app.getPageCollection().nextBy(this.flippingPage);
1855
- d !== null && this.flippingPage.getDensity() !== d.getDensity() && (this.flippingPage.setDrawingDensity("hard"), d.setDrawingDensity("hard"));
1856
+ if (this.flippingPage = this.app.getPageCollection().getFlippingPage(c), this.bottomPage = this.app.getPageCollection().getBottomPage(c), this.render.getOrientation() === "landscape") if (c === 1) {
1857
+ const u = this.app.getPageCollection().nextBy(this.flippingPage);
1858
+ u !== null && this.flippingPage.getDensity() !== u.getDensity() && (this.flippingPage.setDrawingDensity("hard"), u.setDrawingDensity("hard"));
1856
1859
  } else {
1857
- const d = this.app.getPageCollection().prevBy(this.flippingPage);
1858
- d !== null && this.flippingPage.getDensity() !== d.getDensity() && (this.flippingPage.setDrawingDensity("hard"), d.setDrawingDensity("hard"));
1860
+ const u = this.app.getPageCollection().prevBy(this.flippingPage);
1861
+ u !== null && this.flippingPage.getDensity() !== u.getDensity() && (this.flippingPage.setDrawingDensity("hard"), u.setDrawingDensity("hard"));
1859
1862
  }
1860
- return this.render.setDirection(l), this.calc = new b(l, h, a.pageWidth.toString(10), a.height.toString(10)), !0;
1863
+ return this.render.setDirection(c), this.calc = new b(c, h, a.pageWidth.toString(10), a.height.toString(10)), !0;
1861
1864
  } catch {
1862
1865
  return !1;
1863
1866
  }
@@ -1869,9 +1872,9 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1869
1872
  }
1870
1873
  }
1871
1874
  flipToPage(i, n) {
1872
- const a = this.app.getPageCollection().getCurrentSpreadIndex(), l = this.app.getPageCollection().getSpreadIndexByPage(i);
1875
+ const a = this.app.getPageCollection().getCurrentSpreadIndex(), c = this.app.getPageCollection().getSpreadIndexByPage(i);
1873
1876
  try {
1874
- l > a && (this.app.getPageCollection().setCurrentSpreadIndex(l - 1), this.flipNext(n)), l < a && (this.app.getPageCollection().setCurrentSpreadIndex(l + 1), this.flipPrev(n));
1877
+ c > a && (this.app.getPageCollection().setCurrentSpreadIndex(c - 1), this.flipNext(n)), c < a && (this.app.getPageCollection().setCurrentSpreadIndex(c + 1), this.flipPrev(n));
1875
1878
  } catch {
1876
1879
  }
1877
1880
  }
@@ -1892,17 +1895,17 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1892
1895
  if (this.isPointOnCorners(i)) if (this.calc === null) {
1893
1896
  if (!this.start(i)) return;
1894
1897
  this.setState("fold_corner"), this.calc.calc({ x: a - 1, y: 1 });
1895
- const l = 50, h = this.calc.getCorner() === "bottom" ? n.height - 1 : 1, d = this.calc.getCorner() === "bottom" ? n.height - l : l;
1896
- this.animateFlippingTo({ x: a - 1, y: h }, { x: a - l, y: d }, !1, !1);
1898
+ const c = 50, h = this.calc.getCorner() === "bottom" ? n.height - 1 : 1, u = this.calc.getCorner() === "bottom" ? n.height - c : c;
1899
+ this.animateFlippingTo({ x: a - 1, y: h }, { x: a - c, y: u }, !1, !1);
1897
1900
  } else this.do(this.render.convertToPage(i));
1898
1901
  else this.setState("read"), this.render.finishAnimation(), this.stopMove();
1899
1902
  }
1900
- animateFlippingTo(i, n, a, l = !0) {
1901
- const h = f.GetCordsFromTwoPoint(i, n), d = [];
1902
- for (const y of h) d.push(() => this.do(y));
1903
- const w = this.getAnimationDuration(h.length);
1904
- this.render.startAnimation(d, w, () => {
1905
- 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()));
1903
+ animateFlippingTo(i, n, a, c = !0) {
1904
+ const h = p.GetCordsFromTwoPoint(i, n), u = [];
1905
+ for (const y of h) u.push(() => this.do(y));
1906
+ const v = this.getAnimationDuration(h.length);
1907
+ this.render.startAnimation(u, v, () => {
1908
+ this.calc && (a && (this.calc.getDirection() === 1 ? this.app.turnToPrevPage() : this.app.turnToNextPage()), c && (this.render.setBottomPage(null), this.render.setFlippingPage(null), this.render.clearShadow(), this.setState("read"), this.reset()));
1906
1909
  });
1907
1910
  }
1908
1911
  getCalculation() {
@@ -1939,8 +1942,8 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1939
1942
  return !1;
1940
1943
  }
1941
1944
  isPointOnCorners(i) {
1942
- const n = this.getBoundsRect(), a = n.pageWidth, l = Math.sqrt(Math.pow(a, 2) + Math.pow(n.height, 2)) / 5, h = this.render.convertToBook(i);
1943
- return h.x > 0 && h.y > 0 && h.x < n.width && h.y < n.height && (h.x < l || h.x > n.width - l) && (h.y < l || h.y > n.height - l);
1945
+ const n = this.getBoundsRect(), a = n.pageWidth, c = Math.sqrt(Math.pow(a, 2) + Math.pow(n.height, 2)) / 5, h = this.render.convertToBook(i);
1946
+ return h.x > 0 && h.y > 0 && h.x < n.width && h.y < n.height && (h.x < c || h.x > n.width - c) && (h.y < c || h.y > n.height - c);
1944
1947
  }
1945
1948
  }
1946
1949
  class $ {
@@ -1976,14 +1979,14 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
1976
1979
  }
1977
1980
  calculateBoundsRect() {
1978
1981
  let i = "landscape";
1979
- const n = this.getBlockWidth(), a = n / 2, l = this.getBlockHeight() / 2, h = this.setting.width / this.setting.height;
1980
- let d = this.setting.width, w = this.setting.height, y = a - d;
1981
- return this.setting.size === "stretch" ? (n < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (i = "portrait"), d = i === "portrait" ? this.getBlockWidth() : this.getBlockWidth() / 2, d > this.setting.maxWidth && (d = this.setting.maxWidth), w = d / h, w > this.getBlockHeight() && (w = this.getBlockHeight(), d = w * h), y = i === "portrait" ? a - d / 2 - d : a - d) : n < 2 * d && this.app.getSettings().usePortrait && (i = "portrait", y = a - d / 2 - d), this.boundsRect = { left: y, top: l - w / 2, width: 2 * d, height: w, pageWidth: d }, i;
1982
+ const n = this.getBlockWidth(), a = n / 2, c = this.getBlockHeight() / 2, h = this.setting.width / this.setting.height;
1983
+ let u = this.setting.width, v = this.setting.height, y = a - u;
1984
+ return this.setting.size === "stretch" ? (n < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (i = "portrait"), u = i === "portrait" ? this.getBlockWidth() : this.getBlockWidth() / 2, u > this.setting.maxWidth && (u = this.setting.maxWidth), v = u / h, v > this.getBlockHeight() && (v = this.getBlockHeight(), u = v * h), y = i === "portrait" ? a - u / 2 - u : a - u) : n < 2 * u && this.app.getSettings().usePortrait && (i = "portrait", y = a - u / 2 - u), this.boundsRect = { left: y, top: c - v / 2, width: 2 * u, height: v, pageWidth: u }, i;
1982
1985
  }
1983
- setShadowData(i, n, a, l) {
1986
+ setShadowData(i, n, a, c) {
1984
1987
  if (!this.app.getSettings().drawShadow) return;
1985
1988
  const h = 100 * this.getSettings().maxShadowOpacity;
1986
- this.shadow = { pos: i, angle: n, width: 3 * this.getRect().pageWidth / 4 * a / 100, opacity: (100 - a) * h / 100 / 100, direction: l, progress: 2 * a };
1989
+ this.shadow = { pos: i, angle: n, width: 3 * this.getRect().pageWidth / 4 * a / 100, opacity: (100 - a) * h / 100 / 100, direction: c, progress: 2 * a };
1987
1990
  }
1988
1991
  clearShadow() {
1989
1992
  this.shadow = null;
@@ -2045,7 +2048,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2045
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) };
2046
2049
  }
2047
2050
  }
2048
- class T extends $ {
2051
+ class k extends $ {
2049
2052
  constructor(i, n, a) {
2050
2053
  super(i, n), this.canvas = a, this.ctx = a.getContext("2d");
2051
2054
  }
@@ -2066,8 +2069,8 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2066
2069
  this.ctx.rect(i.left, i.top, i.width, i.height);
2067
2070
  const a = { x: i.left + i.width / 2 - n / 2, y: 0 };
2068
2071
  this.ctx.translate(a.x, a.y);
2069
- const l = this.ctx.createLinearGradient(0, 0, n, 0);
2070
- 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();
2072
+ const c = this.ctx.createLinearGradient(0, 0, n, 0);
2073
+ c.addColorStop(0, "rgba(0, 0, 0, 0)"), c.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), c.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), c.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), c.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), c.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = c, this.ctx.fillRect(0, 0, n, 2 * i.height), this.ctx.restore();
2071
2074
  }
2072
2075
  drawOuterShadow() {
2073
2076
  const i = this.getRect();
@@ -2082,8 +2085,8 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2082
2085
  this.ctx.save(), this.ctx.beginPath();
2083
2086
  const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.convertRectToGlobal(this.pageRect);
2084
2087
  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);
2085
- const l = 3 * this.shadow.width / 4, h = this.ctx.createLinearGradient(0, 0, l, 0);
2086
- this.shadow.direction === 0 ? (this.ctx.translate(-l, -100), h.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), h.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), h.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), h.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = h, this.ctx.fillRect(0, 0, l, 2 * i.height), this.ctx.restore();
2088
+ const c = 3 * this.shadow.width / 4, h = this.ctx.createLinearGradient(0, 0, c, 0);
2089
+ this.shadow.direction === 0 ? (this.ctx.translate(-c, -100), h.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), h.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), h.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), h.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), h.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = h, this.ctx.fillRect(0, 0, c, 2 * i.height), this.ctx.restore();
2087
2090
  }
2088
2091
  clear() {
2089
2092
  this.ctx.fillStyle = "white", this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
@@ -2095,40 +2098,40 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2095
2098
  this.update();
2096
2099
  }, this.onMouseDown = (h) => {
2097
2100
  if (this.checkTarget(h.target)) {
2098
- const d = this.getMousePos(h.clientX, h.clientY);
2099
- this.app.startUserTouch(d), h.preventDefault();
2101
+ const u = this.getMousePos(h.clientX, h.clientY);
2102
+ this.app.startUserTouch(u), h.preventDefault();
2100
2103
  }
2101
2104
  }, this.onTouchStart = (h) => {
2102
2105
  if (this.checkTarget(h.target) && h.changedTouches.length > 0) {
2103
- const d = h.changedTouches[0], w = this.getMousePos(d.clientX, d.clientY);
2104
- this.touchPoint = { point: w, time: Date.now() }, setTimeout(() => {
2105
- this.touchPoint !== null && this.app.startUserTouch(w);
2106
+ const u = h.changedTouches[0], v = this.getMousePos(u.clientX, u.clientY);
2107
+ this.touchPoint = { point: v, time: Date.now() }, setTimeout(() => {
2108
+ this.touchPoint !== null && this.app.startUserTouch(v);
2106
2109
  }, this.swipeTimeout), this.app.getSettings().mobileScrollSupport || h.preventDefault();
2107
2110
  }
2108
2111
  }, this.onMouseUp = (h) => {
2109
- const d = this.getMousePos(h.clientX, h.clientY);
2110
- this.app.userStop(d);
2112
+ const u = this.getMousePos(h.clientX, h.clientY);
2113
+ this.app.userStop(u);
2111
2114
  }, this.onMouseMove = (h) => {
2112
- const d = this.getMousePos(h.clientX, h.clientY);
2113
- this.app.userMove(d, !1);
2115
+ const u = this.getMousePos(h.clientX, h.clientY);
2116
+ this.app.userMove(u, !1);
2114
2117
  }, this.onTouchMove = (h) => {
2115
2118
  if (h.changedTouches.length > 0) {
2116
- const d = h.changedTouches[0], w = this.getMousePos(d.clientX, d.clientY);
2117
- this.app.getSettings().mobileScrollSupport ? (this.touchPoint !== null && (Math.abs(this.touchPoint.point.x - w.x) > 10 || this.app.getState() !== "read") && h.cancelable && this.app.userMove(w, !0), this.app.getState() !== "read" && h.preventDefault()) : this.app.userMove(w, !0);
2119
+ const u = h.changedTouches[0], v = this.getMousePos(u.clientX, u.clientY);
2120
+ this.app.getSettings().mobileScrollSupport ? (this.touchPoint !== null && (Math.abs(this.touchPoint.point.x - v.x) > 10 || this.app.getState() !== "read") && h.cancelable && this.app.userMove(v, !0), this.app.getState() !== "read" && h.preventDefault()) : this.app.userMove(v, !0);
2118
2121
  }
2119
2122
  }, this.onTouchEnd = (h) => {
2120
2123
  if (h.changedTouches.length > 0) {
2121
- const d = h.changedTouches[0], w = this.getMousePos(d.clientX, d.clientY);
2124
+ const u = h.changedTouches[0], v = this.getMousePos(u.clientX, u.clientY);
2122
2125
  let y = !1;
2123
2126
  if (this.touchPoint !== null) {
2124
- const E = w.x - this.touchPoint.point.x, D = Math.abs(w.y - this.touchPoint.point.y);
2125
- Math.abs(E) > this.swipeDistance && D < 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"), y = !0), this.touchPoint = null;
2127
+ const E = v.x - this.touchPoint.point.x, R = Math.abs(v.y - this.touchPoint.point.y);
2128
+ 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"), y = !0), this.touchPoint = null;
2126
2129
  }
2127
- this.app.userStop(w, y);
2130
+ this.app.userStop(v, y);
2128
2131
  }
2129
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;
2130
- const l = this.app.getSettings().usePortrait ? 1 : 2;
2131
- 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;
2133
+ const c = this.app.getSettings().usePortrait ? 1 : 2;
2134
+ i.style.minWidth = a.minWidth * c + "px", i.style.minHeight = a.minHeight + "px", a.size === "fixed" && (i.style.minWidth = a.width * c + "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;
2132
2135
  }
2133
2136
  destroy() {
2134
2137
  this.app.getSettings().useMouseEvents && this.removeHandlers(), this.distElement.remove(), this.wrapper.remove();
@@ -2156,10 +2159,10 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2156
2159
  return !this.app.getSettings().clickEventForward || !["a", "button"].includes(i.tagName.toLowerCase());
2157
2160
  }
2158
2161
  }
2159
- class F extends A {
2160
- constructor(i, n, a, l) {
2161
- super(i, n, a), this.wrapper.insertAdjacentHTML("afterbegin", '<div class="stf__block"></div>'), this.distElement = i.querySelector(".stf__block"), this.items = l;
2162
- for (const h of l) this.distElement.appendChild(h);
2162
+ class O extends A {
2163
+ constructor(i, n, a, c) {
2164
+ super(i, n, a), this.wrapper.insertAdjacentHTML("afterbegin", '<div class="stf__block"></div>'), this.distElement = i.querySelector(".stf__block"), this.items = c;
2165
+ for (const h of c) this.distElement.appendChild(h);
2163
2166
  this.setHandlers();
2164
2167
  }
2165
2168
  clear() {
@@ -2174,7 +2177,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2174
2177
  this.app.getRender().update();
2175
2178
  }
2176
2179
  }
2177
- class G extends A {
2180
+ class U extends A {
2178
2181
  constructor(i, n, a) {
2179
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();
2180
2183
  }
@@ -2189,7 +2192,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2189
2192
  this.resizeCanvas(), this.app.getRender().update();
2190
2193
  }
2191
2194
  }
2192
- class N extends $ {
2195
+ class H extends $ {
2193
2196
  constructor(i, n, a) {
2194
2197
  super(i, n), this.outerShadow = null, this.innerShadow = null, this.hardShadow = null, this.hardInnerShadow = null, this.element = a, this.createShadows();
2195
2198
  }
@@ -2209,7 +2212,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2209
2212
  const i = this.getRect(), n = this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress;
2210
2213
  let a = (100 - n) * (2.5 * i.pageWidth) / 100 + 20;
2211
2214
  a > i.pageWidth && (a = i.pageWidth);
2212
- let l = `
2215
+ let c = `
2213
2216
  display: block;
2214
2217
  z-index: ${(this.getSettings().startZIndex + 5).toString(10)};
2215
2218
  width: ${a}px;
@@ -2220,7 +2223,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2220
2223
  left: ${i.left + i.width / 2}px;
2221
2224
  transform-origin: 0 0;
2222
2225
  `;
2223
- 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;
2226
+ c += 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 = c;
2224
2227
  }
2225
2228
  drawHardOuterShadow() {
2226
2229
  const i = this.getRect();
@@ -2238,11 +2241,11 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2238
2241
  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;
2239
2242
  }
2240
2243
  drawInnerShadow() {
2241
- const i = this.getRect(), n = 3 * this.shadow.width / 4, a = this.getDirection() === 0 ? n : 0, l = this.getDirection() === 0 ? "to left" : "to right", h = this.convertToGlobal(this.shadow.pos), d = this.shadow.angle + 3 * Math.PI / 2, w = [this.pageRect.topLeft, this.pageRect.topRight, this.pageRect.bottomRight, this.pageRect.bottomLeft];
2244
+ const i = this.getRect(), n = 3 * this.shadow.width / 4, a = this.getDirection() === 0 ? n : 0, c = this.getDirection() === 0 ? "to left" : "to right", h = this.convertToGlobal(this.shadow.pos), u = this.shadow.angle + 3 * Math.PI / 2, v = [this.pageRect.topLeft, this.pageRect.topRight, this.pageRect.bottomRight, this.pageRect.bottomLeft];
2242
2245
  let y = "polygon( ";
2243
- for (const D of w) {
2244
- let W = this.getDirection() === 1 ? { x: -D.x + this.shadow.pos.x, y: D.y - this.shadow.pos.y } : { x: D.x - this.shadow.pos.x, y: D.y - this.shadow.pos.y };
2245
- W = f.GetRotatedPoint(W, { x: a, y: 100 }, d), y += W.x + "px " + W.y + "px, ";
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 = p.GetRotatedPoint(W, { x: a, y: 100 }, u), y += W.x + "px " + W.y + "px, ";
2246
2249
  }
2247
2250
  y = y.slice(0, -2), y += ")";
2248
2251
  const E = `
@@ -2250,36 +2253,36 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2250
2253
  z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
2251
2254
  width: ${n}px;
2252
2255
  height: ${2 * i.height}px;
2253
- background: linear-gradient(${l},
2256
+ background: linear-gradient(${c},
2254
2257
  rgba(0, 0, 0, ${this.shadow.opacity}) 5%,
2255
2258
  rgba(0, 0, 0, 0.05) 15%,
2256
2259
  rgba(0, 0, 0, ${this.shadow.opacity}) 35%,
2257
2260
  rgba(0, 0, 0, 0) 100%);
2258
2261
  transform-origin: ${a}px 100px;
2259
- transform: translate3d(${h.x - a}px, ${h.y - 100}px, 0) rotate(${d}rad);
2262
+ transform: translate3d(${h.x - a}px, ${h.y - 100}px, 0) rotate(${u}rad);
2260
2263
  clip-path: ${y};
2261
2264
  -webkit-clip-path: ${y};
2262
2265
  `;
2263
2266
  this.innerShadow.style.cssText = E;
2264
2267
  }
2265
2268
  drawOuterShadow() {
2266
- 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, h = this.getDirection() === 0 ? "to right" : "to left", d = [{ x: 0, y: 0 }, { x: i.pageWidth, y: 0 }, { x: i.pageWidth, y: i.height }, { x: 0, y: i.height }];
2267
- let w = "polygon( ";
2268
- for (const E of d) if (E !== null) {
2269
- let D = 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 };
2270
- D = f.GetRotatedPoint(D, { x: l, y: 100 }, a), w += D.x + "px " + D.y + "px, ";
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, c = this.getDirection() === 1 ? this.shadow.width : 0, h = this.getDirection() === 0 ? "to right" : "to left", u = [{ 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 E of u) if (E !== null) {
2272
+ 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 };
2273
+ R = p.GetRotatedPoint(R, { x: c, y: 100 }, a), v += R.x + "px " + R.y + "px, ";
2271
2274
  }
2272
- w = w.slice(0, -2), w += ")";
2275
+ v = v.slice(0, -2), v += ")";
2273
2276
  const y = `
2274
2277
  display: block;
2275
2278
  z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
2276
2279
  width: ${this.shadow.width}px;
2277
2280
  height: ${2 * i.height}px;
2278
2281
  background: linear-gradient(${h}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));
2279
- transform-origin: ${l}px 100px;
2280
- transform: translate3d(${n.x - l}px, ${n.y - 100}px, 0) rotate(${a}rad);
2281
- clip-path: ${w};
2282
- -webkit-clip-path: ${w};
2282
+ transform-origin: ${c}px 100px;
2283
+ transform: translate3d(${n.x - c}px, ${n.y - 100}px, 0) rotate(${a}rad);
2284
+ clip-path: ${v};
2285
+ -webkit-clip-path: ${v};
2283
2286
  `;
2284
2287
  this.outerShadow.style.cssText = y;
2285
2288
  }
@@ -2304,7 +2307,7 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2304
2307
  super.update(), this.rightPage !== null && this.rightPage.setOrientation(1), this.leftPage !== null && this.leftPage.setOrientation(0);
2305
2308
  }
2306
2309
  }
2307
- class H {
2310
+ class N {
2308
2311
  constructor() {
2309
2312
  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 };
2310
2313
  }
@@ -2316,12 +2319,12 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2316
2319
  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;
2317
2320
  }
2318
2321
  }
2319
- (function(p, i) {
2322
+ (function(f, i) {
2320
2323
  i === void 0 && (i = {});
2321
2324
  var n = i.insertAt;
2322
2325
  if (typeof document < "u") {
2323
- var a = document.head || document.getElementsByTagName("head")[0], l = document.createElement("style");
2324
- l.type = "text/css", n === "top" && a.firstChild ? a.insertBefore(l, a.firstChild) : a.appendChild(l), l.styleSheet ? l.styleSheet.cssText = p : l.appendChild(document.createTextNode(p));
2326
+ var a = document.head || document.getElementsByTagName("head")[0], c = document.createElement("style");
2327
+ c.type = "text/css", n === "top" && a.firstChild ? a.insertBefore(c, a.firstChild) : a.appendChild(c), c.styleSheet ? c.styleSheet.cssText = f : c.appendChild(document.createTextNode(f));
2325
2328
  }
2326
2329
  })(`.stf__parent {
2327
2330
  position: relative;
@@ -2387,18 +2390,18 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2387
2390
  constructor() {
2388
2391
  this.events = /* @__PURE__ */ new Map();
2389
2392
  }
2390
- on(p, i) {
2391
- return this.events.has(p) ? this.events.get(p).push(i) : this.events.set(p, [i]), this;
2393
+ on(f, i) {
2394
+ return this.events.has(f) ? this.events.get(f).push(i) : this.events.set(f, [i]), this;
2392
2395
  }
2393
- off(p) {
2394
- this.events.delete(p);
2396
+ off(f) {
2397
+ this.events.delete(f);
2395
2398
  }
2396
- trigger(p, i, n = null) {
2397
- if (this.events.has(p)) for (const a of this.events.get(p)) a({ data: n, object: i });
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 });
2398
2401
  }
2399
2402
  } {
2400
- constructor(p, i) {
2401
- super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new H().getSettings(i), this.block = p;
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;
2402
2405
  }
2403
2406
  destroy() {
2404
2407
  this.ui.destroy(), this.block.remove();
@@ -2406,25 +2409,25 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2406
2409
  update() {
2407
2410
  this.render.update(), this.pages.show();
2408
2411
  }
2409
- loadFromImages(p) {
2410
- this.ui = new G(this.block, this, this.setting);
2412
+ loadFromImages(f) {
2413
+ this.ui = new U(this.block, this, this.setting);
2411
2414
  const i = this.ui.getCanvas();
2412
- this.render = new T(this, this.setting, i), this.flipController = new L(this.render, this), this.pages = new g(this, this.render, p), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2415
+ this.render = new k(this, this.setting, i), this.flipController = new D(this.render, this), this.pages = new d(this, this.render, f), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2413
2416
  this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
2414
2417
  }, 1);
2415
2418
  }
2416
- loadFromHTML(p) {
2417
- this.ui = new F(this.block, this, this.setting, p), this.render = new N(this, this.setting, this.ui.getDistElement()), this.flipController = new L(this.render, this), this.pages = new S(this, this.render, this.ui.getDistElement(), p), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2419
+ loadFromHTML(f) {
2420
+ this.ui = new O(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 S(this, this.render, this.ui.getDistElement(), f), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
2418
2421
  this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
2419
2422
  }, 1);
2420
2423
  }
2421
- updateFromImages(p) {
2424
+ updateFromImages(f) {
2422
2425
  const i = this.pages.getCurrentPageIndex();
2423
- this.pages.destroy(), this.pages = new g(this, this.render, p), this.pages.load(), this.pages.show(i), this.trigger("update", this, { page: i, mode: this.render.getOrientation() });
2426
+ this.pages.destroy(), this.pages = new d(this, this.render, f), this.pages.load(), this.pages.show(i), this.trigger("update", this, { page: i, mode: this.render.getOrientation() });
2424
2427
  }
2425
- updateFromHtml(p) {
2428
+ updateFromHtml(f) {
2426
2429
  const i = this.pages.getCurrentPageIndex();
2427
- this.pages.destroy(), this.pages = new S(this, this.render, this.ui.getDistElement(), p), this.pages.load(), this.ui.updateItems(p), this.render.reload(), this.pages.show(i), this.trigger("update", this, { page: i, mode: this.render.getOrientation() });
2430
+ this.pages.destroy(), this.pages = new S(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() });
2428
2431
  }
2429
2432
  clear() {
2430
2433
  this.pages.destroy(), this.ui.clear();
@@ -2435,26 +2438,26 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2435
2438
  turnToNextPage() {
2436
2439
  this.pages.showNext();
2437
2440
  }
2438
- turnToPage(p) {
2439
- this.pages.show(p);
2441
+ turnToPage(f) {
2442
+ this.pages.show(f);
2440
2443
  }
2441
- flipNext(p = "top") {
2442
- this.flipController.flipNext(p);
2444
+ flipNext(f = "top") {
2445
+ this.flipController.flipNext(f);
2443
2446
  }
2444
- flipPrev(p = "top") {
2445
- this.flipController.flipPrev(p);
2447
+ flipPrev(f = "top") {
2448
+ this.flipController.flipPrev(f);
2446
2449
  }
2447
- flip(p, i = "top") {
2448
- this.flipController.flipToPage(p, i);
2450
+ flip(f, i = "top") {
2451
+ this.flipController.flipToPage(f, i);
2449
2452
  }
2450
- updateState(p) {
2451
- this.trigger("changeState", this, p);
2453
+ updateState(f) {
2454
+ this.trigger("changeState", this, f);
2452
2455
  }
2453
- updatePageIndex(p) {
2454
- this.trigger("flip", this, p);
2456
+ updatePageIndex(f) {
2457
+ this.trigger("flip", this, f);
2455
2458
  }
2456
- updateOrientation(p) {
2457
- this.ui.setOrientationStyle(p), this.update(), this.trigger("changeOrientation", this, p);
2459
+ updateOrientation(f) {
2460
+ this.ui.setOrientationStyle(f), this.update(), this.trigger("changeOrientation", this, f);
2458
2461
  }
2459
2462
  getPageCount() {
2460
2463
  return this.pages.getPageCount();
@@ -2462,8 +2465,8 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2462
2465
  getCurrentPageIndex() {
2463
2466
  return this.pages.getCurrentPageIndex();
2464
2467
  }
2465
- getPage(p) {
2466
- return this.pages.getPage(p);
2468
+ getPage(f) {
2469
+ return this.pages.getPage(f);
2467
2470
  }
2468
2471
  getRender() {
2469
2472
  return this.render;
@@ -2489,14 +2492,14 @@ var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
2489
2492
  getPageCollection() {
2490
2493
  return this.pages;
2491
2494
  }
2492
- startUserTouch(p) {
2493
- this.mousePosition = p, this.isUserTouch = !0, this.isUserMove = !1;
2495
+ startUserTouch(f) {
2496
+ this.mousePosition = f, this.isUserTouch = !0, this.isUserMove = !1;
2494
2497
  }
2495
- userMove(p, i) {
2496
- this.isUserTouch || i || !this.setting.showPageCorners ? this.isUserTouch && f.GetDistanceBetweenTwoPoint(this.mousePosition, p) > 5 && (this.isUserMove = !0, this.flipController.fold(p)) : this.flipController.showCorner(p);
2498
+ userMove(f, i) {
2499
+ this.isUserTouch || i || !this.setting.showPageCorners ? this.isUserTouch && p.GetDistanceBetweenTwoPoint(this.mousePosition, f) > 5 && (this.isUserMove = !0, this.flipController.fold(f)) : this.flipController.showCorner(f);
2497
2500
  }
2498
- userStop(p, i = !1) {
2499
- this.isUserTouch && (this.isUserTouch = !1, i || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(p)));
2501
+ userStop(f, i = !1) {
2502
+ this.isUserTouch && (this.isUserTouch = !1, i || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(f)));
2500
2503
  }
2501
2504
  }, Object.defineProperty(s, "__esModule", { value: !0 });
2502
2505
  });
@@ -2516,17 +2519,23 @@ var hi = Dt.exports;
2516
2519
  * you must purchase a Commercial License from:
2517
2520
  * https://flipbookengine.com/pricing
2518
2521
  */
2519
- class li {
2522
+ function li() {
2523
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2524
+ }
2525
+ function ci(e, t = li()) {
2526
+ return t ? 0 : typeof e == "number" && e >= 0 ? e : 1e3;
2527
+ }
2528
+ class di {
2520
2529
  constructor(t, s, o) {
2521
- v(this, "pageFlip", null);
2522
- v(this, "bookContainer");
2523
- v(this, "options");
2524
- v(this, "store");
2525
- v(this, "unsubs", []);
2526
- v(this, "audioEl", null);
2527
- v(this, "audioUnlockHandler", null);
2528
- v(this, "isLibraryFlipping", !1);
2529
- v(this, "autoPlayTimer", null);
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);
2530
2539
  this.bookContainer = t, this.options = s, this.store = o, s.soundUrl && (this.audioEl = new Audio(s.soundUrl), this.unlockAudio());
2531
2540
  }
2532
2541
  unlockAudio() {
@@ -2557,7 +2566,7 @@ class li {
2557
2566
  usePortrait: !0,
2558
2567
  mobileScrollSupport: !1,
2559
2568
  maxShadowOpacity: this.options.maxShadowOpacity || 0.5,
2560
- flippingTime: this.options.flippingTime || 1e3
2569
+ flippingTime: ci(this.options.flippingTime)
2561
2570
  });
2562
2571
  const o = this.bookContainer.querySelectorAll(".bz-page");
2563
2572
  this.pageFlip.loadFromHTML(Array.from(o)), this.bindEvents(), this.setupSignalSync();
@@ -2573,23 +2582,23 @@ class li {
2573
2582
  }
2574
2583
  setupSignalSync() {
2575
2584
  this.unsubs.push(
2576
- j(() => {
2585
+ _(() => {
2577
2586
  const t = this.store.currentPage.value, s = this.store.flipState.peek();
2578
2587
  if (!this.pageFlip || this.isLibraryFlipping || s !== "read") return;
2579
2588
  const o = this.pageFlip.getCurrentPageIndex();
2580
2589
  if (o !== t && !this.store.isSingleMode.value) {
2581
- const r = (f) => f === 0 ? 0 : Math.ceil(f / 2), c = r(t), g = r(o);
2582
- c === g + 1 ? this.pageFlip.flipNext() : c === g - 1 ? this.pageFlip.flipPrev() : c !== g && this.pageFlip.turnToPage(t);
2590
+ const r = (p) => p === 0 ? 0 : Math.ceil(p / 2), l = r(t), d = r(o);
2591
+ l === d + 1 ? this.pageFlip.flipNext() : l === d - 1 ? this.pageFlip.flipPrev() : l !== d && this.pageFlip.turnToPage(t);
2583
2592
  }
2584
2593
  })
2585
2594
  ), this.unsubs.push(
2586
- j(() => {
2595
+ _(() => {
2587
2596
  this.store.isSingleMode.value, this.pageFlip && setTimeout(() => {
2588
2597
  this.pageFlip && this.pageFlip.update(), window.dispatchEvent(new Event("resize"));
2589
2598
  }, 50);
2590
2599
  })
2591
2600
  ), this.unsubs.push(
2592
- j(() => {
2601
+ _(() => {
2593
2602
  const t = this.store.isAutoPlaying.value, s = this.store.autoPlayInterval.value || 3e3;
2594
2603
  this.autoPlayTimer && (clearInterval(this.autoPlayTimer), this.autoPlayTimer = null), t && (this.autoPlayTimer = setInterval(() => {
2595
2604
  const o = this.store.pages.value.length - 1;
@@ -2642,17 +2651,17 @@ class li {
2642
2651
  * you must purchase a Commercial License from:
2643
2652
  * https://flipbookengine.com/pricing
2644
2653
  */
2645
- class ci {
2654
+ class ui {
2646
2655
  constructor(t, s) {
2647
- v(this, "wrapperElement", null);
2648
- v(this, "sizerElement", null);
2649
- v(this, "pageViewport");
2650
- v(this, "store");
2651
- v(this, "resizeObserver", null);
2652
- v(this, "orientationMediaQuery", null);
2653
- v(this, "orientationChangeHandler", null);
2654
- v(this, "unsubs", []);
2655
- v(this, "onResizeCallback");
2656
+ m(this, "wrapperElement", null);
2657
+ m(this, "sizerElement", null);
2658
+ m(this, "pageViewport");
2659
+ m(this, "store");
2660
+ m(this, "resizeObserver", null);
2661
+ m(this, "orientationMediaQuery", null);
2662
+ m(this, "orientationChangeHandler", null);
2663
+ m(this, "unsubs", []);
2664
+ m(this, "onResizeCallback");
2656
2665
  this.pageViewport = t, this.store = s;
2657
2666
  }
2658
2667
  init(t, s) {
@@ -2660,7 +2669,7 @@ class ci {
2660
2669
  }
2661
2670
  setupStateSync() {
2662
2671
  this.unsubs.push(
2663
- j(() => {
2672
+ _(() => {
2664
2673
  this.store.isSingleMode.value, this.store.orientation.value, setTimeout(() => this.updateBookAspectRatio(), 10);
2665
2674
  })
2666
2675
  );
@@ -2683,11 +2692,11 @@ class ci {
2683
2692
  if (!this.wrapperElement || !this.sizerElement) return;
2684
2693
  const t = this.wrapperElement.clientWidth, s = this.wrapperElement.clientHeight;
2685
2694
  if (t === 0 || s === 0) return;
2686
- const o = this.pageViewport.width, r = this.pageViewport.height, g = this.store.isDoublePageLayout.value ? o * 2 / r : o / r;
2687
- let f = t, P = t / g;
2688
- P > s && (P = s, f = s * g);
2689
- let S = Math.ceil(f);
2690
- S % 2 !== 0 && (S += 1), this.sizerElement.style.width = `${S}px`, this.sizerElement.style.height = `${Math.floor(P)}px`, this.sizerElement.style.aspectRatio = "", this.onResizeCallback && this.onResizeCallback();
2695
+ const o = this.pageViewport.width, r = this.pageViewport.height, d = this.store.isDoublePageLayout.value ? o * 2 / r : o / r;
2696
+ let p = t, x = t / d;
2697
+ x > s && (x = s, p = s * d);
2698
+ let S = Math.ceil(p);
2699
+ S % 2 !== 0 && (S += 1), this.sizerElement.style.width = `${S}px`, this.sizerElement.style.height = `${Math.floor(x)}px`, this.sizerElement.style.aspectRatio = "", this.onResizeCallback && this.onResizeCallback();
2691
2700
  }
2692
2701
  destroy() {
2693
2702
  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);
@@ -2707,17 +2716,17 @@ class ci {
2707
2716
  * you must purchase a Commercial License from:
2708
2717
  * https://flipbookengine.com/pricing
2709
2718
  */
2710
- class di {
2719
+ class gi {
2711
2720
  constructor(t, s, o) {
2712
- v(this, "container");
2713
- v(this, "pageFlipAdapter");
2714
- v(this, "store");
2715
- v(this, "touchStartX", null);
2716
- v(this, "unsubs", []);
2717
- v(this, "listenerAbortController");
2718
- var c;
2721
+ m(this, "container");
2722
+ m(this, "pageFlipAdapter");
2723
+ m(this, "store");
2724
+ m(this, "touchStartX", null);
2725
+ m(this, "unsubs", []);
2726
+ m(this, "listenerAbortController");
2727
+ var l;
2719
2728
  this.container = t, this.pageFlipAdapter = s, this.store = o;
2720
- const r = ((c = t.ownerDocument.defaultView) == null ? void 0 : c.AbortController) ?? globalThis.AbortController;
2729
+ const r = ((l = t.ownerDocument.defaultView) == null ? void 0 : l.AbortController) ?? globalThis.AbortController;
2721
2730
  this.listenerAbortController = new r();
2722
2731
  }
2723
2732
  init() {
@@ -2725,7 +2734,7 @@ class di {
2725
2734
  }
2726
2735
  setupStateSync() {
2727
2736
  this.unsubs.push(
2728
- j(() => {
2737
+ _(() => {
2729
2738
  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");
2730
2739
  })
2731
2740
  );
@@ -2739,13 +2748,13 @@ class di {
2739
2748
  }, { passive: !1, signal: this.listenerAbortController.signal });
2740
2749
  }
2741
2750
  bindMouseDrag() {
2742
- let t = !1, s = 0, o = 0, r = 0, c = 0;
2743
- this.container.addEventListener("mousedown", (g) => {
2744
- this.store.zoomState.value.isActive && (t = !0, s = g.clientX, o = g.clientY, r = this.store.zoomState.value.translateX, c = this.store.zoomState.value.translateY, this.container.style.cursor = "grabbing");
2745
- }, { signal: this.listenerAbortController.signal }), window.addEventListener("mousemove", (g) => {
2751
+ let t = !1, s = 0, o = 0, r = 0, l = 0;
2752
+ this.container.addEventListener("mousedown", (d) => {
2753
+ this.store.zoomState.value.isActive && (t = !0, s = d.clientX, o = d.clientY, r = this.store.zoomState.value.translateX, l = this.store.zoomState.value.translateY, this.container.style.cursor = "grabbing");
2754
+ }, { signal: this.listenerAbortController.signal }), window.addEventListener("mousemove", (d) => {
2746
2755
  if (!t || !this.store.zoomState.value.isActive) return;
2747
- const f = g.clientX - s, P = g.clientY - o;
2748
- this.updateZoomPan(r + f, c + P);
2756
+ const p = d.clientX - s, x = d.clientY - o;
2757
+ this.updateZoomPan(r + p, l + x);
2749
2758
  }, { signal: this.listenerAbortController.signal }), window.addEventListener("mouseup", () => {
2750
2759
  t && (t = !1, this.container.style.cursor = this.store.zoomState.value.isActive ? "grab" : "");
2751
2760
  }, { signal: this.listenerAbortController.signal });
@@ -2758,19 +2767,19 @@ class di {
2758
2767
  this.touchStartX = r.touches[0].clientX;
2759
2768
  else {
2760
2769
  t = !0, this.touchStartX = r.touches[0].clientX;
2761
- const c = r.touches[0].clientY;
2762
- s = this.store.zoomState.value.translateX, o = this.store.zoomState.value.translateY, this.container._touchStartY = c;
2770
+ const l = r.touches[0].clientY;
2771
+ s = this.store.zoomState.value.translateX, o = this.store.zoomState.value.translateY, this.container._touchStartY = l;
2763
2772
  }
2764
2773
  }, { passive: !0, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchmove", (r) => {
2765
2774
  if (t && this.store.zoomState.value.isActive && r.touches.length === 1 && this.touchStartX !== null) {
2766
2775
  r.preventDefault();
2767
- const c = r.touches[0].clientX - this.touchStartX, g = r.touches[0].clientY - this.container._touchStartY;
2768
- this.updateZoomPan(s + c, o + g);
2776
+ const l = r.touches[0].clientX - this.touchStartX, d = r.touches[0].clientY - this.container._touchStartY;
2777
+ this.updateZoomPan(s + l, o + d);
2769
2778
  }
2770
2779
  }, { passive: !1, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchend", (r) => {
2771
2780
  if (this.touchStartX !== null && !this.store.zoomState.value.isActive && this.store.isSingleMode.value && r.changedTouches.length === 1) {
2772
- const c = r.changedTouches[0].clientX - this.touchStartX;
2773
- c > 50 && this.store.currentPage.value > 0 ? this.pageFlipAdapter.turnToPrevPage() : c < -50 && this.store.currentPage.value < this.store.totalPages.value - 1 && this.pageFlipAdapter.turnToNextPage();
2781
+ const l = r.changedTouches[0].clientX - this.touchStartX;
2782
+ l > 50 && this.store.currentPage.value > 0 ? this.pageFlipAdapter.turnToPrevPage() : l < -50 && this.store.currentPage.value < this.store.totalPages.value - 1 && this.pageFlipAdapter.turnToNextPage();
2774
2783
  }
2775
2784
  this.touchStartX = null, t = !1;
2776
2785
  }, { passive: !0, signal: this.listenerAbortController.signal });
@@ -2804,61 +2813,61 @@ class di {
2804
2813
  *
2805
2814
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
2806
2815
  */
2807
- const ui = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
2816
+ const pi = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
2808
2817
  function fe() {
2809
- const e = M(0), t = M(0), s = M(!1), o = M(!0), r = M(!0), c = M("landscape"), g = M("read"), f = M("auto"), P = M(!0), S = M(!1), b = M("#7367f0"), L = M(!1), $ = M(!1), T = M(!1), A = M(3e3), F = M(!0), G = M("en"), N = M({}), H = M(ui()), p = M([]), i = m(() => !s.value && c.value === "landscape"), n = m(() => i.value && e.value === 0), a = m(() => i.value && e.value >= t.value - 1);
2810
- return { currentPage: e, totalPages: t, isSingleMode: s, showThumbs: o, showArrows: r, orientation: c, flipState: g, themeMode: f, allowDownload: P, hasDownloadUrl: S, primaryColor: b, whiteLabel: L, isZoomed: $, isAutoPlaying: T, autoPlayInterval: A, soundEnabled: F, locale: G, messages: N, zoomState: H, pages: p, isDoublePageLayout: i, isFrontCover: n, isBackCover: a, init: (h, d, w, y) => {
2811
- t.value = d, p.value = w, S.value = y, h.theme !== void 0 && (f.value = h.theme), h.primaryColor !== void 0 && (b.value = h.primaryColor), h.showThumbs !== void 0 && (o.value = h.showThumbs), h.showArrows !== void 0 && (r.value = h.showArrows), h.allowDownload !== void 0 && (P.value = h.allowDownload), h.whiteLabel !== void 0 && (L.value = h.whiteLabel), h.soundEnabled !== void 0 && (F.value = h.soundEnabled), h.locale !== void 0 && (G.value = h.locale), h.messages !== void 0 && (N.value = h.messages), h.isSingleMode !== void 0 && (s.value = h.isSingleMode), h.singleMode !== void 0 && (s.value = h.singleMode), h.autoPlay !== void 0 && (T.value = h.autoPlay), h.autoPlayInterval !== void 0 && (A.value = h.autoPlayInterval), e.value = 0;
2818
+ const e = M(0), t = M(0), s = M(!1), o = M(!0), r = M(!0), l = M("landscape"), d = M("read"), p = M("auto"), x = M(!0), S = M(!1), b = M("#7367f0"), D = M(!1), $ = M(!1), k = M(!1), A = M(3e3), O = M(!0), U = M("en"), H = M({}), N = M(pi()), f = M([]), i = w(() => !s.value && l.value === "landscape"), n = w(() => i.value && e.value === 0), a = w(() => i.value && e.value >= t.value - 1);
2819
+ return { currentPage: e, totalPages: t, isSingleMode: s, showThumbs: o, showArrows: r, orientation: l, flipState: d, themeMode: p, allowDownload: x, hasDownloadUrl: S, primaryColor: b, whiteLabel: D, isZoomed: $, isAutoPlaying: k, autoPlayInterval: A, soundEnabled: O, locale: U, messages: H, zoomState: N, pages: f, isDoublePageLayout: i, isFrontCover: n, isBackCover: a, init: (h, u, v, y) => {
2820
+ t.value = u, f.value = v, S.value = y, h.theme !== void 0 && (p.value = h.theme), h.primaryColor !== void 0 && (b.value = h.primaryColor), h.showThumbs !== void 0 && (o.value = h.showThumbs), h.showArrows !== void 0 && (r.value = h.showArrows), h.allowDownload !== void 0 && (x.value = h.allowDownload), h.whiteLabel !== void 0 && (D.value = h.whiteLabel), h.soundEnabled !== void 0 && (O.value = h.soundEnabled), h.locale !== void 0 && (U.value = h.locale), h.messages !== void 0 && (H.value = h.messages), h.isSingleMode !== void 0 && (s.value = h.isSingleMode), h.singleMode !== void 0 && (s.value = h.singleMode), h.autoPlay !== void 0 && (k.value = h.autoPlay), h.autoPlayInterval !== void 0 && (A.value = h.autoPlayInterval), e.value = 0;
2812
2821
  } };
2813
2822
  }
2814
- const C = fe();
2815
- C.currentPage;
2816
- C.totalPages;
2817
- C.isSingleMode;
2818
- C.showThumbs;
2819
- C.showArrows;
2820
- C.orientation;
2821
- C.flipState;
2822
- C.themeMode;
2823
- C.allowDownload;
2824
- C.hasDownloadUrl;
2825
- C.primaryColor;
2826
- C.whiteLabel;
2827
- C.isZoomed;
2828
- C.isAutoPlaying;
2829
- C.autoPlayInterval;
2830
- C.soundEnabled;
2831
- C.locale;
2832
- C.messages;
2833
- C.zoomState;
2834
- C.pages;
2835
- C.isDoublePageLayout;
2836
- C.isFrontCover;
2837
- C.isBackCover;
2838
- function gi(e) {
2823
+ const T = fe();
2824
+ T.currentPage;
2825
+ T.totalPages;
2826
+ T.isSingleMode;
2827
+ T.showThumbs;
2828
+ T.showArrows;
2829
+ T.orientation;
2830
+ T.flipState;
2831
+ T.themeMode;
2832
+ T.allowDownload;
2833
+ T.hasDownloadUrl;
2834
+ T.primaryColor;
2835
+ T.whiteLabel;
2836
+ T.isZoomed;
2837
+ T.isAutoPlaying;
2838
+ T.autoPlayInterval;
2839
+ T.soundEnabled;
2840
+ T.locale;
2841
+ T.messages;
2842
+ T.zoomState;
2843
+ T.pages;
2844
+ T.isDoublePageLayout;
2845
+ T.isFrontCover;
2846
+ T.isBackCover;
2847
+ function fi(e) {
2839
2848
  if (!e || typeof e != "object") return !1;
2840
2849
  const t = e;
2841
2850
  return typeof t.normal == "string" && typeof t.low == "string" && typeof t.thumb == "string";
2842
2851
  }
2843
- function pi(e) {
2852
+ function mi(e) {
2844
2853
  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] : [];
2845
2854
  }
2846
- function fi(e) {
2855
+ function wi(e) {
2847
2856
  return e === "rtl" ? ["right", "left"] : ["left", "right"];
2848
2857
  }
2849
- function mi(e) {
2858
+ function vi(e) {
2850
2859
  const t = [];
2851
2860
  let s = 1;
2852
2861
  return e.forEach((o, r) => {
2853
- const c = o.kind ?? "single", g = o.id ?? `asset-${r}`, f = o.splitDirection ?? "ltr", P = pi(o);
2854
- if (c === "spread") {
2855
- const b = P.length >= 2 ? P.slice(0, 2) : [s, s + 1], L = fi(f);
2856
- b.forEach(($, T) => {
2862
+ const l = o.kind ?? "single", d = o.id ?? `asset-${r}`, p = o.splitDirection ?? "ltr", x = mi(o);
2863
+ if (l === "spread") {
2864
+ const b = x.length >= 2 ? x.slice(0, 2) : [s, s + 1], D = wi(p);
2865
+ b.forEach(($, k) => {
2857
2866
  t.push({
2858
2867
  index: t.length,
2859
- assetId: g,
2868
+ assetId: d,
2860
2869
  pageNumber: $,
2861
- cropMode: L[T] ?? "full",
2870
+ cropMode: D[k] ?? "full",
2862
2871
  normal: o.normal,
2863
2872
  low: o.low,
2864
2873
  thumb: o.thumb
@@ -2866,10 +2875,10 @@ function mi(e) {
2866
2875
  }), s = b[b.length - 1] + 1;
2867
2876
  return;
2868
2877
  }
2869
- const S = P[0] ?? s;
2878
+ const S = x[0] ?? s;
2870
2879
  t.push({
2871
2880
  index: t.length,
2872
- assetId: g,
2881
+ assetId: d,
2873
2882
  pageNumber: S,
2874
2883
  cropMode: "full",
2875
2884
  normal: o.normal,
@@ -2882,37 +2891,74 @@ function Kt(e, t) {
2882
2891
  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);
2883
2892
  const s = t.cssVariables ?? {};
2884
2893
  Object.entries(s).forEach(([o, r]) => {
2885
- const c = o.startsWith("--") ? o : `--${o}`;
2886
- e.style.setProperty(c, r);
2894
+ const l = o.startsWith("--") ? o : `--${o}`;
2895
+ e.style.setProperty(l, r);
2887
2896
  });
2888
2897
  }
2889
- class wi {
2898
+ class yi {
2899
+ constructor(t = 32) {
2900
+ m(this, "entries", /* @__PURE__ */ new Map());
2901
+ m(this, "hits", 0);
2902
+ m(this, "misses", 0);
2903
+ if (this.maxEntries = t, !Number.isInteger(t) || t < 0)
2904
+ throw new RangeError("PDF render cache size must be a non-negative integer.");
2905
+ }
2906
+ get(t) {
2907
+ const s = this.entries.get(t);
2908
+ if (s === void 0) {
2909
+ this.misses++;
2910
+ return;
2911
+ }
2912
+ return this.hits++, this.entries.delete(t), this.entries.set(t, s), s;
2913
+ }
2914
+ set(t, s) {
2915
+ if (!(this.maxEntries === 0 || !s))
2916
+ for (this.entries.delete(t), this.entries.set(t, s); this.entries.size > this.maxEntries; ) {
2917
+ const o = this.entries.keys().next().value;
2918
+ if (o === void 0) break;
2919
+ this.entries.delete(o);
2920
+ }
2921
+ }
2922
+ clear() {
2923
+ this.entries.clear(), this.hits = 0, this.misses = 0;
2924
+ }
2925
+ get size() {
2926
+ return this.entries.size;
2927
+ }
2928
+ getStats() {
2929
+ return { size: this.size, maxEntries: this.maxEntries, hits: this.hits, misses: this.misses };
2930
+ }
2931
+ }
2932
+ class bi {
2890
2933
  constructor(t = {}) {
2891
- v(this, "pdfDoc", null);
2892
- v(this, "loadingTask", null);
2893
- v(this, "options");
2934
+ m(this, "pdfDoc", null);
2935
+ m(this, "loadingTask", null);
2936
+ m(this, "options");
2937
+ m(this, "cache");
2938
+ const s = Number.isFinite(t.cacheSize) ? Math.max(0, Math.floor(t.cacheSize)) : 32;
2894
2939
  this.options = {
2895
2940
  scale: t.scale || 1.5,
2896
2941
  quality: t.quality || 0.85,
2897
2942
  format: t.format || "image/webp",
2898
2943
  workerSrc: t.workerSrc || "",
2899
- concurrency: Math.max(1, Math.floor(t.concurrency || 3))
2900
- }, this.options.workerSrc && (Bt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
2944
+ concurrency: Math.max(1, Math.floor(t.concurrency || 3)),
2945
+ cacheSize: s
2946
+ }, this.cache = new yi(this.options.cacheSize), this.options.workerSrc && (Bt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
2901
2947
  }
2902
2948
  /** Loads a PDF document and cancels PDF.js loading when the signal aborts. */
2903
2949
  async loadDocument(t, s) {
2904
- this.throwIfAborted(s);
2950
+ this.throwIfAborted(s), this.cache.clear();
2905
2951
  const o = Bt.getDocument(t);
2906
2952
  this.loadingTask = o;
2907
2953
  const r = () => {
2908
- var c;
2909
- return (c = o.destroy) == null ? void 0 : c.call(o);
2954
+ var l;
2955
+ return (l = o.destroy) == null ? void 0 : l.call(o);
2910
2956
  };
2911
2957
  s == null || s.addEventListener("abort", r, { once: !0 });
2912
2958
  try {
2913
2959
  return this.pdfDoc = await o.promise, this.throwIfAborted(s), this.pdfDoc.numPages;
2914
- } catch (c) {
2915
- throw s != null && s.aborted ? this.createAbortError() : c;
2960
+ } catch (l) {
2961
+ throw s != null && s.aborted ? this.createAbortError() : l;
2916
2962
  } finally {
2917
2963
  s == null || s.removeEventListener("abort", r), this.loadingTask === o && (this.loadingTask = null);
2918
2964
  }
@@ -2921,28 +2967,31 @@ class wi {
2921
2967
  async renderPageToDataUrl(t, s) {
2922
2968
  if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
2923
2969
  this.throwIfAborted(s);
2970
+ const o = this.cache.get(t);
2971
+ if (o !== void 0) return o;
2924
2972
  try {
2925
- const o = await this.pdfDoc.getPage(t);
2973
+ const r = await this.pdfDoc.getPage(t);
2926
2974
  this.throwIfAborted(s);
2927
- const r = o.getViewport({ scale: this.options.scale }), c = document.createElement("canvas");
2928
- c.width = r.width, c.height = r.height;
2929
- const g = c.getContext("2d");
2930
- if (g) {
2931
- const f = o.render({ canvasContext: g, viewport: r }), P = () => {
2932
- var S;
2933
- return (S = f.cancel) == null ? void 0 : S.call(f);
2975
+ const l = r.getViewport({ scale: this.options.scale }), d = document.createElement("canvas");
2976
+ d.width = l.width, d.height = l.height;
2977
+ const p = d.getContext("2d");
2978
+ if (p) {
2979
+ const x = r.render({ canvasContext: p, viewport: l }), S = () => {
2980
+ var D;
2981
+ return (D = x.cancel) == null ? void 0 : D.call(x);
2934
2982
  };
2935
- s == null || s.addEventListener("abort", P, { once: !0 });
2983
+ s == null || s.addEventListener("abort", S, { once: !0 });
2936
2984
  try {
2937
- await f.promise, this.throwIfAborted(s);
2985
+ await x.promise, this.throwIfAborted(s);
2938
2986
  } finally {
2939
- s == null || s.removeEventListener("abort", P);
2987
+ s == null || s.removeEventListener("abort", S);
2940
2988
  }
2941
- return c.toDataURL(this.options.format, this.options.quality);
2989
+ const b = d.toDataURL(this.options.format, this.options.quality);
2990
+ return this.cache.set(t, b), b;
2942
2991
  }
2943
- } catch (o) {
2992
+ } catch (r) {
2944
2993
  if (s != null && s.aborted) throw this.createAbortError();
2945
- console.error(`PDF page ${t} render error:`, o);
2994
+ console.error(`PDF page ${t} render error:`, r);
2946
2995
  }
2947
2996
  return "";
2948
2997
  }
@@ -2957,11 +3006,11 @@ class wi {
2957
3006
  if (!this.pdfDoc) return [];
2958
3007
  this.throwIfAborted(t);
2959
3008
  const o = this.pdfDoc.numPages, r = new Array(o);
2960
- let c = 1, g = 0;
2961
- const f = async () => {
3009
+ let l = 1, d = 0;
3010
+ const p = async () => {
2962
3011
  for (; ; ) {
2963
3012
  this.throwIfAborted(t);
2964
- const S = c++;
3013
+ const S = l++;
2965
3014
  if (S > o) return;
2966
3015
  const b = await this.renderPageToDataUrl(S, t);
2967
3016
  r[S - 1] = {
@@ -2972,10 +3021,13 @@ class wi {
2972
3021
  normal: b,
2973
3022
  low: b,
2974
3023
  thumb: b
2975
- }, g++, s == null || s({ completed: g, total: o });
3024
+ }, d++, s == null || s({ completed: d, total: o });
2976
3025
  }
2977
- }, P = Math.min(this.options.concurrency, o);
2978
- return await Promise.all(Array.from({ length: P }, () => f())), this.throwIfAborted(t), r;
3026
+ }, x = Math.min(this.options.concurrency, o);
3027
+ return await Promise.all(Array.from({ length: x }, () => p())), this.throwIfAborted(t), r;
3028
+ }
3029
+ getCacheStats() {
3030
+ return this.cache.getStats();
2979
3031
  }
2980
3032
  throwIfAborted(t) {
2981
3033
  if (t != null && t.aborted) throw this.createAbortError();
@@ -2986,7 +3038,7 @@ class wi {
2986
3038
  }
2987
3039
  destroy() {
2988
3040
  var t, s, o, r;
2989
- (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);
3041
+ (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();
2990
3042
  }
2991
3043
  }
2992
3044
  /**
@@ -3005,22 +3057,25 @@ class wi {
3005
3057
  */
3006
3058
  const mt = class mt {
3007
3059
  constructor(t, s = {}) {
3008
- v(this, "container", null);
3009
- v(this, "options");
3010
- v(this, "store", fe());
3060
+ m(this, "container", null);
3061
+ m(this, "options");
3062
+ m(this, "store", fe());
3011
3063
  // Core Managers
3012
- v(this, "pageFlipAdapter", null);
3013
- v(this, "layoutManager", null);
3014
- v(this, "interactionManager", null);
3015
- v(this, "pdfRenderer", null);
3016
- v(this, "listeners", {});
3017
- v(this, "initializationTimer", null);
3018
- v(this, "initGeneration", 0);
3019
- v(this, "initAbortController", null);
3020
- v(this, "eventsReady", !1);
3021
- v(this, "lastEventState", { currentPage: 0, zoom: 1, zoomActive: !1, showThumbs: !0, isSingle: !1, orientation: "" });
3022
- v(this, "eventSyncStop", null);
3023
- v(this, "qualityObserver", null);
3064
+ m(this, "pageFlipAdapter", null);
3065
+ m(this, "layoutManager", null);
3066
+ m(this, "interactionManager", null);
3067
+ m(this, "pdfRenderer", null);
3068
+ m(this, "listeners", {});
3069
+ m(this, "initializationTimer", null);
3070
+ m(this, "initGeneration", 0);
3071
+ m(this, "initAbortController", null);
3072
+ m(this, "eventsReady", !1);
3073
+ m(this, "lastEventState", { currentPage: 0, zoom: 1, zoomActive: !1, showThumbs: !0, isSingle: !1, orientation: "" });
3074
+ m(this, "eventSyncStop", null);
3075
+ m(this, "qualityObserver", null);
3076
+ m(this, "pdfLazyStop", null);
3077
+ m(this, "pdfPageRequests", /* @__PURE__ */ new Map());
3078
+ m(this, "pdfRenderedPages", /* @__PURE__ */ new Set());
3024
3079
  this.selector = t, this.options = {
3025
3080
  allowDownload: !0,
3026
3081
  showThumbs: !0,
@@ -3032,6 +3087,7 @@ const mt = class mt {
3032
3087
  pdfRenderQuality: 0.85,
3033
3088
  pdfRenderFormat: "image/webp",
3034
3089
  pdfRenderConcurrency: 3,
3090
+ pdfRenderCacheSize: 32,
3035
3091
  ...s
3036
3092
  }, this.setupEventSync();
3037
3093
  }
@@ -3040,52 +3096,51 @@ const mt = class mt {
3040
3096
  this.destroy(!0), this.eventsReady = !1;
3041
3097
  const o = this.initGeneration, r = new AbortController();
3042
3098
  this.initAbortController = r;
3043
- let c = [], g = { ...mt.DEFAULT_PAGE_VIEWPORT };
3099
+ let l = [], d = { ...mt.DEFAULT_PAGE_VIEWPORT };
3044
3100
  if (s && s.length > 0) {
3045
3101
  if (r.signal.aborted) return;
3046
- const T = s.filter(gi);
3047
- c = mi(T);
3048
- const A = c[0];
3102
+ const k = s.filter(fi);
3103
+ l = vi(k);
3104
+ const A = l[0];
3049
3105
  if (A) {
3050
- const F = await this.loadImageSize(A.low || A.normal);
3051
- if (F) {
3052
- const N = (A.cropMode !== "full" ? F.width / 2 : F.width) / F.height, H = 420;
3053
- g = N >= 1 ? { width: Math.round(H * N), height: H } : { width: H, height: Math.round(H / N) };
3106
+ const O = await this.loadImageSize(A.low || A.normal);
3107
+ if (O) {
3108
+ const H = (A.cropMode !== "full" ? O.width / 2 : O.width) / O.height, N = 420;
3109
+ d = H >= 1 ? { width: Math.round(N * H), height: N } : { width: N, height: Math.round(N / H) };
3054
3110
  }
3055
3111
  }
3056
3112
  } else if (t) {
3057
3113
  if (r.signal.aborted) return;
3058
- let T = "load";
3114
+ let k = "load";
3059
3115
  try {
3060
- this.pdfRenderer = new wi({
3116
+ this.pdfRenderer = new bi({
3061
3117
  scale: this.options.pdfRenderScale,
3062
3118
  quality: this.options.pdfRenderQuality,
3063
3119
  format: this.options.pdfRenderFormat,
3064
3120
  concurrency: this.options.pdfRenderConcurrency,
3121
+ cacheSize: this.options.pdfRenderCacheSize,
3065
3122
  workerSrc: this.options.pdfWorkerSrc
3066
3123
  }), this.emit("progress", { phase: "loading", completed: 0, total: 0 });
3067
3124
  const A = await this.pdfRenderer.loadDocument(t, r.signal);
3068
- T = "render", this.emit("progress", { phase: "loading", completed: 1, total: A }), c = await this.pdfRenderer.renderAllPages(r.signal, ({ completed: F, total: G }) => {
3069
- this.emit("progress", { phase: "rendering", completed: F, total: G });
3070
- }), g = await this.pdfRenderer.calculateViewportDimensions();
3125
+ k = "render", this.emit("progress", { phase: "loading", completed: 1, total: A }), d = await this.pdfRenderer.calculateViewportDimensions(), l = Array.from({ length: A }, (O, U) => this.createPdfPlaceholder(U + 1));
3071
3126
  } catch (A) {
3072
3127
  r.signal.aborted || (console.error("PDF load failed:", A), this.emit("error", {
3073
- code: T === "load" ? "PDF_LOAD_FAILED" : "PDF_RENDER_FAILED",
3128
+ code: k === "load" ? "PDF_LOAD_FAILED" : "PDF_RENDER_FAILED",
3074
3129
  message: A instanceof Error ? A.message : "Unable to load PDF.",
3075
3130
  cause: A
3076
3131
  }));
3077
3132
  return;
3078
3133
  }
3079
3134
  }
3080
- if (r.signal.aborted || o !== this.initGeneration || !c.length) return;
3081
- this.store.init(this.options, c.length, c, !!t), Kt(this.container, this.options), this.container.innerHTML = "";
3082
- let f, P, S;
3083
- const b = { current: null }, L = { current: null }, $ = ri({
3135
+ if (r.signal.aborted || o !== this.initGeneration || !l.length) return;
3136
+ this.store.init(this.options, l.length, l, !!t), Kt(this.container, this.options), this.container.innerHTML = "";
3137
+ let p, x, S;
3138
+ const b = { current: null }, D = { current: null }, $ = ri({
3084
3139
  pageFlipAdapterRef: b,
3085
- interactionManagerRef: L,
3086
- bookWrapperRef: (T) => f = T,
3087
- bookSizerRef: (T) => P = T,
3088
- bookContainerRef: (T) => S = T,
3140
+ interactionManagerRef: D,
3141
+ bookWrapperRef: (k) => p = k,
3142
+ bookSizerRef: (k) => x = k,
3143
+ bookContainerRef: (k) => S = k,
3089
3144
  className: this.options.className,
3090
3145
  store: this.store,
3091
3146
  onToggleFullscreen: () => this.toggleFullscreen(),
@@ -3093,21 +3148,81 @@ const mt = class mt {
3093
3148
  t && (this.options.onDownload ? this.options.onDownload(t) : window.open(t, "_blank"));
3094
3149
  }
3095
3150
  });
3096
- this.container.appendChild($), this.setupQualityLoading(), this.layoutManager = new ci(g, this.store), this.layoutManager.onResizeCallback = () => {
3151
+ this.container.appendChild($), this.setupQualityLoading(), this.layoutManager = new ui(d, this.store), this.layoutManager.onResizeCallback = () => {
3097
3152
  this.pageFlipAdapter && this.pageFlipAdapter.update();
3098
- }, this.layoutManager.init(f, P), this.pageFlipAdapter = new li(S, this.options, this.store), b.current = this.pageFlipAdapter, await new Promise((T) => {
3153
+ }, this.layoutManager.init(p, x), this.pageFlipAdapter = new di(S, this.options, this.store), b.current = this.pageFlipAdapter, await new Promise((k) => {
3099
3154
  const A = () => {
3100
- r.signal.removeEventListener("abort", A), T();
3155
+ r.signal.removeEventListener("abort", A), k();
3101
3156
  };
3102
- r.signal.addEventListener("abort", A, { once: !0 }), this.initializationTimer = setTimeout(() => {
3157
+ r.signal.addEventListener("abort", A, { once: !0 }), this.initializationTimer = setTimeout(async () => {
3103
3158
  if (this.initializationTimer = null, r.signal.removeEventListener("abort", A), r.signal.aborted || o !== this.initGeneration || !this.pageFlipAdapter) {
3104
- T();
3159
+ k();
3105
3160
  return;
3106
3161
  }
3107
- this.pageFlipAdapter.init(g.width, g.height), this.interactionManager = new di(f, this.pageFlipAdapter, this.store), this.interactionManager.init(), L.current = this.interactionManager, this.eventsReady = !0, this.captureEventState(), this.emit("init", { totalPages: c.length }), T();
3162
+ if (this.pageFlipAdapter.init(d.width, d.height), this.interactionManager = new gi(p, this.pageFlipAdapter, this.store), this.interactionManager.init(), D.current = this.interactionManager, this.setupPdfLazyLoading(), this.pdfRenderer && t)
3163
+ try {
3164
+ await this.renderPdfPage(1, r.signal);
3165
+ } catch {
3166
+ k();
3167
+ return;
3168
+ }
3169
+ if (r.signal.aborted || o !== this.initGeneration) {
3170
+ k();
3171
+ return;
3172
+ }
3173
+ this.eventsReady = !0, this.captureEventState(), this.emit("init", { totalPages: l.length }), k();
3108
3174
  }, 10);
3109
3175
  }), this.initAbortController === r && (this.initAbortController = null);
3110
3176
  }
3177
+ createPdfPlaceholder(t) {
3178
+ const s = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
3179
+ return {
3180
+ index: t - 1,
3181
+ assetId: "pdf-page-" + t,
3182
+ pageNumber: t,
3183
+ cropMode: "full",
3184
+ normal: s,
3185
+ low: s,
3186
+ thumb: s
3187
+ };
3188
+ }
3189
+ renderPdfPage(t, s) {
3190
+ const o = this.pdfRenderer;
3191
+ if (!o) return Promise.resolve("");
3192
+ const r = this.pdfPageRequests.get(t);
3193
+ if (r) return r;
3194
+ if (this.pdfRenderedPages.has(t)) return Promise.resolve("");
3195
+ const l = o.renderPageToDataUrl(t, s).then((d) => {
3196
+ var p;
3197
+ if (!d) throw new Error("PDF page " + t + " produced no image.");
3198
+ return this.pdfRenderedPages.add(t), (p = this.container) == null || p.querySelectorAll('img[data-pdf-page="' + t + '"]').forEach((x) => {
3199
+ x.src = d, delete x.dataset.pdfPage;
3200
+ }), this.emit("progress", {
3201
+ phase: "rendering",
3202
+ completed: this.pdfRenderedPages.size,
3203
+ total: this.store.totalPages.value
3204
+ }), d;
3205
+ }).catch((d) => {
3206
+ throw (d == null ? void 0 : d.name) === "AbortError" || this.emit("error", {
3207
+ code: "PDF_RENDER_FAILED",
3208
+ message: d instanceof Error ? d.message : "Unable to render PDF page.",
3209
+ cause: d
3210
+ }), d;
3211
+ }).finally(() => {
3212
+ this.pdfPageRequests.get(t) === l && this.pdfPageRequests.delete(t);
3213
+ });
3214
+ return this.pdfPageRequests.set(t, l), l;
3215
+ }
3216
+ setupPdfLazyLoading() {
3217
+ var t;
3218
+ (t = this.pdfLazyStop) == null || t.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop = _(() => {
3219
+ const s = this.store.currentPage.value + 1, o = this.store.totalPages.value;
3220
+ [s, s + 1].filter((r) => r <= o).forEach((r) => {
3221
+ this.renderPdfPage(r).catch(() => {
3222
+ });
3223
+ });
3224
+ }));
3225
+ }
3111
3226
  loadImageSize(t) {
3112
3227
  return new Promise((s) => {
3113
3228
  const o = new Image();
@@ -3167,22 +3282,32 @@ const mt = class mt {
3167
3282
  setupQualityLoading() {
3168
3283
  var r;
3169
3284
  if (this.teardownQualityLoading(), !this.container) return;
3170
- const t = Array.from(this.container.querySelectorAll("img[data-src]")), s = (c) => {
3171
- const g = c.dataset.src;
3172
- g && (c.src = g, delete c.dataset.src);
3285
+ const t = Array.from(this.container.querySelectorAll("img[data-src], img[data-pdf-page]")), s = (l) => {
3286
+ const d = Number(l.dataset.pdfPage);
3287
+ if (Number.isInteger(d) && d > 0) {
3288
+ this.renderPdfPage(d).catch(() => {
3289
+ });
3290
+ return;
3291
+ }
3292
+ const p = l.dataset.src;
3293
+ p && (l.src = p, delete l.dataset.src);
3173
3294
  }, o = (r = this.container.ownerDocument.defaultView) == null ? void 0 : r.IntersectionObserver;
3174
3295
  if (!o) {
3175
- t.forEach(s);
3296
+ const l = /* @__PURE__ */ new Set();
3297
+ t.forEach((d) => {
3298
+ const p = Number(d.dataset.pdfPage);
3299
+ Number.isInteger(p) && p > 0 ? l.size < 2 && (l.add(p), s(d)) : s(d);
3300
+ });
3176
3301
  return;
3177
3302
  }
3178
- this.qualityObserver = new o((c) => {
3179
- c.forEach((g) => {
3180
- var f;
3181
- g.isIntersecting && (s(g.target), (f = this.qualityObserver) == null || f.unobserve(g.target));
3303
+ this.qualityObserver = new o((l) => {
3304
+ l.forEach((d) => {
3305
+ var p;
3306
+ d.isIntersecting && (s(d.target), (p = this.qualityObserver) == null || p.unobserve(d.target));
3182
3307
  });
3183
- }, { root: this.container, rootMargin: "240px" }), t.forEach((c) => {
3184
- var g;
3185
- return (g = this.qualityObserver) == null ? void 0 : g.observe(c);
3308
+ }, { root: this.container, rootMargin: "240px" }), t.forEach((l) => {
3309
+ var d;
3310
+ return (d = this.qualityObserver) == null ? void 0 : d.observe(l);
3186
3311
  });
3187
3312
  }
3188
3313
  teardownQualityLoading() {
@@ -3190,7 +3315,7 @@ const mt = class mt {
3190
3315
  (t = this.qualityObserver) == null || t.disconnect(), this.qualityObserver = null;
3191
3316
  }
3192
3317
  setupEventSync() {
3193
- this.eventSyncStop = j(() => {
3318
+ this.eventSyncStop = _(() => {
3194
3319
  const t = {
3195
3320
  currentPage: this.store.currentPage.value,
3196
3321
  zoom: this.store.zoomState.value.scale,
@@ -3222,8 +3347,8 @@ const mt = class mt {
3222
3347
  };
3223
3348
  }
3224
3349
  destroy(t = !1) {
3225
- var s;
3226
- this.initGeneration++, (s = this.initAbortController) == null || s.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(), this.pdfRenderer && this.pdfRenderer.destroy(), this.pageFlipAdapter = null, this.layoutManager = null, this.interactionManager = null, this.pdfRenderer = null, !t && this.container && (this.container.innerHTML = ""), this.emit("destroy", void 0);
3350
+ var s, o;
3351
+ this.initGeneration++, (s = this.initAbortController) == null || s.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(), (o = this.pdfLazyStop) == null || o.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, !t && this.container && (this.container.innerHTML = ""), this.emit("destroy", void 0);
3227
3352
  }
3228
3353
  on(t, s) {
3229
3354
  const o = this.listeners[t] ?? /* @__PURE__ */ new Set();
@@ -3240,14 +3365,14 @@ const mt = class mt {
3240
3365
  });
3241
3366
  }
3242
3367
  };
3243
- v(mt, "DEFAULT_PAGE_VIEWPORT", { width: 420, height: 594 });
3244
- let It = mt;
3368
+ m(mt, "DEFAULT_PAGE_VIEWPORT", { width: 420, height: 594 });
3369
+ let Rt = mt;
3245
3370
  const me = globalThis, we = me.FlipbookEngine || {};
3246
- we.FlipbookEngine = It;
3371
+ we.FlipbookEngine = Rt;
3247
3372
  me.FlipbookEngine = we;
3248
3373
  export {
3249
- It as F,
3250
- gi as i,
3251
- mi as n
3374
+ Rt as F,
3375
+ fi as i,
3376
+ vi as n
3252
3377
  };
3253
- //# sourceMappingURL=engine-G9HiVpA-.js.map
3378
+ //# sourceMappingURL=engine-BuVkDIh-.js.map