import { defineComponent as I, h as R, computed as h, openBlock as l, createBlock as V, resolveDynamicComponent as B, unref as c, normalizeClass as F, withCtx as D, createElementVNode as d, renderSlot as N, normalizeProps as z, guardReactiveProps as E, createElementBlock as u, Fragment as g, renderList as L, createVNode as k, createCommentVNode as y } from "vue";
import { components as P } from "@feedmepos/ui-library";
/**
   * vue-table
   *
   * Copyright (c) TanStack
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE.md file in the root directory of this source tree.
   *
   * @license MIT
   */
const b = I({
  props: ["render", "props"],
  setup: (o) => () => typeof o.render == "function" || typeof o.render == "object" ? R(o.render, o.props) : o.render
}), S = { class: "flex gap-4 w-full" }, _ = { class: "flex-1" }, $ = { class: "flex flex-col" }, j = { key: 0 }, A = { key: 0 }, G = /* @__PURE__ */ I({
  __name: "TableActionableRow",
  props: {
    row: {},
    onRowClick: {},
    actionColumnId: { default: "action" }
  },
  setup(o) {
    const m = o, s = h(
      () => m.row.getVisibleCells().reduce(
        (e, r) => (e[r.column.id] = r, e),
        {}
      )
    );
    return (e, r) => (l(), V(B(e.onRowClick ? c(P).FmListItem : "div"), {
      class: F([
        "w-full border-b border-fm-color-neutral-gray-100",
        {
          "bg-fm-color-neutral-gray-100": e.row.getIsSelected(),
          "cursor-pointer": typeof e.onRowClick == "function"
        }
      ]),
      onClick: r[0] || (r[0] = (a) => {
        var t;
        return (t = e.onRowClick) == null ? void 0 : t.call(e, e.row.original);
      })
    }, {
      default: D(() => {
        var a, t, p, i, f;
        return [
          d("div", S, [
            d("div", _, [
              N(e.$slots, "default", z(E(s.value)), () => [
                d("div", $, [
                  (l(!0), u(g, null, L(m.row.getVisibleCells(), (n) => {
                    var C, v, w;
                    return l(), u(g, {
                      key: n.id
                    }, [
                      n.column.id !== e.actionColumnId ? (l(), u("div", j, [
                        k(c(b), {
                          render: (v = (C = n.column) == null ? void 0 : C.columnDef) == null ? void 0 : v.cell,
                          props: (w = n.getContext) == null ? void 0 : w.call(n)
                        }, null, 8, ["render", "props"])
                      ])) : y("", !0)
                    ], 64);
                  }), 128))
                ])
              ])
            ]),
            s.value[e.actionColumnId ?? ""] ? (l(), u("div", A, [
              d("div", null, [
                k(c(b), {
                  render: (p = (t = (a = s.value[e.actionColumnId ?? ""]) == null ? void 0 : a.column) == null ? void 0 : t.columnDef) == null ? void 0 : p.cell,
                  props: (f = (i = s.value[e.actionColumnId ?? ""]) == null ? void 0 : i.getContext) == null ? void 0 : f.call(i)
                }, null, 8, ["render", "props"])
              ])
            ])) : y("", !0)
          ])
        ];
      }),
      _: 3
    }, 8, ["class"]));
  }
});
export {
  b as F,
  G as _
};
