quickvo-player 0.3.8 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +716 -432
- package/dist/index.umd.cjs +3 -5
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -43,8 +43,8 @@ function a(e, t) {
|
|
|
43
43
|
}
|
|
44
44
|
function o(e, t) {
|
|
45
45
|
if ({lo: e, hi: t} = s(e, t), t <= 2097151) return String(r * t + e);
|
|
46
|
-
let n = e & 16777215, i = (e >>> 24 | t << 8) & 16777215, a = t >> 16 & 65535, o = n + i * 6777216 + a * 6710656, c = i + a * 8147497, l = a * 2,
|
|
47
|
-
return o >=
|
|
46
|
+
let n = e & 16777215, i = (e >>> 24 | t << 8) & 16777215, a = t >> 16 & 65535, o = n + i * 6777216 + a * 6710656, c = i + a * 8147497, l = a * 2, d = 1e7;
|
|
47
|
+
return o >= d && (c += Math.floor(o / d), o %= d), c >= d && (l += Math.floor(c / d), c %= d), l.toString() + u(c) + u(o);
|
|
48
48
|
}
|
|
49
49
|
function s(e, t) {
|
|
50
50
|
return {
|
|
@@ -61,11 +61,11 @@ function c(e, t) {
|
|
|
61
61
|
function l(e, t) {
|
|
62
62
|
return t = ~t, e ? e = ~e + 1 : t += 1, c(e, t);
|
|
63
63
|
}
|
|
64
|
-
var
|
|
64
|
+
var u = (e) => {
|
|
65
65
|
let t = String(e);
|
|
66
66
|
return "0000000".slice(t.length) + t;
|
|
67
67
|
};
|
|
68
|
-
function
|
|
68
|
+
function d(e, t) {
|
|
69
69
|
if (e >= 0) {
|
|
70
70
|
for (; e > 127;) t.push(e & 127 | 128), e >>>= 7;
|
|
71
71
|
t.push(e);
|
|
@@ -74,7 +74,7 @@ function u(e, t) {
|
|
|
74
74
|
t.push(1);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ee() {
|
|
78
78
|
let e = this.buf[this.pos++], t = e & 127;
|
|
79
79
|
if (!(e & 128) || (e = this.buf[this.pos++], t |= (e & 127) << 7, !(e & 128)) || (e = this.buf[this.pos++], t |= (e & 127) << 14, !(e & 128)) || (e = this.buf[this.pos++], t |= (e & 127) << 21, !(e & 128))) return this.assertBounds(), t;
|
|
80
80
|
e = this.buf[this.pos++], t |= (e & 15) << 28;
|
|
@@ -84,8 +84,8 @@ function te() {
|
|
|
84
84
|
}
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js
|
|
87
|
-
var
|
|
88
|
-
function
|
|
87
|
+
var f = /*@__PURE__*/ te();
|
|
88
|
+
function te() {
|
|
89
89
|
let e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
90
90
|
if (typeof BigInt == "function" && typeof e.getBigInt64 == "function" && typeof e.getBigUint64 == "function" && typeof e.setBigInt64 == "function" && typeof e.setBigUint64 == "function" && (globalThis.Deno || typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1")) {
|
|
91
91
|
let t = BigInt("-9223372036854775808"), n = BigInt("9223372036854775807"), r = BigInt("0"), i = BigInt("18446744073709551615");
|
|
@@ -126,16 +126,16 @@ function ne() {
|
|
|
126
126
|
zero: "0",
|
|
127
127
|
supported: !1,
|
|
128
128
|
parse(e) {
|
|
129
|
-
return typeof e != "string" && (e = e.toString()),
|
|
129
|
+
return typeof e != "string" && (e = e.toString()), ne(e), e;
|
|
130
130
|
},
|
|
131
131
|
uParse(e) {
|
|
132
|
-
return typeof e != "string" && (e = e.toString()),
|
|
132
|
+
return typeof e != "string" && (e = e.toString()), re(e), e;
|
|
133
133
|
},
|
|
134
134
|
enc(e) {
|
|
135
|
-
return typeof e != "string" && (e = e.toString()),
|
|
135
|
+
return typeof e != "string" && (e = e.toString()), ne(e), i(e);
|
|
136
136
|
},
|
|
137
137
|
uEnc(e) {
|
|
138
|
-
return typeof e != "string" && (e = e.toString()),
|
|
138
|
+
return typeof e != "string" && (e = e.toString()), re(e), i(e);
|
|
139
139
|
},
|
|
140
140
|
dec(e, t) {
|
|
141
141
|
return a(e, t);
|
|
@@ -145,15 +145,15 @@ function ne() {
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function ne(e) {
|
|
149
149
|
if (!/^-?[0-9]+$/.test(e)) throw Error("invalid int64: " + e);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function re(e) {
|
|
152
152
|
if (!/^[0-9]+$/.test(e)) throw Error("invalid uint64: " + e);
|
|
153
153
|
}
|
|
154
154
|
//#endregion
|
|
155
155
|
//#region node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js
|
|
156
|
-
function
|
|
156
|
+
function p(e, n) {
|
|
157
157
|
switch (e) {
|
|
158
158
|
case t.STRING: return "";
|
|
159
159
|
case t.BOOL: return !1;
|
|
@@ -163,12 +163,12 @@ function f(e, n) {
|
|
|
163
163
|
case t.UINT64:
|
|
164
164
|
case t.SFIXED64:
|
|
165
165
|
case t.FIXED64:
|
|
166
|
-
case t.SINT64: return n ? "0" :
|
|
167
|
-
case t.BYTES: return new Uint8Array();
|
|
166
|
+
case t.SINT64: return n ? "0" : f.zero;
|
|
167
|
+
case t.BYTES: return /* @__PURE__ */ new Uint8Array();
|
|
168
168
|
default: return 0;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function m(e, n) {
|
|
172
172
|
switch (e) {
|
|
173
173
|
case t.BOOL: return n === !1;
|
|
174
174
|
case t.STRING: return n === "";
|
|
@@ -178,45 +178,45 @@ function ae(e, n) {
|
|
|
178
178
|
}
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js
|
|
181
|
-
var
|
|
182
|
-
function
|
|
181
|
+
var h = 2, g = Symbol.for("reflect unsafe local");
|
|
182
|
+
function ie(e, t) {
|
|
183
183
|
let n = e[t.localName].case;
|
|
184
184
|
return n === void 0 ? n : t.fields.find((e) => e.localName === n);
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function ae(e, t) {
|
|
187
187
|
let n = t.localName;
|
|
188
188
|
if (t.oneof) return e[t.oneof.localName].case === n;
|
|
189
|
-
if (t.presence !=
|
|
189
|
+
if (t.presence != h) return e[n] !== void 0 && Object.prototype.hasOwnProperty.call(e, n);
|
|
190
190
|
switch (t.fieldKind) {
|
|
191
191
|
case "list": return e[n].length > 0;
|
|
192
192
|
case "map": return Object.keys(e[n]).length > 0;
|
|
193
|
-
case "scalar": return !
|
|
193
|
+
case "scalar": return !m(t.scalar, e[n]);
|
|
194
194
|
case "enum": return e[n] !== t.enum.values[0].number;
|
|
195
195
|
}
|
|
196
196
|
throw Error("message field with implicit presence");
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function _(e, t) {
|
|
199
199
|
return Object.prototype.hasOwnProperty.call(e, t) && e[t] !== void 0;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function oe(e, t) {
|
|
202
202
|
if (t.oneof) {
|
|
203
203
|
let n = e[t.oneof.localName];
|
|
204
204
|
return n.case === t.localName ? n.value : void 0;
|
|
205
205
|
}
|
|
206
206
|
return e[t.localName];
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function se(e, t, n) {
|
|
209
209
|
t.oneof ? e[t.oneof.localName] = {
|
|
210
210
|
case: t.localName,
|
|
211
211
|
value: n
|
|
212
212
|
} : e[t.localName] = n;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function ce(e, t) {
|
|
215
215
|
let n = t.localName;
|
|
216
216
|
if (t.oneof) {
|
|
217
217
|
let r = t.oneof.localName;
|
|
218
218
|
e[r].case === n && (e[r] = { case: void 0 });
|
|
219
|
-
} else if (t.presence !=
|
|
219
|
+
} else if (t.presence != h) delete e[n];
|
|
220
220
|
else switch (t.fieldKind) {
|
|
221
221
|
case "map":
|
|
222
222
|
e[n] = {};
|
|
@@ -228,17 +228,17 @@ function de(e, t) {
|
|
|
228
228
|
e[n] = t.enum.values[0].number;
|
|
229
229
|
break;
|
|
230
230
|
case "scalar":
|
|
231
|
-
e[n] =
|
|
231
|
+
e[n] = p(t.scalar, t.longAsString);
|
|
232
232
|
break;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
236
|
//#region node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js
|
|
237
|
-
function
|
|
237
|
+
function v(e) {
|
|
238
238
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
if (
|
|
240
|
+
function y(e, t) {
|
|
241
|
+
if (v(e) && g in e && "add" in e && "field" in e && typeof e.field == "function") {
|
|
242
242
|
if (t !== void 0) {
|
|
243
243
|
let n = t, r = e.field();
|
|
244
244
|
return n.listKind == r.listKind && n.scalar === r.scalar && n.message?.typeName === r.message?.typeName && n.enum?.typeName === r.enum?.typeName;
|
|
@@ -247,8 +247,8 @@ function fe(e, t) {
|
|
|
247
247
|
}
|
|
248
248
|
return !1;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
if (
|
|
250
|
+
function le(e, t) {
|
|
251
|
+
if (v(e) && g in e && "has" in e && "field" in e && typeof e.field == "function") {
|
|
252
252
|
if (t !== void 0) {
|
|
253
253
|
let n = t, r = e.field();
|
|
254
254
|
return n.mapKey === r.mapKey && n.mapKind == r.mapKind && n.scalar === r.scalar && n.message?.typeName === r.message?.typeName && n.enum?.typeName === r.enum?.typeName;
|
|
@@ -257,19 +257,19 @@ function pe(e, t) {
|
|
|
257
257
|
}
|
|
258
258
|
return !1;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
return
|
|
260
|
+
function b(e, t) {
|
|
261
|
+
return v(e) && g in e && "desc" in e && v(e.desc) && e.desc.kind === "message" && (t === void 0 || e.desc.typeName == t.typeName);
|
|
262
262
|
}
|
|
263
263
|
//#endregion
|
|
264
264
|
//#region node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js
|
|
265
|
-
function
|
|
266
|
-
return
|
|
265
|
+
function ue(e) {
|
|
266
|
+
return fe(e.$typeName);
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function de(e) {
|
|
269
269
|
let t = e.fields[0];
|
|
270
|
-
return
|
|
270
|
+
return fe(e.typeName) && t !== void 0 && t.fieldKind == "scalar" && t.name == "value" && t.number == 1;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function fe(e) {
|
|
273
273
|
return e.startsWith("google.protobuf.") && [
|
|
274
274
|
"DoubleValue",
|
|
275
275
|
"FloatValue",
|
|
@@ -284,121 +284,121 @@ function _e(e) {
|
|
|
284
284
|
}
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region node_modules/@bufbuild/protobuf/dist/esm/create.js
|
|
287
|
-
var
|
|
288
|
-
function
|
|
287
|
+
var pe = 999, me = 998, x = 2;
|
|
288
|
+
function he(t, n) {
|
|
289
289
|
if (e(n, t)) return n;
|
|
290
|
-
let r =
|
|
291
|
-
return n !== void 0 &&
|
|
290
|
+
let r = Ce(t);
|
|
291
|
+
return n !== void 0 && ge(t, r, n), r;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function ge(e, t, n) {
|
|
294
294
|
for (let r of e.members) {
|
|
295
295
|
let e = n[r.localName];
|
|
296
296
|
if (e == null) continue;
|
|
297
297
|
let i;
|
|
298
298
|
if (r.kind == "oneof") {
|
|
299
|
-
let t =
|
|
299
|
+
let t = ie(n, r);
|
|
300
300
|
if (!t) continue;
|
|
301
|
-
i = t, e =
|
|
301
|
+
i = t, e = oe(n, t);
|
|
302
302
|
} else i = r;
|
|
303
303
|
switch (i.fieldKind) {
|
|
304
304
|
case "message":
|
|
305
|
-
e =
|
|
305
|
+
e = S(i, e);
|
|
306
306
|
break;
|
|
307
307
|
case "scalar":
|
|
308
|
-
e =
|
|
308
|
+
e = _e(i, e);
|
|
309
309
|
break;
|
|
310
310
|
case "list":
|
|
311
|
-
e =
|
|
311
|
+
e = ye(i, e);
|
|
312
312
|
break;
|
|
313
313
|
case "map":
|
|
314
|
-
e =
|
|
314
|
+
e = ve(i, e);
|
|
315
315
|
break;
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
se(t, i, e);
|
|
318
318
|
}
|
|
319
319
|
return t;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
return e.scalar == t.BYTES ?
|
|
321
|
+
function _e(e, n) {
|
|
322
|
+
return e.scalar == t.BYTES ? C(n) : n;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
325
|
-
if (
|
|
326
|
-
if (e.scalar == t.BYTES) return
|
|
327
|
-
if (e.mapKind == "message") return
|
|
324
|
+
function ve(e, n) {
|
|
325
|
+
if (v(n)) {
|
|
326
|
+
if (e.scalar == t.BYTES) return be(n, C);
|
|
327
|
+
if (e.mapKind == "message") return be(n, (t) => S(e, t));
|
|
328
328
|
}
|
|
329
329
|
return n;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function ye(e, n) {
|
|
332
332
|
if (Array.isArray(n)) {
|
|
333
|
-
if (e.scalar == t.BYTES) return n.map(
|
|
334
|
-
if (e.listKind == "message") return n.map((t) =>
|
|
333
|
+
if (e.scalar == t.BYTES) return n.map(C);
|
|
334
|
+
if (e.listKind == "message") return n.map((t) => S(e, t));
|
|
335
335
|
}
|
|
336
336
|
return n;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
if (t.fieldKind == "message" && !t.oneof &&
|
|
340
|
-
if (
|
|
338
|
+
function S(t, n) {
|
|
339
|
+
if (t.fieldKind == "message" && !t.oneof && de(t.message)) return _e(t.message.fields[0], n);
|
|
340
|
+
if (v(n)) {
|
|
341
341
|
if (t.message.typeName == "google.protobuf.Struct" && t.parent.typeName !== "google.protobuf.Value") return n;
|
|
342
|
-
if (!e(n, t.message)) return
|
|
342
|
+
if (!e(n, t.message)) return he(t.message, n);
|
|
343
343
|
}
|
|
344
344
|
return n;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function C(e) {
|
|
347
347
|
return Array.isArray(e) ? new Uint8Array(e) : e;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function be(e, t) {
|
|
350
350
|
let n = {};
|
|
351
351
|
for (let r of Object.entries(e)) n[r[0]] = t(r[1]);
|
|
352
352
|
return n;
|
|
353
353
|
}
|
|
354
|
-
var
|
|
355
|
-
function
|
|
354
|
+
var xe = Symbol(), Se = /* @__PURE__ */ new WeakMap();
|
|
355
|
+
function Ce(e) {
|
|
356
356
|
let t;
|
|
357
|
-
if (
|
|
358
|
-
let n =
|
|
357
|
+
if (we(e)) {
|
|
358
|
+
let n = Se.get(e), r, i;
|
|
359
359
|
if (n) ({prototype: r, members: i} = n);
|
|
360
360
|
else {
|
|
361
361
|
r = {}, i = /* @__PURE__ */ new Set();
|
|
362
|
-
for (let t of e.members) t.kind != "oneof" && (t.fieldKind != "scalar" && t.fieldKind != "enum" || t.presence !=
|
|
363
|
-
|
|
362
|
+
for (let t of e.members) t.kind != "oneof" && (t.fieldKind != "scalar" && t.fieldKind != "enum" || t.presence != x && (i.add(t), r[t.localName] = w(t)));
|
|
363
|
+
Se.set(e, {
|
|
364
364
|
prototype: r,
|
|
365
365
|
members: i
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
t = Object.create(r), t.$typeName = e.typeName;
|
|
369
|
-
for (let n of e.members) i.has(n) || n.kind == "field" && (n.fieldKind == "message" || (n.fieldKind == "scalar" || n.fieldKind == "enum") && n.presence !=
|
|
369
|
+
for (let n of e.members) i.has(n) || n.kind == "field" && (n.fieldKind == "message" || (n.fieldKind == "scalar" || n.fieldKind == "enum") && n.presence != x) || (t[n.localName] = w(n));
|
|
370
370
|
} else {
|
|
371
371
|
t = { $typeName: e.typeName };
|
|
372
|
-
for (let n of e.members) (n.kind == "oneof" || n.presence ==
|
|
372
|
+
for (let n of e.members) (n.kind == "oneof" || n.presence == x) && (t[n.localName] = w(n));
|
|
373
373
|
}
|
|
374
374
|
return t;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function we(e) {
|
|
377
377
|
switch (e.file.edition) {
|
|
378
|
-
case
|
|
379
|
-
case
|
|
380
|
-
default: return e.fields.some((e) => e.presence !=
|
|
378
|
+
case pe: return !1;
|
|
379
|
+
case me: return !0;
|
|
380
|
+
default: return e.fields.some((e) => e.presence != x && e.fieldKind != "message" && !e.oneof);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function w(e) {
|
|
384
384
|
if (e.kind == "oneof") return { case: void 0 };
|
|
385
385
|
if (e.fieldKind == "list") return [];
|
|
386
386
|
if (e.fieldKind == "map") return {};
|
|
387
|
-
if (e.fieldKind == "message") return
|
|
387
|
+
if (e.fieldKind == "message") return xe;
|
|
388
388
|
let t = e.getDefaultValue();
|
|
389
|
-
return t === void 0 ? e.fieldKind == "scalar" ?
|
|
389
|
+
return t === void 0 ? e.fieldKind == "scalar" ? p(e.scalar, e.longAsString) : e.enum.values[0].number : e.fieldKind == "scalar" && e.longAsString ? t.toString() : t;
|
|
390
390
|
}
|
|
391
391
|
//#endregion
|
|
392
392
|
//#region node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js
|
|
393
|
-
var
|
|
393
|
+
var T = class extends Error {
|
|
394
394
|
constructor(e, t, n = "FieldValueInvalidError") {
|
|
395
395
|
super(t), this.name = n, this.field = () => e;
|
|
396
396
|
}
|
|
397
|
-
},
|
|
398
|
-
function
|
|
399
|
-
if (globalThis[
|
|
397
|
+
}, Te = Symbol.for("@bufbuild/protobuf/text-encoding");
|
|
398
|
+
function Ee() {
|
|
399
|
+
if (globalThis[Te] == null) {
|
|
400
400
|
let e = new globalThis.TextEncoder(), t = new globalThis.TextDecoder();
|
|
401
|
-
globalThis[
|
|
401
|
+
globalThis[Te] = {
|
|
402
402
|
encodeUtf8(t) {
|
|
403
403
|
return e.encode(t);
|
|
404
404
|
},
|
|
@@ -414,17 +414,17 @@ function Ae() {
|
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
|
-
return globalThis[
|
|
417
|
+
return globalThis[Te];
|
|
418
418
|
}
|
|
419
419
|
//#endregion
|
|
420
420
|
//#region node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js
|
|
421
|
-
var
|
|
421
|
+
var E;
|
|
422
422
|
(function(e) {
|
|
423
423
|
e[e.Varint = 0] = "Varint", e[e.Bit64 = 1] = "Bit64", e[e.LengthDelimited = 2] = "LengthDelimited", e[e.StartGroup = 3] = "StartGroup", e[e.EndGroup = 4] = "EndGroup", e[e.Bit32 = 5] = "Bit32";
|
|
424
|
-
})(
|
|
425
|
-
var
|
|
426
|
-
constructor(e, t =
|
|
427
|
-
this.decodeUtf8 = t, this.varint64 = n, this.uint32 =
|
|
424
|
+
})(E ||= {});
|
|
425
|
+
var De = class {
|
|
426
|
+
constructor(e, t = Ee().decodeUtf8) {
|
|
427
|
+
this.decodeUtf8 = t, this.varint64 = n, this.uint32 = ee, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
428
428
|
}
|
|
429
429
|
tag() {
|
|
430
430
|
let e = this.uint32(), t = e >>> 3, n = e & 7;
|
|
@@ -434,21 +434,21 @@ var je = class {
|
|
|
434
434
|
skip(e, t) {
|
|
435
435
|
let n = this.pos;
|
|
436
436
|
switch (e) {
|
|
437
|
-
case
|
|
437
|
+
case E.Varint:
|
|
438
438
|
for (; this.buf[this.pos++] & 128;);
|
|
439
439
|
break;
|
|
440
|
-
case
|
|
441
|
-
case
|
|
440
|
+
case E.Bit64: this.pos += 4;
|
|
441
|
+
case E.Bit32:
|
|
442
442
|
this.pos += 4;
|
|
443
443
|
break;
|
|
444
|
-
case
|
|
444
|
+
case E.LengthDelimited:
|
|
445
445
|
let n = this.uint32();
|
|
446
446
|
this.pos += n;
|
|
447
447
|
break;
|
|
448
|
-
case
|
|
448
|
+
case E.StartGroup:
|
|
449
449
|
for (;;) {
|
|
450
450
|
let [e, n] = this.tag();
|
|
451
|
-
if (n ===
|
|
451
|
+
if (n === E.EndGroup) {
|
|
452
452
|
if (t !== void 0 && e !== t) throw Error("invalid end group tag");
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
@@ -470,14 +470,14 @@ var je = class {
|
|
|
470
470
|
return e >>> 1 ^ -(e & 1);
|
|
471
471
|
}
|
|
472
472
|
int64() {
|
|
473
|
-
return
|
|
473
|
+
return f.dec(...this.varint64());
|
|
474
474
|
}
|
|
475
475
|
uint64() {
|
|
476
|
-
return
|
|
476
|
+
return f.uDec(...this.varint64());
|
|
477
477
|
}
|
|
478
478
|
sint64() {
|
|
479
479
|
let [e, t] = this.varint64(), n = -(e & 1);
|
|
480
|
-
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n,
|
|
480
|
+
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, f.dec(e, t);
|
|
481
481
|
}
|
|
482
482
|
bool() {
|
|
483
483
|
let [e, t] = this.varint64();
|
|
@@ -490,10 +490,10 @@ var je = class {
|
|
|
490
490
|
return this.view.getInt32((this.pos += 4) - 4, !0);
|
|
491
491
|
}
|
|
492
492
|
fixed64() {
|
|
493
|
-
return
|
|
493
|
+
return f.uDec(this.sfixed32(), this.sfixed32());
|
|
494
494
|
}
|
|
495
495
|
sfixed64() {
|
|
496
|
-
return
|
|
496
|
+
return f.dec(this.sfixed32(), this.sfixed32());
|
|
497
497
|
}
|
|
498
498
|
float() {
|
|
499
499
|
return this.view.getFloat32((this.pos += 4) - 4, !0);
|
|
@@ -511,35 +511,35 @@ var je = class {
|
|
|
511
511
|
};
|
|
512
512
|
//#endregion
|
|
513
513
|
//#region node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js
|
|
514
|
-
function
|
|
515
|
-
let n = e.fieldKind == "list" ?
|
|
514
|
+
function Oe(e, t) {
|
|
515
|
+
let n = e.fieldKind == "list" ? y(t, e) : e.fieldKind == "map" ? le(t, e) : je(e, t);
|
|
516
516
|
if (n === !0) return;
|
|
517
517
|
let r;
|
|
518
518
|
switch (e.fieldKind) {
|
|
519
519
|
case "list":
|
|
520
|
-
r = `expected ${
|
|
520
|
+
r = `expected ${Pe(e)}, got ${O(t)}`;
|
|
521
521
|
break;
|
|
522
522
|
case "map":
|
|
523
|
-
r = `expected ${
|
|
523
|
+
r = `expected ${Fe(e)}, got ${O(t)}`;
|
|
524
524
|
break;
|
|
525
|
-
default: r =
|
|
525
|
+
default: r = D(e, t, n);
|
|
526
526
|
}
|
|
527
|
-
return new
|
|
527
|
+
return new T(e, r);
|
|
528
528
|
}
|
|
529
|
-
function
|
|
530
|
-
let r =
|
|
531
|
-
if (r !== !0) return new
|
|
529
|
+
function ke(e, t, n) {
|
|
530
|
+
let r = je(e, n);
|
|
531
|
+
if (r !== !0) return new T(e, `list item #${t + 1}: ${D(e, n, r)}`);
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
let r =
|
|
535
|
-
if (r !== !0) return new
|
|
536
|
-
let i =
|
|
537
|
-
if (i !== !0) return new
|
|
533
|
+
function Ae(e, t, n) {
|
|
534
|
+
let r = Me(t, e.mapKey);
|
|
535
|
+
if (r !== !0) return new T(e, `invalid map key: ${D({ scalar: e.mapKey }, t, r)}`);
|
|
536
|
+
let i = je(e, n);
|
|
537
|
+
if (i !== !0) return new T(e, `map entry ${O(t)}: ${D(e, n, i)}`);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
return e.scalar === void 0 ? e.enum === void 0 ?
|
|
539
|
+
function je(e, t) {
|
|
540
|
+
return e.scalar === void 0 ? e.enum === void 0 ? b(t, e.message) : e.enum.open ? Number.isInteger(t) : e.enum.values.some((e) => e.number === t) : Me(t, e.scalar);
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function Me(e, n) {
|
|
543
543
|
switch (n) {
|
|
544
544
|
case t.DOUBLE: return typeof e == "number";
|
|
545
545
|
case t.FLOAT: return typeof e == "number" ? Number.isNaN(e) || !Number.isFinite(e) ? !0 : e > 34028234663852886e22 || e < -34028234663852886e22 ? `${e.toFixed()} out of range` : !0 : !1;
|
|
@@ -549,13 +549,13 @@ function Fe(e, n) {
|
|
|
549
549
|
case t.FIXED32:
|
|
550
550
|
case t.UINT32: return typeof e != "number" || !Number.isInteger(e) ? !1 : e > 4294967295 || e < 0 ? `${e.toFixed()} out of range` : !0;
|
|
551
551
|
case t.BOOL: return typeof e == "boolean";
|
|
552
|
-
case t.STRING: return typeof e == "string" ?
|
|
552
|
+
case t.STRING: return typeof e == "string" ? Ee().checkUtf8(e) || "invalid UTF8" : !1;
|
|
553
553
|
case t.BYTES: return e instanceof Uint8Array;
|
|
554
554
|
case t.INT64:
|
|
555
555
|
case t.SFIXED64:
|
|
556
556
|
case t.SINT64:
|
|
557
557
|
if (typeof e == "bigint" || typeof e == "number" || typeof e == "string" && e.length > 0) try {
|
|
558
|
-
return
|
|
558
|
+
return f.parse(e), !0;
|
|
559
559
|
} catch {
|
|
560
560
|
return `${e} out of range`;
|
|
561
561
|
}
|
|
@@ -563,19 +563,19 @@ function Fe(e, n) {
|
|
|
563
563
|
case t.FIXED64:
|
|
564
564
|
case t.UINT64:
|
|
565
565
|
if (typeof e == "bigint" || typeof e == "number" || typeof e == "string" && e.length > 0) try {
|
|
566
|
-
return
|
|
566
|
+
return f.uParse(e), !0;
|
|
567
567
|
} catch {
|
|
568
568
|
return `${e} out of range`;
|
|
569
569
|
}
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
return n = typeof n == "string" ? `: ${n}` : `, got ${
|
|
573
|
+
function D(e, t, n) {
|
|
574
|
+
return n = typeof n == "string" ? `: ${n}` : `, got ${O(t)}`, e.scalar === void 0 ? e.enum === void 0 ? `expected ${Ne(e.message)}` + n : `expected ${e.enum.toString()}` + n : `expected ${Ie(e.scalar)}` + n;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function O(t) {
|
|
577
577
|
switch (typeof t) {
|
|
578
|
-
case "object": return t === null ? "null" : t instanceof Uint8Array ? `Uint8Array(${t.length})` : Array.isArray(t) ? `Array(${t.length})` :
|
|
578
|
+
case "object": return t === null ? "null" : t instanceof Uint8Array ? `Uint8Array(${t.length})` : Array.isArray(t) ? `Array(${t.length})` : y(t) ? Pe(t.field()) : le(t) ? Fe(t.field()) : b(t) ? Ne(t.desc) : e(t) ? `message ${t.$typeName}` : "object";
|
|
579
579
|
case "string": return t.length > 30 ? "string" : `"${t.split("\"").join("\\\"")}"`;
|
|
580
580
|
case "boolean": return String(t);
|
|
581
581
|
case "number": return String(t);
|
|
@@ -583,24 +583,24 @@ function T(t) {
|
|
|
583
583
|
default: return typeof t;
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function Ne(e) {
|
|
587
587
|
return `ReflectMessage (${e.typeName})`;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function Pe(e) {
|
|
590
590
|
switch (e.listKind) {
|
|
591
591
|
case "message": return `ReflectList (${e.message.toString()})`;
|
|
592
592
|
case "enum": return `ReflectList (${e.enum.toString()})`;
|
|
593
593
|
case "scalar": return `ReflectList (${t[e.scalar]})`;
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Fe(e) {
|
|
597
597
|
switch (e.mapKind) {
|
|
598
598
|
case "message": return `ReflectMap (${t[e.mapKey]}, ${e.message.toString()})`;
|
|
599
599
|
case "enum": return `ReflectMap (${t[e.mapKey]}, ${e.enum.toString()})`;
|
|
600
600
|
case "scalar": return `ReflectMap (${t[e.mapKey]}, ${t[e.scalar]})`;
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function Ie(e) {
|
|
604
604
|
switch (e) {
|
|
605
605
|
case t.STRING: return "string";
|
|
606
606
|
case t.BOOL: return "boolean";
|
|
@@ -621,53 +621,53 @@ function ze(e) {
|
|
|
621
621
|
}
|
|
622
622
|
//#endregion
|
|
623
623
|
//#region node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js
|
|
624
|
-
function
|
|
625
|
-
return new
|
|
624
|
+
function Le(e, t, n = !0) {
|
|
625
|
+
return new ze(e, t, n);
|
|
626
626
|
}
|
|
627
|
-
var
|
|
627
|
+
var Re = /* @__PURE__ */ new WeakMap(), ze = class {
|
|
628
628
|
get sortedFields() {
|
|
629
|
-
let e =
|
|
629
|
+
let e = Re.get(this.desc);
|
|
630
630
|
if (e) return e;
|
|
631
631
|
let t = this.desc.fields.concat().sort((e, t) => e.number - t.number);
|
|
632
|
-
return
|
|
632
|
+
return Re.set(this.desc, t), t;
|
|
633
633
|
}
|
|
634
634
|
constructor(e, t, n = !0) {
|
|
635
|
-
this.lists = /* @__PURE__ */ new Map(), this.maps = /* @__PURE__ */ new Map(), this.check = n, this.desc = e, this.message = this[
|
|
635
|
+
this.lists = /* @__PURE__ */ new Map(), this.maps = /* @__PURE__ */ new Map(), this.check = n, this.desc = e, this.message = this[g] = t ?? he(e), this.fields = e.fields, this.oneofs = e.oneofs, this.members = e.members;
|
|
636
636
|
}
|
|
637
637
|
findNumber(e) {
|
|
638
638
|
return this._fieldsByNumber ||= new Map(this.desc.fields.map((e) => [e.number, e])), this._fieldsByNumber.get(e);
|
|
639
639
|
}
|
|
640
640
|
oneofCase(e) {
|
|
641
|
-
return
|
|
641
|
+
return k(this.message, e), ie(this.message, e);
|
|
642
642
|
}
|
|
643
643
|
isSet(e) {
|
|
644
|
-
return
|
|
644
|
+
return k(this.message, e), ae(this.message, e);
|
|
645
645
|
}
|
|
646
646
|
clear(e) {
|
|
647
|
-
|
|
647
|
+
k(this.message, e), ce(this.message, e);
|
|
648
648
|
}
|
|
649
649
|
get(e) {
|
|
650
|
-
|
|
651
|
-
let t =
|
|
650
|
+
k(this.message, e);
|
|
651
|
+
let t = oe(this.message, e);
|
|
652
652
|
switch (e.fieldKind) {
|
|
653
653
|
case "list":
|
|
654
654
|
let n = this.lists.get(e);
|
|
655
|
-
return (!n || n[
|
|
655
|
+
return (!n || n[g] !== t) && this.lists.set(e, n = new Be(e, t, this.check)), n;
|
|
656
656
|
case "map":
|
|
657
657
|
let r = this.maps.get(e);
|
|
658
|
-
return (!r || r[
|
|
659
|
-
case "message": return
|
|
660
|
-
case "scalar": return t === void 0 ?
|
|
658
|
+
return (!r || r[g] !== t) && this.maps.set(e, r = new Ve(e, t, this.check)), r;
|
|
659
|
+
case "message": return j(e, t, this.check);
|
|
660
|
+
case "scalar": return t === void 0 ? p(e.scalar, !1) : N(e, t);
|
|
661
661
|
case "enum": return t ?? e.enum.values[0].number;
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
664
|
set(e, t) {
|
|
665
|
-
if (
|
|
666
|
-
let n =
|
|
665
|
+
if (k(this.message, e), this.check) {
|
|
666
|
+
let n = Oe(e, t);
|
|
667
667
|
if (n) throw n;
|
|
668
668
|
}
|
|
669
669
|
let n;
|
|
670
|
-
n = e.fieldKind == "message" ?
|
|
670
|
+
n = e.fieldKind == "message" ? A(e, t) : le(t) || y(t) ? t[g] : P(e, t), se(this.message, e, n);
|
|
671
671
|
}
|
|
672
672
|
getUnknown() {
|
|
673
673
|
return this.message.$unknown;
|
|
@@ -676,10 +676,10 @@ var Be = /* @__PURE__ */ new WeakMap(), Ve = class {
|
|
|
676
676
|
this.message.$unknown = e;
|
|
677
677
|
}
|
|
678
678
|
};
|
|
679
|
-
function
|
|
680
|
-
if (t.parent.typeName !== e.$typeName) throw new
|
|
679
|
+
function k(e, t) {
|
|
680
|
+
if (t.parent.typeName !== e.$typeName) throw new T(t, `cannot use ${t.toString()} with message ${e.$typeName}`, "ForeignFieldError");
|
|
681
681
|
}
|
|
682
|
-
var
|
|
682
|
+
var Be = class {
|
|
683
683
|
field() {
|
|
684
684
|
return this._field;
|
|
685
685
|
}
|
|
@@ -687,26 +687,26 @@ var He = class {
|
|
|
687
687
|
return this._arr.length;
|
|
688
688
|
}
|
|
689
689
|
constructor(e, t, n) {
|
|
690
|
-
this._field = e, this._arr = this[
|
|
690
|
+
this._field = e, this._arr = this[g] = t, this.check = n;
|
|
691
691
|
}
|
|
692
692
|
get(e) {
|
|
693
693
|
let t = this._arr[e];
|
|
694
|
-
return t === void 0 ? void 0 :
|
|
694
|
+
return t === void 0 ? void 0 : Ue(this._field, t, this.check);
|
|
695
695
|
}
|
|
696
696
|
set(e, t) {
|
|
697
|
-
if (e < 0 || e >= this._arr.length) throw new
|
|
697
|
+
if (e < 0 || e >= this._arr.length) throw new T(this._field, `list item #${e + 1}: out of range`);
|
|
698
698
|
if (this.check) {
|
|
699
|
-
let n =
|
|
699
|
+
let n = ke(this._field, e, t);
|
|
700
700
|
if (n) throw n;
|
|
701
701
|
}
|
|
702
|
-
this._arr[e] =
|
|
702
|
+
this._arr[e] = He(this._field, t);
|
|
703
703
|
}
|
|
704
704
|
add(e) {
|
|
705
705
|
if (this.check) {
|
|
706
|
-
let t =
|
|
706
|
+
let t = ke(this._field, this._arr.length, e);
|
|
707
707
|
if (t) throw t;
|
|
708
708
|
}
|
|
709
|
-
this._arr.push(
|
|
709
|
+
this._arr.push(He(this._field, e));
|
|
710
710
|
}
|
|
711
711
|
clear() {
|
|
712
712
|
this._arr.splice(0, this._arr.length);
|
|
@@ -718,24 +718,24 @@ var He = class {
|
|
|
718
718
|
return this._arr.keys();
|
|
719
719
|
}
|
|
720
720
|
*values() {
|
|
721
|
-
for (let e of this._arr) yield
|
|
721
|
+
for (let e of this._arr) yield Ue(this._field, e, this.check);
|
|
722
722
|
}
|
|
723
723
|
*entries() {
|
|
724
|
-
for (let e = 0; e < this._arr.length; e++) yield [e,
|
|
724
|
+
for (let e = 0; e < this._arr.length; e++) yield [e, Ue(this._field, this._arr[e], this.check)];
|
|
725
725
|
}
|
|
726
|
-
},
|
|
726
|
+
}, Ve = class {
|
|
727
727
|
constructor(e, t, n = !0) {
|
|
728
|
-
this.obj = this[
|
|
728
|
+
this.obj = this[g] = t ?? {}, this.check = n, this._field = e;
|
|
729
729
|
}
|
|
730
730
|
field() {
|
|
731
731
|
return this._field;
|
|
732
732
|
}
|
|
733
733
|
set(e, t) {
|
|
734
734
|
if (this.check) {
|
|
735
|
-
let n =
|
|
735
|
+
let n = Ae(this._field, e, t);
|
|
736
736
|
if (n) throw n;
|
|
737
737
|
}
|
|
738
|
-
return this.obj[M(e)] =
|
|
738
|
+
return this.obj[M(e)] = We(this._field, t), this;
|
|
739
739
|
}
|
|
740
740
|
delete(e) {
|
|
741
741
|
let t = M(e), n = Object.prototype.hasOwnProperty.call(this.obj, t);
|
|
@@ -746,7 +746,7 @@ var He = class {
|
|
|
746
746
|
}
|
|
747
747
|
get(e) {
|
|
748
748
|
let t = this.obj[M(e)];
|
|
749
|
-
return t !== void 0 && (t =
|
|
749
|
+
return t !== void 0 && (t = Ge(this._field, t, this.check)), t;
|
|
750
750
|
}
|
|
751
751
|
has(e) {
|
|
752
752
|
return Object.prototype.hasOwnProperty.call(this.obj, M(e));
|
|
@@ -755,7 +755,7 @@ var He = class {
|
|
|
755
755
|
for (let e of Object.keys(this.obj)) yield Ke(e, this._field.mapKey);
|
|
756
756
|
}
|
|
757
757
|
*entries() {
|
|
758
|
-
for (let e of Object.entries(this.obj)) yield [Ke(e[0], this._field.mapKey),
|
|
758
|
+
for (let e of Object.entries(this.obj)) yield [Ke(e[0], this._field.mapKey), Ge(this._field, e[1], this.check)];
|
|
759
759
|
}
|
|
760
760
|
[Symbol.iterator]() {
|
|
761
761
|
return this.entries();
|
|
@@ -764,32 +764,32 @@ var He = class {
|
|
|
764
764
|
return Object.keys(this.obj).length;
|
|
765
765
|
}
|
|
766
766
|
*values() {
|
|
767
|
-
for (let e of Object.values(this.obj)) yield
|
|
767
|
+
for (let e of Object.values(this.obj)) yield Ge(this._field, e, this.check);
|
|
768
768
|
}
|
|
769
769
|
forEach(e, t) {
|
|
770
770
|
for (let n of this.entries()) e.call(t, n[1], n[0], this);
|
|
771
771
|
}
|
|
772
772
|
};
|
|
773
|
-
function
|
|
774
|
-
return
|
|
773
|
+
function A(e, t) {
|
|
774
|
+
return b(t) ? ue(t.message) && !e.oneof && e.fieldKind == "message" ? t.message.value : t.desc.typeName == "google.protobuf.Struct" && e.parent.typeName != "google.protobuf.Value" ? Je(t.message) : t.message : t;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
777
|
-
return t !== void 0 && (
|
|
776
|
+
function j(e, t, n) {
|
|
777
|
+
return t !== void 0 && (de(e.message) && !e.oneof && e.fieldKind == "message" ? t = {
|
|
778
778
|
$typeName: e.message.typeName,
|
|
779
779
|
value: N(e.message.fields[0], t)
|
|
780
|
-
} : e.message.typeName == "google.protobuf.Struct" && e.parent.typeName != "google.protobuf.Value" &&
|
|
780
|
+
} : e.message.typeName == "google.protobuf.Struct" && e.parent.typeName != "google.protobuf.Value" && v(t) && (t = qe(t))), new ze(e.message, t, n);
|
|
781
781
|
}
|
|
782
|
-
function
|
|
783
|
-
return e.listKind == "message" ?
|
|
782
|
+
function He(e, t) {
|
|
783
|
+
return e.listKind == "message" ? A(e, t) : P(e, t);
|
|
784
784
|
}
|
|
785
|
-
function
|
|
786
|
-
return e.listKind == "message" ?
|
|
785
|
+
function Ue(e, t, n) {
|
|
786
|
+
return e.listKind == "message" ? j(e, t, n) : N(e, t);
|
|
787
787
|
}
|
|
788
|
-
function
|
|
789
|
-
return e.mapKind == "message" ?
|
|
788
|
+
function We(e, t) {
|
|
789
|
+
return e.mapKind == "message" ? A(e, t) : P(e, t);
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
return e.mapKind == "message" ?
|
|
791
|
+
function Ge(e, t, n) {
|
|
792
|
+
return e.mapKind == "message" ? j(e, t, n) : t;
|
|
793
793
|
}
|
|
794
794
|
function M(e) {
|
|
795
795
|
return typeof e == "string" || typeof e == "number" ? e : String(e);
|
|
@@ -815,12 +815,12 @@ function Ke(e, n) {
|
|
|
815
815
|
case t.UINT64:
|
|
816
816
|
case t.FIXED64:
|
|
817
817
|
try {
|
|
818
|
-
return
|
|
818
|
+
return f.uParse(e);
|
|
819
819
|
} catch {}
|
|
820
820
|
break;
|
|
821
821
|
default:
|
|
822
822
|
try {
|
|
823
|
-
return
|
|
823
|
+
return f.parse(e);
|
|
824
824
|
} catch {}
|
|
825
825
|
break;
|
|
826
826
|
}
|
|
@@ -831,11 +831,11 @@ function N(e, n) {
|
|
|
831
831
|
case t.INT64:
|
|
832
832
|
case t.SFIXED64:
|
|
833
833
|
case t.SINT64:
|
|
834
|
-
"longAsString" in e && e.longAsString && typeof n == "string" && (n =
|
|
834
|
+
"longAsString" in e && e.longAsString && typeof n == "string" && (n = f.parse(n));
|
|
835
835
|
break;
|
|
836
836
|
case t.FIXED64:
|
|
837
837
|
case t.UINT64:
|
|
838
|
-
"longAsString" in e && e.longAsString && typeof n == "string" && (n =
|
|
838
|
+
"longAsString" in e && e.longAsString && typeof n == "string" && (n = f.uParse(n));
|
|
839
839
|
break;
|
|
840
840
|
}
|
|
841
841
|
return n;
|
|
@@ -845,11 +845,11 @@ function P(e, n) {
|
|
|
845
845
|
case t.INT64:
|
|
846
846
|
case t.SFIXED64:
|
|
847
847
|
case t.SINT64:
|
|
848
|
-
"longAsString" in e && e.longAsString ? n = String(n) : (typeof n == "string" || typeof n == "number") && (n =
|
|
848
|
+
"longAsString" in e && e.longAsString ? n = String(n) : (typeof n == "string" || typeof n == "number") && (n = f.parse(n));
|
|
849
849
|
break;
|
|
850
850
|
case t.FIXED64:
|
|
851
851
|
case t.UINT64:
|
|
852
|
-
"longAsString" in e && e.longAsString ? n = String(n) : (typeof n == "string" || typeof n == "number") && (n =
|
|
852
|
+
"longAsString" in e && e.longAsString ? n = String(n) : (typeof n == "string" || typeof n == "number") && (n = f.uParse(n));
|
|
853
853
|
break;
|
|
854
854
|
}
|
|
855
855
|
return n;
|
|
@@ -859,7 +859,7 @@ function qe(e) {
|
|
|
859
859
|
$typeName: "google.protobuf.Struct",
|
|
860
860
|
fields: {}
|
|
861
861
|
};
|
|
862
|
-
if (
|
|
862
|
+
if (v(e)) for (let [n, r] of Object.entries(e)) t.fields[n] = Xe(r);
|
|
863
863
|
return t;
|
|
864
864
|
}
|
|
865
865
|
function Je(e) {
|
|
@@ -998,7 +998,7 @@ function L(e) {
|
|
|
998
998
|
}
|
|
999
999
|
return n.join("");
|
|
1000
1000
|
}
|
|
1001
|
-
var tt = new Set([
|
|
1001
|
+
var tt = /* @__PURE__ */ new Set([
|
|
1002
1002
|
"constructor",
|
|
1003
1003
|
"toString",
|
|
1004
1004
|
"toJSON",
|
|
@@ -1010,7 +1010,7 @@ function R(e) {
|
|
|
1010
1010
|
//#endregion
|
|
1011
1011
|
//#region node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.js
|
|
1012
1012
|
function z(e) {
|
|
1013
|
-
for (let t of e.field)
|
|
1013
|
+
for (let t of e.field) _(t, "jsonName") || (t.jsonName = L(t.name));
|
|
1014
1014
|
e.nestedType.forEach(z);
|
|
1015
1015
|
}
|
|
1016
1016
|
//#endregion
|
|
@@ -1030,9 +1030,9 @@ function rt(e, n) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
case t.INT64:
|
|
1032
1032
|
case t.SFIXED64:
|
|
1033
|
-
case t.SINT64: return
|
|
1033
|
+
case t.SINT64: return f.parse(n);
|
|
1034
1034
|
case t.UINT64:
|
|
1035
|
-
case t.FIXED64: return
|
|
1035
|
+
case t.FIXED64: return f.uParse(n);
|
|
1036
1036
|
case t.DOUBLE:
|
|
1037
1037
|
case t.FLOAT: switch (n) {
|
|
1038
1038
|
case "inf": return Infinity;
|
|
@@ -1115,14 +1115,14 @@ function it(e) {
|
|
|
1115
1115
|
if (r === !1) return !1;
|
|
1116
1116
|
let i = parseInt(e + r, 16);
|
|
1117
1117
|
if (Number.isNaN(i)) return !1;
|
|
1118
|
-
let a = new Uint8Array(4);
|
|
1118
|
+
let a = /* @__PURE__ */ new Uint8Array(4);
|
|
1119
1119
|
new DataView(a.buffer).setInt32(0, i, !0), t.push(a[0], a[1], a[2], a[3]);
|
|
1120
1120
|
break;
|
|
1121
1121
|
}
|
|
1122
1122
|
case "U": {
|
|
1123
1123
|
let e = n.c, r = n.take(8);
|
|
1124
1124
|
if (r === !1) return !1;
|
|
1125
|
-
let i =
|
|
1125
|
+
let i = f.uEnc(e + r), a = /* @__PURE__ */ new Uint8Array(8), o = new DataView(a.buffer);
|
|
1126
1126
|
o.setInt32(0, i.lo, !0), o.setInt32(4, i.hi, !0), t.push(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]);
|
|
1127
1127
|
break;
|
|
1128
1128
|
}
|
|
@@ -1268,9 +1268,9 @@ function St(e, t) {
|
|
|
1268
1268
|
kind: "file",
|
|
1269
1269
|
proto: e,
|
|
1270
1270
|
deprecated: e.options?.deprecated ?? !1,
|
|
1271
|
-
edition:
|
|
1271
|
+
edition: kt(e),
|
|
1272
1272
|
name: e.name.replace(/\.proto$/, ""),
|
|
1273
|
-
dependencies:
|
|
1273
|
+
dependencies: At(e, t),
|
|
1274
1274
|
enums: [],
|
|
1275
1275
|
messages: [],
|
|
1276
1276
|
extensions: [],
|
|
@@ -1283,7 +1283,7 @@ function St(e, t) {
|
|
|
1283
1283
|
return r.get(e);
|
|
1284
1284
|
},
|
|
1285
1285
|
add(e) {
|
|
1286
|
-
|
|
1286
|
+
Y(e.proto.options?.mapEntry === !0), r.set(e.typeName, e);
|
|
1287
1287
|
}
|
|
1288
1288
|
};
|
|
1289
1289
|
for (let r of e.enumType) Ct(r, n, void 0, t);
|
|
@@ -1298,13 +1298,13 @@ function W(e, t) {
|
|
|
1298
1298
|
switch (e.kind) {
|
|
1299
1299
|
case "file":
|
|
1300
1300
|
for (let n of e.proto.extension) {
|
|
1301
|
-
let r =
|
|
1301
|
+
let r = Ot(n, e, t);
|
|
1302
1302
|
e.extensions.push(r), t.add(r);
|
|
1303
1303
|
}
|
|
1304
1304
|
break;
|
|
1305
1305
|
case "message":
|
|
1306
1306
|
for (let n of e.proto.extension) {
|
|
1307
|
-
let r =
|
|
1307
|
+
let r = Ot(n, e, t);
|
|
1308
1308
|
e.nestedExtensions.push(r), t.add(r);
|
|
1309
1309
|
}
|
|
1310
1310
|
for (let n of e.nestedMessages) W(n, t);
|
|
@@ -1314,14 +1314,14 @@ function W(e, t) {
|
|
|
1314
1314
|
function G(e, t, n) {
|
|
1315
1315
|
let r = e.proto.oneofDecl.map((t) => Dt(t, e)), i = /* @__PURE__ */ new Set();
|
|
1316
1316
|
for (let a of e.proto.field) {
|
|
1317
|
-
let o =
|
|
1317
|
+
let o = Nt(a, r), s = Ot(a, e, t, o, n);
|
|
1318
1318
|
e.fields.push(s), e.field[s.localName] = s, o === void 0 ? e.members.push(s) : (o.fields.push(s), i.has(o) || (i.add(o), e.members.push(o)));
|
|
1319
1319
|
}
|
|
1320
1320
|
for (let t of r.filter((e) => i.has(e))) e.oneofs.push(t);
|
|
1321
1321
|
for (let r of e.nestedMessages) G(r, t, n);
|
|
1322
1322
|
}
|
|
1323
1323
|
function Ct(e, t, n, r) {
|
|
1324
|
-
let i =
|
|
1324
|
+
let i = jt(e.name, e.value), a = {
|
|
1325
1325
|
kind: "enum",
|
|
1326
1326
|
proto: e,
|
|
1327
1327
|
deprecated: e.options?.deprecated ?? !1,
|
|
@@ -1329,7 +1329,7 @@ function Ct(e, t, n, r) {
|
|
|
1329
1329
|
parent: n,
|
|
1330
1330
|
open: !0,
|
|
1331
1331
|
name: e.name,
|
|
1332
|
-
typeName:
|
|
1332
|
+
typeName: K(e, n, t),
|
|
1333
1333
|
value: {},
|
|
1334
1334
|
values: [],
|
|
1335
1335
|
sharedPrefix: i,
|
|
@@ -1337,7 +1337,7 @@ function Ct(e, t, n, r) {
|
|
|
1337
1337
|
return `enum ${this.typeName}`;
|
|
1338
1338
|
}
|
|
1339
1339
|
};
|
|
1340
|
-
a.open =
|
|
1340
|
+
a.open = Lt(a), r.add(a);
|
|
1341
1341
|
for (let t of e.value) {
|
|
1342
1342
|
let e = t.name;
|
|
1343
1343
|
a.values.push(a.value[t.number] = {
|
|
@@ -1363,7 +1363,7 @@ function wt(e, t, n, r, i) {
|
|
|
1363
1363
|
file: t,
|
|
1364
1364
|
parent: n,
|
|
1365
1365
|
name: e.name,
|
|
1366
|
-
typeName:
|
|
1366
|
+
typeName: K(e, n, t),
|
|
1367
1367
|
fields: [],
|
|
1368
1368
|
field: {},
|
|
1369
1369
|
oneofs: [],
|
|
@@ -1386,7 +1386,7 @@ function Tt(e, t, n) {
|
|
|
1386
1386
|
deprecated: e.options?.deprecated ?? !1,
|
|
1387
1387
|
file: t,
|
|
1388
1388
|
name: e.name,
|
|
1389
|
-
typeName:
|
|
1389
|
+
typeName: K(e, void 0, t),
|
|
1390
1390
|
methods: [],
|
|
1391
1391
|
method: {},
|
|
1392
1392
|
toString() {
|
|
@@ -1402,8 +1402,8 @@ function Tt(e, t, n) {
|
|
|
1402
1402
|
function Et(e, t, n) {
|
|
1403
1403
|
let r;
|
|
1404
1404
|
r = e.clientStreaming && e.serverStreaming ? "bidi_streaming" : e.clientStreaming ? "client_streaming" : e.serverStreaming ? "server_streaming" : "unary";
|
|
1405
|
-
let i = n.getMessage(
|
|
1406
|
-
|
|
1405
|
+
let i = n.getMessage(q(e.inputType)), a = n.getMessage(q(e.outputType));
|
|
1406
|
+
Y(i, `invalid MethodDescriptorProto: input_type ${e.inputType} not found`), Y(a, `invalid MethodDescriptorProto: output_type ${e.inputType} not found`);
|
|
1407
1407
|
let o = e.name;
|
|
1408
1408
|
return {
|
|
1409
1409
|
kind: "rpc",
|
|
@@ -1435,7 +1435,7 @@ function Dt(e, t) {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
};
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Ot(e, t, n, r, i) {
|
|
1439
1439
|
let a = i === void 0, o = {
|
|
1440
1440
|
kind: "field",
|
|
1441
1441
|
proto: e,
|
|
@@ -1445,7 +1445,7 @@ function K(e, t, n, r, i) {
|
|
|
1445
1445
|
scalar: void 0,
|
|
1446
1446
|
message: void 0,
|
|
1447
1447
|
enum: void 0,
|
|
1448
|
-
presence:
|
|
1448
|
+
presence: Pt(e, r, a, t),
|
|
1449
1449
|
listKind: void 0,
|
|
1450
1450
|
mapKind: void 0,
|
|
1451
1451
|
mapKey: void 0,
|
|
@@ -1455,53 +1455,53 @@ function K(e, t, n, r, i) {
|
|
|
1455
1455
|
getDefaultValue: void 0
|
|
1456
1456
|
};
|
|
1457
1457
|
if (a) {
|
|
1458
|
-
let r = t.kind == "file" ? t : t.file, i = t.kind == "file" ? void 0 : t, a =
|
|
1458
|
+
let r = t.kind == "file" ? t : t.file, i = t.kind == "file" ? void 0 : t, a = K(e, i, r);
|
|
1459
1459
|
o.kind = "extension", o.file = r, o.parent = i, o.oneof = void 0, o.typeName = a, o.jsonName = `[${a}]`, o.toString = () => `extension ${a}`;
|
|
1460
|
-
let s = n.getMessage(
|
|
1461
|
-
|
|
1460
|
+
let s = n.getMessage(q(e.extendee));
|
|
1461
|
+
Y(s, `invalid FieldDescriptorProto: extendee ${e.extendee} not found`), o.extendee = s;
|
|
1462
1462
|
} else {
|
|
1463
1463
|
let n = t;
|
|
1464
|
-
|
|
1464
|
+
Y(n.kind == "message"), o.parent = n, o.oneof = r, o.localName = r ? L(e.name) : R(L(e.name)), o.jsonName = e.jsonName, o.toString = () => `field ${n.typeName}.${e.name}`;
|
|
1465
1465
|
}
|
|
1466
1466
|
let s = e.label, c = e.type, l = e.options?.jstype;
|
|
1467
1467
|
if (s === U) {
|
|
1468
|
-
let r = c == H ? i?.get(
|
|
1468
|
+
let r = c == H ? i?.get(q(e.typeName)) : void 0;
|
|
1469
1469
|
if (r) {
|
|
1470
1470
|
o.fieldKind = "map";
|
|
1471
|
-
let { key: e, value: t } =
|
|
1471
|
+
let { key: e, value: t } = It(r);
|
|
1472
1472
|
return o.mapKey = e.scalar, o.mapKind = t.fieldKind, o.message = t.message, o.delimitedEncoding = !1, o.enum = t.enum, o.scalar = t.scalar, o;
|
|
1473
1473
|
}
|
|
1474
1474
|
switch (o.fieldKind = "list", c) {
|
|
1475
1475
|
case H:
|
|
1476
1476
|
case V:
|
|
1477
|
-
o.listKind = "message", o.message = n.getMessage(
|
|
1477
|
+
o.listKind = "message", o.message = n.getMessage(q(e.typeName)), Y(o.message), o.delimitedEncoding = Rt(e, t);
|
|
1478
1478
|
break;
|
|
1479
1479
|
case dt:
|
|
1480
|
-
o.listKind = "enum", o.enum = n.getEnum(
|
|
1480
|
+
o.listKind = "enum", o.enum = n.getEnum(q(e.typeName)), Y(o.enum);
|
|
1481
1481
|
break;
|
|
1482
1482
|
default:
|
|
1483
1483
|
o.listKind = "scalar", o.scalar = c, o.longAsString = l == pt;
|
|
1484
1484
|
break;
|
|
1485
1485
|
}
|
|
1486
|
-
return o.packed =
|
|
1486
|
+
return o.packed = Ft(e, t), o;
|
|
1487
1487
|
}
|
|
1488
1488
|
switch (c) {
|
|
1489
1489
|
case H:
|
|
1490
1490
|
case V:
|
|
1491
|
-
o.fieldKind = "message", o.message = n.getMessage(
|
|
1491
|
+
o.fieldKind = "message", o.message = n.getMessage(q(e.typeName)), Y(o.message, `invalid FieldDescriptorProto: type_name ${e.typeName} not found`), o.delimitedEncoding = Rt(e, t), o.getDefaultValue = () => void 0;
|
|
1492
1492
|
break;
|
|
1493
1493
|
case dt: {
|
|
1494
|
-
let t = n.getEnum(
|
|
1495
|
-
|
|
1494
|
+
let t = n.getEnum(q(e.typeName));
|
|
1495
|
+
Y(t !== void 0, `invalid FieldDescriptorProto: type_name ${e.typeName} not found`), o.fieldKind = "enum", o.enum = n.getEnum(q(e.typeName)), o.getDefaultValue = () => _(e, "defaultValue") ? nt(t, e.defaultValue) : void 0;
|
|
1496
1496
|
break;
|
|
1497
1497
|
}
|
|
1498
1498
|
default:
|
|
1499
|
-
o.fieldKind = "scalar", o.scalar = c, o.longAsString = l == pt, o.getDefaultValue = () =>
|
|
1499
|
+
o.fieldKind = "scalar", o.scalar = c, o.longAsString = l == pt, o.getDefaultValue = () => _(e, "defaultValue") ? rt(c, e.defaultValue) : void 0;
|
|
1500
1500
|
break;
|
|
1501
1501
|
}
|
|
1502
1502
|
return o;
|
|
1503
1503
|
}
|
|
1504
|
-
function
|
|
1504
|
+
function kt(e) {
|
|
1505
1505
|
switch (e.syntax) {
|
|
1506
1506
|
case "":
|
|
1507
1507
|
case "proto2": return st;
|
|
@@ -1512,15 +1512,15 @@ function Ot(e) {
|
|
|
1512
1512
|
default: throw Error(`${e.name}: unsupported syntax "${e.syntax}"`);
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
|
-
function
|
|
1515
|
+
function At(e, t) {
|
|
1516
1516
|
return e.dependency.map((n) => {
|
|
1517
1517
|
let r = t.getFile(n);
|
|
1518
1518
|
if (!r) throw Error(`Cannot find ${n}, imported by ${e.name}`);
|
|
1519
1519
|
return r;
|
|
1520
1520
|
});
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
let n =
|
|
1522
|
+
function jt(e, t) {
|
|
1523
|
+
let n = Mt(e) + "_";
|
|
1524
1524
|
for (let e of t) {
|
|
1525
1525
|
if (!e.name.toLowerCase().startsWith(n)) return;
|
|
1526
1526
|
let t = e.name.substring(n.length);
|
|
@@ -1528,32 +1528,32 @@ function At(e, t) {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
return n;
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function Mt(e) {
|
|
1532
1532
|
return (e.substring(0, 1) + e.substring(1).replace(/[A-Z]/g, (e) => "_" + e)).toLowerCase();
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function K(e, t, n) {
|
|
1535
1535
|
let r;
|
|
1536
1536
|
return r = t ? `${t.typeName}.${e.name}` : n.proto.package.length > 0 ? `${n.proto.package}.${e.name}` : `${e.name}`, r;
|
|
1537
1537
|
}
|
|
1538
|
-
function
|
|
1538
|
+
function q(e) {
|
|
1539
1539
|
return e.startsWith(".") ? e.substring(1) : e;
|
|
1540
1540
|
}
|
|
1541
|
-
function
|
|
1542
|
-
if (!
|
|
1541
|
+
function Nt(e, t) {
|
|
1542
|
+
if (!_(e, "oneofIndex") || e.proto3Optional) return;
|
|
1543
1543
|
let n = t[e.oneofIndex];
|
|
1544
|
-
return
|
|
1544
|
+
return Y(n, `invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`), n;
|
|
1545
1545
|
}
|
|
1546
|
-
function
|
|
1546
|
+
function Pt(e, t, n, r) {
|
|
1547
1547
|
if (e.label == ft) return _t;
|
|
1548
1548
|
if (e.label == U) return gt;
|
|
1549
1549
|
if (t || e.proto3Optional || n) return ht;
|
|
1550
|
-
let i =
|
|
1550
|
+
let i = J("fieldPresence", {
|
|
1551
1551
|
proto: e,
|
|
1552
1552
|
parent: r
|
|
1553
1553
|
});
|
|
1554
1554
|
return i == gt && (e.type == H || e.type == V) ? ht : i;
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1556
|
+
function Ft(e, t) {
|
|
1557
1557
|
if (e.label != U) return !1;
|
|
1558
1558
|
switch (e.type) {
|
|
1559
1559
|
case lt:
|
|
@@ -1562,54 +1562,54 @@ function Pt(e, t) {
|
|
|
1562
1562
|
case H: return !1;
|
|
1563
1563
|
}
|
|
1564
1564
|
let n = e.options;
|
|
1565
|
-
return n &&
|
|
1565
|
+
return n && _(n, "packed") ? n.packed : vt == J("repeatedFieldEncoding", {
|
|
1566
1566
|
proto: e,
|
|
1567
1567
|
parent: t
|
|
1568
1568
|
});
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function It(e) {
|
|
1571
1571
|
let n = e.fields.find((e) => e.number === 1), r = e.fields.find((e) => e.number === 2);
|
|
1572
|
-
return
|
|
1572
|
+
return Y(n && n.fieldKind == "scalar" && n.scalar != t.BYTES && n.scalar != t.FLOAT && n.scalar != t.DOUBLE && r && r.fieldKind != "list" && r.fieldKind != "map"), {
|
|
1573
1573
|
key: n,
|
|
1574
1574
|
value: r
|
|
1575
1575
|
};
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1578
|
-
return bt ==
|
|
1577
|
+
function Lt(e) {
|
|
1578
|
+
return bt == J("enumType", {
|
|
1579
1579
|
proto: e.proto,
|
|
1580
1580
|
parent: e.parent ?? e.file
|
|
1581
1581
|
});
|
|
1582
1582
|
}
|
|
1583
|
-
function
|
|
1584
|
-
return e.type == V ? !0 : yt ==
|
|
1583
|
+
function Rt(e, t) {
|
|
1584
|
+
return e.type == V ? !0 : yt == J("messageEncoding", {
|
|
1585
1585
|
proto: e,
|
|
1586
1586
|
parent: t
|
|
1587
1587
|
});
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function J(e, t) {
|
|
1590
1590
|
let n = t.proto.options?.features;
|
|
1591
1591
|
if (n) {
|
|
1592
1592
|
let t = n[e];
|
|
1593
1593
|
if (t != 0) return t;
|
|
1594
1594
|
}
|
|
1595
1595
|
if ("kind" in t) {
|
|
1596
|
-
if (t.kind == "message") return
|
|
1596
|
+
if (t.kind == "message") return J(e, t.parent ?? t.file);
|
|
1597
1597
|
let n = xt[t.edition];
|
|
1598
1598
|
if (!n) throw Error(`feature default for edition ${t.edition} not found`);
|
|
1599
1599
|
return n[e];
|
|
1600
1600
|
}
|
|
1601
|
-
return
|
|
1601
|
+
return J(e, t.parent);
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function Y(e, t) {
|
|
1604
1604
|
if (!e) throw Error(t);
|
|
1605
1605
|
}
|
|
1606
1606
|
//#endregion
|
|
1607
1607
|
//#region node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js
|
|
1608
|
-
function
|
|
1609
|
-
let t =
|
|
1608
|
+
function zt(e) {
|
|
1609
|
+
let t = Bt(e);
|
|
1610
1610
|
return t.messageType.forEach(z), at(t, () => void 0).getFile(t.name);
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1612
|
+
function Bt(e) {
|
|
1613
1613
|
return Object.assign(Object.create({
|
|
1614
1614
|
syntax: "",
|
|
1615
1615
|
edition: 0
|
|
@@ -1622,25 +1622,25 @@ function zt(e) {
|
|
|
1622
1622
|
service: [],
|
|
1623
1623
|
extension: []
|
|
1624
1624
|
}, e), {
|
|
1625
|
-
messageType: e.messageType.map(
|
|
1626
|
-
enumType: e.enumType.map(
|
|
1625
|
+
messageType: e.messageType.map(Vt),
|
|
1626
|
+
enumType: e.enumType.map(Wt)
|
|
1627
1627
|
}));
|
|
1628
1628
|
}
|
|
1629
|
-
function
|
|
1629
|
+
function Vt(e) {
|
|
1630
1630
|
return Object.assign(Object.create({ visibility: 0 }), {
|
|
1631
1631
|
$typeName: "google.protobuf.DescriptorProto",
|
|
1632
1632
|
name: e.name,
|
|
1633
|
-
field: e.field?.map(
|
|
1633
|
+
field: e.field?.map(Ht) ?? [],
|
|
1634
1634
|
extension: [],
|
|
1635
|
-
nestedType: e.nestedType?.map(
|
|
1636
|
-
enumType: e.enumType?.map(
|
|
1635
|
+
nestedType: e.nestedType?.map(Vt) ?? [],
|
|
1636
|
+
enumType: e.enumType?.map(Wt) ?? [],
|
|
1637
1637
|
extensionRange: e.extensionRange?.map((e) => Object.assign({ $typeName: "google.protobuf.DescriptorProto.ExtensionRange" }, e)) ?? [],
|
|
1638
1638
|
oneofDecl: [],
|
|
1639
1639
|
reservedRange: [],
|
|
1640
1640
|
reservedName: []
|
|
1641
1641
|
});
|
|
1642
1642
|
}
|
|
1643
|
-
function
|
|
1643
|
+
function Ht(e) {
|
|
1644
1644
|
return Object.assign(Object.create({
|
|
1645
1645
|
label: 1,
|
|
1646
1646
|
typeName: "",
|
|
@@ -1649,9 +1649,9 @@ function Vt(e) {
|
|
|
1649
1649
|
oneofIndex: 0,
|
|
1650
1650
|
jsonName: "",
|
|
1651
1651
|
proto3Optional: !1
|
|
1652
|
-
}), Object.assign(Object.assign({ $typeName: "google.protobuf.FieldDescriptorProto" }, e), { options: e.options ?
|
|
1652
|
+
}), Object.assign(Object.assign({ $typeName: "google.protobuf.FieldDescriptorProto" }, e), { options: e.options ? Ut(e.options) : void 0 }));
|
|
1653
1653
|
}
|
|
1654
|
-
function
|
|
1654
|
+
function Ut(e) {
|
|
1655
1655
|
return Object.assign(Object.create({
|
|
1656
1656
|
ctype: 0,
|
|
1657
1657
|
packed: !1,
|
|
@@ -1668,7 +1668,7 @@ function Ht(e) {
|
|
|
1668
1668
|
uninterpretedOption: []
|
|
1669
1669
|
}));
|
|
1670
1670
|
}
|
|
1671
|
-
function
|
|
1671
|
+
function Wt(e) {
|
|
1672
1672
|
return Object.assign(Object.create({ visibility: 0 }), {
|
|
1673
1673
|
$typeName: "google.protobuf.EnumDescriptorProto",
|
|
1674
1674
|
name: e.name,
|
|
@@ -1679,10 +1679,10 @@ function Ut(e) {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
//#endregion
|
|
1681
1681
|
//#region node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js
|
|
1682
|
-
function
|
|
1682
|
+
function X(e, t, ...n) {
|
|
1683
1683
|
return n.reduce((e, t) => e.nestedMessages[t], e.messages[t]);
|
|
1684
1684
|
}
|
|
1685
|
-
var
|
|
1685
|
+
var Gt = /*@__PURE__*/ X(/* @__PURE__ */ zt({
|
|
1686
1686
|
name: "google/protobuf/descriptor.proto",
|
|
1687
1687
|
package: "google.protobuf",
|
|
1688
1688
|
messageType: [
|
|
@@ -3635,99 +3635,99 @@ var Wt = /* @__PURE__ */ Z(/* @__PURE__ */ Rt({
|
|
|
3635
3635
|
}
|
|
3636
3636
|
]
|
|
3637
3637
|
}]
|
|
3638
|
-
}), 1),
|
|
3638
|
+
}), 1), Kt;
|
|
3639
3639
|
(function(e) {
|
|
3640
3640
|
e[e.DECLARATION = 0] = "DECLARATION", e[e.UNVERIFIED = 1] = "UNVERIFIED";
|
|
3641
|
-
})(Gt ||= {});
|
|
3642
|
-
var Kt;
|
|
3643
|
-
(function(e) {
|
|
3644
|
-
e[e.DOUBLE = 1] = "DOUBLE", e[e.FLOAT = 2] = "FLOAT", e[e.INT64 = 3] = "INT64", e[e.UINT64 = 4] = "UINT64", e[e.INT32 = 5] = "INT32", e[e.FIXED64 = 6] = "FIXED64", e[e.FIXED32 = 7] = "FIXED32", e[e.BOOL = 8] = "BOOL", e[e.STRING = 9] = "STRING", e[e.GROUP = 10] = "GROUP", e[e.MESSAGE = 11] = "MESSAGE", e[e.BYTES = 12] = "BYTES", e[e.UINT32 = 13] = "UINT32", e[e.ENUM = 14] = "ENUM", e[e.SFIXED32 = 15] = "SFIXED32", e[e.SFIXED64 = 16] = "SFIXED64", e[e.SINT32 = 17] = "SINT32", e[e.SINT64 = 18] = "SINT64";
|
|
3645
3641
|
})(Kt ||= {});
|
|
3646
3642
|
var qt;
|
|
3647
3643
|
(function(e) {
|
|
3648
|
-
e[e.
|
|
3644
|
+
e[e.DOUBLE = 1] = "DOUBLE", e[e.FLOAT = 2] = "FLOAT", e[e.INT64 = 3] = "INT64", e[e.UINT64 = 4] = "UINT64", e[e.INT32 = 5] = "INT32", e[e.FIXED64 = 6] = "FIXED64", e[e.FIXED32 = 7] = "FIXED32", e[e.BOOL = 8] = "BOOL", e[e.STRING = 9] = "STRING", e[e.GROUP = 10] = "GROUP", e[e.MESSAGE = 11] = "MESSAGE", e[e.BYTES = 12] = "BYTES", e[e.UINT32 = 13] = "UINT32", e[e.ENUM = 14] = "ENUM", e[e.SFIXED32 = 15] = "SFIXED32", e[e.SFIXED64 = 16] = "SFIXED64", e[e.SINT32 = 17] = "SINT32", e[e.SINT64 = 18] = "SINT64";
|
|
3649
3645
|
})(qt ||= {});
|
|
3650
3646
|
var Jt;
|
|
3651
3647
|
(function(e) {
|
|
3652
|
-
e[e.
|
|
3648
|
+
e[e.OPTIONAL = 1] = "OPTIONAL", e[e.REPEATED = 3] = "REPEATED", e[e.REQUIRED = 2] = "REQUIRED";
|
|
3653
3649
|
})(Jt ||= {});
|
|
3654
3650
|
var Yt;
|
|
3655
3651
|
(function(e) {
|
|
3656
|
-
e[e.
|
|
3652
|
+
e[e.SPEED = 1] = "SPEED", e[e.CODE_SIZE = 2] = "CODE_SIZE", e[e.LITE_RUNTIME = 3] = "LITE_RUNTIME";
|
|
3657
3653
|
})(Yt ||= {});
|
|
3658
3654
|
var Xt;
|
|
3659
3655
|
(function(e) {
|
|
3660
|
-
e[e.
|
|
3656
|
+
e[e.STRING = 0] = "STRING", e[e.CORD = 1] = "CORD", e[e.STRING_PIECE = 2] = "STRING_PIECE";
|
|
3661
3657
|
})(Xt ||= {});
|
|
3662
3658
|
var Zt;
|
|
3663
3659
|
(function(e) {
|
|
3664
|
-
e[e.
|
|
3660
|
+
e[e.JS_NORMAL = 0] = "JS_NORMAL", e[e.JS_STRING = 1] = "JS_STRING", e[e.JS_NUMBER = 2] = "JS_NUMBER";
|
|
3665
3661
|
})(Zt ||= {});
|
|
3666
3662
|
var Qt;
|
|
3667
3663
|
(function(e) {
|
|
3668
|
-
e[e.
|
|
3664
|
+
e[e.RETENTION_UNKNOWN = 0] = "RETENTION_UNKNOWN", e[e.RETENTION_RUNTIME = 1] = "RETENTION_RUNTIME", e[e.RETENTION_SOURCE = 2] = "RETENTION_SOURCE";
|
|
3669
3665
|
})(Qt ||= {});
|
|
3670
3666
|
var $t;
|
|
3671
3667
|
(function(e) {
|
|
3672
|
-
e[e.
|
|
3668
|
+
e[e.TARGET_TYPE_UNKNOWN = 0] = "TARGET_TYPE_UNKNOWN", e[e.TARGET_TYPE_FILE = 1] = "TARGET_TYPE_FILE", e[e.TARGET_TYPE_EXTENSION_RANGE = 2] = "TARGET_TYPE_EXTENSION_RANGE", e[e.TARGET_TYPE_MESSAGE = 3] = "TARGET_TYPE_MESSAGE", e[e.TARGET_TYPE_FIELD = 4] = "TARGET_TYPE_FIELD", e[e.TARGET_TYPE_ONEOF = 5] = "TARGET_TYPE_ONEOF", e[e.TARGET_TYPE_ENUM = 6] = "TARGET_TYPE_ENUM", e[e.TARGET_TYPE_ENUM_ENTRY = 7] = "TARGET_TYPE_ENUM_ENTRY", e[e.TARGET_TYPE_SERVICE = 8] = "TARGET_TYPE_SERVICE", e[e.TARGET_TYPE_METHOD = 9] = "TARGET_TYPE_METHOD";
|
|
3673
3669
|
})($t ||= {});
|
|
3674
3670
|
var en;
|
|
3675
3671
|
(function(e) {
|
|
3676
|
-
e[e.
|
|
3672
|
+
e[e.IDEMPOTENCY_UNKNOWN = 0] = "IDEMPOTENCY_UNKNOWN", e[e.NO_SIDE_EFFECTS = 1] = "NO_SIDE_EFFECTS", e[e.IDEMPOTENT = 2] = "IDEMPOTENT";
|
|
3677
3673
|
})(en ||= {});
|
|
3678
3674
|
var tn;
|
|
3679
3675
|
(function(e) {
|
|
3680
|
-
e[e.
|
|
3676
|
+
e[e.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN", e[e.EXPORT_ALL = 1] = "EXPORT_ALL", e[e.EXPORT_TOP_LEVEL = 2] = "EXPORT_TOP_LEVEL", e[e.LOCAL_ALL = 3] = "LOCAL_ALL", e[e.STRICT = 4] = "STRICT";
|
|
3681
3677
|
})(tn ||= {});
|
|
3682
3678
|
var nn;
|
|
3683
3679
|
(function(e) {
|
|
3684
|
-
e[e.
|
|
3680
|
+
e[e.FIELD_PRESENCE_UNKNOWN = 0] = "FIELD_PRESENCE_UNKNOWN", e[e.EXPLICIT = 1] = "EXPLICIT", e[e.IMPLICIT = 2] = "IMPLICIT", e[e.LEGACY_REQUIRED = 3] = "LEGACY_REQUIRED";
|
|
3685
3681
|
})(nn ||= {});
|
|
3686
3682
|
var rn;
|
|
3687
3683
|
(function(e) {
|
|
3688
|
-
e[e.
|
|
3684
|
+
e[e.ENUM_TYPE_UNKNOWN = 0] = "ENUM_TYPE_UNKNOWN", e[e.OPEN = 1] = "OPEN", e[e.CLOSED = 2] = "CLOSED";
|
|
3689
3685
|
})(rn ||= {});
|
|
3690
3686
|
var an;
|
|
3691
3687
|
(function(e) {
|
|
3692
|
-
e[e.
|
|
3688
|
+
e[e.REPEATED_FIELD_ENCODING_UNKNOWN = 0] = "REPEATED_FIELD_ENCODING_UNKNOWN", e[e.PACKED = 1] = "PACKED", e[e.EXPANDED = 2] = "EXPANDED";
|
|
3693
3689
|
})(an ||= {});
|
|
3694
3690
|
var on;
|
|
3695
3691
|
(function(e) {
|
|
3696
|
-
e[e.
|
|
3692
|
+
e[e.UTF8_VALIDATION_UNKNOWN = 0] = "UTF8_VALIDATION_UNKNOWN", e[e.VERIFY = 2] = "VERIFY", e[e.NONE = 3] = "NONE";
|
|
3697
3693
|
})(on ||= {});
|
|
3698
3694
|
var sn;
|
|
3699
3695
|
(function(e) {
|
|
3700
|
-
e[e.
|
|
3696
|
+
e[e.MESSAGE_ENCODING_UNKNOWN = 0] = "MESSAGE_ENCODING_UNKNOWN", e[e.LENGTH_PREFIXED = 1] = "LENGTH_PREFIXED", e[e.DELIMITED = 2] = "DELIMITED";
|
|
3701
3697
|
})(sn ||= {});
|
|
3702
3698
|
var cn;
|
|
3703
3699
|
(function(e) {
|
|
3704
|
-
e[e.
|
|
3700
|
+
e[e.JSON_FORMAT_UNKNOWN = 0] = "JSON_FORMAT_UNKNOWN", e[e.ALLOW = 1] = "ALLOW", e[e.LEGACY_BEST_EFFORT = 2] = "LEGACY_BEST_EFFORT";
|
|
3705
3701
|
})(cn ||= {});
|
|
3706
3702
|
var ln;
|
|
3707
3703
|
(function(e) {
|
|
3708
|
-
e[e.
|
|
3704
|
+
e[e.ENFORCE_NAMING_STYLE_UNKNOWN = 0] = "ENFORCE_NAMING_STYLE_UNKNOWN", e[e.STYLE2024 = 1] = "STYLE2024", e[e.STYLE_LEGACY = 2] = "STYLE_LEGACY";
|
|
3709
3705
|
})(ln ||= {});
|
|
3710
3706
|
var un;
|
|
3711
3707
|
(function(e) {
|
|
3712
|
-
e[e.
|
|
3708
|
+
e[e.NONE = 0] = "NONE", e[e.SET = 1] = "SET", e[e.ALIAS = 2] = "ALIAS";
|
|
3713
3709
|
})(un ||= {});
|
|
3714
3710
|
var dn;
|
|
3715
3711
|
(function(e) {
|
|
3716
|
-
e[e.
|
|
3712
|
+
e[e.EDITION_UNKNOWN = 0] = "EDITION_UNKNOWN", e[e.EDITION_LEGACY = 900] = "EDITION_LEGACY", e[e.EDITION_PROTO2 = 998] = "EDITION_PROTO2", e[e.EDITION_PROTO3 = 999] = "EDITION_PROTO3", e[e.EDITION_2023 = 1e3] = "EDITION_2023", e[e.EDITION_2024 = 1001] = "EDITION_2024", e[e.EDITION_UNSTABLE = 9999] = "EDITION_UNSTABLE", e[e.EDITION_1_TEST_ONLY = 1] = "EDITION_1_TEST_ONLY", e[e.EDITION_2_TEST_ONLY = 2] = "EDITION_2_TEST_ONLY", e[e.EDITION_99997_TEST_ONLY = 99997] = "EDITION_99997_TEST_ONLY", e[e.EDITION_99998_TEST_ONLY = 99998] = "EDITION_99998_TEST_ONLY", e[e.EDITION_99999_TEST_ONLY = 99999] = "EDITION_99999_TEST_ONLY", e[e.EDITION_MAX = 2147483647] = "EDITION_MAX";
|
|
3717
3713
|
})(dn ||= {});
|
|
3714
|
+
var fn;
|
|
3715
|
+
(function(e) {
|
|
3716
|
+
e[e.VISIBILITY_UNSET = 0] = "VISIBILITY_UNSET", e[e.VISIBILITY_LOCAL = 1] = "VISIBILITY_LOCAL", e[e.VISIBILITY_EXPORT = 2] = "VISIBILITY_EXPORT";
|
|
3717
|
+
})(fn ||= {});
|
|
3718
3718
|
//#endregion
|
|
3719
3719
|
//#region node_modules/@bufbuild/protobuf/dist/esm/from-binary.js
|
|
3720
|
-
var
|
|
3721
|
-
function
|
|
3722
|
-
return e ? Object.assign(Object.assign({},
|
|
3720
|
+
var pn = { readUnknownFields: !0 };
|
|
3721
|
+
function mn(e) {
|
|
3722
|
+
return e ? Object.assign(Object.assign({}, pn), e) : pn;
|
|
3723
3723
|
}
|
|
3724
|
-
function
|
|
3725
|
-
let r =
|
|
3726
|
-
return
|
|
3724
|
+
function Z(e, t, n) {
|
|
3725
|
+
let r = Le(e, void 0, !1);
|
|
3726
|
+
return hn(r, new De(t), mn(n), !1, t.byteLength), r.message;
|
|
3727
3727
|
}
|
|
3728
|
-
function
|
|
3728
|
+
function hn(e, t, n, r, i) {
|
|
3729
3729
|
let a = r ? t.len : t.pos + i, o, s, c = e.getUnknown() ?? [];
|
|
3730
|
-
for (; t.pos < a && ([o, s] = t.tag(), !(r && s ==
|
|
3730
|
+
for (; t.pos < a && ([o, s] = t.tag(), !(r && s == E.EndGroup));) {
|
|
3731
3731
|
let r = e.findNumber(o);
|
|
3732
3732
|
if (!r) {
|
|
3733
3733
|
let e = t.skip(s, o);
|
|
@@ -3738,23 +3738,23 @@ function mn(e, t, n, r, i) {
|
|
|
3738
3738
|
});
|
|
3739
3739
|
continue;
|
|
3740
3740
|
}
|
|
3741
|
-
|
|
3741
|
+
gn(e, t, r, s, n);
|
|
3742
3742
|
}
|
|
3743
|
-
if (r && (s !=
|
|
3743
|
+
if (r && (s != E.EndGroup || o !== i)) throw Error("invalid end group tag");
|
|
3744
3744
|
c.length > 0 && e.setUnknown(c);
|
|
3745
3745
|
}
|
|
3746
|
-
function
|
|
3746
|
+
function gn(e, n, r, i, a) {
|
|
3747
3747
|
switch (r.fieldKind) {
|
|
3748
3748
|
case "scalar":
|
|
3749
|
-
e.set(r,
|
|
3749
|
+
e.set(r, Q(n, r.scalar));
|
|
3750
3750
|
break;
|
|
3751
3751
|
case "enum":
|
|
3752
|
-
let o =
|
|
3752
|
+
let o = Q(n, t.INT32);
|
|
3753
3753
|
if (r.enum.open) e.set(r, o);
|
|
3754
3754
|
else if (r.enum.values.some((e) => e.number === o)) e.set(r, o);
|
|
3755
3755
|
else if (a.readUnknownFields) {
|
|
3756
3756
|
let t = [];
|
|
3757
|
-
|
|
3757
|
+
d(o, t);
|
|
3758
3758
|
let n = e.getUnknown() ?? [];
|
|
3759
3759
|
n.push({
|
|
3760
3760
|
no: r.number,
|
|
@@ -3764,71 +3764,71 @@ function hn(e, n, r, i, a) {
|
|
|
3764
3764
|
}
|
|
3765
3765
|
break;
|
|
3766
3766
|
case "message":
|
|
3767
|
-
e.set(r,
|
|
3767
|
+
e.set(r, yn(n, a, r, e.get(r)));
|
|
3768
3768
|
break;
|
|
3769
3769
|
case "list":
|
|
3770
|
-
|
|
3770
|
+
vn(n, i, e.get(r), a);
|
|
3771
3771
|
break;
|
|
3772
3772
|
case "map":
|
|
3773
|
-
|
|
3773
|
+
_n(n, e.get(r), a);
|
|
3774
3774
|
break;
|
|
3775
3775
|
}
|
|
3776
3776
|
}
|
|
3777
|
-
function
|
|
3777
|
+
function _n(e, t, n) {
|
|
3778
3778
|
let r = t.field(), i, a, o = e.uint32(), s = e.pos + o;
|
|
3779
3779
|
for (; e.pos < s;) {
|
|
3780
3780
|
let [t] = e.tag();
|
|
3781
3781
|
switch (t) {
|
|
3782
3782
|
case 1:
|
|
3783
|
-
i =
|
|
3783
|
+
i = Q(e, r.mapKey);
|
|
3784
3784
|
break;
|
|
3785
3785
|
case 2:
|
|
3786
3786
|
switch (r.mapKind) {
|
|
3787
3787
|
case "scalar":
|
|
3788
|
-
a =
|
|
3788
|
+
a = Q(e, r.scalar);
|
|
3789
3789
|
break;
|
|
3790
3790
|
case "enum":
|
|
3791
3791
|
a = e.int32();
|
|
3792
3792
|
break;
|
|
3793
3793
|
case "message":
|
|
3794
|
-
a =
|
|
3794
|
+
a = yn(e, n, r);
|
|
3795
3795
|
break;
|
|
3796
3796
|
}
|
|
3797
3797
|
break;
|
|
3798
3798
|
}
|
|
3799
3799
|
}
|
|
3800
|
-
if (i === void 0 && (i =
|
|
3800
|
+
if (i === void 0 && (i = p(r.mapKey, !1)), a === void 0) switch (r.mapKind) {
|
|
3801
3801
|
case "scalar":
|
|
3802
|
-
a =
|
|
3802
|
+
a = p(r.scalar, !1);
|
|
3803
3803
|
break;
|
|
3804
3804
|
case "enum":
|
|
3805
3805
|
a = r.enum.values[0].number;
|
|
3806
3806
|
break;
|
|
3807
3807
|
case "message":
|
|
3808
|
-
a =
|
|
3808
|
+
a = Le(r.message, void 0, !1);
|
|
3809
3809
|
break;
|
|
3810
3810
|
}
|
|
3811
3811
|
t.set(i, a);
|
|
3812
3812
|
}
|
|
3813
|
-
function
|
|
3813
|
+
function vn(e, n, r, i) {
|
|
3814
3814
|
let a = r.field();
|
|
3815
3815
|
if (a.listKind === "message") {
|
|
3816
|
-
r.add(
|
|
3816
|
+
r.add(yn(e, i, a));
|
|
3817
3817
|
return;
|
|
3818
3818
|
}
|
|
3819
3819
|
let o = a.scalar ?? t.INT32;
|
|
3820
|
-
if (!(n ==
|
|
3821
|
-
r.add(
|
|
3820
|
+
if (!(n == E.LengthDelimited && o != t.STRING && o != t.BYTES)) {
|
|
3821
|
+
r.add(Q(e, o));
|
|
3822
3822
|
return;
|
|
3823
3823
|
}
|
|
3824
3824
|
let s = e.uint32() + e.pos;
|
|
3825
|
-
for (; e.pos < s;) r.add(
|
|
3825
|
+
for (; e.pos < s;) r.add(Q(e, o));
|
|
3826
3826
|
}
|
|
3827
|
-
function
|
|
3828
|
-
let i = n.delimitedEncoding, a = r ??
|
|
3829
|
-
return
|
|
3827
|
+
function yn(e, t, n, r) {
|
|
3828
|
+
let i = n.delimitedEncoding, a = r ?? Le(n.message, void 0, !1);
|
|
3829
|
+
return hn(a, e, t, i, i ? n.number : e.uint32()), a;
|
|
3830
3830
|
}
|
|
3831
|
-
function
|
|
3831
|
+
function Q(e, n) {
|
|
3832
3832
|
switch (n) {
|
|
3833
3833
|
case t.STRING: return e.string();
|
|
3834
3834
|
case t.BOOL: return e.bool();
|
|
@@ -3849,27 +3849,27 @@ function $(e, n) {
|
|
|
3849
3849
|
}
|
|
3850
3850
|
//#endregion
|
|
3851
3851
|
//#region node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js
|
|
3852
|
-
function
|
|
3853
|
-
let n =
|
|
3852
|
+
function bn(e, t) {
|
|
3853
|
+
let n = Z(Gt, Ze(e));
|
|
3854
3854
|
return n.messageType.forEach(z), n.dependency = t?.map((e) => e.proto.name) ?? [], at(n, (e) => t?.find((t) => t.proto.name === e)).getFile(n.name);
|
|
3855
3855
|
}
|
|
3856
3856
|
//#endregion
|
|
3857
3857
|
//#region node_modules/pr-player/dist/index.js
|
|
3858
|
-
var bn = "(function(){\"use strict\";class P{pendingPayloads=[];payload=new Uint8Array(0);chunks=[];push=t=>{this.pendingPayloads.push(t)};next=(t=0)=>{this.payload=this.payload.slice(t);const s=this.pendingPayloads.shift();if(!s)return!1;const e=new Uint8Array(this.payload.byteLength+s.byteLength);return e.set(this.payload,0),e.set(s,this.payload.byteLength),this.payload=e,new DataView(this.payload.buffer)};pushChunk=t=>{this.chunks.push(t),this.chunks.length>100&&this.chunks.shift()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array(0),this.chunks=[]}}const I=(y,t)=>{const s=new Uint8Array(y),e=new Uint8Array(t),n=new Uint8Array(11+s.length+e.length);let a=0;return n[a++]=1,n[a++]=s[1],n[a++]=s[2],n[a++]=s[3],n[a++]=255,n[a++]=225,n[a++]=s.length>>8&255,n[a++]=s.length&255,n.set(s,a),a+=s.length,n[a++]=1,n[a++]=e.length>>8&255,n[a++]=e.length&255,n.set(e,a),n},T=y=>{let t=0;const s=new DataView(y.buffer),e=s.getUint8(t);if(t=t+1,e!==1)throw new Error(\"Invalid AVC version\");const n=s.getUint8(t)&255;t=t+1;const a=s.getUint8(t)&255;t=t+1;const o=s.getUint8(t)&255;t=t+1;const c=`avc1.${Array.from([n,a,o],U=>U.toString(16).padStart(2,\"0\")).join(\"\")}`,r=(s.getUint8(t)&3)-1;t=t+1;const g=s.getUint8(t)&31;t=t+1;const p=s.getUint16(t,!1);t=t+2;const h=new Uint8Array(s.buffer.slice(t,t+p));t=t+p;const d=s.getUint8(t)&31;t=t+1;const u=s.getUint16(t,!1);t=t+2;const f=new Uint8Array(s.buffer.slice(t,t+u));return t=t+u,{version:e,codec:c,profile:n,compatibility:a,level:o,lengthSizeMinusOne:r,numOfSequenceParameterSets:g,sequenceParameterSetLength:p,sps:h,numOfPictureParameterSets:d,pictureParameterSetLength:u,pps:f}},M=y=>{const t=new Uint8Array(4+y.length);return new DataView(t.buffer).setUint32(0,y.length,!1),t.set(y,4),t},C=y=>{let t=0;for(const n of y)t+=n.length;const s=new Uint8Array(t);let e=0;for(const n of y){const a=n;s.set(a,e),e+=a.length}return s},D=y=>{let t=\"unknown\";switch(y){case 1:case 2:case 27:case 36:t=\"video\";break;case 3:case 4:case 15:t=\"audio\";break;case 6:t=\"subtitle\";break;case 134:t=\"ad\";break}return t};class x{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async t=>{let s=0;for(;!(s+188>t.byteLength);){if(t.getInt8(s)!=71){s++;continue}await this.parsePacket(t,s),s+=188}return s};parsePacket=async(t,s)=>{if(s+188>t.byteLength)throw new Error(\"Invalid TS packet\");if(t.getUint8(s)!==71)throw new Error(\"Invalid TS packet\");let e=s;const n=this.parseHeader(t,e);e+=4;const{transport_error_indicator:a,pid:o,payload_unit_start_indicator:l,adaptation_field_control:i}=n;if(a===1||o===void 0)return;let c=184;if(i===2||i===3){const r=t.getUint8(e);e+=1,this.parseAdaptationField(t,e),e+=r,c-=r}if(i===3&&(c-=1),i===1||i===3){const r=new Uint8Array(t.buffer.slice(e,e+c));if(o===0)return this.parsePAT(t,e);{const{programs:h=[]}=this.pat||{};if(h.find(u=>u.pmt_pid===o))return this.parsePMT(t,e)}const{streams:g=[]}=this.pmt||{},p=g.find(h=>h.elementary_pid===o);if(p){if(l===1){const h=this.payloadMap.get(o);if(h){switch(p.kind){case\"audio\":{const d=await this.parseAudio(h);this.on.chunk&&this.on.chunk(d)}break;case\"video\":{const d=await this.parseVideo(h);this.on.chunk&&this.on.chunk(d),await new Promise(u=>setTimeout(()=>u(!0),0))}break}this.payloadMap.delete(o)}}{this.payloadMap.has(o)||this.payloadMap.set(o,new Uint8Array);const h=this.payloadMap.get(o),d=new Uint8Array(h.byteLength+r.byteLength);d.set(h,0),d.set(r,h.byteLength),this.payloadMap.set(o,d)}}}};parseHeader=(t,s)=>{let e=s;const n=t.getUint8(e),a=t.getUint8(e+1),o=t.getUint8(e+2),l=t.getUint8(e+3),i=(a&128)>>7;if(i===1)return{sync_byte:n,transport_error_indicator:i};const c=(a&64)>>6,r=(a&32)>>5,g=(a&31)<<8|o,p=(l&192)>>6,h=l>>4&3,d=l&15;return{sync_byte:n,transport_error_indicator:i,payload_unit_start_indicator:c,transport_priority:r,pid:g,transport_scrambling_control:p,adaptation_field_control:h,continuity_counter:d}};parsePAT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==0)throw new Error(\"Invalid PAT table_id\");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d}}const a=[];{const l=n.section_length-5-4,i=e+l;for(;e<i;){const c=t.getUint16(e),r=t.getUint16(e+2)&8191;e+=4,c!==0&&r>=32&&r<=8190&&a.push({program_number:c,pmt_pid:r})}}const o=t.getUint32(e);this.pat={header:n,programs:a,crc32:o},this.on.debug&&this.on.debug({pat:this.pat})};parsePMT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==2)throw new Error(\"Invalid PMT table_id\");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1;const u=t.getUint16(e)&8191;e+=2;const f=t.getUint16(e)&4095;e+=2,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d,pcr_pid:u,program_info_length:f}}const a=[];{const l=n.section_length-9-4,i=e+l;for(;e<i;){const c=t.getUint8(e),r=D(c),g=t.getUint16(e+1)&8191,p=t.getUint16(e+3)&4095;if(e+=5,g<32||g>8190){console.warn(`Invalid elementary_pid: 0x${g.toString(16)}`);continue}a.push({kind:r,stream_type:c,elementary_pid:g,es_info_length:p})}}const o=t.getUint32(e);this.pmt={header:n,streams:a,crc32:o},this.on.debug&&this.on.debug({pmt:this.pmt})};parseAdaptationField=(t,s)=>{let e=s,n,a,o,l;const i=t.getUint8(e),c=!!(i&128),r=!!(i&64),g=!!(i&32),p=!!(i&16),h=!!(i&8),d=!!(i&4),u=!!(i&2),f=!!(i&1);e+=1;const U=(_,b)=>{let m=BigInt(0);m|=BigInt(_.getUint16(b))<<25n,m|=BigInt(_.getUint16(b+1))<<17n,m|=BigInt(_.getUint16(b+2))<<9n,m|=BigInt(_.getUint16(b+3))<<1n,m|=BigInt(_.getUint16(b+4)>>7);const S=(_.getUint16(b+4)&1)<<8|_.getUint16(b+5);return m=m*300n+BigInt(S),m};if(p&&(n=U(t,e),e+=6),h&&(a=U(t,e),e+=6),d&&(o=t.getInt8(e),e+=1),u){const _=t.getUint8(e);e+=1,l=new Uint8Array(t.buffer,e,_),e+=_}return{discontinuity_indicator:c,random_access_indicator:r,elementary_stream_priority_indicator:g,pcr_flag:p,opcr_flag:h,splicing_point_flag:d,transport_private_data_flag:u,adaptation_field_extension_flag:f,pcr:n,opcr:a,splice_countdown:o,transport_private_data:l}};parseAudio=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error(\"invalid ts audio payload.\");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{if(!this.audioConfig&&s.getUint8(e)===255){const g=s.getUint8(e+2),p=s.getUint8(e+3);let h,d;d=g>>2&15,h=(g&1)<<2|p>>6;const u=`mp4a.40.${h}`,U=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][d];this.audioConfig={kind:\"audio\",codec:u,sampleRate:U,numberOfChannels:h},this.on.config&&this.on.config(this.audioConfig)}const{dts:o=0,pts:l=0}=n,i=l-o,c=a.slice(7);return{kind:\"audio\",type:\"key\",dts:o,pts:l,cts:i,data:c}}};parseVideo=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error(\"invalid ts video payload.\");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{const o=this.getNalus(a);if(!this.videoConfig){let h,d;if(h=o.find(f=>f.type===7)?.nalu.slice(4),d=o.find(f=>f.type===8)?.nalu.slice(4),h&&d){const u=I(h,d),{codec:f}=T(u);this.videoConfig={kind:\"video\",codec:f,description:u,sps:h,pps:d},this.on.config&&this.on.config(this.videoConfig)}}const l=[];let i=\"delta\";for(const h of o){const{type:d,nalu:u}=h;switch(d){case 6:case 9:l.push(u);break;case 1:i=\"delta\",l.push(u);break;case 5:i=\"key\",l.push(u);break}}const c=C(l),{dts:r=0,pts:g=0}=n,p=g-r;return{kind:\"video\",type:i,dts:r,pts:g,cts:p,data:c,nalus:l}}};parsePtsDts(t,s){const e=t.getUint8(s),n=t.getUint8(s+1),a=t.getUint8(s+2),o=t.getUint8(s+3),l=t.getUint8(s+4),i=(BigInt(e)&0b00001110n)<<29n|(BigInt(n)&0b11111111n)<<22n|(BigInt(a)&0b11111110n)<<14n|(BigInt(o)&0b11111111n)<<7n|(BigInt(l)&0b11111110n)>>1n;return Number(i)/90}getNalus=t=>{const s=[];let e=0;for(;!(e+4>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}e+=3;let n=e;const a=t[e]&31;for(e+=1;!(e+1>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}break}let o=e-n;if(t[e-1]===0&&(o-=1),o!==0){const l=t.slice(n,n+o),i=M(l);s.push({type:a,nalu:i})}}return s}}const k=(y,t)=>y.getUint8(t)<<16|y.getUint8(t+1)<<8|y.getUint8(t+2);class L{audioConfig;videoConfig;header;textDecoder=new TextDecoder(\"utf-8\");on={};constructor(){}parse=async t=>{let s=0;for(this.header||(this.parseHeader(t,s),s+=9);this.isSurplusTag(t,s)!==!1;){const n=this.parseTagHeader(t,s+4),{tagType:a,dataSize:o,timestamp:l}=n;if(a){const i=this.parseTagBody(a,t,s+4+11,o);switch(a){case\"script\":this.on.info&&this.on.info(i);break;case\"audio\":{const{accPacketType:c}=i;if(c===0){const{codec:r,sampleRate:g,channelConfiguration:p}=i;this.audioConfig={kind:\"audio\",codec:r,sampleRate:g,numberOfChannels:p},this.on.config&&this.on.config(this.audioConfig)}else{const{cts:r,data:g}=i,p=\"key\",h=r===void 0?void 0:r+l;this.on.chunk&&this.on.chunk({kind:\"audio\",type:p,dts:l,pts:h,cts:r,data:g})}}break;case\"video\":{const{avcPacketType:c}=i;if(c===0){const{codec:r,sps:g,pps:p,data:h}=i;this.videoConfig={kind:\"video\",codec:r,description:h,sps:g,pps:p},this.on.config&&this.on.config(this.videoConfig)}else{const{frameType:r,cts:g,data:p,nalus:h}=i,d=r===1?\"key\":\"delta\",u=g===void 0?void 0:g+l;this.on.chunk&&this.on.chunk({kind:\"video\",type:d,dts:l,pts:u,cts:g,data:p,nalus:h})}}break}s=s+4+11+o}await new Promise(i=>setTimeout(()=>i(!0),8))}return s};parseHeader=(t,s)=>{let e,n,a,o;e=t.getUint8(s)<<16|t.getUint8(s+1)<<8|t.getUint8(s+2),n=t.getUint8(3);{const i=t.getUint8(0).toString(2).padStart(5,\"0\").split(\"\"),[,,c,,r]=i;a={audio:r===\"1\",video:c===\"1\"}}o=t.getUint32(5),this.header={signature:e,version:n,flags:a,dataOffset:o}};isSurplusTag=(t,s)=>{let e=!0;const n=t.byteLength;if(s+4>n)e=!1;else if(s+4+11>n)e=!1;else{const a=k(t,s+4+1);s+4+11+a>n&&(e=!1)}return e};parseTagHeader=(t,s)=>{let e,n,a,o,l;{const i=t.getUint8(s);let c;switch(i){case 18:c=\"script\";break;case 8:c=\"audio\";break;case 9:c=\"video\";break}e=c}return n=k(t,s+1),a=k(t,s+4),o=t.getUint8(s+7),l=k(t,s+8),{tagType:e,dataSize:n,timestamp:a,timestampExtended:o,streamID:l}};parseTagBody=(t,s,e,n)=>{let a;switch(t){case\"script\":a=this.parseMetaData(s,e);break;case\"audio\":a=this.parseAudio(s,e,n);break;case\"video\":a=this.parseVideo(s,e,n);break}return a};parseMetaData=(t,s)=>{let e=s;{if(t.getUint8(e)!==2)throw new Error(\"Invalid AMF type for onMetaData (expected 0x02)\");e=e+1}const n=t.getUint16(e,!1);e=e+2;{const l=new Int8Array(t.buffer.slice(e,e+n));if((this.textDecoder?.decode(l)||\"\")!==\"onMetaData\")throw new Error(\"Expected 'onMetaData' string\");e=e+n}const a=this.getAmfType(t,e);return e=e+1,this.getAMFValue(t,e,a).value};parseAudio=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a>>2&3,i=a>>1&1,c=a&1;n=n+1;const r=t.getUint8(n);n=n+1;const g=e,p=new Uint8Array(t.buffer.slice(n,n+g));if(o===10&&r===0){const h=t.getUint8(n),d=t.getUint8(n+1),u=h>>3&31,f=(h&7)<<1|d>>7,U=d>>3&15,_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],b=`mp4a.40.${u}`,m=_[f];return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p,samplingFrequencyIndex:f,channelConfiguration:U,codec:b,sampleRate:m}}return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p}};parseVideo=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a&15;n=n+1;const i=t.getUint8(n);n=n+1;const c=k(t,n);n=n+3;const r=e-5,g=new Uint8Array(t.buffer.slice(n,n+r));switch(l){case 7:if(i===0){const p=T(g);return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,...p}}else if(i===1){const p=[],h=n+e-5;for(;!(n+4>h);){const d=t.getUint32(n,!1),u=new Uint8Array(t.buffer.slice(n,n+4+d));n+=4+d,p.push(u)}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,nalus:p}}break;default:throw new Error(\"Unsupported codecID\")}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g}};getAmfType=(t,s)=>t.getUint8(s);getAMFName=(t,s,e)=>{const n=new Uint8Array(t.buffer.slice(s,s+e));return this.textDecoder?.decode(n)||\"\"};getAMFValue=(t,s,e)=>{let n=s,a,o=0;switch(e){case 0:a=t.getFloat64(n,!1),o=8;break;case 1:a=!!t.getUint8(n),o=1;break;case 2:{a=\"\";const i=t.getUint16(n,!1);n=n+2;const c=new Int8Array(t.buffer,n,i).filter(g=>g!==0);a=(this.textDecoder?.decode(c)||\"\").trim(),o=2+i}break;case 3:for(a={};n<t.byteLength;){const i=t.getUint16(n,!1);if(i===0)break;n=n+2;const c=this.getAMFName(t,n,i);n=n+i;const r=this.getAmfType(t,n);if(r===6)break;n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a[c]=g.value,o=2+i+1+g.length}break;case 8:{a={};const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=t.getUint16(n,!1);n=n+2;const g=this.getAMFName(t,n,r);n=n+r;const p=this.getAmfType(t,n);n=n+1;const h=this.getAMFValue(t,n,p);n=n+h.length,a[g]=h.value,o=2+r+1+h.length}}break;case 10:{a=[];const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=this.getAmfType(t,n);n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a.push(g.value),o=1+g.length}}break}return{amfType:e,length:o,value:a}}}class O{pattern;cacher=new P;isParseing=!1;offset=0;parser;on={};constructor(){}init=t=>{switch(this.destroy(),this.pattern=t,this.pattern){case\"flv\":this.parser=new L;break;case\"hls\":this.parser=new x;break;default:throw new Error(\"is error pattern.\")}this.parser.on.debug=s=>this.on.debug&&this.on.debug(s),this.parser.on.info=s=>this.on.info&&this.on.info(s),this.parser.on.config=s=>this.on.config&&this.on.config(s),this.parser.on.chunk=s=>{this.cacher.pushChunk(s),this.on.chunk&&this.on.chunk(s)}};push=t=>{this.cacher.push(t),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw new Error(\"You need to set the pattern.\");if(!this.parser)throw new Error(\"You need to init parser.\");for(;;){const t=this.cacher.next(this.offset);if(this.offset=0,!t)break;this.offset=await this.parser.parse(t)}this.isParseing=!1}catch{this.destroy()}}}const A=new O;A.on.info=y=>postMessage({action:\"on.info\",data:y}),A.on.config=y=>postMessage({action:\"on.config\",data:y}),A.on.chunk=y=>postMessage({action:\"on.chunk\",data:y}),A.on.debug=y=>postMessage({action:\"on.debug\",data:y}),onmessage=y=>{const{action:t,data:s}=y.data,e=A[t];e&&e(s)}})();\n", xn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", bn], { type: "text/javascript;charset=utf-8" });
|
|
3859
|
-
function
|
|
3858
|
+
var xn = "(function(){var e=class{pendingPayloads=[];payload=new Uint8Array;chunks=[];push=e=>{this.pendingPayloads.push(e)};next=(e=0)=>{this.payload=this.payload.slice(e);let t=this.pendingPayloads.shift();if(!t)return!1;let n=new Uint8Array(this.payload.byteLength+t.byteLength);return n.set(this.payload,0),n.set(t,this.payload.byteLength),this.payload=n,new DataView(this.payload.buffer)};pushChunk=e=>{this.chunks.push(e),this.chunks.length>100&&this.chunks.shift()};discardPayload=()=>{this.payload=new Uint8Array};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array,this.chunks=[]}};let t=(e,t)=>{let n=new Uint8Array(e),r=new Uint8Array(t),i=new Uint8Array(11+n.length+r.length),a=0;return i[a++]=1,i[a++]=n[1],i[a++]=n[2],i[a++]=n[3],i[a++]=255,i[a++]=225,i[a++]=n.length>>8&255,i[a++]=n.length&255,i.set(n,a),a+=n.length,i[a++]=1,i[a++]=r.length>>8&255,i[a++]=r.length&255,i.set(r,a),i},n=e=>{let t=0,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n.getUint8(t);if(t+=1,r!==1)throw Error(`Invalid AVC version`);let i=n.getUint8(t)&255;t+=1;let a=n.getUint8(t)&255;t+=1;let o=n.getUint8(t)&255;t+=1;let s=`avc1.${Array.from([i,a,o],e=>e.toString(16).padStart(2,`0`)).join(``)}`;t+=1,t+=1;let c=n.getUint16(t,!1);t+=2;let l=new Uint8Array(e.buffer,e.byteOffset+t,c);t+=c,t+=1;let u=n.getUint16(t,!1);return t+=2,{version:r,codec:s,profile:i,compatibility:a,level:o,sps:l,pps:new Uint8Array(e.buffer,e.byteOffset+t,u)}},r=e=>{let t=new Uint8Array(4+e.length);return new DataView(t.buffer).setUint32(0,e.length,!1),t.set(e,4),t},i=e=>{let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n},a=(e,t)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),o=(e,t)=>{let n=a(e,t);return n&8388608&&(n|=-16777216),n},s=(e,t)=>t<<24|e,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];var l=class{audioConfig;videoConfig;header;textDecoder=new TextDecoder(`utf-8`);on={};constructor(){}parse=async e=>{let t=0;for(this.header||(this.parseHeader(e,t),t+=9);this.isSurplusTag(e,t)!==!1;){let{tagType:n,dataSize:r,dts:i}=this.parseTagHeader(e,t+4);if(n){let a=this.parseTagBody(n,e,t+4+11,r);if(!a){t=t+4+11+r,await new Promise(e=>setTimeout(()=>e(!0),8));continue}switch(n){case`script`:this.on.info&&this.on.info(a);break;case`audio`:{let{accPacketType:e}=a;if(e===0){let{codec:e,sampleRate:t,channelConfiguration:n,data:r}=a;this.audioConfig={kind:`audio`,codec:e,sampleRate:t,numberOfChannels:n,...r?{description:r}:{}},this.on.config&&this.on.config(this.audioConfig)}else{let{cts:e,data:t}=a,n=e===void 0?void 0:e+i;this.on.chunk&&this.on.chunk({kind:`audio`,type:`key`,dts:i,pts:n,cts:e,data:t})}}break;case`video`:{let{avcPacketType:e}=a;if(e===0){let{codec:e,sps:t,pps:n,data:r}=a;this.videoConfig={kind:`video`,codec:e,description:r,sps:t,pps:n},this.on.config&&this.on.config(this.videoConfig)}else{let{frameType:e,cts:t,data:n,nalus:r}=a,o=e===1?`key`:`delta`,s=t===void 0?void 0:t+i;this.on.chunk&&this.on.chunk({kind:`video`,type:o,dts:i,pts:s,cts:t,data:n,nalus:r})}}break}t=t+4+11+r}await new Promise(e=>setTimeout(()=>e(!0),8))}return t};parseHeader=(e,t)=>{let n,r,i,a;n=e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),r=e.getUint8(t+3);{let n=e.getUint8(t+4);i={audio:!!(n&4),video:!!(n&1)}}a=e.getUint32(t+5),this.header={signature:n,version:r,flags:i,dataOffset:a}};isSurplusTag=(e,t)=>{let n=!0,r=e.byteLength;if(t+4>r)n=!1;else if(t+4+11>r)n=!1;else{let i=a(e,t+4+1);t+4+11+i>r&&(n=!1)}return n};parseTagHeader=(e,t)=>{let n,r,i,o,c;{let r=e.getUint8(t),i;switch(r){case 18:i=`script`;break;case 8:i=`audio`;break;case 9:i=`video`;break}n=i}r=a(e,t+1),i=a(e,t+4),o=e.getUint8(t+7),c=a(e,t+8);let l=s(i,o);return{tagType:n,dataSize:r,timestamp:i,timestampExtended:o,dts:l,streamID:c}};parseTagBody=(e,t,n,r)=>{let i;switch(e){case`script`:i=this.parseMetaData(t,n);break;case`audio`:i=this.parseAudio(t,n,r);break;case`video`:i=this.parseVideo(t,n,r);break}return i};parseMetaData=(e,t)=>{let n=t;if(e.getUint8(n)!==2)return null;n+=1;let r=e.getUint16(n,!1);n+=2;{let t=new Int8Array(e.buffer.slice(n,n+r)),i=this.textDecoder?.decode(t)||``;if(n+=r,i!==`onMetaData`)return{name:i}}let i=this.getAmfType(e,n);return n+=1,this.getAMFValue(e,n,i).value};parseAudio=(e,t,n)=>{let r=t,i=e.getUint8(r),a=i>>4&15,o=i>>2&3,s=i>>1&1,l=i&1;r+=1;let u=e.getUint8(r);r+=1;let d=n-(r-t);if(d<=0)return{soundFormat:a,soundRate:o,soundSize:s,soundType:l,accPacketType:u,data:new Uint8Array};let f=new Uint8Array(e.buffer.slice(r,r+d));if(a===10&&u===0){let t=e.getUint8(r),n=e.getUint8(r+1),i=t>>3&31,d=(t&7)<<1|n>>7;return{soundFormat:a,soundRate:o,soundSize:s,soundType:l,accPacketType:u,data:f,samplingFrequencyIndex:d,channelConfiguration:n>>3&15,codec:`mp4a.40.${i}`,sampleRate:c[d]}}return{soundFormat:a,soundRate:o,soundSize:s,soundType:l,accPacketType:u,data:f}};parseVideo=(e,t,r)=>{let i=t,a=e.getUint8(i),s=a>>4&15,c=a&15;i+=1;let l=e.getUint8(i);i+=1;let u=o(e,i);i+=3;let d=r-5;if(d<0)return null;let f=new Uint8Array(e.buffer.slice(i,i+d));switch(c){case 7:if(l===0)return{frameType:s,codecID:c,avcPacketType:l,cts:u,data:f,...n(f)};if(l===1){let t=[],n=i+d;for(;!(i+4>n);){let r=e.getUint32(i,!1);if(r<=0||i+4+r>n)break;let a=new Uint8Array(e.buffer.slice(i,i+4+r));i+=4+r,t.push(a)}return{frameType:s,codecID:c,avcPacketType:l,cts:u,data:f,nalus:t}}break;default:return null}return{frameType:s,codecID:c,avcPacketType:l,cts:u,data:f}};getAmfType=(e,t)=>e.getUint8(t);getAMFName=(e,t,n)=>{let r=new Uint8Array(e.buffer.slice(t,t+n));return this.textDecoder?.decode(r)||``};getAMFValue=(e,t,n)=>{let r=t,i,a=0;switch(n){case 0:i=e.getFloat64(r,!1),a=8;break;case 1:i=!!e.getUint8(r),a=1;break;case 2:{i=``;let t=e.getUint16(r,!1);r+=2;let n=new Int8Array(e.buffer,r,t).filter(e=>e!==0);i=(this.textDecoder?.decode(n)||``).trim(),a=2+t}break;case 3:for(i={};r<e.byteLength;){let t=e.getUint16(r,!1);if(t===0)break;r+=2;let n=this.getAMFName(e,r,t);r+=t;let o=this.getAmfType(e,r);if(o===6)break;r+=1;let s=this.getAMFValue(e,r,o);r+=s.length,i[n]=s.value,a=2+t+1+s.length}break;case 8:{i={};let t=e.getUint32(r,!1);r+=4;for(let n=0;n<t;n++){let t=e.getUint16(r,!1);r+=2;let n=this.getAMFName(e,r,t);r+=t;let o=this.getAmfType(e,r);r+=1;let s=this.getAMFValue(e,r,o);r+=s.length,i[n]=s.value,a=2+t+1+s.length}}break;case 10:{i=[];let t=e.getUint32(r,!1);r+=4;for(let n=0;n<t;n++){let t=this.getAmfType(e,r);r+=1;let n=this.getAMFValue(e,r,t);r+=n.length,i.push(n.value),a=1+n.length}}break}return{amfType:n,length:a,value:i}}};let u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],d=e=>{let t=`unknown`;switch(e){case 1:case 2:case 27:case 36:t=`video`;break;case 3:case 4:case 15:t=`audio`;break;case 6:t=`subtitle`;break;case 134:t=`ad`;break}return t};var f=class{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async e=>{let t=0;for(;!(t+188>e.byteLength);){if(e.getInt8(t)!=71){t++;continue}await this.parsePacket(e,t),t+=188}return t};parsePacket=async(e,t)=>{if(t+188>e.byteLength||e.getUint8(t)!==71)throw Error(`Invalid TS packet`);let n=t,r=this.parseHeader(e,n);n+=4;let{transport_error_indicator:i,pid:a,payload_unit_start_indicator:o,adaptation_field_control:s}=r;if(i===1||a===void 0)return;let c=184;if(s===2||s===3){let t=e.getUint8(n);n+=1,t>0&&(this.parseAdaptationField(e,n),n+=t),c-=1+t}if(s===1||s===3){if(c<=0)return;let t=new Uint8Array(e.buffer.slice(n,n+c));if(a===0)return this.parsePAT(e,n);{let{programs:t=[]}=this.pat||{};if(t.find(e=>e.pmt_pid===a))return this.parsePMT(e,n)}let{streams:r=[]}=this.pmt||{},i=r.find(e=>e.elementary_pid===a);if(i){if(o===1){let e=this.payloadMap.get(a);if(e){switch(i.kind){case`audio`:{let t=await this.parseAudio(e);this.on.chunk&&this.on.chunk(t)}break;case`video`:{let t=await this.parseVideo(e);this.on.chunk&&this.on.chunk(t),await new Promise(e=>setTimeout(()=>e(!0),0))}break}this.payloadMap.delete(a)}}{this.payloadMap.has(a)||this.payloadMap.set(a,new Uint8Array);let e=this.payloadMap.get(a),n=new Uint8Array(e.byteLength+t.byteLength);n.set(e,0),n.set(t,e.byteLength),this.payloadMap.set(a,n)}}}};parseHeader=(e,t)=>{let n=t,r=e.getUint8(n),i=e.getUint8(n+1),a=e.getUint8(n+2),o=e.getUint8(n+3),s=(i&128)>>7;return s===1?{sync_byte:r,transport_error_indicator:s}:{sync_byte:r,transport_error_indicator:s,payload_unit_start_indicator:(i&64)>>6,transport_priority:(i&32)>>5,pid:(i&31)<<8|a,transport_scrambling_control:(o&192)>>6,adaptation_field_control:o>>4&3,continuity_counter:o&15}};parsePAT=(e,t)=>{let n=t,r;{let t=e.getUint8(n);n+=1;let i=e.getUint8(n);if(n+=1,i!==0)throw Error(`Invalid PAT table_id`);let a=e.getUint16(n)&4095;n+=2;let o=e.getUint16(n);n+=2;let s=(e.getUint8(n)&62)>>1,c=e.getUint8(n)&1;n+=1;let l=e.getUint8(n);n+=1;let u=e.getUint8(n);n+=1,r={pointer_field:t,table_id:i,section_length:a,transport_stream_id:o,version_number:s,current_next_indicator:c,section_number:l,last_section_number:u}}let i=[];{let t=r.section_length-5-4,a=n+t;for(;n<a;){let t=e.getUint16(n),r=e.getUint16(n+2)&8191;n+=4,t!==0&&r>=32&&r<=8190&&i.push({program_number:t,pmt_pid:r})}}let a=e.getUint32(n);this.pat={header:r,programs:i,crc32:a}};parsePMT=(e,t)=>{let n=t,r;{let t=e.getUint8(n);n+=1;let i=e.getUint8(n);if(n+=1,i!==2)throw Error(`Invalid PMT table_id`);let a=e.getUint16(n)&4095;n+=2;let o=e.getUint16(n);n+=2;let s=(e.getUint8(n)&62)>>1,c=e.getUint8(n)&1;n+=1;let l=e.getUint8(n);n+=1;let u=e.getUint8(n);n+=1;let d=e.getUint16(n)&8191;n+=2;let f=e.getUint16(n)&4095;n+=2,r={pointer_field:t,table_id:i,section_length:a,transport_stream_id:o,version_number:s,current_next_indicator:c,section_number:l,last_section_number:u,pcr_pid:d,program_info_length:f}}n+=r.program_info_length;let i=[];{let t=r.section_length-9-4,a=n+t;for(;n<a;){let t=e.getUint8(n),r=d(t),a=e.getUint16(n+1)&8191,o=e.getUint16(n+3)&4095;if(n+=5+o,a<32||a>8190){console.warn(`Invalid elementary_pid: 0x${a.toString(16)}`);continue}i.push({kind:r,stream_type:t,elementary_pid:a,es_info_length:o})}}let a=e.getUint32(n);this.pmt={header:r,streams:i,crc32:a}};parseAdaptationField=(e,t)=>{let n=t,r,i,a,o,s=e.getUint8(n),c=!!(s&128),l=!!(s&64),u=!!(s&32),d=!!(s&16),f=!!(s&8),p=!!(s&4),m=!!(s&2),h=!!(s&1);n+=1;let g=(e,t)=>{let n=BigInt(0);n|=BigInt(e.getUint16(t))<<25n,n|=BigInt(e.getUint16(t+1))<<17n,n|=BigInt(e.getUint16(t+2))<<9n,n|=BigInt(e.getUint16(t+3))<<1n,n|=BigInt(e.getUint16(t+4)>>7);let r=(e.getUint16(t+4)&1)<<8|e.getUint16(t+5);return n=n*300n+BigInt(r),n};if(d&&(r=g(e,n),n+=6),f&&(i=g(e,n),n+=6),p&&(a=e.getInt8(n),n+=1),m){let t=e.getUint8(n);n+=1,o=new Uint8Array(e.buffer,n,t),n+=t}return{discontinuity_indicator:c,random_access_indicator:l,elementary_stream_priority_indicator:u,pcr_flag:d,opcr_flag:f,splicing_point_flag:p,transport_private_data_flag:m,adaptation_field_extension_flag:h,pcr:r,opcr:i,splice_countdown:a,transport_private_data:o}};parseAudio=async e=>{let t=new DataView(e.buffer),n=0,r,i;{let e=t.getUint8(n)===0&&t.getUint8(n+1)===0&&t.getUint8(n+2)===1;if(n+=3,!e)throw Error(`invalid ts audio payload.`);let i=t.getUint8(n);n+=1;let a=t.getUint8(n)<<8|t.getUint8(n+1);n+=2;let o,s,c,l,u;{let e=t.getUint8(n);n+=1,o=e>>4&3,s=(e>>3&1)==1,c=(e>>2&1)==1,l=(e>>1&1)==1,u=(e&1)==1}let d,f;{let e=t.getUint8(n);n+=1;let r=e>>6,i=t.getUint8(n);n+=1,(r&2)==2&&(d=this.parsePtsDts(t,n)),f=(r&1)==1?this.parsePtsDts(t,n+5):d,n+=i}r={stream_id:i,pes_packet_length:a,scrambling_control:o,priority:s,data_alignment:c,copyright:l,original_copy:u,pts:d,dts:f}}i=e.slice(n);{let e=this.parseAdts(i);!this.audioConfig&&e&&(this.audioConfig={kind:`audio`,codec:e.codec,sampleRate:e.sampleRate,numberOfChannels:e.channelConfiguration},this.on.config&&this.on.config(this.audioConfig));let{dts:t=0,pts:n=0}=r;return{kind:`audio`,type:`key`,dts:t,pts:n,cts:n-t,data:e?i.slice(e.headerLength):i}}};parseAdts=e=>{if(e.length<7||e[0]!==255||(e[1]&240)!=240)return null;let t=e[1]&1?7:9;if(e.length<t)return null;let n=(e[2]>>6&3)+1,r=e[2]>>2&15,i=(e[2]&1)<<2|e[3]>>6,a=u[r]??44100;return{headerLength:t,codec:`mp4a.40.${n}`,sampleRate:a,channelConfiguration:i}};parseVideo=async e=>{let r=new DataView(e.buffer),a=0,o,s;{let e=r.getUint8(a)===0&&r.getUint8(a+1)===0&&r.getUint8(a+2)===1;if(a+=3,!e)throw Error(`invalid ts video payload.`);let t=r.getUint8(a);a+=1;let n=r.getUint8(a)<<8|r.getUint8(a+1);a+=2;let i,s,c,l,u;{let e=r.getUint8(a);a+=1,i=e>>4&3,s=(e>>3&1)==1,c=(e>>2&1)==1,l=(e>>1&1)==1,u=(e&1)==1}let d,f;{let e=r.getUint8(a);a+=1;let t=e>>6,n=r.getUint8(a);a+=1,(t&2)==2&&(d=this.parsePtsDts(r,a)),f=(t&1)==1?this.parsePtsDts(r,a+5):d,a+=n}o={stream_id:t,pes_packet_length:n,scrambling_control:i,priority:s,data_alignment:c,copyright:l,original_copy:u,pts:d,dts:f}}s=e.slice(a);{let e=this.getNalus(s);if(!this.videoConfig){let r,i;if(r=e.find(e=>e.type===7)?.nalu.slice(4),i=e.find(e=>e.type===8)?.nalu.slice(4),r&&i){let e=t(r,i),{codec:a}=n(e);this.videoConfig={kind:`video`,codec:a,description:e,sps:r,pps:i},this.on.config&&this.on.config(this.videoConfig)}}let r=[],a=`delta`;for(let t of e){let{type:e,nalu:n}=t;switch(e){case 6:case 9:r.push(n);break;case 1:a=`delta`,r.push(n);break;case 5:a=`key`,r.push(n);break}}let c=i(r),{dts:l=0,pts:u=0}=o,d=u-l;return{kind:`video`,type:a,dts:l,pts:u,cts:d,data:c,nalus:r}}};parsePtsDts(e,t){let n=e.getUint8(t),r=e.getUint8(t+1),i=e.getUint8(t+2),a=e.getUint8(t+3),o=e.getUint8(t+4),s=(BigInt(n)&14n)<<29n|(BigInt(r)&255n)<<22n|(BigInt(i)&254n)<<14n|(BigInt(a)&255n)<<7n|(BigInt(o)&254n)>>1n;return Number(s)/90}getNalus=e=>{let t=[],n=0;for(;n<e.byteLength-2;){let i=this.findAnnexBStart(e,n);if(!i)break;let a=e[i.naluOffset]&31,o=this.findAnnexBStart(e,i.nextSearchOffset),s=(o?o.startOffset:e.byteLength)-i.naluOffset;if(s>0){let n=e.slice(i.naluOffset,i.naluOffset+s);t.push({type:a,nalu:r(n)})}n=o?o.startOffset:e.byteLength}return t};findAnnexBStart=(e,t)=>{for(let n=t;n<e.length-2;n++)if(!(e[n]!==0||e[n+1]!==0)){if(e[n+2]===1)return{startOffset:n,naluOffset:n+3,nextSearchOffset:n+3};if(n+3<e.length&&e[n+2]===0&&e[n+3]===1)return{startOffset:n,naluOffset:n+4,nextSearchOffset:n+4}}return null}};let p=(e,t)=>String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3)),m=(e,t,n)=>{if(t+8>n)return null;let r=e.getUint32(t,!1),i=p(e,t+4),a=8;if(r===1){if(t+16>n)return null;r=Number(e.getBigUint64(t+8,!1)),a=16}else r===0&&(r=n-t);return r<a||t+r>n?null:{offset:t,size:r,type:i,headerSize:a,contentStart:t+a}},h=(e,t,n,r)=>{let i=t;for(;i<n;){let t=m(e,i,n);if(!t)break;r(t),i+=t.size}},g=(e,t,n,r)=>{let i=null;return h(e,t,n,t=>{if(t.type===r)i=t;else if(t.type!==`mdat`){let n=g(e,t.contentStart,t.offset+t.size,r);n&&(i=n)}}),i},_=(e,t,n,r)=>{for(let i=t;i+8<=n;i++){if(p(e,i+4)!==r)continue;let t=m(e,i,n);if(t?.type===r)return t}return null},v=(e,t,n,r,i=86)=>_(e,t+i,n,r)||_(e,t+8,n,r),y=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],b=(e,t)=>{let n=0,r=t;for(;r<e.length;){if(n=n<<7|e[r]&127,!(e[r]&128))return{len:n,next:r+1};r++}return{len:0,next:t}};var x=class{audioConfig;videoConfig;tracks=new Map;mdatBox=null;progressiveParsed=!1;on={};getDiscardOffset=(e,t)=>this.progressiveParsed||g(t,0,e,`moof`)||this.tracks.size>0&&!g(t,0,e,`mdat`)?e:0;constructor(){}parse=async e=>{let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=t.byteLength,r=0;for(;r<n;){let i=m(e,r,n);if(!i)return 0;switch(i.type){case`moov`:this.parseMoov(e,i),this.tryRunProgressive(e,t);break;case`moof`:this.parseMoof(e,i,t);break;case`mdat`:this.mdatBox=i,this.tryRunProgressive(e,t);break;case`sidx`:case`styp`:case`free`:case`skip`:case`ftyp`:break;default:break}r+=i.size,(i.type===`moov`||i.type===`moof`||i.type===`mdat`)&&await new Promise(e=>setTimeout(()=>e(!0),8))}return this.progressiveParsed?n:0};tryRunProgressive=(e,t)=>{if(this.progressiveParsed||this.tracks.size===0)return;let n=this.mdatBox??g(e,0,t.byteLength,`mdat`),r=g(e,0,t.byteLength,`moov`);!n||!r||this.isProgressiveReady(n,r,t.byteLength)&&(this.parseProgressive(e,n,t),this.progressiveParsed=!0)};isProgressiveReady=(e,t,n)=>e.offset+e.size<=n&&t.offset+t.size<=n;parseMoov=(e,t)=>{h(e,t.contentStart,t.offset+t.size,t=>{t.type===`trak`&&this.parseTrak(e,t)});let n=g(e,t.contentStart,t.offset+t.size,`mvex`);n&&h(e,n.contentStart,n.offset+n.size,t=>{if(t.type!==`trex`)return;let n=e.getUint32(t.contentStart+4,!1),r=this.tracks.get(n);r&&(r.defaultSampleDuration=e.getUint32(t.contentStart+12,!1),r.defaultSampleSize=e.getUint32(t.contentStart+16,!1))});let r=g(e,t.contentStart,t.offset+t.size,`mvhd`);if(r){let t=e.getUint8(r.contentStart),n=e.getUint32(r.contentStart+(t===1?20:12),!1),i=t===1?Number(e.getBigUint64(r.contentStart+24,!1)):e.getUint32(r.contentStart+16,!1);this.on.info?.({width:[...this.tracks.values()].find(e=>e.kind===`video`)?.width,height:[...this.tracks.values()].find(e=>e.kind===`video`)?.height,duration:n?i/n:void 0})}};readTkhdSize=(e,t)=>{let n=e.getUint8(t.contentStart),r=n===1?72:64,i=n===1?76:68;return{width:e.getUint32(t.contentStart+r,!1)>>16,height:e.getUint32(t.contentStart+i,!1)>>16}};readSampleEntrySize=(e,t)=>({width:e.getUint16(t+32,!1),height:e.getUint16(t+34,!1)});parseTrak=(e,t)=>{let r=g(e,t.contentStart,t.offset+t.size,`tkhd`),i=g(e,t.contentStart,t.offset+t.size,`mdia`);if(!r||!i)return;let a=e.getUint8(r.contentStart),o=e.getUint32(r.contentStart+(a===1?20:12),!1),{width:s,height:c}=this.readTkhdSize(e,r),l=g(e,i.contentStart,i.offset+i.size,`hdlr`),u=g(e,i.contentStart,i.offset+i.size,`mdhd`);if(!l||!u)return;let d=p(e,l.contentStart+8),f=d===`vide`?`video`:d===`soun`?`audio`:void 0;if(!f)return;let m=e.getUint8(u.contentStart),h=e.getUint32(u.contentStart+(m===1?20:12),!1);this.tracks.set(o,{kind:f,trackId:o,timescale:h,width:s,height:c});let _=g(e,i.contentStart,i.offset+i.size,`minf`),y=_&&g(e,_.contentStart,_.offset+_.size,`stbl`),b=y&&g(e,y.contentStart,y.offset+y.size,`stsd`);if(!b)return;let x=b.contentStart+8,S=x+e.getUint32(x,!1),C=p(e,x+4);if(f===`video`&&(C===`avc1`||C===`avc3`)){let t=this.readSampleEntrySize(e,x);t.width&&t.height&&(s=t.width,c=t.height);let r=v(e,x,S,`avcC`,86);if(!r)return;let i=new Uint8Array(e.buffer,r.contentStart,r.size-r.headerSize),a=n(i),o=a.codec.replace(/^avc1\\./,`${C}.`);this.videoConfig={kind:`video`,codec:o,description:i,sps:a.sps,pps:a.pps},this.on.config?.(this.videoConfig)}if(f===`video`){let e=this.tracks.get(o);e&&(e.width=s,e.height=c)}if(f===`audio`&&C===`mp4a`){let t=v(e,x,S,`esds`,36),n=t&&this.parseEsds(e,t);n&&(this.audioConfig=n,this.on.config?.(n))}};parseEsds=(e,t)=>{let n=new Uint8Array(e.buffer,t.contentStart,t.size-t.headerSize);for(let e=0;e<n.length-2;e++){if(n[e]!==5)continue;let{len:t,next:r}=b(n,e+1);if(t<2||r+t>n.length)continue;let i=n.slice(r,r+t),a=i[0],o=i[1],s=a>>3&31,c=(a&7)<<1|o>>7,l=o>>3&15;return{kind:`audio`,codec:`mp4a.40.${s}`,sampleRate:y[c]??44100,numberOfChannels:l,description:i}}return null};findMdatForMoof=(e,t,n)=>{let r=t.offset+t.size;for(;r+8<=n;){let t=m(e,r,n);if(!t||t.type===`moof`)break;if(t.type===`mdat`)return t;r+=t.size}return null};parseMoof=(e,t,n)=>{let r=this.findMdatForMoof(e,t,n.byteLength);r&&h(e,t.contentStart,t.offset+t.size,i=>{i.type===`traf`&&this.parseTraf(e,i,t.offset,r,n)})};ticksToMs=(e,t)=>e/t*1e3;readCttsOffsets=(e,t,n)=>{let r=new Int32Array(n);if(!t||n===0)return r;let i=e.getUint32(t.contentStart+4,!1),a=0,o=0,s=0,c=t.contentStart+8;for(let t=0;t<n;t++)o===0&&a<i&&(o=e.getUint32(c,!1),s=e.getInt32(c+4,!1),c+=8,a++),r[t]=s,--o;return r};parseTraf=(e,t,n,r,i)=>{let a=g(e,t.contentStart,t.offset+t.size,`tfhd`),o=g(e,t.contentStart,t.offset+t.size,`tfdt`),s=g(e,t.contentStart,t.offset+t.size,`trun`);if(!a||!o||!s)return;let c=e.getUint32(a.contentStart+4,!1),l=this.tracks.get(c);if(!l)return;let u=e.getUint32(a.contentStart,!1)&16777215,d=(u&131072)!=0,f=a.contentStart+8,p=null,m=0,h=0;u&1&&(p=Number(e.getBigUint64(f,!1)),f+=8),u&2&&(f+=4),u&8&&(m=e.getUint32(f,!1),f+=4),u&16&&(h=e.getUint32(f,!1),f+=4),u&32&&(f+=4),u&8||(m=l.defaultSampleDuration??0),u&16||(h=l.defaultSampleSize??0);let _=e.getUint8(o.contentStart)===1?Number(e.getBigUint64(o.contentStart+4,!1)):e.getUint32(o.contentStart+4,!1),v=e.getUint32(s.contentStart,!1)&16777215,y=s.offset+s.size,b=s.contentStart+4;if(b+4>y)return;let x=e.getUint32(b,!1);if(b+=4,x===0||x>1e4)return;let S=0;if(v&1){if(b+4>y)return;S=e.getInt32(b,!1),b+=4}v&4&&(b+=4);let C;C=d?n:p===null?r.offset:p;let w=C+(v&1?S:0),T=_;for(let t=0;t<x;t++){let t=m,n=h,r=0;if(v&256){if(b+4>y)break;t=e.getUint32(b,!1),b+=4}if(v&512){if(b+4>y)break;n=e.getUint32(b,!1),b+=4}if(v&1024){if(b+4>y)break;r=e.getUint32(b,!1),b+=4}let a=0;if(v&2048){if(b+4>y)break;a=e.getInt32(b,!1),b+=4}if(t<=0&&l.kind===`audio`){let e=this.audioConfig?.sampleRate??l.timescale;t=Math.round(1024*l.timescale/e)}if(n<=0)continue;if(w+n>i.byteLength)break;let o=i.slice(w,w+n);w+=n;let s=this.ticksToMs(T,l.timescale),c=this.ticksToMs(T+a,l.timescale),u=c-s,d=l.kind!==`video`||!(r>>16&1)||this.isAvccKeyFrame(o)?`key`:`delta`;if(l.kind===`video`){let e=this.splitAvccNalus(o);this.on.chunk?.({kind:`video`,type:d,dts:s,pts:c,cts:u,data:o,nalus:e})}else this.on.chunk?.({kind:`audio`,type:`key`,dts:s,pts:c,cts:u,data:o});T+=t}};parseProgressive=(e,t,n)=>{let r=g(e,0,n.byteLength,`moov`);if(!r)return;let i=[];h(e,r.contentStart,r.offset+r.size,t=>{if(t.type!==`trak`)return;let r=this.collectProgressiveTrackSamples(e,t,n);i.push(...r)}),i.sort((e,t)=>e.dts-t.dts||(e.kind===`video`?-1:1));for(let e of i)this.on.chunk?.(e)};collectProgressiveTrackSamples=(e,t,n)=>{let r=[],i=g(e,t.contentStart,t.offset+t.size,`tkhd`),a=g(e,t.contentStart,t.offset+t.size,`mdia`);if(!i||!a)return r;let o=e.getUint32(i.contentStart+(e.getUint8(i.contentStart)===1?20:12),!1),s=this.tracks.get(o);if(!s)return r;let c=g(e,a.contentStart,a.offset+a.size,`minf`),l=c&&g(e,c.contentStart,c.offset+c.size,`stbl`);if(!l)return r;let u=g(e,l.contentStart,l.offset+l.size,`stsz`),d=g(e,l.contentStart,l.offset+l.size,`stco`),f=g(e,l.contentStart,l.offset+l.size,`co64`),p=g(e,l.contentStart,l.offset+l.size,`stsc`),m=g(e,l.contentStart,l.offset+l.size,`stts`),h=g(e,l.contentStart,l.offset+l.size,`stss`),_=g(e,l.contentStart,l.offset+l.size,`ctts`);if(!u||!d&&!f||!m)return r;let v=e.getUint32(u.contentStart+4,!1),y=e.getUint32(u.contentStart+8,!1),b=this.readCttsOffsets(e,_,y),x=d?e.getUint32(d.contentStart+4,!1):e.getUint32(f.contentStart+4,!1),S=t=>d?e.getUint32(d.contentStart+8+(t-1)*4,!1):Number(e.getBigUint64(f.contentStart+8+(t-1)*8,!1)),C=new Set;if(h){let t=e.getUint32(h.contentStart+4,!1);for(let n=0;n<t;n++)C.add(e.getUint32(h.contentStart+8+n*4,!1))}let w=[];if(p){let t=e.getUint32(p.contentStart+4,!1);for(let n=0;n<t;n++){let t=p.contentStart+8+n*12;w.push({firstChunk:e.getUint32(t,!1),samplesPerChunk:e.getUint32(t+4,!1)})}}let T=e=>{if(w.length===0)return y===x?1:Math.max(1,Math.ceil(y/x));let t=w[0].samplesPerChunk;for(let n of w)if(n.firstChunk<=e)t=n.samplesPerChunk;else break;return t},E=0,D=m.contentStart+8,O=e.getUint32(m.contentStart+4,!1),k=0,A=O>0?e.getUint32(D,!1):0,j=O>0?e.getUint32(D+4,!1):0;D+=8;let M=1;for(let t=1;t<=x&&M<=y;t++){let i=T(t),a=S(t);for(let t=0;t<i&&M<=y;t++,M++){let t=v===0?e.getUint32(u.contentStart+12+(M-1)*4,!1):v;if(a+t>n.byteLength)return r;let i=n.slice(a,a+t);a+=t;let o=this.ticksToMs(E,s.timescale),c=b[M-1]??0,l=this.ticksToMs(E+c,s.timescale),d=l-o,f=s.kind===`video`?this.isAvccKeyFrame(i)||C.has(M)||C.size===0:!0;s.kind===`video`?r.push({kind:`video`,type:f?`key`:`delta`,dts:o,pts:l,cts:d,data:i,nalus:this.splitAvccNalus(i)}):r.push({kind:`audio`,type:`key`,dts:o,pts:l,cts:d,data:i}),E+=j,--A,A===0&&k+1<O&&(k+=1,D=m.contentStart+8+k*8,A=e.getUint32(D,!1),j=e.getUint32(D+4,!1))}}return r};isAvccKeyFrame=e=>{let t=0,n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;t+4<=e.byteLength;){let r=n.getUint32(t,!1);if(r<=0||t+4+r>e.byteLength)break;if((e[t+4]&31)==5)return!0;t+=4+r}return!1};splitAvccNalus=e=>{let t=[],n=0,r=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+4<=e.byteLength;){let i=r.getUint32(n,!1);if(i<=0||n+4+i>e.byteLength)break;t.push(e.slice(n,n+4+i)),n+=4+i}return t}};let S=new class{pattern;cacher=new e;isParseing=!1;offset=0;parser;on={};constructor(){}init=e=>{switch(this.destroy(),this.pattern=e,this.pattern){case`flv`:this.parser=new l;break;case`hls`:this.parser=new f;break;case`dash`:case`mp4`:this.parser=new x;break;default:throw Error(`is error pattern.`)}this.parser.on.info=e=>this.on.info&&this.on.info(e),this.parser.on.config=e=>this.on.config&&this.on.config(e),this.parser.on.chunk=e=>{this.cacher.pushChunk(e),this.on.chunk&&this.on.chunk(e)}};push=e=>{this.cacher.push(e),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw Error(`You need to set the pattern.`);if(!this.parser)throw Error(`You need to init parser.`);for(;;){let e=this.cacher.next(this.offset);if(this.offset=0,!e)break;try{let t=await this.parser.parse(e);if(this.pattern===`mp4`||this.pattern===`dash`){let t=this.parser;this.offset=t.getDiscardOffset(e.byteLength,e)}else this.offset=t}catch{this.cacher.discardPayload();continue}}this.isParseing=!1}catch{this.isParseing=!1,this.cacher.discardPayload()}}};S.on.info=e=>postMessage({action:`on.info`,data:e}),S.on.config=e=>postMessage({action:`on.config`,data:e}),S.on.chunk=e=>postMessage({action:`on.chunk`,data:e}),onmessage=e=>{let{action:t,data:n}=e.data,r=S[t];r&&r(n)}})();", Sn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", xn], { type: "text/javascript;charset=utf-8" });
|
|
3859
|
+
function Cn(e) {
|
|
3860
3860
|
let t;
|
|
3861
3861
|
try {
|
|
3862
|
-
if (t =
|
|
3862
|
+
if (t = Sn && (self.URL || self.webkitURL).createObjectURL(Sn), !t) throw "";
|
|
3863
3863
|
let n = new Worker(t, { name: e?.name });
|
|
3864
3864
|
return n.addEventListener("error", () => {
|
|
3865
3865
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
3866
3866
|
}), n;
|
|
3867
3867
|
} catch {
|
|
3868
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
3868
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(xn), { name: e?.name });
|
|
3869
3869
|
}
|
|
3870
3870
|
}
|
|
3871
|
-
var
|
|
3872
|
-
worker = new
|
|
3871
|
+
var wn = "pr-player-demuxer", Tn = class {
|
|
3872
|
+
worker = new Cn({ name: wn });
|
|
3873
3873
|
on = {};
|
|
3874
3874
|
constructor() {
|
|
3875
3875
|
this.worker.onmessage = (e) => {
|
|
@@ -3884,9 +3884,6 @@ var Cn = class {
|
|
|
3884
3884
|
case "on.chunk":
|
|
3885
3885
|
this.on.chunk && this.on.chunk(n);
|
|
3886
3886
|
break;
|
|
3887
|
-
case "on.debug":
|
|
3888
|
-
this.on.debug && this.on.debug(n);
|
|
3889
|
-
break;
|
|
3890
3887
|
}
|
|
3891
3888
|
};
|
|
3892
3889
|
}
|
|
@@ -3904,21 +3901,21 @@ var Cn = class {
|
|
|
3904
3901
|
data: {}
|
|
3905
3902
|
}), this.worker.terminate();
|
|
3906
3903
|
};
|
|
3907
|
-
},
|
|
3908
|
-
function
|
|
3904
|
+
}, En = "(function(){let e=new class{pattern=`flv`;audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[30,50],hls:[200,300],dash:[50,100],mp4:[30,50],rtmp:[50,100]};decodingSpeedRatio=1;maxDecodingSpeedRatio=2;decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=async e=>{if(this.audio.destroy(),!(await AudioDecoder.isConfigSupported(e).catch(()=>({supported:!1}))).supported){console.warn(`[Decoder] audio config not supported:`,e.codec,`audio will be skipped`),this.audioDecoderConfig=void 0,this.audioDecoder=void 0;return}this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:e=>{let t=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:e,playbackRate:t})},error:e=>{this.on.audio.error&&this.on.audio.error(e)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:e=>{this.frameStartTime||=e.timestamp;try{let t=e.timestamp-this.frameStartTime+this.baseTime*1e3,n=new VideoFrame(e,{timestamp:t});if(e.close(),!n.displayWidth||!n.displayHeight){n.close();return}this.on.video.decode?.({timestamp:t,frame:n}),this.currentChunk?.kind===`video`&&this.currentChunk.nalus&&this.on.nalus?.(this.currentChunk.nalus)}catch{e.close()}},error:e=>{this.on.video.error&&this.on.video.error(e)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),this.pendingChunks=[],this.firstVideoChunkTimestamp=void 0,this.secondVideoChunkTimestamp=void 0,this.frameStartTime=void 0,this.lastRenderTime=void 0,this.nextRenderTime=void 0,clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio,t=this.baseTime+performance.now();if(this.lastRenderTime||=t,this.fps=Math.round(1e3/(t-this.lastRenderTime)),this.lastRenderTime=t,this.nextRenderTime){let t=this.lastRenderTime-this.nextRenderTime;e-=t}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{try{this.decode()}catch(e){console.error(`[Decoder] decode error:`,e)}this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;this.currentChunk=this.pendingChunks.shift(),this.currentChunk;){let e=this.pendingChunks.length;if(this.frameTrack){let[t,n]=this.fameTrackOption[this.pattern];if(e<=t&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){let n=Math.min(1+(e-t)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(n.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.analysis){let{decodingSpeed:t,decodingSpeedRatio:n,fps:r}=this;this.on.analysis({decodingSpeed:t,decodingSpeedRatio:n,fps:r,cacheLength:e})}let{kind:t,init:n}=this.currentChunk;switch(t){case`audio`:this.decodeAudio(n);break;case`video`:this.decodeVideo(n);break}if(t===`video`)break}this.isProcessing=!1}};decodeAudio=e=>{if(this.audioDecoder)try{let t=new EncodedAudioChunk(e);this.audioDecoder.decode(t)}catch(e){console.warn(`[Decoder] audio decode error (AudioDecoder may be unusable):`,e)}};decodeVideo=e=>{if(this.videoDecoder&&(e.type===`key`&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){let t=new EncodedVideoChunk(e);this.videoDecoder.decode(t)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}};e.on.audio.decode=e=>postMessage({action:`on.audio.decode`,data:e},[e.audioData]),e.on.audio.error=e=>postMessage({action:`on.audio.error`,data:e}),e.on.video.decode=e=>postMessage({action:`on.video.decode`,data:e},[e.frame]),e.on.video.error=e=>postMessage({action:`on.video.error`,data:e}),e.on.nalus=e=>postMessage({action:`on.nalus`,data:e}),e.on.analysis=e=>postMessage({action:`on.analysis`,data:e}),onmessage=t=>{let{action:n,data:r}=t.data,i=e[n];i&&i(r)}})();", Dn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", En], { type: "text/javascript;charset=utf-8" });
|
|
3905
|
+
function On(e) {
|
|
3909
3906
|
let t;
|
|
3910
3907
|
try {
|
|
3911
|
-
if (t =
|
|
3908
|
+
if (t = Dn && (self.URL || self.webkitURL).createObjectURL(Dn), !t) throw "";
|
|
3912
3909
|
let n = new Worker(t, { name: e?.name });
|
|
3913
3910
|
return n.addEventListener("error", () => {
|
|
3914
3911
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
3915
3912
|
}), n;
|
|
3916
3913
|
} catch {
|
|
3917
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
3914
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(En), { name: e?.name });
|
|
3918
3915
|
}
|
|
3919
3916
|
}
|
|
3920
|
-
var
|
|
3921
|
-
worker = new
|
|
3917
|
+
var kn = "pr-player-decoder", An = class {
|
|
3918
|
+
worker = new On({ name: kn });
|
|
3922
3919
|
on = {
|
|
3923
3920
|
audio: {},
|
|
3924
3921
|
video: {}
|
|
@@ -3971,26 +3968,26 @@ var Dn = class {
|
|
|
3971
3968
|
destroy = () => {
|
|
3972
3969
|
this.worker.postMessage({ action: "destroy" }), this.worker.terminate();
|
|
3973
3970
|
};
|
|
3974
|
-
},
|
|
3975
|
-
function
|
|
3971
|
+
}, jn = "(function(){let e=new class{renderMap=new Map;constructor(){}push=async e=>{let t=e.frame,n=t.timestamp;try{let e=[...this.renderMap.entries()].filter(([,e])=>e&&!e.pause);if(e.length===1&&e[0][0]===\"default\"&&e[0][1].writer){e[0][1].writer.write(t).catch(()=>{}),t.close();return}for(let[r,i]of e){let{writer:e,offscreen:a,option:o}=i;if(e){let i;if(r===\"default\"||!o)i=new VideoFrame(t,{timestamp:n});else{let{sx:e=0,sy:r=0,sw:a=t.displayWidth,sh:s=t.displayHeight}=o;i=new VideoFrame(t,{visibleRect:{x:e,y:r,width:a,height:s},displayWidth:a,displayHeight:s,timestamp:n})}e.write(i).catch(()=>{}),i.close()}else if(a)if(r===\"default\"||!o)a.width=t.displayWidth,a.height=t.displayHeight,a.getContext(`2d`)?.drawImage(t,0,0);else{let{sx:e=0,sy:n=0,sw:r=t.displayWidth,sh:i=t.displayHeight}=o;a.width=r,a.height=i,a.getContext(`2d`)?.drawImage(t,e,n,r,i,0,0,r,i)}}}catch{}t.close()};addCut=e=>{let{key:t,writable:n,offscreen:r,cutOption:i}={key:`default`,...e},a=this._getSafeSize(i);if(n){let e=n.getWriter();this.renderMap.set(t,{writer:e,option:a,pause:!1})}else this.renderMap.set(t,{offscreen:r,option:a,pause:!1})};delCut=e=>{this.renderMap.delete(e)};setCut=e=>{let{key:t,cutOption:n}={key:`default`,...e},r=this.renderMap.get(t);if(r){let e=this._getSafeSize(n);this.renderMap.set(t,{...r,option:e})}};setPause=e=>{let{key:t,pause:n}={key:`default`,...e},r=this.renderMap.get(t);r&&this.renderMap.set(t,{...r,pause:n})};_getSafeSize=e=>{let t={...e};return t.sx%2!=0&&(t.sx+=1),t.sy%2!=0&&(t.sy+=1),t.sw%2!=0&&--t.sw,t.sh%2!=0&&--t.sh,t};destroy=()=>{this.renderMap=new Map}};onmessage=t=>{let{action:n,data:r}=t.data,i=e[n];i&&i(r)}})();", Mn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jn], { type: "text/javascript;charset=utf-8" });
|
|
3972
|
+
function Nn(e) {
|
|
3976
3973
|
let t;
|
|
3977
3974
|
try {
|
|
3978
|
-
if (t =
|
|
3975
|
+
if (t = Mn && (self.URL || self.webkitURL).createObjectURL(Mn), !t) throw "";
|
|
3979
3976
|
let n = new Worker(t, { name: e?.name });
|
|
3980
3977
|
return n.addEventListener("error", () => {
|
|
3981
3978
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
3982
3979
|
}), n;
|
|
3983
3980
|
} catch {
|
|
3984
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
3981
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(jn), { name: e?.name });
|
|
3985
3982
|
}
|
|
3986
3983
|
}
|
|
3987
|
-
var
|
|
3988
|
-
worker = new
|
|
3984
|
+
var Pn = "pr-player-render", Fn = class {
|
|
3985
|
+
worker = new Nn({ name: Pn });
|
|
3989
3986
|
constructor() {}
|
|
3990
3987
|
push = (e) => this.worker.postMessage({
|
|
3991
3988
|
action: "push",
|
|
3992
3989
|
data: e
|
|
3993
|
-
}, [e.
|
|
3990
|
+
}, [e.frame]);
|
|
3994
3991
|
addCut = (e) => {
|
|
3995
3992
|
let t = [];
|
|
3996
3993
|
e.writable && t.push(e.writable), e.offscreen && t.push(e.offscreen), this.worker.postMessage({
|
|
@@ -4016,7 +4013,15 @@ var jn = class {
|
|
|
4016
4013
|
data: {}
|
|
4017
4014
|
}), this.worker.terminate();
|
|
4018
4015
|
};
|
|
4019
|
-
},
|
|
4016
|
+
}, In = "data:text/javascript;base64,LyoqDQogKiDpnZnpn7Pml7bvvJrlnKjpopHln5/ku4Xkv53nlZkgYmluIDDvvZ4077yI6ZqP5py677yJ77yM5YW25L2Z5Li6IDDvvIzlho3lkIjmiJDml7bln5/lhpnlhaXovpPlh7og4oCUIOWNs+S/ruaUueecn+WuniBQQ03vvIznu48gQW5hbHlzZXIoZmZ0U2l6ZT01MTIpIOaXtuWJjSA1IOS4qiBiaW4g5pyJ6IO96YeP44CB5YW25L2Z5o6l6L+RIDDjgIINCiAqIFBFUklPRCDpobvkuI4gUHJBdWRpb1N0cmVhbSDkuK0gYW5hbHlzZXJOb2RlLmZmdFNpemUg5LiA6Ie044CCDQogKi8NCmNsYXNzIE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3NvciBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3NvciB7DQogIGlzRGVzdHJveSA9IGZhbHNlDQogIGRlYnVnID0gZmFsc2UNCg0KICBzdGF0aWMgU0lMRU5DRV9FUFMgPSAxZS0xNQ0KDQogIC8qKiDkuI4gc3JjL1ByQXVkaW9TdHJlYW0udHMg6YeMIGFuYWx5c2VyTm9kZS5mZnRTaXplIOS/neaMgeS4gOiHtCAqLw0KICBzdGF0aWMgUEVSSU9EID0gNTEyDQoNCiAgLyoqIGJpbiAw772eNCDpmo/mnLrlpI3mlbDvvIjlrp7pg6gv6Jma6YOo77yJ55qE5aSn6Ie05bmF5bqm5bC65bqm77yM5Y+v5oyJ5ZCs5oSfL+e8lueggeWGjeiwgyAqLw0KICBzdGF0aWMgQklOX1NDQUxFID0gMC4wMg0KDQogIGNvbnN0cnVjdG9yKCkgew0KICAgIHN1cGVyKCkNCiAgICB0aGlzLl9zaWxlbnRQY20gPSBuZXcgRmxvYXQzMkFycmF5KE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5QRVJJT0QpDQogICAgdGhpcy5fc2lsZW50T2ZmID0gTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yLlBFUklPRA0KICB9DQoNCiAgc3RhdGljIGFsbElucHV0c1NpbGVudChpbnB1dHMpIHsNCiAgICBjb25zdCBlcHMgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuU0lMRU5DRV9FUFMNCiAgICBmb3IgKGxldCBuaSA9IDA7IG5pIDwgaW5wdXRzLmxlbmd0aDsgbmkrKykgew0KICAgICAgY29uc3QgaW5wdXQgPSBpbnB1dHNbbmldDQogICAgICBpZiAoIWlucHV0KSBjb250aW51ZQ0KICAgICAgZm9yIChsZXQgY2ggPSAwOyBjaCA8IGlucHV0Lmxlbmd0aDsgY2grKykgew0KICAgICAgICBjb25zdCBjaGFubmVsID0gaW5wdXRbY2hdDQogICAgICAgIGlmICghY2hhbm5lbCkgY29udGludWUNCiAgICAgICAgY29uc3QgbiA9IGNoYW5uZWwubGVuZ3RoDQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbjsgaSsrKSB7DQogICAgICAgICAgaWYgKE1hdGguYWJzKGNoYW5uZWxbaV0pID49IGVwcykgcmV0dXJuIGZhbHNlDQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIC8qKg0KICAgKiDku4UgYmluIDAuLjQg6Z2e6Zu277yI6ZqP5py677yJ77yM5ruh6Laz5a6e5L+h5Y+3IElERlTvvIzlhpnlhaUgdGhpcy5fc2lsZW50UGNtDQogICAqLw0KICByZWZpbGxTaWxlbnRQY21Gcm9tRml2ZUJpbnMoKSB7DQogICAgY29uc3QgTiA9IE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5QRVJJT0QNCiAgICBjb25zdCBzY2FsZSA9IE5vdEVtcHR5RmlsdGVyV29ya2xldFByb2Nlc3Nvci5CSU5fU0NBTEUNCiAgICBjb25zdCByZSA9IG5ldyBGbG9hdDY0QXJyYXkoNSkNCiAgICBjb25zdCBpbSA9IG5ldyBGbG9hdDY0QXJyYXkoNSkNCiAgICByZVswXSA9IChNYXRoLnJhbmRvbSgpICogMiAtIDEpICogc2NhbGUNCiAgICBpbVswXSA9IDANCiAgICBmb3IgKGxldCBrID0gMTsgayA8PSA0OyBrKyspIHsNCiAgICAgIHJlW2tdID0gKE1hdGgucmFuZG9tKCkgKiAyIC0gMSkgKiBzY2FsZQ0KICAgICAgaW1ba10gPSAoTWF0aC5yYW5kb20oKSAqIDIgLSAxKSAqIHNjYWxlDQogICAgfQ0KICAgIGNvbnN0IGludk4gPSAxIC8gTg0KICAgIGNvbnN0IHR3b1BpT3Zlck4gPSAoMiAqIE1hdGguUEkpIC8gTg0KICAgIGZvciAobGV0IG4gPSAwOyBuIDwgTjsgbisrKSB7DQogICAgICBsZXQgcyA9IHJlWzBdDQogICAgICBmb3IgKGxldCBrID0gMTsgayA8PSA0OyBrKyspIHsNCiAgICAgICAgY29uc3QgYW5nID0gdHdvUGlPdmVyTiAqIGsgKiBuDQogICAgICAgIHMgKz0gMiAqIChyZVtrXSAqIE1hdGguY29zKGFuZykgLSBpbVtrXSAqIE1hdGguc2luKGFuZykpDQogICAgICB9DQogICAgICB0aGlzLl9zaWxlbnRQY21bbl0gPSBzICogaW52Tg0KICAgIH0NCiAgICB0aGlzLl9zaWxlbnRPZmYgPSAwDQogIH0NCg0KICBmaWxsT3V0cHV0c1NwYXJzZUZpdmVCaW5zKG91dHB1dHMpIHsNCiAgICBjb25zdCBmaXJzdCA9IG91dHB1dHNbMF0NCiAgICBpZiAoIWZpcnN0IHx8ICFmaXJzdFswXSkgcmV0dXJuDQogICAgY29uc3QgZnJhbWVMZW4gPSBmaXJzdFswXS5sZW5ndGgNCg0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZnJhbWVMZW47IGkrKykgew0KICAgICAgaWYgKHRoaXMuX3NpbGVudE9mZiA+PSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EKSB7DQogICAgICAgIHRoaXMucmVmaWxsU2lsZW50UGNtRnJvbUZpdmVCaW5zKCkNCiAgICAgIH0NCiAgICAgIGNvbnN0IHYgPSB0aGlzLl9zaWxlbnRQY21bdGhpcy5fc2lsZW50T2ZmKytdDQogICAgICBmb3IgKGxldCBubyA9IDA7IG5vIDwgb3V0cHV0cy5sZW5ndGg7IG5vKyspIHsNCiAgICAgICAgY29uc3Qgb3V0UG9ydHMgPSBvdXRwdXRzW25vXQ0KICAgICAgICBpZiAoIW91dFBvcnRzKSBjb250aW51ZQ0KICAgICAgICBmb3IgKGxldCBjaCA9IDA7IGNoIDwgb3V0UG9ydHMubGVuZ3RoOyBjaCsrKSB7DQogICAgICAgICAgY29uc3QgY2hhbm5lbCA9IG91dFBvcnRzW2NoXQ0KICAgICAgICAgIGlmIChjaGFubmVsKSBjaGFubmVsW2ldID0gdg0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgc3RhdGljIGNvcHlJbnB1dHNUb091dHB1dHMoaW5wdXRzLCBvdXRwdXRzKSB7DQogICAgZm9yIChsZXQgbm8gPSAwOyBubyA8IG91dHB1dHMubGVuZ3RoOyBubysrKSB7DQogICAgICBjb25zdCBvdXRQb3J0cyA9IG91dHB1dHNbbm9dDQogICAgICBjb25zdCBpblBvcnRzID0gaW5wdXRzW25vXQ0KICAgICAgaWYgKCFvdXRQb3J0cykgY29udGludWUNCiAgICAgIGZvciAobGV0IGNoID0gMDsgY2ggPCBvdXRQb3J0cy5sZW5ndGg7IGNoKyspIHsNCiAgICAgICAgY29uc3Qgb3V0Q2ggPSBvdXRQb3J0c1tjaF0NCiAgICAgICAgaWYgKCFvdXRDaCkgY29udGludWUNCiAgICAgICAgY29uc3QgaW5DaCA9IGluUG9ydHMgJiYgaW5Qb3J0c1tjaF0NCiAgICAgICAgaWYgKGluQ2ggJiYgaW5DaC5sZW5ndGggPT09IG91dENoLmxlbmd0aCkgew0KICAgICAgICAgIG91dENoLnNldChpbkNoKQ0KICAgICAgICB9IGVsc2UgaWYgKGluQ2gpIHsNCiAgICAgICAgICBjb25zdCBuID0gTWF0aC5taW4oaW5DaC5sZW5ndGgsIG91dENoLmxlbmd0aCkNCiAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG47IGkrKykgb3V0Q2hbaV0gPSBpbkNoW2ldDQogICAgICAgICAgZm9yIChsZXQgaSA9IG47IGkgPCBvdXRDaC5sZW5ndGg7IGkrKykgb3V0Q2hbaV0gPSAwDQogICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgb3V0Q2guZmlsbCgwKQ0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMpIHsNCiAgICBpZiAodGhpcy5pc0Rlc3Ryb3kpIHJldHVybiBmYWxzZQ0KDQogICAgaWYgKHRoaXMuZGVidWcpIHsNCiAgICAgIGNvbnNvbGUubG9nKCdceDFiWzM4OzI7MDsxNTE7MjU1bSVjJXNceDFiWzBtJywgJ2NvbG9yOiMwMDk3ZmY7JywgJy0tLS0tLS0+QnJlYXRoZTogaW5wdXRzJywgaW5wdXRzKQ0KICAgIH0NCg0KICAgIGlmIChOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuYWxsSW5wdXRzU2lsZW50KGlucHV0cykpIHsNCiAgICAgIHRoaXMuZmlsbE91dHB1dHNTcGFyc2VGaXZlQmlucyhvdXRwdXRzKQ0KICAgIH0gZWxzZSB7DQogICAgICB0aGlzLl9zaWxlbnRPZmYgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EDQogICAgICBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuY29weUlucHV0c1RvT3V0cHV0cyhpbnB1dHMsIG91dHB1dHMpDQogICAgfQ0KDQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIGRlc3Ryb3koKSB7DQogICAgdGhpcy5pc0Rlc3Ryb3kgPSB0cnVlDQogIH0NCn0NCg0KcmVnaXN0ZXJQcm9jZXNzb3IoJ25vdC1lbXB0eS1maWx0ZXItcHJvY2Vzc29yJywgTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yKQ0K", Ln = class {
|
|
4017
|
+
audioContext = new AudioContext();
|
|
4018
|
+
notEmptyFilterWorkletNode;
|
|
4019
|
+
constructor() {}
|
|
4020
|
+
createNotEmptyFilterWorkletNode = async (e) => (this.destroy(), this.audioContext = e, await this.audioContext.audioWorklet.addModule(In), this.notEmptyFilterWorkletNode = new AudioWorkletNode(this.audioContext, "not-empty-filter-processor"), this.notEmptyFilterWorkletNode);
|
|
4021
|
+
destroy = () => {
|
|
4022
|
+
this.notEmptyFilterWorkletNode?.disconnect(), this.notEmptyFilterWorkletNode?.port.postMessage({ type: "destroy" }), this.notEmptyFilterWorkletNode = void 0;
|
|
4023
|
+
};
|
|
4024
|
+
}, Rn = class {
|
|
4020
4025
|
inputStream = new MediaStream();
|
|
4021
4026
|
outputStream = new MediaStream();
|
|
4022
4027
|
inputGain = 1;
|
|
@@ -4026,6 +4031,7 @@ var jn = class {
|
|
|
4026
4031
|
outputGain = 1;
|
|
4027
4032
|
mixAudioMap = /* @__PURE__ */ new Map();
|
|
4028
4033
|
audioContext = new AudioContext();
|
|
4034
|
+
isExternalAudioContext = !1;
|
|
4029
4035
|
sourceNode;
|
|
4030
4036
|
inputGainNode;
|
|
4031
4037
|
enhanceGainNode;
|
|
@@ -4038,11 +4044,14 @@ var jn = class {
|
|
|
4038
4044
|
destinationNode;
|
|
4039
4045
|
denoise = !1;
|
|
4040
4046
|
mute = !0;
|
|
4047
|
+
notEmpty = !1;
|
|
4041
4048
|
rnnoiseWorklet;
|
|
4042
4049
|
rnnoiseWorkletNode;
|
|
4050
|
+
notEmptyFilterWorklet = new Ln();
|
|
4051
|
+
notEmptyFilterWorkletNode;
|
|
4043
4052
|
filterStream = (e) => e;
|
|
4044
4053
|
constructor(e, t) {
|
|
4045
|
-
this.inputStream = e, t && (this.audioContext = t), this.sourceNode = this.audioContext.createMediaStreamSource(this.inputStream), this.inputGainNode = this.audioContext.createGain(), this.inputGainNode.gain.setValueAtTime(this.inputGain, this.audioContext.currentTime), this.enhanceGainNode = this.audioContext.createGain(), this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime), this.bgsGainNode = this.audioContext.createGain(), this.bgsGainNode.gain.setValueAtTime(this.bgsGain, this.audioContext.currentTime), this.bgmGainNode = this.audioContext.createGain(), this.bgmGainNode.gain.setValueAtTime(this.bgmGain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount), this.outputGainNode = this.audioContext.createGain(), this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime), this.destinationNode = this.audioContext.createMediaStreamDestination(), this.outputStream = this.destinationNode.stream;
|
|
4054
|
+
this.inputStream = e, t && (this.audioContext = t, this.isExternalAudioContext = !0), this.sourceNode = this.audioContext.createMediaStreamSource(this.inputStream), this.inputGainNode = this.audioContext.createGain(), this.inputGainNode.gain.setValueAtTime(this.inputGain, this.audioContext.currentTime), this.enhanceGainNode = this.audioContext.createGain(), this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime), this.bgsGainNode = this.audioContext.createGain(), this.bgsGainNode.gain.setValueAtTime(this.bgsGain, this.audioContext.currentTime), this.bgmGainNode = this.audioContext.createGain(), this.bgmGainNode.gain.setValueAtTime(this.bgmGain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount), this.outputGainNode = this.audioContext.createGain(), this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime), this.destinationNode = this.audioContext.createMediaStreamDestination(), this.outputStream = this.destinationNode.stream;
|
|
4046
4055
|
{
|
|
4047
4056
|
let { sourceNode: e, inputGainNode: t, enhanceGainNode: n, bgsGainNode: r, bgmGainNode: i, analyserNode: a, outputGainNode: o, destinationNode: s } = this;
|
|
4048
4057
|
e.connect(t), t.connect(n), n.connect(a), r.connect(a), i.connect(a), n.connect(s), r.connect(s), i.connect(s), o.connect(this.audioContext.destination);
|
|
@@ -4075,7 +4084,10 @@ var jn = class {
|
|
|
4075
4084
|
this.mute = e, this.analyserNode.disconnect(), e === !1 && this.analyserNode.connect(this.outputGainNode);
|
|
4076
4085
|
};
|
|
4077
4086
|
setDenoise = async (e = !0) => {
|
|
4078
|
-
this.rnnoiseWorklet && (this.inputGainNode.disconnect(),
|
|
4087
|
+
this.rnnoiseWorklet && (this.inputGainNode.disconnect(), e ? (this.rnnoiseWorkletNode = await this.rnnoiseWorklet.createRnnoiseWorkletNode(this.audioContext), this.inputGainNode.connect(this.rnnoiseWorkletNode), this.rnnoiseWorkletNode.connect(this.enhanceGainNode)) : (this.inputGainNode.connect(this.enhanceGainNode), this.rnnoiseWorklet.destroy()), this.denoise = e);
|
|
4088
|
+
};
|
|
4089
|
+
setNotEmpty = async (e = !0) => {
|
|
4090
|
+
this.notEmptyFilterWorklet && (e ? (this.notEmptyFilterWorkletNode = await this.notEmptyFilterWorklet.createNotEmptyFilterWorkletNode(this.audioContext), this.notEmptyFilterWorkletNode.connect(this.analyserNode), this.notEmptyFilterWorkletNode.connect(this.destinationNode)) : (this.notEmptyFilterWorkletNode?.disconnect(), this.notEmptyFilterWorklet.destroy()), this.notEmpty = e);
|
|
4079
4091
|
};
|
|
4080
4092
|
setInputGain = (e) => {
|
|
4081
4093
|
this.inputGain = e, this.inputGainNode.gain.setValueAtTime(e, this.audioContext.currentTime);
|
|
@@ -4120,7 +4132,14 @@ var jn = class {
|
|
|
4120
4132
|
let n = e === "bgs" ? this.bgsGainNode : this.bgmGainNode;
|
|
4121
4133
|
t ? n.connect(this.destinationNode) : n.disconnect(this.destinationNode);
|
|
4122
4134
|
};
|
|
4123
|
-
|
|
4135
|
+
destroy = async () => {
|
|
4136
|
+
for (let e of this.mixAudioMap.values()) e.stop(), e.disconnect();
|
|
4137
|
+
this.mixAudioMap.clear(), this.notEmptyFilterWorklet.destroy(), this.rnnoiseWorklet?.destroy(), this.notEmptyFilterWorkletNode = void 0, this.rnnoiseWorkletNode = void 0, this.sourceNode.disconnect(), this.inputGainNode.disconnect(), this.enhanceGainNode.disconnect(), this.bgsGainNode.disconnect(), this.bgmGainNode.disconnect(), this.analyserNode.disconnect(), this.outputGainNode.disconnect();
|
|
4138
|
+
for (let e of this.inputStream.getTracks()) e.stop(), this.inputStream.removeTrack(e);
|
|
4139
|
+
for (let e of this.outputStream.getTracks()) e.stop(), this.outputStream.removeTrack(e);
|
|
4140
|
+
this.notEmpty = !1, this.denoise = !1, this.mute = !0, !this.isExternalAudioContext && this.audioContext.state !== "closed" && await this.audioContext.close();
|
|
4141
|
+
};
|
|
4142
|
+
}, zn = async (e, t) => {
|
|
4124
4143
|
try {
|
|
4125
4144
|
let { format: n, numberOfChannels: r, numberOfFrames: i, sampleRate: a } = t, o = e.createBuffer(r, i, a);
|
|
4126
4145
|
for (let e = 0; e < r; e++) {
|
|
@@ -4151,7 +4170,7 @@ var jn = class {
|
|
|
4151
4170
|
} catch (e) {
|
|
4152
4171
|
throw console.error("Failed to convert AudioData to AudioBuffer:", e), e;
|
|
4153
4172
|
}
|
|
4154
|
-
},
|
|
4173
|
+
}, Bn = class {
|
|
4155
4174
|
prAudioStream;
|
|
4156
4175
|
audioContext;
|
|
4157
4176
|
destination;
|
|
@@ -4160,33 +4179,33 @@ var jn = class {
|
|
|
4160
4179
|
pendingSources = [];
|
|
4161
4180
|
constructor() {}
|
|
4162
4181
|
init = (e) => {
|
|
4163
|
-
e ||= new (window.AudioContext || window.webkitAudioContext)(), this.audioContext = e, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new
|
|
4182
|
+
e ||= new (window.AudioContext || window.webkitAudioContext)(), this.audioContext = e, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new Rn(this.stream, this.audioContext), this.nextStartTime = 0, this.pendingSources = [];
|
|
4164
4183
|
};
|
|
4165
4184
|
async push(e) {
|
|
4166
4185
|
let { audioData: t, playbackRate: n = 1 } = e;
|
|
4167
4186
|
if (!this.audioContext || !this.destination) return;
|
|
4168
|
-
let r = await
|
|
4187
|
+
let r = await zn(this.audioContext, t);
|
|
4169
4188
|
if (t.close(), !r) return;
|
|
4170
4189
|
let i = this.audioContext.createBufferSource();
|
|
4171
4190
|
i.buffer = r, i.playbackRate.value = n;
|
|
4172
4191
|
let a = -1200 * Math.log2(n);
|
|
4173
4192
|
i.detune.value = a, i.connect(this.destination);
|
|
4174
|
-
let o = Math.max(this.nextStartTime, this.audioContext.currentTime);
|
|
4175
|
-
this.nextStartTime = o +
|
|
4193
|
+
let o = Math.max(this.nextStartTime, this.audioContext.currentTime), s = r.duration / n;
|
|
4194
|
+
this.nextStartTime = o + s, i.start(o), this.pendingSources.push(i), i.onended = () => {
|
|
4176
4195
|
this.pendingSources = this.pendingSources.filter((e) => e !== i);
|
|
4177
4196
|
}, this.audioContext.state === "suspended" && await this.audioContext.resume();
|
|
4178
4197
|
}
|
|
4179
4198
|
getStream = () => this.prAudioStream?.getStream();
|
|
4180
4199
|
destroy() {
|
|
4181
|
-
this.audioContext?.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, this.prAudioStream?.stop(), this.pendingSources.forEach((e) => e.stop()), this.pendingSources = [];
|
|
4200
|
+
this.audioContext?.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, this.prAudioStream?.stop(), this.prAudioStream?.destroy(), this.pendingSources.forEach((e) => e.stop()), this.pendingSources = [];
|
|
4182
4201
|
}
|
|
4183
|
-
},
|
|
4202
|
+
}, Vn = (e) => {
|
|
4184
4203
|
let t = e.toLowerCase();
|
|
4185
|
-
return t.includes(".m3u8") || t.includes("hls") || t.includes("master.m3u8") || t.match(/index\d*\.m3u8/) ? "hls" : t.includes(".mpd") || t.includes("dash") ? "dash" : t.startsWith("rtmp://") || t.startsWith("rtmps://") ? "rtmp" : t.includes(".flv") || t.includes("flv") && !t.includes("flash") ? "flv" : "unknown";
|
|
4186
|
-
},
|
|
4204
|
+
return t.includes(".m3u8") || t.includes("hls") || t.includes("master.m3u8") || t.match(/index\d*\.m3u8/) ? "hls" : t.includes(".mpd") || t.includes("dash") ? "dash" : t.includes(".mp4") || t.includes(".m4s") ? "mp4" : t.startsWith("rtmp://") || t.startsWith("rtmps://") ? "rtmp" : t.includes(".flv") || t.includes("flv") && !t.includes("flash") ? "flv" : "unknown";
|
|
4205
|
+
}, Hn = (e) => {
|
|
4187
4206
|
let t = e?.getTracks() || [];
|
|
4188
4207
|
for (let e of t) e.stop();
|
|
4189
|
-
},
|
|
4208
|
+
}, Un = class {
|
|
4190
4209
|
resolvesMap = /* @__PURE__ */ new Map();
|
|
4191
4210
|
index = 0;
|
|
4192
4211
|
constructor() {}
|
|
@@ -4218,27 +4237,102 @@ var jn = class {
|
|
|
4218
4237
|
n && (clearTimeout(n.timer), n.resolve(), t.delete(e));
|
|
4219
4238
|
}
|
|
4220
4239
|
};
|
|
4221
|
-
},
|
|
4222
|
-
let t = new DataView(e.buffer), n = 0, r
|
|
4223
|
-
|
|
4224
|
-
{
|
|
4225
|
-
|
|
4226
|
-
i
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4240
|
+
}, Wn = (e) => {
|
|
4241
|
+
let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = 0, r = t.getUint32(n, !1);
|
|
4242
|
+
n += 4;
|
|
4243
|
+
let i = t.getUint8(n), a = {
|
|
4244
|
+
forbidden_zero_bit: i >> 7 & 1,
|
|
4245
|
+
nal_ref_idc: i >> 5 & 3,
|
|
4246
|
+
nal_unit_type: i & 31
|
|
4247
|
+
};
|
|
4248
|
+
return n += 1, {
|
|
4249
|
+
size: r,
|
|
4250
|
+
header: a,
|
|
4251
|
+
data: new Uint8Array(e.buffer, e.byteOffset + n, r - 1)
|
|
4252
|
+
};
|
|
4253
|
+
}, $ = (e, t) => e.match(RegExp(`${t}="([^"]*)"`, "i"))?.[1], Gn = (e) => {
|
|
4254
|
+
let [t, n] = e.split("-").map((e) => parseInt(e, 10));
|
|
4255
|
+
return {
|
|
4256
|
+
start: t,
|
|
4257
|
+
end: n
|
|
4258
|
+
};
|
|
4259
|
+
}, Kn = (e) => {
|
|
4260
|
+
if (!e) return;
|
|
4261
|
+
let t = e.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?/i);
|
|
4262
|
+
if (!t) return;
|
|
4263
|
+
let n = parseInt(t[1] || "0", 10), r = parseInt(t[2] || "0", 10), i = parseFloat(t[3] || "0");
|
|
4264
|
+
return n * 3600 + r * 60 + i;
|
|
4265
|
+
}, qn = (e, t) => {
|
|
4266
|
+
if (!t) return e;
|
|
4267
|
+
if (/^https?:\/\//i.test(t)) return t;
|
|
4268
|
+
if (t.startsWith("/")) {
|
|
4269
|
+
let n = e.match(/^(https?:\/\/[^/]+)/i)?.[1];
|
|
4270
|
+
return n ? `${n}${t}` : t;
|
|
4271
|
+
}
|
|
4272
|
+
return e + t;
|
|
4273
|
+
}, Jn = (e, t) => e.replace(/\$(RepresentationID|\w+)(?:%0(\d+)d)?\$/g, (e, n, r) => {
|
|
4274
|
+
let i = t[n] ?? t[n.toLowerCase()] ?? "";
|
|
4275
|
+
return r ? String(i).padStart(Number(r), "0") : String(i);
|
|
4276
|
+
}), Yn = (e, t, n) => qn(e, Jn(t, n)), Xn = (e, t) => {
|
|
4277
|
+
let n = e.match(/<SegmentList([^>]*)>([\s\S]*?)<\/SegmentList>/i) || t.match(/<SegmentList([^>]*)>([\s\S]*?)<\/SegmentList>/i);
|
|
4278
|
+
if (!n) return;
|
|
4279
|
+
let r = n[1], i = n[2], a = i.match(/<Initialization[^>]*range="([^"]+)"/i), o = [], s = /<SegmentURL[^>]*mediaRange="([^"]+)"/gi, c;
|
|
4280
|
+
for (; c = s.exec(i);) o.push(Gn(c[1]));
|
|
4281
|
+
if (!(o.length === 0 && !a)) return {
|
|
4282
|
+
timescale: parseInt($(r, "timescale") || "1000", 10),
|
|
4283
|
+
duration: parseInt($(r, "duration") || "0", 10),
|
|
4284
|
+
initRange: a ? Gn(a[1]) : void 0,
|
|
4285
|
+
segments: o
|
|
4286
|
+
};
|
|
4287
|
+
}, Zn = (e, t) => {
|
|
4288
|
+
let n = e.match(/<SegmentTemplate([^>]*)\/>/i)?.[1] || e.match(/<SegmentTemplate([^>]*)>/i)?.[1] || t.match(/<SegmentTemplate([^>]*)\/>/i)?.[1] || t.match(/<SegmentTemplate([^>]*)>/i)?.[1] || "";
|
|
4289
|
+
if (!n) {
|
|
4290
|
+
let t = e.match(/<SegmentURL[^>]*initialization="([^"]*)"[^>]*media="([^"]*)"/i);
|
|
4291
|
+
return t ? {
|
|
4292
|
+
initialization: t[1],
|
|
4293
|
+
media: t[2],
|
|
4294
|
+
timescale: 1e3,
|
|
4295
|
+
duration: 0,
|
|
4296
|
+
startNumber: 1
|
|
4297
|
+
} : void 0;
|
|
4235
4298
|
}
|
|
4236
4299
|
return {
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4300
|
+
initialization: $(n, "initialization"),
|
|
4301
|
+
media: $(n, "media"),
|
|
4302
|
+
timescale: parseInt($(n, "timescale") || "1000", 10),
|
|
4303
|
+
duration: parseInt($(n, "duration") || "0", 10),
|
|
4304
|
+
startNumber: parseInt($(n, "startNumber") || "1", 10)
|
|
4305
|
+
};
|
|
4306
|
+
}, Qn = (e, t) => {
|
|
4307
|
+
let n = t.substring(0, t.lastIndexOf("/") + 1), r = e.match(/<MPD[^>]*>/i)?.[0] || "", i = ($(r, "type") || "static") === "dynamic", a = Kn($(r, "mediaPresentationDuration")), o = [], s = /<AdaptationSet([^>]*)>([\s\S]*?)<\/AdaptationSet>/gi, c;
|
|
4308
|
+
for (; c = s.exec(e);) {
|
|
4309
|
+
let e = c[1], t = c[2], n = $(e, "mimeType") || "", r = $(e, "contentType") || "", i = n.includes("video") || r === "video" || /<ContentComponent[^>]*contentType="video"/i.test(t), a = n.includes("audio") || r === "audio" || /<ContentComponent[^>]*contentType="audio"/i.test(t), s;
|
|
4310
|
+
if (i && a ? s = "mux" : i ? s = "video" : a && (s = "audio"), !s) continue;
|
|
4311
|
+
let l = t.match(/<Representation([^>]*)(?:\/>|>([\s\S]*?)<\/Representation>)/i);
|
|
4312
|
+
if (!l) continue;
|
|
4313
|
+
let u = l[1], d = l[2] || "", ee = $(u, "id") || "0", f = $(u, "codecs") || "", te = parseInt($(u, "bandwidth") || "0", 10), ne = parseInt($(u, "width") || "0", 10) || void 0, re = parseInt($(u, "height") || "0", 10) || void 0, p = d.match(/<BaseURL>([^<]+)<\/BaseURL>/i)?.[1]?.trim(), m = Xn(d, t), h = m ? void 0 : Zn(d, t);
|
|
4314
|
+
!m && (!h || !h.media && !h.initialization) || o.push({
|
|
4315
|
+
kind: s,
|
|
4316
|
+
mimeType: n || (i ? "video/mp4" : "audio/mp4"),
|
|
4317
|
+
representation: {
|
|
4318
|
+
id: ee,
|
|
4319
|
+
codecs: f,
|
|
4320
|
+
bandwidth: te,
|
|
4321
|
+
width: ne,
|
|
4322
|
+
height: re,
|
|
4323
|
+
baseUrl: p,
|
|
4324
|
+
template: h,
|
|
4325
|
+
segmentList: m
|
|
4326
|
+
}
|
|
4327
|
+
});
|
|
4328
|
+
}
|
|
4329
|
+
return {
|
|
4330
|
+
isLive: i,
|
|
4331
|
+
duration: a,
|
|
4332
|
+
baseUrl: n,
|
|
4333
|
+
adaptations: o
|
|
4240
4334
|
};
|
|
4241
|
-
},
|
|
4335
|
+
}, $n = class {
|
|
4242
4336
|
#e = {
|
|
4243
4337
|
timeout: 5 * 1e3,
|
|
4244
4338
|
check: !1
|
|
@@ -4297,15 +4391,12 @@ var jn = class {
|
|
|
4297
4391
|
e.name = "AbortError", this.#t.abort(e);
|
|
4298
4392
|
}
|
|
4299
4393
|
};
|
|
4300
|
-
},
|
|
4301
|
-
option = {
|
|
4302
|
-
debug: !1,
|
|
4303
|
-
frameTrack: !1
|
|
4304
|
-
};
|
|
4394
|
+
}, er = class {
|
|
4395
|
+
option = { frameTrack: !1 };
|
|
4305
4396
|
converter = "MediaStreamTrackGenerator" in window ? "generator" : "canvas";
|
|
4306
|
-
prFetch = new
|
|
4307
|
-
getSegmentsFetch = new
|
|
4308
|
-
prResolves = new
|
|
4397
|
+
prFetch = new $n();
|
|
4398
|
+
getSegmentsFetch = new $n();
|
|
4399
|
+
prResolves = new Un();
|
|
4309
4400
|
url = "";
|
|
4310
4401
|
start_resolve;
|
|
4311
4402
|
demuxerWorker;
|
|
@@ -4320,12 +4411,11 @@ var jn = class {
|
|
|
4320
4411
|
cutRenders = /* @__PURE__ */ new Map();
|
|
4321
4412
|
trackGenerator;
|
|
4322
4413
|
constructor(e = {}) {
|
|
4323
|
-
|
|
4324
|
-
this.option.debug = t;
|
|
4414
|
+
this.option.frameTrack = e.frameTrack ?? !1;
|
|
4325
4415
|
}
|
|
4326
4416
|
start = async (e) => {
|
|
4327
4417
|
await this.stop(), this.url = e;
|
|
4328
|
-
let t =
|
|
4418
|
+
let t = Vn(e);
|
|
4329
4419
|
if (t === "unknown") throw Error("This address cannot be parsed.");
|
|
4330
4420
|
switch (this.init(t), t) {
|
|
4331
4421
|
case "flv":
|
|
@@ -4334,11 +4424,18 @@ var jn = class {
|
|
|
4334
4424
|
case "hls":
|
|
4335
4425
|
this.hls.start();
|
|
4336
4426
|
break;
|
|
4427
|
+
case "dash":
|
|
4428
|
+
this.dash.start();
|
|
4429
|
+
break;
|
|
4430
|
+
case "mp4":
|
|
4431
|
+
this.mp4.start();
|
|
4432
|
+
break;
|
|
4433
|
+
case "rtmp": throw Error("RTMP is not supported in browser. Please use HTTP-FLV or HLS.");
|
|
4337
4434
|
}
|
|
4338
4435
|
};
|
|
4339
4436
|
stop = async () => {
|
|
4340
4437
|
try {
|
|
4341
|
-
this.url = "", clearInterval(this.hls.getSegmentsTimer), this.prFetch.stop(), this.getSegmentsFetch.stop(), this.demuxerWorker?.destroy(), this.decoderWorker?.destroy(), this.renderWorker?.destroy(), this.cutRenders = /* @__PURE__ */ new Map(),
|
|
4438
|
+
this.url = "", clearInterval(this.hls.getSegmentsTimer), clearInterval(this.dash.getSegmentsTimer), this.prFetch.stop(), this.getSegmentsFetch.stop(), this.demuxerWorker?.destroy(), this.decoderWorker?.destroy(), this.renderWorker?.destroy(), this.cutRenders = /* @__PURE__ */ new Map(), Hn(this.stream), this.audioPlayer?.destroy();
|
|
4342
4439
|
} catch (e) {
|
|
4343
4440
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: error", e);
|
|
4344
4441
|
}
|
|
@@ -4362,14 +4459,14 @@ var jn = class {
|
|
|
4362
4459
|
return this.renderWorker?.addCut({
|
|
4363
4460
|
key: e,
|
|
4364
4461
|
writable: n.writable,
|
|
4365
|
-
|
|
4462
|
+
cutOption: t
|
|
4366
4463
|
}), this.cutRenders.set(e, { stream: r }), r;
|
|
4367
4464
|
}
|
|
4368
4465
|
let n = document.createElement("canvas"), r = n.captureStream(), i = n.transferControlToOffscreen();
|
|
4369
4466
|
return this.renderWorker?.addCut({
|
|
4370
4467
|
key: e,
|
|
4371
4468
|
offscreen: i,
|
|
4372
|
-
|
|
4469
|
+
cutOption: t
|
|
4373
4470
|
}), this.cutRenders.set(e, { stream: r }), r;
|
|
4374
4471
|
},
|
|
4375
4472
|
setCut: (e, t) => {
|
|
@@ -4390,24 +4487,23 @@ var jn = class {
|
|
|
4390
4487
|
}
|
|
4391
4488
|
};
|
|
4392
4489
|
init = (e) => {
|
|
4393
|
-
this.initRender(), this.initDecoder(e), this.initDemuxer(e), this.audioPlayer = new
|
|
4490
|
+
this.initRender(), this.initDecoder(e), this.initDemuxer(e), this.audioPlayer = new Bn(), this.audioPlayer.init();
|
|
4394
4491
|
};
|
|
4395
4492
|
initDemuxer = (e) => {
|
|
4396
|
-
this.demuxerWorker = new
|
|
4397
|
-
this.
|
|
4398
|
-
}, this.demuxerWorker.on.info = (e) => {
|
|
4399
|
-
this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: info", e), this.on.demuxer.info && this.on.demuxer.info(e);
|
|
4493
|
+
this.demuxerWorker = new Tn(), this.demuxerWorker.init(e), this.demuxerWorker.on.info = (e) => {
|
|
4494
|
+
this.on.demuxer.info && this.on.demuxer.info(e);
|
|
4400
4495
|
}, this.demuxerWorker.on.config = (e) => {
|
|
4401
|
-
this.
|
|
4496
|
+
this.on.demuxer.config && this.on.demuxer.config(e);
|
|
4402
4497
|
let { kind: t } = e;
|
|
4403
4498
|
switch (t) {
|
|
4404
4499
|
case "audio":
|
|
4405
4500
|
{
|
|
4406
|
-
let { codec: t, sampleRate: n, numberOfChannels: r } = e;
|
|
4501
|
+
let { codec: t, sampleRate: n, numberOfChannels: r, description: i } = e;
|
|
4407
4502
|
this.decoderWorker?.initAudio({
|
|
4408
4503
|
codec: t,
|
|
4409
4504
|
sampleRate: n,
|
|
4410
|
-
numberOfChannels: r
|
|
4505
|
+
numberOfChannels: r,
|
|
4506
|
+
...i ? { description: i } : {}
|
|
4411
4507
|
});
|
|
4412
4508
|
}
|
|
4413
4509
|
break;
|
|
@@ -4456,20 +4552,20 @@ var jn = class {
|
|
|
4456
4552
|
};
|
|
4457
4553
|
};
|
|
4458
4554
|
initDecoder = (e) => {
|
|
4459
|
-
this.decoderWorker = new
|
|
4555
|
+
this.decoderWorker = new An(), this.decoderWorker.init(e);
|
|
4460
4556
|
let { frameTrack: t = !1 } = this.option;
|
|
4461
|
-
this.decoderWorker.setFrameTrack(t), this.decoderWorker.on.audio.
|
|
4557
|
+
this.decoderWorker.setFrameTrack(t), this.decoderWorker.on.audio.error = (e) => {
|
|
4558
|
+
this.on.error && this.on.error(e);
|
|
4559
|
+
}, this.decoderWorker.on.audio.decode = (e) => {
|
|
4462
4560
|
this.audioPlayer?.push(e), this.on.decoder.audio && this.on.decoder.audio(e);
|
|
4463
|
-
}, this.decoderWorker.on.
|
|
4464
|
-
this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: audio.error ", e), this.on.error && this.on.error(e);
|
|
4465
|
-
}, this.decoderWorker.on.video.decode = async (e) => {
|
|
4561
|
+
}, this.decoderWorker.on.video.decode = (e) => {
|
|
4466
4562
|
this.start_resolve &&= (this.start_resolve(!0), void 0), this.renderWorker?.push(e), this.on.decoder.video && this.on.decoder.video(e);
|
|
4467
4563
|
}, this.decoderWorker.on.video.error = (e) => {
|
|
4468
4564
|
this.on.error && this.on.error(e);
|
|
4469
4565
|
}, this.decoderWorker.on.nalus = async (e) => {
|
|
4470
4566
|
for (let t of e) {
|
|
4471
4567
|
if (t.byteLength <= 4) continue;
|
|
4472
|
-
let { header: e, data: n } =
|
|
4568
|
+
let { header: e, data: n } = Wn(t), { nal_unit_type: r } = e;
|
|
4473
4569
|
r === 6 && this.on.decoder.sei && this.on.decoder.sei(n);
|
|
4474
4570
|
}
|
|
4475
4571
|
}, this.decoderWorker.on.analysis = (e) => {
|
|
@@ -4477,7 +4573,7 @@ var jn = class {
|
|
|
4477
4573
|
};
|
|
4478
4574
|
};
|
|
4479
4575
|
initRender = () => {
|
|
4480
|
-
if (this.renderWorker = new
|
|
4576
|
+
if (this.renderWorker = new Fn(), this.converter === "generator") {
|
|
4481
4577
|
let e = new MediaStreamTrackGenerator({ kind: "video" }), t = new MediaStream([e]);
|
|
4482
4578
|
this.renderWorker?.addCut({ writable: e.writable }), this.stream = t;
|
|
4483
4579
|
} else {
|
|
@@ -4579,13 +4675,201 @@ var jn = class {
|
|
|
4579
4675
|
}
|
|
4580
4676
|
})
|
|
4581
4677
|
};
|
|
4582
|
-
|
|
4678
|
+
mp4 = { start: () => new Promise(async (e, t) => {
|
|
4679
|
+
try {
|
|
4680
|
+
this.start_resolve = e;
|
|
4681
|
+
let n, r = 0;
|
|
4682
|
+
for (;;) {
|
|
4683
|
+
r += 1;
|
|
4684
|
+
try {
|
|
4685
|
+
n = await this.prFetch.request(this.url);
|
|
4686
|
+
} catch (e) {
|
|
4687
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: error", e);
|
|
4688
|
+
}
|
|
4689
|
+
if (n?.status === 200 || r === 3) break;
|
|
4690
|
+
await new Promise((e) => setTimeout(() => e(!0), 500));
|
|
4691
|
+
}
|
|
4692
|
+
if (!n || n.status !== 200) return t("request is error.");
|
|
4693
|
+
let i = n.body?.getReader();
|
|
4694
|
+
if (!i) return t("reader is error.");
|
|
4695
|
+
for (this.decoderWorker?.setFrameTrack(!1);;) {
|
|
4696
|
+
let { done: e, value: t } = await i.read();
|
|
4697
|
+
if (t && this.demuxerWorker?.push(t), e || this.url === "") break;
|
|
4698
|
+
}
|
|
4699
|
+
} catch (e) {
|
|
4700
|
+
e.name !== "AbortError" && t(e);
|
|
4701
|
+
}
|
|
4702
|
+
}) };
|
|
4703
|
+
dash = {
|
|
4704
|
+
isLive: !1,
|
|
4705
|
+
segmentNumber: 1,
|
|
4706
|
+
mpdInfo: null,
|
|
4707
|
+
getSegmentsTimer: 0,
|
|
4708
|
+
fetchSegment: async (e) => {
|
|
4709
|
+
let t = await this.prFetch.request(e);
|
|
4710
|
+
if (!t || t.status !== 200) return !1;
|
|
4711
|
+
let n = t.body?.getReader();
|
|
4712
|
+
if (!n) return !1;
|
|
4713
|
+
for (;;) {
|
|
4714
|
+
let { done: e, value: t } = await n.read();
|
|
4715
|
+
if (t && this.demuxerWorker?.push(t), e || this.url === "") break;
|
|
4716
|
+
}
|
|
4717
|
+
return !0;
|
|
4718
|
+
},
|
|
4719
|
+
fetchByteRange: async (e, t, n) => {
|
|
4720
|
+
let r, i = 0;
|
|
4721
|
+
for (;;) {
|
|
4722
|
+
i += 1;
|
|
4723
|
+
try {
|
|
4724
|
+
r = await fetch(e, { headers: { Range: `bytes=${t}-${n}` } });
|
|
4725
|
+
} catch (e) {
|
|
4726
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: error", e);
|
|
4727
|
+
}
|
|
4728
|
+
if (r?.ok && (r.status === 200 || r.status === 206) || i === 3) break;
|
|
4729
|
+
await new Promise((e) => setTimeout(() => e(!0), 500));
|
|
4730
|
+
}
|
|
4731
|
+
if (!r?.ok || r.status !== 200 && r.status !== 206) return !1;
|
|
4732
|
+
let a = new Uint8Array(await r.arrayBuffer());
|
|
4733
|
+
return a.byteLength > 0 && this.demuxerWorker?.push(a), a.byteLength > 0;
|
|
4734
|
+
},
|
|
4735
|
+
getMpd: async () => {
|
|
4736
|
+
try {
|
|
4737
|
+
let e, t = 0;
|
|
4738
|
+
for (;;) {
|
|
4739
|
+
t += 1;
|
|
4740
|
+
try {
|
|
4741
|
+
e = await this.getSegmentsFetch.request(this.url);
|
|
4742
|
+
} catch (e) {
|
|
4743
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: error", e);
|
|
4744
|
+
}
|
|
4745
|
+
if (e?.status === 200 || t === 3) break;
|
|
4746
|
+
await new Promise((e) => setTimeout(() => e(!0), 500));
|
|
4747
|
+
}
|
|
4748
|
+
if (!e || e.status !== 200) throw Error("request is error.");
|
|
4749
|
+
let n = e.body?.getReader();
|
|
4750
|
+
if (!n) throw Error("reader is error.");
|
|
4751
|
+
let r = [];
|
|
4752
|
+
for (;;) {
|
|
4753
|
+
let { done: e, value: t } = await n.read();
|
|
4754
|
+
if (t && r.push(t), e || this.url === "") break;
|
|
4755
|
+
}
|
|
4756
|
+
let i = r.reduce((e, t) => e + t.byteLength, 0), a = new Uint8Array(i), o = 0;
|
|
4757
|
+
for (let e of r) a.set(e, o), o += e.byteLength;
|
|
4758
|
+
let s = Qn(new TextDecoder("utf-8").decode(a), this.url);
|
|
4759
|
+
return this.dash.mpdInfo = s, this.dash.isLive = s.isLive, this.dash.isLive || (this.option.frameTrack = !1), s;
|
|
4760
|
+
} catch (e) {
|
|
4761
|
+
return e.name !== "AbortError" && this.on.error && this.on.error(e), null;
|
|
4762
|
+
}
|
|
4763
|
+
},
|
|
4764
|
+
start: () => new Promise(async (e, t) => {
|
|
4765
|
+
try {
|
|
4766
|
+
this.start_resolve = e, this.dash.segmentNumber = 1, this.dash.mpdInfo = null;
|
|
4767
|
+
let n = await this.dash.getMpd();
|
|
4768
|
+
if (!n) return t("mpd parse is error.");
|
|
4769
|
+
let r = n.adaptations.find((e) => e.kind === "video" || e.kind === "mux")?.representation;
|
|
4770
|
+
if (r?.width && r?.height) {
|
|
4771
|
+
let e = {
|
|
4772
|
+
width: r.width,
|
|
4773
|
+
height: r.height,
|
|
4774
|
+
duration: n.duration
|
|
4775
|
+
};
|
|
4776
|
+
this.on.demuxer.info && this.on.demuxer.info(e);
|
|
4777
|
+
}
|
|
4778
|
+
let i = n.adaptations.find((e) => e.representation.segmentList);
|
|
4779
|
+
if (i?.representation.segmentList) {
|
|
4780
|
+
let { segmentList: e, baseUrl: r } = i.representation, a = qn(n.baseUrl, r || "");
|
|
4781
|
+
if (e.initRange) {
|
|
4782
|
+
let { start: n, end: r } = e.initRange;
|
|
4783
|
+
if (!await this.dash.fetchByteRange(a, n, r)) return t("dash init segment fetch failed.");
|
|
4784
|
+
}
|
|
4785
|
+
this.decoderWorker?.setFrameTrack(!1);
|
|
4786
|
+
for (let t of e.segments) {
|
|
4787
|
+
if (this.url === "") break;
|
|
4788
|
+
await this.dash.fetchByteRange(a, t.start, t.end);
|
|
4789
|
+
}
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
let a = [
|
|
4793
|
+
n.adaptations.find((e) => e.kind === "video"),
|
|
4794
|
+
n.adaptations.find((e) => e.kind === "audio"),
|
|
4795
|
+
n.adaptations.find((e) => e.kind === "mux")
|
|
4796
|
+
].filter((e) => !!e);
|
|
4797
|
+
if (a.length === 0) return t("no adaptation in mpd.");
|
|
4798
|
+
for (let e of a) {
|
|
4799
|
+
let { id: t, bandwidth: r, template: i } = e.representation;
|
|
4800
|
+
if (!i?.initialization) continue;
|
|
4801
|
+
let a = Yn(n.baseUrl, i.initialization, {
|
|
4802
|
+
RepresentationID: t,
|
|
4803
|
+
Bandwidth: r,
|
|
4804
|
+
Number: this.dash.segmentNumber
|
|
4805
|
+
});
|
|
4806
|
+
await this.dash.fetchSegment(a);
|
|
4807
|
+
}
|
|
4808
|
+
for (this.dash.isLive ? this.dash.getSegmentsTimer = window.setInterval(this.dash.getMpd, 3e3) : this.decoderWorker?.setFrameTrack(!1);;) {
|
|
4809
|
+
let e = this.dash.mpdInfo;
|
|
4810
|
+
if (!e || this.url === "") break;
|
|
4811
|
+
let { baseUrl: t } = e, n = !1;
|
|
4812
|
+
for (let e of a) {
|
|
4813
|
+
let { id: r, bandwidth: i, template: a } = e.representation;
|
|
4814
|
+
if (!a?.media) continue;
|
|
4815
|
+
let o = Yn(t, a.media, {
|
|
4816
|
+
RepresentationID: r,
|
|
4817
|
+
Bandwidth: i,
|
|
4818
|
+
Number: this.dash.segmentNumber
|
|
4819
|
+
});
|
|
4820
|
+
await this.dash.fetchSegment(o) && (n = !0);
|
|
4821
|
+
}
|
|
4822
|
+
if (!n) {
|
|
4823
|
+
if (this.dash.isLive) {
|
|
4824
|
+
await new Promise((e) => setTimeout(() => e(!0), 300));
|
|
4825
|
+
continue;
|
|
4826
|
+
}
|
|
4827
|
+
break;
|
|
4828
|
+
}
|
|
4829
|
+
this.dash.segmentNumber += 1;
|
|
4830
|
+
}
|
|
4831
|
+
} catch (e) {
|
|
4832
|
+
e.name !== "AbortError" && t(e);
|
|
4833
|
+
}
|
|
4834
|
+
})
|
|
4835
|
+
};
|
|
4836
|
+
}, tr = (e, t) => String.fromCharCode(e.getUint8(t), e.getUint8(t + 1), e.getUint8(t + 2), e.getUint8(t + 3)), nr = (e, t, n) => {
|
|
4837
|
+
if (t + 8 > n) return null;
|
|
4838
|
+
let r = e.getUint32(t, !1), i = tr(e, t + 4), a = 8;
|
|
4839
|
+
if (r === 1) {
|
|
4840
|
+
if (t + 16 > n) return null;
|
|
4841
|
+
r = Number(e.getBigUint64(t + 8, !1)), a = 16;
|
|
4842
|
+
} else r === 0 && (r = n - t);
|
|
4843
|
+
return r < a || t + r > n ? null : {
|
|
4844
|
+
offset: t,
|
|
4845
|
+
size: r,
|
|
4846
|
+
type: i,
|
|
4847
|
+
headerSize: a,
|
|
4848
|
+
contentStart: t + a
|
|
4849
|
+
};
|
|
4850
|
+
}, rr = (e, t, n, r) => {
|
|
4851
|
+
let i = t;
|
|
4852
|
+
for (; i < n;) {
|
|
4853
|
+
let t = nr(e, i, n);
|
|
4854
|
+
if (!t) break;
|
|
4855
|
+
r(t), i += t.size;
|
|
4856
|
+
}
|
|
4857
|
+
}, ir = (e, t, n, r) => {
|
|
4858
|
+
let i = null;
|
|
4859
|
+
return rr(e, t, n, (t) => {
|
|
4860
|
+
if (t.type === r) i = t;
|
|
4861
|
+
else if (t.type !== "mdat") {
|
|
4862
|
+
let n = ir(e, t.contentStart, t.offset + t.size, r);
|
|
4863
|
+
n && (i = n);
|
|
4864
|
+
}
|
|
4865
|
+
}), i;
|
|
4866
|
+
}, ar = /*@__PURE__*/ bn("Cg1DZG5EYXRhLnByb3RvEhVjb20ucXVpY2sudm9pY2UucHJvdG8iawoHU2VpRGF0YRIvCgVldmVudBgBIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5FdmVudFR5cGUSDAoEZGF0YRgCIAEoDBIQCghjb21wcmVzcxgDIAEoCBIPCgd2ZXJzaW9uGAQgASgFIq4CCgpMYXlvdXREYXRhEg4KBnJvb21JZBgBIAEoCRIvCgR0eXBlGAIgASgOMiEuY29tLnF1aWNrLnZvaWNlLnByb3RvLkxheW91dFR5cGUSPwoHdXNlck1hcBgDIAMoCzIuLmNvbS5xdWljay52b2ljZS5wcm90by5MYXlvdXREYXRhLlVzZXJNYXBFbnRyeRI8CgxnbG9iYWxDdXN0b20YBCABKAsyIS5jb20ucXVpY2sudm9pY2UucHJvdG8uQ3VzdG9tSW5mb0gAiAEBGk8KDFVzZXJNYXBFbnRyeRILCgNrZXkYASABKAkSLgoFdmFsdWUYAiABKAsyHy5jb20ucXVpY2sudm9pY2UucHJvdG8uVXNlckluZm86AjgBQg8KDV9nbG9iYWxDdXN0b20ivQEKCFVzZXJJbmZvEgoKAmlkGAEgASgJEjAKBmF1ZGlvcxgCIAMoCzIgLmNvbS5xdWljay52b2ljZS5wcm90by5BdWRpb0luZm8SMAoGdmlkZW9zGAMgAygLMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLlZpZGVvSW5mbxI2CgZjdXN0b20YBCABKAsyIS5jb20ucXVpY2sudm9pY2UucHJvdG8uQ3VzdG9tSW5mb0gAiAEBQgkKB19jdXN0b20ilQEKCUF1ZGlvSW5mbxIuCgR0eXBlGAEgASgOMiAuY29tLnF1aWNrLnZvaWNlLnByb3RvLkF1ZGlvVHlwZRIQCghpc0VuYWJsZRgCIAEoCBIOCgZpc011dGUYAyABKAgSDgoGdm9sdW1lGAQgASgBEhcKCnVwZGF0ZVRpbWUYBSABKANIAIgBAUINCgtfdXBkYXRlVGltZSK6AQoJVmlkZW9JbmZvEi4KBHR5cGUYASABKA4yIC5jb20ucXVpY2sudm9pY2UucHJvdG8uVmlkZW9UeXBlEhAKCGlzRW5hYmxlGAIgASgIEg4KBmlzTXV0ZRgDIAEoCBINCgV3aWR0aBgEIAEoBRIOCgZoZWlnaHQYBSABKAUSCQoBeBgGIAEoBRIJCgF5GAcgASgFEhcKCnVwZGF0ZVRpbWUYCCABKANIAIgBAUINCgtfdXBkYXRlVGltZSLEAQoKQ3VzdG9tSW5mbxIOCgZyb29tSWQYASABKAkSSQoMY3VzdG9tS2V5TWFwGAIgAygLMjMuY29tLnF1aWNrLnZvaWNlLnByb3RvLkN1c3RvbUluZm8uQ3VzdG9tS2V5TWFwRW50cnkSFwoKdXBkYXRlVGltZRgDIAEoA0gAiAEBGjMKEUN1c3RvbUtleU1hcEVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFCDQoLX3VwZGF0ZVRpbWUqIwoJRXZlbnRUeXBlEgoKBkxheW91dBAAEgoKBkN1c3RvbRABKj0KCkxheW91dFR5cGUSEQoNQXVkaW9BbmRWaWRlbxAAEg0KCU9ubHlBdWRpbxABEg0KCU9ubHlWaWRlbxACKiwKCUF1ZGlvVHlwZRIOCgpNaWNyb3Bob25lEAASDwoLU3lzdGVtVm9pY2UQASojCglWaWRlb1R5cGUSCgoGQ2FtZXJhEAASCgoGU2NyZWVuEAFCPwoWY29tLnF1aWNrLnBsYXllci5wcm90b0IHQ2RuRGF0YVoWY29tLnF1aWNrLnBsYXllci5wcm90b7oCA0NkbmIGcHJvdG8z"), or = /*@__PURE__*/ X(ar, 0), sr = /*@__PURE__*/ X(ar, 1), cr = /*@__PURE__*/ X(ar, 5), lr = () => ({
|
|
4583
4867
|
remove: !1,
|
|
4584
4868
|
isEnable: !1,
|
|
4585
4869
|
updateTime: 0,
|
|
4586
4870
|
isMute: !1,
|
|
4587
4871
|
volume: 0
|
|
4588
|
-
}),
|
|
4872
|
+
}), ur = () => ({
|
|
4589
4873
|
remove: !1,
|
|
4590
4874
|
isEnable: !1,
|
|
4591
4875
|
updateTime: 0,
|
|
@@ -4594,7 +4878,7 @@ var jn = class {
|
|
|
4594
4878
|
sy: 0,
|
|
4595
4879
|
sw: 0,
|
|
4596
4880
|
sh: 0
|
|
4597
|
-
}),
|
|
4881
|
+
}), dr = class {
|
|
4598
4882
|
userId = "";
|
|
4599
4883
|
mc_audio;
|
|
4600
4884
|
mc_video;
|
|
@@ -4615,11 +4899,11 @@ var jn = class {
|
|
|
4615
4899
|
let { type: t = 0, isEnable: n = !1, isMute: r = !1, updateTime: i, volume: a = 0 } = e;
|
|
4616
4900
|
switch (t) {
|
|
4617
4901
|
case 0:
|
|
4618
|
-
if (this.mc_audio ||=
|
|
4902
|
+
if (this.mc_audio ||= lr(), this.mc_audio.remove = !1, this.mc_audio.updateTime === Number(i)) break;
|
|
4619
4903
|
this.mc_audio.isEnable = !!n, this.mc_audio.isMute = !!r, this.mc_audio.updateTime = Number(i), this.mc_audio.volume = Number(a);
|
|
4620
4904
|
break;
|
|
4621
4905
|
case 1:
|
|
4622
|
-
if (this.ss_audio ||=
|
|
4906
|
+
if (this.ss_audio ||= lr(), this.ss_audio.remove = !1, this.ss_audio.updateTime === Number(i)) break;
|
|
4623
4907
|
this.ss_audio.isEnable = !!n, this.ss_audio.isMute = !!r, this.ss_audio.updateTime = Number(i), this.ss_audio.volume = Number(a);
|
|
4624
4908
|
break;
|
|
4625
4909
|
}
|
|
@@ -4628,11 +4912,11 @@ var jn = class {
|
|
|
4628
4912
|
let { type: t = 0, isEnable: n, isMute: r, updateTime: i, width: a, height: o, x: s, y: c } = e;
|
|
4629
4913
|
switch (t) {
|
|
4630
4914
|
case 0:
|
|
4631
|
-
if (this.mc_video ||=
|
|
4915
|
+
if (this.mc_video ||= ur(), this.mc_video.remove = !1, this.mc_video.updateTime === Number(i)) break;
|
|
4632
4916
|
this.mc_video.isEnable = !!n, this.mc_video.isMute = !!r, this.mc_video.updateTime = Number(i) || 0, this.mc_video.sx = s || 0, this.mc_video.sy = c || 0, this.mc_video.sw = a || 0, this.mc_video.sh = o || 0;
|
|
4633
4917
|
break;
|
|
4634
4918
|
case 1:
|
|
4635
|
-
if (this.ss_video ||=
|
|
4919
|
+
if (this.ss_video ||= ur(), this.ss_video.remove = !1, this.ss_video.updateTime === Number(i)) break;
|
|
4636
4920
|
this.ss_video.isEnable = !!n, this.ss_video.isMute = !!r, this.ss_video.updateTime = Number(i) || 0, this.ss_video.sx = s || 0, this.ss_video.sy = c || 0, this.ss_video.sw = a || 0, this.ss_video.sh = o || 0;
|
|
4637
4921
|
break;
|
|
4638
4922
|
}
|
|
@@ -4642,7 +4926,7 @@ var jn = class {
|
|
|
4642
4926
|
destroy = () => {
|
|
4643
4927
|
this.mc_audio = void 0, this.mc_video = void 0, this.ss_audio = void 0, this.ss_video = void 0;
|
|
4644
4928
|
};
|
|
4645
|
-
},
|
|
4929
|
+
}, fr = (e) => {
|
|
4646
4930
|
let t = 0, n = 0;
|
|
4647
4931
|
for (;;) {
|
|
4648
4932
|
let r = e[t];
|
|
@@ -4656,13 +4940,13 @@ var jn = class {
|
|
|
4656
4940
|
if (n === 5) {
|
|
4657
4941
|
let n = e.slice(t, t + 16), i = Array.from(n, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
4658
4942
|
t += 16;
|
|
4659
|
-
let a = r - 16, o =
|
|
4943
|
+
let a = r - 16, o = Z(or, e.slice(t, t + a)), { event: s = 0 } = o, c = o.data, l;
|
|
4660
4944
|
switch (s) {
|
|
4661
4945
|
case 0:
|
|
4662
|
-
l =
|
|
4946
|
+
l = Z(sr, o.data);
|
|
4663
4947
|
break;
|
|
4664
4948
|
case 1:
|
|
4665
|
-
l =
|
|
4949
|
+
l = Z(cr, o.data);
|
|
4666
4950
|
break;
|
|
4667
4951
|
}
|
|
4668
4952
|
return {
|
|
@@ -4673,7 +4957,7 @@ var jn = class {
|
|
|
4673
4957
|
data: l
|
|
4674
4958
|
};
|
|
4675
4959
|
}
|
|
4676
|
-
},
|
|
4960
|
+
}, pr = class {
|
|
4677
4961
|
option = {
|
|
4678
4962
|
debug: !1,
|
|
4679
4963
|
ws: "wss://livep2p.devplay.cc/websocket"
|
|
@@ -4694,9 +4978,9 @@ var jn = class {
|
|
|
4694
4978
|
};
|
|
4695
4979
|
constructor(e = {}) {
|
|
4696
4980
|
let { debug: t = !1 } = e;
|
|
4697
|
-
this.option.debug = t, this.prPlayer = new
|
|
4981
|
+
this.option.debug = t, this.prPlayer = new er(), this.prPlayer.on.demuxer.chunk = (e) => {}, this.prPlayer.on.decoder.sei = this.onSEI, this.prPlayer.on.decoder.analysis = this.onAnalysis;
|
|
4698
4982
|
}
|
|
4699
|
-
start =
|
|
4983
|
+
start = (e) => (this.stop(), this.prPlayer.start(e));
|
|
4700
4984
|
stop = () => {
|
|
4701
4985
|
this.prPlayer.stop(), this.usersMap = /* @__PURE__ */ new Map(), this.room.roomId = "", this.room.author = "", this.room.updateTime = "", this.room.version = "";
|
|
4702
4986
|
};
|
|
@@ -4712,26 +4996,26 @@ var jn = class {
|
|
|
4712
4996
|
return Array.from(e, (e) => e.updateTime).join("_");
|
|
4713
4997
|
};
|
|
4714
4998
|
checkAndCreateUser = (e, t) => {
|
|
4715
|
-
!this.usersMap.has(e) && this.usersMap.set(e, new
|
|
4999
|
+
!this.usersMap.has(e) && this.usersMap.set(e, new dr());
|
|
4716
5000
|
let n = this.usersMap.get(e);
|
|
4717
5001
|
if (n) {
|
|
4718
5002
|
if (n.init(t), n.mc_video && n.mc_video.stream === void 0) {
|
|
4719
|
-
let { sx:
|
|
4720
|
-
sx:
|
|
4721
|
-
sy:
|
|
4722
|
-
sw:
|
|
4723
|
-
sh:
|
|
5003
|
+
let e = `${n.userId}_mc_video`, { sx: t, sy: r, sw: i, sh: a } = n.mc_video, o = this.prPlayer.cut.create(e, {
|
|
5004
|
+
sx: t,
|
|
5005
|
+
sy: r,
|
|
5006
|
+
sw: i,
|
|
5007
|
+
sh: a
|
|
4724
5008
|
});
|
|
4725
|
-
this.displayMode === "original" && this.prPlayer.cut.setPause(
|
|
5009
|
+
this.displayMode === "original" && this.prPlayer.cut.setPause(e, !0), n.mc_video.stream = o;
|
|
4726
5010
|
}
|
|
4727
5011
|
if (n.ss_video && n.ss_video.stream === void 0) {
|
|
4728
|
-
let { sx:
|
|
4729
|
-
sx:
|
|
4730
|
-
sy:
|
|
4731
|
-
sw:
|
|
4732
|
-
sh:
|
|
5012
|
+
let e = `${n.userId}_ss_video`, { sx: t, sy: r, sw: i, sh: a } = n.ss_video, o = this.prPlayer.cut.create(e, {
|
|
5013
|
+
sx: t,
|
|
5014
|
+
sy: r,
|
|
5015
|
+
sw: i,
|
|
5016
|
+
sh: a
|
|
4733
5017
|
});
|
|
4734
|
-
this.displayMode === "original" && this.prPlayer.cut.setPause(
|
|
5018
|
+
this.displayMode === "original" && this.prPlayer.cut.setPause(e, !0), n.ss_video.stream = o;
|
|
4735
5019
|
}
|
|
4736
5020
|
if (n?.mc_video) {
|
|
4737
5021
|
let e = `${n.userId}_mc_video`, { sx: t, sy: r, sw: i, sh: a } = n.mc_video;
|
|
@@ -4773,7 +5057,7 @@ var jn = class {
|
|
|
4773
5057
|
};
|
|
4774
5058
|
onSEI = (e) => {
|
|
4775
5059
|
try {
|
|
4776
|
-
let t =
|
|
5060
|
+
let t = fr(e);
|
|
4777
5061
|
if (!t) return;
|
|
4778
5062
|
let { event: n, data: r } = t;
|
|
4779
5063
|
switch (n) {
|
|
@@ -4819,4 +5103,4 @@ var jn = class {
|
|
|
4819
5103
|
};
|
|
4820
5104
|
};
|
|
4821
5105
|
//#endregion
|
|
4822
|
-
export {
|
|
5106
|
+
export { pr as QuickVoPlayer };
|