import { __exports as s } from "../../../../../../../../_virtual/additionalItems.js";
import { __require as y } from "../../compile/codegen/index.js";
import { __require as g } from "../../compile/util.js";
var u;
function A() {
  if (u) return s;
  u = 1, Object.defineProperty(s, "__esModule", { value: !0 }), s.validateAdditionalItems = void 0;
  const a = y(), n = g(), c = {
    keyword: "additionalItems",
    type: "array",
    schemaType: ["boolean", "object"],
    before: "uniqueItems",
    error: {
      message: ({ params: { len: e } }) => (0, a.str)`must NOT have more than ${e} items`,
      params: ({ params: { len: e } }) => (0, a._)`{limit: ${e}}`
    },
    code(e) {
      const { parentSchema: r, it: t } = e, { items: i } = r;
      if (!Array.isArray(i)) {
        (0, n.checkStrictMode)(t, '"additionalItems" is ignored when "items" is not an array of schemas');
        return;
      }
      m(e, i);
    }
  };
  function m(e, r) {
    const { gen: t, schema: i, data: f, keyword: p, it: d } = e;
    d.items = !0;
    const l = t.const("len", (0, a._)`${f}.length`);
    if (i === !1)
      e.setParams({ len: r.length }), e.pass((0, a._)`${l} <= ${r.length}`);
    else if (typeof i == "object" && !(0, n.alwaysValidSchema)(d, i)) {
      const o = t.var("valid", (0, a._)`${l} <= ${r.length}`);
      t.if((0, a.not)(o), () => h(o)), e.ok(o);
    }
    function h(o) {
      t.forRange("i", r.length, l, (_) => {
        e.subschema({ keyword: p, dataProp: _, dataPropType: n.Type.Num }, o), d.allErrors || t.if((0, a.not)(o), () => t.break());
      });
    }
  }
  return s.validateAdditionalItems = m, s.default = c, s;
}
export {
  A as __require
};
//# sourceMappingURL=additionalItems.js.map
