@readium/navigator-html-injectables 1.2.0 → 1.3.2
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/dist/index.js +1497 -1434
- package/dist/index.umd.cjs +15 -15
- package/package.json +2 -2
- package/src/helpers/dom.ts +8 -0
- package/src/helpers/locator.ts +55 -53
- package/src/modules/index.ts +1 -0
- package/src/modules/setup/FixedSetup.ts +2 -0
- package/src/modules/setup/Setup.ts +30 -1
- package/src/modules/snapper/ColumnSnapper.ts +3 -1
- package/src/modules/snapper/ScrollSnapper.ts +13 -8
- package/types/src/helpers/dom.d.ts +9 -0
- package/types/src/modules/index.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const Mt = Math.pow(2, 32), Ae = () => Math.round(Math.random() * Mt).toString(36),
|
|
2
|
-
class
|
|
1
|
+
const Mt = Math.pow(2, 32), Ae = () => Math.round(Math.random() * Mt).toString(36), Rt = () => `${Math.round(performance.now())}-${Ae()}-${Ae()}`, _ = 1;
|
|
2
|
+
class Nt {
|
|
3
3
|
constructor(e) {
|
|
4
4
|
this.destination = null, this.registrar = /* @__PURE__ */ new Map(), this.origin = "", this.channelId = "", this.receiver = this.receive.bind(this), this.preLog = [], this.wnd = e, e.addEventListener("message", this.receiver);
|
|
5
5
|
}
|
|
@@ -12,8 +12,8 @@ class Rt {
|
|
|
12
12
|
if (!(!("_readium" in t) || !t._readium || t._readium <= 0)) {
|
|
13
13
|
if (t.key === "_ping") {
|
|
14
14
|
if (!this.destination) {
|
|
15
|
-
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !==
|
|
16
|
-
t._readium >
|
|
15
|
+
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !== _) {
|
|
16
|
+
t._readium > _ ? this.send("error", `received comms version ${t._readium} higher than ${_}`) : this.send("error", `received comms version ${t._readium} lower than ${_}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
this.send("_pong", void 0), this.preLog.forEach((r) => this.send("log", r)), this.preLog = [];
|
|
@@ -76,9 +76,9 @@ class Rt {
|
|
|
76
76
|
if (!this.destination)
|
|
77
77
|
throw Error("Attempted to send comms message before destination has been initialized");
|
|
78
78
|
const n = {
|
|
79
|
-
_readium:
|
|
79
|
+
_readium: _,
|
|
80
80
|
_channel: this.channelId,
|
|
81
|
-
id: r ??
|
|
81
|
+
id: r ?? Rt(),
|
|
82
82
|
// scrict,
|
|
83
83
|
key: e,
|
|
84
84
|
data: t
|
|
@@ -95,341 +95,7 @@ class Rt {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
class
|
|
99
|
-
}
|
|
100
|
-
var F = [], Lt = function() {
|
|
101
|
-
return F.some(function(i) {
|
|
102
|
-
return i.activeTargets.length > 0;
|
|
103
|
-
});
|
|
104
|
-
}, zt = function() {
|
|
105
|
-
return F.some(function(i) {
|
|
106
|
-
return i.skippedTargets.length > 0;
|
|
107
|
-
});
|
|
108
|
-
}, Me = "ResizeObserver loop completed with undelivered notifications.", It = function() {
|
|
109
|
-
var i;
|
|
110
|
-
typeof ErrorEvent == "function" ? i = new ErrorEvent("error", {
|
|
111
|
-
message: Me
|
|
112
|
-
}) : (i = document.createEvent("Event"), i.initEvent("error", !1, !1), i.message = Me), window.dispatchEvent(i);
|
|
113
|
-
}, G;
|
|
114
|
-
(function(i) {
|
|
115
|
-
i.BORDER_BOX = "border-box", i.CONTENT_BOX = "content-box", i.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
116
|
-
})(G || (G = {}));
|
|
117
|
-
var k = function(i) {
|
|
118
|
-
return Object.freeze(i);
|
|
119
|
-
}, Bt = function() {
|
|
120
|
-
function i(e, t) {
|
|
121
|
-
this.inlineSize = e, this.blockSize = t, k(this);
|
|
122
|
-
}
|
|
123
|
-
return i;
|
|
124
|
-
}(), Qe = function() {
|
|
125
|
-
function i(e, t, r, s) {
|
|
126
|
-
return this.x = e, this.y = t, this.width = r, this.height = s, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, k(this);
|
|
127
|
-
}
|
|
128
|
-
return i.prototype.toJSON = function() {
|
|
129
|
-
var e = this, t = e.x, r = e.y, s = e.top, n = e.right, o = e.bottom, a = e.left, h = e.width, c = e.height;
|
|
130
|
-
return { x: t, y: r, top: s, right: n, bottom: o, left: a, width: h, height: c };
|
|
131
|
-
}, i.fromRect = function(e) {
|
|
132
|
-
return new i(e.x, e.y, e.width, e.height);
|
|
133
|
-
}, i;
|
|
134
|
-
}(), Ee = function(i) {
|
|
135
|
-
return i instanceof SVGElement && "getBBox" in i;
|
|
136
|
-
}, et = function(i) {
|
|
137
|
-
if (Ee(i)) {
|
|
138
|
-
var e = i.getBBox(), t = e.width, r = e.height;
|
|
139
|
-
return !t && !r;
|
|
140
|
-
}
|
|
141
|
-
var s = i, n = s.offsetWidth, o = s.offsetHeight;
|
|
142
|
-
return !(n || o || i.getClientRects().length);
|
|
143
|
-
}, Ne = function(i) {
|
|
144
|
-
var e;
|
|
145
|
-
if (i instanceof Element)
|
|
146
|
-
return !0;
|
|
147
|
-
var t = (e = i == null ? void 0 : i.ownerDocument) === null || e === void 0 ? void 0 : e.defaultView;
|
|
148
|
-
return !!(t && i instanceof t.Element);
|
|
149
|
-
}, Dt = function(i) {
|
|
150
|
-
switch (i.tagName) {
|
|
151
|
-
case "INPUT":
|
|
152
|
-
if (i.type !== "image")
|
|
153
|
-
break;
|
|
154
|
-
case "VIDEO":
|
|
155
|
-
case "AUDIO":
|
|
156
|
-
case "EMBED":
|
|
157
|
-
case "OBJECT":
|
|
158
|
-
case "CANVAS":
|
|
159
|
-
case "IFRAME":
|
|
160
|
-
case "IMG":
|
|
161
|
-
return !0;
|
|
162
|
-
}
|
|
163
|
-
return !1;
|
|
164
|
-
}, _ = typeof window < "u" ? window : {}, Q = /* @__PURE__ */ new WeakMap(), Re = /auto|scroll/, Wt = /^tb|vertical/, Ft = /msie|trident/i.test(_.navigator && _.navigator.userAgent), N = function(i) {
|
|
165
|
-
return parseFloat(i || "0");
|
|
166
|
-
}, $ = function(i, e, t) {
|
|
167
|
-
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new Bt((t ? e : i) || 0, (t ? i : e) || 0);
|
|
168
|
-
}, Le = k({
|
|
169
|
-
devicePixelContentBoxSize: $(),
|
|
170
|
-
borderBoxSize: $(),
|
|
171
|
-
contentBoxSize: $(),
|
|
172
|
-
contentRect: new Qe(0, 0, 0, 0)
|
|
173
|
-
}), tt = function(i, e) {
|
|
174
|
-
if (e === void 0 && (e = !1), Q.has(i) && !e)
|
|
175
|
-
return Q.get(i);
|
|
176
|
-
if (et(i))
|
|
177
|
-
return Q.set(i, Le), Le;
|
|
178
|
-
var t = getComputedStyle(i), r = Ee(i) && i.ownerSVGElement && i.getBBox(), s = !Ft && t.boxSizing === "border-box", n = Wt.test(t.writingMode || ""), o = !r && Re.test(t.overflowY || ""), a = !r && Re.test(t.overflowX || ""), h = r ? 0 : N(t.paddingTop), c = r ? 0 : N(t.paddingRight), d = r ? 0 : N(t.paddingBottom), p = r ? 0 : N(t.paddingLeft), u = r ? 0 : N(t.borderTopWidth), f = r ? 0 : N(t.borderRightWidth), v = r ? 0 : N(t.borderBottomWidth), g = r ? 0 : N(t.borderLeftWidth), y = p + c, x = h + d, S = g + f, m = u + v, E = a ? i.offsetHeight - m - i.clientHeight : 0, O = o ? i.offsetWidth - S - i.clientWidth : 0, Y = s ? y + S : 0, Z = s ? x + m : 0, B = r ? r.width : N(t.width) - Y - O, D = r ? r.height : N(t.height) - Z - E, K = B + y + O + S, J = D + x + E + m, U = k({
|
|
179
|
-
devicePixelContentBoxSize: $(Math.round(B * devicePixelRatio), Math.round(D * devicePixelRatio), n),
|
|
180
|
-
borderBoxSize: $(K, J, n),
|
|
181
|
-
contentBoxSize: $(B, D, n),
|
|
182
|
-
contentRect: new Qe(p, h, B, D)
|
|
183
|
-
});
|
|
184
|
-
return Q.set(i, U), U;
|
|
185
|
-
}, it = function(i, e, t) {
|
|
186
|
-
var r = tt(i, t), s = r.borderBoxSize, n = r.contentBoxSize, o = r.devicePixelContentBoxSize;
|
|
187
|
-
switch (e) {
|
|
188
|
-
case G.DEVICE_PIXEL_CONTENT_BOX:
|
|
189
|
-
return o;
|
|
190
|
-
case G.BORDER_BOX:
|
|
191
|
-
return s;
|
|
192
|
-
default:
|
|
193
|
-
return n;
|
|
194
|
-
}
|
|
195
|
-
}, kt = function() {
|
|
196
|
-
function i(e) {
|
|
197
|
-
var t = tt(e);
|
|
198
|
-
this.target = e, this.contentRect = t.contentRect, this.borderBoxSize = k([t.borderBoxSize]), this.contentBoxSize = k([t.contentBoxSize]), this.devicePixelContentBoxSize = k([t.devicePixelContentBoxSize]);
|
|
199
|
-
}
|
|
200
|
-
return i;
|
|
201
|
-
}(), rt = function(i) {
|
|
202
|
-
if (et(i))
|
|
203
|
-
return 1 / 0;
|
|
204
|
-
for (var e = 0, t = i.parentNode; t; )
|
|
205
|
-
e += 1, t = t.parentNode;
|
|
206
|
-
return e;
|
|
207
|
-
}, Ut = function() {
|
|
208
|
-
var i = 1 / 0, e = [];
|
|
209
|
-
F.forEach(function(o) {
|
|
210
|
-
if (o.activeTargets.length !== 0) {
|
|
211
|
-
var a = [];
|
|
212
|
-
o.activeTargets.forEach(function(c) {
|
|
213
|
-
var d = new kt(c.target), p = rt(c.target);
|
|
214
|
-
a.push(d), c.lastReportedSize = it(c.target, c.observedBox), p < i && (i = p);
|
|
215
|
-
}), e.push(function() {
|
|
216
|
-
o.callback.call(o.observer, a, o.observer);
|
|
217
|
-
}), o.activeTargets.splice(0, o.activeTargets.length);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
for (var t = 0, r = e; t < r.length; t++) {
|
|
221
|
-
var s = r[t];
|
|
222
|
-
s();
|
|
223
|
-
}
|
|
224
|
-
return i;
|
|
225
|
-
}, ze = function(i) {
|
|
226
|
-
F.forEach(function(t) {
|
|
227
|
-
t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(s) {
|
|
228
|
-
s.isActive() && (rt(s.target) > i ? t.activeTargets.push(s) : t.skippedTargets.push(s));
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
}, $t = function() {
|
|
232
|
-
var i = 0;
|
|
233
|
-
for (ze(i); Lt(); )
|
|
234
|
-
i = Ut(), ze(i);
|
|
235
|
-
return zt() && It(), i > 0;
|
|
236
|
-
}, de, st = [], Ht = function() {
|
|
237
|
-
return st.splice(0).forEach(function(i) {
|
|
238
|
-
return i();
|
|
239
|
-
});
|
|
240
|
-
}, qt = function(i) {
|
|
241
|
-
if (!de) {
|
|
242
|
-
var e = 0, t = document.createTextNode(""), r = { characterData: !0 };
|
|
243
|
-
new MutationObserver(function() {
|
|
244
|
-
return Ht();
|
|
245
|
-
}).observe(t, r), de = function() {
|
|
246
|
-
t.textContent = "".concat(e ? e-- : e++);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
st.push(i), de();
|
|
250
|
-
}, Xt = function(i) {
|
|
251
|
-
qt(function() {
|
|
252
|
-
requestAnimationFrame(i);
|
|
253
|
-
});
|
|
254
|
-
}, re = 0, Vt = function() {
|
|
255
|
-
return !!re;
|
|
256
|
-
}, _t = 250, jt = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, Ie = [
|
|
257
|
-
"resize",
|
|
258
|
-
"load",
|
|
259
|
-
"transitionend",
|
|
260
|
-
"animationend",
|
|
261
|
-
"animationstart",
|
|
262
|
-
"animationiteration",
|
|
263
|
-
"keyup",
|
|
264
|
-
"keydown",
|
|
265
|
-
"mouseup",
|
|
266
|
-
"mousedown",
|
|
267
|
-
"mouseover",
|
|
268
|
-
"mouseout",
|
|
269
|
-
"blur",
|
|
270
|
-
"focus"
|
|
271
|
-
], Be = function(i) {
|
|
272
|
-
return i === void 0 && (i = 0), Date.now() + i;
|
|
273
|
-
}, ue = !1, Gt = function() {
|
|
274
|
-
function i() {
|
|
275
|
-
var e = this;
|
|
276
|
-
this.stopped = !0, this.listener = function() {
|
|
277
|
-
return e.schedule();
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
return i.prototype.run = function(e) {
|
|
281
|
-
var t = this;
|
|
282
|
-
if (e === void 0 && (e = _t), !ue) {
|
|
283
|
-
ue = !0;
|
|
284
|
-
var r = Be(e);
|
|
285
|
-
Xt(function() {
|
|
286
|
-
var s = !1;
|
|
287
|
-
try {
|
|
288
|
-
s = $t();
|
|
289
|
-
} finally {
|
|
290
|
-
if (ue = !1, e = r - Be(), !Vt())
|
|
291
|
-
return;
|
|
292
|
-
s ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}, i.prototype.schedule = function() {
|
|
297
|
-
this.stop(), this.run();
|
|
298
|
-
}, i.prototype.observe = function() {
|
|
299
|
-
var e = this, t = function() {
|
|
300
|
-
return e.observer && e.observer.observe(document.body, jt);
|
|
301
|
-
};
|
|
302
|
-
document.body ? t() : _.addEventListener("DOMContentLoaded", t);
|
|
303
|
-
}, i.prototype.start = function() {
|
|
304
|
-
var e = this;
|
|
305
|
-
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), Ie.forEach(function(t) {
|
|
306
|
-
return _.addEventListener(t, e.listener, !0);
|
|
307
|
-
}));
|
|
308
|
-
}, i.prototype.stop = function() {
|
|
309
|
-
var e = this;
|
|
310
|
-
this.stopped || (this.observer && this.observer.disconnect(), Ie.forEach(function(t) {
|
|
311
|
-
return _.removeEventListener(t, e.listener, !0);
|
|
312
|
-
}), this.stopped = !0);
|
|
313
|
-
}, i;
|
|
314
|
-
}(), fe = new Gt(), De = function(i) {
|
|
315
|
-
!re && i > 0 && fe.start(), re += i, !re && fe.stop();
|
|
316
|
-
}, Yt = function(i) {
|
|
317
|
-
return !Ee(i) && !Dt(i) && getComputedStyle(i).display === "inline";
|
|
318
|
-
}, Zt = function() {
|
|
319
|
-
function i(e, t) {
|
|
320
|
-
this.target = e, this.observedBox = t || G.CONTENT_BOX, this.lastReportedSize = {
|
|
321
|
-
inlineSize: 0,
|
|
322
|
-
blockSize: 0
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
return i.prototype.isActive = function() {
|
|
326
|
-
var e = it(this.target, this.observedBox, !0);
|
|
327
|
-
return Yt(this.target) && (this.lastReportedSize = e), this.lastReportedSize.inlineSize !== e.inlineSize || this.lastReportedSize.blockSize !== e.blockSize;
|
|
328
|
-
}, i;
|
|
329
|
-
}(), Kt = function() {
|
|
330
|
-
function i(e, t) {
|
|
331
|
-
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = e, this.callback = t;
|
|
332
|
-
}
|
|
333
|
-
return i;
|
|
334
|
-
}(), ee = /* @__PURE__ */ new WeakMap(), We = function(i, e) {
|
|
335
|
-
for (var t = 0; t < i.length; t += 1)
|
|
336
|
-
if (i[t].target === e)
|
|
337
|
-
return t;
|
|
338
|
-
return -1;
|
|
339
|
-
}, te = function() {
|
|
340
|
-
function i() {
|
|
341
|
-
}
|
|
342
|
-
return i.connect = function(e, t) {
|
|
343
|
-
var r = new Kt(e, t);
|
|
344
|
-
ee.set(e, r);
|
|
345
|
-
}, i.observe = function(e, t, r) {
|
|
346
|
-
var s = ee.get(e), n = s.observationTargets.length === 0;
|
|
347
|
-
We(s.observationTargets, t) < 0 && (n && F.push(s), s.observationTargets.push(new Zt(t, r && r.box)), De(1), fe.schedule());
|
|
348
|
-
}, i.unobserve = function(e, t) {
|
|
349
|
-
var r = ee.get(e), s = We(r.observationTargets, t), n = r.observationTargets.length === 1;
|
|
350
|
-
s >= 0 && (n && F.splice(F.indexOf(r), 1), r.observationTargets.splice(s, 1), De(-1));
|
|
351
|
-
}, i.disconnect = function(e) {
|
|
352
|
-
var t = this, r = ee.get(e);
|
|
353
|
-
r.observationTargets.slice().forEach(function(s) {
|
|
354
|
-
return t.unobserve(e, s.target);
|
|
355
|
-
}), r.activeTargets.splice(0, r.activeTargets.length);
|
|
356
|
-
}, i;
|
|
357
|
-
}(), nt = function() {
|
|
358
|
-
function i(e) {
|
|
359
|
-
if (arguments.length === 0)
|
|
360
|
-
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
361
|
-
if (typeof e != "function")
|
|
362
|
-
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
363
|
-
te.connect(this, e);
|
|
364
|
-
}
|
|
365
|
-
return i.prototype.observe = function(e, t) {
|
|
366
|
-
if (arguments.length === 0)
|
|
367
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
368
|
-
if (!Ne(e))
|
|
369
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
370
|
-
te.observe(this, e, t);
|
|
371
|
-
}, i.prototype.unobserve = function(e) {
|
|
372
|
-
if (arguments.length === 0)
|
|
373
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
374
|
-
if (!Ne(e))
|
|
375
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
376
|
-
te.unobserve(this, e);
|
|
377
|
-
}, i.prototype.disconnect = function() {
|
|
378
|
-
te.disconnect(this);
|
|
379
|
-
}, i.toString = function() {
|
|
380
|
-
return "function ResizeObserver () { [polyfill code] }";
|
|
381
|
-
}, i;
|
|
382
|
-
}();
|
|
383
|
-
const Fe = "readium-snapper-style", ot = class me extends ce {
|
|
384
|
-
constructor() {
|
|
385
|
-
super(...arguments), this.protected = !1;
|
|
386
|
-
}
|
|
387
|
-
buildStyles() {
|
|
388
|
-
return `
|
|
389
|
-
html, body {
|
|
390
|
-
touch-action: manipulation;
|
|
391
|
-
user-select: ${this.protected ? "none" : "auto"};
|
|
392
|
-
}`;
|
|
393
|
-
}
|
|
394
|
-
mount(e, t) {
|
|
395
|
-
const r = e.document.createElement("style");
|
|
396
|
-
return r.dataset.readium = "true", r.id = Fe, r.textContent = this.buildStyles(), e.document.head.appendChild(r), t.register("protect", me.moduleName, (s, n) => {
|
|
397
|
-
this.protected = !0, r.textContent = this.buildStyles(), n(!0);
|
|
398
|
-
}), t.register("unprotect", me.moduleName, (s, n) => {
|
|
399
|
-
this.protected = !1, r.textContent = this.buildStyles(), n(!0);
|
|
400
|
-
}), t.log("Snapper Mounted"), !0;
|
|
401
|
-
}
|
|
402
|
-
unmount(e, t) {
|
|
403
|
-
var r;
|
|
404
|
-
return (r = e.document.getElementById(Fe)) == null || r.remove(), t.log("Snapper Unmounted"), !0;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
ot.moduleName = "snapper";
|
|
408
|
-
let at = ot;
|
|
409
|
-
function W(i) {
|
|
410
|
-
return i.document.body.dir.toLowerCase() === "rtl";
|
|
411
|
-
}
|
|
412
|
-
function lt(i) {
|
|
413
|
-
return parseInt(
|
|
414
|
-
i.getComputedStyle(
|
|
415
|
-
i.document.documentElement
|
|
416
|
-
).getPropertyValue("column-count")
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
function Jt(i) {
|
|
420
|
-
const e = "readium-virtual-page";
|
|
421
|
-
let t = i.document.getElementById(e);
|
|
422
|
-
if (lt(i) !== 2)
|
|
423
|
-
t && t.remove();
|
|
424
|
-
else {
|
|
425
|
-
const s = i.document.scrollingElement.scrollWidth / i.innerWidth;
|
|
426
|
-
Math.round(s * 2) / 2 % 1 > 0.1 && (t ? t.remove() : (t = i.document.createElement("div"), t.setAttribute("id", e), t.dataset.readium = "true", t.style.breakBefore = "column", t.innerHTML = "​", i.document.body.appendChild(t)));
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
function Qt(i) {
|
|
430
|
-
return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
|
|
431
|
-
}
|
|
432
|
-
class xe {
|
|
98
|
+
class Ee {
|
|
433
99
|
/**
|
|
434
100
|
* Creates a [Encryption].
|
|
435
101
|
*/
|
|
@@ -441,7 +107,7 @@ class xe {
|
|
|
441
107
|
*/
|
|
442
108
|
static deserialize(e) {
|
|
443
109
|
if (e && e.algorithm)
|
|
444
|
-
return new
|
|
110
|
+
return new Ee({
|
|
445
111
|
algorithm: e.algorithm,
|
|
446
112
|
compression: e.compression,
|
|
447
113
|
originalLength: e.originalLength,
|
|
@@ -486,7 +152,7 @@ class b {
|
|
|
486
152
|
}
|
|
487
153
|
Object.defineProperty(b.prototype, "encryption", {
|
|
488
154
|
get: function() {
|
|
489
|
-
return
|
|
155
|
+
return Ee.deserialize(this.otherProperties.encrypted);
|
|
490
156
|
}
|
|
491
157
|
});
|
|
492
158
|
b.prototype.getContains = function() {
|
|
@@ -506,22 +172,22 @@ class l {
|
|
|
506
172
|
} else
|
|
507
173
|
throw new Error("Invalid media type");
|
|
508
174
|
const o = {};
|
|
509
|
-
for (let
|
|
510
|
-
const f = s[
|
|
175
|
+
for (let d = 1; d < s.length; d++) {
|
|
176
|
+
const f = s[d].split("=");
|
|
511
177
|
if (f.length === 2) {
|
|
512
178
|
const v = f[0].toLocaleLowerCase(), g = v === "charset" ? f[1].toUpperCase() : f[1];
|
|
513
179
|
o[v] = g;
|
|
514
180
|
}
|
|
515
181
|
}
|
|
516
182
|
const a = {}, h = Object.keys(o);
|
|
517
|
-
h.sort((
|
|
183
|
+
h.sort((d, f) => d.localeCompare(f)), h.forEach((d) => a[d] = o[d]);
|
|
518
184
|
let c = "";
|
|
519
|
-
for (const
|
|
520
|
-
const f = a[
|
|
521
|
-
c += `;${
|
|
185
|
+
for (const d in a) {
|
|
186
|
+
const f = a[d];
|
|
187
|
+
c += `;${d}=${f}`;
|
|
522
188
|
}
|
|
523
|
-
const
|
|
524
|
-
this.string =
|
|
189
|
+
const u = `${t}/${r}${c}`, p = a.encoding;
|
|
190
|
+
this.string = u, this.type = t, this.subtype = r, this.parameters = a, this.encoding = p, this.name = e.name, this.fileExtension = e.fileExtension;
|
|
525
191
|
}
|
|
526
192
|
static parse(e) {
|
|
527
193
|
return new l(e);
|
|
@@ -843,6 +509,27 @@ class l {
|
|
|
843
509
|
fileExtension: "json"
|
|
844
510
|
});
|
|
845
511
|
}
|
|
512
|
+
static get READIUM_CONTENT_DOCUMENT() {
|
|
513
|
+
return l.parse({
|
|
514
|
+
mediaType: "application/vnd.readium.content+json",
|
|
515
|
+
name: "Readium Content Document",
|
|
516
|
+
fileExtension: "json"
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
|
|
520
|
+
return l.parse({
|
|
521
|
+
mediaType: "application/guided-navigation+json",
|
|
522
|
+
name: "Readium Guided Navigation Document",
|
|
523
|
+
fileExtension: "json"
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
static get READIUM_POSITION_LIST() {
|
|
527
|
+
return l.parse({
|
|
528
|
+
mediaType: "application/vnd.readium.position-list+json",
|
|
529
|
+
name: "Readium Position List",
|
|
530
|
+
fileExtension: "json"
|
|
531
|
+
});
|
|
532
|
+
}
|
|
846
533
|
static get READIUM_WEBPUB() {
|
|
847
534
|
return l.parse({
|
|
848
535
|
mediaType: "application/webpub+zip",
|
|
@@ -929,7 +616,7 @@ class l {
|
|
|
929
616
|
});
|
|
930
617
|
}
|
|
931
618
|
}
|
|
932
|
-
class
|
|
619
|
+
class Me {
|
|
933
620
|
constructor(e) {
|
|
934
621
|
this.uri = e, this.parameters = this.getParameters(e);
|
|
935
622
|
}
|
|
@@ -957,22 +644,22 @@ class ke {
|
|
|
957
644
|
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? r(s[2]) : t(s[2]));
|
|
958
645
|
}
|
|
959
646
|
}
|
|
960
|
-
function
|
|
647
|
+
function Lt(i) {
|
|
961
648
|
return i && i instanceof Array ? i : void 0;
|
|
962
649
|
}
|
|
963
|
-
function
|
|
964
|
-
return i && typeof i == "string" ? [i] :
|
|
650
|
+
function Qe(i) {
|
|
651
|
+
return i && typeof i == "string" ? [i] : Lt(i);
|
|
965
652
|
}
|
|
966
|
-
function
|
|
653
|
+
function Re(i) {
|
|
967
654
|
return typeof i == "string" ? new Date(i) : void 0;
|
|
968
655
|
}
|
|
969
|
-
function
|
|
656
|
+
function re(i) {
|
|
970
657
|
return isNaN(i) ? void 0 : i;
|
|
971
658
|
}
|
|
972
|
-
function
|
|
973
|
-
return
|
|
659
|
+
function O(i) {
|
|
660
|
+
return re(i) !== void 0 && Math.sign(i) >= 0 ? i : void 0;
|
|
974
661
|
}
|
|
975
|
-
function
|
|
662
|
+
function zt(i) {
|
|
976
663
|
const e = new Array();
|
|
977
664
|
return i.forEach((t) => e.push(t)), e;
|
|
978
665
|
}
|
|
@@ -989,7 +676,7 @@ class w {
|
|
|
989
676
|
static deserialize(e) {
|
|
990
677
|
if (!e)
|
|
991
678
|
return;
|
|
992
|
-
const t =
|
|
679
|
+
const t = re(e.progression), r = re(e.totalProgression), s = re(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
993
680
|
"fragment",
|
|
994
681
|
"fragments",
|
|
995
682
|
"progression",
|
|
@@ -999,7 +686,7 @@ class w {
|
|
|
999
686
|
return Object.entries(e).forEach(([a, h]) => {
|
|
1000
687
|
o.has(a) || n.set(a, h);
|
|
1001
688
|
}), new w({
|
|
1002
|
-
fragments:
|
|
689
|
+
fragments: Qe(e.fragments || e.fragment),
|
|
1003
690
|
progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
|
|
1004
691
|
totalProgression: r !== void 0 && r >= 0 && r <= 1 ? r : void 0,
|
|
1005
692
|
position: s !== void 0 && s > 0 ? s : void 0,
|
|
@@ -1099,11 +786,11 @@ class H {
|
|
|
1099
786
|
title: e.title,
|
|
1100
787
|
rels: e.rel ? e.rel instanceof Array ? new Set(e.rel) : /* @__PURE__ */ new Set([e.rel]) : void 0,
|
|
1101
788
|
properties: b.deserialize(e.properties),
|
|
1102
|
-
height:
|
|
1103
|
-
width:
|
|
1104
|
-
duration:
|
|
1105
|
-
bitrate:
|
|
1106
|
-
languages:
|
|
789
|
+
height: O(e.height),
|
|
790
|
+
width: O(e.width),
|
|
791
|
+
duration: O(e.duration),
|
|
792
|
+
bitrate: O(e.bitrate),
|
|
793
|
+
languages: Qe(e.language),
|
|
1107
794
|
alternates: ne.deserialize(e.alternate),
|
|
1108
795
|
children: ne.deserialize(e.children)
|
|
1109
796
|
});
|
|
@@ -1113,7 +800,7 @@ class H {
|
|
|
1113
800
|
*/
|
|
1114
801
|
serialize() {
|
|
1115
802
|
const e = { href: this.href };
|
|
1116
|
-
return this.templated !== void 0 && (e.templated = this.templated), this.type !== void 0 && (e.type = this.type), this.title !== void 0 && (e.title = this.title), this.rels && (e.rel =
|
|
803
|
+
return this.templated !== void 0 && (e.templated = this.templated), this.type !== void 0 && (e.type = this.type), this.title !== void 0 && (e.title = this.title), this.rels && (e.rel = zt(this.rels)), this.properties && (e.properties = this.properties.serialize()), this.height !== void 0 && (e.height = this.height), this.width !== void 0 && (e.width = this.width), this.duration !== void 0 && (e.duration = this.duration), this.bitrate !== void 0 && (e.bitrate = this.bitrate), this.languages && (e.language = this.languages), this.alternates && (e.alternate = this.alternates.serialize()), this.children && (e.children = this.children.serialize()), e;
|
|
1117
804
|
}
|
|
1118
805
|
/** MediaType of the linked resource. */
|
|
1119
806
|
get mediaType() {
|
|
@@ -1131,14 +818,14 @@ class H {
|
|
|
1131
818
|
}
|
|
1132
819
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
1133
820
|
get templateParameters() {
|
|
1134
|
-
return this.templated ? new
|
|
821
|
+
return this.templated ? new Me(this.href).parameters : /* @__PURE__ */ new Set();
|
|
1135
822
|
}
|
|
1136
823
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
1137
824
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
1138
825
|
*/
|
|
1139
826
|
expandTemplate(e) {
|
|
1140
827
|
return new H({
|
|
1141
|
-
href: new
|
|
828
|
+
href: new Me(this.href).expand(e),
|
|
1142
829
|
templated: !1
|
|
1143
830
|
});
|
|
1144
831
|
}
|
|
@@ -1272,11 +959,11 @@ class oe {
|
|
|
1272
959
|
static deserialize(e) {
|
|
1273
960
|
if (!(e && e.cssSelector))
|
|
1274
961
|
return;
|
|
1275
|
-
let t =
|
|
962
|
+
let t = O(e.textNodeIndex);
|
|
1276
963
|
if (t === void 0)
|
|
1277
964
|
return;
|
|
1278
|
-
let r =
|
|
1279
|
-
return r === void 0 && (r =
|
|
965
|
+
let r = O(e.charOffset);
|
|
966
|
+
return r === void 0 && (r = O(e.offset)), new oe({
|
|
1280
967
|
cssSelector: e.cssSelector,
|
|
1281
968
|
textNodeIndex: t,
|
|
1282
969
|
charOffset: r
|
|
@@ -1293,7 +980,7 @@ class oe {
|
|
|
1293
980
|
return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
|
|
1294
981
|
}
|
|
1295
982
|
}
|
|
1296
|
-
class
|
|
983
|
+
class xe {
|
|
1297
984
|
/**
|
|
1298
985
|
* Creates a [DomRange].
|
|
1299
986
|
*/
|
|
@@ -1308,7 +995,7 @@ class we {
|
|
|
1308
995
|
return;
|
|
1309
996
|
let t = oe.deserialize(e.start);
|
|
1310
997
|
if (t)
|
|
1311
|
-
return new
|
|
998
|
+
return new xe({
|
|
1312
999
|
start: t,
|
|
1313
1000
|
end: oe.deserialize(e.end)
|
|
1314
1001
|
});
|
|
@@ -1331,7 +1018,7 @@ w.prototype.getPartialCfi = function() {
|
|
|
1331
1018
|
};
|
|
1332
1019
|
w.prototype.getDomRange = function() {
|
|
1333
1020
|
var i;
|
|
1334
|
-
return
|
|
1021
|
+
return xe.deserialize((i = this.otherLocations) == null ? void 0 : i.get("domRange"));
|
|
1335
1022
|
};
|
|
1336
1023
|
w.prototype.fragmentParameters = function() {
|
|
1337
1024
|
return new Map(
|
|
@@ -1369,7 +1056,7 @@ w.prototype.space = function() {
|
|
|
1369
1056
|
if (e.length === 4 && !e.some(isNaN))
|
|
1370
1057
|
return e;
|
|
1371
1058
|
};
|
|
1372
|
-
class
|
|
1059
|
+
class we {
|
|
1373
1060
|
/** Creates a [Price]. */
|
|
1374
1061
|
constructor(e) {
|
|
1375
1062
|
this.currency = e.currency, this.value = e.value;
|
|
@@ -1383,9 +1070,9 @@ class Te {
|
|
|
1383
1070
|
let t = e.currency;
|
|
1384
1071
|
if (!(t && typeof t == "string" && t.length > 0))
|
|
1385
1072
|
return;
|
|
1386
|
-
let r =
|
|
1073
|
+
let r = O(e.value);
|
|
1387
1074
|
if (r !== void 0)
|
|
1388
|
-
return new
|
|
1075
|
+
return new we({ currency: t, value: r });
|
|
1389
1076
|
}
|
|
1390
1077
|
/**
|
|
1391
1078
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1421,7 +1108,7 @@ class j {
|
|
|
1421
1108
|
return this.children && (e.children = this.children.map((t) => t.serialize())), e;
|
|
1422
1109
|
}
|
|
1423
1110
|
}
|
|
1424
|
-
class
|
|
1111
|
+
class Te {
|
|
1425
1112
|
/** Creates a [Price]. */
|
|
1426
1113
|
constructor(e) {
|
|
1427
1114
|
this.total = e.total, this.position = e.position;
|
|
@@ -1431,9 +1118,9 @@ class Se {
|
|
|
1431
1118
|
*/
|
|
1432
1119
|
static deserialize(e) {
|
|
1433
1120
|
if (e)
|
|
1434
|
-
return new
|
|
1435
|
-
total:
|
|
1436
|
-
position:
|
|
1121
|
+
return new Te({
|
|
1122
|
+
total: O(e.total),
|
|
1123
|
+
position: O(e.position)
|
|
1437
1124
|
});
|
|
1438
1125
|
}
|
|
1439
1126
|
/**
|
|
@@ -1444,7 +1131,7 @@ class Se {
|
|
|
1444
1131
|
return this.total !== void 0 && (e.total = this.total), this.position !== void 0 && (e.position = this.position), e;
|
|
1445
1132
|
}
|
|
1446
1133
|
}
|
|
1447
|
-
class
|
|
1134
|
+
class Se {
|
|
1448
1135
|
/** Creates a [Copies]. */
|
|
1449
1136
|
constructor(e) {
|
|
1450
1137
|
this.total = e.total, this.available = e.available;
|
|
@@ -1454,9 +1141,9 @@ class Ce {
|
|
|
1454
1141
|
*/
|
|
1455
1142
|
static deserialize(e) {
|
|
1456
1143
|
if (e)
|
|
1457
|
-
return new
|
|
1458
|
-
total:
|
|
1459
|
-
available:
|
|
1144
|
+
return new Se({
|
|
1145
|
+
total: O(e.total),
|
|
1146
|
+
available: O(e.available)
|
|
1460
1147
|
});
|
|
1461
1148
|
}
|
|
1462
1149
|
/**
|
|
@@ -1467,7 +1154,7 @@ class Ce {
|
|
|
1467
1154
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1468
1155
|
}
|
|
1469
1156
|
}
|
|
1470
|
-
class
|
|
1157
|
+
class Ce {
|
|
1471
1158
|
/** Creates a [Availability]. */
|
|
1472
1159
|
constructor(e) {
|
|
1473
1160
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1477,10 +1164,10 @@ class Pe {
|
|
|
1477
1164
|
*/
|
|
1478
1165
|
static deserialize(e) {
|
|
1479
1166
|
if (e && e.state)
|
|
1480
|
-
return new
|
|
1167
|
+
return new Ce({
|
|
1481
1168
|
state: e.state,
|
|
1482
|
-
since:
|
|
1483
|
-
until:
|
|
1169
|
+
since: Re(e.since),
|
|
1170
|
+
until: Re(e.until)
|
|
1484
1171
|
});
|
|
1485
1172
|
}
|
|
1486
1173
|
/**
|
|
@@ -1492,10 +1179,10 @@ class Pe {
|
|
|
1492
1179
|
}
|
|
1493
1180
|
}
|
|
1494
1181
|
b.prototype.getNumberOfItems = function() {
|
|
1495
|
-
return
|
|
1182
|
+
return O(this.otherProperties.numberOfItems);
|
|
1496
1183
|
};
|
|
1497
1184
|
b.prototype.getPrice = function() {
|
|
1498
|
-
return
|
|
1185
|
+
return we.deserialize(this.otherProperties.price);
|
|
1499
1186
|
};
|
|
1500
1187
|
b.prototype.getIndirectAcquisitions = function() {
|
|
1501
1188
|
const i = this.otherProperties.indirectAcquisition;
|
|
@@ -1503,13 +1190,13 @@ b.prototype.getIndirectAcquisitions = function() {
|
|
|
1503
1190
|
return i.map((e) => j.deserialize(e)).filter((e) => e !== void 0);
|
|
1504
1191
|
};
|
|
1505
1192
|
b.prototype.getHolds = function() {
|
|
1506
|
-
return
|
|
1193
|
+
return Te.deserialize(this.otherProperties.holds);
|
|
1507
1194
|
};
|
|
1508
1195
|
b.prototype.getCopies = function() {
|
|
1509
|
-
return
|
|
1196
|
+
return Se.deserialize(this.otherProperties.copies);
|
|
1510
1197
|
};
|
|
1511
1198
|
b.prototype.getAvailability = function() {
|
|
1512
|
-
return
|
|
1199
|
+
return Ce.deserialize(this.otherProperties.availability);
|
|
1513
1200
|
};
|
|
1514
1201
|
b.prototype.getAuthenticate = function() {
|
|
1515
1202
|
return H.deserialize(this.otherProperties.authenticate);
|
|
@@ -1532,31 +1219,33 @@ b.prototype.getPage = function() {
|
|
|
1532
1219
|
b.prototype.getSpread = function() {
|
|
1533
1220
|
return this.otherProperties.spread || void 0;
|
|
1534
1221
|
};
|
|
1535
|
-
|
|
1222
|
+
class ce {
|
|
1223
|
+
}
|
|
1224
|
+
function Ne(i) {
|
|
1536
1225
|
return i.split("").reverse().join("");
|
|
1537
1226
|
}
|
|
1538
|
-
function
|
|
1539
|
-
const r =
|
|
1227
|
+
function It(i, e, t) {
|
|
1228
|
+
const r = Ne(e);
|
|
1540
1229
|
return t.map((s) => {
|
|
1541
|
-
const n = Math.max(0, s.end - e.length - s.errors), o =
|
|
1230
|
+
const n = Math.max(0, s.end - e.length - s.errors), o = Ne(i.slice(n, s.end));
|
|
1542
1231
|
return {
|
|
1543
|
-
start:
|
|
1232
|
+
start: et(o, r, s.errors).reduce((h, c) => s.end - c.end < h ? s.end - c.end : h, s.end),
|
|
1544
1233
|
end: s.end,
|
|
1545
1234
|
errors: s.errors
|
|
1546
1235
|
};
|
|
1547
1236
|
});
|
|
1548
1237
|
}
|
|
1549
|
-
function
|
|
1238
|
+
function ue(i) {
|
|
1550
1239
|
return (i | -i) >> 31 & 1;
|
|
1551
1240
|
}
|
|
1552
|
-
function
|
|
1241
|
+
function Le(i, e, t, r) {
|
|
1553
1242
|
let s = i.P[t], n = i.M[t];
|
|
1554
1243
|
const o = r >>> 31, a = e[t] | o, h = a | n, c = (a & s) + s ^ s | a;
|
|
1555
|
-
let
|
|
1556
|
-
const
|
|
1557
|
-
return
|
|
1244
|
+
let u = n | ~(c | s), p = s & c;
|
|
1245
|
+
const d = ue(u & i.lastRowMask[t]) - ue(p & i.lastRowMask[t]);
|
|
1246
|
+
return u <<= 1, p <<= 1, p |= o, u |= ue(r) - o, s = p | ~(h | u), n = u & h, i.P[t] = s, i.M[t] = n, d;
|
|
1558
1247
|
}
|
|
1559
|
-
function
|
|
1248
|
+
function et(i, e, t) {
|
|
1560
1249
|
if (e.length === 0)
|
|
1561
1250
|
return [];
|
|
1562
1251
|
t = Math.min(t, e.length);
|
|
@@ -1567,10 +1256,10 @@ function ct(i, e, t) {
|
|
|
1567
1256
|
};
|
|
1568
1257
|
o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % s;
|
|
1569
1258
|
const a = new Uint32Array(n + 1), h = /* @__PURE__ */ new Map(), c = [];
|
|
1570
|
-
for (let
|
|
1259
|
+
for (let d = 0; d < 256; d++)
|
|
1571
1260
|
c.push(a);
|
|
1572
|
-
for (let
|
|
1573
|
-
const f = e.charCodeAt(
|
|
1261
|
+
for (let d = 0; d < e.length; d += 1) {
|
|
1262
|
+
const f = e.charCodeAt(d);
|
|
1574
1263
|
if (h.has(f))
|
|
1575
1264
|
continue;
|
|
1576
1265
|
const v = new Uint32Array(n + 1);
|
|
@@ -1585,45 +1274,45 @@ function ct(i, e, t) {
|
|
|
1585
1274
|
}
|
|
1586
1275
|
}
|
|
1587
1276
|
}
|
|
1588
|
-
let
|
|
1277
|
+
let u = Math.max(0, Math.ceil(t / s) - 1);
|
|
1589
1278
|
const p = new Uint32Array(n + 1);
|
|
1590
|
-
for (let
|
|
1591
|
-
p[
|
|
1279
|
+
for (let d = 0; d <= u; d += 1)
|
|
1280
|
+
p[d] = (d + 1) * s;
|
|
1592
1281
|
p[n] = e.length;
|
|
1593
|
-
for (let
|
|
1594
|
-
o.P[
|
|
1595
|
-
for (let
|
|
1596
|
-
const f = i.charCodeAt(
|
|
1282
|
+
for (let d = 0; d <= u; d += 1)
|
|
1283
|
+
o.P[d] = -1, o.M[d] = 0;
|
|
1284
|
+
for (let d = 0; d < i.length; d += 1) {
|
|
1285
|
+
const f = i.charCodeAt(d);
|
|
1597
1286
|
let v;
|
|
1598
1287
|
f < c.length ? v = c[f] : (v = h.get(f), typeof v > "u" && (v = a));
|
|
1599
1288
|
let g = 0;
|
|
1600
|
-
for (let y = 0; y <=
|
|
1601
|
-
g =
|
|
1602
|
-
if (p[
|
|
1603
|
-
|
|
1289
|
+
for (let y = 0; y <= u; y += 1)
|
|
1290
|
+
g = Le(o, v, y, g), p[y] += g;
|
|
1291
|
+
if (p[u] - g <= t && u < n && (v[u + 1] & 1 || g < 0)) {
|
|
1292
|
+
u += 1, o.P[u] = -1, o.M[u] = 0;
|
|
1604
1293
|
let y;
|
|
1605
|
-
if (
|
|
1294
|
+
if (u === n) {
|
|
1606
1295
|
const x = e.length % s;
|
|
1607
1296
|
y = x === 0 ? s : x;
|
|
1608
1297
|
} else
|
|
1609
1298
|
y = s;
|
|
1610
|
-
p[
|
|
1299
|
+
p[u] = p[u - 1] + y - g + Le(o, v, u, g);
|
|
1611
1300
|
} else
|
|
1612
|
-
for (;
|
|
1613
|
-
|
|
1614
|
-
|
|
1301
|
+
for (; u > 0 && p[u] >= t + s; )
|
|
1302
|
+
u -= 1;
|
|
1303
|
+
u === n && p[u] <= t && (p[u] < t && r.splice(0, r.length), r.push({
|
|
1615
1304
|
start: -1,
|
|
1616
|
-
end:
|
|
1617
|
-
errors: p[
|
|
1618
|
-
}), t = p[
|
|
1305
|
+
end: d + 1,
|
|
1306
|
+
errors: p[u]
|
|
1307
|
+
}), t = p[u]);
|
|
1619
1308
|
}
|
|
1620
1309
|
return r;
|
|
1621
1310
|
}
|
|
1622
|
-
function
|
|
1623
|
-
const r =
|
|
1624
|
-
return
|
|
1311
|
+
function Dt(i, e, t) {
|
|
1312
|
+
const r = et(i, e, t);
|
|
1313
|
+
return It(i, e, r);
|
|
1625
1314
|
}
|
|
1626
|
-
function
|
|
1315
|
+
function tt(i, e, t) {
|
|
1627
1316
|
let r = 0;
|
|
1628
1317
|
const s = [];
|
|
1629
1318
|
for (; r !== -1; )
|
|
@@ -1632,31 +1321,31 @@ function dt(i, e, t) {
|
|
|
1632
1321
|
end: r + e.length,
|
|
1633
1322
|
errors: 0
|
|
1634
1323
|
}), r += 1);
|
|
1635
|
-
return s.length > 0 ? s :
|
|
1324
|
+
return s.length > 0 ? s : Dt(i, e, t);
|
|
1636
1325
|
}
|
|
1637
|
-
function
|
|
1638
|
-
return e.length === 0 || i.length === 0 ? 0 : 1 -
|
|
1326
|
+
function ze(i, e) {
|
|
1327
|
+
return e.length === 0 || i.length === 0 ? 0 : 1 - tt(i, e, e.length)[0].errors / e.length;
|
|
1639
1328
|
}
|
|
1640
|
-
function
|
|
1329
|
+
function Bt(i, e, t = {}) {
|
|
1641
1330
|
if (e.length === 0)
|
|
1642
1331
|
return null;
|
|
1643
|
-
const r = Math.min(256, e.length / 2), s =
|
|
1332
|
+
const r = Math.min(256, e.length / 2), s = tt(i, e, r);
|
|
1644
1333
|
if (s.length === 0)
|
|
1645
1334
|
return null;
|
|
1646
1335
|
const n = (a) => {
|
|
1647
|
-
const
|
|
1336
|
+
const d = 1 - a.errors / e.length, f = t.prefix ? ze(
|
|
1648
1337
|
i.slice(
|
|
1649
1338
|
Math.max(0, a.start - t.prefix.length),
|
|
1650
1339
|
a.start
|
|
1651
1340
|
),
|
|
1652
1341
|
t.prefix
|
|
1653
|
-
) : 1, v = t.suffix ?
|
|
1342
|
+
) : 1, v = t.suffix ? ze(
|
|
1654
1343
|
i.slice(a.end, a.end + t.suffix.length),
|
|
1655
1344
|
t.suffix
|
|
1656
1345
|
) : 1;
|
|
1657
1346
|
let g = 1;
|
|
1658
1347
|
typeof t.hint == "number" && (g = 1 - Math.abs(a.start - t.hint) / i.length);
|
|
1659
|
-
const y = 50 *
|
|
1348
|
+
const y = 50 * d + 20 * f + 20 * v + 2 * g, x = 50 + 20 + 20 + 2;
|
|
1660
1349
|
return y / x;
|
|
1661
1350
|
}, o = s.map((a) => ({
|
|
1662
1351
|
start: a.start,
|
|
@@ -1665,7 +1354,7 @@ function si(i, e, t = {}) {
|
|
|
1665
1354
|
}));
|
|
1666
1355
|
return o.sort((a, h) => h.score - a.score), o[0];
|
|
1667
1356
|
}
|
|
1668
|
-
function
|
|
1357
|
+
function fe(i, e, t) {
|
|
1669
1358
|
const r = t === 1 ? e : e - 1;
|
|
1670
1359
|
if (i.charAt(r).trim() !== "")
|
|
1671
1360
|
return e;
|
|
@@ -1675,7 +1364,7 @@ function ge(i, e, t) {
|
|
|
1675
1364
|
const o = s.length - n.length;
|
|
1676
1365
|
return t === 2 ? e - o : e + o;
|
|
1677
1366
|
}
|
|
1678
|
-
function
|
|
1367
|
+
function Ie(i, e) {
|
|
1679
1368
|
const t = i.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1680
1369
|
i.commonAncestorContainer,
|
|
1681
1370
|
NodeFilter.SHOW_TEXT
|
|
@@ -1688,7 +1377,7 @@ function Xe(i, e) {
|
|
|
1688
1377
|
const a = () => {
|
|
1689
1378
|
if (n = e === 1 ? t.nextNode() : t.previousNode(), n) {
|
|
1690
1379
|
const h = n.textContent, c = e === 1 ? 0 : h.length;
|
|
1691
|
-
o =
|
|
1380
|
+
o = fe(h, c, e);
|
|
1692
1381
|
}
|
|
1693
1382
|
};
|
|
1694
1383
|
for (; n && o === -1 && n !== s; )
|
|
@@ -1697,7 +1386,7 @@ function Xe(i, e) {
|
|
|
1697
1386
|
return { node: n, offset: o };
|
|
1698
1387
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1699
1388
|
}
|
|
1700
|
-
function
|
|
1389
|
+
function Wt(i) {
|
|
1701
1390
|
if (!i.toString().trim().length)
|
|
1702
1391
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1703
1392
|
if (i.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1707,13 +1396,13 @@ function ni(i) {
|
|
|
1707
1396
|
const e = i.cloneRange();
|
|
1708
1397
|
let t = !1, r = !1;
|
|
1709
1398
|
const s = {
|
|
1710
|
-
start:
|
|
1399
|
+
start: fe(
|
|
1711
1400
|
i.startContainer.textContent,
|
|
1712
1401
|
i.startOffset,
|
|
1713
1402
|
1
|
|
1714
1403
|
/* Forwards */
|
|
1715
1404
|
),
|
|
1716
|
-
end:
|
|
1405
|
+
end: fe(
|
|
1717
1406
|
i.endContainer.textContent,
|
|
1718
1407
|
i.endOffset,
|
|
1719
1408
|
2
|
|
@@ -1723,7 +1412,7 @@ function ni(i) {
|
|
|
1723
1412
|
if (s.start >= 0 && (e.setStart(i.startContainer, s.start), t = !0), s.end > 0 && (e.setEnd(i.endContainer, s.end), r = !0), t && r)
|
|
1724
1413
|
return e;
|
|
1725
1414
|
if (!t) {
|
|
1726
|
-
const { node: n, offset: o } =
|
|
1415
|
+
const { node: n, offset: o } = Ie(
|
|
1727
1416
|
e,
|
|
1728
1417
|
1
|
|
1729
1418
|
/* Forwards */
|
|
@@ -1731,7 +1420,7 @@ function ni(i) {
|
|
|
1731
1420
|
n && o >= 0 && e.setStart(n, o);
|
|
1732
1421
|
}
|
|
1733
1422
|
if (!r) {
|
|
1734
|
-
const { node: n, offset: o } =
|
|
1423
|
+
const { node: n, offset: o } = Ie(
|
|
1735
1424
|
e,
|
|
1736
1425
|
2
|
|
1737
1426
|
/* Backwards */
|
|
@@ -1740,7 +1429,7 @@ function ni(i) {
|
|
|
1740
1429
|
}
|
|
1741
1430
|
return e;
|
|
1742
1431
|
}
|
|
1743
|
-
function
|
|
1432
|
+
function it(i) {
|
|
1744
1433
|
var e;
|
|
1745
1434
|
switch (i.nodeType) {
|
|
1746
1435
|
case Node.ELEMENT_NODE:
|
|
@@ -1750,13 +1439,13 @@ function ut(i) {
|
|
|
1750
1439
|
return 0;
|
|
1751
1440
|
}
|
|
1752
1441
|
}
|
|
1753
|
-
function
|
|
1442
|
+
function De(i) {
|
|
1754
1443
|
let e = i.previousSibling, t = 0;
|
|
1755
1444
|
for (; e; )
|
|
1756
|
-
t +=
|
|
1445
|
+
t += it(e), e = e.previousSibling;
|
|
1757
1446
|
return t;
|
|
1758
1447
|
}
|
|
1759
|
-
function
|
|
1448
|
+
function rt(i, ...e) {
|
|
1760
1449
|
let t = e.shift();
|
|
1761
1450
|
const r = i.ownerDocument.createNodeIterator(
|
|
1762
1451
|
i,
|
|
@@ -1771,7 +1460,7 @@ function pt(i, ...e) {
|
|
|
1771
1460
|
throw new RangeError("Offset exceeds text length");
|
|
1772
1461
|
return s;
|
|
1773
1462
|
}
|
|
1774
|
-
class
|
|
1463
|
+
class N {
|
|
1775
1464
|
constructor(e, t) {
|
|
1776
1465
|
if (t < 0)
|
|
1777
1466
|
throw new Error("Offset is invalid");
|
|
@@ -1788,8 +1477,8 @@ class R {
|
|
|
1788
1477
|
throw new Error("Parent is not an ancestor of current element");
|
|
1789
1478
|
let t = this.element, r = this.offset;
|
|
1790
1479
|
for (; t !== e; )
|
|
1791
|
-
r +=
|
|
1792
|
-
return new
|
|
1480
|
+
r += De(t), t = t.parentElement;
|
|
1481
|
+
return new N(t, r);
|
|
1793
1482
|
}
|
|
1794
1483
|
/**
|
|
1795
1484
|
* Resolve the position to a specific text node and offset within that node.
|
|
@@ -1810,7 +1499,7 @@ class R {
|
|
|
1810
1499
|
*/
|
|
1811
1500
|
resolve(e = {}) {
|
|
1812
1501
|
try {
|
|
1813
|
-
return
|
|
1502
|
+
return rt(this.element, this.offset)[0];
|
|
1814
1503
|
} catch (t) {
|
|
1815
1504
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
1816
1505
|
const r = document.createTreeWalker(
|
|
@@ -1833,9 +1522,9 @@ class R {
|
|
|
1833
1522
|
static fromCharOffset(e, t) {
|
|
1834
1523
|
switch (e.nodeType) {
|
|
1835
1524
|
case Node.TEXT_NODE:
|
|
1836
|
-
return
|
|
1525
|
+
return N.fromPoint(e, t);
|
|
1837
1526
|
case Node.ELEMENT_NODE:
|
|
1838
|
-
return new
|
|
1527
|
+
return new N(e, t);
|
|
1839
1528
|
default:
|
|
1840
1529
|
throw new Error("Node is not an element or text node");
|
|
1841
1530
|
}
|
|
@@ -1853,16 +1542,16 @@ class R {
|
|
|
1853
1542
|
throw new Error("Text node offset is out of range");
|
|
1854
1543
|
if (!e.parentElement)
|
|
1855
1544
|
throw new Error("Text node has no parent");
|
|
1856
|
-
const r =
|
|
1857
|
-
return new
|
|
1545
|
+
const r = De(e) + t;
|
|
1546
|
+
return new N(e.parentElement, r);
|
|
1858
1547
|
}
|
|
1859
1548
|
case Node.ELEMENT_NODE: {
|
|
1860
1549
|
if (t < 0 || t > e.childNodes.length)
|
|
1861
1550
|
throw new Error("Child node offset is out of range");
|
|
1862
1551
|
let r = 0;
|
|
1863
1552
|
for (let s = 0; s < t; s++)
|
|
1864
|
-
r +=
|
|
1865
|
-
return new
|
|
1553
|
+
r += it(e.childNodes[s]);
|
|
1554
|
+
return new N(e, r);
|
|
1866
1555
|
}
|
|
1867
1556
|
default:
|
|
1868
1557
|
throw new Error("Point is not in an element or text node");
|
|
@@ -1895,7 +1584,7 @@ class z {
|
|
|
1895
1584
|
*/
|
|
1896
1585
|
toRange() {
|
|
1897
1586
|
let e, t;
|
|
1898
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
1587
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = rt(
|
|
1899
1588
|
this.start.element,
|
|
1900
1589
|
this.start.offset,
|
|
1901
1590
|
this.end.offset
|
|
@@ -1913,10 +1602,10 @@ class z {
|
|
|
1913
1602
|
* Create a TextRange from a (DOM) Range
|
|
1914
1603
|
*/
|
|
1915
1604
|
static fromRange(e) {
|
|
1916
|
-
const t =
|
|
1605
|
+
const t = N.fromPoint(
|
|
1917
1606
|
e.startContainer,
|
|
1918
1607
|
e.startOffset
|
|
1919
|
-
), r =
|
|
1608
|
+
), r = N.fromPoint(e.endContainer, e.endOffset);
|
|
1920
1609
|
return new z(t, r);
|
|
1921
1610
|
}
|
|
1922
1611
|
/**
|
|
@@ -1925,8 +1614,8 @@ class z {
|
|
|
1925
1614
|
*/
|
|
1926
1615
|
static fromOffsets(e, t, r) {
|
|
1927
1616
|
return new z(
|
|
1928
|
-
new
|
|
1929
|
-
new
|
|
1617
|
+
new N(e, t),
|
|
1618
|
+
new N(e, r)
|
|
1930
1619
|
);
|
|
1931
1620
|
}
|
|
1932
1621
|
/**
|
|
@@ -1934,7 +1623,7 @@ class z {
|
|
|
1934
1623
|
* whitespace
|
|
1935
1624
|
*/
|
|
1936
1625
|
static trimmedRange(e) {
|
|
1937
|
-
return
|
|
1626
|
+
return Wt(z.fromRange(e).toRange());
|
|
1938
1627
|
}
|
|
1939
1628
|
}
|
|
1940
1629
|
class ae {
|
|
@@ -1998,7 +1687,7 @@ class le {
|
|
|
1998
1687
|
return this.toPositionAnchor(e).toRange();
|
|
1999
1688
|
}
|
|
2000
1689
|
toPositionAnchor(e = {}) {
|
|
2001
|
-
const t = this.root.textContent, r =
|
|
1690
|
+
const t = this.root.textContent, r = Bt(t, this.exact, {
|
|
2002
1691
|
...this.context,
|
|
2003
1692
|
hint: e.hint
|
|
2004
1693
|
});
|
|
@@ -2007,1087 +1696,1458 @@ class le {
|
|
|
2007
1696
|
return new ae(this.root, r.start, r.end);
|
|
2008
1697
|
}
|
|
2009
1698
|
}
|
|
1699
|
+
function Ft(i) {
|
|
1700
|
+
const e = i.tagName.toUpperCase();
|
|
1701
|
+
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
1702
|
+
}
|
|
2010
1703
|
function Oe(i, e) {
|
|
2011
1704
|
try {
|
|
2012
|
-
|
|
2013
|
-
if (
|
|
2014
|
-
let
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
prefix:
|
|
2018
|
-
suffix:
|
|
1705
|
+
const t = e.locations, r = e.text;
|
|
1706
|
+
if (r && r.highlight) {
|
|
1707
|
+
let s;
|
|
1708
|
+
t && t.getCssSelector() && (s = i.querySelector(t.getCssSelector())), s || (s = i.body);
|
|
1709
|
+
const n = new le(s, r.highlight, {
|
|
1710
|
+
prefix: r.before,
|
|
1711
|
+
suffix: r.after
|
|
2019
1712
|
});
|
|
2020
1713
|
try {
|
|
2021
|
-
return
|
|
1714
|
+
return n.toRange();
|
|
2022
1715
|
} catch {
|
|
2023
|
-
return console.warn("Quote not found:",
|
|
1716
|
+
return console.warn("Quote not found:", n), null;
|
|
2024
1717
|
}
|
|
2025
1718
|
}
|
|
2026
|
-
if (
|
|
2027
|
-
|
|
2028
|
-
if (!
|
|
2029
|
-
for (const n of
|
|
2030
|
-
if (
|
|
1719
|
+
if (t) {
|
|
1720
|
+
let s = null;
|
|
1721
|
+
if (!s && t.getCssSelector() && (s = i.querySelector(t.getCssSelector())), !s && t.fragments) {
|
|
1722
|
+
for (const n of t.fragments)
|
|
1723
|
+
if (s = i.getElementById(n), s)
|
|
2031
1724
|
break;
|
|
2032
1725
|
}
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2035
|
-
return
|
|
1726
|
+
if (s) {
|
|
1727
|
+
const n = i.createRange();
|
|
1728
|
+
return s.childNodes.length === 0 || Ft(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
2036
1729
|
}
|
|
2037
1730
|
}
|
|
2038
|
-
} catch (
|
|
2039
|
-
console.error(
|
|
1731
|
+
} catch (t) {
|
|
1732
|
+
console.error(t);
|
|
2040
1733
|
}
|
|
2041
1734
|
return null;
|
|
2042
1735
|
}
|
|
2043
|
-
function
|
|
2044
|
-
|
|
2045
|
-
|
|
1736
|
+
function kt(i, e) {
|
|
1737
|
+
let t = i.getClientRects();
|
|
1738
|
+
t.length || i.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = i.commonAncestorContainer.getClientRects());
|
|
1739
|
+
const r = 1, s = [];
|
|
1740
|
+
for (const c of t)
|
|
1741
|
+
s.push({
|
|
1742
|
+
bottom: c.bottom,
|
|
1743
|
+
height: c.height,
|
|
1744
|
+
left: c.left,
|
|
1745
|
+
right: c.right,
|
|
1746
|
+
top: c.top,
|
|
1747
|
+
width: c.width
|
|
1748
|
+
});
|
|
1749
|
+
const n = st(
|
|
1750
|
+
s,
|
|
1751
|
+
r,
|
|
1752
|
+
e
|
|
1753
|
+
), o = Ht(n, r), a = nt(o), h = 2 * 2;
|
|
1754
|
+
for (let c = a.length - 1; c >= 0; c--) {
|
|
1755
|
+
const u = a[c];
|
|
1756
|
+
if (!(u.width * u.height > h))
|
|
1757
|
+
if (a.length > 1)
|
|
1758
|
+
a.splice(c, 1);
|
|
1759
|
+
else
|
|
1760
|
+
break;
|
|
1761
|
+
}
|
|
1762
|
+
return a;
|
|
2046
1763
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
return
|
|
1764
|
+
function st(i, e, t) {
|
|
1765
|
+
for (let r = 0; r < i.length; r++)
|
|
1766
|
+
for (let s = r + 1; s < i.length; s++) {
|
|
1767
|
+
const n = i[r], o = i[s];
|
|
1768
|
+
if (n === o)
|
|
1769
|
+
continue;
|
|
1770
|
+
const a = A(n.top, o.top, e) && A(n.bottom, o.bottom, e), h = A(n.left, o.left, e) && A(n.right, o.right, e);
|
|
1771
|
+
if ((h && !t || a && !h) && ot(n, o, e)) {
|
|
1772
|
+
const d = i.filter((v) => v !== n && v !== o), f = Ut(n, o);
|
|
1773
|
+
return d.push(f), st(
|
|
1774
|
+
d,
|
|
1775
|
+
e,
|
|
1776
|
+
t
|
|
1777
|
+
);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
return i;
|
|
2064
1781
|
}
|
|
2065
|
-
function
|
|
2066
|
-
const t =
|
|
2067
|
-
return
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
text: new q({
|
|
2076
|
-
highlight: t.textContent || void 0
|
|
2077
|
-
})
|
|
2078
|
-
});
|
|
1782
|
+
function Ut(i, e) {
|
|
1783
|
+
const t = Math.min(i.left, e.left), r = Math.max(i.right, e.right), s = Math.min(i.top, e.top), n = Math.max(i.bottom, e.bottom);
|
|
1784
|
+
return {
|
|
1785
|
+
bottom: n,
|
|
1786
|
+
height: n - s,
|
|
1787
|
+
left: t,
|
|
1788
|
+
right: r,
|
|
1789
|
+
top: s,
|
|
1790
|
+
width: r - t
|
|
1791
|
+
};
|
|
2079
1792
|
}
|
|
2080
|
-
function
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
if (!
|
|
2084
|
-
|
|
1793
|
+
function Ht(i, e) {
|
|
1794
|
+
const t = new Set(i);
|
|
1795
|
+
for (const r of i) {
|
|
1796
|
+
if (!(r.width > 1 && r.height > 1)) {
|
|
1797
|
+
t.delete(r);
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
for (const n of i)
|
|
1801
|
+
if (r !== n && t.has(n) && $t(n, r, e)) {
|
|
1802
|
+
t.delete(r);
|
|
1803
|
+
break;
|
|
1804
|
+
}
|
|
2085
1805
|
}
|
|
2086
|
-
return
|
|
1806
|
+
return Array.from(t);
|
|
2087
1807
|
}
|
|
2088
|
-
function
|
|
2089
|
-
|
|
2090
|
-
return !0;
|
|
2091
|
-
if (!document || !document.documentElement || !document.body)
|
|
2092
|
-
return !1;
|
|
2093
|
-
const r = e.getBoundingClientRect();
|
|
2094
|
-
return t ? r.bottom > 0 && r.top < i.innerHeight : r.right > 0 && r.left < i.innerWidth;
|
|
1808
|
+
function $t(i, e, t) {
|
|
1809
|
+
return Q(i, e.left, e.top, t) && Q(i, e.right, e.top, t) && Q(i, e.left, e.bottom, t) && Q(i, e.right, e.bottom, t);
|
|
2095
1810
|
}
|
|
2096
|
-
function
|
|
2097
|
-
|
|
2098
|
-
return !!(e && (e.getPropertyValue("display") != "block" || e.getPropertyValue("opacity") === "0"));
|
|
1811
|
+
function Q(i, e, t, r) {
|
|
1812
|
+
return (i.left < e || A(i.left, e, r)) && (i.right > e || A(i.right, e, r)) && (i.top < t || A(i.top, t, r)) && (i.bottom > t || A(i.bottom, t, r));
|
|
2099
1813
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
1814
|
+
function nt(i) {
|
|
1815
|
+
for (let e = 0; e < i.length; e++)
|
|
1816
|
+
for (let t = e + 1; t < i.length; t++) {
|
|
1817
|
+
const r = i[e], s = i[t];
|
|
1818
|
+
if (r !== s && ot(r, s, -1)) {
|
|
1819
|
+
let n = [], o;
|
|
1820
|
+
const a = Be(r, s);
|
|
1821
|
+
if (a.length === 1)
|
|
1822
|
+
n = a, o = r;
|
|
1823
|
+
else {
|
|
1824
|
+
const c = Be(s, r);
|
|
1825
|
+
a.length < c.length ? (n = a, o = r) : (n = c, o = s);
|
|
1826
|
+
}
|
|
1827
|
+
const h = i.filter((c) => c !== o);
|
|
1828
|
+
return Array.prototype.push.apply(h, n), nt(h);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return i;
|
|
1832
|
+
}
|
|
1833
|
+
function Be(i, e) {
|
|
1834
|
+
const t = qt(e, i);
|
|
1835
|
+
if (t.height === 0 || t.width === 0)
|
|
1836
|
+
return [i];
|
|
1837
|
+
const r = [];
|
|
1838
|
+
{
|
|
1839
|
+
const s = {
|
|
1840
|
+
bottom: i.bottom,
|
|
1841
|
+
height: 0,
|
|
1842
|
+
left: i.left,
|
|
1843
|
+
right: t.left,
|
|
1844
|
+
top: i.top,
|
|
1845
|
+
width: 0
|
|
1846
|
+
};
|
|
1847
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2113
1848
|
}
|
|
2114
|
-
|
|
2115
|
-
|
|
1849
|
+
{
|
|
1850
|
+
const s = {
|
|
1851
|
+
bottom: t.top,
|
|
1852
|
+
height: 0,
|
|
1853
|
+
left: t.left,
|
|
1854
|
+
right: t.right,
|
|
1855
|
+
top: i.top,
|
|
1856
|
+
width: 0
|
|
1857
|
+
};
|
|
1858
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2116
1859
|
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
}
|
|
1860
|
+
{
|
|
1861
|
+
const s = {
|
|
1862
|
+
bottom: i.bottom,
|
|
1863
|
+
height: 0,
|
|
1864
|
+
left: t.left,
|
|
1865
|
+
right: t.right,
|
|
1866
|
+
top: t.bottom,
|
|
1867
|
+
width: 0
|
|
1868
|
+
};
|
|
1869
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2126
1870
|
}
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
1871
|
+
{
|
|
1872
|
+
const s = {
|
|
1873
|
+
bottom: i.bottom,
|
|
1874
|
+
height: 0,
|
|
1875
|
+
left: t.right,
|
|
1876
|
+
right: i.right,
|
|
1877
|
+
top: i.top,
|
|
1878
|
+
width: 0
|
|
1879
|
+
};
|
|
1880
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2133
1881
|
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
1882
|
+
return r;
|
|
1883
|
+
}
|
|
1884
|
+
function qt(i, e) {
|
|
1885
|
+
const t = Math.max(i.left, e.left), r = Math.min(i.right, e.right), s = Math.max(i.top, e.top), n = Math.min(i.bottom, e.bottom);
|
|
1886
|
+
return {
|
|
1887
|
+
bottom: n,
|
|
1888
|
+
height: Math.max(0, n - s),
|
|
1889
|
+
left: t,
|
|
1890
|
+
right: r,
|
|
1891
|
+
top: s,
|
|
1892
|
+
width: Math.max(0, r - t)
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
function ot(i, e, t) {
|
|
1896
|
+
return (i.left < e.right || t >= 0 && A(i.left, e.right, t)) && (e.left < i.right || t >= 0 && A(e.left, i.right, t)) && (i.top < e.bottom || t >= 0 && A(i.top, e.bottom, t)) && (e.top < i.bottom || t >= 0 && A(e.top, i.bottom, t));
|
|
1897
|
+
}
|
|
1898
|
+
function A(i, e, t) {
|
|
1899
|
+
return Math.abs(i - e) <= t;
|
|
1900
|
+
}
|
|
1901
|
+
var F = [], _t = function() {
|
|
1902
|
+
return F.some(function(i) {
|
|
1903
|
+
return i.activeTargets.length > 0;
|
|
1904
|
+
});
|
|
1905
|
+
}, Vt = function() {
|
|
1906
|
+
return F.some(function(i) {
|
|
1907
|
+
return i.skippedTargets.length > 0;
|
|
1908
|
+
});
|
|
1909
|
+
}, We = "ResizeObserver loop completed with undelivered notifications.", jt = function() {
|
|
1910
|
+
var i;
|
|
1911
|
+
typeof ErrorEvent == "function" ? i = new ErrorEvent("error", {
|
|
1912
|
+
message: We
|
|
1913
|
+
}) : (i = document.createEvent("Event"), i.initEvent("error", !1, !1), i.message = We), window.dispatchEvent(i);
|
|
1914
|
+
}, G;
|
|
1915
|
+
(function(i) {
|
|
1916
|
+
i.BORDER_BOX = "border-box", i.CONTENT_BOX = "content-box", i.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
1917
|
+
})(G || (G = {}));
|
|
1918
|
+
var k = function(i) {
|
|
1919
|
+
return Object.freeze(i);
|
|
1920
|
+
}, Xt = function() {
|
|
1921
|
+
function i(e, t) {
|
|
1922
|
+
this.inlineSize = e, this.blockSize = t, k(this);
|
|
2159
1923
|
}
|
|
2160
|
-
|
|
2161
|
-
|
|
1924
|
+
return i;
|
|
1925
|
+
}(), at = function() {
|
|
1926
|
+
function i(e, t, r, s) {
|
|
1927
|
+
return this.x = e, this.y = t, this.width = r, this.height = s, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, k(this);
|
|
2162
1928
|
}
|
|
2163
|
-
|
|
2164
|
-
this.
|
|
1929
|
+
return i.prototype.toJSON = function() {
|
|
1930
|
+
var e = this, t = e.x, r = e.y, s = e.top, n = e.right, o = e.bottom, a = e.left, h = e.width, c = e.height;
|
|
1931
|
+
return { x: t, y: r, top: s, right: n, bottom: o, left: a, width: h, height: c };
|
|
1932
|
+
}, i.fromRect = function(e) {
|
|
1933
|
+
return new i(e.x, e.y, e.width, e.height);
|
|
1934
|
+
}, i;
|
|
1935
|
+
}(), Pe = function(i) {
|
|
1936
|
+
return i instanceof SVGElement && "getBBox" in i;
|
|
1937
|
+
}, lt = function(i) {
|
|
1938
|
+
if (Pe(i)) {
|
|
1939
|
+
var e = i.getBBox(), t = e.width, r = e.height;
|
|
1940
|
+
return !t && !r;
|
|
2165
1941
|
}
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
1942
|
+
var s = i, n = s.offsetWidth, o = s.offsetHeight;
|
|
1943
|
+
return !(n || o || i.getClientRects().length);
|
|
1944
|
+
}, Fe = function(i) {
|
|
1945
|
+
var e;
|
|
1946
|
+
if (i instanceof Element)
|
|
1947
|
+
return !0;
|
|
1948
|
+
var t = (e = i == null ? void 0 : i.ownerDocument) === null || e === void 0 ? void 0 : e.defaultView;
|
|
1949
|
+
return !!(t && i instanceof t.Element);
|
|
1950
|
+
}, Gt = function(i) {
|
|
1951
|
+
switch (i.tagName) {
|
|
1952
|
+
case "INPUT":
|
|
1953
|
+
if (i.type !== "image")
|
|
2169
1954
|
break;
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
1955
|
+
case "VIDEO":
|
|
1956
|
+
case "AUDIO":
|
|
1957
|
+
case "EMBED":
|
|
1958
|
+
case "OBJECT":
|
|
1959
|
+
case "CANVAS":
|
|
1960
|
+
case "IFRAME":
|
|
1961
|
+
case "IMG":
|
|
1962
|
+
return !0;
|
|
1963
|
+
}
|
|
1964
|
+
return !1;
|
|
1965
|
+
}, X = typeof window < "u" ? window : {}, ee = /* @__PURE__ */ new WeakMap(), ke = /auto|scroll/, Yt = /^tb|vertical/, Zt = /msie|trident/i.test(X.navigator && X.navigator.userAgent), R = function(i) {
|
|
1966
|
+
return parseFloat(i || "0");
|
|
1967
|
+
}, $ = function(i, e, t) {
|
|
1968
|
+
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new Xt((t ? e : i) || 0, (t ? i : e) || 0);
|
|
1969
|
+
}, Ue = k({
|
|
1970
|
+
devicePixelContentBoxSize: $(),
|
|
1971
|
+
borderBoxSize: $(),
|
|
1972
|
+
contentBoxSize: $(),
|
|
1973
|
+
contentRect: new at(0, 0, 0, 0)
|
|
1974
|
+
}), ht = function(i, e) {
|
|
1975
|
+
if (e === void 0 && (e = !1), ee.has(i) && !e)
|
|
1976
|
+
return ee.get(i);
|
|
1977
|
+
if (lt(i))
|
|
1978
|
+
return ee.set(i, Ue), Ue;
|
|
1979
|
+
var t = getComputedStyle(i), r = Pe(i) && i.ownerSVGElement && i.getBBox(), s = !Zt && t.boxSizing === "border-box", n = Yt.test(t.writingMode || ""), o = !r && ke.test(t.overflowY || ""), a = !r && ke.test(t.overflowX || ""), h = r ? 0 : R(t.paddingTop), c = r ? 0 : R(t.paddingRight), u = r ? 0 : R(t.paddingBottom), p = r ? 0 : R(t.paddingLeft), d = r ? 0 : R(t.borderTopWidth), f = r ? 0 : R(t.borderRightWidth), v = r ? 0 : R(t.borderBottomWidth), g = r ? 0 : R(t.borderLeftWidth), y = p + c, x = h + u, S = g + f, m = d + v, E = a ? i.offsetHeight - m - i.clientHeight : 0, P = o ? i.offsetWidth - S - i.clientWidth : 0, Y = s ? y + S : 0, Z = s ? x + m : 0, D = r ? r.width : R(t.width) - Y - P, B = r ? r.height : R(t.height) - Z - E, J = D + y + P + S, K = B + x + E + m, U = k({
|
|
1980
|
+
devicePixelContentBoxSize: $(Math.round(D * devicePixelRatio), Math.round(B * devicePixelRatio), n),
|
|
1981
|
+
borderBoxSize: $(J, K, n),
|
|
1982
|
+
contentBoxSize: $(D, B, n),
|
|
1983
|
+
contentRect: new at(p, h, D, B)
|
|
1984
|
+
});
|
|
1985
|
+
return ee.set(i, U), U;
|
|
1986
|
+
}, ct = function(i, e, t) {
|
|
1987
|
+
var r = ht(i, t), s = r.borderBoxSize, n = r.contentBoxSize, o = r.devicePixelContentBoxSize;
|
|
1988
|
+
switch (e) {
|
|
1989
|
+
case G.DEVICE_PIXEL_CONTENT_BOX:
|
|
1990
|
+
return o;
|
|
1991
|
+
case G.BORDER_BOX:
|
|
1992
|
+
return s;
|
|
1993
|
+
default:
|
|
1994
|
+
return n;
|
|
1995
|
+
}
|
|
1996
|
+
}, Jt = function() {
|
|
1997
|
+
function i(e) {
|
|
1998
|
+
var t = ht(e);
|
|
1999
|
+
this.target = e, this.contentRect = t.contentRect, this.borderBoxSize = k([t.borderBoxSize]), this.contentBoxSize = k([t.contentBoxSize]), this.devicePixelContentBoxSize = k([t.devicePixelContentBoxSize]);
|
|
2000
|
+
}
|
|
2001
|
+
return i;
|
|
2002
|
+
}(), ut = function(i) {
|
|
2003
|
+
if (lt(i))
|
|
2004
|
+
return 1 / 0;
|
|
2005
|
+
for (var e = 0, t = i.parentNode; t; )
|
|
2006
|
+
e += 1, t = t.parentNode;
|
|
2007
|
+
return e;
|
|
2008
|
+
}, Kt = function() {
|
|
2009
|
+
var i = 1 / 0, e = [];
|
|
2010
|
+
F.forEach(function(o) {
|
|
2011
|
+
if (o.activeTargets.length !== 0) {
|
|
2012
|
+
var a = [];
|
|
2013
|
+
o.activeTargets.forEach(function(c) {
|
|
2014
|
+
var u = new Jt(c.target), p = ut(c.target);
|
|
2015
|
+
a.push(u), c.lastReportedSize = ct(c.target, c.observedBox), p < i && (i = p);
|
|
2016
|
+
}), e.push(function() {
|
|
2017
|
+
o.callback.call(o.observer, a, o.observer);
|
|
2018
|
+
}), o.activeTargets.splice(0, o.activeTargets.length);
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
for (var t = 0, r = e; t < r.length; t++) {
|
|
2022
|
+
var s = r[t];
|
|
2023
|
+
s();
|
|
2024
|
+
}
|
|
2025
|
+
return i;
|
|
2026
|
+
}, He = function(i) {
|
|
2027
|
+
F.forEach(function(t) {
|
|
2028
|
+
t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(s) {
|
|
2029
|
+
s.isActive() && (ut(s.target) > i ? t.activeTargets.push(s) : t.skippedTargets.push(s));
|
|
2030
|
+
});
|
|
2031
|
+
});
|
|
2032
|
+
}, Qt = function() {
|
|
2033
|
+
var i = 0;
|
|
2034
|
+
for (He(i); _t(); )
|
|
2035
|
+
i = Kt(), He(i);
|
|
2036
|
+
return Vt() && jt(), i > 0;
|
|
2037
|
+
}, de, dt = [], ei = function() {
|
|
2038
|
+
return dt.splice(0).forEach(function(i) {
|
|
2039
|
+
return i();
|
|
2040
|
+
});
|
|
2041
|
+
}, ti = function(i) {
|
|
2042
|
+
if (!de) {
|
|
2043
|
+
var e = 0, t = document.createTextNode(""), r = { characterData: !0 };
|
|
2044
|
+
new MutationObserver(function() {
|
|
2045
|
+
return ei();
|
|
2046
|
+
}).observe(t, r), de = function() {
|
|
2047
|
+
t.textContent = "".concat(e ? e-- : e++);
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
dt.push(i), de();
|
|
2051
|
+
}, ii = function(i) {
|
|
2052
|
+
ti(function() {
|
|
2053
|
+
requestAnimationFrame(i);
|
|
2054
|
+
});
|
|
2055
|
+
}, se = 0, ri = function() {
|
|
2056
|
+
return !!se;
|
|
2057
|
+
}, si = 250, ni = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, $e = [
|
|
2058
|
+
"resize",
|
|
2059
|
+
"load",
|
|
2060
|
+
"transitionend",
|
|
2061
|
+
"animationend",
|
|
2062
|
+
"animationstart",
|
|
2063
|
+
"animationiteration",
|
|
2064
|
+
"keyup",
|
|
2065
|
+
"keydown",
|
|
2066
|
+
"mouseup",
|
|
2067
|
+
"mousedown",
|
|
2068
|
+
"mouseover",
|
|
2069
|
+
"mouseout",
|
|
2070
|
+
"blur",
|
|
2071
|
+
"focus"
|
|
2072
|
+
], qe = function(i) {
|
|
2073
|
+
return i === void 0 && (i = 0), Date.now() + i;
|
|
2074
|
+
}, pe = !1, oi = function() {
|
|
2075
|
+
function i() {
|
|
2076
|
+
var e = this;
|
|
2077
|
+
this.stopped = !0, this.listener = function() {
|
|
2078
|
+
return e.schedule();
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
return i.prototype.run = function(e) {
|
|
2082
|
+
var t = this;
|
|
2083
|
+
if (e === void 0 && (e = si), !pe) {
|
|
2084
|
+
pe = !0;
|
|
2085
|
+
var r = qe(e);
|
|
2086
|
+
ii(function() {
|
|
2087
|
+
var s = !1;
|
|
2088
|
+
try {
|
|
2089
|
+
s = Qt();
|
|
2090
|
+
} finally {
|
|
2091
|
+
if (pe = !1, e = r - qe(), !ri())
|
|
2092
|
+
return;
|
|
2093
|
+
s ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
|
|
2094
|
+
}
|
|
2095
|
+
});
|
|
2096
|
+
}
|
|
2097
|
+
}, i.prototype.schedule = function() {
|
|
2098
|
+
this.stop(), this.run();
|
|
2099
|
+
}, i.prototype.observe = function() {
|
|
2100
|
+
var e = this, t = function() {
|
|
2101
|
+
return e.observer && e.observer.observe(document.body, ni);
|
|
2102
|
+
};
|
|
2103
|
+
document.body ? t() : X.addEventListener("DOMContentLoaded", t);
|
|
2104
|
+
}, i.prototype.start = function() {
|
|
2105
|
+
var e = this;
|
|
2106
|
+
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), $e.forEach(function(t) {
|
|
2107
|
+
return X.addEventListener(t, e.listener, !0);
|
|
2108
|
+
}));
|
|
2109
|
+
}, i.prototype.stop = function() {
|
|
2110
|
+
var e = this;
|
|
2111
|
+
this.stopped || (this.observer && this.observer.disconnect(), $e.forEach(function(t) {
|
|
2112
|
+
return X.removeEventListener(t, e.listener, !0);
|
|
2113
|
+
}), this.stopped = !0);
|
|
2114
|
+
}, i;
|
|
2115
|
+
}(), me = new oi(), _e = function(i) {
|
|
2116
|
+
!se && i > 0 && me.start(), se += i, !se && me.stop();
|
|
2117
|
+
}, ai = function(i) {
|
|
2118
|
+
return !Pe(i) && !Gt(i) && getComputedStyle(i).display === "inline";
|
|
2119
|
+
}, li = function() {
|
|
2120
|
+
function i(e, t) {
|
|
2121
|
+
this.target = e, this.observedBox = t || G.CONTENT_BOX, this.lastReportedSize = {
|
|
2122
|
+
inlineSize: 0,
|
|
2123
|
+
blockSize: 0
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
return i.prototype.isActive = function() {
|
|
2127
|
+
var e = ct(this.target, this.observedBox, !0);
|
|
2128
|
+
return ai(this.target) && (this.lastReportedSize = e), this.lastReportedSize.inlineSize !== e.inlineSize || this.lastReportedSize.blockSize !== e.blockSize;
|
|
2129
|
+
}, i;
|
|
2130
|
+
}(), hi = function() {
|
|
2131
|
+
function i(e, t) {
|
|
2132
|
+
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = e, this.callback = t;
|
|
2133
|
+
}
|
|
2134
|
+
return i;
|
|
2135
|
+
}(), te = /* @__PURE__ */ new WeakMap(), Ve = function(i, e) {
|
|
2136
|
+
for (var t = 0; t < i.length; t += 1)
|
|
2137
|
+
if (i[t].target === e)
|
|
2138
|
+
return t;
|
|
2139
|
+
return -1;
|
|
2140
|
+
}, ie = function() {
|
|
2141
|
+
function i() {
|
|
2142
|
+
}
|
|
2143
|
+
return i.connect = function(e, t) {
|
|
2144
|
+
var r = new hi(e, t);
|
|
2145
|
+
te.set(e, r);
|
|
2146
|
+
}, i.observe = function(e, t, r) {
|
|
2147
|
+
var s = te.get(e), n = s.observationTargets.length === 0;
|
|
2148
|
+
Ve(s.observationTargets, t) < 0 && (n && F.push(s), s.observationTargets.push(new li(t, r && r.box)), _e(1), me.schedule());
|
|
2149
|
+
}, i.unobserve = function(e, t) {
|
|
2150
|
+
var r = te.get(e), s = Ve(r.observationTargets, t), n = r.observationTargets.length === 1;
|
|
2151
|
+
s >= 0 && (n && F.splice(F.indexOf(r), 1), r.observationTargets.splice(s, 1), _e(-1));
|
|
2152
|
+
}, i.disconnect = function(e) {
|
|
2153
|
+
var t = this, r = te.get(e);
|
|
2154
|
+
r.observationTargets.slice().forEach(function(s) {
|
|
2155
|
+
return t.unobserve(e, s.target);
|
|
2156
|
+
}), r.activeTargets.splice(0, r.activeTargets.length);
|
|
2157
|
+
}, i;
|
|
2158
|
+
}(), pt = function() {
|
|
2159
|
+
function i(e) {
|
|
2160
|
+
if (arguments.length === 0)
|
|
2161
|
+
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2162
|
+
if (typeof e != "function")
|
|
2163
|
+
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
2164
|
+
ie.connect(this, e);
|
|
2165
|
+
}
|
|
2166
|
+
return i.prototype.observe = function(e, t) {
|
|
2167
|
+
if (arguments.length === 0)
|
|
2168
|
+
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2169
|
+
if (!Fe(e))
|
|
2170
|
+
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2171
|
+
ie.observe(this, e, t);
|
|
2172
|
+
}, i.prototype.unobserve = function(e) {
|
|
2173
|
+
if (arguments.length === 0)
|
|
2174
|
+
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2175
|
+
if (!Fe(e))
|
|
2176
|
+
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2177
|
+
ie.unobserve(this, e);
|
|
2178
|
+
}, i.prototype.disconnect = function() {
|
|
2179
|
+
ie.disconnect(this);
|
|
2180
|
+
}, i.toString = function() {
|
|
2181
|
+
return "function ResizeObserver () { [polyfill code] }";
|
|
2182
|
+
}, i;
|
|
2183
|
+
}();
|
|
2184
|
+
function ci(i, e) {
|
|
2185
|
+
return i.document.documentElement.style.getPropertyValue(e);
|
|
2186
|
+
}
|
|
2187
|
+
function ge(i, e, t) {
|
|
2188
|
+
i.document.documentElement.style.setProperty(e, t);
|
|
2189
|
+
}
|
|
2190
|
+
function ft(i, e) {
|
|
2191
|
+
i.document.documentElement.style.removeProperty(e);
|
|
2192
|
+
}
|
|
2193
|
+
const ui = window.ResizeObserver || pt;
|
|
2194
|
+
var di = /* @__PURE__ */ ((i) => (i.Wrap = "wrap", i.Viewport = "viewport", i.Bounds = "bounds", i.Page = "page", i))(di || {}), pi = /* @__PURE__ */ ((i) => (i.Boxes = "boxes", i.Bounds = "bounds", i))(pi || {});
|
|
2195
|
+
const fi = "Highlight" in window, je = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2196
|
+
class mi {
|
|
2197
|
+
/**
|
|
2198
|
+
* Creates a DecorationGroup object
|
|
2199
|
+
* @param id Unique HTML ID-adhering name of the group
|
|
2200
|
+
* @param name Human-readable name of the group
|
|
2201
|
+
*/
|
|
2202
|
+
constructor(e, t, r, s) {
|
|
2203
|
+
this.wnd = e, this.comms = t, this.id = r, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, fi && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2204
|
+
}
|
|
2205
|
+
get activeable() {
|
|
2206
|
+
return this.activateable;
|
|
2207
|
+
}
|
|
2208
|
+
set activeable(e) {
|
|
2209
|
+
this.activateable = e;
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* Adds a new decoration to the group.
|
|
2213
|
+
* @param decoration Decoration to add
|
|
2214
|
+
*/
|
|
2215
|
+
add(e) {
|
|
2216
|
+
var o, a, h, c;
|
|
2217
|
+
const t = `${this.id}-${this.lastItemId++}`, r = Oe(this.wnd.document, e.locator);
|
|
2218
|
+
if (!r) {
|
|
2219
|
+
this.comms.log("Can't locate DOM range for decoration", e);
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
const s = r.commonAncestorContainer;
|
|
2223
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (je.includes(s.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), s.querySelector(je.join(", ").toLowerCase()) && ((a = this.notTextFlag) == null || a.set(t, !0)), (((h = s.textContent) == null ? void 0 : h.trim()) || "").length === 0 && ((c = this.notTextFlag) == null || c.set(t, !0)));
|
|
2224
|
+
const n = {
|
|
2225
|
+
decoration: e,
|
|
2226
|
+
id: t,
|
|
2227
|
+
range: r
|
|
2228
|
+
};
|
|
2229
|
+
this.items.push(n), this.layout(n), this.renderLayout([n]);
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Removes the decoration with given ID from the group.
|
|
2233
|
+
* @param identifier ID of item to remove
|
|
2234
|
+
*/
|
|
2235
|
+
remove(e) {
|
|
2236
|
+
var s, n;
|
|
2237
|
+
const t = this.items.findIndex((o) => o.decoration.id === e);
|
|
2238
|
+
if (t < 0)
|
|
2239
|
+
return;
|
|
2240
|
+
const r = this.items[t];
|
|
2241
|
+
if (this.items.splice(t, 1), r.clickableElements = void 0, r.container && (r.container.remove(), r.container = void 0), this.experimentalHighlights && !((s = this.notTextFlag) != null && s.has(r.id))) {
|
|
2242
|
+
const o = this.wnd.CSS.highlights.get(this.id);
|
|
2243
|
+
o == null || o.delete(r.range);
|
|
2244
|
+
}
|
|
2245
|
+
(n = this.notTextFlag) == null || n.delete(r.id);
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Notifies that the given decoration was modified and needs to be updated.
|
|
2249
|
+
* @param decoration Decoration to update
|
|
2250
|
+
*/
|
|
2251
|
+
update(e) {
|
|
2252
|
+
this.remove(e.id), this.add(e);
|
|
2253
|
+
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Removes all decorations from this group.
|
|
2256
|
+
*/
|
|
2257
|
+
clear() {
|
|
2258
|
+
var e;
|
|
2259
|
+
this.clearContainer(), this.items.length = 0, (e = this.notTextFlag) == null || e.clear();
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Recreates the decoration elements.
|
|
2263
|
+
* To be called after reflowing the resource, for example.
|
|
2264
|
+
*/
|
|
2265
|
+
requestLayout() {
|
|
2266
|
+
this.wnd.cancelAnimationFrame(this.currentRender), this.clearContainer(), this.items.forEach((e) => this.layout(e)), this.renderLayout(this.items);
|
|
2267
|
+
}
|
|
2268
|
+
experimentalLayout(e) {
|
|
2269
|
+
var s, n;
|
|
2270
|
+
const [t, r] = this.requireContainer(!0);
|
|
2271
|
+
r.add(e.range), t.innerHTML = `
|
|
2272
|
+
::highlight(${this.id}) {
|
|
2273
|
+
color: black;
|
|
2274
|
+
background-color: ${((n = (s = e.decoration) == null ? void 0 : s.style) == null ? void 0 : n.tint) ?? "yellow"};
|
|
2275
|
+
}`;
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Layouts a single DecorationItem.
|
|
2279
|
+
* @param item
|
|
2280
|
+
*/
|
|
2281
|
+
layout(e) {
|
|
2282
|
+
var v, g, y, x, S;
|
|
2283
|
+
if (this.experimentalHighlights && !((v = this.notTextFlag) != null && v.has(e.id)))
|
|
2284
|
+
return this.experimentalLayout(e);
|
|
2285
|
+
const t = this.wnd.document.createElement("div");
|
|
2286
|
+
t.setAttribute("id", e.id), t.style.setProperty("pointer-events", "none");
|
|
2287
|
+
const r = this.wnd.innerWidth, s = parseInt(
|
|
2288
|
+
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2289
|
+
"column-count"
|
|
2290
|
+
)
|
|
2291
|
+
), n = r / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, h = o.scrollTop, c = (m, E, P) => {
|
|
2292
|
+
var Y, Z, D, B, J, K;
|
|
2293
|
+
if (m.style.position = "absolute", ((Z = (Y = e.decoration) == null ? void 0 : Y.style) == null ? void 0 : Z.width) === "viewport") {
|
|
2294
|
+
m.style.width = `${r}px`, m.style.height = `${E.height}px`;
|
|
2295
|
+
let U = Math.floor(E.left / r) * r;
|
|
2296
|
+
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
2297
|
+
} else if (((B = (D = e.decoration) == null ? void 0 : D.style) == null ? void 0 : B.width) === "bounds")
|
|
2298
|
+
m.style.width = `${P.width}px`, m.style.height = `${E.height}px`, m.style.left = `${P.left + a}px`, m.style.top = `${E.top + h}px`;
|
|
2299
|
+
else if (((K = (J = e.decoration) == null ? void 0 : J.style) == null ? void 0 : K.width) === "page") {
|
|
2300
|
+
m.style.width = `${n}px`, m.style.height = `${E.height}px`;
|
|
2301
|
+
let U = Math.floor(E.left / n) * n;
|
|
2302
|
+
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
2303
|
+
} else
|
|
2304
|
+
m.style.width = `${E.width}px`, m.style.height = `${E.height}px`, m.style.left = `${E.left + a}px`, m.style.top = `${E.top + h}px`;
|
|
2305
|
+
}, u = e.range.getBoundingClientRect();
|
|
2306
|
+
let p = this.wnd.document.createElement("template");
|
|
2307
|
+
const d = ci(this.wnd, "--USER__appearance") === "readium-night-on";
|
|
2308
|
+
p.innerHTML = `
|
|
2309
|
+
<div
|
|
2310
|
+
class="r2-highlight-0"
|
|
2311
|
+
style="${[
|
|
2312
|
+
`background-color: ${((y = (g = e.decoration) == null ? void 0 : g.style) == null ? void 0 : y.tint) ?? "yellow"} !important`,
|
|
2313
|
+
//"opacity: 0.3 !important",
|
|
2314
|
+
`mix-blend-mode: ${d ? "exclusion" : "multiply"} !important`,
|
|
2315
|
+
"opacity: 1 !important",
|
|
2316
|
+
"box-sizing: border-box !important"
|
|
2317
|
+
].join("; ")}"
|
|
2318
|
+
>
|
|
2319
|
+
</div>
|
|
2320
|
+
`.trim();
|
|
2321
|
+
const f = p.content.firstElementChild;
|
|
2322
|
+
if (((S = (x = e.decoration) == null ? void 0 : x.style) == null ? void 0 : S.layout) === "bounds") {
|
|
2323
|
+
const m = f.cloneNode(!0);
|
|
2324
|
+
m.style.setProperty("pointer-events", "none"), c(m, u, u), t.append(m);
|
|
2325
|
+
} else {
|
|
2326
|
+
let m = kt(
|
|
2327
|
+
e.range,
|
|
2328
|
+
!0
|
|
2329
|
+
// doNotMergeHorizontallyAlignedRects
|
|
2330
|
+
);
|
|
2331
|
+
m = m.sort((E, P) => E.top < P.top ? -1 : E.top > P.top ? 1 : 0);
|
|
2332
|
+
for (let E of m) {
|
|
2333
|
+
const P = f.cloneNode(!0);
|
|
2334
|
+
P.style.setProperty("pointer-events", "none"), c(P, E, u), t.append(P);
|
|
2176
2335
|
}
|
|
2177
2336
|
}
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
if (this.touchState === 2) {
|
|
2182
|
-
const t = this.dragOffset(), r = this.scrollOffset();
|
|
2183
|
-
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), t > 5 && this.comms.send("no_more", void 0), t < -5 && this.comms.send("no_less", void 0)) : r < 5 && t < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : this.cachedScrollWidth - r - this.wnd.innerWidth < 5 && t > 5 && (this.alreadyScrollLeft = this.cachedScrollWidth, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", t);
|
|
2184
|
-
}
|
|
2185
|
-
this.touchState = 0;
|
|
2186
|
-
}
|
|
2187
|
-
onWidthChange() {
|
|
2188
|
-
this.cachedScrollWidth = this.doc().scrollWidth, this.comms.ready && this.snapCurrentOffset();
|
|
2189
|
-
}
|
|
2190
|
-
onTouchMove(e) {
|
|
2191
|
-
if (this.touchState === 0)
|
|
2192
|
-
return;
|
|
2193
|
-
this.touchState === 1 && (this.touchState = 2, T(this.wnd)), this.endingX = e.touches[0].clientX;
|
|
2194
|
-
const t = this.dragOffset(), r = this.alreadyScrollLeft + t;
|
|
2195
|
-
r < 0 ? (this.overscroll = r, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : r + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = r, this.doc().style.transform = `translate3d(${-r}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + t);
|
|
2337
|
+
e.container = t, e.clickableElements = Array.from(
|
|
2338
|
+
t.querySelectorAll("[data-activable='1']")
|
|
2339
|
+
), e.clickableElements.length || (e.clickableElements = Array.from(t.children));
|
|
2196
2340
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2204
|
-
50% {transform: translate3d(-50px, 0, 0);}
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
@keyframes readium-bounce-r-animation {
|
|
2208
|
-
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2209
|
-
50% {transform: translate3d(50px, 0, 0);}
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
.readium-bounce-l {
|
|
2213
|
-
animation: readium-bounce-l-animation 150ms ease-out 1;
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
.readium-bounce-r {
|
|
2217
|
-
animation: readium-bounce-r-animation 150ms ease-out 1;
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
html {
|
|
2221
|
-
overflow: hidden;
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
body {
|
|
2225
|
-
-ms-overflow-style: none; /* for Internet Explorer, Edge */
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
* {
|
|
2229
|
-
scrollbar-width: none; /* for Firefox */
|
|
2230
|
-
}
|
|
2231
|
-
|
|
2232
|
-
body::-webkit-scrollbar {
|
|
2233
|
-
display: none; /* for Chrome, Safari, and Opera */
|
|
2234
|
-
}
|
|
2235
|
-
`, e.document.head.appendChild(r);
|
|
2236
|
-
const s = e.ResizeObserver || nt;
|
|
2237
|
-
this.resizeObserver = new s(() => e.requestAnimationFrame(() => {
|
|
2238
|
-
e && Jt(e);
|
|
2239
|
-
})), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver(() => {
|
|
2240
|
-
this.wnd.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
2241
|
-
}), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] });
|
|
2242
|
-
const n = (o) => {
|
|
2243
|
-
const a = this.doc().scrollLeft;
|
|
2244
|
-
return this.doc().scrollLeft = this.snapOffset(o), a !== this.doc().scrollLeft;
|
|
2245
|
-
};
|
|
2246
|
-
return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression", C.moduleName, (o, a) => {
|
|
2247
|
-
const h = o;
|
|
2248
|
-
if (h < 0 || h > 1) {
|
|
2249
|
-
t.send("error", {
|
|
2250
|
-
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2251
|
-
}), a(!1);
|
|
2252
|
-
return;
|
|
2253
|
-
}
|
|
2254
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2255
|
-
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2256
|
-
const c = this.cachedScrollWidth, d = W(e) ? -1 : 1, p = c * h * d;
|
|
2257
|
-
this.doc().scrollLeft = this.snapOffset(p), this.reportProgress(), T(this.wnd), a(!0);
|
|
2258
|
-
});
|
|
2259
|
-
}), t.register("go_id", C.moduleName, (o, a) => {
|
|
2260
|
-
const h = e.document.getElementById(o);
|
|
2261
|
-
if (!h) {
|
|
2262
|
-
a(!1);
|
|
2263
|
-
return;
|
|
2264
|
-
}
|
|
2265
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2266
|
-
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), a(!0);
|
|
2267
|
-
});
|
|
2268
|
-
}), t.register("go_text", C.moduleName, (o, a) => {
|
|
2269
|
-
let h;
|
|
2270
|
-
Array.isArray(o) && (o.length > 1 && (h = o[1]), o = o[0]);
|
|
2271
|
-
const c = q.deserialize(o), d = Oe(this.wnd.document, new I({
|
|
2272
|
-
href: e.location.href,
|
|
2273
|
-
type: "text/html",
|
|
2274
|
-
text: c,
|
|
2275
|
-
locations: h ? new w({
|
|
2276
|
-
otherLocations: /* @__PURE__ */ new Map([
|
|
2277
|
-
["cssSelector", h]
|
|
2278
|
-
])
|
|
2279
|
-
}) : void 0
|
|
2280
|
-
}));
|
|
2281
|
-
if (!d) {
|
|
2282
|
-
a(!1);
|
|
2341
|
+
renderLayout(e) {
|
|
2342
|
+
this.wnd.cancelAnimationFrame(this.currentRender), this.currentRender = this.wnd.requestAnimationFrame(() => {
|
|
2343
|
+
if (e = e.filter((r) => {
|
|
2344
|
+
var s;
|
|
2345
|
+
return !this.experimentalHighlights || !!((s = this.notTextFlag) != null && s.has(r.id));
|
|
2346
|
+
}), !e || e.length === 0)
|
|
2283
2347
|
return;
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
this.doc().scrollLeft = this.snapOffset(d.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), a(!0);
|
|
2287
|
-
});
|
|
2288
|
-
}), t.register("go_end", C.moduleName, (o, a) => {
|
|
2289
|
-
const h = W(e) ? -1 : 1;
|
|
2290
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2291
|
-
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2292
|
-
const c = this.cachedScrollWidth * h;
|
|
2293
|
-
if (this.doc().scrollLeft === c)
|
|
2294
|
-
return a(!1);
|
|
2295
|
-
this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), T(this.wnd), a(!0);
|
|
2296
|
-
});
|
|
2297
|
-
}), t.register("go_start", C.moduleName, (o, a) => {
|
|
2298
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2299
|
-
if (this.doc().scrollLeft === 0)
|
|
2300
|
-
return a(!1);
|
|
2301
|
-
this.doc().scrollLeft = 0, this.reportProgress(), T(this.wnd), a(!0);
|
|
2302
|
-
});
|
|
2303
|
-
}), t.register("go_prev", C.moduleName, (o, a) => {
|
|
2304
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2305
|
-
const h = e.scrollX - e.innerWidth, c = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, d = n(Math.max(h, c));
|
|
2306
|
-
d && (this.reportProgress(), T(this.wnd)), a(d);
|
|
2307
|
-
});
|
|
2308
|
-
}), t.register("go_next", C.moduleName, (o, a) => {
|
|
2309
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2310
|
-
const h = e.scrollX + e.innerWidth, c = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth, d = n(Math.min(h, c));
|
|
2311
|
-
d && (this.reportProgress(), T(this.wnd)), a(d);
|
|
2312
|
-
});
|
|
2313
|
-
}), t.register("unfocus", C.moduleName, (o, a) => {
|
|
2314
|
-
this.snappingCancelled = !0, T(this.wnd), a(!0);
|
|
2315
|
-
}), t.register("shake", C.moduleName, (o, a) => {
|
|
2316
|
-
this.shake(), a(!0);
|
|
2317
|
-
}), t.register("focus", C.moduleName, (o, a) => {
|
|
2318
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2319
|
-
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), a(!0);
|
|
2320
|
-
});
|
|
2321
|
-
}), t.register("first_visible_locator", C.moduleName, (o, a) => {
|
|
2322
|
-
const h = mt(e, !1);
|
|
2323
|
-
this.comms.send("first_visible_locator", h.serialize()), a(!0);
|
|
2324
|
-
}), e.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), e.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), e.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), e.document.addEventListener("touchstart", () => {
|
|
2325
|
-
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2348
|
+
this.requireContainer().append(...e.map((r) => r.container).filter((r) => !!r));
|
|
2349
|
+
});
|
|
2326
2350
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2351
|
+
/**
|
|
2352
|
+
* Returns the group container element, after making sure it exists.
|
|
2353
|
+
* @returns Group's container
|
|
2354
|
+
*/
|
|
2355
|
+
requireContainer(e = !1) {
|
|
2356
|
+
if (e) {
|
|
2357
|
+
let t;
|
|
2358
|
+
this.wnd.document.getElementById(`${this.id}-style`) ? t = this.wnd.document.getElementById(`${this.id}-style`) : (t = this.wnd.document.createElement("style"), t.dataset.readium = "true", t.id = `${this.id}-style`, this.wnd.document.head.appendChild(t));
|
|
2359
|
+
let r;
|
|
2360
|
+
return this.wnd.CSS.highlights.has(this.id) ? r = this.wnd.CSS.highlights.get(this.id) : (r = new this.wnd.Highlight(), this.wnd.CSS.highlights.set(this.id, r)), [t, r];
|
|
2361
|
+
}
|
|
2362
|
+
return this.container || (this.container = this.wnd.document.createElement("div"), this.container.setAttribute("id", this.id), this.container.dataset.group = this.name, this.container.dataset.readium = "true", this.container.style.setProperty("pointer-events", "none"), this.container.style.display = "contents", this.wnd.document.body.append(this.container)), this.container;
|
|
2330
2363
|
}
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
bottom: "js-iframe-reader-bottom-anchor"
|
|
2337
|
-
};
|
|
2338
|
-
class di extends HTMLElement {
|
|
2339
|
-
connectedCallback() {
|
|
2340
|
-
this.setAttribute("aria-hidden", "true"), this.style.setProperty("display", "block", "important"), this.style.setProperty("padding", "0", "important"), this.style.setProperty("margin", "0", "important"), this.style.setProperty("visibility", "hidden", "important");
|
|
2364
|
+
/**
|
|
2365
|
+
* Removes the group container.
|
|
2366
|
+
*/
|
|
2367
|
+
clearContainer() {
|
|
2368
|
+
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2341
2369
|
}
|
|
2342
2370
|
}
|
|
2343
|
-
|
|
2344
|
-
const e = i.getElementsByTagName("body")[0], t = document.createElement("anchor-observer"), r = document.createElement("anchor-observer");
|
|
2345
|
-
t.dataset.readium = "true", r.dataset.readium = "true", t == null || t.setAttribute("id", he.top), t == null || t.style.setProperty("height", "115px", "important"), r == null || r.setAttribute("id", he.bottom), r == null || r.style.setProperty("height", "80px", "important"), e == null || e.insertBefore(t, e.firstChild), e == null || e.appendChild(r);
|
|
2346
|
-
}
|
|
2347
|
-
function pi(i) {
|
|
2348
|
-
var s, n;
|
|
2349
|
-
const e = i.getElementsByTagName("body")[0], t = e == null ? void 0 : e.querySelector(`#${he.top}`), r = e == null ? void 0 : e.querySelector(`#${he.bottom}`);
|
|
2350
|
-
t && ((s = t.parentElement) == null || s.removeChild(t)), r && ((n = r.parentElement) == null || n.removeChild(r));
|
|
2351
|
-
}
|
|
2352
|
-
const je = "readium-scroll-snapper-style", yt = class M extends at {
|
|
2371
|
+
const mt = class ve extends ce {
|
|
2353
2372
|
constructor() {
|
|
2354
|
-
super(...arguments), this.
|
|
2355
|
-
ui(this.doc());
|
|
2356
|
-
}, this.removeAnchorElements = () => {
|
|
2357
|
-
pi(this.doc());
|
|
2358
|
-
}, this.createCustomElement = () => {
|
|
2359
|
-
customElements.get("anchor-observer") || customElements.define("anchor-observer", di);
|
|
2360
|
-
};
|
|
2373
|
+
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2361
2374
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2375
|
+
cleanup() {
|
|
2376
|
+
this.groups.forEach((e) => e.clear()), this.groups.clear();
|
|
2364
2377
|
}
|
|
2365
|
-
|
|
2366
|
-
this.
|
|
2378
|
+
handleResize() {
|
|
2379
|
+
this.wnd.clearTimeout(this.resizeFrame), this.resizeFrame = this.wnd.setTimeout(() => {
|
|
2380
|
+
this.groups.forEach((e) => {
|
|
2381
|
+
e.experimentalHighlights || e.requestLayout();
|
|
2382
|
+
});
|
|
2383
|
+
}, 50);
|
|
2367
2384
|
}
|
|
2368
2385
|
mount(e, t) {
|
|
2369
|
-
this.wnd = e,
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
const o = e.document.getElementById(s);
|
|
2392
|
-
if (!o) {
|
|
2393
|
-
n(!1);
|
|
2394
|
-
return;
|
|
2395
|
-
}
|
|
2396
|
-
this.wnd.requestAnimationFrame(() => {
|
|
2397
|
-
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(this.doc().scrollTop / this.doc().offsetHeight), T(this.wnd), n(!0);
|
|
2398
|
-
});
|
|
2399
|
-
}), t.register("go_text", M.moduleName, (s, n) => {
|
|
2400
|
-
let o;
|
|
2401
|
-
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2402
|
-
const a = q.deserialize(s), h = Oe(this.wnd.document, new I({
|
|
2403
|
-
href: e.location.href,
|
|
2404
|
-
type: "text/html",
|
|
2405
|
-
text: a,
|
|
2406
|
-
locations: o ? new w({
|
|
2407
|
-
otherLocations: /* @__PURE__ */ new Map([
|
|
2408
|
-
["cssSelector", o]
|
|
2409
|
-
])
|
|
2410
|
-
}) : void 0
|
|
2411
|
-
}));
|
|
2412
|
-
if (!h) {
|
|
2413
|
-
n(!1);
|
|
2414
|
-
return;
|
|
2386
|
+
return this.wnd = e, t.register("decorate", ve.moduleName, (r, s) => {
|
|
2387
|
+
const n = r;
|
|
2388
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = I.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new mi(
|
|
2389
|
+
e,
|
|
2390
|
+
t,
|
|
2391
|
+
`readium-decoration-${this.lastGroupId++}`,
|
|
2392
|
+
n.group
|
|
2393
|
+
));
|
|
2394
|
+
const o = this.groups.get(n.group);
|
|
2395
|
+
switch (n.action) {
|
|
2396
|
+
case "add":
|
|
2397
|
+
o == null || o.add(n.decoration);
|
|
2398
|
+
break;
|
|
2399
|
+
case "remove":
|
|
2400
|
+
o == null || o.remove(n.decoration.id);
|
|
2401
|
+
break;
|
|
2402
|
+
case "clear":
|
|
2403
|
+
o == null || o.clear();
|
|
2404
|
+
break;
|
|
2405
|
+
case "update":
|
|
2406
|
+
o == null || o.update(n.decoration);
|
|
2407
|
+
break;
|
|
2415
2408
|
}
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
});
|
|
2419
|
-
}), t.register("go_start", M.moduleName, (s, n) => {
|
|
2420
|
-
if (this.doc().scrollTop === 0)
|
|
2421
|
-
return n(!1);
|
|
2422
|
-
this.doc().scrollTop = 0, this.reportProgress(0), n(!0);
|
|
2423
|
-
}), t.register("go_end", M.moduleName, (s, n) => {
|
|
2424
|
-
if (this.doc().scrollTop === 0)
|
|
2425
|
-
return n(!1);
|
|
2426
|
-
this.doc().scrollTop = 0, this.reportProgress(0), n(!0);
|
|
2427
|
-
}), t.register("unfocus", M.moduleName, (s, n) => {
|
|
2428
|
-
T(this.wnd), n(!0);
|
|
2429
|
-
}), t.register([
|
|
2430
|
-
"go_next",
|
|
2431
|
-
"go_prev"
|
|
2432
|
-
], M.moduleName, (s, n) => n(!1)), t.register("focus", M.moduleName, (s, n) => {
|
|
2433
|
-
this.reportProgress(this.doc().scrollTop / this.doc().offsetHeight), n(!0);
|
|
2434
|
-
}), t.register("first_visible_locator", M.moduleName, (s, n) => {
|
|
2435
|
-
const o = mt(e, !0);
|
|
2436
|
-
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2437
|
-
}), t.log("ScrollSnapper Mounted"), this.createCustomElement(), this.createAnchorElements(), !0;
|
|
2409
|
+
s(!0);
|
|
2410
|
+
}), this.resizeObserver = new ui(() => e.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(e.document.body), e.addEventListener("orientationchange", this.handleResizer), e.addEventListener("resize", this.handleResizer), t.log("Decorator Mounted"), !0;
|
|
2438
2411
|
}
|
|
2439
2412
|
unmount(e, t) {
|
|
2440
|
-
|
|
2441
|
-
return t.unregisterAll(M.moduleName), this.removeAnchorElements(), (r = e.document.getElementById(je)) == null || r.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2413
|
+
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(ve.moduleName), this.resizeObserver.disconnect(), this.cleanup(), t.log("Decorator Unmounted"), !0;
|
|
2442
2414
|
}
|
|
2443
2415
|
};
|
|
2444
|
-
|
|
2445
|
-
let
|
|
2446
|
-
class
|
|
2416
|
+
mt.moduleName = "decorator";
|
|
2417
|
+
let gi = mt;
|
|
2418
|
+
const Xe = "readium-snapper-style", gt = class ye extends ce {
|
|
2447
2419
|
constructor() {
|
|
2448
|
-
super(...arguments), this.
|
|
2449
|
-
}
|
|
2450
|
-
onPointUp(e) {
|
|
2451
|
-
var s, n, o, a, h;
|
|
2452
|
-
const t = this.wnd.getSelection();
|
|
2453
|
-
if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
|
|
2454
|
-
const c = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
|
|
2455
|
-
if (!c || c.length === 0)
|
|
2456
|
-
return;
|
|
2457
|
-
const d = c[0], p = {
|
|
2458
|
-
text: t.toString(),
|
|
2459
|
-
x: d.x,
|
|
2460
|
-
y: d.y,
|
|
2461
|
-
width: d.width,
|
|
2462
|
-
height: d.height,
|
|
2463
|
-
targetFrameSrc: (a = (o = this.wnd) == null ? void 0 : o.location) == null ? void 0 : a.href
|
|
2464
|
-
};
|
|
2465
|
-
this.comms.send("text_selected", p);
|
|
2466
|
-
}
|
|
2467
|
-
if (this.pointerMoved) {
|
|
2468
|
-
this.pointerMoved = !1;
|
|
2469
|
-
return;
|
|
2470
|
-
}
|
|
2471
|
-
if (!(t != null && t.isCollapsed) || !e.isPrimary)
|
|
2472
|
-
return;
|
|
2473
|
-
const r = this.wnd.devicePixelRatio;
|
|
2474
|
-
e.preventDefault(), this.comms.send(e.pointerType === "touch" ? "tap" : "click", {
|
|
2475
|
-
defaultPrevented: e.defaultPrevented,
|
|
2476
|
-
x: e.clientX * r,
|
|
2477
|
-
y: e.clientY * r,
|
|
2478
|
-
targetFrameSrc: this.wnd.location.href,
|
|
2479
|
-
targetElement: e.target.outerHTML,
|
|
2480
|
-
interactiveElement: (h = ft(e.target)) == null ? void 0 : h.outerHTML,
|
|
2481
|
-
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2482
|
-
}), this.pointerMoved = !1;
|
|
2483
|
-
}
|
|
2484
|
-
onPointMove(e) {
|
|
2485
|
-
if (e.movementY !== void 0 && e.movementX !== void 0) {
|
|
2486
|
-
(Math.abs(e.movementX) > 1 || Math.abs(e.movementY) > 1) && (this.pointerMoved = !0);
|
|
2487
|
-
return;
|
|
2488
|
-
}
|
|
2489
|
-
this.pointerMoved = !0;
|
|
2490
|
-
}
|
|
2491
|
-
onPointDown() {
|
|
2492
|
-
this.pointerMoved = !1;
|
|
2493
|
-
}
|
|
2494
|
-
onContext(e) {
|
|
2495
|
-
this.onPointUp(e), this.pointerMoved = !1;
|
|
2420
|
+
super(...arguments), this.protected = !1;
|
|
2496
2421
|
}
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
clientX: e.clientX,
|
|
2504
|
-
clientY: e.clientY
|
|
2505
|
-
});
|
|
2506
|
-
Object.defineProperty(t, "target", { writable: !1, value: e.target }), Object.defineProperty(t, "defaultPrevented", { writable: !1, value: e.defaultPrevented }), this.onPointUp(t);
|
|
2507
|
-
}
|
|
2422
|
+
buildStyles() {
|
|
2423
|
+
return `
|
|
2424
|
+
html, body {
|
|
2425
|
+
touch-action: manipulation;
|
|
2426
|
+
user-select: ${this.protected ? "none" : "auto"};
|
|
2427
|
+
}`;
|
|
2508
2428
|
}
|
|
2509
2429
|
mount(e, t) {
|
|
2510
|
-
|
|
2430
|
+
const r = e.document.createElement("style");
|
|
2431
|
+
return r.dataset.readium = "true", r.id = Xe, r.textContent = this.buildStyles(), e.document.head.appendChild(r), t.register("protect", ye.moduleName, (s, n) => {
|
|
2432
|
+
this.protected = !0, r.textContent = this.buildStyles(), n(!0);
|
|
2433
|
+
}), t.register("unprotect", ye.moduleName, (s, n) => {
|
|
2434
|
+
this.protected = !1, r.textContent = this.buildStyles(), n(!0);
|
|
2435
|
+
}), t.log("Snapper Mounted"), !0;
|
|
2511
2436
|
}
|
|
2512
2437
|
unmount(e, t) {
|
|
2513
|
-
|
|
2438
|
+
var r;
|
|
2439
|
+
return (r = e.document.getElementById(Xe)) == null || r.remove(), t.log("Snapper Unmounted"), !0;
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
gt.moduleName = "snapper";
|
|
2443
|
+
let vt = gt;
|
|
2444
|
+
function W(i) {
|
|
2445
|
+
return i.document.body.dir.toLowerCase() === "rtl";
|
|
2446
|
+
}
|
|
2447
|
+
function yt(i) {
|
|
2448
|
+
return parseInt(
|
|
2449
|
+
i.getComputedStyle(
|
|
2450
|
+
i.document.documentElement
|
|
2451
|
+
).getPropertyValue("column-count")
|
|
2452
|
+
);
|
|
2453
|
+
}
|
|
2454
|
+
function vi(i) {
|
|
2455
|
+
const e = "readium-virtual-page";
|
|
2456
|
+
let t = i.document.getElementById(e);
|
|
2457
|
+
if (yt(i) !== 2)
|
|
2458
|
+
t && t.remove();
|
|
2459
|
+
else {
|
|
2460
|
+
const s = i.document.scrollingElement.scrollWidth / i.innerWidth;
|
|
2461
|
+
Math.round(s * 2) / 2 % 1 > 0.1 && (t ? t.remove() : (t = i.document.createElement("div"), t.setAttribute("id", e), t.dataset.readium = "true", t.style.breakBefore = "column", t.innerHTML = "​", i.document.body.appendChild(t)));
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
function yi(i) {
|
|
2465
|
+
return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
|
|
2466
|
+
}
|
|
2467
|
+
function T(i) {
|
|
2468
|
+
const e = i.getSelection();
|
|
2469
|
+
e && e.removeAllRanges();
|
|
2470
|
+
}
|
|
2471
|
+
const bi = [
|
|
2472
|
+
"a",
|
|
2473
|
+
"audio",
|
|
2474
|
+
"button",
|
|
2475
|
+
"canvas",
|
|
2476
|
+
"details",
|
|
2477
|
+
"input",
|
|
2478
|
+
"label",
|
|
2479
|
+
"option",
|
|
2480
|
+
"select",
|
|
2481
|
+
"submit",
|
|
2482
|
+
"textarea",
|
|
2483
|
+
"video"
|
|
2484
|
+
];
|
|
2485
|
+
function bt(i) {
|
|
2486
|
+
var e;
|
|
2487
|
+
return bi.indexOf(i.nodeName.toLowerCase()) !== -1 || i.hasAttribute("contenteditable") && ((e = i.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? i : i.parentElement ? bt(i.parentElement) : null;
|
|
2488
|
+
}
|
|
2489
|
+
function Et(i, e) {
|
|
2490
|
+
const t = xt(i, i.document.body, e);
|
|
2491
|
+
return new I({
|
|
2492
|
+
href: "#",
|
|
2493
|
+
type: "application/xhtml+xml",
|
|
2494
|
+
locations: new w({
|
|
2495
|
+
otherLocations: /* @__PURE__ */ new Map([
|
|
2496
|
+
["cssSelector", i._readium_cssSelectorGenerator.getCssSelector(t)]
|
|
2497
|
+
])
|
|
2498
|
+
}),
|
|
2499
|
+
text: new q({
|
|
2500
|
+
highlight: t.textContent || void 0
|
|
2501
|
+
})
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
function xt(i, e, t) {
|
|
2505
|
+
for (var r = 0; r < e.children.length; r++) {
|
|
2506
|
+
const s = e.children[r];
|
|
2507
|
+
if (!xi(s) && Ei(i, s, t))
|
|
2508
|
+
return xt(i, s, t);
|
|
2514
2509
|
}
|
|
2510
|
+
return e;
|
|
2511
|
+
}
|
|
2512
|
+
function Ei(i, e, t) {
|
|
2513
|
+
if (e === document.body || e === document.documentElement)
|
|
2514
|
+
return !0;
|
|
2515
|
+
if (!document || !document.documentElement || !document.body)
|
|
2516
|
+
return !1;
|
|
2517
|
+
const r = e.getBoundingClientRect();
|
|
2518
|
+
return t ? r.bottom > 0 && r.top < i.innerHeight : r.right > 0 && r.left < i.innerWidth;
|
|
2519
|
+
}
|
|
2520
|
+
function xi(i) {
|
|
2521
|
+
const e = getComputedStyle(i);
|
|
2522
|
+
return !!(e && (e.getPropertyValue("display") != "block" || e.getPropertyValue("opacity") === "0"));
|
|
2515
2523
|
}
|
|
2516
|
-
|
|
2517
|
-
const Et = class ve extends ce {
|
|
2524
|
+
const Ge = "readium-column-snapper-style", wi = 200, wt = class C extends vt {
|
|
2518
2525
|
constructor() {
|
|
2519
|
-
super(...arguments), this.
|
|
2526
|
+
super(...arguments), this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
|
|
2520
2527
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
(t = this.comms) == null || t.send("error", {
|
|
2524
|
-
message: e.message,
|
|
2525
|
-
filename: e.filename,
|
|
2526
|
-
lineno: e.lineno,
|
|
2527
|
-
colno: e.colno
|
|
2528
|
-
});
|
|
2528
|
+
doc() {
|
|
2529
|
+
return this.wnd.document.scrollingElement;
|
|
2529
2530
|
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
for (e._readium_blockEvents = !1; ((t = e._readium_blockedEvents) == null ? void 0 : t.length) > 0; ) {
|
|
2533
|
-
const r = e._readium_blockedEvents.shift();
|
|
2534
|
-
switch (r[0]) {
|
|
2535
|
-
case 0:
|
|
2536
|
-
Reflect.apply(r[1], r[2], r[3]);
|
|
2537
|
-
break;
|
|
2538
|
-
case 1:
|
|
2539
|
-
const s = r[1], n = r[2];
|
|
2540
|
-
e.removeEventListener(s.type, e._readium_eventBlocker, !0);
|
|
2541
|
-
const o = new Event(s.type, {
|
|
2542
|
-
bubbles: s.bubbles,
|
|
2543
|
-
cancelable: s.cancelable
|
|
2544
|
-
});
|
|
2545
|
-
n ? n.dispatchEvent(o) : e.dispatchEvent(o);
|
|
2546
|
-
break;
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2531
|
+
scrollOffset() {
|
|
2532
|
+
return this.doc().scrollLeft > 0 ? this.doc().scrollLeft : this.alreadyScrollLeft;
|
|
2549
2533
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2534
|
+
snapOffset(e) {
|
|
2535
|
+
const t = e + (W(this.wnd) ? -1 : 1);
|
|
2536
|
+
return t - t % this.wnd.innerWidth;
|
|
2553
2537
|
}
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
this.mediaPlayingCount > 0 && this.mediaPlayingCount--, (e = this.comms) == null || e.send("media_pause", this.mediaPlayingCount);
|
|
2538
|
+
reportProgress() {
|
|
2539
|
+
this.comms.send("progress", { progress: this.wnd.scrollX / this.cachedScrollWidth, reference: this.wnd.innerWidth / this.doc().scrollWidth });
|
|
2557
2540
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2541
|
+
shake() {
|
|
2542
|
+
if (this.overscroll !== 0 || this.shakeTimeout !== 0)
|
|
2543
|
+
return;
|
|
2544
|
+
const e = this.doc();
|
|
2545
|
+
e.classList.add(W(this.wnd) ? "readium-bounce-l" : "readium-bounce-r");
|
|
2546
|
+
const t = this.scrollOffset();
|
|
2547
|
+
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
2548
|
+
e.classList.remove("readium-bounce-l"), e.classList.remove("readium-bounce-r"), this.shakeTimeout = 0, this.doc().scrollLeft = t;
|
|
2549
|
+
}, 150);
|
|
2562
2550
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2551
|
+
// We have to cache this because during overscroll (transform, or left) the width is incorrect due to browser
|
|
2552
|
+
takeOverSnap() {
|
|
2553
|
+
var t;
|
|
2554
|
+
this.snappingCancelled = !0, this.clearTouches();
|
|
2555
|
+
const e = this.doc();
|
|
2556
|
+
this.overscroll = ((t = e.style.transform) == null ? void 0 : t.length) > 12 ? parseFloat(e.style.transform.slice(12).split("px")[0]) : 0;
|
|
2557
|
+
}
|
|
2558
|
+
// Snaps the current offset to the page width.
|
|
2559
|
+
snapCurrentOffset(e = !1, t = !1) {
|
|
2560
|
+
const r = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = yt(this.wnd), a = Math.min(Math.max(0, r), this.cachedScrollWidth), h = W(this.wnd) ? -1 : 1, c = (
|
|
2561
|
+
// The hurdle to overcome in order to change pages
|
|
2562
|
+
h * (this.wnd.innerWidth / 3) * (h * n > 0 ? 2 : 1)
|
|
2563
|
+
), u = this.snapOffset(a + c);
|
|
2564
|
+
if (e && u !== this.scrollOffset()) {
|
|
2565
|
+
this.snappingCancelled = !1;
|
|
2566
|
+
const p = (g, y, x, S) => x > S ? y : g + (y - g) * yi(x / S), d = (
|
|
2567
|
+
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2568
|
+
wi * o
|
|
2569
|
+
);
|
|
2570
|
+
let f;
|
|
2571
|
+
const v = (g) => {
|
|
2572
|
+
if (this.snappingCancelled)
|
|
2573
|
+
return;
|
|
2574
|
+
f || (f = g);
|
|
2575
|
+
const y = g - f, x = p(this.overscroll, 0, y, d), S = p(r, u, y, d);
|
|
2576
|
+
s.scrollLeft = S, this.overscroll !== 0 && (s.style.transform = `translate3d(${-x}px, 0px, 0px)`), y < d ? this.wnd.requestAnimationFrame(v) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = u, t || this.reportProgress());
|
|
2577
|
+
};
|
|
2578
|
+
this.wnd.requestAnimationFrame(v);
|
|
2579
|
+
} else
|
|
2580
|
+
s.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
|
|
2581
|
+
s.scrollLeft = u, this.clearTouches(), t || this.reportProgress();
|
|
2584
2582
|
});
|
|
2585
|
-
}
|
|
2586
|
-
return t.log("Setup Mounted"), !0;
|
|
2587
2583
|
}
|
|
2588
|
-
|
|
2589
|
-
return
|
|
2584
|
+
dragOffset() {
|
|
2585
|
+
return (this.startingX ?? 0) - (this.endingX ?? 0);
|
|
2590
2586
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
let xt = Et;
|
|
2594
|
-
function mi(i, e) {
|
|
2595
|
-
return i.document.documentElement.style.getPropertyValue(e);
|
|
2596
|
-
}
|
|
2597
|
-
function ye(i, e, t) {
|
|
2598
|
-
i.document.documentElement.style.setProperty(e, t);
|
|
2599
|
-
}
|
|
2600
|
-
function wt(i, e) {
|
|
2601
|
-
i.document.documentElement.style.removeProperty(e);
|
|
2602
|
-
}
|
|
2603
|
-
const Ge = "readium-viewport", Tt = class V extends xt {
|
|
2604
|
-
onViewportWidthChanged(e) {
|
|
2605
|
-
const t = e.target;
|
|
2606
|
-
ye(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
2587
|
+
clearTouches() {
|
|
2588
|
+
this.startingX = void 0, this.endingX = void 0, this.overscroll = 0;
|
|
2607
2589
|
}
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
wt(e, s), n(!0);
|
|
2622
|
-
}), t.register("activate", V.moduleName, (s, n) => {
|
|
2623
|
-
this.unblock(e), n(!0);
|
|
2624
|
-
}), t.log("ReflowableSetup Mounted"), !0;
|
|
2590
|
+
onTouchStart(e) {
|
|
2591
|
+
switch (e.stopPropagation(), this.takeOverSnap(), e.touches.length) {
|
|
2592
|
+
case 1:
|
|
2593
|
+
break;
|
|
2594
|
+
case 2:
|
|
2595
|
+
this.onTouchEnd(e);
|
|
2596
|
+
return;
|
|
2597
|
+
default: {
|
|
2598
|
+
this.onTouchEnd(e), this.comms.send("tap_more", e.touches.length);
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
this.startingX = e.touches[0].clientX, this.alreadyScrollLeft = this.doc().scrollLeft, this.touchState = 1;
|
|
2625
2603
|
}
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2604
|
+
onTouchEnd(e) {
|
|
2605
|
+
if (this.touchState === 2) {
|
|
2606
|
+
const t = this.dragOffset(), r = this.scrollOffset();
|
|
2607
|
+
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), t > 5 && this.comms.send("no_more", void 0), t < -5 && this.comms.send("no_less", void 0)) : r < 5 && t < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : this.cachedScrollWidth - r - this.wnd.innerWidth < 5 && t > 5 && (this.alreadyScrollLeft = this.cachedScrollWidth, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", t);
|
|
2608
|
+
}
|
|
2609
|
+
this.touchState = 0;
|
|
2610
|
+
}
|
|
2611
|
+
onWidthChange() {
|
|
2612
|
+
this.cachedScrollWidth = this.doc().scrollWidth, this.comms.ready && this.snapCurrentOffset();
|
|
2613
|
+
}
|
|
2614
|
+
onTouchMove(e) {
|
|
2615
|
+
if (this.touchState === 0)
|
|
2616
|
+
return;
|
|
2617
|
+
this.touchState === 1 && (this.touchState = 2, T(this.wnd)), this.endingX = e.touches[0].clientX;
|
|
2618
|
+
const t = this.dragOffset(), r = this.alreadyScrollLeft + t;
|
|
2619
|
+
r < 0 ? (this.overscroll = r, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : r + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = r, this.doc().style.transform = `translate3d(${-r}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + t);
|
|
2629
2620
|
}
|
|
2630
|
-
};
|
|
2631
|
-
Tt.moduleName = "reflowable_setup";
|
|
2632
|
-
let gi = Tt;
|
|
2633
|
-
const Ye = "readium-fixed-style", St = class L extends xt {
|
|
2634
2621
|
mount(e, t) {
|
|
2635
|
-
if (!super.mount(e, t))
|
|
2622
|
+
if (this.wnd = e, this.comms = t, !super.mount(e, t))
|
|
2636
2623
|
return !1;
|
|
2624
|
+
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2637
2625
|
const r = e.document.createElement("style");
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
-moz-text-size-adjust: none;
|
|
2626
|
+
r.dataset.readium = "true", r.id = Ge, r.textContent = `
|
|
2627
|
+
@keyframes readium-bounce-l-animation {
|
|
2628
|
+
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2629
|
+
50% {transform: translate3d(-50px, 0, 0);}
|
|
2630
|
+
}
|
|
2644
2631
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2632
|
+
@keyframes readium-bounce-r-animation {
|
|
2633
|
+
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2634
|
+
50% {transform: translate3d(50px, 0, 0);}
|
|
2635
|
+
}
|
|
2648
2636
|
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
const n = Ct(
|
|
2691
|
-
s,
|
|
2692
|
-
r,
|
|
2693
|
-
e
|
|
2694
|
-
), o = Ei(n, r), a = Pt(o), h = 2 * 2;
|
|
2695
|
-
for (let c = a.length - 1; c >= 0; c--) {
|
|
2696
|
-
const d = a[c];
|
|
2697
|
-
if (!(d.width * d.height > h))
|
|
2698
|
-
if (a.length > 1)
|
|
2699
|
-
a.splice(c, 1);
|
|
2700
|
-
else
|
|
2701
|
-
break;
|
|
2702
|
-
}
|
|
2703
|
-
return a;
|
|
2704
|
-
}
|
|
2705
|
-
function Ct(i, e, t) {
|
|
2706
|
-
for (let r = 0; r < i.length; r++)
|
|
2707
|
-
for (let s = r + 1; s < i.length; s++) {
|
|
2708
|
-
const n = i[r], o = i[s];
|
|
2709
|
-
if (n === o)
|
|
2710
|
-
continue;
|
|
2711
|
-
const a = A(n.top, o.top, e) && A(n.bottom, o.bottom, e), h = A(n.left, o.left, e) && A(n.right, o.right, e);
|
|
2712
|
-
if ((h && !t || a && !h) && Ot(n, o, e)) {
|
|
2713
|
-
const u = i.filter((v) => v !== n && v !== o), f = bi(n, o);
|
|
2714
|
-
return u.push(f), Ct(
|
|
2715
|
-
u,
|
|
2716
|
-
e,
|
|
2717
|
-
t
|
|
2718
|
-
);
|
|
2637
|
+
.readium-bounce-l {
|
|
2638
|
+
animation: readium-bounce-l-animation 150ms ease-out 1;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
.readium-bounce-r {
|
|
2642
|
+
animation: readium-bounce-r-animation 150ms ease-out 1;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
html {
|
|
2646
|
+
overflow: hidden;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
body {
|
|
2650
|
+
-ms-overflow-style: none; /* for Internet Explorer, Edge */
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
* {
|
|
2654
|
+
scrollbar-width: none; /* for Firefox */
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
body::-webkit-scrollbar {
|
|
2658
|
+
display: none; /* for Chrome, Safari, and Opera */
|
|
2659
|
+
}
|
|
2660
|
+
`, e.document.head.appendChild(r);
|
|
2661
|
+
const s = e.ResizeObserver || pt;
|
|
2662
|
+
this.resizeObserver = new s(() => e.requestAnimationFrame(() => {
|
|
2663
|
+
e && vi(e);
|
|
2664
|
+
})), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver(() => {
|
|
2665
|
+
this.wnd.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
2666
|
+
}), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] });
|
|
2667
|
+
const n = (o) => {
|
|
2668
|
+
const a = this.doc().scrollLeft;
|
|
2669
|
+
return this.doc().scrollLeft = this.snapOffset(o), a !== this.doc().scrollLeft;
|
|
2670
|
+
};
|
|
2671
|
+
return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression", C.moduleName, (o, a) => {
|
|
2672
|
+
const h = o;
|
|
2673
|
+
if (h < 0 || h > 1) {
|
|
2674
|
+
t.send("error", {
|
|
2675
|
+
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2676
|
+
}), a(!1);
|
|
2677
|
+
return;
|
|
2719
2678
|
}
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2679
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2680
|
+
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2681
|
+
const c = this.cachedScrollWidth, u = W(e) ? -1 : 1, p = c * h * u;
|
|
2682
|
+
this.doc().scrollLeft = this.snapOffset(p), this.reportProgress(), T(this.wnd), a(!0);
|
|
2683
|
+
});
|
|
2684
|
+
}), t.register("go_id", C.moduleName, (o, a) => {
|
|
2685
|
+
const h = e.document.getElementById(o);
|
|
2686
|
+
if (!h) {
|
|
2687
|
+
a(!1);
|
|
2688
|
+
return;
|
|
2689
|
+
}
|
|
2690
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2691
|
+
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), a(!0);
|
|
2692
|
+
});
|
|
2693
|
+
}), t.register("go_text", C.moduleName, (o, a) => {
|
|
2694
|
+
let h;
|
|
2695
|
+
Array.isArray(o) && (o.length > 1 && (h = o[1]), o = o[0]);
|
|
2696
|
+
const c = q.deserialize(o), u = Oe(this.wnd.document, new I({
|
|
2697
|
+
href: e.location.href,
|
|
2698
|
+
type: "text/html",
|
|
2699
|
+
text: c,
|
|
2700
|
+
locations: h ? new w({
|
|
2701
|
+
otherLocations: /* @__PURE__ */ new Map([
|
|
2702
|
+
["cssSelector", h]
|
|
2703
|
+
])
|
|
2704
|
+
}) : void 0
|
|
2705
|
+
}));
|
|
2706
|
+
if (!u) {
|
|
2707
|
+
a(!1);
|
|
2708
|
+
return;
|
|
2745
2709
|
}
|
|
2710
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2711
|
+
this.doc().scrollLeft = this.snapOffset(u.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), a(!0);
|
|
2712
|
+
});
|
|
2713
|
+
}), t.register("go_end", C.moduleName, (o, a) => {
|
|
2714
|
+
const h = W(e) ? -1 : 1;
|
|
2715
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2716
|
+
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2717
|
+
const c = this.cachedScrollWidth * h;
|
|
2718
|
+
if (this.doc().scrollLeft === c)
|
|
2719
|
+
return a(!1);
|
|
2720
|
+
this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), T(this.wnd), a(!0);
|
|
2721
|
+
});
|
|
2722
|
+
}), t.register("go_start", C.moduleName, (o, a) => {
|
|
2723
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2724
|
+
if (this.doc().scrollLeft === 0)
|
|
2725
|
+
return a(!1);
|
|
2726
|
+
this.doc().scrollLeft = 0, this.reportProgress(), T(this.wnd), a(!0);
|
|
2727
|
+
});
|
|
2728
|
+
}), t.register("go_prev", C.moduleName, (o, a) => {
|
|
2729
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2730
|
+
const h = e.scrollX - e.innerWidth, c = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, u = n(Math.max(h, c));
|
|
2731
|
+
u && (this.reportProgress(), T(this.wnd)), a(u);
|
|
2732
|
+
});
|
|
2733
|
+
}), t.register("go_next", C.moduleName, (o, a) => {
|
|
2734
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2735
|
+
const h = e.scrollX + e.innerWidth, c = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth, u = n(Math.min(h, c));
|
|
2736
|
+
u && (this.reportProgress(), T(this.wnd)), a(u);
|
|
2737
|
+
});
|
|
2738
|
+
}), t.register("unfocus", C.moduleName, (o, a) => {
|
|
2739
|
+
this.snappingCancelled = !0, T(this.wnd), a(!0);
|
|
2740
|
+
}), t.register("shake", C.moduleName, (o, a) => {
|
|
2741
|
+
this.shake(), a(!0);
|
|
2742
|
+
}), t.register("focus", C.moduleName, (o, a) => {
|
|
2743
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2744
|
+
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), a(!0);
|
|
2745
|
+
});
|
|
2746
|
+
}), t.register("first_visible_locator", C.moduleName, (o, a) => {
|
|
2747
|
+
const h = Et(e, !1);
|
|
2748
|
+
this.comms.send("first_visible_locator", h.serialize()), a(!0);
|
|
2749
|
+
}), e.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), e.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), e.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), e.document.addEventListener("touchstart", () => {
|
|
2750
|
+
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2751
|
+
}
|
|
2752
|
+
unmount(e, t) {
|
|
2753
|
+
var r;
|
|
2754
|
+
return this.snappingCancelled = !0, t.unregisterAll(C.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), e.removeEventListener("touchstart", this.onTouchStarter), e.removeEventListener("touchend", this.onTouchEnder), e.removeEventListener("touchmove", this.onTouchMover), e.removeEventListener("orientationchange", this.onWidthChanger), e.removeEventListener("resize", this.onWidthChanger), (r = e.document.getElementById(Ge)) == null || r.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
|
|
2755
|
+
}
|
|
2756
|
+
};
|
|
2757
|
+
wt.moduleName = "column_snapper";
|
|
2758
|
+
let Ti = wt;
|
|
2759
|
+
const he = {
|
|
2760
|
+
top: "js-iframe-reader-top-anchor",
|
|
2761
|
+
bottom: "js-iframe-reader-bottom-anchor"
|
|
2762
|
+
};
|
|
2763
|
+
class Si extends HTMLElement {
|
|
2764
|
+
connectedCallback() {
|
|
2765
|
+
this.setAttribute("aria-hidden", "true"), this.style.setProperty("display", "block", "important"), this.style.setProperty("padding", "0", "important"), this.style.setProperty("margin", "0", "important"), this.style.setProperty("visibility", "hidden", "important");
|
|
2746
2766
|
}
|
|
2747
|
-
return Array.from(t);
|
|
2748
|
-
}
|
|
2749
|
-
function xi(i, e, t) {
|
|
2750
|
-
return ie(i, e.left, e.top, t) && ie(i, e.right, e.top, t) && ie(i, e.left, e.bottom, t) && ie(i, e.right, e.bottom, t);
|
|
2751
2767
|
}
|
|
2752
|
-
function
|
|
2753
|
-
|
|
2768
|
+
function Ci(i) {
|
|
2769
|
+
const e = i.getElementsByTagName("body")[0], t = document.createElement("anchor-observer"), r = document.createElement("anchor-observer");
|
|
2770
|
+
t.dataset.readium = "true", r.dataset.readium = "true", t == null || t.setAttribute("id", he.top), t == null || t.style.setProperty("height", "115px", "important"), r == null || r.setAttribute("id", he.bottom), r == null || r.style.setProperty("height", "80px", "important"), e == null || e.insertBefore(t, e.firstChild), e == null || e.appendChild(r);
|
|
2754
2771
|
}
|
|
2755
|
-
function
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
if (r !== s && Ot(r, s, -1)) {
|
|
2760
|
-
let n = [], o;
|
|
2761
|
-
const a = Ze(r, s);
|
|
2762
|
-
if (a.length === 1)
|
|
2763
|
-
n = a, o = r;
|
|
2764
|
-
else {
|
|
2765
|
-
const c = Ze(s, r);
|
|
2766
|
-
a.length < c.length ? (n = a, o = r) : (n = c, o = s);
|
|
2767
|
-
}
|
|
2768
|
-
const h = i.filter((c) => c !== o);
|
|
2769
|
-
return Array.prototype.push.apply(h, n), Pt(h);
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
return i;
|
|
2772
|
+
function Oi(i) {
|
|
2773
|
+
var s, n;
|
|
2774
|
+
const e = i.getElementsByTagName("body")[0], t = e == null ? void 0 : e.querySelector(`#${he.top}`), r = e == null ? void 0 : e.querySelector(`#${he.bottom}`);
|
|
2775
|
+
t && ((s = t.parentElement) == null || s.removeChild(t)), r && ((n = r.parentElement) == null || n.removeChild(r));
|
|
2773
2776
|
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
height: 0,
|
|
2783
|
-
left: i.left,
|
|
2784
|
-
right: t.left,
|
|
2785
|
-
top: i.top,
|
|
2786
|
-
width: 0
|
|
2787
|
-
};
|
|
2788
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2789
|
-
}
|
|
2790
|
-
{
|
|
2791
|
-
const s = {
|
|
2792
|
-
bottom: t.top,
|
|
2793
|
-
height: 0,
|
|
2794
|
-
left: t.left,
|
|
2795
|
-
right: t.right,
|
|
2796
|
-
top: i.top,
|
|
2797
|
-
width: 0
|
|
2777
|
+
const Ye = "readium-scroll-snapper-style", Tt = class M extends vt {
|
|
2778
|
+
constructor() {
|
|
2779
|
+
super(...arguments), this.createAnchorElements = () => {
|
|
2780
|
+
Ci(this.doc());
|
|
2781
|
+
}, this.removeAnchorElements = () => {
|
|
2782
|
+
Oi(this.doc());
|
|
2783
|
+
}, this.createCustomElement = () => {
|
|
2784
|
+
customElements.get("anchor-observer") || customElements.define("anchor-observer", Si);
|
|
2798
2785
|
};
|
|
2799
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2800
2786
|
}
|
|
2801
|
-
{
|
|
2802
|
-
|
|
2803
|
-
bottom: i.bottom,
|
|
2804
|
-
height: 0,
|
|
2805
|
-
left: t.left,
|
|
2806
|
-
right: t.right,
|
|
2807
|
-
top: t.bottom,
|
|
2808
|
-
width: 0
|
|
2809
|
-
};
|
|
2810
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2787
|
+
doc() {
|
|
2788
|
+
return this.wnd.document.scrollingElement;
|
|
2811
2789
|
}
|
|
2812
|
-
{
|
|
2813
|
-
|
|
2814
|
-
bottom: i.bottom,
|
|
2815
|
-
height: 0,
|
|
2816
|
-
left: t.right,
|
|
2817
|
-
right: i.right,
|
|
2818
|
-
top: i.top,
|
|
2819
|
-
width: 0
|
|
2820
|
-
};
|
|
2821
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2790
|
+
reportProgress(e) {
|
|
2791
|
+
this.comms.send("progress", e);
|
|
2822
2792
|
}
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2793
|
+
mount(e, t) {
|
|
2794
|
+
this.wnd = e, this.comms = t, e.navigator.epubReadingSystem.layoutStyle = "scrolling";
|
|
2795
|
+
const r = e.document.createElement("style");
|
|
2796
|
+
return r.dataset.readium = "true", r.id = Ye, r.textContent = `
|
|
2797
|
+
* {
|
|
2798
|
+
scrollbar-width: none; /* for Firefox */
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
body::-webkit-scrollbar {
|
|
2802
|
+
display: none; /* for Chrome, Safari, and Opera */
|
|
2803
|
+
}
|
|
2804
|
+
`, e.document.head.appendChild(r), t.register("go_progression", M.moduleName, (s, n) => {
|
|
2805
|
+
const o = s;
|
|
2806
|
+
if (o < 0 || o > 1) {
|
|
2807
|
+
t.send("error", {
|
|
2808
|
+
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2809
|
+
}), n(!1);
|
|
2810
|
+
return;
|
|
2811
|
+
}
|
|
2812
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2813
|
+
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2814
|
+
});
|
|
2815
|
+
}), t.register("go_id", M.moduleName, (s, n) => {
|
|
2816
|
+
const o = e.document.getElementById(s);
|
|
2817
|
+
if (!o) {
|
|
2818
|
+
n(!1);
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2822
|
+
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2823
|
+
const a = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2824
|
+
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2825
|
+
});
|
|
2826
|
+
}), t.register("go_text", M.moduleName, (s, n) => {
|
|
2827
|
+
let o;
|
|
2828
|
+
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2829
|
+
const a = q.deserialize(s), h = Oe(this.wnd.document, new I({
|
|
2830
|
+
href: e.location.href,
|
|
2831
|
+
type: "text/html",
|
|
2832
|
+
text: a,
|
|
2833
|
+
locations: o ? new w({
|
|
2834
|
+
otherLocations: /* @__PURE__ */ new Map([
|
|
2835
|
+
["cssSelector", o]
|
|
2836
|
+
])
|
|
2837
|
+
}) : void 0
|
|
2838
|
+
}));
|
|
2839
|
+
if (!h) {
|
|
2840
|
+
n(!1);
|
|
2841
|
+
return;
|
|
2842
|
+
}
|
|
2843
|
+
this.wnd.requestAnimationFrame(() => {
|
|
2844
|
+
this.doc().scrollTop = h.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2845
|
+
const c = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2846
|
+
this.reportProgress({ progress: c, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2847
|
+
});
|
|
2848
|
+
}), t.register("go_start", M.moduleName, (s, n) => {
|
|
2849
|
+
if (this.doc().scrollTop === 0)
|
|
2850
|
+
return n(!1);
|
|
2851
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2852
|
+
}), t.register("go_end", M.moduleName, (s, n) => {
|
|
2853
|
+
if (this.doc().scrollTop === 0)
|
|
2854
|
+
return n(!1);
|
|
2855
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2856
|
+
}), t.register("unfocus", M.moduleName, (s, n) => {
|
|
2857
|
+
T(this.wnd), n(!0);
|
|
2858
|
+
}), t.register([
|
|
2859
|
+
"go_next",
|
|
2860
|
+
"go_prev"
|
|
2861
|
+
], M.moduleName, (s, n) => n(!1)), t.register("focus", M.moduleName, (s, n) => {
|
|
2862
|
+
const o = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2863
|
+
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2864
|
+
}), t.register("first_visible_locator", M.moduleName, (s, n) => {
|
|
2865
|
+
const o = Et(e, !0);
|
|
2866
|
+
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2867
|
+
}), t.log("ScrollSnapper Mounted"), this.createCustomElement(), this.createAnchorElements(), !0;
|
|
2851
2868
|
}
|
|
2852
|
-
|
|
2853
|
-
|
|
2869
|
+
unmount(e, t) {
|
|
2870
|
+
var r;
|
|
2871
|
+
return t.unregisterAll(M.moduleName), this.removeAnchorElements(), (r = e.document.getElementById(Ye)) == null || r.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2854
2872
|
}
|
|
2855
|
-
|
|
2856
|
-
|
|
2873
|
+
};
|
|
2874
|
+
Tt.moduleName = "scroll_snapper";
|
|
2875
|
+
let Pi = Tt;
|
|
2876
|
+
class St extends ce {
|
|
2877
|
+
constructor() {
|
|
2878
|
+
super(...arguments), this.pointerMoved = !1, this.onPointerUp = this.onPointUp.bind(this), this.onPointerMove = this.onPointMove.bind(this), this.onPointerDown = this.onPointDown.bind(this), this.onContextMenu = this.onContext.bind(this), this.onClicker = this.onClick.bind(this);
|
|
2857
2879
|
}
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2880
|
+
onPointUp(e) {
|
|
2881
|
+
var s, n, o, a, h;
|
|
2882
|
+
const t = this.wnd.getSelection();
|
|
2883
|
+
if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
|
|
2884
|
+
const c = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
|
|
2885
|
+
if (!c || c.length === 0)
|
|
2886
|
+
return;
|
|
2887
|
+
const u = c[0], p = {
|
|
2888
|
+
text: t.toString(),
|
|
2889
|
+
x: u.x,
|
|
2890
|
+
y: u.y,
|
|
2891
|
+
width: u.width,
|
|
2892
|
+
height: u.height,
|
|
2893
|
+
targetFrameSrc: (a = (o = this.wnd) == null ? void 0 : o.location) == null ? void 0 : a.href
|
|
2894
|
+
};
|
|
2895
|
+
this.comms.send("text_selected", p);
|
|
2896
|
+
}
|
|
2897
|
+
if (this.pointerMoved) {
|
|
2898
|
+
this.pointerMoved = !1;
|
|
2867
2899
|
return;
|
|
2868
2900
|
}
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
const
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2901
|
+
if (!(t != null && t.isCollapsed) || !e.isPrimary)
|
|
2902
|
+
return;
|
|
2903
|
+
const r = this.wnd.devicePixelRatio;
|
|
2904
|
+
e.preventDefault(), this.comms.send(e.pointerType === "touch" ? "tap" : "click", {
|
|
2905
|
+
defaultPrevented: e.defaultPrevented,
|
|
2906
|
+
x: e.clientX * r,
|
|
2907
|
+
y: e.clientY * r,
|
|
2908
|
+
targetFrameSrc: this.wnd.location.href,
|
|
2909
|
+
targetElement: e.target.outerHTML,
|
|
2910
|
+
interactiveElement: (h = bt(e.target)) == null ? void 0 : h.outerHTML,
|
|
2911
|
+
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2912
|
+
}), this.pointerMoved = !1;
|
|
2877
2913
|
}
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
*/
|
|
2882
|
-
remove(e) {
|
|
2883
|
-
var s, n;
|
|
2884
|
-
const t = this.items.findIndex((o) => o.decoration.id === e);
|
|
2885
|
-
if (t < 0)
|
|
2914
|
+
onPointMove(e) {
|
|
2915
|
+
if (e.movementY !== void 0 && e.movementX !== void 0) {
|
|
2916
|
+
(Math.abs(e.movementX) > 1 || Math.abs(e.movementY) > 1) && (this.pointerMoved = !0);
|
|
2886
2917
|
return;
|
|
2887
|
-
const r = this.items[t];
|
|
2888
|
-
if (this.items.splice(t, 1), r.clickableElements = void 0, r.container && (r.container.remove(), r.container = void 0), this.experimentalHighlights && !((s = this.notTextFlag) != null && s.has(r.id))) {
|
|
2889
|
-
const o = this.wnd.CSS.highlights.get(this.id);
|
|
2890
|
-
o == null || o.delete(r.range);
|
|
2891
2918
|
}
|
|
2892
|
-
|
|
2919
|
+
this.pointerMoved = !0;
|
|
2920
|
+
}
|
|
2921
|
+
onPointDown() {
|
|
2922
|
+
this.pointerMoved = !1;
|
|
2923
|
+
}
|
|
2924
|
+
onContext(e) {
|
|
2925
|
+
this.onPointUp(e), this.pointerMoved = !1;
|
|
2926
|
+
}
|
|
2927
|
+
onClick(e) {
|
|
2928
|
+
if (e.preventDefault(), !e.isTrusted) {
|
|
2929
|
+
const t = new PointerEvent("pointerup", {
|
|
2930
|
+
isPrimary: !0,
|
|
2931
|
+
pointerType: "mouse",
|
|
2932
|
+
// Not really a better choice than this
|
|
2933
|
+
clientX: e.clientX,
|
|
2934
|
+
clientY: e.clientY
|
|
2935
|
+
});
|
|
2936
|
+
Object.defineProperty(t, "target", { writable: !1, value: e.target }), Object.defineProperty(t, "defaultPrevented", { writable: !1, value: e.defaultPrevented }), this.onPointUp(t);
|
|
2937
|
+
}
|
|
2893
2938
|
}
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
* @param decoration Decoration to update
|
|
2897
|
-
*/
|
|
2898
|
-
update(e) {
|
|
2899
|
-
this.remove(e.id), this.add(e);
|
|
2939
|
+
mount(e, t) {
|
|
2940
|
+
return this.wnd = e, this.comms = t, e.document.addEventListener("pointerdown", this.onPointerDown), e.document.addEventListener("pointerup", this.onPointerUp), e.document.addEventListener("contextmenu", this.onContextMenu), e.document.addEventListener("pointermove", this.onPointerMove), e.document.addEventListener("click", this.onClicker), t.log("Peripherals Mounted"), !0;
|
|
2900
2941
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
*/
|
|
2904
|
-
clear() {
|
|
2905
|
-
var e;
|
|
2906
|
-
this.clearContainer(), this.items.length = 0, (e = this.notTextFlag) == null || e.clear();
|
|
2942
|
+
unmount(e, t) {
|
|
2943
|
+
return e.document.removeEventListener("pointerdown", this.onPointerDown), e.document.removeEventListener("pointerup", this.onPointerUp), e.document.removeEventListener("contextmenu", this.onContextMenu), e.document.removeEventListener("pointermove", this.onPointerMove), e.document.removeEventListener("click", this.onClicker), t.log("Peripherals Unmounted"), !0;
|
|
2907
2944
|
}
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
this.wnd.cancelAnimationFrame(this.currentRender), this.clearContainer(), this.items.forEach((e) => this.layout(e)), this.renderLayout(this.items);
|
|
2945
|
+
}
|
|
2946
|
+
St.moduleName = "peripherals";
|
|
2947
|
+
const Ct = class be extends ce {
|
|
2948
|
+
constructor() {
|
|
2949
|
+
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
2914
2950
|
}
|
|
2915
|
-
|
|
2916
|
-
var
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2951
|
+
wndOnErr(e) {
|
|
2952
|
+
var t;
|
|
2953
|
+
(t = this.comms) == null || t.send("error", {
|
|
2954
|
+
message: e.message,
|
|
2955
|
+
filename: e.filename,
|
|
2956
|
+
lineno: e.lineno,
|
|
2957
|
+
colno: e.colno
|
|
2958
|
+
});
|
|
2923
2959
|
}
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
m.style.width = `${r}px`, m.style.height = `${E.height}px`;
|
|
2942
|
-
let U = Math.floor(E.left / r) * r;
|
|
2943
|
-
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
2944
|
-
} else if (((D = (B = e.decoration) == null ? void 0 : B.style) == null ? void 0 : D.width) === "bounds")
|
|
2945
|
-
m.style.width = `${O.width}px`, m.style.height = `${E.height}px`, m.style.left = `${O.left + a}px`, m.style.top = `${E.top + h}px`;
|
|
2946
|
-
else if (((J = (K = e.decoration) == null ? void 0 : K.style) == null ? void 0 : J.width) === "page") {
|
|
2947
|
-
m.style.width = `${n}px`, m.style.height = `${E.height}px`;
|
|
2948
|
-
let U = Math.floor(E.left / n) * n;
|
|
2949
|
-
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
2950
|
-
} else
|
|
2951
|
-
m.style.width = `${E.width}px`, m.style.height = `${E.height}px`, m.style.left = `${E.left + a}px`, m.style.top = `${E.top + h}px`;
|
|
2952
|
-
}, d = e.range.getBoundingClientRect();
|
|
2953
|
-
let p = this.wnd.document.createElement("template");
|
|
2954
|
-
const u = mi(this.wnd, "--USER__appearance") === "readium-night-on";
|
|
2955
|
-
p.innerHTML = `
|
|
2956
|
-
<div
|
|
2957
|
-
class="r2-highlight-0"
|
|
2958
|
-
style="${[
|
|
2959
|
-
`background-color: ${((y = (g = e.decoration) == null ? void 0 : g.style) == null ? void 0 : y.tint) ?? "yellow"} !important`,
|
|
2960
|
-
//"opacity: 0.3 !important",
|
|
2961
|
-
`mix-blend-mode: ${u ? "exclusion" : "multiply"} !important`,
|
|
2962
|
-
"opacity: 1 !important",
|
|
2963
|
-
"box-sizing: border-box !important"
|
|
2964
|
-
].join("; ")}"
|
|
2965
|
-
>
|
|
2966
|
-
</div>
|
|
2967
|
-
`.trim();
|
|
2968
|
-
const f = p.content.firstElementChild;
|
|
2969
|
-
if (((S = (x = e.decoration) == null ? void 0 : x.style) == null ? void 0 : S.layout) === "bounds") {
|
|
2970
|
-
const m = f.cloneNode(!0);
|
|
2971
|
-
m.style.setProperty("pointer-events", "none"), c(m, d, d), t.append(m);
|
|
2972
|
-
} else {
|
|
2973
|
-
let m = yi(
|
|
2974
|
-
e.range,
|
|
2975
|
-
!0
|
|
2976
|
-
// doNotMergeHorizontallyAlignedRects
|
|
2977
|
-
);
|
|
2978
|
-
m = m.sort((E, O) => E.top < O.top ? -1 : E.top > O.top ? 1 : 0);
|
|
2979
|
-
for (let E of m) {
|
|
2980
|
-
const O = f.cloneNode(!0);
|
|
2981
|
-
O.style.setProperty("pointer-events", "none"), c(O, E, d), t.append(O);
|
|
2960
|
+
unblock(e) {
|
|
2961
|
+
var t;
|
|
2962
|
+
for (e._readium_blockEvents = !1; ((t = e._readium_blockedEvents) == null ? void 0 : t.length) > 0; ) {
|
|
2963
|
+
const r = e._readium_blockedEvents.shift();
|
|
2964
|
+
switch (r[0]) {
|
|
2965
|
+
case 0:
|
|
2966
|
+
Reflect.apply(r[1], r[2], r[3]);
|
|
2967
|
+
break;
|
|
2968
|
+
case 1:
|
|
2969
|
+
const s = r[1], n = r[2];
|
|
2970
|
+
e.removeEventListener(s.type, e._readium_eventBlocker, !0);
|
|
2971
|
+
const o = new Event(s.type, {
|
|
2972
|
+
bubbles: s.bubbles,
|
|
2973
|
+
cancelable: s.cancelable
|
|
2974
|
+
});
|
|
2975
|
+
n ? n.dispatchEvent(o) : e.dispatchEvent(o);
|
|
2976
|
+
break;
|
|
2982
2977
|
}
|
|
2983
2978
|
}
|
|
2984
|
-
e.container = t, e.clickableElements = Array.from(
|
|
2985
|
-
t.querySelectorAll("[data-activable='1']")
|
|
2986
|
-
), e.clickableElements.length || (e.clickableElements = Array.from(t.children));
|
|
2987
2979
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
var s;
|
|
2992
|
-
return !this.experimentalHighlights || !!((s = this.notTextFlag) != null && s.has(r.id));
|
|
2993
|
-
}), !e || e.length === 0)
|
|
2994
|
-
return;
|
|
2995
|
-
this.requireContainer().append(...e.map((r) => r.container).filter((r) => !!r));
|
|
2996
|
-
});
|
|
2980
|
+
onMediaPlayEvent() {
|
|
2981
|
+
var e;
|
|
2982
|
+
this.mediaPlayingCount++, (e = this.comms) == null || e.send("media_play", this.mediaPlayingCount);
|
|
2997
2983
|
}
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
2984
|
+
onMediaPauseEvent() {
|
|
2985
|
+
var e;
|
|
2986
|
+
this.mediaPlayingCount > 0 && this.mediaPlayingCount--, (e = this.comms) == null || e.send("media_pause", this.mediaPlayingCount);
|
|
2987
|
+
}
|
|
2988
|
+
pauseAllMedia(e) {
|
|
2989
|
+
const t = e.document.querySelectorAll("audio,video");
|
|
2990
|
+
for (let r = 0; r < t.length; r++)
|
|
2991
|
+
t[r].pause();
|
|
2992
|
+
}
|
|
2993
|
+
mount(e, t) {
|
|
2994
|
+
this.comms = t, e.addEventListener(
|
|
2995
|
+
"error",
|
|
2996
|
+
this.wndOnErr,
|
|
2997
|
+
!1
|
|
2998
|
+
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
2999
|
+
value: {
|
|
3000
|
+
name: "readium-ts-toolkit",
|
|
3001
|
+
version: "1.3.2",
|
|
3002
|
+
hasFeature: (s, n = "") => {
|
|
3003
|
+
switch (s) {
|
|
3004
|
+
case "dom-manipulation":
|
|
3005
|
+
return !0;
|
|
3006
|
+
case "layout-changes":
|
|
3007
|
+
return !0;
|
|
3008
|
+
case "touch-events":
|
|
3009
|
+
return !0;
|
|
3010
|
+
case "mouse-events":
|
|
3011
|
+
return !0;
|
|
3012
|
+
case "keyboard-events":
|
|
3013
|
+
return !0;
|
|
3014
|
+
case "spine-scripting":
|
|
3015
|
+
return !0;
|
|
3016
|
+
case "embedded-web-content":
|
|
3017
|
+
return !0;
|
|
3018
|
+
default:
|
|
3019
|
+
return !1;
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
},
|
|
3023
|
+
writable: !1
|
|
3024
|
+
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
3025
|
+
s.cancel(), this.allAnimations.add(s);
|
|
3026
|
+
}), t.register("activate", be.moduleName, (s, n) => {
|
|
3027
|
+
this.allAnimations.forEach((o) => {
|
|
3028
|
+
o.cancel(), o.play();
|
|
3029
|
+
}), n(!0);
|
|
3030
|
+
}), t.register("unfocus", be.moduleName, (s, n) => {
|
|
3031
|
+
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
3032
|
+
});
|
|
3033
|
+
const r = e.document.querySelectorAll("audio,video");
|
|
3034
|
+
for (let s = 0; s < r.length; s++) {
|
|
3035
|
+
const n = r[s];
|
|
3036
|
+
n.addEventListener("play", this.onMediaPlayEvent, {
|
|
3037
|
+
passive: !0
|
|
3038
|
+
}), n.addEventListener("pause", this.onMediaPauseEvent, {
|
|
3039
|
+
passive: !0
|
|
3040
|
+
});
|
|
3008
3041
|
}
|
|
3009
|
-
return
|
|
3042
|
+
return t.log("Setup Mounted"), !0;
|
|
3010
3043
|
}
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
*/
|
|
3014
|
-
clearContainer() {
|
|
3015
|
-
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
3044
|
+
unmount(e, t) {
|
|
3045
|
+
return e.removeEventListener("error", this.wndOnErr), e.removeEventListener("play", this.onMediaPlayEvent), e.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((r) => r.cancel()), this.allAnimations.clear(), t.log("Setup Unmounted"), !0;
|
|
3016
3046
|
}
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3047
|
+
};
|
|
3048
|
+
Ct.moduleName = "setup";
|
|
3049
|
+
let Ot = Ct;
|
|
3050
|
+
const Ze = "readium-viewport", Pt = class V extends Ot {
|
|
3051
|
+
onViewportWidthChanged(e) {
|
|
3052
|
+
const t = e.target;
|
|
3053
|
+
ge(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
3021
3054
|
}
|
|
3022
|
-
|
|
3023
|
-
|
|
3055
|
+
mount(e, t) {
|
|
3056
|
+
if (!super.mount(e, t))
|
|
3057
|
+
return !1;
|
|
3058
|
+
const r = e.document.createElement("meta");
|
|
3059
|
+
return r.dataset.readium = "true", r.setAttribute("name", "viewport"), r.setAttribute("id", Ze), r.setAttribute(
|
|
3060
|
+
"content",
|
|
3061
|
+
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3062
|
+
), e.document.head.appendChild(r), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
3063
|
+
target: e
|
|
3064
|
+
}), t.register("set_property", V.moduleName, (s, n) => {
|
|
3065
|
+
const o = s;
|
|
3066
|
+
ge(e, o[0], o[1]), n(!0);
|
|
3067
|
+
}), t.register("remove_property", V.moduleName, (s, n) => {
|
|
3068
|
+
ft(e, s), n(!0);
|
|
3069
|
+
}), t.register("activate", V.moduleName, (s, n) => {
|
|
3070
|
+
this.unblock(e), n(!0);
|
|
3071
|
+
}), t.log("ReflowableSetup Mounted"), !0;
|
|
3024
3072
|
}
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
e.experimentalHighlights || e.requestLayout();
|
|
3029
|
-
});
|
|
3030
|
-
}, 50);
|
|
3073
|
+
unmount(e, t) {
|
|
3074
|
+
var r;
|
|
3075
|
+
return t.unregisterAll(V.moduleName), (r = e.document.head.querySelector(`#${Ze}`)) == null || r.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
3031
3076
|
}
|
|
3077
|
+
};
|
|
3078
|
+
Pt.moduleName = "reflowable_setup";
|
|
3079
|
+
let Ai = Pt;
|
|
3080
|
+
const Je = "readium-fixed-style", At = class L extends Ot {
|
|
3032
3081
|
mount(e, t) {
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3082
|
+
if (!super.mount(e, t))
|
|
3083
|
+
return !1;
|
|
3084
|
+
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
3085
|
+
const r = e.document.createElement("style");
|
|
3086
|
+
return r.id = Je, r.dataset.readium = "true", r.textContent = `
|
|
3087
|
+
html, body {
|
|
3088
|
+
text-size-adjust: none;
|
|
3089
|
+
-ms-text-size-adjust: none;
|
|
3090
|
+
-webkit-text-size-adjust: none;
|
|
3091
|
+
-moz-text-size-adjust: none;
|
|
3092
|
+
|
|
3093
|
+
/* Fight Safari pinches */
|
|
3094
|
+
touch-action: none !important;
|
|
3095
|
+
min-height: 100%;
|
|
3096
|
+
|
|
3097
|
+
/*cursor: var() TODO*/
|
|
3098
|
+
}`, e.document.head.appendChild(r), t.register("set_property", L.moduleName, (s, n) => {
|
|
3099
|
+
const o = s;
|
|
3100
|
+
ge(e, o[0], o[1]), n(!0);
|
|
3101
|
+
}), t.register("remove_property", L.moduleName, (s, n) => {
|
|
3102
|
+
ft(e, s), n(!0);
|
|
3103
|
+
}), t.register("first_visible_locator", L.moduleName, (s, n) => n(!1)), t.register("unfocus", L.moduleName, (s, n) => {
|
|
3104
|
+
T(e), n(!0);
|
|
3105
|
+
}), t.register([
|
|
3106
|
+
"focus",
|
|
3107
|
+
"go_next",
|
|
3108
|
+
"go_prev",
|
|
3109
|
+
"go_id",
|
|
3110
|
+
"go_end",
|
|
3111
|
+
"go_start",
|
|
3112
|
+
"go_text",
|
|
3113
|
+
"go_progression"
|
|
3114
|
+
], L.moduleName, (s, n) => n(!0)), t.register("activate", L.moduleName, (s, n) => {
|
|
3115
|
+
this.unblock(e), n(!0);
|
|
3116
|
+
}), t.log("FixedSetup Mounted"), !0;
|
|
3058
3117
|
}
|
|
3059
3118
|
unmount(e, t) {
|
|
3060
|
-
|
|
3119
|
+
var r;
|
|
3120
|
+
return t.unregisterAll(L.moduleName), (r = e.document.getElementById(Je)) == null || r.remove(), t.log("FixedSetup Unmounted"), super.unmount(e, t);
|
|
3061
3121
|
}
|
|
3062
3122
|
};
|
|
3063
|
-
At.moduleName = "
|
|
3064
|
-
let
|
|
3065
|
-
const
|
|
3123
|
+
At.moduleName = "fixed_setup";
|
|
3124
|
+
let Mi = At;
|
|
3125
|
+
const Ri = [
|
|
3066
3126
|
"fixed_setup",
|
|
3067
3127
|
"decorator",
|
|
3068
3128
|
"peripherals"
|
|
3069
|
-
],
|
|
3129
|
+
], Ni = [
|
|
3070
3130
|
"reflowable_setup",
|
|
3071
3131
|
"decorator",
|
|
3072
3132
|
"peripherals",
|
|
3073
3133
|
"column_snapper",
|
|
3074
3134
|
"scroll_snapper"
|
|
3075
|
-
],
|
|
3135
|
+
], Ke = new Map([
|
|
3076
3136
|
// All modules go here
|
|
3077
|
-
|
|
3137
|
+
Mi,
|
|
3138
|
+
Ai,
|
|
3139
|
+
St,
|
|
3078
3140
|
gi,
|
|
3079
|
-
|
|
3080
|
-
Pi
|
|
3081
|
-
ci,
|
|
3082
|
-
fi
|
|
3141
|
+
Ti,
|
|
3142
|
+
Pi
|
|
3083
3143
|
].map((i) => [i.moduleName, i]));
|
|
3084
|
-
class
|
|
3144
|
+
class Li {
|
|
3085
3145
|
/**
|
|
3086
3146
|
* @param wnd Window instance to operate on
|
|
3087
3147
|
* @param initialModules List of initial modules to load
|
|
3088
3148
|
*/
|
|
3089
3149
|
constructor(e = window, t = []) {
|
|
3090
|
-
this.loadedModules = [], this.wnd = e, this.comms = new
|
|
3150
|
+
this.loadedModules = [], this.wnd = e, this.comms = new Nt(e);
|
|
3091
3151
|
const r = [...new Set(t)];
|
|
3092
3152
|
if (r.length) {
|
|
3093
3153
|
if (typeof e > "u")
|
|
@@ -3100,7 +3160,7 @@ class Mi {
|
|
|
3100
3160
|
}
|
|
3101
3161
|
}
|
|
3102
3162
|
loadModule(e) {
|
|
3103
|
-
const t =
|
|
3163
|
+
const t = Ke.get(e);
|
|
3104
3164
|
return t === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), t) : new t();
|
|
3105
3165
|
}
|
|
3106
3166
|
/**
|
|
@@ -3118,7 +3178,7 @@ class Mi {
|
|
|
3118
3178
|
* @returns Success
|
|
3119
3179
|
*/
|
|
3120
3180
|
removeModule(e) {
|
|
3121
|
-
const t =
|
|
3181
|
+
const t = Ke.get(e);
|
|
3122
3182
|
if (t === void 0)
|
|
3123
3183
|
return this.comms.log(`Module "${e}" does not exist in the library`), !1;
|
|
3124
3184
|
const r = this.loadedModules.findIndex((s) => s instanceof t);
|
|
@@ -3132,13 +3192,16 @@ class Mi {
|
|
|
3132
3192
|
}
|
|
3133
3193
|
}
|
|
3134
3194
|
export {
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3195
|
+
_ as COMMS_VERSION,
|
|
3196
|
+
Nt as Comms,
|
|
3197
|
+
gi as Decorator,
|
|
3198
|
+
Ri as FXLModules,
|
|
3199
|
+
pi as Layout,
|
|
3200
|
+
Li as Loader,
|
|
3139
3201
|
ce as Module,
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3202
|
+
Ke as ModuleLibrary,
|
|
3203
|
+
St as Peripherals,
|
|
3204
|
+
Ni as ReflowableModules,
|
|
3205
|
+
di as Width,
|
|
3206
|
+
Rt as mid
|
|
3144
3207
|
};
|