@stripchatdev/ext-helper 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ext-helper.js +222 -170
- package/package.json +1 -1
package/dist/ext-helper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const S = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol === "iframe_pubsub" && "version" in e && e.version === "1.0", E = (e, t) => e, w = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
2
2
|
var l;
|
|
3
3
|
(function(e) {
|
|
4
4
|
e.Base32IncorrectEncoding = "B32_ENC_INVALID", e.DecodeTimeInvalidCharacter = "DEC_TIME_CHAR", e.DecodeTimeValueMalformed = "DEC_TIME_MALFORMED", e.EncodeTimeNegative = "ENC_TIME_NEG", e.EncodeTimeSizeExceeded = "ENC_TIME_SIZE_EXCEED", e.EncodeTimeValueMalformed = "ENC_TIME_MALFORMED", e.PRNGDetectFailure = "PRNG_DETECT", e.ULIDInvalid = "ULID_INVALID", e.Unexpected = "UNEXPECTED", e.UUIDInvalid = "UUID_INVALID";
|
|
@@ -8,31 +8,31 @@ class f extends Error {
|
|
|
8
8
|
super(`${r} (${t})`), this.name = "ULIDError", this.code = t;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function T(e) {
|
|
12
12
|
const t = Math.floor(e() * 32) % 32;
|
|
13
13
|
return w.charAt(t);
|
|
14
14
|
}
|
|
15
15
|
function _(e) {
|
|
16
|
-
const t =
|
|
16
|
+
const t = O(), r = t && (t.crypto || t.msCrypto) || null;
|
|
17
17
|
if (typeof (r == null ? void 0 : r.getRandomValues) == "function")
|
|
18
18
|
return () => {
|
|
19
|
-
const
|
|
20
|
-
return r.getRandomValues(
|
|
19
|
+
const n = new Uint8Array(1);
|
|
20
|
+
return r.getRandomValues(n), n[0] / 255;
|
|
21
21
|
};
|
|
22
22
|
if (typeof (r == null ? void 0 : r.randomBytes) == "function")
|
|
23
23
|
return () => r.randomBytes(1).readUInt8() / 255;
|
|
24
24
|
throw new f(l.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function O() {
|
|
27
|
+
return q() ? self : typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : null;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function P(e, t) {
|
|
30
30
|
let r = "";
|
|
31
31
|
for (; e > 0; e--)
|
|
32
|
-
r =
|
|
32
|
+
r = T(t) + r;
|
|
33
33
|
return r;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function H(e, t = 10) {
|
|
36
36
|
if (isNaN(e))
|
|
37
37
|
throw new f(l.EncodeTimeValueMalformed, `Time must be a number: ${e}`);
|
|
38
38
|
if (e > 281474976710655)
|
|
@@ -41,19 +41,19 @@ function L(e, t = 10) {
|
|
|
41
41
|
throw new f(l.EncodeTimeNegative, `Time must be positive: ${e}`);
|
|
42
42
|
if (Number.isInteger(e) === !1)
|
|
43
43
|
throw new f(l.EncodeTimeValueMalformed, `Time must be an integer: ${e}`);
|
|
44
|
-
let r,
|
|
45
|
-
for (let
|
|
46
|
-
r = e % 32,
|
|
47
|
-
return
|
|
44
|
+
let r, n = "";
|
|
45
|
+
for (let s = t; s > 0; s--)
|
|
46
|
+
r = e % 32, n = w.charAt(r) + n, e = (e - r) / 32;
|
|
47
|
+
return n;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function q() {
|
|
50
50
|
return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const r = _(),
|
|
54
|
-
return
|
|
52
|
+
function b(e, t) {
|
|
53
|
+
const r = _(), n = Date.now();
|
|
54
|
+
return H(n, 10) + P(16, r);
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const L = ({ seq: e, uniqId: t }) => (r) => ({
|
|
57
57
|
...{
|
|
58
58
|
protocol: "iframe_pubsub",
|
|
59
59
|
version: "1.0",
|
|
@@ -62,83 +62,97 @@ const S = ({ seq: e, uniqId: t }) => (r) => ({
|
|
|
62
62
|
timestamp: Date.now()
|
|
63
63
|
},
|
|
64
64
|
...r
|
|
65
|
-
}),
|
|
66
|
-
uniqId: () =>
|
|
67
|
-
seq: () =>
|
|
65
|
+
}), y = L({
|
|
66
|
+
uniqId: () => b(),
|
|
67
|
+
seq: () => b()
|
|
68
68
|
});
|
|
69
|
-
class
|
|
69
|
+
class A {
|
|
70
70
|
constructor(t) {
|
|
71
|
-
this.eventHandlerMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (
|
|
72
|
-
if (
|
|
73
|
-
if (
|
|
74
|
-
const { eventName: i } =
|
|
71
|
+
this.eventHandlerMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (s, o) => {
|
|
72
|
+
if (S(s)) {
|
|
73
|
+
if (s.type === "event") {
|
|
74
|
+
const { eventName: i } = s, a = this.eventHandlerMap.get(i);
|
|
75
75
|
if (!a)
|
|
76
76
|
return;
|
|
77
77
|
a.forEach((c) => {
|
|
78
78
|
try {
|
|
79
|
-
c(
|
|
80
|
-
} catch (
|
|
81
|
-
console.error("[PubSubSubscriber] globalMessageHandler: failed to handle income message",
|
|
79
|
+
c(s.data, o.id);
|
|
80
|
+
} catch (h) {
|
|
81
|
+
console.error("[PubSubSubscriber] globalMessageHandler: failed to handle income message", h);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
console.error("[PubSubSubscriber] globalMessageHandler: unhandled message",
|
|
86
|
+
console.error("[PubSubSubscriber] globalMessageHandler: unhandled message", s);
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
const { brokerId: r, transport:
|
|
90
|
-
this.brokerId = r, this.transport =
|
|
89
|
+
const { brokerId: r, transport: n } = t;
|
|
90
|
+
this.brokerId = r, this.transport = n, this.transport.onMessage(this.globalMessageHandler);
|
|
91
91
|
}
|
|
92
92
|
subscribe(t, r) {
|
|
93
|
-
const
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
const o =
|
|
93
|
+
const n = E(t);
|
|
94
|
+
let s = this.eventHandlerMap.get(n);
|
|
95
|
+
s || (s = /* @__PURE__ */ new Set(), this.eventHandlerMap.set(n, s)), s.add(r);
|
|
96
|
+
const o = y({
|
|
97
97
|
type: "subscribe",
|
|
98
98
|
eventName: t
|
|
99
99
|
});
|
|
100
100
|
this.transport.send(this.brokerId, o);
|
|
101
101
|
}
|
|
102
102
|
unsubscribe(t, r) {
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
103
|
+
const n = E(t);
|
|
104
|
+
let s = this.eventHandlerMap.get(n);
|
|
105
|
+
if (!s)
|
|
106
106
|
return;
|
|
107
|
-
r ?
|
|
108
|
-
const o =
|
|
107
|
+
r ? s.delete(r) : this.eventHandlerMap.delete(n);
|
|
108
|
+
const o = y({
|
|
109
109
|
type: "unsubscribe",
|
|
110
110
|
eventName: t
|
|
111
111
|
});
|
|
112
112
|
this.transport.send(this.brokerId, o);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
class
|
|
115
|
+
const x = !!Error.captureStackTrace, C = "APP_ERROR";
|
|
116
|
+
class g extends Error {
|
|
117
117
|
constructor(t, r) {
|
|
118
|
-
super(t), this.name = new.target.name ||
|
|
118
|
+
super(t), this.name = new.target.name || C, this.cause = r, x && Error.captureStackTrace(this, this.constructor);
|
|
119
119
|
}
|
|
120
|
-
static
|
|
121
|
-
|
|
122
|
-
return t instanceof E && t.cause && (r += `
|
|
123
|
-
Caused by: ${E.getChainedMessage(t.cause)}`), r;
|
|
120
|
+
static serializeCause(t) {
|
|
121
|
+
return t instanceof g ? t.toJSON() : t instanceof Error ? { name: t.name, message: t.message } : t !== null && typeof t == "object" ? t : String(t);
|
|
124
122
|
}
|
|
125
123
|
toJSON() {
|
|
126
124
|
return {
|
|
127
125
|
name: this.name,
|
|
128
126
|
message: this.message,
|
|
129
|
-
cause: this.cause ?
|
|
127
|
+
cause: this.cause ? g.serializeCause(this.cause) : void 0
|
|
130
128
|
};
|
|
131
129
|
}
|
|
130
|
+
toString() {
|
|
131
|
+
try {
|
|
132
|
+
const t = this.toJSON();
|
|
133
|
+
return JSON.stringify(t);
|
|
134
|
+
} catch {
|
|
135
|
+
return `failed to stringify error: ${this.name}: ${this.message}`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
132
138
|
}
|
|
133
|
-
const
|
|
139
|
+
const D = {
|
|
134
140
|
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
135
|
-
},
|
|
136
|
-
class
|
|
141
|
+
}, j = "RPC_ERROR";
|
|
142
|
+
class G extends g {
|
|
137
143
|
constructor(t) {
|
|
138
|
-
super(t.message || "
|
|
144
|
+
super(t.message || "rpc error", t.cause), this.name = j, this.code = (t == null ? void 0 : t.code) || D.INTERNAL_ERROR, this.method = t.method, this.params = t.params;
|
|
145
|
+
}
|
|
146
|
+
toJSON() {
|
|
147
|
+
return {
|
|
148
|
+
...super.toJSON(),
|
|
149
|
+
code: this.code,
|
|
150
|
+
method: this.method,
|
|
151
|
+
params: this.params
|
|
152
|
+
};
|
|
139
153
|
}
|
|
140
154
|
}
|
|
141
|
-
const
|
|
155
|
+
const F = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol === "iframe_rpc" && "version" in e && e.version === "1.0", B = ({ uniqId: e }) => (t) => ({
|
|
142
156
|
...{
|
|
143
157
|
protocol: "iframe_rpc",
|
|
144
158
|
version: "1.0",
|
|
@@ -146,44 +160,44 @@ const j = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol ==
|
|
|
146
160
|
timestamp: Date.now()
|
|
147
161
|
},
|
|
148
162
|
...t
|
|
149
|
-
}),
|
|
150
|
-
uniqId: () =>
|
|
163
|
+
}), z = B({
|
|
164
|
+
uniqId: () => b()
|
|
151
165
|
});
|
|
152
|
-
class
|
|
166
|
+
class X {
|
|
153
167
|
constructor(t) {
|
|
154
|
-
this.pendingEntryMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (
|
|
155
|
-
if (
|
|
156
|
-
if (
|
|
157
|
-
const o =
|
|
168
|
+
this.pendingEntryMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (s) => {
|
|
169
|
+
if (F(s)) {
|
|
170
|
+
if (s.type === "response" && s.status === "ok") {
|
|
171
|
+
const o = s.id, i = this.pendingEntryMap.get(o);
|
|
158
172
|
if (!i) {
|
|
159
|
-
console.error("[RpcClient] globalMessageHandler: got success response without pending request",
|
|
173
|
+
console.error("[RpcClient] globalMessageHandler: got success response without pending request", s);
|
|
160
174
|
return;
|
|
161
175
|
}
|
|
162
|
-
this.pendingEntryMap.delete(o), i.resolve(
|
|
176
|
+
this.pendingEntryMap.delete(o), i.resolve(s.result);
|
|
163
177
|
return;
|
|
164
178
|
}
|
|
165
|
-
if (
|
|
166
|
-
const o =
|
|
179
|
+
if (s.type === "response" && s.status === "error") {
|
|
180
|
+
const o = s.id, i = this.pendingEntryMap.get(o);
|
|
167
181
|
if (!i) {
|
|
168
|
-
console.error("[RpcClient] globalMessageHandler: got error response without pending request",
|
|
182
|
+
console.error("[RpcClient] globalMessageHandler: got error response without pending request", s);
|
|
169
183
|
return;
|
|
170
184
|
}
|
|
171
|
-
this.pendingEntryMap.delete(o), i.reject(new
|
|
185
|
+
this.pendingEntryMap.delete(o), i.reject(new G(s.error));
|
|
172
186
|
return;
|
|
173
187
|
}
|
|
174
|
-
console.error("[RpcClient] globalMessageHandler: invalid message schema",
|
|
188
|
+
console.error("[RpcClient] globalMessageHandler: invalid message schema", s);
|
|
175
189
|
}
|
|
176
190
|
};
|
|
177
|
-
const { serverId: r, transport:
|
|
178
|
-
this.serverId = r, this.transport =
|
|
191
|
+
const { serverId: r, transport: n } = t;
|
|
192
|
+
this.serverId = r, this.transport = n, this.transport.onMessage(this.globalMessageHandler);
|
|
179
193
|
}
|
|
180
194
|
makeRequest(t, r) {
|
|
181
|
-
const
|
|
195
|
+
const n = z({
|
|
182
196
|
type: "request",
|
|
183
197
|
method: t,
|
|
184
198
|
params: r
|
|
185
|
-
}),
|
|
186
|
-
this.pendingEntryMap.set(
|
|
199
|
+
}), s = new Promise((o, i) => {
|
|
200
|
+
this.pendingEntryMap.set(n.id, {
|
|
187
201
|
method: t,
|
|
188
202
|
resolve: (a) => {
|
|
189
203
|
o(a);
|
|
@@ -194,42 +208,42 @@ class U {
|
|
|
194
208
|
});
|
|
195
209
|
});
|
|
196
210
|
try {
|
|
197
|
-
this.transport.send(this.serverId,
|
|
211
|
+
this.transport.send(this.serverId, n);
|
|
198
212
|
} catch (o) {
|
|
199
213
|
console.error("[RpcClient] makeRequest: failed to send rpc message", o);
|
|
200
|
-
const i = this.pendingEntryMap.get(
|
|
201
|
-
i && (this.pendingEntryMap.delete(
|
|
214
|
+
const i = this.pendingEntryMap.get(n.id);
|
|
215
|
+
i && (this.pendingEntryMap.delete(n.id), i.reject(o));
|
|
202
216
|
}
|
|
203
|
-
return
|
|
217
|
+
return s;
|
|
204
218
|
}
|
|
205
219
|
}
|
|
206
220
|
class W {
|
|
207
221
|
constructor(t) {
|
|
208
|
-
this.peers = /* @__PURE__ */ new Map(), this.onMessage = (
|
|
209
|
-
const
|
|
222
|
+
this.peers = /* @__PURE__ */ new Map(), this.onMessage = (n) => {
|
|
223
|
+
const s = (o) => {
|
|
210
224
|
const { data: i, origin: a, source: c } = o;
|
|
211
225
|
if (!c) {
|
|
212
226
|
console.error("[PostMessageTransport] onMessage: source could not be empty");
|
|
213
227
|
return;
|
|
214
228
|
}
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
229
|
+
const h = this.findPeer(c, a);
|
|
230
|
+
if (h)
|
|
217
231
|
try {
|
|
218
|
-
|
|
219
|
-
} catch (
|
|
220
|
-
console.error("[PostMessageTransport] onMessage: failed to call cb on message",
|
|
232
|
+
n(i, h);
|
|
233
|
+
} catch (m) {
|
|
234
|
+
console.error("[PostMessageTransport] onMessage: failed to call cb on message", m);
|
|
221
235
|
}
|
|
222
236
|
};
|
|
223
|
-
return this.localWindow.addEventListener("message",
|
|
224
|
-
this.localWindow.removeEventListener("message",
|
|
237
|
+
return this.localWindow.addEventListener("message", s), () => {
|
|
238
|
+
this.localWindow.removeEventListener("message", s);
|
|
225
239
|
};
|
|
226
240
|
};
|
|
227
241
|
const { localWindow: r } = t;
|
|
228
242
|
this.localWindow = r || window;
|
|
229
243
|
}
|
|
230
244
|
send(t, r) {
|
|
231
|
-
const
|
|
232
|
-
|
|
245
|
+
const n = this.peers.get(t);
|
|
246
|
+
n && n.source.postMessage(r, n.origin);
|
|
233
247
|
}
|
|
234
248
|
broadcast(t) {
|
|
235
249
|
this.peers.forEach((r) => {
|
|
@@ -237,8 +251,8 @@ class W {
|
|
|
237
251
|
});
|
|
238
252
|
}
|
|
239
253
|
broadcastGroup(t, r) {
|
|
240
|
-
t.forEach((
|
|
241
|
-
this.send(
|
|
254
|
+
t.forEach((n) => {
|
|
255
|
+
this.send(n, r);
|
|
242
256
|
});
|
|
243
257
|
}
|
|
244
258
|
addPeer(t) {
|
|
@@ -248,64 +262,105 @@ class W {
|
|
|
248
262
|
this.peers.delete(t);
|
|
249
263
|
}
|
|
250
264
|
findPeer(t, r) {
|
|
251
|
-
for (const [
|
|
252
|
-
if (
|
|
253
|
-
return
|
|
265
|
+
for (const [n, s] of this.peers)
|
|
266
|
+
if (s.source === t && s.origin === r)
|
|
267
|
+
return s;
|
|
254
268
|
return null;
|
|
255
269
|
}
|
|
256
270
|
}
|
|
257
|
-
const
|
|
258
|
-
name: "
|
|
259
|
-
message: "
|
|
271
|
+
const p = {
|
|
272
|
+
name: "unknownError",
|
|
273
|
+
message: "unknown error"
|
|
260
274
|
}, M = (e, t = 3, r = 0) => {
|
|
261
275
|
if (e instanceof Error) {
|
|
262
|
-
const
|
|
276
|
+
const n = r < t && e.cause ? M(e.cause, t, r + 1) : void 0;
|
|
263
277
|
return {
|
|
264
278
|
name: e.name,
|
|
265
279
|
message: e.message,
|
|
266
280
|
stack: e.stack,
|
|
267
|
-
cause:
|
|
281
|
+
cause: n
|
|
268
282
|
};
|
|
269
283
|
}
|
|
270
284
|
if (typeof e == "string")
|
|
271
285
|
return {
|
|
272
|
-
name:
|
|
286
|
+
name: p.name,
|
|
273
287
|
message: e
|
|
274
288
|
};
|
|
275
289
|
if (typeof e == "number" || typeof e == "bigint" || typeof e == "boolean")
|
|
276
290
|
return {
|
|
277
|
-
name:
|
|
291
|
+
name: p.name,
|
|
278
292
|
message: String(e)
|
|
279
293
|
};
|
|
280
294
|
if (e && typeof e == "object")
|
|
281
295
|
try {
|
|
282
296
|
return {
|
|
283
|
-
name:
|
|
297
|
+
name: p.name,
|
|
284
298
|
message: "message" in e && typeof e.message == "string" && e.message !== "" ? e.message : JSON.stringify(e)
|
|
285
299
|
};
|
|
286
300
|
} catch {
|
|
287
301
|
return {
|
|
288
|
-
name:
|
|
289
|
-
message: "
|
|
302
|
+
name: p.name,
|
|
303
|
+
message: "failed to serialize error: unserializable error object"
|
|
290
304
|
};
|
|
291
305
|
}
|
|
292
|
-
return
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
306
|
+
return p;
|
|
307
|
+
}, I = (e) => {
|
|
308
|
+
const t = [];
|
|
309
|
+
if (e instanceof Error)
|
|
310
|
+
t.push(e.message), "cause" in e && t.push(I(e.cause));
|
|
311
|
+
else
|
|
312
|
+
try {
|
|
313
|
+
const r = JSON.stringify(e);
|
|
314
|
+
t.push(r);
|
|
315
|
+
} catch {
|
|
316
|
+
t.push("failed to get chained error message: unserializable error object");
|
|
317
|
+
}
|
|
318
|
+
return t.join(":");
|
|
319
|
+
}, $ = [
|
|
320
|
+
// browser internals — harmless noise
|
|
321
|
+
/resizeObserver loop/ig,
|
|
322
|
+
// cross-origin script errors with zero useful info
|
|
323
|
+
/Script error/ig,
|
|
324
|
+
// browser extensions injecting errors
|
|
325
|
+
/chrome-extension:\/\//ig,
|
|
326
|
+
/moz-extension:\/\//ig,
|
|
327
|
+
/safari-extension:\/\//ig,
|
|
328
|
+
// module/chunk loading failures (network flaky, retries handle it)
|
|
329
|
+
/importing a module script failed/ig,
|
|
330
|
+
/loading chunk [\w.-]+ failed/ig,
|
|
331
|
+
/failed to fetch dynamically imported module/ig,
|
|
332
|
+
/error loading dynamically imported module/ig,
|
|
333
|
+
// canceled navigation / aborted
|
|
334
|
+
/AbortError/ig,
|
|
335
|
+
/the operation was aborted/ig,
|
|
336
|
+
/the user aborted a request/ig,
|
|
337
|
+
// webSocket noise
|
|
338
|
+
/webSocket is closed before the connection is established/ig,
|
|
339
|
+
// generic network noise already captured by fetch/xhr integrations
|
|
340
|
+
/networkError when attempting to fetch resource/ig,
|
|
341
|
+
/load failed/ig
|
|
342
|
+
], J = (e) => $.some((t) => (t.lastIndex = 0, t.test(e))), V = (e) => {
|
|
343
|
+
const t = I(e.error), r = typeof e.data == "object" && "message" in e.data && typeof e.data.message == "string" ? e.data.message : "";
|
|
344
|
+
return [t, r].filter((n) => !!n).join(":");
|
|
345
|
+
}, U = (e) => e.data && typeof e.data == "object" && "filename" in e.data ? String(e.data.filename ?? "") : "", K = (e) => {
|
|
346
|
+
const t = V(e), r = U(e);
|
|
347
|
+
return r && /^(chrome|moz|safari)-extension:\/\//.test(r) ? !0 : !!t && J(t);
|
|
348
|
+
}, Z = "get", Q = (e, t) => {
|
|
349
|
+
var s;
|
|
350
|
+
let r, n;
|
|
351
|
+
return e instanceof Request ? (r = e.url, n = e.method) : e instanceof URL ? r = e.toString() : r = e, {
|
|
352
|
+
method: n || ((s = t == null ? void 0 : t.method) == null ? void 0 : s.toString()) || Z,
|
|
298
353
|
url: r
|
|
299
354
|
};
|
|
300
|
-
},
|
|
355
|
+
}, Y = (e, t, r) => ({
|
|
301
356
|
statusCode: r.status,
|
|
302
|
-
...
|
|
303
|
-
}),
|
|
357
|
+
...Q(e, t)
|
|
358
|
+
}), ee = (e) => {
|
|
304
359
|
const t = window.fetch;
|
|
305
360
|
Object.defineProperty(window, "fetch", {
|
|
306
|
-
value: async (
|
|
361
|
+
value: async (n, s) => {
|
|
307
362
|
try {
|
|
308
|
-
const o = new Error("synthetic error"), i = await t(
|
|
363
|
+
const o = new Error("synthetic error"), i = await t(n, s), a = i.clone(), c = Y(n, s, a);
|
|
309
364
|
if (i.status >= 500) {
|
|
310
365
|
const u = new Error("fetch response error");
|
|
311
366
|
u.stack = o.stack, e.report({
|
|
@@ -316,14 +371,14 @@ const h = {
|
|
|
316
371
|
});
|
|
317
372
|
}
|
|
318
373
|
const {
|
|
319
|
-
arrayBuffer:
|
|
320
|
-
blob:
|
|
321
|
-
json:
|
|
322
|
-
text:
|
|
374
|
+
arrayBuffer: h,
|
|
375
|
+
blob: m,
|
|
376
|
+
json: v,
|
|
377
|
+
text: k
|
|
323
378
|
} = i;
|
|
324
379
|
return i.json = async function() {
|
|
325
380
|
try {
|
|
326
|
-
return await
|
|
381
|
+
return await v.call(this);
|
|
327
382
|
} catch (u) {
|
|
328
383
|
throw e.report({
|
|
329
384
|
type: "network",
|
|
@@ -337,7 +392,7 @@ const h = {
|
|
|
337
392
|
}
|
|
338
393
|
}, i.text = async function() {
|
|
339
394
|
try {
|
|
340
|
-
return await
|
|
395
|
+
return await k.call(this);
|
|
341
396
|
} catch (u) {
|
|
342
397
|
throw e.report({
|
|
343
398
|
type: "network",
|
|
@@ -351,7 +406,7 @@ const h = {
|
|
|
351
406
|
}
|
|
352
407
|
}, i.blob = async function() {
|
|
353
408
|
try {
|
|
354
|
-
return await
|
|
409
|
+
return await m.call(this);
|
|
355
410
|
} catch (u) {
|
|
356
411
|
throw e.report({
|
|
357
412
|
type: "network",
|
|
@@ -365,7 +420,7 @@ const h = {
|
|
|
365
420
|
}
|
|
366
421
|
}, i.arrayBuffer = async function() {
|
|
367
422
|
try {
|
|
368
|
-
return await
|
|
423
|
+
return await h.call(this);
|
|
369
424
|
} catch (u) {
|
|
370
425
|
throw e.report({
|
|
371
426
|
type: "network",
|
|
@@ -379,49 +434,44 @@ const h = {
|
|
|
379
434
|
}
|
|
380
435
|
}, i;
|
|
381
436
|
} catch (o) {
|
|
382
|
-
throw o instanceof Error && o.name === "AbortError"
|
|
383
|
-
type: "network",
|
|
384
|
-
kind: "fetchRequestError",
|
|
385
|
-
error: o,
|
|
386
|
-
data: I(s, n)
|
|
387
|
-
}), o;
|
|
437
|
+
throw o instanceof Error && o.name === "AbortError", o;
|
|
388
438
|
}
|
|
389
439
|
},
|
|
390
|
-
configurable: !
|
|
391
|
-
writable: !
|
|
440
|
+
configurable: !0,
|
|
441
|
+
writable: !0
|
|
392
442
|
});
|
|
393
|
-
},
|
|
443
|
+
}, te = (e) => {
|
|
394
444
|
window.addEventListener("unhandledrejection", ({ reason: t }) => {
|
|
395
445
|
e.report({
|
|
396
446
|
type: "runtime",
|
|
397
447
|
kind: "unhandledRejection",
|
|
398
448
|
error: t
|
|
399
449
|
});
|
|
400
|
-
}), window.addEventListener("error", ({ colno: t, error: r, filename:
|
|
450
|
+
}), window.addEventListener("error", ({ colno: t, error: r, filename: n, lineno: s, message: o }) => {
|
|
401
451
|
e.report({
|
|
402
452
|
type: "runtime",
|
|
403
453
|
kind: "uncaughtError",
|
|
404
454
|
error: r,
|
|
405
455
|
data: {
|
|
406
|
-
lineno:
|
|
456
|
+
lineno: s,
|
|
407
457
|
colno: t,
|
|
408
458
|
message: o,
|
|
409
|
-
filename:
|
|
459
|
+
filename: n
|
|
410
460
|
}
|
|
411
461
|
});
|
|
412
462
|
});
|
|
413
|
-
},
|
|
463
|
+
}, N = Symbol("patchedXHLHttpRequest"), d = Symbol("requestInfo"), re = (e) => ({
|
|
414
464
|
statusCode: e.status,
|
|
415
465
|
...e[d]
|
|
416
|
-
}),
|
|
417
|
-
e[
|
|
418
|
-
},
|
|
419
|
-
const t = XMLHttpRequest.prototype.send, r = XMLHttpRequest.prototype.open,
|
|
466
|
+
}), ne = (e) => (e[d] || (e[d] = {}), e[d]), se = (e) => {
|
|
467
|
+
e[N] = !0;
|
|
468
|
+
}, oe = (e) => e[N] === !0, ie = (e) => {
|
|
469
|
+
const t = XMLHttpRequest.prototype.send, r = XMLHttpRequest.prototype.open, n = function(...o) {
|
|
420
470
|
const [i, a] = o;
|
|
421
471
|
this[d] = {
|
|
422
472
|
method: i,
|
|
423
473
|
url: typeof a == "string" ? a : a.toString()
|
|
424
|
-
},
|
|
474
|
+
}, oe(this) || (se(this), this.addEventListener("error", () => {
|
|
425
475
|
const c = new Error("XMLHttpRequest network error");
|
|
426
476
|
e.report({
|
|
427
477
|
type: "network",
|
|
@@ -443,7 +493,7 @@ const h = {
|
|
|
443
493
|
e.report({
|
|
444
494
|
type: "network",
|
|
445
495
|
kind: "xmlHttpRequestLoadError",
|
|
446
|
-
data:
|
|
496
|
+
data: re(this),
|
|
447
497
|
error: c
|
|
448
498
|
});
|
|
449
499
|
}
|
|
@@ -458,9 +508,9 @@ const h = {
|
|
|
458
508
|
data: this[d]
|
|
459
509
|
}), c;
|
|
460
510
|
}
|
|
461
|
-
},
|
|
511
|
+
}, s = function(o) {
|
|
462
512
|
try {
|
|
463
|
-
const i =
|
|
513
|
+
const i = ne(this), a = new Error("XMLHttpRequest request initiator");
|
|
464
514
|
i.requestStack = a.stack, t.call(this, o);
|
|
465
515
|
} catch (i) {
|
|
466
516
|
throw e.report({
|
|
@@ -472,24 +522,26 @@ const h = {
|
|
|
472
522
|
}
|
|
473
523
|
};
|
|
474
524
|
Object.defineProperty(XMLHttpRequest.prototype, "open", {
|
|
475
|
-
value: s,
|
|
476
|
-
configurable: !1,
|
|
477
|
-
writable: !1
|
|
478
|
-
}), Object.defineProperty(XMLHttpRequest.prototype, "send", {
|
|
479
525
|
value: n,
|
|
480
|
-
configurable: !
|
|
481
|
-
writable: !
|
|
526
|
+
configurable: !0,
|
|
527
|
+
writable: !0
|
|
528
|
+
}), Object.defineProperty(XMLHttpRequest.prototype, "send", {
|
|
529
|
+
value: s,
|
|
530
|
+
configurable: !0,
|
|
531
|
+
writable: !0
|
|
482
532
|
});
|
|
483
533
|
};
|
|
484
534
|
let R;
|
|
485
|
-
class
|
|
535
|
+
class ae {
|
|
486
536
|
constructor(t) {
|
|
487
537
|
this.onError = t;
|
|
488
538
|
}
|
|
489
539
|
report(t) {
|
|
490
|
-
|
|
540
|
+
if (K(t))
|
|
541
|
+
return;
|
|
542
|
+
const { error: r, ...n } = t;
|
|
491
543
|
this.onError({
|
|
492
|
-
...
|
|
544
|
+
...n,
|
|
493
545
|
error: r ? M(r) : void 0
|
|
494
546
|
});
|
|
495
547
|
}
|
|
@@ -497,28 +549,28 @@ class te {
|
|
|
497
549
|
this.applyIntegrations();
|
|
498
550
|
}
|
|
499
551
|
applyIntegrations() {
|
|
500
|
-
R || (R = !0,
|
|
552
|
+
R || (R = !0, te(this), ie(this), ee(this));
|
|
501
553
|
}
|
|
502
554
|
}
|
|
503
|
-
class
|
|
555
|
+
class ce {
|
|
504
556
|
constructor(t) {
|
|
505
557
|
const {
|
|
506
558
|
serverId: r,
|
|
507
|
-
serverOrigin:
|
|
508
|
-
serverSource:
|
|
559
|
+
serverOrigin: n,
|
|
560
|
+
serverSource: s,
|
|
509
561
|
theme: o
|
|
510
562
|
} = t, i = {
|
|
511
563
|
id: r,
|
|
512
|
-
origin:
|
|
513
|
-
source:
|
|
564
|
+
origin: n,
|
|
565
|
+
source: s
|
|
514
566
|
}, a = new W({});
|
|
515
|
-
a.addPeer(i), this.rpcClient = new
|
|
567
|
+
a.addPeer(i), this.rpcClient = new X({
|
|
516
568
|
transport: a,
|
|
517
569
|
serverId: r
|
|
518
|
-
}), this.subscriber = new
|
|
570
|
+
}), this.subscriber = new A({
|
|
519
571
|
transport: a,
|
|
520
572
|
brokerId: i.id
|
|
521
|
-
}), document.documentElement.dataset.theme = o, this.crashReporter = new
|
|
573
|
+
}), document.documentElement.dataset.theme = o, this.crashReporter = new ae((c) => {
|
|
522
574
|
this.makeRequest("v1.system.report.crash", c);
|
|
523
575
|
});
|
|
524
576
|
}
|
|
@@ -539,17 +591,17 @@ class re {
|
|
|
539
591
|
a.offsetHeight,
|
|
540
592
|
a.scrollHeight
|
|
541
593
|
);
|
|
542
|
-
},
|
|
594
|
+
}, n = () => {
|
|
543
595
|
const a = document.body;
|
|
544
596
|
return Math.max(
|
|
545
597
|
a.offsetWidth,
|
|
546
598
|
a.scrollWidth
|
|
547
599
|
);
|
|
548
|
-
},
|
|
549
|
-
const a =
|
|
600
|
+
}, s = () => {
|
|
601
|
+
const a = n(), c = r();
|
|
550
602
|
(t.height !== c || t.width !== a) && (t = { height: c, width: a }, this.makeRequest("v1.system.resize.notify", { height: c, width: a }));
|
|
551
603
|
};
|
|
552
|
-
|
|
604
|
+
s(), new ResizeObserver(s).observe(document.body), new MutationObserver(s).observe(document.body, {
|
|
553
605
|
childList: !0,
|
|
554
606
|
subtree: !0,
|
|
555
607
|
attributes: !0,
|
|
@@ -557,15 +609,15 @@ class re {
|
|
|
557
609
|
}), this.crashReporter.init();
|
|
558
610
|
}
|
|
559
611
|
}
|
|
560
|
-
const
|
|
561
|
-
const e = new URL(window.location.href), t = e.searchParams.get("origin") || "", r = e.searchParams.get("theme") || "dark",
|
|
612
|
+
const ue = () => {
|
|
613
|
+
const e = new URL(window.location.href), t = e.searchParams.get("origin") || "", r = e.searchParams.get("theme") || "dark", n = new ce({
|
|
562
614
|
serverId: "server",
|
|
563
615
|
serverOrigin: t || window.parent.origin,
|
|
564
616
|
serverSource: window.parent,
|
|
565
617
|
theme: r
|
|
566
618
|
});
|
|
567
|
-
return
|
|
619
|
+
return n.bootstrap(), n;
|
|
568
620
|
};
|
|
569
621
|
export {
|
|
570
|
-
|
|
622
|
+
ue as createExtHelper
|
|
571
623
|
};
|