"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.State = exports.Message = exports.Type = void 0; const runtime_1 = require("@protobuf-ts/runtime"); const runtime_2 = require("@protobuf-ts/runtime"); const runtime_3 = require("@protobuf-ts/runtime"); const runtime_4 = require("@protobuf-ts/runtime"); const runtime_5 = require("@protobuf-ts/runtime"); /** * @generated from protobuf enum Type */ var Type; (function (Type) { /** * @generated synthetic value - protobuf-ts requires all enums to have a 0 value */ Type[Type["UNSPECIFIED$"] = 0] = "UNSPECIFIED$"; /** * @generated from protobuf enum value: BOOTSTRAP_REQUEST = 1; */ Type[Type["BOOTSTRAP_REQUEST"] = 1] = "BOOTSTRAP_REQUEST"; /** * @generated from protobuf enum value: BOOTSTRAP_RESPONSE = 2; */ Type[Type["BOOTSTRAP_RESPONSE"] = 2] = "BOOTSTRAP_RESPONSE"; /** * @generated from protobuf enum value: CONNECTED = 3; */ Type[Type["CONNECTED"] = 3] = "CONNECTED"; /** * @generated from protobuf enum value: DISCONNECTED = 4; */ Type[Type["DISCONNECTED"] = 4] = "DISCONNECTED"; /** * @generated from protobuf enum value: ADD_ITEM = 5; */ Type[Type["ADD_ITEM"] = 5] = "ADD_ITEM"; /** * @generated from protobuf enum value: REMOVE_ITEM = 6; */ Type[Type["REMOVE_ITEM"] = 6] = "REMOVE_ITEM"; /** * @generated from protobuf enum value: HEARTBEAT = 7; */ Type[Type["HEARTBEAT"] = 7] = "HEARTBEAT"; })(Type = exports.Type || (exports.Type = {})); // @generated message type with reflection information, may provide speed optimized methods class Message$Type extends runtime_5.MessageType { constructor() { super("Message", [ { no: 1, name: "type", kind: "enum", T: () => ["Type", Type] }, { no: 2, name: "bootstrap", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "message", T: () => exports.State } }, { no: 3, name: "data", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, { no: 4, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, { no: 5, name: "id", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } ]); } create(value) { const message = { type: 0, bootstrap: {} }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) runtime_3.reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader, length, options, target) { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* Type type */ 1: message.type = reader.int32(); break; case /* map bootstrap */ 2: this.binaryReadMap2(message.bootstrap, reader, options); break; case /* optional bytes data */ 3: message.data = reader.bytes(); break; case /* optional bytes signature */ 4: message.signature = reader.bytes(); break; case /* optional bytes id */ 5: message.id = reader.bytes(); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } binaryReadMap2(map, reader, options) { let len = reader.uint32(), end = reader.pos + len, key, val; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case 1: key = reader.string(); break; case 2: val = exports.State.internalBinaryRead(reader, reader.uint32(), options); break; default: throw new globalThis.Error("unknown map entry field for field Message.bootstrap"); } } map[key ?? ""] = val ?? exports.State.create(); } internalBinaryWrite(message, writer, options) { /* Type type = 1; */ if (message.type !== 0) writer.tag(1, runtime_1.WireType.Varint).int32(message.type); /* map bootstrap = 2; */ for (let k of Object.keys(message.bootstrap)) { writer.tag(2, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k); writer.tag(2, runtime_1.WireType.LengthDelimited).fork(); exports.State.internalBinaryWrite(message.bootstrap[k], writer, options); writer.join().join(); } /* optional bytes data = 3; */ if (message.data !== undefined) writer.tag(3, runtime_1.WireType.LengthDelimited).bytes(message.data); /* optional bytes signature = 4; */ if (message.signature !== undefined) writer.tag(4, runtime_1.WireType.LengthDelimited).bytes(message.signature); /* optional bytes id = 5; */ if (message.id !== undefined) writer.tag(5, runtime_1.WireType.LengthDelimited).bytes(message.id); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message Message */ exports.Message = new Message$Type(); // @generated message type with reflection information, may provide speed optimized methods class State$Type extends runtime_5.MessageType { constructor() { super("State", [ { no: 1, name: "connectedTo", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ } ]); } create(value) { const message = { connectedTo: [] }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) runtime_3.reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader, length, options, target) { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* repeated bytes connectedTo */ 1: message.connectedTo.push(reader.bytes()); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* repeated bytes connectedTo = 1; */ for (let i = 0; i < message.connectedTo.length; i++) writer.tag(1, runtime_1.WireType.LengthDelimited).bytes(message.connectedTo[i]); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message State */ exports.State = new State$Type();