ball2d 0.2.1 → 0.2.3
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 +9 -6
- package/dist/browser.js +907 -738
- package/dist/node.js +33 -33
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -7,7 +7,39 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
7
7
|
}, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
8
8
|
value: n,
|
|
9
9
|
enumerable: !0
|
|
10
|
-
}) : o, n))
|
|
10
|
+
}) : o, n));
|
|
11
|
+
function l(e) {
|
|
12
|
+
return e === 0 || e === 1 || e === 2;
|
|
13
|
+
}
|
|
14
|
+
function u(e, t) {
|
|
15
|
+
return typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= t;
|
|
16
|
+
}
|
|
17
|
+
function d(e) {
|
|
18
|
+
let { score: t, minutes: n, locked: r, kickRate: i } = e;
|
|
19
|
+
return !u(t, 99) || !u(n, 99) || typeof r != "boolean" || i !== void 0 && !u(i, 6619135) ? null : {
|
|
20
|
+
score: t,
|
|
21
|
+
minutes: n,
|
|
22
|
+
locked: r,
|
|
23
|
+
kickRate: i
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function f(e, t, n) {
|
|
27
|
+
return t !== void 0 && (e.admin || !n && t === e);
|
|
28
|
+
}
|
|
29
|
+
function p(e, t, n) {
|
|
30
|
+
return t !== void 0 && e.admin && t !== e && !n(t);
|
|
31
|
+
}
|
|
32
|
+
var m = "/api/v1", h = {
|
|
33
|
+
rooms: `${m}/rooms`,
|
|
34
|
+
sdkRooms: `${m}/sdk/rooms`,
|
|
35
|
+
account: `${m}/account`,
|
|
36
|
+
accountConfig: `${m}/account/config`,
|
|
37
|
+
profile: `${m}/account/profile`,
|
|
38
|
+
notifications: `${m}/account/notifications`,
|
|
39
|
+
keys: `${m}/account/keys`,
|
|
40
|
+
signal: (e) => `${m}/rooms/${encodeURIComponent(e)}/signal`,
|
|
41
|
+
lease: (e) => `${m}/sdk/rooms/${encodeURIComponent(e)}/lease`
|
|
42
|
+
}, g = Uint8Array, _ = Uint16Array, v = Int32Array, ee = new g([
|
|
11
43
|
0,
|
|
12
44
|
0,
|
|
13
45
|
0,
|
|
@@ -40,7 +72,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
40
72
|
0,
|
|
41
73
|
0,
|
|
42
74
|
0
|
|
43
|
-
]),
|
|
75
|
+
]), y = new g([
|
|
44
76
|
0,
|
|
45
77
|
0,
|
|
46
78
|
0,
|
|
@@ -73,7 +105,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
73
105
|
13,
|
|
74
106
|
0,
|
|
75
107
|
0
|
|
76
|
-
]),
|
|
108
|
+
]), b = new g([
|
|
77
109
|
16,
|
|
78
110
|
17,
|
|
79
111
|
18,
|
|
@@ -93,49 +125,49 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
93
125
|
14,
|
|
94
126
|
1,
|
|
95
127
|
15
|
|
96
|
-
]),
|
|
97
|
-
for (var n = new
|
|
98
|
-
for (var i = new
|
|
128
|
+
]), x = function(e, t) {
|
|
129
|
+
for (var n = new _(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
|
|
130
|
+
for (var i = new v(n[30]), r = 1; r < 30; ++r) for (var a = n[r]; a < n[r + 1]; ++a) i[a] = a - n[r] << 5 | r;
|
|
99
131
|
return {
|
|
100
132
|
b: n,
|
|
101
133
|
r: i
|
|
102
134
|
};
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
for (var
|
|
106
|
-
var
|
|
107
|
-
|
|
135
|
+
}, S = x(ee, 2), te = S.b, C = S.r;
|
|
136
|
+
te[28] = 258, C[258] = 28;
|
|
137
|
+
for (var w = x(y, 0), T = w.b, E = w.r, ne = new _(32768), D = 0; D < 32768; ++D) {
|
|
138
|
+
var O = (D & 43690) >> 1 | (D & 21845) << 1;
|
|
139
|
+
O = (O & 52428) >> 2 | (O & 13107) << 2, O = (O & 61680) >> 4 | (O & 3855) << 4, ne[D] = ((O & 65280) >> 8 | (O & 255) << 8) >> 1;
|
|
108
140
|
}
|
|
109
|
-
for (var
|
|
110
|
-
for (var r = e.length, i = 0, a = new
|
|
111
|
-
var o = new
|
|
141
|
+
for (var k = (function(e, t, n) {
|
|
142
|
+
for (var r = e.length, i = 0, a = new _(t); i < r; ++i) e[i] && ++a[e[i] - 1];
|
|
143
|
+
var o = new _(t);
|
|
112
144
|
for (i = 1; i < t; ++i) o[i] = o[i - 1] + a[i - 1] << 1;
|
|
113
145
|
var s;
|
|
114
146
|
if (n) {
|
|
115
|
-
s = new
|
|
147
|
+
s = new _(1 << t);
|
|
116
148
|
var c = 15 - t;
|
|
117
|
-
for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i],
|
|
118
|
-
} else for (s = new
|
|
149
|
+
for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], u = t - e[i], d = o[e[i] - 1]++ << u, f = d | (1 << u) - 1; d <= f; ++d) s[ne[d] >> c] = l;
|
|
150
|
+
} else for (s = new _(r), i = 0; i < r; ++i) e[i] && (s[i] = ne[o[e[i] - 1]++] >> 15 - e[i]);
|
|
119
151
|
return s;
|
|
120
|
-
}),
|
|
121
|
-
for (var
|
|
122
|
-
for (var
|
|
123
|
-
for (var
|
|
124
|
-
for (var
|
|
125
|
-
var
|
|
152
|
+
}), A = new g(288), D = 0; D < 144; ++D) A[D] = 8;
|
|
153
|
+
for (var D = 144; D < 256; ++D) A[D] = 9;
|
|
154
|
+
for (var D = 256; D < 280; ++D) A[D] = 7;
|
|
155
|
+
for (var D = 280; D < 288; ++D) A[D] = 8;
|
|
156
|
+
for (var j = new g(32), D = 0; D < 32; ++D) j[D] = 5;
|
|
157
|
+
var re = /*#__PURE__*/ k(A, 9, 0), M = /*#__PURE__*/ k(A, 9, 1), ie = /*#__PURE__*/ k(j, 5, 0), N = /*#__PURE__*/ k(j, 5, 1), P = function(e) {
|
|
126
158
|
for (var t = e[0], n = 1; n < e.length; ++n) e[n] > t && (t = e[n]);
|
|
127
159
|
return t;
|
|
128
|
-
},
|
|
160
|
+
}, F = function(e, t, n) {
|
|
129
161
|
var r = t / 8 | 0;
|
|
130
162
|
return (e[r] | e[r + 1] << 8) >> (t & 7) & n;
|
|
131
|
-
},
|
|
163
|
+
}, I = function(e, t) {
|
|
132
164
|
var n = t / 8 | 0;
|
|
133
165
|
return (e[n] | e[n + 1] << 8 | e[n + 2] << 16) >> (t & 7);
|
|
134
|
-
},
|
|
166
|
+
}, L = function(e) {
|
|
135
167
|
return (e + 7) / 8 | 0;
|
|
136
|
-
},
|
|
137
|
-
return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new
|
|
138
|
-
},
|
|
168
|
+
}, ae = function(e, t, n) {
|
|
169
|
+
return (t == null || t < 0) && (t = 0), (n == null || n > e.length) && (n = e.length), new g(e.subarray(t, n));
|
|
170
|
+
}, R = [
|
|
139
171
|
"unexpected EOF",
|
|
140
172
|
"invalid block type",
|
|
141
173
|
"invalid length/literal",
|
|
@@ -150,119 +182,119 @@ var te = /*#__PURE__*/ w(T, 9, 0), ne = /*#__PURE__*/ w(T, 9, 1), re = /*#__PURE
|
|
|
150
182
|
"filename too long",
|
|
151
183
|
"stream finishing",
|
|
152
184
|
"invalid zip data"
|
|
153
|
-
],
|
|
154
|
-
var r = Error(t ||
|
|
155
|
-
if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r,
|
|
185
|
+
], z = function(e, t, n) {
|
|
186
|
+
var r = Error(t || R[e]);
|
|
187
|
+
if (r.code = e, Error.captureStackTrace && Error.captureStackTrace(r, z), !n) throw r;
|
|
156
188
|
return r;
|
|
157
|
-
},
|
|
189
|
+
}, B = function(e, t, n, r) {
|
|
158
190
|
var i = e.length, a = r ? r.length : 0;
|
|
159
|
-
if (!i || t.f && !t.l) return n || new
|
|
191
|
+
if (!i || t.f && !t.l) return n || new g(0);
|
|
160
192
|
var o = !n, s = o || t.i != 2, c = t.i;
|
|
161
|
-
o && (n = new
|
|
162
|
-
var
|
|
193
|
+
o && (n = new g(i * 3));
|
|
194
|
+
var l = function(e) {
|
|
163
195
|
var t = n.length;
|
|
164
196
|
if (e > t) {
|
|
165
|
-
var r = new
|
|
197
|
+
var r = new g(Math.max(t * 2, e));
|
|
166
198
|
r.set(n), n = r;
|
|
167
199
|
}
|
|
168
|
-
},
|
|
200
|
+
}, u = t.f || 0, d = t.p || 0, f = t.b || 0, p = t.l, m = t.d, h = t.m, _ = t.n, v = i * 8;
|
|
169
201
|
do {
|
|
170
|
-
if (!
|
|
171
|
-
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
174
|
-
var
|
|
175
|
-
if (
|
|
176
|
-
c &&
|
|
202
|
+
if (!p) {
|
|
203
|
+
u = F(e, d, 1);
|
|
204
|
+
var x = F(e, d + 1, 3);
|
|
205
|
+
if (d += 3, !x) {
|
|
206
|
+
var S = L(d) + 4, C = e[S - 4] | e[S - 3] << 8, w = S + C;
|
|
207
|
+
if (w > i) {
|
|
208
|
+
c && z(0);
|
|
177
209
|
break;
|
|
178
210
|
}
|
|
179
|
-
s &&
|
|
211
|
+
s && l(f + C), n.set(e.subarray(S, w), f), t.b = f += C, t.p = d = w * 8, t.f = u;
|
|
180
212
|
continue;
|
|
181
213
|
}
|
|
182
|
-
if (
|
|
183
|
-
else if (
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
for (var
|
|
187
|
-
|
|
188
|
-
for (var
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
var
|
|
192
|
-
if (
|
|
214
|
+
if (x == 1) p = M, m = N, h = 9, _ = 5;
|
|
215
|
+
else if (x == 2) {
|
|
216
|
+
var E = F(e, d, 31) + 257, ne = F(e, d + 10, 15) + 4, D = E + F(e, d + 5, 31) + 1;
|
|
217
|
+
d += 14;
|
|
218
|
+
for (var O = new g(D), A = new g(19), j = 0; j < ne; ++j) A[b[j]] = F(e, d + j * 3, 7);
|
|
219
|
+
d += ne * 3;
|
|
220
|
+
for (var re = P(A), ie = (1 << re) - 1, R = k(A, re, 1), j = 0; j < D;) {
|
|
221
|
+
var B = R[F(e, d, ie)];
|
|
222
|
+
d += B & 15;
|
|
223
|
+
var S = B >> 4;
|
|
224
|
+
if (S < 16) O[j++] = S;
|
|
193
225
|
else {
|
|
194
|
-
var
|
|
195
|
-
for (
|
|
226
|
+
var V = 0, H = 0;
|
|
227
|
+
for (S == 16 ? (H = 3 + F(e, d, 3), d += 2, V = O[j - 1]) : S == 17 ? (H = 3 + F(e, d, 7), d += 3) : S == 18 && (H = 11 + F(e, d, 127), d += 7); H--;) O[j++] = V;
|
|
196
228
|
}
|
|
197
229
|
}
|
|
198
|
-
var
|
|
199
|
-
|
|
200
|
-
} else
|
|
201
|
-
if (
|
|
202
|
-
c &&
|
|
230
|
+
var oe = O.subarray(0, E), U = O.subarray(E);
|
|
231
|
+
h = P(oe), _ = P(U), p = k(oe, h, 1), m = k(U, _, 1);
|
|
232
|
+
} else z(1);
|
|
233
|
+
if (d > v) {
|
|
234
|
+
c && z(0);
|
|
203
235
|
break;
|
|
204
236
|
}
|
|
205
237
|
}
|
|
206
|
-
s &&
|
|
207
|
-
for (var
|
|
208
|
-
var
|
|
209
|
-
if (
|
|
210
|
-
c &&
|
|
238
|
+
s && l(f + 131072);
|
|
239
|
+
for (var W = (1 << h) - 1, G = (1 << _) - 1, se = d;; se = d) {
|
|
240
|
+
var V = p[I(e, d) & W], K = V >> 4;
|
|
241
|
+
if (d += V & 15, d > v) {
|
|
242
|
+
c && z(0);
|
|
211
243
|
break;
|
|
212
244
|
}
|
|
213
|
-
if (
|
|
245
|
+
if (V || z(2), K < 256) n[f++] = K;
|
|
214
246
|
else if (K == 256) {
|
|
215
|
-
|
|
247
|
+
se = d, p = null;
|
|
216
248
|
break;
|
|
217
249
|
} else {
|
|
218
250
|
var q = K - 254;
|
|
219
251
|
if (K > 264) {
|
|
220
|
-
var
|
|
221
|
-
q =
|
|
252
|
+
var j = K - 257, J = ee[j];
|
|
253
|
+
q = F(e, d, (1 << J) - 1) + te[j], d += J;
|
|
222
254
|
}
|
|
223
|
-
var Y =
|
|
224
|
-
Y ||
|
|
225
|
-
var
|
|
255
|
+
var Y = m[I(e, d) & G], X = Y >> 4;
|
|
256
|
+
Y || z(3), d += Y & 15;
|
|
257
|
+
var U = T[X];
|
|
226
258
|
if (X > 3) {
|
|
227
|
-
var J =
|
|
228
|
-
|
|
259
|
+
var J = y[X];
|
|
260
|
+
U += I(e, d) & (1 << J) - 1, d += J;
|
|
229
261
|
}
|
|
230
|
-
if (
|
|
231
|
-
c &&
|
|
262
|
+
if (d > v) {
|
|
263
|
+
c && z(0);
|
|
232
264
|
break;
|
|
233
265
|
}
|
|
234
|
-
s &&
|
|
235
|
-
var ce =
|
|
236
|
-
if (
|
|
237
|
-
var Z = a -
|
|
238
|
-
for (Z +
|
|
266
|
+
s && l(f + 131072);
|
|
267
|
+
var ce = f + q;
|
|
268
|
+
if (f < U) {
|
|
269
|
+
var Z = a - U, le = Math.min(U, ce);
|
|
270
|
+
for (Z + f < 0 && z(3); f < le; ++f) n[f] = r[Z + f];
|
|
239
271
|
}
|
|
240
|
-
for (;
|
|
272
|
+
for (; f < ce; ++f) n[f] = n[f - U];
|
|
241
273
|
}
|
|
242
274
|
}
|
|
243
|
-
t.l =
|
|
244
|
-
} while (!
|
|
245
|
-
return
|
|
246
|
-
},
|
|
275
|
+
t.l = p, t.p = se, t.b = f, t.f = u, p && (u = 1, t.m = h, t.d = m, t.n = _);
|
|
276
|
+
} while (!u);
|
|
277
|
+
return f != n.length && o ? ae(n, 0, f) : n.subarray(0, f);
|
|
278
|
+
}, V = function(e, t, n) {
|
|
247
279
|
n <<= t & 7;
|
|
248
280
|
var r = t / 8 | 0;
|
|
249
281
|
e[r] |= n, e[r + 1] |= n >> 8;
|
|
250
|
-
},
|
|
282
|
+
}, H = function(e, t, n) {
|
|
251
283
|
n <<= t & 7;
|
|
252
284
|
var r = t / 8 | 0;
|
|
253
285
|
e[r] |= n, e[r + 1] |= n >> 8, e[r + 2] |= n >> 16;
|
|
254
|
-
},
|
|
286
|
+
}, oe = function(e, t) {
|
|
255
287
|
for (var n = [], r = 0; r < e.length; ++r) e[r] && n.push({
|
|
256
288
|
s: r,
|
|
257
289
|
f: e[r]
|
|
258
290
|
});
|
|
259
291
|
var i = n.length, a = n.slice();
|
|
260
292
|
if (!i) return {
|
|
261
|
-
t:
|
|
293
|
+
t: J,
|
|
262
294
|
l: 0
|
|
263
295
|
};
|
|
264
296
|
if (i == 1) {
|
|
265
|
-
var o = new
|
|
297
|
+
var o = new g(n[0].s + 1);
|
|
266
298
|
return o[n[0].s] = 1, {
|
|
267
299
|
t: o,
|
|
268
300
|
l: 1
|
|
@@ -274,48 +306,48 @@ var te = /*#__PURE__*/ w(T, 9, 0), ne = /*#__PURE__*/ w(T, 9, 1), re = /*#__PURE
|
|
|
274
306
|
s: -1,
|
|
275
307
|
f: 25001
|
|
276
308
|
});
|
|
277
|
-
var s = n[0], c = n[1],
|
|
309
|
+
var s = n[0], c = n[1], l = 0, u = 1, d = 2;
|
|
278
310
|
for (n[0] = {
|
|
279
311
|
s: -1,
|
|
280
312
|
f: s.f + c.f,
|
|
281
313
|
l: s,
|
|
282
314
|
r: c
|
|
283
|
-
};
|
|
315
|
+
}; u != i - 1;) s = n[n[l].f < n[d].f ? l++ : d++], c = n[l != u && n[l].f < n[d].f ? l++ : d++], n[u++] = {
|
|
284
316
|
s: -1,
|
|
285
317
|
f: s.f + c.f,
|
|
286
318
|
l: s,
|
|
287
319
|
r: c
|
|
288
320
|
};
|
|
289
|
-
for (var
|
|
290
|
-
var
|
|
291
|
-
if (
|
|
292
|
-
var r = 0,
|
|
321
|
+
for (var f = a[0].s, r = 1; r < i; ++r) a[r].s > f && (f = a[r].s);
|
|
322
|
+
var p = new _(f + 1), m = U(n[u - 1], p, 0);
|
|
323
|
+
if (m > t) {
|
|
324
|
+
var r = 0, h = 0, v = m - t, ee = 1 << v;
|
|
293
325
|
for (a.sort(function(e, t) {
|
|
294
|
-
return
|
|
326
|
+
return p[t.s] - p[e.s] || e.f - t.f;
|
|
295
327
|
}); r < i; ++r) {
|
|
296
|
-
var
|
|
297
|
-
if (
|
|
328
|
+
var y = a[r].s;
|
|
329
|
+
if (p[y] > t) h += ee - (1 << m - p[y]), p[y] = t;
|
|
298
330
|
else break;
|
|
299
331
|
}
|
|
300
|
-
for (
|
|
332
|
+
for (h >>= v; h > 0;) {
|
|
301
333
|
var b = a[r].s;
|
|
302
|
-
|
|
334
|
+
p[b] < t ? h -= 1 << t - p[b]++ - 1 : ++r;
|
|
303
335
|
}
|
|
304
|
-
for (; r >= 0 &&
|
|
336
|
+
for (; r >= 0 && h; --r) {
|
|
305
337
|
var x = a[r].s;
|
|
306
|
-
|
|
338
|
+
p[x] == t && (--p[x], ++h);
|
|
307
339
|
}
|
|
308
|
-
|
|
340
|
+
m = t;
|
|
309
341
|
}
|
|
310
342
|
return {
|
|
311
|
-
t: new
|
|
312
|
-
l:
|
|
343
|
+
t: new g(p),
|
|
344
|
+
l: m
|
|
313
345
|
};
|
|
314
|
-
},
|
|
315
|
-
return e.s == -1 ? Math.max(
|
|
316
|
-
},
|
|
346
|
+
}, U = function(e, t, n) {
|
|
347
|
+
return e.s == -1 ? Math.max(U(e.l, t, n + 1), U(e.r, t, n + 1)) : t[e.s] = n;
|
|
348
|
+
}, W = function(e) {
|
|
317
349
|
for (var t = e.length; t && !e[--t];);
|
|
318
|
-
for (var n = new
|
|
350
|
+
for (var n = new _(++t), r = 0, i = e[0], a = 1, o = function(e) {
|
|
319
351
|
n[r++] = e;
|
|
320
352
|
}, s = 1; s <= t; ++s) if (e[s] == i && s != t) ++a;
|
|
321
353
|
else {
|
|
@@ -333,44 +365,44 @@ var te = /*#__PURE__*/ w(T, 9, 0), ne = /*#__PURE__*/ w(T, 9, 1), re = /*#__PURE
|
|
|
333
365
|
c: n.subarray(0, r),
|
|
334
366
|
n: t
|
|
335
367
|
};
|
|
336
|
-
},
|
|
368
|
+
}, G = function(e, t) {
|
|
337
369
|
for (var n = 0, r = 0; r < t.length; ++r) n += e[r] * t[r];
|
|
338
370
|
return n;
|
|
339
|
-
},
|
|
340
|
-
var r = n.length, i =
|
|
371
|
+
}, se = function(e, t, n) {
|
|
372
|
+
var r = n.length, i = L(t + 2);
|
|
341
373
|
e[i] = r & 255, e[i + 1] = r >> 8, e[i + 2] = e[i] ^ 255, e[i + 3] = e[i + 1] ^ 255;
|
|
342
374
|
for (var a = 0; a < r; ++a) e[i + a + 4] = n[a];
|
|
343
375
|
return (i + 4 + r) * 8;
|
|
344
|
-
},
|
|
345
|
-
|
|
346
|
-
for (var
|
|
347
|
-
for (var
|
|
348
|
-
for (var
|
|
349
|
-
var
|
|
350
|
-
if (c >= 0 &&
|
|
351
|
-
var
|
|
352
|
-
if (
|
|
353
|
-
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
for (var
|
|
357
|
-
|
|
358
|
-
for (var
|
|
359
|
-
var q = K[
|
|
360
|
-
|
|
376
|
+
}, K = function(e, t, n, r, i, a, o, s, c, l, u) {
|
|
377
|
+
V(t, u++, n), ++i[256];
|
|
378
|
+
for (var d = oe(i, 15), f = d.t, p = d.l, m = oe(a, 15), h = m.t, g = m.l, v = W(f), x = v.c, S = v.n, te = W(h), C = te.c, w = te.n, T = new _(19), E = 0; E < x.length; ++E) ++T[x[E] & 31];
|
|
379
|
+
for (var E = 0; E < C.length; ++E) ++T[C[E] & 31];
|
|
380
|
+
for (var ne = oe(T, 7), D = ne.t, O = ne.l, M = 19; M > 4 && !D[b[M - 1]]; --M);
|
|
381
|
+
var N = l + 5 << 3, P = G(i, A) + G(a, j) + o, F = G(i, f) + G(a, h) + o + 14 + 3 * M + G(T, D) + 2 * T[16] + 3 * T[17] + 7 * T[18];
|
|
382
|
+
if (c >= 0 && N <= P && N <= F) return se(t, u, e.subarray(c, c + l));
|
|
383
|
+
var I, L, ae, R;
|
|
384
|
+
if (V(t, u, 1 + (F < P)), u += 2, F < P) {
|
|
385
|
+
I = k(f, p, 0), L = f, ae = k(h, g, 0), R = h;
|
|
386
|
+
var z = k(D, O, 0);
|
|
387
|
+
V(t, u, S - 257), V(t, u + 5, w - 1), V(t, u + 10, M - 4), u += 14;
|
|
388
|
+
for (var E = 0; E < M; ++E) V(t, u + 3 * E, D[b[E]]);
|
|
389
|
+
u += 3 * M;
|
|
390
|
+
for (var B = [x, C], U = 0; U < 2; ++U) for (var K = B[U], E = 0; E < K.length; ++E) {
|
|
391
|
+
var q = K[E] & 31;
|
|
392
|
+
V(t, u, z[q]), u += D[q], q > 15 && (V(t, u, K[E] >> 5 & 127), u += K[E] >> 12);
|
|
361
393
|
}
|
|
362
|
-
} else
|
|
363
|
-
for (var
|
|
364
|
-
var J = r[
|
|
394
|
+
} else I = re, L = A, ae = ie, R = j;
|
|
395
|
+
for (var E = 0; E < s; ++E) {
|
|
396
|
+
var J = r[E];
|
|
365
397
|
if (J > 255) {
|
|
366
398
|
var q = J >> 18 & 31;
|
|
367
|
-
|
|
399
|
+
H(t, u, I[q + 257]), u += L[q + 257], q > 7 && (V(t, u, J >> 23 & 31), u += ee[q]);
|
|
368
400
|
var Y = J & 31;
|
|
369
|
-
|
|
370
|
-
} else
|
|
401
|
+
H(t, u, ae[Y]), u += R[Y], Y > 3 && (H(t, u, J >> 5 & 8191), u += y[Y]);
|
|
402
|
+
} else H(t, u, I[J]), u += L[J];
|
|
371
403
|
}
|
|
372
|
-
return
|
|
373
|
-
},
|
|
404
|
+
return H(t, u, I[256]), u + L[256];
|
|
405
|
+
}, q = /*#__PURE__*/ new v([
|
|
374
406
|
65540,
|
|
375
407
|
131080,
|
|
376
408
|
131088,
|
|
@@ -380,96 +412,96 @@ var te = /*#__PURE__*/ w(T, 9, 0), ne = /*#__PURE__*/ w(T, 9, 1), re = /*#__PURE
|
|
|
380
412
|
1048832,
|
|
381
413
|
2114560,
|
|
382
414
|
2117632
|
|
383
|
-
]),
|
|
384
|
-
var o = a.z || e.length, s = new
|
|
415
|
+
]), J = /*#__PURE__*/ new g(0), Y = function(e, t, n, r, i, a) {
|
|
416
|
+
var o = a.z || e.length, s = new g(r + o + 5 * (1 + Math.ceil(o / 7e3)) + i), c = s.subarray(r, s.length - i), l = a.l, u = (a.r || 0) & 7;
|
|
385
417
|
if (t) {
|
|
386
|
-
|
|
387
|
-
for (var
|
|
388
|
-
return (e[t] ^ e[t + 1] <<
|
|
389
|
-
},
|
|
390
|
-
var
|
|
391
|
-
if (
|
|
392
|
-
var
|
|
393
|
-
if ((
|
|
394
|
-
|
|
395
|
-
for (var
|
|
396
|
-
for (var
|
|
418
|
+
u && (c[0] = a.r >> 3);
|
|
419
|
+
for (var d = q[t - 1], f = d >> 13, p = d & 8191, m = (1 << n) - 1, h = a.p || new _(32768), b = a.h || new _(m + 1), x = Math.ceil(n / 3), S = 2 * x, te = function(t) {
|
|
420
|
+
return (e[t] ^ e[t + 1] << x ^ e[t + 2] << S) & m;
|
|
421
|
+
}, w = new v(25e3), T = new _(288), ne = new _(32), D = 0, O = 0, k = a.i || 0, A = 0, j = a.w || 0, re = 0; k + 2 < o; ++k) {
|
|
422
|
+
var M = te(k), ie = k & 32767, N = b[M];
|
|
423
|
+
if (h[ie] = N, b[M] = ie, j <= k) {
|
|
424
|
+
var P = o - k;
|
|
425
|
+
if ((D > 7e3 || A > 24576) && (P > 423 || !l)) {
|
|
426
|
+
u = K(e, c, 0, w, T, ne, O, A, re, k - re, u), A = D = O = 0, re = k;
|
|
427
|
+
for (var F = 0; F < 286; ++F) T[F] = 0;
|
|
428
|
+
for (var F = 0; F < 30; ++F) ne[F] = 0;
|
|
397
429
|
}
|
|
398
|
-
var
|
|
399
|
-
if (
|
|
400
|
-
if (e[
|
|
401
|
-
for (var
|
|
402
|
-
if (
|
|
403
|
-
if (
|
|
404
|
-
for (var
|
|
405
|
-
var J =
|
|
406
|
-
Y >
|
|
430
|
+
var I = 2, R = 0, z = p, B = ie - N & 32767;
|
|
431
|
+
if (P > 2 && M == te(k - B)) for (var V = Math.min(f, P) - 1, H = Math.min(32767, k), oe = Math.min(258, P); B <= H && --z && ie != N;) {
|
|
432
|
+
if (e[k + I] == e[k + I - B]) {
|
|
433
|
+
for (var U = 0; U < oe && e[k + U] == e[k + U - B]; ++U);
|
|
434
|
+
if (U > I) {
|
|
435
|
+
if (I = U, R = B, U > V) break;
|
|
436
|
+
for (var W = Math.min(B, U - 2), G = 0, F = 0; F < W; ++F) {
|
|
437
|
+
var J = k - B + F & 32767, Y = J - h[J] & 32767;
|
|
438
|
+
Y > G && (G = Y, N = J);
|
|
407
439
|
}
|
|
408
440
|
}
|
|
409
441
|
}
|
|
410
|
-
|
|
442
|
+
ie = N, N = h[ie], B += ie - N & 32767;
|
|
411
443
|
}
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
var X =
|
|
415
|
-
|
|
416
|
-
} else
|
|
444
|
+
if (R) {
|
|
445
|
+
w[A++] = 268435456 | C[I] << 18 | E[R];
|
|
446
|
+
var X = C[I] & 31, ce = E[R] & 31;
|
|
447
|
+
O += ee[X] + y[ce], ++T[257 + X], ++ne[ce], j = k + I, ++D;
|
|
448
|
+
} else w[A++] = e[k], ++T[e[k]];
|
|
417
449
|
}
|
|
418
450
|
}
|
|
419
|
-
for (
|
|
420
|
-
|
|
451
|
+
for (k = Math.max(k, j); k < o; ++k) w[A++] = e[k], ++T[e[k]];
|
|
452
|
+
u = K(e, c, l, w, T, ne, O, A, re, k - re, u), l || (a.r = u & 7 | c[u / 8 | 0] << 3, u -= 7, a.h = b, a.p = h, a.i = k, a.w = j);
|
|
421
453
|
} else {
|
|
422
|
-
for (var
|
|
423
|
-
var Z =
|
|
424
|
-
Z >= o && (c[
|
|
454
|
+
for (var k = a.w || 0; k < o + l; k += 65535) {
|
|
455
|
+
var Z = k + 65535;
|
|
456
|
+
Z >= o && (c[u / 8 | 0] = l, Z = o), u = se(c, u + 1, e.subarray(k, Z));
|
|
425
457
|
}
|
|
426
458
|
a.i = o;
|
|
427
459
|
}
|
|
428
|
-
return
|
|
429
|
-
},
|
|
460
|
+
return ae(s, 0, r + L(u) + i);
|
|
461
|
+
}, X = function(e, t, n, r, i) {
|
|
430
462
|
if (!i && (i = { l: 1 }, t.dictionary)) {
|
|
431
|
-
var a = t.dictionary.subarray(-32768), o = new
|
|
463
|
+
var a = t.dictionary.subarray(-32768), o = new g(a.length + e.length);
|
|
432
464
|
o.set(a), o.set(e, a.length), e = o, i.w = a.length;
|
|
433
465
|
}
|
|
434
|
-
return
|
|
466
|
+
return Y(e, t.level == null ? 6 : t.level, t.mem == null ? i.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(e.length))) * 1.5) : 20 : 12 + t.mem, n, r, i);
|
|
435
467
|
};
|
|
436
|
-
function
|
|
437
|
-
return
|
|
468
|
+
function ce(e, t) {
|
|
469
|
+
return X(e, t || {}, 0, 0);
|
|
438
470
|
}
|
|
439
|
-
var
|
|
471
|
+
var Z = /* @__PURE__ */ function() {
|
|
440
472
|
function e(e, t) {
|
|
441
473
|
typeof e == "function" && (t = e, e = {}), this.ondata = t;
|
|
442
474
|
var n = e && e.dictionary && e.dictionary.subarray(-32768);
|
|
443
475
|
this.s = {
|
|
444
476
|
i: 0,
|
|
445
477
|
b: n ? n.length : 0
|
|
446
|
-
}, this.o = new
|
|
478
|
+
}, this.o = new g(32768), this.p = new g(0), n && this.o.set(n);
|
|
447
479
|
}
|
|
448
480
|
return e.prototype.e = function(e) {
|
|
449
|
-
if (this.ondata ||
|
|
481
|
+
if (this.ondata || z(5), this.d && z(4), !this.p.length) this.p = e;
|
|
450
482
|
else if (e.length) {
|
|
451
|
-
var t = new
|
|
483
|
+
var t = new g(this.p.length + e.length);
|
|
452
484
|
t.set(this.p), t.set(e, this.p.length), this.p = t;
|
|
453
485
|
}
|
|
454
486
|
}, e.prototype.c = function(e) {
|
|
455
487
|
this.s.i = +(this.d = e || !1);
|
|
456
|
-
var t = this.s.b, n =
|
|
457
|
-
this.ondata(
|
|
488
|
+
var t = this.s.b, n = B(this.p, this.s, this.o);
|
|
489
|
+
this.ondata(ae(n, t, this.s.b), this.d), this.o = ae(n, this.s.b - 32768), this.s.b = this.o.length, this.p = ae(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
458
490
|
}, e.prototype.push = function(e, t) {
|
|
459
491
|
this.e(e), this.c(t);
|
|
460
492
|
}, e;
|
|
461
|
-
}(),
|
|
493
|
+
}(), le = typeof TextDecoder < "u" && /*#__PURE__*/ new TextDecoder();
|
|
462
494
|
try {
|
|
463
|
-
|
|
495
|
+
le.decode(J, { stream: !0 });
|
|
464
496
|
} catch {}
|
|
465
|
-
var
|
|
497
|
+
var ue = 5389, de = (e, t, n) => Number.isInteger(e) && e >= t && e <= n, fe = (e) => Number.isFinite(e) && e >= 1 && e <= 1e5, pe = class {
|
|
466
498
|
core;
|
|
467
499
|
enabled = !1;
|
|
468
500
|
constructor(e) {
|
|
469
501
|
if (this.core = e, e.surface_state_capacity() !== 5389) throw Error("Unsupported surface state version");
|
|
470
502
|
}
|
|
471
503
|
configure(e) {
|
|
472
|
-
if (!
|
|
504
|
+
if (!de(e.seed, 0, 4294967295) || !fe(e.halfWidth) || !fe(e.halfHeight) || !de(e.moisturePermille, 0, 1e3)) throw Error("Invalid surface configuration");
|
|
473
505
|
if (!this.core.surface_configure(e.seed, e.halfWidth, e.halfHeight, e.moisturePermille)) throw Error("Surface configuration rejected");
|
|
474
506
|
this.enabled = !0;
|
|
475
507
|
}
|
|
@@ -477,7 +509,7 @@ var q = 5389, J = (e, t, n) => Number.isInteger(e) && e >= t && e <= n, Y = (e)
|
|
|
477
509
|
this.core.surface_disable(), this.enabled = !1;
|
|
478
510
|
}
|
|
479
511
|
setWeather(e) {
|
|
480
|
-
if (!
|
|
512
|
+
if (!de(e.rainMilliMmH, 0, 2e5) || !de(e.temperatureMilliC, -3e4, 6e4) || !de(e.humidityPermille, 0, 1e3) || !de(e.windMilliMS, 0, 6e4)) throw Error("Invalid surface weather");
|
|
481
513
|
if (!this.core.surface_weather(e.rainMilliMmH, e.temperatureMilliC, e.humidityPermille, e.windMilliMS)) throw Error("Surface is disabled");
|
|
482
514
|
}
|
|
483
515
|
sample(e, t) {
|
|
@@ -496,22 +528,22 @@ var q = 5389, J = (e, t, n) => Number.isInteger(e) && e >= t && e <= n, Y = (e)
|
|
|
496
528
|
return Array.from(this.buffer());
|
|
497
529
|
}
|
|
498
530
|
restore(e) {
|
|
499
|
-
if (!Array.isArray(e) || e.length !== 0 && e.length !== 5389 || !e.every((e) =>
|
|
531
|
+
if (!Array.isArray(e) || e.length !== 0 && e.length !== 5389 || !e.every((e) => de(e, 0, 4294967295)) || (e.length && this.buffer().set(e), !this.core.surface_restore(e.length))) throw Error("Invalid surface checkpoint");
|
|
500
532
|
this.enabled = e.length > 0;
|
|
501
533
|
}
|
|
502
534
|
buffer() {
|
|
503
535
|
let e = this.core.surface_state_ptr();
|
|
504
|
-
return new Uint32Array(this.core.memory.buffer, e,
|
|
536
|
+
return new Uint32Array(this.core.memory.buffer, e, ue);
|
|
505
537
|
}
|
|
506
|
-
},
|
|
538
|
+
}, me = 131072, he = 49152, Q = new TextEncoder();
|
|
507
539
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
508
|
-
var
|
|
509
|
-
function
|
|
510
|
-
if (!
|
|
511
|
-
let n =
|
|
512
|
-
if (n.length >
|
|
513
|
-
let r =
|
|
514
|
-
if (r.length >
|
|
540
|
+
var ge = (e, t) => typeof e == "number" && Number.isInteger(e) && e >= 0 && e <= t;
|
|
541
|
+
function _e(e, t) {
|
|
542
|
+
if (!ge(t, 65535) || !ge(e.tick, 4294967295) || !Array.isArray(e.surface) || e.surface.length !== 5389) throw Error("Invalid terrain snapshot");
|
|
543
|
+
let n = Q.encode(JSON.stringify(e));
|
|
544
|
+
if (n.length > me) throw Error("Terrain snapshot exceeds size limit");
|
|
545
|
+
let r = ce(n, { level: 1 });
|
|
546
|
+
if (r.length > he) throw Error("Compressed terrain snapshot exceeds size limit");
|
|
515
547
|
let i = "";
|
|
516
548
|
for (let e of r) i += String.fromCharCode(e);
|
|
517
549
|
return {
|
|
@@ -521,7 +553,7 @@ function de(e, t) {
|
|
|
521
553
|
payload: btoa(i)
|
|
522
554
|
};
|
|
523
555
|
}
|
|
524
|
-
function
|
|
556
|
+
function ve(e) {
|
|
525
557
|
let t = new AbortController(), n = () => t.abort(e?.reason);
|
|
526
558
|
e?.aborted ? n() : e?.addEventListener("abort", n, { once: !0 });
|
|
527
559
|
let r = setTimeout(() => t.abort(new DOMException("Room startup timed out", "TimeoutError")), 15e3);
|
|
@@ -543,7 +575,72 @@ function fe(e) {
|
|
|
543
575
|
}
|
|
544
576
|
};
|
|
545
577
|
}
|
|
546
|
-
|
|
578
|
+
async function ye(e, t) {
|
|
579
|
+
let n = `Room creation failed (${e.status})`, r = e.body?.getReader();
|
|
580
|
+
if (!r) return Error(n);
|
|
581
|
+
let i = () => {
|
|
582
|
+
r.cancel().catch(() => {});
|
|
583
|
+
};
|
|
584
|
+
t.addEventListener("abort", i, { once: !0 });
|
|
585
|
+
try {
|
|
586
|
+
if (t.throwIfAborted(), e.status < 400 || e.status >= 500 || e.headers.get("content-type")?.split(";")[0].trim() !== "application/json") return Error(n);
|
|
587
|
+
let i = /* @__PURE__ */ new Uint8Array(2048), a = 0;
|
|
588
|
+
for (;;) {
|
|
589
|
+
let e = await r.read();
|
|
590
|
+
if (t.throwIfAborted(), e.done) break;
|
|
591
|
+
if (a + e.value.byteLength > i.length) return Error(n);
|
|
592
|
+
i.set(e.value, a), a += e.value.byteLength;
|
|
593
|
+
}
|
|
594
|
+
let o = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(i.subarray(0, a)));
|
|
595
|
+
if (!o || typeof o != "object") return Error(n);
|
|
596
|
+
let s = o.error;
|
|
597
|
+
return typeof s != "string" || !s.trim() || s.length > 300 || /[<>]/.test(s) || [...s].some((e) => e.charCodeAt(0) < 32 || e.charCodeAt(0) === 127) ? Error(n) : Error(`${s.trim()} (${e.status})`);
|
|
598
|
+
} catch {
|
|
599
|
+
return t.throwIfAborted(), Error(n);
|
|
600
|
+
} finally {
|
|
601
|
+
t.removeEventListener("abort", i), i(), r.releaseLock();
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
var be = class {
|
|
605
|
+
stream;
|
|
606
|
+
sequence = 0;
|
|
607
|
+
pending = [];
|
|
608
|
+
lastSent = -Infinity;
|
|
609
|
+
constructor(e = crypto.randomUUID()) {
|
|
610
|
+
this.stream = e;
|
|
611
|
+
}
|
|
612
|
+
checkpoint() {
|
|
613
|
+
return {
|
|
614
|
+
stream: this.stream,
|
|
615
|
+
sequence: this.sequence
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
capture(e, t) {
|
|
619
|
+
let n = (e.ballKicks ?? []).map((n) => ({
|
|
620
|
+
sequence: ++this.sequence,
|
|
621
|
+
tick: e.tick,
|
|
622
|
+
epoch: t,
|
|
623
|
+
slot: n,
|
|
624
|
+
x: e.data[0],
|
|
625
|
+
y: e.data[1]
|
|
626
|
+
}));
|
|
627
|
+
return this.pending.push(...n), this.pending.length > 8 && this.pending.splice(0, this.pending.length - 8), n;
|
|
628
|
+
}
|
|
629
|
+
drain(e) {
|
|
630
|
+
if (!this.pending.length || e - this.lastSent < 50) return;
|
|
631
|
+
this.lastSent = e;
|
|
632
|
+
let t = this.pending;
|
|
633
|
+
return this.pending = [], {
|
|
634
|
+
type: "match-kicks",
|
|
635
|
+
stream: this.stream,
|
|
636
|
+
events: t
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
function xe(e, t) {
|
|
641
|
+
if (t) for (let n of e.peers.values()) n.control?.readyState === "open" && n.control.bufferedAmount < 16384 && e.control(n, t);
|
|
642
|
+
}
|
|
643
|
+
var Se = /* @__PURE__ */ new Set([
|
|
547
644
|
"noPlayer",
|
|
548
645
|
"playerName",
|
|
549
646
|
"roomName",
|
|
@@ -552,12 +649,12 @@ var pe = /* @__PURE__ */ new Set([
|
|
|
552
649
|
"public",
|
|
553
650
|
"stadium"
|
|
554
651
|
]);
|
|
555
|
-
function
|
|
652
|
+
function Ce(e) {
|
|
556
653
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("Room configuration must be an object");
|
|
557
654
|
for (let t of Object.keys(e)) {
|
|
558
655
|
if (t === "token") throw Error("External service tokens are not supported. Ball2D join verification is configured on the room.");
|
|
559
656
|
if (t === "geo") throw Error("Geolocation overrides are not supported. Room country comes from the host connection.");
|
|
560
|
-
if (!
|
|
657
|
+
if (!Se.has(t)) throw Error(`Unknown room setting: ${t}`);
|
|
561
658
|
}
|
|
562
659
|
let t = { ...e };
|
|
563
660
|
if (typeof t.roomName != "string" || !t.roomName.trim() || t.roomName.length > 64) throw Error("Room name must contain 1–64 characters");
|
|
@@ -576,15 +673,15 @@ function me(e) {
|
|
|
576
673
|
stadium: t.stadium
|
|
577
674
|
};
|
|
578
675
|
}
|
|
579
|
-
function
|
|
676
|
+
function we(e) {
|
|
580
677
|
return /^(?:[0-9a-f]{10}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i.test(e) ? e.toLowerCase() : null;
|
|
581
678
|
}
|
|
582
|
-
function
|
|
583
|
-
let t =
|
|
679
|
+
function Te(e) {
|
|
680
|
+
let t = we(e);
|
|
584
681
|
if (!t) throw Error("Invalid room code");
|
|
585
682
|
return `/r/${t}`;
|
|
586
683
|
}
|
|
587
|
-
function
|
|
684
|
+
function Ee(e, t, n) {
|
|
588
685
|
if (!Number.isFinite(e) || !Number.isInteger(t) || t < 0 || t > 16777215 || !Array.isArray(n) || n.length < 1 || n.length > 3 || n.some((e) => !Number.isInteger(e) || e < 0 || e > 16777215)) throw Error("Invalid team colors");
|
|
589
686
|
return {
|
|
590
687
|
angle: (e % 360 + 360) % 360,
|
|
@@ -592,12 +689,12 @@ function ge(e, t, n) {
|
|
|
592
689
|
colors: [...n]
|
|
593
690
|
};
|
|
594
691
|
}
|
|
595
|
-
function
|
|
692
|
+
function De(e) {
|
|
596
693
|
if (e === void 0) return [null, null];
|
|
597
694
|
if (!Array.isArray(e) || e.length !== 2) throw Error("Invalid team styles");
|
|
598
|
-
return e.map((e) => e === null ? null :
|
|
695
|
+
return e.map((e) => e === null ? null : Ee(e.angle, e.textColor, e.colors));
|
|
599
696
|
}
|
|
600
|
-
var
|
|
697
|
+
var Oe = [
|
|
601
698
|
"normal",
|
|
602
699
|
"bold",
|
|
603
700
|
"italic",
|
|
@@ -605,10 +702,10 @@ var ve = [
|
|
|
605
702
|
"small-bold",
|
|
606
703
|
"small-italic"
|
|
607
704
|
];
|
|
608
|
-
function
|
|
705
|
+
function ke(e, t, n, r) {
|
|
609
706
|
if (typeof e != "string" || e.length > 1e3) throw Error("Announcement exceeds 1000 characters");
|
|
610
707
|
if (t != null && (!Number.isInteger(t) || t < 0 || t > 16777215)) throw Error("Invalid announcement color");
|
|
611
|
-
if (n != null && !
|
|
708
|
+
if (n != null && !Oe.includes(n)) throw Error("Invalid announcement style");
|
|
612
709
|
if (r != null && ![
|
|
613
710
|
0,
|
|
614
711
|
1,
|
|
@@ -622,10 +719,10 @@ function ye(e, t, n, r) {
|
|
|
622
719
|
sound: r ?? 1
|
|
623
720
|
};
|
|
624
721
|
}
|
|
625
|
-
function
|
|
722
|
+
function Ae(e) {
|
|
626
723
|
return e === null || typeof e == "string" && Array.from(e).length <= 2 && !/[\p{Cc}\p{Cf}]/u.test(e);
|
|
627
724
|
}
|
|
628
|
-
var
|
|
725
|
+
var je = [
|
|
629
726
|
[
|
|
630
727
|
"x",
|
|
631
728
|
0,
|
|
@@ -705,11 +802,11 @@ var xe = [
|
|
|
705
802
|
2147483647
|
|
706
803
|
]
|
|
707
804
|
];
|
|
708
|
-
function
|
|
805
|
+
function Me(e) {
|
|
709
806
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("Invalid disc property update");
|
|
710
807
|
let t = e, n = {};
|
|
711
|
-
for (let e = 0; e <
|
|
712
|
-
let [r, , i, a] =
|
|
808
|
+
for (let e = 0; e < je.length; e++) {
|
|
809
|
+
let [r, , i, a] = je[e], o = t[r];
|
|
713
810
|
if (o == null) continue;
|
|
714
811
|
if (typeof o != "number" || !Number.isFinite(o)) throw Error(`Invalid disc property: ${r}`);
|
|
715
812
|
let s = e < 10 ? Math.fround(o) : o | 0;
|
|
@@ -718,7 +815,7 @@ function Se(e) {
|
|
|
718
815
|
}
|
|
719
816
|
return n;
|
|
720
817
|
}
|
|
721
|
-
var
|
|
818
|
+
var Ne = "5a27b77ea69c9f5e179f", Pe = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
722
819
|
(function(n, r) {
|
|
723
820
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : n.JSON5 = r();
|
|
724
821
|
})(e, (function() {
|
|
@@ -778,8 +875,8 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
778
875
|
return e[t] = n, e;
|
|
779
876
|
}, g = {}.hasOwnProperty, _ = function(e, t) {
|
|
780
877
|
return g.call(e, t);
|
|
781
|
-
}, v = 0,
|
|
782
|
-
return `Symbol(${e === void 0 ? "" : e})_${(++v +
|
|
878
|
+
}, v = 0, ee = Math.random(), y = function(e) {
|
|
879
|
+
return `Symbol(${e === void 0 ? "" : e})_${(++v + ee).toString(36)}`;
|
|
783
880
|
}, b = e(function(e) {
|
|
784
881
|
var r = "__core-js_shared__", i = t[r] || (t[r] = {});
|
|
785
882
|
(e.exports = function(e, t) {
|
|
@@ -790,7 +887,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
790
887
|
copyright: "© 2019 Denis Pushkarev (zloirock.ru)"
|
|
791
888
|
});
|
|
792
889
|
})("native-function-to-string", Function.toString), x = e(function(e) {
|
|
793
|
-
var r =
|
|
890
|
+
var r = y("src"), i = "toString", a = ("" + b).split(i);
|
|
794
891
|
n.inspectSource = function(e) {
|
|
795
892
|
return b.call(e);
|
|
796
893
|
}, (e.exports = function(e, n, i, o) {
|
|
@@ -802,7 +899,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
802
899
|
}), S = function(e) {
|
|
803
900
|
if (typeof e != "function") throw TypeError(e + " is not a function!");
|
|
804
901
|
return e;
|
|
805
|
-
},
|
|
902
|
+
}, te = function(e, t, n) {
|
|
806
903
|
if (S(e), t === void 0) return e;
|
|
807
904
|
switch (n) {
|
|
808
905
|
case 1: return function(n) {
|
|
@@ -818,48 +915,48 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
818
915
|
return function() {
|
|
819
916
|
return e.apply(t, arguments);
|
|
820
917
|
};
|
|
821
|
-
},
|
|
822
|
-
var a = e &
|
|
823
|
-
for (p in o && (i = r), i) m = !a && u && u[p] !== void 0, g = (m ? u : i)[p], _ = l && m ?
|
|
918
|
+
}, C = "prototype", w = function(e, r, i) {
|
|
919
|
+
var a = e & w.F, o = e & w.G, s = e & w.S, c = e & w.P, l = e & w.B, u = o ? t : s ? t[r] || (t[r] = {}) : (t[r] || {})[C], d = o ? n : n[r] || (n[r] = {}), f = d[C] || (d[C] = {}), p, m, g, _;
|
|
920
|
+
for (p in o && (i = r), i) m = !a && u && u[p] !== void 0, g = (m ? u : i)[p], _ = l && m ? te(g, t) : c && typeof g == "function" ? te(Function.call, g) : g, u && x(u, p, g, e & w.U), d[p] != g && h(d, p, _), c && f[p] != g && (f[p] = g);
|
|
824
921
|
};
|
|
825
|
-
t.core = n,
|
|
826
|
-
var
|
|
827
|
-
return isNaN(e = +e) ? 0 : (e > 0 ? ne :
|
|
828
|
-
},
|
|
922
|
+
t.core = n, w.F = 1, w.G = 2, w.S = 4, w.P = 8, w.B = 16, w.W = 32, w.U = 64, w.R = 128;
|
|
923
|
+
var T = w, E = Math.ceil, ne = Math.floor, D = function(e) {
|
|
924
|
+
return isNaN(e = +e) ? 0 : (e > 0 ? ne : E)(e);
|
|
925
|
+
}, O = function(e) {
|
|
829
926
|
if (e == null) throw TypeError("Can't call method on " + e);
|
|
830
927
|
return e;
|
|
831
|
-
},
|
|
928
|
+
}, k = function(e) {
|
|
832
929
|
return function(t, n) {
|
|
833
|
-
var r = String(
|
|
930
|
+
var r = String(O(t)), i = D(n), a = r.length, o, s;
|
|
834
931
|
return i < 0 || i >= a ? e ? "" : void 0 : (o = r.charCodeAt(i), o < 55296 || o > 56319 || i + 1 === a || (s = r.charCodeAt(i + 1)) < 56320 || s > 57343 ? e ? r.charAt(i) : o : e ? r.slice(i, i + 2) : (o - 55296 << 10) + (s - 56320) + 65536);
|
|
835
932
|
};
|
|
836
933
|
}(!1);
|
|
837
|
-
|
|
838
|
-
return
|
|
934
|
+
T(T.P, "String", { codePointAt: function(e) {
|
|
935
|
+
return k(this, e);
|
|
839
936
|
} }), n.String.codePointAt;
|
|
840
|
-
var
|
|
841
|
-
return e =
|
|
842
|
-
},
|
|
843
|
-
|
|
937
|
+
var A = Math.max, j = Math.min, re = function(e, t) {
|
|
938
|
+
return e = D(e), e < 0 ? A(e + t, 0) : j(e, t);
|
|
939
|
+
}, M = String.fromCharCode, ie = String.fromCodePoint;
|
|
940
|
+
T(T.S + T.F * (!!ie && ie.length != 1), "String", { fromCodePoint: function(e) {
|
|
844
941
|
for (var t = arguments, n = [], r = arguments.length, i = 0, a; r > i;) {
|
|
845
|
-
if (a = +t[i++],
|
|
846
|
-
n.push(a < 65536 ?
|
|
942
|
+
if (a = +t[i++], re(a, 1114111) !== a) throw RangeError(a + " is not a valid code point");
|
|
943
|
+
n.push(a < 65536 ? M(a) : M(((a -= 65536) >> 10) + 55296, a % 1024 + 56320));
|
|
847
944
|
}
|
|
848
945
|
return n.join("");
|
|
849
946
|
} }), n.String.fromCodePoint;
|
|
850
|
-
var
|
|
947
|
+
var N = {
|
|
851
948
|
Space_Separator: /[\u1680\u2000-\u200A\u202F\u205F\u3000]/,
|
|
852
949
|
ID_Start: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,
|
|
853
950
|
ID_Continue: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
|
|
854
|
-
},
|
|
951
|
+
}, P = {
|
|
855
952
|
isSpaceSeparator: function(e) {
|
|
856
|
-
return typeof e == "string" &&
|
|
953
|
+
return typeof e == "string" && N.Space_Separator.test(e);
|
|
857
954
|
},
|
|
858
955
|
isIdStartChar: function(e) {
|
|
859
|
-
return typeof e == "string" && (e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e === "$" || e === "_" ||
|
|
956
|
+
return typeof e == "string" && (e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e === "$" || e === "_" || N.ID_Start.test(e));
|
|
860
957
|
},
|
|
861
958
|
isIdContinueChar: function(e) {
|
|
862
|
-
return typeof e == "string" && (e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e >= "0" && e <= "9" || e === "$" || e === "_" || e === "" || e === "" ||
|
|
959
|
+
return typeof e == "string" && (e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e >= "0" && e <= "9" || e === "$" || e === "_" || e === "" || e === "" || N.ID_Continue.test(e));
|
|
863
960
|
},
|
|
864
961
|
isDigit: function(e) {
|
|
865
962
|
return typeof e == "string" && /[0-9]/.test(e);
|
|
@@ -867,18 +964,18 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
867
964
|
isHexDigit: function(e) {
|
|
868
965
|
return typeof e == "string" && /[0-9A-Fa-f]/.test(e);
|
|
869
966
|
}
|
|
870
|
-
},
|
|
871
|
-
|
|
967
|
+
}, F, I, L, ae, R, z, B, V, H, oe = function(e, t) {
|
|
968
|
+
F = String(e), I = "start", L = [], ae = 0, R = 1, z = 0, B = void 0, V = void 0, H = void 0;
|
|
872
969
|
do
|
|
873
|
-
|
|
874
|
-
while (
|
|
875
|
-
return typeof t == "function" ?
|
|
970
|
+
B = J(), pe[I]();
|
|
971
|
+
while (B.type !== "eof");
|
|
972
|
+
return typeof t == "function" ? U({ "": H }, "", t) : H;
|
|
876
973
|
};
|
|
877
|
-
function
|
|
974
|
+
function U(e, t, n) {
|
|
878
975
|
var r = e[t];
|
|
879
976
|
if (typeof r == "object" && r) {
|
|
880
977
|
if (Array.isArray(r)) for (var i = 0; i < r.length; i++) {
|
|
881
|
-
var a = String(i), o =
|
|
978
|
+
var a = String(i), o = U(r, a, n);
|
|
882
979
|
o === void 0 ? delete r[a] : Object.defineProperty(r, a, {
|
|
883
980
|
value: o,
|
|
884
981
|
writable: !0,
|
|
@@ -887,7 +984,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
887
984
|
});
|
|
888
985
|
}
|
|
889
986
|
else for (var s in r) {
|
|
890
|
-
var c =
|
|
987
|
+
var c = U(r, s, n);
|
|
891
988
|
c === void 0 ? delete r[s] : Object.defineProperty(r, s, {
|
|
892
989
|
value: c,
|
|
893
990
|
writable: !0,
|
|
@@ -898,20 +995,20 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
898
995
|
}
|
|
899
996
|
return n.call(e, t, r);
|
|
900
997
|
}
|
|
901
|
-
var
|
|
998
|
+
var W, G, se, K, q;
|
|
902
999
|
function J() {
|
|
903
|
-
for (
|
|
1000
|
+
for (W = "default", G = "", se = !1, K = 1;;) {
|
|
904
1001
|
q = Y();
|
|
905
|
-
var e = ce[
|
|
1002
|
+
var e = ce[W]();
|
|
906
1003
|
if (e) return e;
|
|
907
1004
|
}
|
|
908
1005
|
}
|
|
909
1006
|
function Y() {
|
|
910
|
-
if (
|
|
1007
|
+
if (F[ae]) return String.fromCodePoint(F.codePointAt(ae));
|
|
911
1008
|
}
|
|
912
1009
|
function X() {
|
|
913
1010
|
var e = Y();
|
|
914
|
-
return e === "\n" ? (
|
|
1011
|
+
return e === "\n" ? (R++, z = 0) : e ? z += e.length : z++, e && (ae += e.length), e;
|
|
915
1012
|
}
|
|
916
1013
|
var ce = {
|
|
917
1014
|
default: function() {
|
|
@@ -929,23 +1026,23 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
929
1026
|
X();
|
|
930
1027
|
return;
|
|
931
1028
|
case "/":
|
|
932
|
-
X(),
|
|
1029
|
+
X(), W = "comment";
|
|
933
1030
|
return;
|
|
934
1031
|
case void 0: return X(), Z("eof");
|
|
935
1032
|
}
|
|
936
|
-
if (
|
|
1033
|
+
if (P.isSpaceSeparator(q)) {
|
|
937
1034
|
X();
|
|
938
1035
|
return;
|
|
939
1036
|
}
|
|
940
|
-
return ce[
|
|
1037
|
+
return ce[I]();
|
|
941
1038
|
},
|
|
942
1039
|
comment: function() {
|
|
943
1040
|
switch (q) {
|
|
944
1041
|
case "*":
|
|
945
|
-
X(),
|
|
1042
|
+
X(), W = "multiLineComment";
|
|
946
1043
|
return;
|
|
947
1044
|
case "/":
|
|
948
|
-
X(),
|
|
1045
|
+
X(), W = "singleLineComment";
|
|
949
1046
|
return;
|
|
950
1047
|
}
|
|
951
1048
|
throw Q(X());
|
|
@@ -953,7 +1050,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
953
1050
|
multiLineComment: function() {
|
|
954
1051
|
switch (q) {
|
|
955
1052
|
case "*":
|
|
956
|
-
X(),
|
|
1053
|
+
X(), W = "multiLineCommentAsterisk";
|
|
957
1054
|
return;
|
|
958
1055
|
case void 0: throw Q(X());
|
|
959
1056
|
}
|
|
@@ -965,11 +1062,11 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
965
1062
|
X();
|
|
966
1063
|
return;
|
|
967
1064
|
case "/":
|
|
968
|
-
X(),
|
|
1065
|
+
X(), W = "default";
|
|
969
1066
|
return;
|
|
970
1067
|
case void 0: throw Q(X());
|
|
971
1068
|
}
|
|
972
|
-
X(),
|
|
1069
|
+
X(), W = "multiLineComment";
|
|
973
1070
|
},
|
|
974
1071
|
singleLineComment: function() {
|
|
975
1072
|
switch (q) {
|
|
@@ -977,7 +1074,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
977
1074
|
case "\r":
|
|
978
1075
|
case "\u2028":
|
|
979
1076
|
case "\u2029":
|
|
980
|
-
X(),
|
|
1077
|
+
X(), W = "default";
|
|
981
1078
|
return;
|
|
982
1079
|
case void 0: return X(), Z("eof");
|
|
983
1080
|
}
|
|
@@ -992,13 +1089,13 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
992
1089
|
case "f": return X(), le("alse"), Z("boolean", !1);
|
|
993
1090
|
case "-":
|
|
994
1091
|
case "+":
|
|
995
|
-
X() === "-" && (K = -1),
|
|
1092
|
+
X() === "-" && (K = -1), W = "sign";
|
|
996
1093
|
return;
|
|
997
1094
|
case ".":
|
|
998
|
-
|
|
1095
|
+
G = X(), W = "decimalPointLeading";
|
|
999
1096
|
return;
|
|
1000
1097
|
case "0":
|
|
1001
|
-
|
|
1098
|
+
G = X(), W = "zero";
|
|
1002
1099
|
return;
|
|
1003
1100
|
case "1":
|
|
1004
1101
|
case "2":
|
|
@@ -1009,13 +1106,13 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1009
1106
|
case "7":
|
|
1010
1107
|
case "8":
|
|
1011
1108
|
case "9":
|
|
1012
|
-
|
|
1109
|
+
G = X(), W = "decimalInteger";
|
|
1013
1110
|
return;
|
|
1014
1111
|
case "I": return X(), le("nfinity"), Z("numeric", Infinity);
|
|
1015
1112
|
case "N": return X(), le("aN"), Z("numeric", NaN);
|
|
1016
1113
|
case "\"":
|
|
1017
1114
|
case "'":
|
|
1018
|
-
|
|
1115
|
+
se = X() === "\"", G = "", W = "string";
|
|
1019
1116
|
return;
|
|
1020
1117
|
}
|
|
1021
1118
|
throw Q(X());
|
|
@@ -1027,9 +1124,9 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1027
1124
|
switch (e) {
|
|
1028
1125
|
case "$":
|
|
1029
1126
|
case "_": break;
|
|
1030
|
-
default: if (!
|
|
1127
|
+
default: if (!P.isIdStartChar(e)) throw _e();
|
|
1031
1128
|
}
|
|
1032
|
-
|
|
1129
|
+
G += e, W = "identifierName";
|
|
1033
1130
|
},
|
|
1034
1131
|
identifierName: function() {
|
|
1035
1132
|
switch (q) {
|
|
@@ -1037,17 +1134,17 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1037
1134
|
case "_":
|
|
1038
1135
|
case "":
|
|
1039
1136
|
case "":
|
|
1040
|
-
|
|
1137
|
+
G += X();
|
|
1041
1138
|
return;
|
|
1042
1139
|
case "\\":
|
|
1043
|
-
X(),
|
|
1140
|
+
X(), W = "identifierNameEscape";
|
|
1044
1141
|
return;
|
|
1045
1142
|
}
|
|
1046
|
-
if (
|
|
1047
|
-
|
|
1143
|
+
if (P.isIdContinueChar(q)) {
|
|
1144
|
+
G += X();
|
|
1048
1145
|
return;
|
|
1049
1146
|
}
|
|
1050
|
-
return Z("identifier",
|
|
1147
|
+
return Z("identifier", G);
|
|
1051
1148
|
},
|
|
1052
1149
|
identifierNameEscape: function() {
|
|
1053
1150
|
if (q !== "u") throw Q(X());
|
|
@@ -1058,17 +1155,17 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1058
1155
|
case "_":
|
|
1059
1156
|
case "":
|
|
1060
1157
|
case "": break;
|
|
1061
|
-
default: if (!
|
|
1158
|
+
default: if (!P.isIdContinueChar(e)) throw _e();
|
|
1062
1159
|
}
|
|
1063
|
-
|
|
1160
|
+
G += e, W = "identifierName";
|
|
1064
1161
|
},
|
|
1065
1162
|
sign: function() {
|
|
1066
1163
|
switch (q) {
|
|
1067
1164
|
case ".":
|
|
1068
|
-
|
|
1165
|
+
G = X(), W = "decimalPointLeading";
|
|
1069
1166
|
return;
|
|
1070
1167
|
case "0":
|
|
1071
|
-
|
|
1168
|
+
G = X(), W = "zero";
|
|
1072
1169
|
return;
|
|
1073
1170
|
case "1":
|
|
1074
1171
|
case "2":
|
|
@@ -1079,7 +1176,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1079
1176
|
case "7":
|
|
1080
1177
|
case "8":
|
|
1081
1178
|
case "9":
|
|
1082
|
-
|
|
1179
|
+
G = X(), W = "decimalInteger";
|
|
1083
1180
|
return;
|
|
1084
1181
|
case "I": return X(), le("nfinity"), Z("numeric", K * Infinity);
|
|
1085
1182
|
case "N": return X(), le("aN"), Z("numeric", NaN);
|
|
@@ -1089,15 +1186,15 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1089
1186
|
zero: function() {
|
|
1090
1187
|
switch (q) {
|
|
1091
1188
|
case ".":
|
|
1092
|
-
|
|
1189
|
+
G += X(), W = "decimalPoint";
|
|
1093
1190
|
return;
|
|
1094
1191
|
case "e":
|
|
1095
1192
|
case "E":
|
|
1096
|
-
|
|
1193
|
+
G += X(), W = "decimalExponent";
|
|
1097
1194
|
return;
|
|
1098
1195
|
case "x":
|
|
1099
1196
|
case "X":
|
|
1100
|
-
|
|
1197
|
+
G += X(), W = "hexadecimal";
|
|
1101
1198
|
return;
|
|
1102
1199
|
}
|
|
1103
1200
|
return Z("numeric", K * 0);
|
|
@@ -1105,22 +1202,22 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1105
1202
|
decimalInteger: function() {
|
|
1106
1203
|
switch (q) {
|
|
1107
1204
|
case ".":
|
|
1108
|
-
|
|
1205
|
+
G += X(), W = "decimalPoint";
|
|
1109
1206
|
return;
|
|
1110
1207
|
case "e":
|
|
1111
1208
|
case "E":
|
|
1112
|
-
|
|
1209
|
+
G += X(), W = "decimalExponent";
|
|
1113
1210
|
return;
|
|
1114
1211
|
}
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1212
|
+
if (P.isDigit(q)) {
|
|
1213
|
+
G += X();
|
|
1117
1214
|
return;
|
|
1118
1215
|
}
|
|
1119
|
-
return Z("numeric", K * Number(
|
|
1216
|
+
return Z("numeric", K * Number(G));
|
|
1120
1217
|
},
|
|
1121
1218
|
decimalPointLeading: function() {
|
|
1122
|
-
if (
|
|
1123
|
-
|
|
1219
|
+
if (P.isDigit(q)) {
|
|
1220
|
+
G += X(), W = "decimalFraction";
|
|
1124
1221
|
return;
|
|
1125
1222
|
}
|
|
1126
1223
|
throw Q(X());
|
|
@@ -1129,81 +1226,81 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1129
1226
|
switch (q) {
|
|
1130
1227
|
case "e":
|
|
1131
1228
|
case "E":
|
|
1132
|
-
|
|
1229
|
+
G += X(), W = "decimalExponent";
|
|
1133
1230
|
return;
|
|
1134
1231
|
}
|
|
1135
|
-
if (
|
|
1136
|
-
|
|
1232
|
+
if (P.isDigit(q)) {
|
|
1233
|
+
G += X(), W = "decimalFraction";
|
|
1137
1234
|
return;
|
|
1138
1235
|
}
|
|
1139
|
-
return Z("numeric", K * Number(
|
|
1236
|
+
return Z("numeric", K * Number(G));
|
|
1140
1237
|
},
|
|
1141
1238
|
decimalFraction: function() {
|
|
1142
1239
|
switch (q) {
|
|
1143
1240
|
case "e":
|
|
1144
1241
|
case "E":
|
|
1145
|
-
|
|
1242
|
+
G += X(), W = "decimalExponent";
|
|
1146
1243
|
return;
|
|
1147
1244
|
}
|
|
1148
|
-
if (
|
|
1149
|
-
|
|
1245
|
+
if (P.isDigit(q)) {
|
|
1246
|
+
G += X();
|
|
1150
1247
|
return;
|
|
1151
1248
|
}
|
|
1152
|
-
return Z("numeric", K * Number(
|
|
1249
|
+
return Z("numeric", K * Number(G));
|
|
1153
1250
|
},
|
|
1154
1251
|
decimalExponent: function() {
|
|
1155
1252
|
switch (q) {
|
|
1156
1253
|
case "+":
|
|
1157
1254
|
case "-":
|
|
1158
|
-
|
|
1255
|
+
G += X(), W = "decimalExponentSign";
|
|
1159
1256
|
return;
|
|
1160
1257
|
}
|
|
1161
|
-
if (
|
|
1162
|
-
|
|
1258
|
+
if (P.isDigit(q)) {
|
|
1259
|
+
G += X(), W = "decimalExponentInteger";
|
|
1163
1260
|
return;
|
|
1164
1261
|
}
|
|
1165
1262
|
throw Q(X());
|
|
1166
1263
|
},
|
|
1167
1264
|
decimalExponentSign: function() {
|
|
1168
|
-
if (
|
|
1169
|
-
|
|
1265
|
+
if (P.isDigit(q)) {
|
|
1266
|
+
G += X(), W = "decimalExponentInteger";
|
|
1170
1267
|
return;
|
|
1171
1268
|
}
|
|
1172
1269
|
throw Q(X());
|
|
1173
1270
|
},
|
|
1174
1271
|
decimalExponentInteger: function() {
|
|
1175
|
-
if (
|
|
1176
|
-
|
|
1272
|
+
if (P.isDigit(q)) {
|
|
1273
|
+
G += X();
|
|
1177
1274
|
return;
|
|
1178
1275
|
}
|
|
1179
|
-
return Z("numeric", K * Number(
|
|
1276
|
+
return Z("numeric", K * Number(G));
|
|
1180
1277
|
},
|
|
1181
1278
|
hexadecimal: function() {
|
|
1182
|
-
if (
|
|
1183
|
-
|
|
1279
|
+
if (P.isHexDigit(q)) {
|
|
1280
|
+
G += X(), W = "hexadecimalInteger";
|
|
1184
1281
|
return;
|
|
1185
1282
|
}
|
|
1186
1283
|
throw Q(X());
|
|
1187
1284
|
},
|
|
1188
1285
|
hexadecimalInteger: function() {
|
|
1189
|
-
if (
|
|
1190
|
-
|
|
1286
|
+
if (P.isHexDigit(q)) {
|
|
1287
|
+
G += X();
|
|
1191
1288
|
return;
|
|
1192
1289
|
}
|
|
1193
|
-
return Z("numeric", K * Number(
|
|
1290
|
+
return Z("numeric", K * Number(G));
|
|
1194
1291
|
},
|
|
1195
1292
|
string: function() {
|
|
1196
1293
|
switch (q) {
|
|
1197
1294
|
case "\\":
|
|
1198
|
-
X(),
|
|
1295
|
+
X(), G += ue();
|
|
1199
1296
|
return;
|
|
1200
1297
|
case "\"":
|
|
1201
|
-
if (
|
|
1202
|
-
|
|
1298
|
+
if (se) return X(), Z("string", G);
|
|
1299
|
+
G += X();
|
|
1203
1300
|
return;
|
|
1204
1301
|
case "'":
|
|
1205
|
-
if (!
|
|
1206
|
-
|
|
1302
|
+
if (!se) return X(), Z("string", G);
|
|
1303
|
+
G += X();
|
|
1207
1304
|
return;
|
|
1208
1305
|
case "\n":
|
|
1209
1306
|
case "\r": throw Q(X());
|
|
@@ -1213,32 +1310,32 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1213
1310
|
break;
|
|
1214
1311
|
case void 0: throw Q(X());
|
|
1215
1312
|
}
|
|
1216
|
-
|
|
1313
|
+
G += X();
|
|
1217
1314
|
},
|
|
1218
1315
|
start: function() {
|
|
1219
1316
|
switch (q) {
|
|
1220
1317
|
case "{":
|
|
1221
1318
|
case "[": return Z("punctuator", X());
|
|
1222
1319
|
}
|
|
1223
|
-
|
|
1320
|
+
W = "value";
|
|
1224
1321
|
},
|
|
1225
1322
|
beforePropertyName: function() {
|
|
1226
1323
|
switch (q) {
|
|
1227
1324
|
case "$":
|
|
1228
1325
|
case "_":
|
|
1229
|
-
|
|
1326
|
+
G = X(), W = "identifierName";
|
|
1230
1327
|
return;
|
|
1231
1328
|
case "\\":
|
|
1232
|
-
X(),
|
|
1329
|
+
X(), W = "identifierNameStartEscape";
|
|
1233
1330
|
return;
|
|
1234
1331
|
case "}": return Z("punctuator", X());
|
|
1235
1332
|
case "\"":
|
|
1236
1333
|
case "'":
|
|
1237
|
-
|
|
1334
|
+
se = X() === "\"", W = "string";
|
|
1238
1335
|
return;
|
|
1239
1336
|
}
|
|
1240
|
-
if (
|
|
1241
|
-
|
|
1337
|
+
if (P.isIdStartChar(q)) {
|
|
1338
|
+
G += X(), W = "identifierName";
|
|
1242
1339
|
return;
|
|
1243
1340
|
}
|
|
1244
1341
|
throw Q(X());
|
|
@@ -1248,7 +1345,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1248
1345
|
throw Q(X());
|
|
1249
1346
|
},
|
|
1250
1347
|
beforePropertyValue: function() {
|
|
1251
|
-
|
|
1348
|
+
W = "value";
|
|
1252
1349
|
},
|
|
1253
1350
|
afterPropertyValue: function() {
|
|
1254
1351
|
switch (q) {
|
|
@@ -1259,7 +1356,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1259
1356
|
},
|
|
1260
1357
|
beforeArrayValue: function() {
|
|
1261
1358
|
if (q === "]") return Z("punctuator", X());
|
|
1262
|
-
|
|
1359
|
+
W = "value";
|
|
1263
1360
|
},
|
|
1264
1361
|
afterArrayValue: function() {
|
|
1265
1362
|
switch (q) {
|
|
@@ -1276,8 +1373,8 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1276
1373
|
return {
|
|
1277
1374
|
type: e,
|
|
1278
1375
|
value: t,
|
|
1279
|
-
line:
|
|
1280
|
-
column:
|
|
1376
|
+
line: R,
|
|
1377
|
+
column: z
|
|
1281
1378
|
};
|
|
1282
1379
|
}
|
|
1283
1380
|
function le(e) {
|
|
@@ -1296,7 +1393,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1296
1393
|
case "t": return X(), " ";
|
|
1297
1394
|
case "v": return X(), "\v";
|
|
1298
1395
|
case "0":
|
|
1299
|
-
if (X(),
|
|
1396
|
+
if (X(), P.isDigit(Y())) throw Q(X());
|
|
1300
1397
|
return "\0";
|
|
1301
1398
|
case "x": return X(), de();
|
|
1302
1399
|
case "u": return X(), fe();
|
|
@@ -1319,27 +1416,27 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1319
1416
|
}
|
|
1320
1417
|
function de() {
|
|
1321
1418
|
var e = "", t = Y();
|
|
1322
|
-
if (!
|
|
1419
|
+
if (!P.isHexDigit(t) || (e += X(), t = Y(), !P.isHexDigit(t))) throw Q(X());
|
|
1323
1420
|
return e += X(), String.fromCodePoint(parseInt(e, 16));
|
|
1324
1421
|
}
|
|
1325
1422
|
function fe() {
|
|
1326
1423
|
for (var e = "", t = 4; t-- > 0;) {
|
|
1327
1424
|
var n = Y();
|
|
1328
|
-
if (!
|
|
1425
|
+
if (!P.isHexDigit(n)) throw Q(X());
|
|
1329
1426
|
e += X();
|
|
1330
1427
|
}
|
|
1331
1428
|
return String.fromCodePoint(parseInt(e, 16));
|
|
1332
1429
|
}
|
|
1333
1430
|
var pe = {
|
|
1334
1431
|
start: function() {
|
|
1335
|
-
if (
|
|
1432
|
+
if (B.type === "eof") throw ge();
|
|
1336
1433
|
me();
|
|
1337
1434
|
},
|
|
1338
1435
|
beforePropertyName: function() {
|
|
1339
|
-
switch (
|
|
1436
|
+
switch (B.type) {
|
|
1340
1437
|
case "identifier":
|
|
1341
1438
|
case "string":
|
|
1342
|
-
|
|
1439
|
+
V = B.value, I = "afterPropertyName";
|
|
1343
1440
|
return;
|
|
1344
1441
|
case "punctuator":
|
|
1345
1442
|
he();
|
|
@@ -1348,35 +1445,35 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1348
1445
|
}
|
|
1349
1446
|
},
|
|
1350
1447
|
afterPropertyName: function() {
|
|
1351
|
-
if (
|
|
1352
|
-
|
|
1448
|
+
if (B.type === "eof") throw ge();
|
|
1449
|
+
I = "beforePropertyValue";
|
|
1353
1450
|
},
|
|
1354
1451
|
beforePropertyValue: function() {
|
|
1355
|
-
if (
|
|
1452
|
+
if (B.type === "eof") throw ge();
|
|
1356
1453
|
me();
|
|
1357
1454
|
},
|
|
1358
1455
|
beforeArrayValue: function() {
|
|
1359
|
-
if (
|
|
1360
|
-
if (
|
|
1456
|
+
if (B.type === "eof") throw ge();
|
|
1457
|
+
if (B.type === "punctuator" && B.value === "]") {
|
|
1361
1458
|
he();
|
|
1362
1459
|
return;
|
|
1363
1460
|
}
|
|
1364
1461
|
me();
|
|
1365
1462
|
},
|
|
1366
1463
|
afterPropertyValue: function() {
|
|
1367
|
-
if (
|
|
1368
|
-
switch (
|
|
1464
|
+
if (B.type === "eof") throw ge();
|
|
1465
|
+
switch (B.value) {
|
|
1369
1466
|
case ",":
|
|
1370
|
-
|
|
1467
|
+
I = "beforePropertyName";
|
|
1371
1468
|
return;
|
|
1372
1469
|
case "}": he();
|
|
1373
1470
|
}
|
|
1374
1471
|
},
|
|
1375
1472
|
afterArrayValue: function() {
|
|
1376
|
-
if (
|
|
1377
|
-
switch (
|
|
1473
|
+
if (B.type === "eof") throw ge();
|
|
1474
|
+
switch (B.value) {
|
|
1378
1475
|
case ",":
|
|
1379
|
-
|
|
1476
|
+
I = "beforeArrayValue";
|
|
1380
1477
|
return;
|
|
1381
1478
|
case "]": he();
|
|
1382
1479
|
}
|
|
@@ -1385,9 +1482,9 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1385
1482
|
};
|
|
1386
1483
|
function me() {
|
|
1387
1484
|
var e;
|
|
1388
|
-
switch (
|
|
1485
|
+
switch (B.type) {
|
|
1389
1486
|
case "punctuator":
|
|
1390
|
-
switch (
|
|
1487
|
+
switch (B.value) {
|
|
1391
1488
|
case "{":
|
|
1392
1489
|
e = {};
|
|
1393
1490
|
break;
|
|
@@ -1397,37 +1494,37 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1397
1494
|
case "null":
|
|
1398
1495
|
case "boolean":
|
|
1399
1496
|
case "numeric":
|
|
1400
|
-
case "string": e =
|
|
1497
|
+
case "string": e = B.value;
|
|
1401
1498
|
}
|
|
1402
|
-
if (
|
|
1499
|
+
if (H === void 0) H = e;
|
|
1403
1500
|
else {
|
|
1404
|
-
var t =
|
|
1405
|
-
Array.isArray(t) ? t.push(e) : Object.defineProperty(t,
|
|
1501
|
+
var t = L[L.length - 1];
|
|
1502
|
+
Array.isArray(t) ? t.push(e) : Object.defineProperty(t, V, {
|
|
1406
1503
|
value: e,
|
|
1407
1504
|
writable: !0,
|
|
1408
1505
|
enumerable: !0,
|
|
1409
1506
|
configurable: !0
|
|
1410
1507
|
});
|
|
1411
1508
|
}
|
|
1412
|
-
if (typeof e == "object" && e)
|
|
1509
|
+
if (typeof e == "object" && e) L.push(e), I = Array.isArray(e) ? "beforeArrayValue" : "beforePropertyName";
|
|
1413
1510
|
else {
|
|
1414
|
-
var n =
|
|
1415
|
-
|
|
1511
|
+
var n = L[L.length - 1];
|
|
1512
|
+
I = n == null ? "end" : Array.isArray(n) ? "afterArrayValue" : "afterPropertyValue";
|
|
1416
1513
|
}
|
|
1417
1514
|
}
|
|
1418
1515
|
function he() {
|
|
1419
|
-
|
|
1420
|
-
var e =
|
|
1421
|
-
|
|
1516
|
+
L.pop();
|
|
1517
|
+
var e = L[L.length - 1];
|
|
1518
|
+
I = e == null ? "end" : Array.isArray(e) ? "afterArrayValue" : "afterPropertyValue";
|
|
1422
1519
|
}
|
|
1423
1520
|
function Q(e) {
|
|
1424
|
-
return be(e === void 0 ? "JSON5: invalid end of input at " +
|
|
1521
|
+
return be(e === void 0 ? "JSON5: invalid end of input at " + R + ":" + z : "JSON5: invalid character '" + ye(e) + "' at " + R + ":" + z);
|
|
1425
1522
|
}
|
|
1426
1523
|
function ge() {
|
|
1427
|
-
return be("JSON5: invalid end of input at " +
|
|
1524
|
+
return be("JSON5: invalid end of input at " + R + ":" + z);
|
|
1428
1525
|
}
|
|
1429
1526
|
function _e() {
|
|
1430
|
-
return
|
|
1527
|
+
return z -= 5, be("JSON5: invalid identifier character at " + R + ":" + z);
|
|
1431
1528
|
}
|
|
1432
1529
|
function ve(e) {
|
|
1433
1530
|
console.warn("JSON5: '" + ye(e) + "' in strings is not valid ECMAScript; consider escaping");
|
|
@@ -1456,10 +1553,10 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1456
1553
|
}
|
|
1457
1554
|
function be(e) {
|
|
1458
1555
|
var t = SyntaxError(e);
|
|
1459
|
-
return t.lineNumber =
|
|
1556
|
+
return t.lineNumber = R, t.columnNumber = z, t;
|
|
1460
1557
|
}
|
|
1461
1558
|
return {
|
|
1462
|
-
parse:
|
|
1559
|
+
parse: oe,
|
|
1463
1560
|
stringify: function(e, t, n) {
|
|
1464
1561
|
var r = [], i = "", a, o, s = "", c;
|
|
1465
1562
|
if (typeof t == "object" && t && !Array.isArray(t) && (n = t.space, c = t.quote, t = t.replacer), typeof t == "function") o = t;
|
|
@@ -1506,7 +1603,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1506
1603
|
case "\"":
|
|
1507
1604
|
t[a]++, r += a;
|
|
1508
1605
|
continue;
|
|
1509
|
-
case "\0": if (
|
|
1606
|
+
case "\0": if (P.isDigit(e[i + 1])) {
|
|
1510
1607
|
r += "\\x00";
|
|
1511
1608
|
continue;
|
|
1512
1609
|
}
|
|
@@ -1554,8 +1651,8 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1554
1651
|
function g(e) {
|
|
1555
1652
|
if (e.length === 0) return m(e, !0);
|
|
1556
1653
|
var t = String.fromCodePoint(e.codePointAt(0));
|
|
1557
|
-
if (!
|
|
1558
|
-
for (var n = t.length; n < e.length; n++) if (!
|
|
1654
|
+
if (!P.isIdStartChar(t)) return m(e, !0);
|
|
1655
|
+
for (var n = t.length; n < e.length; n++) if (!P.isIdContinueChar(String.fromCodePoint(e.codePointAt(n)))) return m(e, !0);
|
|
1559
1656
|
return e;
|
|
1560
1657
|
}
|
|
1561
1658
|
function _(e) {
|
|
@@ -1579,7 +1676,7 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1579
1676
|
}
|
|
1580
1677
|
};
|
|
1581
1678
|
}));
|
|
1582
|
-
})))(), 1),
|
|
1679
|
+
})))(), 1), Fe = {
|
|
1583
1680
|
ball: 1,
|
|
1584
1681
|
red: 2,
|
|
1585
1682
|
blue: 4,
|
|
@@ -1593,36 +1690,36 @@ var Ce = "edb227eac070ad86a151", we = /* @__PURE__ */ c((/* @__PURE__ */ o(((e,
|
|
|
1593
1690
|
c2: 1073741824,
|
|
1594
1691
|
c3: -2147483648,
|
|
1595
1692
|
all: 63
|
|
1596
|
-
},
|
|
1693
|
+
}, Ie = (e) => {
|
|
1597
1694
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("Expected an object");
|
|
1598
1695
|
return e;
|
|
1599
1696
|
}, $ = (e, t, n = -4096, r = 4096) => {
|
|
1600
1697
|
let i = e === void 0 ? t : e;
|
|
1601
1698
|
if (typeof i != "number" || !Number.isFinite(i) || i < n || i > r) throw Error(`Number must be between ${n} and ${r}`);
|
|
1602
1699
|
return i;
|
|
1603
|
-
},
|
|
1700
|
+
}, Le = (e, t = [0, 0]) => {
|
|
1604
1701
|
if (e === void 0) return [...t];
|
|
1605
1702
|
if (!Array.isArray(e) || e.length !== 2) throw Error("Expected [x, y]");
|
|
1606
1703
|
return [$(e[0], 0), $(e[1], 0)];
|
|
1607
|
-
},
|
|
1704
|
+
}, Re = (e, t) => {
|
|
1608
1705
|
if (e === void 0) return [];
|
|
1609
1706
|
if (!Array.isArray(e) || e.length > t) throw Error(`Array limit: ${t}`);
|
|
1610
1707
|
return e;
|
|
1611
1708
|
};
|
|
1612
|
-
function
|
|
1613
|
-
return e === void 0 ? t : typeof e == "number" ? $(e, t, -2147483648, 4294967295) | 0 :
|
|
1614
|
-
if (typeof t != "string" || !Object.hasOwn(
|
|
1615
|
-
return e |
|
|
1709
|
+
function ze(e, t) {
|
|
1710
|
+
return e === void 0 ? t : typeof e == "number" ? $(e, t, -2147483648, 4294967295) | 0 : Re(e, 16).reduce((e, t) => {
|
|
1711
|
+
if (typeof t != "string" || !Object.hasOwn(Fe, t)) throw Error("Unknown collision flag");
|
|
1712
|
+
return e | Fe[t];
|
|
1616
1713
|
}, 0);
|
|
1617
1714
|
}
|
|
1618
|
-
function
|
|
1715
|
+
function Be(e, t = "FFFFFF") {
|
|
1619
1716
|
if (e === void 0) return t;
|
|
1620
1717
|
if (e === "transparent") return e;
|
|
1621
1718
|
if (Array.isArray(e) && e.length === 3) return e.map((e) => Math.round($(e, 0, 0, 255)).toString(16).padStart(2, "0")).join("");
|
|
1622
1719
|
if (typeof e == "string" && /^[0-9a-f]{6}$/i.test(e)) return e;
|
|
1623
1720
|
throw Error("Invalid color");
|
|
1624
1721
|
}
|
|
1625
|
-
var
|
|
1722
|
+
var Ve = Object.fromEntries(Object.entries({
|
|
1626
1723
|
root: "version physicsMode name width height maxViewWidth cameraFollow spawnDistance canBeStored kickOffReset bg traits vertexes segments goals discs planes joints redSpawnPoints blueSpawnPoints playerPhysics ballPhysics",
|
|
1627
1724
|
bg: "type width height kickOffRadius cornerRadius goalLine color",
|
|
1628
1725
|
vertexes: "trait x y bCoef cMask cGroup",
|
|
@@ -1632,7 +1729,7 @@ var je = Object.fromEntries(Object.entries({
|
|
|
1632
1729
|
goals: "trait p0 p1 team",
|
|
1633
1730
|
joints: "trait d0 d1 length strength color",
|
|
1634
1731
|
playerPhysics: "trait pos speed gravity radius invMass damping bCoef cGroup cMask color acceleration kickingAcceleration kickingDamping kickStrength kickback"
|
|
1635
|
-
}).map(([e, t]) => [e, new Set(t.split(" "))])),
|
|
1732
|
+
}).map(([e, t]) => [e, new Set(t.split(" "))])), He = new Set([
|
|
1636
1733
|
"vertexes",
|
|
1637
1734
|
"segments",
|
|
1638
1735
|
"discs",
|
|
@@ -1640,15 +1737,15 @@ var je = Object.fromEntries(Object.entries({
|
|
|
1640
1737
|
"goals",
|
|
1641
1738
|
"joints",
|
|
1642
1739
|
"playerPhysics"
|
|
1643
|
-
].flatMap((e) => [...
|
|
1644
|
-
function
|
|
1740
|
+
].flatMap((e) => [...Ve[e]]));
|
|
1741
|
+
function Ue(e) {
|
|
1645
1742
|
let t = [], n = (e, t) => {
|
|
1646
|
-
let n = t.length > 80 ? t.slice(0, 80)
|
|
1647
|
-
return e + (/^[A-Za-z_$][\w$]*$/.test(n) ?
|
|
1743
|
+
let n = t.length > 80 ? `${t.slice(0, 80)}…` : t;
|
|
1744
|
+
return e + (/^[A-Za-z_$][\w$]*$/.test(n) ? `.${n}` : `[${JSON.stringify(n)}]`);
|
|
1648
1745
|
}, r = (e, r, i) => {
|
|
1649
|
-
if (e && typeof e == "object" && !Array.isArray(e)) for (let a of Object.keys(e)) r.has(a) || (t.length < 64 ? t.push(
|
|
1746
|
+
if (e && typeof e == "object" && !Array.isArray(e)) for (let a of Object.keys(e)) r.has(a) || (t.length < 64 ? t.push(`Unsupported stadium field: ${n(i, a)}`) : t.length === 64 && t.push("Additional unsupported stadium fields omitted."));
|
|
1650
1747
|
};
|
|
1651
|
-
r(e,
|
|
1748
|
+
r(e, Ve.root, "$"), r(e.bg, Ve.bg, "$.bg");
|
|
1652
1749
|
for (let t of [
|
|
1653
1750
|
"vertexes",
|
|
1654
1751
|
"segments",
|
|
@@ -1658,66 +1755,68 @@ function Ne(e) {
|
|
|
1658
1755
|
"joints"
|
|
1659
1756
|
]) {
|
|
1660
1757
|
let n = e[t];
|
|
1661
|
-
Array.isArray(n) && n.forEach((e, n) =>
|
|
1758
|
+
Array.isArray(n) && n.forEach((e, n) => {
|
|
1759
|
+
r(e, Ve[t], `$.${t}[${n}]`);
|
|
1760
|
+
});
|
|
1662
1761
|
}
|
|
1663
|
-
if (r(e.ballPhysics,
|
|
1762
|
+
if (r(e.ballPhysics, Ve.discs, "$.ballPhysics"), r(e.playerPhysics, Ve.playerPhysics, "$.playerPhysics"), e.traits && typeof e.traits == "object" && !Array.isArray(e.traits)) for (let [t, i] of Object.entries(e.traits)) r(i, He, n("$.traits", t));
|
|
1664
1763
|
return t;
|
|
1665
1764
|
}
|
|
1666
|
-
function
|
|
1765
|
+
function We(e, t, n, r, i) {
|
|
1667
1766
|
let a = e === "hbs" ? 1 : Math.ceil(2 * Math.SQRT2 * 100 / Math.min(10, i));
|
|
1668
1767
|
if ((t + 32) * (n + t + 32 + r) * a > 2e6) throw Error("Stadium collision complexity exceeds the room budget");
|
|
1669
1768
|
}
|
|
1670
|
-
function
|
|
1769
|
+
function Ge(e) {
|
|
1671
1770
|
if (new TextEncoder().encode(e).length > 262144) throw Error("Stadium exceeds 256 KB");
|
|
1672
|
-
let t =
|
|
1771
|
+
let t = Ie(Pe.default.parse(e));
|
|
1673
1772
|
if (t.physicsMode !== void 0 && t.physicsMode !== "hbs" && t.physicsMode !== "substeps") throw Error("Invalid physics mode");
|
|
1674
1773
|
let n = t.physicsMode === "substeps" ? "substeps" : "hbs";
|
|
1675
1774
|
if (t.version !== void 0 && t.version !== 1) throw Error("Unsupported stadium version");
|
|
1676
|
-
let r = t.traits === void 0 ? {} :
|
|
1677
|
-
let t =
|
|
1775
|
+
let r = t.traits === void 0 ? {} : Ie(t.traits), i = (e) => {
|
|
1776
|
+
let t = Ie(e);
|
|
1678
1777
|
if (t.trait === void 0) return t;
|
|
1679
1778
|
if (typeof t.trait != "string" || !Object.hasOwn(r, t.trait)) throw Error("Unknown trait");
|
|
1680
1779
|
return {
|
|
1681
|
-
...
|
|
1780
|
+
...Ie(r[t.trait]),
|
|
1682
1781
|
...t
|
|
1683
1782
|
};
|
|
1684
1783
|
}, a = (e, t = !1) => ({
|
|
1685
|
-
pos:
|
|
1686
|
-
speed:
|
|
1687
|
-
gravity:
|
|
1784
|
+
pos: Le(e.pos),
|
|
1785
|
+
speed: Le(e.speed),
|
|
1786
|
+
gravity: Le(e.gravity),
|
|
1688
1787
|
radius: $(e.radius, 10, .5, 100),
|
|
1689
1788
|
invMass: $(e.invMass, 1, 0, 8192),
|
|
1690
1789
|
damping: $(e.damping, .99, 0, 8192),
|
|
1691
1790
|
bCoef: $(e.bCoef, .5, -1, 8192),
|
|
1692
|
-
cGroup:
|
|
1693
|
-
cMask:
|
|
1694
|
-
color:
|
|
1695
|
-
}), o =
|
|
1791
|
+
cGroup: ze(e.cGroup, t ? 193 : 63),
|
|
1792
|
+
cMask: ze(e.cMask, 63),
|
|
1793
|
+
color: Be(e.color)
|
|
1794
|
+
}), o = Re(t.discs, 63).map((e) => a(i(e)));
|
|
1696
1795
|
if (t.ballPhysics !== "disc0") {
|
|
1697
1796
|
let e = a(t.ballPhysics === void 0 ? {} : i(t.ballPhysics), !0);
|
|
1698
1797
|
e.cGroup |= 192, o.unshift(e);
|
|
1699
1798
|
} else if (!o.length) throw Error("disc0 needs a disc");
|
|
1700
|
-
let s =
|
|
1799
|
+
let s = Re(t.vertexes, 1024).map((e) => i(e)), c = [], l = [], u = Ue(t);
|
|
1701
1800
|
for (let e of s) c.push({
|
|
1702
1801
|
a: [$(e.x, 0), $(e.y, 0)],
|
|
1703
1802
|
b: [$(e.x, 0), $(e.y, 0)],
|
|
1704
1803
|
bCoef: $(e.bCoef, 1, -1, 8192),
|
|
1705
|
-
cGroup:
|
|
1706
|
-
cMask:
|
|
1804
|
+
cGroup: ze(e.cGroup, 32),
|
|
1805
|
+
cMask: ze(e.cMask, 63),
|
|
1707
1806
|
bias: 0,
|
|
1708
1807
|
color: "transparent",
|
|
1709
1808
|
vis: !1
|
|
1710
1809
|
});
|
|
1711
1810
|
let d = [...c];
|
|
1712
|
-
for (let e of
|
|
1811
|
+
for (let e of Re(t.segments, 1024)) {
|
|
1713
1812
|
let t = i(e), n = $(t.v0, -1, 0, s.length - 1), r = $(t.v1, -1, 0, s.length - 1);
|
|
1714
1813
|
if (!Number.isInteger(n) || !Number.isInteger(r)) throw Error("Vertex indices must be integers");
|
|
1715
1814
|
let a = [$(s[n].x, 0), $(s[n].y, 0)], o = [$(s[r].x, 0), $(s[r].y, 0)], u = {
|
|
1716
1815
|
bCoef: $(t.bCoef, 1, -1, 8192),
|
|
1717
|
-
cGroup:
|
|
1718
|
-
cMask:
|
|
1816
|
+
cGroup: ze(t.cGroup, 32),
|
|
1817
|
+
cMask: ze(t.cMask, 63),
|
|
1719
1818
|
bias: $(t.bias, 0, -100, 100),
|
|
1720
|
-
color:
|
|
1819
|
+
color: Be(t.color, "000000"),
|
|
1721
1820
|
vis: t.vis !== !1
|
|
1722
1821
|
}, f = t.curveF === void 0 ? $(t.curve, 0, -359, 359) : 2 * Math.atan2(1, $(t.curveF, 0, -1e8, 1e8)) * 180 / Math.PI;
|
|
1723
1822
|
if (Math.abs(f) < 1e-4) {
|
|
@@ -1731,22 +1830,22 @@ function Fe(e) {
|
|
|
1731
1830
|
}
|
|
1732
1831
|
let p = f * Math.PI / 180, m = o[0] - a[0], h = o[1] - a[1];
|
|
1733
1832
|
if (Math.hypot(m, h) < .001) throw Error("Arc endpoints overlap");
|
|
1734
|
-
let g = 1 / (2 * Math.tan(p / 2)), _ = [(a[0] + o[0]) / 2 - h * g, (a[1] + o[1]) / 2 + m * g], v = Math.hypot(a[0] - _[0], a[1] - _[1]),
|
|
1735
|
-
if (c.length +
|
|
1833
|
+
let g = 1 / (2 * Math.tan(p / 2)), _ = [(a[0] + o[0]) / 2 - h * g, (a[1] + o[1]) / 2 + m * g], v = Math.hypot(a[0] - _[0], a[1] - _[1]), ee = Math.atan2(a[1] - _[1], a[0] - _[0]), y = Math.ceil(Math.abs(p) / Math.max(1e-8, 2 * Math.acos(Math.max(-1, 1 - .15 / v))));
|
|
1834
|
+
if (c.length + y > 4096) throw Error("Compiled geometry exceeds 4096 segments");
|
|
1736
1835
|
let b = {
|
|
1737
1836
|
a,
|
|
1738
1837
|
b: o,
|
|
1739
1838
|
...u,
|
|
1740
1839
|
center: _,
|
|
1741
1840
|
radius: v,
|
|
1742
|
-
start:
|
|
1841
|
+
start: ee,
|
|
1743
1842
|
sweep: p,
|
|
1744
1843
|
major: t.curveF === void 0 ? Math.abs(f) > 180 : Number(t.curveF) <= 0
|
|
1745
1844
|
};
|
|
1746
1845
|
l.push(b), d.push(b);
|
|
1747
1846
|
let x = a;
|
|
1748
|
-
for (let e = 1; e <=
|
|
1749
|
-
let t = e ===
|
|
1847
|
+
for (let e = 1; e <= y; e++) {
|
|
1848
|
+
let t = e === y ? o : [_[0] + v * Math.cos(ee + p * e / y), _[1] + v * Math.sin(ee + p * e / y)];
|
|
1750
1849
|
c.push({
|
|
1751
1850
|
a: x,
|
|
1752
1851
|
b: t,
|
|
@@ -1770,8 +1869,8 @@ function Fe(e) {
|
|
|
1770
1869
|
kickStrength: $(f.kickStrength, 5, -8192, 8192),
|
|
1771
1870
|
kickback: $(f.kickback, 0, -8192, 8192)
|
|
1772
1871
|
};
|
|
1773
|
-
|
|
1774
|
-
let m = t.bg === void 0 ? {} :
|
|
1872
|
+
We(n, o.length, c.length, Re(t.planes, 64).length + Re(t.joints, 128).length, Math.min(p.radius, ...o.map((e) => e.radius)));
|
|
1873
|
+
let m = t.bg === void 0 ? {} : Ie(t.bg);
|
|
1775
1874
|
return {
|
|
1776
1875
|
version: 1,
|
|
1777
1876
|
physicsMode: n,
|
|
@@ -1787,7 +1886,7 @@ function Fe(e) {
|
|
|
1787
1886
|
goalLine: $(m.goalLine, 0, 0, 2048),
|
|
1788
1887
|
width: $(m.width, 0, 0, 2048),
|
|
1789
1888
|
height: $(m.height, 0, 0, 2048),
|
|
1790
|
-
color:
|
|
1889
|
+
color: Be(m.color, "718C5A"),
|
|
1791
1890
|
kickOffRadius: $(m.kickOffRadius, 0, 0, 500)
|
|
1792
1891
|
},
|
|
1793
1892
|
discs: o,
|
|
@@ -1797,24 +1896,24 @@ function Fe(e) {
|
|
|
1797
1896
|
player: p,
|
|
1798
1897
|
spawnDistance: $(t.spawnDistance, 200, 0, 1500),
|
|
1799
1898
|
kickOffReset: t.kickOffReset === "full" ? "full" : "partial",
|
|
1800
|
-
redSpawnPoints:
|
|
1801
|
-
blueSpawnPoints:
|
|
1899
|
+
redSpawnPoints: Re(t.redSpawnPoints, 32).map((e) => Le(e)),
|
|
1900
|
+
blueSpawnPoints: Re(t.blueSpawnPoints, 32).map((e) => Le(e)),
|
|
1802
1901
|
warnings: u,
|
|
1803
|
-
planes:
|
|
1804
|
-
let t = i(e), n =
|
|
1902
|
+
planes: Re(t.planes, 64).map((e) => {
|
|
1903
|
+
let t = i(e), n = Le(t.normal);
|
|
1805
1904
|
if (Math.hypot(...n) < 1e-6) throw Error("Plane normal is zero");
|
|
1806
1905
|
return {
|
|
1807
1906
|
normal: n,
|
|
1808
1907
|
dist: $(t.dist, 0),
|
|
1809
1908
|
bCoef: $(t.bCoef, 1, -1, 8192),
|
|
1810
|
-
cGroup:
|
|
1811
|
-
cMask:
|
|
1909
|
+
cGroup: ze(t.cGroup, 32),
|
|
1910
|
+
cMask: ze(t.cMask, 63)
|
|
1812
1911
|
};
|
|
1813
1912
|
}),
|
|
1814
|
-
goals:
|
|
1913
|
+
goals: Re(t.goals, 16).map((e) => {
|
|
1815
1914
|
let t = i(e);
|
|
1816
1915
|
if (t.team !== "red" && t.team !== "blue") throw Error("Invalid goal team");
|
|
1817
|
-
let n =
|
|
1916
|
+
let n = Le(t.p0), r = Le(t.p1);
|
|
1818
1917
|
if (Math.hypot(r[0] - n[0], r[1] - n[1]) < 1) throw Error("Goal has zero length");
|
|
1819
1918
|
return {
|
|
1820
1919
|
p0: n,
|
|
@@ -1822,22 +1921,22 @@ function Fe(e) {
|
|
|
1822
1921
|
team: t.team === "red" ? 1 : 2
|
|
1823
1922
|
};
|
|
1824
1923
|
}),
|
|
1825
|
-
joints:
|
|
1924
|
+
joints: Re(t.joints, 128).map((e) => {
|
|
1826
1925
|
let t = i(e), n = $(t.d0, -1, 0, o.length - 1), r = $(t.d1, -1, 0, o.length - 1);
|
|
1827
1926
|
if (!Number.isInteger(n) || !Number.isInteger(r) || n === r) throw Error("Invalid joint indices");
|
|
1828
|
-
let a = Math.hypot(o[r].pos[0] - o[n].pos[0], o[r].pos[1] - o[n].pos[1]), s = t.length == null ? [a, a] : typeof t.length == "number" ? [t.length, t.length] :
|
|
1927
|
+
let a = Math.hypot(o[r].pos[0] - o[n].pos[0], o[r].pos[1] - o[n].pos[1]), s = t.length == null ? [a, a] : typeof t.length == "number" ? [t.length, t.length] : Le(t.length);
|
|
1829
1928
|
return {
|
|
1830
1929
|
d0: n,
|
|
1831
1930
|
d1: r,
|
|
1832
1931
|
min: $(s[0], 0, 0),
|
|
1833
1932
|
max: $(s[1], 0, 0),
|
|
1834
1933
|
strength: t.strength === void 0 || t.strength === "rigid" ? "rigid" : $(t.strength, 0, -8192, 8192),
|
|
1835
|
-
color:
|
|
1934
|
+
color: Be(t.color, "000000")
|
|
1836
1935
|
};
|
|
1837
1936
|
})
|
|
1838
1937
|
};
|
|
1839
1938
|
}
|
|
1840
|
-
function
|
|
1939
|
+
function Ke(e = "Emerald Arena", t = 440, n = 220) {
|
|
1841
1940
|
let r = [
|
|
1842
1941
|
[-t, -n],
|
|
1843
1942
|
[t, -n],
|
|
@@ -1977,7 +2076,7 @@ function Ie(e = "Emerald Arena", t = 440, n = 220) {
|
|
|
1977
2076
|
}
|
|
1978
2077
|
}, null, 2);
|
|
1979
2078
|
}
|
|
1980
|
-
var
|
|
2079
|
+
var qe = `ball2d-core/1/${Ne}`, Je = 32, Ye = class e {
|
|
1981
2080
|
core;
|
|
1982
2081
|
terrain;
|
|
1983
2082
|
stadium;
|
|
@@ -1999,10 +2098,10 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
1999
2098
|
lastGoal = 0;
|
|
2000
2099
|
kickRate = 2;
|
|
2001
2100
|
setKickRateLimit(e, t, n) {
|
|
2002
|
-
this.kickRate =
|
|
2101
|
+
this.kickRate = Xe(e, t, n), this.core.kick_limits(this.kickRate & 255, this.kickRate >>> 8 & 255, this.kickRate >>> 16);
|
|
2003
2102
|
}
|
|
2004
2103
|
constructor(e) {
|
|
2005
|
-
this.core = e.exports, this.terrain = new
|
|
2104
|
+
this.core = e.exports, this.terrain = new pe(this.core);
|
|
2006
2105
|
}
|
|
2007
2106
|
configureSurface(e) {
|
|
2008
2107
|
if (this.phase !== "lobby" && this.phase !== "finished") throw Error("Stop the match before configuring its surface");
|
|
@@ -2018,7 +2117,7 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2018
2117
|
return this.terrain.enabled;
|
|
2019
2118
|
}
|
|
2020
2119
|
static async create(t, n) {
|
|
2021
|
-
let r = t ?? await (await fetch("/core.wasm?v=
|
|
2120
|
+
let r = t ?? await (await fetch("/core.wasm?v=5a27b77ea69c9f5e179f", { signal: n })).arrayBuffer();
|
|
2022
2121
|
if (Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", r))).map((e) => e.toString(16).padStart(2, "0")).join("") !== "1229b1b4ba3892d6073fb85b3b6231282c2d81ee270808cb0acda874d49cb87e") throw Error("Physics build changed. Refresh the page to load a matching version.");
|
|
2023
2122
|
return new e(await WebAssembly.instantiate(await WebAssembly.compile(r)));
|
|
2024
2123
|
}
|
|
@@ -2026,9 +2125,9 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2026
2125
|
return new Float64Array(this.core.memory.buffer, this.core.data_ptr(), this.core.count() * 18);
|
|
2027
2126
|
}
|
|
2028
2127
|
load(e) {
|
|
2029
|
-
this.stadium =
|
|
2128
|
+
this.stadium = Ge(e), this.source = e, this.core.reset(), this.terrain.disable(), this.colors = [], this.core.physics_mode(+(this.stadium.physicsMode === "substeps")), this.tick = 0, this.elapsed = 0, this.red = this.blue = 0, this.phase = "lobby", this.paused = !1, this.resumeTicks = 0, this.countdown = 0, this.kickoffActive = !0;
|
|
2030
2129
|
for (let e of this.stadium.discs) this.add(e);
|
|
2031
|
-
for (let e = 0; e <
|
|
2130
|
+
for (let e = 0; e < Je; e++) this.add(this.stadium.player, e + 1);
|
|
2032
2131
|
for (let e of this.stadium.colliders) if ("center" in e) {
|
|
2033
2132
|
let t = e;
|
|
2034
2133
|
this.core.arc(...t.center, t.radius, ...t.a, ...t.b, t.sweep, +t.major, t.bCoef, t.cGroup, t.cMask, t.bias);
|
|
@@ -2061,10 +2160,12 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2061
2160
|
0,
|
|
2062
2161
|
e.pos[0],
|
|
2063
2162
|
t ? 0 : e.pos[1]
|
|
2064
|
-
].forEach((e, t) =>
|
|
2163
|
+
].forEach((e, t) => {
|
|
2164
|
+
this.core.set_disc(n, t, e);
|
|
2165
|
+
});
|
|
2065
2166
|
}
|
|
2066
2167
|
index(e) {
|
|
2067
|
-
if (!Number.isInteger(e) || e < 0 || e >=
|
|
2168
|
+
if (!Number.isInteger(e) || e < 0 || e >= Je) throw Error("Invalid slot");
|
|
2068
2169
|
return this.stadium.discs.length + e;
|
|
2069
2170
|
}
|
|
2070
2171
|
joinPlayer(e) {
|
|
@@ -2087,8 +2188,8 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2087
2188
|
applyDiscProperties(e, t) {
|
|
2088
2189
|
let n = this.data;
|
|
2089
2190
|
if (this.phase === "lobby" || !Number.isInteger(e) || e < 0 || e >= this.colors.length || n[e * 18 + 12] > 0 && n[e * 18 + 13] === 0) return !1;
|
|
2090
|
-
let r =
|
|
2091
|
-
for (let [t, a] of
|
|
2191
|
+
let r = Me(t), i = !1;
|
|
2192
|
+
for (let [t, a] of je) {
|
|
2092
2193
|
let o = r[t];
|
|
2093
2194
|
if (o === void 0) continue;
|
|
2094
2195
|
let s = a === -1 ? this.colors[e] : n[e * 18 + a];
|
|
@@ -2098,9 +2199,9 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2098
2199
|
if (r.radius !== void 0) {
|
|
2099
2200
|
let t = r.radius;
|
|
2100
2201
|
for (let r = 0; r < this.colors.length; r++) r !== e && (t = Math.min(t, n[r * 18 + 4]));
|
|
2101
|
-
|
|
2202
|
+
We(this.stadium.physicsMode, this.stadium.discs.length, this.stadium.segments.length, this.stadium.planes.length + this.stadium.joints.length, t);
|
|
2102
2203
|
}
|
|
2103
|
-
for (let [t, i] of
|
|
2204
|
+
for (let [t, i] of je) {
|
|
2104
2205
|
let a = r[t];
|
|
2105
2206
|
a !== void 0 && (i === -1 ? this.colors[e] = a : n[e * 18 + i] = a);
|
|
2106
2207
|
}
|
|
@@ -2124,7 +2225,7 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2124
2225
|
let r = this.stadium.discs[n];
|
|
2125
2226
|
(e || n === 0 || this.stadium.kickOffReset === "full") && (this.restoreDiscProperties(n, r), t[n * 18] = r.pos[0], t[n * 18 + 1] = r.pos[1], t[n * 18 + 2] = r.speed[0], t[n * 18 + 3] = r.speed[1]);
|
|
2126
2227
|
}
|
|
2127
|
-
for (let e = 0; e <
|
|
2228
|
+
for (let e = 0; e < Je; e++) {
|
|
2128
2229
|
let n = this.index(e);
|
|
2129
2230
|
this.spawn(n, e, t[n * 18 + 13]);
|
|
2130
2231
|
}
|
|
@@ -2158,7 +2259,7 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2158
2259
|
--this.countdown <= 0 && (this.scoreLimit > 0 && Math.max(this.red, this.blue) >= this.scoreLimit || this.timeLimit > 0 && this.elapsed >= this.timeLimit * 60 && this.red !== this.blue ? this.finish() : (this.phase = "playing", this.resetPositions()));
|
|
2159
2260
|
return;
|
|
2160
2261
|
}
|
|
2161
|
-
for (let t = 0; t <
|
|
2262
|
+
for (let t = 0; t < Je; t++) {
|
|
2162
2263
|
let n = this.index(t) * 18, r = this.stadium.player.cMask;
|
|
2163
2264
|
e[n + 11] = r & -25 | (this.kickoffActive ? r & (this.kickoff === 1 ? 8 : 16) : 0);
|
|
2164
2265
|
}
|
|
@@ -2211,10 +2312,10 @@ var Le = `ball2d-core/1/${Ce}`, Re = class e {
|
|
|
2211
2312
|
for (let n = 0; n < e.discs.length; n += 18) if (e.discs[n + 4] < .5 || e.discs[n + 4] > 100 || e.discs[n + 5] < 0 || e.discs[n + 5] > 8192 || e.discs[n + 6] < 0 || e.discs[n + 6] > 8192 || e.discs[n + 7] < -1 || e.discs[n + 7] > 8192 || !t(e.discs[n + 10], 2147483647, -2147483648) || !t(e.discs[n + 11], 2147483647, -2147483648) || !t(e.discs[n + 13], 2) || !t(e.discs[n + 14], 31) || !t(e.discs[n + 15], 2047) || e.discs[n + 12] > 0 && (!Number.isInteger(e.discs[n + 17]) || e.discs[n + 17] < -255 || e.discs[n + 17] > 25500)) throw Error("Invalid disc properties");
|
|
2212
2313
|
let n = 10;
|
|
2213
2314
|
for (let t = 4; t < e.discs.length; t += 18) n = Math.min(n, e.discs[t]);
|
|
2214
|
-
|
|
2315
|
+
We(this.stadium.physicsMode, this.stadium.discs.length, this.stadium.segments.length, this.stadium.planes.length + this.stadium.joints.length, n), this.terrain.restore(e.surface === void 0 ? [] : e.surface), this.setKickRateLimit(e.kickRate & 255, e.kickRate >>> 8 & 255, e.kickRate >>> 16), this.tick = e.tick, this.elapsed = e.elapsed, this.red = e.red, this.blue = e.blue, this.phase = e.phase, this.paused = e.paused, this.resumeTicks = e.resumeTicks, this.countdown = e.countdown, this.kickoff = e.kickoff, this.kickoffActive = e.kickoffActive, this.scoreLimit = e.scoreLimit, this.timeLimit = e.timeLimit, this.data.set(e.discs), this.colors = [...e.colors];
|
|
2215
2316
|
}
|
|
2216
2317
|
};
|
|
2217
|
-
function
|
|
2318
|
+
function Xe(e, t, n) {
|
|
2218
2319
|
if (![
|
|
2219
2320
|
e,
|
|
2220
2321
|
t,
|
|
@@ -2222,20 +2323,56 @@ function ze(e, t, n) {
|
|
|
2222
2323
|
].every(Number.isInteger)) throw Error("Invalid kick rate limit");
|
|
2223
2324
|
return Math.max(0, Math.min(255, e)) | Math.max(0, Math.min(255, t)) << 8 | Math.max(0, Math.min(100, n)) << 16;
|
|
2224
2325
|
}
|
|
2225
|
-
function
|
|
2326
|
+
function Ze(e) {
|
|
2226
2327
|
let t = new URL(e);
|
|
2227
2328
|
if (!["http:", "https:"].includes(t.protocol) || t.username || t.password || t.pathname !== "/" || t.search || t.hash) throw Error("Expected an HTTP(S) service origin without credentials or a path");
|
|
2228
2329
|
return t.origin;
|
|
2229
2330
|
}
|
|
2230
|
-
function
|
|
2331
|
+
function Qe(e) {
|
|
2332
|
+
let t = new URL(e.assets);
|
|
2333
|
+
if (![
|
|
2334
|
+
"http:",
|
|
2335
|
+
"https:",
|
|
2336
|
+
"ball2d:"
|
|
2337
|
+
].includes(t.protocol) || !t.host || t.username || t.password || t.pathname !== "/" || t.search || t.hash) throw Error("Expected a root asset origin");
|
|
2338
|
+
let n = Ze(e.service), r = Ze(e.public);
|
|
2339
|
+
function i(e, t) {
|
|
2340
|
+
if (!e.startsWith("/") || e.startsWith("//") || e.includes("\\") || [...e].some((e) => e.charCodeAt(0) <= 32 || e.charCodeAt(0) === 127)) throw Error("Expected an absolute application path");
|
|
2341
|
+
let n = decodeURIComponent(e.split(/[?#]/, 1)[0]);
|
|
2342
|
+
if (n.includes("\\") || n.includes("//") || n.split("/").some((e) => e === "." || e === "..")) throw Error("Ambiguous application path");
|
|
2343
|
+
let r = new URL(e, t), i = new URL(t);
|
|
2344
|
+
if (r.protocol !== i.protocol || r.host !== i.host || r.username || r.password) throw Error("Application path escaped its runtime origin");
|
|
2345
|
+
return r;
|
|
2346
|
+
}
|
|
2347
|
+
return {
|
|
2348
|
+
serviceOrigin: n,
|
|
2349
|
+
publicOrigin: r,
|
|
2350
|
+
asset: (e) => i(e, t.href),
|
|
2351
|
+
public: (e) => i(e, r),
|
|
2352
|
+
api: (e) => {
|
|
2353
|
+
let t = i(e, n);
|
|
2354
|
+
if (!t.pathname.startsWith(`${m}/`) || t.hash) throw Error("Expected a versioned application API path");
|
|
2355
|
+
return t;
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
function $e() {
|
|
2360
|
+
let e = location.origin;
|
|
2361
|
+
return Qe({
|
|
2362
|
+
assets: e,
|
|
2363
|
+
service: e,
|
|
2364
|
+
public: e
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
function et(e = $e()) {
|
|
2231
2368
|
return {
|
|
2232
|
-
serviceOrigin:
|
|
2369
|
+
serviceOrigin: e.serviceOrigin,
|
|
2233
2370
|
signalingResume: !0,
|
|
2234
2371
|
createWebSocket: (e) => new WebSocket(e),
|
|
2235
2372
|
createPeerConnection: (e) => new RTCPeerConnection(e)
|
|
2236
2373
|
};
|
|
2237
2374
|
}
|
|
2238
|
-
var
|
|
2375
|
+
var tt = [
|
|
2239
2376
|
["classic", "Classic"],
|
|
2240
2377
|
["easy", "Easy"],
|
|
2241
2378
|
["small", "Small"],
|
|
@@ -2247,30 +2384,35 @@ var He = [
|
|
|
2247
2384
|
["big_hockey", "Big Hockey"],
|
|
2248
2385
|
["huge", "Huge"]
|
|
2249
2386
|
];
|
|
2250
|
-
function
|
|
2387
|
+
function nt(e) {
|
|
2251
2388
|
let t = /* @__PURE__ */ new Map();
|
|
2252
2389
|
return async (n) => {
|
|
2253
|
-
let r =
|
|
2390
|
+
let r = tt.find(([e, t]) => e === n || t === n);
|
|
2254
2391
|
if (!r) throw Error("Unknown default stadium");
|
|
2255
2392
|
let i = t.get(r[0]);
|
|
2256
2393
|
return i || (i = (async () => {
|
|
2257
2394
|
let t = await e(`/stadiums/${r[0]}.hbs`);
|
|
2258
2395
|
if (!t.ok) throw Error("Could not load stadium");
|
|
2259
2396
|
let n = await t.text();
|
|
2260
|
-
return
|
|
2397
|
+
return Ge(n), n;
|
|
2261
2398
|
})(), t.set(r[0], i), i.catch(() => t.delete(r[0]))), i;
|
|
2262
2399
|
};
|
|
2263
2400
|
}
|
|
2264
|
-
function
|
|
2265
|
-
let
|
|
2401
|
+
function rt(e = $e()) {
|
|
2402
|
+
let t = et(e), n = (e, t) => fetch(e, t);
|
|
2266
2403
|
return {
|
|
2267
|
-
network:
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2404
|
+
network: t,
|
|
2405
|
+
publicOrigin: e.publicOrigin,
|
|
2406
|
+
request: n,
|
|
2407
|
+
loadEngine: async (t) => {
|
|
2408
|
+
let r = await n(e.asset(`/core.wasm?v=${Ne}`), { signal: t });
|
|
2409
|
+
if (!r.ok) throw Error("Could not load bundled physics engine");
|
|
2410
|
+
return Ye.create(await r.arrayBuffer(), t);
|
|
2411
|
+
},
|
|
2412
|
+
loadStadium: nt((t) => n(e.asset(t)))
|
|
2271
2413
|
};
|
|
2272
2414
|
}
|
|
2273
|
-
var
|
|
2415
|
+
var it = {
|
|
2274
2416
|
message: {
|
|
2275
2417
|
burst: 240,
|
|
2276
2418
|
perSecond: 160
|
|
@@ -2283,12 +2425,12 @@ var Ge = {
|
|
|
2283
2425
|
burst: 4,
|
|
2284
2426
|
perSecond: 1
|
|
2285
2427
|
}
|
|
2286
|
-
},
|
|
2428
|
+
}, at = class {
|
|
2287
2429
|
peers = /* @__PURE__ */ new Map();
|
|
2288
2430
|
allow(e, t, n = performance.now()) {
|
|
2289
2431
|
let r = this.peers.get(e);
|
|
2290
2432
|
r || (r = {}, this.peers.set(e, r));
|
|
2291
|
-
let { burst: i, perSecond: a } =
|
|
2433
|
+
let { burst: i, perSecond: a } = it[t], o = r[t] ?? {
|
|
2292
2434
|
tokens: i,
|
|
2293
2435
|
at: n
|
|
2294
2436
|
};
|
|
@@ -2300,16 +2442,16 @@ var Ge = {
|
|
|
2300
2442
|
clear() {
|
|
2301
2443
|
this.peers.clear();
|
|
2302
2444
|
}
|
|
2303
|
-
},
|
|
2445
|
+
}, ot = 33554432, st = new TextEncoder();
|
|
2304
2446
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
2305
|
-
function
|
|
2447
|
+
function ct(e) {
|
|
2306
2448
|
let t = 2166136261;
|
|
2307
2449
|
for (let n of e) t = Math.imul(t ^ n, 16777619);
|
|
2308
2450
|
return t >>> 0;
|
|
2309
2451
|
}
|
|
2310
|
-
function
|
|
2452
|
+
function lt(e) {
|
|
2311
2453
|
if (e.length > 33554432) throw Error("Replay exceeds 32 MB");
|
|
2312
|
-
let t =
|
|
2454
|
+
let t = ce(e, { level: 6 }), n = new Uint8Array(16 + t.length), r = new DataView(n.buffer);
|
|
2313
2455
|
return n.set([
|
|
2314
2456
|
66,
|
|
2315
2457
|
50,
|
|
@@ -2319,12 +2461,12 @@ function Xe(e) {
|
|
|
2319
2461
|
0,
|
|
2320
2462
|
0,
|
|
2321
2463
|
0
|
|
2322
|
-
]), r.setUint32(8, e.length, !0), r.setUint32(12,
|
|
2464
|
+
]), r.setUint32(8, e.length, !0), r.setUint32(12, ct(e), !0), n.set(t, 16), n;
|
|
2323
2465
|
}
|
|
2324
|
-
function
|
|
2466
|
+
function ut(e) {
|
|
2325
2467
|
if (typeof e == "string") {
|
|
2326
|
-
if (
|
|
2327
|
-
return
|
|
2468
|
+
if (st.encode(e).length > 33554432) throw Error("Replay exceeds 32 MB");
|
|
2469
|
+
return st.encode(e);
|
|
2328
2470
|
}
|
|
2329
2471
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2330
2472
|
if (t.length > 33554432) throw Error("Replay exceeds 32 MB");
|
|
@@ -2332,15 +2474,15 @@ function Ze(e) {
|
|
|
2332
2474
|
if (t.length < 17 || t[4] !== 1 || t[5] || t[6] || t[7]) throw Error("Invalid compressed replay header");
|
|
2333
2475
|
let n = new DataView(t.buffer, t.byteOffset, t.byteLength), r = n.getUint32(8, !0);
|
|
2334
2476
|
if (!r || r > 33554432) throw Error("Invalid expanded replay size");
|
|
2335
|
-
let i = new Uint8Array(r), a = 0, o = !1, s = new
|
|
2477
|
+
let i = new Uint8Array(r), a = 0, o = !1, s = new Z((e, t) => {
|
|
2336
2478
|
if (a + e.length > r) throw Error("Expanded replay exceeds declared size");
|
|
2337
2479
|
i.set(e, a), a += e.length, o = t;
|
|
2338
2480
|
});
|
|
2339
2481
|
for (let e = 16; e < t.length; e += 1024) s.push(t.subarray(e, e + 1024), e + 1024 >= t.length);
|
|
2340
|
-
if (!o || a !== r ||
|
|
2482
|
+
if (!o || a !== r || ct(i) !== n.getUint32(12, !0)) throw Error("Compressed replay integrity failure");
|
|
2341
2483
|
return i;
|
|
2342
2484
|
}
|
|
2343
|
-
var
|
|
2485
|
+
var dt = [
|
|
2344
2486
|
"input",
|
|
2345
2487
|
"team",
|
|
2346
2488
|
"start",
|
|
@@ -2352,11 +2494,11 @@ var Qe = [
|
|
|
2352
2494
|
"join",
|
|
2353
2495
|
"disc",
|
|
2354
2496
|
"surface"
|
|
2355
|
-
],
|
|
2356
|
-
function
|
|
2357
|
-
return
|
|
2497
|
+
], ft = new TextEncoder(), pt = new TextDecoder("utf-8", { fatal: !0 });
|
|
2498
|
+
function mt(e) {
|
|
2499
|
+
return lt(ht(e));
|
|
2358
2500
|
}
|
|
2359
|
-
function
|
|
2501
|
+
function ht(e) {
|
|
2360
2502
|
let { commands: t, ...n } = e, r = t.some((e) => e.kind === "surface") || e.initial.surface !== void 0 || e.checkpoints.some((e) => e.state.surface !== void 0) ? 4 : t.some((e) => e.kind === "disc") ? 3 : e.checkpoints.length ? 2 : 1, i = 0, a = e.checkpoints.map((e) => {
|
|
2361
2503
|
let t = e.state.discs;
|
|
2362
2504
|
if (!Array.isArray(t) || t.length > 1728 || t.some((e) => !Number.isFinite(e))) throw Error("Invalid checkpoint discs");
|
|
@@ -2376,12 +2518,12 @@ function nt(e) {
|
|
|
2376
2518
|
};
|
|
2377
2519
|
});
|
|
2378
2520
|
if (a.length > 721) throw Error("Too many replay checkpoints");
|
|
2379
|
-
let o =
|
|
2521
|
+
let o = ft.encode(JSON.stringify(r >= 2 ? {
|
|
2380
2522
|
...n,
|
|
2381
2523
|
checkpoints: a
|
|
2382
2524
|
} : n));
|
|
2383
2525
|
if (t.length > 5e5 || o.length + 16 > 33554432) throw Error("Replay exceeds bounds");
|
|
2384
|
-
let s = t.length * 12 + t.filter((e) => e.kind === "disc").length * 106, c = new Uint8Array(Math.min(
|
|
2526
|
+
let s = t.length * 12 + t.filter((e) => e.kind === "disc").length * 106, c = new Uint8Array(Math.min(ot, s)), l = new DataView(c.buffer), u = (e) => {
|
|
2385
2527
|
if (d + e > c.length) throw Error("Replay exceeds bounds");
|
|
2386
2528
|
}, d = 0, f = e.initial.tick, p = (e) => {
|
|
2387
2529
|
if (!Number.isInteger(e) || e < 0 || e > 4294967295) throw Error("Invalid replay integer");
|
|
@@ -2392,15 +2534,15 @@ function nt(e) {
|
|
|
2392
2534
|
} while (e);
|
|
2393
2535
|
};
|
|
2394
2536
|
for (let e of t) {
|
|
2395
|
-
let t =
|
|
2537
|
+
let t = dt.indexOf(r < 3 && e.kind === "join" ? "team" : e.kind);
|
|
2396
2538
|
if (e.kind === "join" && e.value !== 0 || e.kind === "team" && e.value > 2) throw Error("Invalid replay team command");
|
|
2397
2539
|
if (t < 0 || !Number.isInteger(e.slot) || e.slot < 0 || e.slot > (e.kind === "disc" ? 95 : 31)) throw Error("Invalid replay command");
|
|
2398
2540
|
if (p(e.tick - f), u(1), c[d++] = r >= 3 ? t : t << 5 | e.slot, r >= 3 && p(e.slot), p(r < 3 && e.kind === "join" ? 3 : e.value), e.kind === "disc") {
|
|
2399
|
-
let t =
|
|
2400
|
-
|
|
2541
|
+
let t = Me(e.properties), n = 0;
|
|
2542
|
+
je.forEach(([e], r) => {
|
|
2401
2543
|
t[e] !== void 0 && (n |= 1 << r);
|
|
2402
2544
|
}), p(n);
|
|
2403
|
-
for (let [e] of
|
|
2545
|
+
for (let [e] of je) {
|
|
2404
2546
|
let n = t[e];
|
|
2405
2547
|
n !== void 0 && (u(8), l.setFloat64(d, n, !0), d += 8);
|
|
2406
2548
|
}
|
|
@@ -2427,9 +2569,9 @@ function nt(e) {
|
|
|
2427
2569
|
}
|
|
2428
2570
|
return h.set(c.subarray(0, d), _), h;
|
|
2429
2571
|
}
|
|
2430
|
-
function
|
|
2431
|
-
let t =
|
|
2432
|
-
if (t[0] !== 66 || t[1] !== 50 || t[2] !== 68 || t[3] !== 80) return JSON.parse(
|
|
2572
|
+
function gt(e) {
|
|
2573
|
+
let t = ut(e);
|
|
2574
|
+
if (t[0] !== 66 || t[1] !== 50 || t[2] !== 68 || t[3] !== 80) return JSON.parse(pt.decode(t));
|
|
2433
2575
|
if (t.length < 16 || ![
|
|
2434
2576
|
1,
|
|
2435
2577
|
2,
|
|
@@ -2438,7 +2580,7 @@ function rt(e) {
|
|
|
2438
2580
|
].includes(t[4]) || t[5] || t[6] || t[7]) throw Error("Invalid packed replay header");
|
|
2439
2581
|
let n = new DataView(t.buffer, t.byteOffset, t.byteLength), r = n.getUint32(8, !0), i = n.getUint32(12, !0);
|
|
2440
2582
|
if (r > t.length - 16 || i > 5e5 || i > (t.length - 16 - r) / 3) throw Error("Invalid packed replay bounds");
|
|
2441
|
-
let a = JSON.parse(
|
|
2583
|
+
let a = JSON.parse(pt.decode(t.subarray(16, 16 + r)));
|
|
2442
2584
|
if (!a || !Number.isSafeInteger(a.initial?.tick) || a.initial.tick < 0) throw Error("Invalid replay initial tick");
|
|
2443
2585
|
a.commands = [];
|
|
2444
2586
|
let o = 16 + r, s = a.initial.tick;
|
|
@@ -2484,14 +2626,14 @@ function rt(e) {
|
|
|
2484
2626
|
};
|
|
2485
2627
|
for (let e = 0; e < i; e++) {
|
|
2486
2628
|
if (s += c(), !Number.isSafeInteger(s) || o >= t.length) throw Error("Invalid replay tick");
|
|
2487
|
-
let e = t[o++], r =
|
|
2629
|
+
let e = t[o++], r = dt[t[4] >= 3 ? e : e >> 5];
|
|
2488
2630
|
if (!r) throw Error("Unknown replay command");
|
|
2489
2631
|
let i = t[4] >= 3 ? c() : e & 31, l = c();
|
|
2490
2632
|
if (r === "disc") {
|
|
2491
2633
|
let e = c();
|
|
2492
2634
|
if (e > 8191) throw Error("Invalid disc property mask");
|
|
2493
2635
|
let u = {};
|
|
2494
|
-
|
|
2636
|
+
je.forEach(([r], i) => {
|
|
2495
2637
|
if (e & 1 << i) {
|
|
2496
2638
|
if (o + 8 > t.length) throw Error("Truncated disc properties");
|
|
2497
2639
|
u[r] = n.getFloat64(o, !0), o += 8;
|
|
@@ -2501,7 +2643,7 @@ function rt(e) {
|
|
|
2501
2643
|
kind: r,
|
|
2502
2644
|
slot: i,
|
|
2503
2645
|
value: l,
|
|
2504
|
-
properties:
|
|
2646
|
+
properties: Me(u)
|
|
2505
2647
|
});
|
|
2506
2648
|
continue;
|
|
2507
2649
|
}
|
|
@@ -2520,12 +2662,12 @@ function rt(e) {
|
|
|
2520
2662
|
if (o !== t.length) throw Error("Trailing replay command data");
|
|
2521
2663
|
return a;
|
|
2522
2664
|
}
|
|
2523
|
-
function
|
|
2665
|
+
function _t(e) {
|
|
2524
2666
|
let t = JSON.stringify(e), n = 2166136261;
|
|
2525
2667
|
for (let e = 0; e < t.length; e++) n ^= t.charCodeAt(e), n = Math.imul(n, 16777619);
|
|
2526
2668
|
return (n >>> 0).toString(16).padStart(8, "0");
|
|
2527
2669
|
}
|
|
2528
|
-
function
|
|
2670
|
+
function vt(e, t) {
|
|
2529
2671
|
switch (t.kind) {
|
|
2530
2672
|
case "surface":
|
|
2531
2673
|
if (t.slot !== 0 || t.value !== 0 && t.value !== 1) throw Error("Invalid surface command");
|
|
@@ -2542,6 +2684,7 @@ function at(e, t) {
|
|
|
2542
2684
|
});
|
|
2543
2685
|
break;
|
|
2544
2686
|
case "disc":
|
|
2687
|
+
if (!t.properties) throw Error("Missing replay disc properties");
|
|
2545
2688
|
e.applyDiscProperties(t.slot, t.properties);
|
|
2546
2689
|
break;
|
|
2547
2690
|
case "input":
|
|
@@ -2571,7 +2714,7 @@ function at(e, t) {
|
|
|
2571
2714
|
case "pause": e.setPaused(!!t.value);
|
|
2572
2715
|
}
|
|
2573
2716
|
}
|
|
2574
|
-
var
|
|
2717
|
+
var yt = class {
|
|
2575
2718
|
replay;
|
|
2576
2719
|
playerOrder = [];
|
|
2577
2720
|
lastInputs = /* @__PURE__ */ new Map();
|
|
@@ -2585,7 +2728,7 @@ var ot = class {
|
|
|
2585
2728
|
this.playerOrder = t.map((e) => e.slot), this.replay = {
|
|
2586
2729
|
magic: "B2DR",
|
|
2587
2730
|
version: 1,
|
|
2588
|
-
engine:
|
|
2731
|
+
engine: qe,
|
|
2589
2732
|
stadium: e.source,
|
|
2590
2733
|
initial: r,
|
|
2591
2734
|
commands: [],
|
|
@@ -2596,14 +2739,14 @@ var ot = class {
|
|
|
2596
2739
|
})),
|
|
2597
2740
|
styles: [{
|
|
2598
2741
|
tick: r.tick,
|
|
2599
|
-
teams:
|
|
2742
|
+
teams: De(n)
|
|
2600
2743
|
}],
|
|
2601
2744
|
orders: [{
|
|
2602
2745
|
tick: r.tick,
|
|
2603
2746
|
slots: [...this.playerOrder]
|
|
2604
2747
|
}],
|
|
2605
2748
|
end: r.tick,
|
|
2606
|
-
finalHash:
|
|
2749
|
+
finalHash: _t(r)
|
|
2607
2750
|
}, this.bytes = new TextEncoder().encode(JSON.stringify(this.replay)).length;
|
|
2608
2751
|
for (let t = 0; t < 32; t++) this.lastInputs.set(t, e.data[e.index(t) * 18 + 14]);
|
|
2609
2752
|
}
|
|
@@ -2623,7 +2766,7 @@ var ot = class {
|
|
|
2623
2766
|
style(e, t) {
|
|
2624
2767
|
let n = {
|
|
2625
2768
|
tick: e,
|
|
2626
|
-
teams:
|
|
2769
|
+
teams: De(t)
|
|
2627
2770
|
}, r = this.replay.styles;
|
|
2628
2771
|
return r.length >= 4096 || !this.reserve(n) ? (this.full = !0, !1) : (r.push(n), !0);
|
|
2629
2772
|
}
|
|
@@ -2638,7 +2781,7 @@ var ot = class {
|
|
|
2638
2781
|
command(e) {
|
|
2639
2782
|
return e.kind === "input" && this.lastInputs.get(e.slot) === e.value ? !0 : this.replay.commands.length >= 5e5 || !this.reserve(e) ? (this.full = !0, !1) : (e.kind === "input" && this.lastInputs.set(e.slot, e.value), (e.kind === "team" || e.kind === "join") && this.lastInputs.set(e.slot, 0), e.kind === "start" && this.lastInputs.clear(), this.replay.commands.push(e.kind === "disc" ? {
|
|
2640
2783
|
...e,
|
|
2641
|
-
properties:
|
|
2784
|
+
properties: Me(e.properties)
|
|
2642
2785
|
} : { ...e }), !0);
|
|
2643
2786
|
}
|
|
2644
2787
|
step(e) {
|
|
@@ -2647,26 +2790,26 @@ var ot = class {
|
|
|
2647
2790
|
let t = e.snapshot(), n = {
|
|
2648
2791
|
tick: e.tick,
|
|
2649
2792
|
state: t,
|
|
2650
|
-
hash:
|
|
2793
|
+
hash: _t(t)
|
|
2651
2794
|
};
|
|
2652
2795
|
this.reserve(n) && this.replay.checkpoints.push(n);
|
|
2653
2796
|
}
|
|
2654
2797
|
this.replay.end = e.tick;
|
|
2655
2798
|
}
|
|
2656
2799
|
pack(e) {
|
|
2657
|
-
return this.replay.end = e.tick, this.replay.finalHash =
|
|
2800
|
+
return this.replay.end = e.tick, this.replay.finalHash = _t(e.snapshot()), ht(this.replay);
|
|
2658
2801
|
}
|
|
2659
2802
|
finish(e) {
|
|
2660
|
-
return this.replay.end = e.tick, this.replay.finalHash =
|
|
2803
|
+
return this.replay.end = e.tick, this.replay.finalHash = _t(e.snapshot()), new Blob([mt(this.replay)], { type: "application/x-ball2d-replay" });
|
|
2661
2804
|
}
|
|
2662
2805
|
};
|
|
2663
|
-
async function
|
|
2806
|
+
async function bt(e) {
|
|
2664
2807
|
if (e.size > 33554432) throw Error("Replay exceeds 32 MB");
|
|
2665
|
-
return
|
|
2808
|
+
return xt(await e.arrayBuffer());
|
|
2666
2809
|
}
|
|
2667
|
-
function
|
|
2668
|
-
let t =
|
|
2669
|
-
if (t.magic !== "B2DR" || t.version !== 1 || t.engine !==
|
|
2810
|
+
function xt(e) {
|
|
2811
|
+
let t = gt(e);
|
|
2812
|
+
if (t.magic !== "B2DR" || t.version !== 1 || t.engine !== qe) throw Error("Unsupported replay engine/version");
|
|
2670
2813
|
if (!Array.isArray(t.commands) || t.commands.length > 5e5 || !Array.isArray(t.checkpoints) || t.checkpoints.length > 721 || !Number.isInteger(t.end) || t.end < t.initial.tick || t.end - t.initial.tick > 216e3) throw Error("Invalid replay bounds");
|
|
2671
2814
|
let n = t.initial.tick;
|
|
2672
2815
|
for (let e of t.commands) {
|
|
@@ -2683,12 +2826,12 @@ function ct(e) {
|
|
|
2683
2826
|
"disc",
|
|
2684
2827
|
"surface"
|
|
2685
2828
|
].includes(e.kind) || e.kind === "surface" && e.slot !== 0 || !Number.isInteger(e.slot) || e.slot < 0 || e.slot > (e.kind === "disc" ? 95 : 31) || !Number.isInteger(e.value) || e.value < 0 || e.value > (e.kind === "disc" || e.kind === "join" ? 0 : e.kind === "kickRate" ? 6619135 : e.kind === "timeLimit" ? 5940 : e.kind === "scoreLimit" ? 99 : e.kind === "team" ? 2 : e.kind === "pause" || e.kind === "surface" ? 1 : 31)) throw Error("Invalid replay command");
|
|
2686
|
-
e.kind === "disc" && (e.properties =
|
|
2829
|
+
e.kind === "disc" && (e.properties = Me(e.properties)), n = e.tick;
|
|
2687
2830
|
}
|
|
2688
2831
|
if (!Array.isArray(t.roster) || t.roster.length > 4096) throw Error("Invalid replay roster");
|
|
2689
2832
|
n = t.initial.tick;
|
|
2690
2833
|
for (let e of t.roster) {
|
|
2691
|
-
if (!Number.isInteger(e.tick) || e.tick < n || e.tick > t.end || !Number.isInteger(e.slot) || e.slot < 0 || e.slot > 31 || e.name !== null && (typeof e.name != "string" || e.name.length > 24) || e.avatar !== void 0 && !
|
|
2834
|
+
if (!Number.isInteger(e.tick) || e.tick < n || e.tick > t.end || !Number.isInteger(e.slot) || e.slot < 0 || e.slot > 31 || e.name !== null && (typeof e.name != "string" || e.name.length > 24) || e.avatar !== void 0 && !Ae(e.avatar)) throw Error("Invalid roster event");
|
|
2692
2835
|
n = e.tick;
|
|
2693
2836
|
}
|
|
2694
2837
|
if (t.styles !== void 0) {
|
|
@@ -2696,7 +2839,7 @@ function ct(e) {
|
|
|
2696
2839
|
let e = t.initial.tick;
|
|
2697
2840
|
for (let n of t.styles) {
|
|
2698
2841
|
if (!n || !Number.isInteger(n.tick) || n.tick < e || n.tick > t.end || n.teams === void 0) throw Error("Invalid replay style");
|
|
2699
|
-
n.teams =
|
|
2842
|
+
n.teams = De(n.teams), e = n.tick;
|
|
2700
2843
|
}
|
|
2701
2844
|
}
|
|
2702
2845
|
if (t.orders !== void 0) {
|
|
@@ -2714,7 +2857,7 @@ function ct(e) {
|
|
|
2714
2857
|
}
|
|
2715
2858
|
return t;
|
|
2716
2859
|
}
|
|
2717
|
-
var
|
|
2860
|
+
var St = (e) => Number.isSafeInteger(e) && e > 0 && e <= 9e4, Ct = class {
|
|
2718
2861
|
io;
|
|
2719
2862
|
state = "admitted";
|
|
2720
2863
|
currentEpoch = 0;
|
|
@@ -2727,7 +2870,7 @@ var lt = (e) => Number.isSafeInteger(e) && e > 0 && e <= 9e4, ut = class {
|
|
|
2727
2870
|
timerVersion = 0;
|
|
2728
2871
|
transport;
|
|
2729
2872
|
constructor(e, t) {
|
|
2730
|
-
if (this.io = e, !
|
|
2873
|
+
if (this.io = e, !St(t)) throw RangeError("Invalid membership duration");
|
|
2731
2874
|
this.membershipDeadline = e.now() + t, this.arm();
|
|
2732
2875
|
}
|
|
2733
2876
|
get epoch() {
|
|
@@ -2740,16 +2883,18 @@ var lt = (e) => Number.isSafeInteger(e) && e > 0 && e <= 9e4, ut = class {
|
|
|
2740
2883
|
e !== this.currentEpoch || this.terminal() || this.checkExpiry() || (this.state === "admitted" ? (this.recoveryDeadline = Math.min(this.io.now() + 3e4, this.membershipDeadline), this.attemptId = this.io.newAttemptId(), this.retry = 0, this.wait()) : (this.state === "connecting" || this.state === "awaiting-ack") && this.wait());
|
|
2741
2884
|
}
|
|
2742
2885
|
acknowledge(e, t) {
|
|
2743
|
-
if (e !== this.currentEpoch || this.state !== "awaiting-ack" || t !== void 0 && !
|
|
2886
|
+
if (e !== this.currentEpoch || this.state !== "awaiting-ack" || t !== void 0 && !St(t) || this.checkExpiry() || this.checkAttemptTimeout()) return !1;
|
|
2744
2887
|
t !== void 0 && (this.membershipDeadline = Math.min(this.membershipDeadline, this.io.now() + t));
|
|
2745
|
-
let n =
|
|
2746
|
-
|
|
2888
|
+
let n = this.attemptId;
|
|
2889
|
+
if (n === void 0) return !1;
|
|
2890
|
+
let r = {
|
|
2891
|
+
attemptId: n,
|
|
2747
2892
|
epoch: e
|
|
2748
2893
|
};
|
|
2749
|
-
return this.state = "admitted", this.recoveryDeadline = Infinity, this.phaseDeadline = Infinity, this.attemptId = void 0, this.retry = 0, this.arm(), this.io.onRecovered(
|
|
2894
|
+
return this.state = "admitted", this.recoveryDeadline = Infinity, this.phaseDeadline = Infinity, this.attemptId = void 0, this.retry = 0, this.arm(), this.io.onRecovered(r), !0;
|
|
2750
2895
|
}
|
|
2751
2896
|
heartbeat(e, t) {
|
|
2752
|
-
return e !== this.currentEpoch || this.state !== "admitted" || !
|
|
2897
|
+
return e !== this.currentEpoch || this.state !== "admitted" || !St(t) || this.checkExpiry() ? !1 : (this.membershipDeadline = this.io.now() + t, this.arm(), !0);
|
|
2753
2898
|
}
|
|
2754
2899
|
cancel() {
|
|
2755
2900
|
this.terminal() || (this.state = "cancelled", this.clearTimer(), this.retire());
|
|
@@ -2795,42 +2940,44 @@ var lt = (e) => Number.isSafeInteger(e) && e > 0 && e <= 9e4, ut = class {
|
|
|
2795
2940
|
}
|
|
2796
2941
|
attempt() {
|
|
2797
2942
|
if (this.checkExpiry()) return;
|
|
2943
|
+
let e = this.attemptId;
|
|
2944
|
+
if (e === void 0) throw Error("Recovery attempt identity is unavailable");
|
|
2798
2945
|
this.state = "connecting";
|
|
2799
|
-
let
|
|
2946
|
+
let t = ++this.currentEpoch;
|
|
2800
2947
|
this.phaseDeadline = this.io.now() + 5e3, this.arm();
|
|
2801
|
-
let
|
|
2948
|
+
let n;
|
|
2802
2949
|
try {
|
|
2803
|
-
|
|
2804
|
-
attemptId:
|
|
2805
|
-
epoch:
|
|
2950
|
+
n = this.io.createAttempt({
|
|
2951
|
+
attemptId: e,
|
|
2952
|
+
epoch: t
|
|
2806
2953
|
}, {
|
|
2807
2954
|
opened: () => {
|
|
2808
|
-
|
|
2955
|
+
t !== this.currentEpoch || this.state !== "connecting" || this.checkExpiry() || this.checkAttemptTimeout() || (this.state = "awaiting-ack");
|
|
2809
2956
|
},
|
|
2810
|
-
closed: () => this.disconnected(
|
|
2957
|
+
closed: () => this.disconnected(t)
|
|
2811
2958
|
});
|
|
2812
2959
|
} catch {
|
|
2813
|
-
|
|
2960
|
+
t === this.currentEpoch && this.disconnected(t);
|
|
2814
2961
|
return;
|
|
2815
2962
|
}
|
|
2816
|
-
if (
|
|
2963
|
+
if (t === this.currentEpoch && (this.state === "connecting" || this.state === "awaiting-ack" || this.state === "admitted")) this.transport = n;
|
|
2817
2964
|
else try {
|
|
2818
|
-
|
|
2965
|
+
n.close();
|
|
2819
2966
|
} catch {}
|
|
2820
2967
|
}
|
|
2821
|
-
};
|
|
2822
|
-
function
|
|
2968
|
+
}, wt = 2, Tt = 9e4, Et = 33;
|
|
2969
|
+
function Dt(e, t) {
|
|
2823
2970
|
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === t.length && t.every((t) => Object.hasOwn(e, t));
|
|
2824
2971
|
}
|
|
2825
|
-
var
|
|
2826
|
-
function
|
|
2827
|
-
return !
|
|
2972
|
+
var Ot = (e) => typeof e == "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(e), kt = (e) => typeof e == "string" && /^[0-9a-f]{64}$/.test(e), At = (e, t) => Number.isSafeInteger(e) && e >= t, jt = (e) => At(e, 1) && e <= Tt, Mt = (e) => e === "host" || e === "guest";
|
|
2973
|
+
function Nt(e) {
|
|
2974
|
+
return !Dt(e, [
|
|
2828
2975
|
"version",
|
|
2829
2976
|
"roomGeneration",
|
|
2830
2977
|
"secret",
|
|
2831
2978
|
"connectionEpoch",
|
|
2832
2979
|
"membershipValidForMs"
|
|
2833
|
-
]) || e.version !==
|
|
2980
|
+
]) || e.version !== wt || !Ot(e.roomGeneration) || !kt(e.secret) || !At(e.connectionEpoch, 1) || !jt(e.membershipValidForMs) ? null : {
|
|
2834
2981
|
version: 2,
|
|
2835
2982
|
roomGeneration: e.roomGeneration,
|
|
2836
2983
|
secret: e.secret,
|
|
@@ -2838,8 +2985,8 @@ function _t(e) {
|
|
|
2838
2985
|
membershipValidForMs: e.membershipValidForMs
|
|
2839
2986
|
};
|
|
2840
2987
|
}
|
|
2841
|
-
function
|
|
2842
|
-
if (!
|
|
2988
|
+
function Pt(e) {
|
|
2989
|
+
if (!Dt(e, [
|
|
2843
2990
|
"type",
|
|
2844
2991
|
"version",
|
|
2845
2992
|
"roomGeneration",
|
|
@@ -2853,9 +3000,9 @@ function vt(e) {
|
|
|
2853
3000
|
"members",
|
|
2854
3001
|
"requireVerification",
|
|
2855
3002
|
"locked"
|
|
2856
|
-
]) || e.type !== "resumed" || e.version !==
|
|
2857
|
-
let t =
|
|
2858
|
-
return
|
|
3003
|
+
]) || e.type !== "resumed" || e.version !== wt || !Ot(e.roomGeneration) || !Ot(e.attemptId) || !Ot(e.id) || !Ot(e.hostId) || !Mt(e.role) || !At(e.connectionEpoch, 1) || !jt(e.membershipValidForMs) || !At(e.rosterRevision, 0) || typeof e.requireVerification != "boolean" || typeof e.locked != "boolean" || !Array.isArray(e.members) || e.members.length < 1 || e.members.length > Et) return null;
|
|
3004
|
+
let t = It(e.members, e.hostId);
|
|
3005
|
+
return t?.some((t) => t.id === e.id && t.role === e.role && t.attached && t.connectionEpoch === e.connectionEpoch) ? {
|
|
2859
3006
|
type: "resumed",
|
|
2860
3007
|
version: 2,
|
|
2861
3008
|
roomGeneration: e.roomGeneration,
|
|
@@ -2869,10 +3016,10 @@ function vt(e) {
|
|
|
2869
3016
|
members: t,
|
|
2870
3017
|
requireVerification: e.requireVerification,
|
|
2871
3018
|
locked: e.locked
|
|
2872
|
-
};
|
|
3019
|
+
} : null;
|
|
2873
3020
|
}
|
|
2874
|
-
function
|
|
2875
|
-
if (!
|
|
3021
|
+
function Ft(e) {
|
|
3022
|
+
if (!Dt(e, [
|
|
2876
3023
|
"type",
|
|
2877
3024
|
"id",
|
|
2878
3025
|
"hostId",
|
|
@@ -2883,9 +3030,9 @@ function yt(e) {
|
|
|
2883
3030
|
"requireVerification",
|
|
2884
3031
|
"locked"
|
|
2885
3032
|
]) || e.type !== "ready") return null;
|
|
2886
|
-
let t =
|
|
3033
|
+
let t = Nt(e.resumeGrant);
|
|
2887
3034
|
if (!t) return null;
|
|
2888
|
-
let n =
|
|
3035
|
+
let n = Pt({
|
|
2889
3036
|
type: "resumed",
|
|
2890
3037
|
version: 2,
|
|
2891
3038
|
roomGeneration: t.roomGeneration,
|
|
@@ -2912,16 +3059,16 @@ function yt(e) {
|
|
|
2912
3059
|
locked: n.locked
|
|
2913
3060
|
} : null;
|
|
2914
3061
|
}
|
|
2915
|
-
function
|
|
2916
|
-
if (!Array.isArray(e) || e.length < 1 || e.length >
|
|
3062
|
+
function It(e, t) {
|
|
3063
|
+
if (!Array.isArray(e) || e.length < 1 || e.length > Et) return null;
|
|
2917
3064
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
2918
3065
|
for (let t of e) {
|
|
2919
|
-
if (!
|
|
3066
|
+
if (!Dt(t, [
|
|
2920
3067
|
"id",
|
|
2921
3068
|
"role",
|
|
2922
3069
|
"attached",
|
|
2923
3070
|
"connectionEpoch"
|
|
2924
|
-
]) || !
|
|
3071
|
+
]) || !Ot(t.id) || !Mt(t.role) || typeof t.attached != "boolean" || !At(t.connectionEpoch, 1) || r.has(t.id)) return null;
|
|
2925
3072
|
r.add(t.id), n.push({
|
|
2926
3073
|
id: t.id,
|
|
2927
3074
|
role: t.role,
|
|
@@ -2932,15 +3079,15 @@ function bt(e, t) {
|
|
|
2932
3079
|
let i = n.filter((e) => e.role === "host");
|
|
2933
3080
|
return i.length === 1 && i[0].id === t ? n : null;
|
|
2934
3081
|
}
|
|
2935
|
-
function
|
|
2936
|
-
if (!
|
|
3082
|
+
function Lt(e) {
|
|
3083
|
+
if (!Dt(e, [
|
|
2937
3084
|
"type",
|
|
2938
3085
|
"roomGeneration",
|
|
2939
3086
|
"hostId",
|
|
2940
3087
|
"rosterRevision",
|
|
2941
3088
|
"members"
|
|
2942
|
-
]) || e.type !== "roster" || !
|
|
2943
|
-
let t =
|
|
3089
|
+
]) || e.type !== "roster" || !Ot(e.roomGeneration) || !Ot(e.hostId) || !At(e.rosterRevision, 0)) return null;
|
|
3090
|
+
let t = It(e.members, e.hostId);
|
|
2944
3091
|
return t ? {
|
|
2945
3092
|
type: "roster",
|
|
2946
3093
|
roomGeneration: e.roomGeneration,
|
|
@@ -2949,31 +3096,31 @@ function xt(e) {
|
|
|
2949
3096
|
members: t
|
|
2950
3097
|
} : null;
|
|
2951
3098
|
}
|
|
2952
|
-
function
|
|
3099
|
+
function Rt(e) {
|
|
2953
3100
|
let t = [...e], n = new Set(t.filter((e) => e.type === "transport" && e.selectedCandidatePairId).map((e) => e.selectedCandidatePairId)), r = t.filter((e) => e.type === "candidate-pair" && e.state === "succeeded"), i = n.size ? r.filter((e) => n.has(e.id)) : r.filter((e) => e.nominated === !0);
|
|
2954
3101
|
if (i.length !== 1) return null;
|
|
2955
3102
|
let a = i[0].currentRoundTripTime;
|
|
2956
3103
|
return typeof a == "number" && Number.isFinite(a) && a >= 0 ? a * 1e3 : null;
|
|
2957
3104
|
}
|
|
2958
|
-
var
|
|
2959
|
-
function
|
|
3105
|
+
var zt = 524288, Bt = 16384, Vt = 12;
|
|
3106
|
+
function Ht(e, t) {
|
|
2960
3107
|
let n = JSON.stringify(e);
|
|
2961
3108
|
if (n === void 0) throw Error("Missing control message");
|
|
2962
3109
|
let r = new TextEncoder().encode(n);
|
|
2963
|
-
if (r.length >
|
|
2964
|
-
if (r.length <=
|
|
2965
|
-
let i = Math.ceil(r.length /
|
|
3110
|
+
if (r.length > zt) throw Error("Control message exceeds 512 KB");
|
|
3111
|
+
if (r.length <= Bt) return [n];
|
|
3112
|
+
let i = Math.ceil(r.length / Bt), a = [];
|
|
2966
3113
|
for (let e = 0; e < i; e++) {
|
|
2967
|
-
let n = r.subarray(e *
|
|
2968
|
-
s.setUint16(0, 45635), s.setUint8(2, 1), s.setUint32(4, t, !0), s.setUint16(8, e, !0), s.setUint16(10, i, !0), new Uint8Array(o,
|
|
3114
|
+
let n = r.subarray(e * Bt, (e + 1) * Bt), o = new ArrayBuffer(Vt + n.length), s = new DataView(o);
|
|
3115
|
+
s.setUint16(0, 45635), s.setUint8(2, 1), s.setUint32(4, t, !0), s.setUint16(8, e, !0), s.setUint16(10, i, !0), new Uint8Array(o, Vt).set(n), a.push(o);
|
|
2969
3116
|
}
|
|
2970
3117
|
return a;
|
|
2971
3118
|
}
|
|
2972
|
-
var
|
|
3119
|
+
var Ut = class {
|
|
2973
3120
|
partial;
|
|
2974
3121
|
push(e, t = performance.now()) {
|
|
2975
3122
|
if (typeof e == "string") {
|
|
2976
|
-
if (this.partial || new TextEncoder().encode(e).length >
|
|
3123
|
+
if (this.partial || new TextEncoder().encode(e).length > Bt) throw Error("Invalid control message");
|
|
2977
3124
|
return JSON.parse(e);
|
|
2978
3125
|
}
|
|
2979
3126
|
if (e.byteLength < 13 || e.byteLength > 16396) throw Error("Control fragment length");
|
|
@@ -2994,13 +3141,13 @@ var Dt = class {
|
|
|
2994
3141
|
}
|
|
2995
3142
|
let o = this.partial;
|
|
2996
3143
|
if (o.id !== r || o.count !== a || o.next !== i || t - o.since > 1e4) throw Error("Control fragment sequence");
|
|
2997
|
-
if (o.next++, o.bytes += e.byteLength -
|
|
2998
|
-
if (o.parts.push(new Uint8Array(e.slice(
|
|
3144
|
+
if (o.next++, o.bytes += e.byteLength - Vt, o.bytes > zt) throw Error("Control size limit");
|
|
3145
|
+
if (o.parts.push(new Uint8Array(e.slice(Vt))), o.next !== a) return;
|
|
2999
3146
|
let s = new Uint8Array(o.bytes), c = 0;
|
|
3000
3147
|
for (let e of o.parts) s.set(e, c), c += e.length;
|
|
3001
3148
|
return this.partial = void 0, JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(s));
|
|
3002
3149
|
}
|
|
3003
|
-
},
|
|
3150
|
+
}, Wt = class extends Error {}, Gt = 1, Kt = (e) => typeof e == "string" && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e), qt = (e) => Number.isSafeInteger(e) && e > 0, Jt = (e) => e?.match(/(?:^|\r?\n)a=ice-ufrag:([^\s]+)/)?.[1], Yt = (e) => e.usernameFragment ?? e.candidate?.match(/(?:^| )ufrag ([^ ]+)/)?.[1], Xt = class {
|
|
3004
3151
|
room;
|
|
3005
3152
|
credentials;
|
|
3006
3153
|
hooks;
|
|
@@ -3051,13 +3198,14 @@ var Dt = class {
|
|
|
3051
3198
|
sendHeartbeat() {
|
|
3052
3199
|
let e = this.heartbeatDeadline - performance.now();
|
|
3053
3200
|
if (!this.signalingReady || !this.resumeGrant || !this.recovery || e <= 0) return;
|
|
3054
|
-
|
|
3201
|
+
this.heartbeatRequest ??= {
|
|
3055
3202
|
id: ++this.heartbeatSequence,
|
|
3056
3203
|
sentAt: performance.now(),
|
|
3057
3204
|
localEpoch: this.recovery.epoch,
|
|
3058
3205
|
transmissions: 0,
|
|
3059
3206
|
retryDelay: Math.max(1, Math.floor(Math.min(5e3, e / 3)))
|
|
3060
3207
|
};
|
|
3208
|
+
let t = this.heartbeatRequest;
|
|
3061
3209
|
if (!(t.transmissions >= 3)) {
|
|
3062
3210
|
t.transmissions++;
|
|
3063
3211
|
try {
|
|
@@ -3071,7 +3219,7 @@ var Dt = class {
|
|
|
3071
3219
|
}
|
|
3072
3220
|
}
|
|
3073
3221
|
get signalingReady() {
|
|
3074
|
-
return !this.closed && !!this.id && this.ws.readyState ===
|
|
3222
|
+
return !this.closed && !!this.id && this.ws.readyState === Gt && this.signalingAdmitted;
|
|
3075
3223
|
}
|
|
3076
3224
|
get signalingAdmitted() {
|
|
3077
3225
|
return !this.recovery || this.recovery.status === "admitted";
|
|
@@ -3088,7 +3236,7 @@ var Dt = class {
|
|
|
3088
3236
|
n && (this.verificationRequest = void 0, clearTimeout(n.timer), t && (this.verificationState = null), n.reject(Error(e)));
|
|
3089
3237
|
}
|
|
3090
3238
|
setRequireVerification(e) {
|
|
3091
|
-
return typeof e == "boolean" ? this.closed || !this.host || !this.signalingAdmitted || this.ws.readyState !==
|
|
3239
|
+
return typeof e == "boolean" ? this.closed || !this.host || !this.signalingAdmitted || this.ws.readyState !== Gt ? Promise.reject(Error("An active room-owner connection is required.")) : this.verificationRequest ? Promise.reject(Error("A verification update is already pending.")) : new Promise((t, n) => {
|
|
3092
3240
|
let r = ++this.verificationSequence, i = setTimeout(() => this.rejectVerification("Verification update was not confirmed."), 1e4);
|
|
3093
3241
|
this.verificationRequest = {
|
|
3094
3242
|
id: r,
|
|
@@ -3114,7 +3262,7 @@ var Dt = class {
|
|
|
3114
3262
|
t && (this.passwordRequest = void 0, clearTimeout(t.timer), t.reject(Error(e)));
|
|
3115
3263
|
}
|
|
3116
3264
|
setPassword(e) {
|
|
3117
|
-
return e !== null && (typeof e != "string" || e.length > 64) ? Promise.reject(Error("Password must contain at most 64 characters.")) : this.closed || !this.host || !this.signalingAdmitted || this.ws.readyState !==
|
|
3265
|
+
return e !== null && (typeof e != "string" || e.length > 64) ? Promise.reject(Error("Password must contain at most 64 characters.")) : this.closed || !this.host || !this.signalingAdmitted || this.ws.readyState !== Gt ? Promise.reject(Error("An active room-owner connection is required.")) : this.passwordRequest ? Promise.reject(Error("A password update is already pending.")) : new Promise((t, n) => {
|
|
3118
3266
|
let r = ++this.passwordRequestId, i = setTimeout(() => this.rejectPasswordUpdate("Password update was not confirmed."), 1e4);
|
|
3119
3267
|
this.passwordRequest = {
|
|
3120
3268
|
id: r,
|
|
@@ -3137,22 +3285,23 @@ var Dt = class {
|
|
|
3137
3285
|
banRequest;
|
|
3138
3286
|
rejectBan(e, t = !0) {
|
|
3139
3287
|
let n = this.banRequest;
|
|
3140
|
-
n && (this.banRequest = void 0, clearTimeout(n.timer), n.reject(t ? new
|
|
3288
|
+
n && (this.banRequest = void 0, clearTimeout(n.timer), n.reject(t ? new Wt(e) : Error(e)));
|
|
3141
3289
|
}
|
|
3142
|
-
updateBan(e, t) {
|
|
3143
|
-
return this.closed || !this.host || !this.signalingAdmitted || this.ws.readyState !==
|
|
3144
|
-
let
|
|
3290
|
+
updateBan(e, t, n) {
|
|
3291
|
+
return this.closed || !this.host || !this.signalingAdmitted || this.ws.readyState !== Gt ? Promise.reject(Error("An active room-owner connection is required.")) : this.banRequest ? Promise.reject(Error("A ban operation is already pending.")) : new Promise((r, i) => {
|
|
3292
|
+
let a = ++this.banSequence, o = setTimeout(() => this.rejectBan("Ban operation was not confirmed."), 1e4);
|
|
3145
3293
|
this.banRequest = {
|
|
3146
|
-
id:
|
|
3147
|
-
resolve:
|
|
3148
|
-
reject:
|
|
3149
|
-
timer:
|
|
3294
|
+
id: a,
|
|
3295
|
+
resolve: r,
|
|
3296
|
+
reject: i,
|
|
3297
|
+
timer: o
|
|
3150
3298
|
};
|
|
3151
3299
|
try {
|
|
3152
3300
|
this.signal({
|
|
3153
3301
|
type: e,
|
|
3154
3302
|
id: t,
|
|
3155
|
-
requestId:
|
|
3303
|
+
requestId: a,
|
|
3304
|
+
...e === "ban" && n !== void 0 ? { reason: n } : {}
|
|
3156
3305
|
});
|
|
3157
3306
|
} catch {
|
|
3158
3307
|
this.rejectBan("Ban operation could not be sent.");
|
|
@@ -3167,9 +3316,9 @@ var Dt = class {
|
|
|
3167
3316
|
lastHeartbeat = 0;
|
|
3168
3317
|
controlId = 0;
|
|
3169
3318
|
controlAssemblers = /* @__PURE__ */ new Map();
|
|
3170
|
-
constructor(e, t, n, r =
|
|
3319
|
+
constructor(e, t, n, r = et()) {
|
|
3171
3320
|
this.room = e, this.credentials = t, this.hooks = n, this.runtime = r;
|
|
3172
|
-
let i = new URL(
|
|
3321
|
+
let i = new URL(h.signal(e), Ze(r.serviceOrigin));
|
|
3173
3322
|
i.protocol = i.protocol === "https:" ? "wss:" : "ws:", this.ws = r.createWebSocket(i), this.attachSocket(this.ws, () => {
|
|
3174
3323
|
this.requestSentAt = performance.now(), this.signal({
|
|
3175
3324
|
type: "hello",
|
|
@@ -3177,13 +3326,13 @@ var Dt = class {
|
|
|
3177
3326
|
...r.signalingResume ? { signalingVersion: 2 } : {}
|
|
3178
3327
|
});
|
|
3179
3328
|
}, 0), this.timer = setInterval(() => {
|
|
3180
|
-
!this.resumeGrant && this.signalingAdmitted && this.ws.readyState ===
|
|
3329
|
+
!this.resumeGrant && this.signalingAdmitted && this.ws.readyState === Gt && performance.now() - this.lastHeartbeat >= 3e4 && (this.signal({ type: "heartbeat" }), this.lastHeartbeat = performance.now());
|
|
3181
3330
|
for (let e of this.peers.values()) {
|
|
3182
3331
|
if (!e.connected && performance.now() - e.created > 2e4) {
|
|
3183
|
-
n.status("
|
|
3332
|
+
n.status("Could not connect directly to this room. Try another network or room.", "error"), this.remove(e.id);
|
|
3184
3333
|
continue;
|
|
3185
3334
|
}
|
|
3186
|
-
e.lostAt !== void 0 && (performance.now() - e.lostAt > 2e4 ? (n.status("The direct connection could not be recovered. Rejoin the room."), this.remove(e.id)) : this.host && performance.now() - e.lastRestart > 5e3 && this.restartPeer(e.id));
|
|
3335
|
+
e.lostAt !== void 0 && (performance.now() - e.lostAt > 2e4 ? (n.status("The direct connection could not be recovered. Rejoin the room.", "error"), this.remove(e.id)) : this.host && performance.now() - e.lastRestart > 5e3 && this.restartPeer(e.id));
|
|
3187
3336
|
}
|
|
3188
3337
|
}, 5e3);
|
|
3189
3338
|
}
|
|
@@ -3195,7 +3344,7 @@ var Dt = class {
|
|
|
3195
3344
|
i() && (this.signalQueue = this.signalQueue.then(async () => {
|
|
3196
3345
|
i() && await this.message(JSON.parse(e.data), r);
|
|
3197
3346
|
}).catch(() => {
|
|
3198
|
-
i() && this.hooks.status("Connection negotiation failed. Try another room or network.");
|
|
3347
|
+
i() && this.hooks.status("Connection negotiation failed. Try another room or network.", "error");
|
|
3199
3348
|
}));
|
|
3200
3349
|
}, e.onclose = (e) => {
|
|
3201
3350
|
if (i()) {
|
|
@@ -3204,7 +3353,7 @@ var Dt = class {
|
|
|
3204
3353
|
1008,
|
|
3205
3354
|
1009
|
|
3206
3355
|
].includes(e.code)) {
|
|
3207
|
-
this.recovery.disconnected(n), this.hooks.status("Signaling interrupted. Reconnecting…");
|
|
3356
|
+
this.recovery.disconnected(n), this.hooks.status("Signaling interrupted. Reconnecting…", "info");
|
|
3208
3357
|
return;
|
|
3209
3358
|
}
|
|
3210
3359
|
if (!this.id || this.recovery || [
|
|
@@ -3215,10 +3364,10 @@ var Dt = class {
|
|
|
3215
3364
|
this.close(), this.hooks.ended?.(e.reason || "Room connection ended.");
|
|
3216
3365
|
return;
|
|
3217
3366
|
}
|
|
3218
|
-
this.hooks.status(e.reason || "Signaling disconnected. Established matches can continue; new joins are unavailable.");
|
|
3367
|
+
this.hooks.status(e.reason || "Signaling disconnected. Established matches can continue; new joins are unavailable.", "error");
|
|
3219
3368
|
}
|
|
3220
3369
|
}, e.onerror = () => {
|
|
3221
|
-
i() && this.hooks.status("Room service is unavailable.");
|
|
3370
|
+
i() && this.hooks.status("Room service is unavailable.", "error");
|
|
3222
3371
|
};
|
|
3223
3372
|
}
|
|
3224
3373
|
startRecovery(e) {
|
|
@@ -3227,7 +3376,7 @@ var Dt = class {
|
|
|
3227
3376
|
this.close(), this.hooks.ended?.("Room membership expired.");
|
|
3228
3377
|
return;
|
|
3229
3378
|
}
|
|
3230
|
-
this.resumeGrant = e, this.recovery = new
|
|
3379
|
+
this.resumeGrant = e, this.recovery = new Ct({
|
|
3231
3380
|
now: () => performance.now(),
|
|
3232
3381
|
setTimer: (e, t) => setTimeout(e, t),
|
|
3233
3382
|
clearTimer: (e) => clearTimeout(e),
|
|
@@ -3235,18 +3384,20 @@ var Dt = class {
|
|
|
3235
3384
|
newAttemptId: () => crypto.randomUUID(),
|
|
3236
3385
|
createAttempt: (e, t) => {
|
|
3237
3386
|
this.resumeAttempt = e;
|
|
3238
|
-
let n = new URL(
|
|
3387
|
+
let n = new URL(h.signal(this.room), Ze(this.runtime.serviceOrigin));
|
|
3239
3388
|
n.protocol = n.protocol === "https:" ? "wss:" : "ws:";
|
|
3240
3389
|
let r = this.runtime.createWebSocket(n);
|
|
3241
3390
|
return this.ws = r, this.attachSocket(r, () => {
|
|
3242
|
-
t.opened()
|
|
3391
|
+
t.opened();
|
|
3392
|
+
let n = this.resumeGrant;
|
|
3393
|
+
this.recovery?.status === "awaiting-ack" && n && (this.requestSentAt = performance.now(), r.send(JSON.stringify({
|
|
3243
3394
|
type: "resume",
|
|
3244
3395
|
version: 2,
|
|
3245
|
-
roomGeneration:
|
|
3396
|
+
roomGeneration: n.roomGeneration,
|
|
3246
3397
|
peerId: this.id,
|
|
3247
|
-
secret:
|
|
3398
|
+
secret: n.secret,
|
|
3248
3399
|
attemptId: e.attemptId,
|
|
3249
|
-
expectedEpoch:
|
|
3400
|
+
expectedEpoch: n.connectionEpoch
|
|
3250
3401
|
})));
|
|
3251
3402
|
}, e.epoch), { close: () => {
|
|
3252
3403
|
this.ws === r && this.socketSerial++, r.onopen = null, r.onmessage = null, r.onclose = null, r.onerror = null, r.close();
|
|
@@ -3259,12 +3410,16 @@ var Dt = class {
|
|
|
3259
3410
|
}, t), this.scheduleHeartbeat(t, !0);
|
|
3260
3411
|
}
|
|
3261
3412
|
signal(e) {
|
|
3262
|
-
!this.closed && this.signalingAdmitted && this.ws.readyState ===
|
|
3413
|
+
!this.closed && this.signalingAdmitted && this.ws.readyState === Gt && this.ws.send(JSON.stringify(e));
|
|
3263
3414
|
}
|
|
3264
3415
|
async message(e, t = this.socketSerial) {
|
|
3265
3416
|
if (this.closed || t !== this.socketSerial) return;
|
|
3417
|
+
if (e.type === "terminal") {
|
|
3418
|
+
this.close(), this.hooks.ended?.(typeof e.reason == "string" && e.reason.length <= 123 ? e.reason : "Room connection ended.");
|
|
3419
|
+
return;
|
|
3420
|
+
}
|
|
3266
3421
|
if (e.type === "resumed") {
|
|
3267
|
-
let n =
|
|
3422
|
+
let n = Pt(e), r = this.resumeGrant, i = this.resumeAttempt;
|
|
3268
3423
|
if (!n || !r || !i || !this.recovery || n.roomGeneration !== r.roomGeneration || n.attemptId !== i.attemptId || n.id !== this.id || n.hostId !== this.hostId || n.role === "host" !== this.host || n.connectionEpoch <= r.connectionEpoch || n.rosterRevision < this.rosterRevision || n.members.some((e) => e.connectionEpoch < (this.members.get(e.id)?.connectionEpoch ?? 0))) return;
|
|
3269
3424
|
let a = Math.floor(n.membershipValidForMs - (performance.now() - this.requestSentAt));
|
|
3270
3425
|
if (a <= 0 || !this.recovery.acknowledge(i.epoch, a)) return;
|
|
@@ -3272,22 +3427,22 @@ var Dt = class {
|
|
|
3272
3427
|
...r,
|
|
3273
3428
|
connectionEpoch: n.connectionEpoch,
|
|
3274
3429
|
membershipValidForMs: a
|
|
3275
|
-
}, this.resumeAttempt = void 0, this.scheduleHeartbeat(a, !1), this.verificationState = n.requireVerification, this.lockedState = n.locked, this.reconcile(n.members, n.rosterRevision, t), this.hooks.status("Room signaling restored.");
|
|
3430
|
+
}, this.resumeAttempt = void 0, this.scheduleHeartbeat(a, !1), this.verificationState = n.requireVerification, this.lockedState = n.locked, this.reconcile(n.members, n.rosterRevision, t), this.hooks.status("Room signaling restored.", "info");
|
|
3276
3431
|
return;
|
|
3277
3432
|
}
|
|
3278
3433
|
if (e.type === "heartbeat" && this.resumeGrant && this.recovery) {
|
|
3279
3434
|
let t = this.heartbeatRequest;
|
|
3280
|
-
if (!t || e.requestId !== t.id || e.connectionEpoch !== this.resumeGrant.connectionEpoch || !Number.isSafeInteger(e.membershipValidForMs) || e.membershipValidForMs < 1 || e.membershipValidForMs > 9e4) return;
|
|
3435
|
+
if (!t || e.requestId !== t.id || e.connectionEpoch !== this.resumeGrant.connectionEpoch || typeof e.membershipValidForMs != "number" || !Number.isSafeInteger(e.membershipValidForMs) || e.membershipValidForMs < 1 || e.membershipValidForMs > 9e4) return;
|
|
3281
3436
|
let n = Math.floor(e.membershipValidForMs - (performance.now() - t.sentAt));
|
|
3282
3437
|
n > 0 && this.recovery.heartbeat(t.localEpoch, n) && this.scheduleHeartbeat(n, !0);
|
|
3283
3438
|
return;
|
|
3284
3439
|
}
|
|
3285
3440
|
if (this.recovery && !this.signalingAdmitted) return;
|
|
3286
3441
|
if (e.type === "roster" && this.resumeGrant) {
|
|
3287
|
-
let n =
|
|
3442
|
+
let n = Lt(e);
|
|
3288
3443
|
if (!n || n.roomGeneration !== this.resumeGrant.roomGeneration || n.hostId !== this.hostId || n.rosterRevision <= this.rosterRevision) return;
|
|
3289
3444
|
let r = n.members.find((e) => e.id === this.id);
|
|
3290
|
-
if (!r
|
|
3445
|
+
if (!r?.attached || r.connectionEpoch !== this.resumeGrant.connectionEpoch || r.role === "host" !== this.host) {
|
|
3291
3446
|
this.close(), this.hooks.ended?.("Room membership ended.");
|
|
3292
3447
|
return;
|
|
3293
3448
|
}
|
|
@@ -3316,7 +3471,7 @@ var Dt = class {
|
|
|
3316
3471
|
siteKey: e.siteKey,
|
|
3317
3472
|
roomId: this.room
|
|
3318
3473
|
}, t.signal);
|
|
3319
|
-
if (t.signal.aborted || this.closed || this.ws.readyState !==
|
|
3474
|
+
if (t.signal.aborted || this.closed || this.ws.readyState !== Gt) return;
|
|
3320
3475
|
if (typeof n != "string" || n.length === 0 || n.length > 2048) throw Error("Invalid verification response.");
|
|
3321
3476
|
this.requestSentAt = performance.now(), this.signal({
|
|
3322
3477
|
type: "hello",
|
|
@@ -3332,7 +3487,7 @@ var Dt = class {
|
|
|
3332
3487
|
return;
|
|
3333
3488
|
}
|
|
3334
3489
|
if (e.type === "passwordUpgradeRequired" && this.host) {
|
|
3335
|
-
this.hooks.status("Update the room password or explicitly unlock it to allow new guests.");
|
|
3490
|
+
this.hooks.status("Update the room password or explicitly unlock it to allow new guests.", "error");
|
|
3336
3491
|
return;
|
|
3337
3492
|
}
|
|
3338
3493
|
if (e.type === "passwordUpdated" && e.ok === !1 && this.passwordRequest?.id === e.requestId) {
|
|
@@ -3355,7 +3510,7 @@ var Dt = class {
|
|
|
3355
3510
|
if (e.type === "ready") {
|
|
3356
3511
|
if (this.id) return;
|
|
3357
3512
|
if (this.runtime.signalingResume && e.resumeGrant !== void 0) {
|
|
3358
|
-
let t =
|
|
3513
|
+
let t = Ft(e);
|
|
3359
3514
|
if (!t) {
|
|
3360
3515
|
this.close(), this.hooks.ended?.("Invalid room admission.");
|
|
3361
3516
|
return;
|
|
@@ -3368,7 +3523,7 @@ var Dt = class {
|
|
|
3368
3523
|
}
|
|
3369
3524
|
if (e.type === "peer" || e.type === "leave") {
|
|
3370
3525
|
if (this.resumeGrant) {
|
|
3371
|
-
if (!
|
|
3526
|
+
if (!Kt(e.id) || !qt(e.connectionEpoch) || typeof e.rosterRevision != "number" || !Number.isSafeInteger(e.rosterRevision) || e.rosterRevision <= this.rosterRevision || e.id === this.id) return;
|
|
3372
3527
|
let t = this.members.get(e.id);
|
|
3373
3528
|
if (t && e.connectionEpoch < t.connectionEpoch) return;
|
|
3374
3529
|
this.rosterRevision = e.rosterRevision, e.type === "peer" ? this.members.set(e.id, {
|
|
@@ -3385,51 +3540,52 @@ var Dt = class {
|
|
|
3385
3540
|
this.host && !this.peers.has(e.id) && await this.offerPeer(e.id, t);
|
|
3386
3541
|
return;
|
|
3387
3542
|
}
|
|
3388
|
-
if (e.type !== "signal" || this.resumeGrant && (!
|
|
3543
|
+
if (e.type !== "signal" || this.resumeGrant && (!Kt(e.negotiationId) || e.toConnectionEpoch !== this.resumeGrant.connectionEpoch || e.fromConnectionEpoch !== this.members.get(e.from)?.connectionEpoch || !this.members.get(e.from)?.attached)) return;
|
|
3389
3544
|
let n = this.peers.get(e.from);
|
|
3390
3545
|
if (!n) {
|
|
3391
3546
|
if (this.host || e.from !== this.hostId || !["offer", "candidate"].includes(e.signal.type)) return;
|
|
3392
3547
|
n = this.make(e.from);
|
|
3393
3548
|
}
|
|
3394
3549
|
if (this.resumeGrant) {
|
|
3550
|
+
if (!Kt(e.negotiationId)) return;
|
|
3395
3551
|
if (e.signal.type === "offer") {
|
|
3396
|
-
if (this.host || !
|
|
3397
|
-
n.negotiationId !== e.negotiationId && (n.candidates = []), this.beginNegotiation(n, e.negotiationId), n.remoteIceUfrag =
|
|
3552
|
+
if (this.host || !Jt(e.signal.sdp)) return;
|
|
3553
|
+
n.negotiationId !== e.negotiationId && (n.candidates = []), this.beginNegotiation(n, e.negotiationId), n.remoteIceUfrag = Jt(e.signal.sdp), n.localIceUfrag = void 0;
|
|
3398
3554
|
} else if (e.signal.type === "candidate" && !n.negotiationId && !this.host) this.beginNegotiation(n, e.negotiationId);
|
|
3399
3555
|
else if (n.negotiationId !== e.negotiationId) return;
|
|
3400
3556
|
if (n.negotiationLocalEpoch !== e.toConnectionEpoch || n.negotiationRemoteEpoch !== e.fromConnectionEpoch) return;
|
|
3401
3557
|
if (e.signal.type === "answer") {
|
|
3402
|
-
if (!
|
|
3403
|
-
n.remoteIceUfrag =
|
|
3558
|
+
if (!Jt(e.signal.sdp)) return;
|
|
3559
|
+
n.remoteIceUfrag = Jt(e.signal.sdp);
|
|
3404
3560
|
}
|
|
3405
3561
|
}
|
|
3406
|
-
let r = n.negotiationId,
|
|
3562
|
+
let r = n, i = r.negotiationId, a = () => this.current(r) && t === this.socketSerial && this.signalingAdmitted && r.negotiationId === i && this.negotiationCurrent(r);
|
|
3407
3563
|
if (e.signal.type === "offer") {
|
|
3408
3564
|
if (this.host) throw Error("Only the host can offer");
|
|
3409
3565
|
if (await n.pc.setRemoteDescription({
|
|
3410
3566
|
type: "offer",
|
|
3411
3567
|
sdp: e.signal.sdp
|
|
3412
|
-
}), !
|
|
3568
|
+
}), !a() || (await this.flushCandidates(n, a), !a())) return;
|
|
3413
3569
|
let t = await n.pc.createAnswer();
|
|
3414
|
-
if (!
|
|
3570
|
+
if (!a() || (n.localIceUfrag = Jt(t.sdp), await n.pc.setLocalDescription(t), !a())) return;
|
|
3415
3571
|
this.peerSignal(n, {
|
|
3416
3572
|
type: "answer",
|
|
3417
|
-
sdp: n
|
|
3573
|
+
sdp: this.localSdp(n)
|
|
3418
3574
|
});
|
|
3419
3575
|
} else if (e.signal.type === "answer") {
|
|
3420
3576
|
if (!this.host) throw Error("Only guests can answer");
|
|
3421
3577
|
if (await n.pc.setRemoteDescription({
|
|
3422
3578
|
type: "answer",
|
|
3423
3579
|
sdp: e.signal.sdp
|
|
3424
|
-
}), !
|
|
3425
|
-
await this.flushCandidates(n,
|
|
3580
|
+
}), !a()) return;
|
|
3581
|
+
await this.flushCandidates(n, a), this.noteHealthy(n);
|
|
3426
3582
|
} else if (e.signal.type === "candidate" && e.signal.candidate) {
|
|
3427
|
-
if (this.resumeGrant && (!
|
|
3583
|
+
if (this.resumeGrant && (!Yt(e.signal.candidate) || n.remoteIceUfrag && Yt(e.signal.candidate) !== n.remoteIceUfrag)) return;
|
|
3428
3584
|
if (!n.pc.remoteDescription) this.queueCandidate(n, e.signal.candidate);
|
|
3429
3585
|
else try {
|
|
3430
3586
|
await n.pc.addIceCandidate(e.signal.candidate);
|
|
3431
3587
|
} catch {
|
|
3432
|
-
|
|
3588
|
+
a() && this.queueCandidate(n, e.signal.candidate);
|
|
3433
3589
|
}
|
|
3434
3590
|
}
|
|
3435
3591
|
}
|
|
@@ -3437,7 +3593,7 @@ var Dt = class {
|
|
|
3437
3593
|
this.members = new Map(e.map((e) => [e.id, e])), this.rosterRevision = t;
|
|
3438
3594
|
for (let e of [...this.peers.keys()]) this.members.has(e) || this.remove(e, !1);
|
|
3439
3595
|
if (this.host) for (let t of e) t.id !== this.id && t.attached && !this.peers.has(t.id) && this.offerPeer(t.id, n).catch(() => {
|
|
3440
|
-
!this.closed && n === this.socketSerial && this.hooks.status("Connection negotiation failed.");
|
|
3596
|
+
!this.closed && n === this.socketSerial && this.hooks.status("Connection negotiation failed.", "error");
|
|
3441
3597
|
});
|
|
3442
3598
|
}
|
|
3443
3599
|
negotiationCurrent(e) {
|
|
@@ -3452,7 +3608,7 @@ var Dt = class {
|
|
|
3452
3608
|
type: "signal",
|
|
3453
3609
|
to: e.id,
|
|
3454
3610
|
signal: t,
|
|
3455
|
-
...n ? {
|
|
3611
|
+
...n && r ? {
|
|
3456
3612
|
fromConnectionEpoch: n.connectionEpoch,
|
|
3457
3613
|
toConnectionEpoch: r.connectionEpoch,
|
|
3458
3614
|
negotiationId: e.negotiationId
|
|
@@ -3466,11 +3622,16 @@ var Dt = class {
|
|
|
3466
3622
|
maxRetransmits: 0
|
|
3467
3623
|
})), this.resumeGrant && this.beginNegotiation(n, crypto.randomUUID());
|
|
3468
3624
|
let r = n.negotiationId, i = () => this.current(n) && t === this.socketSerial && this.signalingAdmitted && n.negotiationId === r && this.negotiationCurrent(n), a = await n.pc.createOffer();
|
|
3469
|
-
i() && (n.localIceUfrag =
|
|
3625
|
+
i() && (n.localIceUfrag = Jt(a.sdp), await n.pc.setLocalDescription(a), i() && this.peerSignal(n, {
|
|
3470
3626
|
type: "offer",
|
|
3471
|
-
sdp: n
|
|
3627
|
+
sdp: this.localSdp(n)
|
|
3472
3628
|
}));
|
|
3473
3629
|
}
|
|
3630
|
+
localSdp(e) {
|
|
3631
|
+
let t = e.pc.localDescription;
|
|
3632
|
+
if (!t) throw Error("Local peer description is unavailable");
|
|
3633
|
+
return t.sdp;
|
|
3634
|
+
}
|
|
3474
3635
|
current(e) {
|
|
3475
3636
|
return !this.closed && this.peers.get(e.id) === e;
|
|
3476
3637
|
}
|
|
@@ -3483,32 +3644,32 @@ var Dt = class {
|
|
|
3483
3644
|
noteHealthy(e) {
|
|
3484
3645
|
if (!this.current(e) || e.pc.connectionState !== "connected" || !["connected", "completed"].includes(e.pc.iceConnectionState)) return;
|
|
3485
3646
|
let t = e.lostAt !== void 0;
|
|
3486
|
-
e.lostAt = void 0, e.restarts = 0, t && this.hooks.status("Direct connection restored.");
|
|
3647
|
+
e.lostAt = void 0, e.restarts = 0, t && this.hooks.status("Direct connection restored.", "info");
|
|
3487
3648
|
}
|
|
3488
3649
|
async flushCandidates(e, t = () => this.current(e)) {
|
|
3489
3650
|
let n = e.candidates.splice(0);
|
|
3490
3651
|
for (let r of n) {
|
|
3491
3652
|
if (!t()) return;
|
|
3492
|
-
if (!this.resumeGrant || e.remoteIceUfrag &&
|
|
3653
|
+
if (!this.resumeGrant || e.remoteIceUfrag && Yt(r) === e.remoteIceUfrag) try {
|
|
3493
3654
|
await e.pc.addIceCandidate(r);
|
|
3494
3655
|
} catch {}
|
|
3495
3656
|
}
|
|
3496
3657
|
}
|
|
3497
3658
|
async restartPeer(e) {
|
|
3498
3659
|
let t = this.peers.get(e);
|
|
3499
|
-
if (this.closed || !this.host || !t || t.restarting || t.restarts >= 2 || t.pc.signalingState !== "stable" || !this.signalingAdmitted || this.ws.readyState !==
|
|
3660
|
+
if (this.closed || !this.host || !t || t.restarting || t.restarts >= 2 || t.pc.signalingState !== "stable" || !this.signalingAdmitted || this.ws.readyState !== Gt) return !1;
|
|
3500
3661
|
let n = this.socketSerial;
|
|
3501
3662
|
this.resumeGrant && (this.beginNegotiation(t, crypto.randomUUID()), t.localIceUfrag = void 0, t.remoteIceUfrag = void 0, t.candidates = []);
|
|
3502
3663
|
let r = t.negotiationId, i = () => this.current(t) && n === this.socketSerial && this.signalingAdmitted && t.negotiationId === r && this.negotiationCurrent(t);
|
|
3503
3664
|
t.restarting = !0, t.lastRestart = performance.now(), t.lostAt ??= t.lastRestart, t.restarts++;
|
|
3504
3665
|
try {
|
|
3505
3666
|
let e = await t.pc.createOffer({ iceRestart: !0 });
|
|
3506
|
-
return !i() || (t.localIceUfrag =
|
|
3667
|
+
return !i() || (t.localIceUfrag = Jt(e.sdp), await t.pc.setLocalDescription(e), !i()) ? !1 : (this.peerSignal(t, {
|
|
3507
3668
|
type: "offer",
|
|
3508
|
-
sdp: t
|
|
3669
|
+
sdp: this.localSdp(t)
|
|
3509
3670
|
}), !0);
|
|
3510
3671
|
} catch {
|
|
3511
|
-
return !this.closed && this.peers.get(e) === t && this.hooks.status("Direct connection recovery is still pending."), !1;
|
|
3672
|
+
return !this.closed && this.peers.get(e) === t && this.hooks.status("Direct connection recovery is still pending.", "info"), !1;
|
|
3512
3673
|
} finally {
|
|
3513
3674
|
t.restarting = !1;
|
|
3514
3675
|
}
|
|
@@ -3530,13 +3691,13 @@ var Dt = class {
|
|
|
3530
3691
|
this.peers.set(e, n), t.onicecandidate = (e) => {
|
|
3531
3692
|
if (!this.current(n) || !e.candidate || !this.signalingAdmitted) return;
|
|
3532
3693
|
let t = e.candidate.toJSON();
|
|
3533
|
-
(!this.resumeGrant || n.localIceUfrag &&
|
|
3694
|
+
(!this.resumeGrant || n.localIceUfrag && Yt(t) === n.localIceUfrag) && this.peerSignal(n, {
|
|
3534
3695
|
type: "candidate",
|
|
3535
3696
|
candidate: t
|
|
3536
3697
|
});
|
|
3537
3698
|
}, t.ondatachannel = (e) => this.bind(n, e.channel);
|
|
3538
3699
|
let r = () => {
|
|
3539
|
-
this.closed || this.peers.get(e) !== n || (t.connectionState === "closed" ? (this.hooks.status("A peer disconnected."), this.remove(e)) : t.connectionState === "connected" && ["connected", "completed"].includes(t.iceConnectionState) ? this.noteHealthy(n) : (["failed", "disconnected"].includes(t.connectionState) || ["failed", "disconnected"].includes(t.iceConnectionState)) && (n.lostAt ??= performance.now(), this.hooks.status("Direct connection interrupted. Attempting recovery…")));
|
|
3700
|
+
this.closed || this.peers.get(e) !== n || (t.connectionState === "closed" ? (this.hooks.status("A peer disconnected.", "info"), this.remove(e)) : t.connectionState === "connected" && ["connected", "completed"].includes(t.iceConnectionState) ? this.noteHealthy(n) : (["failed", "disconnected"].includes(t.connectionState) || ["failed", "disconnected"].includes(t.iceConnectionState)) && (n.lostAt ??= performance.now(), this.hooks.status("Direct connection interrupted. Attempting recovery…", "info")));
|
|
3540
3701
|
};
|
|
3541
3702
|
return t.onconnectionstatechange = r, t.oniceconnectionstatechange = r, n;
|
|
3542
3703
|
}
|
|
@@ -3550,10 +3711,10 @@ var Dt = class {
|
|
|
3550
3711
|
return;
|
|
3551
3712
|
}
|
|
3552
3713
|
t.binaryType = "arraybuffer", t.label === "control" ? e.control = t : e.fast = t, t.onclose = () => {
|
|
3553
|
-
!this.closed && this.peers.get(e.id) === e && (this.hooks.status("A peer closed its game channel."), this.remove(e.id));
|
|
3714
|
+
!this.closed && this.peers.get(e.id) === e && (this.hooks.status("A peer closed its game channel.", "info"), this.remove(e.id));
|
|
3554
3715
|
}, t.onopen = () => {
|
|
3555
3716
|
this.closed || this.peers.get(e.id) !== e || e.control?.readyState === "open" && e.fast?.readyState === "open" && !e.connected && (e.connected = !0, this.host && (e.admissionTimer = setTimeout(() => {
|
|
3556
|
-
this.closed || this.peers.get(e.id) !== e || (this.hooks.status("A peer did not complete room admission."), this.remove(e.id));
|
|
3717
|
+
this.closed || this.peers.get(e.id) !== e || (this.hooks.status("A peer did not complete room admission.", "error"), this.remove(e.id));
|
|
3557
3718
|
}, 1e4)), this.hooks.open(e));
|
|
3558
3719
|
}, t.onmessage = (n) => {
|
|
3559
3720
|
if (!(this.closed || this.peers.get(e.id) !== e)) {
|
|
@@ -3564,7 +3725,7 @@ var Dt = class {
|
|
|
3564
3725
|
if (this.host && t && !this.hooks.allowStadiumUpload?.(e)) throw Error("Guest control size or permission");
|
|
3565
3726
|
if (typeof n.data != "string" && !(n.data instanceof ArrayBuffer)) throw Error("Invalid control type");
|
|
3566
3727
|
let r = this.controlAssemblers.get(e.id);
|
|
3567
|
-
r || (r = new
|
|
3728
|
+
r || (r = new Ut(), this.controlAssemblers.set(e.id, r));
|
|
3568
3729
|
let i = r.push(n.data);
|
|
3569
3730
|
if (i !== void 0) {
|
|
3570
3731
|
if (this.host && t && (!i || typeof i != "object" || i.type !== "action" || i.action !== "customStadium")) throw Error("Invalid bulk action");
|
|
@@ -3573,7 +3734,7 @@ var Dt = class {
|
|
|
3573
3734
|
} else if (n.data instanceof ArrayBuffer && n.data.byteLength <= 1200) this.hooks.fast(e, n.data);
|
|
3574
3735
|
else throw Error();
|
|
3575
3736
|
} catch {
|
|
3576
|
-
this.hooks.status("Invalid peer message rejected."), this.remove(e.id);
|
|
3737
|
+
this.hooks.status("Invalid peer message rejected.", "error"), this.remove(e.id);
|
|
3577
3738
|
}
|
|
3578
3739
|
}
|
|
3579
3740
|
};
|
|
@@ -3583,7 +3744,7 @@ var Dt = class {
|
|
|
3583
3744
|
}
|
|
3584
3745
|
control(e, t) {
|
|
3585
3746
|
if (e.control?.readyState !== "open") return;
|
|
3586
|
-
let n =
|
|
3747
|
+
let n = Ht(t, this.controlId++), r = n.reduce((e, t) => e + (typeof t == "string" ? new TextEncoder().encode(t).length : t.byteLength), 0);
|
|
3587
3748
|
if (e.control.bufferedAmount + r > 1048576) {
|
|
3588
3749
|
this.remove(e.id);
|
|
3589
3750
|
return;
|
|
@@ -3608,7 +3769,7 @@ var Dt = class {
|
|
|
3608
3769
|
}
|
|
3609
3770
|
try {
|
|
3610
3771
|
let t = await e.pc.getStats();
|
|
3611
|
-
!this.closed && this.peers.get(e.id) === e && (e.rtt =
|
|
3772
|
+
!this.closed && this.peers.get(e.id) === e && (e.rtt = Rt(t.values()));
|
|
3612
3773
|
} catch {
|
|
3613
3774
|
e.rtt = null;
|
|
3614
3775
|
}
|
|
@@ -3618,16 +3779,22 @@ var Dt = class {
|
|
|
3618
3779
|
}
|
|
3619
3780
|
}
|
|
3620
3781
|
}
|
|
3782
|
+
hostCloseTimer;
|
|
3621
3783
|
remove(e, t = !0) {
|
|
3622
3784
|
let n = this.peers.get(e);
|
|
3623
|
-
n && (clearTimeout(n.admissionTimer), this.peers.delete(e), this.controlAssemblers.delete(e), n.pc.close(), this.host && t
|
|
3785
|
+
if (n && (clearTimeout(n.admissionTimer), this.peers.delete(e), this.controlAssemblers.delete(e), n.pc.close(), this.host && t && this.signal({
|
|
3624
3786
|
type: "evict",
|
|
3625
3787
|
id: e
|
|
3626
|
-
})
|
|
3788
|
+
}), this.hooks.leave(e), !this.host)) {
|
|
3789
|
+
let e = () => {
|
|
3790
|
+
this.close(), this.hooks.ended?.("The host connection ended.");
|
|
3791
|
+
};
|
|
3792
|
+
this.signalingAdmitted && this.ws.readyState === Gt ? this.hostCloseTimer = setTimeout(e, 1e3) : e();
|
|
3793
|
+
}
|
|
3627
3794
|
}
|
|
3628
3795
|
close() {
|
|
3629
3796
|
if (!this.closed) {
|
|
3630
|
-
this.resumeGrant && this.signalingAdmitted && this.ws.readyState ===
|
|
3797
|
+
clearTimeout(this.hostCloseTimer), this.hostCloseTimer = void 0, this.resumeGrant && this.signalingAdmitted && this.ws.readyState === Gt && this.signal({
|
|
3631
3798
|
type: "leave",
|
|
3632
3799
|
connectionEpoch: this.resumeGrant.connectionEpoch
|
|
3633
3800
|
}), this.recovery?.cancel(), this.resumeGrant = void 0, this.resumeAttempt = void 0, this.cancelHeartbeat(), this.socketSerial++, this.challenge?.abort(), this.rejectVerification("Room closed before verification confirmation."), this.verificationState = null, this.rejectBan("Room closed before ban confirmation."), this.rejectPasswordUpdate("Room closed before password confirmation."), this.closed = !0, clearInterval(this.timer), this.ws.close(1e3, "Left room");
|
|
@@ -3635,14 +3802,14 @@ var Dt = class {
|
|
|
3635
3802
|
this.peers.clear(), this.controlAssemblers.clear();
|
|
3636
3803
|
}
|
|
3637
3804
|
}
|
|
3638
|
-
};
|
|
3639
|
-
function
|
|
3805
|
+
}, Zt = 5;
|
|
3806
|
+
function Qt(e, t) {
|
|
3640
3807
|
return e !== t && e - t >>> 0 < 2147483648;
|
|
3641
3808
|
}
|
|
3642
|
-
function
|
|
3809
|
+
function $t(e) {
|
|
3643
3810
|
if (e.byteLength !== 14) throw Error("Input length");
|
|
3644
3811
|
let t = new DataView(e);
|
|
3645
|
-
if (t.getUint8(0) !== 1 || t.getUint8(1) !==
|
|
3812
|
+
if (t.getUint8(0) !== 1 || t.getUint8(1) !== Zt || t.getUint8(6) > 31 || t.getUint8(7)) throw Error("Input format");
|
|
3646
3813
|
return {
|
|
3647
3814
|
seq: t.getUint32(2, !0),
|
|
3648
3815
|
keys: t.getUint8(6),
|
|
@@ -3650,7 +3817,7 @@ function It(e) {
|
|
|
3650
3817
|
epoch: t.getUint16(12, !0)
|
|
3651
3818
|
};
|
|
3652
3819
|
}
|
|
3653
|
-
function
|
|
3820
|
+
function en(e, t, n = 0) {
|
|
3654
3821
|
if (e.surface?.length) throw Error("Terrain transport is not enabled");
|
|
3655
3822
|
let r = [];
|
|
3656
3823
|
for (let t = 0; t < e.discs.length / 18; t++) {
|
|
@@ -3672,11 +3839,11 @@ function Lt(e, t, n = 0) {
|
|
|
3672
3839
|
let s = new Uint8Array(a), c = [], l = Math.ceil(s.length / 1188);
|
|
3673
3840
|
for (let t = 0; t < l; t++) {
|
|
3674
3841
|
let r = s.subarray(t * 1188, (t + 1) * 1188), i = new ArrayBuffer(12 + r.length), a = new DataView(i);
|
|
3675
|
-
a.setUint8(0, 2), a.setUint8(1,
|
|
3842
|
+
a.setUint8(0, 2), a.setUint8(1, Zt), a.setUint32(2, e.tick, !0), a.setUint8(6, t), a.setUint8(7, l), a.setUint16(8, n, !0), a.setUint16(10, r.length, !0), new Uint8Array(i, 12).set(r), c.push(i);
|
|
3676
3843
|
}
|
|
3677
3844
|
return c;
|
|
3678
3845
|
}
|
|
3679
|
-
var
|
|
3846
|
+
var tn = Object.freeze({ ...Fe }), nn = class e {
|
|
3680
3847
|
runtime;
|
|
3681
3848
|
engine;
|
|
3682
3849
|
network;
|
|
@@ -3684,6 +3851,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3684
3851
|
roomLink = "";
|
|
3685
3852
|
roomName = "";
|
|
3686
3853
|
epoch = 0;
|
|
3854
|
+
kickStream = new be();
|
|
3687
3855
|
stadiumSelection = 0;
|
|
3688
3856
|
players = [];
|
|
3689
3857
|
nextPlayerId = 0;
|
|
@@ -3702,7 +3870,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3702
3870
|
locked = !1;
|
|
3703
3871
|
teamStyles = [null, null];
|
|
3704
3872
|
inputs = /* @__PURE__ */ new Map();
|
|
3705
|
-
traffic = new
|
|
3873
|
+
traffic = new at();
|
|
3706
3874
|
onRoomLink;
|
|
3707
3875
|
onPlayerJoin;
|
|
3708
3876
|
onPlayerTeamChange;
|
|
@@ -3745,18 +3913,18 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3745
3913
|
constructor(e, t) {
|
|
3746
3914
|
this.runtime = t, this.engine = e;
|
|
3747
3915
|
}
|
|
3748
|
-
static async create(t, n =
|
|
3749
|
-
let i =
|
|
3750
|
-
if (t =
|
|
3751
|
-
let
|
|
3752
|
-
if (
|
|
3753
|
-
let
|
|
3916
|
+
static async create(t, n = rt(), r) {
|
|
3917
|
+
let i = Ze(n.network.serviceOrigin), a = Ze(n.publicOrigin ?? i);
|
|
3918
|
+
if (t = Ce(t), t.noPlayer !== void 0 && typeof t.noPlayer != "boolean") throw Error("Invalid noPlayer setting");
|
|
3919
|
+
let o = t.noPlayer === !1, s = t.playerName ?? "Host";
|
|
3920
|
+
if (o && (typeof s != "string" || !s.trim() || s.length > 24)) throw Error("Invalid host player name");
|
|
3921
|
+
let c = ve(r), l;
|
|
3754
3922
|
try {
|
|
3755
|
-
|
|
3756
|
-
let r = await
|
|
3757
|
-
r.load(t.stadium ??
|
|
3758
|
-
let
|
|
3759
|
-
signal:
|
|
3923
|
+
c.signal.throwIfAborted();
|
|
3924
|
+
let r = await c.run(n.loadEngine(c.signal));
|
|
3925
|
+
r.load(t.stadium ?? Ke()), l = new e(r, n);
|
|
3926
|
+
let u = l, d = await c.run(n.request(new URL(h.rooms, i), {
|
|
3927
|
+
signal: c.signal,
|
|
3760
3928
|
method: "POST",
|
|
3761
3929
|
headers: { "Content-Type": "application/json" },
|
|
3762
3930
|
body: JSON.stringify({
|
|
@@ -3764,56 +3932,58 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3764
3932
|
maxPlayers: t.maxPlayers ?? 16,
|
|
3765
3933
|
password: t.password ?? "",
|
|
3766
3934
|
private: t.public === !1,
|
|
3767
|
-
hostPlayer:
|
|
3935
|
+
hostPlayer: o
|
|
3768
3936
|
})
|
|
3769
3937
|
}));
|
|
3770
|
-
if (!
|
|
3771
|
-
let
|
|
3772
|
-
|
|
3773
|
-
let
|
|
3938
|
+
if (!d.ok) throw await c.run(ye(d, c.signal));
|
|
3939
|
+
let f = await c.run(d.json());
|
|
3940
|
+
u.roomId = f.id, u.roomName = t.roomName, u.roomLink = `${a}${Te(f.id)}`;
|
|
3941
|
+
let p;
|
|
3774
3942
|
try {
|
|
3775
|
-
await
|
|
3776
|
-
|
|
3943
|
+
await c.run(new Promise((e, t) => {
|
|
3944
|
+
p = setTimeout(() => t(Error("Signaling timed out")), 12e3), u.network = new Xt(f.id, { hostToken: f.hostToken }, {
|
|
3777
3945
|
ready: (n, r) => {
|
|
3778
3946
|
if (!r) {
|
|
3779
3947
|
t(Error("Host authority was not granted"));
|
|
3780
3948
|
return;
|
|
3781
3949
|
}
|
|
3782
|
-
|
|
3783
|
-
id:
|
|
3950
|
+
o && (u.players.push({
|
|
3951
|
+
id: u.nextPlayerId++,
|
|
3784
3952
|
slot: 0,
|
|
3785
3953
|
peerId: n,
|
|
3786
|
-
name:
|
|
3954
|
+
name: s.trim(),
|
|
3787
3955
|
team: 0,
|
|
3788
3956
|
admin: !0
|
|
3789
|
-
}),
|
|
3957
|
+
}), u.engine.joinPlayer(0)), clearTimeout(p), e();
|
|
3790
3958
|
},
|
|
3791
|
-
allowStadiumUpload: (e) => !!
|
|
3959
|
+
allowStadiumUpload: (e) => !!u.players.find((t) => t.peerId === e.id)?.admin && ["lobby", "finished"].includes(u.engine.phase) && u.traffic.allow(e.id, "message"),
|
|
3792
3960
|
open: () => {},
|
|
3793
|
-
control: (e, t) =>
|
|
3794
|
-
fast: (e, t) =>
|
|
3795
|
-
leave: (e) =>
|
|
3796
|
-
status: (e) =>
|
|
3961
|
+
control: (e, t) => u.control(e, t),
|
|
3962
|
+
fast: (e, t) => u.fast(e, t),
|
|
3963
|
+
leave: (e) => u.leave(e),
|
|
3964
|
+
status: (e, t) => {
|
|
3965
|
+
t === "error" && u.report(e);
|
|
3966
|
+
},
|
|
3797
3967
|
ended: (e) => {
|
|
3798
|
-
clearTimeout(
|
|
3968
|
+
clearTimeout(p), t(Error(e)), u.close(), u.report(e);
|
|
3799
3969
|
}
|
|
3800
3970
|
}, n.network);
|
|
3801
3971
|
}));
|
|
3802
3972
|
} catch (e) {
|
|
3803
|
-
throw
|
|
3973
|
+
throw u.close(), e;
|
|
3804
3974
|
} finally {
|
|
3805
|
-
clearTimeout(
|
|
3975
|
+
clearTimeout(p);
|
|
3806
3976
|
}
|
|
3807
|
-
if (
|
|
3808
|
-
|
|
3809
|
-
let
|
|
3810
|
-
return
|
|
3811
|
-
|
|
3812
|
-
}, 0),
|
|
3977
|
+
if (u.closed) throw Error("Room closed during startup");
|
|
3978
|
+
u.last = performance.now(), u.loop = setInterval(() => u.advance(), 1e3 / 60);
|
|
3979
|
+
let m = u.roomLink;
|
|
3980
|
+
return u.linkNotification = setTimeout(() => {
|
|
3981
|
+
u.linkNotification = void 0, u.invoke("onRoomLink", u.onRoomLink, m);
|
|
3982
|
+
}, 0), l;
|
|
3813
3983
|
} catch (e) {
|
|
3814
|
-
throw
|
|
3984
|
+
throw l?.close(), e;
|
|
3815
3985
|
} finally {
|
|
3816
|
-
|
|
3986
|
+
c.dispose();
|
|
3817
3987
|
}
|
|
3818
3988
|
}
|
|
3819
3989
|
advance() {
|
|
@@ -3829,30 +3999,29 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3829
3999
|
}
|
|
3830
4000
|
if (this.recorder && !this.recorder.canRecord(this.engine) && this.finishRecording("Recording limit reached"), this.closed || (this.engine.phase !== "lobby" && !this.engine.paused && !this.engine.resumeTicks && this.invoke("onGameTick", this.onGameTick), this.closed)) break;
|
|
3831
4001
|
let t = this.engine.red, n = this.engine.blue, r = this.engine.phase;
|
|
3832
|
-
this.engine.step(), this.recorder?.step(this.engine), this.engine.phase !== r && this.state();
|
|
3833
|
-
let i = r === "goal" && this.engine.phase === "playing"
|
|
3834
|
-
r === "finished" && this.engine.phase === "lobby" && this.invoke("onGameStop", this.onGameStop, null);
|
|
3835
|
-
let a = this.engine.ballKicks.map((e) => {
|
|
4002
|
+
this.engine.step(), this.kickStream.capture(this.engine, this.epoch), this.recorder?.step(this.engine), this.engine.phase !== r && this.state();
|
|
4003
|
+
let i = r === "goal" && this.engine.phase === "playing", a = r === "finished" && this.engine.phase === "lobby", o = this.engine.red > t, s = this.engine.blue > n, c = this.engine.ballKicks.map((e) => {
|
|
3836
4004
|
let t = this.players.find((t) => t.slot === e);
|
|
3837
4005
|
return t ? this.playerCopy(t) : null;
|
|
3838
|
-
}).filter((e) => !!e),
|
|
3839
|
-
|
|
3840
|
-
for (let e of
|
|
3841
|
-
if (
|
|
4006
|
+
}).filter((e) => !!e), l = r !== "finished" && this.engine.phase === "finished" ? this.getScores() : null;
|
|
4007
|
+
a && this.invoke("onGameStop", this.onGameStop, null), l && (this.invoke("onTeamVictory", this.onTeamVictory, { ...l }), this.invoke("onGameVictory", this.onGameVictory, { ...l }));
|
|
4008
|
+
for (let e of c) this.invoke("onPlayerBallKick", this.onPlayerBallKick, e);
|
|
4009
|
+
if (o && this.invoke("onTeamGoal", this.onTeamGoal, 1), s && this.invoke("onTeamGoal", this.onTeamGoal, 2), i && this.invoke("onPositionsReset", this.onPositionsReset), this.closed) break;
|
|
3842
4010
|
if (this.engine.tick % 2 == 0) {
|
|
3843
4011
|
let e = this.engine.snapshot();
|
|
3844
4012
|
if (e.surface?.length) {
|
|
3845
4013
|
if (this.engine.tick % 6 == 0) {
|
|
3846
|
-
let t =
|
|
4014
|
+
let t = _e(e, this.epoch);
|
|
3847
4015
|
for (let e of this.network.peers.values()) e.control?.readyState === "open" && e.control.bufferedAmount < 65536 && this.network.control(e, {
|
|
3848
4016
|
...t,
|
|
3849
4017
|
ack: this.inputs.get(e.id)?.seq ?? 0
|
|
3850
4018
|
});
|
|
3851
4019
|
}
|
|
3852
|
-
} else for (let t of this.network.peers.values()) for (let n of
|
|
4020
|
+
} else for (let t of this.network.peers.values()) for (let n of en(e, this.inputs.get(t.id)?.seq ?? 0, this.epoch)) this.network.fast(t, n);
|
|
3853
4021
|
}
|
|
3854
4022
|
this.accumulator -= 1e3 / 60;
|
|
3855
4023
|
}
|
|
4024
|
+
this.closed || xe(this.network, this.kickStream.drain(e));
|
|
3856
4025
|
} catch (e) {
|
|
3857
4026
|
this.closed || (this.engine.setPaused(!0), this.report(String(e)));
|
|
3858
4027
|
}
|
|
@@ -3864,7 +4033,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3864
4033
|
if (!this.allowed(e) || !t || typeof t != "object") return;
|
|
3865
4034
|
let n = t, r = this.players.find((t) => t.peerId === e.id);
|
|
3866
4035
|
if (n.type === "join" && !r) {
|
|
3867
|
-
if (n.version !== 1 || n.engine !==
|
|
4036
|
+
if (n.version !== 1 || n.engine !== qe || typeof n.name != "string" || !n.name.trim() || n.name.length > 24) {
|
|
3868
4037
|
this.network.remove(e.id);
|
|
3869
4038
|
return;
|
|
3870
4039
|
}
|
|
@@ -3882,9 +4051,10 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3882
4051
|
admin: !1
|
|
3883
4052
|
}, this.players.push(r), this.network.admit(e), this.recorder?.player(this.engine.tick, r.slot, r.name), this.command("join", t, 0), this.network.control(e, {
|
|
3884
4053
|
type: "welcome",
|
|
4054
|
+
kickStream: this.kickStream.checkpoint(),
|
|
3885
4055
|
epoch: this.epoch,
|
|
3886
4056
|
roomName: this.roomName,
|
|
3887
|
-
engine:
|
|
4057
|
+
engine: qe,
|
|
3888
4058
|
slot: t,
|
|
3889
4059
|
stadium: this.engine.source,
|
|
3890
4060
|
state: this.engine.snapshot(),
|
|
@@ -3904,17 +4074,13 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3904
4074
|
});
|
|
3905
4075
|
}
|
|
3906
4076
|
if (n.action === "chat" || this.traffic.allow(e.id, "action")) {
|
|
3907
|
-
if (n.action === "avatar" &&
|
|
4077
|
+
if (n.action === "avatar" && Ae(n.avatar)) {
|
|
3908
4078
|
r.avatar = n.avatar, this.recorder?.player(this.engine.tick, r.slot, r.name, r.avatarOverride ?? r.avatar), this.sync();
|
|
3909
4079
|
return;
|
|
3910
4080
|
}
|
|
3911
|
-
if (n.action === "team" && (
|
|
3912
|
-
0,
|
|
3913
|
-
1,
|
|
3914
|
-
2
|
|
3915
|
-
].includes(Number(n.team))) {
|
|
4081
|
+
if (n.action === "team" && l(n.team)) {
|
|
3916
4082
|
let e = n.slot === void 0 ? r : this.players.find((e) => e.slot === n.slot);
|
|
3917
|
-
|
|
4083
|
+
f(r, e, this.locked) && this.changeTeam(e.id, n.team, r);
|
|
3918
4084
|
}
|
|
3919
4085
|
if (n.action === "defaultStadium" || n.action === "customStadium") {
|
|
3920
4086
|
let t = (t) => {
|
|
@@ -3943,7 +4109,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3943
4109
|
if (r.admin) {
|
|
3944
4110
|
if (n.action === "mute" && typeof n.muted == "boolean") {
|
|
3945
4111
|
let e = this.players.find((e) => e.slot === n.slot);
|
|
3946
|
-
e
|
|
4112
|
+
p(r, e, (e) => e.peerId === this.network.hostId) && this.changePlayerMuted(e.id, n.muted, this.playerCopy(r));
|
|
3947
4113
|
return;
|
|
3948
4114
|
}
|
|
3949
4115
|
if (n.action === "surface" && typeof n.enabled == "boolean" && ["lobby", "finished"].includes(this.engine.phase)) {
|
|
@@ -3952,7 +4118,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3952
4118
|
}
|
|
3953
4119
|
if (n.action === "ban" || n.action === "clearBans") {
|
|
3954
4120
|
let t = this.players.find((e) => e.slot === n.slot);
|
|
3955
|
-
if (n.action === "ban" && (
|
|
4121
|
+
if (n.action === "ban" && !p(r, t, (e) => e.peerId === this.network.hostId)) return;
|
|
3956
4122
|
let i = (t) => {
|
|
3957
4123
|
!this.closed && this.network.peers.has(e.id) && this.network.control(e, {
|
|
3958
4124
|
type: "moderationResult",
|
|
@@ -3963,30 +4129,31 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3963
4129
|
i("Only the room owner can clear bans.");
|
|
3964
4130
|
return;
|
|
3965
4131
|
}
|
|
4132
|
+
if (!t) return;
|
|
3966
4133
|
this.banPlayer(t.id, "Removed by admin", this.playerCopy(r)).then(() => i("Player banned.")).catch((e) => i(e instanceof Error ? e.message : "Moderation failed."));
|
|
3967
4134
|
return;
|
|
3968
4135
|
}
|
|
3969
4136
|
if (n.action === "teamColors" && (n.team === 1 || n.team === 2)) {
|
|
3970
4137
|
let e = n.palette;
|
|
3971
|
-
this.changeTeamColors(n.team, e === null ? null :
|
|
4138
|
+
this.changeTeamColors(n.team, e === null ? null : Ee(e.angle, e.textColor, e.colors));
|
|
3972
4139
|
}
|
|
3973
4140
|
if (n.action === "kickRate" && Number.isInteger(n.value) && Number(n.value) >= 0 && Number(n.value) <= 6619135) {
|
|
3974
4141
|
let e = Number(n.value);
|
|
3975
4142
|
this.changeKickRateLimit(e & 255, e >>> 8 & 255, e >>> 16, this.playerCopy(r));
|
|
3976
4143
|
}
|
|
3977
4144
|
if (n.action === "start" && this.beginGame(r), n.action === "stop" && this.endGame(r), n.action === "pause" && (n.paused === void 0 || typeof n.paused == "boolean") && this.changePause(n.paused === void 0 ? !this.engine.paused : n.paused, this.playerCopy(r)), n.action === "settings" && ["lobby", "finished"].includes(this.engine.phase)) {
|
|
3978
|
-
let e =
|
|
3979
|
-
if (
|
|
3980
|
-
if (this.setScoreLimit(e), this.setTimeLimit(
|
|
3981
|
-
if (
|
|
3982
|
-
let
|
|
3983
|
-
this.changeKickRateLimit(
|
|
4145
|
+
let e = d(n);
|
|
4146
|
+
if (e) {
|
|
4147
|
+
if (this.setScoreLimit(e.score), this.setTimeLimit(e.minutes), this.changeTeamsLock(e.locked, this.playerCopy(r)), this.closed) return;
|
|
4148
|
+
if (e.kickRate !== void 0 && e.kickRate !== this.engine.kickRate) {
|
|
4149
|
+
let t = e.kickRate;
|
|
4150
|
+
this.changeKickRateLimit(t & 255, t >>> 8 & 255, t >>> 16, this.playerCopy(r));
|
|
3984
4151
|
}
|
|
3985
4152
|
}
|
|
3986
4153
|
}
|
|
3987
|
-
if (n.action === "kick" && typeof n.slot == "number"
|
|
4154
|
+
if (n.action === "kick" && typeof n.slot == "number") {
|
|
3988
4155
|
let e = this.players.find((e) => e.slot === n.slot);
|
|
3989
|
-
e && this.removePlayer(e.id, "Removed by host", this.playerCopy(r));
|
|
4156
|
+
p(r, e, (e) => e.peerId === this.network.hostId) && this.removePlayer(e.id, "Removed by host", this.playerCopy(r));
|
|
3990
4157
|
}
|
|
3991
4158
|
}
|
|
3992
4159
|
}
|
|
@@ -3996,10 +4163,10 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
3996
4163
|
if (!this.allowed(e)) return;
|
|
3997
4164
|
let n = this.players.find((t) => t.peerId === e.id);
|
|
3998
4165
|
if (!n) return;
|
|
3999
|
-
let r =
|
|
4166
|
+
let r = $t(t);
|
|
4000
4167
|
if (r.epoch !== this.epoch) return;
|
|
4001
4168
|
let i = this.inputs.get(e.id);
|
|
4002
|
-
(!i ||
|
|
4169
|
+
(!i || Qt(r.seq, i.seq)) && (this.inputs.set(e.id, {
|
|
4003
4170
|
seq: r.seq,
|
|
4004
4171
|
received: performance.now(),
|
|
4005
4172
|
keys: r.keys
|
|
@@ -4014,7 +4181,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4014
4181
|
value: n
|
|
4015
4182
|
};
|
|
4016
4183
|
if (this.recorder && (!this.recorder.canRecord(this.engine) || !this.recorder.command(r)) && this.finishRecording("Recording limit reached"), this.closed) throw Error("Room is closed");
|
|
4017
|
-
|
|
4184
|
+
vt(this.engine, r);
|
|
4018
4185
|
}
|
|
4019
4186
|
roster() {
|
|
4020
4187
|
return this.players.map((e) => ({
|
|
@@ -4069,7 +4236,8 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4069
4236
|
return t ? this.playerCopy(t) : null;
|
|
4070
4237
|
}
|
|
4071
4238
|
setTeamColors(e, t, n, r) {
|
|
4072
|
-
|
|
4239
|
+
let i = Ee(t, n, r);
|
|
4240
|
+
i.angle = ((256 * t / 360 | 0) & 255) * (360 / 256), this.changeTeamColors(e, i);
|
|
4073
4241
|
}
|
|
4074
4242
|
changeTeamColors(e, t) {
|
|
4075
4243
|
if (this.closed) throw Error("Room is closed");
|
|
@@ -4087,7 +4255,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4087
4255
|
}
|
|
4088
4256
|
setPlayerAvatar(e, t) {
|
|
4089
4257
|
if (this.closed) throw Error("Room is closed");
|
|
4090
|
-
if (!
|
|
4258
|
+
if (!Ae(t)) throw Error("Avatar must be null or at most two visible characters.");
|
|
4091
4259
|
let n = this.players.find((t) => t.id === e);
|
|
4092
4260
|
n && (n.avatarOverride = t, this.recorder?.player(this.engine.tick, n.slot, n.name, t ?? n.avatar), this.sync());
|
|
4093
4261
|
}
|
|
@@ -4138,9 +4306,9 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4138
4306
|
let i = this.playerCopy(r), a = t.slice(0, 100);
|
|
4139
4307
|
if (this.bans.size >= 256 && !this.bans.has(e)) throw Error("Clear existing bans before adding more.");
|
|
4140
4308
|
try {
|
|
4141
|
-
await this.network.updateBan("ban", r.peerId);
|
|
4309
|
+
await this.network.updateBan("ban", r.peerId, a);
|
|
4142
4310
|
} catch (t) {
|
|
4143
|
-
throw t instanceof
|
|
4311
|
+
throw t instanceof Wt && this.bans.set(e, r.peerId), t;
|
|
4144
4312
|
}
|
|
4145
4313
|
this.bans.set(e, r.peerId), this.network.remove(r.peerId), this.invoke("onPlayerKicked", this.onPlayerKicked, i, a, !0, n);
|
|
4146
4314
|
}
|
|
@@ -4185,7 +4353,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4185
4353
|
}
|
|
4186
4354
|
sendAnnouncement(e, t, n, r, i) {
|
|
4187
4355
|
if (this.closed) throw Error("Room is closed");
|
|
4188
|
-
let a =
|
|
4356
|
+
let a = ke(e, n, r, i);
|
|
4189
4357
|
if (t != null && (!Number.isSafeInteger(t) || t < 0)) throw Error("Invalid announcement target");
|
|
4190
4358
|
if (t == null) this.network.broadcast(a);
|
|
4191
4359
|
else {
|
|
@@ -4227,7 +4395,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4227
4395
|
}
|
|
4228
4396
|
changeKickRateLimit(e, t, n, r) {
|
|
4229
4397
|
if (this.closed) throw Error("Room is closed");
|
|
4230
|
-
let i =
|
|
4398
|
+
let i = Xe(e, t, n);
|
|
4231
4399
|
i !== this.engine.kickRate && (this.command("kickRate", 0, i), this.state(), this.invoke("onKickRateLimitSet", this.onKickRateLimitSet, i & 255, i >>> 8 & 255, i >>> 16, r));
|
|
4232
4400
|
}
|
|
4233
4401
|
async setPassword(e) {
|
|
@@ -4272,7 +4440,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4272
4440
|
changeStadium(e, t) {
|
|
4273
4441
|
if (this.closed) throw Error("Room is closed");
|
|
4274
4442
|
if (!["lobby", "finished"].includes(this.engine.phase)) return;
|
|
4275
|
-
|
|
4443
|
+
Ge(e);
|
|
4276
4444
|
let n = ++this.stadiumSelection;
|
|
4277
4445
|
if (this.recorder && this.finishRecording("Stadium changed"), this.closed) throw Error("Room is closed");
|
|
4278
4446
|
if (["lobby", "finished"].includes(this.engine.phase)) {
|
|
@@ -4322,7 +4490,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4322
4490
|
};
|
|
4323
4491
|
}
|
|
4324
4492
|
get CollisionFlags() {
|
|
4325
|
-
return
|
|
4493
|
+
return tn;
|
|
4326
4494
|
}
|
|
4327
4495
|
getDiscCount() {
|
|
4328
4496
|
return this.closed || this.engine.phase === "lobby" ? 0 : this.engine.stadium.discs.length + this.players.filter((e) => e.team !== 0).length;
|
|
@@ -4347,7 +4515,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4347
4515
|
n && this.changeDisc(this.engine.index(n.slot), t);
|
|
4348
4516
|
}
|
|
4349
4517
|
changeDisc(e, t) {
|
|
4350
|
-
let n =
|
|
4518
|
+
let n = Me(t), r = this.readDisc(e);
|
|
4351
4519
|
if (Object.entries(n).every(([e, t]) => r[e] === t)) return;
|
|
4352
4520
|
let i = {
|
|
4353
4521
|
tick: this.engine.tick,
|
|
@@ -4357,7 +4525,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4357
4525
|
properties: n
|
|
4358
4526
|
};
|
|
4359
4527
|
if (this.recorder && (!this.recorder.canRecord(this.engine) || !this.recorder.command(i)) && this.finishRecording("Recording limit reached"), this.closed) throw Error("Room is closed");
|
|
4360
|
-
|
|
4528
|
+
vt(this.engine, i), this.state();
|
|
4361
4529
|
}
|
|
4362
4530
|
getPlayerDiscProperties(e) {
|
|
4363
4531
|
if (this.closed || this.engine.phase === "lobby") return null;
|
|
@@ -4371,7 +4539,7 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4371
4539
|
if (this.closed) throw Error("Room is closed");
|
|
4372
4540
|
if (this.finishingRecording) throw Error("Recording completion is in progress");
|
|
4373
4541
|
if (this.recorder) throw Error("Recording is already active");
|
|
4374
|
-
this.recorder = new
|
|
4542
|
+
this.recorder = new yt(this.engine, this.players.map((e) => ({
|
|
4375
4543
|
slot: e.slot,
|
|
4376
4544
|
name: e.name,
|
|
4377
4545
|
avatar: e.avatarOverride ?? e.avatar
|
|
@@ -4401,11 +4569,11 @@ var Rt = Object.freeze({ ...Te }), zt = class e {
|
|
|
4401
4569
|
}
|
|
4402
4570
|
}
|
|
4403
4571
|
};
|
|
4404
|
-
function
|
|
4572
|
+
function rn(e) {
|
|
4405
4573
|
if (!e || typeof e != "object" || Array.isArray(e)) throw Error("Room configuration must be an object");
|
|
4406
4574
|
let t = { ...e }, n = t.maxPlayers ?? 12;
|
|
4407
4575
|
if (typeof n != "number" || !Number.isFinite(n) || !Number.isInteger(n)) throw Error("maxPlayers must be a finite integer");
|
|
4408
|
-
return
|
|
4576
|
+
return Ce({
|
|
4409
4577
|
...t,
|
|
4410
4578
|
roomName: t.roomName ?? "Headless Room",
|
|
4411
4579
|
playerName: t.playerName ?? "Host",
|
|
@@ -4415,7 +4583,7 @@ function Bt(e) {
|
|
|
4415
4583
|
password: t.password ?? ""
|
|
4416
4584
|
});
|
|
4417
4585
|
}
|
|
4418
|
-
var
|
|
4586
|
+
var an = class {
|
|
4419
4587
|
onError;
|
|
4420
4588
|
pending = [];
|
|
4421
4589
|
active;
|
|
@@ -4451,6 +4619,7 @@ var Vt = class {
|
|
|
4451
4619
|
async drain() {
|
|
4452
4620
|
for (; !this.closed && this.pending.length;) {
|
|
4453
4621
|
let e = this.pending.shift();
|
|
4622
|
+
if (!e) break;
|
|
4454
4623
|
this.active = e;
|
|
4455
4624
|
try {
|
|
4456
4625
|
e.resolve(await e.run());
|
|
@@ -4468,19 +4637,19 @@ var Vt = class {
|
|
|
4468
4637
|
this.active?.reject(e);
|
|
4469
4638
|
for (let t of this.pending.splice(0)) t.reject(e);
|
|
4470
4639
|
}
|
|
4471
|
-
},
|
|
4472
|
-
function
|
|
4640
|
+
}, on = /* @__PURE__ */ "sendChat.sendAnnouncement.setPlayerAdmin.setPlayerMuted.setPlayerTeam.kickPlayer.clearBan.clearBans.setScoreLimit.setTimeLimit.setCustomStadium.setDefaultStadium.setTeamsLock.setTeamColors.startGame.stopGame.pauseGame.setPassword.setRequireVerification.setRequireRecaptcha.reorderPlayers.setKickRateLimit.setSurfaceEnabled.setPlayerAvatar.setDiscProperties.setPlayerDiscProperties".split(".");
|
|
4641
|
+
function sn(e, t) {
|
|
4473
4642
|
let n = Object.create(null);
|
|
4474
4643
|
t && Object.defineProperty(n, "closed", {
|
|
4475
4644
|
enumerable: !0,
|
|
4476
4645
|
value: t
|
|
4477
4646
|
});
|
|
4478
|
-
let r = new
|
|
4647
|
+
let r = new an((t) => {
|
|
4479
4648
|
let n = e.onError?.(String(t));
|
|
4480
4649
|
n instanceof Promise && n.catch(() => {});
|
|
4481
4650
|
});
|
|
4482
4651
|
e.signal.addEventListener("abort", () => r.close(), { once: !0 }), e.signal.aborted && r.close();
|
|
4483
|
-
for (let t of
|
|
4652
|
+
for (let t of on) Object.defineProperty(n, t, {
|
|
4484
4653
|
enumerable: !0,
|
|
4485
4654
|
value: (...n) => {
|
|
4486
4655
|
try {
|
|
@@ -4564,19 +4733,19 @@ function Ut(e, t) {
|
|
|
4564
4733
|
}
|
|
4565
4734
|
}), Object.preventExtensions(n);
|
|
4566
4735
|
}
|
|
4567
|
-
function
|
|
4568
|
-
return
|
|
4736
|
+
function cn(e) {
|
|
4737
|
+
return bt(e);
|
|
4569
4738
|
}
|
|
4570
|
-
function
|
|
4739
|
+
function ln(e) {
|
|
4571
4740
|
if (typeof e != "string") throw TypeError("Stadium source must be a string");
|
|
4572
|
-
let t =
|
|
4741
|
+
let t = Ge(e);
|
|
4573
4742
|
return Object.freeze({
|
|
4574
4743
|
name: t.name,
|
|
4575
4744
|
canBeStored: t.canBeStored,
|
|
4576
4745
|
warnings: Object.freeze([...t.warnings])
|
|
4577
4746
|
});
|
|
4578
4747
|
}
|
|
4579
|
-
async function
|
|
4580
|
-
return
|
|
4748
|
+
async function un(e = {}, t = {}) {
|
|
4749
|
+
return sn(await nn.create(rn(e), void 0, t.signal));
|
|
4581
4750
|
}
|
|
4582
|
-
export {
|
|
4751
|
+
export { un as createRoom, cn as readReplay, ln as validateStadium };
|