UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

1,556 lines 353 kB
import l from "long"; function Dr() { let e = 0, i = 0; for (let t = 0; t < 28; t += 7) { let a = this.buf[this.pos++]; if (e |= (a & 127) << t, (a & 128) == 0) return this.assertBounds(), [e, i]; } let n = this.buf[this.pos++]; if (e |= (n & 15) << 28, i = (n & 112) >> 4, (n & 128) == 0) return this.assertBounds(), [e, i]; for (let t = 3; t <= 31; t += 7) { let a = this.buf[this.pos++]; if (i |= (a & 127) << t, (a & 128) == 0) return this.assertBounds(), [e, i]; } throw new Error("invalid varint"); } function ye(e, i, n) { for (let r = 0; r < 28; r = r + 7) { const f = e >>> r, O = !(!(f >>> 7) && i == 0), D = (O ? f | 128 : f) & 255; if (n.push(D), !O) return; } const t = e >>> 28 & 15 | (i & 7) << 4, a = i >> 3 != 0; if (n.push((a ? t | 128 : t) & 255), !!a) { for (let r = 3; r < 31; r = r + 7) { const f = i >>> r, O = !!(f >>> 7), D = (O ? f | 128 : f) & 255; if (n.push(D), !O) return; } n.push(i >>> 31 & 1); } } const Fe = 4294967296; function Xe(e) { const i = e[0] === "-"; i && (e = e.slice(1)); const n = 1e6; let t = 0, a = 0; function r(f, O) { const D = Number(e.slice(f, O)); a *= n, t = t * n + D, t >= Fe && (a = a + (t / Fe | 0), t = t % Fe); } return r(-24, -18), r(-18, -12), r(-12, -6), r(-6), i ? Lr(t, a) : He(t, a); } function xr(e, i) { let n = He(e, i); const t = n.hi & 2147483648; t && (n = Lr(n.lo, n.hi)); const a = Fr(n.lo, n.hi); return t ? "-" + a : a; } function Fr(e, i) { if ({ lo: e, hi: i } = Jr(e, i), i <= 2097151) return String(Fe * i + e); const n = e & 16777215, t = (e >>> 24 | i << 8) & 16777215, a = i >> 16 & 65535; let r = n + t * 6777216 + a * 6710656, f = t + a * 8147497, O = a * 2; const D = 1e7; return r >= D && (f += Math.floor(r / D), r %= D), f >= D && (O += Math.floor(f / D), f %= D), O.toString() + Qe(f) + Qe(r); } function Jr(e, i) { return { lo: e >>> 0, hi: i >>> 0 }; } function He(e, i) { return { lo: e | 0, hi: i | 0 }; } function Lr(e, i) { return i = ~i, e ? e = ~e + 1 : i += 1, He(e, i); } const Qe = (e) => { const i = String(e); return "0000000".slice(i.length) + i; }; function ze(e, i) { if (e >= 0) { for (; e > 127; ) i.push(e & 127 | 128), e = e >>> 7; i.push(e); } else { for (let n = 0; n < 9; n++) i.push(e & 127 | 128), e = e >> 7; i.push(1); } } function Vr() { let e = this.buf[this.pos++], i = e & 127; if ((e & 128) == 0) return this.assertBounds(), i; if (e = this.buf[this.pos++], i |= (e & 127) << 7, (e & 128) == 0) return this.assertBounds(), i; if (e = this.buf[this.pos++], i |= (e & 127) << 14, (e & 128) == 0) return this.assertBounds(), i; if (e = this.buf[this.pos++], i |= (e & 127) << 21, (e & 128) == 0) return this.assertBounds(), i; e = this.buf[this.pos++], i |= (e & 15) << 28; for (let n = 5; (e & 128) !== 0 && n < 10; n++) e = this.buf[this.pos++]; if ((e & 128) != 0) throw new Error("invalid varint"); return this.assertBounds(), i >>> 0; } const H = /* @__PURE__ */ Br(); function Br() { const e = new DataView(new ArrayBuffer(8)); 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")) { const n = BigInt("-9223372036854775808"), t = BigInt("9223372036854775807"), a = BigInt("0"), r = BigInt("18446744073709551615"); return { zero: BigInt(0), supported: !0, parse(f) { const O = typeof f == "bigint" ? f : BigInt(f); if (O > t || O < n) throw new Error(`invalid int64: ${f}`); return O; }, uParse(f) { const O = typeof f == "bigint" ? f : BigInt(f); if (O > r || O < a) throw new Error(`invalid uint64: ${f}`); return O; }, enc(f) { return e.setBigInt64(0, this.parse(f), !0), { lo: e.getInt32(0, !0), hi: e.getInt32(4, !0) }; }, uEnc(f) { return e.setBigInt64(0, this.uParse(f), !0), { lo: e.getInt32(0, !0), hi: e.getInt32(4, !0) }; }, dec(f, O) { return e.setInt32(0, f, !0), e.setInt32(4, O, !0), e.getBigInt64(0, !0); }, uDec(f, O) { return e.setInt32(0, f, !0), e.setInt32(4, O, !0), e.getBigUint64(0, !0); } }; } return { zero: "0", supported: !1, parse(n) { return typeof n != "string" && (n = n.toString()), Ke(n), n; }, uParse(n) { return typeof n != "string" && (n = n.toString()), Ye(n), n; }, enc(n) { return typeof n != "string" && (n = n.toString()), Ke(n), Xe(n); }, uEnc(n) { return typeof n != "string" && (n = n.toString()), Ye(n), Xe(n); }, dec(n, t) { return xr(n, t); }, uDec(n, t) { return Fr(n, t); } }; } function Ke(e) { if (!/^-?[0-9]+$/.test(e)) throw new Error("invalid int64: " + e); } function Ye(e) { if (!/^[0-9]+$/.test(e)) throw new Error("invalid uint64: " + e); } const De = /* @__PURE__ */ Symbol.for("@bufbuild/protobuf/text-encoding"); function Mr() { if (globalThis[De] == null) { const e = new globalThis.TextEncoder(), i = new globalThis.TextDecoder(); globalThis[De] = { encodeUtf8(n) { return e.encode(n); }, decodeUtf8(n) { return i.decode(n); }, checkUtf8(n) { try { return encodeURIComponent(n), !0; } catch { return !1; } } }; } return globalThis[De]; } var X; (function(e) { 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"; })(X || (X = {})); const Ur = 34028234663852886e22, wr = -34028234663852886e22, Hr = 4294967295, qr = 2147483647, Zr = -2147483648; class u { constructor(i = Mr().encodeUtf8) { this.encodeUtf8 = i, this.stack = [], this.chunks = [], this.buf = []; } /** * Return all bytes written and reset this writer. */ finish() { this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []); let i = 0; for (let a = 0; a < this.chunks.length; a++) i += this.chunks[a].length; let n = new Uint8Array(i), t = 0; for (let a = 0; a < this.chunks.length; a++) n.set(this.chunks[a], t), t += this.chunks[a].length; return this.chunks = [], n; } /** * 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 i = this.finish(), n = this.stack.pop(); if (!n) throw new Error("invalid state, fork stack empty"); return this.chunks = n.chunks, this.buf = n.buf, this.uint32(i.byteLength), this.raw(i); } /** * 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(i, n) { return this.uint32((i << 3 | n) >>> 0); } /** * Write a chunk of raw bytes. */ raw(i) { return this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []), this.chunks.push(i), this; } /** * Write a `uint32` value, an unsigned 32 bit varint. */ uint32(i) { for (We(i); i > 127; ) this.buf.push(i & 127 | 128), i = i >>> 7; return this.buf.push(i), this; } /** * Write a `int32` value, a signed 32 bit varint. */ int32(i) { return xe(i), ze(i, this.buf), this; } /** * Write a `bool` value, a variant. */ bool(i) { return this.buf.push(i ? 1 : 0), this; } /** * Write a `bytes` value, length-delimited arbitrary data. */ bytes(i) { return this.uint32(i.byteLength), this.raw(i); } /** * Write a `string` value, length-delimited data converted to UTF-8 text. */ string(i) { let n = this.encodeUtf8(i); return this.uint32(n.byteLength), this.raw(n); } /** * Write a `float` value, 32-bit floating point number. */ float(i) { Xr(i); let n = new Uint8Array(4); return new DataView(n.buffer).setFloat32(0, i, !0), this.raw(n); } /** * Write a `double` value, a 64-bit floating point number. */ double(i) { let n = new Uint8Array(8); return new DataView(n.buffer).setFloat64(0, i, !0), this.raw(n); } /** * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer. */ fixed32(i) { We(i); let n = new Uint8Array(4); return new DataView(n.buffer).setUint32(0, i, !0), this.raw(n); } /** * Write a `sfixed32` value, a signed, fixed-length 32-bit integer. */ sfixed32(i) { xe(i); let n = new Uint8Array(4); return new DataView(n.buffer).setInt32(0, i, !0), this.raw(n); } /** * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint. */ sint32(i) { return xe(i), i = (i << 1 ^ i >> 31) >>> 0, ze(i, this.buf), this; } /** * Write a `fixed64` value, a signed, fixed-length 64-bit integer. */ sfixed64(i) { let n = new Uint8Array(8), t = new DataView(n.buffer), a = H.enc(i); return t.setInt32(0, a.lo, !0), t.setInt32(4, a.hi, !0), this.raw(n); } /** * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer. */ fixed64(i) { let n = new Uint8Array(8), t = new DataView(n.buffer), a = H.uEnc(i); return t.setInt32(0, a.lo, !0), t.setInt32(4, a.hi, !0), this.raw(n); } /** * Write a `int64` value, a signed 64-bit varint. */ int64(i) { let n = H.enc(i); return ye(n.lo, n.hi, this.buf), this; } /** * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint. */ sint64(i) { const n = H.enc(i), t = n.hi >> 31, a = n.lo << 1 ^ t, r = (n.hi << 1 | n.lo >>> 31) ^ t; return ye(a, r, this.buf), this; } /** * Write a `uint64` value, an unsigned 64-bit varint. */ uint64(i) { const n = H.uEnc(i); return ye(n.lo, n.hi, this.buf), this; } } class o { constructor(i, n = Mr().decodeUtf8) { this.decodeUtf8 = n, this.varint64 = Dr, this.uint32 = Vr, this.buf = i, this.len = i.length, this.pos = 0, this.view = new DataView(i.buffer, i.byteOffset, i.byteLength); } /** * Reads a tag - field number and wire type. */ tag() { let i = this.uint32(), n = i >>> 3, t = i & 7; if (n <= 0 || t < 0 || t > 5) throw new Error("illegal tag: field no " + n + " wire type " + t); return [n, t]; } /** * 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(i, n) { let t = this.pos; switch (i) { case X.Varint: for (; this.buf[this.pos++] & 128; ) ; break; // @ts-ignore TS7029: Fallthrough case in switch -- ignore instead of expect-error for compiler settings without noFallthroughCasesInSwitch: true case X.Bit64: this.pos += 4; case X.Bit32: this.pos += 4; break; case X.LengthDelimited: let a = this.uint32(); this.pos += a; break; case X.StartGroup: for (; ; ) { const [r, f] = this.tag(); if (f === X.EndGroup) { if (n !== void 0 && r !== n) throw new Error("invalid end group tag"); break; } this.skip(f, r); } break; default: throw new Error("cant skip wire type " + i); } return this.assertBounds(), this.buf.subarray(t, 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 i = this.uint32(); return i >>> 1 ^ -(i & 1); } /** * Read a `int64` field, a signed 64-bit varint. */ int64() { return H.dec(...this.varint64()); } /** * Read a `uint64` field, an unsigned 64-bit varint. */ uint64() { return H.uDec(...this.varint64()); } /** * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint. */ sint64() { let [i, n] = this.varint64(), t = -(i & 1); return i = (i >>> 1 | (n & 1) << 31) ^ t, n = n >>> 1 ^ t, H.dec(i, n); } /** * Read a `bool` field, a variant. */ bool() { let [i, n] = this.varint64(); return i !== 0 || n !== 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 H.uDec(this.sfixed32(), this.sfixed32()); } /** * Read a `fixed64` field, a signed, fixed-length 64-bit integer. */ sfixed64() { return H.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 i = this.uint32(), n = this.pos; return this.pos += i, this.assertBounds(), this.buf.subarray(n, n + i); } /** * Read a `string` field, length-delimited data converted to UTF-8 text. */ string() { return this.decodeUtf8(this.bytes()); } } function xe(e) { if (typeof e == "string") e = Number(e); else if (typeof e != "number") throw new Error("invalid int32: " + typeof e); if (!Number.isInteger(e) || e > qr || e < Zr) throw new Error("invalid int32: " + e); } function We(e) { if (typeof e == "string") e = Number(e); else if (typeof e != "number") throw new Error("invalid uint32: " + typeof e); if (!Number.isInteger(e) || e > Hr || e < 0) throw new Error("invalid uint32: " + e); } function Xr(e) { if (typeof e == "string") { const i = e; if (e = Number(e), Number.isNaN(e) && i !== "NaN") throw new Error("invalid float32: " + i); } else if (typeof e != "number") throw new Error("invalid float32: " + typeof e); if (Number.isFinite(e) && (e > Ur || e < wr)) throw new Error("invalid float32: " + e); } var Qr = /* @__PURE__ */ ((e) => (e[e.SIGNAL_ENCODING_INTEL = 0] = "SIGNAL_ENCODING_INTEL", e[e.SIGNAL_ENCODING_MOTOROLA = 1] = "SIGNAL_ENCODING_MOTOROLA", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Qr || {}); function zr(e) { switch (e) { case 0: case "SIGNAL_ENCODING_INTEL": return 0; case 1: case "SIGNAL_ENCODING_MOTOROLA": return 1; default: return -1; } } function Kr(e) { switch (e) { case 0: return "SIGNAL_ENCODING_INTEL"; case 1: return "SIGNAL_ENCODING_MOTOROLA"; default: return "UNRECOGNIZED"; } } var Yr = /* @__PURE__ */ ((e) => (e[e.SIGNAL_TYPE_INVALID = 0] = "SIGNAL_TYPE_INVALID", e[e.SIGNAL_TYPE_SIGNED = 1] = "SIGNAL_TYPE_SIGNED", e[e.SIGNAL_TYPE_UNSIGNED = 2] = "SIGNAL_TYPE_UNSIGNED", e[e.SIGNAL_TYPE_FLOAT = 3] = "SIGNAL_TYPE_FLOAT", e[e.SIGNAL_TYPE_DOUBLE = 4] = "SIGNAL_TYPE_DOUBLE", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Yr || {}); function $e(e) { switch (e) { case 0: case "SIGNAL_TYPE_INVALID": return 0; case 1: case "SIGNAL_TYPE_SIGNED": return 1; case 2: case "SIGNAL_TYPE_UNSIGNED": return 2; case 3: case "SIGNAL_TYPE_FLOAT": return 3; case 4: case "SIGNAL_TYPE_DOUBLE": return 4; default: return -1; } } function Wr(e) { switch (e) { case 0: return "SIGNAL_TYPE_INVALID"; case 1: return "SIGNAL_TYPE_SIGNED"; case 2: return "SIGNAL_TYPE_UNSIGNED"; case 3: return "SIGNAL_TYPE_FLOAT"; case 4: return "SIGNAL_TYPE_DOUBLE"; default: return "UNRECOGNIZED"; } } function je() { return { name: "", qualifiedName: "", comment: "", encoding: 0, dataType: 0, startbit: 0, length: 0, unit: "", factor: 0, offset: 0, minValue: 0, maxValue: 0, enumValues: {}, isMultiplexer: !1, isMultiplexed: !1, multiplexValue: void 0 }; } const B = { encode(e, i = new u()) { return e.name !== "" && i.uint32(10).string(e.name), e.qualifiedName !== "" && i.uint32(18).string(e.qualifiedName), e.comment !== "" && i.uint32(26).string(e.comment), e.encoding !== 0 && i.uint32(32).int32(e.encoding), e.dataType !== 0 && i.uint32(40).int32(e.dataType), e.startbit !== 0 && i.uint32(48).int32(e.startbit), e.length !== 0 && i.uint32(56).int32(e.length), e.unit !== "" && i.uint32(66).string(e.unit), e.factor !== 0 && i.uint32(73).double(e.factor), e.offset !== 0 && i.uint32(81).double(e.offset), e.minValue !== 0 && i.uint32(89).double(e.minValue), e.maxValue !== 0 && i.uint32(97).double(e.maxValue), globalThis.Object.entries(e.enumValues).forEach(([n, t]) => { Ve.encode({ key: n, value: t }, i.uint32(106).fork()).join(); }), e.isMultiplexer !== !1 && i.uint32(112).bool(e.isMultiplexer), e.isMultiplexed !== !1 && i.uint32(120).bool(e.isMultiplexed), e.multiplexValue !== void 0 && i.uint32(128).int32(e.multiplexValue), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = je(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 10) break; a.name = n.string(); continue; } case 2: { if (r !== 18) break; a.qualifiedName = n.string(); continue; } case 3: { if (r !== 26) break; a.comment = n.string(); continue; } case 4: { if (r !== 32) break; a.encoding = n.int32(); continue; } case 5: { if (r !== 40) break; a.dataType = n.int32(); continue; } case 6: { if (r !== 48) break; a.startbit = n.int32(); continue; } case 7: { if (r !== 56) break; a.length = n.int32(); continue; } case 8: { if (r !== 66) break; a.unit = n.string(); continue; } case 9: { if (r !== 73) break; a.factor = n.double(); continue; } case 10: { if (r !== 81) break; a.offset = n.double(); continue; } case 11: { if (r !== 89) break; a.minValue = n.double(); continue; } case 12: { if (r !== 97) break; a.maxValue = n.double(); continue; } case 13: { if (r !== 106) break; const f = Ve.decode(n, n.uint32()); f.value !== void 0 && (a.enumValues[f.key] = f.value); continue; } case 14: { if (r !== 112) break; a.isMultiplexer = n.bool(); continue; } case 15: { if (r !== 120) break; a.isMultiplexed = n.bool(); continue; } case 16: { if (r !== 128) break; a.multiplexValue = n.int32(); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { name: A(e.name) ? globalThis.String(e.name) : "", qualifiedName: A(e.qualifiedName) ? globalThis.String(e.qualifiedName) : A(e.qualified_name) ? globalThis.String(e.qualified_name) : "", comment: A(e.comment) ? globalThis.String(e.comment) : "", encoding: A(e.encoding) ? zr(e.encoding) : 0, dataType: A(e.dataType) ? $e(e.dataType) : A(e.data_type) ? $e(e.data_type) : 0, startbit: A(e.startbit) ? globalThis.Number(e.startbit) : 0, length: A(e.length) ? globalThis.Number(e.length) : 0, unit: A(e.unit) ? globalThis.String(e.unit) : "", factor: A(e.factor) ? globalThis.Number(e.factor) : 0, offset: A(e.offset) ? globalThis.Number(e.offset) : 0, minValue: A(e.minValue) ? globalThis.Number(e.minValue) : A(e.min_value) ? globalThis.Number(e.min_value) : 0, maxValue: A(e.maxValue) ? globalThis.Number(e.maxValue) : A(e.max_value) ? globalThis.Number(e.max_value) : 0, enumValues: ni(e.enumValues) ? globalThis.Object.entries(e.enumValues).reduce((i, [n, t]) => (i[globalThis.Number(n)] = globalThis.String(t), i), {}) : ni(e.enum_values) ? globalThis.Object.entries(e.enum_values).reduce((i, [n, t]) => (i[globalThis.Number(n)] = globalThis.String(t), i), {}) : {}, isMultiplexer: A(e.isMultiplexer) ? globalThis.Boolean(e.isMultiplexer) : A(e.is_multiplexer) ? globalThis.Boolean(e.is_multiplexer) : !1, isMultiplexed: A(e.isMultiplexed) ? globalThis.Boolean(e.isMultiplexed) : A(e.is_multiplexed) ? globalThis.Boolean(e.is_multiplexed) : !1, multiplexValue: A(e.multiplexValue) ? globalThis.Number(e.multiplexValue) : A(e.multiplex_value) ? globalThis.Number(e.multiplex_value) : void 0 }; }, toJSON(e) { const i = {}; if (e.name !== "" && (i.name = e.name), e.qualifiedName !== "" && (i.qualifiedName = e.qualifiedName), e.comment !== "" && (i.comment = e.comment), e.encoding !== 0 && (i.encoding = Kr(e.encoding)), e.dataType !== 0 && (i.dataType = Wr(e.dataType)), e.startbit !== 0 && (i.startbit = Math.round(e.startbit)), e.length !== 0 && (i.length = Math.round(e.length)), e.unit !== "" && (i.unit = e.unit), e.factor !== 0 && (i.factor = e.factor), e.offset !== 0 && (i.offset = e.offset), e.minValue !== 0 && (i.minValue = e.minValue), e.maxValue !== 0 && (i.maxValue = e.maxValue), e.enumValues) { const n = globalThis.Object.entries(e.enumValues); n.length > 0 && (i.enumValues = {}, n.forEach(([t, a]) => { i.enumValues[t] = a; })); } return e.isMultiplexer !== !1 && (i.isMultiplexer = e.isMultiplexer), e.isMultiplexed !== !1 && (i.isMultiplexed = e.isMultiplexed), e.multiplexValue !== void 0 && (i.multiplexValue = Math.round(e.multiplexValue)), i; }, create(e) { return B.fromPartial(e ?? {}); }, fromPartial(e) { const i = je(); return i.name = e.name ?? "", i.qualifiedName = e.qualifiedName ?? "", i.comment = e.comment ?? "", i.encoding = e.encoding ?? 0, i.dataType = e.dataType ?? 0, i.startbit = e.startbit ?? 0, i.length = e.length ?? 0, i.unit = e.unit ?? "", i.factor = e.factor ?? 0, i.offset = e.offset ?? 0, i.minValue = e.minValue ?? 0, i.maxValue = e.maxValue ?? 0, i.enumValues = globalThis.Object.entries(e.enumValues ?? {}).reduce((n, [t, a]) => (a !== void 0 && (n[globalThis.Number(t)] = globalThis.String(a)), n), {}), i.isMultiplexer = e.isMultiplexer ?? !1, i.isMultiplexed = e.isMultiplexed ?? !1, i.multiplexValue = e.multiplexValue ?? void 0, i; } }; function ei() { return { key: 0, value: "" }; } const Ve = { encode(e, i = new u()) { return e.key !== 0 && i.uint32(8).int32(e.key), e.value !== "" && i.uint32(18).string(e.value), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = ei(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 8) break; a.key = n.int32(); continue; } case 2: { if (r !== 18) break; a.value = n.string(); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { key: A(e.key) ? globalThis.Number(e.key) : 0, value: A(e.value) ? globalThis.String(e.value) : "" }; }, toJSON(e) { const i = {}; return e.key !== 0 && (i.key = Math.round(e.key)), e.value !== "" && (i.value = e.value), i; }, create(e) { return Ve.fromPartial(e ?? {}); }, fromPartial(e) { const i = ei(); return i.key = e.key ?? 0, i.value = e.value ?? "", i; } }; function ii() { return { items: [] }; } const $r = { encode(e, i = new u()) { for (const n of e.items) B.encode(n, i.uint32(10).fork()).join(); return i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = ii(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 10) break; a.items.push(B.decode(n, n.uint32())); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { items: globalThis.Array.isArray(e?.items) ? e.items.map((i) => B.fromJSON(i)) : [] }; }, toJSON(e) { const i = {}; return e.items?.length && (i.items = e.items.map((n) => B.toJSON(n))), i; }, create(e) { return $r.fromPartial(e ?? {}); }, fromPartial(e) { const i = ii(); return i.items = e.items?.map((n) => B.fromPartial(n)) || [], i; } }; function ni(e) { return typeof e == "object" && e !== null; } function A(e) { return e != null; } var jr = /* @__PURE__ */ ((e) => (e[e.CAN_FRAME_FLAG_UNSPECIFIED = 0] = "CAN_FRAME_FLAG_UNSPECIFIED", e[e.CAN_FRAME_FLAG_RTR = 1] = "CAN_FRAME_FLAG_RTR", e[e.CAN_FRAME_FLAG_STD = 2] = "CAN_FRAME_FLAG_STD", e[e.CAN_FRAME_FLAG_EXT = 4] = "CAN_FRAME_FLAG_EXT", e[e.CAN_FRAME_FLAG_WAKEUP = 8] = "CAN_FRAME_FLAG_WAKEUP", e[e.CAN_FRAME_FLAG_NERR = 16] = "CAN_FRAME_FLAG_NERR", e[e.CAN_FRAME_FLAG_ERROR_FRAME = 32] = "CAN_FRAME_FLAG_ERROR_FRAME", e[e.CAN_FRAME_FLAG_TXACK = 64] = "CAN_FRAME_FLAG_TXACK", e[e.CAN_FRAME_FLAG_TXRQ = 128] = "CAN_FRAME_FLAG_TXRQ", e[e.CAN_FRAME_FLAG_DELAY_MSG = 256] = "CAN_FRAME_FLAG_DELAY_MSG", e[e.CAN_FRAME_FLAG_LOCAL_TXACK = 268435456] = "CAN_FRAME_FLAG_LOCAL_TXACK", e[e.CAN_FRAME_FLAG_SINGLE_SHOT = 16777216] = "CAN_FRAME_FLAG_SINGLE_SHOT", e[e.CAN_FRAME_FLAG_TXNACK = 33554432] = "CAN_FRAME_FLAG_TXNACK", e[e.CAN_FRAME_FLAG_ABL = 67108864] = "CAN_FRAME_FLAG_ABL", e[e.CAN_FRAME_FLAG_FD_FDF = 65536] = "CAN_FRAME_FLAG_FD_FDF", e[e.CAN_FRAME_FLAG_FD_BRS = 131072] = "CAN_FRAME_FLAG_FD_BRS", e[e.CAN_FRAME_FLAG_FD_ESI = 262144] = "CAN_FRAME_FLAG_FD_ESI", e[e.CAN_FRAME_FLAG_ERR_HW_OVERRUN = 512] = "CAN_FRAME_FLAG_ERR_HW_OVERRUN", e[e.CAN_FRAME_FLAG_ERR_SW_OVERRUN = 1024] = "CAN_FRAME_FLAG_ERR_SW_OVERRUN", e[e.CAN_FRAME_FLAG_ERR_STUFF = 2048] = "CAN_FRAME_FLAG_ERR_STUFF", e[e.CAN_FRAME_FLAG_ERR_FORM = 4096] = "CAN_FRAME_FLAG_ERR_FORM", e[e.CAN_FRAME_FLAG_ERR_CRC = 8192] = "CAN_FRAME_FLAG_ERR_CRC", e[e.CAN_FRAME_FLAG_ERR_BIT0 = 16384] = "CAN_FRAME_FLAG_ERR_BIT0", e[e.CAN_FRAME_FLAG_ERR_BIT1 = 32768] = "CAN_FRAME_FLAG_ERR_BIT1", e[e.CAN_FRAME_FLAG_XL_XLF = 1048576] = "CAN_FRAME_FLAG_XL_XLF", e[e.CAN_FRAME_FLAG_XL_VCID = 2097152] = "CAN_FRAME_FLAG_XL_VCID", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(jr || {}); function ea(e) { switch (e) { case 0: case "CAN_FRAME_FLAG_UNSPECIFIED": return 0; case 1: case "CAN_FRAME_FLAG_RTR": return 1; case 2: case "CAN_FRAME_FLAG_STD": return 2; case 4: case "CAN_FRAME_FLAG_EXT": return 4; case 8: case "CAN_FRAME_FLAG_WAKEUP": return 8; case 16: case "CAN_FRAME_FLAG_NERR": return 16; case 32: case "CAN_FRAME_FLAG_ERROR_FRAME": return 32; case 64: case "CAN_FRAME_FLAG_TXACK": return 64; case 128: case "CAN_FRAME_FLAG_TXRQ": return 128; case 256: case "CAN_FRAME_FLAG_DELAY_MSG": return 256; case 268435456: case "CAN_FRAME_FLAG_LOCAL_TXACK": return 268435456; case 16777216: case "CAN_FRAME_FLAG_SINGLE_SHOT": return 16777216; case 33554432: case "CAN_FRAME_FLAG_TXNACK": return 33554432; case 67108864: case "CAN_FRAME_FLAG_ABL": return 67108864; case 65536: case "CAN_FRAME_FLAG_FD_FDF": return 65536; case 131072: case "CAN_FRAME_FLAG_FD_BRS": return 131072; case 262144: case "CAN_FRAME_FLAG_FD_ESI": return 262144; case 512: case "CAN_FRAME_FLAG_ERR_HW_OVERRUN": return 512; case 1024: case "CAN_FRAME_FLAG_ERR_SW_OVERRUN": return 1024; case 2048: case "CAN_FRAME_FLAG_ERR_STUFF": return 2048; case 4096: case "CAN_FRAME_FLAG_ERR_FORM": return 4096; case 8192: case "CAN_FRAME_FLAG_ERR_CRC": return 8192; case 16384: case "CAN_FRAME_FLAG_ERR_BIT0": return 16384; case 32768: case "CAN_FRAME_FLAG_ERR_BIT1": return 32768; case 1048576: case "CAN_FRAME_FLAG_XL_XLF": return 1048576; case 2097152: case "CAN_FRAME_FLAG_XL_VCID": return 2097152; default: return -1; } } function ia(e) { switch (e) { case 0: return "CAN_FRAME_FLAG_UNSPECIFIED"; case 1: return "CAN_FRAME_FLAG_RTR"; case 2: return "CAN_FRAME_FLAG_STD"; case 4: return "CAN_FRAME_FLAG_EXT"; case 8: return "CAN_FRAME_FLAG_WAKEUP"; case 16: return "CAN_FRAME_FLAG_NERR"; case 32: return "CAN_FRAME_FLAG_ERROR_FRAME"; case 64: return "CAN_FRAME_FLAG_TXACK"; case 128: return "CAN_FRAME_FLAG_TXRQ"; case 256: return "CAN_FRAME_FLAG_DELAY_MSG"; case 268435456: return "CAN_FRAME_FLAG_LOCAL_TXACK"; case 16777216: return "CAN_FRAME_FLAG_SINGLE_SHOT"; case 33554432: return "CAN_FRAME_FLAG_TXNACK"; case 67108864: return "CAN_FRAME_FLAG_ABL"; case 65536: return "CAN_FRAME_FLAG_FD_FDF"; case 131072: return "CAN_FRAME_FLAG_FD_BRS"; case 262144: return "CAN_FRAME_FLAG_FD_ESI"; case 512: return "CAN_FRAME_FLAG_ERR_HW_OVERRUN"; case 1024: return "CAN_FRAME_FLAG_ERR_SW_OVERRUN"; case 2048: return "CAN_FRAME_FLAG_ERR_STUFF"; case 4096: return "CAN_FRAME_FLAG_ERR_FORM"; case 8192: return "CAN_FRAME_FLAG_ERR_CRC"; case 16384: return "CAN_FRAME_FLAG_ERR_BIT0"; case 32768: return "CAN_FRAME_FLAG_ERR_BIT1"; case 1048576: return "CAN_FRAME_FLAG_XL_XLF"; case 2097152: return "CAN_FRAME_FLAG_XL_VCID"; default: return "UNRECOGNIZED"; } } var na = /* @__PURE__ */ ((e) => (e[e.LIN_FRAME_FLAG_UNSPECIFIED = 0] = "LIN_FRAME_FLAG_UNSPECIFIED", e[e.LIN_FRAME_FLAG_TX = 1] = "LIN_FRAME_FLAG_TX", e[e.LIN_FRAME_FLAG_RX = 2] = "LIN_FRAME_FLAG_RX", e[e.LIN_FRAME_FLAG_WAKEUP_FRAME = 4] = "LIN_FRAME_FLAG_WAKEUP_FRAME", e[e.LIN_FRAME_FLAG_NODATA = 8] = "LIN_FRAME_FLAG_NODATA", e[e.LIN_FRAME_FLAG_CSUM_ERROR = 16] = "LIN_FRAME_FLAG_CSUM_ERROR", e[e.LIN_FRAME_FLAG_PARITY_ERROR = 32] = "LIN_FRAME_FLAG_PARITY_ERROR", e[e.LIN_FRAME_FLAG_SYNCH_ERROR = 64] = "LIN_FRAME_FLAG_SYNCH_ERROR", e[e.LIN_FRAME_FLAG_BIT_ERROR = 128] = "LIN_FRAME_FLAG_BIT_ERROR", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(na || {}); function ra(e) { switch (e) { case 0: case "LIN_FRAME_FLAG_UNSPECIFIED": return 0; case 1: case "LIN_FRAME_FLAG_TX": return 1; case 2: case "LIN_FRAME_FLAG_RX": return 2; case 4: case "LIN_FRAME_FLAG_WAKEUP_FRAME": return 4; case 8: case "LIN_FRAME_FLAG_NODATA": return 8; case 16: case "LIN_FRAME_FLAG_CSUM_ERROR": return 16; case 32: case "LIN_FRAME_FLAG_PARITY_ERROR": return 32; case 64: case "LIN_FRAME_FLAG_SYNCH_ERROR": return 64; case 128: case "LIN_FRAME_FLAG_BIT_ERROR": return 128; default: return -1; } } function aa(e) { switch (e) { case 0: return "LIN_FRAME_FLAG_UNSPECIFIED"; case 1: return "LIN_FRAME_FLAG_TX"; case 2: return "LIN_FRAME_FLAG_RX"; case 4: return "LIN_FRAME_FLAG_WAKEUP_FRAME"; case 8: return "LIN_FRAME_FLAG_NODATA"; case 16: return "LIN_FRAME_FLAG_CSUM_ERROR"; case 32: return "LIN_FRAME_FLAG_PARITY_ERROR"; case 64: return "LIN_FRAME_FLAG_SYNCH_ERROR"; case 128: return "LIN_FRAME_FLAG_BIT_ERROR"; default: return "UNRECOGNIZED"; } } function ri() { return { flags: [] }; } const T = { encode(e, i = new u()) { i.uint32(10).fork(); for (const n of e.flags) i.int32(n); return i.join(), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = ri(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r === 8) { a.flags.push(n.int32()); continue; } if (r === 10) { const f = n.uint32() + n.pos; for (; n.pos < f; ) a.flags.push(n.int32()); continue; } break; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { flags: globalThis.Array.isArray(e?.flags) ? e.flags.map((i) => ea(i)) : [] }; }, toJSON(e) { const i = {}; return e.flags?.length && (i.flags = e.flags.map((n) => ia(n))), i; }, create(e) { return T.fromPartial(e ?? {}); }, fromPartial(e) { const i = ri(); return i.flags = e.flags?.map((n) => n) || [], i; } }; function ai() { return { flags: [] }; } const v = { encode(e, i = new u()) { i.uint32(10).fork(); for (const n of e.flags) i.int32(n); return i.join(), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = ai(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r === 8) { a.flags.push(n.int32()); continue; } if (r === 10) { const f = n.uint32() + n.pos; for (; n.pos < f; ) a.flags.push(n.int32()); continue; } break; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { flags: globalThis.Array.isArray(e?.flags) ? e.flags.map((i) => ra(i)) : [] }; }, toJSON(e) { const i = {}; return e.flags?.length && (i.flags = e.flags.map((n) => aa(n))), i; }, create(e) { return v.fromPartial(e ?? {}); }, fromPartial(e) { const i = ai(); return i.flags = e.flags?.map((n) => n) || [], i; } }; function ti() { return { stringValue: void 0, doubleValue: void 0 }; } const Z = { encode(e, i = new u()) { return e.stringValue !== void 0 && i.uint32(10).string(e.stringValue), e.doubleValue !== void 0 && i.uint32(17).double(e.doubleValue), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = ti(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 10) break; a.stringValue = n.string(); continue; } case 2: { if (r !== 17) break; a.doubleValue = n.double(); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { stringValue: m(e.stringValue) ? globalThis.String(e.stringValue) : m(e.string_value) ? globalThis.String(e.string_value) : void 0, doubleValue: m(e.doubleValue) ? globalThis.Number(e.doubleValue) : m(e.double_value) ? globalThis.Number(e.double_value) : void 0 }; }, toJSON(e) { const i = {}; return e.stringValue !== void 0 && (i.stringValue = e.stringValue), e.doubleValue !== void 0 && (i.doubleValue = e.doubleValue), i; }, create(e) { return Z.fromPartial(e ?? {}); }, fromPartial(e) { const i = ti(); return i.stringValue = e.stringValue ?? void 0, i.doubleValue = e.doubleValue ?? void 0, i; } }; function si() { return { name: "", qualifiedName: "", unit: "", stringValue: void 0, doubleValue: 0 }; } const h = { encode(e, i = new u()) { return e.name !== "" && i.uint32(10).string(e.name), e.qualifiedName !== "" && i.uint32(18).string(e.qualifiedName), e.unit !== "" && i.uint32(26).string(e.unit), e.stringValue !== void 0 && i.uint32(34).string(e.stringValue), e.doubleValue !== 0 && i.uint32(41).double(e.doubleValue), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = si(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 10) break; a.name = n.string(); continue; } case 2: { if (r !== 18) break; a.qualifiedName = n.string(); continue; } case 3: { if (r !== 26) break; a.unit = n.string(); continue; } case 4: { if (r !== 34) break; a.stringValue = n.string(); continue; } case 5: { if (r !== 41) break; a.doubleValue = n.double(); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { name: m(e.name) ? globalThis.String(e.name) : "", qualifiedName: m(e.qualifiedName) ? globalThis.String(e.qualifiedName) : m(e.qualified_name) ? globalThis.String(e.qualified_name) : "", unit: m(e.unit) ? globalThis.String(e.unit) : "", stringValue: m(e.stringValue) ? globalThis.String(e.stringValue) : m(e.string_value) ? globalThis.String(e.string_value) : void 0, doubleValue: m(e.doubleValue) ? globalThis.Number(e.doubleValue) : m(e.double_value) ? globalThis.Number(e.double_value) : 0 }; }, toJSON(e) { const i = {}; return e.name !== "" && (i.name = e.name), e.qualifiedName !== "" && (i.qualifiedName = e.qualifiedName), e.unit !== "" && (i.unit = e.unit), e.stringValue !== void 0 && (i.stringValue = e.stringValue), e.doubleValue !== 0 && (i.doubleValue = e.doubleValue), i; }, create(e) { return h.fromPartial(e ?? {}); }, fromPartial(e) { const i = si(); return i.name = e.name ?? "", i.qualifiedName = e.qualifiedName ?? "", i.unit = e.unit ?? "", i.stringValue = e.stringValue ?? void 0, i.doubleValue = e.doubleValue ?? 0, i; } }; function oi() { return { sourceId: "", sourceName: "", streamId: "", id: 0, messageName: "", data: [], tx: !1, dlc: 0, hashCode: 0, properties: {}, signalValues: [], canFrameFlags: void 0, linFrameFlags: void 0, timeUs: l.UZERO, deltaTimeUs: void 0, fixedPosIdentifier: void 0, protocol: void 0, muxValue: void 0 }; } const me = { encode(e, i = new u()) { e.sourceId !== "" && i.uint32(10).string(e.sourceId), e.sourceName !== "" && i.uint32(18).string(e.sourceName), e.streamId !== "" && i.uint32(26).string(e.streamId), e.id !== 0 && i.uint32(32).int32(e.id), e.messageName !== "" && i.uint32(42).string(e.messageName), i.uint32(50).fork(); for (const n of e.data) i.uint32(n); i.join(), e.tx !== !1 && i.uint32(64).bool(e.tx), e.dlc !== 0 && i.uint32(72).int32(e.dlc), e.hashCode !== 0 && i.uint32(80).int32(e.hashCode), globalThis.Object.entries(e.properties).forEach(([n, t]) => { Be.encode({ key: n, value: t }, i.uint32(90).fork()).join(); }); for (const n of e.signalValues) h.encode(n, i.uint32(98).fork()).join(); return e.canFrameFlags !== void 0 && T.encode(e.canFrameFlags, i.uint32(106).fork()).join(), e.linFrameFlags !== void 0 && v.encode(e.linFrameFlags, i.uint32(114).fork()).join(), e.timeUs.equals(l.UZERO) || i.uint32(152).uint64(e.timeUs.toString()), e.deltaTimeUs !== void 0 && i.uint32(120).uint64(e.deltaTimeUs.toString()), e.fixedPosIdentifier !== void 0 && i.uint32(130).string(e.fixedPosIdentifier), e.protocol !== void 0 && i.uint32(138).string(e.protocol), e.muxValue !== void 0 && i.uint32(144).int32(e.muxValue), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = oi(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 10) break; a.sourceId = n.string(); continue; } case 2: { if (r !== 18) break; a.sourceName = n.string(); continue; } case 3: { if (r !== 26) break; a.streamId = n.string(); continue; } case 4: { if (r !== 32) break; a.id = n.int32(); continue; } case 5: { if (r !== 42) break; a.messageName = n.string(); continue; } case 6: { if (r === 48) { a.data.push(n.uint32()); continue; } if (r === 50) { const f = n.uint32() + n.pos; for (; n.pos < f; ) a.data.push(n.uint32()); continue; } break; } case 8: { if (r !== 64) break; a.tx = n.bool(); continue; } case 9: { if (r !== 72) break; a.dlc = n.int32(); continue; } case 10: { if (r !== 80) break; a.hashCode = n.int32(); continue; } case 11: { if (r !== 90) break; const f = Be.decode(n, n.uint32()); f.value !== void 0 && (a.properties[f.key] = f.value); continue; } case 12: { if (r !== 98) break; a.signalValues.push(h.decode(n, n.uint32())); continue; } case 13: { if (r !== 106) break; a.canFrameFlags = T.decode(n, n.uint32()); continue; } case 14: { if (r !== 114) break; a.linFrameFlags = v.decode(n, n.uint32()); continue; } case 19: { if (r !== 152) break; a.timeUs = l.fromString(n.uint64().toString(), !0); continue; } case 15: { if (r !== 120) break; a.deltaTimeUs = l.fromString(n.uint64().toString(), !0); continue; } case 16: { if (r !== 130) break; a.fixedPosIdentifier = n.string(); continue; } case 17: { if (r !== 138) break; a.protocol = n.string(); continue; } case 18: { if (r !== 144) break; a.muxValue = n.int32(); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { sourceId: m(e.sourceId) ? globalThis.String(e.sourceId) : m(e.source_id) ? globalThis.String(e.source_id) : "", sourceName: m(e.sourceName) ? globalThis.String(e.sourceName) : m(e.source_name) ? globalThis.String(e.source_name) : "", streamId: m(e.streamId) ? globalThis.String(e.streamId) : m(e.stream_id) ? globalThis.String(e.stream_id) : "", id: m(e.id) ? globalThis.Number(e.id) : 0, messageName: m(e.messageName) ? globalThis.String(e.messageName) : m(e.message_name) ? globalThis.String(e.message_name) : "", data: globalThis.Array.isArray(e?.data) ? e.data.map((i) => globalThis.Number(i)) : [], tx: m(e.tx) ? globalThis.Boolean(e.tx) : !1, dlc: m(e.dlc) ? globalThis.Number(e.dlc) : 0, hashCode: m(e.hashCode) ? globalThis.Number(e.hashCode) : m(e.hash_code) ? globalThis.Number(e.hash_code) : 0, properties: ua(e.properties) ? globalThis.Object.entries(e.properties).reduce((i, [n, t]) => (i[n] = Z.fromJSON(t), i), {}) : {}, signalValues: globalThis.Array.isArray(e?.signalValues) ? e.signalValues.map((i) => h.fromJSON(i)) : globalThis.Array.isArray(e?.signal_values) ? e.signal_values.map((i) => h.fromJSON(i)) : [], canFrameFlags: m(e.canFrameFlags) ? T.fromJSON(e.canFrameFlags) : m(e.can_frame_flags) ? T.fromJSON(e.can_frame_flags) : void 0, linFrameFlags: m(e.linFrameFlags) ? v.fromJSON(e.linFrameFlags) : m(e.lin_frame_flags) ? v.fromJSON(e.lin_frame_flags) : void 0, timeUs: m(e.timeUs) ? l.fromValue(e.timeUs) : m(e.time_us) ? l.fromValue(e.time_us) : l.UZERO, deltaTimeUs: m(e.deltaTimeUs) ? l.fromValue(e.deltaTimeUs) : m(e.delta_time_us) ? l.fromValue(e.delta_time_us) : void 0, fixedPosIdentifier: m(e.fixedPosIdentifier) ? globalThis.String(e.fixedPosIdentifier) : m(e.fixed_pos_identifier) ? globalThis.String(e.fixed_pos_identifier) : void 0, protocol: m(e.protocol) ? globalThis.String(e.protocol) : void 0, muxValue: m(e.muxValue) ? globalThis.Number(e.muxValue) : m(e.mux_value) ? globalThis.Number(e.mux_value) : void 0 }; }, toJSON(e) { const i = {}; if (e.sourceId !== "" && (i.sourceId = e.sourceId), e.sourceName !== "" && (i.sourceName = e.sourceName), e.streamId !== "" && (i.streamId = e.streamId), e.id !== 0 && (i.id = Math.round(e.id)), e.messageName !== "" && (i.messageName = e.messageName), e.data?.length && (i.data = e.data.map((n) => Math.round(n))), e.tx !== !1 && (i.tx = e.tx), e.dlc !== 0 && (i.dlc = Math.round(e.dlc)), e.hashCode !== 0 && (i.hashCode = Math.round(e.hashCode)), e.properties) { const n = globalThis.Object.entries(e.properties); n.length > 0 && (i.properties = {}, n.forEach(([t, a]) => { i.properties[t] = Z.toJSON(a); })); } return e.signalValues?.length && (i.signalValues = e.signalValues.map((n) => h.toJSON(n))), e.canFrameFlags !== void 0 && (i.canFrameFlags = T.toJSON(e.canFrameFlags)), e.linFrameFlags !== void 0 && (i.linFrameFlags = v.toJSON(e.linFrameFlags)), e.timeUs.equals(l.UZERO) || (i.timeUs = (e.timeUs || l.UZERO).toString()), e.deltaTimeUs !== void 0 && (i.deltaTimeUs = (e.deltaTimeUs || l.UZERO).toString()), e.fixedPosIdentifier !== void 0 && (i.fixedPosIdentifier = e.fixedPosIdentifier), e.protocol !== void 0 && (i.protocol = e.protocol), e.muxValue !== void 0 && (i.muxValue = Math.round(e.muxValue)), i; }, create(e) { return me.fromPartial(e ?? {}); }, fromPartial(e) { const i = oi(); return i.sourceId = e.sourceId ?? "", i.sourceName = e.sourceName ?? "", i.streamId = e.streamId ?? "", i.id = e.id ?? 0, i.messageName = e.messageName ?? "", i.data = e.data?.map((n) => n) || [], i.tx = e.tx ?? !1, i.dlc = e.dlc ?? 0, i.hashCode = e.hashCode ?? 0, i.properties = globalThis.Object.entries(e.properties ?? {}).reduce((n, [t, a]) => (a !== void 0 && (n[t] = Z.fromPartial(a)), n), {}), i.signalValues = e.signalValues?.map((n) => h.fromPartial(n)) || [], i.canFrameFlags = e.canFrameFlags !== void 0 && e.canFrameFlags !== null ? T.fromPartial(e.canFrameFlags) : void 0, i.linFrameFlags = e.linFrameFlags !== void 0 && e.linFrameFlags !== null ? v.fromPartial(e.linFrameFlags) : void 0, i.timeUs = e.timeUs !== void 0 && e.timeUs !== null ? l.fromValue(e.timeUs) : l.UZERO, i.deltaTimeUs = e.deltaTimeUs !== void 0 && e.deltaTimeUs !== null ? l.fromValue(e.deltaTimeUs) : void 0, i.fixedPosIdentifier = e.fixedPosIdentifier ?? void 0, i.protocol = e.protocol ?? void 0, i.muxValue = e.muxValue ?? void 0, i; } }; function ui() { return { key: "", value: void 0 }; } const Be = { encode(e, i = new u()) { return e.key !== "" && i.uint32(10).string(e.key), e.value !== void 0 && Z.encode(e.value, i.uint32(18).fork()).join(), i; }, decode(e, i) { const n = e instanceof o ? e : new o(e), t = i === void 0 ? n.len : n.pos + i, a = ui(); for (; n.pos < t; ) { const r = n.uint32(); switch (r >>> 3) { case 1: { if (r !== 10) break; a.key = n.string(); continue; } case 2: { if (r !== 18) break; a.value = Z.decode(n, n.uint32()); continue; } } if ((r & 7) === 4 || r === 0) break; n.skip(r & 7); } return a; }, fromJSON(e) { return { key: m(e.key) ? globalThis.String(e.key) : "", value: m(e.value) ? Z.fromJSON(e.value) : void 0 }; }, toJSON