import { fieldFactory as p } from "../subcomponents/FieldTypes/fieldFactory.js";
function u(f, t, a) {
  const o = [], i = [];
  for (let n = 0; n < t.length; n++)
    try {
      const d = t[n], e = a(d.name), r = {
        id: 0,
        isSet: !0,
        fixed: !1,
        field: e,
        fieldType: e.type,
        operator: t[n].operator,
        operand1: t[n].operand1,
        operand2: t[n].operand2,
        operandsArray: t[n].operandsArray
      };
      if (!e)
        continue;
      p(e.type).verifyFilter(d, e) && (r.fieldType === "datetime" && (r.operand1 = /* @__PURE__ */ new Date(r.operand1 + ""), r.operand2 = /* @__PURE__ */ new Date(r.operand2 + "")), e.presence === "fixed" && (i.findIndex((c) => c === e.name) === -1 ? (r.fixed = !0, i.push(e.name)) : r.fixed = !1), r.isSet = !0, r.id = o.length + 1, o.push(r));
    } catch {
    }
  for (let n = 0; n < f.length; n++) {
    const d = f[n];
    if ((d.presence === "initialized" || d.presence === "fixed") && !t.find((e) => e.name === d.name)) {
      const e = p(d.type).getDefaultFilter(
        d,
        d.presence === "fixed"
      );
      e.id = -(o.length + 1), o.push(e);
    }
  }
  return o;
}
export {
  u as getPurgedInitialFiltersApplied
};
