import { Z as ZodEffects, a as ZodType } from "../../index-D5q7WHKa.js";
var ZodFieldType = /* @__PURE__ */ ((ZodFieldType2) => {
  ZodFieldType2["OBJECT"] = "ZodObject";
  ZodFieldType2["STRING"] = "ZodString";
  ZodFieldType2["NUMBER"] = "ZodNumber";
  ZodFieldType2["BOOLEAN"] = "ZodBoolean";
  return ZodFieldType2;
})(ZodFieldType || {});
function getZodField(obj) {
  const zodFieldName = getZodFieldTypeName(obj);
  if (!Object.values(ZodFieldType).includes(zodFieldName)) {
    throw new Error(
      `getZodField Error: Only ${Object.values(ZodFieldType).join(`, `)} ZodTypes are supported, received ${zodFieldName}.`
    );
  }
  if (obj instanceof ZodEffects && obj._def.schema instanceof ZodType) {
    return obj._def.schema;
  }
  return obj;
}
function getZodFieldTypeName(obj) {
  if ("schema" in obj._def && obj instanceof ZodEffects && obj._def.schema instanceof ZodType) {
    return getZodFieldTypeName(obj._def.schema);
  }
  if ("innerType" in obj._def) {
    return getZodFieldTypeName(obj._def.innerType);
  }
  if ("typeName" in obj._def && typeof obj._def.typeName === "string") {
    return obj._def.typeName;
  }
  throw new Error("getZodFieldTypeName: Unable to determine field type");
}
export {
  ZodFieldType,
  getZodField,
  getZodFieldTypeName
};
//# sourceMappingURL=zod-helpers.js.map
