var o = Object.defineProperty;
var i = (s, e) => o(s, "name", { value: e, configurable: !0 });
import { localOneofName as l } from "./names.js";
import { assert as f } from "./assert.js";
class d {
  static {
    i(this, "InternalOneofInfo");
  }
  constructor(e) {
    this.kind = "oneof", this.repeated = !1, this.packed = !1, this.opt = !1, this.req = !1, this.default = void 0, this.fields = [], this.name = e, this.localName = l(e);
  }
  addField(e) {
    f(e.oneof === this, `field ${e.name} not one of ${this.name}`), this.fields.push(e);
  }
  findField(e) {
    if (!this._lookup) {
      this._lookup = /* @__PURE__ */ Object.create(null);
      for (let t = 0; t < this.fields.length; t++)
        this._lookup[this.fields[t].localName] = this.fields[t];
    }
    return this._lookup[e];
  }
}
export {
  d as InternalOneofInfo
};
