@haelp/teto
Version:
A typescript-based controllable TETR.IO client.
1,095 lines (1,094 loc) • 615 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/classes/ribbon/codecs/utils/msgpackr-943ed70.js
var require_msgpackr_943ed70 = __commonJS({
"src/classes/ribbon/codecs/utils/msgpackr-943ed70.js"(exports2, module2) {
"use strict";
module2.exports = function(t) {
"use strict";
var n, r2, i;
try {
n = new TextDecoder();
} catch (t2) {
}
var a, o, s, u, c, l = 0, h = {}, p = 0, f = 0, d = [], m = { useRecords: false, mapsAsObjects: true };
class g {
}
const v = new g();
v.name = "MessagePack 0xC1";
var y = false, b2 = 2;
try {
new Function("");
} catch (t2) {
b2 = 1 / 0;
}
class x {
constructor(t2) {
t2 && (false === t2.useRecords && void 0 === t2.mapsAsObjects && (t2.mapsAsObjects = true), t2.sequential && false !== t2.trusted && (t2.trusted = true, t2.structures || 0 == t2.useRecords || (t2.structures = [], t2.maxSharedStructures || (t2.maxSharedStructures = 0))), t2.structures ? t2.structures.sharedLength = t2.structures.length : t2.getStructures && ((t2.structures = []).uninitialized = true, t2.structures.sharedLength = 0), t2.int64AsNumber && (t2.int64AsType = "number")), Object.assign(this, t2);
}
unpack(t2, n2) {
if (r2)
return Y(
() => (Z(), this ? this.unpack(t2, n2) : x.prototype.unpack.call(m, t2, n2))
);
t2.buffer || t2.constructor !== ArrayBuffer || (t2 = void 0 !== e ? e.from(t2) : new Uint8Array(t2)), "object" == typeof n2 ? (i = n2.end || t2.length, l = n2.start || 0) : (l = 0, i = n2 > -1 ? n2 : t2.length), f = 0, o = null, s = null, r2 = t2;
try {
c = t2.dataView || (t2.dataView = new DataView(t2.buffer, t2.byteOffset, t2.byteLength));
} catch (e3) {
if (r2 = null, t2 instanceof Uint8Array) throw e3;
throw new Error(
"Source must be a Uint8Array or Buffer but was a " + (t2 && "object" == typeof t2 ? t2.constructor.name : typeof t2)
);
}
if (this instanceof x) {
if (h = this, this.structures) return a = this.structures, w(n2);
(!a || a.length > 0) && (a = []);
} else h = m, (!a || a.length > 0) && (a = []);
return w(n2);
}
unpackMultiple(t2, e3) {
let n2, r3 = 0;
try {
y = true;
let i2 = t2.length, a2 = this ? this.unpack(t2, i2) : Q.unpack(t2, i2);
if (!e3) {
for (n2 = [a2]; l < i2; ) r3 = l, n2.push(w());
return n2;
}
if (false === e3(a2, r3, l)) return;
for (; l < i2; ) if (r3 = l, false === e3(w(), r3, l)) return;
} catch (t3) {
throw t3.lastPosition = r3, t3.values = n2, t3;
} finally {
y = false, Z();
}
}
_mergeStructures(t2, e3) {
t2 = t2 || [], Object.isFrozen(t2) && (t2 = t2.map((t3) => t3.slice(0)));
for (let e4 = 0, n2 = t2.length; e4 < n2; e4++) {
let n3 = t2[e4];
n3 && (n3.isShared = true, e4 >= 32 && (n3.highByte = e4 - 32 >> 5));
}
t2.sharedLength = t2.length;
for (let n2 in e3 || [])
if (n2 >= 0) {
let r3 = t2[n2], i2 = e3[n2];
i2 && (r3 && ((t2.restoreStructures || (t2.restoreStructures = []))[n2] = r3), t2[n2] = i2);
}
return this.structures = t2;
}
decode(t2, e3) {
return this.unpack(t2, e3);
}
}
function w(t2) {
try {
if (!h.trusted && !y) {
let t4 = a.sharedLength || 0;
t4 < a.length && (a.length = t4);
}
let t3;
if (h.randomAccessStructure && r2[l] < 64 && r2[l], t3 = S(), s && (l = s.postBundlePosition, s = null), y && (a.restoreStructures = null), l == i)
a && a.restoreStructures && _(), a = null, r2 = null, u && (u = null);
else {
if (l > i) throw new Error("Unexpected end of MessagePack data");
if (!y) {
let e3;
try {
e3 = JSON.stringify(
t3,
(t4, e4) => "bigint" == typeof e4 ? `${e4}n` : e4
).slice(0, 100);
} catch (t4) {
e3 = "(JSON view not available " + t4 + ")";
}
throw new Error("Data read, but end of buffer not reached " + e3);
}
}
return t3;
} catch (t3) {
throw a && a.restoreStructures && _(), Z(), (t3 instanceof RangeError || t3.message.startsWith("Unexpected end of buffer") || l > i) && (t3.incomplete = true), t3;
}
}
function _() {
for (let t2 in a.restoreStructures) a[t2] = a.restoreStructures[t2];
a.restoreStructures = null;
}
function S() {
let t2 = r2[l++];
if (t2 < 160) {
if (t2 < 128) {
if (t2 < 64) return t2;
{
let e3 = a[63 & t2] || h.getStructures && I()[63 & t2];
return e3 ? (e3.read || (e3.read = E(e3, 63 & t2)), e3.read()) : t2;
}
}
if (t2 < 144) {
if (t2 -= 128, h.mapsAsObjects) {
let e3 = {};
for (let n2 = 0; n2 < t2; n2++) {
let t3 = W();
"__proto__" === t3 && (t3 = "__proto_"), e3[t3] = S();
}
return e3;
}
{
let e3 = /* @__PURE__ */ new Map();
for (let n2 = 0; n2 < t2; n2++) e3.set(S(), S());
return e3;
}
}
{
t2 -= 144;
let e3 = new Array(t2);
for (let n2 = 0; n2 < t2; n2++) e3[n2] = S();
return h.freezeData ? Object.freeze(e3) : e3;
}
}
if (t2 < 192) {
let e3 = t2 - 160;
if (f >= l) return o.slice(l - p, (l += e3) - p);
if (0 == f && i < 140) {
let t3 = e3 < 16 ? L(e3) : P(e3);
if (null != t3) return t3;
}
return A(e3);
}
{
let e3;
switch (t2) {
case 192:
return null;
case 193:
return s ? (e3 = S(), e3 > 0 ? s[1].slice(s.position1, s.position1 += e3) : s[0].slice(s.position0, s.position0 -= e3)) : v;
case 194:
return false;
case 195:
return true;
case 196:
if (e3 = r2[l++], void 0 === e3)
throw new Error("Unexpected end of buffer");
return z(e3);
case 197:
return e3 = c.getUint16(l), l += 2, z(e3);
case 198:
return e3 = c.getUint32(l), l += 4, z(e3);
case 199:
return U(r2[l++]);
case 200:
return e3 = c.getUint16(l), l += 2, U(e3);
case 201:
return e3 = c.getUint32(l), l += 4, U(e3);
case 202:
if (e3 = c.getFloat32(l), h.useFloat32 > 2) {
let t3 = $[(127 & r2[l]) << 1 | r2[l + 1] >> 7];
return l += 4, (t3 * e3 + (e3 > 0 ? 0.5 : -0.5) | 0) / t3;
}
return l += 4, e3;
case 203:
return e3 = c.getFloat64(l), l += 8, e3;
case 204:
return r2[l++];
case 205:
return e3 = c.getUint16(l), l += 2, e3;
case 206:
return e3 = c.getUint32(l), l += 4, e3;
case 207:
return "number" === h.int64AsType ? (e3 = 4294967296 * c.getUint32(l), e3 += c.getUint32(l + 4)) : "string" === h.int64AsType ? e3 = c.getBigUint64(l).toString() : "auto" === h.int64AsType ? (e3 = c.getBigUint64(l), e3 <= BigInt(2) << BigInt(52) && (e3 = Number(e3))) : e3 = c.getBigUint64(l), l += 8, e3;
case 208:
return c.getInt8(l++);
case 209:
return e3 = c.getInt16(l), l += 2, e3;
case 210:
return e3 = c.getInt32(l), l += 4, e3;
case 211:
return "number" === h.int64AsType ? (e3 = 4294967296 * c.getInt32(l), e3 += c.getUint32(l + 4)) : "string" === h.int64AsType ? e3 = c.getBigInt64(l).toString() : "auto" === h.int64AsType ? (e3 = c.getBigInt64(l), e3 >= BigInt(-2) << BigInt(52) && e3 <= BigInt(2) << BigInt(52) && (e3 = Number(e3))) : e3 = c.getBigInt64(l), l += 8, e3;
case 212:
if (e3 = r2[l++], 114 == e3) return j(63 & r2[l++]);
{
let t3 = d[e3];
if (t3)
return t3.read ? (l++, t3.read(S())) : t3.noBuffer ? (l++, t3()) : t3(r2.subarray(l, ++l));
throw new Error("Unknown extension " + e3);
}
case 213:
return e3 = r2[l], 114 == e3 ? (l++, j(63 & r2[l++], r2[l++])) : U(2);
case 214:
return U(4);
case 215:
return U(8);
case 216:
return U(16);
case 217:
return e3 = r2[l++], f >= l ? o.slice(l - p, (l += e3) - p) : N(e3);
case 218:
return e3 = c.getUint16(l), f >= (l += 2) ? o.slice(l - p, (l += e3) - p) : C(e3);
case 219:
return e3 = c.getUint32(l), f >= (l += 4) ? o.slice(l - p, (l += e3) - p) : R(e3);
case 220:
return e3 = c.getUint16(l), l += 2, D(e3);
case 221:
return e3 = c.getUint32(l), l += 4, D(e3);
case 222:
return e3 = c.getUint16(l), l += 2, M(e3);
case 223:
return e3 = c.getUint32(l), l += 4, M(e3);
default:
if (t2 >= 224) return t2 - 256;
if (void 0 === t2) {
let t3 = new Error("Unexpected end of MessagePack data");
throw t3.incomplete = true, t3;
}
throw new Error("Unknown MessagePack token " + t2);
}
}
}
const T = /^[a-zA-Z_$][a-zA-Z\d_$]*$/;
function E(t2, e3) {
function n2() {
if (n2.count++ > b2) {
let n3 = t2.read = new Function(
"r",
"return function(){return " + (h.freezeData ? "Object.freeze" : "") + "({" + t2.map(
(t3) => "__proto__" === t3 ? "__proto_:r()" : T.test(t3) ? t3 + ":r()" : "[" + JSON.stringify(t3) + "]:r()"
).join(",") + "})}"
)(S);
return 0 === t2.highByte && (t2.read = k(e3, t2.read)), n3();
}
let r3 = {};
for (let e4 = 0, n3 = t2.length; e4 < n3; e4++) {
let n4 = t2[e4];
"__proto__" === n4 && (n4 = "__proto_"), r3[n4] = S();
}
return h.freezeData ? Object.freeze(r3) : r3;
}
return n2.count = 0, 0 === t2.highByte ? k(e3, n2) : n2;
}
const k = (t2, e3) => function() {
let n2 = r2[l++];
if (0 === n2) return e3();
let i2 = t2 < 32 ? -(t2 + (n2 << 5)) : t2 + (n2 << 5), o2 = a[i2] || I()[i2];
if (!o2) throw new Error("Record id is not defined for " + i2);
return o2.read || (o2.read = E(o2, t2)), o2.read();
};
function I() {
let t2 = Y(() => (r2 = null, h.getStructures()));
return a = h._mergeStructures(t2, a);
}
var A = O, N = O, C = O, R = O;
function O(t2) {
let e3;
if (t2 < 16 && (e3 = L(t2))) return e3;
if (t2 > 64 && n) return n.decode(r2.subarray(l, l += t2));
const i2 = l + t2, a2 = [];
for (e3 = ""; l < i2; ) {
const t3 = r2[l++];
if (128 & t3)
if (192 == (224 & t3)) {
const e4 = 63 & r2[l++];
a2.push((31 & t3) << 6 | e4);
} else if (224 == (240 & t3)) {
const e4 = 63 & r2[l++], n2 = 63 & r2[l++];
a2.push((31 & t3) << 12 | e4 << 6 | n2);
} else if (240 == (248 & t3)) {
let e4 = (7 & t3) << 18 | (63 & r2[l++]) << 12 | (63 & r2[l++]) << 6 | 63 & r2[l++];
e4 > 65535 && (e4 -= 65536, a2.push(e4 >>> 10 & 1023 | 55296), e4 = 56320 | 1023 & e4), a2.push(e4);
} else a2.push(t3);
else a2.push(t3);
a2.length >= 4096 && (e3 += F.apply(String, a2), a2.length = 0);
}
return a2.length > 0 && (e3 += F.apply(String, a2)), e3;
}
function D(t2) {
let e3 = new Array(t2);
for (let n2 = 0; n2 < t2; n2++) e3[n2] = S();
return h.freezeData ? Object.freeze(e3) : e3;
}
function M(t2) {
if (h.mapsAsObjects) {
let e3 = {};
for (let n2 = 0; n2 < t2; n2++) {
let t3 = W();
"__proto__" === t3 && (t3 = "__proto_"), e3[t3] = S();
}
return e3;
}
{
let e3 = /* @__PURE__ */ new Map();
for (let n2 = 0; n2 < t2; n2++) e3.set(S(), S());
return e3;
}
}
var F = String.fromCharCode;
function P(t2) {
let e3 = l, n2 = new Array(t2);
for (let i2 = 0; i2 < t2; i2++) {
const t3 = r2[l++];
if ((128 & t3) > 0) return void (l = e3);
n2[i2] = t3;
}
return F.apply(String, n2);
}
function L(t2) {
if (t2 < 4) {
if (t2 < 2) {
if (0 === t2) return "";
{
let t3 = r2[l++];
return (128 & t3) > 1 ? void (l -= 1) : F(t3);
}
}
{
let e3 = r2[l++], n2 = r2[l++];
if ((128 & e3) > 0 || (128 & n2) > 0) return void (l -= 2);
if (t2 < 3) return F(e3, n2);
let i2 = r2[l++];
return (128 & i2) > 0 ? void (l -= 3) : F(e3, n2, i2);
}
}
{
let e3 = r2[l++], n2 = r2[l++], i2 = r2[l++], a2 = r2[l++];
if ((128 & e3) > 0 || (128 & n2) > 0 || (128 & i2) > 0 || (128 & a2) > 0)
return void (l -= 4);
if (t2 < 6) {
if (4 === t2) return F(e3, n2, i2, a2);
{
let t3 = r2[l++];
return (128 & t3) > 0 ? void (l -= 5) : F(e3, n2, i2, a2, t3);
}
}
if (t2 < 8) {
let o2 = r2[l++], s2 = r2[l++];
if ((128 & o2) > 0 || (128 & s2) > 0) return void (l -= 6);
if (t2 < 7) return F(e3, n2, i2, a2, o2, s2);
let u2 = r2[l++];
return (128 & u2) > 0 ? void (l -= 7) : F(e3, n2, i2, a2, o2, s2, u2);
}
{
let o2 = r2[l++], s2 = r2[l++], u2 = r2[l++], c2 = r2[l++];
if ((128 & o2) > 0 || (128 & s2) > 0 || (128 & u2) > 0 || (128 & c2) > 0)
return void (l -= 8);
if (t2 < 10) {
if (8 === t2) return F(e3, n2, i2, a2, o2, s2, u2, c2);
{
let t3 = r2[l++];
return (128 & t3) > 0 ? void (l -= 9) : F(e3, n2, i2, a2, o2, s2, u2, c2, t3);
}
}
if (t2 < 12) {
let h2 = r2[l++], p2 = r2[l++];
if ((128 & h2) > 0 || (128 & p2) > 0) return void (l -= 10);
if (t2 < 11) return F(e3, n2, i2, a2, o2, s2, u2, c2, h2, p2);
let f2 = r2[l++];
return (128 & f2) > 0 ? void (l -= 11) : F(e3, n2, i2, a2, o2, s2, u2, c2, h2, p2, f2);
}
{
let h2 = r2[l++], p2 = r2[l++], f2 = r2[l++], d2 = r2[l++];
if ((128 & h2) > 0 || (128 & p2) > 0 || (128 & f2) > 0 || (128 & d2) > 0)
return void (l -= 12);
if (t2 < 14) {
if (12 === t2) return F(e3, n2, i2, a2, o2, s2, u2, c2, h2, p2, f2, d2);
{
let t3 = r2[l++];
return (128 & t3) > 0 ? void (l -= 13) : F(e3, n2, i2, a2, o2, s2, u2, c2, h2, p2, f2, d2, t3);
}
}
{
let m2 = r2[l++], g2 = r2[l++];
if ((128 & m2) > 0 || (128 & g2) > 0) return void (l -= 14);
if (t2 < 15) return F(e3, n2, i2, a2, o2, s2, u2, c2, h2, p2, f2, d2, m2, g2);
let v2 = r2[l++];
return (128 & v2) > 0 ? void (l -= 15) : F(e3, n2, i2, a2, o2, s2, u2, c2, h2, p2, f2, d2, m2, g2, v2);
}
}
}
}
}
function B() {
let t2, e3 = r2[l++];
if (e3 < 192) t2 = e3 - 160;
else
switch (e3) {
case 217:
t2 = r2[l++];
break;
case 218:
t2 = c.getUint16(l), l += 2;
break;
case 219:
t2 = c.getUint32(l), l += 4;
break;
default:
throw new Error("Expected string");
}
return O(t2);
}
function z(t2) {
return h.copyBuffers ? Uint8Array.prototype.slice.call(r2, l, l += t2) : r2.subarray(l, l += t2);
}
function U(t2) {
let e3 = r2[l++];
if (d[e3]) {
let n2, i2 = l;
return d[e3](
r2.subarray(l, n2 = l += t2),
(t3) => {
l = t3;
try {
return S();
} finally {
l = n2;
}
},
i2
);
}
throw new Error("Unknown extension type " + e3);
}
var G = new Array(4096);
function W() {
let t2 = r2[l++];
if (!(t2 >= 160 && t2 < 192)) return l--, V(S());
if (t2 -= 160, f >= l) return o.slice(l - p, (l += t2) - p);
if (!(0 == f && i < 180)) return A(t2);
let e3, n2 = 4095 & (t2 << 5 ^ (t2 > 1 ? c.getUint16(l) : t2 > 0 ? r2[l] : 0)), a2 = G[n2], s2 = l, u2 = l + t2 - 3, h2 = 0;
if (a2 && a2.bytes == t2) {
for (; s2 < u2; ) {
if (e3 = c.getUint32(s2), e3 != a2[h2++]) {
s2 = 1879048192;
break;
}
s2 += 4;
}
for (u2 += 3; s2 < u2; )
if (e3 = r2[s2++], e3 != a2[h2++]) {
s2 = 1879048192;
break;
}
if (s2 === u2) return l = s2, a2.string;
u2 -= 3, s2 = l;
}
for (a2 = [], G[n2] = a2, a2.bytes = t2; s2 < u2; )
e3 = c.getUint32(s2), a2.push(e3), s2 += 4;
for (u2 += 3; s2 < u2; ) e3 = r2[s2++], a2.push(e3);
let d2 = t2 < 16 ? L(t2) : P(t2);
return a2.string = null != d2 ? d2 : A(t2);
}
function V(t2) {
if ("string" == typeof t2) return t2;
if ("number" == typeof t2 || "boolean" == typeof t2 || "bigint" == typeof t2)
return t2.toString();
if (null == t2) return t2 + "";
throw new Error("Invalid property type for record", typeof t2);
}
const j = (t2, e3) => {
let n2 = S().map(V), r3 = t2;
void 0 !== e3 && (t2 = t2 < 32 ? -((e3 << 5) + t2) : (e3 << 5) + t2, n2.highByte = e3);
let i2 = a[t2];
return i2 && (i2.isShared || y) && ((a.restoreStructures || (a.restoreStructures = []))[t2] = i2), a[t2] = n2, n2.read = E(n2, r3), n2.read();
};
d[0] = () => {
}, d[0].noBuffer = true, d[66] = (t2) => {
let e3 = t2.length, n2 = BigInt(128 & t2[0] ? t2[0] - 256 : t2[0]);
for (let r3 = 1; r3 < e3; r3++) n2 <<= 8n, n2 += BigInt(t2[r3]);
return n2;
};
let H = { Error, TypeError, ReferenceError };
d[101] = () => {
let t2 = S();
return (H[t2[0]] || Error)(t2[1]);
}, d[105] = (t2) => {
if (false === h.structuredClone)
throw new Error("Structured clone extension is disabled");
let e3 = c.getUint32(l - 4);
u || (u = /* @__PURE__ */ new Map());
let n2, i2 = r2[l];
n2 = i2 >= 144 && i2 < 160 || 220 == i2 || 221 == i2 ? [] : {};
let a2 = { target: n2 };
u.set(e3, a2);
let o2 = S();
return a2.used ? Object.assign(n2, o2) : (a2.target = o2, o2);
}, d[112] = (t2) => {
if (false === h.structuredClone)
throw new Error("Structured clone extension is disabled");
let e3 = c.getUint32(l - 4), n2 = u.get(e3);
return n2.used = true, n2.target;
}, d[115] = () => new Set(S());
const X = [
"Int8",
"Uint8",
"Uint8Clamped",
"Int16",
"Uint16",
"Int32",
"Uint32",
"Float32",
"Float64",
"BigInt64",
"BigUint64"
].map((t2) => t2 + "Array");
let q = "object" == typeof globalThis ? globalThis : window;
d[116] = (t2) => {
let e3 = t2[0], n2 = X[e3];
if (!n2) {
if (16 === e3) {
let e4 = new ArrayBuffer(t2.length - 1);
return new Uint8Array(e4).set(t2.subarray(1)), e4;
}
throw new Error("Could not find typed array for code " + e3);
}
return new q[n2](Uint8Array.prototype.slice.call(t2, 1).buffer);
}, d[120] = () => {
let t2 = S();
return new RegExp(t2[0], t2[1]);
};
const K = [];
function Y(t2) {
let e3 = i, n2 = l, d2 = p, m2 = f, g2 = o, v2 = u, b3 = s, x2 = new Uint8Array(r2.slice(0, i)), w2 = a, _2 = a.slice(0, a.length), S2 = h, T2 = y, E2 = t2();
return i = e3, l = n2, p = d2, f = m2, o = g2, u = v2, s = b3, r2 = x2, y = T2, (a = w2).splice(0, a.length, ..._2), h = S2, c = new DataView(r2.buffer, r2.byteOffset, r2.byteLength), E2;
}
function Z() {
r2 = null, u = null, a = null;
}
d[98] = (t2) => {
let e3 = (t2[0] << 24) + (t2[1] << 16) + (t2[2] << 8) + t2[3], n2 = l;
return l += e3 - t2.length, s = K, (s = [B(), B()]).position0 = 0, s.position1 = 0, s.postBundlePosition = l, l = n2, S();
}, d[255] = (t2) => 4 == t2.length ? new Date(1e3 * (16777216 * t2[0] + (t2[1] << 16) + (t2[2] << 8) + t2[3])) : 8 == t2.length ? new Date(
((t2[0] << 22) + (t2[1] << 14) + (t2[2] << 6) + (t2[3] >> 2)) / 1e6 + 1e3 * (4294967296 * (3 & t2[3]) + 16777216 * t2[4] + (t2[5] << 16) + (t2[6] << 8) + t2[7])
) : 12 == t2.length ? new Date(
((t2[0] << 24) + (t2[1] << 16) + (t2[2] << 8) + t2[3]) / 1e6 + 1e3 * ((128 & t2[4] ? -281474976710656 : 0) + 1099511627776 * t2[6] + 4294967296 * t2[7] + 16777216 * t2[8] + (t2[9] << 16) + (t2[10] << 8) + t2[11])
) : /* @__PURE__ */ new Date("invalid");
const $ = new Array(147);
for (let t2 = 0; t2 < 256; t2++)
$[t2] = +("1e" + Math.floor(45.15 - 0.30103 * t2));
const J = x;
var Q = new x({ useRecords: false });
const tt2 = Q.unpack, et2 = Q.unpackMultiple, nt2 = Q.unpack, rt = { NEVER: 0, ALWAYS: 1, DECIMAL_ROUND: 3, DECIMAL_FIT: 4 };
let it, at, ot, st = new Float32Array(1), ut = new Uint8Array(st.buffer, 0, 4);
try {
it = new TextEncoder();
} catch (t2) {
}
const ct = void 0 !== Buffer, lt = ct ? function(t2) {
return Buffer.allocUnsafeSlow(t2);
} : Uint8Array, ht = ct ? Buffer : Uint8Array, pt = ct ? 4294967296 : 2144337920;
let ft, dt, mt, gt, vt = 0, yt = null;
const bt = /[\u0080-\uFFFF]/, xt = Symbol("record-id");
class wt extends x {
constructor(t2) {
let e3, n2, r3, i2;
super(t2), this.offset = 0;
let a2 = ht.prototype.utf8Write ? function(t3, e4) {
return ft.utf8Write(t3, e4, 4294967295);
} : !(!it || !it.encodeInto) && function(t3, e4) {
return it.encodeInto(t3, ft.subarray(e4)).written;
}, o2 = this;
t2 || (t2 = {});
let s2 = t2 && t2.sequential, u2 = t2.structures || t2.saveStructures, c2 = t2.maxSharedStructures;
if (null == c2 && (c2 = u2 ? 32 : 0), c2 > 8160)
throw new Error("Maximum maxSharedStructure is 8160");
t2.structuredClone && null == t2.moreTypes && (this.moreTypes = true);
let l2 = t2.maxOwnStructures;
null == l2 && (l2 = u2 ? 32 : 64), this.structures || 0 == t2.useRecords || (this.structures = []);
let h2 = c2 > 32 || l2 + c2 > 64, p2 = c2 + 64, f2 = c2 + l2 + 64;
if (f2 > 8256)
throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");
let d2 = [], m2 = 0, g2 = 0;
this.pack = this.encode = function(t3, a3) {
if (ft || (ft = new lt(8192), mt = ft.dataView || (ft.dataView = new DataView(ft.buffer, 0, 8192)), vt = 0), gt = ft.length - 10, gt - vt < 2048 ? (ft = new lt(ft.length), mt = ft.dataView || (ft.dataView = new DataView(ft.buffer, 0, ft.length)), gt = ft.length - 10, vt = 0) : vt = vt + 7 & 2147483640, e3 = vt, a3 & Pt && (vt += 255 & a3), i2 = o2.structuredClone ? /* @__PURE__ */ new Map() : null, o2.bundleStrings && "string" != typeof t3 ? (yt = [], yt.size = 1 / 0) : yt = null, r3 = o2.structures, r3) {
r3.uninitialized && (r3 = o2._mergeStructures(o2.getStructures()));
let t4 = r3.sharedLength || 0;
if (t4 > c2)
throw new Error(
"Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to " + r3.sharedLength
);
if (!r3.transitions) {
r3.transitions = /* @__PURE__ */ Object.create(null);
for (let e4 = 0; e4 < t4; e4++) {
let t5 = r3[e4];
if (!t5) continue;
let n3, i3 = r3.transitions;
for (let e5 = 0, r4 = t5.length; e5 < r4; e5++) {
let r5 = t5[e5];
n3 = i3[r5], n3 || (n3 = i3[r5] = /* @__PURE__ */ Object.create(null)), i3 = n3;
}
i3[xt] = e4 + 64;
}
this.lastNamedStructuresLength = t4;
}
s2 || (r3.nextId = t4 + 64);
}
let u3;
n2 && (n2 = false);
try {
o2.randomAccessStructure && t3 && t3.constructor && t3.constructor === Object ? I2(t3) : b3(t3);
let n3 = yt;
if (yt && Et(e3, b3, 0), i2 && i2.idsToInsert) {
let t4 = i2.idsToInsert.sort(
(t5, e4) => t5.offset > e4.offset ? 1 : -1
), r4 = t4.length, a4 = -1;
for (; n3 && r4 > 0; ) {
let i3 = t4[--r4].offset + e3;
i3 < n3.stringsPosition + e3 && -1 === a4 && (a4 = 0), i3 > n3.position + e3 ? a4 >= 0 && (a4 += 6) : (a4 >= 0 && (mt.setUint32(
n3.position + e3,
mt.getUint32(n3.position + e3) + a4
), a4 = -1), n3 = n3.previous, r4++);
}
a4 >= 0 && n3 && mt.setUint32(n3.position + e3, mt.getUint32(n3.position + e3) + a4), vt += 6 * t4.length, vt > gt && T2(vt), o2.offset = vt;
let s3 = function(t5, e4) {
let n4, r5 = 6 * e4.length, i3 = t5.length - r5;
for (; n4 = e4.pop(); ) {
let e5 = n4.offset, a5 = n4.id;
t5.copyWithin(e5 + r5, e5, i3), r5 -= 6;
let o3 = e5 + r5;
t5[o3++] = 214, t5[o3++] = 105, t5[o3++] = a5 >> 24, t5[o3++] = a5 >> 16 & 255, t5[o3++] = a5 >> 8 & 255, t5[o3++] = 255 & a5, i3 = e5;
}
return t5;
}(ft.subarray(e3, vt), t4);
return i2 = null, s3;
}
return o2.offset = vt, a3 & Mt ? (ft.start = e3, ft.end = vt, ft) : ft.subarray(e3, vt);
} catch (t4) {
throw u3 = t4, t4;
} finally {
if (r3 && (v2(), n2 && o2.saveStructures)) {
let n3 = r3.sharedLength || 0, i3 = ft.subarray(e3, vt), s3 = function(t4, e4) {
return t4.isCompatible = (t5) => {
let n4 = !t5 || (e4.lastNamedStructuresLength || 0) === t5.length;
return n4 || e4._mergeStructures(t5), n4;
}, t4;
}(r3, o2);
if (!u3)
return false === o2.saveStructures(s3, s3.isCompatible) ? o2.pack(t3, a3) : (o2.lastNamedStructuresLength = n3, ft.length > 1073741824 && (ft = null), i3);
}
ft.length > 1073741824 && (ft = null), a3 & Ft && (vt = e3);
}
};
const v2 = () => {
g2 < 10 && g2++;
let t3 = r3.sharedLength || 0;
if (r3.length > t3 && !s2 && (r3.length = t3), m2 > 1e4)
r3.transitions = null, g2 = 0, m2 = 0, d2.length > 0 && (d2 = []);
else if (d2.length > 0 && !s2) {
for (let t4 = 0, e4 = d2.length; t4 < e4; t4++) d2[t4][xt] = 0;
d2 = [];
}
}, y2 = (t3) => {
var e4 = t3.length;
e4 < 16 ? ft[vt++] = 144 | e4 : e4 < 65536 ? (ft[vt++] = 220, ft[vt++] = e4 >> 8, ft[vt++] = 255 & e4) : (ft[vt++] = 221, mt.setUint32(vt, e4), vt += 4);
for (let n3 = 0; n3 < e4; n3++) b3(t3[n3]);
}, b3 = (t3) => {
vt > gt && (ft = T2(vt));
var n3, r4 = typeof t3;
if ("string" === r4) {
let r5, i3 = t3.length;
if (yt && i3 >= 4 && i3 < 4096) {
if ((yt.size += i3) > 21760) {
let t4, n5, r6 = (yt[0] ? 3 * yt[0].length + yt[1].length : 0) + 10;
vt + r6 > gt && (ft = T2(vt + r6)), yt.position ? (n5 = yt, ft[vt] = 200, vt += 3, ft[vt++] = 98, t4 = vt - e3, vt += 4, Et(e3, b3, 0), mt.setUint16(t4 + e3 - 3, vt - e3 - t4)) : (ft[vt++] = 214, ft[vt++] = 98, t4 = vt - e3, vt += 4), yt = ["", ""], yt.previous = n5, yt.size = 0, yt.position = t4;
}
let n4 = bt.test(t3);
return yt[n4 ? 0 : 1] += t3, ft[vt++] = 193, void b3(n4 ? -i3 : i3);
}
r5 = i3 < 32 ? 1 : i3 < 256 ? 2 : i3 < 65536 ? 3 : 5;
let o3 = 3 * i3;
if (vt + o3 > gt && (ft = T2(vt + o3)), i3 < 64 || !a2) {
let e4, a3, o4, s3 = vt + r5;
for (e4 = 0; e4 < i3; e4++)
a3 = t3.charCodeAt(e4), a3 < 128 ? ft[s3++] = a3 : a3 < 2048 ? (ft[s3++] = a3 >> 6 | 192, ft[s3++] = 63 & a3 | 128) : 55296 == (64512 & a3) && 56320 == (64512 & (o4 = t3.charCodeAt(e4 + 1))) ? (a3 = 65536 + ((1023 & a3) << 10) + (1023 & o4), e4++, ft[s3++] = a3 >> 18 | 240, ft[s3++] = a3 >> 12 & 63 | 128, ft[s3++] = a3 >> 6 & 63 | 128, ft[s3++] = 63 & a3 | 128) : (ft[s3++] = a3 >> 12 | 224, ft[s3++] = a3 >> 6 & 63 | 128, ft[s3++] = 63 & a3 | 128);
n3 = s3 - vt - r5;
} else n3 = a2(t3, vt + r5);
n3 < 32 ? ft[vt++] = 160 | n3 : n3 < 256 ? (r5 < 2 && ft.copyWithin(vt + 2, vt + 1, vt + 1 + n3), ft[vt++] = 217, ft[vt++] = n3) : n3 < 65536 ? (r5 < 3 && ft.copyWithin(vt + 3, vt + 2, vt + 2 + n3), ft[vt++] = 218, ft[vt++] = n3 >> 8, ft[vt++] = 255 & n3) : (r5 < 5 && ft.copyWithin(vt + 5, vt + 3, vt + 3 + n3), ft[vt++] = 219, mt.setUint32(vt, n3), vt += 4), vt += n3;
} else if ("number" === r4)
if (t3 >>> 0 === t3)
t3 < 32 || t3 < 128 && false === this.useRecords || t3 < 64 && !this.randomAccessStructure ? ft[vt++] = t3 : t3 < 256 ? (ft[vt++] = 204, ft[vt++] = t3) : t3 < 65536 ? (ft[vt++] = 205, ft[vt++] = t3 >> 8, ft[vt++] = 255 & t3) : (ft[vt++] = 206, mt.setUint32(vt, t3), vt += 4);
else if ((t3 | 0) === t3)
t3 >= -32 ? ft[vt++] = 256 + t3 : t3 >= -128 ? (ft[vt++] = 208, ft[vt++] = t3 + 256) : t3 >= -32768 ? (ft[vt++] = 209, mt.setInt16(vt, t3), vt += 2) : (ft[vt++] = 210, mt.setInt32(vt, t3), vt += 4);
else {
let e4;
if ((e4 = this.useFloat32) > 0 && t3 < 4294967296 && t3 >= -2147483648) {
let n4;
if (ft[vt++] = 202, mt.setFloat32(vt, t3), e4 < 4 || ((n4 = t3 * $[(127 & ft[vt]) << 1 | ft[vt + 1] >> 7]) | 0) === n4)
return void (vt += 4);
vt--;
}
ft[vt++] = 203, mt.setFloat64(vt, t3), vt += 8;
}
else if ("object" === r4 || "function" === r4)
if (t3) {
if (i2) {
let n4 = i2.get(t3);
if (n4) {
if (!n4.id) {
let t4 = i2.idsToInsert || (i2.idsToInsert = []);
n4.id = t4.push(n4);
}
return ft[vt++] = 214, ft[vt++] = 112, mt.setUint32(vt, n4.id), void (vt += 4);
}
i2.set(t3, { offset: vt - e3 });
}
let a3 = t3.constructor;
if (a3 === Object) S2(t3);
else if (a3 === Array) y2(t3);
else if (a3 === Map)
if (this.mapAsEmptyObject) ft[vt++] = 128;
else {
(n3 = t3.size) < 16 ? ft[vt++] = 128 | n3 : n3 < 65536 ? (ft[vt++] = 222, ft[vt++] = n3 >> 8, ft[vt++] = 255 & n3) : (ft[vt++] = 223, mt.setUint32(vt, n3), vt += 4);
for (let [e4, n4] of t3) b3(e4), b3(n4);
}
else {
for (let n4 = 0, r5 = at.length; n4 < r5; n4++) {
if (t3 instanceof ot[n4]) {
let r6 = at[n4];
if (r6.write) {
r6.type && (ft[vt++] = 212, ft[vt++] = r6.type, ft[vt++] = 0);
let e4 = r6.write.call(this, t3);
return void (e4 === t3 ? Array.isArray(t3) ? y2(t3) : S2(t3) : b3(e4));
}
let i3, a4 = ft, o3 = mt, s3 = vt, u3 = e3;
ft = null;
try {
i3 = r6.pack.call(
this,
t3,
(t4) => (ft = a4, a4 = null, vt += t4, vt > gt && T2(vt), { target: ft, targetView: mt, position: vt - t4 }),
b3
);
} finally {
a4 && (ft = a4, mt = o3, vt = s3, e3 = u3, gt = ft.length - 10);
}
return void (i3 && (i3.length + vt > gt && T2(i3.length + vt), vt = Tt(i3, ft, vt, r6.type)));
}
}
if (Array.isArray(t3)) y2(t3);
else {
if (t3.toJSON) {
const e4 = t3.toJSON();
if (e4 !== t3) return b3(e4);
}
if ("function" === r4)
return b3(this.writeFunction && this.writeFunction(t3));
S2(t3);
}
}
} else ft[vt++] = 192;
else if ("boolean" === r4) ft[vt++] = t3 ? 195 : 194;
else if ("bigint" === r4) {
if (t3 < BigInt(1) << BigInt(63) && t3 >= -(BigInt(1) << BigInt(63)))
ft[vt++] = 211, mt.setBigInt64(vt, t3);
else if (t3 < BigInt(1) << BigInt(64) && t3 > 0)
ft[vt++] = 207, mt.setBigUint64(vt, t3);
else {
if (!this.largeBigIntToFloat) {
if (this.useBigIntExtension && t3 < 2n ** 1023n && t3 > -(2n ** 1023n)) {
ft[vt++] = 199, vt++, ft[vt++] = 66;
let e4, n4 = [];
do {
let r5 = 0xffn & t3;
e4 = (0x80n & r5) === (t3 < 0n ? 0x80n : 0n), n4.push(r5), t3 >>= 8n;
} while (0n !== t3 && -1n !== t3 || !e4);
ft[vt - 2] = n4.length;
for (let t4 = n4.length; t4 > 0; ) ft[vt++] = Number(n4[--t4]);
return;
}
throw new RangeError(
t3 + " was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension or set largeBigIntToFloat to convert to float-64"
);
}
ft[vt++] = 203, mt.setFloat64(vt, Number(t3));
}
vt += 8;
} else {
if ("undefined" !== r4) throw new Error("Unknown type: " + r4);
this.encodeUndefinedAsNil ? ft[vt++] = 192 : (ft[vt++] = 212, ft[vt++] = 0, ft[vt++] = 0);
}
}, x2 = this.variableMapSize || this.coercibleKeyAsNumber ? (t3) => {
let e4, n3 = Object.keys(t3), r4 = n3.length;
if (r4 < 16 ? ft[vt++] = 128 | r4 : r4 < 65536 ? (ft[vt++] = 222, ft[vt++] = r4 >> 8, ft[vt++] = 255 & r4) : (ft[vt++] = 223, mt.setUint32(vt, r4), vt += 4), this.coercibleKeyAsNumber)
for (let i3 = 0; i3 < r4; i3++) {
e4 = n3[i3];
let r5 = Number(e4);
b3(isNaN(r5) ? e4 : r5), b3(t3[e4]);
}
else for (let i3 = 0; i3 < r4; i3++) b3(e4 = n3[i3]), b3(t3[e4]);
} : (t3) => {
ft[vt++] = 222;
let n3 = vt - e3;
vt += 2;
let r4 = 0;
for (let e4 in t3)
("function" != typeof t3.hasOwnProperty || t3.hasOwnProperty(e4)) && (b3(e4), b3(t3[e4]), r4++);
ft[n3++ + e3] = r4 >> 8, ft[n3 + e3] = 255 & r4;
}, w2 = false === this.useRecords ? x2 : t2.progressiveRecords && !h2 ? (t3) => {
let n3, i3, a3 = r3.transitions || (r3.transitions = /* @__PURE__ */ Object.create(null)), o3 = vt++ - e3;
for (let s3 in t3)
if ("function" != typeof t3.hasOwnProperty || t3.hasOwnProperty(s3)) {
if (n3 = a3[s3], n3) a3 = n3;
else {
let u3 = Object.keys(t3), c3 = a3;
a3 = r3.transitions;
let l3 = 0;
for (let t4 = 0, e4 = u3.length; t4 < e4; t4++) {
let e5 = u3[t4];
n3 = a3[e5], n3 || (n3 = a3[e5] = /* @__PURE__ */ Object.create(null), l3++), a3 = n3;
}
o3 + e3 + 1 == vt ? (vt--, E2(a3, u3, l3)) : k2(a3, u3, o3, l3), i3 = true, a3 = c3[s3];
}
b3(t3[s3]);
}
if (!i3) {
let n4 = a3[xt];
n4 ? ft[o3 + e3] = n4 : k2(a3, Object.keys(t3), o3, 0);
}
} : (t3) => {
let e4, n3 = r3.transitions || (r3.transitions = /* @__PURE__ */ Object.create(null)), i3 = 0;
for (let r4 in t3)
("function" != typeof t3.hasOwnProperty || t3.hasOwnProperty(r4)) && (e4 = n3[r4], e4 || (e4 = n3[r4] = /* @__PURE__ */ Object.create(null), i3++), n3 = e4);
let a3 = n3[xt];
a3 ? a3 >= 96 && h2 ? (ft[vt++] = 96 + (31 & (a3 -= 96)), ft[vt++] = a3 >> 5) : ft[vt++] = a3 : E2(n3, n3.__keys__ || Object.keys(t3), i3);
for (let e5 in t3)
("function" != typeof t3.hasOwnProperty || t3.hasOwnProperty(e5)) && b3(t3[e5]);
}, _2 = "function" == typeof this.useRecords && this.useRecords, S2 = _2 ? (t3) => {
_2(t3) ? w2(t3) : x2(t3);
} : w2, T2 = (t3) => {
let n3;
if (t3 > 16777216) {
if (t3 - e3 > pt)
throw new Error(
"Packed buffer would be larger than maximum buffer size"
);
n3 = Math.min(
pt,
4096 * Math.round(
Math.max((t3 - e3) * (t3 > 67108864 ? 1.25 : 2), 4194304) / 4096
)
);
} else n3 = 1 + (Math.max(t3 - e3 << 2, ft.length - 1) >> 12) << 12;
let r4 = new lt(n3);
return mt = r4.dataView || (r4.dataView = new DataView(r4.buffer, 0, n3)), t3 = Math.min(t3, ft.length), ft.copy ? ft.copy(r4, 0, e3, t3) : r4.set(ft.slice(e3, t3)), vt -= e3, e3 = 0, gt = r4.length - 10, ft = r4;
}, E2 = (t3, e4, i3) => {
let a3 = r3.nextId;
a3 || (a3 = 64), a3 < p2 && this.shouldShareStructure && !this.shouldShareStructure(e4) ? (a3 = r3.nextOwnId, a3 < f2 || (a3 = p2), r3.nextOwnId = a3 + 1) : (a3 >= f2 && (a3 = p2), r3.nextId = a3 + 1);
let o3 = e4.highByte = a3 >= 96 && h2 ? a3 - 96 >> 5 : -1;
t3[xt] = a3, t3.__keys__ = e4, r3[a3 - 64] = e4, a3 < p2 ? (e4.isShared = true, r3.sharedLength = a3 - 63, n2 = true, o3 >= 0 ? (ft[vt++] = 96 + (31 & a3), ft[vt++] = o3) : ft[vt++] = a3) : (o3 >= 0 ? (ft[vt++] = 213, ft[vt++] = 114, ft[vt++] = 96 + (31 & a3), ft[vt++] = o3) : (ft[vt++] = 212, ft[vt++] = 114, ft[vt++] = a3), i3 && (m2 += g2 * i3), d2.length >= l2 && (d2.shift()[xt] = 0), d2.push(t3), b3(e4));
}, k2 = (t3, n3, r4, i3) => {
let a3 = ft, o3 = vt, s3 = gt, u3 = e3;
ft = dt, vt = 0, e3 = 0, ft || (dt = ft = new lt(8192)), gt = ft.length - 10, E2(t3, n3, i3), dt = ft;
let c3 = vt;
if (ft = a3, vt = o3, gt = s3, e3 = u3, c3 > 1) {
let t4 = vt + c3 - 1;
t4 > gt && T2(t4);
let n4 = r4 + e3;
ft.copyWithin(n4 + c3, n4 + 1, vt), ft.set(dt.slice(0, c3), n4), vt = t4;
} else ft[r4 + e3] = dt[0];
}, I2 = (t3) => {
let i3 = (void 0)(
t3,
ft,
e3,
vt,
r3,
T2,
(t4, e4, r4) => {
if (r4) return n2 = true;
vt = e4;
let i4 = ft;
return b3(t4), v2(), i4 !== ft ? { position: vt, targetView: mt, target: ft } : vt;
},
this
);
if (0 === i3) return S2(t3);
vt = i3;
};
}
useBuffer(t2) {
ft = t2, mt = new DataView(ft.buffer, ft.byteOffset, ft.byteLength), vt = 0;
}
clearSharedData() {
this.structures && (this.structures = []), this.typedStructs && (this.typedStructs = []);
}
}
function _t(t2, e3, n2, r3) {
let i2 = t2.byteLength;
if (i2 + 1 < 256) {
var { target: a2, position: o2 } = n2(4 + i2);
a2[o2++] = 199, a2[o2++] = i2 + 1;
} else if (i2 + 1 < 65536) {
var { target: a2, position: o2 } = n2(5 + i2);
a2[o2++] = 200, a2[o2++] = i2 + 1 >> 8, a2[o2++] = i2 + 1 & 255;
} else {
var { target: a2, position: o2, targetView: s2 } = n2(7 + i2);
a2[o2++] = 201, s2.setUint32(o2, i2 + 1), o2 += 4;
}
a2[o2++] = 116, a2[o2++] = e3, t2.buffer || (t2 = new Uint8Array(t2)), a2.set(new Uint8Array(t2.buffer, t2.byteOffset, t2.byteLength), o2);
}
function St(t2, e3) {
let n2 = t2.byteLength;
var r3, i2;
if (n2 < 256) {
var { target: r3, position: i2 } = e3(n2 + 2);
r3[i2++] = 196, r3[i2++] = n2;
} else if (n2 < 65536) {
var { target: r3, position: i2 } = e3(n2 + 3);
r3[i2++] = 197, r3[i2++] = n2 >> 8, r3[i2++] = 255 & n2;
} else {
var { target: r3, position: i2, targetView: a2 } = e3(n2 + 5);
r3[i2++] = 198, a2.setUint32(i2, n2), i2 += 4;
}
r3.set(t2, i2);
}
function Tt(t2, e3, n2, r3) {
let i2 = t2.length;
switch (i2) {
case 1:
e3[n2++] = 212;
break;
case 2:
e3[n2++] = 213;
break;
case 4:
e3[n2++] = 214;
break;
case 8:
e3[n2++] = 215;
break;
case 16:
e3[n2++] = 216;
break;
default:
i2 < 256 ? (e3[n2++] = 199, e3[n2++] = i2) : i2 < 65536 ? (e3[n2++] = 200, e3[n2++] = i2 >> 8, e3[n2++] = 255 & i2) : (e3[n2++] = 201, e3[n2++] = i2 >> 24, e3[n2++] = i2 >> 16 & 255, e3[n2++] = i2 >> 8 & 255, e3[n2++] = 255 & i2);
}
return e3[n2++] = r3, e3.set(t2, n2), n2 += i2;
}
function Et(t2, e3, n2) {
if (yt.length > 0) {
mt.setUint32(yt.position + t2, vt + n2 - yt.position - t2), yt.stringsPosition = vt - t2;
let r3 = yt;
yt = null, e3(r3[0]), e3(r3[1]);
}
}
ot = [
Date,
Set,
Error,
RegExp,
ArrayBuffer,
Object.getPrototypeOf(Uint8Array.prototype).constructor,
g
], at = [
{
pack(t2, e3, n2) {
let r3 = t2.getTime() / 1e3;
if ((this.useTimestamp32 || 0 === t2.getMilliseconds()) && r3 >= 0 && r3 < 4294967296) {
let { target: t3, targetView: n3, position: i2 } = e3(6);
t3[i2++] = 214, t3[i2++] = 255, n3.setUint32(i2, r3);
} else if (r3 > 0 && r3 < 4294967296) {
let { target: n3, targetView: i2, position: a2 } = e3(10);
n3[a2++] = 215, n3[a2++] = 255, i2.setUint32(
a2,
4e6 * t2.getMilliseconds() + (r3 / 1e3 / 4294967296 | 0)
), i2.setUint32(a2 + 4, r3);
} else if (isNaN(r3)) {
if (this.onInvalidDate) return e3(0), n2(this.onInvalidDate());
let { target: t3, targetView: r4, position: i2 } = e3(3);
t3[i2++] = 212, t3[i2++] = 255, t3[i2++] = 255;
} else {
let { target: n3, targetView: i2, position: a2 } = e3(15);
n3[a2++] = 199, n3[a2++] = 12, n3[a2++] = 255, i2.setUint32(a2, 1e6 * t2.getMilliseconds()), i2.setBigInt64(a2 + 4, BigInt(Math.floor(r3)));
}
}
},
{
pack(t2, e3, n2) {
if (this.setAsEmptyObject) return e3(0), n2({});
let r3 = Array.from(t2), { target: i2, position: a2 } = e3(this.moreTypes ? 3 : 0);
this.moreTypes && (i2[a2++] = 212, i2[a2++] = 115, i2[a2++] = 0), n2(r3);
}
},
{
pack(t2, e3, n2) {
let { target: r3, position: i2 } = e3(this.moreTypes ? 3 : 0);
this.moreTypes && (r3[i2++] = 212, r3[i2++] = 101, r3[i2++] = 0), n2([t2.name, t2.message]);
}
},
{
pack(t2, e3, n2) {
let { target: r3, position: i2 } = e3(this.moreTypes ? 3 : 0);
this.moreTypes && (r3[i2++] = 212, r3[i2++] = 120, r3[i2++] = 0), n2([t2.source, t2.flags]);
}
},
{
pack(t2, n2) {
this.moreTypes ? _t(t2, 16, n2) : St(ct ? e.from(t2) : new Uint8Array(t2), n2);
}
},
{
pack(t2, e3) {
let n2 = t2.constructor;
n2 !== ht && this.moreTypes ? _t(t2, X.indexOf(n2.name), e3) : St(t2, e3);
}
},
{
pack(t2, e3) {
let { target: n2, position: r3 } = e3(1);
n2[r3] = 193;
}
}
];
let kt = new wt({ useRecords: false });
const It = kt.pack, At = kt.pack, Nt = wt, { NEVER: Ct, ALWAYS: Rt, DECIMAL_ROUND: Ot, DECIMAL_FIT: Dt } = rt, Mt = 512, Ft = 1024, Pt = 2048;
const Lt = function(t2, n2 = {}) {
if (!t2 || "object" != typeof t2)
throw new Error(
"first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise"
);
const r3 = new x(n2);
let i2;
const a2 = (t3) => {
let n3;
i2 && (t3 = e.concat([i2, t3]), i2 = void 0);
try {
n3 = r3.unpackMultiple(t3);
} catch (e3) {
if (!e3.incomplete) throw e3;
i2 = t3.slice(e3.lastPosition), n3 = e3.values;
}
return n3;
};
return "function" == typeof t2[Symbol.iterator] ? function* () {
for (const e3 of t2) yield* a2(e3);
}() : "function" == typeof t2[Symbol.asyncIterator] ? async function* () {
for await (const e3 of t2) yield* a2(e3);
}() : void 0;
}, Bt = function(t2, e3 = {}) {
if (t2 && "object" == typ