"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 object_meta_exports = {};
__export(object_meta_exports, {
  ObjectMeta: () => ObjectMeta
});
module.exports = __toCommonJS(object_meta_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");
class ObjectMeta$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.ObjectMeta", [
      {
        no: 6,
        name: "resource_version",
        kind: "scalar",
        T: 9
      },
      {
        no: 12,
        name: "annotations",
        kind: "map",
        K: 9,
        V: {
          kind: "scalar",
          T: 9
          /*ScalarType.STRING*/
        }
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.resourceVersion = "";
    message.annotations = {};
    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 resource_version */
        6:
          message.resourceVersion = reader.string();
          break;
        case /* map<string, string> annotations */
        12:
          this.binaryReadMap12(message.annotations, reader, 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;
  }
  binaryReadMap12(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 = reader.string();
          break;
        default:
          throw new globalThis.Error(
            "unknown map entry field for com.daml.ledger.api.v2.admin.ObjectMeta.annotations"
          );
      }
    }
    map[key ?? ""] = val ?? "";
  }
  internalBinaryWrite(message, writer, options) {
    if (message.resourceVersion !== "")
      writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.resourceVersion);
    for (let k of globalThis.Object.keys(message.annotations))
      writer.tag(12, import_runtime.WireType.LengthDelimited).fork().tag(1, import_runtime.WireType.LengthDelimited).string(k).tag(2, import_runtime.WireType.LengthDelimited).string(message.annotations[k]).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ObjectMeta = new ObjectMeta$Type();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ObjectMeta
});
//# sourceMappingURL=object_meta.cjs.map