@readium/navigator-html-injectables 1.3.3 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +978 -1213
- package/dist/index.umd.cjs +9 -9
- package/package.json +7 -8
- package/src/comms/keys.ts +2 -0
- package/src/helpers/color.ts +114 -0
- package/src/helpers/css.ts +37 -0
- package/src/helpers/document.ts +42 -21
- package/src/modules/Decorator.ts +3 -5
- package/src/modules/setup/ReflowableSetup.ts +12 -1
- package/src/modules/snapper/ColumnSnapper.ts +35 -9
- package/src/modules/snapper/ScrollSnapper.ts +24 -17
- package/types/src/comms/keys.d.ts +1 -1
- package/types/src/helpers/color.d.ts +16 -0
- package/types/src/helpers/css.d.ts +6 -0
- package/types/src/helpers/document.d.ts +11 -2
- package/types/src/modules/snapper/ScrollSnapper.d.ts +3 -3
- package/src/helpers/scrollSnapperHelper.ts +0 -43
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const nt = Math.pow(2, 32), ge = () => Math.round(Math.random() * nt).toString(36), ot = () => `${Math.round(performance.now())}-${ge()}-${ge()}`, k = 1;
|
|
2
|
+
class at {
|
|
3
3
|
constructor(e) {
|
|
4
4
|
this.destination = null, this.registrar = /* @__PURE__ */ new Map(), this.origin = "", this.channelId = "", this.receiver = this.receive.bind(this), this.preLog = [], this.wnd = e, e.addEventListener("message", this.receiver);
|
|
5
5
|
}
|
|
@@ -12,11 +12,11 @@ class zt {
|
|
|
12
12
|
if (!(!("_readium" in t) || !t._readium || t._readium <= 0)) {
|
|
13
13
|
if (t.key === "_ping") {
|
|
14
14
|
if (!this.destination) {
|
|
15
|
-
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !==
|
|
16
|
-
t._readium >
|
|
15
|
+
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !== k) {
|
|
16
|
+
t._readium > k ? this.send("error", `received comms version ${t._readium} higher than ${k}`) : this.send("error", `received comms version ${t._readium} lower than ${k}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
this.send("_pong", void 0), this.preLog.forEach((
|
|
19
|
+
this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
|
|
20
20
|
}
|
|
21
21
|
return;
|
|
22
22
|
} else if (this.channelId) {
|
|
@@ -33,35 +33,35 @@ class zt {
|
|
|
33
33
|
e.strict && this.send("_unhandled", e);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
t.forEach((
|
|
37
|
-
this.send("_ack",
|
|
36
|
+
t.forEach((i) => i.cb(e.data, (s) => {
|
|
37
|
+
this.send("_ack", s, e.id);
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
register(e, t,
|
|
41
|
-
Array.isArray(e) || (e = [e]), e.forEach((
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
throw new Error(`Trying to register another callback for combination of event ${
|
|
46
|
-
|
|
47
|
-
cb:
|
|
40
|
+
register(e, t, i) {
|
|
41
|
+
Array.isArray(e) || (e = [e]), e.forEach((s) => {
|
|
42
|
+
const n = this.registrar.get(s);
|
|
43
|
+
if (n && n.length >= 0) {
|
|
44
|
+
if (n.find((a) => a.module === t))
|
|
45
|
+
throw new Error(`Trying to register another callback for combination of event ${s} and module ${t}`);
|
|
46
|
+
n.push({
|
|
47
|
+
cb: i,
|
|
48
48
|
module: t
|
|
49
|
-
}), this.registrar.set(
|
|
49
|
+
}), this.registrar.set(s, n);
|
|
50
50
|
} else
|
|
51
|
-
this.registrar.set(
|
|
52
|
-
cb:
|
|
51
|
+
this.registrar.set(s, [{
|
|
52
|
+
cb: i,
|
|
53
53
|
module: t
|
|
54
54
|
}]);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
unregister(e, t) {
|
|
58
|
-
Array.isArray(e) || (e = [e]), e.forEach((
|
|
59
|
-
const
|
|
60
|
-
!
|
|
58
|
+
Array.isArray(e) || (e = [e]), e.forEach((i) => {
|
|
59
|
+
const s = this.registrar.get(i);
|
|
60
|
+
!s || s.length === 0 || s.splice(s.findIndex((n) => n.module === t), 1);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
unregisterAll(e) {
|
|
64
|
-
this.registrar.forEach((t,
|
|
64
|
+
this.registrar.forEach((t, i) => this.registrar.set(i, t.filter((s) => s.module !== e)));
|
|
65
65
|
}
|
|
66
66
|
log(...e) {
|
|
67
67
|
this.destination ? this.send("log", e) : this.preLog.push(e);
|
|
@@ -72,30 +72,30 @@ class zt {
|
|
|
72
72
|
destroy() {
|
|
73
73
|
this.destination = null, this.channelId = "", this.preLog = [], this.registrar.clear(), this.wnd.removeEventListener("message", this.receiver);
|
|
74
74
|
}
|
|
75
|
-
send(e, t,
|
|
75
|
+
send(e, t, i = void 0, s = []) {
|
|
76
76
|
if (!this.destination)
|
|
77
77
|
throw Error("Attempted to send comms message before destination has been initialized");
|
|
78
|
-
const
|
|
79
|
-
_readium:
|
|
78
|
+
const n = {
|
|
79
|
+
_readium: k,
|
|
80
80
|
_channel: this.channelId,
|
|
81
|
-
id:
|
|
81
|
+
id: i ?? ot(),
|
|
82
82
|
// scrict,
|
|
83
83
|
key: e,
|
|
84
84
|
data: t
|
|
85
85
|
};
|
|
86
86
|
try {
|
|
87
|
-
this.destination.postMessage(
|
|
87
|
+
this.destination.postMessage(n, {
|
|
88
88
|
targetOrigin: this.origin,
|
|
89
|
-
transfer:
|
|
89
|
+
transfer: s
|
|
90
90
|
});
|
|
91
91
|
} catch (o) {
|
|
92
|
-
if (
|
|
92
|
+
if (s.length > 0)
|
|
93
93
|
throw o;
|
|
94
|
-
this.destination.postMessage(
|
|
94
|
+
this.destination.postMessage(n, this.origin, s);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class ie {
|
|
99
99
|
/**
|
|
100
100
|
* Creates a [Encryption].
|
|
101
101
|
*/
|
|
@@ -107,7 +107,7 @@ class we {
|
|
|
107
107
|
*/
|
|
108
108
|
static deserialize(e) {
|
|
109
109
|
if (e && e.algorithm)
|
|
110
|
-
return new
|
|
110
|
+
return new ie({
|
|
111
111
|
algorithm: e.algorithm,
|
|
112
112
|
compression: e.compression,
|
|
113
113
|
originalLength: e.originalLength,
|
|
@@ -123,7 +123,7 @@ class we {
|
|
|
123
123
|
return this.compression !== void 0 && (e.compression = this.compression), this.originalLength !== void 0 && (e.originalLength = this.originalLength), this.profile !== void 0 && (e.profile = this.profile), this.scheme !== void 0 && (e.scheme = this.scheme), e;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
class
|
|
126
|
+
class E {
|
|
127
127
|
constructor(e) {
|
|
128
128
|
this.otherProperties = e;
|
|
129
129
|
}
|
|
@@ -132,7 +132,7 @@ class b {
|
|
|
132
132
|
*/
|
|
133
133
|
static deserialize(e) {
|
|
134
134
|
if (e)
|
|
135
|
-
return new
|
|
135
|
+
return new E(e);
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -145,49 +145,49 @@ class b {
|
|
|
145
145
|
*/
|
|
146
146
|
add(e) {
|
|
147
147
|
const t = Object.assign({}, this.otherProperties);
|
|
148
|
-
for (const
|
|
149
|
-
t[
|
|
150
|
-
return new
|
|
148
|
+
for (const i in e)
|
|
149
|
+
t[i] = e[i];
|
|
150
|
+
return new E(t);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
Object.defineProperty(
|
|
153
|
+
Object.defineProperty(E.prototype, "encryption", {
|
|
154
154
|
get: function() {
|
|
155
|
-
return
|
|
155
|
+
return ie.deserialize(this.otherProperties.encrypted);
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
E.prototype.getContains = function() {
|
|
159
159
|
return new Set(this.otherProperties.contains || []);
|
|
160
160
|
};
|
|
161
|
-
|
|
161
|
+
E.prototype.getLayout = function() {
|
|
162
162
|
return this.otherProperties.layout;
|
|
163
163
|
};
|
|
164
164
|
class l {
|
|
165
165
|
/** Creates a MediaType object. */
|
|
166
166
|
constructor(e) {
|
|
167
|
-
let t,
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
if (t =
|
|
167
|
+
let t, i, s = e.mediaType.replace(/\s/g, "").split(";");
|
|
168
|
+
const n = s[0].split("/");
|
|
169
|
+
if (n.length === 2) {
|
|
170
|
+
if (t = n[0].toLowerCase().trim(), i = n[1].toLowerCase().trim(), t.length === 0 || i.length === 0)
|
|
171
171
|
throw new Error("Invalid media type");
|
|
172
172
|
} else
|
|
173
173
|
throw new Error("Invalid media type");
|
|
174
174
|
const o = {};
|
|
175
|
-
for (let
|
|
176
|
-
const f =
|
|
175
|
+
for (let u = 1; u < s.length; u++) {
|
|
176
|
+
const f = s[u].split("=");
|
|
177
177
|
if (f.length === 2) {
|
|
178
|
-
const
|
|
179
|
-
o[
|
|
178
|
+
const g = f[0].toLocaleLowerCase(), m = g === "charset" ? f[1].toUpperCase() : f[1];
|
|
179
|
+
o[g] = m;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
const a = {}, h = Object.keys(o);
|
|
183
|
-
h.sort((
|
|
183
|
+
h.sort((u, f) => u.localeCompare(f)), h.forEach((u) => a[u] = o[u]);
|
|
184
184
|
let c = "";
|
|
185
|
-
for (const
|
|
186
|
-
const f = a[
|
|
187
|
-
c += `;${
|
|
185
|
+
for (const u in a) {
|
|
186
|
+
const f = a[u];
|
|
187
|
+
c += `;${u}=${f}`;
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
this.string =
|
|
189
|
+
const d = `${t}/${i}${c}`, p = a.encoding;
|
|
190
|
+
this.string = d, this.type = t, this.subtype = i, this.parameters = a, this.encoding = p, this.name = e.name, this.fileExtension = e.fileExtension;
|
|
191
191
|
}
|
|
192
192
|
static parse(e) {
|
|
193
193
|
return new l(e);
|
|
@@ -223,13 +223,13 @@ class l {
|
|
|
223
223
|
const t = typeof e == "string" ? l.parse({ mediaType: e }) : e;
|
|
224
224
|
if (!((this.type === "*" || this.type === t.type) && (this.subtype === "*" || this.subtype === t.subtype)))
|
|
225
225
|
return !1;
|
|
226
|
-
const
|
|
227
|
-
Object.entries(this.parameters).map(([
|
|
228
|
-
),
|
|
229
|
-
Object.entries(t.parameters).map(([
|
|
226
|
+
const i = new Set(
|
|
227
|
+
Object.entries(this.parameters).map(([n, o]) => `${n}=${o}`)
|
|
228
|
+
), s = new Set(
|
|
229
|
+
Object.entries(t.parameters).map(([n, o]) => `${n}=${o}`)
|
|
230
230
|
);
|
|
231
|
-
for (const
|
|
232
|
-
if (!
|
|
231
|
+
for (const n of Array.from(i.values()))
|
|
232
|
+
if (!s.has(n))
|
|
233
233
|
return !1;
|
|
234
234
|
return !0;
|
|
235
235
|
}
|
|
@@ -616,7 +616,7 @@ class l {
|
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
class
|
|
619
|
+
class ye {
|
|
620
620
|
constructor(e) {
|
|
621
621
|
this.uri = e, this.parameters = this.getParameters(e);
|
|
622
622
|
}
|
|
@@ -624,9 +624,9 @@ class Re {
|
|
|
624
624
|
* List of URI template parameter keys, if the [Link] is templated.
|
|
625
625
|
*/
|
|
626
626
|
getParameters(e) {
|
|
627
|
-
const t = /\{\??([^}]+)\}/g,
|
|
628
|
-
return
|
|
629
|
-
|
|
627
|
+
const t = /\{\??([^}]+)\}/g, i = e.match(t);
|
|
628
|
+
return i ? new Set(
|
|
629
|
+
i.join(",").replace(t, "$1").split(",").map((s) => s.trim())
|
|
630
630
|
) : /* @__PURE__ */ new Set();
|
|
631
631
|
}
|
|
632
632
|
/** Expands the URI by replacing the template variables by the given parameters.
|
|
@@ -634,36 +634,36 @@ class Re {
|
|
|
634
634
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
635
635
|
*/
|
|
636
636
|
expand(e) {
|
|
637
|
-
const t = (
|
|
638
|
-
const o = e[
|
|
637
|
+
const t = (s) => s.split(",").map((n) => {
|
|
638
|
+
const o = e[n];
|
|
639
639
|
return o ? encodeURIComponent(o) : "";
|
|
640
|
-
}).join(","),
|
|
641
|
-
const o =
|
|
640
|
+
}).join(","), i = (s) => "?" + s.split(",").map((n) => {
|
|
641
|
+
const o = n.split("=")[0], a = e[o];
|
|
642
642
|
return a ? `${o}=${encodeURIComponent(a)}` : "";
|
|
643
643
|
}).join("&");
|
|
644
|
-
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...
|
|
644
|
+
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? i(s[2]) : t(s[2]));
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
return
|
|
647
|
+
function lt(r) {
|
|
648
|
+
return r && r instanceof Array ? r : void 0;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
651
|
-
return
|
|
650
|
+
function We(r) {
|
|
651
|
+
return r && typeof r == "string" ? [r] : lt(r);
|
|
652
652
|
}
|
|
653
|
-
function
|
|
654
|
-
return typeof
|
|
653
|
+
function ve(r) {
|
|
654
|
+
return typeof r == "string" ? new Date(r) : void 0;
|
|
655
655
|
}
|
|
656
|
-
function
|
|
657
|
-
return isNaN(
|
|
656
|
+
function j(r) {
|
|
657
|
+
return isNaN(r) ? void 0 : r;
|
|
658
658
|
}
|
|
659
|
-
function
|
|
660
|
-
return
|
|
659
|
+
function C(r) {
|
|
660
|
+
return j(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function ht(r) {
|
|
663
663
|
const e = new Array();
|
|
664
|
-
return
|
|
664
|
+
return r.forEach((t) => e.push(t)), e;
|
|
665
665
|
}
|
|
666
|
-
class
|
|
666
|
+
class x {
|
|
667
667
|
/**
|
|
668
668
|
* Creates a [Locations].
|
|
669
669
|
*/
|
|
@@ -676,7 +676,7 @@ class w {
|
|
|
676
676
|
static deserialize(e) {
|
|
677
677
|
if (!e)
|
|
678
678
|
return;
|
|
679
|
-
const t =
|
|
679
|
+
const t = j(e.progression), i = j(e.totalProgression), s = j(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
680
680
|
"fragment",
|
|
681
681
|
"fragments",
|
|
682
682
|
"progression",
|
|
@@ -684,13 +684,13 @@ class w {
|
|
|
684
684
|
"position"
|
|
685
685
|
]);
|
|
686
686
|
return Object.entries(e).forEach(([a, h]) => {
|
|
687
|
-
o.has(a) ||
|
|
688
|
-
}), new
|
|
689
|
-
fragments:
|
|
687
|
+
o.has(a) || n.set(a, h);
|
|
688
|
+
}), new x({
|
|
689
|
+
fragments: We(e.fragments || e.fragment),
|
|
690
690
|
progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
|
|
691
|
-
totalProgression:
|
|
692
|
-
position:
|
|
693
|
-
otherLocations:
|
|
691
|
+
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
692
|
+
position: s !== void 0 && s > 0 ? s : void 0,
|
|
693
|
+
otherLocations: n.size === 0 ? void 0 : n
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
/**
|
|
@@ -698,10 +698,10 @@ class w {
|
|
|
698
698
|
*/
|
|
699
699
|
serialize() {
|
|
700
700
|
const e = {};
|
|
701
|
-
return this.fragments && (e.fragments = this.fragments), this.progression !== void 0 && (e.progression = this.progression), this.totalProgression !== void 0 && (e.totalProgression = this.totalProgression), this.position !== void 0 && (e.position = this.position), this.otherLocations && this.otherLocations.forEach((t,
|
|
701
|
+
return this.fragments && (e.fragments = this.fragments), this.progression !== void 0 && (e.progression = this.progression), this.totalProgression !== void 0 && (e.totalProgression = this.totalProgression), this.position !== void 0 && (e.position = this.position), this.otherLocations && this.otherLocations.forEach((t, i) => e[i] = t), e;
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
-
class
|
|
704
|
+
class U {
|
|
705
705
|
/**
|
|
706
706
|
* Creates a [Text].
|
|
707
707
|
*/
|
|
@@ -713,7 +713,7 @@ class _ {
|
|
|
713
713
|
*/
|
|
714
714
|
static deserialize(e) {
|
|
715
715
|
if (e)
|
|
716
|
-
return new
|
|
716
|
+
return new U({
|
|
717
717
|
after: e.after,
|
|
718
718
|
before: e.before,
|
|
719
719
|
highlight: e.highlight
|
|
@@ -727,24 +727,24 @@ class _ {
|
|
|
727
727
|
return this.after !== void 0 && (e.after = this.after), this.before !== void 0 && (e.before = this.before), this.highlight !== void 0 && (e.highlight = this.highlight), e;
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
|
-
class
|
|
730
|
+
class D {
|
|
731
731
|
/**
|
|
732
732
|
* Creates a [Locator].
|
|
733
733
|
*/
|
|
734
734
|
constructor(e) {
|
|
735
|
-
this.href = e.href, this.type = e.type, this.title = e.title, this.locations = e.locations ? e.locations : new
|
|
735
|
+
this.href = e.href, this.type = e.type, this.title = e.title, this.locations = e.locations ? e.locations : new x({}), this.text = e.text;
|
|
736
736
|
}
|
|
737
737
|
/**
|
|
738
738
|
* Parses a [Link] from its RWPM JSON representation.
|
|
739
739
|
*/
|
|
740
740
|
static deserialize(e) {
|
|
741
741
|
if (e && e.href && e.type)
|
|
742
|
-
return new
|
|
742
|
+
return new D({
|
|
743
743
|
href: e.href,
|
|
744
744
|
type: e.type,
|
|
745
745
|
title: e.title,
|
|
746
|
-
locations:
|
|
747
|
-
text:
|
|
746
|
+
locations: x.deserialize(e.locations),
|
|
747
|
+
text: U.deserialize(e.text)
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
/**
|
|
@@ -758,16 +758,16 @@ class B {
|
|
|
758
758
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
759
759
|
*/
|
|
760
760
|
copyWithLocations(e) {
|
|
761
|
-
return new
|
|
761
|
+
return new D({
|
|
762
762
|
href: this.href,
|
|
763
763
|
type: this.type,
|
|
764
764
|
title: this.title,
|
|
765
765
|
text: this.text,
|
|
766
|
-
locations: new
|
|
766
|
+
locations: new x({ ...this.locations, ...e })
|
|
767
767
|
});
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
|
-
class
|
|
770
|
+
class B {
|
|
771
771
|
/**
|
|
772
772
|
* Creates a [Link].
|
|
773
773
|
*/
|
|
@@ -779,20 +779,20 @@ class V {
|
|
|
779
779
|
*/
|
|
780
780
|
static deserialize(e) {
|
|
781
781
|
if (e && e.href && typeof e.href == "string")
|
|
782
|
-
return new
|
|
782
|
+
return new B({
|
|
783
783
|
href: e.href,
|
|
784
784
|
templated: e.templated,
|
|
785
785
|
type: e.type,
|
|
786
786
|
title: e.title,
|
|
787
787
|
rels: e.rel ? e.rel instanceof Array ? new Set(e.rel) : /* @__PURE__ */ new Set([e.rel]) : void 0,
|
|
788
|
-
properties:
|
|
789
|
-
height:
|
|
790
|
-
width:
|
|
791
|
-
duration:
|
|
792
|
-
bitrate:
|
|
793
|
-
languages:
|
|
794
|
-
alternates:
|
|
795
|
-
children:
|
|
788
|
+
properties: E.deserialize(e.properties),
|
|
789
|
+
height: C(e.height),
|
|
790
|
+
width: C(e.width),
|
|
791
|
+
duration: C(e.duration),
|
|
792
|
+
bitrate: C(e.bitrate),
|
|
793
|
+
languages: We(e.language),
|
|
794
|
+
alternates: q.deserialize(e.alternate),
|
|
795
|
+
children: q.deserialize(e.children)
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
/**
|
|
@@ -800,7 +800,7 @@ class V {
|
|
|
800
800
|
*/
|
|
801
801
|
serialize() {
|
|
802
802
|
const e = { href: this.href };
|
|
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 =
|
|
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 = ht(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;
|
|
804
804
|
}
|
|
805
805
|
/** MediaType of the linked resource. */
|
|
806
806
|
get mediaType() {
|
|
@@ -813,19 +813,19 @@ class V {
|
|
|
813
813
|
const t = this.href.replace(/^(\/)/, "");
|
|
814
814
|
if (t.length === 0)
|
|
815
815
|
return;
|
|
816
|
-
let
|
|
817
|
-
return
|
|
816
|
+
let i = e || "/";
|
|
817
|
+
return i.startsWith("/") && (i = "file://" + i), new URL(t, i).href.replace(/^(file:\/\/)/, "");
|
|
818
818
|
}
|
|
819
819
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
820
820
|
get templateParameters() {
|
|
821
|
-
return this.templated ? new
|
|
821
|
+
return this.templated ? new ye(this.href).parameters : /* @__PURE__ */ new Set();
|
|
822
822
|
}
|
|
823
823
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
824
824
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
825
825
|
*/
|
|
826
826
|
expandTemplate(e) {
|
|
827
|
-
return new
|
|
828
|
-
href: new
|
|
827
|
+
return new B({
|
|
828
|
+
href: new ye(this.href).expand(e),
|
|
829
829
|
templated: !1
|
|
830
830
|
});
|
|
831
831
|
}
|
|
@@ -834,25 +834,25 @@ class V {
|
|
|
834
834
|
*/
|
|
835
835
|
addProperties(e) {
|
|
836
836
|
var t;
|
|
837
|
-
const
|
|
838
|
-
return
|
|
837
|
+
const i = B.deserialize(this.serialize());
|
|
838
|
+
return i.properties = i.properties ? (t = i.properties) == null ? void 0 : t.add(e) : new E(e), i;
|
|
839
839
|
}
|
|
840
840
|
/**
|
|
841
841
|
* Creates a [Locator] from a reading order [Link].
|
|
842
842
|
*/
|
|
843
843
|
get locator() {
|
|
844
844
|
let e = this.href.split("#");
|
|
845
|
-
return new
|
|
845
|
+
return new D({
|
|
846
846
|
href: e.length > 0 && e[0] !== void 0 ? e[0] : this.href,
|
|
847
847
|
type: this.type ?? "",
|
|
848
848
|
title: this.title,
|
|
849
|
-
locations: new
|
|
849
|
+
locations: new x({
|
|
850
850
|
fragments: e.length > 1 && e[1] !== void 0 ? [e[1]] : []
|
|
851
851
|
})
|
|
852
852
|
});
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
class
|
|
855
|
+
class q {
|
|
856
856
|
/**
|
|
857
857
|
* Creates a [Links].
|
|
858
858
|
*/
|
|
@@ -864,8 +864,8 @@ class ae {
|
|
|
864
864
|
*/
|
|
865
865
|
static deserialize(e) {
|
|
866
866
|
if (e && e instanceof Array)
|
|
867
|
-
return new
|
|
868
|
-
e.map((t) =>
|
|
867
|
+
return new q(
|
|
868
|
+
e.map((t) => B.deserialize(t)).filter((t) => t !== void 0)
|
|
869
869
|
);
|
|
870
870
|
}
|
|
871
871
|
/**
|
|
@@ -876,39 +876,39 @@ class ae {
|
|
|
876
876
|
}
|
|
877
877
|
/** Finds the first link with the given relation. */
|
|
878
878
|
findWithRel(e) {
|
|
879
|
-
const t = (
|
|
879
|
+
const t = (i) => i.rels && i.rels.has(e);
|
|
880
880
|
return this.items.find(t);
|
|
881
881
|
}
|
|
882
882
|
/** Finds all the links with the given relation. */
|
|
883
883
|
filterByRel(e) {
|
|
884
|
-
const t = (
|
|
884
|
+
const t = (i) => i.rels && i.rels.has(e);
|
|
885
885
|
return this.items.filter(t);
|
|
886
886
|
}
|
|
887
887
|
/** Finds the first link matching the given HREF. */
|
|
888
888
|
findWithHref(e) {
|
|
889
|
-
const t = (
|
|
889
|
+
const t = (i) => i.href === e;
|
|
890
890
|
return this.items.find(t);
|
|
891
891
|
}
|
|
892
892
|
/** Finds the index of the first link matching the given HREF. */
|
|
893
893
|
findIndexWithHref(e) {
|
|
894
|
-
const t = (
|
|
894
|
+
const t = (i) => i.href === e;
|
|
895
895
|
return this.items.findIndex(t);
|
|
896
896
|
}
|
|
897
897
|
/** Finds the first link matching the given media type. */
|
|
898
898
|
findWithMediaType(e) {
|
|
899
|
-
const t = (
|
|
899
|
+
const t = (i) => i.mediaType.matches(e);
|
|
900
900
|
return this.items.find(t);
|
|
901
901
|
}
|
|
902
902
|
/** Finds all the links matching the given media type. */
|
|
903
903
|
filterByMediaType(e) {
|
|
904
|
-
const t = (
|
|
904
|
+
const t = (i) => i.mediaType.matches(e);
|
|
905
905
|
return this.items.filter(t);
|
|
906
906
|
}
|
|
907
907
|
/** Finds all the links matching any of the given media types. */
|
|
908
908
|
filterByMediaTypes(e) {
|
|
909
|
-
const t = (
|
|
910
|
-
for (const
|
|
911
|
-
if (
|
|
909
|
+
const t = (i) => {
|
|
910
|
+
for (const s of e)
|
|
911
|
+
if (i.mediaType.matches(s))
|
|
912
912
|
return !0;
|
|
913
913
|
return !1;
|
|
914
914
|
};
|
|
@@ -937,8 +937,8 @@ class ae {
|
|
|
937
937
|
/** Returns whether all the resources in the collection are matching any of the given media types. */
|
|
938
938
|
everyMatchesMediaType(e) {
|
|
939
939
|
return Array.isArray(e) ? this.items.length > 0 && this.items.every((t) => {
|
|
940
|
-
for (const
|
|
941
|
-
return t.mediaType.matches(
|
|
940
|
+
for (const i of e)
|
|
941
|
+
return t.mediaType.matches(i);
|
|
942
942
|
return !1;
|
|
943
943
|
}) : this.items.length > 0 && this.items.every((t) => t.mediaType.matches(e));
|
|
944
944
|
}
|
|
@@ -946,7 +946,7 @@ class ae {
|
|
|
946
946
|
return this.items.filter((e) => e.type);
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
class
|
|
949
|
+
class V {
|
|
950
950
|
/**
|
|
951
951
|
* Creates a [DomRange].
|
|
952
952
|
*/
|
|
@@ -959,14 +959,14 @@ class le {
|
|
|
959
959
|
static deserialize(e) {
|
|
960
960
|
if (!(e && e.cssSelector))
|
|
961
961
|
return;
|
|
962
|
-
let t =
|
|
962
|
+
let t = C(e.textNodeIndex);
|
|
963
963
|
if (t === void 0)
|
|
964
964
|
return;
|
|
965
|
-
let
|
|
966
|
-
return
|
|
965
|
+
let i = C(e.charOffset);
|
|
966
|
+
return i === void 0 && (i = C(e.offset)), new V({
|
|
967
967
|
cssSelector: e.cssSelector,
|
|
968
968
|
textNodeIndex: t,
|
|
969
|
-
charOffset:
|
|
969
|
+
charOffset: i
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
/**
|
|
@@ -980,7 +980,7 @@ class le {
|
|
|
980
980
|
return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
|
-
class
|
|
983
|
+
class re {
|
|
984
984
|
/**
|
|
985
985
|
* Creates a [DomRange].
|
|
986
986
|
*/
|
|
@@ -993,11 +993,11 @@ class Te {
|
|
|
993
993
|
static deserialize(e) {
|
|
994
994
|
if (!e)
|
|
995
995
|
return;
|
|
996
|
-
let t =
|
|
996
|
+
let t = V.deserialize(e.start);
|
|
997
997
|
if (t)
|
|
998
|
-
return new
|
|
998
|
+
return new re({
|
|
999
999
|
start: t,
|
|
1000
|
-
end:
|
|
1000
|
+
end: V.deserialize(e.end)
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
1003
|
/**
|
|
@@ -1008,55 +1008,55 @@ class Te {
|
|
|
1008
1008
|
return this.end && (e.end = this.end.serialize()), e;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
|
|
1012
|
-
var
|
|
1013
|
-
return (
|
|
1011
|
+
x.prototype.getCssSelector = function() {
|
|
1012
|
+
var r;
|
|
1013
|
+
return (r = this.otherLocations) == null ? void 0 : r.get("cssSelector");
|
|
1014
1014
|
};
|
|
1015
|
-
|
|
1016
|
-
var
|
|
1017
|
-
return (
|
|
1015
|
+
x.prototype.getPartialCfi = function() {
|
|
1016
|
+
var r;
|
|
1017
|
+
return (r = this.otherLocations) == null ? void 0 : r.get("partialCfi");
|
|
1018
1018
|
};
|
|
1019
|
-
|
|
1020
|
-
var
|
|
1021
|
-
return
|
|
1019
|
+
x.prototype.getDomRange = function() {
|
|
1020
|
+
var r;
|
|
1021
|
+
return re.deserialize((r = this.otherLocations) == null ? void 0 : r.get("domRange"));
|
|
1022
1022
|
};
|
|
1023
|
-
|
|
1023
|
+
x.prototype.fragmentParameters = function() {
|
|
1024
1024
|
return new Map(
|
|
1025
|
-
this.fragments.map((
|
|
1026
|
-
|
|
1027
|
-
|
|
1025
|
+
this.fragments.map((r) => r.startsWith("#") ? r.slice(1) : r).join("&").split("&").filter((r) => !r.startsWith("#")).map((r) => r.split("=")).filter((r) => r.length === 2).map((r) => [
|
|
1026
|
+
r[0].trim().toLowerCase(),
|
|
1027
|
+
r[1].trim()
|
|
1028
1028
|
])
|
|
1029
1029
|
);
|
|
1030
1030
|
};
|
|
1031
|
-
|
|
1031
|
+
x.prototype.htmlId = function() {
|
|
1032
1032
|
if (!this.fragments.length)
|
|
1033
1033
|
return;
|
|
1034
|
-
let
|
|
1035
|
-
if (!
|
|
1034
|
+
let r = this.fragments.find((e) => e.length && !e.includes("="));
|
|
1035
|
+
if (!r) {
|
|
1036
1036
|
const e = this.fragmentParameters();
|
|
1037
|
-
e.has("id") ?
|
|
1037
|
+
e.has("id") ? r = e.get("id") : e.has("name") && (r = e.get("name"));
|
|
1038
1038
|
}
|
|
1039
|
-
return
|
|
1039
|
+
return r != null && r.startsWith("#") ? r.slice(1) : r;
|
|
1040
1040
|
};
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
if (!isNaN(
|
|
1044
|
-
return
|
|
1041
|
+
x.prototype.page = function() {
|
|
1042
|
+
const r = parseInt(this.fragmentParameters().get("page"));
|
|
1043
|
+
if (!isNaN(r) && r >= 0)
|
|
1044
|
+
return r;
|
|
1045
1045
|
};
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
if (!isNaN(
|
|
1049
|
-
return
|
|
1046
|
+
x.prototype.time = function() {
|
|
1047
|
+
const r = parseInt(this.fragmentParameters().get("t"));
|
|
1048
|
+
if (!isNaN(r))
|
|
1049
|
+
return r;
|
|
1050
1050
|
};
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
if (!
|
|
1051
|
+
x.prototype.space = function() {
|
|
1052
|
+
const r = this.fragmentParameters();
|
|
1053
|
+
if (!r.has("xywh"))
|
|
1054
1054
|
return;
|
|
1055
|
-
const e =
|
|
1055
|
+
const e = r.get("xywh").split(",").map((t) => parseInt(t));
|
|
1056
1056
|
if (e.length === 4 && !e.some(isNaN))
|
|
1057
1057
|
return e;
|
|
1058
1058
|
};
|
|
1059
|
-
class
|
|
1059
|
+
class se {
|
|
1060
1060
|
/** Creates a [Price]. */
|
|
1061
1061
|
constructor(e) {
|
|
1062
1062
|
this.currency = e.currency, this.value = e.value;
|
|
@@ -1070,9 +1070,9 @@ class Se {
|
|
|
1070
1070
|
let t = e.currency;
|
|
1071
1071
|
if (!(t && typeof t == "string" && t.length > 0))
|
|
1072
1072
|
return;
|
|
1073
|
-
let
|
|
1074
|
-
if (
|
|
1075
|
-
return new
|
|
1073
|
+
let i = C(e.value);
|
|
1074
|
+
if (i !== void 0)
|
|
1075
|
+
return new se({ currency: t, value: i });
|
|
1076
1076
|
}
|
|
1077
1077
|
/**
|
|
1078
1078
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1081,7 +1081,7 @@ class Se {
|
|
|
1081
1081
|
return { currency: this.currency, value: this.value };
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
|
-
class
|
|
1084
|
+
class H {
|
|
1085
1085
|
/** Creates a [Acquisition]. */
|
|
1086
1086
|
constructor(e) {
|
|
1087
1087
|
this.type = e.type, this.children = e.children;
|
|
@@ -1091,14 +1091,14 @@ class G {
|
|
|
1091
1091
|
*/
|
|
1092
1092
|
static deserialize(e) {
|
|
1093
1093
|
if (e && e.type)
|
|
1094
|
-
return new
|
|
1094
|
+
return new H({
|
|
1095
1095
|
type: e.type,
|
|
1096
|
-
children:
|
|
1096
|
+
children: H.deserializeArray(e.children)
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
static deserializeArray(e) {
|
|
1100
1100
|
if (e instanceof Array)
|
|
1101
|
-
return e.map((t) =>
|
|
1101
|
+
return e.map((t) => H.deserialize(t)).filter((t) => t !== void 0);
|
|
1102
1102
|
}
|
|
1103
1103
|
/**
|
|
1104
1104
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1108,7 +1108,7 @@ class G {
|
|
|
1108
1108
|
return this.children && (e.children = this.children.map((t) => t.serialize())), e;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
class
|
|
1111
|
+
class ne {
|
|
1112
1112
|
/** Creates a [Price]. */
|
|
1113
1113
|
constructor(e) {
|
|
1114
1114
|
this.total = e.total, this.position = e.position;
|
|
@@ -1118,9 +1118,9 @@ class Ce {
|
|
|
1118
1118
|
*/
|
|
1119
1119
|
static deserialize(e) {
|
|
1120
1120
|
if (e)
|
|
1121
|
-
return new
|
|
1122
|
-
total:
|
|
1123
|
-
position:
|
|
1121
|
+
return new ne({
|
|
1122
|
+
total: C(e.total),
|
|
1123
|
+
position: C(e.position)
|
|
1124
1124
|
});
|
|
1125
1125
|
}
|
|
1126
1126
|
/**
|
|
@@ -1131,7 +1131,7 @@ class Ce {
|
|
|
1131
1131
|
return this.total !== void 0 && (e.total = this.total), this.position !== void 0 && (e.position = this.position), e;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
class
|
|
1134
|
+
class oe {
|
|
1135
1135
|
/** Creates a [Copies]. */
|
|
1136
1136
|
constructor(e) {
|
|
1137
1137
|
this.total = e.total, this.available = e.available;
|
|
@@ -1141,9 +1141,9 @@ class Oe {
|
|
|
1141
1141
|
*/
|
|
1142
1142
|
static deserialize(e) {
|
|
1143
1143
|
if (e)
|
|
1144
|
-
return new
|
|
1145
|
-
total:
|
|
1146
|
-
available:
|
|
1144
|
+
return new oe({
|
|
1145
|
+
total: C(e.total),
|
|
1146
|
+
available: C(e.available)
|
|
1147
1147
|
});
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
@@ -1154,7 +1154,7 @@ class Oe {
|
|
|
1154
1154
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
|
-
class
|
|
1157
|
+
class ae {
|
|
1158
1158
|
/** Creates a [Availability]. */
|
|
1159
1159
|
constructor(e) {
|
|
1160
1160
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1164,10 +1164,10 @@ class Pe {
|
|
|
1164
1164
|
*/
|
|
1165
1165
|
static deserialize(e) {
|
|
1166
1166
|
if (e && e.state)
|
|
1167
|
-
return new
|
|
1167
|
+
return new ae({
|
|
1168
1168
|
state: e.state,
|
|
1169
|
-
since:
|
|
1170
|
-
until:
|
|
1169
|
+
since: ve(e.since),
|
|
1170
|
+
until: ve(e.until)
|
|
1171
1171
|
});
|
|
1172
1172
|
}
|
|
1173
1173
|
/**
|
|
@@ -1178,334 +1178,334 @@ class Pe {
|
|
|
1178
1178
|
return this.since !== void 0 && (e.since = this.since.toISOString()), this.until !== void 0 && (e.until = this.until.toISOString()), e;
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
|
-
|
|
1182
|
-
return
|
|
1181
|
+
E.prototype.getNumberOfItems = function() {
|
|
1182
|
+
return C(this.otherProperties.numberOfItems);
|
|
1183
1183
|
};
|
|
1184
|
-
|
|
1185
|
-
return
|
|
1184
|
+
E.prototype.getPrice = function() {
|
|
1185
|
+
return se.deserialize(this.otherProperties.price);
|
|
1186
1186
|
};
|
|
1187
|
-
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
return
|
|
1187
|
+
E.prototype.getIndirectAcquisitions = function() {
|
|
1188
|
+
const r = this.otherProperties.indirectAcquisition;
|
|
1189
|
+
if (r && r instanceof Array)
|
|
1190
|
+
return r.map((e) => H.deserialize(e)).filter((e) => e !== void 0);
|
|
1191
1191
|
};
|
|
1192
|
-
|
|
1193
|
-
return
|
|
1192
|
+
E.prototype.getHolds = function() {
|
|
1193
|
+
return ne.deserialize(this.otherProperties.holds);
|
|
1194
1194
|
};
|
|
1195
|
-
|
|
1196
|
-
return
|
|
1195
|
+
E.prototype.getCopies = function() {
|
|
1196
|
+
return oe.deserialize(this.otherProperties.copies);
|
|
1197
1197
|
};
|
|
1198
|
-
|
|
1199
|
-
return
|
|
1198
|
+
E.prototype.getAvailability = function() {
|
|
1199
|
+
return ae.deserialize(this.otherProperties.availability);
|
|
1200
1200
|
};
|
|
1201
|
-
|
|
1202
|
-
return
|
|
1201
|
+
E.prototype.getAuthenticate = function() {
|
|
1202
|
+
return B.deserialize(this.otherProperties.authenticate);
|
|
1203
1203
|
};
|
|
1204
|
-
|
|
1204
|
+
E.prototype.getClipped = function() {
|
|
1205
1205
|
return this.otherProperties.clipped;
|
|
1206
1206
|
};
|
|
1207
|
-
|
|
1207
|
+
E.prototype.getFit = function() {
|
|
1208
1208
|
return this.otherProperties.fit;
|
|
1209
1209
|
};
|
|
1210
|
-
|
|
1210
|
+
E.prototype.getOrientation = function() {
|
|
1211
1211
|
return this.otherProperties.orientation;
|
|
1212
1212
|
};
|
|
1213
|
-
|
|
1213
|
+
E.prototype.getOverflow = function() {
|
|
1214
1214
|
return this.otherProperties.overflow;
|
|
1215
1215
|
};
|
|
1216
|
-
|
|
1216
|
+
E.prototype.getPage = function() {
|
|
1217
1217
|
return this.otherProperties.page || void 0;
|
|
1218
1218
|
};
|
|
1219
|
-
|
|
1219
|
+
E.prototype.getSpread = function() {
|
|
1220
1220
|
return this.otherProperties.spread || void 0;
|
|
1221
1221
|
};
|
|
1222
|
-
var
|
|
1223
|
-
(function(
|
|
1224
|
-
|
|
1225
|
-
})(
|
|
1226
|
-
var
|
|
1227
|
-
(function(
|
|
1228
|
-
|
|
1229
|
-
})(
|
|
1230
|
-
const
|
|
1231
|
-
function
|
|
1232
|
-
console.warn(`${
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
function
|
|
1236
|
-
return
|
|
1237
|
-
}
|
|
1238
|
-
function
|
|
1239
|
-
return
|
|
1240
|
-
}
|
|
1241
|
-
function
|
|
1242
|
-
const e =
|
|
1243
|
-
if (
|
|
1244
|
-
return (
|
|
1222
|
+
var R;
|
|
1223
|
+
(function(r) {
|
|
1224
|
+
r.NONE = "none", r.DESCENDANT = "descendant", r.CHILD = "child";
|
|
1225
|
+
})(R || (R = {}));
|
|
1226
|
+
var P;
|
|
1227
|
+
(function(r) {
|
|
1228
|
+
r.id = "id", r.class = "class", r.tag = "tag", r.attribute = "attribute", r.nthchild = "nthchild", r.nthoftype = "nthoftype";
|
|
1229
|
+
})(P || (P = {}));
|
|
1230
|
+
const ct = "CssSelectorGenerator";
|
|
1231
|
+
function Ee(r = "unknown problem", ...e) {
|
|
1232
|
+
console.warn(`${ct}: ${r}`, ...e);
|
|
1233
|
+
}
|
|
1234
|
+
P.id, P.class, P.tag, P.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
|
|
1235
|
+
function dt(r) {
|
|
1236
|
+
return r instanceof RegExp;
|
|
1237
|
+
}
|
|
1238
|
+
function ut(r) {
|
|
1239
|
+
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1240
|
+
}
|
|
1241
|
+
function pt(r) {
|
|
1242
|
+
const e = r.map((t) => {
|
|
1243
|
+
if (dt(t))
|
|
1244
|
+
return (i) => t.test(i);
|
|
1245
1245
|
if (typeof t == "function")
|
|
1246
|
-
return (
|
|
1247
|
-
const
|
|
1248
|
-
return typeof
|
|
1246
|
+
return (i) => {
|
|
1247
|
+
const s = t(i);
|
|
1248
|
+
return typeof s != "boolean" ? (Ee("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", t), !1) : s;
|
|
1249
1249
|
};
|
|
1250
1250
|
if (typeof t == "string") {
|
|
1251
|
-
const
|
|
1252
|
-
return (
|
|
1251
|
+
const i = new RegExp("^" + ut(t) + "$");
|
|
1252
|
+
return (s) => i.test(s);
|
|
1253
1253
|
}
|
|
1254
|
-
return
|
|
1254
|
+
return Ee("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", t), () => !1;
|
|
1255
1255
|
});
|
|
1256
|
-
return (t) => e.some((
|
|
1256
|
+
return (t) => e.some((i) => i(t));
|
|
1257
1257
|
}
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1258
|
+
const ft = "", mt = " > ", gt = " ";
|
|
1259
|
+
R.NONE + "", R.NONE, R.DESCENDANT + "", R.DESCENDANT, R.CHILD + "", R.CHILD;
|
|
1260
|
+
P.nthoftype, P.tag, P.id, P.class, P.attribute, P.nthchild;
|
|
1261
|
+
pt([
|
|
1262
1262
|
"class",
|
|
1263
1263
|
"id",
|
|
1264
1264
|
// Angular attributes
|
|
1265
1265
|
"ng-*"
|
|
1266
1266
|
]);
|
|
1267
|
-
class
|
|
1267
|
+
class Y {
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1270
|
-
return
|
|
1269
|
+
function be(r) {
|
|
1270
|
+
return r.split("").reverse().join("");
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1273
|
-
const
|
|
1274
|
-
return t.map((
|
|
1275
|
-
const
|
|
1272
|
+
function yt(r, e, t) {
|
|
1273
|
+
const i = be(e);
|
|
1274
|
+
return t.map((s) => {
|
|
1275
|
+
const n = Math.max(0, s.end - e.length - s.errors), o = be(r.slice(n, s.end));
|
|
1276
1276
|
return {
|
|
1277
|
-
start:
|
|
1278
|
-
end:
|
|
1279
|
-
errors:
|
|
1277
|
+
start: Fe(o, i, s.errors).reduce((h, c) => s.end - c.end < h ? s.end - c.end : h, s.end),
|
|
1278
|
+
end: s.end,
|
|
1279
|
+
errors: s.errors
|
|
1280
1280
|
};
|
|
1281
1281
|
});
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return (
|
|
1283
|
+
function Z(r) {
|
|
1284
|
+
return (r | -r) >> 31 & 1;
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
let
|
|
1288
|
-
const o =
|
|
1289
|
-
let
|
|
1290
|
-
const
|
|
1291
|
-
return
|
|
1286
|
+
function xe(r, e, t, i) {
|
|
1287
|
+
let s = r.P[t], n = r.M[t];
|
|
1288
|
+
const o = i >>> 31, a = e[t] | o, h = a | n, c = (a & s) + s ^ s | a;
|
|
1289
|
+
let d = n | ~(c | s), p = s & c;
|
|
1290
|
+
const u = Z(d & r.lastRowMask[t]) - Z(p & r.lastRowMask[t]);
|
|
1291
|
+
return d <<= 1, p <<= 1, p |= o, d |= Z(i) - o, s = p | ~(h | d), n = d & h, r.P[t] = s, r.M[t] = n, u;
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1293
|
+
function Fe(r, e, t) {
|
|
1294
1294
|
if (e.length === 0)
|
|
1295
1295
|
return [];
|
|
1296
1296
|
t = Math.min(t, e.length);
|
|
1297
|
-
const
|
|
1298
|
-
P: new Uint32Array(
|
|
1299
|
-
M: new Uint32Array(
|
|
1300
|
-
lastRowMask: new Uint32Array(
|
|
1297
|
+
const i = [], s = 32, n = Math.ceil(e.length / s) - 1, o = {
|
|
1298
|
+
P: new Uint32Array(n + 1),
|
|
1299
|
+
M: new Uint32Array(n + 1),
|
|
1300
|
+
lastRowMask: new Uint32Array(n + 1)
|
|
1301
1301
|
};
|
|
1302
|
-
o.lastRowMask.fill(1 << 31), o.lastRowMask[
|
|
1303
|
-
const a = new Uint32Array(
|
|
1304
|
-
for (let
|
|
1302
|
+
o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % s;
|
|
1303
|
+
const a = new Uint32Array(n + 1), h = /* @__PURE__ */ new Map(), c = [];
|
|
1304
|
+
for (let u = 0; u < 256; u++)
|
|
1305
1305
|
c.push(a);
|
|
1306
|
-
for (let
|
|
1307
|
-
const f = e.charCodeAt(
|
|
1306
|
+
for (let u = 0; u < e.length; u += 1) {
|
|
1307
|
+
const f = e.charCodeAt(u);
|
|
1308
1308
|
if (h.has(f))
|
|
1309
1309
|
continue;
|
|
1310
|
-
const
|
|
1311
|
-
h.set(f,
|
|
1312
|
-
for (let
|
|
1313
|
-
|
|
1314
|
-
for (let
|
|
1315
|
-
const
|
|
1316
|
-
if (
|
|
1310
|
+
const g = new Uint32Array(n + 1);
|
|
1311
|
+
h.set(f, g), f < c.length && (c[f] = g);
|
|
1312
|
+
for (let m = 0; m <= n; m += 1) {
|
|
1313
|
+
g[m] = 0;
|
|
1314
|
+
for (let v = 0; v < s; v += 1) {
|
|
1315
|
+
const S = m * s + v;
|
|
1316
|
+
if (S >= e.length)
|
|
1317
1317
|
continue;
|
|
1318
|
-
e.charCodeAt(
|
|
1318
|
+
e.charCodeAt(S) === f && (g[m] |= 1 << v);
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
let
|
|
1323
|
-
const p = new Uint32Array(
|
|
1324
|
-
for (let
|
|
1325
|
-
p[
|
|
1326
|
-
p[
|
|
1327
|
-
for (let
|
|
1328
|
-
o.P[
|
|
1329
|
-
for (let
|
|
1330
|
-
const f =
|
|
1331
|
-
let
|
|
1332
|
-
f < c.length ?
|
|
1333
|
-
let
|
|
1334
|
-
for (let
|
|
1335
|
-
|
|
1336
|
-
if (p[
|
|
1337
|
-
|
|
1338
|
-
let
|
|
1339
|
-
if (
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1322
|
+
let d = Math.max(0, Math.ceil(t / s) - 1);
|
|
1323
|
+
const p = new Uint32Array(n + 1);
|
|
1324
|
+
for (let u = 0; u <= d; u += 1)
|
|
1325
|
+
p[u] = (u + 1) * s;
|
|
1326
|
+
p[n] = e.length;
|
|
1327
|
+
for (let u = 0; u <= d; u += 1)
|
|
1328
|
+
o.P[u] = -1, o.M[u] = 0;
|
|
1329
|
+
for (let u = 0; u < r.length; u += 1) {
|
|
1330
|
+
const f = r.charCodeAt(u);
|
|
1331
|
+
let g;
|
|
1332
|
+
f < c.length ? g = c[f] : (g = h.get(f), typeof g > "u" && (g = a));
|
|
1333
|
+
let m = 0;
|
|
1334
|
+
for (let v = 0; v <= d; v += 1)
|
|
1335
|
+
m = xe(o, g, v, m), p[v] += m;
|
|
1336
|
+
if (p[d] - m <= t && d < n && (g[d + 1] & 1 || m < 0)) {
|
|
1337
|
+
d += 1, o.P[d] = -1, o.M[d] = 0;
|
|
1338
|
+
let v;
|
|
1339
|
+
if (d === n) {
|
|
1340
|
+
const S = e.length % s;
|
|
1341
|
+
v = S === 0 ? s : S;
|
|
1342
1342
|
} else
|
|
1343
|
-
|
|
1344
|
-
p[
|
|
1343
|
+
v = s;
|
|
1344
|
+
p[d] = p[d - 1] + v - m + xe(o, g, d, m);
|
|
1345
1345
|
} else
|
|
1346
|
-
for (;
|
|
1347
|
-
|
|
1348
|
-
|
|
1346
|
+
for (; d > 0 && p[d] >= t + s; )
|
|
1347
|
+
d -= 1;
|
|
1348
|
+
d === n && p[d] <= t && (p[d] < t && i.splice(0, i.length), i.push({
|
|
1349
1349
|
start: -1,
|
|
1350
|
-
end:
|
|
1351
|
-
errors: p[
|
|
1352
|
-
}), t = p[
|
|
1350
|
+
end: u + 1,
|
|
1351
|
+
errors: p[d]
|
|
1352
|
+
}), t = p[d]);
|
|
1353
1353
|
}
|
|
1354
|
-
return
|
|
1354
|
+
return i;
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1357
|
-
const
|
|
1358
|
-
return
|
|
1359
|
-
}
|
|
1360
|
-
function
|
|
1361
|
-
let
|
|
1362
|
-
const
|
|
1363
|
-
for (;
|
|
1364
|
-
|
|
1365
|
-
start:
|
|
1366
|
-
end:
|
|
1356
|
+
function vt(r, e, t) {
|
|
1357
|
+
const i = Fe(r, e, t);
|
|
1358
|
+
return yt(r, e, i);
|
|
1359
|
+
}
|
|
1360
|
+
function Be(r, e, t) {
|
|
1361
|
+
let i = 0;
|
|
1362
|
+
const s = [];
|
|
1363
|
+
for (; i !== -1; )
|
|
1364
|
+
i = r.indexOf(e, i), i !== -1 && (s.push({
|
|
1365
|
+
start: i,
|
|
1366
|
+
end: i + e.length,
|
|
1367
1367
|
errors: 0
|
|
1368
|
-
}),
|
|
1369
|
-
return
|
|
1368
|
+
}), i += 1);
|
|
1369
|
+
return s.length > 0 ? s : vt(r, e, t);
|
|
1370
1370
|
}
|
|
1371
|
-
function
|
|
1372
|
-
return e.length === 0 ||
|
|
1371
|
+
function Se(r, e) {
|
|
1372
|
+
return e.length === 0 || r.length === 0 ? 0 : 1 - Be(r, e, e.length)[0].errors / e.length;
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function Et(r, e, t = {}) {
|
|
1375
1375
|
if (e.length === 0)
|
|
1376
1376
|
return null;
|
|
1377
|
-
const
|
|
1378
|
-
if (
|
|
1377
|
+
const i = Math.min(256, e.length / 2), s = Be(r, e, i);
|
|
1378
|
+
if (s.length === 0)
|
|
1379
1379
|
return null;
|
|
1380
|
-
const
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1380
|
+
const n = (a) => {
|
|
1381
|
+
const u = 1 - a.errors / e.length, f = t.prefix ? Se(
|
|
1382
|
+
r.slice(
|
|
1383
1383
|
Math.max(0, a.start - t.prefix.length),
|
|
1384
1384
|
a.start
|
|
1385
1385
|
),
|
|
1386
1386
|
t.prefix
|
|
1387
|
-
) : 1,
|
|
1388
|
-
|
|
1387
|
+
) : 1, g = t.suffix ? Se(
|
|
1388
|
+
r.slice(a.end, a.end + t.suffix.length),
|
|
1389
1389
|
t.suffix
|
|
1390
1390
|
) : 1;
|
|
1391
|
-
let
|
|
1392
|
-
typeof t.hint == "number" && (
|
|
1393
|
-
const
|
|
1394
|
-
return
|
|
1395
|
-
}, o =
|
|
1391
|
+
let m = 1;
|
|
1392
|
+
typeof t.hint == "number" && (m = 1 - Math.abs(a.start - t.hint) / r.length);
|
|
1393
|
+
const v = 50 * u + 20 * f + 20 * g + 2 * m, S = 50 + 20 + 20 + 2;
|
|
1394
|
+
return v / S;
|
|
1395
|
+
}, o = s.map((a) => ({
|
|
1396
1396
|
start: a.start,
|
|
1397
1397
|
end: a.end,
|
|
1398
|
-
score:
|
|
1398
|
+
score: n(a)
|
|
1399
1399
|
}));
|
|
1400
1400
|
return o.sort((a, h) => h.score - a.score), o[0];
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const
|
|
1404
|
-
if (
|
|
1402
|
+
function J(r, e, t) {
|
|
1403
|
+
const i = t === 1 ? e : e - 1;
|
|
1404
|
+
if (r.charAt(i).trim() !== "")
|
|
1405
1405
|
return e;
|
|
1406
|
-
let
|
|
1407
|
-
if (t === 2 ? (
|
|
1406
|
+
let s, n;
|
|
1407
|
+
if (t === 2 ? (s = r.substring(0, e), n = s.trimEnd()) : (s = r.substring(e), n = s.trimStart()), !n.length)
|
|
1408
1408
|
return -1;
|
|
1409
|
-
const o =
|
|
1409
|
+
const o = s.length - n.length;
|
|
1410
1410
|
return t === 2 ? e - o : e + o;
|
|
1411
1411
|
}
|
|
1412
|
-
function
|
|
1413
|
-
const t =
|
|
1414
|
-
|
|
1412
|
+
function Te(r, e) {
|
|
1413
|
+
const t = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1414
|
+
r.commonAncestorContainer,
|
|
1415
1415
|
NodeFilter.SHOW_TEXT
|
|
1416
|
-
),
|
|
1417
|
-
let
|
|
1418
|
-
for (;
|
|
1419
|
-
|
|
1420
|
-
e === 2 && (
|
|
1416
|
+
), i = e === 1 ? r.startContainer : r.endContainer, s = e === 1 ? r.endContainer : r.startContainer;
|
|
1417
|
+
let n = t.nextNode();
|
|
1418
|
+
for (; n && n !== i; )
|
|
1419
|
+
n = t.nextNode();
|
|
1420
|
+
e === 2 && (n = t.previousNode());
|
|
1421
1421
|
let o = -1;
|
|
1422
1422
|
const a = () => {
|
|
1423
|
-
if (
|
|
1424
|
-
const h =
|
|
1425
|
-
o =
|
|
1423
|
+
if (n = e === 1 ? t.nextNode() : t.previousNode(), n) {
|
|
1424
|
+
const h = n.textContent, c = e === 1 ? 0 : h.length;
|
|
1425
|
+
o = J(h, c, e);
|
|
1426
1426
|
}
|
|
1427
1427
|
};
|
|
1428
|
-
for (;
|
|
1428
|
+
for (; n && o === -1 && n !== s; )
|
|
1429
1429
|
a();
|
|
1430
|
-
if (
|
|
1431
|
-
return { node:
|
|
1430
|
+
if (n && o >= 0)
|
|
1431
|
+
return { node: n, offset: o };
|
|
1432
1432
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1435
|
-
if (!
|
|
1434
|
+
function bt(r) {
|
|
1435
|
+
if (!r.toString().trim().length)
|
|
1436
1436
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1437
|
-
if (
|
|
1437
|
+
if (r.startContainer.nodeType !== Node.TEXT_NODE)
|
|
1438
1438
|
throw new RangeError("Range startContainer is not a text node");
|
|
1439
|
-
if (
|
|
1439
|
+
if (r.endContainer.nodeType !== Node.TEXT_NODE)
|
|
1440
1440
|
throw new RangeError("Range endContainer is not a text node");
|
|
1441
|
-
const e =
|
|
1442
|
-
let t = !1,
|
|
1443
|
-
const
|
|
1444
|
-
start:
|
|
1445
|
-
|
|
1446
|
-
|
|
1441
|
+
const e = r.cloneRange();
|
|
1442
|
+
let t = !1, i = !1;
|
|
1443
|
+
const s = {
|
|
1444
|
+
start: J(
|
|
1445
|
+
r.startContainer.textContent,
|
|
1446
|
+
r.startOffset,
|
|
1447
1447
|
1
|
|
1448
1448
|
/* Forwards */
|
|
1449
1449
|
),
|
|
1450
|
-
end:
|
|
1451
|
-
|
|
1452
|
-
|
|
1450
|
+
end: J(
|
|
1451
|
+
r.endContainer.textContent,
|
|
1452
|
+
r.endOffset,
|
|
1453
1453
|
2
|
|
1454
1454
|
/* Backwards */
|
|
1455
1455
|
)
|
|
1456
1456
|
};
|
|
1457
|
-
if (
|
|
1457
|
+
if (s.start >= 0 && (e.setStart(r.startContainer, s.start), t = !0), s.end > 0 && (e.setEnd(r.endContainer, s.end), i = !0), t && i)
|
|
1458
1458
|
return e;
|
|
1459
1459
|
if (!t) {
|
|
1460
|
-
const { node:
|
|
1460
|
+
const { node: n, offset: o } = Te(
|
|
1461
1461
|
e,
|
|
1462
1462
|
1
|
|
1463
1463
|
/* Forwards */
|
|
1464
1464
|
);
|
|
1465
|
-
|
|
1465
|
+
n && o >= 0 && e.setStart(n, o);
|
|
1466
1466
|
}
|
|
1467
|
-
if (!
|
|
1468
|
-
const { node:
|
|
1467
|
+
if (!i) {
|
|
1468
|
+
const { node: n, offset: o } = Te(
|
|
1469
1469
|
e,
|
|
1470
1470
|
2
|
|
1471
1471
|
/* Backwards */
|
|
1472
1472
|
);
|
|
1473
|
-
|
|
1473
|
+
n && o > 0 && e.setEnd(n, o);
|
|
1474
1474
|
}
|
|
1475
1475
|
return e;
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function Ue(r) {
|
|
1478
1478
|
var e;
|
|
1479
|
-
switch (
|
|
1479
|
+
switch (r.nodeType) {
|
|
1480
1480
|
case Node.ELEMENT_NODE:
|
|
1481
1481
|
case Node.TEXT_NODE:
|
|
1482
|
-
return ((e =
|
|
1482
|
+
return ((e = r.textContent) == null ? void 0 : e.length) ?? 0;
|
|
1483
1483
|
default:
|
|
1484
1484
|
return 0;
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1488
|
-
let e =
|
|
1487
|
+
function we(r) {
|
|
1488
|
+
let e = r.previousSibling, t = 0;
|
|
1489
1489
|
for (; e; )
|
|
1490
|
-
t +=
|
|
1490
|
+
t += Ue(e), e = e.previousSibling;
|
|
1491
1491
|
return t;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function ke(r, ...e) {
|
|
1494
1494
|
let t = e.shift();
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1495
|
+
const i = r.ownerDocument.createNodeIterator(
|
|
1496
|
+
r,
|
|
1497
1497
|
NodeFilter.SHOW_TEXT
|
|
1498
|
-
),
|
|
1499
|
-
let
|
|
1500
|
-
for (; t !== void 0 &&
|
|
1501
|
-
o =
|
|
1498
|
+
), s = [];
|
|
1499
|
+
let n = i.nextNode(), o, a = 0;
|
|
1500
|
+
for (; t !== void 0 && n; )
|
|
1501
|
+
o = n, a + o.data.length > t ? (s.push({ node: o, offset: t - a }), t = e.shift()) : (n = i.nextNode(), a += o.data.length);
|
|
1502
1502
|
for (; t !== void 0 && o && a === t; )
|
|
1503
|
-
|
|
1503
|
+
s.push({ node: o, offset: o.data.length }), t = e.shift();
|
|
1504
1504
|
if (t !== void 0)
|
|
1505
1505
|
throw new RangeError("Offset exceeds text length");
|
|
1506
|
-
return
|
|
1506
|
+
return s;
|
|
1507
1507
|
}
|
|
1508
|
-
class
|
|
1508
|
+
class M {
|
|
1509
1509
|
constructor(e, t) {
|
|
1510
1510
|
if (t < 0)
|
|
1511
1511
|
throw new Error("Offset is invalid");
|
|
@@ -1520,10 +1520,10 @@ class L {
|
|
|
1520
1520
|
relativeTo(e) {
|
|
1521
1521
|
if (!e.contains(this.element))
|
|
1522
1522
|
throw new Error("Parent is not an ancestor of current element");
|
|
1523
|
-
let t = this.element,
|
|
1523
|
+
let t = this.element, i = this.offset;
|
|
1524
1524
|
for (; t !== e; )
|
|
1525
|
-
|
|
1526
|
-
return new
|
|
1525
|
+
i += we(t), t = t.parentElement;
|
|
1526
|
+
return new M(t, i);
|
|
1527
1527
|
}
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Resolve the position to a specific text node and offset within that node.
|
|
@@ -1544,18 +1544,18 @@ class L {
|
|
|
1544
1544
|
*/
|
|
1545
1545
|
resolve(e = {}) {
|
|
1546
1546
|
try {
|
|
1547
|
-
return
|
|
1547
|
+
return ke(this.element, this.offset)[0];
|
|
1548
1548
|
} catch (t) {
|
|
1549
1549
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
1550
|
-
const
|
|
1550
|
+
const i = document.createTreeWalker(
|
|
1551
1551
|
this.element.getRootNode(),
|
|
1552
1552
|
NodeFilter.SHOW_TEXT
|
|
1553
1553
|
);
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1556
|
-
if (!
|
|
1554
|
+
i.currentNode = this.element;
|
|
1555
|
+
const s = e.direction === 1, n = s ? i.nextNode() : i.previousNode();
|
|
1556
|
+
if (!n)
|
|
1557
1557
|
throw t;
|
|
1558
|
-
return { node:
|
|
1558
|
+
return { node: n, offset: s ? 0 : n.data.length };
|
|
1559
1559
|
} else
|
|
1560
1560
|
throw t;
|
|
1561
1561
|
}
|
|
@@ -1567,9 +1567,9 @@ class L {
|
|
|
1567
1567
|
static fromCharOffset(e, t) {
|
|
1568
1568
|
switch (e.nodeType) {
|
|
1569
1569
|
case Node.TEXT_NODE:
|
|
1570
|
-
return
|
|
1570
|
+
return M.fromPoint(e, t);
|
|
1571
1571
|
case Node.ELEMENT_NODE:
|
|
1572
|
-
return new
|
|
1572
|
+
return new M(e, t);
|
|
1573
1573
|
default:
|
|
1574
1574
|
throw new Error("Node is not an element or text node");
|
|
1575
1575
|
}
|
|
@@ -1587,23 +1587,23 @@ class L {
|
|
|
1587
1587
|
throw new Error("Text node offset is out of range");
|
|
1588
1588
|
if (!e.parentElement)
|
|
1589
1589
|
throw new Error("Text node has no parent");
|
|
1590
|
-
const
|
|
1591
|
-
return new
|
|
1590
|
+
const i = we(e) + t;
|
|
1591
|
+
return new M(e.parentElement, i);
|
|
1592
1592
|
}
|
|
1593
1593
|
case Node.ELEMENT_NODE: {
|
|
1594
1594
|
if (t < 0 || t > e.childNodes.length)
|
|
1595
1595
|
throw new Error("Child node offset is out of range");
|
|
1596
|
-
let
|
|
1597
|
-
for (let
|
|
1598
|
-
|
|
1599
|
-
return new
|
|
1596
|
+
let i = 0;
|
|
1597
|
+
for (let s = 0; s < t; s++)
|
|
1598
|
+
i += Ue(e.childNodes[s]);
|
|
1599
|
+
return new M(e, i);
|
|
1600
1600
|
}
|
|
1601
1601
|
default:
|
|
1602
1602
|
throw new Error("Point is not in an element or text node");
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class z {
|
|
1607
1607
|
constructor(e, t) {
|
|
1608
1608
|
this.start = e, this.end = t;
|
|
1609
1609
|
}
|
|
@@ -1613,7 +1613,7 @@ class D {
|
|
|
1613
1613
|
* `end.element`.
|
|
1614
1614
|
*/
|
|
1615
1615
|
relativeTo(e) {
|
|
1616
|
-
return new
|
|
1616
|
+
return new z(
|
|
1617
1617
|
this.start.relativeTo(e),
|
|
1618
1618
|
this.end.relativeTo(e)
|
|
1619
1619
|
);
|
|
@@ -1629,7 +1629,7 @@ class D {
|
|
|
1629
1629
|
*/
|
|
1630
1630
|
toRange() {
|
|
1631
1631
|
let e, t;
|
|
1632
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
1632
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = ke(
|
|
1633
1633
|
this.start.element,
|
|
1634
1634
|
this.start.offset,
|
|
1635
1635
|
this.end.offset
|
|
@@ -1640,27 +1640,27 @@ class D {
|
|
|
1640
1640
|
direction: 2
|
|
1641
1641
|
/* BACKWARDS */
|
|
1642
1642
|
}));
|
|
1643
|
-
const
|
|
1644
|
-
return
|
|
1643
|
+
const i = new Range();
|
|
1644
|
+
return i.setStart(e.node, e.offset), i.setEnd(t.node, t.offset), i;
|
|
1645
1645
|
}
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Create a TextRange from a (DOM) Range
|
|
1648
1648
|
*/
|
|
1649
1649
|
static fromRange(e) {
|
|
1650
|
-
const t =
|
|
1650
|
+
const t = M.fromPoint(
|
|
1651
1651
|
e.startContainer,
|
|
1652
1652
|
e.startOffset
|
|
1653
|
-
),
|
|
1654
|
-
return new
|
|
1653
|
+
), i = M.fromPoint(e.endContainer, e.endOffset);
|
|
1654
|
+
return new z(t, i);
|
|
1655
1655
|
}
|
|
1656
1656
|
/**
|
|
1657
1657
|
* Create a TextRange representing the `start`th to `end`th characters in
|
|
1658
1658
|
* `root`
|
|
1659
1659
|
*/
|
|
1660
|
-
static fromOffsets(e, t,
|
|
1661
|
-
return new
|
|
1662
|
-
new
|
|
1663
|
-
new
|
|
1660
|
+
static fromOffsets(e, t, i) {
|
|
1661
|
+
return new z(
|
|
1662
|
+
new M(e, t),
|
|
1663
|
+
new M(e, i)
|
|
1664
1664
|
);
|
|
1665
1665
|
}
|
|
1666
1666
|
/**
|
|
@@ -1668,23 +1668,23 @@ class D {
|
|
|
1668
1668
|
* whitespace
|
|
1669
1669
|
*/
|
|
1670
1670
|
static trimmedRange(e) {
|
|
1671
|
-
return
|
|
1671
|
+
return bt(z.fromRange(e).toRange());
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
|
-
class
|
|
1675
|
-
constructor(e, t,
|
|
1676
|
-
this.root = e, this.start = t, this.end =
|
|
1674
|
+
class _ {
|
|
1675
|
+
constructor(e, t, i) {
|
|
1676
|
+
this.root = e, this.start = t, this.end = i;
|
|
1677
1677
|
}
|
|
1678
1678
|
static fromRange(e, t) {
|
|
1679
|
-
const
|
|
1680
|
-
return new
|
|
1679
|
+
const i = z.fromRange(t).relativeTo(e);
|
|
1680
|
+
return new _(
|
|
1681
1681
|
e,
|
|
1682
|
-
|
|
1683
|
-
|
|
1682
|
+
i.start.offset,
|
|
1683
|
+
i.end.offset
|
|
1684
1684
|
);
|
|
1685
1685
|
}
|
|
1686
1686
|
static fromSelector(e, t) {
|
|
1687
|
-
return new
|
|
1687
|
+
return new _(e, t.start, t.end);
|
|
1688
1688
|
}
|
|
1689
1689
|
toSelector() {
|
|
1690
1690
|
return {
|
|
@@ -1694,15 +1694,15 @@ class he {
|
|
|
1694
1694
|
};
|
|
1695
1695
|
}
|
|
1696
1696
|
toRange() {
|
|
1697
|
-
return
|
|
1697
|
+
return z.fromOffsets(this.root, this.start, this.end).toRange();
|
|
1698
1698
|
}
|
|
1699
1699
|
}
|
|
1700
|
-
class
|
|
1700
|
+
class X {
|
|
1701
1701
|
/**
|
|
1702
1702
|
* @param root - A root element from which to anchor.
|
|
1703
1703
|
*/
|
|
1704
|
-
constructor(e, t,
|
|
1705
|
-
this.root = e, this.exact = t, this.context =
|
|
1704
|
+
constructor(e, t, i = {}) {
|
|
1705
|
+
this.root = e, this.exact = t, this.context = i;
|
|
1706
1706
|
}
|
|
1707
1707
|
/**
|
|
1708
1708
|
* Create a `TextQuoteAnchor` from a range.
|
|
@@ -1710,15 +1710,15 @@ class ce {
|
|
|
1710
1710
|
* Will throw if `range` does not contain any text nodes.
|
|
1711
1711
|
*/
|
|
1712
1712
|
static fromRange(e, t) {
|
|
1713
|
-
const
|
|
1714
|
-
return new
|
|
1715
|
-
prefix:
|
|
1716
|
-
suffix:
|
|
1713
|
+
const i = e.textContent, s = z.fromRange(t).relativeTo(e), n = s.start.offset, o = s.end.offset, a = 32;
|
|
1714
|
+
return new X(e, i.slice(n, o), {
|
|
1715
|
+
prefix: i.slice(Math.max(0, n - a), n),
|
|
1716
|
+
suffix: i.slice(o, Math.min(i.length, o + a))
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
1719
|
static fromSelector(e, t) {
|
|
1720
|
-
const { prefix:
|
|
1721
|
-
return new
|
|
1720
|
+
const { prefix: i, suffix: s } = t;
|
|
1721
|
+
return new X(e, t.exact, { prefix: i, suffix: s });
|
|
1722
1722
|
}
|
|
1723
1723
|
toSelector() {
|
|
1724
1724
|
return {
|
|
@@ -1732,45 +1732,45 @@ class ce {
|
|
|
1732
1732
|
return this.toPositionAnchor(e).toRange();
|
|
1733
1733
|
}
|
|
1734
1734
|
toPositionAnchor(e = {}) {
|
|
1735
|
-
const t = this.root.textContent,
|
|
1735
|
+
const t = this.root.textContent, i = Et(t, this.exact, {
|
|
1736
1736
|
...this.context,
|
|
1737
1737
|
hint: e.hint
|
|
1738
1738
|
});
|
|
1739
|
-
if (!
|
|
1739
|
+
if (!i)
|
|
1740
1740
|
throw new Error("Quote not found");
|
|
1741
|
-
return new
|
|
1741
|
+
return new _(this.root, i.start, i.end);
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1745
|
-
const e =
|
|
1744
|
+
function xt(r) {
|
|
1745
|
+
const e = r.tagName.toUpperCase();
|
|
1746
1746
|
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1748
|
+
function le(r, e) {
|
|
1749
1749
|
try {
|
|
1750
|
-
const t = e.locations,
|
|
1751
|
-
if (
|
|
1752
|
-
let
|
|
1753
|
-
t && t.getCssSelector() && (
|
|
1754
|
-
const
|
|
1755
|
-
prefix:
|
|
1756
|
-
suffix:
|
|
1750
|
+
const t = e.locations, i = e.text;
|
|
1751
|
+
if (i && i.highlight) {
|
|
1752
|
+
let s;
|
|
1753
|
+
t && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), s || (s = r.body);
|
|
1754
|
+
const n = new X(s, i.highlight, {
|
|
1755
|
+
prefix: i.before,
|
|
1756
|
+
suffix: i.after
|
|
1757
1757
|
});
|
|
1758
1758
|
try {
|
|
1759
|
-
return
|
|
1759
|
+
return n.toRange();
|
|
1760
1760
|
} catch {
|
|
1761
|
-
return console.warn("Quote not found:",
|
|
1761
|
+
return console.warn("Quote not found:", n), null;
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
if (t) {
|
|
1765
|
-
let
|
|
1766
|
-
if (!
|
|
1767
|
-
for (const
|
|
1768
|
-
if (
|
|
1765
|
+
let s = null;
|
|
1766
|
+
if (!s && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), !s && t.fragments) {
|
|
1767
|
+
for (const n of t.fragments)
|
|
1768
|
+
if (s = r.getElementById(n), s)
|
|
1769
1769
|
break;
|
|
1770
1770
|
}
|
|
1771
|
-
if (
|
|
1772
|
-
const
|
|
1773
|
-
return
|
|
1771
|
+
if (s) {
|
|
1772
|
+
const n = r.createRange();
|
|
1773
|
+
return s.childNodes.length === 0 || xt(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1774
1774
|
}
|
|
1775
1775
|
}
|
|
1776
1776
|
} catch (t) {
|
|
@@ -1778,12 +1778,12 @@ function Ae(i, e) {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
return null;
|
|
1780
1780
|
}
|
|
1781
|
-
function
|
|
1782
|
-
let t =
|
|
1783
|
-
t.length ||
|
|
1784
|
-
const
|
|
1781
|
+
function St(r, e) {
|
|
1782
|
+
let t = r.getClientRects();
|
|
1783
|
+
t.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = r.commonAncestorContainer.getClientRects());
|
|
1784
|
+
const i = 1, s = [];
|
|
1785
1785
|
for (const c of t)
|
|
1786
|
-
|
|
1786
|
+
s.push({
|
|
1787
1787
|
bottom: c.bottom,
|
|
1788
1788
|
height: c.height,
|
|
1789
1789
|
left: c.left,
|
|
@@ -1791,14 +1791,14 @@ function Yt(i, e) {
|
|
|
1791
1791
|
top: c.top,
|
|
1792
1792
|
width: c.width
|
|
1793
1793
|
});
|
|
1794
|
-
const
|
|
1795
|
-
|
|
1796
|
-
|
|
1794
|
+
const n = He(
|
|
1795
|
+
s,
|
|
1796
|
+
i,
|
|
1797
1797
|
e
|
|
1798
|
-
), o =
|
|
1798
|
+
), o = wt(n, i), a = $e(o), h = 2 * 2;
|
|
1799
1799
|
for (let c = a.length - 1; c >= 0; c--) {
|
|
1800
|
-
const
|
|
1801
|
-
if (!(
|
|
1800
|
+
const d = a[c];
|
|
1801
|
+
if (!(d.width * d.height > h))
|
|
1802
1802
|
if (a.length > 1)
|
|
1803
1803
|
a.splice(c, 1);
|
|
1804
1804
|
else
|
|
@@ -1806,446 +1806,208 @@ function Yt(i, e) {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
return a;
|
|
1808
1808
|
}
|
|
1809
|
-
function
|
|
1810
|
-
for (let
|
|
1811
|
-
for (let
|
|
1812
|
-
const
|
|
1813
|
-
if (
|
|
1809
|
+
function He(r, e, t) {
|
|
1810
|
+
for (let i = 0; i < r.length; i++)
|
|
1811
|
+
for (let s = i + 1; s < r.length; s++) {
|
|
1812
|
+
const n = r[i], o = r[s];
|
|
1813
|
+
if (n === o)
|
|
1814
1814
|
continue;
|
|
1815
|
-
const a = N(
|
|
1816
|
-
if ((h && !t || a && !h) &&
|
|
1817
|
-
const
|
|
1818
|
-
return
|
|
1819
|
-
|
|
1815
|
+
const a = N(n.top, o.top, e) && N(n.bottom, o.bottom, e), h = N(n.left, o.left, e) && N(n.right, o.right, e);
|
|
1816
|
+
if ((h && !t || a && !h) && je(n, o, e)) {
|
|
1817
|
+
const u = r.filter((g) => g !== n && g !== o), f = Tt(n, o);
|
|
1818
|
+
return u.push(f), He(
|
|
1819
|
+
u,
|
|
1820
1820
|
e,
|
|
1821
1821
|
t
|
|
1822
1822
|
);
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
|
-
return
|
|
1825
|
+
return r;
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1828
|
-
const t = Math.min(
|
|
1827
|
+
function Tt(r, e) {
|
|
1828
|
+
const t = Math.min(r.left, e.left), i = Math.max(r.right, e.right), s = Math.min(r.top, e.top), n = Math.max(r.bottom, e.bottom);
|
|
1829
1829
|
return {
|
|
1830
|
-
bottom:
|
|
1831
|
-
height:
|
|
1830
|
+
bottom: n,
|
|
1831
|
+
height: n - s,
|
|
1832
1832
|
left: t,
|
|
1833
|
-
right:
|
|
1834
|
-
top:
|
|
1835
|
-
width:
|
|
1833
|
+
right: i,
|
|
1834
|
+
top: s,
|
|
1835
|
+
width: i - t
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1839
|
-
const t = new Set(
|
|
1840
|
-
for (const
|
|
1841
|
-
if (!(
|
|
1842
|
-
t.delete(
|
|
1838
|
+
function wt(r, e) {
|
|
1839
|
+
const t = new Set(r);
|
|
1840
|
+
for (const i of r) {
|
|
1841
|
+
if (!(i.width > 1 && i.height > 1)) {
|
|
1842
|
+
t.delete(i);
|
|
1843
1843
|
continue;
|
|
1844
1844
|
}
|
|
1845
|
-
for (const
|
|
1846
|
-
if (
|
|
1847
|
-
t.delete(
|
|
1845
|
+
for (const n of r)
|
|
1846
|
+
if (i !== n && t.has(n) && Ct(n, i, e)) {
|
|
1847
|
+
t.delete(i);
|
|
1848
1848
|
break;
|
|
1849
1849
|
}
|
|
1850
1850
|
}
|
|
1851
1851
|
return Array.from(t);
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1854
|
-
return
|
|
1853
|
+
function Ct(r, e, t) {
|
|
1854
|
+
return $(r, e.left, e.top, t) && $(r, e.right, e.top, t) && $(r, e.left, e.bottom, t) && $(r, e.right, e.bottom, t);
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1857
|
-
return (
|
|
1856
|
+
function $(r, e, t, i) {
|
|
1857
|
+
return (r.left < e || N(r.left, e, i)) && (r.right > e || N(r.right, e, i)) && (r.top < t || N(r.top, t, i)) && (r.bottom > t || N(r.bottom, t, i));
|
|
1858
1858
|
}
|
|
1859
|
-
function
|
|
1860
|
-
for (let e = 0; e <
|
|
1861
|
-
for (let t = e + 1; t <
|
|
1862
|
-
const
|
|
1863
|
-
if (
|
|
1864
|
-
let
|
|
1865
|
-
const a =
|
|
1859
|
+
function $e(r) {
|
|
1860
|
+
for (let e = 0; e < r.length; e++)
|
|
1861
|
+
for (let t = e + 1; t < r.length; t++) {
|
|
1862
|
+
const i = r[e], s = r[t];
|
|
1863
|
+
if (i !== s && je(i, s, -1)) {
|
|
1864
|
+
let n = [], o;
|
|
1865
|
+
const a = Ce(i, s);
|
|
1866
1866
|
if (a.length === 1)
|
|
1867
|
-
|
|
1867
|
+
n = a, o = i;
|
|
1868
1868
|
else {
|
|
1869
|
-
const c =
|
|
1870
|
-
a.length < c.length ? (
|
|
1869
|
+
const c = Ce(s, i);
|
|
1870
|
+
a.length < c.length ? (n = a, o = i) : (n = c, o = s);
|
|
1871
1871
|
}
|
|
1872
|
-
const h =
|
|
1873
|
-
return Array.prototype.push.apply(h,
|
|
1872
|
+
const h = r.filter((c) => c !== o);
|
|
1873
|
+
return Array.prototype.push.apply(h, n), $e(h);
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
return
|
|
1876
|
+
return r;
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1879
|
-
const t =
|
|
1878
|
+
function Ce(r, e) {
|
|
1879
|
+
const t = Pt(e, r);
|
|
1880
1880
|
if (t.height === 0 || t.width === 0)
|
|
1881
|
-
return [
|
|
1882
|
-
const
|
|
1881
|
+
return [r];
|
|
1882
|
+
const i = [];
|
|
1883
1883
|
{
|
|
1884
|
-
const
|
|
1885
|
-
bottom:
|
|
1884
|
+
const s = {
|
|
1885
|
+
bottom: r.bottom,
|
|
1886
1886
|
height: 0,
|
|
1887
|
-
left:
|
|
1887
|
+
left: r.left,
|
|
1888
1888
|
right: t.left,
|
|
1889
|
-
top:
|
|
1889
|
+
top: r.top,
|
|
1890
1890
|
width: 0
|
|
1891
1891
|
};
|
|
1892
|
-
|
|
1892
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1893
1893
|
}
|
|
1894
1894
|
{
|
|
1895
|
-
const
|
|
1895
|
+
const s = {
|
|
1896
1896
|
bottom: t.top,
|
|
1897
1897
|
height: 0,
|
|
1898
1898
|
left: t.left,
|
|
1899
1899
|
right: t.right,
|
|
1900
|
-
top:
|
|
1900
|
+
top: r.top,
|
|
1901
1901
|
width: 0
|
|
1902
1902
|
};
|
|
1903
|
-
|
|
1903
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1904
1904
|
}
|
|
1905
1905
|
{
|
|
1906
|
-
const
|
|
1907
|
-
bottom:
|
|
1906
|
+
const s = {
|
|
1907
|
+
bottom: r.bottom,
|
|
1908
1908
|
height: 0,
|
|
1909
1909
|
left: t.left,
|
|
1910
1910
|
right: t.right,
|
|
1911
1911
|
top: t.bottom,
|
|
1912
1912
|
width: 0
|
|
1913
1913
|
};
|
|
1914
|
-
|
|
1914
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1915
1915
|
}
|
|
1916
1916
|
{
|
|
1917
|
-
const
|
|
1918
|
-
bottom:
|
|
1917
|
+
const s = {
|
|
1918
|
+
bottom: r.bottom,
|
|
1919
1919
|
height: 0,
|
|
1920
1920
|
left: t.right,
|
|
1921
|
-
right:
|
|
1922
|
-
top:
|
|
1921
|
+
right: r.right,
|
|
1922
|
+
top: r.top,
|
|
1923
1923
|
width: 0
|
|
1924
1924
|
};
|
|
1925
|
-
|
|
1925
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1926
1926
|
}
|
|
1927
|
-
return
|
|
1927
|
+
return i;
|
|
1928
1928
|
}
|
|
1929
|
-
function
|
|
1930
|
-
const t = Math.max(
|
|
1929
|
+
function Pt(r, e) {
|
|
1930
|
+
const t = Math.max(r.left, e.left), i = Math.min(r.right, e.right), s = Math.max(r.top, e.top), n = Math.min(r.bottom, e.bottom);
|
|
1931
1931
|
return {
|
|
1932
|
-
bottom:
|
|
1933
|
-
height: Math.max(0,
|
|
1932
|
+
bottom: n,
|
|
1933
|
+
height: Math.max(0, n - s),
|
|
1934
1934
|
left: t,
|
|
1935
|
-
right:
|
|
1936
|
-
top:
|
|
1937
|
-
width: Math.max(0,
|
|
1935
|
+
right: i,
|
|
1936
|
+
top: s,
|
|
1937
|
+
width: Math.max(0, i - t)
|
|
1938
1938
|
};
|
|
1939
1939
|
}
|
|
1940
|
-
function
|
|
1941
|
-
return (
|
|
1940
|
+
function je(r, e, t) {
|
|
1941
|
+
return (r.left < e.right || t >= 0 && N(r.left, e.right, t)) && (e.left < r.right || t >= 0 && N(e.left, r.right, t)) && (r.top < e.bottom || t >= 0 && N(r.top, e.bottom, t)) && (e.top < r.bottom || t >= 0 && N(e.top, r.bottom, t));
|
|
1942
1942
|
}
|
|
1943
|
-
function N(
|
|
1944
|
-
return Math.abs(
|
|
1943
|
+
function N(r, e, t) {
|
|
1944
|
+
return Math.abs(r - e) <= t;
|
|
1945
1945
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
}, ti = function() {
|
|
1951
|
-
return U.some(function(i) {
|
|
1952
|
-
return i.skippedTargets.length > 0;
|
|
1953
|
-
});
|
|
1954
|
-
}, Ue = "ResizeObserver loop completed with undelivered notifications.", ii = function() {
|
|
1955
|
-
var i;
|
|
1956
|
-
typeof ErrorEvent == "function" ? i = new ErrorEvent("error", {
|
|
1957
|
-
message: Ue
|
|
1958
|
-
}) : (i = document.createEvent("Event"), i.initEvent("error", !1, !1), i.message = Ue), window.dispatchEvent(i);
|
|
1959
|
-
}, J;
|
|
1960
|
-
(function(i) {
|
|
1961
|
-
i.BORDER_BOX = "border-box", i.CONTENT_BOX = "content-box", i.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
1962
|
-
})(J || (J = {}));
|
|
1963
|
-
var H = function(i) {
|
|
1964
|
-
return Object.freeze(i);
|
|
1965
|
-
}, ri = function() {
|
|
1966
|
-
function i(e, t) {
|
|
1967
|
-
this.inlineSize = e, this.blockSize = t, H(this);
|
|
1968
|
-
}
|
|
1969
|
-
return i;
|
|
1970
|
-
}(), ct = function() {
|
|
1971
|
-
function i(e, t, r, n) {
|
|
1972
|
-
return this.x = e, this.y = t, this.width = r, this.height = n, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, H(this);
|
|
1973
|
-
}
|
|
1974
|
-
return i.prototype.toJSON = function() {
|
|
1975
|
-
var e = this, t = e.x, r = e.y, n = e.top, s = e.right, o = e.bottom, a = e.left, h = e.width, c = e.height;
|
|
1976
|
-
return { x: t, y: r, top: n, right: s, bottom: o, left: a, width: h, height: c };
|
|
1977
|
-
}, i.fromRect = function(e) {
|
|
1978
|
-
return new i(e.x, e.y, e.width, e.height);
|
|
1979
|
-
}, i;
|
|
1980
|
-
}(), Ne = function(i) {
|
|
1981
|
-
return i instanceof SVGElement && "getBBox" in i;
|
|
1982
|
-
}, ut = function(i) {
|
|
1983
|
-
if (Ne(i)) {
|
|
1984
|
-
var e = i.getBBox(), t = e.width, r = e.height;
|
|
1985
|
-
return !t && !r;
|
|
1986
|
-
}
|
|
1987
|
-
var n = i, s = n.offsetWidth, o = n.offsetHeight;
|
|
1988
|
-
return !(s || o || i.getClientRects().length);
|
|
1989
|
-
}, He = function(i) {
|
|
1990
|
-
var e;
|
|
1991
|
-
if (i instanceof Element)
|
|
1992
|
-
return !0;
|
|
1993
|
-
var t = (e = i == null ? void 0 : i.ownerDocument) === null || e === void 0 ? void 0 : e.defaultView;
|
|
1994
|
-
return !!(t && i instanceof t.Element);
|
|
1995
|
-
}, ni = function(i) {
|
|
1996
|
-
switch (i.tagName) {
|
|
1997
|
-
case "INPUT":
|
|
1998
|
-
if (i.type !== "image")
|
|
1999
|
-
break;
|
|
2000
|
-
case "VIDEO":
|
|
2001
|
-
case "AUDIO":
|
|
2002
|
-
case "EMBED":
|
|
2003
|
-
case "OBJECT":
|
|
2004
|
-
case "CANVAS":
|
|
2005
|
-
case "IFRAME":
|
|
2006
|
-
case "IMG":
|
|
2007
|
-
return !0;
|
|
2008
|
-
}
|
|
2009
|
-
return !1;
|
|
2010
|
-
}, Y = typeof window < "u" ? window : {}, ie = /* @__PURE__ */ new WeakMap(), $e = /auto|scroll/, si = /^tb|vertical/, oi = /msie|trident/i.test(Y.navigator && Y.navigator.userAgent), R = function(i) {
|
|
2011
|
-
return parseFloat(i || "0");
|
|
2012
|
-
}, q = function(i, e, t) {
|
|
2013
|
-
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new ri((t ? e : i) || 0, (t ? i : e) || 0);
|
|
2014
|
-
}, Ve = H({
|
|
2015
|
-
devicePixelContentBoxSize: q(),
|
|
2016
|
-
borderBoxSize: q(),
|
|
2017
|
-
contentBoxSize: q(),
|
|
2018
|
-
contentRect: new ct(0, 0, 0, 0)
|
|
2019
|
-
}), dt = function(i, e) {
|
|
2020
|
-
if (e === void 0 && (e = !1), ie.has(i) && !e)
|
|
2021
|
-
return ie.get(i);
|
|
2022
|
-
if (ut(i))
|
|
2023
|
-
return ie.set(i, Ve), Ve;
|
|
2024
|
-
var t = getComputedStyle(i), r = Ne(i) && i.ownerSVGElement && i.getBBox(), n = !oi && t.boxSizing === "border-box", s = si.test(t.writingMode || ""), o = !r && $e.test(t.overflowY || ""), a = !r && $e.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, K = n ? y + S : 0, Z = n ? x + m : 0, W = r ? r.width : R(t.width) - K - P, F = r ? r.height : R(t.height) - Z - E, Q = W + y + P + S, ee = F + x + E + m, $ = H({
|
|
2025
|
-
devicePixelContentBoxSize: q(Math.round(W * devicePixelRatio), Math.round(F * devicePixelRatio), s),
|
|
2026
|
-
borderBoxSize: q(Q, ee, s),
|
|
2027
|
-
contentBoxSize: q(W, F, s),
|
|
2028
|
-
contentRect: new ct(p, h, W, F)
|
|
2029
|
-
});
|
|
2030
|
-
return ie.set(i, $), $;
|
|
2031
|
-
}, pt = function(i, e, t) {
|
|
2032
|
-
var r = dt(i, t), n = r.borderBoxSize, s = r.contentBoxSize, o = r.devicePixelContentBoxSize;
|
|
2033
|
-
switch (e) {
|
|
2034
|
-
case J.DEVICE_PIXEL_CONTENT_BOX:
|
|
2035
|
-
return o;
|
|
2036
|
-
case J.BORDER_BOX:
|
|
2037
|
-
return n;
|
|
2038
|
-
default:
|
|
2039
|
-
return s;
|
|
2040
|
-
}
|
|
2041
|
-
}, ai = function() {
|
|
2042
|
-
function i(e) {
|
|
2043
|
-
var t = dt(e);
|
|
2044
|
-
this.target = e, this.contentRect = t.contentRect, this.borderBoxSize = H([t.borderBoxSize]), this.contentBoxSize = H([t.contentBoxSize]), this.devicePixelContentBoxSize = H([t.devicePixelContentBoxSize]);
|
|
2045
|
-
}
|
|
2046
|
-
return i;
|
|
2047
|
-
}(), ft = function(i) {
|
|
2048
|
-
if (ut(i))
|
|
2049
|
-
return 1 / 0;
|
|
2050
|
-
for (var e = 0, t = i.parentNode; t; )
|
|
2051
|
-
e += 1, t = t.parentNode;
|
|
1946
|
+
function qe(r) {
|
|
1947
|
+
const e = {}, t = r.document.documentElement.style;
|
|
1948
|
+
for (const i in r.document.documentElement.style)
|
|
1949
|
+
Object.hasOwn(t, i) && !Number.isNaN(Number.parseInt(i)) && (e[t[i]] = t.getPropertyValue(t[i]));
|
|
2052
1950
|
return e;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
a.push(u), c.lastReportedSize = pt(c.target, c.observedBox), p < i && (i = p);
|
|
2061
|
-
}), e.push(function() {
|
|
2062
|
-
o.callback.call(o.observer, a, o.observer);
|
|
2063
|
-
}), o.activeTargets.splice(0, o.activeTargets.length);
|
|
2064
|
-
}
|
|
2065
|
-
});
|
|
2066
|
-
for (var t = 0, r = e; t < r.length; t++) {
|
|
2067
|
-
var n = r[t];
|
|
2068
|
-
n();
|
|
2069
|
-
}
|
|
2070
|
-
return i;
|
|
2071
|
-
}, qe = function(i) {
|
|
2072
|
-
U.forEach(function(t) {
|
|
2073
|
-
t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(n) {
|
|
2074
|
-
n.isActive() && (ft(n.target) > i ? t.activeTargets.push(n) : t.skippedTargets.push(n));
|
|
2075
|
-
});
|
|
2076
|
-
});
|
|
2077
|
-
}, hi = function() {
|
|
2078
|
-
var i = 0;
|
|
2079
|
-
for (qe(i); ei(); )
|
|
2080
|
-
i = li(), qe(i);
|
|
2081
|
-
return ti() && ii(), i > 0;
|
|
2082
|
-
}, fe, mt = [], ci = function() {
|
|
2083
|
-
return mt.splice(0).forEach(function(i) {
|
|
2084
|
-
return i();
|
|
2085
|
-
});
|
|
2086
|
-
}, ui = function(i) {
|
|
2087
|
-
if (!fe) {
|
|
2088
|
-
var e = 0, t = document.createTextNode(""), r = { characterData: !0 };
|
|
2089
|
-
new MutationObserver(function() {
|
|
2090
|
-
return ci();
|
|
2091
|
-
}).observe(t, r), fe = function() {
|
|
2092
|
-
t.textContent = "".concat(e ? e-- : e++);
|
|
2093
|
-
};
|
|
2094
|
-
}
|
|
2095
|
-
mt.push(i), fe();
|
|
2096
|
-
}, di = function(i) {
|
|
2097
|
-
ui(function() {
|
|
2098
|
-
requestAnimationFrame(i);
|
|
1951
|
+
}
|
|
1952
|
+
function Nt(r, e) {
|
|
1953
|
+
const t = qe(r);
|
|
1954
|
+
Object.keys(t).forEach((i) => {
|
|
1955
|
+
e.hasOwnProperty(i) || he(r, i);
|
|
1956
|
+
}), Object.entries(e).forEach(([i, s]) => {
|
|
1957
|
+
t[i] !== s && G(r, i, s);
|
|
2099
1958
|
});
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
"
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
],
|
|
2118
|
-
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
return
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
if (me = !1, e = r - je(), !pi())
|
|
2137
|
-
return;
|
|
2138
|
-
n ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
}
|
|
2142
|
-
}, i.prototype.schedule = function() {
|
|
2143
|
-
this.stop(), this.run();
|
|
2144
|
-
}, i.prototype.observe = function() {
|
|
2145
|
-
var e = this, t = function() {
|
|
2146
|
-
return e.observer && e.observer.observe(document.body, mi);
|
|
2147
|
-
};
|
|
2148
|
-
document.body ? t() : Y.addEventListener("DOMContentLoaded", t);
|
|
2149
|
-
}, i.prototype.start = function() {
|
|
2150
|
-
var e = this;
|
|
2151
|
-
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), _e.forEach(function(t) {
|
|
2152
|
-
return Y.addEventListener(t, e.listener, !0);
|
|
2153
|
-
}));
|
|
2154
|
-
}, i.prototype.stop = function() {
|
|
2155
|
-
var e = this;
|
|
2156
|
-
this.stopped || (this.observer && this.observer.disconnect(), _e.forEach(function(t) {
|
|
2157
|
-
return Y.removeEventListener(t, e.listener, !0);
|
|
2158
|
-
}), this.stopped = !0);
|
|
2159
|
-
}, i;
|
|
2160
|
-
}(), ve = new gi(), Xe = function(i) {
|
|
2161
|
-
!oe && i > 0 && ve.start(), oe += i, !oe && ve.stop();
|
|
2162
|
-
}, vi = function(i) {
|
|
2163
|
-
return !Ne(i) && !ni(i) && getComputedStyle(i).display === "inline";
|
|
2164
|
-
}, yi = function() {
|
|
2165
|
-
function i(e, t) {
|
|
2166
|
-
this.target = e, this.observedBox = t || J.CONTENT_BOX, this.lastReportedSize = {
|
|
2167
|
-
inlineSize: 0,
|
|
2168
|
-
blockSize: 0
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
return i.prototype.isActive = function() {
|
|
2172
|
-
var e = pt(this.target, this.observedBox, !0);
|
|
2173
|
-
return vi(this.target) && (this.lastReportedSize = e), this.lastReportedSize.inlineSize !== e.inlineSize || this.lastReportedSize.blockSize !== e.blockSize;
|
|
2174
|
-
}, i;
|
|
2175
|
-
}(), bi = function() {
|
|
2176
|
-
function i(e, t) {
|
|
2177
|
-
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = e, this.callback = t;
|
|
1959
|
+
}
|
|
1960
|
+
function Pe(r, e) {
|
|
1961
|
+
return r.document.documentElement.style.getPropertyValue(e);
|
|
1962
|
+
}
|
|
1963
|
+
function G(r, e, t) {
|
|
1964
|
+
r.document.documentElement.style.setProperty(e, t);
|
|
1965
|
+
}
|
|
1966
|
+
function he(r, e) {
|
|
1967
|
+
r.document.documentElement.style.removeProperty(e);
|
|
1968
|
+
}
|
|
1969
|
+
const At = (r) => {
|
|
1970
|
+
if (r.startsWith("rgb")) {
|
|
1971
|
+
const e = r.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
|
|
1972
|
+
if (e)
|
|
1973
|
+
return {
|
|
1974
|
+
r: parseInt(e[1], 10),
|
|
1975
|
+
g: parseInt(e[2], 10),
|
|
1976
|
+
b: parseInt(e[3], 10),
|
|
1977
|
+
a: e[4] ? parseInt(e[4], 10) / 255 : 1
|
|
1978
|
+
};
|
|
1979
|
+
} else if (r.startsWith("#")) {
|
|
1980
|
+
const e = r.slice(1);
|
|
1981
|
+
if (e.length === 3 || e.length === 4)
|
|
1982
|
+
return {
|
|
1983
|
+
r: parseInt(e[0] + e[0], 16) / 255,
|
|
1984
|
+
g: parseInt(e[1] + e[1], 16) / 255,
|
|
1985
|
+
b: parseInt(e[2] + e[2], 16) / 255,
|
|
1986
|
+
a: e.length === 4 ? parseInt(e[3] + e[3], 16) / 255 : 1
|
|
1987
|
+
};
|
|
1988
|
+
if (e.length === 6 || e.length === 8)
|
|
1989
|
+
return {
|
|
1990
|
+
r: parseInt(e[0] + e[1], 16) / 255,
|
|
1991
|
+
g: parseInt(e[2] + e[3], 16) / 255,
|
|
1992
|
+
b: parseInt(e[4] + e[5], 16) / 255,
|
|
1993
|
+
a: e.length === 8 ? parseInt(e[6] + e[7], 16) / 255 : 1
|
|
1994
|
+
};
|
|
2178
1995
|
}
|
|
2179
|
-
return
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
}
|
|
2188
|
-
return i.connect = function(e, t) {
|
|
2189
|
-
var r = new bi(e, t);
|
|
2190
|
-
re.set(e, r);
|
|
2191
|
-
}, i.observe = function(e, t, r) {
|
|
2192
|
-
var n = re.get(e), s = n.observationTargets.length === 0;
|
|
2193
|
-
Ge(n.observationTargets, t) < 0 && (s && U.push(n), n.observationTargets.push(new yi(t, r && r.box)), Xe(1), ve.schedule());
|
|
2194
|
-
}, i.unobserve = function(e, t) {
|
|
2195
|
-
var r = re.get(e), n = Ge(r.observationTargets, t), s = r.observationTargets.length === 1;
|
|
2196
|
-
n >= 0 && (s && U.splice(U.indexOf(r), 1), r.observationTargets.splice(n, 1), Xe(-1));
|
|
2197
|
-
}, i.disconnect = function(e) {
|
|
2198
|
-
var t = this, r = re.get(e);
|
|
2199
|
-
r.observationTargets.slice().forEach(function(n) {
|
|
2200
|
-
return t.unobserve(e, n.target);
|
|
2201
|
-
}), r.activeTargets.splice(0, r.activeTargets.length);
|
|
2202
|
-
}, i;
|
|
2203
|
-
}(), gt = function() {
|
|
2204
|
-
function i(e) {
|
|
2205
|
-
if (arguments.length === 0)
|
|
2206
|
-
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2207
|
-
if (typeof e != "function")
|
|
2208
|
-
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
2209
|
-
ne.connect(this, e);
|
|
2210
|
-
}
|
|
2211
|
-
return i.prototype.observe = function(e, t) {
|
|
2212
|
-
if (arguments.length === 0)
|
|
2213
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2214
|
-
if (!He(e))
|
|
2215
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2216
|
-
ne.observe(this, e, t);
|
|
2217
|
-
}, i.prototype.unobserve = function(e) {
|
|
2218
|
-
if (arguments.length === 0)
|
|
2219
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2220
|
-
if (!He(e))
|
|
2221
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2222
|
-
ne.unobserve(this, e);
|
|
2223
|
-
}, i.prototype.disconnect = function() {
|
|
2224
|
-
ne.disconnect(this);
|
|
2225
|
-
}, i.toString = function() {
|
|
2226
|
-
return "function ResizeObserver () { [polyfill code] }";
|
|
2227
|
-
}, i;
|
|
2228
|
-
}();
|
|
2229
|
-
function Ei(i, e) {
|
|
2230
|
-
return i.document.documentElement.style.getPropertyValue(e);
|
|
2231
|
-
}
|
|
2232
|
-
function ye(i, e, t) {
|
|
2233
|
-
i.document.documentElement.style.setProperty(e, t);
|
|
2234
|
-
}
|
|
2235
|
-
function vt(i, e) {
|
|
2236
|
-
i.document.documentElement.style.removeProperty(e);
|
|
2237
|
-
}
|
|
2238
|
-
const xi = window.ResizeObserver || gt;
|
|
2239
|
-
var wi = /* @__PURE__ */ ((i) => (i.Wrap = "wrap", i.Viewport = "viewport", i.Bounds = "bounds", i.Page = "page", i))(wi || {}), Ti = /* @__PURE__ */ ((i) => (i.Boxes = "boxes", i.Bounds = "bounds", i))(Ti || {});
|
|
2240
|
-
const Si = "Highlight" in window, Ye = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2241
|
-
class Ci {
|
|
1996
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
1997
|
+
}, Mt = (r) => 0.2126 * r.r * r.a + 0.7152 * r.g * r.a + 0.0722 * r.b * r.a, Ot = (r) => {
|
|
1998
|
+
const e = At(r);
|
|
1999
|
+
return Mt(e) < 128;
|
|
2000
|
+
};
|
|
2001
|
+
var It = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(It || {}), Lt = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(Lt || {});
|
|
2002
|
+
const Rt = "Highlight" in window, Ne = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2003
|
+
class zt {
|
|
2242
2004
|
/**
|
|
2243
2005
|
* Creates a DecorationGroup object
|
|
2244
2006
|
* @param id Unique HTML ID-adhering name of the group
|
|
2245
2007
|
* @param name Human-readable name of the group
|
|
2246
2008
|
*/
|
|
2247
|
-
constructor(e, t,
|
|
2248
|
-
this.wnd = e, this.comms = t, this.id =
|
|
2009
|
+
constructor(e, t, i, s) {
|
|
2010
|
+
this.wnd = e, this.comms = t, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Rt && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2249
2011
|
}
|
|
2250
2012
|
get activeable() {
|
|
2251
2013
|
return this.activateable;
|
|
@@ -2259,35 +2021,35 @@ class Ci {
|
|
|
2259
2021
|
*/
|
|
2260
2022
|
add(e) {
|
|
2261
2023
|
var o, a, h, c;
|
|
2262
|
-
const t = `${this.id}-${this.lastItemId++}`,
|
|
2263
|
-
if (!
|
|
2024
|
+
const t = `${this.id}-${this.lastItemId++}`, i = le(this.wnd.document, e.locator);
|
|
2025
|
+
if (!i) {
|
|
2264
2026
|
this.comms.log("Can't locate DOM range for decoration", e);
|
|
2265
2027
|
return;
|
|
2266
2028
|
}
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2029
|
+
const s = i.commonAncestorContainer;
|
|
2030
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(s.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), s.querySelector(Ne.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)));
|
|
2031
|
+
const n = {
|
|
2270
2032
|
decoration: e,
|
|
2271
2033
|
id: t,
|
|
2272
|
-
range:
|
|
2034
|
+
range: i
|
|
2273
2035
|
};
|
|
2274
|
-
this.items.push(
|
|
2036
|
+
this.items.push(n), this.layout(n), this.renderLayout([n]);
|
|
2275
2037
|
}
|
|
2276
2038
|
/**
|
|
2277
2039
|
* Removes the decoration with given ID from the group.
|
|
2278
2040
|
* @param identifier ID of item to remove
|
|
2279
2041
|
*/
|
|
2280
2042
|
remove(e) {
|
|
2281
|
-
var
|
|
2043
|
+
var s, n;
|
|
2282
2044
|
const t = this.items.findIndex((o) => o.decoration.id === e);
|
|
2283
2045
|
if (t < 0)
|
|
2284
2046
|
return;
|
|
2285
|
-
const
|
|
2286
|
-
if (this.items.splice(t, 1),
|
|
2047
|
+
const i = this.items[t];
|
|
2048
|
+
if (this.items.splice(t, 1), i.clickableElements = void 0, i.container && (i.container.remove(), i.container = void 0), this.experimentalHighlights && !((s = this.notTextFlag) != null && s.has(i.id))) {
|
|
2287
2049
|
const o = this.wnd.CSS.highlights.get(this.id);
|
|
2288
|
-
o == null || o.delete(
|
|
2050
|
+
o == null || o.delete(i.range);
|
|
2289
2051
|
}
|
|
2290
|
-
(
|
|
2052
|
+
(n = this.notTextFlag) == null || n.delete(i.id);
|
|
2291
2053
|
}
|
|
2292
2054
|
/**
|
|
2293
2055
|
* Notifies that the given decoration was modified and needs to be updated.
|
|
@@ -2311,12 +2073,12 @@ class Ci {
|
|
|
2311
2073
|
this.wnd.cancelAnimationFrame(this.currentRender), this.clearContainer(), this.items.forEach((e) => this.layout(e)), this.renderLayout(this.items);
|
|
2312
2074
|
}
|
|
2313
2075
|
experimentalLayout(e) {
|
|
2314
|
-
var
|
|
2315
|
-
const [t,
|
|
2316
|
-
|
|
2076
|
+
var s, n;
|
|
2077
|
+
const [t, i] = this.requireContainer(!0);
|
|
2078
|
+
i.add(e.range), t.innerHTML = `
|
|
2317
2079
|
::highlight(${this.id}) {
|
|
2318
2080
|
color: black;
|
|
2319
|
-
background-color: ${((
|
|
2081
|
+
background-color: ${((n = (s = e.decoration) == null ? void 0 : s.style) == null ? void 0 : n.tint) ?? "yellow"};
|
|
2320
2082
|
}`;
|
|
2321
2083
|
}
|
|
2322
2084
|
/**
|
|
@@ -2324,39 +2086,39 @@ class Ci {
|
|
|
2324
2086
|
* @param item
|
|
2325
2087
|
*/
|
|
2326
2088
|
layout(e) {
|
|
2327
|
-
var
|
|
2328
|
-
if (this.experimentalHighlights && !((
|
|
2089
|
+
var g, m, v, S, O;
|
|
2090
|
+
if (this.experimentalHighlights && !((g = this.notTextFlag) != null && g.has(e.id)))
|
|
2329
2091
|
return this.experimentalLayout(e);
|
|
2330
2092
|
const t = this.wnd.document.createElement("div");
|
|
2331
2093
|
t.setAttribute("id", e.id), t.style.setProperty("pointer-events", "none");
|
|
2332
|
-
const
|
|
2094
|
+
const i = this.wnd.innerWidth, s = parseInt(
|
|
2333
2095
|
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2334
2096
|
"column-count"
|
|
2335
2097
|
)
|
|
2336
|
-
),
|
|
2337
|
-
var
|
|
2338
|
-
if (
|
|
2339
|
-
|
|
2340
|
-
let
|
|
2341
|
-
|
|
2342
|
-
} else if (((
|
|
2343
|
-
|
|
2344
|
-
else if (((
|
|
2345
|
-
|
|
2346
|
-
let
|
|
2347
|
-
|
|
2098
|
+
), n = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, h = o.scrollTop, c = (y, b, I) => {
|
|
2099
|
+
var ce, de, ue, pe, fe, me;
|
|
2100
|
+
if (y.style.position = "absolute", ((de = (ce = e.decoration) == null ? void 0 : ce.style) == null ? void 0 : de.width) === "viewport") {
|
|
2101
|
+
y.style.width = `${i}px`, y.style.height = `${b.height}px`;
|
|
2102
|
+
let K = Math.floor(b.left / i) * i;
|
|
2103
|
+
y.style.left = `${K + a}px`, y.style.top = `${b.top + h}px`;
|
|
2104
|
+
} else if (((pe = (ue = e.decoration) == null ? void 0 : ue.style) == null ? void 0 : pe.width) === "bounds")
|
|
2105
|
+
y.style.width = `${I.width}px`, y.style.height = `${b.height}px`, y.style.left = `${I.left + a}px`, y.style.top = `${b.top + h}px`;
|
|
2106
|
+
else if (((me = (fe = e.decoration) == null ? void 0 : fe.style) == null ? void 0 : me.width) === "page") {
|
|
2107
|
+
y.style.width = `${n}px`, y.style.height = `${b.height}px`;
|
|
2108
|
+
let K = Math.floor(b.left / n) * n;
|
|
2109
|
+
y.style.left = `${K + a}px`, y.style.top = `${b.top + h}px`;
|
|
2348
2110
|
} else
|
|
2349
|
-
|
|
2350
|
-
},
|
|
2111
|
+
y.style.width = `${b.width}px`, y.style.height = `${b.height}px`, y.style.left = `${b.left + a}px`, y.style.top = `${b.top + h}px`;
|
|
2112
|
+
}, d = e.range.getBoundingClientRect();
|
|
2351
2113
|
let p = this.wnd.document.createElement("template");
|
|
2352
|
-
const
|
|
2114
|
+
const u = Pe(this.wnd, "--USER__appearance") === "readium-night-on" || Ot(Pe(this.wnd, "--USER__backgroundColor"));
|
|
2353
2115
|
p.innerHTML = `
|
|
2354
2116
|
<div
|
|
2355
2117
|
class="r2-highlight-0"
|
|
2356
2118
|
style="${[
|
|
2357
|
-
`background-color: ${((
|
|
2119
|
+
`background-color: ${((v = (m = e.decoration) == null ? void 0 : m.style) == null ? void 0 : v.tint) ?? "yellow"} !important`,
|
|
2358
2120
|
//"opacity: 0.3 !important",
|
|
2359
|
-
`mix-blend-mode: ${
|
|
2121
|
+
`mix-blend-mode: ${u ? "exclusion" : "multiply"} !important`,
|
|
2360
2122
|
"opacity: 1 !important",
|
|
2361
2123
|
"box-sizing: border-box !important"
|
|
2362
2124
|
].join("; ")}"
|
|
@@ -2364,19 +2126,19 @@ class Ci {
|
|
|
2364
2126
|
</div>
|
|
2365
2127
|
`.trim();
|
|
2366
2128
|
const f = p.content.firstElementChild;
|
|
2367
|
-
if (((
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2129
|
+
if (((O = (S = e.decoration) == null ? void 0 : S.style) == null ? void 0 : O.layout) === "bounds") {
|
|
2130
|
+
const y = f.cloneNode(!0);
|
|
2131
|
+
y.style.setProperty("pointer-events", "none"), c(y, d, d), t.append(y);
|
|
2370
2132
|
} else {
|
|
2371
|
-
let
|
|
2133
|
+
let y = St(
|
|
2372
2134
|
e.range,
|
|
2373
2135
|
!0
|
|
2374
2136
|
// doNotMergeHorizontallyAlignedRects
|
|
2375
2137
|
);
|
|
2376
|
-
|
|
2377
|
-
for (let
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2138
|
+
y = y.sort((b, I) => b.top < I.top ? -1 : b.top > I.top ? 1 : 0);
|
|
2139
|
+
for (let b of y) {
|
|
2140
|
+
const I = f.cloneNode(!0);
|
|
2141
|
+
I.style.setProperty("pointer-events", "none"), c(I, b, d), t.append(I);
|
|
2380
2142
|
}
|
|
2381
2143
|
}
|
|
2382
2144
|
e.container = t, e.clickableElements = Array.from(
|
|
@@ -2385,12 +2147,12 @@ class Ci {
|
|
|
2385
2147
|
}
|
|
2386
2148
|
renderLayout(e) {
|
|
2387
2149
|
this.wnd.cancelAnimationFrame(this.currentRender), this.currentRender = this.wnd.requestAnimationFrame(() => {
|
|
2388
|
-
if (e = e.filter((
|
|
2389
|
-
var
|
|
2390
|
-
return !this.experimentalHighlights || !!((
|
|
2150
|
+
if (e = e.filter((i) => {
|
|
2151
|
+
var s;
|
|
2152
|
+
return !this.experimentalHighlights || !!((s = this.notTextFlag) != null && s.has(i.id));
|
|
2391
2153
|
}), !e || e.length === 0)
|
|
2392
2154
|
return;
|
|
2393
|
-
this.requireContainer().append(...e.map((
|
|
2155
|
+
this.requireContainer().append(...e.map((i) => i.container).filter((i) => !!i));
|
|
2394
2156
|
});
|
|
2395
2157
|
}
|
|
2396
2158
|
/**
|
|
@@ -2401,8 +2163,8 @@ class Ci {
|
|
|
2401
2163
|
if (e) {
|
|
2402
2164
|
let t;
|
|
2403
2165
|
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));
|
|
2404
|
-
let
|
|
2405
|
-
return this.wnd.CSS.highlights.has(this.id) ?
|
|
2166
|
+
let i;
|
|
2167
|
+
return this.wnd.CSS.highlights.has(this.id) ? i = this.wnd.CSS.highlights.get(this.id) : (i = new this.wnd.Highlight(), this.wnd.CSS.highlights.set(this.id, i)), [t, i];
|
|
2406
2168
|
}
|
|
2407
2169
|
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;
|
|
2408
2170
|
}
|
|
@@ -2413,7 +2175,7 @@ class Ci {
|
|
|
2413
2175
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2414
2176
|
}
|
|
2415
2177
|
}
|
|
2416
|
-
const
|
|
2178
|
+
const Ve = class Q extends Y {
|
|
2417
2179
|
constructor() {
|
|
2418
2180
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2419
2181
|
}
|
|
@@ -2428,39 +2190,39 @@ const yt = class be extends de {
|
|
|
2428
2190
|
}, 50);
|
|
2429
2191
|
}
|
|
2430
2192
|
mount(e, t) {
|
|
2431
|
-
return this.wnd = e, t.register("decorate",
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2193
|
+
return this.wnd = e, t.register("decorate", Q.moduleName, (i, s) => {
|
|
2194
|
+
const n = i;
|
|
2195
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = D.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new zt(
|
|
2434
2196
|
e,
|
|
2435
2197
|
t,
|
|
2436
2198
|
`readium-decoration-${this.lastGroupId++}`,
|
|
2437
|
-
|
|
2199
|
+
n.group
|
|
2438
2200
|
));
|
|
2439
|
-
const o = this.groups.get(
|
|
2440
|
-
switch (
|
|
2201
|
+
const o = this.groups.get(n.group);
|
|
2202
|
+
switch (n.action) {
|
|
2441
2203
|
case "add":
|
|
2442
|
-
o == null || o.add(
|
|
2204
|
+
o == null || o.add(n.decoration);
|
|
2443
2205
|
break;
|
|
2444
2206
|
case "remove":
|
|
2445
|
-
o == null || o.remove(
|
|
2207
|
+
o == null || o.remove(n.decoration.id);
|
|
2446
2208
|
break;
|
|
2447
2209
|
case "clear":
|
|
2448
2210
|
o == null || o.clear();
|
|
2449
2211
|
break;
|
|
2450
2212
|
case "update":
|
|
2451
|
-
o == null || o.update(
|
|
2213
|
+
o == null || o.update(n.decoration);
|
|
2452
2214
|
break;
|
|
2453
2215
|
}
|
|
2454
|
-
|
|
2455
|
-
}), this.resizeObserver = new
|
|
2216
|
+
s(!0);
|
|
2217
|
+
}), this.resizeObserver = new ResizeObserver(() => 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;
|
|
2456
2218
|
}
|
|
2457
2219
|
unmount(e, t) {
|
|
2458
|
-
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(
|
|
2220
|
+
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(Q.moduleName), this.resizeObserver.disconnect(), this.cleanup(), t.log("Decorator Unmounted"), !0;
|
|
2459
2221
|
}
|
|
2460
2222
|
};
|
|
2461
|
-
|
|
2462
|
-
let
|
|
2463
|
-
const
|
|
2223
|
+
Ve.moduleName = "decorator";
|
|
2224
|
+
let Dt = Ve;
|
|
2225
|
+
const Ae = "readium-snapper-style", _e = class ee extends Y {
|
|
2464
2226
|
constructor() {
|
|
2465
2227
|
super(...arguments), this.protected = !1;
|
|
2466
2228
|
}
|
|
@@ -2472,48 +2234,53 @@ const Je = "readium-snapper-style", bt = class Ee extends de {
|
|
|
2472
2234
|
}`;
|
|
2473
2235
|
}
|
|
2474
2236
|
mount(e, t) {
|
|
2475
|
-
const
|
|
2476
|
-
return
|
|
2477
|
-
this.protected = !0,
|
|
2478
|
-
}), t.register("unprotect",
|
|
2479
|
-
this.protected = !1,
|
|
2237
|
+
const i = e.document.createElement("style");
|
|
2238
|
+
return i.dataset.readium = "true", i.id = Ae, i.textContent = this.buildStyles(), e.document.head.appendChild(i), t.register("protect", ee.moduleName, (s, n) => {
|
|
2239
|
+
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2240
|
+
}), t.register("unprotect", ee.moduleName, (s, n) => {
|
|
2241
|
+
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2480
2242
|
}), t.log("Snapper Mounted"), !0;
|
|
2481
2243
|
}
|
|
2482
2244
|
unmount(e, t) {
|
|
2483
|
-
var
|
|
2484
|
-
return (
|
|
2245
|
+
var i;
|
|
2246
|
+
return (i = e.document.getElementById(Ae)) == null || i.remove(), t.log("Snapper Unmounted"), !0;
|
|
2485
2247
|
}
|
|
2486
2248
|
};
|
|
2487
|
-
|
|
2488
|
-
let
|
|
2489
|
-
function
|
|
2490
|
-
return
|
|
2249
|
+
_e.moduleName = "snapper";
|
|
2250
|
+
let Xe = _e;
|
|
2251
|
+
function W(r) {
|
|
2252
|
+
return r.document.body.dir.toLowerCase() === "rtl";
|
|
2491
2253
|
}
|
|
2492
|
-
function
|
|
2254
|
+
function Ge(r) {
|
|
2493
2255
|
return parseInt(
|
|
2494
|
-
|
|
2495
|
-
|
|
2256
|
+
r.getComputedStyle(
|
|
2257
|
+
r.document.documentElement
|
|
2496
2258
|
).getPropertyValue("column-count")
|
|
2497
2259
|
);
|
|
2498
2260
|
}
|
|
2499
|
-
function
|
|
2500
|
-
const e = "
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2261
|
+
function Me(r) {
|
|
2262
|
+
const e = getComputedStyle(r), t = parseFloat(e.paddingTop || "0"), i = parseFloat(e.paddingBottom || "0");
|
|
2263
|
+
return r.clientHeight - t - i;
|
|
2264
|
+
}
|
|
2265
|
+
function Oe(r) {
|
|
2266
|
+
const e = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
2267
|
+
for (const a of e)
|
|
2268
|
+
a.remove();
|
|
2269
|
+
const t = Ge(r), i = r.document.scrollingElement.scrollWidth, s = Math.ceil(i / r.innerWidth) * t, n = Math.round(i / r.innerWidth * t), o = t === 1 ? 0 : s - n;
|
|
2270
|
+
if (o > 0)
|
|
2271
|
+
for (let a = 0; a < o; a++) {
|
|
2272
|
+
const h = r.document.createElement("div");
|
|
2273
|
+
h.setAttribute("id", `readium-virtual-page-${a}`), h.dataset.readium = "true", CSS.supports("break-before", "column") ? h.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (h.style.breakInside = "avoid-column"), h.style.height = Me(r.document.documentElement) + "px"), h.innerHTML = "​", r.document.body.appendChild(h);
|
|
2274
|
+
}
|
|
2508
2275
|
}
|
|
2509
|
-
function
|
|
2510
|
-
return
|
|
2276
|
+
function Wt(r) {
|
|
2277
|
+
return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
|
|
2511
2278
|
}
|
|
2512
|
-
function T(
|
|
2513
|
-
const e =
|
|
2279
|
+
function T(r) {
|
|
2280
|
+
const e = r.getSelection();
|
|
2514
2281
|
e && e.removeAllRanges();
|
|
2515
2282
|
}
|
|
2516
|
-
const
|
|
2283
|
+
const Ft = [
|
|
2517
2284
|
"a",
|
|
2518
2285
|
"audio",
|
|
2519
2286
|
"button",
|
|
@@ -2527,49 +2294,49 @@ const Ni = [
|
|
|
2527
2294
|
"textarea",
|
|
2528
2295
|
"video"
|
|
2529
2296
|
];
|
|
2530
|
-
function
|
|
2297
|
+
function Ye(r) {
|
|
2531
2298
|
var e;
|
|
2532
|
-
return
|
|
2299
|
+
return Ft.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && ((e = r.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? r : r.parentElement ? Ye(r.parentElement) : null;
|
|
2533
2300
|
}
|
|
2534
|
-
function
|
|
2535
|
-
const t =
|
|
2301
|
+
function Ke(r, e) {
|
|
2302
|
+
const t = Ze(r, r.document.body, e), i = r._readium_cssSelectorGenerator.getCssSelector(t, {
|
|
2536
2303
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2537
2304
|
});
|
|
2538
|
-
return new
|
|
2305
|
+
return new D({
|
|
2539
2306
|
href: "#",
|
|
2540
2307
|
type: "application/xhtml+xml",
|
|
2541
|
-
locations: new
|
|
2308
|
+
locations: new x({
|
|
2542
2309
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2543
|
-
["cssSelector",
|
|
2310
|
+
["cssSelector", i]
|
|
2544
2311
|
])
|
|
2545
2312
|
}),
|
|
2546
|
-
text: new
|
|
2313
|
+
text: new U({
|
|
2547
2314
|
highlight: t.textContent || void 0
|
|
2548
2315
|
})
|
|
2549
2316
|
});
|
|
2550
2317
|
}
|
|
2551
|
-
function
|
|
2552
|
-
for (var
|
|
2553
|
-
const
|
|
2554
|
-
if (!
|
|
2555
|
-
return
|
|
2318
|
+
function Ze(r, e, t) {
|
|
2319
|
+
for (var i = 0; i < e.children.length; i++) {
|
|
2320
|
+
const s = e.children[i];
|
|
2321
|
+
if (!kt(s) && Bt(r, s, t))
|
|
2322
|
+
return Ut(r, s) ? s : Ze(r, s, t);
|
|
2556
2323
|
}
|
|
2557
2324
|
return e;
|
|
2558
2325
|
}
|
|
2559
|
-
function
|
|
2326
|
+
function Bt(r, e, t) {
|
|
2560
2327
|
if (e === document.body || e === document.documentElement)
|
|
2561
2328
|
return !0;
|
|
2562
2329
|
if (!document || !document.documentElement || !document.body)
|
|
2563
2330
|
return !1;
|
|
2564
|
-
const
|
|
2565
|
-
return t ?
|
|
2331
|
+
const i = e.getBoundingClientRect();
|
|
2332
|
+
return t ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
|
|
2566
2333
|
}
|
|
2567
|
-
function
|
|
2334
|
+
function Ut(r, e) {
|
|
2568
2335
|
const t = e.getBoundingClientRect();
|
|
2569
|
-
return t.top >= 0 && t.left >= 0 && t.bottom <=
|
|
2336
|
+
return t.top >= 0 && t.left >= 0 && t.bottom <= r.innerHeight && t.right <= r.innerWidth;
|
|
2570
2337
|
}
|
|
2571
|
-
function
|
|
2572
|
-
const e = getComputedStyle(
|
|
2338
|
+
function kt(r) {
|
|
2339
|
+
const e = getComputedStyle(r);
|
|
2573
2340
|
if (e) {
|
|
2574
2341
|
const t = e.getPropertyValue("display");
|
|
2575
2342
|
if (t != "block" && t != "list-item" || e.getPropertyValue("opacity") === "0")
|
|
@@ -2577,7 +2344,7 @@ function Li(i) {
|
|
|
2577
2344
|
}
|
|
2578
2345
|
return !1;
|
|
2579
2346
|
}
|
|
2580
|
-
const
|
|
2347
|
+
const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
|
|
2581
2348
|
constructor() {
|
|
2582
2349
|
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);
|
|
2583
2350
|
}
|
|
@@ -2588,7 +2355,7 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2588
2355
|
return this.doc().scrollLeft > 0 ? this.doc().scrollLeft : this.alreadyScrollLeft;
|
|
2589
2356
|
}
|
|
2590
2357
|
snapOffset(e) {
|
|
2591
|
-
const t = e + (
|
|
2358
|
+
const t = e + (W(this.wnd) ? -1 : 1);
|
|
2592
2359
|
return t - t % this.wnd.innerWidth;
|
|
2593
2360
|
}
|
|
2594
2361
|
reportProgress() {
|
|
@@ -2598,7 +2365,7 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2598
2365
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0)
|
|
2599
2366
|
return;
|
|
2600
2367
|
const e = this.doc();
|
|
2601
|
-
e.classList.add(
|
|
2368
|
+
e.classList.add(W(this.wnd) ? "readium-bounce-l" : "readium-bounce-r");
|
|
2602
2369
|
const t = this.scrollOffset();
|
|
2603
2370
|
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
2604
2371
|
e.classList.remove("readium-bounce-l"), e.classList.remove("readium-bounce-r"), this.shakeTimeout = 0, this.doc().scrollLeft = t;
|
|
@@ -2613,28 +2380,28 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2613
2380
|
}
|
|
2614
2381
|
// Snaps the current offset to the page width.
|
|
2615
2382
|
snapCurrentOffset(e = !1, t = !1) {
|
|
2616
|
-
const
|
|
2383
|
+
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = Ge(this.wnd), a = Math.min(Math.max(0, i), this.cachedScrollWidth), h = W(this.wnd) ? -1 : 1, c = (
|
|
2617
2384
|
// The hurdle to overcome in order to change pages
|
|
2618
|
-
h * (this.wnd.innerWidth / 3) * (h *
|
|
2619
|
-
),
|
|
2620
|
-
if (e &&
|
|
2385
|
+
h * (this.wnd.innerWidth / 3) * (h * n > 0 ? 2 : 1)
|
|
2386
|
+
), d = this.snapOffset(a + c);
|
|
2387
|
+
if (e && d !== this.scrollOffset()) {
|
|
2621
2388
|
this.snappingCancelled = !1;
|
|
2622
|
-
const p = (
|
|
2389
|
+
const p = (m, v, S, O) => S > O ? v : m + (v - m) * Wt(S / O), u = (
|
|
2623
2390
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2624
|
-
|
|
2391
|
+
Ht * o
|
|
2625
2392
|
);
|
|
2626
2393
|
let f;
|
|
2627
|
-
const
|
|
2394
|
+
const g = (m) => {
|
|
2628
2395
|
if (this.snappingCancelled)
|
|
2629
2396
|
return;
|
|
2630
|
-
f || (f =
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2397
|
+
f || (f = m);
|
|
2398
|
+
const v = m - f, S = p(this.overscroll, 0, v, u), O = p(i, d, v, u);
|
|
2399
|
+
s.scrollLeft = O, this.overscroll !== 0 && (s.style.transform = `translate3d(${-S}px, 0px, 0px)`), v < u ? this.wnd.requestAnimationFrame(g) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = d, t || this.reportProgress());
|
|
2633
2400
|
};
|
|
2634
|
-
this.wnd.requestAnimationFrame(
|
|
2401
|
+
this.wnd.requestAnimationFrame(g);
|
|
2635
2402
|
} else
|
|
2636
|
-
|
|
2637
|
-
|
|
2403
|
+
s.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
|
|
2404
|
+
s.scrollLeft = d, this.clearTouches(), t || this.reportProgress();
|
|
2638
2405
|
});
|
|
2639
2406
|
}
|
|
2640
2407
|
dragOffset() {
|
|
@@ -2659,8 +2426,8 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2659
2426
|
}
|
|
2660
2427
|
onTouchEnd(e) {
|
|
2661
2428
|
if (this.touchState === 2) {
|
|
2662
|
-
const t = this.dragOffset(),
|
|
2663
|
-
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), t > 5 && this.comms.send("no_more", void 0), t < -5 && this.comms.send("no_less", void 0)) :
|
|
2429
|
+
const t = this.dragOffset(), i = this.scrollOffset();
|
|
2430
|
+
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), t > 5 && this.comms.send("no_more", void 0), t < -5 && this.comms.send("no_less", void 0)) : i < 5 && t < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : this.cachedScrollWidth - i - this.wnd.innerWidth < 5 && t > 5 && (this.alreadyScrollLeft = this.cachedScrollWidth, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", t);
|
|
2664
2431
|
}
|
|
2665
2432
|
this.touchState = 0;
|
|
2666
2433
|
}
|
|
@@ -2671,15 +2438,15 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2671
2438
|
if (this.touchState === 0)
|
|
2672
2439
|
return;
|
|
2673
2440
|
this.touchState === 1 && (this.touchState = 2, T(this.wnd)), this.endingX = e.touches[0].clientX;
|
|
2674
|
-
const t = this.dragOffset(),
|
|
2675
|
-
|
|
2441
|
+
const t = this.dragOffset(), i = this.alreadyScrollLeft + t;
|
|
2442
|
+
i < 0 ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + t);
|
|
2676
2443
|
}
|
|
2677
2444
|
mount(e, t) {
|
|
2678
2445
|
if (this.wnd = e, this.comms = t, !super.mount(e, t))
|
|
2679
2446
|
return !1;
|
|
2680
2447
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2681
|
-
const
|
|
2682
|
-
|
|
2448
|
+
const i = e.document.createElement("style");
|
|
2449
|
+
i.dataset.readium = "true", i.id = Ie, i.textContent = `
|
|
2683
2450
|
@keyframes readium-bounce-l-animation {
|
|
2684
2451
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2685
2452
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2713,131 +2480,121 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2713
2480
|
body::-webkit-scrollbar {
|
|
2714
2481
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2715
2482
|
}
|
|
2716
|
-
`, e.document.head.appendChild(
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
})
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2483
|
+
`, e.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2484
|
+
e.requestAnimationFrame(() => {
|
|
2485
|
+
e && Oe(e);
|
|
2486
|
+
}), this.onWidthChange();
|
|
2487
|
+
}), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver((n) => {
|
|
2488
|
+
for (const o of n)
|
|
2489
|
+
if (o.target === this.wnd.document.documentElement) {
|
|
2490
|
+
const a = o.oldValue, h = o.target.getAttribute("style"), c = /transform\s*:\s*([^;]+)/, d = a == null ? void 0 : a.match(c), p = h == null ? void 0 : h.match(c);
|
|
2491
|
+
(!d && !p || d && !p || d && p && d[1] !== p[1]) && (e.requestAnimationFrame(() => {
|
|
2492
|
+
e && Oe(e);
|
|
2493
|
+
}), this.onWidthChange());
|
|
2494
|
+
} else
|
|
2495
|
+
e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
2496
|
+
}), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document.documentElement, { attributes: !0, attributeFilter: ["style"] });
|
|
2497
|
+
const s = (n) => {
|
|
2498
|
+
const o = this.doc().scrollLeft;
|
|
2499
|
+
return this.doc().scrollLeft = this.snapOffset(n), o !== this.doc().scrollLeft;
|
|
2726
2500
|
};
|
|
2727
|
-
return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression",
|
|
2728
|
-
const
|
|
2729
|
-
if (
|
|
2501
|
+
return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression", w.moduleName, (n, o) => {
|
|
2502
|
+
const a = n;
|
|
2503
|
+
if (a < 0 || a > 1) {
|
|
2730
2504
|
t.send("error", {
|
|
2731
2505
|
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2732
|
-
}),
|
|
2506
|
+
}), o(!1);
|
|
2733
2507
|
return;
|
|
2734
2508
|
}
|
|
2735
2509
|
this.wnd.requestAnimationFrame(() => {
|
|
2736
2510
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2737
|
-
const
|
|
2738
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2511
|
+
const h = this.cachedScrollWidth, c = W(e) ? -1 : 1, d = h * a * c;
|
|
2512
|
+
this.doc().scrollLeft = this.snapOffset(d), this.reportProgress(), T(this.wnd), o(!0);
|
|
2739
2513
|
});
|
|
2740
|
-
}), t.register("go_id",
|
|
2741
|
-
const
|
|
2742
|
-
if (!
|
|
2743
|
-
|
|
2514
|
+
}), t.register("go_id", w.moduleName, (n, o) => {
|
|
2515
|
+
const a = e.document.getElementById(n);
|
|
2516
|
+
if (!a) {
|
|
2517
|
+
o(!1);
|
|
2744
2518
|
return;
|
|
2745
2519
|
}
|
|
2746
2520
|
this.wnd.requestAnimationFrame(() => {
|
|
2747
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2521
|
+
this.doc().scrollLeft = this.snapOffset(a.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), o(!0);
|
|
2748
2522
|
});
|
|
2749
|
-
}), t.register("go_text",
|
|
2750
|
-
let
|
|
2751
|
-
Array.isArray(
|
|
2752
|
-
const
|
|
2523
|
+
}), t.register("go_text", w.moduleName, (n, o) => {
|
|
2524
|
+
let a;
|
|
2525
|
+
Array.isArray(n) && (n.length > 1 && (a = n[1]), n = n[0]);
|
|
2526
|
+
const h = U.deserialize(n), c = le(this.wnd.document, new D({
|
|
2753
2527
|
href: e.location.href,
|
|
2754
2528
|
type: "text/html",
|
|
2755
|
-
text:
|
|
2756
|
-
locations:
|
|
2529
|
+
text: h,
|
|
2530
|
+
locations: a ? new x({
|
|
2757
2531
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2758
|
-
["cssSelector",
|
|
2532
|
+
["cssSelector", a]
|
|
2759
2533
|
])
|
|
2760
2534
|
}) : void 0
|
|
2761
2535
|
}));
|
|
2762
|
-
if (!
|
|
2763
|
-
|
|
2536
|
+
if (!c) {
|
|
2537
|
+
o(!1);
|
|
2764
2538
|
return;
|
|
2765
2539
|
}
|
|
2766
2540
|
this.wnd.requestAnimationFrame(() => {
|
|
2767
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2541
|
+
this.doc().scrollLeft = this.snapOffset(c.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), o(!0);
|
|
2768
2542
|
});
|
|
2769
|
-
}), t.register("go_end",
|
|
2770
|
-
const
|
|
2543
|
+
}), t.register("go_end", w.moduleName, (n, o) => {
|
|
2544
|
+
const a = W(e) ? -1 : 1;
|
|
2771
2545
|
this.wnd.requestAnimationFrame(() => {
|
|
2772
2546
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2773
|
-
const
|
|
2774
|
-
if (this.doc().scrollLeft ===
|
|
2775
|
-
return
|
|
2776
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2547
|
+
const h = this.cachedScrollWidth * a;
|
|
2548
|
+
if (this.doc().scrollLeft === h)
|
|
2549
|
+
return o(!1);
|
|
2550
|
+
this.doc().scrollLeft = this.snapOffset(h), this.reportProgress(), T(this.wnd), o(!0);
|
|
2777
2551
|
});
|
|
2778
|
-
}), t.register("go_start",
|
|
2552
|
+
}), t.register("go_start", w.moduleName, (n, o) => {
|
|
2779
2553
|
this.wnd.requestAnimationFrame(() => {
|
|
2780
2554
|
if (this.doc().scrollLeft === 0)
|
|
2781
|
-
return
|
|
2782
|
-
this.doc().scrollLeft = 0, this.reportProgress(), T(this.wnd),
|
|
2555
|
+
return o(!1);
|
|
2556
|
+
this.doc().scrollLeft = 0, this.reportProgress(), T(this.wnd), o(!0);
|
|
2783
2557
|
});
|
|
2784
|
-
}), t.register("go_prev",
|
|
2558
|
+
}), t.register("go_prev", w.moduleName, (n, o) => {
|
|
2785
2559
|
this.wnd.requestAnimationFrame(() => {
|
|
2786
|
-
|
|
2787
|
-
|
|
2560
|
+
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2561
|
+
const a = e.scrollX - e.innerWidth, h = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, c = s(Math.max(a, h));
|
|
2562
|
+
c && (this.reportProgress(), T(this.wnd)), o(c);
|
|
2788
2563
|
});
|
|
2789
|
-
}), t.register("go_next",
|
|
2564
|
+
}), t.register("go_next", w.moduleName, (n, o) => {
|
|
2790
2565
|
this.wnd.requestAnimationFrame(() => {
|
|
2791
|
-
|
|
2792
|
-
|
|
2566
|
+
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2567
|
+
const a = e.scrollX + e.innerWidth, h = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth, c = s(Math.min(a, h));
|
|
2568
|
+
c && (this.reportProgress(), T(this.wnd)), o(c);
|
|
2793
2569
|
});
|
|
2794
|
-
}), t.register("unfocus",
|
|
2795
|
-
this.snappingCancelled = !0, T(this.wnd),
|
|
2796
|
-
}), t.register("shake",
|
|
2797
|
-
this.shake(),
|
|
2798
|
-
}), t.register("focus",
|
|
2570
|
+
}), t.register("unfocus", w.moduleName, (n, o) => {
|
|
2571
|
+
this.snappingCancelled = !0, T(this.wnd), o(!0);
|
|
2572
|
+
}), t.register("shake", w.moduleName, (n, o) => {
|
|
2573
|
+
this.shake(), o(!0);
|
|
2574
|
+
}), t.register("focus", w.moduleName, (n, o) => {
|
|
2799
2575
|
this.wnd.requestAnimationFrame(() => {
|
|
2800
|
-
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(),
|
|
2576
|
+
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), o(!0);
|
|
2801
2577
|
});
|
|
2802
|
-
}), t.register("first_visible_locator",
|
|
2803
|
-
const
|
|
2804
|
-
this.comms.send("first_visible_locator",
|
|
2578
|
+
}), t.register("first_visible_locator", w.moduleName, (n, o) => {
|
|
2579
|
+
const a = Ke(e, !1);
|
|
2580
|
+
this.comms.send("first_visible_locator", a.serialize()), o(!0);
|
|
2805
2581
|
}), 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", () => {
|
|
2806
2582
|
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2807
2583
|
}
|
|
2808
2584
|
unmount(e, t) {
|
|
2809
|
-
var
|
|
2810
|
-
return this.snappingCancelled = !0, t.unregisterAll(
|
|
2585
|
+
var i;
|
|
2586
|
+
return this.snappingCancelled = !0, t.unregisterAll(w.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), (i = e.document.getElementById(Ie)) == null || i.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
|
|
2811
2587
|
}
|
|
2812
2588
|
};
|
|
2813
|
-
|
|
2814
|
-
let
|
|
2815
|
-
const
|
|
2816
|
-
top: "js-iframe-reader-top-anchor",
|
|
2817
|
-
bottom: "js-iframe-reader-bottom-anchor"
|
|
2818
|
-
};
|
|
2819
|
-
class Di extends HTMLElement {
|
|
2820
|
-
connectedCallback() {
|
|
2821
|
-
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");
|
|
2822
|
-
}
|
|
2823
|
-
}
|
|
2824
|
-
function Bi(i) {
|
|
2825
|
-
const e = i.getElementsByTagName("body")[0], t = document.createElement("anchor-observer"), r = document.createElement("anchor-observer");
|
|
2826
|
-
t.dataset.readium = "true", r.dataset.readium = "true", t == null || t.setAttribute("id", ue.top), t == null || t.style.setProperty("height", "115px", "important"), r == null || r.setAttribute("id", ue.bottom), r == null || r.style.setProperty("height", "80px", "important"), e == null || e.insertBefore(t, e.firstChild), e == null || e.appendChild(r);
|
|
2827
|
-
}
|
|
2828
|
-
function Wi(i) {
|
|
2829
|
-
var n, s;
|
|
2830
|
-
const e = i.getElementsByTagName("body")[0], t = e == null ? void 0 : e.querySelector(`#${ue.top}`), r = e == null ? void 0 : e.querySelector(`#${ue.bottom}`);
|
|
2831
|
-
t && ((n = t.parentElement) == null || n.removeChild(t)), r && ((s = r.parentElement) == null || s.removeChild(r));
|
|
2832
|
-
}
|
|
2833
|
-
const Ze = "readium-scroll-snapper-style", Ot = class M extends Et {
|
|
2589
|
+
Je.moduleName = "column_snapper";
|
|
2590
|
+
let $t = Je;
|
|
2591
|
+
const Le = "readium-scroll-snapper-style", Qe = class A extends Xe {
|
|
2834
2592
|
constructor() {
|
|
2835
|
-
super(...arguments), this.
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
customElements.get("anchor-observer") || customElements.define("anchor-observer", Di);
|
|
2593
|
+
super(...arguments), this.isScrolling = !1, this.handleScroll = () => {
|
|
2594
|
+
this.isScrolling || (this.isScrolling = !0, this.wnd.requestAnimationFrame(() => {
|
|
2595
|
+
const e = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2596
|
+
this.reportProgress({ progress: e, reference: this.wnd.innerHeight / this.doc().scrollHeight }), this.isScrolling = !1;
|
|
2597
|
+
}));
|
|
2841
2598
|
};
|
|
2842
2599
|
}
|
|
2843
2600
|
doc() {
|
|
@@ -2848,8 +2605,8 @@ const Ze = "readium-scroll-snapper-style", Ot = class M extends Et {
|
|
|
2848
2605
|
}
|
|
2849
2606
|
mount(e, t) {
|
|
2850
2607
|
this.wnd = e, this.comms = t, e.navigator.epubReadingSystem.layoutStyle = "scrolling";
|
|
2851
|
-
const
|
|
2852
|
-
return
|
|
2608
|
+
const i = e.document.createElement("style");
|
|
2609
|
+
return i.dataset.readium = "true", i.id = Le, i.textContent = `
|
|
2853
2610
|
* {
|
|
2854
2611
|
scrollbar-width: none; /* for Firefox */
|
|
2855
2612
|
}
|
|
@@ -2857,95 +2614,99 @@ const Ze = "readium-scroll-snapper-style", Ot = class M extends Et {
|
|
|
2857
2614
|
body::-webkit-scrollbar {
|
|
2858
2615
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2859
2616
|
}
|
|
2860
|
-
`, e.document.head.appendChild(
|
|
2861
|
-
|
|
2617
|
+
`, e.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2618
|
+
this.comms.ready && this.handleScroll();
|
|
2619
|
+
}), this.resizeObserver.observe(e.document.body), e.addEventListener("scroll", this.handleScroll, {
|
|
2620
|
+
passive: !0
|
|
2621
|
+
}), t.register("go_progression", A.moduleName, (s, n) => {
|
|
2622
|
+
const o = s;
|
|
2862
2623
|
if (o < 0 || o > 1) {
|
|
2863
2624
|
t.send("error", {
|
|
2864
2625
|
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2865
|
-
}),
|
|
2626
|
+
}), n(!1);
|
|
2866
2627
|
return;
|
|
2867
2628
|
}
|
|
2868
2629
|
this.wnd.requestAnimationFrame(() => {
|
|
2869
|
-
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd),
|
|
2630
|
+
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2870
2631
|
});
|
|
2871
|
-
}), t.register("go_id",
|
|
2872
|
-
const o = e.document.getElementById(
|
|
2632
|
+
}), t.register("go_id", A.moduleName, (s, n) => {
|
|
2633
|
+
const o = e.document.getElementById(s);
|
|
2873
2634
|
if (!o) {
|
|
2874
|
-
|
|
2635
|
+
n(!1);
|
|
2875
2636
|
return;
|
|
2876
2637
|
}
|
|
2877
2638
|
this.wnd.requestAnimationFrame(() => {
|
|
2878
2639
|
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2879
2640
|
const a = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2880
|
-
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd),
|
|
2641
|
+
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2881
2642
|
});
|
|
2882
|
-
}), t.register("go_text",
|
|
2643
|
+
}), t.register("go_text", A.moduleName, (s, n) => {
|
|
2883
2644
|
let o;
|
|
2884
|
-
Array.isArray(
|
|
2885
|
-
const a =
|
|
2645
|
+
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2646
|
+
const a = U.deserialize(s), h = le(this.wnd.document, new D({
|
|
2886
2647
|
href: e.location.href,
|
|
2887
2648
|
type: "text/html",
|
|
2888
2649
|
text: a,
|
|
2889
|
-
locations: o ? new
|
|
2650
|
+
locations: o ? new x({
|
|
2890
2651
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2891
2652
|
["cssSelector", o]
|
|
2892
2653
|
])
|
|
2893
2654
|
}) : void 0
|
|
2894
2655
|
}));
|
|
2895
2656
|
if (!h) {
|
|
2896
|
-
|
|
2657
|
+
n(!1);
|
|
2897
2658
|
return;
|
|
2898
2659
|
}
|
|
2899
2660
|
this.wnd.requestAnimationFrame(() => {
|
|
2900
2661
|
this.doc().scrollTop = h.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2901
2662
|
const c = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2902
|
-
this.reportProgress({ progress: c, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd),
|
|
2663
|
+
this.reportProgress({ progress: c, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2903
2664
|
});
|
|
2904
|
-
}), t.register("go_start",
|
|
2665
|
+
}), t.register("go_start", A.moduleName, (s, n) => {
|
|
2905
2666
|
if (this.doc().scrollTop === 0)
|
|
2906
|
-
return
|
|
2907
|
-
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2908
|
-
}), t.register("go_end",
|
|
2667
|
+
return n(!1);
|
|
2668
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2669
|
+
}), t.register("go_end", A.moduleName, (s, n) => {
|
|
2909
2670
|
if (this.doc().scrollTop === 0)
|
|
2910
|
-
return
|
|
2911
|
-
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2912
|
-
}), t.register("unfocus",
|
|
2913
|
-
T(this.wnd),
|
|
2671
|
+
return n(!1);
|
|
2672
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2673
|
+
}), t.register("unfocus", A.moduleName, (s, n) => {
|
|
2674
|
+
T(this.wnd), n(!0);
|
|
2914
2675
|
}), t.register([
|
|
2915
2676
|
"go_next",
|
|
2916
2677
|
"go_prev"
|
|
2917
|
-
],
|
|
2678
|
+
], A.moduleName, (s, n) => n(!1)), t.register("focus", A.moduleName, (s, n) => {
|
|
2918
2679
|
const o = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2919
|
-
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2920
|
-
}), t.register("first_visible_locator",
|
|
2921
|
-
const o =
|
|
2922
|
-
this.comms.send("first_visible_locator", o.serialize()),
|
|
2923
|
-
}), t.log("ScrollSnapper Mounted"),
|
|
2680
|
+
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2681
|
+
}), t.register("first_visible_locator", A.moduleName, (s, n) => {
|
|
2682
|
+
const o = Ke(e, !0);
|
|
2683
|
+
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2684
|
+
}), t.log("ScrollSnapper Mounted"), !0;
|
|
2924
2685
|
}
|
|
2925
2686
|
unmount(e, t) {
|
|
2926
|
-
var
|
|
2927
|
-
return t.unregisterAll(
|
|
2687
|
+
var i;
|
|
2688
|
+
return t.unregisterAll(A.moduleName), this.resizeObserver.disconnect(), this.handleScroll && e.removeEventListener("scroll", this.handleScroll), (i = e.document.getElementById(Le)) == null || i.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2928
2689
|
}
|
|
2929
2690
|
};
|
|
2930
|
-
|
|
2931
|
-
let
|
|
2932
|
-
class
|
|
2691
|
+
Qe.moduleName = "scroll_snapper";
|
|
2692
|
+
let jt = Qe;
|
|
2693
|
+
class et extends Y {
|
|
2933
2694
|
constructor() {
|
|
2934
2695
|
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);
|
|
2935
2696
|
}
|
|
2936
2697
|
onPointUp(e) {
|
|
2937
|
-
var
|
|
2698
|
+
var s, n, o, a, h;
|
|
2938
2699
|
const t = this.wnd.getSelection();
|
|
2939
|
-
if (t && ((
|
|
2940
|
-
const c = (
|
|
2700
|
+
if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
|
|
2701
|
+
const c = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
|
|
2941
2702
|
if (!c || c.length === 0)
|
|
2942
2703
|
return;
|
|
2943
|
-
const
|
|
2704
|
+
const d = c[0], p = {
|
|
2944
2705
|
text: t.toString(),
|
|
2945
|
-
x:
|
|
2946
|
-
y:
|
|
2947
|
-
width:
|
|
2948
|
-
height:
|
|
2706
|
+
x: d.x,
|
|
2707
|
+
y: d.y,
|
|
2708
|
+
width: d.width,
|
|
2709
|
+
height: d.height,
|
|
2949
2710
|
targetFrameSrc: (a = (o = this.wnd) == null ? void 0 : o.location) == null ? void 0 : a.href
|
|
2950
2711
|
};
|
|
2951
2712
|
this.comms.send("text_selected", p);
|
|
@@ -2956,14 +2717,14 @@ class Pt extends de {
|
|
|
2956
2717
|
}
|
|
2957
2718
|
if (!(t != null && t.isCollapsed) || !e.isPrimary)
|
|
2958
2719
|
return;
|
|
2959
|
-
const
|
|
2720
|
+
const i = this.wnd.devicePixelRatio;
|
|
2960
2721
|
e.preventDefault(), this.comms.send(e.pointerType === "touch" ? "tap" : "click", {
|
|
2961
2722
|
defaultPrevented: e.defaultPrevented,
|
|
2962
|
-
x: e.clientX *
|
|
2963
|
-
y: e.clientY *
|
|
2723
|
+
x: e.clientX * i,
|
|
2724
|
+
y: e.clientY * i,
|
|
2964
2725
|
targetFrameSrc: this.wnd.location.href,
|
|
2965
2726
|
targetElement: e.target.outerHTML,
|
|
2966
|
-
interactiveElement: (h =
|
|
2727
|
+
interactiveElement: (h = Ye(e.target)) == null ? void 0 : h.outerHTML,
|
|
2967
2728
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2968
2729
|
}), this.pointerMoved = !1;
|
|
2969
2730
|
}
|
|
@@ -2999,8 +2760,8 @@ class Pt extends de {
|
|
|
2999
2760
|
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;
|
|
3000
2761
|
}
|
|
3001
2762
|
}
|
|
3002
|
-
|
|
3003
|
-
const
|
|
2763
|
+
et.moduleName = "peripherals";
|
|
2764
|
+
const tt = class te extends Y {
|
|
3004
2765
|
constructor() {
|
|
3005
2766
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
3006
2767
|
}
|
|
@@ -3016,19 +2777,19 @@ const At = class xe extends de {
|
|
|
3016
2777
|
unblock(e) {
|
|
3017
2778
|
var t;
|
|
3018
2779
|
for (e._readium_blockEvents = !1; ((t = e._readium_blockedEvents) == null ? void 0 : t.length) > 0; ) {
|
|
3019
|
-
const
|
|
3020
|
-
switch (
|
|
2780
|
+
const i = e._readium_blockedEvents.shift();
|
|
2781
|
+
switch (i[0]) {
|
|
3021
2782
|
case 0:
|
|
3022
|
-
Reflect.apply(
|
|
2783
|
+
Reflect.apply(i[1], i[2], i[3]);
|
|
3023
2784
|
break;
|
|
3024
2785
|
case 1:
|
|
3025
|
-
const
|
|
3026
|
-
e.removeEventListener(
|
|
3027
|
-
const o = new Event(
|
|
3028
|
-
bubbles:
|
|
3029
|
-
cancelable:
|
|
2786
|
+
const s = i[1], n = i[2];
|
|
2787
|
+
e.removeEventListener(s.type, e._readium_eventBlocker, !0);
|
|
2788
|
+
const o = new Event(s.type, {
|
|
2789
|
+
bubbles: s.bubbles,
|
|
2790
|
+
cancelable: s.cancelable
|
|
3030
2791
|
});
|
|
3031
|
-
|
|
2792
|
+
n ? n.dispatchEvent(o) : e.dispatchEvent(o);
|
|
3032
2793
|
break;
|
|
3033
2794
|
}
|
|
3034
2795
|
}
|
|
@@ -3043,8 +2804,8 @@ const At = class xe extends de {
|
|
|
3043
2804
|
}
|
|
3044
2805
|
pauseAllMedia(e) {
|
|
3045
2806
|
const t = e.document.querySelectorAll("audio,video");
|
|
3046
|
-
for (let
|
|
3047
|
-
t[
|
|
2807
|
+
for (let i = 0; i < t.length; i++)
|
|
2808
|
+
t[i].pause();
|
|
3048
2809
|
}
|
|
3049
2810
|
mount(e, t) {
|
|
3050
2811
|
this.comms = t, e.addEventListener(
|
|
@@ -3054,9 +2815,9 @@ const At = class xe extends de {
|
|
|
3054
2815
|
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
3055
2816
|
value: {
|
|
3056
2817
|
name: "readium-ts-toolkit",
|
|
3057
|
-
version: "
|
|
3058
|
-
hasFeature: (
|
|
3059
|
-
switch (
|
|
2818
|
+
version: "2.0.0-beta.1",
|
|
2819
|
+
hasFeature: (s, n = "") => {
|
|
2820
|
+
switch (s) {
|
|
3060
2821
|
case "dom-manipulation":
|
|
3061
2822
|
return !0;
|
|
3062
2823
|
case "layout-changes":
|
|
@@ -3077,69 +2838,73 @@ const At = class xe extends de {
|
|
|
3077
2838
|
}
|
|
3078
2839
|
},
|
|
3079
2840
|
writable: !1
|
|
3080
|
-
}), "getAnimations" in e.document && e.document.getAnimations().forEach((
|
|
3081
|
-
|
|
3082
|
-
}), t.register("activate",
|
|
2841
|
+
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
2842
|
+
s.cancel(), this.allAnimations.add(s);
|
|
2843
|
+
}), t.register("activate", te.moduleName, (s, n) => {
|
|
3083
2844
|
this.allAnimations.forEach((o) => {
|
|
3084
2845
|
o.cancel(), o.play();
|
|
3085
|
-
}),
|
|
3086
|
-
}), t.register("unfocus",
|
|
3087
|
-
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()),
|
|
2846
|
+
}), n(!0);
|
|
2847
|
+
}), t.register("unfocus", te.moduleName, (s, n) => {
|
|
2848
|
+
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
3088
2849
|
});
|
|
3089
|
-
const
|
|
3090
|
-
for (let
|
|
3091
|
-
const
|
|
3092
|
-
|
|
2850
|
+
const i = e.document.querySelectorAll("audio,video");
|
|
2851
|
+
for (let s = 0; s < i.length; s++) {
|
|
2852
|
+
const n = i[s];
|
|
2853
|
+
n.addEventListener("play", this.onMediaPlayEvent, {
|
|
3093
2854
|
passive: !0
|
|
3094
|
-
}),
|
|
2855
|
+
}), n.addEventListener("pause", this.onMediaPauseEvent, {
|
|
3095
2856
|
passive: !0
|
|
3096
2857
|
});
|
|
3097
2858
|
}
|
|
3098
2859
|
return t.log("Setup Mounted"), !0;
|
|
3099
2860
|
}
|
|
3100
2861
|
unmount(e, t) {
|
|
3101
|
-
return e.removeEventListener("error", this.wndOnErr), e.removeEventListener("play", this.onMediaPlayEvent), e.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((
|
|
2862
|
+
return e.removeEventListener("error", this.wndOnErr), e.removeEventListener("play", this.onMediaPlayEvent), e.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((i) => i.cancel()), this.allAnimations.clear(), t.log("Setup Unmounted"), !0;
|
|
3102
2863
|
}
|
|
3103
2864
|
};
|
|
3104
|
-
|
|
3105
|
-
let
|
|
3106
|
-
const
|
|
2865
|
+
tt.moduleName = "setup";
|
|
2866
|
+
let it = tt;
|
|
2867
|
+
const Re = "readium-viewport", rt = class F extends it {
|
|
3107
2868
|
onViewportWidthChanged(e) {
|
|
3108
2869
|
const t = e.target;
|
|
3109
|
-
|
|
2870
|
+
G(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
3110
2871
|
}
|
|
3111
2872
|
mount(e, t) {
|
|
3112
2873
|
if (!super.mount(e, t))
|
|
3113
2874
|
return !1;
|
|
3114
|
-
const
|
|
3115
|
-
return
|
|
2875
|
+
const i = e.document.createElement("meta");
|
|
2876
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", Re), i.setAttribute(
|
|
3116
2877
|
"content",
|
|
3117
2878
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3118
|
-
), e.document.head.appendChild(
|
|
2879
|
+
), e.document.head.appendChild(i), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
3119
2880
|
target: e
|
|
3120
|
-
}), t.register("
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
2881
|
+
}), t.register("get_properties", F.moduleName, (s, n) => {
|
|
2882
|
+
qe(e), n(!0);
|
|
2883
|
+
}), t.register("update_properties", F.moduleName, (s, n) => {
|
|
2884
|
+
s["--RS__viewportWidth"] = `${e.innerWidth}px`, Nt(e, s), n(!0);
|
|
2885
|
+
}), t.register("set_property", F.moduleName, (s, n) => {
|
|
2886
|
+
const o = s;
|
|
2887
|
+
G(e, o[0], o[1]), n(!0);
|
|
2888
|
+
}), t.register("remove_property", F.moduleName, (s, n) => {
|
|
2889
|
+
he(e, s), n(!0);
|
|
2890
|
+
}), t.register("activate", F.moduleName, (s, n) => {
|
|
2891
|
+
this.unblock(e), n(!0);
|
|
3127
2892
|
}), t.log("ReflowableSetup Mounted"), !0;
|
|
3128
2893
|
}
|
|
3129
2894
|
unmount(e, t) {
|
|
3130
|
-
var
|
|
3131
|
-
return t.unregisterAll(
|
|
2895
|
+
var i;
|
|
2896
|
+
return t.unregisterAll(F.moduleName), (i = e.document.head.querySelector(`#${Re}`)) == null || i.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
3132
2897
|
}
|
|
3133
2898
|
};
|
|
3134
|
-
|
|
3135
|
-
let
|
|
3136
|
-
const
|
|
2899
|
+
rt.moduleName = "reflowable_setup";
|
|
2900
|
+
let qt = rt;
|
|
2901
|
+
const ze = "readium-fixed-style", st = class L extends it {
|
|
3137
2902
|
mount(e, t) {
|
|
3138
2903
|
if (!super.mount(e, t))
|
|
3139
2904
|
return !1;
|
|
3140
2905
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
3141
|
-
const
|
|
3142
|
-
return
|
|
2906
|
+
const i = e.document.createElement("style");
|
|
2907
|
+
return i.id = ze, i.dataset.readium = "true", i.textContent = `
|
|
3143
2908
|
html, body {
|
|
3144
2909
|
text-size-adjust: none;
|
|
3145
2910
|
-ms-text-size-adjust: none;
|
|
@@ -3151,13 +2916,13 @@ const et = "readium-fixed-style", Rt = class I extends Nt {
|
|
|
3151
2916
|
min-height: 100%;
|
|
3152
2917
|
|
|
3153
2918
|
/*cursor: var() TODO*/
|
|
3154
|
-
}`, e.document.head.appendChild(
|
|
3155
|
-
const o =
|
|
3156
|
-
|
|
3157
|
-
}), t.register("remove_property",
|
|
3158
|
-
|
|
3159
|
-
}), t.register("first_visible_locator",
|
|
3160
|
-
T(e),
|
|
2919
|
+
}`, e.document.head.appendChild(i), t.register("set_property", L.moduleName, (s, n) => {
|
|
2920
|
+
const o = s;
|
|
2921
|
+
G(e, o[0], o[1]), n(!0);
|
|
2922
|
+
}), t.register("remove_property", L.moduleName, (s, n) => {
|
|
2923
|
+
he(e, s), n(!0);
|
|
2924
|
+
}), t.register("first_visible_locator", L.moduleName, (s, n) => n(!1)), t.register("unfocus", L.moduleName, (s, n) => {
|
|
2925
|
+
T(e), n(!0);
|
|
3161
2926
|
}), t.register([
|
|
3162
2927
|
"focus",
|
|
3163
2928
|
"go_next",
|
|
@@ -3167,56 +2932,56 @@ const et = "readium-fixed-style", Rt = class I extends Nt {
|
|
|
3167
2932
|
"go_start",
|
|
3168
2933
|
"go_text",
|
|
3169
2934
|
"go_progression"
|
|
3170
|
-
],
|
|
3171
|
-
this.unblock(e),
|
|
2935
|
+
], L.moduleName, (s, n) => n(!0)), t.register("activate", L.moduleName, (s, n) => {
|
|
2936
|
+
this.unblock(e), n(!0);
|
|
3172
2937
|
}), t.log("FixedSetup Mounted"), !0;
|
|
3173
2938
|
}
|
|
3174
2939
|
unmount(e, t) {
|
|
3175
|
-
var
|
|
3176
|
-
return t.unregisterAll(
|
|
2940
|
+
var i;
|
|
2941
|
+
return t.unregisterAll(L.moduleName), (i = e.document.getElementById(ze)) == null || i.remove(), t.log("FixedSetup Unmounted"), super.unmount(e, t);
|
|
3177
2942
|
}
|
|
3178
2943
|
};
|
|
3179
|
-
|
|
3180
|
-
let
|
|
3181
|
-
const
|
|
2944
|
+
st.moduleName = "fixed_setup";
|
|
2945
|
+
let Vt = st;
|
|
2946
|
+
const _t = [
|
|
3182
2947
|
"fixed_setup",
|
|
3183
2948
|
"decorator",
|
|
3184
2949
|
"peripherals"
|
|
3185
|
-
],
|
|
2950
|
+
], Xt = [
|
|
3186
2951
|
"reflowable_setup",
|
|
3187
2952
|
"decorator",
|
|
3188
2953
|
"peripherals",
|
|
3189
2954
|
"column_snapper",
|
|
3190
2955
|
"scroll_snapper"
|
|
3191
|
-
],
|
|
2956
|
+
], De = new Map([
|
|
3192
2957
|
// All modules go here
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
].map((
|
|
3200
|
-
class
|
|
2958
|
+
Vt,
|
|
2959
|
+
qt,
|
|
2960
|
+
et,
|
|
2961
|
+
Dt,
|
|
2962
|
+
$t,
|
|
2963
|
+
jt
|
|
2964
|
+
].map((r) => [r.moduleName, r]));
|
|
2965
|
+
class Gt {
|
|
3201
2966
|
/**
|
|
3202
2967
|
* @param wnd Window instance to operate on
|
|
3203
2968
|
* @param initialModules List of initial modules to load
|
|
3204
2969
|
*/
|
|
3205
2970
|
constructor(e = window, t = []) {
|
|
3206
|
-
this.loadedModules = [], this.wnd = e, this.comms = new
|
|
3207
|
-
const
|
|
3208
|
-
if (
|
|
2971
|
+
this.loadedModules = [], this.wnd = e, this.comms = new at(e);
|
|
2972
|
+
const i = [...new Set(t)];
|
|
2973
|
+
if (i.length) {
|
|
3209
2974
|
if (typeof e > "u")
|
|
3210
2975
|
throw Error("Loader is not in a web browser");
|
|
3211
|
-
e.parent !== e && this.comms.log("Loader is probably in a frame"), this.loadedModules =
|
|
3212
|
-
const
|
|
3213
|
-
if (
|
|
3214
|
-
return
|
|
3215
|
-
}).filter((
|
|
2976
|
+
e.parent !== e && this.comms.log("Loader is probably in a frame"), this.loadedModules = i.map((s) => {
|
|
2977
|
+
const n = this.loadModule(s);
|
|
2978
|
+
if (n)
|
|
2979
|
+
return n.mount(this.wnd, this.comms), n;
|
|
2980
|
+
}).filter((s) => s !== void 0);
|
|
3216
2981
|
}
|
|
3217
2982
|
}
|
|
3218
2983
|
loadModule(e) {
|
|
3219
|
-
const t =
|
|
2984
|
+
const t = De.get(e);
|
|
3220
2985
|
return t === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), t) : new t();
|
|
3221
2986
|
}
|
|
3222
2987
|
/**
|
|
@@ -3234,11 +2999,11 @@ class Vi {
|
|
|
3234
2999
|
* @returns Success
|
|
3235
3000
|
*/
|
|
3236
3001
|
removeModule(e) {
|
|
3237
|
-
const t =
|
|
3002
|
+
const t = De.get(e);
|
|
3238
3003
|
if (t === void 0)
|
|
3239
3004
|
return this.comms.log(`Module "${e}" does not exist in the library`), !1;
|
|
3240
|
-
const
|
|
3241
|
-
return
|
|
3005
|
+
const i = this.loadedModules.findIndex((s) => s instanceof t);
|
|
3006
|
+
return i < 0 ? !1 : (this.loadedModules[i].unmount(this.wnd, this.comms), this.loadedModules.splice(i, 1), !0);
|
|
3242
3007
|
}
|
|
3243
3008
|
/**
|
|
3244
3009
|
* Unmount and remove all modules
|
|
@@ -3248,16 +3013,16 @@ class Vi {
|
|
|
3248
3013
|
}
|
|
3249
3014
|
}
|
|
3250
3015
|
export {
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3016
|
+
k as COMMS_VERSION,
|
|
3017
|
+
at as Comms,
|
|
3018
|
+
Dt as Decorator,
|
|
3019
|
+
_t as FXLModules,
|
|
3020
|
+
Lt as Layout,
|
|
3021
|
+
Gt as Loader,
|
|
3022
|
+
Y as Module,
|
|
3023
|
+
De as ModuleLibrary,
|
|
3024
|
+
et as Peripherals,
|
|
3025
|
+
Xt as ReflowableModules,
|
|
3026
|
+
It as Width,
|
|
3027
|
+
ot as mid
|
|
3263
3028
|
};
|