"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var common_exports = {};
__export(common_exports, {
  StoreId: () => StoreId,
  StoreId_Authorized: () => StoreId_Authorized,
  StoreId_Synchronizer: () => StoreId_Synchronizer,
  StoreId_Temporary: () => StoreId_Temporary,
  TopologyTransactions: () => TopologyTransactions,
  TopologyTransactions_Item: () => TopologyTransactions_Item
});
module.exports = __toCommonJS(common_exports);
var import_runtime = require("@protobuf-ts/runtime");
var import_runtime2 = require("@protobuf-ts/runtime");
var import_runtime3 = require("@protobuf-ts/runtime");
var import_runtime4 = require("@protobuf-ts/runtime");
var import_timestamp = require("../../../../../../google/protobuf/timestamp.cjs");
class TopologyTransactions$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.topology.admin.v30.TopologyTransactions",
      [
        {
          no: 1,
          name: "items",
          kind: "message",
          repeat: 2,
          T: () => TopologyTransactions_Item
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.items = [];
    if (value !== void 0)
      (0, import_runtime3.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 com.digitalasset.canton.topology.admin.v30.TopologyTransactions.Item items */
        1:
          message.items.push(
            TopologyTransactions_Item.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          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 ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    for (let i = 0; i < message.items.length; i++)
      TopologyTransactions_Item.internalBinaryWrite(
        message.items[i],
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TopologyTransactions = new TopologyTransactions$Type();
class TopologyTransactions_Item$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.topology.admin.v30.TopologyTransactions.Item",
      [
        {
          no: 4,
          name: "sequenced",
          kind: "message",
          T: () => import_timestamp.Timestamp
        },
        {
          no: 1,
          name: "valid_from",
          kind: "message",
          T: () => import_timestamp.Timestamp
        },
        {
          no: 2,
          name: "valid_until",
          kind: "message",
          T: () => import_timestamp.Timestamp
        },
        {
          no: 3,
          name: "transaction",
          kind: "scalar",
          T: 12
        },
        {
          no: 5,
          name: "rejection_reason",
          kind: "scalar",
          opt: true,
          T: 9
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.transaction = new Uint8Array(0);
    if (value !== void 0)
      (0, import_runtime3.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 /* google.protobuf.Timestamp sequenced */
        4:
          message.sequenced = import_timestamp.Timestamp.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.sequenced
          );
          break;
        case /* google.protobuf.Timestamp valid_from */
        1:
          message.validFrom = import_timestamp.Timestamp.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.validFrom
          );
          break;
        case /* google.protobuf.Timestamp valid_until */
        2:
          message.validUntil = import_timestamp.Timestamp.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.validUntil
          );
          break;
        case /* bytes transaction */
        3:
          message.transaction = reader.bytes();
          break;
        case /* optional string rejection_reason */
        5:
          message.rejectionReason = reader.string();
          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 ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.validFrom)
      import_timestamp.Timestamp.internalBinaryWrite(
        message.validFrom,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.validUntil)
      import_timestamp.Timestamp.internalBinaryWrite(
        message.validUntil,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.transaction.length)
      writer.tag(3, import_runtime.WireType.LengthDelimited).bytes(message.transaction);
    if (message.sequenced)
      import_timestamp.Timestamp.internalBinaryWrite(
        message.sequenced,
        writer.tag(4, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.rejectionReason !== void 0)
      writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.rejectionReason);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TopologyTransactions_Item = new TopologyTransactions_Item$Type();
class StoreId$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.digitalasset.canton.topology.admin.v30.StoreId", [
      {
        no: 1,
        name: "authorized",
        kind: "message",
        oneof: "store",
        T: () => StoreId_Authorized
      },
      {
        no: 2,
        name: "synchronizer",
        kind: "message",
        oneof: "store",
        T: () => StoreId_Synchronizer
      },
      {
        no: 3,
        name: "temporary",
        kind: "message",
        oneof: "store",
        T: () => StoreId_Temporary
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.store = { oneofKind: void 0 };
    if (value !== void 0)
      (0, import_runtime3.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 /* com.digitalasset.canton.topology.admin.v30.StoreId.Authorized authorized */
        1:
          message.store = {
            oneofKind: "authorized",
            authorized: StoreId_Authorized.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.store.authorized
            )
          };
          break;
        case /* com.digitalasset.canton.topology.admin.v30.StoreId.Synchronizer synchronizer */
        2:
          message.store = {
            oneofKind: "synchronizer",
            synchronizer: StoreId_Synchronizer.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.store.synchronizer
            )
          };
          break;
        case /* com.digitalasset.canton.topology.admin.v30.StoreId.Temporary temporary */
        3:
          message.store = {
            oneofKind: "temporary",
            temporary: StoreId_Temporary.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.store.temporary
            )
          };
          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 ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.store.oneofKind === "authorized")
      StoreId_Authorized.internalBinaryWrite(
        message.store.authorized,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.store.oneofKind === "synchronizer")
      StoreId_Synchronizer.internalBinaryWrite(
        message.store.synchronizer,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.store.oneofKind === "temporary")
      StoreId_Temporary.internalBinaryWrite(
        message.store.temporary,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const StoreId = new StoreId$Type();
class StoreId_Authorized$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.topology.admin.v30.StoreId.Authorized",
      []
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.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) {
        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 ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const StoreId_Authorized = new StoreId_Authorized$Type();
class StoreId_Synchronizer$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.topology.admin.v30.StoreId.Synchronizer",
      [{
        no: 1,
        name: "id",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      }]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.id = "";
    if (value !== void 0)
      (0, import_runtime3.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 /* string id */
        1:
          message.id = reader.string();
          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 ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.id !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.id);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const StoreId_Synchronizer = new StoreId_Synchronizer$Type();
class StoreId_Temporary$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.digitalasset.canton.topology.admin.v30.StoreId.Temporary", [
      {
        no: 1,
        name: "name",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.name = "";
    if (value !== void 0)
      (0, import_runtime3.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 /* string name */
        1:
          message.name = reader.string();
          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 ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.name !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.name);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const StoreId_Temporary = new StoreId_Temporary$Type();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  StoreId,
  StoreId_Authorized,
  StoreId_Synchronizer,
  StoreId_Temporary,
  TopologyTransactions,
  TopologyTransactions_Item
});
//# sourceMappingURL=common.cjs.map