@d-id/client-sdk
Version:
d-id client sdk
1,719 lines • 675 kB
JavaScript
function sc(i, e) {
return e.forEach(function(t) {
t && typeof t != "string" && !Array.isArray(t) && Object.keys(t).forEach(function(n) {
if (n !== "default" && !(n in i)) {
var s = Object.getOwnPropertyDescriptor(t, n);
Object.defineProperty(i, n, s.get ? s : { enumerable: !0, get: function() {
return t[n];
} });
}
});
}), Object.freeze(i);
}
var rc = Object.defineProperty, ac = (i, e, t) => e in i ? rc(i, e, {
enumerable: !0,
configurable: !0,
writable: !0,
value: t
}) : i[e] = t, Ms = (i, e, t) => ac(i, typeof e != "symbol" ? e + "" : e, t);
class ce {
constructor() {
Ms(this, "_locking"), Ms(this, "_locks"), this._locking = Promise.resolve(), this._locks = 0;
}
isLocked() {
return this._locks > 0;
}
lock() {
this._locks += 1;
let e;
const t = new Promise((s) => e = () => {
this._locks -= 1, s();
}), n = this._locking.then(() => e);
return this._locking = this._locking.then(() => t), n;
}
}
function Q(i, e) {
if (!i)
throw new Error(e);
}
const oc = 34028234663852886e22, cc = -34028234663852886e22, dc = 4294967295, lc = 2147483647, uc = -2147483648;
function un(i) {
if (typeof i != "number") throw new Error("invalid int 32: " + typeof i);
if (!Number.isInteger(i) || i > lc || i < uc) throw new Error("invalid int 32: " + i);
}
function Ei(i) {
if (typeof i != "number") throw new Error("invalid uint 32: " + typeof i);
if (!Number.isInteger(i) || i > dc || i < 0) throw new Error("invalid uint 32: " + i);
}
function Yr(i) {
if (typeof i != "number") throw new Error("invalid float 32: " + typeof i);
if (Number.isFinite(i) && (i > oc || i < cc))
throw new Error("invalid float 32: " + i);
}
const Qr = Symbol("@bufbuild/protobuf/enum-type");
function hc(i) {
const e = i[Qr];
return Q(e, "missing enum type on enum object"), e;
}
function Xr(i, e, t, n) {
i[Qr] = Zr(e, t.map((s) => ({
no: s.no,
name: s.name,
localName: i[s.no]
})));
}
function Zr(i, e, t) {
const n = /* @__PURE__ */ Object.create(null), s = /* @__PURE__ */ Object.create(null), r = [];
for (const o of e) {
const a = $r(o);
r.push(a), n[o.name] = a, s[o.no] = a;
}
return {
typeName: i,
values: r,
// We do not surface options at this time
// options: opt?.options ?? Object.create(null),
findName(o) {
return n[o];
},
findNumber(o) {
return s[o];
}
};
}
function mc(i, e, t) {
const n = {};
for (const s of e) {
const r = $r(s);
n[r.localName] = r.no, n[r.no] = r.localName;
}
return Xr(n, i, e), n;
}
function $r(i) {
return "localName" in i ? i : Object.assign(Object.assign({}, i), {
localName: i.name
});
}
class es {
/**
* Compare with a message of the same type.
* Note that this function disregards extensions and unknown fields.
*/
equals(e) {
return this.getType().runtime.util.equals(this.getType(), this, e);
}
/**
* Create a deep copy.
*/
clone() {
return this.getType().runtime.util.clone(this);
}
/**
* Parse from binary data, merging fields.
*
* Repeated fields are appended. Map entries are added, overwriting
* existing keys.
*
* If a message field is already present, it will be merged with the
* new data.
*/
fromBinary(e, t) {
const n = this.getType(), s = n.runtime.bin, r = s.makeReadOptions(t);
return s.readMessage(this, r.readerFactory(e), e.byteLength, r), this;
}
/**
* Parse a message from a JSON value.
*/
fromJson(e, t) {
const n = this.getType(), s = n.runtime.json, r = s.makeReadOptions(t);
return s.readMessage(n, e, r, this), this;
}
/**
* Parse a message from a JSON string.
*/
fromJsonString(e, t) {
let n;
try {
n = JSON.parse(e);
} catch (s) {
throw new Error("cannot decode ".concat(this.getType().typeName, " from JSON: ").concat(s instanceof Error ? s.message : String(s)));
}
return this.fromJson(n, t);
}
/**
* Serialize the message to binary data.
*/
toBinary(e) {
const t = this.getType(), n = t.runtime.bin, s = n.makeWriteOptions(e), r = s.writerFactory();
return n.writeMessage(this, r, s), r.finish();
}
/**
* Serialize the message to a JSON value, a JavaScript value that can be
* passed to JSON.stringify().
*/
toJson(e) {
const t = this.getType(), n = t.runtime.json, s = n.makeWriteOptions(e);
return n.writeMessage(this, s);
}
/**
* Serialize the message to a JSON string.
*/
toJsonString(e) {
var t;
const n = this.toJson(e);
return JSON.stringify(n, null, (t = e == null ? void 0 : e.prettySpaces) !== null && t !== void 0 ? t : 0);
}
/**
* Override for serialization behavior. This will be invoked when calling
* JSON.stringify on this message (i.e. JSON.stringify(msg)).
*
* Note that this will not serialize google.protobuf.Any with a packed
* message because the protobuf JSON format specifies that it needs to be
* unpacked, and this is only possible with a type registry to look up the
* message type. As a result, attempting to serialize a message with this
* type will throw an Error.
*
* This method is protected because you should not need to invoke it
* directly -- instead use JSON.stringify or toJsonString for
* stringified JSON. Alternatively, if actual JSON is desired, you should
* use toJson.
*/
toJSON() {
return this.toJson({
emitDefaultValues: !0
});
}
/**
* Retrieve the MessageType of this message - a singleton that represents
* the protobuf message declaration and provides metadata for reflection-
* based operations.
*/
getType() {
return Object.getPrototypeOf(this).constructor;
}
}
function fc(i, e, t, n) {
var s;
const r = (s = n == null ? void 0 : n.localName) !== null && s !== void 0 ? s : e.substring(e.lastIndexOf(".") + 1), o = {
[r]: function(a) {
i.util.initFields(this), i.util.initPartial(a, this);
}
}[r];
return Object.setPrototypeOf(o.prototype, new es()), Object.assign(o, {
runtime: i,
typeName: e,
fields: i.util.newFieldList(t),
fromBinary(a, c) {
return new o().fromBinary(a, c);
},
fromJson(a, c) {
return new o().fromJson(a, c);
},
fromJsonString(a, c) {
return new o().fromJsonString(a, c);
},
equals(a, c) {
return i.util.equals(o, a, c);
}
}), o;
}
function pc() {
let i = 0, e = 0;
for (let n = 0; n < 28; n += 7) {
let s = this.buf[this.pos++];
if (i |= (s & 127) << n, !(s & 128))
return this.assertBounds(), [i, e];
}
let t = this.buf[this.pos++];
if (i |= (t & 15) << 28, e = (t & 112) >> 4, !(t & 128))
return this.assertBounds(), [i, e];
for (let n = 3; n <= 31; n += 7) {
let s = this.buf[this.pos++];
if (e |= (s & 127) << n, !(s & 128))
return this.assertBounds(), [i, e];
}
throw new Error("invalid varint");
}
function si(i, e, t) {
for (let r = 0; r < 28; r = r + 7) {
const o = i >>> r, a = !(!(o >>> 7) && e == 0), c = (a ? o | 128 : o) & 255;
if (t.push(c), !a)
return;
}
const n = i >>> 28 & 15 | (e & 7) << 4, s = !!(e >> 3);
if (t.push((s ? n | 128 : n) & 255), !!s) {
for (let r = 3; r < 31; r = r + 7) {
const o = e >>> r, a = !!(o >>> 7), c = (a ? o | 128 : o) & 255;
if (t.push(c), !a)
return;
}
t.push(e >>> 31 & 1);
}
}
const hn = 4294967296;
function xs(i) {
const e = i[0] === "-";
e && (i = i.slice(1));
const t = 1e6;
let n = 0, s = 0;
function r(o, a) {
const c = Number(i.slice(o, a));
s *= t, n = n * t + c, n >= hn && (s = s + (n / hn | 0), n = n % hn);
}
return r(-24, -18), r(-18, -12), r(-12, -6), r(-6), e ? ta(n, s) : ts(n, s);
}
function gc(i, e) {
let t = ts(i, e);
const n = t.hi & 2147483648;
n && (t = ta(t.lo, t.hi));
const s = ea(t.lo, t.hi);
return n ? "-" + s : s;
}
function ea(i, e) {
if ({
lo: i,
hi: e
} = vc(i, e), e <= 2097151)
return String(hn * e + i);
const t = i & 16777215, n = (i >>> 24 | e << 8) & 16777215, s = e >> 16 & 65535;
let r = t + n * 6777216 + s * 6710656, o = n + s * 8147497, a = s * 2;
const c = 1e7;
return r >= c && (o += Math.floor(r / c), r %= c), o >= c && (a += Math.floor(o / c), o %= c), a.toString() + As(o) + As(r);
}
function vc(i, e) {
return {
lo: i >>> 0,
hi: e >>> 0
};
}
function ts(i, e) {
return {
lo: i | 0,
hi: e | 0
};
}
function ta(i, e) {
return e = ~e, i ? i = ~i + 1 : e += 1, ts(i, e);
}
const As = (i) => {
const e = String(i);
return "0000000".slice(e.length) + e;
};
function Ds(i, e) {
if (i >= 0) {
for (; i > 127; )
e.push(i & 127 | 128), i = i >>> 7;
e.push(i);
} else {
for (let t = 0; t < 9; t++)
e.push(i & 127 | 128), i = i >> 7;
e.push(1);
}
}
function bc() {
let i = this.buf[this.pos++], e = i & 127;
if (!(i & 128))
return this.assertBounds(), e;
if (i = this.buf[this.pos++], e |= (i & 127) << 7, !(i & 128))
return this.assertBounds(), e;
if (i = this.buf[this.pos++], e |= (i & 127) << 14, !(i & 128))
return this.assertBounds(), e;
if (i = this.buf[this.pos++], e |= (i & 127) << 21, !(i & 128))
return this.assertBounds(), e;
i = this.buf[this.pos++], e |= (i & 15) << 28;
for (let t = 5; i & 128 && t < 10; t++) i = this.buf[this.pos++];
if (i & 128) throw new Error("invalid varint");
return this.assertBounds(), e >>> 0;
}
function yc() {
const i = new DataView(new ArrayBuffer(8));
if (typeof BigInt == "function" && typeof i.getBigInt64 == "function" && typeof i.getBigUint64 == "function" && typeof i.setBigInt64 == "function" && typeof i.setBigUint64 == "function" && (typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1")) {
const s = BigInt("-9223372036854775808"), r = BigInt("9223372036854775807"), o = BigInt("0"), a = BigInt("18446744073709551615");
return {
zero: BigInt(0),
supported: !0,
parse(c) {
const d = typeof c == "bigint" ? c : BigInt(c);
if (d > r || d < s)
throw new Error("int64 invalid: ".concat(c));
return d;
},
uParse(c) {
const d = typeof c == "bigint" ? c : BigInt(c);
if (d > a || d < o)
throw new Error("uint64 invalid: ".concat(c));
return d;
},
enc(c) {
return i.setBigInt64(0, this.parse(c), !0), {
lo: i.getInt32(0, !0),
hi: i.getInt32(4, !0)
};
},
uEnc(c) {
return i.setBigInt64(0, this.uParse(c), !0), {
lo: i.getInt32(0, !0),
hi: i.getInt32(4, !0)
};
},
dec(c, d) {
return i.setInt32(0, c, !0), i.setInt32(4, d, !0), i.getBigInt64(0, !0);
},
uDec(c, d) {
return i.setInt32(0, c, !0), i.setInt32(4, d, !0), i.getBigUint64(0, !0);
}
};
}
const t = (s) => Q(/^-?[0-9]+$/.test(s), "int64 invalid: ".concat(s)), n = (s) => Q(/^[0-9]+$/.test(s), "uint64 invalid: ".concat(s));
return {
zero: "0",
supported: !1,
parse(s) {
return typeof s != "string" && (s = s.toString()), t(s), s;
},
uParse(s) {
return typeof s != "string" && (s = s.toString()), n(s), s;
},
enc(s) {
return typeof s != "string" && (s = s.toString()), t(s), xs(s);
},
uEnc(s) {
return typeof s != "string" && (s = s.toString()), n(s), xs(s);
},
dec(s, r) {
return gc(s, r);
},
uDec(s, r) {
return ea(s, r);
}
};
}
const J = yc();
var S;
(function(i) {
i[i.DOUBLE = 1] = "DOUBLE", i[i.FLOAT = 2] = "FLOAT", i[i.INT64 = 3] = "INT64", i[i.UINT64 = 4] = "UINT64", i[i.INT32 = 5] = "INT32", i[i.FIXED64 = 6] = "FIXED64", i[i.FIXED32 = 7] = "FIXED32", i[i.BOOL = 8] = "BOOL", i[i.STRING = 9] = "STRING", i[i.BYTES = 12] = "BYTES", i[i.UINT32 = 13] = "UINT32", i[i.SFIXED32 = 15] = "SFIXED32", i[i.SFIXED64 = 16] = "SFIXED64", i[i.SINT32 = 17] = "SINT32", i[i.SINT64 = 18] = "SINT64";
})(S || (S = {}));
var st;
(function(i) {
i[i.BIGINT = 0] = "BIGINT", i[i.STRING = 1] = "STRING";
})(st || (st = {}));
function Ye(i, e, t) {
if (e === t)
return !0;
if (i == S.BYTES) {
if (!(e instanceof Uint8Array) || !(t instanceof Uint8Array) || e.length !== t.length)
return !1;
for (let n = 0; n < e.length; n++)
if (e[n] !== t[n])
return !1;
return !0;
}
switch (i) {
case S.UINT64:
case S.FIXED64:
case S.INT64:
case S.SFIXED64:
case S.SINT64:
return e == t;
}
return !1;
}
function Ot(i, e) {
switch (i) {
case S.BOOL:
return !1;
case S.UINT64:
case S.FIXED64:
case S.INT64:
case S.SFIXED64:
case S.SINT64:
return e == 0 ? J.zero : "0";
case S.DOUBLE:
case S.FLOAT:
return 0;
case S.BYTES:
return new Uint8Array(0);
case S.STRING:
return "";
default:
return 0;
}
}
function na(i, e) {
switch (i) {
case S.BOOL:
return e === !1;
case S.STRING:
return e === "";
case S.BYTES:
return e instanceof Uint8Array && !e.byteLength;
default:
return e == 0;
}
}
var ee;
(function(i) {
i[i.Varint = 0] = "Varint", i[i.Bit64 = 1] = "Bit64", i[i.LengthDelimited = 2] = "LengthDelimited", i[i.StartGroup = 3] = "StartGroup", i[i.EndGroup = 4] = "EndGroup", i[i.Bit32 = 5] = "Bit32";
})(ee || (ee = {}));
class kc {
constructor(e) {
this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
}
/**
* Return all bytes written and reset this writer.
*/
finish() {
this.chunks.push(new Uint8Array(this.buf));
let e = 0;
for (let s = 0; s < this.chunks.length; s++) e += this.chunks[s].length;
let t = new Uint8Array(e), n = 0;
for (let s = 0; s < this.chunks.length; s++)
t.set(this.chunks[s], n), n += this.chunks[s].length;
return this.chunks = [], t;
}
/**
* Start a new fork for length-delimited data like a message
* or a packed repeated field.
*
* Must be joined later with `join()`.
*/
fork() {
return this.stack.push({
chunks: this.chunks,
buf: this.buf
}), this.chunks = [], this.buf = [], this;
}
/**
* Join the last fork. Write its length and bytes, then
* return to the previous state.
*/
join() {
let e = this.finish(), t = this.stack.pop();
if (!t) throw new Error("invalid state, fork stack empty");
return this.chunks = t.chunks, this.buf = t.buf, this.uint32(e.byteLength), this.raw(e);
}
/**
* Writes a tag (field number and wire type).
*
* Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
*
* Generated code should compute the tag ahead of time and call `uint32()`.
*/
tag(e, t) {
return this.uint32((e << 3 | t) >>> 0);
}
/**
* Write a chunk of raw bytes.
*/
raw(e) {
return this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []), this.chunks.push(e), this;
}
/**
* Write a `uint32` value, an unsigned 32 bit varint.
*/
uint32(e) {
for (Ei(e); e > 127; )
this.buf.push(e & 127 | 128), e = e >>> 7;
return this.buf.push(e), this;
}
/**
* Write a `int32` value, a signed 32 bit varint.
*/
int32(e) {
return un(e), Ds(e, this.buf), this;
}
/**
* Write a `bool` value, a variant.
*/
bool(e) {
return this.buf.push(e ? 1 : 0), this;
}
/**
* Write a `bytes` value, length-delimited arbitrary data.
*/
bytes(e) {
return this.uint32(e.byteLength), this.raw(e);
}
/**
* Write a `string` value, length-delimited data converted to UTF-8 text.
*/
string(e) {
let t = this.textEncoder.encode(e);
return this.uint32(t.byteLength), this.raw(t);
}
/**
* Write a `float` value, 32-bit floating point number.
*/
float(e) {
Yr(e);
let t = new Uint8Array(4);
return new DataView(t.buffer).setFloat32(0, e, !0), this.raw(t);
}
/**
* Write a `double` value, a 64-bit floating point number.
*/
double(e) {
let t = new Uint8Array(8);
return new DataView(t.buffer).setFloat64(0, e, !0), this.raw(t);
}
/**
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
*/
fixed32(e) {
Ei(e);
let t = new Uint8Array(4);
return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
}
/**
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
*/
sfixed32(e) {
un(e);
let t = new Uint8Array(4);
return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
}
/**
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
*/
sint32(e) {
return un(e), e = (e << 1 ^ e >> 31) >>> 0, Ds(e, this.buf), this;
}
/**
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
*/
sfixed64(e) {
let t = new Uint8Array(8), n = new DataView(t.buffer), s = J.enc(e);
return n.setInt32(0, s.lo, !0), n.setInt32(4, s.hi, !0), this.raw(t);
}
/**
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
*/
fixed64(e) {
let t = new Uint8Array(8), n = new DataView(t.buffer), s = J.uEnc(e);
return n.setInt32(0, s.lo, !0), n.setInt32(4, s.hi, !0), this.raw(t);
}
/**
* Write a `int64` value, a signed 64-bit varint.
*/
int64(e) {
let t = J.enc(e);
return si(t.lo, t.hi, this.buf), this;
}
/**
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
*/
sint64(e) {
let t = J.enc(e), n = t.hi >> 31, s = t.lo << 1 ^ n, r = (t.hi << 1 | t.lo >>> 31) ^ n;
return si(s, r, this.buf), this;
}
/**
* Write a `uint64` value, an unsigned 64-bit varint.
*/
uint64(e) {
let t = J.uEnc(e);
return si(t.lo, t.hi, this.buf), this;
}
}
class Tc {
constructor(e, t) {
this.varint64 = pc, this.uint32 = bc, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength), this.textDecoder = t ?? new TextDecoder();
}
/**
* Reads a tag - field number and wire type.
*/
tag() {
let e = this.uint32(), t = e >>> 3, n = e & 7;
if (t <= 0 || n < 0 || n > 5) throw new Error("illegal tag: field no " + t + " wire type " + n);
return [t, n];
}
/**
* Skip one element and return the skipped data.
*
* When skipping StartGroup, provide the tags field number to check for
* matching field number in the EndGroup tag.
*/
skip(e, t) {
let n = this.pos;
switch (e) {
case ee.Varint:
for (; this.buf[this.pos++] & 128; )
;
break;
case ee.Bit64:
this.pos += 4;
case ee.Bit32:
this.pos += 4;
break;
case ee.LengthDelimited:
let s = this.uint32();
this.pos += s;
break;
case ee.StartGroup:
for (; ; ) {
const [r, o] = this.tag();
if (o === ee.EndGroup) {
if (t !== void 0 && r !== t)
throw new Error("invalid end group tag");
break;
}
this.skip(o, r);
}
break;
default:
throw new Error("cant skip wire type " + e);
}
return this.assertBounds(), this.buf.subarray(n, this.pos);
}
/**
* Throws error if position in byte array is out of range.
*/
assertBounds() {
if (this.pos > this.len) throw new RangeError("premature EOF");
}
/**
* Read a `int32` field, a signed 32 bit varint.
*/
int32() {
return this.uint32() | 0;
}
/**
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
*/
sint32() {
let e = this.uint32();
return e >>> 1 ^ -(e & 1);
}
/**
* Read a `int64` field, a signed 64-bit varint.
*/
int64() {
return J.dec(...this.varint64());
}
/**
* Read a `uint64` field, an unsigned 64-bit varint.
*/
uint64() {
return J.uDec(...this.varint64());
}
/**
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
*/
sint64() {
let [e, t] = this.varint64(), n = -(e & 1);
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, J.dec(e, t);
}
/**
* Read a `bool` field, a variant.
*/
bool() {
let [e, t] = this.varint64();
return e !== 0 || t !== 0;
}
/**
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
*/
fixed32() {
return this.view.getUint32((this.pos += 4) - 4, !0);
}
/**
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
*/
sfixed32() {
return this.view.getInt32((this.pos += 4) - 4, !0);
}
/**
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
*/
fixed64() {
return J.uDec(this.sfixed32(), this.sfixed32());
}
/**
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
*/
sfixed64() {
return J.dec(this.sfixed32(), this.sfixed32());
}
/**
* Read a `float` field, 32-bit floating point number.
*/
float() {
return this.view.getFloat32((this.pos += 4) - 4, !0);
}
/**
* Read a `double` field, a 64-bit floating point number.
*/
double() {
return this.view.getFloat64((this.pos += 8) - 8, !0);
}
/**
* Read a `bytes` field, length-delimited arbitrary data.
*/
bytes() {
let e = this.uint32(), t = this.pos;
return this.pos += e, this.assertBounds(), this.buf.subarray(t, t + e);
}
/**
* Read a `string` field, length-delimited data converted to UTF-8 text.
*/
string() {
return this.textDecoder.decode(this.bytes());
}
}
function Sc(i, e, t, n) {
let s;
return {
typeName: e,
extendee: t,
get field() {
if (!s) {
const r = typeof n == "function" ? n() : n;
r.name = e.split(".").pop(), r.jsonName = "[".concat(e, "]"), s = i.util.newFieldList([r]).list()[0];
}
return s;
},
runtime: i
};
}
function ia(i) {
const e = i.field.localName, t = /* @__PURE__ */ Object.create(null);
return t[e] = Cc(i), [t, () => t[e]];
}
function Cc(i) {
const e = i.field;
if (e.repeated)
return [];
if (e.default !== void 0)
return e.default;
switch (e.kind) {
case "enum":
return e.T.values[0].no;
case "scalar":
return Ot(e.T, e.L);
case "message":
const t = e.T, n = new t();
return t.fieldWrapper ? t.fieldWrapper.unwrapField(n) : n;
case "map":
throw "map fields are not allowed to be extensions";
}
}
function Ec(i, e) {
if (!e.repeated && (e.kind == "enum" || e.kind == "scalar")) {
for (let t = i.length - 1; t >= 0; --t)
if (i[t].no == e.no)
return [i[t]];
return [];
}
return i.filter((t) => t.no === e.no);
}
let He = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), Ln = [];
for (let i = 0; i < He.length; i++) Ln[He[i].charCodeAt(0)] = i;
Ln[45] = He.indexOf("+");
Ln[95] = He.indexOf("/");
const sa = {
/**
* Decodes a base64 string to a byte array.
*
* - ignores white-space, including line breaks and tabs
* - allows inner padding (can decode concatenated base64 strings)
* - does not require padding
* - understands base64url encoding:
* "-" instead of "+",
* "_" instead of "/",
* no padding
*/
dec(i) {
let e = i.length * 3 / 4;
i[i.length - 2] == "=" ? e -= 2 : i[i.length - 1] == "=" && (e -= 1);
let t = new Uint8Array(e), n = 0, s = 0, r, o = 0;
for (let a = 0; a < i.length; a++) {
if (r = Ln[i.charCodeAt(a)], r === void 0)
switch (i[a]) {
case "=":
s = 0;
case `
`:
case "\r":
case " ":
case " ":
continue;
default:
throw Error("invalid base64 string.");
}
switch (s) {
case 0:
o = r, s = 1;
break;
case 1:
t[n++] = o << 2 | (r & 48) >> 4, o = r, s = 2;
break;
case 2:
t[n++] = (o & 15) << 4 | (r & 60) >> 2, o = r, s = 3;
break;
case 3:
t[n++] = (o & 3) << 6 | r, s = 0;
break;
}
}
if (s == 1) throw Error("invalid base64 string.");
return t.subarray(0, n);
},
/**
* Encode a byte array to a base64 string.
*/
enc(i) {
let e = "", t = 0, n, s = 0;
for (let r = 0; r < i.length; r++)
switch (n = i[r], t) {
case 0:
e += He[n >> 2], s = (n & 3) << 4, t = 1;
break;
case 1:
e += He[s | n >> 4], s = (n & 15) << 2, t = 2;
break;
case 2:
e += He[s | n >> 6], e += He[n & 63], t = 0;
break;
}
return t && (e += He[s], e += "=", t == 1 && (e += "=")), e;
}
};
function Pc(i, e, t) {
aa(e, i);
const n = e.runtime.bin.makeReadOptions(t), s = Ec(i.getType().runtime.bin.listUnknownFields(i), e.field), [r, o] = ia(e);
for (const a of s)
e.runtime.bin.readField(r, n.readerFactory(a.data), e.field, a.wireType, n);
return o();
}
function _c(i, e, t, n) {
aa(e, i);
const s = e.runtime.bin.makeReadOptions(n), r = e.runtime.bin.makeWriteOptions(n);
if (ra(i, e)) {
const d = i.getType().runtime.bin.listUnknownFields(i).filter((l) => l.no != e.field.no);
i.getType().runtime.bin.discardUnknownFields(i);
for (const l of d)
i.getType().runtime.bin.onUnknownField(i, l.no, l.wireType, l.data);
}
const o = r.writerFactory();
let a = e.field;
!a.opt && !a.repeated && (a.kind == "enum" || a.kind == "scalar") && (a = Object.assign(Object.assign({}, e.field), {
opt: !0
})), e.runtime.bin.writeField(a, t, o, r);
const c = s.readerFactory(o.finish());
for (; c.pos < c.len; ) {
const [d, l] = c.tag(), u = c.skip(l, d);
i.getType().runtime.bin.onUnknownField(i, d, l, u);
}
}
function ra(i, e) {
const t = i.getType();
return e.extendee.typeName === t.typeName && !!t.runtime.bin.listUnknownFields(i).find((n) => n.no == e.field.no);
}
function aa(i, e) {
Q(i.extendee.typeName == e.getType().typeName, "extension ".concat(i.typeName, " can only be applied to message ").concat(i.extendee.typeName));
}
function oa(i, e) {
const t = i.localName;
if (i.repeated)
return e[t].length > 0;
if (i.oneof)
return e[i.oneof.localName].case === t;
switch (i.kind) {
case "enum":
case "scalar":
return i.opt || i.req ? e[t] !== void 0 : i.kind == "enum" ? e[t] !== i.T.values[0].no : !na(i.T, e[t]);
case "message":
return e[t] !== void 0;
case "map":
return Object.keys(e[t]).length > 0;
}
}
function Ns(i, e) {
const t = i.localName, n = !i.opt && !i.req;
if (i.repeated)
e[t] = [];
else if (i.oneof)
e[i.oneof.localName] = {
case: void 0
};
else
switch (i.kind) {
case "map":
e[t] = {};
break;
case "enum":
e[t] = n ? i.T.values[0].no : void 0;
break;
case "scalar":
e[t] = n ? Ot(i.T, i.L) : void 0;
break;
case "message":
e[t] = void 0;
break;
}
}
function Ge(i, e) {
if (i === null || typeof i != "object" || !Object.getOwnPropertyNames(es.prototype).every((n) => n in i && typeof i[n] == "function"))
return !1;
const t = i.getType();
return t === null || typeof t != "function" || !("typeName" in t) || typeof t.typeName != "string" ? !1 : e === void 0 ? !0 : t.typeName == e.typeName;
}
function ca(i, e) {
return Ge(e) || !i.fieldWrapper ? e : i.fieldWrapper.wrapField(e);
}
S.DOUBLE, S.FLOAT, S.INT64, S.UINT64, S.INT32, S.UINT32, S.BOOL, S.STRING, S.BYTES;
const Ls = {
ignoreUnknownFields: !1
}, Us = {
emitDefaultValues: !1,
enumAsInteger: !1,
useProtoFieldName: !1,
prettySpaces: 0
};
function Rc(i) {
return i ? Object.assign(Object.assign({}, Ls), i) : Ls;
}
function wc(i) {
return i ? Object.assign(Object.assign({}, Us), i) : Us;
}
const En = Symbol(), mn = Symbol();
function Ic() {
return {
makeReadOptions: Rc,
makeWriteOptions: wc,
readMessage(i, e, t, n) {
if (e == null || Array.isArray(e) || typeof e != "object")
throw new Error("cannot decode message ".concat(i.typeName, " from JSON: ").concat(xe(e)));
n = n ?? new i();
const s = /* @__PURE__ */ new Map(), r = t.typeRegistry;
for (const [o, a] of Object.entries(e)) {
const c = i.fields.findJsonName(o);
if (c) {
if (c.oneof) {
if (a === null && c.kind == "scalar")
continue;
const d = s.get(c.oneof);
if (d !== void 0)
throw new Error("cannot decode message ".concat(i.typeName, ' from JSON: multiple keys for oneof "').concat(c.oneof.name, '" present: "').concat(d, '", "').concat(o, '"'));
s.set(c.oneof, o);
}
Fs(n, a, c, t, i);
} else {
let d = !1;
if (r != null && r.findExtension && o.startsWith("[") && o.endsWith("]")) {
const l = r.findExtension(o.substring(1, o.length - 1));
if (l && l.extendee.typeName == i.typeName) {
d = !0;
const [u, h] = ia(l);
Fs(u, a, l.field, t, l), _c(n, l, h(), t);
}
}
if (!d && !t.ignoreUnknownFields)
throw new Error("cannot decode message ".concat(i.typeName, ' from JSON: key "').concat(o, '" is unknown'));
}
}
return n;
},
writeMessage(i, e) {
const t = i.getType(), n = {};
let s;
try {
for (s of t.fields.byNumber()) {
if (!oa(s, i)) {
if (s.req)
throw "required field not set";
if (!e.emitDefaultValues || !Mc(s))
continue;
}
const o = s.oneof ? i[s.oneof.localName].value : i[s.localName], a = Bs(s, o, e);
a !== void 0 && (n[e.useProtoFieldName ? s.name : s.jsonName] = a);
}
const r = e.typeRegistry;
if (r != null && r.findExtensionFor)
for (const o of t.runtime.bin.listUnknownFields(i)) {
const a = r.findExtensionFor(t.typeName, o.no);
if (a && ra(i, a)) {
const c = Pc(i, a, e), d = Bs(a.field, c, e);
d !== void 0 && (n[a.field.jsonName] = d);
}
}
} catch (r) {
const o = s ? "cannot encode field ".concat(t.typeName, ".").concat(s.name, " to JSON") : "cannot encode message ".concat(t.typeName, " to JSON"), a = r instanceof Error ? r.message : String(r);
throw new Error(o + (a.length > 0 ? ": ".concat(a) : ""));
}
return n;
},
readScalar(i, e, t) {
return Wt(i, e, t ?? st.BIGINT, !0);
},
writeScalar(i, e, t) {
if (e !== void 0 && (t || na(i, e)))
return fn(i, e);
},
debug: xe
};
}
function xe(i) {
if (i === null)
return "null";
switch (typeof i) {
case "object":
return Array.isArray(i) ? "array" : "object";
case "string":
return i.length > 100 ? "string" : '"'.concat(i.split('"').join('\\"'), '"');
default:
return String(i);
}
}
function Fs(i, e, t, n, s) {
let r = t.localName;
if (t.repeated) {
if (Q(t.kind != "map"), e === null)
return;
if (!Array.isArray(e))
throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e)));
const o = i[r];
for (const a of e) {
if (a === null)
throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(a)));
switch (t.kind) {
case "message":
o.push(t.T.fromJson(a, n));
break;
case "enum":
const c = ri(t.T, a, n.ignoreUnknownFields, !0);
c !== mn && o.push(c);
break;
case "scalar":
try {
o.push(Wt(t.T, a, t.L, !0));
} catch (d) {
let l = "cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(a));
throw d instanceof Error && d.message.length > 0 && (l += ": ".concat(d.message)), new Error(l);
}
break;
}
}
} else if (t.kind == "map") {
if (e === null)
return;
if (typeof e != "object" || Array.isArray(e))
throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e)));
const o = i[r];
for (const [a, c] of Object.entries(e)) {
if (c === null)
throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: map value null"));
let d;
try {
d = Oc(t.K, a);
} catch (l) {
let u = "cannot decode map key for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e));
throw l instanceof Error && l.message.length > 0 && (u += ": ".concat(l.message)), new Error(u);
}
switch (t.V.kind) {
case "message":
o[d] = t.V.T.fromJson(c, n);
break;
case "enum":
const l = ri(t.V.T, c, n.ignoreUnknownFields, !0);
l !== mn && (o[d] = l);
break;
case "scalar":
try {
o[d] = Wt(t.V.T, c, st.BIGINT, !0);
} catch (u) {
let h = "cannot decode map value for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e));
throw u instanceof Error && u.message.length > 0 && (h += ": ".concat(u.message)), new Error(h);
}
break;
}
}
} else
switch (t.oneof && (i = i[t.oneof.localName] = {
case: r
}, r = "value"), t.kind) {
case "message":
const o = t.T;
if (e === null && o.typeName != "google.protobuf.Value")
return;
let a = i[r];
Ge(a) ? a.fromJson(e, n) : (i[r] = a = o.fromJson(e, n), o.fieldWrapper && !t.oneof && (i[r] = o.fieldWrapper.unwrapField(a)));
break;
case "enum":
const c = ri(t.T, e, n.ignoreUnknownFields, !1);
switch (c) {
case En:
Ns(t, i);
break;
case mn:
break;
default:
i[r] = c;
break;
}
break;
case "scalar":
try {
const d = Wt(t.T, e, t.L, !1);
switch (d) {
case En:
Ns(t, i);
break;
default:
i[r] = d;
break;
}
} catch (d) {
let l = "cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e));
throw d instanceof Error && d.message.length > 0 && (l += ": ".concat(d.message)), new Error(l);
}
break;
}
}
function Oc(i, e) {
if (i === S.BOOL)
switch (e) {
case "true":
e = !0;
break;
case "false":
e = !1;
break;
}
return Wt(i, e, st.BIGINT, !0).toString();
}
function Wt(i, e, t, n) {
if (e === null)
return n ? Ot(i, t) : En;
switch (i) {
case S.DOUBLE:
case S.FLOAT:
if (e === "NaN") return Number.NaN;
if (e === "Infinity") return Number.POSITIVE_INFINITY;
if (e === "-Infinity") return Number.NEGATIVE_INFINITY;
if (e === "" || typeof e == "string" && e.trim().length !== e.length || typeof e != "string" && typeof e != "number")
break;
const s = Number(e);
if (Number.isNaN(s) || !Number.isFinite(s))
break;
return i == S.FLOAT && Yr(s), s;
case S.INT32:
case S.FIXED32:
case S.SFIXED32:
case S.SINT32:
case S.UINT32:
let r;
if (typeof e == "number" ? r = e : typeof e == "string" && e.length > 0 && e.trim().length === e.length && (r = Number(e)), r === void 0) break;
return i == S.UINT32 || i == S.FIXED32 ? Ei(r) : un(r), r;
case S.INT64:
case S.SFIXED64:
case S.SINT64:
if (typeof e != "number" && typeof e != "string") break;
const o = J.parse(e);
return t ? o.toString() : o;
case S.FIXED64:
case S.UINT64:
if (typeof e != "number" && typeof e != "string") break;
const a = J.uParse(e);
return t ? a.toString() : a;
case S.BOOL:
if (typeof e != "boolean") break;
return e;
case S.STRING:
if (typeof e != "string")
break;
try {
encodeURIComponent(e);
} catch {
throw new Error("invalid UTF8");
}
return e;
case S.BYTES:
if (e === "") return new Uint8Array(0);
if (typeof e != "string") break;
return sa.dec(e);
}
throw new Error();
}
function ri(i, e, t, n) {
if (e === null)
return i.typeName == "google.protobuf.NullValue" ? 0 : n ? i.values[0].no : En;
switch (typeof e) {
case "number":
if (Number.isInteger(e))
return e;
break;
case "string":
const s = i.findName(e);
if (s !== void 0)
return s.no;
if (t)
return mn;
break;
}
throw new Error("cannot decode enum ".concat(i.typeName, " from JSON: ").concat(xe(e)));
}
function Mc(i) {
return i.repeated || i.kind == "map" ? !0 : !(i.oneof || i.kind == "message" || i.opt || i.req);
}
function Bs(i, e, t) {
if (i.kind == "map") {
Q(typeof e == "object" && e != null);
const n = {}, s = Object.entries(e);
switch (i.V.kind) {
case "scalar":
for (const [o, a] of s)
n[o.toString()] = fn(i.V.T, a);
break;
case "message":
for (const [o, a] of s)
n[o.toString()] = a.toJson(t);
break;
case "enum":
const r = i.V.T;
for (const [o, a] of s)
n[o.toString()] = ai(r, a, t.enumAsInteger);
break;
}
return t.emitDefaultValues || s.length > 0 ? n : void 0;
}
if (i.repeated) {
Q(Array.isArray(e));
const n = [];
switch (i.kind) {
case "scalar":
for (let s = 0; s < e.length; s++)
n.push(fn(i.T, e[s]));
break;
case "enum":
for (let s = 0; s < e.length; s++)
n.push(ai(i.T, e[s], t.enumAsInteger));
break;
case "message":
for (let s = 0; s < e.length; s++)
n.push(e[s].toJson(t));
break;
}
return t.emitDefaultValues || n.length > 0 ? n : void 0;
}
switch (i.kind) {
case "scalar":
return fn(i.T, e);
case "enum":
return ai(i.T, e, t.enumAsInteger);
case "message":
return ca(i.T, e).toJson(t);
}
}
function ai(i, e, t) {
var n;
if (Q(typeof e == "number"), i.typeName == "google.protobuf.NullValue")
return null;
if (t)
return e;
const s = i.findNumber(e);
return (n = s == null ? void 0 : s.name) !== null && n !== void 0 ? n : e;
}
function fn(i, e) {
switch (i) {
case S.INT32:
case S.SFIXED32:
case S.SINT32:
case S.FIXED32:
case S.UINT32:
return Q(typeof e == "number"), e;
case S.FLOAT:
case S.DOUBLE:
return Q(typeof e == "number"), Number.isNaN(e) ? "NaN" : e === Number.POSITIVE_INFINITY ? "Infinity" : e === Number.NEGATIVE_INFINITY ? "-Infinity" : e;
case S.STRING:
return Q(typeof e == "string"), e;
case S.BOOL:
return Q(typeof e == "boolean"), e;
case S.UINT64:
case S.FIXED64:
case S.INT64:
case S.SFIXED64:
case S.SINT64:
return Q(typeof e == "bigint" || typeof e == "string" || typeof e == "number"), e.toString();
case S.BYTES:
return Q(e instanceof Uint8Array), sa.enc(e);
}
}
const kt = Symbol("@bufbuild/protobuf/unknown-fields"), js = {
readUnknownFields: !0,
readerFactory: (i) => new Tc(i)
}, Vs = {
writeUnknownFields: !0,
writerFactory: () => new kc()
};
function xc(i) {
return i ? Object.assign(Object.assign({}, js), i) : js;
}
function Ac(i) {
return i ? Object.assign(Object.assign({}, Vs), i) : Vs;
}
function Dc() {
return {
makeReadOptions: xc,
makeWriteOptions: Ac,
listUnknownFields(i) {
var e;
return (e = i[kt]) !== null && e !== void 0 ? e : [];
},
discardUnknownFields(i) {
delete i[kt];
},
writeUnknownFields(i, e) {
const n = i[kt];
if (n)
for (const s of n)
e.tag(s.no, s.wireType).raw(s.data);
},
onUnknownField(i, e, t, n) {
const s = i;
Array.isArray(s[kt]) || (s[kt] = []), s[kt].push({
no: e,
wireType: t,
data: n
});
},
readMessage(i, e, t, n, s) {
const r = i.getType(), o = s ? e.len : e.pos + t;
let a, c;
for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == ee.EndGroup)); ) {
const d = r.fields.find(a);
if (!d) {
const l = e.skip(c, a);
n.readUnknownFields && this.onUnknownField(i, a, c, l);
continue;
}
qs(i, e, d, c, n);
}
if (s && // eslint-disable-line @typescript-eslint/strict-boolean-expressions
(c != ee.EndGroup || a !== t))
throw new Error("invalid end group tag");
},
readField: qs,
writeMessage(i, e, t) {
const n = i.getType();
for (const s of n.fields.byNumber()) {
if (!oa(s, i)) {
if (s.req)
throw new Error("cannot encode field ".concat(n.typeName, ".").concat(s.name, " to binary: required field not set"));
continue;
}
const r = s.oneof ? i[s.oneof.localName].value : i[s.localName];
Ws(s, r, e, t);
}
return t.writeUnknownFields && this.writeUnknownFields(i, e), e;
},
writeField(i, e, t, n) {
e !== void 0 && Ws(i, e, t, n);
}
};
}
function qs(i, e, t, n, s) {
let {
repeated: r,
localName: o
} = t;
switch (t.oneof && (i = i[t.oneof.localName], i.case != o && delete i.value, i.case = o, o = "value"), t.kind) {
case "scalar":
case "enum":
const a = t.kind == "enum" ? S.INT32 : t.T;
let c = Pn;
if (t.kind == "scalar" && t.L > 0 && (c = Lc), r) {
let h = i[o];
if (n == ee.LengthDelimited && a != S.STRING && a != S.BYTES) {
let b = e.uint32() + e.pos;
for (; e.pos < b; )
h.push(c(e, a));
} else
h.push(c(e, a));
} else
i[o] = c(e, a);
break;
case "message":
const d = t.T;
r ? i[o].push(pn(e, new d(), s, t)) : Ge(i[o]) ? pn(e, i[o], s, t) : (i[o] = pn(e, new d(), s, t), d.fieldWrapper && !t.oneof && !t.repeated && (i[o] = d.fieldWrapper.unwrapField(i[o])));
break;
case "map":
let [l, u] = Nc(t, e, s);
i[o][l] = u;
break;
}
}
function pn(i, e, t, n) {
const s = e.getType().runtime.bin, r = n == null ? void 0 : n.delimited;
return s.readMessage(
e,
i,
r ? n.no : i.uint32(),
// eslint-disable-line @typescript-eslint/strict-boolean-expressions
t,
r
), e;
}
function Nc(i, e, t) {
const n = e.uint32(), s = e.pos + n;
let r, o;
for (; e.pos < s; ) {
const [a] = e.tag();
switch (a) {
case 1:
r = Pn(e, i.K);
break;
case 2:
switch (i.V.kind) {
case "scalar":
o = Pn(e, i.V.T);
break;
case "enum":
o = e.int32();
break;
case "message":
o = pn(e, new i.V.T(), t, void 0);
break;
}
break;
}
}
if (r === void 0 && (r = Ot(i.K, st.BIGINT)), typeof r != "string" && typeof r != "number" && (r = r.toString()), o === void 0)
switch (i.V.kind) {
case "scalar":
o = Ot(i.V.T, st.BIGINT);
break;
case "enum":
o = i.V.T.values[0].no;
break;
case "message":
o = new i.V.T();
break;
}
return [r, o];
}
function Lc(i, e) {
const t = Pn(i, e);
return typeof t == "bigint" ? t.toString() : t;
}
function Pn(i, e) {
switch (e) {
case S.STRING:
return i.string();
case S.BOOL:
return i.bool();
case S.DOUBLE:
return i.double();
case S.FLOAT:
return i.float();
case S.INT32:
return i.int32();
case S.INT64:
return i.int64();
case S.UINT64:
return i.uint64();
case S.FIXED64:
return i.fixed64();
case S.BYTES:
return i.bytes();
case S.FIXED32:
return i.fixed32();
case S.SFIXED32:
return i.sfixed32();
case S.SFIXED64:
return i.sfixed64();
case S.SINT64:
return i.sint64();
case S.UINT32:
return i.uint32();
case S.SINT32:
return i.sint32();
}
}
function Ws(i, e, t, n) {
Q(e !== void 0);
const s = i.repeated;
switch (i.kind) {
case "scalar":
case "enum":
let r = i.kind == "enum" ? S.INT32 : i.T;
if (s)
if (Q(Array.isArray(e)), i.packed)
Fc(t, r, i.no, e);
else
for (const o of e)
Kt(t, r, i.no, o);
else
Kt(t, r, i.no, e);
break;
case "message":
if (s) {
Q(Array.isArray(e));
for (const o of e)
Ks(t, n, i, o);
} else
Ks(t, n, i, e);
break;
case "map":
Q(typeof e == "object" && e != null);
for (const [o, a] of Object.entries(e))
Uc(t, n, i, o, a);
break;
}
}
function Uc(i, e, t, n, s) {
i.tag(t.no, ee.LengthDelimited), i.fork();
let r = n;
switch (t.K) {
case S.INT32:
case S.FIXED32:
case S.UINT32:
case S.SFIXED32:
case S.SINT32:
r = Number.parseInt(n);
break;
case S.BOOL:
Q(n == "true" || n == "false"), r = n == "true";
break;
}
switch (Kt(i, t.K, 1, r), t.V.kind) {
case "scalar":
Kt(i, t.V.T, 2, s);
break;
case "enum":
Kt(i, S.INT32, 2, s);
break;
case "message":
Q(s !== void 0), i.tag(2, ee.LengthDelimited).bytes(s.toBinary(e));
break;
}
i.join();
}
function Ks(i, e, t, n) {
const s = ca(t.T, n);
t.delimited ? i.tag(t.no, ee.StartGroup).raw(s.toBinary(e)).tag(t.no, ee.EndGroup) : i.tag(t.no, ee.LengthDelimited).bytes(s.toBinary(e));
}
function Kt(i, e, t, n) {
Q(n !== void 0);
let [s, r] = da(e);
i.tag(t, s)[r](n);
}
function Fc(i, e, t, n) {
if (!n.length)
return;
i.tag(t, ee.LengthDelimited).fork();
let [, s] = da(e);
for (let r = 0; r < n.length; r++)
i[s](n[r]);
i.join();
}
function da(i) {
let e = ee.Varint;
switch (i) {
case S.BYTES:
case S.STRING:
e = ee.LengthDelimited;
break;
case S.DOUBLE:
case S.FIXED64:
case S.SFIXED64:
e = ee.Bit64;
break;
case S.FIXED32:
case S.SFIXED32:
case S.FLOAT:
e = ee.Bit32;
break;
}
const t = S[i].toLowerCase();
return [e, t];
}
function Bc() {
return {
setEnumType: Xr,
initPartial(i, e) {
if (i === void 0)
return;
const t = e.getType();
for (const n of t.fields.byMember()) {
const s = n.localName, r = e, o = i;
if (o[s] != null)
switch (n.kind) {
case "oneof":
const a = o[s].case;
if (a === void 0)
continue;
const c = n.findField(a);
let d = o[s].value;
c && c.kind == "message" && !Ge(d, c.T) ? d = new c.T(d) : c && c.kind === "scalar" && c.T === S.BYTES && (d = Nt(d)), r[s] = {
case: a,
value: d
};
break;
case "scalar":
case "enum":
let l = o[s];
n.T === S.BYTES && (l = n.repeated ? l.map(Nt) : Nt(l)), r[s] = l;
break;
case "map":
switch (n.V.kind) {
case "scalar":
case "enum":
if (n.V.T === S.BYTES)
for (const [p, b] of Object.entries(o[s]))
r[s][p] = Nt(b);
else
Object.assign(r[s], o[s]);
break;
case "message":
const h = n.V.T;
for (const p of Object.keys(o[s])) {
let b = o[s][p];
h.fieldWrapper || (b = new h(b)), r[s][p] = b;
}
break;
}
break;
case "message":
const u = n.T;
if (n.repeated)
r[s] = o[s].map((h) => Ge(h, u) ? h : new u(h));
else {
const h = o[s];
u.fieldWrapper ? /* We can't use BytesValue.typeName as that will create a circular import */ u.typeName === "google.protobuf.BytesValue" ? r[s] = Nt(h) : r[s] = h : r[s] = Ge(h, u) ? h : new u(h);
}
break;
}
}
},
// TODO use isFieldSet() here to support future field presence
equals(i, e, t) {
return e === t ? !0 : !e || !t ? !1 : i.fields.byMember().every((n) => {
const s = e[n.localName], r = t[n.localName];
if (n.repeated) {
if (s.length !== r.length)
return !1;
switch (n.kind) {
case "message":
return s.every((o, a) => n.T.equals(o, r[a]));
case "scalar":
return s.every((o, a) => Ye(n.T, o, r[a]));
case "enum":
return s.every((o, a) => Ye(S.INT32, o, r[a]));
}
throw new Error("repeated cannot contain ".concat(n.kind));
}
switch (n.kind) {
case "message":
let o = s, a = r;
return n.T.fieldWrapper && (o !== void 0 && !Ge(o) && (o = n.T.fieldWrapper.wrapField(o)), a !== void 0 && !Ge(a) && (a = n.T.fieldWrapper.wrapField(a))), n.T.equals(o, a);
case "enum":
return Ye(S.INT32, s, r);
case "scalar":
return Ye(n.T, s, r);
case "oneof":
if (s.case !== r.case)
return !1;
const c = n.findField(s.case);
if (c === void 0)
return !0;
switch (c.kind) {