@readium/navigator-html-injectables 1.3.1 → 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 +1153 -1148
- package/dist/index.umd.cjs +15 -15
- package/package.json +1 -1
- package/src/modules/index.ts +1 -0
- package/types/src/modules/index.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -95,341 +95,7 @@ class Nt {
|
|
|
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
|
-
}, Dt = 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
|
-
}, Re = 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
|
-
}, Bt = 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
|
-
}, V = typeof window < "u" ? window : {}, Q = /* @__PURE__ */ new WeakMap(), Ne = /auto|scroll/, Wt = /^tb|vertical/, Ft = /msie|trident/i.test(V.navigator && V.navigator.userAgent), R = function(i) {
|
|
165
|
-
return parseFloat(i || "0");
|
|
166
|
-
}, H = function(i, e, t) {
|
|
167
|
-
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new Dt((t ? e : i) || 0, (t ? i : e) || 0);
|
|
168
|
-
}, Le = k({
|
|
169
|
-
devicePixelContentBoxSize: H(),
|
|
170
|
-
borderBoxSize: H(),
|
|
171
|
-
contentBoxSize: H(),
|
|
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 && Ne.test(t.overflowY || ""), a = !r && Ne.test(t.overflowX || ""), h = r ? 0 : R(t.paddingTop), c = r ? 0 : R(t.paddingRight), d = r ? 0 : R(t.paddingBottom), p = r ? 0 : R(t.paddingLeft), u = 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 + d, S = g + f, m = u + 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({
|
|
179
|
-
devicePixelContentBoxSize: H(Math.round(D * devicePixelRatio), Math.round(B * devicePixelRatio), n),
|
|
180
|
-
borderBoxSize: H(J, K, n),
|
|
181
|
-
contentBoxSize: H(D, B, n),
|
|
182
|
-
contentRect: new Qe(p, h, D, B)
|
|
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
|
-
}, Ht = function() {
|
|
232
|
-
var i = 0;
|
|
233
|
-
for (ze(i); Lt(); )
|
|
234
|
-
i = Ut(), ze(i);
|
|
235
|
-
return zt() && It(), i > 0;
|
|
236
|
-
}, de, st = [], $t = 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 $t();
|
|
245
|
-
}).observe(t, r), de = function() {
|
|
246
|
-
t.textContent = "".concat(e ? e-- : e++);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
st.push(i), de();
|
|
250
|
-
}, _t = function(i) {
|
|
251
|
-
qt(function() {
|
|
252
|
-
requestAnimationFrame(i);
|
|
253
|
-
});
|
|
254
|
-
}, re = 0, jt = function() {
|
|
255
|
-
return !!re;
|
|
256
|
-
}, Vt = 250, Xt = { 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
|
-
], De = 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 = Vt), !ue) {
|
|
283
|
-
ue = !0;
|
|
284
|
-
var r = De(e);
|
|
285
|
-
_t(function() {
|
|
286
|
-
var s = !1;
|
|
287
|
-
try {
|
|
288
|
-
s = Ht();
|
|
289
|
-
} finally {
|
|
290
|
-
if (ue = !1, e = r - De(), !jt())
|
|
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, Xt);
|
|
301
|
-
};
|
|
302
|
-
document.body ? t() : V.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 V.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 V.removeEventListener(t, e.listener, !0);
|
|
312
|
-
}), this.stopped = !0);
|
|
313
|
-
}, i;
|
|
314
|
-
}(), fe = new Gt(), Be = function(i) {
|
|
315
|
-
!re && i > 0 && fe.start(), re += i, !re && fe.stop();
|
|
316
|
-
}, Yt = function(i) {
|
|
317
|
-
return !Ee(i) && !Bt(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
|
-
}(), Jt = 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 Jt(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)), Be(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), Be(-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 (!Re(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 (!Re(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 Kt(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);
|
|
@@ -950,7 +616,7 @@ class l {
|
|
|
950
616
|
});
|
|
951
617
|
}
|
|
952
618
|
}
|
|
953
|
-
class
|
|
619
|
+
class Me {
|
|
954
620
|
constructor(e) {
|
|
955
621
|
this.uri = e, this.parameters = this.getParameters(e);
|
|
956
622
|
}
|
|
@@ -978,22 +644,22 @@ class ke {
|
|
|
978
644
|
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? r(s[2]) : t(s[2]));
|
|
979
645
|
}
|
|
980
646
|
}
|
|
981
|
-
function
|
|
647
|
+
function Lt(i) {
|
|
982
648
|
return i && i instanceof Array ? i : void 0;
|
|
983
649
|
}
|
|
984
|
-
function
|
|
985
|
-
return i && typeof i == "string" ? [i] :
|
|
650
|
+
function Qe(i) {
|
|
651
|
+
return i && typeof i == "string" ? [i] : Lt(i);
|
|
986
652
|
}
|
|
987
|
-
function
|
|
653
|
+
function Re(i) {
|
|
988
654
|
return typeof i == "string" ? new Date(i) : void 0;
|
|
989
655
|
}
|
|
990
|
-
function
|
|
656
|
+
function re(i) {
|
|
991
657
|
return isNaN(i) ? void 0 : i;
|
|
992
658
|
}
|
|
993
659
|
function O(i) {
|
|
994
|
-
return
|
|
660
|
+
return re(i) !== void 0 && Math.sign(i) >= 0 ? i : void 0;
|
|
995
661
|
}
|
|
996
|
-
function
|
|
662
|
+
function zt(i) {
|
|
997
663
|
const e = new Array();
|
|
998
664
|
return i.forEach((t) => e.push(t)), e;
|
|
999
665
|
}
|
|
@@ -1010,7 +676,7 @@ class w {
|
|
|
1010
676
|
static deserialize(e) {
|
|
1011
677
|
if (!e)
|
|
1012
678
|
return;
|
|
1013
|
-
const t =
|
|
679
|
+
const t = re(e.progression), r = re(e.totalProgression), s = re(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
1014
680
|
"fragment",
|
|
1015
681
|
"fragments",
|
|
1016
682
|
"progression",
|
|
@@ -1020,7 +686,7 @@ class w {
|
|
|
1020
686
|
return Object.entries(e).forEach(([a, h]) => {
|
|
1021
687
|
o.has(a) || n.set(a, h);
|
|
1022
688
|
}), new w({
|
|
1023
|
-
fragments:
|
|
689
|
+
fragments: Qe(e.fragments || e.fragment),
|
|
1024
690
|
progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
|
|
1025
691
|
totalProgression: r !== void 0 && r >= 0 && r <= 1 ? r : void 0,
|
|
1026
692
|
position: s !== void 0 && s > 0 ? s : void 0,
|
|
@@ -1101,7 +767,7 @@ class I {
|
|
|
1101
767
|
});
|
|
1102
768
|
}
|
|
1103
769
|
}
|
|
1104
|
-
class
|
|
770
|
+
class H {
|
|
1105
771
|
/**
|
|
1106
772
|
* Creates a [Link].
|
|
1107
773
|
*/
|
|
@@ -1113,7 +779,7 @@ class $ {
|
|
|
1113
779
|
*/
|
|
1114
780
|
static deserialize(e) {
|
|
1115
781
|
if (e && e.href && typeof e.href == "string")
|
|
1116
|
-
return new
|
|
782
|
+
return new H({
|
|
1117
783
|
href: e.href,
|
|
1118
784
|
templated: e.templated,
|
|
1119
785
|
type: e.type,
|
|
@@ -1124,7 +790,7 @@ class $ {
|
|
|
1124
790
|
width: O(e.width),
|
|
1125
791
|
duration: O(e.duration),
|
|
1126
792
|
bitrate: O(e.bitrate),
|
|
1127
|
-
languages:
|
|
793
|
+
languages: Qe(e.language),
|
|
1128
794
|
alternates: ne.deserialize(e.alternate),
|
|
1129
795
|
children: ne.deserialize(e.children)
|
|
1130
796
|
});
|
|
@@ -1134,7 +800,7 @@ class $ {
|
|
|
1134
800
|
*/
|
|
1135
801
|
serialize() {
|
|
1136
802
|
const e = { href: this.href };
|
|
1137
|
-
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;
|
|
1138
804
|
}
|
|
1139
805
|
/** MediaType of the linked resource. */
|
|
1140
806
|
get mediaType() {
|
|
@@ -1152,14 +818,14 @@ class $ {
|
|
|
1152
818
|
}
|
|
1153
819
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
1154
820
|
get templateParameters() {
|
|
1155
|
-
return this.templated ? new
|
|
821
|
+
return this.templated ? new Me(this.href).parameters : /* @__PURE__ */ new Set();
|
|
1156
822
|
}
|
|
1157
823
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
1158
824
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
1159
825
|
*/
|
|
1160
826
|
expandTemplate(e) {
|
|
1161
|
-
return new
|
|
1162
|
-
href: new
|
|
827
|
+
return new H({
|
|
828
|
+
href: new Me(this.href).expand(e),
|
|
1163
829
|
templated: !1
|
|
1164
830
|
});
|
|
1165
831
|
}
|
|
@@ -1168,7 +834,7 @@ class $ {
|
|
|
1168
834
|
*/
|
|
1169
835
|
addProperties(e) {
|
|
1170
836
|
var t;
|
|
1171
|
-
const r =
|
|
837
|
+
const r = H.deserialize(this.serialize());
|
|
1172
838
|
return r.properties = r.properties ? (t = r.properties) == null ? void 0 : t.add(e) : new b(e), r;
|
|
1173
839
|
}
|
|
1174
840
|
/**
|
|
@@ -1199,7 +865,7 @@ class ne {
|
|
|
1199
865
|
static deserialize(e) {
|
|
1200
866
|
if (e && e instanceof Array)
|
|
1201
867
|
return new ne(
|
|
1202
|
-
e.map((t) =>
|
|
868
|
+
e.map((t) => H.deserialize(t)).filter((t) => t !== void 0)
|
|
1203
869
|
);
|
|
1204
870
|
}
|
|
1205
871
|
/**
|
|
@@ -1314,7 +980,7 @@ class oe {
|
|
|
1314
980
|
return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
|
|
1315
981
|
}
|
|
1316
982
|
}
|
|
1317
|
-
class
|
|
983
|
+
class xe {
|
|
1318
984
|
/**
|
|
1319
985
|
* Creates a [DomRange].
|
|
1320
986
|
*/
|
|
@@ -1329,7 +995,7 @@ class we {
|
|
|
1329
995
|
return;
|
|
1330
996
|
let t = oe.deserialize(e.start);
|
|
1331
997
|
if (t)
|
|
1332
|
-
return new
|
|
998
|
+
return new xe({
|
|
1333
999
|
start: t,
|
|
1334
1000
|
end: oe.deserialize(e.end)
|
|
1335
1001
|
});
|
|
@@ -1352,7 +1018,7 @@ w.prototype.getPartialCfi = function() {
|
|
|
1352
1018
|
};
|
|
1353
1019
|
w.prototype.getDomRange = function() {
|
|
1354
1020
|
var i;
|
|
1355
|
-
return
|
|
1021
|
+
return xe.deserialize((i = this.otherLocations) == null ? void 0 : i.get("domRange"));
|
|
1356
1022
|
};
|
|
1357
1023
|
w.prototype.fragmentParameters = function() {
|
|
1358
1024
|
return new Map(
|
|
@@ -1390,7 +1056,7 @@ w.prototype.space = function() {
|
|
|
1390
1056
|
if (e.length === 4 && !e.some(isNaN))
|
|
1391
1057
|
return e;
|
|
1392
1058
|
};
|
|
1393
|
-
class
|
|
1059
|
+
class we {
|
|
1394
1060
|
/** Creates a [Price]. */
|
|
1395
1061
|
constructor(e) {
|
|
1396
1062
|
this.currency = e.currency, this.value = e.value;
|
|
@@ -1406,7 +1072,7 @@ class Te {
|
|
|
1406
1072
|
return;
|
|
1407
1073
|
let r = O(e.value);
|
|
1408
1074
|
if (r !== void 0)
|
|
1409
|
-
return new
|
|
1075
|
+
return new we({ currency: t, value: r });
|
|
1410
1076
|
}
|
|
1411
1077
|
/**
|
|
1412
1078
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1415,7 +1081,7 @@ class Te {
|
|
|
1415
1081
|
return { currency: this.currency, value: this.value };
|
|
1416
1082
|
}
|
|
1417
1083
|
}
|
|
1418
|
-
class
|
|
1084
|
+
class j {
|
|
1419
1085
|
/** Creates a [Acquisition]. */
|
|
1420
1086
|
constructor(e) {
|
|
1421
1087
|
this.type = e.type, this.children = e.children;
|
|
@@ -1425,14 +1091,14 @@ class X {
|
|
|
1425
1091
|
*/
|
|
1426
1092
|
static deserialize(e) {
|
|
1427
1093
|
if (e && e.type)
|
|
1428
|
-
return new
|
|
1094
|
+
return new j({
|
|
1429
1095
|
type: e.type,
|
|
1430
|
-
children:
|
|
1096
|
+
children: j.deserializeArray(e.children)
|
|
1431
1097
|
});
|
|
1432
1098
|
}
|
|
1433
1099
|
static deserializeArray(e) {
|
|
1434
1100
|
if (e instanceof Array)
|
|
1435
|
-
return e.map((t) =>
|
|
1101
|
+
return e.map((t) => j.deserialize(t)).filter((t) => t !== void 0);
|
|
1436
1102
|
}
|
|
1437
1103
|
/**
|
|
1438
1104
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1442,7 +1108,7 @@ class X {
|
|
|
1442
1108
|
return this.children && (e.children = this.children.map((t) => t.serialize())), e;
|
|
1443
1109
|
}
|
|
1444
1110
|
}
|
|
1445
|
-
class
|
|
1111
|
+
class Te {
|
|
1446
1112
|
/** Creates a [Price]. */
|
|
1447
1113
|
constructor(e) {
|
|
1448
1114
|
this.total = e.total, this.position = e.position;
|
|
@@ -1452,7 +1118,7 @@ class Se {
|
|
|
1452
1118
|
*/
|
|
1453
1119
|
static deserialize(e) {
|
|
1454
1120
|
if (e)
|
|
1455
|
-
return new
|
|
1121
|
+
return new Te({
|
|
1456
1122
|
total: O(e.total),
|
|
1457
1123
|
position: O(e.position)
|
|
1458
1124
|
});
|
|
@@ -1465,7 +1131,7 @@ class Se {
|
|
|
1465
1131
|
return this.total !== void 0 && (e.total = this.total), this.position !== void 0 && (e.position = this.position), e;
|
|
1466
1132
|
}
|
|
1467
1133
|
}
|
|
1468
|
-
class
|
|
1134
|
+
class Se {
|
|
1469
1135
|
/** Creates a [Copies]. */
|
|
1470
1136
|
constructor(e) {
|
|
1471
1137
|
this.total = e.total, this.available = e.available;
|
|
@@ -1475,7 +1141,7 @@ class Ce {
|
|
|
1475
1141
|
*/
|
|
1476
1142
|
static deserialize(e) {
|
|
1477
1143
|
if (e)
|
|
1478
|
-
return new
|
|
1144
|
+
return new Se({
|
|
1479
1145
|
total: O(e.total),
|
|
1480
1146
|
available: O(e.available)
|
|
1481
1147
|
});
|
|
@@ -1488,7 +1154,7 @@ class Ce {
|
|
|
1488
1154
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1489
1155
|
}
|
|
1490
1156
|
}
|
|
1491
|
-
class
|
|
1157
|
+
class Ce {
|
|
1492
1158
|
/** Creates a [Availability]. */
|
|
1493
1159
|
constructor(e) {
|
|
1494
1160
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1498,10 +1164,10 @@ class Oe {
|
|
|
1498
1164
|
*/
|
|
1499
1165
|
static deserialize(e) {
|
|
1500
1166
|
if (e && e.state)
|
|
1501
|
-
return new
|
|
1167
|
+
return new Ce({
|
|
1502
1168
|
state: e.state,
|
|
1503
|
-
since:
|
|
1504
|
-
until:
|
|
1169
|
+
since: Re(e.since),
|
|
1170
|
+
until: Re(e.until)
|
|
1505
1171
|
});
|
|
1506
1172
|
}
|
|
1507
1173
|
/**
|
|
@@ -1516,24 +1182,24 @@ b.prototype.getNumberOfItems = function() {
|
|
|
1516
1182
|
return O(this.otherProperties.numberOfItems);
|
|
1517
1183
|
};
|
|
1518
1184
|
b.prototype.getPrice = function() {
|
|
1519
|
-
return
|
|
1185
|
+
return we.deserialize(this.otherProperties.price);
|
|
1520
1186
|
};
|
|
1521
1187
|
b.prototype.getIndirectAcquisitions = function() {
|
|
1522
1188
|
const i = this.otherProperties.indirectAcquisition;
|
|
1523
1189
|
if (i && i instanceof Array)
|
|
1524
|
-
return i.map((e) =>
|
|
1190
|
+
return i.map((e) => j.deserialize(e)).filter((e) => e !== void 0);
|
|
1525
1191
|
};
|
|
1526
1192
|
b.prototype.getHolds = function() {
|
|
1527
|
-
return
|
|
1193
|
+
return Te.deserialize(this.otherProperties.holds);
|
|
1528
1194
|
};
|
|
1529
1195
|
b.prototype.getCopies = function() {
|
|
1530
|
-
return
|
|
1196
|
+
return Se.deserialize(this.otherProperties.copies);
|
|
1531
1197
|
};
|
|
1532
1198
|
b.prototype.getAvailability = function() {
|
|
1533
|
-
return
|
|
1199
|
+
return Ce.deserialize(this.otherProperties.availability);
|
|
1534
1200
|
};
|
|
1535
1201
|
b.prototype.getAuthenticate = function() {
|
|
1536
|
-
return
|
|
1202
|
+
return H.deserialize(this.otherProperties.authenticate);
|
|
1537
1203
|
};
|
|
1538
1204
|
b.prototype.getClipped = function() {
|
|
1539
1205
|
return this.otherProperties.clipped;
|
|
@@ -1553,31 +1219,33 @@ b.prototype.getPage = function() {
|
|
|
1553
1219
|
b.prototype.getSpread = function() {
|
|
1554
1220
|
return this.otherProperties.spread || void 0;
|
|
1555
1221
|
};
|
|
1556
|
-
|
|
1222
|
+
class ce {
|
|
1223
|
+
}
|
|
1224
|
+
function Ne(i) {
|
|
1557
1225
|
return i.split("").reverse().join("");
|
|
1558
1226
|
}
|
|
1559
|
-
function
|
|
1560
|
-
const r =
|
|
1227
|
+
function It(i, e, t) {
|
|
1228
|
+
const r = Ne(e);
|
|
1561
1229
|
return t.map((s) => {
|
|
1562
|
-
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));
|
|
1563
1231
|
return {
|
|
1564
|
-
start:
|
|
1232
|
+
start: et(o, r, s.errors).reduce((h, c) => s.end - c.end < h ? s.end - c.end : h, s.end),
|
|
1565
1233
|
end: s.end,
|
|
1566
1234
|
errors: s.errors
|
|
1567
1235
|
};
|
|
1568
1236
|
});
|
|
1569
1237
|
}
|
|
1570
|
-
function
|
|
1238
|
+
function ue(i) {
|
|
1571
1239
|
return (i | -i) >> 31 & 1;
|
|
1572
1240
|
}
|
|
1573
|
-
function
|
|
1241
|
+
function Le(i, e, t, r) {
|
|
1574
1242
|
let s = i.P[t], n = i.M[t];
|
|
1575
1243
|
const o = r >>> 31, a = e[t] | o, h = a | n, c = (a & s) + s ^ s | a;
|
|
1576
|
-
let
|
|
1577
|
-
const
|
|
1578
|
-
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;
|
|
1579
1247
|
}
|
|
1580
|
-
function
|
|
1248
|
+
function et(i, e, t) {
|
|
1581
1249
|
if (e.length === 0)
|
|
1582
1250
|
return [];
|
|
1583
1251
|
t = Math.min(t, e.length);
|
|
@@ -1588,10 +1256,10 @@ function ct(i, e, t) {
|
|
|
1588
1256
|
};
|
|
1589
1257
|
o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % s;
|
|
1590
1258
|
const a = new Uint32Array(n + 1), h = /* @__PURE__ */ new Map(), c = [];
|
|
1591
|
-
for (let
|
|
1259
|
+
for (let d = 0; d < 256; d++)
|
|
1592
1260
|
c.push(a);
|
|
1593
|
-
for (let
|
|
1594
|
-
const f = e.charCodeAt(
|
|
1261
|
+
for (let d = 0; d < e.length; d += 1) {
|
|
1262
|
+
const f = e.charCodeAt(d);
|
|
1595
1263
|
if (h.has(f))
|
|
1596
1264
|
continue;
|
|
1597
1265
|
const v = new Uint32Array(n + 1);
|
|
@@ -1606,45 +1274,45 @@ function ct(i, e, t) {
|
|
|
1606
1274
|
}
|
|
1607
1275
|
}
|
|
1608
1276
|
}
|
|
1609
|
-
let
|
|
1277
|
+
let u = Math.max(0, Math.ceil(t / s) - 1);
|
|
1610
1278
|
const p = new Uint32Array(n + 1);
|
|
1611
|
-
for (let
|
|
1612
|
-
p[
|
|
1279
|
+
for (let d = 0; d <= u; d += 1)
|
|
1280
|
+
p[d] = (d + 1) * s;
|
|
1613
1281
|
p[n] = e.length;
|
|
1614
|
-
for (let
|
|
1615
|
-
o.P[
|
|
1616
|
-
for (let
|
|
1617
|
-
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);
|
|
1618
1286
|
let v;
|
|
1619
1287
|
f < c.length ? v = c[f] : (v = h.get(f), typeof v > "u" && (v = a));
|
|
1620
1288
|
let g = 0;
|
|
1621
|
-
for (let y = 0; y <=
|
|
1622
|
-
g =
|
|
1623
|
-
if (p[
|
|
1624
|
-
|
|
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;
|
|
1625
1293
|
let y;
|
|
1626
|
-
if (
|
|
1294
|
+
if (u === n) {
|
|
1627
1295
|
const x = e.length % s;
|
|
1628
1296
|
y = x === 0 ? s : x;
|
|
1629
1297
|
} else
|
|
1630
1298
|
y = s;
|
|
1631
|
-
p[
|
|
1299
|
+
p[u] = p[u - 1] + y - g + Le(o, v, u, g);
|
|
1632
1300
|
} else
|
|
1633
|
-
for (;
|
|
1634
|
-
|
|
1635
|
-
|
|
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({
|
|
1636
1304
|
start: -1,
|
|
1637
|
-
end:
|
|
1638
|
-
errors: p[
|
|
1639
|
-
}), t = p[
|
|
1305
|
+
end: d + 1,
|
|
1306
|
+
errors: p[u]
|
|
1307
|
+
}), t = p[u]);
|
|
1640
1308
|
}
|
|
1641
1309
|
return r;
|
|
1642
1310
|
}
|
|
1643
|
-
function
|
|
1644
|
-
const r =
|
|
1645
|
-
return
|
|
1311
|
+
function Dt(i, e, t) {
|
|
1312
|
+
const r = et(i, e, t);
|
|
1313
|
+
return It(i, e, r);
|
|
1646
1314
|
}
|
|
1647
|
-
function
|
|
1315
|
+
function tt(i, e, t) {
|
|
1648
1316
|
let r = 0;
|
|
1649
1317
|
const s = [];
|
|
1650
1318
|
for (; r !== -1; )
|
|
@@ -1653,31 +1321,31 @@ function dt(i, e, t) {
|
|
|
1653
1321
|
end: r + e.length,
|
|
1654
1322
|
errors: 0
|
|
1655
1323
|
}), r += 1);
|
|
1656
|
-
return s.length > 0 ? s :
|
|
1324
|
+
return s.length > 0 ? s : Dt(i, e, t);
|
|
1657
1325
|
}
|
|
1658
|
-
function
|
|
1659
|
-
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;
|
|
1660
1328
|
}
|
|
1661
|
-
function
|
|
1329
|
+
function Bt(i, e, t = {}) {
|
|
1662
1330
|
if (e.length === 0)
|
|
1663
1331
|
return null;
|
|
1664
|
-
const r = Math.min(256, e.length / 2), s =
|
|
1332
|
+
const r = Math.min(256, e.length / 2), s = tt(i, e, r);
|
|
1665
1333
|
if (s.length === 0)
|
|
1666
1334
|
return null;
|
|
1667
1335
|
const n = (a) => {
|
|
1668
|
-
const
|
|
1336
|
+
const d = 1 - a.errors / e.length, f = t.prefix ? ze(
|
|
1669
1337
|
i.slice(
|
|
1670
1338
|
Math.max(0, a.start - t.prefix.length),
|
|
1671
1339
|
a.start
|
|
1672
1340
|
),
|
|
1673
1341
|
t.prefix
|
|
1674
|
-
) : 1, v = t.suffix ?
|
|
1342
|
+
) : 1, v = t.suffix ? ze(
|
|
1675
1343
|
i.slice(a.end, a.end + t.suffix.length),
|
|
1676
1344
|
t.suffix
|
|
1677
1345
|
) : 1;
|
|
1678
1346
|
let g = 1;
|
|
1679
1347
|
typeof t.hint == "number" && (g = 1 - Math.abs(a.start - t.hint) / i.length);
|
|
1680
|
-
const y = 50 *
|
|
1348
|
+
const y = 50 * d + 20 * f + 20 * v + 2 * g, x = 50 + 20 + 20 + 2;
|
|
1681
1349
|
return y / x;
|
|
1682
1350
|
}, o = s.map((a) => ({
|
|
1683
1351
|
start: a.start,
|
|
@@ -1686,7 +1354,7 @@ function si(i, e, t = {}) {
|
|
|
1686
1354
|
}));
|
|
1687
1355
|
return o.sort((a, h) => h.score - a.score), o[0];
|
|
1688
1356
|
}
|
|
1689
|
-
function
|
|
1357
|
+
function fe(i, e, t) {
|
|
1690
1358
|
const r = t === 1 ? e : e - 1;
|
|
1691
1359
|
if (i.charAt(r).trim() !== "")
|
|
1692
1360
|
return e;
|
|
@@ -1696,7 +1364,7 @@ function ge(i, e, t) {
|
|
|
1696
1364
|
const o = s.length - n.length;
|
|
1697
1365
|
return t === 2 ? e - o : e + o;
|
|
1698
1366
|
}
|
|
1699
|
-
function
|
|
1367
|
+
function Ie(i, e) {
|
|
1700
1368
|
const t = i.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1701
1369
|
i.commonAncestorContainer,
|
|
1702
1370
|
NodeFilter.SHOW_TEXT
|
|
@@ -1709,7 +1377,7 @@ function _e(i, e) {
|
|
|
1709
1377
|
const a = () => {
|
|
1710
1378
|
if (n = e === 1 ? t.nextNode() : t.previousNode(), n) {
|
|
1711
1379
|
const h = n.textContent, c = e === 1 ? 0 : h.length;
|
|
1712
|
-
o =
|
|
1380
|
+
o = fe(h, c, e);
|
|
1713
1381
|
}
|
|
1714
1382
|
};
|
|
1715
1383
|
for (; n && o === -1 && n !== s; )
|
|
@@ -1718,7 +1386,7 @@ function _e(i, e) {
|
|
|
1718
1386
|
return { node: n, offset: o };
|
|
1719
1387
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1720
1388
|
}
|
|
1721
|
-
function
|
|
1389
|
+
function Wt(i) {
|
|
1722
1390
|
if (!i.toString().trim().length)
|
|
1723
1391
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1724
1392
|
if (i.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1728,13 +1396,13 @@ function ni(i) {
|
|
|
1728
1396
|
const e = i.cloneRange();
|
|
1729
1397
|
let t = !1, r = !1;
|
|
1730
1398
|
const s = {
|
|
1731
|
-
start:
|
|
1399
|
+
start: fe(
|
|
1732
1400
|
i.startContainer.textContent,
|
|
1733
1401
|
i.startOffset,
|
|
1734
1402
|
1
|
|
1735
1403
|
/* Forwards */
|
|
1736
1404
|
),
|
|
1737
|
-
end:
|
|
1405
|
+
end: fe(
|
|
1738
1406
|
i.endContainer.textContent,
|
|
1739
1407
|
i.endOffset,
|
|
1740
1408
|
2
|
|
@@ -1744,7 +1412,7 @@ function ni(i) {
|
|
|
1744
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)
|
|
1745
1413
|
return e;
|
|
1746
1414
|
if (!t) {
|
|
1747
|
-
const { node: n, offset: o } =
|
|
1415
|
+
const { node: n, offset: o } = Ie(
|
|
1748
1416
|
e,
|
|
1749
1417
|
1
|
|
1750
1418
|
/* Forwards */
|
|
@@ -1752,7 +1420,7 @@ function ni(i) {
|
|
|
1752
1420
|
n && o >= 0 && e.setStart(n, o);
|
|
1753
1421
|
}
|
|
1754
1422
|
if (!r) {
|
|
1755
|
-
const { node: n, offset: o } =
|
|
1423
|
+
const { node: n, offset: o } = Ie(
|
|
1756
1424
|
e,
|
|
1757
1425
|
2
|
|
1758
1426
|
/* Backwards */
|
|
@@ -1761,7 +1429,7 @@ function ni(i) {
|
|
|
1761
1429
|
}
|
|
1762
1430
|
return e;
|
|
1763
1431
|
}
|
|
1764
|
-
function
|
|
1432
|
+
function it(i) {
|
|
1765
1433
|
var e;
|
|
1766
1434
|
switch (i.nodeType) {
|
|
1767
1435
|
case Node.ELEMENT_NODE:
|
|
@@ -1771,13 +1439,13 @@ function ut(i) {
|
|
|
1771
1439
|
return 0;
|
|
1772
1440
|
}
|
|
1773
1441
|
}
|
|
1774
|
-
function
|
|
1442
|
+
function De(i) {
|
|
1775
1443
|
let e = i.previousSibling, t = 0;
|
|
1776
1444
|
for (; e; )
|
|
1777
|
-
t +=
|
|
1445
|
+
t += it(e), e = e.previousSibling;
|
|
1778
1446
|
return t;
|
|
1779
1447
|
}
|
|
1780
|
-
function
|
|
1448
|
+
function rt(i, ...e) {
|
|
1781
1449
|
let t = e.shift();
|
|
1782
1450
|
const r = i.ownerDocument.createNodeIterator(
|
|
1783
1451
|
i,
|
|
@@ -1809,7 +1477,7 @@ class N {
|
|
|
1809
1477
|
throw new Error("Parent is not an ancestor of current element");
|
|
1810
1478
|
let t = this.element, r = this.offset;
|
|
1811
1479
|
for (; t !== e; )
|
|
1812
|
-
r +=
|
|
1480
|
+
r += De(t), t = t.parentElement;
|
|
1813
1481
|
return new N(t, r);
|
|
1814
1482
|
}
|
|
1815
1483
|
/**
|
|
@@ -1831,7 +1499,7 @@ class N {
|
|
|
1831
1499
|
*/
|
|
1832
1500
|
resolve(e = {}) {
|
|
1833
1501
|
try {
|
|
1834
|
-
return
|
|
1502
|
+
return rt(this.element, this.offset)[0];
|
|
1835
1503
|
} catch (t) {
|
|
1836
1504
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
1837
1505
|
const r = document.createTreeWalker(
|
|
@@ -1874,7 +1542,7 @@ class N {
|
|
|
1874
1542
|
throw new Error("Text node offset is out of range");
|
|
1875
1543
|
if (!e.parentElement)
|
|
1876
1544
|
throw new Error("Text node has no parent");
|
|
1877
|
-
const r =
|
|
1545
|
+
const r = De(e) + t;
|
|
1878
1546
|
return new N(e.parentElement, r);
|
|
1879
1547
|
}
|
|
1880
1548
|
case Node.ELEMENT_NODE: {
|
|
@@ -1882,7 +1550,7 @@ class N {
|
|
|
1882
1550
|
throw new Error("Child node offset is out of range");
|
|
1883
1551
|
let r = 0;
|
|
1884
1552
|
for (let s = 0; s < t; s++)
|
|
1885
|
-
r +=
|
|
1553
|
+
r += it(e.childNodes[s]);
|
|
1886
1554
|
return new N(e, r);
|
|
1887
1555
|
}
|
|
1888
1556
|
default:
|
|
@@ -1916,7 +1584,7 @@ class z {
|
|
|
1916
1584
|
*/
|
|
1917
1585
|
toRange() {
|
|
1918
1586
|
let e, t;
|
|
1919
|
-
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(
|
|
1920
1588
|
this.start.element,
|
|
1921
1589
|
this.start.offset,
|
|
1922
1590
|
this.end.offset
|
|
@@ -1955,7 +1623,7 @@ class z {
|
|
|
1955
1623
|
* whitespace
|
|
1956
1624
|
*/
|
|
1957
1625
|
static trimmedRange(e) {
|
|
1958
|
-
return
|
|
1626
|
+
return Wt(z.fromRange(e).toRange());
|
|
1959
1627
|
}
|
|
1960
1628
|
}
|
|
1961
1629
|
class ae {
|
|
@@ -2019,7 +1687,7 @@ class le {
|
|
|
2019
1687
|
return this.toPositionAnchor(e).toRange();
|
|
2020
1688
|
}
|
|
2021
1689
|
toPositionAnchor(e = {}) {
|
|
2022
|
-
const t = this.root.textContent, r =
|
|
1690
|
+
const t = this.root.textContent, r = Bt(t, this.exact, {
|
|
2023
1691
|
...this.context,
|
|
2024
1692
|
hint: e.hint
|
|
2025
1693
|
});
|
|
@@ -2028,11 +1696,11 @@ class le {
|
|
|
2028
1696
|
return new ae(this.root, r.start, r.end);
|
|
2029
1697
|
}
|
|
2030
1698
|
}
|
|
2031
|
-
function
|
|
1699
|
+
function Ft(i) {
|
|
2032
1700
|
const e = i.tagName.toUpperCase();
|
|
2033
1701
|
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
2034
1702
|
}
|
|
2035
|
-
function
|
|
1703
|
+
function Oe(i, e) {
|
|
2036
1704
|
try {
|
|
2037
1705
|
const t = e.locations, r = e.text;
|
|
2038
1706
|
if (r && r.highlight) {
|
|
@@ -2057,7 +1725,7 @@ function Pe(i, e) {
|
|
|
2057
1725
|
}
|
|
2058
1726
|
if (s) {
|
|
2059
1727
|
const n = i.createRange();
|
|
2060
|
-
return s.childNodes.length === 0 ||
|
|
1728
|
+
return s.childNodes.length === 0 || Ft(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
2061
1729
|
}
|
|
2062
1730
|
}
|
|
2063
1731
|
} catch (t) {
|
|
@@ -2065,14 +1733,745 @@ function Pe(i, e) {
|
|
|
2065
1733
|
}
|
|
2066
1734
|
return null;
|
|
2067
1735
|
}
|
|
2068
|
-
function
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
const
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
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;
|
|
1763
|
+
}
|
|
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;
|
|
1781
|
+
}
|
|
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
|
+
};
|
|
1792
|
+
}
|
|
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
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return Array.from(t);
|
|
1807
|
+
}
|
|
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);
|
|
1810
|
+
}
|
|
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));
|
|
1813
|
+
}
|
|
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);
|
|
1848
|
+
}
|
|
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);
|
|
1859
|
+
}
|
|
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);
|
|
1870
|
+
}
|
|
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);
|
|
1881
|
+
}
|
|
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);
|
|
1923
|
+
}
|
|
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);
|
|
1928
|
+
}
|
|
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;
|
|
1941
|
+
}
|
|
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")
|
|
1954
|
+
break;
|
|
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);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
e.container = t, e.clickableElements = Array.from(
|
|
2338
|
+
t.querySelectorAll("[data-activable='1']")
|
|
2339
|
+
), e.clickableElements.length || (e.clickableElements = Array.from(t.children));
|
|
2340
|
+
}
|
|
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)
|
|
2347
|
+
return;
|
|
2348
|
+
this.requireContainer().append(...e.map((r) => r.container).filter((r) => !!r));
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
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;
|
|
2363
|
+
}
|
|
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);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
const mt = class ve extends ce {
|
|
2372
|
+
constructor() {
|
|
2373
|
+
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2374
|
+
}
|
|
2375
|
+
cleanup() {
|
|
2376
|
+
this.groups.forEach((e) => e.clear()), this.groups.clear();
|
|
2377
|
+
}
|
|
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);
|
|
2384
|
+
}
|
|
2385
|
+
mount(e, t) {
|
|
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;
|
|
2408
|
+
}
|
|
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;
|
|
2411
|
+
}
|
|
2412
|
+
unmount(e, t) {
|
|
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;
|
|
2414
|
+
}
|
|
2415
|
+
};
|
|
2416
|
+
mt.moduleName = "decorator";
|
|
2417
|
+
let gi = mt;
|
|
2418
|
+
const Xe = "readium-snapper-style", gt = class ye extends ce {
|
|
2419
|
+
constructor() {
|
|
2420
|
+
super(...arguments), this.protected = !1;
|
|
2421
|
+
}
|
|
2422
|
+
buildStyles() {
|
|
2423
|
+
return `
|
|
2424
|
+
html, body {
|
|
2425
|
+
touch-action: manipulation;
|
|
2426
|
+
user-select: ${this.protected ? "none" : "auto"};
|
|
2427
|
+
}`;
|
|
2428
|
+
}
|
|
2429
|
+
mount(e, t) {
|
|
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;
|
|
2436
|
+
}
|
|
2437
|
+
unmount(e, t) {
|
|
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",
|
|
2076
2475
|
"canvas",
|
|
2077
2476
|
"details",
|
|
2078
2477
|
"input",
|
|
@@ -2083,12 +2482,12 @@ const ai = [
|
|
|
2083
2482
|
"textarea",
|
|
2084
2483
|
"video"
|
|
2085
2484
|
];
|
|
2086
|
-
function
|
|
2485
|
+
function bt(i) {
|
|
2087
2486
|
var e;
|
|
2088
|
-
return
|
|
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;
|
|
2089
2488
|
}
|
|
2090
|
-
function
|
|
2091
|
-
const t =
|
|
2489
|
+
function Et(i, e) {
|
|
2490
|
+
const t = xt(i, i.document.body, e);
|
|
2092
2491
|
return new I({
|
|
2093
2492
|
href: "#",
|
|
2094
2493
|
type: "application/xhtml+xml",
|
|
@@ -2102,15 +2501,15 @@ function mt(i, e) {
|
|
|
2102
2501
|
})
|
|
2103
2502
|
});
|
|
2104
2503
|
}
|
|
2105
|
-
function
|
|
2504
|
+
function xt(i, e, t) {
|
|
2106
2505
|
for (var r = 0; r < e.children.length; r++) {
|
|
2107
2506
|
const s = e.children[r];
|
|
2108
|
-
if (!
|
|
2109
|
-
return
|
|
2507
|
+
if (!xi(s) && Ei(i, s, t))
|
|
2508
|
+
return xt(i, s, t);
|
|
2110
2509
|
}
|
|
2111
2510
|
return e;
|
|
2112
2511
|
}
|
|
2113
|
-
function
|
|
2512
|
+
function Ei(i, e, t) {
|
|
2114
2513
|
if (e === document.body || e === document.documentElement)
|
|
2115
2514
|
return !0;
|
|
2116
2515
|
if (!document || !document.documentElement || !document.body)
|
|
@@ -2118,11 +2517,11 @@ function li(i, e, t) {
|
|
|
2118
2517
|
const r = e.getBoundingClientRect();
|
|
2119
2518
|
return t ? r.bottom > 0 && r.top < i.innerHeight : r.right > 0 && r.left < i.innerWidth;
|
|
2120
2519
|
}
|
|
2121
|
-
function
|
|
2520
|
+
function xi(i) {
|
|
2122
2521
|
const e = getComputedStyle(i);
|
|
2123
2522
|
return !!(e && (e.getPropertyValue("display") != "block" || e.getPropertyValue("opacity") === "0"));
|
|
2124
2523
|
}
|
|
2125
|
-
const
|
|
2524
|
+
const Ge = "readium-column-snapper-style", wi = 200, wt = class C extends vt {
|
|
2126
2525
|
constructor() {
|
|
2127
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);
|
|
2128
2527
|
}
|
|
@@ -2158,28 +2557,28 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2158
2557
|
}
|
|
2159
2558
|
// Snaps the current offset to the page width.
|
|
2160
2559
|
snapCurrentOffset(e = !1, t = !1) {
|
|
2161
|
-
const r = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o =
|
|
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 = (
|
|
2162
2561
|
// The hurdle to overcome in order to change pages
|
|
2163
2562
|
h * (this.wnd.innerWidth / 3) * (h * n > 0 ? 2 : 1)
|
|
2164
|
-
),
|
|
2165
|
-
if (e &&
|
|
2563
|
+
), u = this.snapOffset(a + c);
|
|
2564
|
+
if (e && u !== this.scrollOffset()) {
|
|
2166
2565
|
this.snappingCancelled = !1;
|
|
2167
|
-
const p = (g, y, x, S) => x > S ? y : g + (y - g) *
|
|
2566
|
+
const p = (g, y, x, S) => x > S ? y : g + (y - g) * yi(x / S), d = (
|
|
2168
2567
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2169
|
-
|
|
2568
|
+
wi * o
|
|
2170
2569
|
);
|
|
2171
2570
|
let f;
|
|
2172
2571
|
const v = (g) => {
|
|
2173
2572
|
if (this.snappingCancelled)
|
|
2174
2573
|
return;
|
|
2175
2574
|
f || (f = g);
|
|
2176
|
-
const y = g - f, x = p(this.overscroll, 0, y,
|
|
2177
|
-
s.scrollLeft = S, this.overscroll !== 0 && (s.style.transform = `translate3d(${-x}px, 0px, 0px)`), y <
|
|
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());
|
|
2178
2577
|
};
|
|
2179
2578
|
this.wnd.requestAnimationFrame(v);
|
|
2180
2579
|
} else
|
|
2181
2580
|
s.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
|
|
2182
|
-
s.scrollLeft =
|
|
2581
|
+
s.scrollLeft = u, this.clearTouches(), t || this.reportProgress();
|
|
2183
2582
|
});
|
|
2184
2583
|
}
|
|
2185
2584
|
dragOffset() {
|
|
@@ -2224,7 +2623,7 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2224
2623
|
return !1;
|
|
2225
2624
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2226
2625
|
const r = e.document.createElement("style");
|
|
2227
|
-
r.dataset.readium = "true", r.id =
|
|
2626
|
+
r.dataset.readium = "true", r.id = Ge, r.textContent = `
|
|
2228
2627
|
@keyframes readium-bounce-l-animation {
|
|
2229
2628
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2230
2629
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2259,9 +2658,9 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2259
2658
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2260
2659
|
}
|
|
2261
2660
|
`, e.document.head.appendChild(r);
|
|
2262
|
-
const s = e.ResizeObserver ||
|
|
2661
|
+
const s = e.ResizeObserver || pt;
|
|
2263
2662
|
this.resizeObserver = new s(() => e.requestAnimationFrame(() => {
|
|
2264
|
-
e &&
|
|
2663
|
+
e && vi(e);
|
|
2265
2664
|
})), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver(() => {
|
|
2266
2665
|
this.wnd.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
2267
2666
|
}), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] });
|
|
@@ -2279,7 +2678,7 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2279
2678
|
}
|
|
2280
2679
|
this.wnd.requestAnimationFrame(() => {
|
|
2281
2680
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2282
|
-
const c = this.cachedScrollWidth,
|
|
2681
|
+
const c = this.cachedScrollWidth, u = W(e) ? -1 : 1, p = c * h * u;
|
|
2283
2682
|
this.doc().scrollLeft = this.snapOffset(p), this.reportProgress(), T(this.wnd), a(!0);
|
|
2284
2683
|
});
|
|
2285
2684
|
}), t.register("go_id", C.moduleName, (o, a) => {
|
|
@@ -2294,7 +2693,7 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2294
2693
|
}), t.register("go_text", C.moduleName, (o, a) => {
|
|
2295
2694
|
let h;
|
|
2296
2695
|
Array.isArray(o) && (o.length > 1 && (h = o[1]), o = o[0]);
|
|
2297
|
-
const c = q.deserialize(o),
|
|
2696
|
+
const c = q.deserialize(o), u = Oe(this.wnd.document, new I({
|
|
2298
2697
|
href: e.location.href,
|
|
2299
2698
|
type: "text/html",
|
|
2300
2699
|
text: c,
|
|
@@ -2304,12 +2703,12 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2304
2703
|
])
|
|
2305
2704
|
}) : void 0
|
|
2306
2705
|
}));
|
|
2307
|
-
if (!
|
|
2706
|
+
if (!u) {
|
|
2308
2707
|
a(!1);
|
|
2309
2708
|
return;
|
|
2310
2709
|
}
|
|
2311
2710
|
this.wnd.requestAnimationFrame(() => {
|
|
2312
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2711
|
+
this.doc().scrollLeft = this.snapOffset(u.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), a(!0);
|
|
2313
2712
|
});
|
|
2314
2713
|
}), t.register("go_end", C.moduleName, (o, a) => {
|
|
2315
2714
|
const h = W(e) ? -1 : 1;
|
|
@@ -2328,13 +2727,13 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2328
2727
|
});
|
|
2329
2728
|
}), t.register("go_prev", C.moduleName, (o, a) => {
|
|
2330
2729
|
this.wnd.requestAnimationFrame(() => {
|
|
2331
|
-
const h = e.scrollX - e.innerWidth, c = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0,
|
|
2332
|
-
|
|
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);
|
|
2333
2732
|
});
|
|
2334
2733
|
}), t.register("go_next", C.moduleName, (o, a) => {
|
|
2335
2734
|
this.wnd.requestAnimationFrame(() => {
|
|
2336
|
-
const h = e.scrollX + e.innerWidth, c = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth,
|
|
2337
|
-
|
|
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);
|
|
2338
2737
|
});
|
|
2339
2738
|
}), t.register("unfocus", C.moduleName, (o, a) => {
|
|
2340
2739
|
this.snappingCancelled = !0, T(this.wnd), a(!0);
|
|
@@ -2345,44 +2744,44 @@ const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
|
2345
2744
|
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), a(!0);
|
|
2346
2745
|
});
|
|
2347
2746
|
}), t.register("first_visible_locator", C.moduleName, (o, a) => {
|
|
2348
|
-
const h =
|
|
2747
|
+
const h = Et(e, !1);
|
|
2349
2748
|
this.comms.send("first_visible_locator", h.serialize()), a(!0);
|
|
2350
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", () => {
|
|
2351
2750
|
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2352
2751
|
}
|
|
2353
2752
|
unmount(e, t) {
|
|
2354
2753
|
var r;
|
|
2355
|
-
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(
|
|
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);
|
|
2356
2755
|
}
|
|
2357
2756
|
};
|
|
2358
|
-
|
|
2359
|
-
let
|
|
2757
|
+
wt.moduleName = "column_snapper";
|
|
2758
|
+
let Ti = wt;
|
|
2360
2759
|
const he = {
|
|
2361
2760
|
top: "js-iframe-reader-top-anchor",
|
|
2362
2761
|
bottom: "js-iframe-reader-bottom-anchor"
|
|
2363
2762
|
};
|
|
2364
|
-
class
|
|
2763
|
+
class Si extends HTMLElement {
|
|
2365
2764
|
connectedCallback() {
|
|
2366
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");
|
|
2367
2766
|
}
|
|
2368
2767
|
}
|
|
2369
|
-
function
|
|
2768
|
+
function Ci(i) {
|
|
2370
2769
|
const e = i.getElementsByTagName("body")[0], t = document.createElement("anchor-observer"), r = document.createElement("anchor-observer");
|
|
2371
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);
|
|
2372
2771
|
}
|
|
2373
|
-
function
|
|
2772
|
+
function Oi(i) {
|
|
2374
2773
|
var s, n;
|
|
2375
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}`);
|
|
2376
2775
|
t && ((s = t.parentElement) == null || s.removeChild(t)), r && ((n = r.parentElement) == null || n.removeChild(r));
|
|
2377
2776
|
}
|
|
2378
|
-
const
|
|
2777
|
+
const Ye = "readium-scroll-snapper-style", Tt = class M extends vt {
|
|
2379
2778
|
constructor() {
|
|
2380
2779
|
super(...arguments), this.createAnchorElements = () => {
|
|
2381
|
-
|
|
2780
|
+
Ci(this.doc());
|
|
2382
2781
|
}, this.removeAnchorElements = () => {
|
|
2383
|
-
|
|
2782
|
+
Oi(this.doc());
|
|
2384
2783
|
}, this.createCustomElement = () => {
|
|
2385
|
-
customElements.get("anchor-observer") || customElements.define("anchor-observer",
|
|
2784
|
+
customElements.get("anchor-observer") || customElements.define("anchor-observer", Si);
|
|
2386
2785
|
};
|
|
2387
2786
|
}
|
|
2388
2787
|
doc() {
|
|
@@ -2394,7 +2793,7 @@ const Xe = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2394
2793
|
mount(e, t) {
|
|
2395
2794
|
this.wnd = e, this.comms = t, e.navigator.epubReadingSystem.layoutStyle = "scrolling";
|
|
2396
2795
|
const r = e.document.createElement("style");
|
|
2397
|
-
return r.dataset.readium = "true", r.id =
|
|
2796
|
+
return r.dataset.readium = "true", r.id = Ye, r.textContent = `
|
|
2398
2797
|
* {
|
|
2399
2798
|
scrollbar-width: none; /* for Firefox */
|
|
2400
2799
|
}
|
|
@@ -2427,7 +2826,7 @@ const Xe = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2427
2826
|
}), t.register("go_text", M.moduleName, (s, n) => {
|
|
2428
2827
|
let o;
|
|
2429
2828
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2430
|
-
const a = q.deserialize(s), h =
|
|
2829
|
+
const a = q.deserialize(s), h = Oe(this.wnd.document, new I({
|
|
2431
2830
|
href: e.location.href,
|
|
2432
2831
|
type: "text/html",
|
|
2433
2832
|
text: a,
|
|
@@ -2453,678 +2852,281 @@ const Xe = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2453
2852
|
}), t.register("go_end", M.moduleName, (s, n) => {
|
|
2454
2853
|
if (this.doc().scrollTop === 0)
|
|
2455
2854
|
return n(!1);
|
|
2456
|
-
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2457
|
-
}), t.register("unfocus", M.moduleName, (s, n) => {
|
|
2458
|
-
T(this.wnd), n(!0);
|
|
2459
|
-
}), t.register([
|
|
2460
|
-
"go_next",
|
|
2461
|
-
"go_prev"
|
|
2462
|
-
], M.moduleName, (s, n) => n(!1)), t.register("focus", M.moduleName, (s, n) => {
|
|
2463
|
-
const o = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2464
|
-
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2465
|
-
}), t.register("first_visible_locator", M.moduleName, (s, n) => {
|
|
2466
|
-
const o =
|
|
2467
|
-
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2468
|
-
}), t.log("ScrollSnapper Mounted"), this.createCustomElement(), this.createAnchorElements(), !0;
|
|
2469
|
-
}
|
|
2470
|
-
unmount(e, t) {
|
|
2471
|
-
var r;
|
|
2472
|
-
return t.unregisterAll(M.moduleName), this.removeAnchorElements(), (r = e.document.getElementById(Xe)) == null || r.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2473
|
-
}
|
|
2474
|
-
};
|
|
2475
|
-
yt.moduleName = "scroll_snapper";
|
|
2476
|
-
let mi = yt;
|
|
2477
|
-
class bt extends ce {
|
|
2478
|
-
constructor() {
|
|
2479
|
-
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);
|
|
2480
|
-
}
|
|
2481
|
-
onPointUp(e) {
|
|
2482
|
-
var s, n, o, a, h;
|
|
2483
|
-
const t = this.wnd.getSelection();
|
|
2484
|
-
if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
|
|
2485
|
-
const c = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
|
|
2486
|
-
if (!c || c.length === 0)
|
|
2487
|
-
return;
|
|
2488
|
-
const d = c[0], p = {
|
|
2489
|
-
text: t.toString(),
|
|
2490
|
-
x: d.x,
|
|
2491
|
-
y: d.y,
|
|
2492
|
-
width: d.width,
|
|
2493
|
-
height: d.height,
|
|
2494
|
-
targetFrameSrc: (a = (o = this.wnd) == null ? void 0 : o.location) == null ? void 0 : a.href
|
|
2495
|
-
};
|
|
2496
|
-
this.comms.send("text_selected", p);
|
|
2497
|
-
}
|
|
2498
|
-
if (this.pointerMoved) {
|
|
2499
|
-
this.pointerMoved = !1;
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
if (!(t != null && t.isCollapsed) || !e.isPrimary)
|
|
2503
|
-
return;
|
|
2504
|
-
const r = this.wnd.devicePixelRatio;
|
|
2505
|
-
e.preventDefault(), this.comms.send(e.pointerType === "touch" ? "tap" : "click", {
|
|
2506
|
-
defaultPrevented: e.defaultPrevented,
|
|
2507
|
-
x: e.clientX * r,
|
|
2508
|
-
y: e.clientY * r,
|
|
2509
|
-
targetFrameSrc: this.wnd.location.href,
|
|
2510
|
-
targetElement: e.target.outerHTML,
|
|
2511
|
-
interactiveElement: (h = ft(e.target)) == null ? void 0 : h.outerHTML,
|
|
2512
|
-
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2513
|
-
}), this.pointerMoved = !1;
|
|
2514
|
-
}
|
|
2515
|
-
onPointMove(e) {
|
|
2516
|
-
if (e.movementY !== void 0 && e.movementX !== void 0) {
|
|
2517
|
-
(Math.abs(e.movementX) > 1 || Math.abs(e.movementY) > 1) && (this.pointerMoved = !0);
|
|
2518
|
-
return;
|
|
2519
|
-
}
|
|
2520
|
-
this.pointerMoved = !0;
|
|
2521
|
-
}
|
|
2522
|
-
onPointDown() {
|
|
2523
|
-
this.pointerMoved = !1;
|
|
2524
|
-
}
|
|
2525
|
-
onContext(e) {
|
|
2526
|
-
this.onPointUp(e), this.pointerMoved = !1;
|
|
2527
|
-
}
|
|
2528
|
-
onClick(e) {
|
|
2529
|
-
if (e.preventDefault(), !e.isTrusted) {
|
|
2530
|
-
const t = new PointerEvent("pointerup", {
|
|
2531
|
-
isPrimary: !0,
|
|
2532
|
-
pointerType: "mouse",
|
|
2533
|
-
// Not really a better choice than this
|
|
2534
|
-
clientX: e.clientX,
|
|
2535
|
-
clientY: e.clientY
|
|
2536
|
-
});
|
|
2537
|
-
Object.defineProperty(t, "target", { writable: !1, value: e.target }), Object.defineProperty(t, "defaultPrevented", { writable: !1, value: e.defaultPrevented }), this.onPointUp(t);
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
mount(e, t) {
|
|
2541
|
-
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;
|
|
2542
|
-
}
|
|
2543
|
-
unmount(e, t) {
|
|
2544
|
-
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;
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
bt.moduleName = "peripherals";
|
|
2548
|
-
const Et = class ve extends ce {
|
|
2549
|
-
constructor() {
|
|
2550
|
-
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
2551
|
-
}
|
|
2552
|
-
wndOnErr(e) {
|
|
2553
|
-
var t;
|
|
2554
|
-
(t = this.comms) == null || t.send("error", {
|
|
2555
|
-
message: e.message,
|
|
2556
|
-
filename: e.filename,
|
|
2557
|
-
lineno: e.lineno,
|
|
2558
|
-
colno: e.colno
|
|
2559
|
-
});
|
|
2560
|
-
}
|
|
2561
|
-
unblock(e) {
|
|
2562
|
-
var t;
|
|
2563
|
-
for (e._readium_blockEvents = !1; ((t = e._readium_blockedEvents) == null ? void 0 : t.length) > 0; ) {
|
|
2564
|
-
const r = e._readium_blockedEvents.shift();
|
|
2565
|
-
switch (r[0]) {
|
|
2566
|
-
case 0:
|
|
2567
|
-
Reflect.apply(r[1], r[2], r[3]);
|
|
2568
|
-
break;
|
|
2569
|
-
case 1:
|
|
2570
|
-
const s = r[1], n = r[2];
|
|
2571
|
-
e.removeEventListener(s.type, e._readium_eventBlocker, !0);
|
|
2572
|
-
const o = new Event(s.type, {
|
|
2573
|
-
bubbles: s.bubbles,
|
|
2574
|
-
cancelable: s.cancelable
|
|
2575
|
-
});
|
|
2576
|
-
n ? n.dispatchEvent(o) : e.dispatchEvent(o);
|
|
2577
|
-
break;
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2581
|
-
onMediaPlayEvent() {
|
|
2582
|
-
var e;
|
|
2583
|
-
this.mediaPlayingCount++, (e = this.comms) == null || e.send("media_play", this.mediaPlayingCount);
|
|
2584
|
-
}
|
|
2585
|
-
onMediaPauseEvent() {
|
|
2586
|
-
var e;
|
|
2587
|
-
this.mediaPlayingCount > 0 && this.mediaPlayingCount--, (e = this.comms) == null || e.send("media_pause", this.mediaPlayingCount);
|
|
2588
|
-
}
|
|
2589
|
-
pauseAllMedia(e) {
|
|
2590
|
-
const t = e.document.querySelectorAll("audio,video");
|
|
2591
|
-
for (let r = 0; r < t.length; r++)
|
|
2592
|
-
t[r].pause();
|
|
2593
|
-
}
|
|
2594
|
-
mount(e, t) {
|
|
2595
|
-
this.comms = t, e.addEventListener(
|
|
2596
|
-
"error",
|
|
2597
|
-
this.wndOnErr,
|
|
2598
|
-
!1
|
|
2599
|
-
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
2600
|
-
value: {
|
|
2601
|
-
name: "readium-ts-toolkit",
|
|
2602
|
-
version: "1.3.1",
|
|
2603
|
-
hasFeature: (s, n = "") => {
|
|
2604
|
-
switch (s) {
|
|
2605
|
-
case "dom-manipulation":
|
|
2606
|
-
return !0;
|
|
2607
|
-
case "layout-changes":
|
|
2608
|
-
return !0;
|
|
2609
|
-
case "touch-events":
|
|
2610
|
-
return !0;
|
|
2611
|
-
case "mouse-events":
|
|
2612
|
-
return !0;
|
|
2613
|
-
case "keyboard-events":
|
|
2614
|
-
return !0;
|
|
2615
|
-
case "spine-scripting":
|
|
2616
|
-
return !0;
|
|
2617
|
-
case "embedded-web-content":
|
|
2618
|
-
return !0;
|
|
2619
|
-
default:
|
|
2620
|
-
return !1;
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
},
|
|
2624
|
-
writable: !1
|
|
2625
|
-
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
2626
|
-
s.cancel(), this.allAnimations.add(s);
|
|
2627
|
-
}), t.register("activate", ve.moduleName, (s, n) => {
|
|
2628
|
-
this.allAnimations.forEach((o) => {
|
|
2629
|
-
o.cancel(), o.play();
|
|
2630
|
-
}), n(!0);
|
|
2631
|
-
}), t.register("unfocus", ve.moduleName, (s, n) => {
|
|
2632
|
-
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
2633
|
-
});
|
|
2634
|
-
const r = e.document.querySelectorAll("audio,video");
|
|
2635
|
-
for (let s = 0; s < r.length; s++) {
|
|
2636
|
-
const n = r[s];
|
|
2637
|
-
n.addEventListener("play", this.onMediaPlayEvent, {
|
|
2638
|
-
passive: !0
|
|
2639
|
-
}), n.addEventListener("pause", this.onMediaPauseEvent, {
|
|
2640
|
-
passive: !0
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
|
-
return t.log("Setup Mounted"), !0;
|
|
2644
|
-
}
|
|
2645
|
-
unmount(e, t) {
|
|
2646
|
-
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;
|
|
2647
|
-
}
|
|
2648
|
-
};
|
|
2649
|
-
Et.moduleName = "setup";
|
|
2650
|
-
let xt = Et;
|
|
2651
|
-
function gi(i, e) {
|
|
2652
|
-
return i.document.documentElement.style.getPropertyValue(e);
|
|
2653
|
-
}
|
|
2654
|
-
function ye(i, e, t) {
|
|
2655
|
-
i.document.documentElement.style.setProperty(e, t);
|
|
2656
|
-
}
|
|
2657
|
-
function wt(i, e) {
|
|
2658
|
-
i.document.documentElement.style.removeProperty(e);
|
|
2659
|
-
}
|
|
2660
|
-
const Ge = "readium-viewport", Tt = class j extends xt {
|
|
2661
|
-
onViewportWidthChanged(e) {
|
|
2662
|
-
const t = e.target;
|
|
2663
|
-
ye(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
2664
|
-
}
|
|
2665
|
-
mount(e, t) {
|
|
2666
|
-
if (!super.mount(e, t))
|
|
2667
|
-
return !1;
|
|
2668
|
-
const r = e.document.createElement("meta");
|
|
2669
|
-
return r.dataset.readium = "true", r.setAttribute("name", "viewport"), r.setAttribute("id", Ge), r.setAttribute(
|
|
2670
|
-
"content",
|
|
2671
|
-
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
2672
|
-
), e.document.head.appendChild(r), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
2673
|
-
target: e
|
|
2674
|
-
}), t.register("set_property", j.moduleName, (s, n) => {
|
|
2675
|
-
const o = s;
|
|
2676
|
-
ye(e, o[0], o[1]), n(!0);
|
|
2677
|
-
}), t.register("remove_property", j.moduleName, (s, n) => {
|
|
2678
|
-
wt(e, s), n(!0);
|
|
2679
|
-
}), t.register("activate", j.moduleName, (s, n) => {
|
|
2680
|
-
this.unblock(e), n(!0);
|
|
2681
|
-
}), t.log("ReflowableSetup Mounted"), !0;
|
|
2682
|
-
}
|
|
2683
|
-
unmount(e, t) {
|
|
2684
|
-
var r;
|
|
2685
|
-
return t.unregisterAll(j.moduleName), (r = e.document.head.querySelector(`#${Ge}`)) == null || r.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
2686
|
-
}
|
|
2687
|
-
};
|
|
2688
|
-
Tt.moduleName = "reflowable_setup";
|
|
2689
|
-
let vi = Tt;
|
|
2690
|
-
const Ye = "readium-fixed-style", St = class L extends xt {
|
|
2691
|
-
mount(e, t) {
|
|
2692
|
-
if (!super.mount(e, t))
|
|
2693
|
-
return !1;
|
|
2694
|
-
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2695
|
-
const r = e.document.createElement("style");
|
|
2696
|
-
return r.id = Ye, r.dataset.readium = "true", r.textContent = `
|
|
2697
|
-
html, body {
|
|
2698
|
-
text-size-adjust: none;
|
|
2699
|
-
-ms-text-size-adjust: none;
|
|
2700
|
-
-webkit-text-size-adjust: none;
|
|
2701
|
-
-moz-text-size-adjust: none;
|
|
2702
|
-
|
|
2703
|
-
/* Fight Safari pinches */
|
|
2704
|
-
touch-action: none !important;
|
|
2705
|
-
min-height: 100%;
|
|
2706
|
-
|
|
2707
|
-
/*cursor: var() TODO*/
|
|
2708
|
-
}`, e.document.head.appendChild(r), t.register("set_property", L.moduleName, (s, n) => {
|
|
2709
|
-
const o = s;
|
|
2710
|
-
ye(e, o[0], o[1]), n(!0);
|
|
2711
|
-
}), t.register("remove_property", L.moduleName, (s, n) => {
|
|
2712
|
-
wt(e, s), n(!0);
|
|
2713
|
-
}), t.register("first_visible_locator", L.moduleName, (s, n) => n(!1)), t.register("unfocus", L.moduleName, (s, n) => {
|
|
2714
|
-
T(e), n(!0);
|
|
2715
|
-
}), t.register([
|
|
2716
|
-
"focus",
|
|
2717
|
-
"go_next",
|
|
2718
|
-
"go_prev",
|
|
2719
|
-
"go_id",
|
|
2720
|
-
"go_end",
|
|
2721
|
-
"go_start",
|
|
2722
|
-
"go_text",
|
|
2723
|
-
"go_progression"
|
|
2724
|
-
], L.moduleName, (s, n) => n(!0)), t.register("activate", L.moduleName, (s, n) => {
|
|
2725
|
-
this.unblock(e), n(!0);
|
|
2726
|
-
}), t.log("FixedSetup Mounted"), !0;
|
|
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;
|
|
2727
2868
|
}
|
|
2728
2869
|
unmount(e, t) {
|
|
2729
2870
|
var r;
|
|
2730
|
-
return t.unregisterAll(
|
|
2871
|
+
return t.unregisterAll(M.moduleName), this.removeAnchorElements(), (r = e.document.getElementById(Ye)) == null || r.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2731
2872
|
}
|
|
2732
2873
|
};
|
|
2733
|
-
|
|
2734
|
-
let
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
const r = 1, s = [];
|
|
2739
|
-
for (const c of t)
|
|
2740
|
-
s.push({
|
|
2741
|
-
bottom: c.bottom,
|
|
2742
|
-
height: c.height,
|
|
2743
|
-
left: c.left,
|
|
2744
|
-
right: c.right,
|
|
2745
|
-
top: c.top,
|
|
2746
|
-
width: c.width
|
|
2747
|
-
});
|
|
2748
|
-
const n = Ct(
|
|
2749
|
-
s,
|
|
2750
|
-
r,
|
|
2751
|
-
e
|
|
2752
|
-
), o = xi(n, r), a = Ot(o), h = 2 * 2;
|
|
2753
|
-
for (let c = a.length - 1; c >= 0; c--) {
|
|
2754
|
-
const d = a[c];
|
|
2755
|
-
if (!(d.width * d.height > h))
|
|
2756
|
-
if (a.length > 1)
|
|
2757
|
-
a.splice(c, 1);
|
|
2758
|
-
else
|
|
2759
|
-
break;
|
|
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);
|
|
2760
2879
|
}
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
}
|
|
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);
|
|
2778
2896
|
}
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
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);
|
|
2783
|
-
return {
|
|
2784
|
-
bottom: n,
|
|
2785
|
-
height: n - s,
|
|
2786
|
-
left: t,
|
|
2787
|
-
right: r,
|
|
2788
|
-
top: s,
|
|
2789
|
-
width: r - t
|
|
2790
|
-
};
|
|
2791
|
-
}
|
|
2792
|
-
function xi(i, e) {
|
|
2793
|
-
const t = new Set(i);
|
|
2794
|
-
for (const r of i) {
|
|
2795
|
-
if (!(r.width > 1 && r.height > 1)) {
|
|
2796
|
-
t.delete(r);
|
|
2797
|
-
continue;
|
|
2897
|
+
if (this.pointerMoved) {
|
|
2898
|
+
this.pointerMoved = !1;
|
|
2899
|
+
return;
|
|
2798
2900
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
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;
|
|
2804
2913
|
}
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
}
|
|
2810
|
-
function ie(i, e, t, r) {
|
|
2811
|
-
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));
|
|
2812
|
-
}
|
|
2813
|
-
function Ot(i) {
|
|
2814
|
-
for (let e = 0; e < i.length; e++)
|
|
2815
|
-
for (let t = e + 1; t < i.length; t++) {
|
|
2816
|
-
const r = i[e], s = i[t];
|
|
2817
|
-
if (r !== s && Pt(r, s, -1)) {
|
|
2818
|
-
let n = [], o;
|
|
2819
|
-
const a = Ze(r, s);
|
|
2820
|
-
if (a.length === 1)
|
|
2821
|
-
n = a, o = r;
|
|
2822
|
-
else {
|
|
2823
|
-
const c = Ze(s, r);
|
|
2824
|
-
a.length < c.length ? (n = a, o = r) : (n = c, o = s);
|
|
2825
|
-
}
|
|
2826
|
-
const h = i.filter((c) => c !== o);
|
|
2827
|
-
return Array.prototype.push.apply(h, n), Ot(h);
|
|
2828
|
-
}
|
|
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);
|
|
2917
|
+
return;
|
|
2829
2918
|
}
|
|
2830
|
-
|
|
2831
|
-
}
|
|
2832
|
-
function Ze(i, e) {
|
|
2833
|
-
const t = Ti(e, i);
|
|
2834
|
-
if (t.height === 0 || t.width === 0)
|
|
2835
|
-
return [i];
|
|
2836
|
-
const r = [];
|
|
2837
|
-
{
|
|
2838
|
-
const s = {
|
|
2839
|
-
bottom: i.bottom,
|
|
2840
|
-
height: 0,
|
|
2841
|
-
left: i.left,
|
|
2842
|
-
right: t.left,
|
|
2843
|
-
top: i.top,
|
|
2844
|
-
width: 0
|
|
2845
|
-
};
|
|
2846
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2919
|
+
this.pointerMoved = !0;
|
|
2847
2920
|
}
|
|
2848
|
-
{
|
|
2849
|
-
|
|
2850
|
-
bottom: t.top,
|
|
2851
|
-
height: 0,
|
|
2852
|
-
left: t.left,
|
|
2853
|
-
right: t.right,
|
|
2854
|
-
top: i.top,
|
|
2855
|
-
width: 0
|
|
2856
|
-
};
|
|
2857
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2921
|
+
onPointDown() {
|
|
2922
|
+
this.pointerMoved = !1;
|
|
2858
2923
|
}
|
|
2859
|
-
{
|
|
2860
|
-
|
|
2861
|
-
bottom: i.bottom,
|
|
2862
|
-
height: 0,
|
|
2863
|
-
left: t.left,
|
|
2864
|
-
right: t.right,
|
|
2865
|
-
top: t.bottom,
|
|
2866
|
-
width: 0
|
|
2867
|
-
};
|
|
2868
|
-
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && r.push(s);
|
|
2924
|
+
onContext(e) {
|
|
2925
|
+
this.onPointUp(e), this.pointerMoved = !1;
|
|
2869
2926
|
}
|
|
2870
|
-
{
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
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
|
+
}
|
|
2880
2938
|
}
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
function Ti(i, e) {
|
|
2884
|
-
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);
|
|
2885
|
-
return {
|
|
2886
|
-
bottom: n,
|
|
2887
|
-
height: Math.max(0, n - s),
|
|
2888
|
-
left: t,
|
|
2889
|
-
right: r,
|
|
2890
|
-
top: s,
|
|
2891
|
-
width: Math.max(0, r - t)
|
|
2892
|
-
};
|
|
2893
|
-
}
|
|
2894
|
-
function Pt(i, e, t) {
|
|
2895
|
-
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));
|
|
2896
|
-
}
|
|
2897
|
-
function A(i, e, t) {
|
|
2898
|
-
return Math.abs(i - e) <= t;
|
|
2899
|
-
}
|
|
2900
|
-
const Si = window.ResizeObserver || nt, Ci = "Highlight" in window, Je = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2901
|
-
class Oi {
|
|
2902
|
-
/**
|
|
2903
|
-
* Creates a DecorationGroup object
|
|
2904
|
-
* @param id Unique HTML ID-adhering name of the group
|
|
2905
|
-
* @param name Human-readable name of the group
|
|
2906
|
-
*/
|
|
2907
|
-
constructor(e, t, r, s) {
|
|
2908
|
-
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, Ci && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
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;
|
|
2909
2941
|
}
|
|
2910
|
-
|
|
2911
|
-
return this.
|
|
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;
|
|
2912
2944
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
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();
|
|
2915
2950
|
}
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
this.comms.log("Can't locate DOM range for decoration", e);
|
|
2925
|
-
return;
|
|
2926
|
-
}
|
|
2927
|
-
const s = r.commonAncestorContainer;
|
|
2928
|
-
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)));
|
|
2929
|
-
const n = {
|
|
2930
|
-
decoration: e,
|
|
2931
|
-
id: t,
|
|
2932
|
-
range: r
|
|
2933
|
-
};
|
|
2934
|
-
this.items.push(n), this.layout(n), this.renderLayout([n]);
|
|
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
|
+
});
|
|
2935
2959
|
}
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
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;
|
|
2977
|
+
}
|
|
2949
2978
|
}
|
|
2950
|
-
(n = this.notTextFlag) == null || n.delete(r.id);
|
|
2951
2979
|
}
|
|
2952
|
-
|
|
2953
|
-
* Notifies that the given decoration was modified and needs to be updated.
|
|
2954
|
-
* @param decoration Decoration to update
|
|
2955
|
-
*/
|
|
2956
|
-
update(e) {
|
|
2957
|
-
this.remove(e.id), this.add(e);
|
|
2958
|
-
}
|
|
2959
|
-
/**
|
|
2960
|
-
* Removes all decorations from this group.
|
|
2961
|
-
*/
|
|
2962
|
-
clear() {
|
|
2980
|
+
onMediaPlayEvent() {
|
|
2963
2981
|
var e;
|
|
2964
|
-
this.
|
|
2965
|
-
}
|
|
2966
|
-
/**
|
|
2967
|
-
* Recreates the decoration elements.
|
|
2968
|
-
* To be called after reflowing the resource, for example.
|
|
2969
|
-
*/
|
|
2970
|
-
requestLayout() {
|
|
2971
|
-
this.wnd.cancelAnimationFrame(this.currentRender), this.clearContainer(), this.items.forEach((e) => this.layout(e)), this.renderLayout(this.items);
|
|
2982
|
+
this.mediaPlayingCount++, (e = this.comms) == null || e.send("media_play", this.mediaPlayingCount);
|
|
2972
2983
|
}
|
|
2973
|
-
|
|
2974
|
-
var
|
|
2975
|
-
|
|
2976
|
-
r.add(e.range), t.innerHTML = `
|
|
2977
|
-
::highlight(${this.id}) {
|
|
2978
|
-
color: black;
|
|
2979
|
-
background-color: ${((n = (s = e.decoration) == null ? void 0 : s.style) == null ? void 0 : n.tint) ?? "yellow"};
|
|
2980
|
-
}`;
|
|
2984
|
+
onMediaPauseEvent() {
|
|
2985
|
+
var e;
|
|
2986
|
+
this.mediaPlayingCount > 0 && this.mediaPlayingCount--, (e = this.comms) == null || e.send("media_pause", this.mediaPlayingCount);
|
|
2981
2987
|
}
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
layout(e) {
|
|
2987
|
-
var v, g, y, x, S;
|
|
2988
|
-
if (this.experimentalHighlights && !((v = this.notTextFlag) != null && v.has(e.id)))
|
|
2989
|
-
return this.experimentalLayout(e);
|
|
2990
|
-
const t = this.wnd.document.createElement("div");
|
|
2991
|
-
t.setAttribute("id", e.id), t.style.setProperty("pointer-events", "none");
|
|
2992
|
-
const r = this.wnd.innerWidth, s = parseInt(
|
|
2993
|
-
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2994
|
-
"column-count"
|
|
2995
|
-
)
|
|
2996
|
-
), n = r / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, h = o.scrollTop, c = (m, E, P) => {
|
|
2997
|
-
var Y, Z, D, B, J, K;
|
|
2998
|
-
if (m.style.position = "absolute", ((Z = (Y = e.decoration) == null ? void 0 : Y.style) == null ? void 0 : Z.width) === "viewport") {
|
|
2999
|
-
m.style.width = `${r}px`, m.style.height = `${E.height}px`;
|
|
3000
|
-
let U = Math.floor(E.left / r) * r;
|
|
3001
|
-
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
3002
|
-
} else if (((B = (D = e.decoration) == null ? void 0 : D.style) == null ? void 0 : B.width) === "bounds")
|
|
3003
|
-
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`;
|
|
3004
|
-
else if (((K = (J = e.decoration) == null ? void 0 : J.style) == null ? void 0 : K.width) === "page") {
|
|
3005
|
-
m.style.width = `${n}px`, m.style.height = `${E.height}px`;
|
|
3006
|
-
let U = Math.floor(E.left / n) * n;
|
|
3007
|
-
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
3008
|
-
} else
|
|
3009
|
-
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`;
|
|
3010
|
-
}, d = e.range.getBoundingClientRect();
|
|
3011
|
-
let p = this.wnd.document.createElement("template");
|
|
3012
|
-
const u = gi(this.wnd, "--USER__appearance") === "readium-night-on";
|
|
3013
|
-
p.innerHTML = `
|
|
3014
|
-
<div
|
|
3015
|
-
class="r2-highlight-0"
|
|
3016
|
-
style="${[
|
|
3017
|
-
`background-color: ${((y = (g = e.decoration) == null ? void 0 : g.style) == null ? void 0 : y.tint) ?? "yellow"} !important`,
|
|
3018
|
-
//"opacity: 0.3 !important",
|
|
3019
|
-
`mix-blend-mode: ${u ? "exclusion" : "multiply"} !important`,
|
|
3020
|
-
"opacity: 1 !important",
|
|
3021
|
-
"box-sizing: border-box !important"
|
|
3022
|
-
].join("; ")}"
|
|
3023
|
-
>
|
|
3024
|
-
</div>
|
|
3025
|
-
`.trim();
|
|
3026
|
-
const f = p.content.firstElementChild;
|
|
3027
|
-
if (((S = (x = e.decoration) == null ? void 0 : x.style) == null ? void 0 : S.layout) === "bounds") {
|
|
3028
|
-
const m = f.cloneNode(!0);
|
|
3029
|
-
m.style.setProperty("pointer-events", "none"), c(m, d, d), t.append(m);
|
|
3030
|
-
} else {
|
|
3031
|
-
let m = bi(
|
|
3032
|
-
e.range,
|
|
3033
|
-
!0
|
|
3034
|
-
// doNotMergeHorizontallyAlignedRects
|
|
3035
|
-
);
|
|
3036
|
-
m = m.sort((E, P) => E.top < P.top ? -1 : E.top > P.top ? 1 : 0);
|
|
3037
|
-
for (let E of m) {
|
|
3038
|
-
const P = f.cloneNode(!0);
|
|
3039
|
-
P.style.setProperty("pointer-events", "none"), c(P, E, d), t.append(P);
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
e.container = t, e.clickableElements = Array.from(
|
|
3043
|
-
t.querySelectorAll("[data-activable='1']")
|
|
3044
|
-
), e.clickableElements.length || (e.clickableElements = Array.from(t.children));
|
|
2988
|
+
pauseAllMedia(e) {
|
|
2989
|
+
const t = e.document.querySelectorAll("audio,video");
|
|
2990
|
+
for (let r = 0; r < t.length; r++)
|
|
2991
|
+
t[r].pause();
|
|
3045
2992
|
}
|
|
3046
|
-
|
|
3047
|
-
this.
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
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);
|
|
3054
3032
|
});
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
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));
|
|
3064
|
-
let r;
|
|
3065
|
-
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];
|
|
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
|
+
});
|
|
3066
3041
|
}
|
|
3067
|
-
return
|
|
3042
|
+
return t.log("Setup Mounted"), !0;
|
|
3068
3043
|
}
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
*/
|
|
3072
|
-
clearContainer() {
|
|
3073
|
-
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;
|
|
3074
3046
|
}
|
|
3075
|
-
}
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
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`);
|
|
3079
3054
|
}
|
|
3080
|
-
|
|
3081
|
-
|
|
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;
|
|
3082
3072
|
}
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
e.experimentalHighlights || e.requestLayout();
|
|
3087
|
-
});
|
|
3088
|
-
}, 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);
|
|
3089
3076
|
}
|
|
3077
|
+
};
|
|
3078
|
+
Pt.moduleName = "reflowable_setup";
|
|
3079
|
+
let Ai = Pt;
|
|
3080
|
+
const Je = "readium-fixed-style", At = class L extends Ot {
|
|
3090
3081
|
mount(e, t) {
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
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;
|
|
3116
3117
|
}
|
|
3117
3118
|
unmount(e, t) {
|
|
3118
|
-
|
|
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);
|
|
3119
3121
|
}
|
|
3120
3122
|
};
|
|
3121
|
-
At.moduleName = "
|
|
3122
|
-
let
|
|
3123
|
-
const
|
|
3123
|
+
At.moduleName = "fixed_setup";
|
|
3124
|
+
let Mi = At;
|
|
3125
|
+
const Ri = [
|
|
3124
3126
|
"fixed_setup",
|
|
3125
3127
|
"decorator",
|
|
3126
3128
|
"peripherals"
|
|
3127
|
-
],
|
|
3129
|
+
], Ni = [
|
|
3128
3130
|
"reflowable_setup",
|
|
3129
3131
|
"decorator",
|
|
3130
3132
|
"peripherals",
|
|
@@ -3132,14 +3134,14 @@ const Ai = [
|
|
|
3132
3134
|
"scroll_snapper"
|
|
3133
3135
|
], Ke = new Map([
|
|
3134
3136
|
// All modules go here
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3137
|
+
Mi,
|
|
3138
|
+
Ai,
|
|
3139
|
+
St,
|
|
3140
|
+
gi,
|
|
3141
|
+
Ti,
|
|
3142
|
+
Pi
|
|
3141
3143
|
].map((i) => [i.moduleName, i]));
|
|
3142
|
-
class
|
|
3144
|
+
class Li {
|
|
3143
3145
|
/**
|
|
3144
3146
|
* @param wnd Window instance to operate on
|
|
3145
3147
|
* @param initialModules List of initial modules to load
|
|
@@ -3192,11 +3194,14 @@ class Ri {
|
|
|
3192
3194
|
export {
|
|
3193
3195
|
_ as COMMS_VERSION,
|
|
3194
3196
|
Nt as Comms,
|
|
3195
|
-
|
|
3196
|
-
Ri as
|
|
3197
|
+
gi as Decorator,
|
|
3198
|
+
Ri as FXLModules,
|
|
3199
|
+
pi as Layout,
|
|
3200
|
+
Li as Loader,
|
|
3197
3201
|
ce as Module,
|
|
3198
3202
|
Ke as ModuleLibrary,
|
|
3199
|
-
|
|
3200
|
-
|
|
3203
|
+
St as Peripherals,
|
|
3204
|
+
Ni as ReflowableModules,
|
|
3205
|
+
di as Width,
|
|
3201
3206
|
Rt as mid
|
|
3202
3207
|
};
|