import { makeProtoRuntime as n } from "./private/proto-runtime.js";
import { InternalFieldList as t } from "./private/field-list.js";
import { scalarZeroValue as m } from "./private/scalars.js";
import { normalizeFieldInfos as i } from "./private/field-normalize.js";
const l = n(
  "proto3",
  (a) => new t(a, (e) => i(e)),
  // TODO merge with proto2 and initExtensionField, also see initPartial, equals, clone
  (a) => {
    for (const e of a.getType().fields.byMember()) {
      if (e.opt)
        continue;
      const o = e.localName, r = a;
      if (e.repeated) {
        r[o] = [];
        continue;
      }
      switch (e.kind) {
        case "oneof":
          r[o] = { case: void 0 };
          break;
        case "enum":
          r[o] = 0;
          break;
        case "map":
          r[o] = {};
          break;
        case "scalar":
          r[o] = m(e.T, e.L);
          break;
      }
    }
  }
);
export {
  l as proto3
};
