const t = {
  modelType: "GenAI_NanoGPT_v2",
  vocabSize: 2e3,
  blockSize: 128,
  // Maximum sequence length
  nLayer: 6,
  // Number of transformer layers
  nHead: 4,
  // Number of attention heads
  nEmbed: 256,
  // Embedding dimension
  mlpFactor: 4
};
function n(e, a) {
  if (typeof e[a] != "number" || Number.isNaN(e[a]))
    throw new Error(`Invalid config: "${a}" must be a number.`);
}
function l(e) {
  const a = (o) => typeof o == "object" && o !== null && !Array.isArray(o);
  if (!a(e))
    throw new Error("Invalid config: expected an object.");
  if (n(e, "vocabSize"), n(e, "blockSize"), n(e, "nLayer"), n(e, "nHead"), n(e, "nEmbed"), n(e, "mlpFactor"), e.loraConfig !== void 0) {
    if (!a(e.loraConfig))
      throw new Error('Invalid config: "loraConfig" must be an object.');
    const o = Object.values(e.loraConfig);
    if (!o.every((r) => a(r)))
      throw new Error('Invalid config: each entry in "loraConfig" must be an object.');
    if (!o.every((r) => "rank" in r && "alpha" in r && "variables" in r))
      throw new Error('Invalid config: each LoRA config must have "rank", "alpha", and "variables" fields.');
    o.forEach((r) => {
      if (n(r, "rank"), n(r, "alpha"), !Array.isArray(r.variables) || !r.variables.every((i) => typeof i == "string"))
        throw new Error('Invalid config: "variables" must be a string array.');
    });
  }
  if (e.modelType === "GenAI_NanoGPT_v1") {
    if (typeof e.useRope != "boolean")
      throw new Error('Invalid config: "useRope" must be a boolean for GenAI_NanoGPT_v1.');
    return;
  }
  if (e.modelType === "GenAI_NanoGPT_v2") {
    if (e.windowSize !== void 0 && typeof e.windowSize != "string")
      throw new Error('Invalid config: "windowSize" must be a string for GenAI_NanoGPT_v2.');
    return;
  }
  throw new Error('Invalid config: "modelType" must be "GenAI_NanoGPT_v1" or "GenAI_NanoGPT_v2".');
}
export {
  t as defaultConfig,
  l as validateConfig
};
