flipbookengine 0.2.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +272 -187
- package/THIRD-PARTY-NOTICES.md +56 -0
- package/dist/adapters/PageFlipAdapter.d.ts +5 -1
- package/dist/components/App.d.ts +3 -0
- package/dist/components/NavigationArrows.d.ts +9 -0
- package/dist/components/Thumbnails.d.ts +3 -0
- package/dist/components/Toolbar.d.ts +3 -0
- package/dist/components/Viewer.d.ts +3 -0
- package/dist/core/InteractionManager.d.ts +4 -1
- package/dist/core/LayoutManager.d.ts +19 -1
- package/dist/core/PdfRenderer.d.ts +33 -0
- package/dist/engine-G9HiVpA-.js +3253 -0
- package/dist/engine-G9HiVpA-.js.map +1 -0
- package/dist/engine.d.ts +37 -3
- package/dist/flipbook-engine.css +1 -1
- package/dist/flipbook-engine.iife.js +94 -48
- package/dist/flipbook-engine.iife.js.map +1 -1
- package/dist/flipbook-engine.js +4 -20635
- package/dist/flipbook-engine.js.map +1 -1
- package/dist/flipbook-engine.react.js +44 -29
- package/dist/flipbook-engine.react.js.map +1 -1
- package/dist/flipbook-engine.vue.js +25 -22
- package/dist/flipbook-engine.vue.js.map +1 -1
- package/dist/react/index.d.ts +4 -1
- package/dist/state/store.d.ts +41 -21
- package/dist/theme/theme.d.ts +0 -1
- package/dist/vue/index.d.ts +5 -2
- package/package.json +113 -105
|
@@ -0,0 +1,3253 @@
|
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var Ht = (e) => {
|
|
3
|
+
throw TypeError(e);
|
|
4
|
+
};
|
|
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);
|
|
8
|
+
import * as Bt from "pdfjs-dist";
|
|
9
|
+
var be = Symbol.for("preact-signals");
|
|
10
|
+
function Rt() {
|
|
11
|
+
if (U > 1)
|
|
12
|
+
U--;
|
|
13
|
+
else {
|
|
14
|
+
var e, t = !1;
|
|
15
|
+
for (function() {
|
|
16
|
+
var r = ct;
|
|
17
|
+
for (ct = void 0; r !== void 0; )
|
|
18
|
+
r.S.v === r.v && (r.S.i = r.i), r = r.o;
|
|
19
|
+
}(); tt !== void 0; ) {
|
|
20
|
+
var s = tt;
|
|
21
|
+
for (tt = void 0, lt++; s !== void 0; ) {
|
|
22
|
+
var o = s.u;
|
|
23
|
+
if (s.u = void 0, s.f &= -3, !(8 & s.f) && ee(s)) try {
|
|
24
|
+
s.c();
|
|
25
|
+
} catch (r) {
|
|
26
|
+
t || (e = r, t = !0);
|
|
27
|
+
}
|
|
28
|
+
s = o;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (lt = 0, U--, t) throw e;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
var k = void 0;
|
|
35
|
+
function wt(e) {
|
|
36
|
+
var t = k;
|
|
37
|
+
k = void 0;
|
|
38
|
+
try {
|
|
39
|
+
return e();
|
|
40
|
+
} finally {
|
|
41
|
+
k = t;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var tt = void 0, U = 0, lt = 0, _t = 0, ct = void 0, dt = 0;
|
|
45
|
+
function te(e) {
|
|
46
|
+
if (k !== void 0) {
|
|
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;
|
|
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;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function I(e, t) {
|
|
55
|
+
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
|
|
56
|
+
}
|
|
57
|
+
I.prototype.brand = be;
|
|
58
|
+
I.prototype.h = function() {
|
|
59
|
+
return !0;
|
|
60
|
+
};
|
|
61
|
+
I.prototype.S = function(e) {
|
|
62
|
+
var t = this, s = this.t;
|
|
63
|
+
s !== e && e.e === void 0 && (e.x = s, this.t = e, s !== void 0 ? s.e = e : wt(function() {
|
|
64
|
+
var o;
|
|
65
|
+
(o = t.W) == null || o.call(t);
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
I.prototype.U = function(e) {
|
|
69
|
+
var t = this;
|
|
70
|
+
if (this.t !== void 0) {
|
|
71
|
+
var s = e.e, o = e.x;
|
|
72
|
+
s !== void 0 && (s.x = o, e.e = void 0), o !== void 0 && (o.e = s, e.x = void 0), e === this.t && (this.t = o, o === void 0 && wt(function() {
|
|
73
|
+
var r;
|
|
74
|
+
(r = t.Z) == null || r.call(t);
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
I.prototype.subscribe = function(e) {
|
|
79
|
+
var t = this;
|
|
80
|
+
return j(function() {
|
|
81
|
+
var s = t.value;
|
|
82
|
+
wt(function() {
|
|
83
|
+
return e(s);
|
|
84
|
+
});
|
|
85
|
+
}, { name: "sub" });
|
|
86
|
+
};
|
|
87
|
+
I.prototype.valueOf = function() {
|
|
88
|
+
return this.value;
|
|
89
|
+
};
|
|
90
|
+
I.prototype.toString = function() {
|
|
91
|
+
return this.value + "";
|
|
92
|
+
};
|
|
93
|
+
I.prototype.toJSON = function() {
|
|
94
|
+
return this.value;
|
|
95
|
+
};
|
|
96
|
+
I.prototype.peek = function() {
|
|
97
|
+
var e = this;
|
|
98
|
+
return wt(function() {
|
|
99
|
+
return e.value;
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
Object.defineProperty(I.prototype, "value", { get: function() {
|
|
103
|
+
var e = te(this);
|
|
104
|
+
return e !== void 0 && (e.i = this.i), this.v;
|
|
105
|
+
}, set: function(e) {
|
|
106
|
+
if (e !== this.v) {
|
|
107
|
+
if (lt > 100) throw new Error("Cycle detected");
|
|
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++;
|
|
111
|
+
try {
|
|
112
|
+
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
113
|
+
} finally {
|
|
114
|
+
Rt();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} });
|
|
118
|
+
function M(e, t) {
|
|
119
|
+
return new I(e, t);
|
|
120
|
+
}
|
|
121
|
+
function ee(e) {
|
|
122
|
+
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
123
|
+
return !1;
|
|
124
|
+
}
|
|
125
|
+
function ie(e) {
|
|
126
|
+
for (var t = e.s; t !== void 0; t = t.n) {
|
|
127
|
+
var s = t.S.n;
|
|
128
|
+
if (s !== void 0 && (t.r = s), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
129
|
+
e.s = t;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function se(e) {
|
|
135
|
+
for (var t = e.s, s = void 0; t !== void 0; ) {
|
|
136
|
+
var o = t.p;
|
|
137
|
+
t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : s = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
|
|
138
|
+
}
|
|
139
|
+
e.s = s;
|
|
140
|
+
}
|
|
141
|
+
function X(e, t) {
|
|
142
|
+
I.call(this, void 0, t), this.x = e, this.s = void 0, this.g = dt - 1, this.f = 4;
|
|
143
|
+
}
|
|
144
|
+
X.prototype = new I();
|
|
145
|
+
X.prototype.h = function() {
|
|
146
|
+
if (this.f &= -3, 1 & this.f) return !1;
|
|
147
|
+
if ((36 & this.f) == 32 || (this.f &= -5, this.g === dt)) return !0;
|
|
148
|
+
if (this.g = dt, this.f |= 1, this.i > 0 && !ee(this))
|
|
149
|
+
return this.f &= -2, !0;
|
|
150
|
+
var e = k;
|
|
151
|
+
try {
|
|
152
|
+
ie(this), k = this;
|
|
153
|
+
var t = this.x();
|
|
154
|
+
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
155
|
+
} catch (s) {
|
|
156
|
+
this.v = s, this.f |= 16, this.i++;
|
|
157
|
+
}
|
|
158
|
+
return k = e, se(this), this.f &= -2, !0;
|
|
159
|
+
};
|
|
160
|
+
X.prototype.S = function(e) {
|
|
161
|
+
if (this.t === void 0) {
|
|
162
|
+
this.f |= 36;
|
|
163
|
+
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
164
|
+
}
|
|
165
|
+
I.prototype.S.call(this, e);
|
|
166
|
+
};
|
|
167
|
+
X.prototype.U = function(e) {
|
|
168
|
+
if (this.t !== void 0 && (I.prototype.U.call(this, e), this.t === void 0)) {
|
|
169
|
+
this.f &= -33;
|
|
170
|
+
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
X.prototype.N = function() {
|
|
174
|
+
if (!(2 & this.f)) {
|
|
175
|
+
this.f |= 6;
|
|
176
|
+
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
Object.defineProperty(X.prototype, "value", { get: function() {
|
|
180
|
+
if (1 & this.f) throw new Error("Cycle detected");
|
|
181
|
+
var e = te(this);
|
|
182
|
+
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
|
|
183
|
+
return this.v;
|
|
184
|
+
} });
|
|
185
|
+
function m(e, t) {
|
|
186
|
+
return new X(e, t);
|
|
187
|
+
}
|
|
188
|
+
function ne(e) {
|
|
189
|
+
var t = e.m;
|
|
190
|
+
if (e.m = void 0, typeof t == "function") {
|
|
191
|
+
U++;
|
|
192
|
+
var s = k;
|
|
193
|
+
k = void 0;
|
|
194
|
+
try {
|
|
195
|
+
t();
|
|
196
|
+
} catch (o) {
|
|
197
|
+
throw e.f &= -2, e.f |= 8, Lt(e), o;
|
|
198
|
+
} finally {
|
|
199
|
+
k = s, Rt();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function Lt(e) {
|
|
204
|
+
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
|
|
205
|
+
e.x = void 0, e.s = void 0, ne(e);
|
|
206
|
+
}
|
|
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();
|
|
210
|
+
}
|
|
211
|
+
function q(e, t) {
|
|
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
|
+
}
|
|
214
|
+
q.prototype.c = function() {
|
|
215
|
+
var e = this.S();
|
|
216
|
+
try {
|
|
217
|
+
if (8 & this.f || this.x === void 0) return;
|
|
218
|
+
var t = this.x();
|
|
219
|
+
typeof t == "function" && (this.m = t);
|
|
220
|
+
} finally {
|
|
221
|
+
e();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
q.prototype.S = function() {
|
|
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);
|
|
229
|
+
};
|
|
230
|
+
q.prototype.N = function() {
|
|
231
|
+
2 & this.f || (this.f |= 2, this.u = tt, tt = this);
|
|
232
|
+
};
|
|
233
|
+
q.prototype.d = function() {
|
|
234
|
+
this.f |= 8, 1 & this.f || Lt(this);
|
|
235
|
+
};
|
|
236
|
+
q.prototype.dispose = function() {
|
|
237
|
+
this.d();
|
|
238
|
+
};
|
|
239
|
+
function j(e, t) {
|
|
240
|
+
var s = new q(e, t);
|
|
241
|
+
try {
|
|
242
|
+
s.c();
|
|
243
|
+
} catch (r) {
|
|
244
|
+
throw s.d(), r;
|
|
245
|
+
}
|
|
246
|
+
var o = s.d.bind(s);
|
|
247
|
+
return o[Symbol.dispose] = o, o;
|
|
248
|
+
}
|
|
249
|
+
var oe = /* @__PURE__ */ Symbol.for("Serenity.initPropHook");
|
|
250
|
+
function Se(e) {
|
|
251
|
+
return !!(e && typeof e.nodeType == "number");
|
|
252
|
+
}
|
|
253
|
+
function vt(e) {
|
|
254
|
+
return typeof e == "string";
|
|
255
|
+
}
|
|
256
|
+
function re(e) {
|
|
257
|
+
return typeof e == "number";
|
|
258
|
+
}
|
|
259
|
+
function z(e) {
|
|
260
|
+
return typeof e == "object" && e !== null;
|
|
261
|
+
}
|
|
262
|
+
function Pe(e) {
|
|
263
|
+
return !!(e && e.isComponent);
|
|
264
|
+
}
|
|
265
|
+
function zt(e) {
|
|
266
|
+
return z(e) && typeof e.length == "number" && typeof e.nodeType != "number";
|
|
267
|
+
}
|
|
268
|
+
function ke(e) {
|
|
269
|
+
return typeof e == "function" && typeof e[oe] == "function";
|
|
270
|
+
}
|
|
271
|
+
function it(e) {
|
|
272
|
+
return e != null && typeof e != "boolean";
|
|
273
|
+
}
|
|
274
|
+
function st(e) {
|
|
275
|
+
return Array.isArray(e) ? e.map(st).filter(Boolean).join(" ") : z(e) ? Symbol.iterator in e ? st(Array.from(e)) : Object.keys(e).filter((t) => e[t]).join(" ") : it(e) ? "" + e : "";
|
|
276
|
+
}
|
|
277
|
+
function Ce(e) {
|
|
278
|
+
return e != null && typeof e == "object" && "current" in e;
|
|
279
|
+
}
|
|
280
|
+
function Ft(e, t) {
|
|
281
|
+
Ce(e) ? e.current = t : typeof e == "function" && e(t);
|
|
282
|
+
}
|
|
283
|
+
function Te(e, t, s) {
|
|
284
|
+
t = { ...t, children: s };
|
|
285
|
+
const o = new e(t), r = o.render();
|
|
286
|
+
return "ref" in t && Ft(t.ref, o), r;
|
|
287
|
+
}
|
|
288
|
+
var Ae = "http://www.w3.org/1998/Math/MathML", Ee = /* @__PURE__ */ new Set(["math", "annotation", "annotation-xml", "maction", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics", "menclose", "mfenced"]), Me = /* @__PURE__ */ new Set([
|
|
289
|
+
// "a",
|
|
290
|
+
"animate",
|
|
291
|
+
"animateMotion",
|
|
292
|
+
"animateTransform",
|
|
293
|
+
"circle",
|
|
294
|
+
"clipPath",
|
|
295
|
+
"defs",
|
|
296
|
+
"desc",
|
|
297
|
+
"ellipse",
|
|
298
|
+
"feBlend",
|
|
299
|
+
"feColorMatrix",
|
|
300
|
+
"feComponentTransfer",
|
|
301
|
+
"feComposite",
|
|
302
|
+
"feConvolveMatrix",
|
|
303
|
+
"feDiffuseLighting",
|
|
304
|
+
"feDisplacementMap",
|
|
305
|
+
"feDistantLight",
|
|
306
|
+
"feDropShadow",
|
|
307
|
+
"feFlood",
|
|
308
|
+
"feFuncA",
|
|
309
|
+
"feFuncB",
|
|
310
|
+
"feFuncG",
|
|
311
|
+
"feFuncR",
|
|
312
|
+
"feGaussianBlur",
|
|
313
|
+
"feImage",
|
|
314
|
+
"feMerge",
|
|
315
|
+
"feMergeNode",
|
|
316
|
+
"feMorphology",
|
|
317
|
+
"feOffset",
|
|
318
|
+
"fePointLight",
|
|
319
|
+
"feSpecularLighting",
|
|
320
|
+
"feSpotLight",
|
|
321
|
+
"feTile",
|
|
322
|
+
"feTurbulence",
|
|
323
|
+
"filter",
|
|
324
|
+
"foreignObject",
|
|
325
|
+
"g",
|
|
326
|
+
"image",
|
|
327
|
+
"line",
|
|
328
|
+
"linearGradient",
|
|
329
|
+
"marker",
|
|
330
|
+
"mask",
|
|
331
|
+
"metadata",
|
|
332
|
+
"mpath",
|
|
333
|
+
"path",
|
|
334
|
+
"pattern",
|
|
335
|
+
"polygon",
|
|
336
|
+
"polyline",
|
|
337
|
+
"radialGradient",
|
|
338
|
+
"rect",
|
|
339
|
+
// "script",
|
|
340
|
+
"set",
|
|
341
|
+
"stop",
|
|
342
|
+
// "style",
|
|
343
|
+
"svg",
|
|
344
|
+
"switch",
|
|
345
|
+
"symbol",
|
|
346
|
+
"text",
|
|
347
|
+
"textPath",
|
|
348
|
+
// "title",
|
|
349
|
+
"tref",
|
|
350
|
+
"tspan",
|
|
351
|
+
"use",
|
|
352
|
+
"view"
|
|
353
|
+
]), Gt = /^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/, De = "http://www.w3.org/2000/svg", Ut = /* @__PURE__ */ Symbol.for("Serenity.jsxNamespaceURI");
|
|
354
|
+
function Ie(e) {
|
|
355
|
+
const t = globalThis[Ut];
|
|
356
|
+
return arguments.length && (globalThis[Ut] = e), t;
|
|
357
|
+
}
|
|
358
|
+
var Re = /* @__PURE__ */ Symbol.for("Serenity.jsxTypeKey"), Le = "ShadowRoot";
|
|
359
|
+
function ze(e) {
|
|
360
|
+
return e != null && e[Re] === Le;
|
|
361
|
+
}
|
|
362
|
+
var bt = /* @__PURE__ */ Symbol.for("Serenity.disposingListeners"), xt = /* @__PURE__ */ Symbol.for("Serenity.lifecycleRoot");
|
|
363
|
+
function Ot() {
|
|
364
|
+
return globalThis[bt] || (globalThis[bt] = /* @__PURE__ */ new WeakMap());
|
|
365
|
+
}
|
|
366
|
+
function Wt(e) {
|
|
367
|
+
e && e.target && (!e.currentTarget || e.currentTarget === e.target) && Fe(e == null ? void 0 : e.target);
|
|
368
|
+
}
|
|
369
|
+
function Fe(e, t) {
|
|
370
|
+
if (!e)
|
|
371
|
+
return;
|
|
372
|
+
const s = Ot();
|
|
373
|
+
function o(r) {
|
|
374
|
+
const c = s.get(r);
|
|
375
|
+
if (c) {
|
|
376
|
+
s.delete(r), r.removeEventListener("disposing", Wt);
|
|
377
|
+
for (const g of c)
|
|
378
|
+
try {
|
|
379
|
+
g.callback(r);
|
|
380
|
+
} catch {
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
o(e);
|
|
385
|
+
}
|
|
386
|
+
function Ct(e, t, s) {
|
|
387
|
+
if (!e || !t)
|
|
388
|
+
return e;
|
|
389
|
+
const o = Ot();
|
|
390
|
+
let r = o.get(e);
|
|
391
|
+
if (!r)
|
|
392
|
+
return typeof e.addEventListener != "function" || (o.set(e, r = [{
|
|
393
|
+
callback: t,
|
|
394
|
+
regKey: s
|
|
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);
|
|
398
|
+
}
|
|
399
|
+
function jt(e, t, s) {
|
|
400
|
+
if (!e || !t)
|
|
401
|
+
return e;
|
|
402
|
+
const o = Ot(), r = o.get(e);
|
|
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);
|
|
407
|
+
}
|
|
408
|
+
r.length === 0 && (o.delete(e), typeof e.removeEventListener == "function" && e.removeEventListener("disposing", Wt));
|
|
409
|
+
}
|
|
410
|
+
return e;
|
|
411
|
+
}
|
|
412
|
+
function Oe(...e) {
|
|
413
|
+
if (e.length > 0) {
|
|
414
|
+
const t = globalThis[xt] || null;
|
|
415
|
+
return globalThis[xt] = e[0] || null, t;
|
|
416
|
+
}
|
|
417
|
+
return globalThis[xt] || null;
|
|
418
|
+
}
|
|
419
|
+
function Z(e) {
|
|
420
|
+
return e != null && typeof e == "object" && typeof e.subscribe == "function" && typeof e.peek == "function" && "value" in e;
|
|
421
|
+
}
|
|
422
|
+
var ot, O, _, Tt, At, Jt, We = (Jt = class {
|
|
423
|
+
constructor(e, t, s) {
|
|
424
|
+
rt(this, _);
|
|
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);
|
|
428
|
+
}
|
|
429
|
+
get lifecycleNode() {
|
|
430
|
+
return B(this, O);
|
|
431
|
+
}
|
|
432
|
+
get effectDisposer() {
|
|
433
|
+
return B(this, ot);
|
|
434
|
+
}
|
|
435
|
+
set effectDisposer(e) {
|
|
436
|
+
J(this, _, Tt).call(this), at(this, ot, e), J(this, _, At).call(this);
|
|
437
|
+
}
|
|
438
|
+
set lifecycleNode(e) {
|
|
439
|
+
e !== B(this, O) && (J(this, _, Tt).call(this), at(this, O, e), J(this, _, At).call(this));
|
|
440
|
+
}
|
|
441
|
+
}, ot = new WeakMap(), O = new WeakMap(), _ = new WeakSet(), Tt = function() {
|
|
442
|
+
var e;
|
|
443
|
+
jt(B(this, O), this.effectDisposer), jt(B(this, O), (e = this.signal) == null ? void 0 : e.derivedDisposer);
|
|
444
|
+
}, At = function() {
|
|
445
|
+
var e;
|
|
446
|
+
Ct(B(this, O), this.effectDisposer), Ct(B(this, O), (e = this.signal) == null ? void 0 : e.derivedDisposer);
|
|
447
|
+
}, Jt);
|
|
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;
|
|
451
|
+
try {
|
|
452
|
+
t(r);
|
|
453
|
+
} finally {
|
|
454
|
+
r.prevValue = r.newValue, r.isInitial = !1;
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
return c && !r.effectDisposer && (r.effectDisposer = c), r.effectDisposer;
|
|
458
|
+
}
|
|
459
|
+
function Vt(e, t) {
|
|
460
|
+
e instanceof window.HTMLTemplateElement ? e.content.appendChild(t) : e.appendChild(t);
|
|
461
|
+
}
|
|
462
|
+
var St = 0, Et = "__domwisefrag_";
|
|
463
|
+
function ae(e) {
|
|
464
|
+
return e instanceof Comment && e.data.startsWith(Et);
|
|
465
|
+
}
|
|
466
|
+
function Zt(e) {
|
|
467
|
+
return e instanceof DocumentFragment && ae(e.firstChild);
|
|
468
|
+
}
|
|
469
|
+
function $e(e, t) {
|
|
470
|
+
var s;
|
|
471
|
+
typeof e.replaceWith == "function" ? e.replaceWith(t) : (s = e.parentNode) == null || s.replaceChild(t, e);
|
|
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("");
|
|
475
|
+
}
|
|
476
|
+
function Ne(e, t) {
|
|
477
|
+
let s;
|
|
478
|
+
nt(t, (o) => {
|
|
479
|
+
var g;
|
|
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;
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
if (!o.hasChanged)
|
|
487
|
+
return;
|
|
488
|
+
const r = Xt(o.newValue);
|
|
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)); )
|
|
492
|
+
;
|
|
493
|
+
}
|
|
494
|
+
let c = Zt(r) ? r.firstChild : r;
|
|
495
|
+
$e(s, r), o.lifecycleNode = (s = c) ?? e;
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function ut(e, t) {
|
|
499
|
+
if (it(t))
|
|
500
|
+
if (zt(t))
|
|
501
|
+
for (const s of [...t])
|
|
502
|
+
ut(e, s);
|
|
503
|
+
else if (vt(t) || re(t))
|
|
504
|
+
Vt(e, document.createTextNode(t));
|
|
505
|
+
else if (Se(t))
|
|
506
|
+
Vt(e, t);
|
|
507
|
+
else if (ze(t)) {
|
|
508
|
+
const s = e.attachShadow(t.attr);
|
|
509
|
+
ut(s, t.children), Ft(t.ref, s);
|
|
510
|
+
} else Z(t) && Ne(e, t);
|
|
511
|
+
}
|
|
512
|
+
function he(e) {
|
|
513
|
+
return e == null || (zt(e) ? e = Array.from(e).map((t) => Z(t) ? t.peek() : t) : z(e) && (e = { ...e }, Object.entries(e).forEach(([t, s]) => {
|
|
514
|
+
Z(s) && (e[t] = s.peek());
|
|
515
|
+
}))), e;
|
|
516
|
+
}
|
|
517
|
+
function He(e, t) {
|
|
518
|
+
if (t == null || t === !1 || t === !0)
|
|
519
|
+
return;
|
|
520
|
+
t = he(t);
|
|
521
|
+
const s = (st(t) ?? "").split(" ");
|
|
522
|
+
for (let o of s)
|
|
523
|
+
o && e.classList.remove(o);
|
|
524
|
+
}
|
|
525
|
+
function Be(e, t, s) {
|
|
526
|
+
if (t == null || t === !1) {
|
|
527
|
+
He(e, s);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
s = he(s), zt(t) ? t = Array.from(t).map((o) => {
|
|
531
|
+
let r = o;
|
|
532
|
+
return Z(o) && nt(o, (c) => {
|
|
533
|
+
if (c.isInitial) {
|
|
534
|
+
r = c.newValue;
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
Pt(e, c.newValue, c.prevValue);
|
|
538
|
+
}, {
|
|
539
|
+
lifecycleNode: e
|
|
540
|
+
}), r;
|
|
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;
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
Pt(e, !!c.newValue && o, !!c.prevValue && o);
|
|
548
|
+
}, {
|
|
549
|
+
lifecycleNode: e
|
|
550
|
+
});
|
|
551
|
+
})), Pt(e, t, s);
|
|
552
|
+
}
|
|
553
|
+
function Pt(e, t, s) {
|
|
554
|
+
const o = (st(t) ?? "").split(" ");
|
|
555
|
+
if (s) {
|
|
556
|
+
const r = (st(s) ?? "").split(" ");
|
|
557
|
+
for (let c of r)
|
|
558
|
+
c && !o.includes(c) && e.classList.remove(c);
|
|
559
|
+
}
|
|
560
|
+
for (let r of o)
|
|
561
|
+
r && e.classList.add(r);
|
|
562
|
+
}
|
|
563
|
+
function _e(e, t) {
|
|
564
|
+
return e + t.charAt(0).toUpperCase() + t.substring(1);
|
|
565
|
+
}
|
|
566
|
+
var Ge = /* @__PURE__ */ (() => {
|
|
567
|
+
let e = {
|
|
568
|
+
animationIterationCount: 0,
|
|
569
|
+
borderImageOutset: 0,
|
|
570
|
+
borderImageSlice: 0,
|
|
571
|
+
borderImageWidth: 0,
|
|
572
|
+
boxFlex: 0,
|
|
573
|
+
boxFlexGroup: 0,
|
|
574
|
+
boxOrdinalGroup: 0,
|
|
575
|
+
columnCount: 0,
|
|
576
|
+
columns: 0,
|
|
577
|
+
flex: 0,
|
|
578
|
+
flexGrow: 0,
|
|
579
|
+
flexPositive: 0,
|
|
580
|
+
flexShrink: 0,
|
|
581
|
+
flexNegative: 0,
|
|
582
|
+
flexOrder: 0,
|
|
583
|
+
gridArea: 0,
|
|
584
|
+
gridRow: 0,
|
|
585
|
+
gridRowEnd: 0,
|
|
586
|
+
gridRowSpan: 0,
|
|
587
|
+
gridRowStart: 0,
|
|
588
|
+
gridColumn: 0,
|
|
589
|
+
gridColumnEnd: 0,
|
|
590
|
+
gridColumnSpan: 0,
|
|
591
|
+
gridColumnStart: 0,
|
|
592
|
+
fontWeight: 0,
|
|
593
|
+
lineClamp: 0,
|
|
594
|
+
lineHeight: 0,
|
|
595
|
+
opacity: 0,
|
|
596
|
+
order: 0,
|
|
597
|
+
orphans: 0,
|
|
598
|
+
tabSize: 0,
|
|
599
|
+
widows: 0,
|
|
600
|
+
zIndex: 0,
|
|
601
|
+
zoom: 0,
|
|
602
|
+
// SVG-related properties
|
|
603
|
+
fillOpacity: 0,
|
|
604
|
+
floodOpacity: 0,
|
|
605
|
+
stopOpacity: 0,
|
|
606
|
+
strokeDasharray: 0,
|
|
607
|
+
strokeDashoffset: 0,
|
|
608
|
+
strokeMiterlimit: 0,
|
|
609
|
+
strokeOpacity: 0,
|
|
610
|
+
strokeWidth: 0
|
|
611
|
+
};
|
|
612
|
+
const t = ["Webkit", "ms", "Moz", "O"];
|
|
613
|
+
return Object.keys(e).forEach((s) => {
|
|
614
|
+
t.forEach((o) => {
|
|
615
|
+
e[_e(o, s)] = 0;
|
|
616
|
+
});
|
|
617
|
+
}), e;
|
|
618
|
+
})();
|
|
619
|
+
function Mt(e, t, s) {
|
|
620
|
+
t.indexOf("-") === 0 ? e.style.setProperty(t, s) : re(s) && Ge[t] !== 0 ? e.style[t] = s + "px" : e.style[t] = s;
|
|
621
|
+
}
|
|
622
|
+
function qt(e, t) {
|
|
623
|
+
if (!(t == null || t === !1 || t === !0)) {
|
|
624
|
+
if (vt(t)) {
|
|
625
|
+
e.removeAttribute("style");
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
z(t) && Object.keys(t).forEach((s) => {
|
|
629
|
+
Mt(e, s, "");
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function Ue(e, t, s) {
|
|
634
|
+
if (t == null || t === !1 || t === !0) {
|
|
635
|
+
qt(e, s);
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (vt(t)) {
|
|
639
|
+
e.setAttribute("style", t);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
if (z(t)) {
|
|
643
|
+
z(s) ? (t = { ...t }, Object.keys(s).forEach((o) => {
|
|
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), {
|
|
647
|
+
lifecycleNode: e
|
|
648
|
+
}) : Mt(e, o, r);
|
|
649
|
+
});
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
var je = "http://www.w3.org/1999/xlink", Ve = "http://www.w3.org/XML/1998/namespace";
|
|
654
|
+
function ht(e, t) {
|
|
655
|
+
return e.replace(/[A-Z]/g, (s) => t + s.toLowerCase());
|
|
656
|
+
}
|
|
657
|
+
var Ze = /* @__PURE__ */ new Map([
|
|
658
|
+
["autoComplete", "autocomplete"],
|
|
659
|
+
["autoFocus", "autofocus"],
|
|
660
|
+
["className", "class"],
|
|
661
|
+
["colSpan", "colspan"],
|
|
662
|
+
["contentEditable", "contenteditable"],
|
|
663
|
+
["formNoValidate", "formnovalidate"],
|
|
664
|
+
["htmlFor", "for"],
|
|
665
|
+
["innerText", "textContent"],
|
|
666
|
+
["minLength", "minlength"],
|
|
667
|
+
["maxLength", "maxlength"],
|
|
668
|
+
["readOnly", "readonly"],
|
|
669
|
+
["reffererPolicy", "referrerpolicy"],
|
|
670
|
+
["rowSpan", "rowspan"],
|
|
671
|
+
["spellCheck", "spellcheck"],
|
|
672
|
+
["tabIndex", "tabindex"],
|
|
673
|
+
["onDoubleClick", "onDblClick"],
|
|
674
|
+
["onDoubleClickCapture", "onDblClickCapture"]
|
|
675
|
+
]);
|
|
676
|
+
function Yt(e, t, s, o) {
|
|
677
|
+
switch (t) {
|
|
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);
|
|
683
|
+
});
|
|
684
|
+
return;
|
|
685
|
+
case "textContent":
|
|
686
|
+
it(s) ? e[t] = s : it(o) && (e[t] = "");
|
|
687
|
+
return;
|
|
688
|
+
case "dangerouslySetInnerHTML":
|
|
689
|
+
z(s) ? e.innerHTML = s.__html : z(o) && (e.innerHTML = "");
|
|
690
|
+
return;
|
|
691
|
+
case "value":
|
|
692
|
+
if (s == null) {
|
|
693
|
+
o != null && (e[t] = null);
|
|
694
|
+
return;
|
|
695
|
+
} else {
|
|
696
|
+
if (e instanceof window.HTMLSelectElement)
|
|
697
|
+
return;
|
|
698
|
+
if (e instanceof window.HTMLTextAreaElement) {
|
|
699
|
+
e.value = s;
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
break;
|
|
704
|
+
case "class":
|
|
705
|
+
Be(e, s, o);
|
|
706
|
+
return;
|
|
707
|
+
case "spellcheck":
|
|
708
|
+
e.spellcheck = s === "" || s === !0 || s === "true" ? !0 : s === !1 || s === "false" ? !1 : s;
|
|
709
|
+
return;
|
|
710
|
+
case "draggable":
|
|
711
|
+
s === !1 || s === "false" ? s = "false" : s === "" ? s = null : (s === !0 || s === "true") && (s = "true");
|
|
712
|
+
break;
|
|
713
|
+
case "contenteditable":
|
|
714
|
+
s === !1 ? s = "false" : (s === "" || s === !0) && (s = "true");
|
|
715
|
+
break;
|
|
716
|
+
case "ref":
|
|
717
|
+
case "namespaceURI":
|
|
718
|
+
return;
|
|
719
|
+
case "style":
|
|
720
|
+
Ue(e, s, o);
|
|
721
|
+
return;
|
|
722
|
+
case "on":
|
|
723
|
+
case "onCapture":
|
|
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);
|
|
729
|
+
});
|
|
730
|
+
return;
|
|
731
|
+
case "xlinkActuate":
|
|
732
|
+
case "xlinkArcrole":
|
|
733
|
+
case "xlinkHref":
|
|
734
|
+
case "xlinkRole":
|
|
735
|
+
case "xlinkShow":
|
|
736
|
+
case "xlinkTitle":
|
|
737
|
+
case "xlinkType":
|
|
738
|
+
e.setAttributeNS(je, ht(t, ":"), s);
|
|
739
|
+
return;
|
|
740
|
+
case "xmlnsXlink":
|
|
741
|
+
e.setAttribute("xmlns:xlink", s);
|
|
742
|
+
return;
|
|
743
|
+
case "xmlBase":
|
|
744
|
+
case "xmlLang":
|
|
745
|
+
case "xmlSpace":
|
|
746
|
+
e.setAttributeNS(Ve, ht(t, ":"), s);
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
if (typeof s == "function") {
|
|
750
|
+
if (t[0] === "o" && t[1] === "n") {
|
|
751
|
+
if (o != null && o === s)
|
|
752
|
+
return;
|
|
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));
|
|
757
|
+
} else
|
|
758
|
+
console.warn(`A function was provided for JSX ${e.tagName} element ${t} which does not start with "on":`, s, e.tagName);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (z(o)) {
|
|
762
|
+
if (o === s)
|
|
763
|
+
return;
|
|
764
|
+
delete e[t];
|
|
765
|
+
}
|
|
766
|
+
if (o === !0) {
|
|
767
|
+
if (o === s)
|
|
768
|
+
return;
|
|
769
|
+
e.removeAttribute(t);
|
|
770
|
+
}
|
|
771
|
+
if (o !== !1 && o != null) {
|
|
772
|
+
if (o === s)
|
|
773
|
+
return;
|
|
774
|
+
e instanceof SVGElement && !Gt.test(t) ? e.removeAttributeNS(ht(t, "-"), s) : e.removeAttribute(t);
|
|
775
|
+
}
|
|
776
|
+
if (z(s)) {
|
|
777
|
+
e[t] = s;
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
if (s === !0) {
|
|
781
|
+
e.setAttribute(t, "");
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
s !== !1 && s != null && (e instanceof SVGElement && !Gt.test(t) ? e.setAttribute(ht(t, "-"), s) : e.setAttribute(t, s));
|
|
785
|
+
}
|
|
786
|
+
function Xe(e, t) {
|
|
787
|
+
for (let [s, o] of Object.entries(t))
|
|
788
|
+
s = Ze.get(s) ?? s, Z(o) ? nt(o, (r) => Yt(e, s, r.newValue, r.prevValue), {
|
|
789
|
+
lifecycleNode: e
|
|
790
|
+
}) : ke(o) ? o[oe](e, s) : Yt(e, s, o);
|
|
791
|
+
return e;
|
|
792
|
+
}
|
|
793
|
+
function qe(e) {
|
|
794
|
+
this[e] = null;
|
|
795
|
+
}
|
|
796
|
+
function u(e, t) {
|
|
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;
|
|
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)
|
|
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));
|
|
805
|
+
} else
|
|
806
|
+
c.value = o.value;
|
|
807
|
+
Ft(o.ref, c);
|
|
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 });
|
|
810
|
+
else
|
|
811
|
+
throw new TypeError(`Invalid JSX element type: ${e}`);
|
|
812
|
+
return c;
|
|
813
|
+
}
|
|
814
|
+
var Ye = /* @__PURE__ */ Symbol.for("preact-signals");
|
|
815
|
+
function $t() {
|
|
816
|
+
if (V > 1)
|
|
817
|
+
V--;
|
|
818
|
+
else {
|
|
819
|
+
var e, t = !1;
|
|
820
|
+
for (function() {
|
|
821
|
+
var r = pt;
|
|
822
|
+
for (pt = void 0; r !== void 0; )
|
|
823
|
+
r.S.v === r.v && (r.S.i = r.i), r = r.o;
|
|
824
|
+
}(); et !== void 0; ) {
|
|
825
|
+
var s = et;
|
|
826
|
+
for (et = void 0, gt++; s !== void 0; ) {
|
|
827
|
+
var o = s.u;
|
|
828
|
+
if (s.u = void 0, s.f &= -3, !(8 & s.f) && de(s)) try {
|
|
829
|
+
s.c();
|
|
830
|
+
} catch (r) {
|
|
831
|
+
t || (e = r, t = !0);
|
|
832
|
+
}
|
|
833
|
+
s = o;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (gt = 0, V--, t) throw e;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
var x = void 0;
|
|
840
|
+
function le(e) {
|
|
841
|
+
var t = x;
|
|
842
|
+
x = void 0;
|
|
843
|
+
try {
|
|
844
|
+
return e();
|
|
845
|
+
} finally {
|
|
846
|
+
x = t;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
var et = void 0, V = 0, gt = 0, Qt = 0, pt = void 0, ft = 0;
|
|
850
|
+
function ce(e) {
|
|
851
|
+
if (x !== void 0) {
|
|
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;
|
|
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;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function R(e, t) {
|
|
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
|
+
}
|
|
862
|
+
R.prototype.brand = Ye;
|
|
863
|
+
R.prototype.h = function() {
|
|
864
|
+
return !0;
|
|
865
|
+
};
|
|
866
|
+
R.prototype.S = function(e) {
|
|
867
|
+
var t = this, s = this.t;
|
|
868
|
+
s !== e && e.e === void 0 && (e.x = s, this.t = e, s !== void 0 ? s.e = e : le(function() {
|
|
869
|
+
var o;
|
|
870
|
+
(o = t.W) == null || o.call(t);
|
|
871
|
+
}));
|
|
872
|
+
};
|
|
873
|
+
R.prototype.U = function(e) {
|
|
874
|
+
var t = this;
|
|
875
|
+
if (this.t !== void 0) {
|
|
876
|
+
var s = e.e, o = e.x;
|
|
877
|
+
s !== void 0 && (s.x = o, e.e = void 0), o !== void 0 && (o.e = s, e.x = void 0), e === this.t && (this.t = o, o === void 0 && le(function() {
|
|
878
|
+
var r;
|
|
879
|
+
(r = t.Z) == null || r.call(t);
|
|
880
|
+
}));
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
R.prototype.subscribe = function(e) {
|
|
884
|
+
var t = this;
|
|
885
|
+
return Ke(function() {
|
|
886
|
+
var s = t.value, o = x;
|
|
887
|
+
x = void 0;
|
|
888
|
+
try {
|
|
889
|
+
e(s);
|
|
890
|
+
} finally {
|
|
891
|
+
x = o;
|
|
892
|
+
}
|
|
893
|
+
}, { name: "sub" });
|
|
894
|
+
};
|
|
895
|
+
R.prototype.valueOf = function() {
|
|
896
|
+
return this.value;
|
|
897
|
+
};
|
|
898
|
+
R.prototype.toString = function() {
|
|
899
|
+
return this.value + "";
|
|
900
|
+
};
|
|
901
|
+
R.prototype.toJSON = function() {
|
|
902
|
+
return this.value;
|
|
903
|
+
};
|
|
904
|
+
R.prototype.peek = function() {
|
|
905
|
+
var e = x;
|
|
906
|
+
x = void 0;
|
|
907
|
+
try {
|
|
908
|
+
return this.value;
|
|
909
|
+
} finally {
|
|
910
|
+
x = e;
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
Object.defineProperty(R.prototype, "value", { get: function() {
|
|
914
|
+
var e = ce(this);
|
|
915
|
+
return e !== void 0 && (e.i = this.i), this.v;
|
|
916
|
+
}, set: function(e) {
|
|
917
|
+
if (e !== this.v) {
|
|
918
|
+
if (gt > 100) throw new Error("Cycle detected");
|
|
919
|
+
(function(s) {
|
|
920
|
+
V !== 0 && gt === 0 && s.l !== Qt && (s.l = Qt, pt = { S: s, v: s.v, i: s.i, o: pt });
|
|
921
|
+
})(this), this.v = e, this.i++, ft++, V++;
|
|
922
|
+
try {
|
|
923
|
+
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
924
|
+
} finally {
|
|
925
|
+
$t();
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
} });
|
|
929
|
+
function de(e) {
|
|
930
|
+
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
931
|
+
return !1;
|
|
932
|
+
}
|
|
933
|
+
function ue(e) {
|
|
934
|
+
for (var t = e.s; t !== void 0; t = t.n) {
|
|
935
|
+
var s = t.S.n;
|
|
936
|
+
if (s !== void 0 && (t.r = s), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
937
|
+
e.s = t;
|
|
938
|
+
break;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function ge(e) {
|
|
943
|
+
for (var t = e.s, s = void 0; t !== void 0; ) {
|
|
944
|
+
var o = t.p;
|
|
945
|
+
t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : s = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
|
|
946
|
+
}
|
|
947
|
+
e.s = s;
|
|
948
|
+
}
|
|
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;
|
|
951
|
+
}
|
|
952
|
+
Y.prototype = new R();
|
|
953
|
+
Y.prototype.h = function() {
|
|
954
|
+
if (this.f &= -3, 1 & this.f) return !1;
|
|
955
|
+
if ((36 & this.f) == 32 || (this.f &= -5, this.g === ft)) return !0;
|
|
956
|
+
if (this.g = ft, this.f |= 1, this.i > 0 && !de(this))
|
|
957
|
+
return this.f &= -2, !0;
|
|
958
|
+
var e = x;
|
|
959
|
+
try {
|
|
960
|
+
ue(this), x = this;
|
|
961
|
+
var t = this.x();
|
|
962
|
+
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
963
|
+
} catch (s) {
|
|
964
|
+
this.v = s, this.f |= 16, this.i++;
|
|
965
|
+
}
|
|
966
|
+
return x = e, ge(this), this.f &= -2, !0;
|
|
967
|
+
};
|
|
968
|
+
Y.prototype.S = function(e) {
|
|
969
|
+
if (this.t === void 0) {
|
|
970
|
+
this.f |= 36;
|
|
971
|
+
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
972
|
+
}
|
|
973
|
+
R.prototype.S.call(this, e);
|
|
974
|
+
};
|
|
975
|
+
Y.prototype.U = function(e) {
|
|
976
|
+
if (this.t !== void 0 && (R.prototype.U.call(this, e), this.t === void 0)) {
|
|
977
|
+
this.f &= -33;
|
|
978
|
+
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
Y.prototype.N = function() {
|
|
982
|
+
if (!(2 & this.f)) {
|
|
983
|
+
this.f |= 6;
|
|
984
|
+
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
Object.defineProperty(Y.prototype, "value", { get: function() {
|
|
988
|
+
if (1 & this.f) throw new Error("Cycle detected");
|
|
989
|
+
var e = ce(this);
|
|
990
|
+
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
|
|
991
|
+
return this.v;
|
|
992
|
+
} });
|
|
993
|
+
function pe(e) {
|
|
994
|
+
var t = e.m;
|
|
995
|
+
if (e.m = void 0, typeof t == "function") {
|
|
996
|
+
V++;
|
|
997
|
+
var s = x;
|
|
998
|
+
x = void 0;
|
|
999
|
+
try {
|
|
1000
|
+
t();
|
|
1001
|
+
} catch (o) {
|
|
1002
|
+
throw e.f &= -2, e.f |= 8, Nt(e), o;
|
|
1003
|
+
} finally {
|
|
1004
|
+
x = s, $t();
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
function Nt(e) {
|
|
1009
|
+
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
|
|
1010
|
+
e.x = void 0, e.s = void 0, pe(e);
|
|
1011
|
+
}
|
|
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();
|
|
1015
|
+
}
|
|
1016
|
+
function Q(e, t) {
|
|
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;
|
|
1018
|
+
}
|
|
1019
|
+
Q.prototype.c = function() {
|
|
1020
|
+
var e = this.S();
|
|
1021
|
+
try {
|
|
1022
|
+
if (8 & this.f || this.x === void 0) return;
|
|
1023
|
+
var t = this.x();
|
|
1024
|
+
typeof t == "function" && (this.m = t);
|
|
1025
|
+
} finally {
|
|
1026
|
+
e();
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
Q.prototype.S = function() {
|
|
1030
|
+
if (1 & this.f) throw new Error("Cycle detected");
|
|
1031
|
+
this.f |= 1, this.f &= -9, pe(this), ue(this), V++;
|
|
1032
|
+
var e = x;
|
|
1033
|
+
return x = this, Qe.bind(this, e);
|
|
1034
|
+
};
|
|
1035
|
+
Q.prototype.N = function() {
|
|
1036
|
+
2 & this.f || (this.f |= 2, this.u = et, et = this);
|
|
1037
|
+
};
|
|
1038
|
+
Q.prototype.d = function() {
|
|
1039
|
+
this.f |= 8, 1 & this.f || Nt(this);
|
|
1040
|
+
};
|
|
1041
|
+
Q.prototype.dispose = function() {
|
|
1042
|
+
this.d();
|
|
1043
|
+
};
|
|
1044
|
+
function Ke(e, t) {
|
|
1045
|
+
var s = new Q(e, t);
|
|
1046
|
+
try {
|
|
1047
|
+
s.c();
|
|
1048
|
+
} catch (r) {
|
|
1049
|
+
throw s.d(), r;
|
|
1050
|
+
}
|
|
1051
|
+
var o = s.d.bind(s);
|
|
1052
|
+
return o[Symbol.dispose] = o, o;
|
|
1053
|
+
}
|
|
1054
|
+
const Je = {
|
|
1055
|
+
emptyStateTitle: "No data available.",
|
|
1056
|
+
thumbnails: "Thumbnails",
|
|
1057
|
+
singlePageMode: "Single Page Mode",
|
|
1058
|
+
pages: "Pages",
|
|
1059
|
+
previous: "Previous",
|
|
1060
|
+
next: "Next",
|
|
1061
|
+
zoomOut: "Zoom Out",
|
|
1062
|
+
zoomIn: "Zoom In",
|
|
1063
|
+
fullscreen: "Fullscreen",
|
|
1064
|
+
settings: "Settings",
|
|
1065
|
+
downloadCatalog: "Download Catalog",
|
|
1066
|
+
play: "Play",
|
|
1067
|
+
pause: "Pause"
|
|
1068
|
+
}, ti = {
|
|
1069
|
+
emptyStateTitle: "Veri bulunamadi.",
|
|
1070
|
+
thumbnails: "Küçük Resimler",
|
|
1071
|
+
singlePageMode: "Tek Sayfa Modu",
|
|
1072
|
+
pages: "Sayfalar",
|
|
1073
|
+
previous: "Önceki",
|
|
1074
|
+
next: "Sonraki",
|
|
1075
|
+
zoomOut: "Uzaklaş",
|
|
1076
|
+
zoomIn: "Yaklaş",
|
|
1077
|
+
fullscreen: "Tam Ekran",
|
|
1078
|
+
settings: "Ayarlar",
|
|
1079
|
+
downloadCatalog: "Kataloğu İndir",
|
|
1080
|
+
play: "Otomatik Oynat",
|
|
1081
|
+
pause: "Duraklat"
|
|
1082
|
+
}, kt = {
|
|
1083
|
+
en: Je,
|
|
1084
|
+
tr: ti
|
|
1085
|
+
};
|
|
1086
|
+
function ei(e = {}) {
|
|
1087
|
+
var r;
|
|
1088
|
+
const t = e.locale ?? "en", s = kt[t] ?? kt.en, o = ((r = e.messages) == null ? void 0 : r[t]) ?? {};
|
|
1089
|
+
return {
|
|
1090
|
+
...kt.en,
|
|
1091
|
+
...s,
|
|
1092
|
+
...o
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
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(
|
|
1100
|
+
"button",
|
|
1101
|
+
{
|
|
1102
|
+
type: "button",
|
|
1103
|
+
class: m(() => `bk-btn ${e.store.showThumbs.value ? "active" : ""}`),
|
|
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" })
|
|
1113
|
+
] })
|
|
1114
|
+
}
|
|
1115
|
+
),
|
|
1116
|
+
/* @__PURE__ */ u(
|
|
1117
|
+
"button",
|
|
1118
|
+
{
|
|
1119
|
+
type: "button",
|
|
1120
|
+
class: m(() => `bk-btn bz-hide-mobile ${e.store.isSingleMode.value ? "active" : ""}`),
|
|
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" })
|
|
1131
|
+
] })
|
|
1132
|
+
}
|
|
1133
|
+
),
|
|
1134
|
+
/* @__PURE__ */ u(
|
|
1135
|
+
"button",
|
|
1136
|
+
{
|
|
1137
|
+
type: "button",
|
|
1138
|
+
class: m(() => `bk-btn ${e.store.isAutoPlaying.value ? "active" : ""}`),
|
|
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"),
|
|
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" })
|
|
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" }) })
|
|
1149
|
+
]
|
|
1150
|
+
}
|
|
1151
|
+
)
|
|
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(() => {
|
|
1156
|
+
const s = e.store.currentPage.value, o = e.store.totalPages.value;
|
|
1157
|
+
if (e.store.isSingleMode.value || s === 0 || s >= o - 1)
|
|
1158
|
+
return `${s + 1} / ${o}`;
|
|
1159
|
+
const r = s % 2 === 1 ? s : s - 1;
|
|
1160
|
+
return `${r + 1}-${r + 2} / ${o}`;
|
|
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" }) }) })
|
|
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" })
|
|
1170
|
+
] }) }),
|
|
1171
|
+
/* @__PURE__ */ u(
|
|
1172
|
+
"button",
|
|
1173
|
+
{
|
|
1174
|
+
type: "button",
|
|
1175
|
+
class: m(() => `bk-btn ${e.store.isZoomed.value ? "active" : ""}`),
|
|
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" })
|
|
1183
|
+
] })
|
|
1184
|
+
}
|
|
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" })
|
|
1191
|
+
] }) }) : null),
|
|
1192
|
+
/* @__PURE__ */ u(
|
|
1193
|
+
"button",
|
|
1194
|
+
{
|
|
1195
|
+
type: "button",
|
|
1196
|
+
class: m(() => `bk-btn ${e.store.soundEnabled.value ? "" : "muted"}`),
|
|
1197
|
+
onClick: e.onSoundToggle,
|
|
1198
|
+
"aria-label": "Sound",
|
|
1199
|
+
"aria-pressed": m(() => e.store.soundEnabled.value ? "true" : "false"),
|
|
1200
|
+
title: "Sound",
|
|
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" })
|
|
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" })
|
|
1211
|
+
] })
|
|
1212
|
+
]
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1215
|
+
] })
|
|
1216
|
+
] });
|
|
1217
|
+
}
|
|
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) => {
|
|
1220
|
+
const o = () => {
|
|
1221
|
+
const r = e.store.currentPage.value;
|
|
1222
|
+
if (e.store.isSingleMode.value || r === 0 || r >= e.store.pages.value.length - 1)
|
|
1223
|
+
return r === s;
|
|
1224
|
+
const c = r % 2 === 1 ? r : r - 1;
|
|
1225
|
+
return s === c || s === c + 1;
|
|
1226
|
+
};
|
|
1227
|
+
return /* @__PURE__ */ u(
|
|
1228
|
+
"div",
|
|
1229
|
+
{
|
|
1230
|
+
class: m(() => `thumb-item ${o() ? "active" : ""}`),
|
|
1231
|
+
role: "button",
|
|
1232
|
+
tabindex: "0",
|
|
1233
|
+
"aria-label": `Go to page ${s + 1}`,
|
|
1234
|
+
"aria-current": m(() => o() ? "page" : void 0),
|
|
1235
|
+
onClick: () => e.onThumbClick(s),
|
|
1236
|
+
onKeyDown: (r) => {
|
|
1237
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), e.onThumbClick(s));
|
|
1238
|
+
},
|
|
1239
|
+
children: [
|
|
1240
|
+
/* @__PURE__ */ u("div", { class: "thumb-img-wrapper", children: /* @__PURE__ */ u(
|
|
1241
|
+
"img",
|
|
1242
|
+
{
|
|
1243
|
+
class: "thumb-img",
|
|
1244
|
+
src: t.thumb || t.low || t.normal,
|
|
1245
|
+
alt: `Page ${s + 1}`,
|
|
1246
|
+
loading: "lazy",
|
|
1247
|
+
onError: (r) => {
|
|
1248
|
+
r.currentTarget.style.display = "none";
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
) }),
|
|
1252
|
+
/* @__PURE__ */ u("span", { children: s + 1 })
|
|
1253
|
+
]
|
|
1254
|
+
}
|
|
1255
|
+
);
|
|
1256
|
+
}) });
|
|
1257
|
+
}
|
|
1258
|
+
function ni(e) {
|
|
1259
|
+
return /* @__PURE__ */ u(
|
|
1260
|
+
"div",
|
|
1261
|
+
{
|
|
1262
|
+
role: "region",
|
|
1263
|
+
"aria-label": "Flipbook viewer",
|
|
1264
|
+
class: m(() => {
|
|
1265
|
+
let t = "bk-book-wrapper ";
|
|
1266
|
+
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
|
+
ref: e.bookWrapperRef,
|
|
1269
|
+
children: /* @__PURE__ */ u(
|
|
1270
|
+
"div",
|
|
1271
|
+
{
|
|
1272
|
+
class: "bk-book-sizer",
|
|
1273
|
+
ref: e.bookSizerRef,
|
|
1274
|
+
children: [
|
|
1275
|
+
/* @__PURE__ */ u(
|
|
1276
|
+
"div",
|
|
1277
|
+
{
|
|
1278
|
+
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"};`),
|
|
1281
|
+
children: e.store.pages.value.map((t, s) => {
|
|
1282
|
+
const o = s === 0 || s === e.store.pages.value.length - 1;
|
|
1283
|
+
return /* @__PURE__ */ u(
|
|
1284
|
+
"div",
|
|
1285
|
+
{
|
|
1286
|
+
class: `bz-page ${s === 0 ? "bz-page--cover" : ""} ${s === e.store.pages.value.length - 1 ? "bz-page--back" : ""}`,
|
|
1287
|
+
"data-density": o ? "hard" : "soft",
|
|
1288
|
+
"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(
|
|
1291
|
+
"img",
|
|
1292
|
+
{
|
|
1293
|
+
src: t.low || t.normal,
|
|
1294
|
+
"data-src": t.normal,
|
|
1295
|
+
class: `page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
|
|
1296
|
+
alt: `Page ${s + 1}`,
|
|
1297
|
+
loading: "lazy"
|
|
1298
|
+
}
|
|
1299
|
+
),
|
|
1300
|
+
/* @__PURE__ */ u("div", { class: "page-shadow" })
|
|
1301
|
+
] })
|
|
1302
|
+
}
|
|
1303
|
+
);
|
|
1304
|
+
})
|
|
1305
|
+
}
|
|
1306
|
+
),
|
|
1307
|
+
/* @__PURE__ */ u(
|
|
1308
|
+
"div",
|
|
1309
|
+
{
|
|
1310
|
+
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
|
+
const t = e.store.pages.value[e.store.currentPage.value];
|
|
1314
|
+
return t ? /* @__PURE__ */ u(
|
|
1315
|
+
"img",
|
|
1316
|
+
{
|
|
1317
|
+
class: `bk-single-img page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
|
|
1318
|
+
src: e.store.zoomState.value.isActive ? t.normal : t.low || t.normal,
|
|
1319
|
+
alt: `Page ${e.store.currentPage.value + 1}`,
|
|
1320
|
+
style: "opacity: 1; transition: opacity 0.3s; box-shadow: var(--flipbook-shadow);"
|
|
1321
|
+
}
|
|
1322
|
+
) : null;
|
|
1323
|
+
})
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
]
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1329
|
+
}
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
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
|
+
"button",
|
|
1337
|
+
{
|
|
1338
|
+
type: "button",
|
|
1339
|
+
class: "bk-nav-arrow bk-nav-prev",
|
|
1340
|
+
style: m(() => t.value ? "visibility: visible;" : "visibility: hidden;"),
|
|
1341
|
+
onClick: (o) => {
|
|
1342
|
+
o.preventDefault(), e.onPrevPage();
|
|
1343
|
+
},
|
|
1344
|
+
"aria-label": "Previous Page",
|
|
1345
|
+
children: /* @__PURE__ */ u("div", { class: "bk-arrow-icon bk-arrow-left" })
|
|
1346
|
+
}
|
|
1347
|
+
),
|
|
1348
|
+
/* @__PURE__ */ u(
|
|
1349
|
+
"button",
|
|
1350
|
+
{
|
|
1351
|
+
type: "button",
|
|
1352
|
+
class: "bk-nav-arrow bk-nav-next",
|
|
1353
|
+
style: m(() => s.value ? "visibility: visible;" : "visibility: hidden;"),
|
|
1354
|
+
onClick: (o) => {
|
|
1355
|
+
o.preventDefault(), e.onNextPage();
|
|
1356
|
+
},
|
|
1357
|
+
"aria-label": "Next Page",
|
|
1358
|
+
children: /* @__PURE__ */ u("div", { class: "bk-arrow-icon bk-arrow-right" })
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
] });
|
|
1362
|
+
}
|
|
1363
|
+
function ri(e) {
|
|
1364
|
+
const t = () => {
|
|
1365
|
+
e.store.showThumbs.value = !e.store.showThumbs.value;
|
|
1366
|
+
}, s = () => {
|
|
1367
|
+
e.store.isSingleMode.value = !e.store.isSingleMode.value;
|
|
1368
|
+
}, o = () => {
|
|
1369
|
+
e.store.isAutoPlaying.value = !e.store.isAutoPlaying.value;
|
|
1370
|
+
}, r = () => {
|
|
1371
|
+
var b;
|
|
1372
|
+
(b = e.interactionManagerRef.current) == null || b.zoomIn();
|
|
1373
|
+
}, c = () => {
|
|
1374
|
+
var b;
|
|
1375
|
+
(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 = () => {
|
|
1380
|
+
var b;
|
|
1381
|
+
(b = e.pageFlipAdapterRef.current) == null || b.turnToNextPage();
|
|
1382
|
+
}, S = () => {
|
|
1383
|
+
var b;
|
|
1384
|
+
(b = e.pageFlipAdapterRef.current) == null || b.turnToPrevPage();
|
|
1385
|
+
};
|
|
1386
|
+
return /* @__PURE__ */ u(
|
|
1387
|
+
"div",
|
|
1388
|
+
{
|
|
1389
|
+
class: m(() => `bk-wrapper bk-theme-${e.store.themeMode.value} ${e.className || ""}`),
|
|
1390
|
+
children: [
|
|
1391
|
+
/* @__PURE__ */ u("div", { class: "bk-main-area", children: [
|
|
1392
|
+
/* @__PURE__ */ u(
|
|
1393
|
+
ni,
|
|
1394
|
+
{
|
|
1395
|
+
store: e.store,
|
|
1396
|
+
bookWrapperRef: e.bookWrapperRef,
|
|
1397
|
+
bookSizerRef: e.bookSizerRef,
|
|
1398
|
+
bookContainerRef: e.bookContainerRef
|
|
1399
|
+
}
|
|
1400
|
+
),
|
|
1401
|
+
/* @__PURE__ */ u(
|
|
1402
|
+
oi,
|
|
1403
|
+
{
|
|
1404
|
+
store: e.store,
|
|
1405
|
+
onPrevPage: S,
|
|
1406
|
+
onNextPage: P
|
|
1407
|
+
}
|
|
1408
|
+
),
|
|
1409
|
+
e.store.whiteLabel.value ? null : /* @__PURE__ */ u("div", { class: "bk-watermark", children: [
|
|
1410
|
+
"Powered by ",
|
|
1411
|
+
/* @__PURE__ */ u("a", { href: "https://flipbookengine.com", target: "_blank", rel: "noopener", style: "text-decoration: underline;", children: "FlipbookEngine" })
|
|
1412
|
+
] })
|
|
1413
|
+
] }),
|
|
1414
|
+
/* @__PURE__ */ u(
|
|
1415
|
+
ii,
|
|
1416
|
+
{
|
|
1417
|
+
store: e.store,
|
|
1418
|
+
onToggleThumbs: t,
|
|
1419
|
+
onToggleSingleMode: s,
|
|
1420
|
+
onZoomIn: r,
|
|
1421
|
+
onZoomOut: c,
|
|
1422
|
+
onDownload: e.onDownload,
|
|
1423
|
+
onNextPage: P,
|
|
1424
|
+
onPrevPage: S,
|
|
1425
|
+
onSoundToggle: () => e.store.soundEnabled.value = !e.store.soundEnabled.value,
|
|
1426
|
+
onToggleAutoPlay: o,
|
|
1427
|
+
onToggleFullscreen: g
|
|
1428
|
+
}
|
|
1429
|
+
),
|
|
1430
|
+
/* @__PURE__ */ u(
|
|
1431
|
+
si,
|
|
1432
|
+
{
|
|
1433
|
+
store: e.store,
|
|
1434
|
+
onThumbClick: f
|
|
1435
|
+
}
|
|
1436
|
+
)
|
|
1437
|
+
]
|
|
1438
|
+
}
|
|
1439
|
+
);
|
|
1440
|
+
}
|
|
1441
|
+
var ai = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Dt = { exports: {} };
|
|
1442
|
+
(function(e, t) {
|
|
1443
|
+
(function(s, o) {
|
|
1444
|
+
o(t);
|
|
1445
|
+
})(ai, function(s) {
|
|
1446
|
+
class o {
|
|
1447
|
+
constructor(i, n) {
|
|
1448
|
+
this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = n, this.nowDrawingDensity = this.createdDensity, this.render = i;
|
|
1449
|
+
}
|
|
1450
|
+
setDensity(i) {
|
|
1451
|
+
this.createdDensity = i, this.nowDrawingDensity = i;
|
|
1452
|
+
}
|
|
1453
|
+
setDrawingDensity(i) {
|
|
1454
|
+
this.nowDrawingDensity = i;
|
|
1455
|
+
}
|
|
1456
|
+
setPosition(i) {
|
|
1457
|
+
this.state.position = i;
|
|
1458
|
+
}
|
|
1459
|
+
setAngle(i) {
|
|
1460
|
+
this.state.angle = i;
|
|
1461
|
+
}
|
|
1462
|
+
setArea(i) {
|
|
1463
|
+
this.state.area = i;
|
|
1464
|
+
}
|
|
1465
|
+
setHardDrawingAngle(i) {
|
|
1466
|
+
this.state.hardDrawingAngle = i;
|
|
1467
|
+
}
|
|
1468
|
+
setHardAngle(i) {
|
|
1469
|
+
this.state.hardAngle = i, this.state.hardDrawingAngle = i;
|
|
1470
|
+
}
|
|
1471
|
+
setOrientation(i) {
|
|
1472
|
+
this.orientation = i;
|
|
1473
|
+
}
|
|
1474
|
+
getDrawingDensity() {
|
|
1475
|
+
return this.nowDrawingDensity;
|
|
1476
|
+
}
|
|
1477
|
+
getDensity() {
|
|
1478
|
+
return this.createdDensity;
|
|
1479
|
+
}
|
|
1480
|
+
getHardAngle() {
|
|
1481
|
+
return this.state.hardAngle;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
class r extends o {
|
|
1485
|
+
constructor(i, n, a) {
|
|
1486
|
+
super(i, a), this.image = null, this.isLoad = !1, this.loadingAngle = 0, this.image = new Image(), this.image.src = n;
|
|
1487
|
+
}
|
|
1488
|
+
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;
|
|
1490
|
+
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();
|
|
1493
|
+
}
|
|
1494
|
+
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);
|
|
1497
|
+
}
|
|
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
|
+
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
|
+
}
|
|
1503
|
+
load() {
|
|
1504
|
+
this.isLoad || (this.image.onload = () => {
|
|
1505
|
+
this.isLoad = !0;
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
newTemporaryCopy() {
|
|
1509
|
+
return this;
|
|
1510
|
+
}
|
|
1511
|
+
getTemporaryCopy() {
|
|
1512
|
+
return this;
|
|
1513
|
+
}
|
|
1514
|
+
hideTemporaryCopy() {
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
class c {
|
|
1518
|
+
constructor(i, n) {
|
|
1519
|
+
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
|
+
}
|
|
1521
|
+
destroy() {
|
|
1522
|
+
this.pages = [];
|
|
1523
|
+
}
|
|
1524
|
+
createSpread() {
|
|
1525
|
+
this.landscapeSpread = [], this.portraitSpread = [];
|
|
1526
|
+
for (let n = 0; n < this.pages.length; n++) this.portraitSpread.push([n]);
|
|
1527
|
+
let i = 0;
|
|
1528
|
+
this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([i]), i++);
|
|
1529
|
+
for (let n = i; n < this.pages.length; n += 2) n < this.pages.length - 1 ? this.landscapeSpread.push([n, n + 1]) : (this.landscapeSpread.push([n]), this.pages[n].setDensity("hard"));
|
|
1530
|
+
}
|
|
1531
|
+
getSpread() {
|
|
1532
|
+
return this.render.getOrientation() === "landscape" ? this.landscapeSpread : this.portraitSpread;
|
|
1533
|
+
}
|
|
1534
|
+
getSpreadIndexByPage(i) {
|
|
1535
|
+
const n = this.getSpread();
|
|
1536
|
+
for (let a = 0; a < n.length; a++) if (i === n[a][0] || i === n[a][1]) return a;
|
|
1537
|
+
return null;
|
|
1538
|
+
}
|
|
1539
|
+
getPageCount() {
|
|
1540
|
+
return this.pages.length;
|
|
1541
|
+
}
|
|
1542
|
+
getPages() {
|
|
1543
|
+
return this.pages;
|
|
1544
|
+
}
|
|
1545
|
+
getPage(i) {
|
|
1546
|
+
if (i >= 0 && i < this.pages.length) return this.pages[i];
|
|
1547
|
+
throw new Error("Invalid page number");
|
|
1548
|
+
}
|
|
1549
|
+
nextBy(i) {
|
|
1550
|
+
const n = this.pages.indexOf(i);
|
|
1551
|
+
return n < this.pages.length - 1 ? this.pages[n + 1] : null;
|
|
1552
|
+
}
|
|
1553
|
+
prevBy(i) {
|
|
1554
|
+
const n = this.pages.indexOf(i);
|
|
1555
|
+
return n > 0 ? this.pages[n - 1] : null;
|
|
1556
|
+
}
|
|
1557
|
+
getFlippingPage(i) {
|
|
1558
|
+
const n = this.currentSpreadIndex;
|
|
1559
|
+
if (this.render.getOrientation() === "portrait") return i === 0 ? this.pages[n].newTemporaryCopy() : this.pages[n - 1];
|
|
1560
|
+
{
|
|
1561
|
+
const a = i === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
|
|
1562
|
+
return a.length === 1 || i === 0 ? this.pages[a[0]] : this.pages[a[1]];
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
getBottomPage(i) {
|
|
1566
|
+
const n = this.currentSpreadIndex;
|
|
1567
|
+
if (this.render.getOrientation() === "portrait") return i === 0 ? this.pages[n + 1] : this.pages[n - 1];
|
|
1568
|
+
{
|
|
1569
|
+
const a = i === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
|
|
1570
|
+
return a.length === 1 ? this.pages[a[0]] : i === 0 ? this.pages[a[1]] : this.pages[a[0]];
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
showNext() {
|
|
1574
|
+
this.currentSpreadIndex < this.getSpread().length && (this.currentSpreadIndex++, this.showSpread());
|
|
1575
|
+
}
|
|
1576
|
+
showPrev() {
|
|
1577
|
+
this.currentSpreadIndex > 0 && (this.currentSpreadIndex--, this.showSpread());
|
|
1578
|
+
}
|
|
1579
|
+
getCurrentPageIndex() {
|
|
1580
|
+
return this.currentPageIndex;
|
|
1581
|
+
}
|
|
1582
|
+
show(i = null) {
|
|
1583
|
+
if (i === null && (i = this.currentPageIndex), i < 0 || i >= this.pages.length) return;
|
|
1584
|
+
const n = this.getSpreadIndexByPage(i);
|
|
1585
|
+
n !== null && (this.currentSpreadIndex = n, this.showSpread());
|
|
1586
|
+
}
|
|
1587
|
+
getCurrentSpreadIndex() {
|
|
1588
|
+
return this.currentSpreadIndex;
|
|
1589
|
+
}
|
|
1590
|
+
setCurrentSpreadIndex(i) {
|
|
1591
|
+
if (!(i >= 0 && i < this.getSpread().length)) throw new Error("Invalid page");
|
|
1592
|
+
this.currentSpreadIndex = i;
|
|
1593
|
+
}
|
|
1594
|
+
showSpread() {
|
|
1595
|
+
const i = this.getSpread()[this.currentSpreadIndex];
|
|
1596
|
+
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
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
class g extends c {
|
|
1600
|
+
constructor(i, n, a) {
|
|
1601
|
+
super(i, n), this.imagesHref = a;
|
|
1602
|
+
}
|
|
1603
|
+
load() {
|
|
1604
|
+
for (const i of this.imagesHref) {
|
|
1605
|
+
const n = new r(this.render, i, "soft");
|
|
1606
|
+
n.load(), this.pages.push(n);
|
|
1607
|
+
}
|
|
1608
|
+
this.createSpread();
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
class f {
|
|
1612
|
+
static GetDistanceBetweenTwoPoint(i, n) {
|
|
1613
|
+
return i === null || n === null ? 1 / 0 : Math.sqrt(Math.pow(n.x - i.x, 2) + Math.pow(n.y - i.y, 2));
|
|
1614
|
+
}
|
|
1615
|
+
static GetSegmentLength(i) {
|
|
1616
|
+
return f.GetDistanceBetweenTwoPoint(i[0], i[1]);
|
|
1617
|
+
}
|
|
1618
|
+
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)));
|
|
1621
|
+
}
|
|
1622
|
+
static PointInRect(i, n) {
|
|
1623
|
+
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;
|
|
1624
|
+
}
|
|
1625
|
+
static GetRotatedPoint(i, n, a) {
|
|
1626
|
+
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
|
+
}
|
|
1628
|
+
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
|
+
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 };
|
|
1635
|
+
}
|
|
1636
|
+
static GetIntersectBetweenTwoSegment(i, n, a) {
|
|
1637
|
+
return f.PointInRect(i, f.GetIntersectBeetwenTwoLine(n, a));
|
|
1638
|
+
}
|
|
1639
|
+
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);
|
|
1641
|
+
if (isFinite(W) && isFinite(K)) return { x: W, y: K };
|
|
1642
|
+
if (Math.abs(E - D) < 0.1) throw new Error("Segment included");
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
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
|
+
}
|
|
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;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
class P extends o {
|
|
1655
|
+
constructor(i, n, a) {
|
|
1656
|
+
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
|
+
}
|
|
1658
|
+
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());
|
|
1660
|
+
}
|
|
1661
|
+
getTemporaryCopy() {
|
|
1662
|
+
return this.temporaryCopy;
|
|
1663
|
+
}
|
|
1664
|
+
hideTemporaryCopy() {
|
|
1665
|
+
this.temporaryCopy !== null && (this.copiedElement.remove(), this.copiedElement = null, this.temporaryCopy = null);
|
|
1666
|
+
}
|
|
1667
|
+
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;
|
|
1669
|
+
this.element.classList.remove("--simple");
|
|
1670
|
+
const d = `
|
|
1671
|
+
display: block;
|
|
1672
|
+
z-index: ${this.element.style.zIndex};
|
|
1673
|
+
left: 0;
|
|
1674
|
+
top: 0;
|
|
1675
|
+
width: ${l}px;
|
|
1676
|
+
height: ${h}px;
|
|
1677
|
+
`;
|
|
1678
|
+
n === "hard" ? this.drawHard(d) : this.drawSoft(a, d);
|
|
1679
|
+
}
|
|
1680
|
+
drawHard(i = "") {
|
|
1681
|
+
const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, l = i + `
|
|
1682
|
+
backface-visibility: hidden;
|
|
1683
|
+
-webkit-backface-visibility: hidden;
|
|
1684
|
+
clip-path: none;
|
|
1685
|
+
-webkit-clip-path: none;
|
|
1686
|
+
` + (this.orientation === 0 ? `transform-origin: ${this.render.getRect().pageWidth}px 0;
|
|
1687
|
+
transform: translate3d(0, 0, 0) rotateY(${a}deg);` : `transform-origin: 0 0;
|
|
1688
|
+
transform: translate3d(${n}px, 0, 0) rotateY(${a}deg);`);
|
|
1689
|
+
this.element.style.cssText = l;
|
|
1690
|
+
}
|
|
1691
|
+
drawSoft(i, n = "") {
|
|
1692
|
+
let a = "polygon( ";
|
|
1693
|
+
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, ";
|
|
1696
|
+
}
|
|
1697
|
+
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;
|
|
1700
|
+
}
|
|
1701
|
+
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;
|
|
1703
|
+
this.element.classList.add("--simple"), this.element.style.cssText = `
|
|
1704
|
+
position: absolute;
|
|
1705
|
+
display: block;
|
|
1706
|
+
height: ${l}px;
|
|
1707
|
+
left: ${h}px;
|
|
1708
|
+
top: ${d}px;
|
|
1709
|
+
width: ${a}px;
|
|
1710
|
+
z-index: ${this.render.getSettings().startZIndex + 1};`;
|
|
1711
|
+
}
|
|
1712
|
+
getElement() {
|
|
1713
|
+
return this.element;
|
|
1714
|
+
}
|
|
1715
|
+
load() {
|
|
1716
|
+
this.isLoad = !0;
|
|
1717
|
+
}
|
|
1718
|
+
setOrientation(i) {
|
|
1719
|
+
super.setOrientation(i), this.element.classList.remove("--left", "--right"), this.element.classList.add(i === 1 ? "--right" : "--left");
|
|
1720
|
+
}
|
|
1721
|
+
setDrawingDensity(i) {
|
|
1722
|
+
this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" + i), super.setDrawingDensity(i);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
class S extends c {
|
|
1726
|
+
constructor(i, n, a, l) {
|
|
1727
|
+
super(i, n), this.element = a, this.pagesElement = l;
|
|
1728
|
+
}
|
|
1729
|
+
load() {
|
|
1730
|
+
for (const i of this.pagesElement) {
|
|
1731
|
+
const n = new P(this.render, i, i.dataset.density === "hard" ? "hard" : "soft");
|
|
1732
|
+
n.load(), this.pages.push(n);
|
|
1733
|
+
}
|
|
1734
|
+
this.createSpread();
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
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);
|
|
1740
|
+
}
|
|
1741
|
+
calc(i) {
|
|
1742
|
+
try {
|
|
1743
|
+
return this.position = this.calcAngleAndPosition(i), this.calculateIntersectPoint(this.position), !0;
|
|
1744
|
+
} catch {
|
|
1745
|
+
return !1;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
getFlippingClipArea() {
|
|
1749
|
+
const i = [];
|
|
1750
|
+
let n = !1;
|
|
1751
|
+
return i.push(this.rect.topLeft), i.push(this.topIntersectPoint), this.sideIntersectPoint === null ? n = !0 : (i.push(this.sideIntersectPoint), this.bottomIntersectPoint === null && (n = !1)), i.push(this.bottomIntersectPoint), (n || this.corner === "bottom") && i.push(this.rect.bottomLeft), i;
|
|
1752
|
+
}
|
|
1753
|
+
getBottomClipArea() {
|
|
1754
|
+
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;
|
|
1756
|
+
}
|
|
1757
|
+
getAngle() {
|
|
1758
|
+
return this.direction === 0 ? -this.angle : this.angle;
|
|
1759
|
+
}
|
|
1760
|
+
getRect() {
|
|
1761
|
+
return this.rect;
|
|
1762
|
+
}
|
|
1763
|
+
getPosition() {
|
|
1764
|
+
return this.position;
|
|
1765
|
+
}
|
|
1766
|
+
getActiveCorner() {
|
|
1767
|
+
return this.direction === 0 ? this.rect.topLeft : this.rect.topRight;
|
|
1768
|
+
}
|
|
1769
|
+
getDirection() {
|
|
1770
|
+
return this.direction;
|
|
1771
|
+
}
|
|
1772
|
+
getFlippingProgress() {
|
|
1773
|
+
return Math.abs((this.position.x - this.pageWidth) / (2 * this.pageWidth) * 100);
|
|
1774
|
+
}
|
|
1775
|
+
getCorner() {
|
|
1776
|
+
return this.corner;
|
|
1777
|
+
}
|
|
1778
|
+
getBottomPagePosition() {
|
|
1779
|
+
return this.direction === 1 ? { x: this.pageWidth, y: 0 } : { x: 0, y: 0 };
|
|
1780
|
+
}
|
|
1781
|
+
getShadowStartPoint() {
|
|
1782
|
+
return this.corner === "top" ? this.topIntersectPoint : this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.topIntersectPoint;
|
|
1783
|
+
}
|
|
1784
|
+
getShadowAngle() {
|
|
1785
|
+
const i = f.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
|
|
1786
|
+
return this.direction === 0 ? i : Math.PI - i;
|
|
1787
|
+
}
|
|
1788
|
+
calcAngleAndPosition(i) {
|
|
1789
|
+
let n = i;
|
|
1790
|
+
if (this.updateAngleAndGeometry(n), n = this.corner === "top" ? this.checkPositionAtCenterLine(n, { x: 0, y: 0 }, { x: 0, y: this.pageHeight }) : this.checkPositionAtCenterLine(n, { x: 0, y: this.pageHeight }, { x: 0, y: 0 }), Math.abs(n.x - this.pageWidth) < 1 && Math.abs(n.y) < 1) throw new Error("Point is too small");
|
|
1791
|
+
return n;
|
|
1792
|
+
}
|
|
1793
|
+
updateAngleAndGeometry(i) {
|
|
1794
|
+
this.angle = this.calculateAngle(i), this.rect = this.getPageRect(i);
|
|
1795
|
+
}
|
|
1796
|
+
calculateAngle(i) {
|
|
1797
|
+
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;
|
|
1803
|
+
}
|
|
1804
|
+
getPageRect(i) {
|
|
1805
|
+
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);
|
|
1806
|
+
}
|
|
1807
|
+
getRectFromBasePoint(i, n) {
|
|
1808
|
+
return { topLeft: this.getRotatedPoint(i[0], n), topRight: this.getRotatedPoint(i[1], n), bottomLeft: this.getRotatedPoint(i[2], n), bottomRight: this.getRotatedPoint(i[3], n) };
|
|
1809
|
+
}
|
|
1810
|
+
getRotatedPoint(i, n) {
|
|
1811
|
+
return { x: i.x * Math.cos(this.angle) + i.y * Math.sin(this.angle) + n.x, y: i.y * Math.cos(this.angle) - i.x * Math.sin(this.angle) + n.y };
|
|
1812
|
+
}
|
|
1813
|
+
calculateIntersectPoint(i) {
|
|
1814
|
+
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 }]));
|
|
1816
|
+
}
|
|
1817
|
+
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));
|
|
1826
|
+
}
|
|
1827
|
+
return l;
|
|
1828
|
+
}
|
|
1829
|
+
getSegmentToShadowLine() {
|
|
1830
|
+
const i = this.getShadowStartPoint();
|
|
1831
|
+
return [i, i !== this.sideIntersectPoint && this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.bottomIntersectPoint];
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
class L {
|
|
1835
|
+
constructor(i, n) {
|
|
1836
|
+
this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render = i, this.app = n;
|
|
1837
|
+
}
|
|
1838
|
+
fold(i) {
|
|
1839
|
+
this.setState("user_fold"), this.calc === null && this.start(i), this.do(this.render.convertToPage(i));
|
|
1840
|
+
}
|
|
1841
|
+
flip(i) {
|
|
1842
|
+
if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(i) || (this.calc !== null && this.render.finishAnimation(), !this.start(i))) return;
|
|
1843
|
+
const n = this.getBoundsRect();
|
|
1844
|
+
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);
|
|
1847
|
+
}
|
|
1848
|
+
start(i) {
|
|
1849
|
+
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;
|
|
1852
|
+
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
|
+
} 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"));
|
|
1859
|
+
}
|
|
1860
|
+
return this.render.setDirection(l), this.calc = new b(l, h, a.pageWidth.toString(10), a.height.toString(10)), !0;
|
|
1861
|
+
} catch {
|
|
1862
|
+
return !1;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
do(i) {
|
|
1866
|
+
if (this.calc !== null && this.calc.calc(i)) {
|
|
1867
|
+
const n = this.calc.getFlippingProgress();
|
|
1868
|
+
this.bottomPage.setArea(this.calc.getBottomClipArea()), this.bottomPage.setPosition(this.calc.getBottomPagePosition()), this.bottomPage.setAngle(0), this.bottomPage.setHardAngle(0), this.flippingPage.setArea(this.calc.getFlippingClipArea()), this.flippingPage.setPosition(this.calc.getActiveCorner()), this.flippingPage.setAngle(this.calc.getAngle()), this.calc.getDirection() === 0 ? this.flippingPage.setHardAngle(90 * (200 - 2 * n) / 100) : this.flippingPage.setHardAngle(-90 * (200 - 2 * n) / 100), this.render.setPageRect(this.calc.getRect()), this.render.setBottomPage(this.bottomPage), this.render.setFlippingPage(this.flippingPage), this.render.setShadowData(this.calc.getShadowStartPoint(), this.calc.getShadowAngle(), n, this.calc.getDirection());
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
flipToPage(i, n) {
|
|
1872
|
+
const a = this.app.getPageCollection().getCurrentSpreadIndex(), l = this.app.getPageCollection().getSpreadIndexByPage(i);
|
|
1873
|
+
try {
|
|
1874
|
+
l > a && (this.app.getPageCollection().setCurrentSpreadIndex(l - 1), this.flipNext(n)), l < a && (this.app.getPageCollection().setCurrentSpreadIndex(l + 1), this.flipPrev(n));
|
|
1875
|
+
} catch {
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
flipNext(i) {
|
|
1879
|
+
this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y: i === "top" ? 1 : this.render.getRect().height - 2 });
|
|
1880
|
+
}
|
|
1881
|
+
flipPrev(i) {
|
|
1882
|
+
this.flip({ x: 10, y: i === "top" ? 1 : this.render.getRect().height - 2 });
|
|
1883
|
+
}
|
|
1884
|
+
stopMove() {
|
|
1885
|
+
if (this.calc === null) return;
|
|
1886
|
+
const i = this.calc.getPosition(), n = this.getBoundsRect(), a = this.calc.getCorner() === "bottom" ? n.height : 0;
|
|
1887
|
+
i.x <= 0 ? this.animateFlippingTo(i, { x: -n.pageWidth, y: a }, !0) : this.animateFlippingTo(i, { x: n.pageWidth, y: a }, !1);
|
|
1888
|
+
}
|
|
1889
|
+
showCorner(i) {
|
|
1890
|
+
if (!this.checkState("read", "fold_corner")) return;
|
|
1891
|
+
const n = this.getBoundsRect(), a = n.pageWidth;
|
|
1892
|
+
if (this.isPointOnCorners(i)) if (this.calc === null) {
|
|
1893
|
+
if (!this.start(i)) return;
|
|
1894
|
+
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);
|
|
1897
|
+
} else this.do(this.render.convertToPage(i));
|
|
1898
|
+
else this.setState("read"), this.render.finishAnimation(), this.stopMove();
|
|
1899
|
+
}
|
|
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()));
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
getCalculation() {
|
|
1909
|
+
return this.calc;
|
|
1910
|
+
}
|
|
1911
|
+
getState() {
|
|
1912
|
+
return this.state;
|
|
1913
|
+
}
|
|
1914
|
+
setState(i) {
|
|
1915
|
+
this.state !== i && (this.app.updateState(i), this.state = i);
|
|
1916
|
+
}
|
|
1917
|
+
getDirectionByPoint(i) {
|
|
1918
|
+
const n = this.getBoundsRect();
|
|
1919
|
+
if (this.render.getOrientation() === "portrait") {
|
|
1920
|
+
if (i.x - n.pageWidth <= n.width / 5) return 1;
|
|
1921
|
+
} else if (i.x < n.width / 2) return 1;
|
|
1922
|
+
return 0;
|
|
1923
|
+
}
|
|
1924
|
+
getAnimationDuration(i) {
|
|
1925
|
+
const n = this.app.getSettings().flippingTime;
|
|
1926
|
+
return i >= 1e3 ? n : i / 1e3 * n;
|
|
1927
|
+
}
|
|
1928
|
+
checkDirection(i) {
|
|
1929
|
+
return i === 0 ? this.app.getCurrentPageIndex() < this.app.getPageCount() - 1 : this.app.getCurrentPageIndex() >= 1;
|
|
1930
|
+
}
|
|
1931
|
+
reset() {
|
|
1932
|
+
this.calc = null, this.flippingPage = null, this.bottomPage = null;
|
|
1933
|
+
}
|
|
1934
|
+
getBoundsRect() {
|
|
1935
|
+
return this.render.getRect();
|
|
1936
|
+
}
|
|
1937
|
+
checkState(...i) {
|
|
1938
|
+
for (const n of i) if (this.state === n) return !0;
|
|
1939
|
+
return !1;
|
|
1940
|
+
}
|
|
1941
|
+
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);
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
class $ {
|
|
1947
|
+
constructor(i, n) {
|
|
1948
|
+
this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = n, this.app = i;
|
|
1949
|
+
const a = new RegExp("Version\\/[\\d\\.]+.*Safari/");
|
|
1950
|
+
this.safari = a.exec(window.navigator.userAgent) !== null;
|
|
1951
|
+
}
|
|
1952
|
+
render(i) {
|
|
1953
|
+
if (this.animation !== null) {
|
|
1954
|
+
const n = Math.round((i - this.animation.startedAt) / this.animation.durationFrame);
|
|
1955
|
+
n < this.animation.frames.length ? this.animation.frames[n]() : (this.animation.onAnimateEnd(), this.animation = null);
|
|
1956
|
+
}
|
|
1957
|
+
this.timer = i, this.drawFrame();
|
|
1958
|
+
}
|
|
1959
|
+
start() {
|
|
1960
|
+
this.update();
|
|
1961
|
+
const i = (n) => {
|
|
1962
|
+
this.render(n), requestAnimationFrame(i);
|
|
1963
|
+
};
|
|
1964
|
+
requestAnimationFrame(i);
|
|
1965
|
+
}
|
|
1966
|
+
startAnimation(i, n, a) {
|
|
1967
|
+
this.finishAnimation(), this.animation = { frames: i, duration: n, durationFrame: n / i.length, onAnimateEnd: a, startedAt: this.timer };
|
|
1968
|
+
}
|
|
1969
|
+
finishAnimation() {
|
|
1970
|
+
this.animation !== null && (this.animation.frames[this.animation.frames.length - 1](), this.animation.onAnimateEnd !== null && this.animation.onAnimateEnd()), this.animation = null;
|
|
1971
|
+
}
|
|
1972
|
+
update() {
|
|
1973
|
+
this.boundsRect = null;
|
|
1974
|
+
const i = this.calculateBoundsRect();
|
|
1975
|
+
this.orientation !== i && (this.orientation = i, this.app.updateOrientation(i));
|
|
1976
|
+
}
|
|
1977
|
+
calculateBoundsRect() {
|
|
1978
|
+
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
|
+
}
|
|
1983
|
+
setShadowData(i, n, a, l) {
|
|
1984
|
+
if (!this.app.getSettings().drawShadow) return;
|
|
1985
|
+
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 };
|
|
1987
|
+
}
|
|
1988
|
+
clearShadow() {
|
|
1989
|
+
this.shadow = null;
|
|
1990
|
+
}
|
|
1991
|
+
getBlockWidth() {
|
|
1992
|
+
return this.app.getUI().getDistElement().offsetWidth;
|
|
1993
|
+
}
|
|
1994
|
+
getBlockHeight() {
|
|
1995
|
+
return this.app.getUI().getDistElement().offsetHeight;
|
|
1996
|
+
}
|
|
1997
|
+
getDirection() {
|
|
1998
|
+
return this.direction;
|
|
1999
|
+
}
|
|
2000
|
+
getRect() {
|
|
2001
|
+
return this.boundsRect === null && this.calculateBoundsRect(), this.boundsRect;
|
|
2002
|
+
}
|
|
2003
|
+
getSettings() {
|
|
2004
|
+
return this.app.getSettings();
|
|
2005
|
+
}
|
|
2006
|
+
getOrientation() {
|
|
2007
|
+
return this.orientation;
|
|
2008
|
+
}
|
|
2009
|
+
setPageRect(i) {
|
|
2010
|
+
this.pageRect = i;
|
|
2011
|
+
}
|
|
2012
|
+
setDirection(i) {
|
|
2013
|
+
this.direction = i;
|
|
2014
|
+
}
|
|
2015
|
+
setRightPage(i) {
|
|
2016
|
+
i !== null && i.setOrientation(1), this.rightPage = i;
|
|
2017
|
+
}
|
|
2018
|
+
setLeftPage(i) {
|
|
2019
|
+
i !== null && i.setOrientation(0), this.leftPage = i;
|
|
2020
|
+
}
|
|
2021
|
+
setBottomPage(i) {
|
|
2022
|
+
i !== null && i.setOrientation(this.direction === 1 ? 0 : 1), this.bottomPage = i;
|
|
2023
|
+
}
|
|
2024
|
+
setFlippingPage(i) {
|
|
2025
|
+
i !== null && i.setOrientation(this.direction === 0 && this.orientation !== "portrait" ? 0 : 1), this.flippingPage = i;
|
|
2026
|
+
}
|
|
2027
|
+
convertToBook(i) {
|
|
2028
|
+
const n = this.getRect();
|
|
2029
|
+
return { x: i.x - n.left, y: i.y - n.top };
|
|
2030
|
+
}
|
|
2031
|
+
isSafari() {
|
|
2032
|
+
return this.safari;
|
|
2033
|
+
}
|
|
2034
|
+
convertToPage(i, n) {
|
|
2035
|
+
n || (n = this.direction);
|
|
2036
|
+
const a = this.getRect();
|
|
2037
|
+
return { x: n === 0 ? i.x - a.left - a.width / 2 : a.width / 2 - i.x + a.left, y: i.y - a.top };
|
|
2038
|
+
}
|
|
2039
|
+
convertToGlobal(i, n) {
|
|
2040
|
+
if (n || (n = this.direction), i == null) return null;
|
|
2041
|
+
const a = this.getRect();
|
|
2042
|
+
return { x: n === 0 ? i.x + a.left + a.width / 2 : a.width / 2 - i.x + a.left, y: i.y + a.top };
|
|
2043
|
+
}
|
|
2044
|
+
convertRectToGlobal(i, n) {
|
|
2045
|
+
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
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
class T extends $ {
|
|
2049
|
+
constructor(i, n, a) {
|
|
2050
|
+
super(i, n), this.canvas = a, this.ctx = a.getContext("2d");
|
|
2051
|
+
}
|
|
2052
|
+
getContext() {
|
|
2053
|
+
return this.ctx;
|
|
2054
|
+
}
|
|
2055
|
+
reload() {
|
|
2056
|
+
}
|
|
2057
|
+
drawFrame() {
|
|
2058
|
+
this.clear(), this.orientation !== "portrait" && this.leftPage != null && this.leftPage.simpleDraw(0), this.rightPage != null && this.rightPage.simpleDraw(1), this.bottomPage != null && this.bottomPage.draw(), this.drawBookShadow(), this.flippingPage != null && this.flippingPage.draw(), this.shadow != null && (this.drawOuterShadow(), this.drawInnerShadow());
|
|
2059
|
+
const i = this.getRect();
|
|
2060
|
+
this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(i.left + i.pageWidth, i.top, i.width, i.height), this.ctx.clip());
|
|
2061
|
+
}
|
|
2062
|
+
drawBookShadow() {
|
|
2063
|
+
const i = this.getRect();
|
|
2064
|
+
this.ctx.save(), this.ctx.beginPath();
|
|
2065
|
+
const n = i.width / 20;
|
|
2066
|
+
this.ctx.rect(i.left, i.top, i.width, i.height);
|
|
2067
|
+
const a = { x: i.left + i.width / 2 - n / 2, y: 0 };
|
|
2068
|
+
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();
|
|
2071
|
+
}
|
|
2072
|
+
drawOuterShadow() {
|
|
2073
|
+
const i = this.getRect();
|
|
2074
|
+
this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(i.left, i.top, i.width, i.height);
|
|
2075
|
+
const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y });
|
|
2076
|
+
this.ctx.translate(n.x, n.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
|
|
2077
|
+
const a = this.ctx.createLinearGradient(0, 0, this.shadow.width, 0);
|
|
2078
|
+
this.shadow.direction === 0 ? (this.ctx.translate(0, -100), a.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), a.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), a.addColorStop(0, "rgba(0, 0, 0, 0)"), a.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = a, this.ctx.fillRect(0, 0, this.shadow.width, 2 * i.height), this.ctx.restore();
|
|
2079
|
+
}
|
|
2080
|
+
drawInnerShadow() {
|
|
2081
|
+
const i = this.getRect();
|
|
2082
|
+
this.ctx.save(), this.ctx.beginPath();
|
|
2083
|
+
const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.convertRectToGlobal(this.pageRect);
|
|
2084
|
+
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();
|
|
2087
|
+
}
|
|
2088
|
+
clear() {
|
|
2089
|
+
this.ctx.fillStyle = "white", this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
class A {
|
|
2093
|
+
constructor(i, n, a) {
|
|
2094
|
+
this.touchPoint = null, this.swipeTimeout = 250, this.onResize = () => {
|
|
2095
|
+
this.update();
|
|
2096
|
+
}, this.onMouseDown = (h) => {
|
|
2097
|
+
if (this.checkTarget(h.target)) {
|
|
2098
|
+
const d = this.getMousePos(h.clientX, h.clientY);
|
|
2099
|
+
this.app.startUserTouch(d), h.preventDefault();
|
|
2100
|
+
}
|
|
2101
|
+
}, this.onTouchStart = (h) => {
|
|
2102
|
+
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
|
+
}, this.swipeTimeout), this.app.getSettings().mobileScrollSupport || h.preventDefault();
|
|
2107
|
+
}
|
|
2108
|
+
}, this.onMouseUp = (h) => {
|
|
2109
|
+
const d = this.getMousePos(h.clientX, h.clientY);
|
|
2110
|
+
this.app.userStop(d);
|
|
2111
|
+
}, this.onMouseMove = (h) => {
|
|
2112
|
+
const d = this.getMousePos(h.clientX, h.clientY);
|
|
2113
|
+
this.app.userMove(d, !1);
|
|
2114
|
+
}, this.onTouchMove = (h) => {
|
|
2115
|
+
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);
|
|
2118
|
+
}
|
|
2119
|
+
}, this.onTouchEnd = (h) => {
|
|
2120
|
+
if (h.changedTouches.length > 0) {
|
|
2121
|
+
const d = h.changedTouches[0], w = this.getMousePos(d.clientX, d.clientY);
|
|
2122
|
+
let y = !1;
|
|
2123
|
+
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;
|
|
2126
|
+
}
|
|
2127
|
+
this.app.userStop(w, y);
|
|
2128
|
+
}
|
|
2129
|
+
}, 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;
|
|
2132
|
+
}
|
|
2133
|
+
destroy() {
|
|
2134
|
+
this.app.getSettings().useMouseEvents && this.removeHandlers(), this.distElement.remove(), this.wrapper.remove();
|
|
2135
|
+
}
|
|
2136
|
+
getDistElement() {
|
|
2137
|
+
return this.distElement;
|
|
2138
|
+
}
|
|
2139
|
+
getWrapper() {
|
|
2140
|
+
return this.wrapper;
|
|
2141
|
+
}
|
|
2142
|
+
setOrientationStyle(i) {
|
|
2143
|
+
this.wrapper.classList.remove("--portrait", "--landscape"), i === "portrait" ? (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / this.app.getSettings().width * 100 + "%"), this.wrapper.classList.add("--portrait")) : (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / (2 * this.app.getSettings().width) * 100 + "%"), this.wrapper.classList.add("--landscape")), this.update();
|
|
2144
|
+
}
|
|
2145
|
+
removeHandlers() {
|
|
2146
|
+
window.removeEventListener("resize", this.onResize), this.distElement.removeEventListener("mousedown", this.onMouseDown), this.distElement.removeEventListener("touchstart", this.onTouchStart), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("touchend", this.onTouchEnd);
|
|
2147
|
+
}
|
|
2148
|
+
setHandlers() {
|
|
2149
|
+
window.addEventListener("resize", this.onResize, !1), this.app.getSettings().useMouseEvents && (this.distElement.addEventListener("mousedown", this.onMouseDown), this.distElement.addEventListener("touchstart", this.onTouchStart), window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("touchmove", this.onTouchMove, { passive: !this.app.getSettings().mobileScrollSupport }), window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("touchend", this.onTouchEnd));
|
|
2150
|
+
}
|
|
2151
|
+
getMousePos(i, n) {
|
|
2152
|
+
const a = this.distElement.getBoundingClientRect();
|
|
2153
|
+
return { x: i - a.left, y: n - a.top };
|
|
2154
|
+
}
|
|
2155
|
+
checkTarget(i) {
|
|
2156
|
+
return !this.app.getSettings().clickEventForward || !["a", "button"].includes(i.tagName.toLowerCase());
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
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);
|
|
2163
|
+
this.setHandlers();
|
|
2164
|
+
}
|
|
2165
|
+
clear() {
|
|
2166
|
+
for (const i of this.items) this.parentElement.appendChild(i);
|
|
2167
|
+
}
|
|
2168
|
+
updateItems(i) {
|
|
2169
|
+
this.removeHandlers(), this.distElement.innerHTML = "";
|
|
2170
|
+
for (const n of i) this.distElement.appendChild(n);
|
|
2171
|
+
this.items = i, this.setHandlers();
|
|
2172
|
+
}
|
|
2173
|
+
update() {
|
|
2174
|
+
this.app.getRender().update();
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
class G extends A {
|
|
2178
|
+
constructor(i, n, a) {
|
|
2179
|
+
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
|
+
}
|
|
2181
|
+
resizeCanvas() {
|
|
2182
|
+
const i = getComputedStyle(this.canvas), n = parseInt(i.getPropertyValue("width"), 10), a = parseInt(i.getPropertyValue("height"), 10);
|
|
2183
|
+
this.canvas.width = n, this.canvas.height = a;
|
|
2184
|
+
}
|
|
2185
|
+
getCanvas() {
|
|
2186
|
+
return this.canvas;
|
|
2187
|
+
}
|
|
2188
|
+
update() {
|
|
2189
|
+
this.resizeCanvas(), this.app.getRender().update();
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
class N extends $ {
|
|
2193
|
+
constructor(i, n, a) {
|
|
2194
|
+
super(i, n), this.outerShadow = null, this.innerShadow = null, this.hardShadow = null, this.hardInnerShadow = null, this.element = a, this.createShadows();
|
|
2195
|
+
}
|
|
2196
|
+
createShadows() {
|
|
2197
|
+
this.element.insertAdjacentHTML("beforeend", `<div class="stf__outerShadow"></div>
|
|
2198
|
+
<div class="stf__innerShadow"></div>
|
|
2199
|
+
<div class="stf__hardShadow"></div>
|
|
2200
|
+
<div class="stf__hardInnerShadow"></div>`), this.outerShadow = this.element.querySelector(".stf__outerShadow"), this.innerShadow = this.element.querySelector(".stf__innerShadow"), this.hardShadow = this.element.querySelector(".stf__hardShadow"), this.hardInnerShadow = this.element.querySelector(".stf__hardInnerShadow");
|
|
2201
|
+
}
|
|
2202
|
+
clearShadow() {
|
|
2203
|
+
super.clearShadow(), this.outerShadow.style.cssText = "display: none", this.innerShadow.style.cssText = "display: none", this.hardShadow.style.cssText = "display: none", this.hardInnerShadow.style.cssText = "display: none";
|
|
2204
|
+
}
|
|
2205
|
+
reload() {
|
|
2206
|
+
this.element.querySelector(".stf__outerShadow") || this.createShadows();
|
|
2207
|
+
}
|
|
2208
|
+
drawHardInnerShadow() {
|
|
2209
|
+
const i = this.getRect(), n = this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress;
|
|
2210
|
+
let a = (100 - n) * (2.5 * i.pageWidth) / 100 + 20;
|
|
2211
|
+
a > i.pageWidth && (a = i.pageWidth);
|
|
2212
|
+
let l = `
|
|
2213
|
+
display: block;
|
|
2214
|
+
z-index: ${(this.getSettings().startZIndex + 5).toString(10)};
|
|
2215
|
+
width: ${a}px;
|
|
2216
|
+
height: ${i.height}px;
|
|
2217
|
+
background: linear-gradient(to right,
|
|
2218
|
+
rgba(0, 0, 0, ${this.shadow.opacity * n / 100}) 5%,
|
|
2219
|
+
rgba(0, 0, 0, 0) 100%);
|
|
2220
|
+
left: ${i.left + i.width / 2}px;
|
|
2221
|
+
transform-origin: 0 0;
|
|
2222
|
+
`;
|
|
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;
|
|
2224
|
+
}
|
|
2225
|
+
drawHardOuterShadow() {
|
|
2226
|
+
const i = this.getRect();
|
|
2227
|
+
let n = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 * i.pageWidth) / 100 + 20;
|
|
2228
|
+
n > i.pageWidth && (n = i.pageWidth);
|
|
2229
|
+
let a = `
|
|
2230
|
+
display: block;
|
|
2231
|
+
z-index: ${(this.getSettings().startZIndex + 4).toString(10)};
|
|
2232
|
+
width: ${n}px;
|
|
2233
|
+
height: ${i.height}px;
|
|
2234
|
+
background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);
|
|
2235
|
+
left: ${i.left + i.width / 2}px;
|
|
2236
|
+
transform-origin: 0 0;
|
|
2237
|
+
`;
|
|
2238
|
+
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
|
+
}
|
|
2240
|
+
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];
|
|
2242
|
+
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
|
+
}
|
|
2247
|
+
y = y.slice(0, -2), y += ")";
|
|
2248
|
+
const E = `
|
|
2249
|
+
display: block;
|
|
2250
|
+
z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
|
|
2251
|
+
width: ${n}px;
|
|
2252
|
+
height: ${2 * i.height}px;
|
|
2253
|
+
background: linear-gradient(${l},
|
|
2254
|
+
rgba(0, 0, 0, ${this.shadow.opacity}) 5%,
|
|
2255
|
+
rgba(0, 0, 0, 0.05) 15%,
|
|
2256
|
+
rgba(0, 0, 0, ${this.shadow.opacity}) 35%,
|
|
2257
|
+
rgba(0, 0, 0, 0) 100%);
|
|
2258
|
+
transform-origin: ${a}px 100px;
|
|
2259
|
+
transform: translate3d(${h.x - a}px, ${h.y - 100}px, 0) rotate(${d}rad);
|
|
2260
|
+
clip-path: ${y};
|
|
2261
|
+
-webkit-clip-path: ${y};
|
|
2262
|
+
`;
|
|
2263
|
+
this.innerShadow.style.cssText = E;
|
|
2264
|
+
}
|
|
2265
|
+
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, ";
|
|
2271
|
+
}
|
|
2272
|
+
w = w.slice(0, -2), w += ")";
|
|
2273
|
+
const y = `
|
|
2274
|
+
display: block;
|
|
2275
|
+
z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
|
|
2276
|
+
width: ${this.shadow.width}px;
|
|
2277
|
+
height: ${2 * i.height}px;
|
|
2278
|
+
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};
|
|
2283
|
+
`;
|
|
2284
|
+
this.outerShadow.style.cssText = y;
|
|
2285
|
+
}
|
|
2286
|
+
drawLeftPage() {
|
|
2287
|
+
this.orientation !== "portrait" && this.leftPage !== null && (this.direction === 1 && this.flippingPage !== null && this.flippingPage.getDrawingDensity() === "hard" ? (this.leftPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.leftPage.setHardDrawingAngle(180 + this.flippingPage.getHardAngle()), this.leftPage.draw(this.flippingPage.getDrawingDensity())) : this.leftPage.simpleDraw(0));
|
|
2288
|
+
}
|
|
2289
|
+
drawRightPage() {
|
|
2290
|
+
this.rightPage !== null && (this.direction === 0 && this.flippingPage !== null && this.flippingPage.getDrawingDensity() === "hard" ? (this.rightPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.rightPage.setHardDrawingAngle(180 + this.flippingPage.getHardAngle()), this.rightPage.draw(this.flippingPage.getDrawingDensity())) : this.rightPage.simpleDraw(1));
|
|
2291
|
+
}
|
|
2292
|
+
drawBottomPage() {
|
|
2293
|
+
if (this.bottomPage === null) return;
|
|
2294
|
+
const i = this.flippingPage != null ? this.flippingPage.getDrawingDensity() : null;
|
|
2295
|
+
this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(i));
|
|
2296
|
+
}
|
|
2297
|
+
drawFrame() {
|
|
2298
|
+
this.clear(), this.drawLeftPage(), this.drawRightPage(), this.drawBottomPage(), this.flippingPage != null && (this.flippingPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.flippingPage.draw()), this.shadow != null && this.flippingPage !== null && (this.flippingPage.getDrawingDensity() === "soft" ? (this.drawOuterShadow(), this.drawInnerShadow()) : (this.drawHardOuterShadow(), this.drawHardInnerShadow()));
|
|
2299
|
+
}
|
|
2300
|
+
clear() {
|
|
2301
|
+
for (const i of this.app.getPageCollection().getPages()) i !== this.leftPage && i !== this.rightPage && i !== this.flippingPage && i !== this.bottomPage && (i.getElement().style.cssText = "display: none"), i.getTemporaryCopy() !== this.flippingPage && i.hideTemporaryCopy();
|
|
2302
|
+
}
|
|
2303
|
+
update() {
|
|
2304
|
+
super.update(), this.rightPage !== null && this.rightPage.setOrientation(1), this.leftPage !== null && this.leftPage.setOrientation(0);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
class H {
|
|
2308
|
+
constructor() {
|
|
2309
|
+
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
|
+
}
|
|
2311
|
+
getSettings(i) {
|
|
2312
|
+
const n = this._default;
|
|
2313
|
+
if (Object.assign(n, i), n.size !== "stretch" && n.size !== "fixed") throw new Error('Invalid size type. Available only "fixed" and "stretch" value');
|
|
2314
|
+
if (n.width <= 0 || n.height <= 0) throw new Error("Invalid width or height");
|
|
2315
|
+
if (n.flippingTime <= 0) throw new Error("Invalid flipping time");
|
|
2316
|
+
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
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
(function(p, i) {
|
|
2320
|
+
i === void 0 && (i = {});
|
|
2321
|
+
var n = i.insertAt;
|
|
2322
|
+
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));
|
|
2325
|
+
}
|
|
2326
|
+
})(`.stf__parent {
|
|
2327
|
+
position: relative;
|
|
2328
|
+
display: block;
|
|
2329
|
+
box-sizing: border-box;
|
|
2330
|
+
transform: translateZ(0);
|
|
2331
|
+
|
|
2332
|
+
-ms-touch-action: pan-y;
|
|
2333
|
+
touch-action: pan-y;
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
.sft__wrapper {
|
|
2337
|
+
position: relative;
|
|
2338
|
+
width: 100%;
|
|
2339
|
+
box-sizing: border-box;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
.stf__parent canvas {
|
|
2343
|
+
position: absolute;
|
|
2344
|
+
width: 100%;
|
|
2345
|
+
height: 100%;
|
|
2346
|
+
left: 0;
|
|
2347
|
+
top: 0;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
.stf__block {
|
|
2351
|
+
position: absolute;
|
|
2352
|
+
width: 100%;
|
|
2353
|
+
height: 100%;
|
|
2354
|
+
box-sizing: border-box;
|
|
2355
|
+
perspective: 2000px;
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
.stf__item {
|
|
2359
|
+
display: none;
|
|
2360
|
+
position: absolute;
|
|
2361
|
+
transform-style: preserve-3d;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
.stf__outerShadow {
|
|
2365
|
+
position: absolute;
|
|
2366
|
+
left: 0;
|
|
2367
|
+
top: 0;
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
.stf__innerShadow {
|
|
2371
|
+
position: absolute;
|
|
2372
|
+
left: 0;
|
|
2373
|
+
top: 0;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
.stf__hardShadow {
|
|
2377
|
+
position: absolute;
|
|
2378
|
+
left: 0;
|
|
2379
|
+
top: 0;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
.stf__hardInnerShadow {
|
|
2383
|
+
position: absolute;
|
|
2384
|
+
left: 0;
|
|
2385
|
+
top: 0;
|
|
2386
|
+
}`), s.PageFlip = class extends class {
|
|
2387
|
+
constructor() {
|
|
2388
|
+
this.events = /* @__PURE__ */ new Map();
|
|
2389
|
+
}
|
|
2390
|
+
on(p, i) {
|
|
2391
|
+
return this.events.has(p) ? this.events.get(p).push(i) : this.events.set(p, [i]), this;
|
|
2392
|
+
}
|
|
2393
|
+
off(p) {
|
|
2394
|
+
this.events.delete(p);
|
|
2395
|
+
}
|
|
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 });
|
|
2398
|
+
}
|
|
2399
|
+
} {
|
|
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;
|
|
2402
|
+
}
|
|
2403
|
+
destroy() {
|
|
2404
|
+
this.ui.destroy(), this.block.remove();
|
|
2405
|
+
}
|
|
2406
|
+
update() {
|
|
2407
|
+
this.render.update(), this.pages.show();
|
|
2408
|
+
}
|
|
2409
|
+
loadFromImages(p) {
|
|
2410
|
+
this.ui = new G(this.block, this, this.setting);
|
|
2411
|
+
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(() => {
|
|
2413
|
+
this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
|
|
2414
|
+
}, 1);
|
|
2415
|
+
}
|
|
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(() => {
|
|
2418
|
+
this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
|
|
2419
|
+
}, 1);
|
|
2420
|
+
}
|
|
2421
|
+
updateFromImages(p) {
|
|
2422
|
+
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() });
|
|
2424
|
+
}
|
|
2425
|
+
updateFromHtml(p) {
|
|
2426
|
+
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() });
|
|
2428
|
+
}
|
|
2429
|
+
clear() {
|
|
2430
|
+
this.pages.destroy(), this.ui.clear();
|
|
2431
|
+
}
|
|
2432
|
+
turnToPrevPage() {
|
|
2433
|
+
this.pages.showPrev();
|
|
2434
|
+
}
|
|
2435
|
+
turnToNextPage() {
|
|
2436
|
+
this.pages.showNext();
|
|
2437
|
+
}
|
|
2438
|
+
turnToPage(p) {
|
|
2439
|
+
this.pages.show(p);
|
|
2440
|
+
}
|
|
2441
|
+
flipNext(p = "top") {
|
|
2442
|
+
this.flipController.flipNext(p);
|
|
2443
|
+
}
|
|
2444
|
+
flipPrev(p = "top") {
|
|
2445
|
+
this.flipController.flipPrev(p);
|
|
2446
|
+
}
|
|
2447
|
+
flip(p, i = "top") {
|
|
2448
|
+
this.flipController.flipToPage(p, i);
|
|
2449
|
+
}
|
|
2450
|
+
updateState(p) {
|
|
2451
|
+
this.trigger("changeState", this, p);
|
|
2452
|
+
}
|
|
2453
|
+
updatePageIndex(p) {
|
|
2454
|
+
this.trigger("flip", this, p);
|
|
2455
|
+
}
|
|
2456
|
+
updateOrientation(p) {
|
|
2457
|
+
this.ui.setOrientationStyle(p), this.update(), this.trigger("changeOrientation", this, p);
|
|
2458
|
+
}
|
|
2459
|
+
getPageCount() {
|
|
2460
|
+
return this.pages.getPageCount();
|
|
2461
|
+
}
|
|
2462
|
+
getCurrentPageIndex() {
|
|
2463
|
+
return this.pages.getCurrentPageIndex();
|
|
2464
|
+
}
|
|
2465
|
+
getPage(p) {
|
|
2466
|
+
return this.pages.getPage(p);
|
|
2467
|
+
}
|
|
2468
|
+
getRender() {
|
|
2469
|
+
return this.render;
|
|
2470
|
+
}
|
|
2471
|
+
getFlipController() {
|
|
2472
|
+
return this.flipController;
|
|
2473
|
+
}
|
|
2474
|
+
getOrientation() {
|
|
2475
|
+
return this.render.getOrientation();
|
|
2476
|
+
}
|
|
2477
|
+
getBoundsRect() {
|
|
2478
|
+
return this.render.getRect();
|
|
2479
|
+
}
|
|
2480
|
+
getSettings() {
|
|
2481
|
+
return this.setting;
|
|
2482
|
+
}
|
|
2483
|
+
getUI() {
|
|
2484
|
+
return this.ui;
|
|
2485
|
+
}
|
|
2486
|
+
getState() {
|
|
2487
|
+
return this.flipController.getState();
|
|
2488
|
+
}
|
|
2489
|
+
getPageCollection() {
|
|
2490
|
+
return this.pages;
|
|
2491
|
+
}
|
|
2492
|
+
startUserTouch(p) {
|
|
2493
|
+
this.mousePosition = p, this.isUserTouch = !0, this.isUserMove = !1;
|
|
2494
|
+
}
|
|
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);
|
|
2497
|
+
}
|
|
2498
|
+
userStop(p, i = !1) {
|
|
2499
|
+
this.isUserTouch && (this.isUserTouch = !1, i || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(p)));
|
|
2500
|
+
}
|
|
2501
|
+
}, Object.defineProperty(s, "__esModule", { value: !0 });
|
|
2502
|
+
});
|
|
2503
|
+
})(Dt, Dt.exports);
|
|
2504
|
+
var hi = Dt.exports;
|
|
2505
|
+
/**
|
|
2506
|
+
* @license FlipbookEngine v0.2.4
|
|
2507
|
+
* Copyright (c) 2026 Murat Dogan
|
|
2508
|
+
*
|
|
2509
|
+
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
2510
|
+
*
|
|
2511
|
+
* 1. Open Source (AGPLv3): You may use, modify, and distribute this software
|
|
2512
|
+
* under the terms of the GNU Affero General Public License v3.0.
|
|
2513
|
+
*
|
|
2514
|
+
* 2. Commercial License: If you wish to use this software in commercial,
|
|
2515
|
+
* closed-source, or SaaS products without the AGPLv3 obligations,
|
|
2516
|
+
* you must purchase a Commercial License from:
|
|
2517
|
+
* https://flipbookengine.com/pricing
|
|
2518
|
+
*/
|
|
2519
|
+
class li {
|
|
2520
|
+
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
|
+
this.bookContainer = t, this.options = s, this.store = o, s.soundUrl && (this.audioEl = new Audio(s.soundUrl), this.unlockAudio());
|
|
2531
|
+
}
|
|
2532
|
+
unlockAudio() {
|
|
2533
|
+
if (!this.audioEl) return;
|
|
2534
|
+
const t = () => {
|
|
2535
|
+
if (this.audioEl) {
|
|
2536
|
+
const s = this.audioEl.play();
|
|
2537
|
+
s && typeof s.then == "function" && s.then(() => {
|
|
2538
|
+
this.audioEl.pause(), this.audioEl.currentTime = 0;
|
|
2539
|
+
}).catch(() => {
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
document.removeEventListener("touchstart", t), document.removeEventListener("click", t), this.audioUnlockHandler = null;
|
|
2543
|
+
};
|
|
2544
|
+
this.audioUnlockHandler = t, document.addEventListener("touchstart", t, { once: !0 }), document.addEventListener("click", t, { once: !0 });
|
|
2545
|
+
}
|
|
2546
|
+
init(t, s) {
|
|
2547
|
+
this.pageFlip = new hi.PageFlip(this.bookContainer, {
|
|
2548
|
+
width: t,
|
|
2549
|
+
height: s,
|
|
2550
|
+
size: "stretch",
|
|
2551
|
+
minWidth: 100,
|
|
2552
|
+
maxWidth: 3e3,
|
|
2553
|
+
minHeight: 100,
|
|
2554
|
+
maxHeight: 3e3,
|
|
2555
|
+
drawShadow: !0,
|
|
2556
|
+
showCover: !0,
|
|
2557
|
+
usePortrait: !0,
|
|
2558
|
+
mobileScrollSupport: !1,
|
|
2559
|
+
maxShadowOpacity: this.options.maxShadowOpacity || 0.5,
|
|
2560
|
+
flippingTime: this.options.flippingTime || 1e3
|
|
2561
|
+
});
|
|
2562
|
+
const o = this.bookContainer.querySelectorAll(".bz-page");
|
|
2563
|
+
this.pageFlip.loadFromHTML(Array.from(o)), this.bindEvents(), this.setupSignalSync();
|
|
2564
|
+
}
|
|
2565
|
+
bindEvents() {
|
|
2566
|
+
this.pageFlip.on("flip", (t) => {
|
|
2567
|
+
this.store.currentPage.value !== t.data && (this.isLibraryFlipping = !0, this.store.currentPage.value = t.data, this.playSound(), this.isLibraryFlipping = !1);
|
|
2568
|
+
}), this.pageFlip.on("changeState", (t) => {
|
|
2569
|
+
this.store.flipState.value = t.data;
|
|
2570
|
+
}), this.pageFlip.on("changeOrientation", (t) => {
|
|
2571
|
+
this.store.orientation.value !== t.data && (this.store.orientation.value = t.data);
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
setupSignalSync() {
|
|
2575
|
+
this.unsubs.push(
|
|
2576
|
+
j(() => {
|
|
2577
|
+
const t = this.store.currentPage.value, s = this.store.flipState.peek();
|
|
2578
|
+
if (!this.pageFlip || this.isLibraryFlipping || s !== "read") return;
|
|
2579
|
+
const o = this.pageFlip.getCurrentPageIndex();
|
|
2580
|
+
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);
|
|
2583
|
+
}
|
|
2584
|
+
})
|
|
2585
|
+
), this.unsubs.push(
|
|
2586
|
+
j(() => {
|
|
2587
|
+
this.store.isSingleMode.value, this.pageFlip && setTimeout(() => {
|
|
2588
|
+
this.pageFlip && this.pageFlip.update(), window.dispatchEvent(new Event("resize"));
|
|
2589
|
+
}, 50);
|
|
2590
|
+
})
|
|
2591
|
+
), this.unsubs.push(
|
|
2592
|
+
j(() => {
|
|
2593
|
+
const t = this.store.isAutoPlaying.value, s = this.store.autoPlayInterval.value || 3e3;
|
|
2594
|
+
this.autoPlayTimer && (clearInterval(this.autoPlayTimer), this.autoPlayTimer = null), t && (this.autoPlayTimer = setInterval(() => {
|
|
2595
|
+
const o = this.store.pages.value.length - 1;
|
|
2596
|
+
if (this.store.currentPage.peek() >= o || this.store.currentPage.peek() >= o - 1 && !this.store.isSingleMode.peek()) {
|
|
2597
|
+
this.store.isAutoPlaying.value = !1;
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2600
|
+
this.turnToNextPage();
|
|
2601
|
+
}, s));
|
|
2602
|
+
})
|
|
2603
|
+
);
|
|
2604
|
+
}
|
|
2605
|
+
turnToNextPage() {
|
|
2606
|
+
if (this.store.isSingleMode.value) {
|
|
2607
|
+
const t = this.store.currentPage.value + 1;
|
|
2608
|
+
t < this.store.pages.value.length && (this.store.currentPage.value = t, this.playSound());
|
|
2609
|
+
} else this.pageFlip && this.pageFlip.flipNext();
|
|
2610
|
+
}
|
|
2611
|
+
turnToPrevPage() {
|
|
2612
|
+
if (this.store.isSingleMode.value) {
|
|
2613
|
+
const t = this.store.currentPage.value - 1;
|
|
2614
|
+
t >= 0 && (this.store.currentPage.value = t, this.playSound());
|
|
2615
|
+
} else this.pageFlip && this.pageFlip.flipPrev();
|
|
2616
|
+
}
|
|
2617
|
+
playSound() {
|
|
2618
|
+
if (this.store.soundEnabled.value && this.audioEl) {
|
|
2619
|
+
this.audioEl.currentTime = 0;
|
|
2620
|
+
const t = this.audioEl.play();
|
|
2621
|
+
t && typeof t.catch == "function" && t.catch((s) => console.warn("Flipbook Audio Play Error:", s));
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
update() {
|
|
2625
|
+
this.pageFlip && this.pageFlip.update();
|
|
2626
|
+
}
|
|
2627
|
+
destroy() {
|
|
2628
|
+
this.autoPlayTimer && (clearInterval(this.autoPlayTimer), this.autoPlayTimer = null), this.audioUnlockHandler && (document.removeEventListener("touchstart", this.audioUnlockHandler), document.removeEventListener("click", this.audioUnlockHandler), this.audioUnlockHandler = null), this.unsubs.forEach((t) => t()), this.unsubs = [], this.pageFlip && (this.pageFlip.destroy(), this.pageFlip = null);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* @license FlipbookEngine v0.2.4
|
|
2633
|
+
* Copyright (c) 2026 Murat Dogan
|
|
2634
|
+
*
|
|
2635
|
+
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
2636
|
+
*
|
|
2637
|
+
* 1. Open Source (AGPLv3): You may use, modify, and distribute this software
|
|
2638
|
+
* under the terms of the GNU Affero General Public License v3.0.
|
|
2639
|
+
*
|
|
2640
|
+
* 2. Commercial License: If you wish to use this software in commercial,
|
|
2641
|
+
* closed-source, or SaaS products without the AGPLv3 obligations,
|
|
2642
|
+
* you must purchase a Commercial License from:
|
|
2643
|
+
* https://flipbookengine.com/pricing
|
|
2644
|
+
*/
|
|
2645
|
+
class ci {
|
|
2646
|
+
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
|
+
this.pageViewport = t, this.store = s;
|
|
2657
|
+
}
|
|
2658
|
+
init(t, s) {
|
|
2659
|
+
this.wrapperElement = t, this.sizerElement = s, this.setupResizeObserver(), this.setupOrientationMedia(), this.setupStateSync(), this.updateBookAspectRatio();
|
|
2660
|
+
}
|
|
2661
|
+
setupStateSync() {
|
|
2662
|
+
this.unsubs.push(
|
|
2663
|
+
j(() => {
|
|
2664
|
+
this.store.isSingleMode.value, this.store.orientation.value, setTimeout(() => this.updateBookAspectRatio(), 10);
|
|
2665
|
+
})
|
|
2666
|
+
);
|
|
2667
|
+
}
|
|
2668
|
+
setupResizeObserver() {
|
|
2669
|
+
typeof ResizeObserver < "u" && this.wrapperElement && (this.resizeObserver = new ResizeObserver(() => {
|
|
2670
|
+
this.updateBookAspectRatio();
|
|
2671
|
+
}), this.resizeObserver.observe(this.wrapperElement));
|
|
2672
|
+
}
|
|
2673
|
+
setupOrientationMedia() {
|
|
2674
|
+
if (typeof window < "u" && window.matchMedia) {
|
|
2675
|
+
this.orientationMediaQuery = window.matchMedia("(orientation: portrait)");
|
|
2676
|
+
const t = (s) => {
|
|
2677
|
+
s.matches, this.updateBookAspectRatio();
|
|
2678
|
+
};
|
|
2679
|
+
this.orientationChangeHandler = t, this.orientationMediaQuery.addEventListener ? this.orientationMediaQuery.addEventListener("change", t) : this.orientationMediaQuery.addListener(t), t(this.orientationMediaQuery);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
updateBookAspectRatio() {
|
|
2683
|
+
if (!this.wrapperElement || !this.sizerElement) return;
|
|
2684
|
+
const t = this.wrapperElement.clientWidth, s = this.wrapperElement.clientHeight;
|
|
2685
|
+
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();
|
|
2691
|
+
}
|
|
2692
|
+
destroy() {
|
|
2693
|
+
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);
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
/**
|
|
2697
|
+
* @license FlipbookEngine v0.2.4
|
|
2698
|
+
* Copyright (c) 2026 Murat Dogan
|
|
2699
|
+
*
|
|
2700
|
+
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
2701
|
+
*
|
|
2702
|
+
* 1. Open Source (AGPLv3): You may use, modify, and distribute this software
|
|
2703
|
+
* under the terms of the GNU Affero General Public License v3.0.
|
|
2704
|
+
*
|
|
2705
|
+
* 2. Commercial License: If you wish to use this software in commercial,
|
|
2706
|
+
* closed-source, or SaaS products without the AGPLv3 obligations,
|
|
2707
|
+
* you must purchase a Commercial License from:
|
|
2708
|
+
* https://flipbookengine.com/pricing
|
|
2709
|
+
*/
|
|
2710
|
+
class di {
|
|
2711
|
+
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;
|
|
2719
|
+
this.container = t, this.pageFlipAdapter = s, this.store = o;
|
|
2720
|
+
const r = ((c = t.ownerDocument.defaultView) == null ? void 0 : c.AbortController) ?? globalThis.AbortController;
|
|
2721
|
+
this.listenerAbortController = new r();
|
|
2722
|
+
}
|
|
2723
|
+
init() {
|
|
2724
|
+
this.bindWheel(), this.bindMouseDrag(), this.bindTouch(), this.setupStateSync();
|
|
2725
|
+
}
|
|
2726
|
+
setupStateSync() {
|
|
2727
|
+
this.unsubs.push(
|
|
2728
|
+
j(() => {
|
|
2729
|
+
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
|
+
})
|
|
2731
|
+
);
|
|
2732
|
+
}
|
|
2733
|
+
bindWheel() {
|
|
2734
|
+
this.container.addEventListener("wheel", (t) => {
|
|
2735
|
+
this.store.zoomState.value.isActive && (t.preventDefault(), this.updateZoomPan(
|
|
2736
|
+
this.store.zoomState.value.translateX - t.deltaX,
|
|
2737
|
+
this.store.zoomState.value.translateY - t.deltaY
|
|
2738
|
+
));
|
|
2739
|
+
}, { passive: !1, signal: this.listenerAbortController.signal });
|
|
2740
|
+
}
|
|
2741
|
+
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) => {
|
|
2746
|
+
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);
|
|
2749
|
+
}, { signal: this.listenerAbortController.signal }), window.addEventListener("mouseup", () => {
|
|
2750
|
+
t && (t = !1, this.container.style.cursor = this.store.zoomState.value.isActive ? "grab" : "");
|
|
2751
|
+
}, { signal: this.listenerAbortController.signal });
|
|
2752
|
+
}
|
|
2753
|
+
bindTouch() {
|
|
2754
|
+
let t = !1, s = 0, o = 0;
|
|
2755
|
+
this.container.addEventListener("touchstart", (r) => {
|
|
2756
|
+
if (r.touches.length === 1)
|
|
2757
|
+
if (!this.store.zoomState.value.isActive)
|
|
2758
|
+
this.touchStartX = r.touches[0].clientX;
|
|
2759
|
+
else {
|
|
2760
|
+
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;
|
|
2763
|
+
}
|
|
2764
|
+
}, { passive: !0, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchmove", (r) => {
|
|
2765
|
+
if (t && this.store.zoomState.value.isActive && r.touches.length === 1 && this.touchStartX !== null) {
|
|
2766
|
+
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);
|
|
2769
|
+
}
|
|
2770
|
+
}, { passive: !1, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchend", (r) => {
|
|
2771
|
+
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();
|
|
2774
|
+
}
|
|
2775
|
+
this.touchStartX = null, t = !1;
|
|
2776
|
+
}, { passive: !0, signal: this.listenerAbortController.signal });
|
|
2777
|
+
}
|
|
2778
|
+
zoomIn() {
|
|
2779
|
+
let t = this.store.zoomState.value.scale + 0.5;
|
|
2780
|
+
t > 5 && (t = 5), this.store.zoomState.value = {
|
|
2781
|
+
...this.store.zoomState.value,
|
|
2782
|
+
isActive: t > 1,
|
|
2783
|
+
scale: t
|
|
2784
|
+
}, t > 1 && (this.container.style.cursor = "grab");
|
|
2785
|
+
}
|
|
2786
|
+
zoomOut() {
|
|
2787
|
+
let t = this.store.zoomState.value.scale - 0.5;
|
|
2788
|
+
t <= 1 ? (t = 1, this.store.zoomState.value = { ...this.store.zoomState.value, isActive: !1, translateX: 0, translateY: 0, scale: 1 }, this.container.style.cursor = "") : this.store.zoomState.value = { ...this.store.zoomState.value, isActive: !0, scale: t };
|
|
2789
|
+
}
|
|
2790
|
+
updateZoomPan(t, s) {
|
|
2791
|
+
this.store.zoomState.value = {
|
|
2792
|
+
...this.store.zoomState.value,
|
|
2793
|
+
translateX: t,
|
|
2794
|
+
translateY: s
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2797
|
+
destroy() {
|
|
2798
|
+
this.listenerAbortController.abort(), this.unsubs.forEach((t) => t()), this.unsubs = [];
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
/**
|
|
2802
|
+
* @license FlipbookEngine v0.2.4
|
|
2803
|
+
* Copyright (c) 2026 Murat Dogan
|
|
2804
|
+
*
|
|
2805
|
+
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
2806
|
+
*/
|
|
2807
|
+
const ui = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
|
|
2808
|
+
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;
|
|
2812
|
+
} };
|
|
2813
|
+
}
|
|
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) {
|
|
2839
|
+
if (!e || typeof e != "object") return !1;
|
|
2840
|
+
const t = e;
|
|
2841
|
+
return typeof t.normal == "string" && typeof t.low == "string" && typeof t.thumb == "string";
|
|
2842
|
+
}
|
|
2843
|
+
function pi(e) {
|
|
2844
|
+
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
|
+
}
|
|
2846
|
+
function fi(e) {
|
|
2847
|
+
return e === "rtl" ? ["right", "left"] : ["left", "right"];
|
|
2848
|
+
}
|
|
2849
|
+
function mi(e) {
|
|
2850
|
+
const t = [];
|
|
2851
|
+
let s = 1;
|
|
2852
|
+
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) => {
|
|
2857
|
+
t.push({
|
|
2858
|
+
index: t.length,
|
|
2859
|
+
assetId: g,
|
|
2860
|
+
pageNumber: $,
|
|
2861
|
+
cropMode: L[T] ?? "full",
|
|
2862
|
+
normal: o.normal,
|
|
2863
|
+
low: o.low,
|
|
2864
|
+
thumb: o.thumb
|
|
2865
|
+
});
|
|
2866
|
+
}), s = b[b.length - 1] + 1;
|
|
2867
|
+
return;
|
|
2868
|
+
}
|
|
2869
|
+
const S = P[0] ?? s;
|
|
2870
|
+
t.push({
|
|
2871
|
+
index: t.length,
|
|
2872
|
+
assetId: g,
|
|
2873
|
+
pageNumber: S,
|
|
2874
|
+
cropMode: "full",
|
|
2875
|
+
normal: o.normal,
|
|
2876
|
+
low: o.low,
|
|
2877
|
+
thumb: o.thumb
|
|
2878
|
+
}), s = S + 1;
|
|
2879
|
+
}), t;
|
|
2880
|
+
}
|
|
2881
|
+
function Kt(e, t) {
|
|
2882
|
+
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
|
+
const s = t.cssVariables ?? {};
|
|
2884
|
+
Object.entries(s).forEach(([o, r]) => {
|
|
2885
|
+
const c = o.startsWith("--") ? o : `--${o}`;
|
|
2886
|
+
e.style.setProperty(c, r);
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
2889
|
+
class wi {
|
|
2890
|
+
constructor(t = {}) {
|
|
2891
|
+
v(this, "pdfDoc", null);
|
|
2892
|
+
v(this, "loadingTask", null);
|
|
2893
|
+
v(this, "options");
|
|
2894
|
+
this.options = {
|
|
2895
|
+
scale: t.scale || 1.5,
|
|
2896
|
+
quality: t.quality || 0.85,
|
|
2897
|
+
format: t.format || "image/webp",
|
|
2898
|
+
workerSrc: t.workerSrc || "",
|
|
2899
|
+
concurrency: Math.max(1, Math.floor(t.concurrency || 3))
|
|
2900
|
+
}, this.options.workerSrc && (Bt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
|
|
2901
|
+
}
|
|
2902
|
+
/** Loads a PDF document and cancels PDF.js loading when the signal aborts. */
|
|
2903
|
+
async loadDocument(t, s) {
|
|
2904
|
+
this.throwIfAborted(s);
|
|
2905
|
+
const o = Bt.getDocument(t);
|
|
2906
|
+
this.loadingTask = o;
|
|
2907
|
+
const r = () => {
|
|
2908
|
+
var c;
|
|
2909
|
+
return (c = o.destroy) == null ? void 0 : c.call(o);
|
|
2910
|
+
};
|
|
2911
|
+
s == null || s.addEventListener("abort", r, { once: !0 });
|
|
2912
|
+
try {
|
|
2913
|
+
return this.pdfDoc = await o.promise, this.throwIfAborted(s), this.pdfDoc.numPages;
|
|
2914
|
+
} catch (c) {
|
|
2915
|
+
throw s != null && s.aborted ? this.createAbortError() : c;
|
|
2916
|
+
} finally {
|
|
2917
|
+
s == null || s.removeEventListener("abort", r), this.loadingTask === o && (this.loadingTask = null);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
/** Renders a specific page to a Data URL. The page index is 1-based. */
|
|
2921
|
+
async renderPageToDataUrl(t, s) {
|
|
2922
|
+
if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
|
|
2923
|
+
this.throwIfAborted(s);
|
|
2924
|
+
try {
|
|
2925
|
+
const o = await this.pdfDoc.getPage(t);
|
|
2926
|
+
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);
|
|
2934
|
+
};
|
|
2935
|
+
s == null || s.addEventListener("abort", P, { once: !0 });
|
|
2936
|
+
try {
|
|
2937
|
+
await f.promise, this.throwIfAborted(s);
|
|
2938
|
+
} finally {
|
|
2939
|
+
s == null || s.removeEventListener("abort", P);
|
|
2940
|
+
}
|
|
2941
|
+
return c.toDataURL(this.options.format, this.options.quality);
|
|
2942
|
+
}
|
|
2943
|
+
} catch (o) {
|
|
2944
|
+
if (s != null && s.aborted) throw this.createAbortError();
|
|
2945
|
+
console.error(`PDF page ${t} render error:`, o);
|
|
2946
|
+
}
|
|
2947
|
+
return "";
|
|
2948
|
+
}
|
|
2949
|
+
/** Calculates the best viewport dimensions based on the first page. */
|
|
2950
|
+
async calculateViewportDimensions(t = 420) {
|
|
2951
|
+
if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
|
|
2952
|
+
const o = (await this.pdfDoc.getPage(1)).getViewport({ scale: 1 }), r = o.width / o.height;
|
|
2953
|
+
return r >= 1 ? { width: Math.round(t * r), height: t } : { width: t, height: Math.round(t / r) };
|
|
2954
|
+
}
|
|
2955
|
+
/** Renders pages concurrently with a bounded worker pool and preserves page order. */
|
|
2956
|
+
async renderAllPages(t, s) {
|
|
2957
|
+
if (!this.pdfDoc) return [];
|
|
2958
|
+
this.throwIfAborted(t);
|
|
2959
|
+
const o = this.pdfDoc.numPages, r = new Array(o);
|
|
2960
|
+
let c = 1, g = 0;
|
|
2961
|
+
const f = async () => {
|
|
2962
|
+
for (; ; ) {
|
|
2963
|
+
this.throwIfAborted(t);
|
|
2964
|
+
const S = c++;
|
|
2965
|
+
if (S > o) return;
|
|
2966
|
+
const b = await this.renderPageToDataUrl(S, t);
|
|
2967
|
+
r[S - 1] = {
|
|
2968
|
+
index: S - 1,
|
|
2969
|
+
assetId: `pdf-page-${S}`,
|
|
2970
|
+
pageNumber: S,
|
|
2971
|
+
cropMode: "full",
|
|
2972
|
+
normal: b,
|
|
2973
|
+
low: b,
|
|
2974
|
+
thumb: b
|
|
2975
|
+
}, g++, s == null || s({ completed: g, total: o });
|
|
2976
|
+
}
|
|
2977
|
+
}, P = Math.min(this.options.concurrency, o);
|
|
2978
|
+
return await Promise.all(Array.from({ length: P }, () => f())), this.throwIfAborted(t), r;
|
|
2979
|
+
}
|
|
2980
|
+
throwIfAborted(t) {
|
|
2981
|
+
if (t != null && t.aborted) throw this.createAbortError();
|
|
2982
|
+
}
|
|
2983
|
+
createAbortError() {
|
|
2984
|
+
const t = new Error("PDF rendering was aborted.");
|
|
2985
|
+
return t.name = "AbortError", t;
|
|
2986
|
+
}
|
|
2987
|
+
destroy() {
|
|
2988
|
+
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);
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* @license FlipbookEngine v0.2.4
|
|
2994
|
+
* Copyright (c) 2026 Murat Dogan
|
|
2995
|
+
*
|
|
2996
|
+
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
2997
|
+
*
|
|
2998
|
+
* 1. Open Source (AGPLv3): You may use, modify, and distribute this software
|
|
2999
|
+
* under the terms of the GNU Affero General Public License v3.0.
|
|
3000
|
+
*
|
|
3001
|
+
* 2. Commercial License: If you wish to use this software in commercial,
|
|
3002
|
+
* closed-source, or SaaS products without the AGPLv3 obligations,
|
|
3003
|
+
* you must purchase a Commercial License from:
|
|
3004
|
+
* https://flipbookengine.com/pricing
|
|
3005
|
+
*/
|
|
3006
|
+
const mt = class mt {
|
|
3007
|
+
constructor(t, s = {}) {
|
|
3008
|
+
v(this, "container", null);
|
|
3009
|
+
v(this, "options");
|
|
3010
|
+
v(this, "store", fe());
|
|
3011
|
+
// 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);
|
|
3024
|
+
this.selector = t, this.options = {
|
|
3025
|
+
allowDownload: !0,
|
|
3026
|
+
showThumbs: !0,
|
|
3027
|
+
primaryColor: "#7367f0",
|
|
3028
|
+
theme: "auto",
|
|
3029
|
+
soundUrl: "https://flipbookengine.com/Content/page-flip.mp3",
|
|
3030
|
+
autoPlayInterval: 3e3,
|
|
3031
|
+
pdfRenderScale: 1.5,
|
|
3032
|
+
pdfRenderQuality: 0.85,
|
|
3033
|
+
pdfRenderFormat: "image/webp",
|
|
3034
|
+
pdfRenderConcurrency: 3,
|
|
3035
|
+
...s
|
|
3036
|
+
}, this.setupEventSync();
|
|
3037
|
+
}
|
|
3038
|
+
async init(t, s) {
|
|
3039
|
+
if (typeof this.selector == "string" ? this.container = document.querySelector(this.selector) : this.container = this.selector, !this.container) return;
|
|
3040
|
+
this.destroy(!0), this.eventsReady = !1;
|
|
3041
|
+
const o = this.initGeneration, r = new AbortController();
|
|
3042
|
+
this.initAbortController = r;
|
|
3043
|
+
let c = [], g = { ...mt.DEFAULT_PAGE_VIEWPORT };
|
|
3044
|
+
if (s && s.length > 0) {
|
|
3045
|
+
if (r.signal.aborted) return;
|
|
3046
|
+
const T = s.filter(gi);
|
|
3047
|
+
c = mi(T);
|
|
3048
|
+
const A = c[0];
|
|
3049
|
+
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) };
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
} else if (t) {
|
|
3057
|
+
if (r.signal.aborted) return;
|
|
3058
|
+
let T = "load";
|
|
3059
|
+
try {
|
|
3060
|
+
this.pdfRenderer = new wi({
|
|
3061
|
+
scale: this.options.pdfRenderScale,
|
|
3062
|
+
quality: this.options.pdfRenderQuality,
|
|
3063
|
+
format: this.options.pdfRenderFormat,
|
|
3064
|
+
concurrency: this.options.pdfRenderConcurrency,
|
|
3065
|
+
workerSrc: this.options.pdfWorkerSrc
|
|
3066
|
+
}), this.emit("progress", { phase: "loading", completed: 0, total: 0 });
|
|
3067
|
+
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();
|
|
3071
|
+
} catch (A) {
|
|
3072
|
+
r.signal.aborted || (console.error("PDF load failed:", A), this.emit("error", {
|
|
3073
|
+
code: T === "load" ? "PDF_LOAD_FAILED" : "PDF_RENDER_FAILED",
|
|
3074
|
+
message: A instanceof Error ? A.message : "Unable to load PDF.",
|
|
3075
|
+
cause: A
|
|
3076
|
+
}));
|
|
3077
|
+
return;
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
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({
|
|
3084
|
+
pageFlipAdapterRef: b,
|
|
3085
|
+
interactionManagerRef: L,
|
|
3086
|
+
bookWrapperRef: (T) => f = T,
|
|
3087
|
+
bookSizerRef: (T) => P = T,
|
|
3088
|
+
bookContainerRef: (T) => S = T,
|
|
3089
|
+
className: this.options.className,
|
|
3090
|
+
store: this.store,
|
|
3091
|
+
onToggleFullscreen: () => this.toggleFullscreen(),
|
|
3092
|
+
onDownload: () => {
|
|
3093
|
+
t && (this.options.onDownload ? this.options.onDownload(t) : window.open(t, "_blank"));
|
|
3094
|
+
}
|
|
3095
|
+
});
|
|
3096
|
+
this.container.appendChild($), this.setupQualityLoading(), this.layoutManager = new ci(g, this.store), this.layoutManager.onResizeCallback = () => {
|
|
3097
|
+
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) => {
|
|
3099
|
+
const A = () => {
|
|
3100
|
+
r.signal.removeEventListener("abort", A), T();
|
|
3101
|
+
};
|
|
3102
|
+
r.signal.addEventListener("abort", A, { once: !0 }), this.initializationTimer = setTimeout(() => {
|
|
3103
|
+
if (this.initializationTimer = null, r.signal.removeEventListener("abort", A), r.signal.aborted || o !== this.initGeneration || !this.pageFlipAdapter) {
|
|
3104
|
+
T();
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
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();
|
|
3108
|
+
}, 10);
|
|
3109
|
+
}), this.initAbortController === r && (this.initAbortController = null);
|
|
3110
|
+
}
|
|
3111
|
+
loadImageSize(t) {
|
|
3112
|
+
return new Promise((s) => {
|
|
3113
|
+
const o = new Image();
|
|
3114
|
+
o.onload = () => s({ width: o.naturalWidth || o.width, height: o.naturalHeight || o.height }), o.onerror = () => s(null), o.src = t;
|
|
3115
|
+
});
|
|
3116
|
+
}
|
|
3117
|
+
goToPage(t) {
|
|
3118
|
+
const s = Math.max(0, this.store.totalPages.value - 1);
|
|
3119
|
+
this.store.currentPage.value = Math.max(0, Math.min(s, Math.trunc(t)));
|
|
3120
|
+
}
|
|
3121
|
+
getTotalPages() {
|
|
3122
|
+
return this.store.totalPages.value;
|
|
3123
|
+
}
|
|
3124
|
+
getCurrentPage() {
|
|
3125
|
+
return this.store.currentPage.value;
|
|
3126
|
+
}
|
|
3127
|
+
getZoom() {
|
|
3128
|
+
return this.store.zoomState.value.scale;
|
|
3129
|
+
}
|
|
3130
|
+
setZoom(t) {
|
|
3131
|
+
const s = Number.isFinite(t) ? t : 1, o = Math.max(0.5, Math.min(5, s));
|
|
3132
|
+
this.store.zoomState.value = {
|
|
3133
|
+
...this.store.zoomState.value,
|
|
3134
|
+
scale: o,
|
|
3135
|
+
isActive: o > 1,
|
|
3136
|
+
...o <= 1 ? { translateX: 0, translateY: 0 } : {}
|
|
3137
|
+
}, this.store.isZoomed.value = o > 1;
|
|
3138
|
+
}
|
|
3139
|
+
nextPage() {
|
|
3140
|
+
this.pageFlipAdapter && this.pageFlipAdapter.turnToNextPage();
|
|
3141
|
+
}
|
|
3142
|
+
toggleFullscreen() {
|
|
3143
|
+
var s, o;
|
|
3144
|
+
const t = this.container;
|
|
3145
|
+
t && (document.fullscreenElement ? (o = document.exitFullscreen) == null || o.call(document).catch((r) => console.warn("Exit fullscreen err:", r)) : (s = t.requestFullscreen) == null || s.call(t).catch((r) => console.warn("Fullscreen err:", r)));
|
|
3146
|
+
}
|
|
3147
|
+
setLocale(t, s) {
|
|
3148
|
+
const o = s ? { ...this.options.messages, [t]: s[t] ?? s } : this.options.messages;
|
|
3149
|
+
this.options = { ...this.options, locale: t, messages: o }, this.store.locale.value = t, o && (this.store.messages.value = o);
|
|
3150
|
+
}
|
|
3151
|
+
prevPage() {
|
|
3152
|
+
this.pageFlipAdapter && this.pageFlipAdapter.turnToPrevPage();
|
|
3153
|
+
}
|
|
3154
|
+
setSingleMode(t) {
|
|
3155
|
+
this.store.isSingleMode.value = t;
|
|
3156
|
+
}
|
|
3157
|
+
updateOptions(t) {
|
|
3158
|
+
this.options = { ...this.options, ...t }, t.theme !== void 0 && (this.store.themeMode.value = t.theme), t.primaryColor !== void 0 && (this.store.primaryColor.value = t.primaryColor), t.showThumbs !== void 0 && (this.store.showThumbs.value = t.showThumbs), t.showArrows !== void 0 && (this.store.showArrows.value = t.showArrows), t.allowDownload !== void 0 && (this.store.allowDownload.value = t.allowDownload), t.whiteLabel !== void 0 && (this.store.whiteLabel.value = t.whiteLabel), t.soundEnabled !== void 0 && (this.store.soundEnabled.value = t.soundEnabled), t.locale !== void 0 && (this.store.locale.value = t.locale), t.messages !== void 0 && (this.store.messages.value = t.messages), t.singleMode !== void 0 && (this.store.isSingleMode.value = t.singleMode), t.isSingleMode !== void 0 && (this.store.isSingleMode.value = t.isSingleMode), t.autoPlay !== void 0 && (this.store.isAutoPlaying.value = t.autoPlay), t.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = t.autoPlayInterval), this.container && Kt(this.container, this.options);
|
|
3159
|
+
}
|
|
3160
|
+
async setPages(t, s) {
|
|
3161
|
+
if (!(t != null && t.length)) {
|
|
3162
|
+
s && await this.init(s);
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3165
|
+
await this.init(s || "", t);
|
|
3166
|
+
}
|
|
3167
|
+
setupQualityLoading() {
|
|
3168
|
+
var r;
|
|
3169
|
+
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);
|
|
3173
|
+
}, o = (r = this.container.ownerDocument.defaultView) == null ? void 0 : r.IntersectionObserver;
|
|
3174
|
+
if (!o) {
|
|
3175
|
+
t.forEach(s);
|
|
3176
|
+
return;
|
|
3177
|
+
}
|
|
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));
|
|
3182
|
+
});
|
|
3183
|
+
}, { root: this.container, rootMargin: "240px" }), t.forEach((c) => {
|
|
3184
|
+
var g;
|
|
3185
|
+
return (g = this.qualityObserver) == null ? void 0 : g.observe(c);
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
teardownQualityLoading() {
|
|
3189
|
+
var t;
|
|
3190
|
+
(t = this.qualityObserver) == null || t.disconnect(), this.qualityObserver = null;
|
|
3191
|
+
}
|
|
3192
|
+
setupEventSync() {
|
|
3193
|
+
this.eventSyncStop = j(() => {
|
|
3194
|
+
const t = {
|
|
3195
|
+
currentPage: this.store.currentPage.value,
|
|
3196
|
+
zoom: this.store.zoomState.value.scale,
|
|
3197
|
+
zoomActive: this.store.zoomState.value.isActive,
|
|
3198
|
+
showThumbs: this.store.showThumbs.value,
|
|
3199
|
+
isSingle: this.store.isSingleMode.value,
|
|
3200
|
+
orientation: this.store.orientation.value
|
|
3201
|
+
};
|
|
3202
|
+
if (!this.eventsReady) {
|
|
3203
|
+
this.lastEventState = t;
|
|
3204
|
+
return;
|
|
3205
|
+
}
|
|
3206
|
+
t.currentPage !== this.lastEventState.currentPage && this.emit("pageChange", {
|
|
3207
|
+
currentPage: t.currentPage,
|
|
3208
|
+
pageNumber: t.currentPage + 1,
|
|
3209
|
+
totalPages: this.store.totalPages.value,
|
|
3210
|
+
isSingle: t.isSingle
|
|
3211
|
+
}), (t.zoom !== this.lastEventState.zoom || t.zoomActive !== this.lastEventState.zoomActive) && this.emit("zoomChange", { zoom: t.zoom, isActive: t.zoomActive }), t.showThumbs !== this.lastEventState.showThumbs && this.emit("thumbsToggle", { showThumbs: t.showThumbs }), t.isSingle !== this.lastEventState.isSingle && this.emit("singlePageModeChange", { isSingle: t.isSingle }), t.orientation !== this.lastEventState.orientation && this.emit("orientationChange", { orientation: t.orientation }), this.lastEventState = t;
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
captureEventState() {
|
|
3215
|
+
this.lastEventState = {
|
|
3216
|
+
currentPage: this.store.currentPage.value,
|
|
3217
|
+
zoom: this.store.zoomState.value.scale,
|
|
3218
|
+
zoomActive: this.store.zoomState.value.isActive,
|
|
3219
|
+
showThumbs: this.store.showThumbs.value,
|
|
3220
|
+
isSingle: this.store.isSingleMode.value,
|
|
3221
|
+
orientation: this.store.orientation.value
|
|
3222
|
+
};
|
|
3223
|
+
}
|
|
3224
|
+
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);
|
|
3227
|
+
}
|
|
3228
|
+
on(t, s) {
|
|
3229
|
+
const o = this.listeners[t] ?? /* @__PURE__ */ new Set();
|
|
3230
|
+
return o.add(s), this.listeners[t] = o, () => this.off(t, s);
|
|
3231
|
+
}
|
|
3232
|
+
off(t, s) {
|
|
3233
|
+
var o;
|
|
3234
|
+
(o = this.listeners[t]) == null || o.delete(s);
|
|
3235
|
+
}
|
|
3236
|
+
emit(t, s) {
|
|
3237
|
+
var o;
|
|
3238
|
+
(o = this.listeners[t]) == null || o.forEach((r) => {
|
|
3239
|
+
r(s);
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
v(mt, "DEFAULT_PAGE_VIEWPORT", { width: 420, height: 594 });
|
|
3244
|
+
let It = mt;
|
|
3245
|
+
const me = globalThis, we = me.FlipbookEngine || {};
|
|
3246
|
+
we.FlipbookEngine = It;
|
|
3247
|
+
me.FlipbookEngine = we;
|
|
3248
|
+
export {
|
|
3249
|
+
It as F,
|
|
3250
|
+
gi as i,
|
|
3251
|
+
mi as n
|
|
3252
|
+
};
|
|
3253
|
+
//# sourceMappingURL=engine-G9HiVpA-.js.map
|