html-flip-book-react 0.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/flip-book.d.ts +14 -0
  2. package/dist/flip-book.d.ts.map +1 -0
  3. package/dist/flip-book.js +1410 -0
  4. package/dist/flip-book.js.map +1 -0
  5. package/example/.vscode/settings.json +3 -0
  6. package/example/README.md +47 -0
  7. package/example/assets/pages_data/en/assets/cover.jpg +0 -0
  8. package/example/assets/pages_data/en/assets/sql-command.png +0 -0
  9. package/example/assets/pages_data/en/content/000-introduction.md +85 -0
  10. package/example/assets/pages_data/en/content/001-databases.md +39 -0
  11. package/example/assets/pages_data/en/content/002-install-mysql.md +162 -0
  12. package/example/assets/pages_data/en/content/003-creating-tables.md +304 -0
  13. package/example/assets/pages_data/en/content/004-basic-syntax.md +145 -0
  14. package/example/assets/pages_data/en/content/005-select.md +359 -0
  15. package/example/assets/pages_data/en/content/006-where.md +225 -0
  16. package/example/assets/pages_data/en/content/007-order-and-group-by.md +142 -0
  17. package/example/assets/pages_data/en/content/008-insert.md +86 -0
  18. package/example/assets/pages_data/en/content/009-update.md +92 -0
  19. package/example/assets/pages_data/en/content/010-delete.md +28 -0
  20. package/example/assets/pages_data/en/content/011-join.md +297 -0
  21. package/example/assets/pages_data/en/content/012-sql-command-categories.md +121 -0
  22. package/example/assets/pages_data/en/content/013-sub-queries.md +112 -0
  23. package/example/assets/pages_data/en/content/014-unions.md +124 -0
  24. package/example/assets/pages_data/en/content/015-Keys-in-a-Relational Database.md +51 -0
  25. package/example/assets/pages_data/en/content/016-Logical-operator-keywords.md +17 -0
  26. package/example/assets/pages_data/en/content/017-having-clause_aggregate-functions.md +184 -0
  27. package/example/assets/pages_data/en/content/018-essential-mysql-functions.md +190 -0
  28. package/example/assets/pages_data/en/content/019-triggers-in-sql.md +133 -0
  29. package/example/assets/pages_data/en/content/020-TCL-commands.md +154 -0
  30. package/example/assets/pages_data/en/content/021-DCL-commands.md +126 -0
  31. package/example/assets/pages_data/en/content/100-mysqldump.md +109 -0
  32. package/example/assets/pages_data/en/content/101-learn-materialize.md +267 -0
  33. package/example/assets/pages_data/en/content/999-conclusion.md +24 -0
  34. package/example/assets/pages_data/he/4.txt +2 -0
  35. package/example/assets/pages_data/he/5.txt +4 -0
  36. package/example/assets/pages_data/he/6.txt +4 -0
  37. package/example/index.html +21 -0
  38. package/example/package-lock.json +5324 -0
  39. package/example/package.json +39 -0
  40. package/example/src/App.css +52 -0
  41. package/example/src/App.tsx +25 -0
  42. package/example/src/EnBook.tsx +55 -0
  43. package/example/src/HeBook.tsx +44 -0
  44. package/example/src/index.tsx +12 -0
  45. package/example/vite-env.d.ts +1 -0
  46. package/example/vite.config.js +84 -0
  47. package/package.json +45 -0
  48. package/src/FlipBook.tsx +45 -0
  49. package/vite.config.js +66 -0
