import { defineComponent as g, openBlock as o, createElementBlock as n, normalizeStyle as k, unref as s, normalizeClass as i, createElementVNode as r, renderSlot as c, createBlock as h, createCommentVNode as p, Fragment as m } from "vue";
import { useTheme as v } from "../../composables/useTheme.js";
import x from "../tooltip/ToggleTip.vue.js";
const b = { class: "flex items-center gap-1" }, B = {
  key: 2,
  d: "m3 9l4-4l4 4M7 5v14m14-4l-4 4l-4-4m4 4V5"
}, d = {
  sort: [1, -1, void 0],
  textAlign: ["left", "center", "right"]
}, A = {
  sort: {
    type: Number,
    validator: (l) => d.sort.includes(l)
  },
  sortable: Boolean,
  textAlign: {
    type: String,
    default: "left",
    validator: (l) => d.textAlign.includes(l)
  },
  tooltip: String
}, C = { name: "XTableHeader", validators: d }, T = /* @__PURE__ */ g({
  ...C,
  props: A,
  setup(l) {
    const u = l, { styles: y, classes: a, className: f } = v("TableHeader", {}, u);
    return (e, t) => (o(), n("th", {
      style: k(s(y)),
      class: i([s(f), s(a).th, "group/th"])
    }, [
      r("div", {
        class: i(s(a).header)
      }, [
        r("div", b, [
          c(e.$slots, "default"),
          e.tooltip ? (o(), h(x, {
            key: 0,
            content: e.tooltip
          }, null, 8, ["content"])) : p("", !0)
        ]),
        e.sortable ? (o(), n("svg", {
          key: 0,
          class: i(["shrink-0", [
            s(a).sortIcon,
            e.textAlign === "right" ? "-mr-4 -translate-x-4" : "-ml-4 translate-x-4",
            [e.sort && [1, -1].includes(e.sort) ? "" : "group-hover/th:text-secondary-500 dark:group-hover/th:text-secondary-400"],
            [e.sort !== -1 && e.sort !== 1 ? "text-secondary-400 dark:text-secondary-500" : "text-primary-500 dark:text-primary-400"]
          ]]),
          width: "24",
          height: "24",
          viewBox: "0 0 24 24",
          stroke: "currentColor",
          "stroke-linejoin": "round",
          "stroke-linecap": "round",
          fill: "none",
          role: "presentation"
        }, [
          e.sort === -1 ? (o(), n(m, { key: 0 }, [
            t[0] || (t[0] = r("line", {
              x1: "12",
              y1: "5",
              x2: "12",
              y2: "19"
            }, null, -1)),
            t[1] || (t[1] = r("polyline", { points: "19 12 12 19 5 12" }, null, -1))
          ], 64)) : e.sort === 1 ? (o(), n(m, { key: 1 }, [
            t[2] || (t[2] = r("line", {
              x1: "12",
              y1: "19",
              x2: "12",
              y2: "5"
            }, null, -1)),
            t[3] || (t[3] = r("polyline", { points: "5 12 12 5 19 12" }, null, -1))
          ], 64)) : (o(), n("path", B))
        ], 2)) : p("", !0)
      ], 2)
    ], 6));
  }
});
export {
  T as default
};
