@acrobits/ipc-sdk 0.0.14
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/README.md +55 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1367 -0
- package/docs/classes/IPCManager.html +421 -0
- package/docs/enums/IPCEvents.html +91 -0
- package/docs/index.html +70 -0
- package/docs/interfaces/BaseContactItem.html +98 -0
- package/docs/interfaces/CloudUsernameContactItem.html +109 -0
- package/docs/interfaces/DetailedContactItem.html +146 -0
- package/docs/interfaces/ILogger.html +151 -0
- package/docs/interfaces/SipUriContactItem.html +109 -0
- package/docs/modules.html +76 -0
- package/docs/types/ContactItem.html +57 -0
- package/docs/types/ContactLabel.html +57 -0
- package/docs/types/HostType.html +58 -0
- package/docs/types/IPCContext.html +60 -0
- package/docs/types/IpcProtocolVersion.html +57 -0
- package/docs/types/UnsubscribeCallback.html +65 -0
- package/lib/index.d.ts +193 -0
- package/lib/ipc-sdk.js +3062 -0
- package/lib/ipc-sdk.js.map +1 -0
- package/lib/ipc-sdk.umd.cjs +5 -0
- package/lib/ipc-sdk.umd.cjs.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +64 -0
package/lib/ipc-sdk.js
ADDED
|
@@ -0,0 +1,3062 @@
|
|
|
1
|
+
var Ar = Object.defineProperty;
|
|
2
|
+
var Tr = (r, e, t) => e in r ? Ar(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var re = (r, e, t) => (Tr(r, typeof e != "symbol" ? e + "" : e, t), t), Cr = (r, e, t) => {
|
|
4
|
+
if (!e.has(r))
|
|
5
|
+
throw TypeError("Cannot " + t);
|
|
6
|
+
};
|
|
7
|
+
var vt = (r, e, t) => {
|
|
8
|
+
if (e.has(r))
|
|
9
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
+
e instanceof WeakSet ? e.add(r) : e.set(r, t);
|
|
11
|
+
};
|
|
12
|
+
var je = (r, e, t) => (Cr(r, e, "access private method"), t);
|
|
13
|
+
var H = /* @__PURE__ */ ((r) => (r.BadgeQuery = "BADGE QUERY", r.HostInForeground = "HOST IN FOREGROUND", r))(H || {}), Nr = Object.defineProperty, xr = (r, e, t) => e in r ? Nr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, q = (r, e, t) => (xr(r, typeof e != "symbol" ? e + "" : e, t), t), We = { exports: {} };
|
|
14
|
+
const Lr = "2.0.0", Zt = 256, Pr = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
15
|
+
9007199254740991, Mr = 16, _r = Zt - 6, Dr = [
|
|
16
|
+
"major",
|
|
17
|
+
"premajor",
|
|
18
|
+
"minor",
|
|
19
|
+
"preminor",
|
|
20
|
+
"patch",
|
|
21
|
+
"prepatch",
|
|
22
|
+
"prerelease"
|
|
23
|
+
];
|
|
24
|
+
var xe = {
|
|
25
|
+
MAX_LENGTH: Zt,
|
|
26
|
+
MAX_SAFE_COMPONENT_LENGTH: Mr,
|
|
27
|
+
MAX_SAFE_BUILD_LENGTH: _r,
|
|
28
|
+
MAX_SAFE_INTEGER: Pr,
|
|
29
|
+
RELEASE_TYPES: Dr,
|
|
30
|
+
SEMVER_SPEC_VERSION: Lr,
|
|
31
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
32
|
+
FLAG_LOOSE: 2
|
|
33
|
+
};
|
|
34
|
+
const Ur = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...r) => console.error("SEMVER", ...r) : () => {
|
|
35
|
+
};
|
|
36
|
+
var Le = Ur;
|
|
37
|
+
(function(r, e) {
|
|
38
|
+
const {
|
|
39
|
+
MAX_SAFE_COMPONENT_LENGTH: t,
|
|
40
|
+
MAX_SAFE_BUILD_LENGTH: n,
|
|
41
|
+
MAX_LENGTH: i
|
|
42
|
+
} = xe, s = Le;
|
|
43
|
+
e = r.exports = {};
|
|
44
|
+
const a = e.re = [], c = e.safeRe = [], o = e.src = [], l = e.t = {};
|
|
45
|
+
let u = 0;
|
|
46
|
+
const p = "[a-zA-Z0-9-]", w = [
|
|
47
|
+
["\\s", 1],
|
|
48
|
+
["\\d", i],
|
|
49
|
+
[p, n]
|
|
50
|
+
], f = (R) => {
|
|
51
|
+
for (const [D, Q] of w)
|
|
52
|
+
R = R.split(`${D}*`).join(`${D}{0,${Q}}`).split(`${D}+`).join(`${D}{1,${Q}}`);
|
|
53
|
+
return R;
|
|
54
|
+
}, g = (R, D, Q) => {
|
|
55
|
+
const L = f(D), W = u++;
|
|
56
|
+
s(R, W, D), l[R] = W, o[W] = D, a[W] = new RegExp(D, Q ? "g" : void 0), c[W] = new RegExp(L, Q ? "g" : void 0);
|
|
57
|
+
};
|
|
58
|
+
g("NUMERICIDENTIFIER", "0|[1-9]\\d*"), g("NUMERICIDENTIFIERLOOSE", "\\d+"), g("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${p}*`), g("MAINVERSION", `(${o[l.NUMERICIDENTIFIER]})\\.(${o[l.NUMERICIDENTIFIER]})\\.(${o[l.NUMERICIDENTIFIER]})`), g("MAINVERSIONLOOSE", `(${o[l.NUMERICIDENTIFIERLOOSE]})\\.(${o[l.NUMERICIDENTIFIERLOOSE]})\\.(${o[l.NUMERICIDENTIFIERLOOSE]})`), g("PRERELEASEIDENTIFIER", `(?:${o[l.NUMERICIDENTIFIER]}|${o[l.NONNUMERICIDENTIFIER]})`), g("PRERELEASEIDENTIFIERLOOSE", `(?:${o[l.NUMERICIDENTIFIERLOOSE]}|${o[l.NONNUMERICIDENTIFIER]})`), g("PRERELEASE", `(?:-(${o[l.PRERELEASEIDENTIFIER]}(?:\\.${o[l.PRERELEASEIDENTIFIER]})*))`), g("PRERELEASELOOSE", `(?:-?(${o[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[l.PRERELEASEIDENTIFIERLOOSE]})*))`), g("BUILDIDENTIFIER", `${p}+`), g("BUILD", `(?:\\+(${o[l.BUILDIDENTIFIER]}(?:\\.${o[l.BUILDIDENTIFIER]})*))`), g("FULLPLAIN", `v?${o[l.MAINVERSION]}${o[l.PRERELEASE]}?${o[l.BUILD]}?`), g("FULL", `^${o[l.FULLPLAIN]}$`), g("LOOSEPLAIN", `[v=\\s]*${o[l.MAINVERSIONLOOSE]}${o[l.PRERELEASELOOSE]}?${o[l.BUILD]}?`), g("LOOSE", `^${o[l.LOOSEPLAIN]}$`), g("GTLT", "((?:<|>)?=?)"), g("XRANGEIDENTIFIERLOOSE", `${o[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), g("XRANGEIDENTIFIER", `${o[l.NUMERICIDENTIFIER]}|x|X|\\*`), g("XRANGEPLAIN", `[v=\\s]*(${o[l.XRANGEIDENTIFIER]})(?:\\.(${o[l.XRANGEIDENTIFIER]})(?:\\.(${o[l.XRANGEIDENTIFIER]})(?:${o[l.PRERELEASE]})?${o[l.BUILD]}?)?)?`), g("XRANGEPLAINLOOSE", `[v=\\s]*(${o[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[l.XRANGEIDENTIFIERLOOSE]})(?:${o[l.PRERELEASELOOSE]})?${o[l.BUILD]}?)?)?`), g("XRANGE", `^${o[l.GTLT]}\\s*${o[l.XRANGEPLAIN]}$`), g("XRANGELOOSE", `^${o[l.GTLT]}\\s*${o[l.XRANGEPLAINLOOSE]}$`), g("COERCE", `(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?(?:$|[^\\d])`), g("COERCERTL", o[l.COERCE], !0), g("LONETILDE", "(?:~>?)"), g("TILDETRIM", `(\\s*)${o[l.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", g("TILDE", `^${o[l.LONETILDE]}${o[l.XRANGEPLAIN]}$`), g("TILDELOOSE", `^${o[l.LONETILDE]}${o[l.XRANGEPLAINLOOSE]}$`), g("LONECARET", "(?:\\^)"), g("CARETTRIM", `(\\s*)${o[l.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", g("CARET", `^${o[l.LONECARET]}${o[l.XRANGEPLAIN]}$`), g("CARETLOOSE", `^${o[l.LONECARET]}${o[l.XRANGEPLAINLOOSE]}$`), g("COMPARATORLOOSE", `^${o[l.GTLT]}\\s*(${o[l.LOOSEPLAIN]})$|^$`), g("COMPARATOR", `^${o[l.GTLT]}\\s*(${o[l.FULLPLAIN]})$|^$`), g("COMPARATORTRIM", `(\\s*)${o[l.GTLT]}\\s*(${o[l.LOOSEPLAIN]}|${o[l.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", g("HYPHENRANGE", `^\\s*(${o[l.XRANGEPLAIN]})\\s+-\\s+(${o[l.XRANGEPLAIN]})\\s*$`), g("HYPHENRANGELOOSE", `^\\s*(${o[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[l.XRANGEPLAINLOOSE]})\\s*$`), g("STAR", "(<|>)?=?\\s*\\*"), g("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), g("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
59
|
+
})(We, We.exports);
|
|
60
|
+
var ve = We.exports;
|
|
61
|
+
const jr = Object.freeze({ loose: !0 }), Fr = Object.freeze({}), Gr = (r) => r ? typeof r != "object" ? jr : r : Fr;
|
|
62
|
+
var it = Gr;
|
|
63
|
+
const gt = /^[0-9]+$/, er = (r, e) => {
|
|
64
|
+
const t = gt.test(r), n = gt.test(e);
|
|
65
|
+
return t && n && (r = +r, e = +e), r === e ? 0 : t && !n ? -1 : n && !t ? 1 : r < e ? -1 : 1;
|
|
66
|
+
}, kr = (r, e) => er(e, r);
|
|
67
|
+
var tr = {
|
|
68
|
+
compareIdentifiers: er,
|
|
69
|
+
rcompareIdentifiers: kr
|
|
70
|
+
};
|
|
71
|
+
const me = Le, { MAX_LENGTH: mt, MAX_SAFE_INTEGER: Ee } = xe, { safeRe: Et, t: yt } = ve, Vr = it, { compareIdentifiers: ne } = tr;
|
|
72
|
+
let Hr = class k {
|
|
73
|
+
constructor(e, t) {
|
|
74
|
+
if (t = Vr(t), e instanceof k) {
|
|
75
|
+
if (e.loose === !!t.loose && e.includePrerelease === !!t.includePrerelease)
|
|
76
|
+
return e;
|
|
77
|
+
e = e.version;
|
|
78
|
+
} else if (typeof e != "string")
|
|
79
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);
|
|
80
|
+
if (e.length > mt)
|
|
81
|
+
throw new TypeError(
|
|
82
|
+
`version is longer than ${mt} characters`
|
|
83
|
+
);
|
|
84
|
+
me("SemVer", e, t), this.options = t, this.loose = !!t.loose, this.includePrerelease = !!t.includePrerelease;
|
|
85
|
+
const n = e.trim().match(t.loose ? Et[yt.LOOSE] : Et[yt.FULL]);
|
|
86
|
+
if (!n)
|
|
87
|
+
throw new TypeError(`Invalid Version: ${e}`);
|
|
88
|
+
if (this.raw = e, this.major = +n[1], this.minor = +n[2], this.patch = +n[3], this.major > Ee || this.major < 0)
|
|
89
|
+
throw new TypeError("Invalid major version");
|
|
90
|
+
if (this.minor > Ee || this.minor < 0)
|
|
91
|
+
throw new TypeError("Invalid minor version");
|
|
92
|
+
if (this.patch > Ee || this.patch < 0)
|
|
93
|
+
throw new TypeError("Invalid patch version");
|
|
94
|
+
n[4] ? this.prerelease = n[4].split(".").map((i) => {
|
|
95
|
+
if (/^[0-9]+$/.test(i)) {
|
|
96
|
+
const s = +i;
|
|
97
|
+
if (s >= 0 && s < Ee)
|
|
98
|
+
return s;
|
|
99
|
+
}
|
|
100
|
+
return i;
|
|
101
|
+
}) : this.prerelease = [], this.build = n[5] ? n[5].split(".") : [], this.format();
|
|
102
|
+
}
|
|
103
|
+
format() {
|
|
104
|
+
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
|
|
105
|
+
}
|
|
106
|
+
toString() {
|
|
107
|
+
return this.version;
|
|
108
|
+
}
|
|
109
|
+
compare(e) {
|
|
110
|
+
if (me("SemVer.compare", this.version, this.options, e), !(e instanceof k)) {
|
|
111
|
+
if (typeof e == "string" && e === this.version)
|
|
112
|
+
return 0;
|
|
113
|
+
e = new k(e, this.options);
|
|
114
|
+
}
|
|
115
|
+
return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e);
|
|
116
|
+
}
|
|
117
|
+
compareMain(e) {
|
|
118
|
+
return e instanceof k || (e = new k(e, this.options)), ne(this.major, e.major) || ne(this.minor, e.minor) || ne(this.patch, e.patch);
|
|
119
|
+
}
|
|
120
|
+
comparePre(e) {
|
|
121
|
+
if (e instanceof k || (e = new k(e, this.options)), this.prerelease.length && !e.prerelease.length)
|
|
122
|
+
return -1;
|
|
123
|
+
if (!this.prerelease.length && e.prerelease.length)
|
|
124
|
+
return 1;
|
|
125
|
+
if (!this.prerelease.length && !e.prerelease.length)
|
|
126
|
+
return 0;
|
|
127
|
+
let t = 0;
|
|
128
|
+
do {
|
|
129
|
+
const n = this.prerelease[t], i = e.prerelease[t];
|
|
130
|
+
if (me("prerelease compare", t, n, i), n === void 0 && i === void 0)
|
|
131
|
+
return 0;
|
|
132
|
+
if (i === void 0)
|
|
133
|
+
return 1;
|
|
134
|
+
if (n === void 0)
|
|
135
|
+
return -1;
|
|
136
|
+
if (n !== i)
|
|
137
|
+
return ne(n, i);
|
|
138
|
+
} while (++t);
|
|
139
|
+
}
|
|
140
|
+
compareBuild(e) {
|
|
141
|
+
e instanceof k || (e = new k(e, this.options));
|
|
142
|
+
let t = 0;
|
|
143
|
+
do {
|
|
144
|
+
const n = this.build[t], i = e.build[t];
|
|
145
|
+
if (me("prerelease compare", t, n, i), n === void 0 && i === void 0)
|
|
146
|
+
return 0;
|
|
147
|
+
if (i === void 0)
|
|
148
|
+
return 1;
|
|
149
|
+
if (n === void 0)
|
|
150
|
+
return -1;
|
|
151
|
+
if (n !== i)
|
|
152
|
+
return ne(n, i);
|
|
153
|
+
} while (++t);
|
|
154
|
+
}
|
|
155
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
156
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
157
|
+
inc(e, t, n) {
|
|
158
|
+
switch (e) {
|
|
159
|
+
case "premajor":
|
|
160
|
+
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", t, n);
|
|
161
|
+
break;
|
|
162
|
+
case "preminor":
|
|
163
|
+
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", t, n);
|
|
164
|
+
break;
|
|
165
|
+
case "prepatch":
|
|
166
|
+
this.prerelease.length = 0, this.inc("patch", t, n), this.inc("pre", t, n);
|
|
167
|
+
break;
|
|
168
|
+
case "prerelease":
|
|
169
|
+
this.prerelease.length === 0 && this.inc("patch", t, n), this.inc("pre", t, n);
|
|
170
|
+
break;
|
|
171
|
+
case "major":
|
|
172
|
+
(this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
|
|
173
|
+
break;
|
|
174
|
+
case "minor":
|
|
175
|
+
(this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
|
|
176
|
+
break;
|
|
177
|
+
case "patch":
|
|
178
|
+
this.prerelease.length === 0 && this.patch++, this.prerelease = [];
|
|
179
|
+
break;
|
|
180
|
+
case "pre": {
|
|
181
|
+
const i = Number(n) ? 1 : 0;
|
|
182
|
+
if (!t && n === !1)
|
|
183
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
184
|
+
if (this.prerelease.length === 0)
|
|
185
|
+
this.prerelease = [i];
|
|
186
|
+
else {
|
|
187
|
+
let s = this.prerelease.length;
|
|
188
|
+
for (; --s >= 0; )
|
|
189
|
+
typeof this.prerelease[s] == "number" && (this.prerelease[s]++, s = -2);
|
|
190
|
+
if (s === -1) {
|
|
191
|
+
if (t === this.prerelease.join(".") && n === !1)
|
|
192
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
193
|
+
this.prerelease.push(i);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (t) {
|
|
197
|
+
let s = [t, i];
|
|
198
|
+
n === !1 && (s = [t]), ne(this.prerelease[0], t) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = s) : this.prerelease = s;
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
default:
|
|
203
|
+
throw new Error(`invalid increment argument: ${e}`);
|
|
204
|
+
}
|
|
205
|
+
return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var _ = Hr;
|
|
209
|
+
const bt = _, Xr = (r, e, t = !1) => {
|
|
210
|
+
if (r instanceof bt)
|
|
211
|
+
return r;
|
|
212
|
+
try {
|
|
213
|
+
return new bt(r, e);
|
|
214
|
+
} catch (n) {
|
|
215
|
+
if (!t)
|
|
216
|
+
return null;
|
|
217
|
+
throw n;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var oe = Xr;
|
|
221
|
+
const Br = oe, qr = (r, e) => {
|
|
222
|
+
const t = Br(r, e);
|
|
223
|
+
return t ? t.version : null;
|
|
224
|
+
};
|
|
225
|
+
var Yr = qr;
|
|
226
|
+
const zr = oe, Qr = (r, e) => {
|
|
227
|
+
const t = zr(r.trim().replace(/^[=v]+/, ""), e);
|
|
228
|
+
return t ? t.version : null;
|
|
229
|
+
};
|
|
230
|
+
var Wr = Qr;
|
|
231
|
+
const wt = _, Jr = (r, e, t, n, i) => {
|
|
232
|
+
typeof t == "string" && (i = n, n = t, t = void 0);
|
|
233
|
+
try {
|
|
234
|
+
return new wt(
|
|
235
|
+
r instanceof wt ? r.version : r,
|
|
236
|
+
t
|
|
237
|
+
).inc(e, n, i).version;
|
|
238
|
+
} catch {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
var Kr = Jr;
|
|
243
|
+
const Rt = oe, Zr = (r, e) => {
|
|
244
|
+
const t = Rt(r, null, !0), n = Rt(e, null, !0), i = t.compare(n);
|
|
245
|
+
if (i === 0)
|
|
246
|
+
return null;
|
|
247
|
+
const s = i > 0, a = s ? t : n, c = s ? n : t, o = !!a.prerelease.length;
|
|
248
|
+
if (c.prerelease.length && !o)
|
|
249
|
+
return !c.patch && !c.minor ? "major" : a.patch ? "patch" : a.minor ? "minor" : "major";
|
|
250
|
+
const l = o ? "pre" : "";
|
|
251
|
+
return t.major !== n.major ? l + "major" : t.minor !== n.minor ? l + "minor" : t.patch !== n.patch ? l + "patch" : "prerelease";
|
|
252
|
+
};
|
|
253
|
+
var en = Zr;
|
|
254
|
+
const tn = _, rn = (r, e) => new tn(r, e).major;
|
|
255
|
+
var nn = rn;
|
|
256
|
+
const sn = _, on = (r, e) => new sn(r, e).minor;
|
|
257
|
+
var an = on;
|
|
258
|
+
const ln = _, cn = (r, e) => new ln(r, e).patch;
|
|
259
|
+
var un = cn;
|
|
260
|
+
const hn = oe, pn = (r, e) => {
|
|
261
|
+
const t = hn(r, e);
|
|
262
|
+
return t && t.prerelease.length ? t.prerelease : null;
|
|
263
|
+
};
|
|
264
|
+
var fn = pn;
|
|
265
|
+
const It = _, dn = (r, e, t) => new It(r, t).compare(new It(e, t));
|
|
266
|
+
var F = dn;
|
|
267
|
+
const vn = F, gn = (r, e, t) => vn(e, r, t);
|
|
268
|
+
var mn = gn;
|
|
269
|
+
const En = F, yn = (r, e) => En(r, e, !0);
|
|
270
|
+
var bn = yn;
|
|
271
|
+
const $t = _, wn = (r, e, t) => {
|
|
272
|
+
const n = new $t(r, t), i = new $t(e, t);
|
|
273
|
+
return n.compare(i) || n.compareBuild(i);
|
|
274
|
+
};
|
|
275
|
+
var st = wn;
|
|
276
|
+
const Rn = st, In = (r, e) => r.sort((t, n) => Rn(t, n, e));
|
|
277
|
+
var $n = In;
|
|
278
|
+
const Sn = st, On = (r, e) => r.sort((t, n) => Sn(n, t, e));
|
|
279
|
+
var An = On;
|
|
280
|
+
const Tn = F, Cn = (r, e, t) => Tn(r, e, t) > 0;
|
|
281
|
+
var Pe = Cn;
|
|
282
|
+
const Nn = F, xn = (r, e, t) => Nn(r, e, t) < 0;
|
|
283
|
+
var ot = xn;
|
|
284
|
+
const Ln = F, Pn = (r, e, t) => Ln(r, e, t) === 0;
|
|
285
|
+
var rr = Pn;
|
|
286
|
+
const Mn = F, _n = (r, e, t) => Mn(r, e, t) !== 0;
|
|
287
|
+
var nr = _n;
|
|
288
|
+
const Dn = F, Un = (r, e, t) => Dn(r, e, t) >= 0;
|
|
289
|
+
var at = Un;
|
|
290
|
+
const jn = F, Fn = (r, e, t) => jn(r, e, t) <= 0;
|
|
291
|
+
var lt = Fn;
|
|
292
|
+
const Gn = rr, kn = nr, Vn = Pe, Hn = at, Xn = ot, Bn = lt, qn = (r, e, t, n) => {
|
|
293
|
+
switch (e) {
|
|
294
|
+
case "===":
|
|
295
|
+
return typeof r == "object" && (r = r.version), typeof t == "object" && (t = t.version), r === t;
|
|
296
|
+
case "!==":
|
|
297
|
+
return typeof r == "object" && (r = r.version), typeof t == "object" && (t = t.version), r !== t;
|
|
298
|
+
case "":
|
|
299
|
+
case "=":
|
|
300
|
+
case "==":
|
|
301
|
+
return Gn(r, t, n);
|
|
302
|
+
case "!=":
|
|
303
|
+
return kn(r, t, n);
|
|
304
|
+
case ">":
|
|
305
|
+
return Vn(r, t, n);
|
|
306
|
+
case ">=":
|
|
307
|
+
return Hn(r, t, n);
|
|
308
|
+
case "<":
|
|
309
|
+
return Xn(r, t, n);
|
|
310
|
+
case "<=":
|
|
311
|
+
return Bn(r, t, n);
|
|
312
|
+
default:
|
|
313
|
+
throw new TypeError(`Invalid operator: ${e}`);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
var ir = qn;
|
|
317
|
+
const Yn = _, zn = oe, { safeRe: ye, t: be } = ve, Qn = (r, e) => {
|
|
318
|
+
if (r instanceof Yn)
|
|
319
|
+
return r;
|
|
320
|
+
if (typeof r == "number" && (r = String(r)), typeof r != "string")
|
|
321
|
+
return null;
|
|
322
|
+
e = e || {};
|
|
323
|
+
let t = null;
|
|
324
|
+
if (!e.rtl)
|
|
325
|
+
t = r.match(ye[be.COERCE]);
|
|
326
|
+
else {
|
|
327
|
+
let n;
|
|
328
|
+
for (; (n = ye[be.COERCERTL].exec(r)) && (!t || t.index + t[0].length !== r.length); )
|
|
329
|
+
(!t || n.index + n[0].length !== t.index + t[0].length) && (t = n), ye[be.COERCERTL].lastIndex = n.index + n[1].length + n[2].length;
|
|
330
|
+
ye[be.COERCERTL].lastIndex = -1;
|
|
331
|
+
}
|
|
332
|
+
return t === null ? null : zn(`${t[2]}.${t[3] || "0"}.${t[4] || "0"}`, e);
|
|
333
|
+
};
|
|
334
|
+
var Wn = Qn, St, Ot;
|
|
335
|
+
function Jn() {
|
|
336
|
+
return Ot || (Ot = 1, St = function(r) {
|
|
337
|
+
r.prototype[Symbol.iterator] = function* () {
|
|
338
|
+
for (let e = this.head; e; e = e.next)
|
|
339
|
+
yield e.value;
|
|
340
|
+
};
|
|
341
|
+
}), St;
|
|
342
|
+
}
|
|
343
|
+
var Kn = $;
|
|
344
|
+
$.Node = ee;
|
|
345
|
+
$.create = $;
|
|
346
|
+
function $(r) {
|
|
347
|
+
var e = this;
|
|
348
|
+
if (e instanceof $ || (e = new $()), e.tail = null, e.head = null, e.length = 0, r && typeof r.forEach == "function")
|
|
349
|
+
r.forEach(function(i) {
|
|
350
|
+
e.push(i);
|
|
351
|
+
});
|
|
352
|
+
else if (arguments.length > 0)
|
|
353
|
+
for (var t = 0, n = arguments.length; t < n; t++)
|
|
354
|
+
e.push(arguments[t]);
|
|
355
|
+
return e;
|
|
356
|
+
}
|
|
357
|
+
$.prototype.removeNode = function(r) {
|
|
358
|
+
if (r.list !== this)
|
|
359
|
+
throw new Error("removing node which does not belong to this list");
|
|
360
|
+
var e = r.next, t = r.prev;
|
|
361
|
+
return e && (e.prev = t), t && (t.next = e), r === this.head && (this.head = e), r === this.tail && (this.tail = t), r.list.length--, r.next = null, r.prev = null, r.list = null, e;
|
|
362
|
+
};
|
|
363
|
+
$.prototype.unshiftNode = function(r) {
|
|
364
|
+
if (r !== this.head) {
|
|
365
|
+
r.list && r.list.removeNode(r);
|
|
366
|
+
var e = this.head;
|
|
367
|
+
r.list = this, r.next = e, e && (e.prev = r), this.head = r, this.tail || (this.tail = r), this.length++;
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
$.prototype.pushNode = function(r) {
|
|
371
|
+
if (r !== this.tail) {
|
|
372
|
+
r.list && r.list.removeNode(r);
|
|
373
|
+
var e = this.tail;
|
|
374
|
+
r.list = this, r.prev = e, e && (e.next = r), this.tail = r, this.head || (this.head = r), this.length++;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
$.prototype.push = function() {
|
|
378
|
+
for (var r = 0, e = arguments.length; r < e; r++)
|
|
379
|
+
ei(this, arguments[r]);
|
|
380
|
+
return this.length;
|
|
381
|
+
};
|
|
382
|
+
$.prototype.unshift = function() {
|
|
383
|
+
for (var r = 0, e = arguments.length; r < e; r++)
|
|
384
|
+
ti(this, arguments[r]);
|
|
385
|
+
return this.length;
|
|
386
|
+
};
|
|
387
|
+
$.prototype.pop = function() {
|
|
388
|
+
if (this.tail) {
|
|
389
|
+
var r = this.tail.value;
|
|
390
|
+
return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, r;
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
$.prototype.shift = function() {
|
|
394
|
+
if (this.head) {
|
|
395
|
+
var r = this.head.value;
|
|
396
|
+
return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, r;
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
$.prototype.forEach = function(r, e) {
|
|
400
|
+
e = e || this;
|
|
401
|
+
for (var t = this.head, n = 0; t !== null; n++)
|
|
402
|
+
r.call(e, t.value, n, this), t = t.next;
|
|
403
|
+
};
|
|
404
|
+
$.prototype.forEachReverse = function(r, e) {
|
|
405
|
+
e = e || this;
|
|
406
|
+
for (var t = this.tail, n = this.length - 1; t !== null; n--)
|
|
407
|
+
r.call(e, t.value, n, this), t = t.prev;
|
|
408
|
+
};
|
|
409
|
+
$.prototype.get = function(r) {
|
|
410
|
+
for (var e = 0, t = this.head; t !== null && e < r; e++)
|
|
411
|
+
t = t.next;
|
|
412
|
+
if (e === r && t !== null)
|
|
413
|
+
return t.value;
|
|
414
|
+
};
|
|
415
|
+
$.prototype.getReverse = function(r) {
|
|
416
|
+
for (var e = 0, t = this.tail; t !== null && e < r; e++)
|
|
417
|
+
t = t.prev;
|
|
418
|
+
if (e === r && t !== null)
|
|
419
|
+
return t.value;
|
|
420
|
+
};
|
|
421
|
+
$.prototype.map = function(r, e) {
|
|
422
|
+
e = e || this;
|
|
423
|
+
for (var t = new $(), n = this.head; n !== null; )
|
|
424
|
+
t.push(r.call(e, n.value, this)), n = n.next;
|
|
425
|
+
return t;
|
|
426
|
+
};
|
|
427
|
+
$.prototype.mapReverse = function(r, e) {
|
|
428
|
+
e = e || this;
|
|
429
|
+
for (var t = new $(), n = this.tail; n !== null; )
|
|
430
|
+
t.push(r.call(e, n.value, this)), n = n.prev;
|
|
431
|
+
return t;
|
|
432
|
+
};
|
|
433
|
+
$.prototype.reduce = function(r, e) {
|
|
434
|
+
var t, n = this.head;
|
|
435
|
+
if (arguments.length > 1)
|
|
436
|
+
t = e;
|
|
437
|
+
else if (this.head)
|
|
438
|
+
n = this.head.next, t = this.head.value;
|
|
439
|
+
else
|
|
440
|
+
throw new TypeError("Reduce of empty list with no initial value");
|
|
441
|
+
for (var i = 0; n !== null; i++)
|
|
442
|
+
t = r(t, n.value, i), n = n.next;
|
|
443
|
+
return t;
|
|
444
|
+
};
|
|
445
|
+
$.prototype.reduceReverse = function(r, e) {
|
|
446
|
+
var t, n = this.tail;
|
|
447
|
+
if (arguments.length > 1)
|
|
448
|
+
t = e;
|
|
449
|
+
else if (this.tail)
|
|
450
|
+
n = this.tail.prev, t = this.tail.value;
|
|
451
|
+
else
|
|
452
|
+
throw new TypeError("Reduce of empty list with no initial value");
|
|
453
|
+
for (var i = this.length - 1; n !== null; i--)
|
|
454
|
+
t = r(t, n.value, i), n = n.prev;
|
|
455
|
+
return t;
|
|
456
|
+
};
|
|
457
|
+
$.prototype.toArray = function() {
|
|
458
|
+
for (var r = new Array(this.length), e = 0, t = this.head; t !== null; e++)
|
|
459
|
+
r[e] = t.value, t = t.next;
|
|
460
|
+
return r;
|
|
461
|
+
};
|
|
462
|
+
$.prototype.toArrayReverse = function() {
|
|
463
|
+
for (var r = new Array(this.length), e = 0, t = this.tail; t !== null; e++)
|
|
464
|
+
r[e] = t.value, t = t.prev;
|
|
465
|
+
return r;
|
|
466
|
+
};
|
|
467
|
+
$.prototype.slice = function(r, e) {
|
|
468
|
+
e = e || this.length, e < 0 && (e += this.length), r = r || 0, r < 0 && (r += this.length);
|
|
469
|
+
var t = new $();
|
|
470
|
+
if (e < r || e < 0)
|
|
471
|
+
return t;
|
|
472
|
+
r < 0 && (r = 0), e > this.length && (e = this.length);
|
|
473
|
+
for (var n = 0, i = this.head; i !== null && n < r; n++)
|
|
474
|
+
i = i.next;
|
|
475
|
+
for (; i !== null && n < e; n++, i = i.next)
|
|
476
|
+
t.push(i.value);
|
|
477
|
+
return t;
|
|
478
|
+
};
|
|
479
|
+
$.prototype.sliceReverse = function(r, e) {
|
|
480
|
+
e = e || this.length, e < 0 && (e += this.length), r = r || 0, r < 0 && (r += this.length);
|
|
481
|
+
var t = new $();
|
|
482
|
+
if (e < r || e < 0)
|
|
483
|
+
return t;
|
|
484
|
+
r < 0 && (r = 0), e > this.length && (e = this.length);
|
|
485
|
+
for (var n = this.length, i = this.tail; i !== null && n > e; n--)
|
|
486
|
+
i = i.prev;
|
|
487
|
+
for (; i !== null && n > r; n--, i = i.prev)
|
|
488
|
+
t.push(i.value);
|
|
489
|
+
return t;
|
|
490
|
+
};
|
|
491
|
+
$.prototype.splice = function(r, e, ...t) {
|
|
492
|
+
r > this.length && (r = this.length - 1), r < 0 && (r = this.length + r);
|
|
493
|
+
for (var n = 0, i = this.head; i !== null && n < r; n++)
|
|
494
|
+
i = i.next;
|
|
495
|
+
for (var s = [], n = 0; i && n < e; n++)
|
|
496
|
+
s.push(i.value), i = this.removeNode(i);
|
|
497
|
+
i === null && (i = this.tail), i !== this.head && i !== this.tail && (i = i.prev);
|
|
498
|
+
for (var n = 0; n < t.length; n++)
|
|
499
|
+
i = Zn(this, i, t[n]);
|
|
500
|
+
return s;
|
|
501
|
+
};
|
|
502
|
+
$.prototype.reverse = function() {
|
|
503
|
+
for (var r = this.head, e = this.tail, t = r; t !== null; t = t.prev) {
|
|
504
|
+
var n = t.prev;
|
|
505
|
+
t.prev = t.next, t.next = n;
|
|
506
|
+
}
|
|
507
|
+
return this.head = e, this.tail = r, this;
|
|
508
|
+
};
|
|
509
|
+
function Zn(r, e, t) {
|
|
510
|
+
var n = e === r.head ? new ee(t, null, e, r) : new ee(t, e, e.next, r);
|
|
511
|
+
return n.next === null && (r.tail = n), n.prev === null && (r.head = n), r.length++, n;
|
|
512
|
+
}
|
|
513
|
+
function ei(r, e) {
|
|
514
|
+
r.tail = new ee(e, r.tail, null, r), r.head || (r.head = r.tail), r.length++;
|
|
515
|
+
}
|
|
516
|
+
function ti(r, e) {
|
|
517
|
+
r.head = new ee(e, null, r.head, r), r.tail || (r.tail = r.head), r.length++;
|
|
518
|
+
}
|
|
519
|
+
function ee(r, e, t, n) {
|
|
520
|
+
if (!(this instanceof ee))
|
|
521
|
+
return new ee(r, e, t, n);
|
|
522
|
+
this.list = n, this.value = r, e ? (e.next = this, this.prev = e) : this.prev = null, t ? (t.prev = this, this.next = t) : this.next = null;
|
|
523
|
+
}
|
|
524
|
+
try {
|
|
525
|
+
Jn()($);
|
|
526
|
+
} catch {
|
|
527
|
+
}
|
|
528
|
+
const ri = Kn, J = Symbol("max"), B = Symbol("length"), ie = Symbol("lengthCalculator"), he = Symbol("allowStale"), K = Symbol("maxAge"), X = Symbol("dispose"), At = Symbol("noDisposeOnSet"), x = Symbol("lruList"), j = Symbol("cache"), sr = Symbol("updateAgeOnGet"), Fe = () => 1;
|
|
529
|
+
class ni {
|
|
530
|
+
constructor(e) {
|
|
531
|
+
if (typeof e == "number" && (e = { max: e }), e || (e = {}), e.max && (typeof e.max != "number" || e.max < 0))
|
|
532
|
+
throw new TypeError("max must be a non-negative number");
|
|
533
|
+
this[J] = e.max || 1 / 0;
|
|
534
|
+
const t = e.length || Fe;
|
|
535
|
+
if (this[ie] = typeof t != "function" ? Fe : t, this[he] = e.stale || !1, e.maxAge && typeof e.maxAge != "number")
|
|
536
|
+
throw new TypeError("maxAge must be a number");
|
|
537
|
+
this[K] = e.maxAge || 0, this[X] = e.dispose, this[At] = e.noDisposeOnSet || !1, this[sr] = e.updateAgeOnGet || !1, this.reset();
|
|
538
|
+
}
|
|
539
|
+
// resize the cache when the max changes.
|
|
540
|
+
set max(e) {
|
|
541
|
+
if (typeof e != "number" || e < 0)
|
|
542
|
+
throw new TypeError("max must be a non-negative number");
|
|
543
|
+
this[J] = e || 1 / 0, le(this);
|
|
544
|
+
}
|
|
545
|
+
get max() {
|
|
546
|
+
return this[J];
|
|
547
|
+
}
|
|
548
|
+
set allowStale(e) {
|
|
549
|
+
this[he] = !!e;
|
|
550
|
+
}
|
|
551
|
+
get allowStale() {
|
|
552
|
+
return this[he];
|
|
553
|
+
}
|
|
554
|
+
set maxAge(e) {
|
|
555
|
+
if (typeof e != "number")
|
|
556
|
+
throw new TypeError("maxAge must be a non-negative number");
|
|
557
|
+
this[K] = e, le(this);
|
|
558
|
+
}
|
|
559
|
+
get maxAge() {
|
|
560
|
+
return this[K];
|
|
561
|
+
}
|
|
562
|
+
// resize the cache when the lengthCalculator changes.
|
|
563
|
+
set lengthCalculator(e) {
|
|
564
|
+
typeof e != "function" && (e = Fe), e !== this[ie] && (this[ie] = e, this[B] = 0, this[x].forEach((t) => {
|
|
565
|
+
t.length = this[ie](t.value, t.key), this[B] += t.length;
|
|
566
|
+
})), le(this);
|
|
567
|
+
}
|
|
568
|
+
get lengthCalculator() {
|
|
569
|
+
return this[ie];
|
|
570
|
+
}
|
|
571
|
+
get length() {
|
|
572
|
+
return this[B];
|
|
573
|
+
}
|
|
574
|
+
get itemCount() {
|
|
575
|
+
return this[x].length;
|
|
576
|
+
}
|
|
577
|
+
rforEach(e, t) {
|
|
578
|
+
t = t || this;
|
|
579
|
+
for (let n = this[x].tail; n !== null; ) {
|
|
580
|
+
const i = n.prev;
|
|
581
|
+
Tt(this, e, n, t), n = i;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
forEach(e, t) {
|
|
585
|
+
t = t || this;
|
|
586
|
+
for (let n = this[x].head; n !== null; ) {
|
|
587
|
+
const i = n.next;
|
|
588
|
+
Tt(this, e, n, t), n = i;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
keys() {
|
|
592
|
+
return this[x].toArray().map((e) => e.key);
|
|
593
|
+
}
|
|
594
|
+
values() {
|
|
595
|
+
return this[x].toArray().map((e) => e.value);
|
|
596
|
+
}
|
|
597
|
+
reset() {
|
|
598
|
+
this[X] && this[x] && this[x].length && this[x].forEach((e) => this[X](e.key, e.value)), this[j] = /* @__PURE__ */ new Map(), this[x] = new ri(), this[B] = 0;
|
|
599
|
+
}
|
|
600
|
+
dump() {
|
|
601
|
+
return this[x].map((e) => Oe(this, e) ? !1 : {
|
|
602
|
+
k: e.key,
|
|
603
|
+
v: e.value,
|
|
604
|
+
e: e.now + (e.maxAge || 0)
|
|
605
|
+
}).toArray().filter((e) => e);
|
|
606
|
+
}
|
|
607
|
+
dumpLru() {
|
|
608
|
+
return this[x];
|
|
609
|
+
}
|
|
610
|
+
set(e, t, n) {
|
|
611
|
+
if (n = n || this[K], n && typeof n != "number")
|
|
612
|
+
throw new TypeError("maxAge must be a number");
|
|
613
|
+
const i = n ? Date.now() : 0, s = this[ie](t, e);
|
|
614
|
+
if (this[j].has(e)) {
|
|
615
|
+
if (s > this[J])
|
|
616
|
+
return se(this, this[j].get(e)), !1;
|
|
617
|
+
const c = this[j].get(e).value;
|
|
618
|
+
return this[X] && (this[At] || this[X](e, c.value)), c.now = i, c.maxAge = n, c.value = t, this[B] += s - c.length, c.length = s, this.get(e), le(this), !0;
|
|
619
|
+
}
|
|
620
|
+
const a = new ii(e, t, s, i, n);
|
|
621
|
+
return a.length > this[J] ? (this[X] && this[X](e, t), !1) : (this[B] += a.length, this[x].unshift(a), this[j].set(e, this[x].head), le(this), !0);
|
|
622
|
+
}
|
|
623
|
+
has(e) {
|
|
624
|
+
if (!this[j].has(e))
|
|
625
|
+
return !1;
|
|
626
|
+
const t = this[j].get(e).value;
|
|
627
|
+
return !Oe(this, t);
|
|
628
|
+
}
|
|
629
|
+
get(e) {
|
|
630
|
+
return Ge(this, e, !0);
|
|
631
|
+
}
|
|
632
|
+
peek(e) {
|
|
633
|
+
return Ge(this, e, !1);
|
|
634
|
+
}
|
|
635
|
+
pop() {
|
|
636
|
+
const e = this[x].tail;
|
|
637
|
+
return e ? (se(this, e), e.value) : null;
|
|
638
|
+
}
|
|
639
|
+
del(e) {
|
|
640
|
+
se(this, this[j].get(e));
|
|
641
|
+
}
|
|
642
|
+
load(e) {
|
|
643
|
+
this.reset();
|
|
644
|
+
const t = Date.now();
|
|
645
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
646
|
+
const i = e[n], s = i.e || 0;
|
|
647
|
+
if (s === 0)
|
|
648
|
+
this.set(i.k, i.v);
|
|
649
|
+
else {
|
|
650
|
+
const a = s - t;
|
|
651
|
+
a > 0 && this.set(i.k, i.v, a);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
prune() {
|
|
656
|
+
this[j].forEach((e, t) => Ge(this, t, !1));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const Ge = (r, e, t) => {
|
|
660
|
+
const n = r[j].get(e);
|
|
661
|
+
if (n) {
|
|
662
|
+
const i = n.value;
|
|
663
|
+
if (Oe(r, i)) {
|
|
664
|
+
if (se(r, n), !r[he])
|
|
665
|
+
return;
|
|
666
|
+
} else
|
|
667
|
+
t && (r[sr] && (n.value.now = Date.now()), r[x].unshiftNode(n));
|
|
668
|
+
return i.value;
|
|
669
|
+
}
|
|
670
|
+
}, Oe = (r, e) => {
|
|
671
|
+
if (!e || !e.maxAge && !r[K])
|
|
672
|
+
return !1;
|
|
673
|
+
const t = Date.now() - e.now;
|
|
674
|
+
return e.maxAge ? t > e.maxAge : r[K] && t > r[K];
|
|
675
|
+
}, le = (r) => {
|
|
676
|
+
if (r[B] > r[J])
|
|
677
|
+
for (let e = r[x].tail; r[B] > r[J] && e !== null; ) {
|
|
678
|
+
const t = e.prev;
|
|
679
|
+
se(r, e), e = t;
|
|
680
|
+
}
|
|
681
|
+
}, se = (r, e) => {
|
|
682
|
+
if (e) {
|
|
683
|
+
const t = e.value;
|
|
684
|
+
r[X] && r[X](t.key, t.value), r[B] -= t.length, r[j].delete(t.key), r[x].removeNode(e);
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
class ii {
|
|
688
|
+
constructor(e, t, n, i, s) {
|
|
689
|
+
this.key = e, this.value = t, this.length = n, this.now = i, this.maxAge = s || 0;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
const Tt = (r, e, t, n) => {
|
|
693
|
+
let i = t.value;
|
|
694
|
+
Oe(r, i) && (se(r, t), r[he] || (i = void 0)), i && e.call(n, i.value, i.key, r);
|
|
695
|
+
};
|
|
696
|
+
var si = ni, ke, Ct;
|
|
697
|
+
function G() {
|
|
698
|
+
if (Ct)
|
|
699
|
+
return ke;
|
|
700
|
+
Ct = 1;
|
|
701
|
+
class r {
|
|
702
|
+
constructor(h, y) {
|
|
703
|
+
if (y = n(y), h instanceof r)
|
|
704
|
+
return h.loose === !!y.loose && h.includePrerelease === !!y.includePrerelease ? h : new r(h.raw, y);
|
|
705
|
+
if (h instanceof i)
|
|
706
|
+
return this.raw = h.value, this.set = [[h]], this.format(), this;
|
|
707
|
+
if (this.options = y, this.loose = !!y.loose, this.includePrerelease = !!y.includePrerelease, this.raw = h.trim().split(/\s+/).join(" "), this.set = this.raw.split("||").map((m) => this.parseRange(m.trim())).filter((m) => m.length), !this.set.length)
|
|
708
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
709
|
+
if (this.set.length > 1) {
|
|
710
|
+
const m = this.set[0];
|
|
711
|
+
if (this.set = this.set.filter((E) => !g(E[0])), this.set.length === 0)
|
|
712
|
+
this.set = [m];
|
|
713
|
+
else if (this.set.length > 1) {
|
|
714
|
+
for (const E of this.set)
|
|
715
|
+
if (E.length === 1 && R(E[0])) {
|
|
716
|
+
this.set = [E];
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
this.format();
|
|
722
|
+
}
|
|
723
|
+
format() {
|
|
724
|
+
return this.range = this.set.map((h) => h.join(" ").trim()).join("||").trim(), this.range;
|
|
725
|
+
}
|
|
726
|
+
toString() {
|
|
727
|
+
return this.range;
|
|
728
|
+
}
|
|
729
|
+
parseRange(h) {
|
|
730
|
+
const y = ((this.options.includePrerelease && w) | (this.options.loose && f)) + ":" + h, m = t.get(y);
|
|
731
|
+
if (m)
|
|
732
|
+
return m;
|
|
733
|
+
const E = this.options.loose, v = E ? c[o.HYPHENRANGELOOSE] : c[o.HYPHENRANGE];
|
|
734
|
+
h = h.replace(v, Sr(this.options.includePrerelease)), s("hyphen replace", h), h = h.replace(c[o.COMPARATORTRIM], l), s("comparator trim", h), h = h.replace(c[o.TILDETRIM], u), s("tilde trim", h), h = h.replace(c[o.CARETTRIM], p), s("caret trim", h);
|
|
735
|
+
let b = h.split(" ").map((A) => Q(A, this.options)).join(" ").split(/\s+/).map((A) => $r(A, this.options));
|
|
736
|
+
E && (b = b.filter((A) => (s("loose invalid filter", A, this.options), !!A.match(c[o.COMPARATORLOOSE])))), s("range list", b);
|
|
737
|
+
const S = /* @__PURE__ */ new Map(), I = b.map((A) => new i(A, this.options));
|
|
738
|
+
for (const A of I) {
|
|
739
|
+
if (g(A))
|
|
740
|
+
return [A];
|
|
741
|
+
S.set(A.value, A);
|
|
742
|
+
}
|
|
743
|
+
S.size > 1 && S.has("") && S.delete("");
|
|
744
|
+
const O = [...S.values()];
|
|
745
|
+
return t.set(y, O), O;
|
|
746
|
+
}
|
|
747
|
+
intersects(h, y) {
|
|
748
|
+
if (!(h instanceof r))
|
|
749
|
+
throw new TypeError("a Range is required");
|
|
750
|
+
return this.set.some((m) => D(m, y) && h.set.some((E) => D(E, y) && m.every((v) => E.every((b) => v.intersects(b, y)))));
|
|
751
|
+
}
|
|
752
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
753
|
+
test(h) {
|
|
754
|
+
if (!h)
|
|
755
|
+
return !1;
|
|
756
|
+
if (typeof h == "string")
|
|
757
|
+
try {
|
|
758
|
+
h = new a(h, this.options);
|
|
759
|
+
} catch {
|
|
760
|
+
return !1;
|
|
761
|
+
}
|
|
762
|
+
for (let y = 0; y < this.set.length; y++)
|
|
763
|
+
if (Or(this.set[y], h, this.options))
|
|
764
|
+
return !0;
|
|
765
|
+
return !1;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
ke = r;
|
|
769
|
+
const e = si, t = new e({ max: 1e3 }), n = it, i = Me(), s = Le, a = _, {
|
|
770
|
+
safeRe: c,
|
|
771
|
+
t: o,
|
|
772
|
+
comparatorTrimReplace: l,
|
|
773
|
+
tildeTrimReplace: u,
|
|
774
|
+
caretTrimReplace: p
|
|
775
|
+
} = ve, { FLAG_INCLUDE_PRERELEASE: w, FLAG_LOOSE: f } = xe, g = (d) => d.value === "<0.0.0-0", R = (d) => d.value === "", D = (d, h) => {
|
|
776
|
+
let y = !0;
|
|
777
|
+
const m = d.slice();
|
|
778
|
+
let E = m.pop();
|
|
779
|
+
for (; y && m.length; )
|
|
780
|
+
y = m.every((v) => E.intersects(v, h)), E = m.pop();
|
|
781
|
+
return y;
|
|
782
|
+
}, Q = (d, h) => (s("comp", d, h), d = yr(d, h), s("caret", d), d = W(d, h), s("tildes", d), d = wr(d, h), s("xrange", d), d = Ir(d, h), s("stars", d), d), L = (d) => !d || d.toLowerCase() === "x" || d === "*", W = (d, h) => d.trim().split(/\s+/).map((y) => Er(y, h)).join(" "), Er = (d, h) => {
|
|
783
|
+
const y = h.loose ? c[o.TILDELOOSE] : c[o.TILDE];
|
|
784
|
+
return d.replace(y, (m, E, v, b, S) => {
|
|
785
|
+
s("tilde", d, m, E, v, b, S);
|
|
786
|
+
let I;
|
|
787
|
+
return L(E) ? I = "" : L(v) ? I = `>=${E}.0.0 <${+E + 1}.0.0-0` : L(b) ? I = `>=${E}.${v}.0 <${E}.${+v + 1}.0-0` : S ? (s("replaceTilde pr", S), I = `>=${E}.${v}.${b}-${S} <${E}.${+v + 1}.0-0`) : I = `>=${E}.${v}.${b} <${E}.${+v + 1}.0-0`, s("tilde return", I), I;
|
|
788
|
+
});
|
|
789
|
+
}, yr = (d, h) => d.trim().split(/\s+/).map((y) => br(y, h)).join(" "), br = (d, h) => {
|
|
790
|
+
s("caret", d, h);
|
|
791
|
+
const y = h.loose ? c[o.CARETLOOSE] : c[o.CARET], m = h.includePrerelease ? "-0" : "";
|
|
792
|
+
return d.replace(y, (E, v, b, S, I) => {
|
|
793
|
+
s("caret", d, E, v, b, S, I);
|
|
794
|
+
let O;
|
|
795
|
+
return L(v) ? O = "" : L(b) ? O = `>=${v}.0.0${m} <${+v + 1}.0.0-0` : L(S) ? v === "0" ? O = `>=${v}.${b}.0${m} <${v}.${+b + 1}.0-0` : O = `>=${v}.${b}.0${m} <${+v + 1}.0.0-0` : I ? (s("replaceCaret pr", I), v === "0" ? b === "0" ? O = `>=${v}.${b}.${S}-${I} <${v}.${b}.${+S + 1}-0` : O = `>=${v}.${b}.${S}-${I} <${v}.${+b + 1}.0-0` : O = `>=${v}.${b}.${S}-${I} <${+v + 1}.0.0-0`) : (s("no pr"), v === "0" ? b === "0" ? O = `>=${v}.${b}.${S}${m} <${v}.${b}.${+S + 1}-0` : O = `>=${v}.${b}.${S}${m} <${v}.${+b + 1}.0-0` : O = `>=${v}.${b}.${S} <${+v + 1}.0.0-0`), s("caret return", O), O;
|
|
796
|
+
});
|
|
797
|
+
}, wr = (d, h) => (s("replaceXRanges", d, h), d.split(/\s+/).map((y) => Rr(y, h)).join(" ")), Rr = (d, h) => {
|
|
798
|
+
d = d.trim();
|
|
799
|
+
const y = h.loose ? c[o.XRANGELOOSE] : c[o.XRANGE];
|
|
800
|
+
return d.replace(y, (m, E, v, b, S, I) => {
|
|
801
|
+
s("xRange", d, m, E, v, b, S, I);
|
|
802
|
+
const O = L(v), A = O || L(b), te = A || L(S), ae = te;
|
|
803
|
+
return E === "=" && ae && (E = ""), I = h.includePrerelease ? "-0" : "", O ? E === ">" || E === "<" ? m = "<0.0.0-0" : m = "*" : E && ae ? (A && (b = 0), S = 0, E === ">" ? (E = ">=", A ? (v = +v + 1, b = 0, S = 0) : (b = +b + 1, S = 0)) : E === "<=" && (E = "<", A ? v = +v + 1 : b = +b + 1), E === "<" && (I = "-0"), m = `${E + v}.${b}.${S}${I}`) : A ? m = `>=${v}.0.0${I} <${+v + 1}.0.0-0` : te && (m = `>=${v}.${b}.0${I} <${v}.${+b + 1}.0-0`), s("xRange return", m), m;
|
|
804
|
+
});
|
|
805
|
+
}, Ir = (d, h) => (s("replaceStars", d, h), d.trim().replace(c[o.STAR], "")), $r = (d, h) => (s("replaceGTE0", d, h), d.trim().replace(c[h.includePrerelease ? o.GTE0PRE : o.GTE0], "")), Sr = (d) => (h, y, m, E, v, b, S, I, O, A, te, ae, mo) => (L(m) ? y = "" : L(E) ? y = `>=${m}.0.0${d ? "-0" : ""}` : L(v) ? y = `>=${m}.${E}.0${d ? "-0" : ""}` : b ? y = `>=${y}` : y = `>=${y}${d ? "-0" : ""}`, L(O) ? I = "" : L(A) ? I = `<${+O + 1}.0.0-0` : L(te) ? I = `<${O}.${+A + 1}.0-0` : ae ? I = `<=${O}.${A}.${te}-${ae}` : d ? I = `<${O}.${A}.${+te + 1}-0` : I = `<=${I}`, `${y} ${I}`.trim()), Or = (d, h, y) => {
|
|
806
|
+
for (let m = 0; m < d.length; m++)
|
|
807
|
+
if (!d[m].test(h))
|
|
808
|
+
return !1;
|
|
809
|
+
if (h.prerelease.length && !y.includePrerelease) {
|
|
810
|
+
for (let m = 0; m < d.length; m++)
|
|
811
|
+
if (s(d[m].semver), d[m].semver !== i.ANY && d[m].semver.prerelease.length > 0) {
|
|
812
|
+
const E = d[m].semver;
|
|
813
|
+
if (E.major === h.major && E.minor === h.minor && E.patch === h.patch)
|
|
814
|
+
return !0;
|
|
815
|
+
}
|
|
816
|
+
return !1;
|
|
817
|
+
}
|
|
818
|
+
return !0;
|
|
819
|
+
};
|
|
820
|
+
return ke;
|
|
821
|
+
}
|
|
822
|
+
var Ve, Nt;
|
|
823
|
+
function Me() {
|
|
824
|
+
if (Nt)
|
|
825
|
+
return Ve;
|
|
826
|
+
Nt = 1;
|
|
827
|
+
const r = Symbol("SemVer ANY");
|
|
828
|
+
class e {
|
|
829
|
+
static get ANY() {
|
|
830
|
+
return r;
|
|
831
|
+
}
|
|
832
|
+
constructor(u, p) {
|
|
833
|
+
if (p = t(p), u instanceof e) {
|
|
834
|
+
if (u.loose === !!p.loose)
|
|
835
|
+
return u;
|
|
836
|
+
u = u.value;
|
|
837
|
+
}
|
|
838
|
+
u = u.trim().split(/\s+/).join(" "), a("comparator", u, p), this.options = p, this.loose = !!p.loose, this.parse(u), this.semver === r ? this.value = "" : this.value = this.operator + this.semver.version, a("comp", this);
|
|
839
|
+
}
|
|
840
|
+
parse(u) {
|
|
841
|
+
const p = this.options.loose ? n[i.COMPARATORLOOSE] : n[i.COMPARATOR], w = u.match(p);
|
|
842
|
+
if (!w)
|
|
843
|
+
throw new TypeError(`Invalid comparator: ${u}`);
|
|
844
|
+
this.operator = w[1] !== void 0 ? w[1] : "", this.operator === "=" && (this.operator = ""), w[2] ? this.semver = new c(w[2], this.options.loose) : this.semver = r;
|
|
845
|
+
}
|
|
846
|
+
toString() {
|
|
847
|
+
return this.value;
|
|
848
|
+
}
|
|
849
|
+
test(u) {
|
|
850
|
+
if (a("Comparator.test", u, this.options.loose), this.semver === r || u === r)
|
|
851
|
+
return !0;
|
|
852
|
+
if (typeof u == "string")
|
|
853
|
+
try {
|
|
854
|
+
u = new c(u, this.options);
|
|
855
|
+
} catch {
|
|
856
|
+
return !1;
|
|
857
|
+
}
|
|
858
|
+
return s(u, this.operator, this.semver, this.options);
|
|
859
|
+
}
|
|
860
|
+
intersects(u, p) {
|
|
861
|
+
if (!(u instanceof e))
|
|
862
|
+
throw new TypeError("a Comparator is required");
|
|
863
|
+
return this.operator === "" ? this.value === "" ? !0 : new o(u.value, p).test(this.value) : u.operator === "" ? u.value === "" ? !0 : new o(this.value, p).test(u.semver) : (p = t(p), p.includePrerelease && (this.value === "<0.0.0-0" || u.value === "<0.0.0-0") || !p.includePrerelease && (this.value.startsWith("<0.0.0") || u.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && u.operator.startsWith(">") || this.operator.startsWith("<") && u.operator.startsWith("<") || this.semver.version === u.semver.version && this.operator.includes("=") && u.operator.includes("=") || s(this.semver, "<", u.semver, p) && this.operator.startsWith(">") && u.operator.startsWith("<") || s(this.semver, ">", u.semver, p) && this.operator.startsWith("<") && u.operator.startsWith(">")));
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
Ve = e;
|
|
867
|
+
const t = it, { safeRe: n, t: i } = ve, s = ir, a = Le, c = _, o = G();
|
|
868
|
+
return Ve;
|
|
869
|
+
}
|
|
870
|
+
const oi = G(), ai = (r, e, t) => {
|
|
871
|
+
try {
|
|
872
|
+
e = new oi(e, t);
|
|
873
|
+
} catch {
|
|
874
|
+
return !1;
|
|
875
|
+
}
|
|
876
|
+
return e.test(r);
|
|
877
|
+
};
|
|
878
|
+
var _e = ai;
|
|
879
|
+
const li = G(), ci = (r, e) => new li(r, e).set.map((t) => t.map((n) => n.value).join(" ").trim().split(" "));
|
|
880
|
+
var ui = ci;
|
|
881
|
+
const hi = _, pi = G(), fi = (r, e, t) => {
|
|
882
|
+
let n = null, i = null, s = null;
|
|
883
|
+
try {
|
|
884
|
+
s = new pi(e, t);
|
|
885
|
+
} catch {
|
|
886
|
+
return null;
|
|
887
|
+
}
|
|
888
|
+
return r.forEach((a) => {
|
|
889
|
+
s.test(a) && (!n || i.compare(a) === -1) && (n = a, i = new hi(n, t));
|
|
890
|
+
}), n;
|
|
891
|
+
};
|
|
892
|
+
var di = fi;
|
|
893
|
+
const vi = _, gi = G(), mi = (r, e, t) => {
|
|
894
|
+
let n = null, i = null, s = null;
|
|
895
|
+
try {
|
|
896
|
+
s = new gi(e, t);
|
|
897
|
+
} catch {
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
return r.forEach((a) => {
|
|
901
|
+
s.test(a) && (!n || i.compare(a) === 1) && (n = a, i = new vi(n, t));
|
|
902
|
+
}), n;
|
|
903
|
+
};
|
|
904
|
+
var Ei = mi;
|
|
905
|
+
const He = _, yi = G(), xt = Pe, bi = (r, e) => {
|
|
906
|
+
r = new yi(r, e);
|
|
907
|
+
let t = new He("0.0.0");
|
|
908
|
+
if (r.test(t) || (t = new He("0.0.0-0"), r.test(t)))
|
|
909
|
+
return t;
|
|
910
|
+
t = null;
|
|
911
|
+
for (let n = 0; n < r.set.length; ++n) {
|
|
912
|
+
const i = r.set[n];
|
|
913
|
+
let s = null;
|
|
914
|
+
i.forEach((a) => {
|
|
915
|
+
const c = new He(a.semver.version);
|
|
916
|
+
switch (a.operator) {
|
|
917
|
+
case ">":
|
|
918
|
+
c.prerelease.length === 0 ? c.patch++ : c.prerelease.push(0), c.raw = c.format();
|
|
919
|
+
case "":
|
|
920
|
+
case ">=":
|
|
921
|
+
(!s || xt(c, s)) && (s = c);
|
|
922
|
+
break;
|
|
923
|
+
case "<":
|
|
924
|
+
case "<=":
|
|
925
|
+
break;
|
|
926
|
+
default:
|
|
927
|
+
throw new Error(`Unexpected operation: ${a.operator}`);
|
|
928
|
+
}
|
|
929
|
+
}), s && (!t || xt(t, s)) && (t = s);
|
|
930
|
+
}
|
|
931
|
+
return t && r.test(t) ? t : null;
|
|
932
|
+
};
|
|
933
|
+
var wi = bi;
|
|
934
|
+
const Ri = G(), Ii = (r, e) => {
|
|
935
|
+
try {
|
|
936
|
+
return new Ri(r, e).range || "*";
|
|
937
|
+
} catch {
|
|
938
|
+
return null;
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
var $i = Ii;
|
|
942
|
+
const Si = _, or = Me(), { ANY: Oi } = or, Ai = G(), Ti = _e, Lt = Pe, Pt = ot, Ci = lt, Ni = at, xi = (r, e, t, n) => {
|
|
943
|
+
r = new Si(r, n), e = new Ai(e, n);
|
|
944
|
+
let i, s, a, c, o;
|
|
945
|
+
switch (t) {
|
|
946
|
+
case ">":
|
|
947
|
+
i = Lt, s = Ci, a = Pt, c = ">", o = ">=";
|
|
948
|
+
break;
|
|
949
|
+
case "<":
|
|
950
|
+
i = Pt, s = Ni, a = Lt, c = "<", o = "<=";
|
|
951
|
+
break;
|
|
952
|
+
default:
|
|
953
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
954
|
+
}
|
|
955
|
+
if (Ti(r, e, n))
|
|
956
|
+
return !1;
|
|
957
|
+
for (let l = 0; l < e.set.length; ++l) {
|
|
958
|
+
const u = e.set[l];
|
|
959
|
+
let p = null, w = null;
|
|
960
|
+
if (u.forEach((f) => {
|
|
961
|
+
f.semver === Oi && (f = new or(">=0.0.0")), p = p || f, w = w || f, i(f.semver, p.semver, n) ? p = f : a(f.semver, w.semver, n) && (w = f);
|
|
962
|
+
}), p.operator === c || p.operator === o || (!w.operator || w.operator === c) && s(r, w.semver) || w.operator === o && a(r, w.semver))
|
|
963
|
+
return !1;
|
|
964
|
+
}
|
|
965
|
+
return !0;
|
|
966
|
+
};
|
|
967
|
+
var ct = xi;
|
|
968
|
+
const Li = ct, Pi = (r, e, t) => Li(r, e, ">", t);
|
|
969
|
+
var Mi = Pi;
|
|
970
|
+
const _i = ct, Di = (r, e, t) => _i(r, e, "<", t);
|
|
971
|
+
var Ui = Di;
|
|
972
|
+
const Mt = G(), ji = (r, e, t) => (r = new Mt(r, t), e = new Mt(e, t), r.intersects(e, t));
|
|
973
|
+
var Fi = ji;
|
|
974
|
+
const Gi = _e, ki = F;
|
|
975
|
+
var Vi = (r, e, t) => {
|
|
976
|
+
const n = [];
|
|
977
|
+
let i = null, s = null;
|
|
978
|
+
const a = r.sort((u, p) => ki(u, p, t));
|
|
979
|
+
for (const u of a)
|
|
980
|
+
Gi(u, e, t) ? (s = u, i || (i = u)) : (s && n.push([i, s]), s = null, i = null);
|
|
981
|
+
i && n.push([i, null]);
|
|
982
|
+
const c = [];
|
|
983
|
+
for (const [u, p] of n)
|
|
984
|
+
u === p ? c.push(u) : !p && u === a[0] ? c.push("*") : p ? u === a[0] ? c.push(`<=${p}`) : c.push(`${u} - ${p}`) : c.push(`>=${u}`);
|
|
985
|
+
const o = c.join(" || "), l = typeof e.raw == "string" ? e.raw : String(e);
|
|
986
|
+
return o.length < l.length ? o : e;
|
|
987
|
+
};
|
|
988
|
+
const _t = G(), ut = Me(), { ANY: Xe } = ut, ce = _e, ht = F, Hi = (r, e, t = {}) => {
|
|
989
|
+
if (r === e)
|
|
990
|
+
return !0;
|
|
991
|
+
r = new _t(r, t), e = new _t(e, t);
|
|
992
|
+
let n = !1;
|
|
993
|
+
e:
|
|
994
|
+
for (const i of r.set) {
|
|
995
|
+
for (const s of e.set) {
|
|
996
|
+
const a = Bi(i, s, t);
|
|
997
|
+
if (n = n || a !== null, a)
|
|
998
|
+
continue e;
|
|
999
|
+
}
|
|
1000
|
+
if (n)
|
|
1001
|
+
return !1;
|
|
1002
|
+
}
|
|
1003
|
+
return !0;
|
|
1004
|
+
}, Xi = [new ut(">=0.0.0-0")], Dt = [new ut(">=0.0.0")], Bi = (r, e, t) => {
|
|
1005
|
+
if (r === e)
|
|
1006
|
+
return !0;
|
|
1007
|
+
if (r.length === 1 && r[0].semver === Xe) {
|
|
1008
|
+
if (e.length === 1 && e[0].semver === Xe)
|
|
1009
|
+
return !0;
|
|
1010
|
+
t.includePrerelease ? r = Xi : r = Dt;
|
|
1011
|
+
}
|
|
1012
|
+
if (e.length === 1 && e[0].semver === Xe) {
|
|
1013
|
+
if (t.includePrerelease)
|
|
1014
|
+
return !0;
|
|
1015
|
+
e = Dt;
|
|
1016
|
+
}
|
|
1017
|
+
const n = /* @__PURE__ */ new Set();
|
|
1018
|
+
let i, s;
|
|
1019
|
+
for (const f of r)
|
|
1020
|
+
f.operator === ">" || f.operator === ">=" ? i = Ut(i, f, t) : f.operator === "<" || f.operator === "<=" ? s = jt(s, f, t) : n.add(f.semver);
|
|
1021
|
+
if (n.size > 1)
|
|
1022
|
+
return null;
|
|
1023
|
+
let a;
|
|
1024
|
+
if (i && s && (a = ht(i.semver, s.semver, t), a > 0 || a === 0 && (i.operator !== ">=" || s.operator !== "<=")))
|
|
1025
|
+
return null;
|
|
1026
|
+
for (const f of n) {
|
|
1027
|
+
if (i && !ce(f, String(i), t) || s && !ce(f, String(s), t))
|
|
1028
|
+
return null;
|
|
1029
|
+
for (const g of e)
|
|
1030
|
+
if (!ce(f, String(g), t))
|
|
1031
|
+
return !1;
|
|
1032
|
+
return !0;
|
|
1033
|
+
}
|
|
1034
|
+
let c, o, l, u, p = s && !t.includePrerelease && s.semver.prerelease.length ? s.semver : !1, w = i && !t.includePrerelease && i.semver.prerelease.length ? i.semver : !1;
|
|
1035
|
+
p && p.prerelease.length === 1 && s.operator === "<" && p.prerelease[0] === 0 && (p = !1);
|
|
1036
|
+
for (const f of e) {
|
|
1037
|
+
if (u = u || f.operator === ">" || f.operator === ">=", l = l || f.operator === "<" || f.operator === "<=", i) {
|
|
1038
|
+
if (w && f.semver.prerelease && f.semver.prerelease.length && f.semver.major === w.major && f.semver.minor === w.minor && f.semver.patch === w.patch && (w = !1), f.operator === ">" || f.operator === ">=") {
|
|
1039
|
+
if (c = Ut(i, f, t), c === f && c !== i)
|
|
1040
|
+
return !1;
|
|
1041
|
+
} else if (i.operator === ">=" && !ce(i.semver, String(f), t))
|
|
1042
|
+
return !1;
|
|
1043
|
+
}
|
|
1044
|
+
if (s) {
|
|
1045
|
+
if (p && f.semver.prerelease && f.semver.prerelease.length && f.semver.major === p.major && f.semver.minor === p.minor && f.semver.patch === p.patch && (p = !1), f.operator === "<" || f.operator === "<=") {
|
|
1046
|
+
if (o = jt(s, f, t), o === f && o !== s)
|
|
1047
|
+
return !1;
|
|
1048
|
+
} else if (s.operator === "<=" && !ce(s.semver, String(f), t))
|
|
1049
|
+
return !1;
|
|
1050
|
+
}
|
|
1051
|
+
if (!f.operator && (s || i) && a !== 0)
|
|
1052
|
+
return !1;
|
|
1053
|
+
}
|
|
1054
|
+
return !(i && l && !s && a !== 0 || s && u && !i && a !== 0 || w || p);
|
|
1055
|
+
}, Ut = (r, e, t) => {
|
|
1056
|
+
if (!r)
|
|
1057
|
+
return e;
|
|
1058
|
+
const n = ht(r.semver, e.semver, t);
|
|
1059
|
+
return n > 0 ? r : n < 0 || e.operator === ">" && r.operator === ">=" ? e : r;
|
|
1060
|
+
}, jt = (r, e, t) => {
|
|
1061
|
+
if (!r)
|
|
1062
|
+
return e;
|
|
1063
|
+
const n = ht(r.semver, e.semver, t);
|
|
1064
|
+
return n < 0 ? r : n > 0 || e.operator === "<" && r.operator === "<=" ? e : r;
|
|
1065
|
+
};
|
|
1066
|
+
var qi = Hi;
|
|
1067
|
+
const Be = ve, Ft = xe, Yi = _, Gt = tr, zi = oe, Qi = Yr, Wi = Wr, Ji = Kr, Ki = en, Zi = nn, es = an, ts = un, rs = fn, ns = F, is = mn, ss = bn, os = st, as = $n, ls = An, cs = Pe, us = ot, hs = rr, ps = nr, fs = at, ds = lt, vs = ir, gs = Wn, ms = Me(), Es = G(), ys = _e, bs = ui, ws = di, Rs = Ei, Is = wi, $s = $i, Ss = ct, Os = Mi, As = Ui, Ts = Fi, Cs = Vi, Ns = qi;
|
|
1068
|
+
var C = {
|
|
1069
|
+
parse: zi,
|
|
1070
|
+
valid: Qi,
|
|
1071
|
+
clean: Wi,
|
|
1072
|
+
inc: Ji,
|
|
1073
|
+
diff: Ki,
|
|
1074
|
+
major: Zi,
|
|
1075
|
+
minor: es,
|
|
1076
|
+
patch: ts,
|
|
1077
|
+
prerelease: rs,
|
|
1078
|
+
compare: ns,
|
|
1079
|
+
rcompare: is,
|
|
1080
|
+
compareLoose: ss,
|
|
1081
|
+
compareBuild: os,
|
|
1082
|
+
sort: as,
|
|
1083
|
+
rsort: ls,
|
|
1084
|
+
gt: cs,
|
|
1085
|
+
lt: us,
|
|
1086
|
+
eq: hs,
|
|
1087
|
+
neq: ps,
|
|
1088
|
+
gte: fs,
|
|
1089
|
+
lte: ds,
|
|
1090
|
+
cmp: vs,
|
|
1091
|
+
coerce: gs,
|
|
1092
|
+
Comparator: ms,
|
|
1093
|
+
Range: Es,
|
|
1094
|
+
satisfies: ys,
|
|
1095
|
+
toComparators: bs,
|
|
1096
|
+
maxSatisfying: ws,
|
|
1097
|
+
minSatisfying: Rs,
|
|
1098
|
+
minVersion: Is,
|
|
1099
|
+
validRange: $s,
|
|
1100
|
+
outside: Ss,
|
|
1101
|
+
gtr: Os,
|
|
1102
|
+
ltr: As,
|
|
1103
|
+
intersects: Ts,
|
|
1104
|
+
simplifyRange: Cs,
|
|
1105
|
+
subset: Ns,
|
|
1106
|
+
SemVer: Yi,
|
|
1107
|
+
re: Be.re,
|
|
1108
|
+
src: Be.src,
|
|
1109
|
+
tokens: Be.t,
|
|
1110
|
+
SEMVER_SPEC_VERSION: Ft.SEMVER_SPEC_VERSION,
|
|
1111
|
+
RELEASE_TYPES: Ft.RELEASE_TYPES,
|
|
1112
|
+
compareIdentifiers: Gt.compareIdentifiers,
|
|
1113
|
+
rcompareIdentifiers: Gt.rcompareIdentifiers
|
|
1114
|
+
};
|
|
1115
|
+
class N extends Error {
|
|
1116
|
+
constructor(e) {
|
|
1117
|
+
super(`Incorrect context (${e}). Cannot perform the requested operation.`), q(this, "context"), this.context = e;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
class $e extends Error {
|
|
1121
|
+
constructor(e, t, n) {
|
|
1122
|
+
super(`Invalid parameter (${e}). ${n}`), this.param = e, this.value = t, this.reason = n;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
class xs extends Error {
|
|
1126
|
+
constructor(e, t) {
|
|
1127
|
+
super(
|
|
1128
|
+
`'streamId' value of "${e}" is different from what we expected ("${t}")`
|
|
1129
|
+
), this.streamId = e, this.expectedStreamId = t;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
class kt extends Error {
|
|
1133
|
+
constructor(e) {
|
|
1134
|
+
super(`${e} needs to be initialized before it can be used.`);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
class Vt extends Error {
|
|
1138
|
+
constructor(e, t) {
|
|
1139
|
+
let n = `Unsupported Protocol ${Array.isArray(e) ? "versions" : "version"}: (${e}).`;
|
|
1140
|
+
t && (n += ` Minimum version supported is ${t}.`), super(n), this.version = e;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
var Je = function(r, e) {
|
|
1144
|
+
return Je = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
|
|
1145
|
+
t.__proto__ = n;
|
|
1146
|
+
} || function(t, n) {
|
|
1147
|
+
for (var i in n)
|
|
1148
|
+
Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
1149
|
+
}, Je(r, e);
|
|
1150
|
+
};
|
|
1151
|
+
function z(r, e) {
|
|
1152
|
+
if (typeof e != "function" && e !== null)
|
|
1153
|
+
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
1154
|
+
Je(r, e);
|
|
1155
|
+
function t() {
|
|
1156
|
+
this.constructor = r;
|
|
1157
|
+
}
|
|
1158
|
+
r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
1159
|
+
}
|
|
1160
|
+
function Ke(r) {
|
|
1161
|
+
var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], n = 0;
|
|
1162
|
+
if (t)
|
|
1163
|
+
return t.call(r);
|
|
1164
|
+
if (r && typeof r.length == "number")
|
|
1165
|
+
return {
|
|
1166
|
+
next: function() {
|
|
1167
|
+
return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1171
|
+
}
|
|
1172
|
+
function pe(r, e) {
|
|
1173
|
+
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
1174
|
+
if (!t)
|
|
1175
|
+
return r;
|
|
1176
|
+
var n = t.call(r), i, s = [], a;
|
|
1177
|
+
try {
|
|
1178
|
+
for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; )
|
|
1179
|
+
s.push(i.value);
|
|
1180
|
+
} catch (c) {
|
|
1181
|
+
a = { error: c };
|
|
1182
|
+
} finally {
|
|
1183
|
+
try {
|
|
1184
|
+
i && !i.done && (t = n.return) && t.call(n);
|
|
1185
|
+
} finally {
|
|
1186
|
+
if (a)
|
|
1187
|
+
throw a.error;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return s;
|
|
1191
|
+
}
|
|
1192
|
+
function fe(r, e, t) {
|
|
1193
|
+
if (t || arguments.length === 2)
|
|
1194
|
+
for (var n = 0, i = e.length, s; n < i; n++)
|
|
1195
|
+
(s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]);
|
|
1196
|
+
return r.concat(s || Array.prototype.slice.call(e));
|
|
1197
|
+
}
|
|
1198
|
+
function U(r) {
|
|
1199
|
+
return typeof r == "function";
|
|
1200
|
+
}
|
|
1201
|
+
function ar(r) {
|
|
1202
|
+
var e = function(n) {
|
|
1203
|
+
Error.call(n), n.stack = new Error().stack;
|
|
1204
|
+
}, t = r(e);
|
|
1205
|
+
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
|
|
1206
|
+
}
|
|
1207
|
+
var qe = ar(function(r) {
|
|
1208
|
+
return function(e) {
|
|
1209
|
+
r(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
1210
|
+
` + e.map(function(t, n) {
|
|
1211
|
+
return n + 1 + ") " + t.toString();
|
|
1212
|
+
}).join(`
|
|
1213
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
1214
|
+
};
|
|
1215
|
+
});
|
|
1216
|
+
function Ae(r, e) {
|
|
1217
|
+
if (r) {
|
|
1218
|
+
var t = r.indexOf(e);
|
|
1219
|
+
0 <= t && r.splice(t, 1);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
var ge = function() {
|
|
1223
|
+
function r(e) {
|
|
1224
|
+
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
1225
|
+
}
|
|
1226
|
+
return r.prototype.unsubscribe = function() {
|
|
1227
|
+
var e, t, n, i, s;
|
|
1228
|
+
if (!this.closed) {
|
|
1229
|
+
this.closed = !0;
|
|
1230
|
+
var a = this._parentage;
|
|
1231
|
+
if (a)
|
|
1232
|
+
if (this._parentage = null, Array.isArray(a))
|
|
1233
|
+
try {
|
|
1234
|
+
for (var c = Ke(a), o = c.next(); !o.done; o = c.next()) {
|
|
1235
|
+
var l = o.value;
|
|
1236
|
+
l.remove(this);
|
|
1237
|
+
}
|
|
1238
|
+
} catch (R) {
|
|
1239
|
+
e = { error: R };
|
|
1240
|
+
} finally {
|
|
1241
|
+
try {
|
|
1242
|
+
o && !o.done && (t = c.return) && t.call(c);
|
|
1243
|
+
} finally {
|
|
1244
|
+
if (e)
|
|
1245
|
+
throw e.error;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
else
|
|
1249
|
+
a.remove(this);
|
|
1250
|
+
var u = this.initialTeardown;
|
|
1251
|
+
if (U(u))
|
|
1252
|
+
try {
|
|
1253
|
+
u();
|
|
1254
|
+
} catch (R) {
|
|
1255
|
+
s = R instanceof qe ? R.errors : [R];
|
|
1256
|
+
}
|
|
1257
|
+
var p = this._finalizers;
|
|
1258
|
+
if (p) {
|
|
1259
|
+
this._finalizers = null;
|
|
1260
|
+
try {
|
|
1261
|
+
for (var w = Ke(p), f = w.next(); !f.done; f = w.next()) {
|
|
1262
|
+
var g = f.value;
|
|
1263
|
+
try {
|
|
1264
|
+
Ht(g);
|
|
1265
|
+
} catch (R) {
|
|
1266
|
+
s = s ?? [], R instanceof qe ? s = fe(fe([], pe(s)), pe(R.errors)) : s.push(R);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
} catch (R) {
|
|
1270
|
+
n = { error: R };
|
|
1271
|
+
} finally {
|
|
1272
|
+
try {
|
|
1273
|
+
f && !f.done && (i = w.return) && i.call(w);
|
|
1274
|
+
} finally {
|
|
1275
|
+
if (n)
|
|
1276
|
+
throw n.error;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
if (s)
|
|
1281
|
+
throw new qe(s);
|
|
1282
|
+
}
|
|
1283
|
+
}, r.prototype.add = function(e) {
|
|
1284
|
+
var t;
|
|
1285
|
+
if (e && e !== this)
|
|
1286
|
+
if (this.closed)
|
|
1287
|
+
Ht(e);
|
|
1288
|
+
else {
|
|
1289
|
+
if (e instanceof r) {
|
|
1290
|
+
if (e.closed || e._hasParent(this))
|
|
1291
|
+
return;
|
|
1292
|
+
e._addParent(this);
|
|
1293
|
+
}
|
|
1294
|
+
(this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
|
|
1295
|
+
}
|
|
1296
|
+
}, r.prototype._hasParent = function(e) {
|
|
1297
|
+
var t = this._parentage;
|
|
1298
|
+
return t === e || Array.isArray(t) && t.includes(e);
|
|
1299
|
+
}, r.prototype._addParent = function(e) {
|
|
1300
|
+
var t = this._parentage;
|
|
1301
|
+
this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
|
|
1302
|
+
}, r.prototype._removeParent = function(e) {
|
|
1303
|
+
var t = this._parentage;
|
|
1304
|
+
t === e ? this._parentage = null : Array.isArray(t) && Ae(t, e);
|
|
1305
|
+
}, r.prototype.remove = function(e) {
|
|
1306
|
+
var t = this._finalizers;
|
|
1307
|
+
t && Ae(t, e), e instanceof r && e._removeParent(this);
|
|
1308
|
+
}, r.EMPTY = function() {
|
|
1309
|
+
var e = new r();
|
|
1310
|
+
return e.closed = !0, e;
|
|
1311
|
+
}(), r;
|
|
1312
|
+
}(), lr = ge.EMPTY;
|
|
1313
|
+
function cr(r) {
|
|
1314
|
+
return r instanceof ge || r && "closed" in r && U(r.remove) && U(r.add) && U(r.unsubscribe);
|
|
1315
|
+
}
|
|
1316
|
+
function Ht(r) {
|
|
1317
|
+
U(r) ? r() : r.unsubscribe();
|
|
1318
|
+
}
|
|
1319
|
+
var ur = {
|
|
1320
|
+
onUnhandledError: null,
|
|
1321
|
+
onStoppedNotification: null,
|
|
1322
|
+
Promise: void 0,
|
|
1323
|
+
useDeprecatedSynchronousErrorHandling: !1,
|
|
1324
|
+
useDeprecatedNextContext: !1
|
|
1325
|
+
}, Ls = {
|
|
1326
|
+
setTimeout: function(r, e) {
|
|
1327
|
+
for (var t = [], n = 2; n < arguments.length; n++)
|
|
1328
|
+
t[n - 2] = arguments[n];
|
|
1329
|
+
return setTimeout.apply(void 0, fe([r, e], pe(t)));
|
|
1330
|
+
},
|
|
1331
|
+
clearTimeout: function(r) {
|
|
1332
|
+
return clearTimeout(r);
|
|
1333
|
+
},
|
|
1334
|
+
delegate: void 0
|
|
1335
|
+
};
|
|
1336
|
+
function Ps(r) {
|
|
1337
|
+
Ls.setTimeout(function() {
|
|
1338
|
+
throw r;
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
function Xt() {
|
|
1342
|
+
}
|
|
1343
|
+
function Se(r) {
|
|
1344
|
+
r();
|
|
1345
|
+
}
|
|
1346
|
+
var pt = function(r) {
|
|
1347
|
+
z(e, r);
|
|
1348
|
+
function e(t) {
|
|
1349
|
+
var n = r.call(this) || this;
|
|
1350
|
+
return n.isStopped = !1, t ? (n.destination = t, cr(t) && t.add(n)) : n.destination = Us, n;
|
|
1351
|
+
}
|
|
1352
|
+
return e.create = function(t, n, i) {
|
|
1353
|
+
return new Ze(t, n, i);
|
|
1354
|
+
}, e.prototype.next = function(t) {
|
|
1355
|
+
this.isStopped || this._next(t);
|
|
1356
|
+
}, e.prototype.error = function(t) {
|
|
1357
|
+
this.isStopped || (this.isStopped = !0, this._error(t));
|
|
1358
|
+
}, e.prototype.complete = function() {
|
|
1359
|
+
this.isStopped || (this.isStopped = !0, this._complete());
|
|
1360
|
+
}, e.prototype.unsubscribe = function() {
|
|
1361
|
+
this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
|
|
1362
|
+
}, e.prototype._next = function(t) {
|
|
1363
|
+
this.destination.next(t);
|
|
1364
|
+
}, e.prototype._error = function(t) {
|
|
1365
|
+
try {
|
|
1366
|
+
this.destination.error(t);
|
|
1367
|
+
} finally {
|
|
1368
|
+
this.unsubscribe();
|
|
1369
|
+
}
|
|
1370
|
+
}, e.prototype._complete = function() {
|
|
1371
|
+
try {
|
|
1372
|
+
this.destination.complete();
|
|
1373
|
+
} finally {
|
|
1374
|
+
this.unsubscribe();
|
|
1375
|
+
}
|
|
1376
|
+
}, e;
|
|
1377
|
+
}(ge), Ms = Function.prototype.bind;
|
|
1378
|
+
function Ye(r, e) {
|
|
1379
|
+
return Ms.call(r, e);
|
|
1380
|
+
}
|
|
1381
|
+
var _s = function() {
|
|
1382
|
+
function r(e) {
|
|
1383
|
+
this.partialObserver = e;
|
|
1384
|
+
}
|
|
1385
|
+
return r.prototype.next = function(e) {
|
|
1386
|
+
var t = this.partialObserver;
|
|
1387
|
+
if (t.next)
|
|
1388
|
+
try {
|
|
1389
|
+
t.next(e);
|
|
1390
|
+
} catch (n) {
|
|
1391
|
+
we(n);
|
|
1392
|
+
}
|
|
1393
|
+
}, r.prototype.error = function(e) {
|
|
1394
|
+
var t = this.partialObserver;
|
|
1395
|
+
if (t.error)
|
|
1396
|
+
try {
|
|
1397
|
+
t.error(e);
|
|
1398
|
+
} catch (n) {
|
|
1399
|
+
we(n);
|
|
1400
|
+
}
|
|
1401
|
+
else
|
|
1402
|
+
we(e);
|
|
1403
|
+
}, r.prototype.complete = function() {
|
|
1404
|
+
var e = this.partialObserver;
|
|
1405
|
+
if (e.complete)
|
|
1406
|
+
try {
|
|
1407
|
+
e.complete();
|
|
1408
|
+
} catch (t) {
|
|
1409
|
+
we(t);
|
|
1410
|
+
}
|
|
1411
|
+
}, r;
|
|
1412
|
+
}(), Ze = function(r) {
|
|
1413
|
+
z(e, r);
|
|
1414
|
+
function e(t, n, i) {
|
|
1415
|
+
var s = r.call(this) || this, a;
|
|
1416
|
+
if (U(t) || !t)
|
|
1417
|
+
a = {
|
|
1418
|
+
next: t ?? void 0,
|
|
1419
|
+
error: n ?? void 0,
|
|
1420
|
+
complete: i ?? void 0
|
|
1421
|
+
};
|
|
1422
|
+
else {
|
|
1423
|
+
var c;
|
|
1424
|
+
s && ur.useDeprecatedNextContext ? (c = Object.create(t), c.unsubscribe = function() {
|
|
1425
|
+
return s.unsubscribe();
|
|
1426
|
+
}, a = {
|
|
1427
|
+
next: t.next && Ye(t.next, c),
|
|
1428
|
+
error: t.error && Ye(t.error, c),
|
|
1429
|
+
complete: t.complete && Ye(t.complete, c)
|
|
1430
|
+
}) : a = t;
|
|
1431
|
+
}
|
|
1432
|
+
return s.destination = new _s(a), s;
|
|
1433
|
+
}
|
|
1434
|
+
return e;
|
|
1435
|
+
}(pt);
|
|
1436
|
+
function we(r) {
|
|
1437
|
+
Ps(r);
|
|
1438
|
+
}
|
|
1439
|
+
function Ds(r) {
|
|
1440
|
+
throw r;
|
|
1441
|
+
}
|
|
1442
|
+
var Us = {
|
|
1443
|
+
closed: !0,
|
|
1444
|
+
next: Xt,
|
|
1445
|
+
error: Ds,
|
|
1446
|
+
complete: Xt
|
|
1447
|
+
}, js = function() {
|
|
1448
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
1449
|
+
}();
|
|
1450
|
+
function hr(r) {
|
|
1451
|
+
return r;
|
|
1452
|
+
}
|
|
1453
|
+
function Fs(r) {
|
|
1454
|
+
return r.length === 0 ? hr : r.length === 1 ? r[0] : function(e) {
|
|
1455
|
+
return r.reduce(function(t, n) {
|
|
1456
|
+
return n(t);
|
|
1457
|
+
}, e);
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
var Te = function() {
|
|
1461
|
+
function r(e) {
|
|
1462
|
+
e && (this._subscribe = e);
|
|
1463
|
+
}
|
|
1464
|
+
return r.prototype.lift = function(e) {
|
|
1465
|
+
var t = new r();
|
|
1466
|
+
return t.source = this, t.operator = e, t;
|
|
1467
|
+
}, r.prototype.subscribe = function(e, t, n) {
|
|
1468
|
+
var i = this, s = ks(e) ? e : new Ze(e, t, n);
|
|
1469
|
+
return Se(function() {
|
|
1470
|
+
var a = i, c = a.operator, o = a.source;
|
|
1471
|
+
s.add(c ? c.call(s, o) : o ? i._subscribe(s) : i._trySubscribe(s));
|
|
1472
|
+
}), s;
|
|
1473
|
+
}, r.prototype._trySubscribe = function(e) {
|
|
1474
|
+
try {
|
|
1475
|
+
return this._subscribe(e);
|
|
1476
|
+
} catch (t) {
|
|
1477
|
+
e.error(t);
|
|
1478
|
+
}
|
|
1479
|
+
}, r.prototype.forEach = function(e, t) {
|
|
1480
|
+
var n = this;
|
|
1481
|
+
return t = Bt(t), new t(function(i, s) {
|
|
1482
|
+
var a = new Ze({
|
|
1483
|
+
next: function(c) {
|
|
1484
|
+
try {
|
|
1485
|
+
e(c);
|
|
1486
|
+
} catch (o) {
|
|
1487
|
+
s(o), a.unsubscribe();
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
error: s,
|
|
1491
|
+
complete: i
|
|
1492
|
+
});
|
|
1493
|
+
n.subscribe(a);
|
|
1494
|
+
});
|
|
1495
|
+
}, r.prototype._subscribe = function(e) {
|
|
1496
|
+
var t;
|
|
1497
|
+
return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e);
|
|
1498
|
+
}, r.prototype[js] = function() {
|
|
1499
|
+
return this;
|
|
1500
|
+
}, r.prototype.pipe = function() {
|
|
1501
|
+
for (var e = [], t = 0; t < arguments.length; t++)
|
|
1502
|
+
e[t] = arguments[t];
|
|
1503
|
+
return Fs(e)(this);
|
|
1504
|
+
}, r.prototype.toPromise = function(e) {
|
|
1505
|
+
var t = this;
|
|
1506
|
+
return e = Bt(e), new e(function(n, i) {
|
|
1507
|
+
var s;
|
|
1508
|
+
t.subscribe(function(a) {
|
|
1509
|
+
return s = a;
|
|
1510
|
+
}, function(a) {
|
|
1511
|
+
return i(a);
|
|
1512
|
+
}, function() {
|
|
1513
|
+
return n(s);
|
|
1514
|
+
});
|
|
1515
|
+
});
|
|
1516
|
+
}, r.create = function(e) {
|
|
1517
|
+
return new r(e);
|
|
1518
|
+
}, r;
|
|
1519
|
+
}();
|
|
1520
|
+
function Bt(r) {
|
|
1521
|
+
var e;
|
|
1522
|
+
return (e = r ?? ur.Promise) !== null && e !== void 0 ? e : Promise;
|
|
1523
|
+
}
|
|
1524
|
+
function Gs(r) {
|
|
1525
|
+
return r && U(r.next) && U(r.error) && U(r.complete);
|
|
1526
|
+
}
|
|
1527
|
+
function ks(r) {
|
|
1528
|
+
return r && r instanceof pt || Gs(r) && cr(r);
|
|
1529
|
+
}
|
|
1530
|
+
function Vs(r) {
|
|
1531
|
+
return U(r == null ? void 0 : r.lift);
|
|
1532
|
+
}
|
|
1533
|
+
function De(r) {
|
|
1534
|
+
return function(e) {
|
|
1535
|
+
if (Vs(e))
|
|
1536
|
+
return e.lift(function(t) {
|
|
1537
|
+
try {
|
|
1538
|
+
return r(t, this);
|
|
1539
|
+
} catch (n) {
|
|
1540
|
+
this.error(n);
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
throw new TypeError("Unable to lift unknown Observable type");
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
function Ue(r, e, t, n, i) {
|
|
1547
|
+
return new Hs(r, e, t, n, i);
|
|
1548
|
+
}
|
|
1549
|
+
var Hs = function(r) {
|
|
1550
|
+
z(e, r);
|
|
1551
|
+
function e(t, n, i, s, a, c) {
|
|
1552
|
+
var o = r.call(this, t) || this;
|
|
1553
|
+
return o.onFinalize = a, o.shouldUnsubscribe = c, o._next = n ? function(l) {
|
|
1554
|
+
try {
|
|
1555
|
+
n(l);
|
|
1556
|
+
} catch (u) {
|
|
1557
|
+
t.error(u);
|
|
1558
|
+
}
|
|
1559
|
+
} : r.prototype._next, o._error = s ? function(l) {
|
|
1560
|
+
try {
|
|
1561
|
+
s(l);
|
|
1562
|
+
} catch (u) {
|
|
1563
|
+
t.error(u);
|
|
1564
|
+
} finally {
|
|
1565
|
+
this.unsubscribe();
|
|
1566
|
+
}
|
|
1567
|
+
} : r.prototype._error, o._complete = i ? function() {
|
|
1568
|
+
try {
|
|
1569
|
+
i();
|
|
1570
|
+
} catch (l) {
|
|
1571
|
+
t.error(l);
|
|
1572
|
+
} finally {
|
|
1573
|
+
this.unsubscribe();
|
|
1574
|
+
}
|
|
1575
|
+
} : r.prototype._complete, o;
|
|
1576
|
+
}
|
|
1577
|
+
return e.prototype.unsubscribe = function() {
|
|
1578
|
+
var t;
|
|
1579
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
1580
|
+
var n = this.closed;
|
|
1581
|
+
r.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
|
|
1582
|
+
}
|
|
1583
|
+
}, e;
|
|
1584
|
+
}(pt), Xs = ar(function(r) {
|
|
1585
|
+
return function() {
|
|
1586
|
+
r(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
1587
|
+
};
|
|
1588
|
+
}), pr = function(r) {
|
|
1589
|
+
z(e, r);
|
|
1590
|
+
function e() {
|
|
1591
|
+
var t = r.call(this) || this;
|
|
1592
|
+
return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
|
|
1593
|
+
}
|
|
1594
|
+
return e.prototype.lift = function(t) {
|
|
1595
|
+
var n = new qt(this, this);
|
|
1596
|
+
return n.operator = t, n;
|
|
1597
|
+
}, e.prototype._throwIfClosed = function() {
|
|
1598
|
+
if (this.closed)
|
|
1599
|
+
throw new Xs();
|
|
1600
|
+
}, e.prototype.next = function(t) {
|
|
1601
|
+
var n = this;
|
|
1602
|
+
Se(function() {
|
|
1603
|
+
var i, s;
|
|
1604
|
+
if (n._throwIfClosed(), !n.isStopped) {
|
|
1605
|
+
n.currentObservers || (n.currentObservers = Array.from(n.observers));
|
|
1606
|
+
try {
|
|
1607
|
+
for (var a = Ke(n.currentObservers), c = a.next(); !c.done; c = a.next()) {
|
|
1608
|
+
var o = c.value;
|
|
1609
|
+
o.next(t);
|
|
1610
|
+
}
|
|
1611
|
+
} catch (l) {
|
|
1612
|
+
i = { error: l };
|
|
1613
|
+
} finally {
|
|
1614
|
+
try {
|
|
1615
|
+
c && !c.done && (s = a.return) && s.call(a);
|
|
1616
|
+
} finally {
|
|
1617
|
+
if (i)
|
|
1618
|
+
throw i.error;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1623
|
+
}, e.prototype.error = function(t) {
|
|
1624
|
+
var n = this;
|
|
1625
|
+
Se(function() {
|
|
1626
|
+
if (n._throwIfClosed(), !n.isStopped) {
|
|
1627
|
+
n.hasError = n.isStopped = !0, n.thrownError = t;
|
|
1628
|
+
for (var i = n.observers; i.length; )
|
|
1629
|
+
i.shift().error(t);
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
}, e.prototype.complete = function() {
|
|
1633
|
+
var t = this;
|
|
1634
|
+
Se(function() {
|
|
1635
|
+
if (t._throwIfClosed(), !t.isStopped) {
|
|
1636
|
+
t.isStopped = !0;
|
|
1637
|
+
for (var n = t.observers; n.length; )
|
|
1638
|
+
n.shift().complete();
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
}, e.prototype.unsubscribe = function() {
|
|
1642
|
+
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
1643
|
+
}, Object.defineProperty(e.prototype, "observed", {
|
|
1644
|
+
get: function() {
|
|
1645
|
+
var t;
|
|
1646
|
+
return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0;
|
|
1647
|
+
},
|
|
1648
|
+
enumerable: !1,
|
|
1649
|
+
configurable: !0
|
|
1650
|
+
}), e.prototype._trySubscribe = function(t) {
|
|
1651
|
+
return this._throwIfClosed(), r.prototype._trySubscribe.call(this, t);
|
|
1652
|
+
}, e.prototype._subscribe = function(t) {
|
|
1653
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
|
|
1654
|
+
}, e.prototype._innerSubscribe = function(t) {
|
|
1655
|
+
var n = this, i = this, s = i.hasError, a = i.isStopped, c = i.observers;
|
|
1656
|
+
return s || a ? lr : (this.currentObservers = null, c.push(t), new ge(function() {
|
|
1657
|
+
n.currentObservers = null, Ae(c, t);
|
|
1658
|
+
}));
|
|
1659
|
+
}, e.prototype._checkFinalizedStatuses = function(t) {
|
|
1660
|
+
var n = this, i = n.hasError, s = n.thrownError, a = n.isStopped;
|
|
1661
|
+
i ? t.error(s) : a && t.complete();
|
|
1662
|
+
}, e.prototype.asObservable = function() {
|
|
1663
|
+
var t = new Te();
|
|
1664
|
+
return t.source = this, t;
|
|
1665
|
+
}, e.create = function(t, n) {
|
|
1666
|
+
return new qt(t, n);
|
|
1667
|
+
}, e;
|
|
1668
|
+
}(Te), qt = function(r) {
|
|
1669
|
+
z(e, r);
|
|
1670
|
+
function e(t, n) {
|
|
1671
|
+
var i = r.call(this) || this;
|
|
1672
|
+
return i.destination = t, i.source = n, i;
|
|
1673
|
+
}
|
|
1674
|
+
return e.prototype.next = function(t) {
|
|
1675
|
+
var n, i;
|
|
1676
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || i === void 0 || i.call(n, t);
|
|
1677
|
+
}, e.prototype.error = function(t) {
|
|
1678
|
+
var n, i;
|
|
1679
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || i === void 0 || i.call(n, t);
|
|
1680
|
+
}, e.prototype.complete = function() {
|
|
1681
|
+
var t, n;
|
|
1682
|
+
(n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
|
|
1683
|
+
}, e.prototype._subscribe = function(t) {
|
|
1684
|
+
var n, i;
|
|
1685
|
+
return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && i !== void 0 ? i : lr;
|
|
1686
|
+
}, e;
|
|
1687
|
+
}(pr), Bs = {
|
|
1688
|
+
now: function() {
|
|
1689
|
+
return Date.now();
|
|
1690
|
+
},
|
|
1691
|
+
delegate: void 0
|
|
1692
|
+
}, qs = function(r) {
|
|
1693
|
+
z(e, r);
|
|
1694
|
+
function e(t, n) {
|
|
1695
|
+
return r.call(this) || this;
|
|
1696
|
+
}
|
|
1697
|
+
return e.prototype.schedule = function(t, n) {
|
|
1698
|
+
return this;
|
|
1699
|
+
}, e;
|
|
1700
|
+
}(ge), et = {
|
|
1701
|
+
setInterval: function(r, e) {
|
|
1702
|
+
for (var t = [], n = 2; n < arguments.length; n++)
|
|
1703
|
+
t[n - 2] = arguments[n];
|
|
1704
|
+
var i = et.delegate;
|
|
1705
|
+
return i != null && i.setInterval ? i.setInterval.apply(i, fe([r, e], pe(t))) : setInterval.apply(void 0, fe([r, e], pe(t)));
|
|
1706
|
+
},
|
|
1707
|
+
clearInterval: function(r) {
|
|
1708
|
+
return clearInterval(r);
|
|
1709
|
+
},
|
|
1710
|
+
delegate: void 0
|
|
1711
|
+
}, Ys = function(r) {
|
|
1712
|
+
z(e, r);
|
|
1713
|
+
function e(t, n) {
|
|
1714
|
+
var i = r.call(this, t, n) || this;
|
|
1715
|
+
return i.scheduler = t, i.work = n, i.pending = !1, i;
|
|
1716
|
+
}
|
|
1717
|
+
return e.prototype.schedule = function(t, n) {
|
|
1718
|
+
var i;
|
|
1719
|
+
if (n === void 0 && (n = 0), this.closed)
|
|
1720
|
+
return this;
|
|
1721
|
+
this.state = t;
|
|
1722
|
+
var s = this.id, a = this.scheduler;
|
|
1723
|
+
return s != null && (this.id = this.recycleAsyncId(a, s, n)), this.pending = !0, this.delay = n, this.id = (i = this.id) !== null && i !== void 0 ? i : this.requestAsyncId(a, this.id, n), this;
|
|
1724
|
+
}, e.prototype.requestAsyncId = function(t, n, i) {
|
|
1725
|
+
return i === void 0 && (i = 0), et.setInterval(t.flush.bind(t, this), i);
|
|
1726
|
+
}, e.prototype.recycleAsyncId = function(t, n, i) {
|
|
1727
|
+
if (i === void 0 && (i = 0), i != null && this.delay === i && this.pending === !1)
|
|
1728
|
+
return n;
|
|
1729
|
+
n != null && et.clearInterval(n);
|
|
1730
|
+
}, e.prototype.execute = function(t, n) {
|
|
1731
|
+
if (this.closed)
|
|
1732
|
+
return new Error("executing a cancelled action");
|
|
1733
|
+
this.pending = !1;
|
|
1734
|
+
var i = this._execute(t, n);
|
|
1735
|
+
if (i)
|
|
1736
|
+
return i;
|
|
1737
|
+
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
1738
|
+
}, e.prototype._execute = function(t, n) {
|
|
1739
|
+
var i = !1, s;
|
|
1740
|
+
try {
|
|
1741
|
+
this.work(t);
|
|
1742
|
+
} catch (a) {
|
|
1743
|
+
i = !0, s = a || new Error("Scheduled action threw falsy error");
|
|
1744
|
+
}
|
|
1745
|
+
if (i)
|
|
1746
|
+
return this.unsubscribe(), s;
|
|
1747
|
+
}, e.prototype.unsubscribe = function() {
|
|
1748
|
+
if (!this.closed) {
|
|
1749
|
+
var t = this, n = t.id, i = t.scheduler, s = i.actions;
|
|
1750
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, Ae(s, this), n != null && (this.id = this.recycleAsyncId(i, n, null)), this.delay = null, r.prototype.unsubscribe.call(this);
|
|
1751
|
+
}
|
|
1752
|
+
}, e;
|
|
1753
|
+
}(qs), Yt = function() {
|
|
1754
|
+
function r(e, t) {
|
|
1755
|
+
t === void 0 && (t = r.now), this.schedulerActionCtor = e, this.now = t;
|
|
1756
|
+
}
|
|
1757
|
+
return r.prototype.schedule = function(e, t, n) {
|
|
1758
|
+
return t === void 0 && (t = 0), new this.schedulerActionCtor(this, e).schedule(n, t);
|
|
1759
|
+
}, r.now = Bs.now, r;
|
|
1760
|
+
}(), zs = function(r) {
|
|
1761
|
+
z(e, r);
|
|
1762
|
+
function e(t, n) {
|
|
1763
|
+
n === void 0 && (n = Yt.now);
|
|
1764
|
+
var i = r.call(this, t, n) || this;
|
|
1765
|
+
return i.actions = [], i._active = !1, i;
|
|
1766
|
+
}
|
|
1767
|
+
return e.prototype.flush = function(t) {
|
|
1768
|
+
var n = this.actions;
|
|
1769
|
+
if (this._active) {
|
|
1770
|
+
n.push(t);
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
var i;
|
|
1774
|
+
this._active = !0;
|
|
1775
|
+
do
|
|
1776
|
+
if (i = t.execute(t.state, t.delay))
|
|
1777
|
+
break;
|
|
1778
|
+
while (t = n.shift());
|
|
1779
|
+
if (this._active = !1, i) {
|
|
1780
|
+
for (; t = n.shift(); )
|
|
1781
|
+
t.unsubscribe();
|
|
1782
|
+
throw i;
|
|
1783
|
+
}
|
|
1784
|
+
}, e;
|
|
1785
|
+
}(Yt), Qs = new zs(Ys), Ws = Qs, Js = new Te(function(r) {
|
|
1786
|
+
return r.complete();
|
|
1787
|
+
});
|
|
1788
|
+
function Ks(r) {
|
|
1789
|
+
return r && U(r.schedule);
|
|
1790
|
+
}
|
|
1791
|
+
function Zs(r) {
|
|
1792
|
+
return r instanceof Date && !isNaN(r);
|
|
1793
|
+
}
|
|
1794
|
+
function T(r, e) {
|
|
1795
|
+
return De(function(t, n) {
|
|
1796
|
+
var i = 0;
|
|
1797
|
+
t.subscribe(Ue(n, function(s) {
|
|
1798
|
+
n.next(r.call(e, s, i++));
|
|
1799
|
+
}));
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
function eo(r, e, t) {
|
|
1803
|
+
r === void 0 && (r = 0), t === void 0 && (t = Ws);
|
|
1804
|
+
var n = -1;
|
|
1805
|
+
return e != null && (Ks(e) ? t = e : n = e), new Te(function(i) {
|
|
1806
|
+
var s = Zs(r) ? +r - t.now() : r;
|
|
1807
|
+
s < 0 && (s = 0);
|
|
1808
|
+
var a = 0;
|
|
1809
|
+
return t.schedule(function() {
|
|
1810
|
+
i.closed || (i.next(a++), 0 <= n ? this.schedule(void 0, n) : i.complete());
|
|
1811
|
+
}, s);
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
function M(r, e) {
|
|
1815
|
+
return De(function(t, n) {
|
|
1816
|
+
var i = 0;
|
|
1817
|
+
t.subscribe(Ue(n, function(s) {
|
|
1818
|
+
return r.call(e, s, i++) && n.next(s);
|
|
1819
|
+
}));
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
function V(r) {
|
|
1823
|
+
return r <= 0 ? function() {
|
|
1824
|
+
return Js;
|
|
1825
|
+
} : De(function(e, t) {
|
|
1826
|
+
var n = 0;
|
|
1827
|
+
e.subscribe(Ue(t, function(i) {
|
|
1828
|
+
++n <= r && (t.next(i), r <= n && t.complete());
|
|
1829
|
+
}));
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
function P(r, e, t) {
|
|
1833
|
+
var n = U(r) || e || t ? { next: r, error: e, complete: t } : r;
|
|
1834
|
+
return n ? De(function(i, s) {
|
|
1835
|
+
var a;
|
|
1836
|
+
(a = n.subscribe) === null || a === void 0 || a.call(n);
|
|
1837
|
+
var c = !0;
|
|
1838
|
+
i.subscribe(Ue(s, function(o) {
|
|
1839
|
+
var l;
|
|
1840
|
+
(l = n.next) === null || l === void 0 || l.call(n, o), s.next(o);
|
|
1841
|
+
}, function() {
|
|
1842
|
+
var o;
|
|
1843
|
+
c = !1, (o = n.complete) === null || o === void 0 || o.call(n), s.complete();
|
|
1844
|
+
}, function(o) {
|
|
1845
|
+
var l;
|
|
1846
|
+
c = !1, (l = n.error) === null || l === void 0 || l.call(n, o), s.error(o);
|
|
1847
|
+
}, function() {
|
|
1848
|
+
var o, l;
|
|
1849
|
+
c && ((o = n.unsubscribe) === null || o === void 0 || o.call(n)), (l = n.finalize) === null || l === void 0 || l.call(n);
|
|
1850
|
+
}));
|
|
1851
|
+
}) : hr;
|
|
1852
|
+
}
|
|
1853
|
+
class Z {
|
|
1854
|
+
static gte(e, t) {
|
|
1855
|
+
return t === void 0 ? (n) => Z.gte(n, e) ? n : !1 : C.gte(C.coerce(e), C.coerce(t));
|
|
1856
|
+
}
|
|
1857
|
+
static lte(e, t) {
|
|
1858
|
+
return t === void 0 ? (n) => Z.lte(n, e) ? n : !1 : C.lte(C.coerce(e), C.coerce(t));
|
|
1859
|
+
}
|
|
1860
|
+
static gt(e, t) {
|
|
1861
|
+
return t === void 0 ? (n) => Z.gt(n, e) ? n : !1 : C.gt(C.coerce(e), C.coerce(t));
|
|
1862
|
+
}
|
|
1863
|
+
static lt(e, t) {
|
|
1864
|
+
return t === void 0 ? (n) => Z.lt(n, e) ? n : !1 : C.lt(C.coerce(e), C.coerce(t));
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Check if the two {@link IpcProtocolVersion} values are logically (==) equal.
|
|
1868
|
+
*
|
|
1869
|
+
* @param v1 - First version to compare
|
|
1870
|
+
* @param v2 - Second version to compare
|
|
1871
|
+
* @returns Return true if the versions are logically (==) equal.
|
|
1872
|
+
*/
|
|
1873
|
+
static eq(e, t) {
|
|
1874
|
+
return C.eq(C.coerce(e), C.coerce(t));
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Check if the two {@link IpcProtocolVersion} values are not equal.
|
|
1878
|
+
*
|
|
1879
|
+
* @param v1 - First version to compare
|
|
1880
|
+
* @param v2 - Second version to compare
|
|
1881
|
+
* @returns Return true if the versions are not equal.
|
|
1882
|
+
*/
|
|
1883
|
+
static neq(e, t) {
|
|
1884
|
+
return C.neq(C.coerce(e), C.coerce(t));
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Compare two {@link IpcProtocolVersion} values.
|
|
1888
|
+
*
|
|
1889
|
+
* @param v1 - First version to compare
|
|
1890
|
+
* @param v2 - Second version to compare
|
|
1891
|
+
* @returns Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in
|
|
1892
|
+
* ascending order if passed to Array.sort().
|
|
1893
|
+
*/
|
|
1894
|
+
static compare(e, t) {
|
|
1895
|
+
return C.compare(C.coerce(e), C.coerce(t));
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
const zt = "1.0";
|
|
1899
|
+
class to {
|
|
1900
|
+
/**
|
|
1901
|
+
* Create a new instance of the {@link IpcHelper | IPC Protocol Helper}.
|
|
1902
|
+
*
|
|
1903
|
+
* @remarks
|
|
1904
|
+
* Ideally, you should always have only one instance of the helper created at any point.
|
|
1905
|
+
*
|
|
1906
|
+
* @param supportedVersions - An array of supported protocol versions to choose from
|
|
1907
|
+
* @param logService - An instance of a logging service or utility
|
|
1908
|
+
*/
|
|
1909
|
+
constructor(e, t) {
|
|
1910
|
+
if (q(this, "negotiatedProtocolVersion"), q(this, "currentContext"), q(this, "incomingMessages$"), q(this, "inIframe", !1), q(this, "embeddedResult"), q(this, "iframePort1"), q(this, "iframePort2"), this.supportedVersions = e, this.logService = t, this.incomingMessages$ = new pr(), this.supportedVersions = e.filter(Z.gte(zt)), !this.supportedVersions.length)
|
|
1911
|
+
throw new Vt(e, zt);
|
|
1912
|
+
this.negotiatedProtocolVersion = this.supportedVersions[0], this.embeddedResult = null, this.iframePort2 = null;
|
|
1913
|
+
}
|
|
1914
|
+
get parent() {
|
|
1915
|
+
return window.parent;
|
|
1916
|
+
}
|
|
1917
|
+
get self() {
|
|
1918
|
+
return window.self;
|
|
1919
|
+
}
|
|
1920
|
+
get frameElement() {
|
|
1921
|
+
return window.frameElement;
|
|
1922
|
+
}
|
|
1923
|
+
// only used by remote party, not used locally
|
|
1924
|
+
// @ts-expect-error
|
|
1925
|
+
get port1() {
|
|
1926
|
+
var e, t;
|
|
1927
|
+
return this.inIframe ? this.iframePort1 : (t = (e = window.Acrobits) == null ? void 0 : e.messageChannel) == null ? void 0 : t.port1;
|
|
1928
|
+
}
|
|
1929
|
+
get port2() {
|
|
1930
|
+
var e, t, n, i;
|
|
1931
|
+
if (this.inIframe) {
|
|
1932
|
+
if (!this.iframePort2)
|
|
1933
|
+
throw new kt("port2");
|
|
1934
|
+
return this.iframePort2;
|
|
1935
|
+
} else {
|
|
1936
|
+
if (!((t = (e = window.Acrobits) == null ? void 0 : e.messageChannel) != null && t.port2))
|
|
1937
|
+
throw new kt("port2");
|
|
1938
|
+
return (i = (n = window.Acrobits) == null ? void 0 : n.messageChannel) == null ? void 0 : i.port2;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* Determines if the app is embedded in a Host app like WebRTC or native CSP clients.
|
|
1943
|
+
*
|
|
1944
|
+
* @returns Observable with the {@link AppContext} the app is running under. Emits once.
|
|
1945
|
+
*/
|
|
1946
|
+
determineContext() {
|
|
1947
|
+
return eo(1e3).pipe(
|
|
1948
|
+
T(() => (this.isEmbedded() ? this.currentContext = "user" : this.currentContext = "guest", this.currentContext)),
|
|
1949
|
+
V(1)
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Opens the IPC Bridge by sending the {@link HelloMessage} to the host application to initiate
|
|
1954
|
+
* handshake and returns an Observable that emits once with the {@link HelloMessageReply}.
|
|
1955
|
+
*
|
|
1956
|
+
* @returns Observable with a {@link HelloMessageReply} instance. Emits once.
|
|
1957
|
+
*/
|
|
1958
|
+
openBridge() {
|
|
1959
|
+
if (!this.isEmbedded())
|
|
1960
|
+
throw new N(this.currentContext);
|
|
1961
|
+
const e = "HELLO", t = this.createMessage(e);
|
|
1962
|
+
t.protocolVersions = this.supportedVersions, this.logCreated(e, t);
|
|
1963
|
+
const n = this.incomingMessages$.pipe(
|
|
1964
|
+
M((i) => i.type === e && i.replyTo === t.id),
|
|
1965
|
+
T((i) => i),
|
|
1966
|
+
P(this.logReceived(e)),
|
|
1967
|
+
T((i) => {
|
|
1968
|
+
if (this.supportedVersions.some(Z.gt(i.protocolVersion)))
|
|
1969
|
+
throw new Vt(i.protocolVersion, this.supportedVersions[0]);
|
|
1970
|
+
return i;
|
|
1971
|
+
}),
|
|
1972
|
+
P((i) => {
|
|
1973
|
+
this.negotiatedProtocolVersion = i.protocolVersion, this.logService.info(
|
|
1974
|
+
`[IPC] Negotiated IPC Protocol Version: ${this.negotiatedProtocolVersion}`
|
|
1975
|
+
);
|
|
1976
|
+
}),
|
|
1977
|
+
V(1)
|
|
1978
|
+
);
|
|
1979
|
+
return this.logService.debug(`Created ${e} Reply handler`), this.inIframe ? this.createIframeChannel().then(() => this.finishIpcSetup(t)) : this.finishIpcSetup(t), n;
|
|
1980
|
+
}
|
|
1981
|
+
/**
|
|
1982
|
+
* Request an SSO Token from the Host app to authenticate the current user and make further API
|
|
1983
|
+
* requests on their behalf.
|
|
1984
|
+
*
|
|
1985
|
+
* @returns Observable with a {@link TokenMessageReply} instance containing the SSO Token. Emits
|
|
1986
|
+
* once.
|
|
1987
|
+
*/
|
|
1988
|
+
requestSSOToken() {
|
|
1989
|
+
if (!this.isEmbedded())
|
|
1990
|
+
throw new N(this.currentContext);
|
|
1991
|
+
const e = "TOKEN", t = this.createMessage(e);
|
|
1992
|
+
this.logCreated(e, t);
|
|
1993
|
+
const n = this.incomingMessages$.pipe(
|
|
1994
|
+
M((i) => i.type === e && i.replyTo === t.id),
|
|
1995
|
+
T((i) => i),
|
|
1996
|
+
P(this.logReceived(e)),
|
|
1997
|
+
V(1)
|
|
1998
|
+
);
|
|
1999
|
+
return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(t), this.logSent(e, t), n;
|
|
2000
|
+
}
|
|
2001
|
+
/**
|
|
2002
|
+
* Sends the {@link JoiningRoomMessage} lifecycle message to the Host application based on the
|
|
2003
|
+
* parameters provided.
|
|
2004
|
+
*
|
|
2005
|
+
* @remarks
|
|
2006
|
+
* This message should always be sent whenever joining a conference. The host app can use
|
|
2007
|
+
* information provided by the {@link JoiningRoomMessageParams} fields to properly setup it's own
|
|
2008
|
+
* state and context if needed.
|
|
2009
|
+
*
|
|
2010
|
+
* @param params - Parameters object for the {@link JoiningRoomMessage} message.
|
|
2011
|
+
*
|
|
2012
|
+
* @returns This method returns void.
|
|
2013
|
+
*/
|
|
2014
|
+
sendJoiningRoomMessage(e) {
|
|
2015
|
+
if (!this.isEmbedded())
|
|
2016
|
+
throw new N(this.currentContext);
|
|
2017
|
+
const {
|
|
2018
|
+
roomName: t,
|
|
2019
|
+
roomInvite: n,
|
|
2020
|
+
displayName: i,
|
|
2021
|
+
jwtToken: s,
|
|
2022
|
+
serverUrl: a,
|
|
2023
|
+
region: c,
|
|
2024
|
+
joinMicMuted: o,
|
|
2025
|
+
joinWithoutCamera: l
|
|
2026
|
+
} = e, u = "JOINING ROOM", p = this.createMessage(u, !1);
|
|
2027
|
+
p.roomName = t, p.jwtToken = s, p.serverUrl = a, p.region = c, p.roomInvite = n, p.joinMicMuted = o ?? !1, p.joinWithoutCamera = l ?? !1, p.displayName = i, this.logCreated(u, p), this.port2.postMessage(p), this.logSent(u, p);
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* Sends a {@link LeavingRoomMessage} lifecycle message to the Host app.
|
|
2031
|
+
*
|
|
2032
|
+
* @remarks
|
|
2033
|
+
* This message should always be sent whenever leaving a conference so the host app can manage
|
|
2034
|
+
* it's state and context properly.
|
|
2035
|
+
*
|
|
2036
|
+
* @param roomName - The name of the room or Meeting ID we are leaving
|
|
2037
|
+
*
|
|
2038
|
+
* @returns This method returns void.
|
|
2039
|
+
*/
|
|
2040
|
+
sendLeavingRoomMessage(e) {
|
|
2041
|
+
if (!this.isEmbedded())
|
|
2042
|
+
throw new N(this.currentContext);
|
|
2043
|
+
const t = "LEAVING ROOM", n = this.createMessage(t, !1);
|
|
2044
|
+
n.roomName = e, this.logCreated(t, n), this.port2.postMessage(n), this.logSent(t, n);
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Setup listener for {@link JoinRoomMessage}, which can be sent by a host app to ask the client
|
|
2048
|
+
* to join the specified room or meeting.
|
|
2049
|
+
*
|
|
2050
|
+
* @remarks
|
|
2051
|
+
* The client app still needs to follow the standard workflow for joining a conference, including
|
|
2052
|
+
* requesting an SSO Token and then sending the {@link JoiningRoomMessage} when joining the
|
|
2053
|
+
* conference.
|
|
2054
|
+
*
|
|
2055
|
+
* @example
|
|
2056
|
+
* Here is an example of how a listener can be setup:
|
|
2057
|
+
*
|
|
2058
|
+
* ```ts
|
|
2059
|
+
* const ipcHelper = new IpcHelper(['1.0'], console);
|
|
2060
|
+
*
|
|
2061
|
+
* const joinRoomSubscription = ipcHelper.onJoinRoomMessage().subscribe((msg) => {
|
|
2062
|
+
* // your logic for handling the message goes here
|
|
2063
|
+
* });
|
|
2064
|
+
*
|
|
2065
|
+
* // don't forget to unsubscribe when you're cleaning up
|
|
2066
|
+
* joinRoomSubscription.unsubscribe();
|
|
2067
|
+
* ```
|
|
2068
|
+
*
|
|
2069
|
+
* @returns An Observable that emits whenever {@link JoinRoomMessage} is received so it can be
|
|
2070
|
+
* subscribed to indefinitely.
|
|
2071
|
+
*/
|
|
2072
|
+
onJoinRoomMessage() {
|
|
2073
|
+
if (!this.isEmbedded())
|
|
2074
|
+
throw new N(this.currentContext);
|
|
2075
|
+
const e = "JOIN ROOM";
|
|
2076
|
+
return this.incomingMessages$.pipe(
|
|
2077
|
+
M((t) => t.type === e && t.target === "client"),
|
|
2078
|
+
T((t) => t),
|
|
2079
|
+
P(this.logReceived(e)),
|
|
2080
|
+
T((t) => t)
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
/**
|
|
2084
|
+
* Setup listener for {@link LeaveRoomMessage}, which can be sent by a host app to ask the client
|
|
2085
|
+
* to leave the current room or meeting.
|
|
2086
|
+
*
|
|
2087
|
+
* @remarks
|
|
2088
|
+
* The client app still needs to follow the standard workflow for leaving a conference, including
|
|
2089
|
+
* sending the {@link LeavingRoomMessage} when leaving the conference.
|
|
2090
|
+
*
|
|
2091
|
+
* @example
|
|
2092
|
+
* Here is an example of how a listener can be setup:
|
|
2093
|
+
*
|
|
2094
|
+
* ```ts
|
|
2095
|
+
* const ipcHelper = new IpcHelper(['1.0'], console);
|
|
2096
|
+
*
|
|
2097
|
+
* const leaveRoomSubscription = ipcHelper.onLeaveRoomMessage().subscribe((msg) => {
|
|
2098
|
+
* // your logic for handling the message goes here
|
|
2099
|
+
* });
|
|
2100
|
+
*
|
|
2101
|
+
* // don't forget to unsubscribe when you're cleaning up
|
|
2102
|
+
* leaveRoomSubscription.unsubscribe();
|
|
2103
|
+
* ```
|
|
2104
|
+
*
|
|
2105
|
+
* @returns An Observable that emits whenever {@link LeavingRoomMessage} is received so it can be
|
|
2106
|
+
* subscribed to indefinitely.
|
|
2107
|
+
*/
|
|
2108
|
+
onLeaveRoomMessage() {
|
|
2109
|
+
if (!this.isEmbedded())
|
|
2110
|
+
throw new N(this.currentContext);
|
|
2111
|
+
const e = "LEAVE ROOM";
|
|
2112
|
+
return this.incomingMessages$.pipe(
|
|
2113
|
+
M((t) => t.type === e && t.target === "client"),
|
|
2114
|
+
T((t) => t),
|
|
2115
|
+
P(this.logReceived(e)),
|
|
2116
|
+
T((t) => t)
|
|
2117
|
+
);
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Setup listener for {@link ConfigMessage}, which is be sent by a host app whenever there is
|
|
2121
|
+
* an update to the user preferences or configuration (e.g. new default video camera).
|
|
2122
|
+
*
|
|
2123
|
+
* @remarks
|
|
2124
|
+
* Ideally, the client app should honor the user preferences received via {@link ConfigMessage},
|
|
2125
|
+
* however if the client app has it's own preferences for similar options as well, then they
|
|
2126
|
+
* should take priority.
|
|
2127
|
+
*
|
|
2128
|
+
* @example
|
|
2129
|
+
* Here is an example of how a listener can be setup:
|
|
2130
|
+
*
|
|
2131
|
+
* ```ts
|
|
2132
|
+
* const ipcHelper = new IpcHelper(['1.0'], console);
|
|
2133
|
+
*
|
|
2134
|
+
* const configSubscription = ipcHelper.onConfigMessage().subscribe((msg) => {
|
|
2135
|
+
* // your logic for handling the configuration goes here
|
|
2136
|
+
* });
|
|
2137
|
+
*
|
|
2138
|
+
* // don't forget to unsubscribe when you're cleaning up
|
|
2139
|
+
* configSubscription.unsubscribe();
|
|
2140
|
+
* ```
|
|
2141
|
+
*
|
|
2142
|
+
* @returns An Observable that emits whenever {@link ConfigMessage} is received so it can be
|
|
2143
|
+
* subscribed to indefinitely.
|
|
2144
|
+
*/
|
|
2145
|
+
onConfigMessage() {
|
|
2146
|
+
if (!this.isEmbedded())
|
|
2147
|
+
throw new N(this.currentContext);
|
|
2148
|
+
const e = "CONFIG";
|
|
2149
|
+
return this.incomingMessages$.pipe(
|
|
2150
|
+
M((t) => t.type === e && t.target === "client"),
|
|
2151
|
+
T((t) => t),
|
|
2152
|
+
P(this.logReceived(e)),
|
|
2153
|
+
T((t) => ({
|
|
2154
|
+
preferredCameraType: t.preferredCameraType,
|
|
2155
|
+
preferredMicType: t.preferredMicType,
|
|
2156
|
+
preferredOutputType: t.preferredOutputType,
|
|
2157
|
+
preferredCameraDeviceLabel: t.preferredCameraDeviceLabel,
|
|
2158
|
+
preferredMicDeviceLabel: t.preferredMicDeviceLabel,
|
|
2159
|
+
preferredOutputDeviceLabel: t.preferredOutputDeviceLabel,
|
|
2160
|
+
performanceProfile: t.performanceProfile,
|
|
2161
|
+
cloudUsername: t.cloudUsername,
|
|
2162
|
+
configuredOAuthProviders: t.configuredOAuthProviders,
|
|
2163
|
+
locales: t.locales ? [...t.locales] : []
|
|
2164
|
+
}))
|
|
2165
|
+
);
|
|
2166
|
+
}
|
|
2167
|
+
sendScreenshareSourceMessage(e) {
|
|
2168
|
+
if (!this.isEmbedded())
|
|
2169
|
+
throw new N(this.currentContext);
|
|
2170
|
+
const t = "SCREENSHARE SOURCE", n = this.createMessage(t);
|
|
2171
|
+
n.sourceTypes = e, this.logCreated(t, n);
|
|
2172
|
+
const i = this.incomingMessages$.pipe(
|
|
2173
|
+
M((s) => s.type === t && s.replyTo === n.id),
|
|
2174
|
+
T((s) => s),
|
|
2175
|
+
P(this.logReceived(t)),
|
|
2176
|
+
T((s) => s),
|
|
2177
|
+
V(1)
|
|
2178
|
+
);
|
|
2179
|
+
return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(n), this.logSent(t, n), i;
|
|
2180
|
+
}
|
|
2181
|
+
layoutChange(e, t, n) {
|
|
2182
|
+
if (!this.isEmbedded())
|
|
2183
|
+
throw new N(this.currentContext);
|
|
2184
|
+
const i = "LAYOUT CHANGE";
|
|
2185
|
+
let s, a;
|
|
2186
|
+
if (t && n ? (s = this.createMessage(i, !1, n), s.result = t) : (s = this.createMessage(i), a = this.incomingMessages$.pipe(
|
|
2187
|
+
M((c) => c.type === i && c.replyTo === s.id),
|
|
2188
|
+
T((c) => c),
|
|
2189
|
+
P(this.logReceived(i)),
|
|
2190
|
+
T((c) => c),
|
|
2191
|
+
V(1)
|
|
2192
|
+
), this.logService.debug(`Created ${i} Reply handler`)), s.layout = e, this.logCreated(i, s), this.port2.postMessage(s), this.logSent(i, s), a)
|
|
2193
|
+
return a;
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Setup listener for {@link LayoutChangeMessage}, which can be sent by a host app if it needs to
|
|
2197
|
+
* request a layout change on the client.
|
|
2198
|
+
*
|
|
2199
|
+
* @remarks
|
|
2200
|
+
* In some scenarios, a `host` app can request a layout change from the client, so this listener
|
|
2201
|
+
* should be setup to support that use case.
|
|
2202
|
+
*
|
|
2203
|
+
* Whenever such a request is received, the `client` app **SHOULD** respond with a
|
|
2204
|
+
* {@link LayoutChangeMessageReply} to acknowledge if it is ready for a change.
|
|
2205
|
+
*
|
|
2206
|
+
* @example
|
|
2207
|
+
* Here is an example of how a listener can be setup:
|
|
2208
|
+
*
|
|
2209
|
+
* ```ts
|
|
2210
|
+
* const ipcHelper = new IpcHelper(['1.0'], console);
|
|
2211
|
+
*
|
|
2212
|
+
* const layoutChangeSubscription = ipcHelper.onLayoutChangeMessage().subscribe((msg) => {
|
|
2213
|
+
* // your logic for handling the request goes here
|
|
2214
|
+
*
|
|
2215
|
+
* // once you're ready to acknowledge, let the `host` app know
|
|
2216
|
+
* ipcHelper.layoutChange(msg.layout, result, msg.id);
|
|
2217
|
+
* });
|
|
2218
|
+
*
|
|
2219
|
+
* // don't forget to unsubscribe when you're cleaning up
|
|
2220
|
+
* layoutChangeSubscription.unsubscribe();
|
|
2221
|
+
* ```
|
|
2222
|
+
*
|
|
2223
|
+
* @returns An Observable that emits whenever {@link LayoutChangeMessage} is received so it can be
|
|
2224
|
+
* subscribed to indefinitely.
|
|
2225
|
+
*/
|
|
2226
|
+
onLayoutChangeMessage() {
|
|
2227
|
+
if (!this.isEmbedded())
|
|
2228
|
+
throw new N(this.currentContext);
|
|
2229
|
+
const e = "LAYOUT CHANGE";
|
|
2230
|
+
return this.incomingMessages$.pipe(
|
|
2231
|
+
M((t) => t.type === e && t.target === "client" && t.replyTo === null),
|
|
2232
|
+
T((t) => t),
|
|
2233
|
+
P(this.logReceived(e)),
|
|
2234
|
+
T((t) => t)
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
requestOAuthToken(e) {
|
|
2238
|
+
if (!this.isEmbedded())
|
|
2239
|
+
throw new N(this.currentContext);
|
|
2240
|
+
Array.isArray(e) || (e = [e]);
|
|
2241
|
+
const t = "OAUTH TOKEN", n = this.createMessage(t);
|
|
2242
|
+
n.providerTypes = e, this.logCreated(t, n);
|
|
2243
|
+
const i = this.incomingMessages$.pipe(
|
|
2244
|
+
M((s) => s.type === t && s.replyTo === n.id),
|
|
2245
|
+
T((s) => s),
|
|
2246
|
+
P(this.logReceived(t)),
|
|
2247
|
+
V(1)
|
|
2248
|
+
);
|
|
2249
|
+
return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(n), this.logSent(t, n), i;
|
|
2250
|
+
}
|
|
2251
|
+
openUrl(e, t) {
|
|
2252
|
+
if (!this.isEmbedded())
|
|
2253
|
+
throw new N(this.currentContext);
|
|
2254
|
+
const n = "OPEN URL", i = this.createMessage(n, !1);
|
|
2255
|
+
i.url = e, i.data = t, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i);
|
|
2256
|
+
}
|
|
2257
|
+
selectContacts(e, t, n) {
|
|
2258
|
+
if (!this.isEmbedded())
|
|
2259
|
+
throw new N(this.currentContext);
|
|
2260
|
+
if (t === "group" && n === void 0)
|
|
2261
|
+
throw new $e(
|
|
2262
|
+
"currentContacts",
|
|
2263
|
+
n,
|
|
2264
|
+
"currentContacts is required for group streams"
|
|
2265
|
+
);
|
|
2266
|
+
if (t === "direct" && n !== void 0)
|
|
2267
|
+
throw new $e(
|
|
2268
|
+
"currentContacts",
|
|
2269
|
+
n,
|
|
2270
|
+
"currentContacts should not be passed for direct streams"
|
|
2271
|
+
);
|
|
2272
|
+
const i = "SELECT CONTACTS", s = this.createMessage(i, !0);
|
|
2273
|
+
s.streamType = t, s.streamId = e, s.currentContacts = n, this.logCreated(i, s);
|
|
2274
|
+
const a = this.incomingMessages$.pipe(
|
|
2275
|
+
M((c) => c.type === i && c.replyTo === s.id),
|
|
2276
|
+
P(this.logReceived(i)),
|
|
2277
|
+
// validate if `streamId` is the same as we sent
|
|
2278
|
+
T((c) => {
|
|
2279
|
+
const o = c;
|
|
2280
|
+
if (o.streamId !== e)
|
|
2281
|
+
throw new xs(o.streamId, e);
|
|
2282
|
+
return t === "direct" && o.contacts.length > 1 && (o.contacts = [o.contacts[0]]), o;
|
|
2283
|
+
}),
|
|
2284
|
+
V(1)
|
|
2285
|
+
);
|
|
2286
|
+
return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(s), this.logSent(i, s), a;
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Request detailed contact information for the given Cloud usernames.
|
|
2290
|
+
*
|
|
2291
|
+
* @param contacts - Cloud usernames for which we need detailed contact information
|
|
2292
|
+
*
|
|
2293
|
+
* @returns Observable with a {@link MatchContactsMessageReply} instance containing the requested
|
|
2294
|
+
* {@link ContactItem} information. Emits once.
|
|
2295
|
+
*/
|
|
2296
|
+
matchContacts(e) {
|
|
2297
|
+
if (!this.isEmbedded())
|
|
2298
|
+
throw new N(this.currentContext);
|
|
2299
|
+
if (!e.length)
|
|
2300
|
+
throw new $e("contacts", e, "At least one contact is required");
|
|
2301
|
+
const t = "MATCH CONTACTS", n = this.createMessage(t);
|
|
2302
|
+
n.contacts = [...e], this.logCreated(t, n);
|
|
2303
|
+
const i = this.incomingMessages$.pipe(
|
|
2304
|
+
M((s) => s.type === t && s.replyTo === n.id),
|
|
2305
|
+
P(this.logReceived(t)),
|
|
2306
|
+
T((s) => s),
|
|
2307
|
+
V(1)
|
|
2308
|
+
);
|
|
2309
|
+
return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(n), this.logSent(t, n), i;
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Setup listener for {@link PushMessageMessage}, which can be sent by a Host app to forward an
|
|
2313
|
+
* an Acrobits Messaging message received via push notification to the Client app.
|
|
2314
|
+
*
|
|
2315
|
+
* @remarks
|
|
2316
|
+
* The format of the {@link PushMessagePayload} SHOULD be kept the same as the one received from
|
|
2317
|
+
* the push notification. The Client app can then use the payload to handle the message as needed.
|
|
2318
|
+
*
|
|
2319
|
+
* @example
|
|
2320
|
+
* Here is an example of how a listener can be setup:
|
|
2321
|
+
*
|
|
2322
|
+
* ```ts
|
|
2323
|
+
* const ipcHelper = new IpcHelper(['1.0'], console);
|
|
2324
|
+
*
|
|
2325
|
+
* const pushMessageSubscription = ipcHelper.onPushMessageMessage().subscribe((msg) => {
|
|
2326
|
+
* // your logic for handling the incoming push message goes here
|
|
2327
|
+
* });
|
|
2328
|
+
*
|
|
2329
|
+
* // don't forget to unsubscribe when you're cleaning up
|
|
2330
|
+
* pushMessageSubscription.unsubscribe();
|
|
2331
|
+
* ```
|
|
2332
|
+
*
|
|
2333
|
+
* @returns An observable that emits whenever {@link PushMessageMessage} is received so it can be
|
|
2334
|
+
* subscribed to indefinitely.
|
|
2335
|
+
*/
|
|
2336
|
+
onPushMessageMessage() {
|
|
2337
|
+
if (!this.isEmbedded())
|
|
2338
|
+
throw new N(this.currentContext);
|
|
2339
|
+
const e = "PUSH MESSAGE";
|
|
2340
|
+
return this.incomingMessages$.pipe(
|
|
2341
|
+
M((t) => t.type === e && t.target === "client"),
|
|
2342
|
+
T((t) => t),
|
|
2343
|
+
P(this.logReceived(e))
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* Sends a {@link PushTokenMessage} to the Host app, to request the Push Token for the current
|
|
2348
|
+
* device.
|
|
2349
|
+
*
|
|
2350
|
+
* @remarks
|
|
2351
|
+
* The Host app should reply with a {@link PushTokenMessageReply} containing the Push Token.
|
|
2352
|
+
*
|
|
2353
|
+
* @returns Observable with a {@link PushTokenMessageReply} instance containing the Push Token.
|
|
2354
|
+
*/
|
|
2355
|
+
requestPushToken() {
|
|
2356
|
+
if (!this.isEmbedded())
|
|
2357
|
+
throw new N(this.currentContext);
|
|
2358
|
+
const e = "PUSH TOKEN", t = this.createMessage(e);
|
|
2359
|
+
this.logCreated(e, t);
|
|
2360
|
+
const n = this.incomingMessages$.pipe(
|
|
2361
|
+
M((i) => i.type === e && i.replyTo === t.id),
|
|
2362
|
+
P(this.logReceived(e)),
|
|
2363
|
+
T((i) => i),
|
|
2364
|
+
V(1)
|
|
2365
|
+
);
|
|
2366
|
+
return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(t), this.logSent(e, t), n;
|
|
2367
|
+
}
|
|
2368
|
+
/**
|
|
2369
|
+
* Setup listener for {@link BadgeQueryMessage}, which can be sent by a `Host` app to request the
|
|
2370
|
+
* current badge counter from the `Client` app.
|
|
2371
|
+
*
|
|
2372
|
+
* @returns An observable that emits whenever {@link BadgeQueryMessage} is received so it can be
|
|
2373
|
+
* subscribed to indefinitely.
|
|
2374
|
+
*/
|
|
2375
|
+
onBadgeQueryMessage() {
|
|
2376
|
+
if (!this.isEmbedded())
|
|
2377
|
+
throw new N(this.currentContext);
|
|
2378
|
+
const e = "BADGE QUERY";
|
|
2379
|
+
return this.incomingMessages$.pipe(
|
|
2380
|
+
M((t) => t.type === e && t.target === "client"),
|
|
2381
|
+
T((t) => t),
|
|
2382
|
+
P(this.logReceived(e))
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Sends a {@link BadgeUpdateMessage} from the `Client` to the `Host` with the current counter.
|
|
2387
|
+
*
|
|
2388
|
+
* @remarks
|
|
2389
|
+
* This message can be sent independently or as a reply to a {@link BadgeQueryMessage} from the
|
|
2390
|
+
* Host app. If sending as a reply, the `replyTo` parameter should contain the ID of the original
|
|
2391
|
+
* {@link BadgeQueryMessage}.
|
|
2392
|
+
*
|
|
2393
|
+
* @param count - The counter's value
|
|
2394
|
+
* @param replyTo - _Optional_. The message ID to which the reply should be sent
|
|
2395
|
+
*/
|
|
2396
|
+
sendBadgeUpdateMessage(e, t) {
|
|
2397
|
+
if (!this.isEmbedded())
|
|
2398
|
+
throw new N(this.currentContext);
|
|
2399
|
+
const n = "BADGE UPDATE", i = this.createMessage(n, !1, t);
|
|
2400
|
+
i.count = e, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i);
|
|
2401
|
+
}
|
|
2402
|
+
/**
|
|
2403
|
+
* Setup listener for {@link HostInForegroundMessage}, which can be sent by a `Host` app to
|
|
2404
|
+
* notify the `Client` app that it is now in the foreground.
|
|
2405
|
+
*
|
|
2406
|
+
* @remarks
|
|
2407
|
+
* This message has no data in it's payload apart from the basic message definition. It can be
|
|
2408
|
+
* used by client apps to refresh and sync their state.
|
|
2409
|
+
*
|
|
2410
|
+
* @returns An observable that emits whenever {@link HostInForegroundMessage} is received so it
|
|
2411
|
+
* can be subscribed to indefinitely.
|
|
2412
|
+
*/
|
|
2413
|
+
onHostInForegroundMessage() {
|
|
2414
|
+
if (!this.isEmbedded())
|
|
2415
|
+
throw new N(this.currentContext);
|
|
2416
|
+
const e = "HOST IN FOREGROUND";
|
|
2417
|
+
return this.incomingMessages$.pipe(
|
|
2418
|
+
M((t) => t.type === e && t.target === "client"),
|
|
2419
|
+
T((t) => t),
|
|
2420
|
+
P(this.logReceived(e))
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Checks if the client app is either embedded in an iframe or in a native webview.
|
|
2425
|
+
*
|
|
2426
|
+
* @internal
|
|
2427
|
+
*
|
|
2428
|
+
* @returns `true` if the client app is embedded, `false` otherwise.
|
|
2429
|
+
*/
|
|
2430
|
+
isEmbedded() {
|
|
2431
|
+
if (this.embeddedResult !== null)
|
|
2432
|
+
return this.embeddedResult;
|
|
2433
|
+
let e = !1;
|
|
2434
|
+
return this.logService.debug("Checking if running in iframe..."), e = !!this.frameElement, e || (e = this.self !== this.parent), e ? (this.logService.debug("In iframe"), this.inIframe = !0, this.embeddedResult = !0, !0) : (this.logService.debug("Not in iframe"), this.logService.debug("Checking if running in native app..."), !e && (e = !!window.Acrobits, e) ? (this.logService.debug("In native app"), this.embeddedResult = !0, e) : (this.logService.debug("Not running in native app"), this.embeddedResult = !1, this.embeddedResult));
|
|
2435
|
+
}
|
|
2436
|
+
logReceived(e, t) {
|
|
2437
|
+
const n = (i) => this.logService.debug(`[IPC] Received ${e} message`, i);
|
|
2438
|
+
return t && n(t), n;
|
|
2439
|
+
}
|
|
2440
|
+
logSent(e, t) {
|
|
2441
|
+
this.logService.debug(`[IPC] Sent ${e} message`, t);
|
|
2442
|
+
}
|
|
2443
|
+
logCreated(e, t) {
|
|
2444
|
+
this.logService.debug(`[IPC] Created ${e} message`, t);
|
|
2445
|
+
}
|
|
2446
|
+
async createIframeChannel() {
|
|
2447
|
+
return new Promise((e) => {
|
|
2448
|
+
const t = (n) => {
|
|
2449
|
+
n.data === "message channel port" && (this.iframePort2 = n.ports[0], this.self.removeEventListener("message", t), e());
|
|
2450
|
+
};
|
|
2451
|
+
this.self.addEventListener("message", t), this.parent.postMessage("get channel", "*");
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
finishIpcSetup(e) {
|
|
2455
|
+
this.logService.debug("Registering listener on port2..."), this.port2.addEventListener("message", this.handleIpcMessage.bind(this)), this.port2.start(), this.logService.debug("Started listening on port2"), this.port2.postMessage(e), this.logSent("HELLO", e);
|
|
2456
|
+
}
|
|
2457
|
+
handleIpcMessage(e) {
|
|
2458
|
+
const { data: t } = e;
|
|
2459
|
+
!t.id || t.target !== "client" || this.incomingMessages$.next(t);
|
|
2460
|
+
}
|
|
2461
|
+
createMessage(e, t = !0, n) {
|
|
2462
|
+
return {
|
|
2463
|
+
type: e,
|
|
2464
|
+
id: this.generateId(),
|
|
2465
|
+
target: "host",
|
|
2466
|
+
expectReply: t,
|
|
2467
|
+
replyTo: n ?? null
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2470
|
+
generateId(e = 8, t = !1) {
|
|
2471
|
+
let n = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
|
|
2472
|
+
const i = [];
|
|
2473
|
+
t && (n = n.substr(0, n.indexOf("Q")));
|
|
2474
|
+
for (let s = 0; s < e; s++)
|
|
2475
|
+
i.push(n[Math.floor(Math.random() * n.length)]);
|
|
2476
|
+
return i.join("");
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
var tt = function(r, e) {
|
|
2480
|
+
return tt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
|
|
2481
|
+
t.__proto__ = n;
|
|
2482
|
+
} || function(t, n) {
|
|
2483
|
+
for (var i in n)
|
|
2484
|
+
Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
2485
|
+
}, tt(r, e);
|
|
2486
|
+
};
|
|
2487
|
+
function ft(r, e) {
|
|
2488
|
+
if (typeof e != "function" && e !== null)
|
|
2489
|
+
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
2490
|
+
tt(r, e);
|
|
2491
|
+
function t() {
|
|
2492
|
+
this.constructor = r;
|
|
2493
|
+
}
|
|
2494
|
+
r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
2495
|
+
}
|
|
2496
|
+
function Qt(r) {
|
|
2497
|
+
var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], n = 0;
|
|
2498
|
+
if (t)
|
|
2499
|
+
return t.call(r);
|
|
2500
|
+
if (r && typeof r.length == "number")
|
|
2501
|
+
return {
|
|
2502
|
+
next: function() {
|
|
2503
|
+
return r && n >= r.length && (r = void 0), { value: r && r[n++], done: !r };
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
2507
|
+
}
|
|
2508
|
+
function Ce(r, e) {
|
|
2509
|
+
var t = typeof Symbol == "function" && r[Symbol.iterator];
|
|
2510
|
+
if (!t)
|
|
2511
|
+
return r;
|
|
2512
|
+
var n = t.call(r), i, s = [], a;
|
|
2513
|
+
try {
|
|
2514
|
+
for (; (e === void 0 || e-- > 0) && !(i = n.next()).done; )
|
|
2515
|
+
s.push(i.value);
|
|
2516
|
+
} catch (c) {
|
|
2517
|
+
a = { error: c };
|
|
2518
|
+
} finally {
|
|
2519
|
+
try {
|
|
2520
|
+
i && !i.done && (t = n.return) && t.call(n);
|
|
2521
|
+
} finally {
|
|
2522
|
+
if (a)
|
|
2523
|
+
throw a.error;
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
return s;
|
|
2527
|
+
}
|
|
2528
|
+
function Ne(r, e, t) {
|
|
2529
|
+
if (t || arguments.length === 2)
|
|
2530
|
+
for (var n = 0, i = e.length, s; n < i; n++)
|
|
2531
|
+
(s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]);
|
|
2532
|
+
return r.concat(s || Array.prototype.slice.call(e));
|
|
2533
|
+
}
|
|
2534
|
+
function Y(r) {
|
|
2535
|
+
return typeof r == "function";
|
|
2536
|
+
}
|
|
2537
|
+
function fr(r) {
|
|
2538
|
+
var e = function(n) {
|
|
2539
|
+
Error.call(n), n.stack = new Error().stack;
|
|
2540
|
+
}, t = r(e);
|
|
2541
|
+
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
|
|
2542
|
+
}
|
|
2543
|
+
var ze = fr(function(r) {
|
|
2544
|
+
return function(t) {
|
|
2545
|
+
r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
|
|
2546
|
+
` + t.map(function(n, i) {
|
|
2547
|
+
return i + 1 + ") " + n.toString();
|
|
2548
|
+
}).join(`
|
|
2549
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = t;
|
|
2550
|
+
};
|
|
2551
|
+
});
|
|
2552
|
+
function Wt(r, e) {
|
|
2553
|
+
if (r) {
|
|
2554
|
+
var t = r.indexOf(e);
|
|
2555
|
+
0 <= t && r.splice(t, 1);
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
var dt = function() {
|
|
2559
|
+
function r(e) {
|
|
2560
|
+
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
2561
|
+
}
|
|
2562
|
+
return r.prototype.unsubscribe = function() {
|
|
2563
|
+
var e, t, n, i, s;
|
|
2564
|
+
if (!this.closed) {
|
|
2565
|
+
this.closed = !0;
|
|
2566
|
+
var a = this._parentage;
|
|
2567
|
+
if (a)
|
|
2568
|
+
if (this._parentage = null, Array.isArray(a))
|
|
2569
|
+
try {
|
|
2570
|
+
for (var c = Qt(a), o = c.next(); !o.done; o = c.next()) {
|
|
2571
|
+
var l = o.value;
|
|
2572
|
+
l.remove(this);
|
|
2573
|
+
}
|
|
2574
|
+
} catch (R) {
|
|
2575
|
+
e = { error: R };
|
|
2576
|
+
} finally {
|
|
2577
|
+
try {
|
|
2578
|
+
o && !o.done && (t = c.return) && t.call(c);
|
|
2579
|
+
} finally {
|
|
2580
|
+
if (e)
|
|
2581
|
+
throw e.error;
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
else
|
|
2585
|
+
a.remove(this);
|
|
2586
|
+
var u = this.initialTeardown;
|
|
2587
|
+
if (Y(u))
|
|
2588
|
+
try {
|
|
2589
|
+
u();
|
|
2590
|
+
} catch (R) {
|
|
2591
|
+
s = R instanceof ze ? R.errors : [R];
|
|
2592
|
+
}
|
|
2593
|
+
var p = this._finalizers;
|
|
2594
|
+
if (p) {
|
|
2595
|
+
this._finalizers = null;
|
|
2596
|
+
try {
|
|
2597
|
+
for (var w = Qt(p), f = w.next(); !f.done; f = w.next()) {
|
|
2598
|
+
var g = f.value;
|
|
2599
|
+
try {
|
|
2600
|
+
Jt(g);
|
|
2601
|
+
} catch (R) {
|
|
2602
|
+
s = s ?? [], R instanceof ze ? s = Ne(Ne([], Ce(s)), Ce(R.errors)) : s.push(R);
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
} catch (R) {
|
|
2606
|
+
n = { error: R };
|
|
2607
|
+
} finally {
|
|
2608
|
+
try {
|
|
2609
|
+
f && !f.done && (i = w.return) && i.call(w);
|
|
2610
|
+
} finally {
|
|
2611
|
+
if (n)
|
|
2612
|
+
throw n.error;
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
if (s)
|
|
2617
|
+
throw new ze(s);
|
|
2618
|
+
}
|
|
2619
|
+
}, r.prototype.add = function(e) {
|
|
2620
|
+
var t;
|
|
2621
|
+
if (e && e !== this)
|
|
2622
|
+
if (this.closed)
|
|
2623
|
+
Jt(e);
|
|
2624
|
+
else {
|
|
2625
|
+
if (e instanceof r) {
|
|
2626
|
+
if (e.closed || e._hasParent(this))
|
|
2627
|
+
return;
|
|
2628
|
+
e._addParent(this);
|
|
2629
|
+
}
|
|
2630
|
+
(this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
|
|
2631
|
+
}
|
|
2632
|
+
}, r.prototype._hasParent = function(e) {
|
|
2633
|
+
var t = this._parentage;
|
|
2634
|
+
return t === e || Array.isArray(t) && t.includes(e);
|
|
2635
|
+
}, r.prototype._addParent = function(e) {
|
|
2636
|
+
var t = this._parentage;
|
|
2637
|
+
this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
|
|
2638
|
+
}, r.prototype._removeParent = function(e) {
|
|
2639
|
+
var t = this._parentage;
|
|
2640
|
+
t === e ? this._parentage = null : Array.isArray(t) && Wt(t, e);
|
|
2641
|
+
}, r.prototype.remove = function(e) {
|
|
2642
|
+
var t = this._finalizers;
|
|
2643
|
+
t && Wt(t, e), e instanceof r && e._removeParent(this);
|
|
2644
|
+
}, r.EMPTY = function() {
|
|
2645
|
+
var e = new r();
|
|
2646
|
+
return e.closed = !0, e;
|
|
2647
|
+
}(), r;
|
|
2648
|
+
}();
|
|
2649
|
+
dt.EMPTY;
|
|
2650
|
+
function ro(r) {
|
|
2651
|
+
return r instanceof dt || r && "closed" in r && Y(r.remove) && Y(r.add) && Y(r.unsubscribe);
|
|
2652
|
+
}
|
|
2653
|
+
function Jt(r) {
|
|
2654
|
+
Y(r) ? r() : r.unsubscribe();
|
|
2655
|
+
}
|
|
2656
|
+
var no = {
|
|
2657
|
+
onUnhandledError: null,
|
|
2658
|
+
onStoppedNotification: null,
|
|
2659
|
+
Promise: void 0,
|
|
2660
|
+
useDeprecatedSynchronousErrorHandling: !1,
|
|
2661
|
+
useDeprecatedNextContext: !1
|
|
2662
|
+
}, rt = {
|
|
2663
|
+
setTimeout: function(r, e) {
|
|
2664
|
+
for (var t = [], n = 2; n < arguments.length; n++)
|
|
2665
|
+
t[n - 2] = arguments[n];
|
|
2666
|
+
var i = rt.delegate;
|
|
2667
|
+
return i != null && i.setTimeout ? i.setTimeout.apply(i, Ne([r, e], Ce(t))) : setTimeout.apply(void 0, Ne([r, e], Ce(t)));
|
|
2668
|
+
},
|
|
2669
|
+
clearTimeout: function(r) {
|
|
2670
|
+
var e = rt.delegate;
|
|
2671
|
+
return ((e == null ? void 0 : e.clearTimeout) || clearTimeout)(r);
|
|
2672
|
+
},
|
|
2673
|
+
delegate: void 0
|
|
2674
|
+
};
|
|
2675
|
+
function io(r) {
|
|
2676
|
+
rt.setTimeout(function() {
|
|
2677
|
+
throw r;
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
function Kt() {
|
|
2681
|
+
}
|
|
2682
|
+
var dr = function(r) {
|
|
2683
|
+
ft(e, r);
|
|
2684
|
+
function e(t) {
|
|
2685
|
+
var n = r.call(this) || this;
|
|
2686
|
+
return n.isStopped = !1, t ? (n.destination = t, ro(t) && t.add(n)) : n.destination = lo, n;
|
|
2687
|
+
}
|
|
2688
|
+
return e.create = function(t, n, i) {
|
|
2689
|
+
return new vr(t, n, i);
|
|
2690
|
+
}, e.prototype.next = function(t) {
|
|
2691
|
+
this.isStopped || this._next(t);
|
|
2692
|
+
}, e.prototype.error = function(t) {
|
|
2693
|
+
this.isStopped || (this.isStopped = !0, this._error(t));
|
|
2694
|
+
}, e.prototype.complete = function() {
|
|
2695
|
+
this.isStopped || (this.isStopped = !0, this._complete());
|
|
2696
|
+
}, e.prototype.unsubscribe = function() {
|
|
2697
|
+
this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
|
|
2698
|
+
}, e.prototype._next = function(t) {
|
|
2699
|
+
this.destination.next(t);
|
|
2700
|
+
}, e.prototype._error = function(t) {
|
|
2701
|
+
try {
|
|
2702
|
+
this.destination.error(t);
|
|
2703
|
+
} finally {
|
|
2704
|
+
this.unsubscribe();
|
|
2705
|
+
}
|
|
2706
|
+
}, e.prototype._complete = function() {
|
|
2707
|
+
try {
|
|
2708
|
+
this.destination.complete();
|
|
2709
|
+
} finally {
|
|
2710
|
+
this.unsubscribe();
|
|
2711
|
+
}
|
|
2712
|
+
}, e;
|
|
2713
|
+
}(dt), so = Function.prototype.bind;
|
|
2714
|
+
function Qe(r, e) {
|
|
2715
|
+
return so.call(r, e);
|
|
2716
|
+
}
|
|
2717
|
+
var oo = function() {
|
|
2718
|
+
function r(e) {
|
|
2719
|
+
this.partialObserver = e;
|
|
2720
|
+
}
|
|
2721
|
+
return r.prototype.next = function(e) {
|
|
2722
|
+
var t = this.partialObserver;
|
|
2723
|
+
if (t.next)
|
|
2724
|
+
try {
|
|
2725
|
+
t.next(e);
|
|
2726
|
+
} catch (n) {
|
|
2727
|
+
Re(n);
|
|
2728
|
+
}
|
|
2729
|
+
}, r.prototype.error = function(e) {
|
|
2730
|
+
var t = this.partialObserver;
|
|
2731
|
+
if (t.error)
|
|
2732
|
+
try {
|
|
2733
|
+
t.error(e);
|
|
2734
|
+
} catch (n) {
|
|
2735
|
+
Re(n);
|
|
2736
|
+
}
|
|
2737
|
+
else
|
|
2738
|
+
Re(e);
|
|
2739
|
+
}, r.prototype.complete = function() {
|
|
2740
|
+
var e = this.partialObserver;
|
|
2741
|
+
if (e.complete)
|
|
2742
|
+
try {
|
|
2743
|
+
e.complete();
|
|
2744
|
+
} catch (t) {
|
|
2745
|
+
Re(t);
|
|
2746
|
+
}
|
|
2747
|
+
}, r;
|
|
2748
|
+
}(), vr = function(r) {
|
|
2749
|
+
ft(e, r);
|
|
2750
|
+
function e(t, n, i) {
|
|
2751
|
+
var s = r.call(this) || this, a;
|
|
2752
|
+
if (Y(t) || !t)
|
|
2753
|
+
a = {
|
|
2754
|
+
next: t ?? void 0,
|
|
2755
|
+
error: n ?? void 0,
|
|
2756
|
+
complete: i ?? void 0
|
|
2757
|
+
};
|
|
2758
|
+
else {
|
|
2759
|
+
var c;
|
|
2760
|
+
s && no.useDeprecatedNextContext ? (c = Object.create(t), c.unsubscribe = function() {
|
|
2761
|
+
return s.unsubscribe();
|
|
2762
|
+
}, a = {
|
|
2763
|
+
next: t.next && Qe(t.next, c),
|
|
2764
|
+
error: t.error && Qe(t.error, c),
|
|
2765
|
+
complete: t.complete && Qe(t.complete, c)
|
|
2766
|
+
}) : a = t;
|
|
2767
|
+
}
|
|
2768
|
+
return s.destination = new oo(a), s;
|
|
2769
|
+
}
|
|
2770
|
+
return e;
|
|
2771
|
+
}(dr);
|
|
2772
|
+
function Re(r) {
|
|
2773
|
+
io(r);
|
|
2774
|
+
}
|
|
2775
|
+
function ao(r) {
|
|
2776
|
+
throw r;
|
|
2777
|
+
}
|
|
2778
|
+
var lo = {
|
|
2779
|
+
closed: !0,
|
|
2780
|
+
next: Kt,
|
|
2781
|
+
error: ao,
|
|
2782
|
+
complete: Kt
|
|
2783
|
+
};
|
|
2784
|
+
function co(r) {
|
|
2785
|
+
return r;
|
|
2786
|
+
}
|
|
2787
|
+
function uo(r) {
|
|
2788
|
+
return Y(r == null ? void 0 : r.lift);
|
|
2789
|
+
}
|
|
2790
|
+
function gr(r) {
|
|
2791
|
+
return function(e) {
|
|
2792
|
+
if (uo(e))
|
|
2793
|
+
return e.lift(function(t) {
|
|
2794
|
+
try {
|
|
2795
|
+
return r(t, this);
|
|
2796
|
+
} catch (n) {
|
|
2797
|
+
this.error(n);
|
|
2798
|
+
}
|
|
2799
|
+
});
|
|
2800
|
+
throw new TypeError("Unable to lift unknown Observable type");
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
function mr(r, e, t, n, i) {
|
|
2804
|
+
return new ho(r, e, t, n, i);
|
|
2805
|
+
}
|
|
2806
|
+
var ho = function(r) {
|
|
2807
|
+
ft(e, r);
|
|
2808
|
+
function e(t, n, i, s, a, c) {
|
|
2809
|
+
var o = r.call(this, t) || this;
|
|
2810
|
+
return o.onFinalize = a, o.shouldUnsubscribe = c, o._next = n ? function(l) {
|
|
2811
|
+
try {
|
|
2812
|
+
n(l);
|
|
2813
|
+
} catch (u) {
|
|
2814
|
+
t.error(u);
|
|
2815
|
+
}
|
|
2816
|
+
} : r.prototype._next, o._error = s ? function(l) {
|
|
2817
|
+
try {
|
|
2818
|
+
s(l);
|
|
2819
|
+
} catch (u) {
|
|
2820
|
+
t.error(u);
|
|
2821
|
+
} finally {
|
|
2822
|
+
this.unsubscribe();
|
|
2823
|
+
}
|
|
2824
|
+
} : r.prototype._error, o._complete = i ? function() {
|
|
2825
|
+
try {
|
|
2826
|
+
i();
|
|
2827
|
+
} catch (l) {
|
|
2828
|
+
t.error(l);
|
|
2829
|
+
} finally {
|
|
2830
|
+
this.unsubscribe();
|
|
2831
|
+
}
|
|
2832
|
+
} : r.prototype._complete, o;
|
|
2833
|
+
}
|
|
2834
|
+
return e.prototype.unsubscribe = function() {
|
|
2835
|
+
var t;
|
|
2836
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
2837
|
+
var n = this.closed;
|
|
2838
|
+
r.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
|
|
2839
|
+
}
|
|
2840
|
+
}, e;
|
|
2841
|
+
}(dr), po = fr(function(r) {
|
|
2842
|
+
return function() {
|
|
2843
|
+
r(this), this.name = "EmptyError", this.message = "no elements in sequence";
|
|
2844
|
+
};
|
|
2845
|
+
});
|
|
2846
|
+
function ue(r, e) {
|
|
2847
|
+
var t = typeof e == "object";
|
|
2848
|
+
return new Promise(function(n, i) {
|
|
2849
|
+
var s = new vr({
|
|
2850
|
+
next: function(a) {
|
|
2851
|
+
n(a), s.unsubscribe();
|
|
2852
|
+
},
|
|
2853
|
+
error: i,
|
|
2854
|
+
complete: function() {
|
|
2855
|
+
t ? n(e.defaultValue) : i(new po());
|
|
2856
|
+
}
|
|
2857
|
+
});
|
|
2858
|
+
r.subscribe(s);
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
function Ie(r, e) {
|
|
2862
|
+
return gr(function(t, n) {
|
|
2863
|
+
var i = 0;
|
|
2864
|
+
t.subscribe(mr(n, function(s) {
|
|
2865
|
+
n.next(r.call(e, s, i++));
|
|
2866
|
+
}));
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
function fo(r, e, t) {
|
|
2870
|
+
var n = Y(r) || e || t ? { next: r, error: e, complete: t } : r;
|
|
2871
|
+
return n ? gr(function(i, s) {
|
|
2872
|
+
var a;
|
|
2873
|
+
(a = n.subscribe) === null || a === void 0 || a.call(n);
|
|
2874
|
+
var c = !0;
|
|
2875
|
+
i.subscribe(mr(s, function(o) {
|
|
2876
|
+
var l;
|
|
2877
|
+
(l = n.next) === null || l === void 0 || l.call(n, o), s.next(o);
|
|
2878
|
+
}, function() {
|
|
2879
|
+
var o;
|
|
2880
|
+
c = !1, (o = n.complete) === null || o === void 0 || o.call(n), s.complete();
|
|
2881
|
+
}, function(o) {
|
|
2882
|
+
var l;
|
|
2883
|
+
c = !1, (l = n.error) === null || l === void 0 || l.call(n, o), s.error(o);
|
|
2884
|
+
}, function() {
|
|
2885
|
+
var o, l;
|
|
2886
|
+
c && ((o = n.unsubscribe) === null || o === void 0 || o.call(n)), (l = n.finalize) === null || l === void 0 || l.call(n);
|
|
2887
|
+
}));
|
|
2888
|
+
}) : co;
|
|
2889
|
+
}
|
|
2890
|
+
function vo() {
|
|
2891
|
+
try {
|
|
2892
|
+
return import("@acrobits/log-helper").then((r) => r.LogHelper.getLogger("IpcSDK"));
|
|
2893
|
+
} catch {
|
|
2894
|
+
return Promise.resolve(console);
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
const go = ["1.0"];
|
|
2898
|
+
var de, nt;
|
|
2899
|
+
class yo {
|
|
2900
|
+
/**
|
|
2901
|
+
* A class that manages the IPC communication between the `Client` and the `Host`.
|
|
2902
|
+
*
|
|
2903
|
+
* @remarks
|
|
2904
|
+
* Ideally, there should only be one instance of the IPCManager in the app. It is recommended to
|
|
2905
|
+
* create the instance as a singleton and use it throughout the app.
|
|
2906
|
+
*
|
|
2907
|
+
* @param logger - An optional logger instance to use for logging. If not provided, a default logger
|
|
2908
|
+
* will be used.
|
|
2909
|
+
*/
|
|
2910
|
+
constructor(e) {
|
|
2911
|
+
vt(this, de);
|
|
2912
|
+
/**
|
|
2913
|
+
* The type of the `Host` app the `Client` is embedded in.
|
|
2914
|
+
*/
|
|
2915
|
+
re(this, "host");
|
|
2916
|
+
/**
|
|
2917
|
+
* The cloud ID of the `Host` app the `Client` is embedded in.
|
|
2918
|
+
*/
|
|
2919
|
+
re(this, "cloudId");
|
|
2920
|
+
re(this, "logger");
|
|
2921
|
+
re(this, "helper");
|
|
2922
|
+
re(this, "listeners");
|
|
2923
|
+
e ? this.logger = e : (this.logger = console, vo().then((t) => {
|
|
2924
|
+
this.logger = t;
|
|
2925
|
+
})), this.helper = new to(go, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(H.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(H.HostInForeground, /* @__PURE__ */ new Set());
|
|
2926
|
+
}
|
|
2927
|
+
/**
|
|
2928
|
+
* Returns whether the app is running inside a native WebView (`host` context) or as a
|
|
2929
|
+
* `standalone` app.
|
|
2930
|
+
*/
|
|
2931
|
+
get context() {
|
|
2932
|
+
return je(this, de, nt).call(this, this.helper.currentContext);
|
|
2933
|
+
}
|
|
2934
|
+
/**
|
|
2935
|
+
* Determines if the app is connected to a `Host` app.
|
|
2936
|
+
*/
|
|
2937
|
+
get isConnected() {
|
|
2938
|
+
return !!(this.helper.currentContext === "user" && this.host && this.cloudId);
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
* The negotiated IPC protocol version.
|
|
2942
|
+
*/
|
|
2943
|
+
get negotiatedVersion() {
|
|
2944
|
+
return this.helper.negotiatedProtocolVersion;
|
|
2945
|
+
}
|
|
2946
|
+
/**
|
|
2947
|
+
* Determines if the app is embedded in a Host app or native CSP clients.
|
|
2948
|
+
*
|
|
2949
|
+
* @returns A promise with {@link IPCContext} the app is running under.
|
|
2950
|
+
*/
|
|
2951
|
+
async determineContext() {
|
|
2952
|
+
const e = await ue(this.helper.determineContext(), {
|
|
2953
|
+
defaultValue: "guest"
|
|
2954
|
+
});
|
|
2955
|
+
return je(this, de, nt).call(this, e);
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* Initiates the IPC handshake with the `Host` app.
|
|
2959
|
+
*/
|
|
2960
|
+
initiateConnection() {
|
|
2961
|
+
return ue(
|
|
2962
|
+
this.helper.openBridge().pipe(
|
|
2963
|
+
fo((e) => {
|
|
2964
|
+
this.helper.onBadgeQueryMessage().subscribe((t) => {
|
|
2965
|
+
var n;
|
|
2966
|
+
this.logger.debug("Received Badge Query: ", t);
|
|
2967
|
+
for (const i of ((n = this.listeners.get(H.BadgeQuery)) == null ? void 0 : n.values()) ?? [])
|
|
2968
|
+
i();
|
|
2969
|
+
}), this.helper.onHostInForegroundMessage().subscribe((t) => {
|
|
2970
|
+
var n;
|
|
2971
|
+
this.logger.debug("Received Host In Foreground: ", t);
|
|
2972
|
+
for (const i of ((n = this.listeners.get(H.HostInForeground)) == null ? void 0 : n.values()) ?? [])
|
|
2973
|
+
i();
|
|
2974
|
+
}), this.cloudId = e.cloudId, this.host = e.host;
|
|
2975
|
+
}),
|
|
2976
|
+
Ie(() => {
|
|
2977
|
+
})
|
|
2978
|
+
)
|
|
2979
|
+
);
|
|
2980
|
+
}
|
|
2981
|
+
selectContacts(e, t, n) {
|
|
2982
|
+
this.logger.debug("Selecting Contacts: ", ...arguments);
|
|
2983
|
+
let i;
|
|
2984
|
+
if (t === "multi") {
|
|
2985
|
+
if (!n)
|
|
2986
|
+
throw new $e(
|
|
2987
|
+
"currentContacts",
|
|
2988
|
+
n,
|
|
2989
|
+
"currentContacts is required for group streams"
|
|
2990
|
+
);
|
|
2991
|
+
i = this.helper.selectContacts(e.toString(), "group", n);
|
|
2992
|
+
} else
|
|
2993
|
+
i = this.helper.selectContacts(e.toString(), "direct");
|
|
2994
|
+
return ue(i.pipe(Ie((s) => s.contacts)));
|
|
2995
|
+
}
|
|
2996
|
+
/**
|
|
2997
|
+
* Matches batch of {@link ContactItem} objects against the Host's contact list to fetch detailed
|
|
2998
|
+
* contact information.
|
|
2999
|
+
*
|
|
3000
|
+
* @param contacts - List of {@link ContactItem} collection to match against the Host's contact
|
|
3001
|
+
* list.
|
|
3002
|
+
* @returns A collection of {@link DetailedContactItem} objects which were matched against the
|
|
3003
|
+
* Host's contact list.
|
|
3004
|
+
*/
|
|
3005
|
+
matchContacts(e) {
|
|
3006
|
+
return this.logger.debug("Match Contacts: ", e), ue(this.helper.matchContacts(e).pipe(Ie((t) => t.contacts)));
|
|
3007
|
+
}
|
|
3008
|
+
/**
|
|
3009
|
+
* Requests the `Host` app to provide the Push Token for the current device.
|
|
3010
|
+
*
|
|
3011
|
+
* @returns A promise with the Push Token as `string`.
|
|
3012
|
+
*/
|
|
3013
|
+
requestPushToken() {
|
|
3014
|
+
return this.logger.debug("Requesting Push Token"), ue(this.helper.requestPushToken().pipe(Ie((e) => e.pushToken)));
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* Sends the current badge count to the `Host` app.
|
|
3018
|
+
*
|
|
3019
|
+
* @param count - The count to update the badge to.
|
|
3020
|
+
*/
|
|
3021
|
+
badgeUpdate(e) {
|
|
3022
|
+
this.logger.debug("Sending Badge Update: ", e), this.helper.sendBadgeUpdateMessage(e);
|
|
3023
|
+
}
|
|
3024
|
+
/**
|
|
3025
|
+
* Registers a callback to be invoked when a {@link IPCEvents.BadgeQuery} is received.
|
|
3026
|
+
*
|
|
3027
|
+
* @param callback - A callback function to be invoked when a {@link IPCEvents.BadgeQuery} event
|
|
3028
|
+
* is received.
|
|
3029
|
+
* @returns An unsubscribe callback to remove the listener.
|
|
3030
|
+
*/
|
|
3031
|
+
onBadgeQueryRequest(e) {
|
|
3032
|
+
var t;
|
|
3033
|
+
return this.logger.debug("Registering for Badge Query"), (t = this.listeners.get(H.BadgeQuery)) == null || t.add(e), () => {
|
|
3034
|
+
var n;
|
|
3035
|
+
return (n = this.listeners.get(H.BadgeQuery)) == null ? void 0 : n.delete(e);
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Registers a callback to be invoked when a {@link IPCEvents.HostInForeground} event is received.
|
|
3040
|
+
*
|
|
3041
|
+
* @param callback - A callback function to be invoked when a {@link IPCEvents.HostInForeground}
|
|
3042
|
+
* event is received.
|
|
3043
|
+
* @returns An unsubscribe callback to remove the listener.
|
|
3044
|
+
*/
|
|
3045
|
+
onHostInForeground(e) {
|
|
3046
|
+
var t;
|
|
3047
|
+
return this.logger.debug("Registering for Host In Foreground"), (t = this.listeners.get(H.HostInForeground)) == null || t.add(e), () => {
|
|
3048
|
+
var n;
|
|
3049
|
+
return (n = this.listeners.get(H.HostInForeground)) == null ? void 0 : n.delete(e);
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
de = new WeakSet(), nt = function(e) {
|
|
3054
|
+
if (e === "user")
|
|
3055
|
+
return "host";
|
|
3056
|
+
if (e === "guest")
|
|
3057
|
+
return "standalone";
|
|
3058
|
+
};
|
|
3059
|
+
export {
|
|
3060
|
+
H as IPCEvents,
|
|
3061
|
+
yo as IPCManager
|
|
3062
|
+
};
|