@@ -0,0 +1,1410 @@
1
+ var ii = Object.defineProperty;
2
+ var ni = (d, r, s) => r in d ? ii(d, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : d[r] = s;
3
+ var x = (d, r, s) => ni(d, typeof r != "symbol" ? r + "" : r, s);
4
+ import ri, { useRef as oi, useEffect as si } from "react";
5
+ var Ee = { exports: {} }, Ht = {};
6
+ var je;
7
+ function ai() {
8
+ if (je) return Ht;
9
+ je = 1;
10
+ var d = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
11
+ function s(u, c, v) {
12
+ var f = null;
13
+ if (v !== void 0 && (f = "" + v), c.key !== void 0 && (f = "" + c.key), "key" in c) {
14
+ v = {};
15
+ for (var l in c)
16
+ l !== "key" && (v[l] = c[l]);
17
+ } else v = c;
18
+ return c = v.ref, {
19
+ $$typeof: d,
20
+ type: u,
21
+ key: f,
22
+ ref: c !== void 0 ? c : null,
23
+ props: v
24
+ };
25
+ }
26
+ return Ht.Fragment = r, Ht.jsx = s, Ht.jsxs = s, Ht;
27
+ }
28
+ var Bt = {};
29
+ var Ye;
30
+ function ui() {
31
+ return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && function() {
32
+ function d(i) {
33
+ for (var h = arguments.length, p = Array(1 < h ? h - 1 : 0), T = 1; T < h; T++)
34
+ p[T - 1] = arguments[T];
35
+ h = i, T = Error("react-stack-top-frame"), G.getCurrentStack && (T = G.getCurrentStack(T), T !== "" && (h += "%s", p = p.concat([T]))), p.unshift(h), Function.prototype.apply.call(console.error, console, p);
36
+ }
37
+ function r(i) {
38
+ if (i == null) return null;
39
+ if (typeof i == "function")
40
+ return i.$$typeof === ce ? null : i.displayName || i.name || null;
41
+ if (typeof i == "string") return i;
42
+ switch (i) {
43
+ case at:
44
+ return "Fragment";
45
+ case rt:
46
+ return "Portal";
47
+ case At:
48
+ return "Profiler";
49
+ case Pt:
50
+ return "StrictMode";
51
+ case st:
52
+ return "Suspense";
53
+ case ft:
54
+ return "SuspenseList";
55
+ }
56
+ if (typeof i == "object")
57
+ switch (typeof i.tag == "number" && d(
58
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
59
+ ), i.$$typeof) {
60
+ case ot:
61
+ return (i.displayName || "Context") + ".Provider";
62
+ case Yt:
63
+ return (i._context.displayName || "Context") + ".Consumer";
64
+ case ht:
65
+ var h = i.render;
66
+ return i = i.displayName, i || (i = h.displayName || h.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
67
+ case Nt:
68
+ return h = i.displayName || null, h !== null ? h : r(i.type) || "Memo";
69
+ case pt:
70
+ h = i._payload, i = i._init;
71
+ try {
72
+ return r(i(h));
73
+ } catch {
74
+ }
75
+ }
76
+ return null;
77
+ }
78
+ function s(i) {
79
+ return "" + i;
80
+ }
81
+ function u(i) {
82
+ try {
83
+ s(i);
84
+ var h = !1;
85
+ } catch {
86
+ h = !0;
87
+ }
88
+ if (h)
89
+ return h = typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object", d(
90
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
91
+ h
92
+ ), s(i);
93
+ }
94
+ function c() {
95
+ }
96
+ function v() {
97
+ if (I === 0) {
98
+ _ = console.log, Y = console.info, xt = console.warn, dt = console.error, vt = console.group, gt = console.groupCollapsed, mt = console.groupEnd;
99
+ var i = {
100
+ configurable: !0,
101
+ enumerable: !0,
102
+ value: c,
103
+ writable: !0
104
+ };
105
+ Object.defineProperties(console, {
106
+ info: i,
107
+ log: i,
108
+ warn: i,
109
+ error: i,
110
+ group: i,
111
+ groupCollapsed: i,
112
+ groupEnd: i
113
+ });
114
+ }
115
+ I++;
116
+ }
117
+ function f() {
118
+ if (I--, I === 0) {
119
+ var i = { configurable: !0, enumerable: !0, writable: !0 };
120
+ Object.defineProperties(console, {
121
+ log: B({}, i, { value: _ }),
122
+ info: B({}, i, { value: Y }),
123
+ warn: B({}, i, { value: xt }),
124
+ error: B({}, i, { value: dt }),
125
+ group: B({}, i, { value: vt }),
126
+ groupCollapsed: B({}, i, { value: gt }),
127
+ groupEnd: B({}, i, { value: mt })
128
+ });
129
+ }
130
+ 0 > I && d(
131
+ "disabledDepth fell below zero. This is a bug in React. Please file an issue."
132
+ );
133
+ }
134
+ function l(i) {
135
+ if (V === void 0)
136
+ try {
137
+ throw Error();
138
+ } catch (p) {
139
+ var h = p.stack.trim().match(/\n( *(at )?)/);
140
+ V = h && h[1] || "";
141
+ }
142
+ return `
143
+ ` + V + i;
144
+ }
145
+ function E(i, h) {
146
+ if (!i || J) return "";
147
+ var p = It.get(i);
148
+ if (p !== void 0) return p;
149
+ J = !0, p = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
150
+ var T = null;
151
+ T = G.H, G.H = null, v();
152
+ var k = {
153
+ DetermineComponentFrameRoot: function() {
154
+ try {
155
+ if (h) {
156
+ var Q = function() {
157
+ throw Error();
158
+ };
159
+ if (Object.defineProperty(Q.prototype, "props", {
160
+ set: function() {
161
+ throw Error();
162
+ }
163
+ }), typeof Reflect == "object" && Reflect.construct) {
164
+ try {
165
+ Reflect.construct(Q, []);
166
+ } catch (K) {
167
+ var Et = K;
168
+ }
169
+ Reflect.construct(i, [], Q);
170
+ } else {
171
+ try {
172
+ Q.call();
173
+ } catch (K) {
174
+ Et = K;
175
+ }
176
+ i.call(Q.prototype);
177
+ }
178
+ } else {
179
+ try {
180
+ throw Error();
181
+ } catch (K) {
182
+ Et = K;
183
+ }
184
+ (Q = i()) && typeof Q.catch == "function" && Q.catch(function() {
185
+ });
186
+ }
187
+ } catch (K) {
188
+ if (K && Et && typeof K.stack == "string")
189
+ return [K.stack, Et.stack];
190
+ }
191
+ return [null, null];
192
+ }
193
+ };
194
+ k.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
195
+ var Tt = Object.getOwnPropertyDescriptor(
196
+ k.DetermineComponentFrameRoot,
197
+ "name"
198
+ );
199
+ Tt && Tt.configurable && Object.defineProperty(
200
+ k.DetermineComponentFrameRoot,
201
+ "name",
202
+ { value: "DetermineComponentFrameRoot" }
203
+ );
204
+ try {
205
+ var m = k.DetermineComponentFrameRoot(), S = m[0], Z = m[1];
206
+ if (S && Z) {
207
+ var z = S.split(`
208
+ `), ut = Z.split(`
209
+ `);
210
+ for (S = m = 0; m < z.length && !z[m].includes(
211
+ "DetermineComponentFrameRoot"
212
+ ); )
213
+ m++;
214
+ for (; S < ut.length && !ut[S].includes("DetermineComponentFrameRoot"); )
215
+ S++;
216
+ if (m === z.length || S === ut.length)
217
+ for (m = z.length - 1, S = ut.length - 1; 1 <= m && 0 <= S && z[m] !== ut[S]; )
218
+ S--;
219
+ for (; 1 <= m && 0 <= S; m--, S--)
220
+ if (z[m] !== ut[S]) {
221
+ if (m !== 1 || S !== 1)
222
+ do
223
+ if (m--, S--, 0 > S || z[m] !== ut[S]) {
224
+ var yt = `
225
+ ` + z[m].replace(
226
+ " at new ",
227
+ " at "
228
+ );
229
+ return i.displayName && yt.includes("<anonymous>") && (yt = yt.replace("<anonymous>", i.displayName)), typeof i == "function" && It.set(i, yt), yt;
230
+ }
231
+ while (1 <= m && 0 <= S);
232
+ break;
233
+ }
234
+ }
235
+ } finally {
236
+ J = !1, G.H = T, f(), Error.prepareStackTrace = p;
237
+ }
238
+ return z = (z = i ? i.displayName || i.name : "") ? l(z) : "", typeof i == "function" && It.set(i, z), z;
239
+ }
240
+ function y(i) {
241
+ if (i == null) return "";
242
+ if (typeof i == "function") {
243
+ var h = i.prototype;
244
+ return E(
245
+ i,
246
+ !(!h || !h.isReactComponent)
247
+ );
248
+ }
249
+ if (typeof i == "string") return l(i);
250
+ switch (i) {
251
+ case st:
252
+ return l("Suspense");
253
+ case ft:
254
+ return l("SuspenseList");
255
+ }
256
+ if (typeof i == "object")
257
+ switch (i.$$typeof) {
258
+ case ht:
259
+ return i = E(i.render, !1), i;
260
+ case Nt:
261
+ return y(i.type);
262
+ case pt:
263
+ h = i._payload, i = i._init;
264
+ try {
265
+ return y(i(h));
266
+ } catch {
267
+ }
268
+ }
269
+ return "";
270
+ }
271
+ function w() {
272
+ var i = G.A;
273
+ return i === null ? null : i.getOwner();
274
+ }
275
+ function P(i) {
276
+ if (Xt.call(i, "ref")) {
277
+ var h = Object.getOwnPropertyDescriptor(i, "ref").get;
278
+ if (h && h.isReactWarning) return !1;
279
+ }
280
+ return i.ref !== void 0;
281
+ }
282
+ function g(i) {
283
+ if (Xt.call(i, "key")) {
284
+ var h = Object.getOwnPropertyDescriptor(i, "key").get;
285
+ if (h && h.isReactWarning) return !1;
286
+ }
287
+ return i.key !== void 0;
288
+ }
289
+ function C(i, h) {
290
+ function p() {
291
+ Rt || (Rt = !0, d(
292
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
293
+ h
294
+ ));
295
+ }
296
+ p.isReactWarning = !0, Object.defineProperty(i, "key", {
297
+ get: p,
298
+ configurable: !0
299
+ });
300
+ }
301
+ function O() {
302
+ var i = r(this.type);
303
+ return U[i] || (U[i] = !0, d(
304
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
305
+ )), i = this.props.ref, i !== void 0 ? i : null;
306
+ }
307
+ function F(i, h, p, T, k, Tt, m) {
308
+ return p = m.ref, i = {
309
+ $$typeof: nt,
310
+ type: i,
311
+ key: h,
312
+ props: m,
313
+ _owner: Tt
314
+ }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(i, "ref", {
315
+ enumerable: !1,
316
+ get: O
317
+ }) : Object.defineProperty(i, "ref", { enumerable: !1, value: null }), i._store = {}, Object.defineProperty(i._store, "validated", {
318
+ configurable: !1,
319
+ enumerable: !1,
320
+ writable: !0,
321
+ value: 0
322
+ }), Object.defineProperty(i, "_debugInfo", {
323
+ configurable: !1,
324
+ enumerable: !1,
325
+ writable: !0,
326
+ value: null
327
+ }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
328
+ }
329
+ function N(i, h, p, T, k, Tt) {
330
+ if (typeof i == "string" || typeof i == "function" || i === at || i === At || i === Pt || i === st || i === ft || i === ue || typeof i == "object" && i !== null && (i.$$typeof === pt || i.$$typeof === Nt || i.$$typeof === ot || i.$$typeof === Yt || i.$$typeof === ht || i.$$typeof === $t || i.getModuleId !== void 0)) {
331
+ var m = h.children;
332
+ if (m !== void 0)
333
+ if (T)
334
+ if (Wt(m)) {
335
+ for (T = 0; T < m.length; T++)
336
+ M(m[T], i);
337
+ Object.freeze && Object.freeze(m);
338
+ } else
339
+ d(
340
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
341
+ );
342
+ else M(m, i);
343
+ } else
344
+ m = "", (i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (m += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), i === null ? T = "null" : Wt(i) ? T = "array" : i !== void 0 && i.$$typeof === nt ? (T = "<" + (r(i.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : T = typeof i, d(
345
+ "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
346
+ T,
347
+ m
348
+ );
349
+ if (Xt.call(h, "key")) {
350
+ m = r(i);
351
+ var S = Object.keys(h).filter(function(z) {
352
+ return z !== "key";
353
+ });
354
+ T = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", Zt[m + T] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", d(
355
+ `A props object containing a "key" prop is being spread into JSX:
356
+ let props = %s;
357
+ <%s {...props} />
358
+ React keys must be passed directly to JSX without using spread:
359
+ let props = %s;
360
+ <%s key={someKey} {...props} />`,
361
+ T,
362
+ m,
363
+ S,
364
+ m
365
+ ), Zt[m + T] = !0);
366
+ }
367
+ if (m = null, p !== void 0 && (u(p), m = "" + p), g(h) && (u(h.key), m = "" + h.key), P(h), "key" in h) {
368
+ p = {};
369
+ for (var Z in h)
370
+ Z !== "key" && (p[Z] = h[Z]);
371
+ } else p = h;
372
+ return m && (h = typeof i == "function" ? i.displayName || i.name || "Unknown" : i, m && C(p, h)), F(
373
+ i,
374
+ m,
375
+ null,
376
+ Tt,
377
+ k,
378
+ w(),
379
+ p
380
+ );
381
+ }
382
+ function M(i, h) {
383
+ if (typeof i == "object" && i && i.$$typeof !== Jt) {
384
+ if (Wt(i))
385
+ for (var p = 0; p < i.length; p++) {
386
+ var T = i[p];
387
+ q(T) && H(T, h);
388
+ }
389
+ else if (q(i))
390
+ i._store && (i._store.validated = 1);
391
+ else if (i === null || typeof i != "object" ? p = null : (p = zt && i[zt] || i["@@iterator"], p = typeof p == "function" ? p : null), typeof p == "function" && p !== i.entries && (p = p.call(i), p !== i))
392
+ for (; !(i = p.next()).done; )
393
+ q(i.value) && H(i.value, h);
394
+ }
395
+ }
396
+ function q(i) {
397
+ return typeof i == "object" && i !== null && i.$$typeof === nt;
398
+ }
399
+ function H(i, h) {
400
+ if (i._store && !i._store.validated && i.key == null && (i._store.validated = 1, h = it(h), !qt[h])) {
401
+ qt[h] = !0;
402
+ var p = "";
403
+ i && i._owner != null && i._owner !== w() && (p = null, typeof i._owner.tag == "number" ? p = r(i._owner.type) : typeof i._owner.name == "string" && (p = i._owner.name), p = " It was passed a child from " + p + ".");
404
+ var T = G.getCurrentStack;
405
+ G.getCurrentStack = function() {
406
+ var k = y(i.type);
407
+ return T && (k += T() || ""), k;
408
+ }, d(
409
+ 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
410
+ h,
411
+ p
412
+ ), G.getCurrentStack = T;
413
+ }
414
+ }
415
+ function it(i) {
416
+ var h = "", p = w();
417
+ return p && (p = r(p.type)) && (h = `
418
+
419
+ Check the render method of \`` + p + "`."), h || (i = r(i)) && (h = `
420
+
421
+ Check the top-level render call using <` + i + ">."), h;
422
+ }
423
+ var j = ri, nt = Symbol.for("react.transitional.element"), rt = Symbol.for("react.portal"), at = Symbol.for("react.fragment"), Pt = Symbol.for("react.strict_mode"), At = Symbol.for("react.profiler"), Yt = Symbol.for("react.consumer"), ot = Symbol.for("react.context"), ht = Symbol.for("react.forward_ref"), st = Symbol.for("react.suspense"), ft = Symbol.for("react.suspense_list"), Nt = Symbol.for("react.memo"), pt = Symbol.for("react.lazy"), ue = Symbol.for("react.offscreen"), zt = Symbol.iterator, G = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ce = Symbol.for("react.client.reference"), Xt = Object.prototype.hasOwnProperty, B = Object.assign, $t = Symbol.for("react.client.reference"), Wt = Array.isArray, I = 0, _, Y, xt, dt, vt, gt, mt;
424
+ c.__reactDisabledLog = !0;
425
+ var V, J = !1, It = new (typeof WeakMap == "function" ? WeakMap : Map)(), Jt = Symbol.for("react.client.reference"), Rt, U = {}, Zt = {}, qt = {};
426
+ Bt.Fragment = at, Bt.jsx = function(i, h, p, T, k) {
427
+ return N(i, h, p, !1, T, k);
428
+ }, Bt.jsxs = function(i, h, p, T, k) {
429
+ return N(i, h, p, !0, T, k);
430
+ };
431
+ }()), Bt;
432
+ }
433
+ process.env.NODE_ENV === "production" ? Ee.exports = ai() : Ee.exports = ui();
434
+ var ze = Ee.exports;
435
+ var ci = { 168: (d, r, s) => {
436
+ var u;
437
+ (function(c, v, f, l) {
438
+ var E, y = ["", "webkit", "Moz", "MS", "ms", "o"], w = v.createElement("div"), P = "function", g = Math.round, C = Math.abs, O = Date.now;
439
+ function F(t, e, n) {
440
+ return setTimeout(nt(t, n), e);
441
+ }
442
+ function N(t, e, n) {
443
+ return !!Array.isArray(t) && (M(t, n[e], n), !0);
444
+ }
445
+ function M(t, e, n) {
446
+ var o;
447
+ if (t) if (t.forEach) t.forEach(e, n);
448
+ else if (t.length !== l) for (o = 0; o < t.length; ) e.call(n, t[o], o, t), o++;
449
+ else for (o in t) t.hasOwnProperty(o) && e.call(n, t[o], o, t);
450
+ }
451
+ function q(t, e, n) {
452
+ var o = "DEPRECATED METHOD: " + e + `
453
+ ` + n + ` AT
454
+ `;
455
+ return function() {
456
+ var a = new Error("get-stack-trace"), b = a && a.stack ? a.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace", R = c.console && (c.console.warn || c.console.log);
457
+ return R && R.call(c.console, o, b), t.apply(this, arguments);
458
+ };
459
+ }
460
+ E = typeof Object.assign != "function" ? function(t) {
461
+ if (t === l || t === null) throw new TypeError("Cannot convert undefined or null to object");
462
+ for (var e = Object(t), n = 1; n < arguments.length; n++) {
463
+ var o = arguments[n];
464
+ if (o !== l && o !== null) for (var a in o) o.hasOwnProperty(a) && (e[a] = o[a]);
465
+ }
466
+ return e;
467
+ } : Object.assign;
468
+ var H = q(function(t, e, n) {
469
+ for (var o = Object.keys(e), a = 0; a < o.length; ) (!n || n && t[o[a]] === l) && (t[o[a]] = e[o[a]]), a++;
470
+ return t;
471
+ }, "extend", "Use `assign`."), it = q(function(t, e) {
472
+ return H(t, e, !0);
473
+ }, "merge", "Use `assign`.");
474
+ function j(t, e, n) {
475
+ var o, a = e.prototype;
476
+ (o = t.prototype = Object.create(a)).constructor = t, o._super = a, n && E(o, n);
477
+ }
478
+ function nt(t, e) {
479
+ return function() {
480
+ return t.apply(e, arguments);
481
+ };
482
+ }
483
+ function rt(t, e) {
484
+ return typeof t == P ? t.apply(e && e[0] || l, e) : t;
485
+ }
486
+ function at(t, e) {
487
+ return t === l ? e : t;
488
+ }
489
+ function Pt(t, e, n) {
490
+ M(ht(e), function(o) {
491
+ t.addEventListener(o, n, !1);
492
+ });
493
+ }
494
+ function At(t, e, n) {
495
+ M(ht(e), function(o) {
496
+ t.removeEventListener(o, n, !1);
497
+ });
498
+ }
499
+ function Yt(t, e) {
500
+ for (; t; ) {
501
+ if (t == e) return !0;
502
+ t = t.parentNode;
503
+ }
504
+ return !1;
505
+ }
506
+ function ot(t, e) {
507
+ return t.indexOf(e) > -1;
508
+ }
509
+ function ht(t) {
510
+ return t.trim().split(/\s+/g);
511
+ }
512
+ function st(t, e, n) {
513
+ if (t.indexOf && !n) return t.indexOf(e);
514
+ for (var o = 0; o < t.length; ) {
515
+ if (n && t[o][n] == e || !n && t[o] === e) return o;
516
+ o++;
517
+ }
518
+ return -1;
519
+ }
520
+ function ft(t) {
521
+ return Array.prototype.slice.call(t, 0);
522
+ }
523
+ function Nt(t, e, n) {
524
+ for (var o = [], a = [], b = 0; b < t.length; ) {
525
+ var R = t[b][e];
526
+ st(a, R) < 0 && o.push(t[b]), a[b] = R, b++;
527
+ }
528
+ return o = o.sort(function(X, A) {
529
+ return X[e] > A[e];
530
+ }), o;
531
+ }
532
+ function pt(t, e) {
533
+ for (var n, o, a = e[0].toUpperCase() + e.slice(1), b = 0; b < y.length; ) {
534
+ if ((o = (n = y[b]) ? n + a : e) in t) return o;
535
+ b++;
536
+ }
537
+ return l;
538
+ }
539
+ var ue = 1;
540
+ function zt(t) {
541
+ var e = t.ownerDocument || t;
542
+ return e.defaultView || e.parentWindow || c;
543
+ }
544
+ var G = "ontouchstart" in c, ce = pt(c, "PointerEvent") !== l, Xt = G && /mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent), B = "touch", $t = "mouse", Wt = 25, I = 1, _ = 4, Y = 8, xt = 1, dt = 2, vt = 4, gt = 8, mt = 16, V = dt | vt, J = gt | mt, It = V | J, Jt = ["x", "y"], Rt = ["clientX", "clientY"];
545
+ function U(t, e) {
546
+ var n = this;
547
+ this.manager = t, this.callback = e, this.element = t.element, this.target = t.options.inputTarget, this.domHandler = function(o) {
548
+ rt(t.options.enable, [t]) && n.handler(o);
549
+ }, this.init();
550
+ }
551
+ function Zt(t, e, n) {
552
+ var o = n.pointers.length, a = n.changedPointers.length, b = e & I && o - a == 0, R = e & (_ | Y) && o - a == 0;
553
+ n.isFirst = !!b, n.isFinal = !!R, b && (t.session = {}), n.eventType = e, function(X, A) {
554
+ var $ = X.session, re = A.pointers, _e = re.length;
555
+ $.firstInput || ($.firstInput = qt(A)), _e > 1 && !$.firstMultiple ? $.firstMultiple = qt(A) : _e === 1 && ($.firstMultiple = !1);
556
+ var Oe = $.firstInput, Ft = $.firstMultiple, Ne = Ft ? Ft.center : Oe.center, Ie = A.center = i(re);
557
+ A.timeStamp = O(), A.deltaTime = A.timeStamp - Oe.timeStamp, A.angle = k(Ne, Ie), A.distance = T(Ne, Ie), function(et, L) {
558
+ var bt = L.center, Dt = et.offsetDelta || {}, _t = et.prevDelta || {}, Ot = et.prevInput || {};
559
+ L.eventType !== I && Ot.eventType !== _ || (_t = et.prevDelta = { x: Ot.deltaX || 0, y: Ot.deltaY || 0 }, Dt = et.offsetDelta = { x: bt.x, y: bt.y }), L.deltaX = _t.x + (bt.x - Dt.x), L.deltaY = _t.y + (bt.y - Dt.y);
560
+ }($, A), A.offsetDirection = p(A.deltaX, A.deltaY);
561
+ var Te, Fe, Mt = h(A.deltaTime, A.deltaX, A.deltaY);
562
+ A.overallVelocityX = Mt.x, A.overallVelocityY = Mt.y, A.overallVelocity = C(Mt.x) > C(Mt.y) ? Mt.x : Mt.y, A.scale = Ft ? (Te = Ft.pointers, T((Fe = re)[0], Fe[1], Rt) / T(Te[0], Te[1], Rt)) : 1, A.rotation = Ft ? function(et, L) {
563
+ return k(L[1], L[0], Rt) + k(et[1], et[0], Rt);
564
+ }(Ft.pointers, re) : 0, A.maxPointers = $.prevInput ? A.pointers.length > $.prevInput.maxPointers ? A.pointers.length : $.prevInput.maxPointers : A.pointers.length, function(et, L) {
565
+ var bt, Dt, _t, Ot, wt = et.lastInterval || L, Me = L.timeStamp - wt.timeStamp;
566
+ if (L.eventType != Y && (Me > Wt || wt.velocity === l)) {
567
+ var ke = L.deltaX - wt.deltaX, Le = L.deltaY - wt.deltaY, kt = h(Me, ke, Le);
568
+ Dt = kt.x, _t = kt.y, bt = C(kt.x) > C(kt.y) ? kt.x : kt.y, Ot = p(ke, Le), et.lastInterval = L;
569
+ } else bt = wt.velocity, Dt = wt.velocityX, _t = wt.velocityY, Ot = wt.direction;
570
+ L.velocity = bt, L.velocityX = Dt, L.velocityY = _t, L.direction = Ot;
571
+ }($, A);
572
+ var ye = X.element;
573
+ Yt(A.srcEvent.target, ye) && (ye = A.srcEvent.target), A.target = ye;
574
+ }(t, n), t.emit("hammer.input", n), t.recognize(n), t.session.prevInput = n;
575
+ }
576
+ function qt(t) {
577
+ for (var e = [], n = 0; n < t.pointers.length; ) e[n] = { clientX: g(t.pointers[n].clientX), clientY: g(t.pointers[n].clientY) }, n++;
578
+ return { timeStamp: O(), pointers: e, center: i(e), deltaX: t.deltaX, deltaY: t.deltaY };
579
+ }
580
+ function i(t) {
581
+ var e = t.length;
582
+ if (e === 1) return { x: g(t[0].clientX), y: g(t[0].clientY) };
583
+ for (var n = 0, o = 0, a = 0; a < e; ) n += t[a].clientX, o += t[a].clientY, a++;
584
+ return { x: g(n / e), y: g(o / e) };
585
+ }
586
+ function h(t, e, n) {
587
+ return { x: e / t || 0, y: n / t || 0 };
588
+ }
589
+ function p(t, e) {
590
+ return t === e ? xt : C(t) >= C(e) ? t < 0 ? dt : vt : e < 0 ? gt : mt;
591
+ }
592
+ function T(t, e, n) {
593
+ n || (n = Jt);
594
+ var o = e[n[0]] - t[n[0]], a = e[n[1]] - t[n[1]];
595
+ return Math.sqrt(o * o + a * a);
596
+ }
597
+ function k(t, e, n) {
598
+ n || (n = Jt);
599
+ var o = e[n[0]] - t[n[0]], a = e[n[1]] - t[n[1]];
600
+ return 180 * Math.atan2(a, o) / Math.PI;
601
+ }
602
+ U.prototype = { handler: function() {
603
+ }, init: function() {
604
+ this.evEl && Pt(this.element, this.evEl, this.domHandler), this.evTarget && Pt(this.target, this.evTarget, this.domHandler), this.evWin && Pt(zt(this.element), this.evWin, this.domHandler);
605
+ }, destroy: function() {
606
+ this.evEl && At(this.element, this.evEl, this.domHandler), this.evTarget && At(this.target, this.evTarget, this.domHandler), this.evWin && At(zt(this.element), this.evWin, this.domHandler);
607
+ } };
608
+ var Tt = { mousedown: I, mousemove: 2, mouseup: _ }, m = "mousedown", S = "mousemove mouseup";
609
+ function Z() {
610
+ this.evEl = m, this.evWin = S, this.pressed = !1, U.apply(this, arguments);
611
+ }
612
+ j(Z, U, { handler: function(t) {
613
+ var e = Tt[t.type];
614
+ e & I && t.button === 0 && (this.pressed = !0), 2 & e && t.which !== 1 && (e = _), this.pressed && (e & _ && (this.pressed = !1), this.callback(this.manager, e, { pointers: [t], changedPointers: [t], pointerType: $t, srcEvent: t }));
615
+ } });
616
+ var z = { pointerdown: I, pointermove: 2, pointerup: _, pointercancel: Y, pointerout: Y }, ut = { 2: B, 3: "pen", 4: $t, 5: "kinect" }, yt = "pointerdown", Q = "pointermove pointerup pointercancel";
617
+ function Et() {
618
+ this.evEl = yt, this.evWin = Q, U.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
619
+ }
620
+ c.MSPointerEvent && !c.PointerEvent && (yt = "MSPointerDown", Q = "MSPointerMove MSPointerUp MSPointerCancel"), j(Et, U, { handler: function(t) {
621
+ var e = this.store, n = !1, o = t.type.toLowerCase().replace("ms", ""), a = z[o], b = ut[t.pointerType] || t.pointerType, R = b == B, X = st(e, t.pointerId, "pointerId");
622
+ a & I && (t.button === 0 || R) ? X < 0 && (e.push(t), X = e.length - 1) : a & (_ | Y) && (n = !0), X < 0 || (e[X] = t, this.callback(this.manager, a, { pointers: e, changedPointers: [t], pointerType: b, srcEvent: t }), n && e.splice(X, 1));
623
+ } });
624
+ var K = { touchstart: I, touchmove: 2, touchend: _, touchcancel: Y };
625
+ function be() {
626
+ this.evTarget = "touchstart", this.evWin = "touchstart touchmove touchend touchcancel", this.started = !1, U.apply(this, arguments);
627
+ }
628
+ function Ge(t, e) {
629
+ var n = ft(t.touches), o = ft(t.changedTouches);
630
+ return e & (_ | Y) && (n = Nt(n.concat(o), "identifier")), [n, o];
631
+ }
632
+ j(be, U, { handler: function(t) {
633
+ var e = K[t.type];
634
+ if (e === I && (this.started = !0), this.started) {
635
+ var n = Ge.call(this, t, e);
636
+ e & (_ | Y) && n[0].length - n[1].length == 0 && (this.started = !1), this.callback(this.manager, e, { pointers: n[0], changedPointers: n[1], pointerType: B, srcEvent: t });
637
+ }
638
+ } });
639
+ var Je = { touchstart: I, touchmove: 2, touchend: _, touchcancel: Y }, Ze = "touchstart touchmove touchend touchcancel";
640
+ function Qt() {
641
+ this.evTarget = Ze, this.targetIds = {}, U.apply(this, arguments);
642
+ }
643
+ function Qe(t, e) {
644
+ var n = ft(t.touches), o = this.targetIds;
645
+ if (e & (2 | I) && n.length === 1) return o[n[0].identifier] = !0, [n, n];
646
+ var a, b, R = ft(t.changedTouches), X = [], A = this.target;
647
+ if (b = n.filter(function($) {
648
+ return Yt($.target, A);
649
+ }), e === I) for (a = 0; a < b.length; ) o[b[a].identifier] = !0, a++;
650
+ for (a = 0; a < R.length; ) o[R[a].identifier] && X.push(R[a]), e & (_ | Y) && delete o[R[a].identifier], a++;
651
+ return X.length ? [Nt(b.concat(X), "identifier"), X] : void 0;
652
+ }
653
+ j(Qt, U, { handler: function(t) {
654
+ var e = Je[t.type], n = Qe.call(this, t, e);
655
+ n && this.callback(this.manager, e, { pointers: n[0], changedPointers: n[1], pointerType: B, srcEvent: t });
656
+ } });
657
+ var Ke = 2500;
658
+ function le() {
659
+ U.apply(this, arguments);
660
+ var t = nt(this.handler, this);
661
+ this.touch = new Qt(this.manager, t), this.mouse = new Z(this.manager, t), this.primaryTouch = null, this.lastTouches = [];
662
+ }
663
+ function ti(t, e) {
664
+ t & I ? (this.primaryTouch = e.changedPointers[0].identifier, we.call(this, e)) : t & (_ | Y) && we.call(this, e);
665
+ }
666
+ function we(t) {
667
+ var e = t.changedPointers[0];
668
+ if (e.identifier === this.primaryTouch) {
669
+ var n = { x: e.clientX, y: e.clientY };
670
+ this.lastTouches.push(n);
671
+ var o = this.lastTouches;
672
+ setTimeout(function() {
673
+ var a = o.indexOf(n);
674
+ a > -1 && o.splice(a, 1);
675
+ }, Ke);
676
+ }
677
+ }
678
+ function ei(t) {
679
+ for (var e = t.srcEvent.clientX, n = t.srcEvent.clientY, o = 0; o < this.lastTouches.length; o++) {
680
+ var a = this.lastTouches[o], b = Math.abs(e - a.x), R = Math.abs(n - a.y);
681
+ if (b <= 25 && R <= 25) return !0;
682
+ }
683
+ return !1;
684
+ }
685
+ j(le, U, { handler: function(t, e, n) {
686
+ var o = n.pointerType == B, a = n.pointerType == $t;
687
+ if (!(a && n.sourceCapabilities && n.sourceCapabilities.firesTouchEvents)) {
688
+ if (o) ti.call(this, e, n);
689
+ else if (a && ei.call(this, n)) return;
690
+ this.callback(t, e, n);
691
+ }
692
+ }, destroy: function() {
693
+ this.touch.destroy(), this.mouse.destroy();
694
+ } });
695
+ var Pe = pt(w.style, "touchAction"), Ae = Pe !== l, xe = "compute", Re = "auto", he = "manipulation", Ct = "none", Ut = "pan-x", Vt = "pan-y", Kt = function() {
696
+ if (!Ae) return !1;
697
+ var t = {}, e = c.CSS && c.CSS.supports;
698
+ return ["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(function(n) {
699
+ t[n] = !e || c.CSS.supports("touch-action", n);
700
+ }), t;
701
+ }();
702
+ function fe(t, e) {
703
+ this.manager = t, this.set(e);
704
+ }
705
+ fe.prototype = { set: function(t) {
706
+ t == xe && (t = this.compute()), Ae && this.manager.element.style && Kt[t] && (this.manager.element.style[Pe] = t), this.actions = t.toLowerCase().trim();
707
+ }, update: function() {
708
+ this.set(this.manager.options.touchAction);
709
+ }, compute: function() {
710
+ var t = [];
711
+ return M(this.manager.recognizers, function(e) {
712
+ rt(e.options.enable, [e]) && (t = t.concat(e.getTouchAction()));
713
+ }), function(e) {
714
+ if (ot(e, Ct)) return Ct;
715
+ var n = ot(e, Ut), o = ot(e, Vt);
716
+ return n && o ? Ct : n || o ? n ? Ut : Vt : ot(e, he) ? he : Re;
717
+ }(t.join(" "));
718
+ }, preventDefaults: function(t) {
719
+ var e = t.srcEvent, n = t.offsetDirection;
720
+ if (this.manager.session.prevented) e.preventDefault();
721
+ else {
722
+ var o = this.actions, a = ot(o, Ct) && !Kt[Ct], b = ot(o, Vt) && !Kt[Vt], R = ot(o, Ut) && !Kt[Ut];
723
+ if (a) {
724
+ var X = t.pointers.length === 1, A = t.distance < 2, $ = t.deltaTime < 250;
725
+ if (X && A && $) return;
726
+ }
727
+ if (!R || !b) return a || b && n & V || R && n & J ? this.preventSrc(e) : void 0;
728
+ }
729
+ }, preventSrc: function(t) {
730
+ this.manager.session.prevented = !0, t.preventDefault();
731
+ } };
732
+ var te = 1, ct = 32;
733
+ function lt(t) {
734
+ this.options = E({}, this.defaults, t || {}), this.id = ue++, this.manager = null, this.options.enable = at(this.options.enable, !0), this.state = te, this.simultaneous = {}, this.requireFail = [];
735
+ }
736
+ function Ce(t) {
737
+ return 16 & t ? "cancel" : 8 & t ? "end" : 4 & t ? "move" : 2 & t ? "start" : "";
738
+ }
739
+ function Se(t) {
740
+ return t == mt ? "down" : t == gt ? "up" : t == dt ? "left" : t == vt ? "right" : "";
741
+ }
742
+ function ee(t, e) {
743
+ var n = e.manager;
744
+ return n ? n.get(t) : t;
745
+ }
746
+ function tt() {
747
+ lt.apply(this, arguments);
748
+ }
749
+ function ie() {
750
+ tt.apply(this, arguments), this.pX = null, this.pY = null;
751
+ }
752
+ function pe() {
753
+ tt.apply(this, arguments);
754
+ }
755
+ function de() {
756
+ lt.apply(this, arguments), this._timer = null, this._input = null;
757
+ }
758
+ function ve() {
759
+ tt.apply(this, arguments);
760
+ }
761
+ function ge() {
762
+ tt.apply(this, arguments);
763
+ }
764
+ function ne() {
765
+ lt.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
766
+ }
767
+ function St(t, e) {
768
+ return (e = e || {}).recognizers = at(e.recognizers, St.defaults.preset), new me(t, e);
769
+ }
770
+ function me(t, e) {
771
+ this.options = E({}, St.defaults, e || {}), this.options.inputTarget = this.options.inputTarget || t, this.handlers = {}, this.session = {}, this.recognizers = [], this.oldCssProps = {}, this.element = t, this.input = new (this.options.inputClass || (ce ? Et : Xt ? Qt : G ? le : Z))(this, Zt), this.touchAction = new fe(this, this.options.touchAction), De(this, !0), M(this.options.recognizers, function(n) {
772
+ var o = this.add(new n[0](n[1]));
773
+ n[2] && o.recognizeWith(n[2]), n[3] && o.requireFailure(n[3]);
774
+ }, this);
775
+ }
776
+ function De(t, e) {
777
+ var n, o = t.element;
778
+ o.style && (M(t.options.cssProps, function(a, b) {
779
+ n = pt(o.style, b), e ? (t.oldCssProps[n] = o.style[n], o.style[n] = a) : o.style[n] = t.oldCssProps[n] || "";
780
+ }), e || (t.oldCssProps = {}));
781
+ }
782
+ lt.prototype = { defaults: {}, set: function(t) {
783
+ return E(this.options, t), this.manager && this.manager.touchAction.update(), this;
784
+ }, recognizeWith: function(t) {
785
+ if (N(t, "recognizeWith", this)) return this;
786
+ var e = this.simultaneous;
787
+ return e[(t = ee(t, this)).id] || (e[t.id] = t, t.recognizeWith(this)), this;
788
+ }, dropRecognizeWith: function(t) {
789
+ return N(t, "dropRecognizeWith", this) || (t = ee(t, this), delete this.simultaneous[t.id]), this;
790
+ }, requireFailure: function(t) {
791
+ if (N(t, "requireFailure", this)) return this;
792
+ var e = this.requireFail;
793
+ return st(e, t = ee(t, this)) === -1 && (e.push(t), t.requireFailure(this)), this;
794
+ }, dropRequireFailure: function(t) {
795
+ if (N(t, "dropRequireFailure", this)) return this;
796
+ t = ee(t, this);
797
+ var e = st(this.requireFail, t);
798
+ return e > -1 && this.requireFail.splice(e, 1), this;
799
+ }, hasRequireFailures: function() {
800
+ return this.requireFail.length > 0;
801
+ }, canRecognizeWith: function(t) {
802
+ return !!this.simultaneous[t.id];
803
+ }, emit: function(t) {
804
+ var e = this, n = this.state;
805
+ function o(a) {
806
+ e.manager.emit(a, t);
807
+ }
808
+ n < 8 && o(e.options.event + Ce(n)), o(e.options.event), t.additionalEvent && o(t.additionalEvent), n >= 8 && o(e.options.event + Ce(n));
809
+ }, tryEmit: function(t) {
810
+ if (this.canEmit()) return this.emit(t);
811
+ this.state = ct;
812
+ }, canEmit: function() {
813
+ for (var t = 0; t < this.requireFail.length; ) {
814
+ if (!(this.requireFail[t].state & (ct | te))) return !1;
815
+ t++;
816
+ }
817
+ return !0;
818
+ }, recognize: function(t) {
819
+ var e = E({}, t);
820
+ if (!rt(this.options.enable, [this, e])) return this.reset(), void (this.state = ct);
821
+ 56 & this.state && (this.state = te), this.state = this.process(e), 30 & this.state && this.tryEmit(e);
822
+ }, process: function(t) {
823
+ }, getTouchAction: function() {
824
+ }, reset: function() {
825
+ } }, j(tt, lt, { defaults: { pointers: 1 }, attrTest: function(t) {
826
+ var e = this.options.pointers;
827
+ return e === 0 || t.pointers.length === e;
828
+ }, process: function(t) {
829
+ var e = this.state, n = t.eventType, o = 6 & e, a = this.attrTest(t);
830
+ return o && (n & Y || !a) ? 16 | e : o || a ? n & _ ? 8 | e : 2 & e ? 4 | e : 2 : ct;
831
+ } }), j(ie, tt, { defaults: { event: "pan", threshold: 10, pointers: 1, direction: It }, getTouchAction: function() {
832
+ var t = this.options.direction, e = [];
833
+ return t & V && e.push(Vt), t & J && e.push(Ut), e;
834
+ }, directionTest: function(t) {
835
+ var e = this.options, n = !0, o = t.distance, a = t.direction, b = t.deltaX, R = t.deltaY;
836
+ return a & e.direction || (e.direction & V ? (a = b === 0 ? xt : b < 0 ? dt : vt, n = b != this.pX, o = Math.abs(t.deltaX)) : (a = R === 0 ? xt : R < 0 ? gt : mt, n = R != this.pY, o = Math.abs(t.deltaY))), t.direction = a, n && o > e.threshold && a & e.direction;
837
+ }, attrTest: function(t) {
838
+ return tt.prototype.attrTest.call(this, t) && (2 & this.state || !(2 & this.state) && this.directionTest(t));
839
+ }, emit: function(t) {
840
+ this.pX = t.deltaX, this.pY = t.deltaY;
841
+ var e = Se(t.direction);
842
+ e && (t.additionalEvent = this.options.event + e), this._super.emit.call(this, t);
843
+ } }), j(pe, tt, { defaults: { event: "pinch", threshold: 0, pointers: 2 }, getTouchAction: function() {
844
+ return [Ct];
845
+ }, attrTest: function(t) {
846
+ return this._super.attrTest.call(this, t) && (Math.abs(t.scale - 1) > this.options.threshold || 2 & this.state);
847
+ }, emit: function(t) {
848
+ if (t.scale !== 1) {
849
+ var e = t.scale < 1 ? "in" : "out";
850
+ t.additionalEvent = this.options.event + e;
851
+ }
852
+ this._super.emit.call(this, t);
853
+ } }), j(de, lt, { defaults: { event: "press", pointers: 1, time: 251, threshold: 9 }, getTouchAction: function() {
854
+ return [Re];
855
+ }, process: function(t) {
856
+ var e = this.options, n = t.pointers.length === e.pointers, o = t.distance < e.threshold, a = t.deltaTime > e.time;
857
+ if (this._input = t, !o || !n || t.eventType & (_ | Y) && !a) this.reset();
858
+ else if (t.eventType & I) this.reset(), this._timer = F(function() {
859
+ this.state = 8, this.tryEmit();
860
+ }, e.time, this);
861
+ else if (t.eventType & _) return 8;
862
+ return ct;
863
+ }, reset: function() {
864
+ clearTimeout(this._timer);
865
+ }, emit: function(t) {
866
+ this.state === 8 && (t && t.eventType & _ ? this.manager.emit(this.options.event + "up", t) : (this._input.timeStamp = O(), this.manager.emit(this.options.event, this._input)));
867
+ } }), j(ve, tt, { defaults: { event: "rotate", threshold: 0, pointers: 2 }, getTouchAction: function() {
868
+ return [Ct];
869
+ }, attrTest: function(t) {
870
+ return this._super.attrTest.call(this, t) && (Math.abs(t.rotation) > this.options.threshold || 2 & this.state);
871
+ } }), j(ge, tt, { defaults: { event: "swipe", threshold: 10, velocity: 0.3, direction: V | J, pointers: 1 }, getTouchAction: function() {
872
+ return ie.prototype.getTouchAction.call(this);
873
+ }, attrTest: function(t) {
874
+ var e, n = this.options.direction;
875
+ return n & (V | J) ? e = t.overallVelocity : n & V ? e = t.overallVelocityX : n & J && (e = t.overallVelocityY), this._super.attrTest.call(this, t) && n & t.offsetDirection && t.distance > this.options.threshold && t.maxPointers == this.options.pointers && C(e) > this.options.velocity && t.eventType & _;
876
+ }, emit: function(t) {
877
+ var e = Se(t.offsetDirection);
878
+ e && this.manager.emit(this.options.event + e, t), this.manager.emit(this.options.event, t);
879
+ } }), j(ne, lt, { defaults: { event: "tap", pointers: 1, taps: 1, interval: 300, time: 250, threshold: 9, posThreshold: 10 }, getTouchAction: function() {
880
+ return [he];
881
+ }, process: function(t) {
882
+ var e = this.options, n = t.pointers.length === e.pointers, o = t.distance < e.threshold, a = t.deltaTime < e.time;
883
+ if (this.reset(), t.eventType & I && this.count === 0) return this.failTimeout();
884
+ if (o && a && n) {
885
+ if (t.eventType != _) return this.failTimeout();
886
+ var b = !this.pTime || t.timeStamp - this.pTime < e.interval, R = !this.pCenter || T(this.pCenter, t.center) < e.posThreshold;
887
+ if (this.pTime = t.timeStamp, this.pCenter = t.center, R && b ? this.count += 1 : this.count = 1, this._input = t, this.count % e.taps == 0) return this.hasRequireFailures() ? (this._timer = F(function() {
888
+ this.state = 8, this.tryEmit();
889
+ }, e.interval, this), 2) : 8;
890
+ }
891
+ return ct;
892
+ }, failTimeout: function() {
893
+ return this._timer = F(function() {
894
+ this.state = ct;
895
+ }, this.options.interval, this), ct;
896
+ }, reset: function() {
897
+ clearTimeout(this._timer);
898
+ }, emit: function() {
899
+ this.state == 8 && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
900
+ } }), St.VERSION = "2.0.7", St.defaults = { domEvents: !1, touchAction: xe, enable: !0, inputTarget: null, inputClass: null, preset: [[ve, { enable: !1 }], [pe, { enable: !1 }, ["rotate"]], [ge, { direction: V }], [ie, { direction: V }, ["swipe"]], [ne], [ne, { event: "doubletap", taps: 2 }, ["tap"]], [de]], cssProps: { userSelect: "none", touchSelect: "none", touchCallout: "none", contentZooming: "none", userDrag: "none", tapHighlightColor: "rgba(0,0,0,0)" } }, me.prototype = { set: function(t) {
901
+ return E(this.options, t), t.touchAction && this.touchAction.update(), t.inputTarget && (this.input.destroy(), this.input.target = t.inputTarget, this.input.init()), this;
902
+ }, stop: function(t) {
903
+ this.session.stopped = t ? 2 : 1;
904
+ }, recognize: function(t) {
905
+ var e = this.session;
906
+ if (!e.stopped) {
907
+ var n;
908
+ this.touchAction.preventDefaults(t);
909
+ var o = this.recognizers, a = e.curRecognizer;
910
+ (!a || a && 8 & a.state) && (a = e.curRecognizer = null);
911
+ for (var b = 0; b < o.length; ) n = o[b], e.stopped === 2 || a && n != a && !n.canRecognizeWith(a) ? n.reset() : n.recognize(t), !a && 14 & n.state && (a = e.curRecognizer = n), b++;
912
+ }
913
+ }, get: function(t) {
914
+ if (t instanceof lt) return t;
915
+ for (var e = this.recognizers, n = 0; n < e.length; n++) if (e[n].options.event == t) return e[n];
916
+ return null;
917
+ }, add: function(t) {
918
+ if (N(t, "add", this)) return this;
919
+ var e = this.get(t.options.event);
920
+ return e && this.remove(e), this.recognizers.push(t), t.manager = this, this.touchAction.update(), t;
921
+ }, remove: function(t) {
922
+ if (N(t, "remove", this)) return this;
923
+ if (t = this.get(t)) {
924
+ var e = this.recognizers, n = st(e, t);
925
+ n !== -1 && (e.splice(n, 1), this.touchAction.update());
926
+ }
927
+ return this;
928
+ }, on: function(t, e) {
929
+ if (t !== l && e !== l) {
930
+ var n = this.handlers;
931
+ return M(ht(t), function(o) {
932
+ n[o] = n[o] || [], n[o].push(e);
933
+ }), this;
934
+ }
935
+ }, off: function(t, e) {
936
+ if (t !== l) {
937
+ var n = this.handlers;
938
+ return M(ht(t), function(o) {
939
+ e ? n[o] && n[o].splice(st(n[o], e), 1) : delete n[o];
940
+ }), this;
941
+ }
942
+ }, emit: function(t, e) {
943
+ this.options.domEvents && function(a, b) {
944
+ var R = v.createEvent("Event");
945
+ R.initEvent(a, !0, !0), R.gesture = b, b.target.dispatchEvent(R);
946
+ }(t, e);
947
+ var n = this.handlers[t] && this.handlers[t].slice();
948
+ if (n && n.length) {
949
+ e.type = t, e.preventDefault = function() {
950
+ e.srcEvent.preventDefault();
951
+ };
952
+ for (var o = 0; o < n.length; ) n[o](e), o++;
953
+ }
954
+ }, destroy: function() {
955
+ this.element && De(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
956
+ } }, E(St, { INPUT_START: I, INPUT_MOVE: 2, INPUT_END: _, INPUT_CANCEL: Y, STATE_POSSIBLE: te, STATE_BEGAN: 2, STATE_CHANGED: 4, STATE_ENDED: 8, STATE_RECOGNIZED: 8, STATE_CANCELLED: 16, STATE_FAILED: ct, DIRECTION_NONE: xt, DIRECTION_LEFT: dt, DIRECTION_RIGHT: vt, DIRECTION_UP: gt, DIRECTION_DOWN: mt, DIRECTION_HORIZONTAL: V, DIRECTION_VERTICAL: J, DIRECTION_ALL: It, Manager: me, Input: U, TouchAction: fe, TouchInput: Qt, MouseInput: Z, PointerEventInput: Et, TouchMouseInput: le, SingleTouchInput: be, Recognizer: lt, AttrRecognizer: tt, Tap: ne, Pan: ie, Swipe: ge, Pinch: pe, Rotate: ve, Press: de, on: Pt, off: At, each: M, merge: it, extend: H, assign: E, inherit: j, bindFn: nt, prefixed: pt }), (c !== void 0 ? c : typeof self < "u" ? self : {}).Hammer = St, (u = (function() {
957
+ return St;
958
+ }).call(r, s, r, d)) === l || (d.exports = u);
959
+ })(window, document);
960
+ }, 970: (d, r, s) => {
961
+ s.d(r, { A: () => l });
962
+ var u = s(645), c = s.n(u), v = s(278), f = s.n(v)()(c());
963
+ f.push([d.id, ".flipbook{height:100%;width:100%;overflow:hidden}.flipbook-debug-bar{position:absolute;bottom:0;left:0;width:100%;background-color:rgba(0,0,0,.5);color:#fff;padding:10px;box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:space-between;z-index:9999}", ""]);
964
+ const l = f;
965
+ }, 0: (d, r, s) => {
966
+ s.d(r, { A: () => l });
967
+ var u = s(645), c = s.n(u), v = s(278), f = s.n(v)()(c());
968
+ f.push([d.id, ".page{position:absolute;backface-visibility:hidden;transform-style:preserve-3d}.page>*{max-width:100%;max-height:100%;height:100%;width:100%;box-sizing:border-box}", ""]);
969
+ const l = f;
970
+ }, 278: (d) => {
971
+ d.exports = function(r) {
972
+ var s = [];
973
+ return s.toString = function() {
974
+ return this.map(function(u) {
975
+ var c = "", v = u[5] !== void 0;
976
+ return u[4] && (c += "@supports (".concat(u[4], ") {")), u[2] && (c += "@media ".concat(u[2], " {")), v && (c += "@layer".concat(u[5].length > 0 ? " ".concat(u[5]) : "", " {")), c += r(u), v && (c += "}"), u[2] && (c += "}"), u[4] && (c += "}"), c;
977
+ }).join("");
978
+ }, s.i = function(u, c, v, f, l) {
979
+ typeof u == "string" && (u = [[null, u, void 0]]);
980
+ var E = {};
981
+ if (v) for (var y = 0; y < this.length; y++) {
982
+ var w = this[y][0];
983
+ w != null && (E[w] = !0);
984
+ }
985
+ for (var P = 0; P < u.length; P++) {
986
+ var g = [].concat(u[P]);
987
+ v && E[g[0]] || (l !== void 0 && (g[5] === void 0 || (g[1] = "@layer".concat(g[5].length > 0 ? " ".concat(g[5]) : "", " {").concat(g[1], "}")), g[5] = l), c && (g[2] && (g[1] = "@media ".concat(g[2], " {").concat(g[1], "}")), g[2] = c), f && (g[4] ? (g[1] = "@supports (".concat(g[4], ") {").concat(g[1], "}"), g[4] = f) : g[4] = "".concat(f)), s.push(g));
988
+ }
989
+ }, s;
990
+ };
991
+ }, 645: (d) => {
992
+ d.exports = function(r) {
993
+ return r[1];
994
+ };
995
+ }, 292: (d) => {
996
+ var r = [];
997
+ function s(v) {
998
+ for (var f = -1, l = 0; l < r.length; l++) if (r[l].identifier === v) {
999
+ f = l;
1000
+ break;
1001
+ }
1002
+ return f;
1003
+ }
1004
+ function u(v, f) {
1005
+ for (var l = {}, E = [], y = 0; y < v.length; y++) {
1006
+ var w = v[y], P = f.base ? w[0] + f.base : w[0], g = l[P] || 0, C = "".concat(P, " ").concat(g);
1007
+ l[P] = g + 1;
1008
+ var O = s(C), F = { css: w[1], media: w[2], sourceMap: w[3], supports: w[4], layer: w[5] };
1009
+ if (O !== -1) r[O].references++, r[O].updater(F);
1010
+ else {
1011
+ var N = c(F, f);
1012
+ f.byIndex = y, r.splice(y, 0, { identifier: C, updater: N, references: 1 });
1013
+ }
1014
+ E.push(C);
1015
+ }
1016
+ return E;
1017
+ }
1018
+ function c(v, f) {
1019
+ var l = f.domAPI(f);
1020
+ return l.update(v), function(E) {
1021
+ if (E) {
1022
+ if (E.css === v.css && E.media === v.media && E.sourceMap === v.sourceMap && E.supports === v.supports && E.layer === v.layer) return;
1023
+ l.update(v = E);
1024
+ } else l.remove();
1025
+ };
1026
+ }
1027
+ d.exports = function(v, f) {
1028
+ var l = u(v = v || [], f = f || {});
1029
+ return function(E) {
1030
+ E = E || [];
1031
+ for (var y = 0; y < l.length; y++) {
1032
+ var w = s(l[y]);
1033
+ r[w].references--;
1034
+ }
1035
+ for (var P = u(E, f), g = 0; g < l.length; g++) {
1036
+ var C = s(l[g]);
1037
+ r[C].references === 0 && (r[C].updater(), r.splice(C, 1));
1038
+ }
1039
+ l = P;
1040
+ };
1041
+ };
1042
+ }, 383: (d) => {
1043
+ var r = {};
1044
+ d.exports = function(s, u) {
1045
+ var c = function(v) {
1046
+ if (r[v] === void 0) {
1047
+ var f = document.querySelector(v);
1048
+ if (window.HTMLIFrameElement && f instanceof window.HTMLIFrameElement) try {
1049
+ f = f.contentDocument.head;
1050
+ } catch {
1051
+ f = null;
1052
+ }
1053
+ r[v] = f;
1054
+ }
1055
+ return r[v];
1056
+ }(s);
1057
+ if (!c) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
1058
+ c.appendChild(u);
1059
+ };
1060
+ }, 88: (d) => {
1061
+ d.exports = function(r) {
1062
+ var s = document.createElement("style");
1063
+ return r.setAttributes(s, r.attributes), r.insert(s, r.options), s;
1064
+ };
1065
+ }, 884: (d, r, s) => {
1066
+ d.exports = function(u) {
1067
+ var c = s.nc;
1068
+ c && u.setAttribute("nonce", c);
1069
+ };
1070
+ }, 893: (d) => {
1071
+ d.exports = function(r) {
1072
+ if (typeof document > "u") return { update: function() {
1073
+ }, remove: function() {
1074
+ } };
1075
+ var s = r.insertStyleElement(r);
1076
+ return { update: function(u) {
1077
+ (function(c, v, f) {
1078
+ var l = "";
1079
+ f.supports && (l += "@supports (".concat(f.supports, ") {")), f.media && (l += "@media ".concat(f.media, " {"));
1080
+ var E = f.layer !== void 0;
1081
+ E && (l += "@layer".concat(f.layer.length > 0 ? " ".concat(f.layer) : "", " {")), l += f.css, E && (l += "}"), f.media && (l += "}"), f.supports && (l += "}");
1082
+ var y = f.sourceMap;
1083
+ y && typeof btoa < "u" && (l += `
1084
+ /*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(y)))), " */")), v.styleTagTransform(l, c, v.options);
1085
+ })(s, r, u);
1086
+ }, remove: function() {
1087
+ (function(u) {
1088
+ if (u.parentNode === null) return !1;
1089
+ u.parentNode.removeChild(u);
1090
+ })(s);
1091
+ } };
1092
+ };
1093
+ }, 997: (d) => {
1094
+ d.exports = function(r, s) {
1095
+ if (s.styleSheet) s.styleSheet.cssText = r;
1096
+ else {
1097
+ for (; s.firstChild; ) s.removeChild(s.firstChild);
1098
+ s.appendChild(document.createTextNode(r));
1099
+ }
1100
+ };
1101
+ } }, Xe = {};
1102
+ function D(d) {
1103
+ var r = Xe[d];
1104
+ if (r !== void 0) return r.exports;
1105
+ var s = Xe[d] = { id: d, exports: {} };
1106
+ return ci[d](s, s.exports, D), s.exports;
1107
+ }
1108
+ D.n = (d) => {
1109
+ var r = d && d.__esModule ? () => d.default : () => d;
1110
+ return D.d(r, { a: r }), r;
1111
+ }, D.d = (d, r) => {
1112
+ for (var s in r) D.o(r, s) && !D.o(d, s) && Object.defineProperty(d, s, { enumerable: !0, get: r[s] });
1113
+ }, D.o = (d, r) => Object.prototype.hasOwnProperty.call(d, r), D.nc = void 0;
1114
+ var $e = {};
1115
+ D.d($e, { $: () => yi });
1116
+ var li = D(292), We = D.n(li), hi = D(893), qe = D.n(hi), fi = D(383), Ue = D.n(fi), pi = D(884), Ve = D.n(pi), di = D(88), He = D.n(di), vi = D(997), Be = D.n(vi), oe = D(0), Lt = {};
1117
+ Lt.styleTagTransform = Be(), Lt.setAttributes = Ve(), Lt.insert = Ue().bind(null, "head"), Lt.domAPI = qe(), Lt.insertStyleElement = He(), We()(oe.A, Lt), oe.A && oe.A.locals && oe.A.locals;
1118
+ var se = D(970), jt = {};
1119
+ jt.styleTagTransform = Be(), jt.setAttributes = Ve(), jt.insert = Ue().bind(null, "head"), jt.domAPI = qe(), jt.insertStyleElement = He(), We()(se.A, jt), se.A && se.A.locals && se.A.locals;
1120
+ var W, gi = D(168), mi = D.n(gi);
1121
+ (function(d) {
1122
+ d.Forward = "Forward", d.Backward = "Backward", d.None = "None";
1123
+ })(W || (W = {}));
1124
+ class Ti {
1125
+ constructor(r, s, u, c, v) {
1126
+ x(this, "index");
1127
+ x(this, "pages");
1128
+ x(this, "bookProperties");
1129
+ x(this, "onTurned");
1130
+ x(this, "currentAnimation", null);
1131
+ x(this, "targetFlipPosition", null);
1132
+ x(this, "wrappedFlipPosition");
1133
+ this.index = r, this.pages = s, this.bookProperties = c, this.onTurned = v, this.wrappedFlipPosition = u ? 1 : 0;
1134
+ }
1135
+ get isTurned() {
1136
+ return this.flipPosition === 1;
1137
+ }
1138
+ get isTurning() {
1139
+ return this.flipPosition !== 0;
1140
+ }
1141
+ get isCover() {
1142
+ return this.isFirst || this.isLast;
1143
+ }
1144
+ get isFirst() {
1145
+ return this.index === 0;
1146
+ }
1147
+ get isLast() {
1148
+ return this.index === this.bookProperties.leavesCount - 1;
1149
+ }
1150
+ set flipPosition(r) {
1151
+ this.wrappedFlipPosition = Math.max(0, Math.min(1, r));
1152
+ }
1153
+ get flipPosition() {
1154
+ return this.wrappedFlipPosition;
1155
+ }
1156
+ async flipToPosition(r, s = 225) {
1157
+ return this.currentAnimation && await this.currentAnimation, this.flipPosition === r ? Promise.resolve() : this.targetFlipPosition === r ? this.currentAnimation ?? Promise.resolve() : (this.targetFlipPosition = r, this.currentAnimation = new Promise((u) => {
1158
+ const c = this.flipPosition, v = 180 * Math.abs(r - c) / s * 1e3, f = performance.now(), l = (E) => {
1159
+ const y = E - f;
1160
+ if (y < 0) return void requestAnimationFrame(l);
1161
+ const w = Math.min(y / v, 1), P = c + w * (r - c);
1162
+ this.pages.forEach((g, C) => {
1163
+ const O = this.bookProperties.isLTR;
1164
+ if (g) {
1165
+ const F = C % 2 + 1 == 1, N = (F ? O ? P > 0.5 ? 180 - 180 * P : 180 * -P : P > 0.5 ? -(180 - 180 * P) : 180 * P : O ? P < 0.5 ? 180 * -P : 180 - 180 * P : P < 0.5 ? 180 * P : -(180 - 180 * P)) + "deg", M = F ? O ? "100%" : "-100%" : "0px", q = F ? P > 0.5 ? -1 : 1 : P < 0.5 ? -1 : 1;
1166
+ g.style.transform = `translateX(${M})rotateY(${N})scaleX(${q})`, g.style.transformOrigin = F ? O ? "left" : "right" : O ? "right" : "left", g.style.zIndex = `${P > 0.5 ? g.dataset.pageIndex : this.bookProperties.pagesCount - g.dataset.pageIndex}`;
1167
+ }
1168
+ }), this.flipPosition = Math.max(0, Math.min(1, P)), this.flipPosition !== 1 && this.flipPosition !== 0 || this.onTurned(this.flipPosition === 1 ? W.Forward : W.Backward), w < 1 ? requestAnimationFrame(l) : (this.currentAnimation = null, this.targetFlipPosition = null, u());
1169
+ };
1170
+ requestAnimationFrame(l);
1171
+ }), this.currentAnimation);
1172
+ }
1173
+ async efficientFlipToPosition(r, s = 2e4) {
1174
+ return function(u, c, v) {
1175
+ var f, l = {}, E = l.noTrailing, y = E !== void 0 && E, w = l.noLeading, P = w !== void 0 && w, g = l.debounceMode, C = g === void 0 ? void 0 : g, O = !1, F = 0;
1176
+ function N() {
1177
+ f && clearTimeout(f);
1178
+ }
1179
+ function M() {
1180
+ for (var q = arguments.length, H = new Array(q), it = 0; it < q; it++) H[it] = arguments[it];
1181
+ var j = this, nt = Date.now() - F;
1182
+ function rt() {
1183
+ F = Date.now(), c.apply(j, H);
1184
+ }
1185
+ function at() {
1186
+ f = void 0;
1187
+ }
1188
+ O || (P || !C || f || rt(), N(), C === void 0 && nt > u ? P ? (F = Date.now(), y || (f = setTimeout(C ? at : rt, u))) : rt() : y !== !0 && (f = setTimeout(C ? at : rt, C === void 0 ? u - nt : u)));
1189
+ }
1190
+ return M.cancel = function(q) {
1191
+ var H = (q || {}).upcomingOnly, it = H !== void 0 && H;
1192
+ N(), O = !it;
1193
+ }, M;
1194
+ }(1, this.flipToPosition.bind(this))(r, s);
1195
+ }
1196
+ }
1197
+ class ae {
1198
+ constructor(r, s) {
1199
+ x(this, "width");
1200
+ x(this, "height");
1201
+ this.width = r, this.height = s;
1202
+ }
1203
+ static from(r) {
1204
+ return new ae(r.width, r.height);
1205
+ }
1206
+ get value() {
1207
+ return this.width / this.height;
1208
+ }
1209
+ }
1210
+ class Gt {
1211
+ constructor(r, s) {
1212
+ x(this, "width");
1213
+ x(this, "height");
1214
+ x(this, "aspectRatio");
1215
+ this.width = r, this.height = s, this.aspectRatio = new ae(r, s);
1216
+ }
1217
+ aspectRatioFit(r) {
1218
+ const s = ae.from(r).value;
1219
+ return this.aspectRatio.value > s ? new Gt(this.height * s, this.height) : new Gt(this.width, this.width / s);
1220
+ }
1221
+ get asString() {
1222
+ return `${this.width}x${this.height}`;
1223
+ }
1224
+ }
1225
+ class yi {
1226
+ constructor(r) {
1227
+ x(this, "bookElement");
1228
+ x(this, "pageElements", []);
1229
+ x(this, "pagesCount");
1230
+ x(this, "leafAspectRatio", { width: 2, height: 3 });
1231
+ x(this, "coverAspectRatio", { width: 2.15, height: 3.15 });
1232
+ x(this, "direction", "ltr");
1233
+ x(this, "onPageChanged");
1234
+ x(this, "pageSemantics");
1235
+ x(this, "leaves", []);
1236
+ x(this, "currentLeaf");
1237
+ x(this, "flipDirection", W.None);
1238
+ x(this, "flipStartingPos", 0);
1239
+ x(this, "isDuringManualFlip", !1);
1240
+ x(this, "flipDelta", 0);
1241
+ x(this, "isDuringAutoFlip", !1);
1242
+ x(this, "touchStartingPos", { x: 0, y: 0 });
1243
+ x(this, "prevVisiblePageIndices");
1244
+ x(this, "handleTouchStart", (r) => {
1245
+ if (r.touches.length > 1) return;
1246
+ const s = r.touches[0];
1247
+ this.touchStartingPos = { x: s.pageX, y: s.pageY };
1248
+ });
1249
+ x(this, "handleTouchMove", (r) => {
1250
+ if (r.touches.length > 1) return;
1251
+ const s = r.touches[0], u = s.pageX - this.touchStartingPos.x, c = s.pageY - this.touchStartingPos.y;
1252
+ Math.abs(u) > Math.abs(c) && r.preventDefault();
1253
+ });
1254
+ this.pagesCount = r.pagesCount, this.leafAspectRatio = r.leafAspectRatio || this.leafAspectRatio, this.coverAspectRatio = r.coverAspectRatio || this.coverAspectRatio, this.direction = r.direction || this.direction, this.pageSemantics = r.pageSemantics, this.onPageChanged = r.onPageChanged;
1255
+ }
1256
+ get isLTR() {
1257
+ return this.direction === "ltr";
1258
+ }
1259
+ get isClosed() {
1260
+ return !this.currentOrTurningLeaves[0];
1261
+ }
1262
+ get isClosedInverted() {
1263
+ return !this.currentLeaves[1];
1264
+ }
1265
+ get currentLeaves() {
1266
+ let r = -1;
1267
+ for (let s = this.leaves.length - 1; s >= 0; s--) {
1268
+ const u = this.leaves[s];
1269
+ if (u.isTurned) {
1270
+ r = u.index + 1;
1271
+ break;
1272
+ }
1273
+ }
1274
+ return r == -1 ? [void 0, this.leaves[0]] : r == this.leaves.length ? [this.leaves[r - 1], void 0] : [this.leaves[r - 1], this.leaves[r]];
1275
+ }
1276
+ get currentOrTurningLeaves() {
1277
+ let r = -1;
1278
+ for (let s = this.leaves.length - 1; s >= 0; s--) {
1279
+ const u = this.leaves[s];
1280
+ if (u.isTurned || u.isTurning) {
1281
+ r = u.index + 1;
1282
+ break;
1283
+ }
1284
+ }
1285
+ return r == -1 ? [void 0, this.leaves[0]] : r == this.leaves.length ? [this.leaves[r - 1], void 0] : [this.leaves[r - 1], this.leaves[r]];
1286
+ }
1287
+ render(r, s = !1) {
1288
+ const u = document.querySelector(r);
1289
+ if (!u) throw new Error(`Couldn't find container with selector: ${r}`);
1290
+ this.bookElement = u, this.bookElement.classList.contains("flipbook") || this.bookElement.classList.add("flipbook");
1291
+ const c = u.querySelectorAll(".page");
1292
+ if (!c.length) throw new Error("No pages found in flipbook");
1293
+ this.pageElements = Array.from(c), this.leaves.splice(0, this.leaves.length);
1294
+ const v = Math.ceil(this.pagesCount / 2), f = new Gt(this.bookElement.clientWidth / 2, this.bookElement.clientHeight).aspectRatioFit(this.coverAspectRatio), l = new Gt(f.width * this.leafAspectRatio.width / this.coverAspectRatio.width, f.height * this.leafAspectRatio.height / this.coverAspectRatio.height);
1295
+ this.bookElement.style.perspective = 2 * Math.min(2 * l.width, l.height) + "px", this.pageElements.forEach((y, w) => {
1296
+ var C, O;
1297
+ y.style.width = `${l.width}px`, y.style.height = `${l.height}px`, y.style.zIndex = "" + (this.pagesCount - w), y.dataset.pageIndex = w.toString(), y.style[this.isLTR ? "left" : "right"] = (u.clientWidth - 2 * l.width) / 2 + "px", y.style.top = (u.clientHeight - l.height) / 2 + "px", y.dataset.pageSemanticName = ((C = this.pageSemantics) == null ? void 0 : C.indexToSemanticName(w)) ?? "", y.dataset.pageTitle = ((O = this.pageSemantics) == null ? void 0 : O.indexToTitle(w)) ?? "";
1298
+ const P = Math.floor(w / 2), g = (w + 1) % 2 == 1;
1299
+ y.classList.add(g ? "odd" : "even", ...w === 0 ? ["current-page"] : []), g ? (y.style.transform = `translateX(${this.isLTR ? "" : "-"}100%)`, this.leaves[P] = new Ti(P, [y, void 0], !1, { isLTR: this.isLTR, leavesCount: v, pagesCount: this.pagesCount }, (F) => {
1300
+ const N = F == W.Forward ? w + 2 === this.pagesCount ? [w + 1] : [w + 1, w + 2] : w === 0 ? [w] : [w - 1, w];
1301
+ if (this.prevVisiblePageIndices && this.prevVisiblePageIndices.length === N.length && N.every((q, H) => q === this.prevVisiblePageIndices[H])) return;
1302
+ const M = this.prevVisiblePageIndices;
1303
+ this.prevVisiblePageIndices = N, this.onTurned(N, M);
1304
+ })) : (y.style.transform = `scaleX(-1)translateX(${this.isLTR ? "-" : ""}100%)`, this.leaves[P].pages[1] = y);
1305
+ });
1306
+ const E = new (mi())(this.bookElement);
1307
+ E.on("panstart", this.onDragStart.bind(this)), E.on("panmove", this.onDragUpdate.bind(this)), E.on("panend", this.onDragEnd.bind(this)), this.bookElement.addEventListener("touchstart", this.handleTouchStart.bind(this), { passive: !1 }), this.bookElement.addEventListener("touchmove", this.handleTouchMove.bind(this), { passive: !1 }), s && this.fillDebugBar();
1308
+ }
1309
+ fillDebugBar() {
1310
+ var s;
1311
+ const r = document.createElement("div");
1312
+ r.className = "flipbook-debug-bar", (s = this.bookElement) == null || s.appendChild(r), setInterval(() => {
1313
+ var u;
1314
+ r.innerHTML = `
1315
+ <div>Direction: ${this.isLTR ? "LTR" : "RTL"}</div>
1316
+ <div>Current Leaf: ${this.currentLeaf ? this.currentLeaf.index : "None"}</div>
1317
+ <div>Flip dir: ${this.flipDirection}</div>
1318
+ <div>Flip Δ: ${this.flipDelta}</div>
1319
+ <div>Current Leaf Flip Position: ${(u = this.currentLeaf) == null ? void 0 : u.flipPosition.toFixed(3)}</div>
1320
+ <div>Is During Auto Flip: ${this.isDuringAutoFlip}</div>
1321
+ `;
1322
+ }, 10);
1323
+ }
1324
+ onDragStart(r) {
1325
+ if (console.log("drag start"), this.currentLeaf || this.isDuringAutoFlip) return this.flipDirection = W.None, void (this.flipStartingPos = 0);
1326
+ this.flipStartingPos = r.center.x;
1327
+ }
1328
+ onDragUpdate(r) {
1329
+ var s;
1330
+ if (console.log("drag update"), !this.isDuringAutoFlip && !this.isDuringManualFlip) {
1331
+ this.isDuringManualFlip = !0;
1332
+ try {
1333
+ const u = r.center.x;
1334
+ this.flipDelta = this.isLTR ? this.flipStartingPos - u : u - this.flipStartingPos;
1335
+ const c = ((s = this.bookElement) == null ? void 0 : s.clientWidth) ?? 0;
1336
+ if (Math.abs(this.flipDelta) > c || this.flipDelta === 0) return;
1337
+ switch (this.flipDirection = this.flipDirection !== W.None ? this.flipDirection : this.flipDelta > 0 ? W.Forward : W.Backward, this.flipDirection) {
1338
+ case W.Forward:
1339
+ const v = this.flipDelta / c;
1340
+ if (v > 1 || this.flipDelta < 0) return;
1341
+ if (!this.currentLeaf) {
1342
+ if (this.isClosedInverted) return;
1343
+ this.currentLeaf = this.currentOrTurningLeaves[1];
1344
+ }
1345
+ this.currentLeaf.efficientFlipToPosition(v);
1346
+ break;
1347
+ case W.Backward:
1348
+ const f = 1 - Math.abs(this.flipDelta) / c;
1349
+ if (f < 0 || this.flipDelta > 0) return;
1350
+ if (!this.currentLeaf) {
1351
+ if (this.isClosed) return;
1352
+ this.currentLeaf = this.currentOrTurningLeaves[0];
1353
+ }
1354
+ this.currentLeaf.efficientFlipToPosition(f);
1355
+ }
1356
+ } finally {
1357
+ this.isDuringManualFlip = !1;
1358
+ }
1359
+ }
1360
+ }
1361
+ async onDragEnd(r) {
1362
+ if (console.log("drag end"), !this.currentLeaf || this.isDuringAutoFlip) return this.flipDirection = W.None, void (this.flipStartingPos = 0);
1363
+ const s = 1e3 * r.velocityX;
1364
+ let u;
1365
+ switch (this.flipDirection) {
1366
+ case W.Forward:
1367
+ u = (this.isLTR ? s < -500 : s > 500) || this.currentLeaf.flipPosition >= 0.5 ? 1 : 0;
1368
+ break;
1369
+ case W.Backward:
1370
+ u = (this.isLTR ? s > 500 : s < -500) || this.currentLeaf.flipPosition <= 0.5 ? 0 : 1;
1371
+ break;
1372
+ default:
1373
+ return;
1374
+ }
1375
+ this.isDuringAutoFlip = !0, this.flipDirection = W.None, this.flipStartingPos = 0, await this.currentLeaf.flipToPosition(u), this.isDuringAutoFlip = !1, this.currentLeaf = void 0;
1376
+ }
1377
+ onTurned(r, s) {
1378
+ for (let u = 0; u < this.pageElements.length; u++) {
1379
+ const c = this.pageElements[u];
1380
+ (r.includes(u) ? c.classList.add : s && s.includes ? c.classList.remove : () => null).bind(c.classList)("current-page");
1381
+ }
1382
+ }
1383
+ jumpToPage(r) {
1384
+ this.onPageChanged && this.onPageChanged(r);
1385
+ }
1386
+ }
1387
+ var Ei = $e.$;
1388
+ const Pi = ({
1389
+ pages: d,
1390
+ className: r,
1391
+ debug: s = !1,
1392
+ direction: u = "ltr",
1393
+ // Add the direction prop
1394
+ pageSemantics: c = void 0
1395
+ }) => {
1396
+ const v = oi(
1397
+ new Ei({
1398
+ pageSemantics: c,
1399
+ pagesCount: d.length,
1400
+ direction: u
1401
+ })
1402
+ );
1403
+ return si(() => {
1404
+ v.current.render(`.${r}`, s);
1405
+ }, []), /* @__PURE__ */ ze.jsx("div", { className: r, children: d.map((f, l) => /* @__PURE__ */ ze.jsx("div", { className: "page", children: f }, l)) });
1406
+ };
1407
+ export {
1408
+ Pi as FlipBook
1409
+ };
1410
+ //# sourceMappingURL=flip-book.js.map