@readium/navigator-html-injectables 2.2.0 → 2.2.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 +289 -280
- package/dist/index.umd.cjs +7 -7
- package/package.json +1 -1
- package/src/modules/setup/WebPubSetup.ts +22 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const et = Math.pow(2, 32), xe = () => Math.round(Math.random() * et).toString(36), tt = () => `${Math.round(performance.now())}-${xe()}-${xe()}`, B = 1;
|
|
2
|
+
class it {
|
|
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
|
}
|
|
@@ -10,8 +10,8 @@ class tt {
|
|
|
10
10
|
if (!(!("_readium" in t) || !t._readium || t._readium <= 0)) {
|
|
11
11
|
if (t.key === "_ping") {
|
|
12
12
|
if (!this.destination) {
|
|
13
|
-
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !==
|
|
14
|
-
t._readium >
|
|
13
|
+
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !== B) {
|
|
14
|
+
t._readium > B ? this.send("error", `received comms version ${t._readium} higher than ${B}`) : this.send("error", `received comms version ${t._readium} lower than ${B}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
|
|
@@ -71,9 +71,9 @@ class tt {
|
|
|
71
71
|
send(e, t, i = void 0, s = []) {
|
|
72
72
|
if (!this.destination) throw Error("Attempted to send comms message before destination has been initialized");
|
|
73
73
|
const n = {
|
|
74
|
-
_readium:
|
|
74
|
+
_readium: B,
|
|
75
75
|
_channel: this.channelId,
|
|
76
|
-
id: i ??
|
|
76
|
+
id: i ?? tt(),
|
|
77
77
|
// scrict,
|
|
78
78
|
key: e,
|
|
79
79
|
data: t
|
|
@@ -89,15 +89,15 @@ class tt {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
const N = class
|
|
92
|
+
const N = class F {
|
|
93
93
|
constructor(e) {
|
|
94
94
|
if (typeof e == "string") {
|
|
95
|
-
if (!
|
|
95
|
+
if (!F.VALID_MODES.has(e.toLowerCase()))
|
|
96
96
|
return;
|
|
97
97
|
this.value = e.toLowerCase();
|
|
98
98
|
} else {
|
|
99
99
|
const t = e.filter(
|
|
100
|
-
(i) =>
|
|
100
|
+
(i) => F.VALID_MODES.has(i.toLowerCase())
|
|
101
101
|
);
|
|
102
102
|
if (t.length === 0)
|
|
103
103
|
return;
|
|
@@ -110,11 +110,11 @@ const N = class W {
|
|
|
110
110
|
static deserialize(e) {
|
|
111
111
|
if (!e) return;
|
|
112
112
|
if (typeof e == "string")
|
|
113
|
-
return new
|
|
113
|
+
return new F(e);
|
|
114
114
|
if (!Array.isArray(e)) return;
|
|
115
|
-
const t = e.filter((i) => i ?
|
|
115
|
+
const t = e.filter((i) => i ? F.VALID_MODES.has(i.toLowerCase()) : !1);
|
|
116
116
|
if (t.length !== 0)
|
|
117
|
-
return new
|
|
117
|
+
return new F(t);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Serializes a [PrimaryAccessMode] to its RWPM JSON representation.
|
|
@@ -124,7 +124,7 @@ const N = class W {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
N.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), N.AUDITORY = new N("auditory"), N.TACTILE = new N("tactile"), N.TEXTUAL = new N("textual"), N.VISUAL = new N("visual");
|
|
127
|
-
class
|
|
127
|
+
class de {
|
|
128
128
|
/**
|
|
129
129
|
* Creates a [Encryption].
|
|
130
130
|
*/
|
|
@@ -136,7 +136,7 @@ class ue {
|
|
|
136
136
|
*/
|
|
137
137
|
static deserialize(e) {
|
|
138
138
|
if (e && e.algorithm)
|
|
139
|
-
return new
|
|
139
|
+
return new de({
|
|
140
140
|
algorithm: e.algorithm,
|
|
141
141
|
compression: e.compression,
|
|
142
142
|
originalLength: e.originalLength,
|
|
@@ -184,25 +184,25 @@ class C {
|
|
|
184
184
|
}
|
|
185
185
|
Object.defineProperty(C.prototype, "encryption", {
|
|
186
186
|
get: function() {
|
|
187
|
-
return
|
|
187
|
+
return de.deserialize(this.otherProperties.encrypted);
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
|
-
function
|
|
190
|
+
function st(r) {
|
|
191
191
|
return r && Array.isArray(r) ? r : void 0;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
return r && typeof r == "string" ? [r] :
|
|
193
|
+
function $e(r) {
|
|
194
|
+
return r && typeof r == "string" ? [r] : st(r);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function Te(r) {
|
|
197
197
|
return typeof r == "string" ? new Date(r) : void 0;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function G(r) {
|
|
200
200
|
return isNaN(r) ? void 0 : r;
|
|
201
201
|
}
|
|
202
202
|
function S(r) {
|
|
203
|
-
return
|
|
203
|
+
return G(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function rt(r) {
|
|
206
206
|
const e = new Array();
|
|
207
207
|
return r.forEach((t) => e.push(t)), e;
|
|
208
208
|
}
|
|
@@ -661,7 +661,7 @@ class a {
|
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
|
-
class
|
|
664
|
+
class we {
|
|
665
665
|
constructor(e) {
|
|
666
666
|
this.uri = e, this.parameters = this.getParameters(e);
|
|
667
667
|
}
|
|
@@ -701,7 +701,7 @@ class b {
|
|
|
701
701
|
*/
|
|
702
702
|
static deserialize(e) {
|
|
703
703
|
if (!e) return;
|
|
704
|
-
const t =
|
|
704
|
+
const t = G(e.progression), i = G(e.totalProgression), s = G(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
705
705
|
"fragment",
|
|
706
706
|
"fragments",
|
|
707
707
|
"progression",
|
|
@@ -711,7 +711,7 @@ class b {
|
|
|
711
711
|
return Object.entries(e).forEach(([l, u]) => {
|
|
712
712
|
o.has(l) || n.set(l, u);
|
|
713
713
|
}), new b({
|
|
714
|
-
fragments:
|
|
714
|
+
fragments: $e(e.fragments || e.fragment),
|
|
715
715
|
progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
|
|
716
716
|
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
717
717
|
position: s !== void 0 && s > 0 ? s : void 0,
|
|
@@ -726,7 +726,7 @@ class b {
|
|
|
726
726
|
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;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
class
|
|
729
|
+
class D {
|
|
730
730
|
/**
|
|
731
731
|
* Creates a [Text].
|
|
732
732
|
*/
|
|
@@ -738,7 +738,7 @@ class z {
|
|
|
738
738
|
*/
|
|
739
739
|
static deserialize(e) {
|
|
740
740
|
if (e)
|
|
741
|
-
return new
|
|
741
|
+
return new D({
|
|
742
742
|
after: e.after,
|
|
743
743
|
before: e.before,
|
|
744
744
|
highlight: e.highlight
|
|
@@ -752,7 +752,7 @@ class z {
|
|
|
752
752
|
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;
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
class
|
|
755
|
+
class I {
|
|
756
756
|
/**
|
|
757
757
|
* Creates a [Locator].
|
|
758
758
|
*/
|
|
@@ -764,12 +764,12 @@ class L {
|
|
|
764
764
|
*/
|
|
765
765
|
static deserialize(e) {
|
|
766
766
|
if (e && e.href && e.type)
|
|
767
|
-
return new
|
|
767
|
+
return new I({
|
|
768
768
|
href: e.href,
|
|
769
769
|
type: e.type,
|
|
770
770
|
title: e.title,
|
|
771
771
|
locations: b.deserialize(e.locations),
|
|
772
|
-
text:
|
|
772
|
+
text: D.deserialize(e.text)
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
@@ -783,7 +783,7 @@ class L {
|
|
|
783
783
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
784
784
|
*/
|
|
785
785
|
copyWithLocations(e) {
|
|
786
|
-
return new
|
|
786
|
+
return new I({
|
|
787
787
|
href: this.href,
|
|
788
788
|
type: this.type,
|
|
789
789
|
title: this.title,
|
|
@@ -792,7 +792,7 @@ class L {
|
|
|
792
792
|
});
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
|
-
class
|
|
795
|
+
class U {
|
|
796
796
|
/**
|
|
797
797
|
* Creates a [Link].
|
|
798
798
|
*/
|
|
@@ -804,7 +804,7 @@ class F {
|
|
|
804
804
|
*/
|
|
805
805
|
static deserialize(e) {
|
|
806
806
|
if (!(!e || typeof e.href != "string"))
|
|
807
|
-
return new
|
|
807
|
+
return new U({
|
|
808
808
|
href: e.href,
|
|
809
809
|
templated: e.templated,
|
|
810
810
|
type: e.type,
|
|
@@ -816,9 +816,9 @@ class F {
|
|
|
816
816
|
size: S(e.size),
|
|
817
817
|
duration: S(e.duration),
|
|
818
818
|
bitrate: S(e.bitrate),
|
|
819
|
-
languages:
|
|
820
|
-
alternates:
|
|
821
|
-
children:
|
|
819
|
+
languages: $e(e.language),
|
|
820
|
+
alternates: Y.deserialize(e.alternate),
|
|
821
|
+
children: Y.deserialize(e.children)
|
|
822
822
|
});
|
|
823
823
|
}
|
|
824
824
|
/**
|
|
@@ -826,7 +826,7 @@ class F {
|
|
|
826
826
|
*/
|
|
827
827
|
serialize() {
|
|
828
828
|
const e = { href: this.href };
|
|
829
|
-
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 =
|
|
829
|
+
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 = rt(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.size !== void 0 && (e.size = this.size), 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;
|
|
830
830
|
}
|
|
831
831
|
/** MediaType of the linked resource. */
|
|
832
832
|
get mediaType() {
|
|
@@ -843,14 +843,14 @@ class F {
|
|
|
843
843
|
}
|
|
844
844
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
845
845
|
get templateParameters() {
|
|
846
|
-
return this.templated ? new
|
|
846
|
+
return this.templated ? new we(this.href).parameters : /* @__PURE__ */ new Set();
|
|
847
847
|
}
|
|
848
848
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
849
849
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
850
850
|
*/
|
|
851
851
|
expandTemplate(e) {
|
|
852
|
-
return new
|
|
853
|
-
href: new
|
|
852
|
+
return new U({
|
|
853
|
+
href: new we(this.href).expand(e),
|
|
854
854
|
templated: !1
|
|
855
855
|
});
|
|
856
856
|
}
|
|
@@ -858,7 +858,7 @@ class F {
|
|
|
858
858
|
* Makes a copy of this [Link] after merging in the given additional other [properties].
|
|
859
859
|
*/
|
|
860
860
|
addProperties(e) {
|
|
861
|
-
const t =
|
|
861
|
+
const t = U.deserialize(this.serialize());
|
|
862
862
|
return t.properties = t.properties ? t.properties?.add(e) : new C(e), t;
|
|
863
863
|
}
|
|
864
864
|
/**
|
|
@@ -866,7 +866,7 @@ class F {
|
|
|
866
866
|
*/
|
|
867
867
|
get locator() {
|
|
868
868
|
let e = this.href.split("#");
|
|
869
|
-
return new
|
|
869
|
+
return new I({
|
|
870
870
|
href: e.length > 0 && e[0] !== void 0 ? e[0] : this.href,
|
|
871
871
|
type: this.type ?? "",
|
|
872
872
|
title: this.title,
|
|
@@ -876,7 +876,7 @@ class F {
|
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
878
|
}
|
|
879
|
-
class
|
|
879
|
+
class Y {
|
|
880
880
|
/**
|
|
881
881
|
* Creates a [Links].
|
|
882
882
|
*/
|
|
@@ -888,8 +888,8 @@ class _ {
|
|
|
888
888
|
*/
|
|
889
889
|
static deserialize(e) {
|
|
890
890
|
if (e && Array.isArray(e))
|
|
891
|
-
return new
|
|
892
|
-
e.map((t) =>
|
|
891
|
+
return new Y(
|
|
892
|
+
e.map((t) => U.deserialize(t)).filter((t) => t !== void 0)
|
|
893
893
|
);
|
|
894
894
|
}
|
|
895
895
|
/**
|
|
@@ -973,7 +973,7 @@ class _ {
|
|
|
973
973
|
C.prototype.getContains = function() {
|
|
974
974
|
return new Set(this.otherProperties.contains || []);
|
|
975
975
|
};
|
|
976
|
-
class
|
|
976
|
+
class K {
|
|
977
977
|
/**
|
|
978
978
|
* Creates a [DomRange].
|
|
979
979
|
*/
|
|
@@ -988,7 +988,7 @@ class G {
|
|
|
988
988
|
let t = S(e.textNodeIndex);
|
|
989
989
|
if (t === void 0) return;
|
|
990
990
|
let i = S(e.charOffset);
|
|
991
|
-
return i === void 0 && (i = S(e.offset)), new
|
|
991
|
+
return i === void 0 && (i = S(e.offset)), new K({
|
|
992
992
|
cssSelector: e.cssSelector,
|
|
993
993
|
textNodeIndex: t,
|
|
994
994
|
charOffset: i
|
|
@@ -1005,7 +1005,7 @@ class G {
|
|
|
1005
1005
|
return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
class
|
|
1008
|
+
class pe {
|
|
1009
1009
|
/**
|
|
1010
1010
|
* Creates a [DomRange].
|
|
1011
1011
|
*/
|
|
@@ -1017,11 +1017,11 @@ class de {
|
|
|
1017
1017
|
*/
|
|
1018
1018
|
static deserialize(e) {
|
|
1019
1019
|
if (!e) return;
|
|
1020
|
-
let t =
|
|
1020
|
+
let t = K.deserialize(e.start);
|
|
1021
1021
|
if (t)
|
|
1022
|
-
return new
|
|
1022
|
+
return new pe({
|
|
1023
1023
|
start: t,
|
|
1024
|
-
end:
|
|
1024
|
+
end: K.deserialize(e.end)
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
1027
1027
|
/**
|
|
@@ -1039,7 +1039,7 @@ b.prototype.getPartialCfi = function() {
|
|
|
1039
1039
|
return this.otherLocations?.get("partialCfi");
|
|
1040
1040
|
};
|
|
1041
1041
|
b.prototype.getDomRange = function() {
|
|
1042
|
-
return
|
|
1042
|
+
return pe.deserialize(this.otherLocations?.get("domRange"));
|
|
1043
1043
|
};
|
|
1044
1044
|
b.prototype.fragmentParameters = function() {
|
|
1045
1045
|
return new Map(
|
|
@@ -1073,7 +1073,7 @@ b.prototype.space = function() {
|
|
|
1073
1073
|
if (e.length === 4 && !e.some(isNaN))
|
|
1074
1074
|
return e;
|
|
1075
1075
|
};
|
|
1076
|
-
class
|
|
1076
|
+
class fe {
|
|
1077
1077
|
/** Creates a [Price]. */
|
|
1078
1078
|
constructor(e) {
|
|
1079
1079
|
this.currency = e.currency, this.value = e.value;
|
|
@@ -1088,7 +1088,7 @@ class pe {
|
|
|
1088
1088
|
return;
|
|
1089
1089
|
let i = S(e.value);
|
|
1090
1090
|
if (i !== void 0)
|
|
1091
|
-
return new
|
|
1091
|
+
return new fe({ currency: t, value: i });
|
|
1092
1092
|
}
|
|
1093
1093
|
/**
|
|
1094
1094
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1097,7 +1097,7 @@ class pe {
|
|
|
1097
1097
|
return { currency: this.currency, value: this.value };
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
|
-
class
|
|
1100
|
+
class H {
|
|
1101
1101
|
/** Creates a [Acquisition]. */
|
|
1102
1102
|
constructor(e) {
|
|
1103
1103
|
this.type = e.type, this.children = e.children;
|
|
@@ -1107,14 +1107,14 @@ class B {
|
|
|
1107
1107
|
*/
|
|
1108
1108
|
static deserialize(e) {
|
|
1109
1109
|
if (e && e.type)
|
|
1110
|
-
return new
|
|
1110
|
+
return new H({
|
|
1111
1111
|
type: e.type,
|
|
1112
|
-
children:
|
|
1112
|
+
children: H.deserializeArray(e.children)
|
|
1113
1113
|
});
|
|
1114
1114
|
}
|
|
1115
1115
|
static deserializeArray(e) {
|
|
1116
1116
|
if (Array.isArray(e))
|
|
1117
|
-
return e.map((t) =>
|
|
1117
|
+
return e.map((t) => H.deserialize(t)).filter((t) => t !== void 0);
|
|
1118
1118
|
}
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1124,7 +1124,7 @@ class B {
|
|
|
1124
1124
|
return this.children && (e.children = this.children.map((t) => t.serialize())), e;
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
class
|
|
1127
|
+
class me {
|
|
1128
1128
|
/** Creates a [Price]. */
|
|
1129
1129
|
constructor(e) {
|
|
1130
1130
|
this.total = e.total, this.position = e.position;
|
|
@@ -1134,7 +1134,7 @@ class fe {
|
|
|
1134
1134
|
*/
|
|
1135
1135
|
static deserialize(e) {
|
|
1136
1136
|
if (e)
|
|
1137
|
-
return new
|
|
1137
|
+
return new me({
|
|
1138
1138
|
total: S(e.total),
|
|
1139
1139
|
position: S(e.position)
|
|
1140
1140
|
});
|
|
@@ -1147,7 +1147,7 @@ class fe {
|
|
|
1147
1147
|
return this.total !== void 0 && (e.total = this.total), this.position !== void 0 && (e.position = this.position), e;
|
|
1148
1148
|
}
|
|
1149
1149
|
}
|
|
1150
|
-
class
|
|
1150
|
+
class ge {
|
|
1151
1151
|
/** Creates a [Copies]. */
|
|
1152
1152
|
constructor(e) {
|
|
1153
1153
|
this.total = e.total, this.available = e.available;
|
|
@@ -1157,7 +1157,7 @@ class me {
|
|
|
1157
1157
|
*/
|
|
1158
1158
|
static deserialize(e) {
|
|
1159
1159
|
if (e)
|
|
1160
|
-
return new
|
|
1160
|
+
return new ge({
|
|
1161
1161
|
total: S(e.total),
|
|
1162
1162
|
available: S(e.available)
|
|
1163
1163
|
});
|
|
@@ -1170,7 +1170,7 @@ class me {
|
|
|
1170
1170
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
|
-
class
|
|
1173
|
+
class ye {
|
|
1174
1174
|
/** Creates a [Availability]. */
|
|
1175
1175
|
constructor(e) {
|
|
1176
1176
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1180,10 +1180,10 @@ class ge {
|
|
|
1180
1180
|
*/
|
|
1181
1181
|
static deserialize(e) {
|
|
1182
1182
|
if (e && e.state)
|
|
1183
|
-
return new
|
|
1183
|
+
return new ye({
|
|
1184
1184
|
state: e.state,
|
|
1185
|
-
since:
|
|
1186
|
-
until:
|
|
1185
|
+
since: Te(e.since),
|
|
1186
|
+
until: Te(e.until)
|
|
1187
1187
|
});
|
|
1188
1188
|
}
|
|
1189
1189
|
/**
|
|
@@ -1198,85 +1198,85 @@ C.prototype.getNumberOfItems = function() {
|
|
|
1198
1198
|
return S(this.otherProperties.numberOfItems);
|
|
1199
1199
|
};
|
|
1200
1200
|
C.prototype.getPrice = function() {
|
|
1201
|
-
return
|
|
1201
|
+
return fe.deserialize(this.otherProperties.price);
|
|
1202
1202
|
};
|
|
1203
1203
|
C.prototype.getIndirectAcquisitions = function() {
|
|
1204
1204
|
const r = this.otherProperties.indirectAcquisition;
|
|
1205
1205
|
if (r && Array.isArray(r))
|
|
1206
|
-
return r.map((e) =>
|
|
1206
|
+
return r.map((e) => H.deserialize(e)).filter((e) => e !== void 0);
|
|
1207
1207
|
};
|
|
1208
1208
|
C.prototype.getHolds = function() {
|
|
1209
|
-
return
|
|
1209
|
+
return me.deserialize(this.otherProperties.holds);
|
|
1210
1210
|
};
|
|
1211
1211
|
C.prototype.getCopies = function() {
|
|
1212
|
-
return
|
|
1212
|
+
return ge.deserialize(this.otherProperties.copies);
|
|
1213
1213
|
};
|
|
1214
1214
|
C.prototype.getAvailability = function() {
|
|
1215
|
-
return
|
|
1215
|
+
return ye.deserialize(this.otherProperties.availability);
|
|
1216
1216
|
};
|
|
1217
1217
|
C.prototype.getAuthenticate = function() {
|
|
1218
|
-
return
|
|
1218
|
+
return U.deserialize(this.otherProperties.authenticate);
|
|
1219
1219
|
};
|
|
1220
|
-
const
|
|
1221
|
-
function
|
|
1222
|
-
console.warn(`${
|
|
1220
|
+
const nt = "CssSelectorGenerator";
|
|
1221
|
+
function Se(r = "unknown problem", ...e) {
|
|
1222
|
+
console.warn(`${nt}: ${r}`, ...e);
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function ot(r) {
|
|
1225
1225
|
return r instanceof RegExp;
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1227
|
+
function at(r) {
|
|
1228
1228
|
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function lt(r) {
|
|
1231
1231
|
const e = r.map((t) => {
|
|
1232
|
-
if (
|
|
1232
|
+
if (ot(t))
|
|
1233
1233
|
return (i) => t.test(i);
|
|
1234
1234
|
if (typeof t == "function")
|
|
1235
1235
|
return (i) => {
|
|
1236
1236
|
const s = t(i);
|
|
1237
|
-
return typeof s != "boolean" ? (
|
|
1237
|
+
return typeof s != "boolean" ? (Se("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", t), !1) : s;
|
|
1238
1238
|
};
|
|
1239
1239
|
if (typeof t == "string") {
|
|
1240
|
-
const i = new RegExp("^" +
|
|
1240
|
+
const i = new RegExp("^" + at(t) + "$");
|
|
1241
1241
|
return (s) => i.test(s);
|
|
1242
1242
|
}
|
|
1243
|
-
return
|
|
1243
|
+
return Se("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", t), () => !1;
|
|
1244
1244
|
});
|
|
1245
1245
|
return (t) => e.some((i) => i(t));
|
|
1246
1246
|
}
|
|
1247
|
-
|
|
1247
|
+
lt([
|
|
1248
1248
|
"class",
|
|
1249
1249
|
"id",
|
|
1250
1250
|
// Angular attributes
|
|
1251
1251
|
"ng-*"
|
|
1252
1252
|
]);
|
|
1253
|
-
class
|
|
1253
|
+
class X {
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function Ce(r) {
|
|
1256
1256
|
return r.split("").reverse().join("");
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1259
|
-
const i =
|
|
1258
|
+
function ht(r, e, t) {
|
|
1259
|
+
const i = Ce(e);
|
|
1260
1260
|
return t.map((s) => {
|
|
1261
|
-
const n = Math.max(0, s.end - e.length - s.errors), o =
|
|
1261
|
+
const n = Math.max(0, s.end - e.length - s.errors), o = Ce(r.slice(n, s.end));
|
|
1262
1262
|
return {
|
|
1263
|
-
start:
|
|
1263
|
+
start: ke(o, i, s.errors).reduce((u, h) => s.end - h.end < u ? s.end - h.end : u, s.end),
|
|
1264
1264
|
end: s.end,
|
|
1265
1265
|
errors: s.errors
|
|
1266
1266
|
};
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function ie(r) {
|
|
1270
1270
|
return (r | -r) >> 31 & 1;
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function Pe(r, e, t, i) {
|
|
1273
1273
|
let s = r.P[t], n = r.M[t];
|
|
1274
1274
|
const o = i >>> 31, l = e[t] | o, u = l | n, h = (l & s) + s ^ s | l;
|
|
1275
1275
|
let c = n | ~(h | s), m = s & h;
|
|
1276
|
-
const p =
|
|
1277
|
-
return c <<= 1, m <<= 1, m |= o, c |=
|
|
1276
|
+
const p = ie(c & r.lastRowMask[t]) - ie(m & r.lastRowMask[t]);
|
|
1277
|
+
return c <<= 1, m <<= 1, m |= o, c |= ie(i) - o, s = m | ~(u | c), n = c & u, r.P[t] = s, r.M[t] = n, p;
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function ke(r, e, t) {
|
|
1280
1280
|
if (e.length === 0)
|
|
1281
1281
|
return [];
|
|
1282
1282
|
t = Math.min(t, e.length);
|
|
@@ -1318,7 +1318,7 @@ function $e(r, e, t) {
|
|
|
1318
1318
|
y < h.length ? d = h[y] : (d = u.get(y), typeof d > "u" && (d = l));
|
|
1319
1319
|
let f = 0;
|
|
1320
1320
|
for (let g = 0; g <= c; g += 1)
|
|
1321
|
-
f =
|
|
1321
|
+
f = Pe(o, d, g, f), m[g] += f;
|
|
1322
1322
|
if (m[c] - f <= t && c < n && (d[c + 1] & 1 || f < 0)) {
|
|
1323
1323
|
c += 1, o.P[c] = -1, o.M[c] = 0;
|
|
1324
1324
|
let g;
|
|
@@ -1327,7 +1327,7 @@ function $e(r, e, t) {
|
|
|
1327
1327
|
g = E === 0 ? s : E;
|
|
1328
1328
|
} else
|
|
1329
1329
|
g = s;
|
|
1330
|
-
m[c] = m[c - 1] + g - f +
|
|
1330
|
+
m[c] = m[c - 1] + g - f + Pe(o, d, c, f);
|
|
1331
1331
|
} else
|
|
1332
1332
|
for (; c > 0 && m[c] >= t + s; )
|
|
1333
1333
|
c -= 1;
|
|
@@ -1339,11 +1339,11 @@ function $e(r, e, t) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
return i;
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const i =
|
|
1344
|
-
return
|
|
1342
|
+
function ct(r, e, t) {
|
|
1343
|
+
const i = ke(r, e, t);
|
|
1344
|
+
return ht(r, e, i);
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1346
|
+
function Ve(r, e, t) {
|
|
1347
1347
|
let i = 0;
|
|
1348
1348
|
const s = [];
|
|
1349
1349
|
for (; i !== -1; )
|
|
@@ -1352,25 +1352,25 @@ function ke(r, e, t) {
|
|
|
1352
1352
|
end: i + e.length,
|
|
1353
1353
|
errors: 0
|
|
1354
1354
|
}), i += 1);
|
|
1355
|
-
return s.length > 0 ? s :
|
|
1355
|
+
return s.length > 0 ? s : ct(r, e, t);
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1358
|
-
return e.length === 0 || r.length === 0 ? 0 : 1 -
|
|
1357
|
+
function Ae(r, e) {
|
|
1358
|
+
return e.length === 0 || r.length === 0 ? 0 : 1 - Ve(r, e, e.length)[0].errors / e.length;
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1360
|
+
function ut(r, e, t = {}) {
|
|
1361
1361
|
if (e.length === 0)
|
|
1362
1362
|
return null;
|
|
1363
|
-
const i = Math.min(256, e.length / 2), s =
|
|
1363
|
+
const i = Math.min(256, e.length / 2), s = Ve(r, e, i);
|
|
1364
1364
|
if (s.length === 0)
|
|
1365
1365
|
return null;
|
|
1366
1366
|
const n = (l) => {
|
|
1367
|
-
const p = 1 - l.errors / e.length, y = t.prefix ?
|
|
1367
|
+
const p = 1 - l.errors / e.length, y = t.prefix ? Ae(
|
|
1368
1368
|
r.slice(
|
|
1369
1369
|
Math.max(0, l.start - t.prefix.length),
|
|
1370
1370
|
l.start
|
|
1371
1371
|
),
|
|
1372
1372
|
t.prefix
|
|
1373
|
-
) : 1, d = t.suffix ?
|
|
1373
|
+
) : 1, d = t.suffix ? Ae(
|
|
1374
1374
|
r.slice(l.end, l.end + t.suffix.length),
|
|
1375
1375
|
t.suffix
|
|
1376
1376
|
) : 1;
|
|
@@ -1383,7 +1383,7 @@ function ct(r, e, t = {}) {
|
|
|
1383
1383
|
}));
|
|
1384
1384
|
return o.sort((l, u) => u.score - l.score), o[0];
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function se(r, e, t) {
|
|
1387
1387
|
const i = t === 1 ? e : e - 1;
|
|
1388
1388
|
if (r.charAt(i).trim() !== "")
|
|
1389
1389
|
return e;
|
|
@@ -1393,7 +1393,7 @@ function ie(r, e, t) {
|
|
|
1393
1393
|
const o = s.length - n.length;
|
|
1394
1394
|
return t === 2 ? e - o : e + o;
|
|
1395
1395
|
}
|
|
1396
|
-
function
|
|
1396
|
+
function Me(r, e) {
|
|
1397
1397
|
const t = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1398
1398
|
r.commonAncestorContainer,
|
|
1399
1399
|
NodeFilter.SHOW_TEXT
|
|
@@ -1406,7 +1406,7 @@ function Ae(r, e) {
|
|
|
1406
1406
|
const l = () => {
|
|
1407
1407
|
if (n = e === 1 ? t.nextNode() : t.previousNode(), n) {
|
|
1408
1408
|
const u = n.textContent, h = e === 1 ? 0 : u.length;
|
|
1409
|
-
o =
|
|
1409
|
+
o = se(u, h, e);
|
|
1410
1410
|
}
|
|
1411
1411
|
};
|
|
1412
1412
|
for (; n && o === -1 && n !== s; )
|
|
@@ -1415,7 +1415,7 @@ function Ae(r, e) {
|
|
|
1415
1415
|
return { node: n, offset: o };
|
|
1416
1416
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function dt(r) {
|
|
1419
1419
|
if (!r.toString().trim().length)
|
|
1420
1420
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1421
1421
|
if (r.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1425,13 +1425,13 @@ function ut(r) {
|
|
|
1425
1425
|
const e = r.cloneRange();
|
|
1426
1426
|
let t = !1, i = !1;
|
|
1427
1427
|
const s = {
|
|
1428
|
-
start:
|
|
1428
|
+
start: se(
|
|
1429
1429
|
r.startContainer.textContent,
|
|
1430
1430
|
r.startOffset,
|
|
1431
1431
|
1
|
|
1432
1432
|
/* Forwards */
|
|
1433
1433
|
),
|
|
1434
|
-
end:
|
|
1434
|
+
end: se(
|
|
1435
1435
|
r.endContainer.textContent,
|
|
1436
1436
|
r.endOffset,
|
|
1437
1437
|
2
|
|
@@ -1441,7 +1441,7 @@ function ut(r) {
|
|
|
1441
1441
|
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)
|
|
1442
1442
|
return e;
|
|
1443
1443
|
if (!t) {
|
|
1444
|
-
const { node: n, offset: o } =
|
|
1444
|
+
const { node: n, offset: o } = Me(
|
|
1445
1445
|
e,
|
|
1446
1446
|
1
|
|
1447
1447
|
/* Forwards */
|
|
@@ -1449,7 +1449,7 @@ function ut(r) {
|
|
|
1449
1449
|
n && o >= 0 && e.setStart(n, o);
|
|
1450
1450
|
}
|
|
1451
1451
|
if (!i) {
|
|
1452
|
-
const { node: n, offset: o } =
|
|
1452
|
+
const { node: n, offset: o } = Me(
|
|
1453
1453
|
e,
|
|
1454
1454
|
2
|
|
1455
1455
|
/* Backwards */
|
|
@@ -1458,7 +1458,7 @@ function ut(r) {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
return e;
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function je(r) {
|
|
1462
1462
|
switch (r.nodeType) {
|
|
1463
1463
|
case Node.ELEMENT_NODE:
|
|
1464
1464
|
case Node.TEXT_NODE:
|
|
@@ -1467,13 +1467,13 @@ function Ve(r) {
|
|
|
1467
1467
|
return 0;
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
|
-
function
|
|
1470
|
+
function Ne(r) {
|
|
1471
1471
|
let e = r.previousSibling, t = 0;
|
|
1472
1472
|
for (; e; )
|
|
1473
|
-
t +=
|
|
1473
|
+
t += je(e), e = e.previousSibling;
|
|
1474
1474
|
return t;
|
|
1475
1475
|
}
|
|
1476
|
-
function
|
|
1476
|
+
function qe(r, ...e) {
|
|
1477
1477
|
let t = e.shift();
|
|
1478
1478
|
const i = r.ownerDocument.createNodeIterator(
|
|
1479
1479
|
r,
|
|
@@ -1505,7 +1505,7 @@ class M {
|
|
|
1505
1505
|
throw new Error("Parent is not an ancestor of current element");
|
|
1506
1506
|
let t = this.element, i = this.offset;
|
|
1507
1507
|
for (; t !== e; )
|
|
1508
|
-
i +=
|
|
1508
|
+
i += Ne(t), t = t.parentElement;
|
|
1509
1509
|
return new M(t, i);
|
|
1510
1510
|
}
|
|
1511
1511
|
/**
|
|
@@ -1527,7 +1527,7 @@ class M {
|
|
|
1527
1527
|
*/
|
|
1528
1528
|
resolve(e = {}) {
|
|
1529
1529
|
try {
|
|
1530
|
-
return
|
|
1530
|
+
return qe(this.element, this.offset)[0];
|
|
1531
1531
|
} catch (t) {
|
|
1532
1532
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
1533
1533
|
const i = document.createTreeWalker(
|
|
@@ -1570,7 +1570,7 @@ class M {
|
|
|
1570
1570
|
throw new Error("Text node offset is out of range");
|
|
1571
1571
|
if (!e.parentElement)
|
|
1572
1572
|
throw new Error("Text node has no parent");
|
|
1573
|
-
const i =
|
|
1573
|
+
const i = Ne(e) + t;
|
|
1574
1574
|
return new M(e.parentElement, i);
|
|
1575
1575
|
}
|
|
1576
1576
|
case Node.ELEMENT_NODE: {
|
|
@@ -1578,7 +1578,7 @@ class M {
|
|
|
1578
1578
|
throw new Error("Child node offset is out of range");
|
|
1579
1579
|
let i = 0;
|
|
1580
1580
|
for (let s = 0; s < t; s++)
|
|
1581
|
-
i +=
|
|
1581
|
+
i += je(e.childNodes[s]);
|
|
1582
1582
|
return new M(e, i);
|
|
1583
1583
|
}
|
|
1584
1584
|
default:
|
|
@@ -1586,7 +1586,7 @@ class M {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
1588
|
}
|
|
1589
|
-
class
|
|
1589
|
+
class R {
|
|
1590
1590
|
constructor(e, t) {
|
|
1591
1591
|
this.start = e, this.end = t;
|
|
1592
1592
|
}
|
|
@@ -1596,7 +1596,7 @@ class I {
|
|
|
1596
1596
|
* `end.element`.
|
|
1597
1597
|
*/
|
|
1598
1598
|
relativeTo(e) {
|
|
1599
|
-
return new
|
|
1599
|
+
return new R(
|
|
1600
1600
|
this.start.relativeTo(e),
|
|
1601
1601
|
this.end.relativeTo(e)
|
|
1602
1602
|
);
|
|
@@ -1612,7 +1612,7 @@ class I {
|
|
|
1612
1612
|
*/
|
|
1613
1613
|
toRange() {
|
|
1614
1614
|
let e, t;
|
|
1615
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
1615
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = qe(
|
|
1616
1616
|
this.start.element,
|
|
1617
1617
|
this.start.offset,
|
|
1618
1618
|
this.end.offset
|
|
@@ -1634,14 +1634,14 @@ class I {
|
|
|
1634
1634
|
e.startContainer,
|
|
1635
1635
|
e.startOffset
|
|
1636
1636
|
), i = M.fromPoint(e.endContainer, e.endOffset);
|
|
1637
|
-
return new
|
|
1637
|
+
return new R(t, i);
|
|
1638
1638
|
}
|
|
1639
1639
|
/**
|
|
1640
1640
|
* Create a TextRange representing the `start`th to `end`th characters in
|
|
1641
1641
|
* `root`
|
|
1642
1642
|
*/
|
|
1643
1643
|
static fromOffsets(e, t, i) {
|
|
1644
|
-
return new
|
|
1644
|
+
return new R(
|
|
1645
1645
|
new M(e, t),
|
|
1646
1646
|
new M(e, i)
|
|
1647
1647
|
);
|
|
@@ -1651,23 +1651,23 @@ class I {
|
|
|
1651
1651
|
* whitespace
|
|
1652
1652
|
*/
|
|
1653
1653
|
static trimmedRange(e) {
|
|
1654
|
-
return
|
|
1654
|
+
return dt(R.fromRange(e).toRange());
|
|
1655
1655
|
}
|
|
1656
1656
|
}
|
|
1657
|
-
class
|
|
1657
|
+
class Z {
|
|
1658
1658
|
constructor(e, t, i) {
|
|
1659
1659
|
this.root = e, this.start = t, this.end = i;
|
|
1660
1660
|
}
|
|
1661
1661
|
static fromRange(e, t) {
|
|
1662
|
-
const i =
|
|
1663
|
-
return new
|
|
1662
|
+
const i = R.fromRange(t).relativeTo(e);
|
|
1663
|
+
return new Z(
|
|
1664
1664
|
e,
|
|
1665
1665
|
i.start.offset,
|
|
1666
1666
|
i.end.offset
|
|
1667
1667
|
);
|
|
1668
1668
|
}
|
|
1669
1669
|
static fromSelector(e, t) {
|
|
1670
|
-
return new
|
|
1670
|
+
return new Z(e, t.start, t.end);
|
|
1671
1671
|
}
|
|
1672
1672
|
toSelector() {
|
|
1673
1673
|
return {
|
|
@@ -1677,10 +1677,10 @@ class Y {
|
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
1679
|
toRange() {
|
|
1680
|
-
return
|
|
1680
|
+
return R.fromOffsets(this.root, this.start, this.end).toRange();
|
|
1681
1681
|
}
|
|
1682
1682
|
}
|
|
1683
|
-
class
|
|
1683
|
+
class J {
|
|
1684
1684
|
/**
|
|
1685
1685
|
* @param root - A root element from which to anchor.
|
|
1686
1686
|
*/
|
|
@@ -1693,15 +1693,15 @@ class K {
|
|
|
1693
1693
|
* Will throw if `range` does not contain any text nodes.
|
|
1694
1694
|
*/
|
|
1695
1695
|
static fromRange(e, t) {
|
|
1696
|
-
const i = e.textContent, s =
|
|
1697
|
-
return new
|
|
1696
|
+
const i = e.textContent, s = R.fromRange(t).relativeTo(e), n = s.start.offset, o = s.end.offset, l = 32;
|
|
1697
|
+
return new J(e, i.slice(n, o), {
|
|
1698
1698
|
prefix: i.slice(Math.max(0, n - l), n),
|
|
1699
1699
|
suffix: i.slice(o, Math.min(i.length, o + l))
|
|
1700
1700
|
});
|
|
1701
1701
|
}
|
|
1702
1702
|
static fromSelector(e, t) {
|
|
1703
1703
|
const { prefix: i, suffix: s } = t;
|
|
1704
|
-
return new
|
|
1704
|
+
return new J(e, t.exact, { prefix: i, suffix: s });
|
|
1705
1705
|
}
|
|
1706
1706
|
toSelector() {
|
|
1707
1707
|
return {
|
|
@@ -1715,16 +1715,16 @@ class K {
|
|
|
1715
1715
|
return this.toPositionAnchor(e).toRange();
|
|
1716
1716
|
}
|
|
1717
1717
|
toPositionAnchor(e = {}) {
|
|
1718
|
-
const t = this.root.textContent, i =
|
|
1718
|
+
const t = this.root.textContent, i = ut(t, this.exact, {
|
|
1719
1719
|
...this.context,
|
|
1720
1720
|
hint: e.hint
|
|
1721
1721
|
});
|
|
1722
1722
|
if (!i)
|
|
1723
1723
|
throw new Error("Quote not found");
|
|
1724
|
-
return new
|
|
1724
|
+
return new Z(this.root, i.start, i.end);
|
|
1725
1725
|
}
|
|
1726
1726
|
}
|
|
1727
|
-
function
|
|
1727
|
+
function pt(r) {
|
|
1728
1728
|
const e = r.tagName.toUpperCase();
|
|
1729
1729
|
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
1730
1730
|
}
|
|
@@ -1734,7 +1734,7 @@ function ee(r, e) {
|
|
|
1734
1734
|
if (i && i.highlight) {
|
|
1735
1735
|
let s;
|
|
1736
1736
|
t && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), s || (s = r.body);
|
|
1737
|
-
const n = new
|
|
1737
|
+
const n = new J(s, i.highlight, {
|
|
1738
1738
|
prefix: i.before,
|
|
1739
1739
|
suffix: i.after
|
|
1740
1740
|
});
|
|
@@ -1753,7 +1753,7 @@ function ee(r, e) {
|
|
|
1753
1753
|
}
|
|
1754
1754
|
if (s) {
|
|
1755
1755
|
const n = r.createRange();
|
|
1756
|
-
return s.childNodes.length === 0 ||
|
|
1756
|
+
return s.childNodes.length === 0 || pt(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1757
1757
|
}
|
|
1758
1758
|
}
|
|
1759
1759
|
} catch (t) {
|
|
@@ -1761,7 +1761,7 @@ function ee(r, e) {
|
|
|
1761
1761
|
}
|
|
1762
1762
|
return null;
|
|
1763
1763
|
}
|
|
1764
|
-
function
|
|
1764
|
+
function ft(r, e) {
|
|
1765
1765
|
let t = r.getClientRects();
|
|
1766
1766
|
t.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = r.commonAncestorContainer.getClientRects());
|
|
1767
1767
|
const i = 1, s = [];
|
|
@@ -1774,10 +1774,10 @@ function pt(r, e) {
|
|
|
1774
1774
|
top: h.top,
|
|
1775
1775
|
width: h.width
|
|
1776
1776
|
});
|
|
1777
|
-
const n =
|
|
1777
|
+
const n = Xe(
|
|
1778
1778
|
s,
|
|
1779
1779
|
i
|
|
1780
|
-
), o =
|
|
1780
|
+
), o = gt(n, i), l = _e(o), u = 4;
|
|
1781
1781
|
for (let h = l.length - 1; h >= 0; h--) {
|
|
1782
1782
|
const c = l[h];
|
|
1783
1783
|
if (!(c.width * c.height > u))
|
|
@@ -1788,16 +1788,16 @@ function pt(r, e) {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
return l;
|
|
1790
1790
|
}
|
|
1791
|
-
function
|
|
1791
|
+
function Xe(r, e, t) {
|
|
1792
1792
|
for (let i = 0; i < r.length; i++)
|
|
1793
1793
|
for (let s = i + 1; s < r.length; s++) {
|
|
1794
1794
|
const n = r[i], o = r[s];
|
|
1795
1795
|
if (n === o)
|
|
1796
1796
|
continue;
|
|
1797
1797
|
const l = P(n.top, o.top, e) && P(n.bottom, o.bottom, e), u = P(n.left, o.left, e) && P(n.right, o.right, e);
|
|
1798
|
-
if (l && !u &&
|
|
1799
|
-
const m = r.filter((y) => y !== n && y !== o), p =
|
|
1800
|
-
return m.push(p),
|
|
1798
|
+
if (l && !u && Ge(n, o, e)) {
|
|
1799
|
+
const m = r.filter((y) => y !== n && y !== o), p = mt(n, o);
|
|
1800
|
+
return m.push(p), Xe(
|
|
1801
1801
|
m,
|
|
1802
1802
|
e
|
|
1803
1803
|
);
|
|
@@ -1805,7 +1805,7 @@ function qe(r, e, t) {
|
|
|
1805
1805
|
}
|
|
1806
1806
|
return r;
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function mt(r, e) {
|
|
1809
1809
|
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);
|
|
1810
1810
|
return {
|
|
1811
1811
|
bottom: n,
|
|
@@ -1816,7 +1816,7 @@ function ft(r, e) {
|
|
|
1816
1816
|
width: i - t
|
|
1817
1817
|
};
|
|
1818
1818
|
}
|
|
1819
|
-
function
|
|
1819
|
+
function gt(r, e) {
|
|
1820
1820
|
const t = new Set(r);
|
|
1821
1821
|
for (const i of r) {
|
|
1822
1822
|
if (!(i.width > 1 && i.height > 1)) {
|
|
@@ -1824,40 +1824,40 @@ function mt(r, e) {
|
|
|
1824
1824
|
continue;
|
|
1825
1825
|
}
|
|
1826
1826
|
for (const n of r)
|
|
1827
|
-
if (i !== n && t.has(n) &&
|
|
1827
|
+
if (i !== n && t.has(n) && yt(n, i, e)) {
|
|
1828
1828
|
t.delete(i);
|
|
1829
1829
|
break;
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
1832
1832
|
return Array.from(t);
|
|
1833
1833
|
}
|
|
1834
|
-
function
|
|
1835
|
-
return
|
|
1834
|
+
function yt(r, e, t) {
|
|
1835
|
+
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);
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function _(r, e, t, i) {
|
|
1838
1838
|
return (r.left < e || P(r.left, e, i)) && (r.right > e || P(r.right, e, i)) && (r.top < t || P(r.top, t, i)) && (r.bottom > t || P(r.bottom, t, i));
|
|
1839
1839
|
}
|
|
1840
|
-
function
|
|
1840
|
+
function _e(r) {
|
|
1841
1841
|
for (let e = 0; e < r.length; e++)
|
|
1842
1842
|
for (let t = e + 1; t < r.length; t++) {
|
|
1843
1843
|
const i = r[e], s = r[t];
|
|
1844
|
-
if (i !== s &&
|
|
1844
|
+
if (i !== s && Ge(i, s, -1)) {
|
|
1845
1845
|
let n = [], o;
|
|
1846
|
-
const l =
|
|
1846
|
+
const l = Oe(i, s);
|
|
1847
1847
|
if (l.length === 1)
|
|
1848
1848
|
n = l, o = i;
|
|
1849
1849
|
else {
|
|
1850
|
-
const h =
|
|
1850
|
+
const h = Oe(s, i);
|
|
1851
1851
|
l.length < h.length ? (n = l, o = i) : (n = h, o = s);
|
|
1852
1852
|
}
|
|
1853
1853
|
const u = r.filter((h) => h !== o);
|
|
1854
|
-
return Array.prototype.push.apply(u, n),
|
|
1854
|
+
return Array.prototype.push.apply(u, n), _e(u);
|
|
1855
1855
|
}
|
|
1856
1856
|
}
|
|
1857
1857
|
return r;
|
|
1858
1858
|
}
|
|
1859
|
-
function
|
|
1860
|
-
const t =
|
|
1859
|
+
function Oe(r, e) {
|
|
1860
|
+
const t = vt(e, r);
|
|
1861
1861
|
if (t.height === 0 || t.width === 0)
|
|
1862
1862
|
return [r];
|
|
1863
1863
|
const i = [];
|
|
@@ -1907,7 +1907,7 @@ function Ne(r, e) {
|
|
|
1907
1907
|
}
|
|
1908
1908
|
return i;
|
|
1909
1909
|
}
|
|
1910
|
-
function
|
|
1910
|
+
function vt(r, e) {
|
|
1911
1911
|
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);
|
|
1912
1912
|
return {
|
|
1913
1913
|
bottom: n,
|
|
@@ -1918,33 +1918,33 @@ function yt(r, e) {
|
|
|
1918
1918
|
width: Math.max(0, i - t)
|
|
1919
1919
|
};
|
|
1920
1920
|
}
|
|
1921
|
-
function
|
|
1921
|
+
function Ge(r, e, t) {
|
|
1922
1922
|
return (r.left < e.right || t >= 0 && P(r.left, e.right, t)) && (e.left < r.right || t >= 0 && P(e.left, r.right, t)) && (r.top < e.bottom || t >= 0 && P(r.top, e.bottom, t)) && (e.top < r.bottom || t >= 0 && P(e.top, r.bottom, t));
|
|
1923
1923
|
}
|
|
1924
1924
|
function P(r, e, t) {
|
|
1925
1925
|
return Math.abs(r - e) <= t;
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function ve(r) {
|
|
1928
1928
|
const e = {}, t = r.document.documentElement.style;
|
|
1929
1929
|
for (const i in r.document.documentElement.style)
|
|
1930
1930
|
Object.hasOwn(t, i) && !Number.isNaN(Number.parseInt(i)) && (e[t[i]] = t.getPropertyValue(t[i]));
|
|
1931
1931
|
return e;
|
|
1932
1932
|
}
|
|
1933
|
-
function
|
|
1934
|
-
const t =
|
|
1933
|
+
function Ye(r, e) {
|
|
1934
|
+
const t = ve(r);
|
|
1935
1935
|
Object.keys(t).forEach((i) => {
|
|
1936
|
-
e.hasOwnProperty(i) ||
|
|
1936
|
+
e.hasOwnProperty(i) || te(r, i);
|
|
1937
1937
|
}), Object.entries(e).forEach(([i, s]) => {
|
|
1938
|
-
t[i] !== s &&
|
|
1938
|
+
t[i] !== s && j(r, i, s);
|
|
1939
1939
|
});
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Le(r, e) {
|
|
1942
1942
|
return r.document.documentElement.style.getPropertyValue(e);
|
|
1943
1943
|
}
|
|
1944
|
-
function
|
|
1944
|
+
function j(r, e, t) {
|
|
1945
1945
|
r.document.documentElement.style.setProperty(e, t);
|
|
1946
1946
|
}
|
|
1947
|
-
function
|
|
1947
|
+
function te(r, e) {
|
|
1948
1948
|
r.document.documentElement.style.removeProperty(e);
|
|
1949
1949
|
}
|
|
1950
1950
|
const bt = (r) => {
|
|
@@ -1980,7 +1980,7 @@ const bt = (r) => {
|
|
|
1980
1980
|
return Et(e) < 128;
|
|
1981
1981
|
};
|
|
1982
1982
|
var Tt = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(Tt || {}), wt = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(wt || {});
|
|
1983
|
-
const St = () => "Highlight" in window,
|
|
1983
|
+
const St = () => "Highlight" in window, Ie = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
1984
1984
|
class Ct {
|
|
1985
1985
|
/**
|
|
1986
1986
|
* Creates a DecorationGroup object
|
|
@@ -2007,7 +2007,7 @@ class Ct {
|
|
|
2007
2007
|
return;
|
|
2008
2008
|
}
|
|
2009
2009
|
const s = i.commonAncestorContainer;
|
|
2010
|
-
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (
|
|
2010
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ie.includes(s.nodeName.toUpperCase()) && this.notTextFlag?.set(t, !0), s.querySelector(Ie.join(", ").toLowerCase()) && this.notTextFlag?.set(t, !0), (s.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(t, !0));
|
|
2011
2011
|
const n = {
|
|
2012
2012
|
decoration: e,
|
|
2013
2013
|
id: t,
|
|
@@ -2081,7 +2081,7 @@ class Ct {
|
|
|
2081
2081
|
d.style.width = `${f.width}px`, d.style.height = `${f.height}px`, d.style.left = `${f.left + l}px`, d.style.top = `${f.top + u}px`;
|
|
2082
2082
|
}, c = e.range.getBoundingClientRect();
|
|
2083
2083
|
let m = this.wnd.document.createElement("template");
|
|
2084
|
-
const p =
|
|
2084
|
+
const p = Le(this.wnd, "--USER__appearance") === "readium-night-on" || xt(Le(this.wnd, "--USER__backgroundColor"));
|
|
2085
2085
|
m.innerHTML = `
|
|
2086
2086
|
<div
|
|
2087
2087
|
class="r2-highlight-0"
|
|
@@ -2100,7 +2100,7 @@ class Ct {
|
|
|
2100
2100
|
const d = y.cloneNode(!0);
|
|
2101
2101
|
d.style.setProperty("pointer-events", "none"), h(d, c, c), t.append(d);
|
|
2102
2102
|
} else {
|
|
2103
|
-
let d =
|
|
2103
|
+
let d = ft(
|
|
2104
2104
|
e.range
|
|
2105
2105
|
);
|
|
2106
2106
|
d = d.sort((f, g) => f.top < g.top ? -1 : f.top > g.top ? 1 : 0);
|
|
@@ -2139,7 +2139,7 @@ class Ct {
|
|
|
2139
2139
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2140
2140
|
}
|
|
2141
2141
|
}
|
|
2142
|
-
const
|
|
2142
|
+
const $ = class $ extends X {
|
|
2143
2143
|
constructor() {
|
|
2144
2144
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2145
2145
|
}
|
|
@@ -2154,9 +2154,9 @@ const H = class H extends j {
|
|
|
2154
2154
|
}, 50);
|
|
2155
2155
|
}
|
|
2156
2156
|
mount(e, t) {
|
|
2157
|
-
return this.wnd = e, t.register("decorate",
|
|
2157
|
+
return this.wnd = e, t.register("decorate", $.moduleName, (i, s) => {
|
|
2158
2158
|
const n = i;
|
|
2159
|
-
n.decoration && n.decoration.locator && (n.decoration.locator =
|
|
2159
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = I.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new Ct(
|
|
2160
2160
|
e,
|
|
2161
2161
|
t,
|
|
2162
2162
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2181,12 +2181,12 @@ const H = class H extends j {
|
|
|
2181
2181
|
}), 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;
|
|
2182
2182
|
}
|
|
2183
2183
|
unmount(e, t) {
|
|
2184
|
-
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(
|
|
2184
|
+
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll($.moduleName), this.resizeObserver.disconnect(), this.cleanup(), t.log("Decorator Unmounted"), !0;
|
|
2185
2185
|
}
|
|
2186
2186
|
};
|
|
2187
|
-
|
|
2188
|
-
let
|
|
2189
|
-
const
|
|
2187
|
+
$.moduleName = "decorator";
|
|
2188
|
+
let re = $;
|
|
2189
|
+
const Re = "readium-snapper-style", k = class k extends X {
|
|
2190
2190
|
constructor() {
|
|
2191
2191
|
super(...arguments), this.protected = !1;
|
|
2192
2192
|
}
|
|
@@ -2199,34 +2199,34 @@ const Ie = "readium-snapper-style", $ = class $ extends j {
|
|
|
2199
2199
|
}
|
|
2200
2200
|
mount(e, t) {
|
|
2201
2201
|
const i = e.document.createElement("style");
|
|
2202
|
-
return i.dataset.readium = "true", i.id =
|
|
2202
|
+
return i.dataset.readium = "true", i.id = Re, i.textContent = this.buildStyles(), e.document.head.appendChild(i), t.register("protect", k.moduleName, (s, n) => {
|
|
2203
2203
|
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2204
|
-
}), t.register("unprotect",
|
|
2204
|
+
}), t.register("unprotect", k.moduleName, (s, n) => {
|
|
2205
2205
|
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2206
2206
|
}), t.log("Snapper Mounted"), !0;
|
|
2207
2207
|
}
|
|
2208
2208
|
unmount(e, t) {
|
|
2209
|
-
return e.document.getElementById(
|
|
2209
|
+
return e.document.getElementById(Re)?.remove(), t.log("Snapper Unmounted"), !0;
|
|
2210
2210
|
}
|
|
2211
2211
|
};
|
|
2212
|
-
|
|
2213
|
-
let
|
|
2214
|
-
function
|
|
2212
|
+
k.moduleName = "snapper";
|
|
2213
|
+
let q = k;
|
|
2214
|
+
function z(r) {
|
|
2215
2215
|
return r.document.body.dir.toLowerCase() === "rtl";
|
|
2216
2216
|
}
|
|
2217
|
-
function
|
|
2217
|
+
function Ke(r) {
|
|
2218
2218
|
return parseInt(
|
|
2219
2219
|
r.getComputedStyle(
|
|
2220
2220
|
r.document.documentElement
|
|
2221
2221
|
).getPropertyValue("column-count")
|
|
2222
2222
|
);
|
|
2223
2223
|
}
|
|
2224
|
-
function
|
|
2224
|
+
function ze(r) {
|
|
2225
2225
|
const e = getComputedStyle(r), t = parseFloat(e.paddingTop || "0"), i = parseFloat(e.paddingBottom || "0");
|
|
2226
2226
|
return r.clientHeight - t - i;
|
|
2227
2227
|
}
|
|
2228
|
-
function
|
|
2229
|
-
const e =
|
|
2228
|
+
function De(r) {
|
|
2229
|
+
const e = Ke(r);
|
|
2230
2230
|
if (!e)
|
|
2231
2231
|
return !1;
|
|
2232
2232
|
const t = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
@@ -2236,11 +2236,11 @@ function ze(r) {
|
|
|
2236
2236
|
if (u > 0)
|
|
2237
2237
|
for (let h = 0; h < u; h++) {
|
|
2238
2238
|
const c = r.document.createElement("div");
|
|
2239
|
-
c.setAttribute("id", `readium-virtual-page-${h}`), c.dataset.readium = "true", CSS.supports("break-before", "column") ? c.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (c.style.breakInside = "avoid-column"), c.style.height =
|
|
2239
|
+
c.setAttribute("id", `readium-virtual-page-${h}`), c.dataset.readium = "true", CSS.supports("break-before", "column") ? c.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (c.style.breakInside = "avoid-column"), c.style.height = ze(r.document.documentElement) + "px"), c.innerHTML = "​", r.document.body.appendChild(c);
|
|
2240
2240
|
}
|
|
2241
2241
|
return i !== u;
|
|
2242
2242
|
}
|
|
2243
|
-
function
|
|
2243
|
+
function Ze(r) {
|
|
2244
2244
|
const e = r.document.createElement("style");
|
|
2245
2245
|
e.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(e), r.document.body.removeChild(e);
|
|
2246
2246
|
}
|
|
@@ -2265,14 +2265,14 @@ const At = [
|
|
|
2265
2265
|
"textarea",
|
|
2266
2266
|
"video"
|
|
2267
2267
|
];
|
|
2268
|
-
function
|
|
2269
|
-
return At.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" ? r : r.parentElement ?
|
|
2268
|
+
function Je(r) {
|
|
2269
|
+
return At.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" ? r : r.parentElement ? Je(r.parentElement) : null;
|
|
2270
2270
|
}
|
|
2271
|
-
function
|
|
2272
|
-
const t =
|
|
2271
|
+
function be(r, e) {
|
|
2272
|
+
const t = Qe(r, r.document.body, e), i = r._readium_cssSelectorGenerator.getCssSelector(t, {
|
|
2273
2273
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2274
2274
|
});
|
|
2275
|
-
return new
|
|
2275
|
+
return new I({
|
|
2276
2276
|
href: "#",
|
|
2277
2277
|
type: "application/xhtml+xml",
|
|
2278
2278
|
locations: new b({
|
|
@@ -2280,16 +2280,16 @@ function ve(r, e) {
|
|
|
2280
2280
|
["cssSelector", i]
|
|
2281
2281
|
])
|
|
2282
2282
|
}),
|
|
2283
|
-
text: new
|
|
2283
|
+
text: new D({
|
|
2284
2284
|
highlight: t.textContent || void 0
|
|
2285
2285
|
})
|
|
2286
2286
|
});
|
|
2287
2287
|
}
|
|
2288
|
-
function
|
|
2288
|
+
function Qe(r, e, t) {
|
|
2289
2289
|
for (var i = 0; i < e.children.length; i++) {
|
|
2290
2290
|
const s = e.children[i];
|
|
2291
2291
|
if (!Ot(s) && Mt(r, s, t))
|
|
2292
|
-
return Nt(r, s) ? s :
|
|
2292
|
+
return Nt(r, s) ? s : Qe(r, s, t);
|
|
2293
2293
|
}
|
|
2294
2294
|
return e;
|
|
2295
2295
|
}
|
|
@@ -2314,7 +2314,7 @@ function Ot(r) {
|
|
|
2314
2314
|
}
|
|
2315
2315
|
return !1;
|
|
2316
2316
|
}
|
|
2317
|
-
const
|
|
2317
|
+
const We = "readium-column-snapper-style", Lt = 200, x = class x extends q {
|
|
2318
2318
|
constructor() {
|
|
2319
2319
|
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);
|
|
2320
2320
|
}
|
|
@@ -2325,7 +2325,7 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2325
2325
|
return this.doc().scrollLeft > 0 ? this.doc().scrollLeft : this.alreadyScrollLeft;
|
|
2326
2326
|
}
|
|
2327
2327
|
snapOffset(e) {
|
|
2328
|
-
const t = e + (
|
|
2328
|
+
const t = e + (z(this.wnd) ? -1 : 1);
|
|
2329
2329
|
return t - t % this.wnd.innerWidth;
|
|
2330
2330
|
}
|
|
2331
2331
|
reportProgress() {
|
|
@@ -2338,7 +2338,7 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2338
2338
|
shake() {
|
|
2339
2339
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0) return;
|
|
2340
2340
|
const e = this.doc();
|
|
2341
|
-
e.classList.add(
|
|
2341
|
+
e.classList.add(z(this.wnd) ? "readium-bounce-l" : "readium-bounce-r");
|
|
2342
2342
|
const t = this.scrollOffset();
|
|
2343
2343
|
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
2344
2344
|
e.classList.remove("readium-bounce-l"), e.classList.remove("readium-bounce-r"), this.shakeTimeout = 0, this.doc().scrollLeft = t;
|
|
@@ -2352,13 +2352,13 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
// Snaps the current offset to the page width.
|
|
2354
2354
|
snapCurrentOffset(e = !1, t = !1) {
|
|
2355
|
-
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o =
|
|
2355
|
+
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = Ke(this.wnd), l = Math.min(Math.max(0, i), this.cachedScrollWidth), u = z(this.wnd) ? -1 : 1, h = (
|
|
2356
2356
|
// The hurdle to overcome in order to change pages
|
|
2357
2357
|
u * (this.wnd.innerWidth / 3) * (u * n > 0 ? 2 : 1)
|
|
2358
2358
|
), c = this.snapOffset(l + h);
|
|
2359
2359
|
if (e && c !== this.scrollOffset()) {
|
|
2360
2360
|
this.snappingCancelled = !1;
|
|
2361
|
-
const m = (f, g, E,
|
|
2361
|
+
const m = (f, g, E, W) => E > W ? g : f + (g - f) * Pt(E / W), p = (
|
|
2362
2362
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2363
2363
|
Lt * o
|
|
2364
2364
|
);
|
|
@@ -2366,8 +2366,8 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2366
2366
|
const d = (f) => {
|
|
2367
2367
|
if (this.snappingCancelled) return;
|
|
2368
2368
|
y || (y = f);
|
|
2369
|
-
const g = f - y, E = m(this.overscroll, 0, g, p),
|
|
2370
|
-
s.scrollLeft =
|
|
2369
|
+
const g = f - y, E = m(this.overscroll, 0, g, p), W = m(i, c, g, p);
|
|
2370
|
+
s.scrollLeft = W, this.overscroll !== 0 && (s.style.transform = `translate3d(${-E}px, 0px, 0px)`), g < p ? this.wnd.requestAnimationFrame(d) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = c, t || this.reportProgress());
|
|
2371
2371
|
};
|
|
2372
2372
|
this.wnd.requestAnimationFrame(d);
|
|
2373
2373
|
} else
|
|
@@ -2415,7 +2415,7 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2415
2415
|
if (this.wnd = e, this.comms = t, !super.mount(e, t)) return !1;
|
|
2416
2416
|
e.navigator.epubReadingSystem && (e.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
2417
2417
|
const i = e.document.createElement("style");
|
|
2418
|
-
i.dataset.readium = "true", i.id =
|
|
2418
|
+
i.dataset.readium = "true", i.id = We, i.textContent = `
|
|
2419
2419
|
@keyframes readium-bounce-l-animation {
|
|
2420
2420
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2421
2421
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2451,14 +2451,14 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2451
2451
|
}
|
|
2452
2452
|
`, e.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2453
2453
|
e.requestAnimationFrame(() => {
|
|
2454
|
-
e &&
|
|
2454
|
+
e && De(e);
|
|
2455
2455
|
}), this.onWidthChange();
|
|
2456
2456
|
}), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver((n) => {
|
|
2457
2457
|
for (const o of n)
|
|
2458
2458
|
if (o.target === this.wnd.document.documentElement) {
|
|
2459
2459
|
const l = o.oldValue, u = o.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, c = l?.match(h), m = u?.match(h);
|
|
2460
2460
|
(!c && !m || c && !m || c && m && c[1] !== m[1]) && (e.requestAnimationFrame(() => {
|
|
2461
|
-
e &&
|
|
2461
|
+
e && De(e);
|
|
2462
2462
|
}), this.onWidthChange());
|
|
2463
2463
|
} else
|
|
2464
2464
|
e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
@@ -2477,7 +2477,7 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2477
2477
|
}
|
|
2478
2478
|
this.wnd.requestAnimationFrame(() => {
|
|
2479
2479
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2480
|
-
const u = this.cachedScrollWidth, h =
|
|
2480
|
+
const u = this.cachedScrollWidth, h = z(e) ? -1 : 1, c = u * l * h;
|
|
2481
2481
|
this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), v(this.wnd), o(!0);
|
|
2482
2482
|
});
|
|
2483
2483
|
}), t.register("go_id", x.moduleName, (n, o) => {
|
|
@@ -2492,7 +2492,7 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2492
2492
|
}), t.register("go_text", x.moduleName, (n, o) => {
|
|
2493
2493
|
let l;
|
|
2494
2494
|
Array.isArray(n) && (n.length > 1 && (l = n[1]), n = n[0]);
|
|
2495
|
-
const u =
|
|
2495
|
+
const u = D.deserialize(n), h = ee(this.wnd.document, new I({
|
|
2496
2496
|
href: e.location.href,
|
|
2497
2497
|
type: "text/html",
|
|
2498
2498
|
text: u,
|
|
@@ -2510,7 +2510,7 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2510
2510
|
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), v(this.wnd), o(!0);
|
|
2511
2511
|
});
|
|
2512
2512
|
}), t.register("go_end", x.moduleName, (n, o) => {
|
|
2513
|
-
const l =
|
|
2513
|
+
const l = z(e) ? -1 : 1;
|
|
2514
2514
|
this.wnd.requestAnimationFrame(() => {
|
|
2515
2515
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2516
2516
|
const u = this.cachedScrollWidth * l;
|
|
@@ -2525,13 +2525,13 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2525
2525
|
}), t.register("go_prev", x.moduleName, (n, o) => {
|
|
2526
2526
|
this.wnd.requestAnimationFrame(() => {
|
|
2527
2527
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2528
|
-
const l = e.scrollX - e.innerWidth, u =
|
|
2528
|
+
const l = e.scrollX - e.innerWidth, u = z(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, h = s(Math.max(l, u));
|
|
2529
2529
|
h && (this.reportProgress(), v(this.wnd)), o(h);
|
|
2530
2530
|
});
|
|
2531
2531
|
}), t.register("go_next", x.moduleName, (n, o) => {
|
|
2532
2532
|
this.wnd.requestAnimationFrame(() => {
|
|
2533
2533
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2534
|
-
const l = e.scrollX + e.innerWidth, u =
|
|
2534
|
+
const l = e.scrollX + e.innerWidth, u = z(e) ? 0 : this.cachedScrollWidth - e.innerWidth, h = s(Math.min(l, u));
|
|
2535
2535
|
h && (this.reportProgress(), v(this.wnd)), o(h);
|
|
2536
2536
|
});
|
|
2537
2537
|
}), t.register("unfocus", x.moduleName, (n, o) => {
|
|
@@ -2543,18 +2543,18 @@ const De = "readium-column-snapper-style", Lt = 200, x = class x extends V {
|
|
|
2543
2543
|
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), o(!0);
|
|
2544
2544
|
});
|
|
2545
2545
|
}), t.register("first_visible_locator", x.moduleName, (n, o) => {
|
|
2546
|
-
const l =
|
|
2546
|
+
const l = be(e, !1);
|
|
2547
2547
|
this.comms.send("first_visible_locator", l.serialize()), o(!0);
|
|
2548
2548
|
}), 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", () => {
|
|
2549
2549
|
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2550
2550
|
}
|
|
2551
2551
|
unmount(e, t) {
|
|
2552
|
-
return this.snappingCancelled = !0, t.unregisterAll(x.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), e.document.getElementById(
|
|
2552
|
+
return this.snappingCancelled = !0, t.unregisterAll(x.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), e.document.getElementById(We)?.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
|
|
2553
2553
|
}
|
|
2554
2554
|
};
|
|
2555
2555
|
x.moduleName = "column_snapper";
|
|
2556
|
-
let
|
|
2557
|
-
const
|
|
2556
|
+
let ne = x;
|
|
2557
|
+
const Fe = "readium-scroll-snapper-style", T = class T extends q {
|
|
2558
2558
|
constructor() {
|
|
2559
2559
|
super(...arguments), this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = () => {
|
|
2560
2560
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -2584,7 +2584,7 @@ const We = "readium-scroll-snapper-style", T = class T extends V {
|
|
|
2584
2584
|
mount(e, t) {
|
|
2585
2585
|
this.wnd = e, this.comms = t, this.initialScrollHandled = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), e.navigator.epubReadingSystem && (e.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
2586
2586
|
const i = e.document.createElement("style");
|
|
2587
|
-
return i.dataset.readium = "true", i.id =
|
|
2587
|
+
return i.dataset.readium = "true", i.id = Fe, i.textContent = `
|
|
2588
2588
|
* {
|
|
2589
2589
|
scrollbar-width: none; /* for Firefox */
|
|
2590
2590
|
}
|
|
@@ -2597,7 +2597,7 @@ const We = "readium-scroll-snapper-style", T = class T extends V {
|
|
|
2597
2597
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
2598
2598
|
}, 50);
|
|
2599
2599
|
}), this.resizeObserver.observe(e.document.body), e.addEventListener("scroll", this.handleScroll, { passive: !0 }), t.register("force_webkit_recalc", T.moduleName, () => {
|
|
2600
|
-
|
|
2600
|
+
Ze(this.wnd);
|
|
2601
2601
|
const s = this.doc().scrollTop;
|
|
2602
2602
|
s > 1 ? this.doc().scrollTop = s - 1 : this.doc().scrollTop = s + 1, this.doc().scrollTop = s;
|
|
2603
2603
|
}), t.register("go_progression", T.moduleName, (s, n) => {
|
|
@@ -2623,7 +2623,7 @@ const We = "readium-scroll-snapper-style", T = class T extends V {
|
|
|
2623
2623
|
}), t.register("go_text", T.moduleName, (s, n) => {
|
|
2624
2624
|
let o;
|
|
2625
2625
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2626
|
-
const l =
|
|
2626
|
+
const l = D.deserialize(s), u = ee(this.wnd.document, new I({
|
|
2627
2627
|
href: e.location.href,
|
|
2628
2628
|
type: "text/html",
|
|
2629
2629
|
text: l,
|
|
@@ -2654,17 +2654,17 @@ const We = "readium-scroll-snapper-style", T = class T extends V {
|
|
|
2654
2654
|
], T.moduleName, (s, n) => n(!1)), t.register("focus", T.moduleName, (s, n) => {
|
|
2655
2655
|
this.reportProgress(), n(!0);
|
|
2656
2656
|
}), t.register("first_visible_locator", T.moduleName, (s, n) => {
|
|
2657
|
-
const o =
|
|
2657
|
+
const o = be(e, !0);
|
|
2658
2658
|
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2659
2659
|
}), t.log("ScrollSnapper Mounted"), !0;
|
|
2660
2660
|
}
|
|
2661
2661
|
unmount(e, t) {
|
|
2662
|
-
return t.unregisterAll(T.moduleName), this.resizeObserver.disconnect(), this.handleScroll && e.removeEventListener("scroll", this.handleScroll), e.document.getElementById(
|
|
2662
|
+
return t.unregisterAll(T.moduleName), this.resizeObserver.disconnect(), this.handleScroll && e.removeEventListener("scroll", this.handleScroll), e.document.getElementById(Fe)?.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2663
2663
|
}
|
|
2664
2664
|
};
|
|
2665
2665
|
T.moduleName = "scroll_snapper";
|
|
2666
|
-
let
|
|
2667
|
-
const w = class w extends
|
|
2666
|
+
let oe = T;
|
|
2667
|
+
const w = class w extends q {
|
|
2668
2668
|
constructor() {
|
|
2669
2669
|
super(...arguments), this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = () => {
|
|
2670
2670
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -2697,7 +2697,7 @@ const w = class w extends V {
|
|
|
2697
2697
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
2698
2698
|
}, 50);
|
|
2699
2699
|
}), this.resizeObserver.observe(e.document.body), e.addEventListener("scroll", this.handleScroll, { passive: !0 }), t.register("force_webkit_recalc", w.moduleName, () => {
|
|
2700
|
-
|
|
2700
|
+
Ze(this.wnd);
|
|
2701
2701
|
const i = this.doc().scrollTop;
|
|
2702
2702
|
i > 1 ? this.doc().scrollTop = i - 1 : this.doc().scrollTop = i + 1, this.doc().scrollTop = i;
|
|
2703
2703
|
}), t.register("go_progression", w.moduleName, (i, s) => {
|
|
@@ -2723,7 +2723,7 @@ const w = class w extends V {
|
|
|
2723
2723
|
}), t.register("go_text", w.moduleName, (i, s) => {
|
|
2724
2724
|
let n;
|
|
2725
2725
|
Array.isArray(i) && (i.length > 1 && (n = i[1]), i = i[0]);
|
|
2726
|
-
const o =
|
|
2726
|
+
const o = D.deserialize(i), l = ee(this.wnd.document, new I({
|
|
2727
2727
|
href: e.location.href,
|
|
2728
2728
|
type: "text/html",
|
|
2729
2729
|
text: o,
|
|
@@ -2754,7 +2754,7 @@ const w = class w extends V {
|
|
|
2754
2754
|
], w.moduleName, (i, s) => s(!1)), t.register("focus", w.moduleName, (i, s) => {
|
|
2755
2755
|
this.reportProgress(), s(!0);
|
|
2756
2756
|
}), t.register("first_visible_locator", w.moduleName, (i, s) => {
|
|
2757
|
-
const n =
|
|
2757
|
+
const n = be(e, !0);
|
|
2758
2758
|
t.send("first_visible_locator", n.serialize()), s(!0);
|
|
2759
2759
|
}), t.log("WebPubSnapper Mounted"), !0;
|
|
2760
2760
|
}
|
|
@@ -2763,8 +2763,8 @@ const w = class w extends V {
|
|
|
2763
2763
|
}
|
|
2764
2764
|
};
|
|
2765
2765
|
w.moduleName = "webpub_snapper";
|
|
2766
|
-
let
|
|
2767
|
-
const
|
|
2766
|
+
let ae = w;
|
|
2767
|
+
const Ee = class Ee extends X {
|
|
2768
2768
|
constructor() {
|
|
2769
2769
|
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);
|
|
2770
2770
|
}
|
|
@@ -2796,7 +2796,7 @@ const be = class be extends j {
|
|
|
2796
2796
|
y: e.clientY * i,
|
|
2797
2797
|
targetFrameSrc: this.wnd.location.href,
|
|
2798
2798
|
targetElement: e.target.outerHTML,
|
|
2799
|
-
interactiveElement:
|
|
2799
|
+
interactiveElement: Je(e.target)?.outerHTML,
|
|
2800
2800
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2801
2801
|
}), this.pointerMoved = !1;
|
|
2802
2802
|
}
|
|
@@ -2832,9 +2832,9 @@ const be = class be extends j {
|
|
|
2832
2832
|
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;
|
|
2833
2833
|
}
|
|
2834
2834
|
};
|
|
2835
|
-
|
|
2836
|
-
let
|
|
2837
|
-
const
|
|
2835
|
+
Ee.moduleName = "peripherals";
|
|
2836
|
+
let le = Ee;
|
|
2837
|
+
const V = class V extends X {
|
|
2838
2838
|
constructor() {
|
|
2839
2839
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
2840
2840
|
}
|
|
@@ -2884,7 +2884,7 @@ const k = class k extends j {
|
|
|
2884
2884
|
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
2885
2885
|
value: {
|
|
2886
2886
|
name: "readium-ts-toolkit",
|
|
2887
|
-
version: "2.2.
|
|
2887
|
+
version: "2.2.1",
|
|
2888
2888
|
hasFeature: (s, n = "") => {
|
|
2889
2889
|
switch (s) {
|
|
2890
2890
|
case "dom-manipulation":
|
|
@@ -2909,11 +2909,11 @@ const k = class k extends j {
|
|
|
2909
2909
|
writable: !1
|
|
2910
2910
|
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
2911
2911
|
s.cancel(), this.allAnimations.add(s);
|
|
2912
|
-
}), t.register("activate",
|
|
2912
|
+
}), t.register("activate", V.moduleName, (s, n) => {
|
|
2913
2913
|
this.allAnimations.forEach((o) => {
|
|
2914
2914
|
o.cancel(), o.play();
|
|
2915
2915
|
}), n(!0);
|
|
2916
|
-
}), t.register("unfocus",
|
|
2916
|
+
}), t.register("unfocus", V.moduleName, (s, n) => {
|
|
2917
2917
|
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
2918
2918
|
});
|
|
2919
2919
|
const i = e.document.querySelectorAll("audio,video");
|
|
@@ -2931,46 +2931,46 @@ const k = class k extends j {
|
|
|
2931
2931
|
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;
|
|
2932
2932
|
}
|
|
2933
2933
|
};
|
|
2934
|
-
|
|
2935
|
-
let
|
|
2936
|
-
const
|
|
2934
|
+
V.moduleName = "setup";
|
|
2935
|
+
let Q = V;
|
|
2936
|
+
const Ue = "readium-viewport", O = class O extends Q {
|
|
2937
2937
|
onViewportWidthChanged(e) {
|
|
2938
2938
|
const t = e.target;
|
|
2939
|
-
|
|
2939
|
+
j(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
2940
2940
|
}
|
|
2941
2941
|
mount(e, t) {
|
|
2942
2942
|
if (!super.mount(e, t)) return !1;
|
|
2943
2943
|
const i = e.document.createElement("meta");
|
|
2944
|
-
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id",
|
|
2944
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", Ue), i.setAttribute(
|
|
2945
2945
|
"content",
|
|
2946
2946
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
2947
2947
|
), e.document.head.appendChild(i), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
2948
2948
|
target: e
|
|
2949
2949
|
}), t.register("get_properties", O.moduleName, (s, n) => {
|
|
2950
|
-
|
|
2950
|
+
ve(e), n(!0);
|
|
2951
2951
|
}), t.register("update_properties", O.moduleName, (s, n) => {
|
|
2952
|
-
s["--RS__viewportWidth"] = `${e.innerWidth}px`,
|
|
2952
|
+
s["--RS__viewportWidth"] = `${e.innerWidth}px`, Ye(e, s), n(!0);
|
|
2953
2953
|
}), t.register("set_property", O.moduleName, (s, n) => {
|
|
2954
2954
|
const o = s;
|
|
2955
|
-
|
|
2955
|
+
j(e, o[0], o[1]), n(!0);
|
|
2956
2956
|
}), t.register("remove_property", O.moduleName, (s, n) => {
|
|
2957
|
-
|
|
2957
|
+
te(e, s), n(!0);
|
|
2958
2958
|
}), t.register("activate", O.moduleName, (s, n) => {
|
|
2959
2959
|
this.unblock(e), n(!0);
|
|
2960
2960
|
}), t.log("ReflowableSetup Mounted"), !0;
|
|
2961
2961
|
}
|
|
2962
2962
|
unmount(e, t) {
|
|
2963
|
-
return t.unregisterAll(O.moduleName), e.document.head.querySelector(`#${
|
|
2963
|
+
return t.unregisterAll(O.moduleName), e.document.head.querySelector(`#${Ue}`)?.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
2964
2964
|
}
|
|
2965
2965
|
};
|
|
2966
2966
|
O.moduleName = "reflowable_setup";
|
|
2967
|
-
let
|
|
2968
|
-
const
|
|
2967
|
+
let he = O;
|
|
2968
|
+
const Be = "readium-fixed-style", A = class A extends Q {
|
|
2969
2969
|
mount(e, t) {
|
|
2970
2970
|
if (!super.mount(e, t)) return !1;
|
|
2971
2971
|
e.navigator.epubReadingSystem && (e.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
2972
2972
|
const i = e.document.createElement("style");
|
|
2973
|
-
return i.id =
|
|
2973
|
+
return i.id = Be, i.dataset.readium = "true", i.textContent = `
|
|
2974
2974
|
html, body {
|
|
2975
2975
|
text-size-adjust: none;
|
|
2976
2976
|
-ms-text-size-adjust: none;
|
|
@@ -2984,9 +2984,9 @@ const Ue = "readium-fixed-style", A = class A extends J {
|
|
|
2984
2984
|
/*cursor: var() TODO*/
|
|
2985
2985
|
}`, e.document.head.appendChild(i), t.register("set_property", A.moduleName, (s, n) => {
|
|
2986
2986
|
const o = s;
|
|
2987
|
-
|
|
2987
|
+
j(e, o[0], o[1]), n(!0);
|
|
2988
2988
|
}), t.register("remove_property", A.moduleName, (s, n) => {
|
|
2989
|
-
|
|
2989
|
+
te(e, s), n(!0);
|
|
2990
2990
|
}), t.register("first_visible_locator", A.moduleName, (s, n) => n(!1)), t.register("unfocus", A.moduleName, (s, n) => {
|
|
2991
2991
|
v(e), n(!0);
|
|
2992
2992
|
}), t.register([
|
|
@@ -3003,12 +3003,12 @@ const Ue = "readium-fixed-style", A = class A extends J {
|
|
|
3003
3003
|
}), t.log("FixedSetup Mounted"), !0;
|
|
3004
3004
|
}
|
|
3005
3005
|
unmount(e, t) {
|
|
3006
|
-
return t.unregisterAll(A.moduleName), e.document.getElementById(
|
|
3006
|
+
return t.unregisterAll(A.moduleName), e.document.getElementById(Be)?.remove(), t.log("FixedSetup Unmounted"), super.unmount(e, t);
|
|
3007
3007
|
}
|
|
3008
3008
|
};
|
|
3009
3009
|
A.moduleName = "fixed_setup";
|
|
3010
|
-
let
|
|
3011
|
-
const
|
|
3010
|
+
let ce = A;
|
|
3011
|
+
const L = class L extends X {
|
|
3012
3012
|
wndOnErr(e) {
|
|
3013
3013
|
this.comms?.send("error", {
|
|
3014
3014
|
message: e.message,
|
|
@@ -3022,16 +3022,25 @@ const Q = class Q extends j {
|
|
|
3022
3022
|
"error",
|
|
3023
3023
|
this.wndOnErr,
|
|
3024
3024
|
!1
|
|
3025
|
-
), t.register("
|
|
3025
|
+
), t.register("get_properties", L.moduleName, (i, s) => {
|
|
3026
|
+
ve(e), s(!0);
|
|
3027
|
+
}), t.register("update_properties", L.moduleName, (i, s) => {
|
|
3028
|
+
Ye(e, i), s(!0);
|
|
3029
|
+
}), t.register("set_property", L.moduleName, (i, s) => {
|
|
3030
|
+
const n = i;
|
|
3031
|
+
j(e, n[0], n[1]), s(!0);
|
|
3032
|
+
}), t.register("remove_property", L.moduleName, (i, s) => {
|
|
3033
|
+
te(e, i), s(!0);
|
|
3034
|
+
}), t.register("activate", L.moduleName, (i, s) => {
|
|
3026
3035
|
s(!0);
|
|
3027
3036
|
}), t.log("WebPubSetup Mounted"), !0;
|
|
3028
3037
|
}
|
|
3029
3038
|
unmount(e, t) {
|
|
3030
|
-
return e.removeEventListener("error", this.wndOnErr), t.log("WebPubSetup Unmounted"), !0;
|
|
3039
|
+
return t.unregisterAll(L.moduleName), e.removeEventListener("error", this.wndOnErr), t.log("WebPubSetup Unmounted"), !0;
|
|
3031
3040
|
}
|
|
3032
3041
|
};
|
|
3033
|
-
|
|
3034
|
-
let
|
|
3042
|
+
L.moduleName = "webpub_setup";
|
|
3043
|
+
let ue = L;
|
|
3035
3044
|
const Rt = [
|
|
3036
3045
|
"fixed_setup",
|
|
3037
3046
|
"decorator",
|
|
@@ -3047,16 +3056,16 @@ const Rt = [
|
|
|
3047
3056
|
"webpub_snapper",
|
|
3048
3057
|
"decorator",
|
|
3049
3058
|
"peripherals"
|
|
3050
|
-
],
|
|
3059
|
+
], He = new Map([
|
|
3051
3060
|
// All modules go here
|
|
3052
|
-
he,
|
|
3053
|
-
le,
|
|
3054
3061
|
ce,
|
|
3055
|
-
|
|
3062
|
+
he,
|
|
3063
|
+
ue,
|
|
3056
3064
|
ae,
|
|
3057
|
-
|
|
3065
|
+
le,
|
|
3058
3066
|
re,
|
|
3059
|
-
ne
|
|
3067
|
+
ne,
|
|
3068
|
+
oe
|
|
3060
3069
|
].map((r) => [r.moduleName, r]));
|
|
3061
3070
|
class Wt {
|
|
3062
3071
|
/**
|
|
@@ -3064,7 +3073,7 @@ class Wt {
|
|
|
3064
3073
|
* @param initialModules List of initial modules to load
|
|
3065
3074
|
*/
|
|
3066
3075
|
constructor(e = window, t = []) {
|
|
3067
|
-
this.loadedModules = [], this.wnd = e, this.comms = new
|
|
3076
|
+
this.loadedModules = [], this.wnd = e, this.comms = new it(e);
|
|
3068
3077
|
const i = [...new Set(t)];
|
|
3069
3078
|
if (i.length) {
|
|
3070
3079
|
if (typeof e > "u")
|
|
@@ -3077,7 +3086,7 @@ class Wt {
|
|
|
3077
3086
|
}
|
|
3078
3087
|
}
|
|
3079
3088
|
loadModule(e) {
|
|
3080
|
-
const t =
|
|
3089
|
+
const t = He.get(e);
|
|
3081
3090
|
return t === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), t) : new t();
|
|
3082
3091
|
}
|
|
3083
3092
|
/**
|
|
@@ -3095,7 +3104,7 @@ class Wt {
|
|
|
3095
3104
|
* @returns Success
|
|
3096
3105
|
*/
|
|
3097
3106
|
removeModule(e) {
|
|
3098
|
-
const t =
|
|
3107
|
+
const t = He.get(e);
|
|
3099
3108
|
if (t === void 0)
|
|
3100
3109
|
return this.comms.log(`Module "${e}" does not exist in the library`), !1;
|
|
3101
3110
|
const i = this.loadedModules.findIndex((s) => s instanceof t);
|
|
@@ -3109,17 +3118,17 @@ class Wt {
|
|
|
3109
3118
|
}
|
|
3110
3119
|
}
|
|
3111
3120
|
export {
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3121
|
+
B as COMMS_VERSION,
|
|
3122
|
+
it as Comms,
|
|
3123
|
+
re as Decorator,
|
|
3115
3124
|
Rt as FXLModules,
|
|
3116
3125
|
wt as Layout,
|
|
3117
3126
|
Wt as Loader,
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3127
|
+
X as Module,
|
|
3128
|
+
He as ModuleLibrary,
|
|
3129
|
+
le as Peripherals,
|
|
3121
3130
|
zt as ReflowableModules,
|
|
3122
3131
|
Dt as WebPubModules,
|
|
3123
3132
|
Tt as Width,
|
|
3124
|
-
|
|
3133
|
+
tt as mid
|
|
3125
3134
|
};
|