import { defineComponent as X, useModel as ae, computed as z, withDirectives as De, openBlock as s, createElementBlock as d, normalizeClass as B, createVNode as q, createCommentVNode as m, createElementVNode as k, Fragment as I, renderList as Q, vShow as ut, mergeModels as le, ref as P, useTemplateRef as Ie, unref as Y, withCtx as ne, renderSlot as M, toDisplayString as re, createBlock as N, resolveDynamicComponent as ct, onMounted as qe, normalizeStyle as te, mergeProps as Pe, watch as oe, onUnmounted as gt, withModifiers as vt, Transition as ft, createTextVNode as bt, useSlots as ht, createSlots as wt, normalizeProps as mt, nextTick as Le, vModelSelect as yt } from "vue";
import { _ as W, k as kt, v as pt, f as Pt, u as Dt, c as Ve, b as He, l as ze, e as Ue, i as Oe } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-gN_n5gOu.js";
import { ucfirst as St, ucwords as Ae, toSnakeCase as Ct } from "./dsg-vue.helpers-string.esm.js";
import { data_get as pe } from "./dsg-vue.helpers-object.esm.js";
import { isEmpty as xt } from "./dsg-vue.helpers.esm.js";
const $t = { class: "dsg-table-pagination" }, Tt = ["disabled"], Rt = ["disabled"], Mt = ["onClick", "innerHTML"], Et = ["onClick", "innerHTML"], Bt = ["disabled"], Ft = ["disabled"], We = /* @__PURE__ */ X({
  __name: "DsgTablePagination",
  props: /* @__PURE__ */ le({
    onEachSide: { default: 3 },
    firstPage: { default: 1 },
    showFirstLast: { type: Boolean, default: !0 },
    firstIcon: { default: "chevron-left-double" },
    lastIcon: { default: "chevron-right-double" },
    prevIcon: { default: "chevron-left" },
    nextIcon: { default: "chevron-right" }
  }, {
    pagination: { default: null },
    paginationModifiers: {}
  }),
  emits: /* @__PURE__ */ le(["dsg-table:change-page"], ["update:pagination"]),
  setup(e, { expose: F, emit: g }) {
    const r = ae(e, "pagination"), $ = z(() => r.value === null ? 0 : r.value?.last_page - e.firstPage + 1), L = z(() => r.value === null ? 0 : r.value?.last_page), b = z(() => r.value === null ? !1 : r.value?.current_page === e.firstPage), v = z(() => r.value === null ? !1 : r.value?.current_page === L.value), H = z(() => $.value < e.onEachSide * 2 + 4), x = z(() => e.onEachSide * 2 + 1), C = z(() => !r.value || r.value?.current_page <= e.onEachSide ? 1 : r.value?.current_page >= $.value - e.onEachSide ? $.value - e.onEachSide * 2 : r.value?.current_page - e.onEachSide), h = g, a = (R) => {
      h("dsg-table:change-page", R);
    }, T = (R) => R === r.value?.current_page;
    return F({
      loadPage: a
    }), (R, y) => De((s(), d("div", $t, [
      e.showFirstLast ? (s(), d("a", {
        key: 0,
        onClick: y[0] || (y[0] = (p) => a(e.firstPage)),
        class: B(["dsg-table-pagination__link", { "dsg-table-pagination__link--disabled": b.value }]),
        disabled: b.value,
        title: "First",
        "aria-label": "First"
      }, [
        q(W, {
          icon: e.firstIcon,
          size: "sm"
        }, null, 8, ["icon"])
      ], 10, Tt)) : m("", !0),
      k("a", {
        onClick: y[1] || (y[1] = (p) => a("prev")),
        class: B(["dsg-table-pagination__link", { "dsg-table-pagination__link--disabled": b.value }]),
        disabled: b.value,
        title: "Previous",
        "aria-label": "Previous"
      }, [
        q(W, {
          icon: e.prevIcon,
          size: "sm"
        }, null, 8, ["icon"])
      ], 10, Rt),
      H.value ? (s(!0), d(I, { key: 1 }, Q($.value, (p, V) => (s(), d("a", {
        key: V,
        onClick: (se) => a(V + e.firstPage),
        class: B(["dsg-table-pagination__link", { "dsg-table-pagination__link--active": T(V + e.firstPage) }]),
        innerHTML: p
      }, null, 10, Mt))), 128)) : (s(!0), d(I, { key: 2 }, Q(x.value, (p, V) => (s(), d("a", {
        key: V,
        onClick: (se) => a(C.value + V + e.firstPage - 1),
        class: B(["dsg-table-pagination__link", { "dsg-table-pagination__link--active": T(C.value + V + e.firstPage - 1) }]),
        innerHTML: C.value + p - 1
      }, null, 10, Et))), 128)),
      k("a", {
        onClick: y[2] || (y[2] = (p) => a("next")),
        class: B(["dsg-table-pagination__link", { "dsg-table-pagination__link--disabled": v.value }]),
        disabled: v.value,
        title: "Next",
        "aria-label": "Next"
      }, [
        q(W, {
          icon: e.nextIcon,
          size: "sm"
        }, null, 8, ["icon"])
      ], 10, Bt),
      e.showFirstLast ? (s(), d("a", {
        key: 3,
        onClick: y[3] || (y[3] = (p) => a(L.value)),
        class: B(["dsg-table-pagination__link", { "dsg-table-pagination__link--disabled": v.value }]),
        disabled: v.value,
        title: "Last",
        "aria-label": "Last"
      }, [
        q(W, {
          icon: e.lastIcon,
          size: "sm"
        }, null, 8, ["icon"])
      ], 10, Ft)) : m("", !0)
    ], 512)), [
      [ut, r.value && L.value > e.firstPage]
    ]);
  }
}), Lt = ["innerHTML"], Ne = /* @__PURE__ */ X({
  __name: "DsgTablePaginationInfo",
  props: /* @__PURE__ */ le({
    infoTemplate: { default: "Displaying {from} to {to} of {total} items" },
    noDataTemplate: { default: "No relevant data" }
  }, {
    pagination: { default: null },
    paginationModifiers: {}
  }),
  emits: ["update:pagination"],
  setup(e) {
    const F = ae(e, "pagination"), g = z(() => F.value == null || F.value.total == 0 ? e.noDataTemplate : e.infoTemplate.replace("{from}", (F.value?.from || 0).toString()).replace("{to}", (F.value?.to || 0).toString()).replace("{total}", (F.value?.total || 0).toString()));
    return (r, $) => (s(), d("div", {
      class: "dsg-table-pagination-info",
      innerHTML: g.value
    }, null, 8, Lt));
  }
}), Ht = {
  class: "dsg-table-actions",
  ref: "dsgTableActions"
}, Ut = { class: "dsg-table-action__trigger" }, At = {
  key: 0,
  class: "dsg-table-actions__menu-wrapper"
}, It = ["href", "target", "onClick"], qt = ["textContent"], Vt = { key: 0 }, zt = { key: 1 }, Ot = ["href", "target", "onClick"], Wt = { class: "flex-1" }, Ke = /* @__PURE__ */ X({
  __name: "DsgTableActions",
  props: {
    placement: { default: "auto" },
    data: { default: () => {
    } }
  },
  emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked"],
  setup(e, { emit: F }) {
    const g = P(!1);
    Ie("dsgTableActions");
    const r = z(() => e.data?.rowData ?? null), $ = z(() => r.value?.actions ?? null), L = z(() => r.value?.links ?? null), b = (C) => {
      switch (C) {
        case "edit":
          return "edit-05";
        case "view":
          return "eye";
        case "delete":
          return "trash-01";
        case "archive":
          return "eye-off";
        default:
          return "dots-horizontal";
      }
    }, v = (C, h, a) => {
      switch (h) {
        case "edit":
          x("dsg-table:action-edit", a, r.value);
          break;
        case "view":
          x("dsg-table:action-view", a, r.value);
          break;
        case "delete":
          x("dsg-table:action-delete", a, r.value);
          break;
        case "archive":
          x("dsg-table:action-archive", a, r.value);
          break;
      }
    }, H = (C, h) => {
      const a = C.actionId || C.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
      x("dsg-table:link-clicked", h, a, r.value);
    }, x = F;
    return (C, h) => De((s(), d("div", Ht, [
      q(Y(kt), {
        triggers: [],
        placement: e.placement,
        "handle-resize": !0,
        strategy: "absolute",
        shown: g.value,
        class: "dsg-table-actions__popper",
        onHide: h[1] || (h[1] = (a) => g.value = !1),
        ref: "floatingVueFilterDropdown"
      }, {
        popper: ne(() => [
          g.value ? (s(), d("div", At, [
            (s(!0), d(I, null, Q($.value, (a, T) => (s(), d(I, null, [
              ["edit", "view", "delete", "archive"].includes(String(T)) ? (s(), d("a", {
                key: T,
                href: a?.link,
                target: a?.target || "_self",
                onClick: (R) => v(a, String(T), R)
              }, [
                k("div", {
                  class: B(["dsg-table-actions__menu-item", `dsg-table-actions__menu-item--${String(T)}`])
                }, [
                  q(W, {
                    icon: b(String(T)),
                    size: "sm"
                  }, null, 8, ["icon"]),
                  k("span", {
                    class: "dsg-table-actions__menu-item-id",
                    textContent: re(Y(St)(String(T)))
                  }, null, 8, qt)
                ], 2)
              ], 8, It)) : m("", !0)
            ], 64))), 256)),
            $.value && L.value ? (s(), d("hr", Vt)) : m("", !0),
            L.value ? (s(!0), d(I, { key: 1 }, Q(L.value, (a) => (s(), d(I, {
              key: a.label
            }, [
              a.hasOwnProperty("component") ? (s(), N(ct(a.component), {
                key: 0,
                quote: r.value,
                "row-data": r.value
              }, null, 8, ["quote", "row-data"])) : a.hasOwnProperty("type") && a.type == "break" ? (s(), d("hr", zt)) : (s(), d("a", {
                key: 2,
                href: a.link,
                target: a.target || "_self",
                class: B(["dsg-table-actions__menu-item", a.class]),
                onClick: (T) => H(a, T)
              }, [
                a.icon ? (s(), N(W, {
                  key: 0,
                  icon: a.icon,
                  size: "sm"
                }, null, 8, ["icon"])) : m("", !0),
                k("span", Wt, re(a.label), 1)
              ], 10, Ot))
            ], 64))), 128)) : m("", !0)
          ])) : m("", !0)
        ]),
        default: ne(() => [
          k("div", Ut, [
            k("button", {
              type: "button",
              class: "dsg-table-actions__button",
              "aria-expanded": "false",
              "aria-haspopup": "true",
              onClick: h[0] || (h[0] = (a) => g.value = !g.value)
            }, [
              M(C.$slots, "dsg-table-action-button-content", {}, () => [
                q(W, {
                  icon: "dots-vertical",
                  size: "sm"
                })
              ])
            ])
          ])
        ]),
        _: 3
      }, 8, ["placement", "shown"])
    ])), [
      [Y(pt), () => g.value = !1]
    ]);
  }
}), Nt = { class: "dsg-table-search" }, je = /* @__PURE__ */ X({
  __name: "DsgTableSearch",
  props: {
    name: {},
    id: {},
    placeholder: { default: "Search" },
    disabled: { type: Boolean, default: !1 },
    required: { type: Boolean, default: !1 },
    readonly: { type: Boolean, default: !1 },
    hidden: { type: Boolean, default: !1 },
    extraClasses: {},
    eventName: {},
    replaceState: { type: Boolean, default: !0 }
  },
  emits: ["dsg-table:term-changed"],
  setup(e, { emit: F }) {
    const g = P("");
    qe(() => {
      const b = new URL(window.location.href).searchParams.get("term");
      b && (g.value = b, r("dsg-table:term-changed", b));
    });
    const r = F, $ = Dt((L) => {
      if (g.value = L, e.replaceState) {
        const b = new URL(window.location.href);
        g.value ? b.searchParams.set("term", g.value) : b.searchParams.delete("term"), window.history.pushState({}, "", b.toString());
      }
      r("dsg-table:term-changed", g.value);
    }, 300);
    return (L, b) => (s(), d("div", Nt, [
      q(Pt, {
        modelValue: g.value,
        "onUpdate:modelValue": b[0] || (b[0] = (v) => g.value = v),
        name: e.name,
        id: e.id || e.name,
        placeholder: e.placeholder,
        disabled: e.disabled,
        required: e.required,
        readonly: e.readonly,
        hidden: e.hidden,
        "has-clear-button": !0,
        autocomplete: "off",
        size: "sm",
        icon: "search-sm",
        "icon-clickable": !0,
        onIconClicked: b[1] || (b[1] = (v) => Y($)(v)),
        onEnterPressed: b[2] || (b[2] = (v) => Y($)(v)),
        onOnClear: b[3] || (b[3] = () => Y($)(""))
      }, null, 8, ["modelValue", "name", "id", "placeholder", "disabled", "required", "readonly", "hidden"])
    ]));
  }
}), Kt = { class: "dsg-table-row-header" }, jt = {
  key: 0,
  class: "dsg-table-row-header__row dsg-table-row-header__row--checkbox",
  scope: "col"
}, Qt = {
  key: 1,
  class: "dsg-table-row-header__row dsg-table-row-header__row--expand-detail",
  scope: "col"
}, Yt = ["title", "id", "onClick"], Gt = {
  key: 0,
  class: "dsg-table-row-header__sort-icon"
}, Jt = ["innerHTML"], Xt = ["innerHTML"], Zt = ["innerHTML"], _t = ["innerHTML"], Qe = /* @__PURE__ */ X({
  __name: "DsgTableRowHeader",
  props: /* @__PURE__ */ le({
    fields: {},
    scrollVisible: { type: Boolean },
    hasSelectAll: { type: Boolean, default: !1 },
    showExpandDetail: { type: Boolean, default: !0 },
    tableDataLength: { default: 0 }
  }, {
    sortField: { default: null },
    sortFieldModifiers: {},
    selectedRows: { default: [] },
    selectedRowsModifiers: {},
    hasSelected: { type: Boolean, default: !1 },
    hasSelectedModifiers: {}
  }),
  emits: /* @__PURE__ */ le(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
  setup(e, { emit: F }) {
    const g = ae(e, "sortField"), r = ae(e, "selectedRows"), $ = ae(e, "hasSelected"), L = P("17px"), b = (C) => {
      $.value && r.value.length > 0 && r.value.length !== e.tableDataLength ? ($.value = !0, v("dsg-table:on-select-all")) : !$.value && r.value.length === 0 ? ($.value = !1, v("dsg-table:on-select-all")) : v("dsg-table:on-deselect-all");
    }, v = F, H = (C, h) => [
      C,
      C + "-" + Ct(String(h?.name)),
      h.titleClass || "",
      { "dsg-table-row-header__row--sortable": h.sortable },
      { "dsg-table-row-header__row--sort-active": g.value?.name === h.name }
    ], x = (C) => {
      C.sortable && (g.value = {
        name: String(C?.name),
        field: String(C?.sortField),
        direction: g.value?.name === C.name && g.value?.direction === "asc" ? "desc" : "asc"
      }, v("dsg-table:sort-field", C));
    };
    return (C, h) => (s(), d("tr", Kt, [
      e.hasSelectAll ? (s(), d("th", jt, [
        q(Ve, {
          modelValue: $.value,
          "onUpdate:modelValue": [
            h[0] || (h[0] = (a) => $.value = a),
            b
          ],
          indeterminate: r.value.length > 0 && r.value.length !== e.tableDataLength
        }, null, 8, ["modelValue", "indeterminate"])
      ])) : m("", !0),
      e.showExpandDetail ? (s(), d("th", Qt)) : m("", !0),
      (s(!0), d(I, null, Q(e.fields, (a, T) => (s(), d(I, null, [
        a?.visible ? (s(), d("th", {
          key: T,
          class: B(H("dsg-table-row-header__row", a)),
          style: te([{ width: a.width || void 0 }, a.style]),
          title: a.title + (a.sortable ? " Sort" : ""),
          id: "_" + a.name,
          onClick: (R) => x(a),
          scope: "col"
        }, [
          a.sortable ? (s(), d("div", Gt, [
            a.tooltip ? (s(), N(He, Pe({
              key: 0,
              ref_for: !0
            }, a.tooltip, { class: "dsg-table-row-header__tooltip" }), {
              "dsg-tooltip--trigger": ne(() => [
                a.title ? (s(), d("span", {
                  key: 0,
                  class: "dsg-table-row-header__title",
                  innerHTML: a.title
                }, null, 8, Jt)) : m("", !0),
                a.tooltip.icon ? (s(), N(W, {
                  key: 1,
                  icon: a.tooltip.icon,
                  class: "inline-flex",
                  size: "xs"
                }, null, 8, ["icon"])) : m("", !0)
              ]),
              _: 2
            }, 1040)) : a.title ? (s(), d("span", {
              key: 1,
              class: "dsg-table-row-header__title",
              innerHTML: a.title
            }, null, 8, Xt)) : m("", !0),
            a.sortable && g.value?.name !== a.name ? (s(), N(W, {
              key: 2,
              icon: "chevron-selector-vertical",
              class: "inline-flex",
              size: "xs"
            })) : m("", !0),
            a.sortable && g.value?.name === a.name && g.value?.direction === "asc" ? (s(), N(W, {
              key: 3,
              icon: "chevron-down",
              class: "inline-flex",
              size: "xs"
            })) : m("", !0),
            a.sortable && g.value?.name === a.name && g.value?.direction === "desc" ? (s(), N(W, {
              key: 4,
              icon: "chevron-up",
              class: "inline-flex",
              size: "xs"
            })) : m("", !0)
          ])) : (s(), d(I, { key: 1 }, [
            a.tooltip ? (s(), N(He, Pe({
              key: 0,
              ref_for: !0
            }, a.tooltip, { class: "dsg-table-row-header__tooltip" }), {
              "dsg-tooltip--trigger": ne(() => [
                k("span", {
                  class: "dsg-table-row-header__title",
                  innerHTML: Y(Ae)(String(a?.title))
                }, null, 8, Zt),
                a.tooltip.icon ? (s(), N(W, {
                  key: 0,
                  icon: a.tooltip.icon,
                  class: "inline-flex",
                  size: "xs"
                }, null, 8, ["icon"])) : m("", !0)
              ]),
              _: 2
            }, 1040)) : (s(), d("span", {
              key: 1,
              class: "dsg-table-row-header__title",
              innerHTML: Y(Ae)(String(a?.title))
            }, null, 8, _t))
          ], 64))
        ], 14, Yt)) : m("", !0)
      ], 64))), 256)),
      e.scrollVisible ? (s(), d("th", {
        key: 2,
        style: te({ width: L.value }),
        class: "dsg-table-row-header__col-gutter"
      }, null, 4)) : m("", !0)
    ]));
  }
}), ea = ["span"], ta = {
  key: 0,
  class: "dsg-table-component__loading"
}, aa = ["colspan"], la = ["colspan"], na = ["onClick", "onDblclick", "onMouseover", "onMouseenter"], sa = ["onClickCapture"], oa = {
  key: 1,
  class: "dsg-table-component__cell dsg-table-component__cell--expand"
}, ia = ["aria-expanded", "onClick"], da = ["onClick", "onDblclick", "onContextmenu"], ra = ["innerHTML"], ua = ["onClick"], ca = ["colspan"], ga = { key: 2 }, va = ["colspan"], fa = { class: "dsg-table-component__footer" }, ba = /* @__PURE__ */ X({
  __name: "DsgTableComponent",
  props: /* @__PURE__ */ le({
    fields: { default: () => [] },
    isDraggable: { type: Boolean, default: !1 },
    dragApi: { default: "" },
    loadOnStart: { type: Boolean, default: !0 },
    apiUrl: { default: "" },
    httpMethod: { default: "get" },
    reactiveApiUrl: { type: Boolean, default: !0 },
    apiMode: { type: Boolean, default: !0 },
    data: { default: null },
    dataManager: { type: [Function, null], default: null },
    dataPath: { default: "data" },
    tableLayout: { default: "fixed" },
    paginationPath: { default: "links.pagination" },
    queryParams: { default: () => ({
      sort: "sort",
      order: "order",
      page: "page",
      perPage: "per_page"
    }) },
    httpOptions: { default: () => ({}) },
    hasDetailRow: { type: Boolean, default: !1 },
    showExpandDetail: { type: Boolean, default: !0 },
    expandableRows: { type: Boolean, default: !1 },
    expandMultiple: { type: Boolean, default: !1 },
    initialPage: { default: 1 },
    firstPage: { default: 1 },
    sortOrder: { default: () => [] },
    multiSort: { type: Boolean },
    tableHeight: { default: null },
    multiSortKey: {},
    rowClass: { type: [String, Function], default: "" },
    detailRowComponent: {},
    detailRowTransition: { default: "fade" },
    detailRowClass: { type: [String, Function] },
    detailRowOptions: { default: () => ({}) },
    trackBy: { default: "id" },
    css: { default: () => ({
      tableWrapper: "dsg-table-wrapper",
      thead: "dsg-table-thead",
      tbody: "dsg-table-tbody",
      table: "dsg-table-component"
    }) },
    minRows: { default: 0 },
    noDataTemplate: { default: "No Data Available" },
    showSortIcons: { type: Boolean },
    headerRows: {},
    transform: { type: [Function, null], default: null },
    sortParams: { type: [Function, null], default: null },
    fieldPrefix: {},
    eventPrefix: {},
    selectable: { type: Boolean, default: !1 },
    shiftSelectHighlight: { default: () => {
    } },
    selectedRowHighlight: { default: () => {
    } },
    replaceState: { type: Boolean, default: !0 },
    replaceStrategy: { default: "window" }
  }, {
    filterParams: { default: {} },
    filterParamsModifiers: {},
    perPage: { default: 20 },
    perPageModifiers: {}
  }),
  emits: /* @__PURE__ */ le(["dsg-table:loading", "dsg-table:loaded", "dsg-table:load-success", "dsg-table:load-error", "dsg-table:pagination-data", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:row-expanded", "dsg-table:row-collapsed"], ["update:filterParams", "update:perPage"]),
  setup(e, { expose: F, emit: g }) {
    const r = (t) => t.map((l, n) => ({
      field: l.field || "",
      title: l.title || "",
      name: l.name || "",
      titleClass: l.titleClass || "",
      dataClass: l.dataClass || "",
      visible: l.visible ?? !0,
      width: l.width || void 0,
      sortField: l.sortField || null,
      sortable: l.sortField,
      formatter: l.formatter || null,
      tooltip: l.tooltip ?? null,
      $_index: n
    })), $ = () => {
      if (!e.apiMode) return null;
      const l = ze().find((n) => n.key === e.queryParams.sort);
      if (l && l.value.length > 0) {
        const n = l.value[0], f = n.startsWith("-"), c = f ? n.substring(1) : n, S = e.fields.find((K) => K.sortField === c || K.name === c || K.field === c);
        return S ? {
          name: String(S.name || S.field),
          field: c,
          direction: f ? "desc" : "asc"
        } : {
          name: c,
          field: c,
          direction: f ? "desc" : "asc"
        };
      }
      return null;
    }, L = () => {
      if (!(!e.apiMode || !e.replaceState) && e.replaceStrategy === "window") {
        const t = new URL(window.location.href), l = new URLSearchParams(t.search);
        if (l.delete(e.queryParams.sort), y.value) {
          const f = (y.value.direction === "desc" ? "-" : "") + y.value.field;
          l.set(e.queryParams.sort, f);
        }
        const n = `${t.pathname}${l.toString() ? "?" + l.toString() : ""}`;
        window.history.pushState({}, "", n);
      }
    }, b = P(r(e.fields)), v = P(e.data), H = P(null), x = P(e.initialPage), C = P("17px"), h = P(!1), a = P({}), T = P(0), R = P(!0), y = P($()), p = P(null), V = P(0), se = ae(e, "filterParams"), ue = ae(e, "perPage"), E = P([]), ie = P(!1), O = P(/* @__PURE__ */ new Set()), A = P(null), j = P(null), G = P(!1), Z = z(() => e.tableHeight != null), _ = z(() => {
      let t = b.value.filter((l) => l.visible).length;
      return e.selectable && t++, e.hasDetailRow && e.expandableRows && t++, t;
    }), fe = z(() => {
      const t = {};
      return e.shiftSelectHighlight && (t["--dsg-shift-select-bg"] = e.shiftSelectHighlight), e.selectedRowHighlight && (t["--dsg-selected-row-bg"] = e.selectedRowHighlight), Object.keys(t).length > 0 ? t : void 0;
    }), be = (t, l) => {
      const n = t?.[e.trackBy];
      return n ?? l;
    };
    oe(
      () => E.value.length,
      (t) => {
        ie.value = e.selectable && t > 0;
      },
      { immediate: !0 }
    ), oe(
      () => e.fields,
      (t) => {
        b.value = r(t);
      },
      { immediate: !0, deep: !0 }
    ), oe(
      () => se.value,
      (t) => {
        ee();
      },
      { deep: !0 }
    ), oe(
      () => ue.value,
      () => {
        ee();
      }
    ), oe(
      () => e.apiUrl,
      (t, l) => {
        e.apiMode && t !== l && t && ee();
      }
    ), oe(
      () => y.value,
      () => {
        L();
      },
      { deep: !0 }
    );
    const U = g, he = (t, l) => t.formatter && typeof t.formatter == "function" ? t.formatter(t, l) : pe(l, String(t?.name), ""), we = (t) => "dsg-field--" + t.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), me = (t, l) => {
      const n = {
        odd: l % 2 === 0,
        even: l % 2 !== 0,
        "dsg-table-component__row--selected": t.selected
      };
      if (!e.rowClass)
        return n;
      let f = {};
      if (typeof e.rowClass == "function") {
        const c = e.rowClass(t, l);
        typeof c == "string" ? c.split(" ").forEach((S) => {
          S.trim() && (f[S.trim()] = !0);
        }) : Array.isArray(c) ? c.forEach((S) => {
          typeof S == "string" && S.trim() && (f[S.trim()] = !0);
        }) : typeof c == "object" && c !== null && (f = c);
      } else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((c) => {
        c.trim() && (f[c.trim()] = !0);
      });
      return { ...n, ...f };
    }, J = (t) => O.value.has(t[e.trackBy]), ce = (t, l) => {
      const n = t[e.trackBy];
      O.value.has(n) ? (O.value.delete(n), U("dsg-table:row-collapsed", t, l)) : (e.expandMultiple || O.value.clear(), O.value.add(n), U("dsg-table:row-expanded", t, l));
    }, ge = (t) => {
      const l = t[e.trackBy];
      O.value.has(l) || (e.expandMultiple || O.value.clear(), O.value.add(l));
    }, ye = (t) => {
      O.value.delete(t[e.trackBy]);
    }, o = () => {
      v.value?.forEach((t) => {
        O.value.add(t[e.trackBy]);
      });
    }, i = () => {
      O.value.clear();
    }, u = () => O.value, w = (t, l) => {
      if (e.selectable) {
        if (l !== void 0 && (A.value = l), t.selected)
          E.value.push(t);
        else {
          const n = E.value.findIndex((f) => f[e.trackBy] === t[e.trackBy]);
          n !== -1 && E.value.splice(n, 1);
        }
        U("dsg-table:rows-selected", E.value);
      }
    }, D = (t, l, n) => {
      if (e.selectable && t.shiftKey && A.value !== null) {
        t.stopPropagation(), t.preventDefault();
        const f = Math.min(A.value, n), c = Math.max(A.value, n), S = !l.selected;
        for (let K = f; K <= c; K++) {
          if (K === A.value) continue;
          const de = v.value?.[K];
          if (de) {
            const Be = de.selected;
            if (de.selected = S, S && !Be)
              E.value.push(de);
            else if (!S && Be) {
              const Fe = E.value.findIndex((rt) => rt[e.trackBy] === de[e.trackBy]);
              Fe !== -1 && E.value.splice(Fe, 1);
            }
          }
        }
        A.value = n, j.value = null, U("dsg-table:rows-selected", E.value);
      }
    }, ke = () => {
      e.selectable && (v.value?.forEach((t) => {
        t.selected = !0;
      }), E.value = v.value?.filter((t) => t.selected) ?? [], A.value = null, U("dsg-table:rows-selected", E.value));
    }, Ye = () => {
      e.selectable && (v.value?.forEach((t) => {
        t.selected = !1;
      }), E.value = [], A.value = null, U("dsg-table:rows-selected", E.value));
    }, ve = (t) => {
      v.value = Array.isArray(t) ? t : [], e.selectable && (A.value = null, v.value.forEach((l) => {
        l.selected = l.selected ?? !1;
      }));
    }, Ge = () => v.value ?? [], Je = (t) => {
      t === "prev" ? x.value > e.firstPage && x.value-- : t === "next" ? x.value < (H.value?.last_page ?? 0) && x.value++ : t != x.value && t >= e.firstPage && t <= (H.value?.last_page ?? 0) && (x.value = t), ee();
    }, Xe = () => ({
      [e.queryParams?.sort]: y.value ? (y.value?.direction === "desc" ? "-" : "") + y.value?.field : void 0,
      [e.queryParams?.order]: y.value?.direction,
      [e.queryParams?.page]: x.value,
      [e.queryParams?.perPage]: ue.value
    }), Se = () => {
      p.value && (p.value.abort(), p.value = null);
    }, Ze = (t, l) => {
      Se(), V.value++;
      const n = V.value, f = new AbortController();
      return l.signal = f.signal, p.value = f, (e.httpMethod.toLowerCase() === "get" ? Ue.get(t, l) : (() => {
        const S = l.params;
        return delete l.params, Ue.post(t, S, l);
      })()).then(
        (S) => ({ ...S, _requestId: n, _apiUrl: t }),
        (S) => {
          throw S.name === "AbortError" || S.code === "ERR_CANCELED" ? { ...S, _requestId: n, _cancelled: !0 } : { ...S, _requestId: n };
        }
      );
    }, Ce = (t) => {
      if (t._requestId && t._requestId !== V.value || t._apiUrl && t._apiUrl !== e.apiUrl)
        return;
      U("dsg-table:load-success", t);
      const l = e.transform ? e.transform(t.data) : t.data;
      v.value = pe(l, e.dataPath, null), e.selectable && (A.value = null, v.value?.forEach((n) => {
        n.selected = n.selected ?? !1;
      })), H.value = pe(l, e.paginationPath, null) ?? null, T.value = v.value?.length ? v.value[0].order : T, !xt(e.paginationPath) && H.value === null && console.warn(
        'DsgTable: pagination-path "' + e.paginationPath + `" not found. It looks like the data returned from the server does not have pagination information or you may have set it incorrectly.
You can explicitly suppress this warning by setting pagination-path="".`
      ), p.value = null, U("dsg-table:pagination-data", H.value), H.value && x.value > (H.value?.last_page || 0) && v.value?.length === 0 && (x.value = e.initialPage, ee()), U("dsg-table:loaded"), R.value = !1;
    }, xe = (t) => {
      t._requestId && t._requestId !== V.value || t._apiUrl && t._apiUrl !== e.apiUrl || t._cancelled || (console.error("load-error", t), p.value = null, U("dsg-table:load-error", t), U("dsg-table:loaded"), R.value = !1);
    }, $e = () => {
      if (e.data !== null && Array.isArray(e.data)) {
        ve(e.data), R.value = !1;
        return;
      }
      if (e.dataManager && typeof e.dataManager == "function") {
        const t = e.dataManager();
        ve(t), R.value = !1;
      } else
        ve(e.data), R.value = !1;
    }, ee = (t = Ce, l = xe, n = {}) => {
      const f = t || Ce, c = l || xe;
      if (!e.apiMode) {
        $e();
        return;
      }
      return R.value = !0, U("dsg-table:loading", R.value), e.httpOptions.params = {
        ...Xe(),
        ...se.value
      }, Ze(e.apiUrl, e.httpOptions).then(f).catch((S) => c(S));
    }, _e = (t, l, n) => {
      U("dsg-table:row-clicked", t, l, n);
    }, et = (t, l, n) => {
      U("dsg-table:row-dblclick", t, l, n);
    }, tt = (t, l, n) => {
    }, at = (t, l, n, f) => {
    }, lt = (t, l, n, f) => {
    }, nt = (t, l, n, f) => {
    }, st = (t, l, n) => {
    }, Te = (t) => {
      t.key === "Shift" && (G.value = !0);
    }, Re = (t) => {
      t.key === "Shift" && (G.value = !1, j.value = null);
    }, Me = () => {
      G.value = !1, j.value = null;
    }, ot = (t) => {
      e.selectable && G.value && A.value !== null && (j.value = t);
    }, it = () => {
      j.value = null;
    }, dt = (t) => {
      if (!e.selectable || !G.value || A.value === null || j.value === null)
        return !1;
      const l = Math.min(A.value, j.value), n = Math.max(A.value, j.value);
      return t >= l && t <= n;
    };
    qe(() => {
      e.apiMode === !0 ? ee() : $e(), e.selectable && (document.addEventListener("keydown", Te), document.addEventListener("keyup", Re), window.addEventListener("blur", Me));
    }), gt(() => {
      e.selectable && (document.removeEventListener("keydown", Te), document.removeEventListener("keyup", Re), window.removeEventListener("blur", Me));
    });
    const Ee = () => {
      e.apiMode && (E.value = [], Se(), ee());
    };
    return F({
      changePage: Je,
      reload: Ee,
      getData: Ge,
      setData: ve,
      setLoading: (t) => {
        R.value = t, U("dsg-table:loading", R.value);
      },
      expandRow: ge,
      collapseRow: ye,
      toggleRowExpand: ce,
      expandAllRows: o,
      collapseAllRows: i,
      getExpandedRows: u,
      isRowExpanded: J
    }), (t, l) => (s(), d("div", {
      class: B(["dsg-table-component", { "dsg-table-component--shift-active": e.selectable && G.value }]),
      style: te(fe.value)
    }, [
      k("div", {
        ref: "dsgTableBodyWrapper",
        class: B(["dsg-table-component__body-wrapper", { "dsg-table-component__body-wrapper--fixed-header": Z.value }]),
        style: te({ height: e.tableHeight || void 0 })
      }, [
        k("table", {
          class: B([
            "dsg-table-component__main",
            Z.value ? "dsg-table-component__main--fixed-header" : "",
            "dsg-table-component__main--" + e.tableLayout,
            a.value.table
          ])
        }, [
          k("colgroup", { span: _.value }, [
            (s(!0), d(I, null, Q(b.value, (n, f) => (s(), d(I, null, [
              n?.visible ? (s(), d("col", {
                key: f,
                style: te({ width: n.width || void 0 }),
                class: B("dsg-table-component__col-" + n.name + " " + n.titleClass)
              }, null, 6)) : m("", !0)
            ], 64))), 256)),
            !Z.value && h.value ? (s(), d("col", {
              key: 0,
              style: te({ width: C.value }),
              class: "dsg-table-component__col-gutter"
            }, null, 4)) : m("", !0)
          ], 8, ea),
          k("thead", {
            class: B([[a.value.thead, { sticky: Z.value, "top-0": Z.value }], "dsg-table-component__head"])
          }, [
            M(t.$slots, "tableHeader", { fields: b.value }, () => [
              q(Qe, {
                fields: b.value,
                "has-select-all": e.selectable,
                "selected-rows": E.value,
                "onUpdate:selectedRows": l[0] || (l[0] = (n) => E.value = n),
                "has-selected": ie.value,
                "onUpdate:hasSelected": l[1] || (l[1] = (n) => ie.value = n),
                "scroll-visible": h.value,
                "show-expand-detail": e.hasDetailRow && e.showExpandDetail,
                "table-data-length": v.value?.length,
                "sort-field": y.value,
                "onUpdate:sortField": l[2] || (l[2] = (n) => y.value = n),
                "onDsgTable:sortField": l[3] || (l[3] = (n) => Ee()),
                "onDsgTable:onSelectAll": ke,
                "onDsgTable:onDeselectAll": Ye
              }, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
            ])
          ], 2),
          k("tbody", {
            class: B(["dsg-table-component__body", a.value.tbody])
          }, [
            R.value ? (s(), d("tr", ta, [
              k("td", { colspan: _.value }, [
                k("div", {
                  "aria-label": "Loading...",
                  role: "status",
                  class: "flex items-center space-x-3 h-12 w-full justify-center",
                  colspan: _.value
                }, [
                  M(t.$slots, "dsg-table-loading", {}, () => [
                    q(W, {
                      icon: "loading-02",
                      class: "animate-spin"
                    }),
                    l[5] || (l[5] = k("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
                  ])
                ], 8, la)
              ], 8, aa)
            ])) : (s(!0), d(I, { key: 1 }, Q(v.value, (n, f) => (s(), d(I, {
              key: be(n, f)
            }, [
              k("tr", {
                class: B(["dsg-table-component__row", [me(n, f), { "dsg-table-component__row--shift-range": e.selectable && dt(f) }]]),
                onClick: (c) => _e(c, f, n),
                onDblclick: (c) => et(c, f, n),
                onMouseover: (c) => tt(),
                onMouseenter: (c) => ot(f),
                onMouseleave: l[4] || (l[4] = (c) => it())
              }, [
                e.selectable ? (s(), d("td", {
                  key: 0,
                  class: "dsg-table-component__cell dsg-table-component__cell--checkbox",
                  onClickCapture: (c) => D(c, n, f)
                }, [
                  q(Ve, {
                    modelValue: n.selected,
                    "onUpdate:modelValue": [(c) => n.selected = c, (c) => w(n, f)]
                  }, null, 8, ["modelValue", "onUpdate:modelValue"])
                ], 40, sa)) : m("", !0),
                e.hasDetailRow && e.expandableRows ? (s(), d("td", oa, [
                  k("button", {
                    type: "button",
                    class: B(["dsg-table-component__expand-toggle", { "dsg-table-component__expand-toggle--expanded": J(n) }]),
                    "aria-expanded": J(n),
                    "aria-label": "Toggle row details",
                    onClick: vt((c) => ce(n, f), ["stop"])
                  }, [
                    q(W, {
                      icon: "chevron-right",
                      size: "sm",
                      class: "dsg-table-component__expand-icon"
                    })
                  ], 10, ia)
                ])) : m("", !0),
                (s(!0), d(I, null, Q(b.value, (c, S) => (s(), d(I, { key: S }, [
                  c.visible ? (s(), d("td", {
                    key: 0,
                    class: B(["dsg-table-component__cell", c.dataClass]),
                    style: te({ width: c.width || void 0 }),
                    onClick: (K) => at(),
                    onDblclick: (K) => lt(),
                    onContextmenu: (K) => nt()
                  }, [
                    M(t.$slots, we(c), {
                      rowData: n,
                      rowIndex: f,
                      rowField: c
                    }, () => [
                      k("span", {
                        innerHTML: he(c, n)
                      }, null, 8, ra)
                    ])
                  ], 46, da)) : m("", !0)
                ], 64))), 128))
              ], 42, na),
              e.hasDetailRow && (!e.expandableRows || J(n)) ? (s(), N(ft, {
                key: 0,
                name: e.detailRowTransition
              }, {
                default: ne(() => [
                  k("tr", {
                    class: B(["dsg-table-component__detail", { "dsg-table-component__detail--expanded": e.expandableRows && J(n) }]),
                    onClick: (c) => st()
                  }, [
                    k("td", { colspan: _.value }, [
                      M(t.$slots, "dsg-table-detail-row", {
                        rowData: n,
                        rowIndex: f,
                        options: e.detailRowOptions,
                        isExpanded: e.expandableRows ? J(n) : !0
                      })
                    ], 8, ca)
                  ], 10, ua)
                ]),
                _: 2
              }, 1032, ["name"])) : m("", !0)
            ], 64))), 128)),
            !R.value && !v.value?.length && e.noDataTemplate.length ? (s(), d("tr", ga, [
              k("td", {
                colspan: _.value,
                class: "dsg-table-component__empty-result"
              }, [
                M(t.$slots, "dsg-table-empty-result", {}, () => [
                  bt(re(e.noDataTemplate), 1)
                ])
              ], 8, va)
            ])) : m("", !0)
          ], 2),
          k("tfoot", fa, [
            M(t.$slots, "dsg-table-footer", {
              fields: b.value,
              data: v.value
            })
          ])
        ], 2)
      ], 6)
    ], 6));
  }
}), ha = { class: "dsg-table" }, wa = {
  key: 0,
  class: "dsg-table__pre-header"
}, ma = { class: "dsg-table--pre-header-left" }, ya = ["textContent"], ka = { class: "dsg-table__pre-header-right" }, pa = {
  key: 1,
  class: "dsg-table__search-header",
  ref: "dsgTableSearchHeaderEl"
}, Pa = { class: "dsg-table__search-top" }, Da = {
  key: 2,
  class: "dsg-table__footer",
  ref: "dsgTableFooterEl"
}, Sa = { class: "dsg-table__footer-left" }, Ca = { class: "dsg-table__footer-center" }, xa = { class: "dsg-table__footer-right" }, $a = /* @__PURE__ */ X({
  __name: "DsgTable",
  props: {
    getUrl: {},
    fields: {},
    loadOnStart: { type: Boolean, default: !0 },
    displaySearch: { type: Boolean, default: !0 },
    displayPaginationInfo: { type: Boolean, default: !0 },
    reloadOnChangeTimer: { type: Boolean, default: !1 },
    selectable: { type: Boolean, default: !1 },
    shiftSelectHighlight: { default: () => {
    } },
    selectedRowHighlight: { default: () => {
    } },
    trackBy: { default: "id" },
    title: { default: "" },
    filters: { default: () => {
    } },
    initialFilters: { default: () => ({}) },
    filterEntity: { default: "" },
    filterEndpoint: { default: "" },
    filterSearchEndpoint: { default: "" },
    tableLayout: { default: "fixed" },
    autoSortFilters: { type: Boolean, default: !0 },
    data: { default: null },
    hasHeader: { type: Boolean, default: !0 },
    hasFooter: { type: Boolean, default: !0 },
    perPage: { default: 20 },
    paginationPath: { default: "meta" },
    css: { default: () => ({ tableWrapper: "border-b" }) },
    rowClass: { type: [String, Function], default: void 0 },
    apiMode: { type: Boolean, default: !0 },
    replaceState: { type: Boolean, default: !0 },
    replaceStrategy: { default: "window" },
    hasDetailRow: { type: Boolean, default: !1 },
    expandableRows: { type: Boolean, default: !1 },
    expandMultiple: { type: Boolean, default: !1 },
    showExpandDetail: { type: Boolean, default: !0 },
    detailRowTransition: { default: "fade" },
    detailRowOptions: { default: () => ({}) }
  },
  emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:filter-updated", "dsg-table:term-changed", "dsg-table:data-loaded", "dsg-table:row-expanded", "dsg-table:row-collapsed"],
  setup(e, { expose: F, emit: g }) {
    const r = (o) => {
      R.value = o;
    }, $ = P(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), L = () => {
      if ($.value) {
        let o = {};
        return ze().forEach((i) => {
          if (i.key.startsWith("filter[")) {
            const u = i.key.replace("filter[", "").replace("]", ""), w = i.value;
            o[`filter[${u}]`] = w.join(",");
          }
        }), o;
      } else
        return {};
    }, b = z(() => ({
      ...e.css,
      tableWrapper: "border-b " + (e.css?.tableWrapper || "")
    })), v = ht(), H = P(!0), x = P(null), C = P("<p>Showing {from} to {to} of {total}</p>"), h = P(null), a = Ie("dsgTable"), T = P({ perPage: e.perPage, change: r }), R = P(e.perPage), y = P({ ...L(), ...e.initialFilters }), p = g, V = (o) => {
      a.value?.changePage(o);
    }, se = (o) => {
      h.value = o;
    }, ue = ({ data: o }) => {
      x.value = o, p("dsg-table:data-loaded", o);
    }, E = () => {
      a.value?.reload();
    }, ie = (o) => {
      a.value?.setLoading(o);
    }, O = (o) => {
      const i = a.value?.getData?.() ?? [];
      a.value?.setData(i.map((u) => u.id === o.id ? o : u));
    }, A = (o) => {
      const i = a.value?.getData?.() ?? [];
      a.value?.setData([...i, o]);
    }, j = (o) => {
      const i = a.value?.getData?.() ?? [];
      a.value?.setData(i.filter((u) => u.id !== o.id));
    }, G = (o) => {
      a.value?.setData(o);
    }, Z = () => a.value?.getData() ?? [], _ = (o) => {
      const i = a.value?.getData() ?? [], u = o(i);
      u && a.value?.setData(u);
    }, fe = (o) => {
      a.value?.expandRow(o);
    }, be = (o) => {
      a.value?.collapseRow(o);
    }, U = (o, i) => {
      a.value?.toggleRowExpand(o, i);
    }, he = () => {
      a.value?.expandAllRows();
    }, we = () => {
      a.value?.collapseAllRows();
    }, me = () => a.value?.getExpandedRows() ?? /* @__PURE__ */ new Set(), J = (o) => {
      y.value = o;
    }, ce = () => y.value ?? {}, ge = (o) => {
      const i = { ...y.value };
      !o || o.trim() === "" ? delete i["filter[term]"] : i["filter[term]"] = o, y.value = i, Le(() => {
        E();
      }), p("dsg-table:term-changed", o);
    }, ye = (o, i, u) => {
      let w = {};
      y.value["filter[term]"] && (w["filter[term]"] = y.value["filter[term]"]), Object.keys(o).forEach((D) => {
        o[D] !== null && o[D] !== void 0 && o[D] !== "" && (w[D] = o[D]);
      }), y.value = w, Le(() => {
        E();
      }), p("dsg-table:filter-updated", y.value, i, u);
    };
    return F({
      reloadTable: E,
      updateRowTable: O,
      addRowTable: A,
      deleteRowTable: j,
      setData: G,
      getData: Z,
      mutateData: _,
      termChanged: ge,
      setFilters: J,
      getFilters: ce,
      setLoading: ie,
      expandRow: fe,
      collapseRow: be,
      toggleRowExpand: U,
      expandAllRows: he,
      collapseAllRows: we,
      getExpandedRows: me,
      changePage: V
    }), (o, i) => (s(), d("div", ha, [
      e.hasHeader ? (s(), d("div", wa, [
        M(o.$slots, "dsg-table--pre-header", {}, () => [
          k("div", ma, [
            M(o.$slots, "dsg-table--page-title", {
              data: x.value,
              title: e.title
            }, () => [
              e.title.length > 0 ? (s(), d("h1", {
                key: 0,
                class: "dsg-table__title",
                textContent: re(e.title)
              }, null, 8, ya)) : m("", !0)
            ])
          ]),
          k("div", ka, [
            M(o.$slots, "dsg-table--page-actions", { data: x.value })
          ])
        ])
      ])) : m("", !0),
      e.displaySearch ? (s(), d("div", pa, [
        k("div", Pa, [
          M(o.$slots, "dsg-table--search-header", { data: x.value }, () => [
            q(je, {
              name: "term",
              "onDsgTable:termChanged": i[0] || (i[0] = (u) => ge(u))
            }),
            q(Oe, {
              entity: e.filterEntity,
              "filter-endpoint": e.filterEndpoint,
              "search-endpoint": e.filterSearchEndpoint,
              "auto-sort": e.autoSortFilters,
              filters: e.filters,
              "onDsgTable:filterUpdated": i[1] || (i[1] = (u, w, D) => ye(u, w, D))
            }, null, 8, ["entity", "filter-endpoint", "search-endpoint", "auto-sort", "filters"]),
            M(o.$slots, "dsg-table--search-actions", { data: x.value })
          ])
        ]),
        M(o.$slots, "dsg-table--search-navigation")
      ], 512)) : m("", !0),
      q(ba, {
        ref: "dsgTable",
        "api-url": e.getUrl,
        "filter-params": y.value,
        "onUpdate:filterParams": i[7] || (i[7] = (u) => y.value = u),
        "per-page": R.value,
        "onUpdate:perPage": i[8] || (i[8] = (u) => R.value = u),
        fields: e.fields,
        "load-on-start": e.loadOnStart,
        "pagination-path": e.paginationPath,
        selectable: e.selectable,
        "shift-select-highlight": e.shiftSelectHighlight,
        "selected-row-highlight": e.selectedRowHighlight,
        "track-by": e.trackBy,
        "table-layout": e.tableLayout,
        css: b.value,
        data: e.data,
        "row-class": e.rowClass,
        "api-mode": $.value,
        "replace-state": e.replaceState,
        "replace-strategy": e.replaceStrategy,
        "has-detail-row": e.hasDetailRow,
        "expandable-rows": e.expandableRows,
        "expand-multiple": e.expandMultiple,
        "show-expand-detail": e.showExpandDetail,
        "detail-row-transition": e.detailRowTransition,
        "detail-row-options": e.detailRowOptions,
        "onDsgTable:loading": i[9] || (i[9] = (u) => H.value = !0),
        "onDsgTable:loaded": i[10] || (i[10] = (u) => H.value = !1),
        "onDsgTable:paginationData": se,
        "onDsgTable:loadSuccess": ue,
        "onDsgTable:rowsSelected": i[11] || (i[11] = (u) => p("dsg-table:rows-selected", u)),
        "onDsgTable:rowClicked": i[12] || (i[12] = (u, w, D) => p("dsg-table:row-clicked", u, w, D)),
        "onDsgTable:rowHover": i[13] || (i[13] = (u, w, D) => p("dsg-table:row-hover", u, w, D)),
        "onDsgTable:rowDblclick": i[14] || (i[14] = (u, w, D) => p("dsg-table:row-dblclick", u, w, D)),
        "onDsgTable:rowExpanded": i[15] || (i[15] = (u, w) => p("dsg-table:row-expanded", u, w)),
        "onDsgTable:rowCollapsed": i[16] || (i[16] = (u, w) => p("dsg-table:row-collapsed", u, w))
      }, wt({
        "dsg-field--actions": ne((u) => [
          M(o.$slots, "dsg-table-actions", { data: u }, () => [
            (s(), N(Ke, {
              key: u.rowData?.[e.trackBy] ?? u.rowIndex,
              data: u,
              "onDsgTable:actionEdit": i[2] || (i[2] = (w, D) => p("dsg-table:action-edit", w, D)),
              "onDsgTable:actionView": i[3] || (i[3] = (w, D) => p("dsg-table:action-view", w, D)),
              "onDsgTable:actionDelete": i[4] || (i[4] = (w, D) => p("dsg-table:action-delete", w, D)),
              "onDsgTable:actionArchive": i[5] || (i[5] = (w, D) => p("dsg-table:action-archive", w, D)),
              "onDsgTable:linkClicked": i[6] || (i[6] = (w, D, ke) => p("dsg-table:link-clicked", w, D, ke))
            }, null, 8, ["data"]))
          ])
        ]),
        _: 2
      }, [
        Q(Y(v), (u, w) => ({
          name: w,
          fn: ne((D) => [
            String(w) !== "dsg-field--actions" ? M(o.$slots, w, mt(Pe({ key: 0 }, D))) : m("", !0)
          ])
        }))
      ]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "pagination-path", "selectable", "shift-select-highlight", "selected-row-highlight", "track-by", "table-layout", "css", "data", "row-class", "api-mode", "replace-state", "replace-strategy", "has-detail-row", "expandable-rows", "expand-multiple", "show-expand-detail", "detail-row-transition", "detail-row-options"]),
      e.hasFooter ? (s(), d("div", Da, [
        k("div", Sa, [
          M(o.$slots, "dsg-table--footer-left", {
            data: h.value,
            perPage: T.value
          }, () => [
            e.displayPaginationInfo ? (s(), N(Ne, {
              key: 0,
              ref: "paginationInfoStart",
              pagination: h.value,
              "onUpdate:pagination": i[17] || (i[17] = (u) => h.value = u),
              "info-template": C.value
            }, null, 8, ["pagination", "info-template"])) : m("", !0),
            M(o.$slots, "dsg-table--footer-left-extras", {
              data: h.value,
              perPage: T.value
            })
          ])
        ]),
        k("div", Ca, [
          M(o.$slots, "dsg-table--footer-center", {
            data: h.value,
            perPage: T.value
          }, () => [
            M(o.$slots, "dsg-table--footer-center-extras", {
              data: h.value,
              perPage: T.value
            })
          ])
        ]),
        k("div", xa, [
          M(o.$slots, "dsg-table--footer-right", {
            data: h.value,
            perPage: T.value
          }, () => [
            H.value === !1 && e.displayPaginationInfo ? (s(), N(We, {
              key: 0,
              ref: "pagination",
              pagination: h.value,
              "onUpdate:pagination": i[18] || (i[18] = (u) => h.value = u),
              "onDsgTable:changePage": V
            }, null, 8, ["pagination"])) : m("", !0),
            M(o.$slots, "dsg-table--footer-right-extras", {
              data: h.value,
              perPage: T.value
            })
          ])
        ])
      ], 512)) : m("", !0)
    ]));
  }
}), Ta = { class: "dsg-table-per-page" }, Ra = ["value", "textContent"], Ma = /* @__PURE__ */ X({
  __name: "DsgTablePerPage",
  props: {
    perPageOptions: { default: () => [10, 20, 30, 50, 100] },
    perPage: {}
  },
  setup(e) {
    return (F, g) => (s(), d("div", Ta, [
      De(k("select", {
        "onUpdate:modelValue": g[0] || (g[0] = (r) => e.perPage.perPage = r),
        class: "dsg-table-per-page__select",
        onChange: g[1] || (g[1] = (r) => e.perPage.change(e.perPage.perPage))
      }, [
        (s(!0), d(I, null, Q(e.perPageOptions, (r) => (s(), d("option", {
          key: r,
          value: r,
          textContent: re(r)
        }, null, 8, Ra))), 128))
      ], 544), [
        [yt, e.perPage.perPage]
      ])
    ]));
  }
}), Ea = $a, Ba = Ke, Fa = Ma, La = Oe, Ha = We, Ua = Ne, Aa = je, Ia = Qe, Ka = {
  DsgTable: Ea,
  DsgTableActions: Ba,
  DsgTablePerPage: Fa,
  DsgTableFilter: La,
  DsgTablePagination: Ha,
  DsgTablePaginationInfo: Ua,
  DsgTableSearch: Aa,
  DsgTableRowHeader: Ia
};
export {
  Ea as DsgTable,
  Ba as DsgTableActions,
  La as DsgTableFilter,
  Ha as DsgTablePagination,
  Ua as DsgTablePaginationInfo,
  Fa as DsgTablePerPage,
  Ia as DsgTableRowHeader,
  Aa as DsgTableSearch,
  Ka as default
};
