import { defineComponent as F, defineAsyncComponent as a, computed as o, reactive as z, openBlock as i, createElementBlock as c, normalizeClass as $, unref as t, normalizeStyle as G, createCommentVNode as m, createElementVNode as D, toDisplayString as K, renderSlot as M, Fragment as H, renderList as I, createBlock as A, resolveDynamicComponent as O } from "vue";
const U = {
  key: 0,
  class: "cds-fields-group__label"
}, j = ["innerHTML"], J = ["textContent"], N = ["textContent"], Q = /* @__PURE__ */ F({
  __name: "Group",
  props: {
    group: null,
    decorations: null,
    formWidth: null,
    uploader: null
  },
  emits: ["change-data", "update-data", "file", "group", "list"],
  setup(T, { emit: g }) {
    var S;
    const n = T;
    a(() => import("./InputNumber-be4245f6.mjs")), a(() => import("./InputText-67493c8f.mjs")), a(() => import("./InputTextarea-0b54a4ed.mjs")), a(() => import("./InputTextEditor-30ed5757.mjs")), a(() => import("./InputCheckbox-0deb683e.mjs")), a(() => import("./index-16f6bbbd.mjs").then((e) => e.a5)), a(() => import("./InputSelect-eb6cecae.mjs")), a(() => import("./index-16f6bbbd.mjs").then((e) => e.a6)), a(() => import("./InputDate-40843186.mjs")), a(() => import("./InputJson-0e9cf7cd.mjs")), a(() => import("./InputFile-4f1f9561.mjs"));
    const p = o(() => n.formWidth || 0), y = o(() => n.group.id), _ = o(() => {
      var e;
      return (e = n.group) == null ? void 0 : e.groupKey;
    });
    o(() => n.group.name);
    const h = o(() => {
      var e;
      return (e = n.group) == null ? void 0 : e.icon;
    }), b = o(() => {
      var e;
      return (e = n.group) == null ? void 0 : e.label;
    }), C = o(() => {
      var e;
      return (e = n.group) == null ? void 0 : e.description;
    }), d = o(() => {
      var e;
      return ((e = n.group) == null ? void 0 : e.width) || 1;
    });
    o(() => {
      var e;
      return ((e = n.group) == null ? void 0 : e.height) || 1;
    }), o(() => {
      var e;
      return ((e = n.group) == null ? void 0 : e.order) || 0;
    });
    const s = o(() => n == null ? void 0 : n.decorations);
    o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.size;
    });
    const k = o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.inline;
    }), V = o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.groupsSeparately;
    });
    o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.grid;
    });
    const q = o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.card;
    });
    o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.line;
    }), o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.displayOnly;
    }), o(() => {
      var e;
      return (e = s.value) == null ? void 0 : e.disabled;
    });
    const L = z({}), v = z((S = n.group) == null ? void 0 : S.fields), w = o(() => ({ "cds-fields-group--card": q.value && V.value })), B = o(() => d.value ? p.value > 1500 ? `grid-column: span ${d.value}` : p.value <= 1500 && p.value > 1300 ? `grid-column: span ${d.value > 2 ? d.value - 1 : 2}` : p.value <= 1300 && p.value > 900 ? `grid-column: span ${d.value > 1, 2}` : "grid-column: span 4" : "grid-column: span 4"), f = (e, r) => {
      const { key: l, valid: u, value: E, query: x } = e;
      !l || !v || !v.length || (r === "file" && g(r, e), L[l] = { key: l, valid: u, value: E, query: x }, g(r, e), g("group", { groupId: y.value, groupKey: _.value, query: x, values: L }));
    }, W = (e) => g("list", e);
    return (e, r) => (i(), c("div", {
      class: $([t(w), "cds-fields-group"]),
      style: G(t(B))
    }, [
      t(b) ? (i(), c("h3", U, [
        t(h) ? (i(), c("span", {
          key: 0,
          class: "cds-fields-group__label-icon",
          innerHTML: t(h)
        }, null, 8, j)) : m("", !0),
        D("span", {
          class: "cds-fields-group__label-text",
          textContent: K(t(b))
        }, null, 8, J)
      ])) : m("", !0),
      t(C) ? (i(), c("p", {
        key: 1,
        class: "cds-fields-group__description",
        textContent: K(t(C))
      }, null, 8, N)) : m("", !0),
      M(e.$slots, "top"),
      D("div", {
        class: $([{ "cds-fields-group__fields--inline": t(k) }, "cds-fields-group__fields"])
      }, [
        (i(!0), c(H, null, I(v, (l) => (i(), A(O(l.component), {
          base: {
            autocapitalizationType: l.autocapitalizationType,
            description: l.description,
            groupId: t(y),
            groupKey: t(_),
            hint: l.hint,
            icon: l.icon,
            inline: t(k),
            label: l.label,
            key: l.key,
            required: l.required,
            validate: l.validate,
            validationMessage: l.validationMessage,
            value: l.value
          },
          decorations: t(s),
          params: l.params,
          uploader: n.uploader,
          value: l.value,
          onFile: r[0] || (r[0] = (u) => f(u, "file")),
          onList: r[1] || (r[1] = (u) => W(u)),
          onChangeData: r[2] || (r[2] = (u) => f(u, "change-data")),
          onUpdateData: r[3] || (r[3] = (u) => f(u, "update-data"))
        }, null, 40, ["base", "decorations", "params", "uploader", "value"]))), 256))
      ], 2),
      M(e.$slots, "bottom")
    ], 6));
  }
});
export {
  Q as default
};
//# sourceMappingURL=Group-18743db5.mjs.map
