import { __exports as d } from "../../../../../../_virtual/limit.js";
import { __require as h } from "../../../../ajv@8.17.1/node_modules/ajv/dist/ajv.js";
import { __require as q } from "../../../../ajv@8.17.1/node_modules/ajv/dist/compile/codegen/index.js";
var $;
function D() {
  return $ ? d : ($ = 1, function(f) {
    Object.defineProperty(f, "__esModule", { value: !0 }), f.formatLimitDefinition = void 0;
    const _ = h(), o = q(), r = o.operators, n = {
      formatMaximum: { okStr: "<=", ok: r.LTE, fail: r.GT },
      formatMinimum: { okStr: ">=", ok: r.GTE, fail: r.LT },
      formatExclusiveMaximum: { okStr: "<", ok: r.LT, fail: r.GTE },
      formatExclusiveMinimum: { okStr: ">", ok: r.GT, fail: r.LTE }
    }, k = {
      message: ({ keyword: e, schemaCode: a }) => (0, o.str)`should be ${n[e].okStr} ${a}`,
      params: ({ keyword: e, schemaCode: a }) => (0, o._)`{comparison: ${n[e].okStr}, limit: ${a}}`
    };
    f.formatLimitDefinition = {
      keyword: Object.keys(n),
      type: "string",
      schemaType: "string",
      $data: !0,
      error: k,
      code(e) {
        const { gen: a, data: L, schemaCode: g, keyword: u, it: l } = e, { opts: m, self: s } = l;
        if (!m.validateFormats)
          return;
        const c = new _.KeywordCxt(l, s.RULES.all.format.definition, "format");
        c.$data ? E() : v();
        function E() {
          const i = a.scopeValue("formats", {
            ref: s.formats,
            code: m.code.formats
          }), t = a.const("fmt", (0, o._)`${i}[${c.schemaCode}]`);
          e.fail$data((0, o.or)((0, o._)`typeof ${t} != "object"`, (0, o._)`${t} instanceof RegExp`, (0, o._)`typeof ${t}.compare != "function"`, p(t)));
        }
        function v() {
          const i = c.schema, t = s.formats[i];
          if (!t || t === !0)
            return;
          if (typeof t != "object" || t instanceof RegExp || typeof t.compare != "function")
            throw new Error(`"${u}": format "${i}" does not define "compare" function`);
          const T = a.scopeValue("formats", {
            key: i,
            ref: t,
            code: m.code.formats ? (0, o._)`${m.code.formats}${(0, o.getProperty)(i)}` : void 0
          });
          e.fail$data(p(T));
        }
        function p(i) {
          return (0, o._)`${i}.compare(${L}, ${g}) ${n[u].fail} 0`;
        }
      },
      dependencies: ["format"]
    };
    const y = (e) => (e.addKeyword(f.formatLimitDefinition), e);
    f.default = y;
  }(d), d);
}
export {
  D as __require
};
//# sourceMappingURL=limit.js.map
