import { _ as T, h as Je, i as Ke, j as Ge, f as L, I as Qe, s as R, k as K, V as Xe, l as Ye, m as Ze, n as et, A as G, o as tt, p as st, b as nt, q as at, r as lt, a as rt, t as ot, v as it, u as Ee } from "./import-file-r6B0-WFX.js";
import { createElementBlock as d, openBlock as r, createTextVNode as z, createElementVNode as a, toDisplayString as A, createCommentVNode as k, normalizeClass as w, resolveComponent as p, Fragment as $, createVNode as x, withCtx as P, createBlock as y, renderList as V, withModifiers as dt, Transition as Q, withDirectives as X, renderSlot as ut, vShow as Y, Teleport as ct, getCurrentInstance as Ue, ref as H, resolveDynamicComponent as J, defineComponent as ht, withKeys as pt, normalizeStyle as W } from "vue";
const bt = {
  data() {
    return {
      currentSort: ""
    };
  },
  props: {
    data: {
      type: Object,
      default: () => null
    },
    activeColumn: { type: String }
  },
  mounted() {
    this.$emit("update-ref", this.$refs.column);
  },
  computed: {
    label() {
      var e, t;
      return ((e = this.data) == null ? void 0 : e.ua) || ((t = this.data) == null ? void 0 : t.label) || this.data.title || "null";
    },
    selectedSortParam() {
      var e, t;
      return (t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.sort;
    },
    getVisibleIcon() {
      return this.data.format !== "image" && this.data.format !== "verify";
    }
  },
  watch: {
    activeColumn(e) {
      e !== this.data.name && (this.currentSort = "");
    }
  },
  methods: {
    changeCurrentSort(e) {
      switch (e) {
        case "":
          return "asc";
        case "asc":
          return "desc";
        case "desc":
          return "";
        default:
          return "";
      }
    },
    handleClickSortBtn(e) {
      this.$emit("change-active", this.data.name), this.currentSort = this.changeCurrentSort(e);
      const t = this.$route.query, { sort: n, ...o } = t, s = this.currentSort ? `${this.data.name}-${this.currentSort}` : "";
      this.$router.replace({
        query: {
          ...o,
          ...s && { sort: s }
        }
      });
    },
    isValueEqualToSelected(e) {
      return `${this.data.name}-${e}` === this.selectedSortParam;
    }
  }
}, ft = {
  scope: "col",
  class: "text-start",
  ref: "column"
}, gt = { class: "w-[24px]" }, mt = {
  key: 1,
  class: "flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1 dark:text-neutral-200"
};
function xt(e, t, n, o, s, l) {
  return r(), d("th", ft, [
    l.getVisibleIcon ? (r(), d("button", {
      key: 0,
      type: "button",
      class: "flex items-center px-1 py-2 font-medium text-gray-800 text-start gap-x-1 dark:text-neutral-200",
      onClick: t[0] || (t[0] = (h) => l.handleClickSortBtn(s.currentSort))
    }, [
      z(A(l.label) + " ", 1),
      a("span", gt, [
        s.currentSort ? (r(), d("svg", {
          key: 0,
          class: w(["shrink-0 size-3.5", { "rotate-180": s.currentSort === "asc" }]),
          xmlns: "http://www.w3.org/2000/svg",
          width: "24",
          height: "24",
          viewBox: "0 0 24 24",
          fill: "none",
          stroke: "currentColor",
          "stroke-width": "2",
          "stroke-linecap": "round",
          "stroke-linejoin": "round"
        }, [...t[1] || (t[1] = [
          a("path", { d: "m5 12 7-7 7 7" }, null, -1),
          a("path", { d: "M12 19V5" }, null, -1)
        ])], 2)) : k("", !0)
      ])
    ])) : (r(), d("p", mt, A(l.label), 1))
  ], 512);
}
const yt = /* @__PURE__ */ T(bt, [["render", xt]]), vt = {}, kt = {
  xmlns: "http://www.w3.org/2000/svg",
  width: "24",
  height: "24",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2",
  "stroke-linecap": "round",
  "stroke-linejoin": "round",
  class: "icon icon-tabler icons-tabler-outline icon-tabler-link"
};
function _t(e, t) {
  return r(), d("svg", kt, [...t[0] || (t[0] = [
    a("path", {
      stroke: "none",
      d: "M0 0h24v24H0z",
      fill: "none"
    }, null, -1),
    a("path", { d: "M9 15l6 -6" }, null, -1),
    a("path", { d: "M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" }, null, -1),
    a("path", { d: "M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" }, null, -1)
  ])]);
}
const Ct = /* @__PURE__ */ T(vt, [["render", _t]]), wt = {
  components: {
    IconMore: Ge,
    IconDelete: Ke,
    IconEdit: Je,
    IconLink: Ct
  },
  emits: ["updateTable"],
  props: {
    item: Object,
    table: String,
    isForm: null,
    actions: Array,
    default: () => []
  },
  data() {
    return {
      formVisible: !1,
      isDeleteConfirm: !1,
      formValue: {},
      top: 0,
      left: 0
    };
  },
  computed: {
    getCustomActions() {
      return this.actions.filter((e) => typeof e == "object");
    }
  },
  methods: {
    openConfirm() {
      this.isDeleteConfirm = !0, document.querySelector("body").click();
    },
    async getData() {
      var e;
      try {
        const { data: t } = await L.get(
          `/api/table/${this.table}/${(e = this.item) == null ? void 0 : e.id}`
        );
        this.formValue = t;
      } catch (t) {
        console.error(t);
      }
    },
    doSomethingOnCancel() {
      this.formVisible = !1;
    },
    async deleteElement() {
      var e, t;
      try {
        const { data: n } = await L.get(
          `/api/table/${this.table}/${(e = this.item) == null ? void 0 : e.id}`
        );
        await L.delete(`/api/table/${n == null ? void 0 : n.token}`), await this.$notify({
          title: "Успішно!",
          message: "Об`єкт успішно видалeно",
          type: "success"
        }), await this.$emit("update-table");
      } catch (n) {
        this.$notify({
          title: "Помилка!",
          message: (t = n == null ? void 0 : n.response) == null ? void 0 : t.data,
          type: "error"
        });
      } finally {
        this.isDeleteConfirm = !1;
      }
    },
    async customButtonAction(e) {
      var t, n, o;
      document.querySelector("body").click(), e != null && e.form ? (await this.$v3plugin.$form({
        form: e == null ? void 0 : e.form,
        id: (t = this.item) == null ? void 0 : t.id,
        api: e == null ? void 0 : e.api,
        title: e == null ? void 0 : e.title
      }), await this.$emit("update-table")) : e != null && e.api ? (await this.$v3plugin.$api({
        confirm: e == null ? void 0 : e.confirm,
        api: e == null ? void 0 : e.api,
        method: e == null ? void 0 : e.method,
        id: (n = this.item) == null ? void 0 : n.id,
        isId: (e == null ? void 0 : e.isId) || !1
      }), await this.$emit("update-table")) : e != null && e.href && this.$router.push((e == null ? void 0 : e.href) + ((o = this.item) == null ? void 0 : o.id));
    }
  }
}, $t = { class: "inline-flex" }, St = { class: "inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50" }, At = { class: "flex flex-col items-start" }, Tt = ["onClick"], It = { class: "text-gray-800" }, Dt = {
  key: 1,
  class: "h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"
}, Pt = { class: "flex justify-end p-[16px] pr-0 gap-x-3" };
function Vt(e, t, n, o, s, l) {
  const h = p("IconMore"), g = p("IconEdit"), b = p("router-link"), f = p("IconLink"), u = p("IconDelete"), v = p("VsPopover"), m = p("VsConfirm");
  return r(), d($, null, [
    a("div", $t, [
      x(v, {
        trigger: "click",
        placement: "bottom-left"
      }, {
        reference: P(() => [
          a("button", St, [
            x(h, {
              height: "16",
              width: "16"
            })
          ])
        ]),
        default: P(() => {
          var c, _, C, I, D;
          return [
            a("div", At, [
              (c = n.actions) != null && c.includes("edit") && n.isForm ? (r(), y(b, {
                key: 0,
                to: `/edit?table=${(C = (_ = e.$route) == null ? void 0 : _.params) == null ? void 0 : C.catchAll}&id=${(I = n.item) == null ? void 0 : I.id}`,
                class: "w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"
              }, {
                default: P(() => [
                  x(g, { color: "#000" }),
                  t[4] || (t[4] = z(" Редагувати ", -1))
                ]),
                _: 1
              }, 8, ["to"])) : k("", !0),
              (r(!0), d($, null, V(l.getCustomActions, (S, F) => (r(), d("button", {
                key: F,
                onClick: (q) => l.customButtonAction(S),
                class: "w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"
              }, [
                S != null && S.href ? (r(), y(f, {
                  key: 0,
                  class: "size-3.5"
                })) : k("", !0),
                a("span", It, A(S == null ? void 0 : S.label), 1)
              ], 8, Tt))), 128)),
              n.isForm ? (r(), d("div", Dt)) : k("", !0),
              (D = n.actions) != null && D.includes("del") ? (r(), d("button", {
                key: 2,
                onClick: t[0] || (t[0] = dt((...S) => l.openConfirm && l.openConfirm(...S), ["stop"])),
                class: "w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"
              }, [
                x(u),
                t[5] || (t[5] = a("span", { class: "text-gray-800" }, "Видалити", -1))
              ])) : k("", !0)
            ])
          ];
        }),
        _: 1
      })
    ]),
    x(m, {
      visible: s.isDeleteConfirm,
      "onUpdate:visible": t[3] || (t[3] = (c) => s.isDeleteConfirm = c),
      size: "small",
      title: "Ви впевнені?"
    }, {
      default: P(() => [
        t[6] || (t[6] = a("p", { class: "mt-1 text-sm text-gray-600 dark:text-neutral-400" }, " Ви впевнені, що хочете видалити цей об'єкт? ", -1)),
        a("div", Pt, [
          a("button", {
            type: "button",
            class: "inline-flex items-center px-3 py-2 text-xs font-medium duration-300 border rounded-lg shadow-sm hover:bg-gray-100 gap-x-2 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",
            onClick: t[1] || (t[1] = (c) => s.isDeleteConfirm = !1)
          }, " Скасувати "),
          a("button", {
            type: "button",
            class: "inline-flex items-center px-3 py-2 text-xs font-medium text-white duration-300 bg-red-500 rounded-lg gap-x-2 hover:bg-red-700 disabled:opacity-50 disabled:pointer-events-none",
            onClick: t[2] || (t[2] = (...c) => l.deleteElement && l.deleteElement(...c))
          }, " Так, я впевнена(ий) ")
        ])
      ]),
      _: 1
    }, 8, ["visible"])
  ], 64);
}
const Ft = /* @__PURE__ */ T(wt, [["render", Vt]]), jt = {}, Lt = {
  class: "flex-shrink-0 mt-0.5 size-3.5",
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2",
  "stroke-linecap": "round",
  "stroke-linejoin": "round"
};
function zt(e, t, n, o, s, l) {
  return r(), d("svg", Lt, [...t[0] || (t[0] = [
    a("path", { d: "m3 16 4 4 4-4" }, null, -1),
    a("path", { d: "M7 20V4" }, null, -1),
    a("path", { d: "m21 8-4-4-4 4" }, null, -1),
    a("path", { d: "M17 4v16" }, null, -1)
  ])]);
}
const qt = /* @__PURE__ */ T(jt, [["render", zt]]), Mt = {}, Bt = {
  xmlns: "http://www.w3.org/2000/svg",
  width: "24",
  height: "24",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2",
  "stroke-linecap": "round",
  "stroke-linejoin": "round",
  class: "icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"
};
function Nt(e, t, n, o, s, l) {
  return r(), d("svg", Bt, [...t[0] || (t[0] = [
    a("path", {
      stroke: "none",
      d: "M0 0h24v24H0z",
      fill: "none"
    }, null, -1),
    a("path", { d: "M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1" }, null, -1),
    a("path", { d: "M9 12l2 2l4 -4" }, null, -1)
  ])]);
}
const Ot = /* @__PURE__ */ T(Mt, [["render", Nt]]), Et = {
  components: { IconExport: qt, IconChevronDown: Qe, IconSuccess: Ot },
  props: {
    table: String,
    columns: Array,
    page: [String, Number],
    filterCustom: String,
    filterState: String,
    filters: String
  },
  data() {
    return {
      isOpen: !1,
      tableFormats: ["json", "csv", "xlsx"],
      format: "",
      cols: [],
      activeAction: "",
      isSuccessTemplate: !1,
      actions: [
        { name: "choceAll", function: this.choceAll, label: "Вибрати усі" },
        {
          name: "choceVisible",
          function: this.choceVisible,
          label: "Вибрати поточні"
        },
        { name: "clearAll", function: this.clearAll, label: "Жодного" }
      ],
      es: null,
      progress: 0
    };
  },
  watch: {
    isOpen(e) {
      e || (this.format = "", this.cols = [], this.activeAction = "", this.isSuccessTemplate = !1);
    }
  },
  computed: {
    color() {
      return R.value.buttonColor || "blue";
    }
  },
  methods: {
    async downloadBlob(e) {
      const t = await L.get(e || "/api/export", {
        params: {
          table: this.table,
          format: this.format,
          cols: this.cols.join(","),
          page: this.page,
          filter: this.filters || null,
          state: this.filterState || null,
          custom: this.filterCustom || null
        },
        responseType: "blob"
      }), n = new Blob([t.data], {
        type: "application/octet-stream"
      }), o = document.createElement("a");
      o.href = URL.createObjectURL(n), o.download = `${this.table.split(".")[0]}.${this.format}`, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(o.href), this.isSuccessTemplate = !0, this.$notify({
        type: "success",
        title: "Експорт",
        message: "Файл успішно експортовано!"
      });
    },
    async exportTable() {
      var t;
      try {
        await L.get("/api/export", {
          params: {
            table: this.table,
            format: this.format,
            cols: this.cols.join(","),
            page: this.page,
            filter: this.filters || null,
            state: this.filterState || null,
            custom: this.filterCustom || null,
            stream: !0
          },
          validateStatus: (n) => n === 200
          // treat only 200 as file already
        }), await this.downloadBlob();
        return;
      } catch {
      }
      const e = new URLSearchParams({
        table: this.table,
        format: this.format,
        cols: this.cols.join(","),
        page: this.page,
        filter: this.filters || "",
        state: this.filterState || "",
        custom: this.filterCustom || ""
      });
      (t = this.es) == null || t.close(), this.es = new EventSource(`/api/export?${e.toString()}`), this.es.addEventListener("progress", (n) => {
        try {
          const { percent: o } = JSON.parse(n.data);
          this.progress = o;
        } catch {
          console.log("progress", n.data);
        }
      }), this.es.addEventListener("done", async (n) => {
        this.es.close(), this.es = null;
        const { url: o } = JSON.parse(n.data || "{}");
        await this.downloadBlob(o);
      }), this.es.onerror = (n) => {
        var o;
        console.error("SSE error", n), this.$notify({
          type: "error",
          title: "Помилка",
          message: "Потік експорту перервано."
        }), (o = this.es) == null || o.close();
      };
    },
    selectFormat(e) {
      this.format = e;
    },
    choceAll() {
      var e;
      this.cols = (e = this.columns) == null ? void 0 : e.map((t) => t == null ? void 0 : t.name), this.activeAction = "choceAll";
    },
    clearAll() {
      this.cols = [], this.activeAction = "clearAll";
    },
    choceVisible() {
      var e, t;
      this.cols = (t = (e = this.columns) == null ? void 0 : e.filter((n) => (n == null ? void 0 : n.hidden) !== !0)) == null ? void 0 : t.map((n) => n == null ? void 0 : n.name), this.activeAction = "choceVisible";
    }
  }
}, Ut = {
  key: 0,
  class: "flex flex-col items-center"
}, Rt = {
  key: 1,
  class: "p-4"
}, Wt = { class: "pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700" }, Ht = { class: "flex items-center gap-[10px] -ml-[10px] my-[10px]" }, Jt = ["onClick"], Kt = {
  key: 0,
  class: "block h-[8px] w-[8px] rounded-full bg-blue-500"
}, Gt = { class: "mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]" }, Qt = { class: "pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700" }, Xt = { class: "mt-2 space-y-2" }, Yt = ["id", "onChange"], Zt = ["for"], es = {
  key: 0,
  class: "flex w-full justify-end p-[20px] gap-[6px] border-t"
}, ts = {
  key: 1,
  class: "flex w-full justify-end p-[20px] gap-[6px] border-t"
};
function ss(e, t, n, o, s, l) {
  const h = p("IconExport"), g = p("IconSuccess"), b = p("VsCheckbox"), f = p("VsDialog");
  return r(), d($, null, [
    a("button", {
      onClick: t[0] || (t[0] = (u) => s.isOpen = !0),
      class: "py-2 max-h-[34px] px-2.5 md:inline-flex hidden items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"
    }, [
      x(h, {
        height: "16",
        width: "16"
      }),
      t[7] || (t[7] = z(" Експорт ", -1))
    ]),
    x(f, {
      visible: s.isOpen,
      "onUpdate:visible": t[6] || (t[6] = (u) => s.isOpen = u),
      title: "Експорт таблиці",
      size: "small",
      closeClickBack: !0
    }, {
      footer: P(() => [
        s.isSuccessTemplate ? (r(), d("div", es, [
          a("button", {
            type: "button",
            class: "inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",
            onClick: t[2] || (t[2] = (u) => s.isOpen = !1)
          }, " Закрити "),
          a("button", {
            type: "button",
            class: "inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",
            onClick: t[3] || (t[3] = (u) => s.isSuccessTemplate = !1)
          }, " Вигрузити ще ")
        ])) : (r(), d("div", ts, [
          a("button", {
            type: "button",
            class: "inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",
            onClick: t[4] || (t[4] = (u) => s.isOpen = !1)
          }, " Скасувати "),
          a("button", {
            type: "button",
            class: w(`inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-${l.color}-700 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-${l.color}-800 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-${l.color}-300 dark:focus:ring-${l.color}-500`),
            onClick: t[5] || (t[5] = (...u) => l.exportTable && l.exportTable(...u))
          }, " Завантажити таблицю ", 2)
        ]))
      ]),
      default: P(() => [
        s.isSuccessTemplate ? (r(), d("div", Ut, [
          x(g, {
            height: "100",
            width: "100",
            class: "text-green-200 mb-[20px]"
          }),
          t[8] || (t[8] = a("h2", null, "Звіт сформовано і збережено", -1))
        ])) : (r(), d("div", Rt, [
          a("div", Wt, [
            t[9] || (t[9] = a("h2", { class: "text-sm font-[600] text-gray-500" }, " Виберіть стовпці таблиці для експорту: ", -1)),
            a("div", Ht, [
              (r(!0), d($, null, V(s.actions, (u) => (r(), d("button", {
                key: u == null ? void 0 : u.name,
                onClick: u == null ? void 0 : u.function,
                class: "inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"
              }, [
                a("span", {
                  class: w(["h-[14px] w-[14px] border rounded-full flex items-center justify-center", { "border-blue-500": (u == null ? void 0 : u.name) === s.activeAction }])
                }, [
                  (u == null ? void 0 : u.name) === s.activeAction ? (r(), d("span", Kt)) : k("", !0)
                ], 2),
                z(" " + A(u == null ? void 0 : u.label), 1)
              ], 8, Jt))), 128))
            ]),
            a("div", Gt, [
              (r(!0), d($, null, V(n.columns, (u, v) => (r(), d("div", {
                class: "flex items-center",
                key: v,
                style: { width: "calc((100% - 10px) / 2)" }
              }, [
                x(b, {
                  class: "[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",
                  modelValue: s.cols,
                  "onUpdate:modelValue": t[1] || (t[1] = (m) => s.cols = m),
                  value: u == null ? void 0 : u.name,
                  label: u == null ? void 0 : u.ua
                }, null, 8, ["modelValue", "value", "label"])
              ]))), 128))
            ])
          ]),
          a("div", Qt, [
            t[10] || (t[10] = a("h2", { class: "text-sm font-[600] text-gray-500" }, " Виберіть формат таблиці: ", -1)),
            a("div", Xt, [
              (r(!0), d($, null, V(s.tableFormats, (u, v) => (r(), d("div", {
                class: "flex items-center",
                key: v
              }, [
                a("input", {
                  type: "radio",
                  name: "hs-pro-duecmfm",
                  class: "text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",
                  id: u,
                  onChange: (m) => l.selectFormat(u)
                }, null, 40, Yt),
                a("label", {
                  for: u,
                  class: "text-sm text-gray-800 ms-3 dark:text-neutral-400"
                }, " Формат " + A(u), 9, Zt)
              ]))), 128))
            ])
          ])
        ]))
      ]),
      _: 1
    }, 8, ["visible"])
  ], 64);
}
const ns = /* @__PURE__ */ T(Et, [["render", ss]]), as = {}, ls = {
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2",
  "stroke-linecap": "round",
  "stroke-linejoin": "round",
  class: "icon icon-tabler icons-tabler-outline icon-tabler-minus"
};
function rs(e, t, n, o, s, l) {
  return r(), d("svg", ls, [...t[0] || (t[0] = [
    a("path", {
      stroke: "none",
      d: "M0 0h24v24H0z",
      fill: "none"
    }, null, -1),
    a("path", { d: "M5 12l14 0" }, null, -1)
  ])]);
}
const os = /* @__PURE__ */ T(as, [["render", rs]]), is = {
  components: { IconPlus: K, IconMinus: os },
  props: {
    title: String,
    defaultValue: { type: Boolean, default: () => !1 }
  },
  data() {
    return { expanded: this.defaultValue };
  }
}, ds = { class: "hs-accordion" }, us = { class: "py-0.5 flex items-center gap-x-0.5 w-full" }, cs = { class: "text-sm font-medium" }, hs = { class: "relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b" };
function ps(e, t, n, o, s, l) {
  const h = p("IconPlus"), g = p("IconMinus");
  return r(), d("div", null, [
    a("div", null, [
      a("div", ds, [
        a("div", us, [
          a("div", {
            onClick: t[0] || (t[0] = (b) => s.expanded = !s.expanded),
            class: "rounded-md cursor-pointer grow"
          }, [
            a("span", cs, A(n.title), 1)
          ]),
          a("button", {
            class: "flex items-center justify-center rounded-md size-6 hover:bg-gray-100",
            onClick: t[1] || (t[1] = (b) => s.expanded = !s.expanded)
          }, [
            s.expanded ? (r(), y(g, {
              key: 1,
              width: "14"
            })) : (r(), y(h, { key: 0 }))
          ])
        ]),
        x(Q, { name: "fade" }, {
          default: P(() => [
            X(a("div", hs, [
              ut(e.$slots, "default", {}, void 0, !0)
            ], 512), [
              [Y, s.expanded]
            ])
          ]),
          _: 3
        })
      ])
    ])
  ]);
}
const bs = /* @__PURE__ */ T(is, [["render", ps], ["__scopeId", "data-v-e1f274c9"]]), fs = {
  components: {
    AdminComponentIs: G,
    AdminTree: bs,
    VsNoData: et,
    VsWidgetComments: Ze,
    VsWidgetMap: Ye,
    VsWidgetFileList: Xe
  },
  props: { table: String, columns: Array, row: Object }
}, gs = {
  class: "pl-2 hs-accordion w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",
  style: { height: "calc(100vh - 229px)" }
}, ms = {
  style: { height: "calc(100vh - 360px)" },
  class: "pl-2"
}, xs = { class: "flow-root mt-[10px]" }, ys = { class: "divide-y divide-gray-100 text-[12px]" }, vs = { class: "grid grid-cols-1 gap-1 py-3 even:bg-gray-50 sm:grid-cols-3 sm:gap-4" }, ks = { class: "font-medium text-gray-900" }, _s = { class: "text-gray-700 sm:col-span-2" };
function Cs(e, t, n, o, s, l) {
  var f, u, v, m;
  const h = p("AdminComponentIs"), g = p("VsWidgetFileList"), b = p("VsNoData");
  return r(), d("div", gs, [
    t[0] || (t[0] = a("div", { class: "pl-[10px] py-[9px]" }, [
      a("h2", { class: "text-sm font-medium text-center" }, "Інформація про об'єкт")
    ], -1)),
    a("div", ms, [
      (u = (f = e.$route) == null ? void 0 : f.query) != null && u.card ? (r(), d($, { key: 0 }, [
        a("div", xs, [
          a("dl", ys, [
            (r(!0), d($, null, V(n.columns, (c) => (r(), d("div", vs, [
              a("dt", ks, A((c == null ? void 0 : c.ua) || (c == null ? void 0 : c.title)), 1),
              a("dd", _s, [
                x(h, {
                  row: n.row,
                  column: c,
                  table: n.table
                }, null, 8, ["row", "column", "table"])
              ])
            ]))), 256))
          ])
        ]),
        (r(), y(g, {
          key: (v = n.row) == null ? void 0 : v.id,
          id: (m = n.row) == null ? void 0 : m.id,
          class: "mt-10"
        }, null, 8, ["id"]))
      ], 64)) : (r(), y(b, {
        key: 1,
        text: "Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"
      }))
    ])
  ]);
}
const ws = /* @__PURE__ */ T(fs, [["render", Cs]]), $s = {
  emits: ["filterChange"],
  props: {
    scheme: { type: Object },
    onFilters: { type: Number },
    table: { type: String }
  },
  components: { IconFilter: tt },
  data() {
    return {
      isFilters: !1
    };
  },
  methods: {
    closeFilter({ target: e }) {
      this.isFilters && e.classList.contains("filter-container") && (this.isFilters = !1);
    }
  }
}, Ss = {
  key: 0,
  class: "px-[7px] text-[10px] py-[1px] font-[700] text-white bg-blue-500 rounded-full"
}, As = { class: "filter-content h-screen bg-white w-[400px] overflow-x-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" };
function Ts(e, t, n, o, s, l) {
  const h = p("IconFilter"), g = p("VsFilter");
  return r(), d($, null, [
    a("button", {
      onClick: t[0] || (t[0] = (b) => s.isFilters = !s.isFilters),
      class: "py-2 px-2.5 max-h-[34px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none"
    }, [
      x(h, {
        height: "16",
        width: "16"
      }),
      t[4] || (t[4] = z(" Фільтри ", -1)),
      n.onFilters ? (r(), d("span", Ss, A(n.onFilters), 1)) : k("", !0)
    ]),
    x(Q, { name: "fade" }, {
      default: P(() => {
        var b;
        return [
          (r(), y(ct, { to: "#modal" }, [
            X(a("div", {
              onClick: t[3] || (t[3] = (...f) => l.closeFilter && l.closeFilter(...f)),
              style: { height: "100vh" },
              class: "fixed filter-container top-0 flex justify-end items-center z-[12] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.2)]"
            }, [
              a("div", As, [
                (b = n.scheme) != null && b.length ? (r(), y(g, {
                  key: 0,
                  ref: "filter",
                  scheme: n.scheme,
                  layout: "default",
                  "apply-vue-router": "",
                  history: "",
                  name: "filter",
                  footer: !0,
                  background: !0,
                  onFilterChange: t[1] || (t[1] = (f) => e.$emit("filterChange", f)),
                  closeFilterBtn: !0,
                  onFilterClose: t[2] || (t[2] = (f) => s.isFilters = !1)
                }, null, 8, ["scheme"])) : k("", !0)
              ])
            ], 512), [
              [Y, s.isFilters]
            ])
          ]))
        ];
      }),
      _: 1
    })
  ], 64);
}
const Is = /* @__PURE__ */ T($s, [["render", Ts]]), Ds = {
  props: { tabsList: { type: Array, default: () => [] }, filterState: String }
}, Ps = {
  class: "relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700",
  "aria-label": "Tabs",
  role: "tablist",
  "aria-orientation": "horizontal"
}, Vs = ["onClick"];
function Fs(e, t, n, o, s, l) {
  return r(), d("nav", Ps, [
    (r(!0), d($, null, V(n.tabsList, (h) => (r(), d("button", {
      onClick: (g) => e.$emit("update:filterState", h == null ? void 0 : h.name),
      class: w(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active", {
        " font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800": (h == null ? void 0 : h.name) === n.filterState
      }])
    }, A(h == null ? void 0 : h.label), 11, Vs))), 256))
  ]);
}
const js = /* @__PURE__ */ T(Ds, [["render", Fs]]), Ls = {}, zs = {
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2",
  "stroke-linecap": "round",
  "stroke-linejoin": "round",
  class: "icon icon-tabler icons-tabler-outline icon-tabler-filter"
};
function qs(e, t, n, o, s, l) {
  return r(), d("svg", zs, [...t[0] || (t[0] = [
    a("path", {
      stroke: "none",
      d: "M0 0h24v24H0z",
      fill: "none"
    }, null, -1),
    a("path", { d: "M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z" }, null, -1)
  ])]);
}
const Ms = /* @__PURE__ */ T(Ls, [["render", qs]]), Bs = {
  components: { IconFilter2: Ms, IconCheck2: st },
  props: { filterCustom: String, customList: Array }
}, Ns = { class: "py-2 max-h-[34px] px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700" }, Os = { class: "flex flex-col p-[2px] gap-[2px] w-[170px]" }, Es = ["onClick"], Us = { class: "text-sm text-gray-800" };
function Rs(e, t, n, o, s, l) {
  const h = p("IconFilter2"), g = p("IconCheck2"), b = p("VsPopover");
  return r(), y(b, {
    ref: "popover",
    placement: "bottom"
  }, {
    reference: P(() => [
      a("button", Ns, [
        x(h, {
          height: "20",
          width: "20"
        })
      ])
    ]),
    default: P(() => [
      a("div", Os, [
        (r(!0), d($, null, V(n.customList, (f, u) => (r(), d("button", {
          onClick: (v) => {
            var m;
            e.$emit("update:filterCustom", f == null ? void 0 : f.name), (m = e.$refs) == null || m.popover.togglePopover();
          },
          key: u,
          class: w(["flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100", { "bg-gray-100": n.filterCustom === (f == null ? void 0 : f.name) }])
        }, [
          a("span", Us, A(f == null ? void 0 : f.label), 1),
          n.filterCustom === (f == null ? void 0 : f.name) ? (r(), y(g, {
            key: 0,
            class: "ml-auto size-3 shrink-0"
          })) : k("", !0)
        ], 10, Es))), 128)),
        a("button", {
          class: "flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",
          onClick: t[0] || (t[0] = (f) => {
            var u;
            e.$emit("update:filterCustom", void 0), (u = e.$refs) == null || u.popover.togglePopover();
          })
        }, " Скинути фільтри ")
      ])
    ]),
    _: 1
  }, 512);
}
const Ws = /* @__PURE__ */ T(Bs, [["render", Rs]]), Hs = { class: "flex items-center gap-x-2" }, Js = {
  __name: "admin-table-custom-buttons",
  props: {
    slots: Object,
    data: Object
  },
  setup(e) {
    var g, b, f, u, v;
    const { asyncTemplateSlot: t } = (v = (u = (f = (b = (g = Ue()) == null ? void 0 : g.appContext) == null ? void 0 : b.app) == null ? void 0 : f.config) == null ? void 0 : u.globalProperties) == null ? void 0 : v.utils, n = H(""), o = H(""), s = e, l = () => {
      var m, c, _, C, I;
      if ((m = s.slots) != null && m.panelLeft || (o.value = "div"), (_ = (c = s.slots) == null ? void 0 : c.panelLeft) != null && _.includes("<")) {
        const D = t("PanelLeft", (C = s.slots) == null ? void 0 : C.panelLeft, [
          "name"
        ]);
        o.value = D;
      } else
        o.value = (I = s.slots) == null ? void 0 : I.panelLeft;
    }, h = () => {
      var m, c, _, C, I;
      if ((m = s.slots) != null && m.panelRight || (n.value = "div"), (_ = (c = s.slots) == null ? void 0 : c.panelRight) != null && _.includes("<")) {
        const D = t("PanelRight", (C = s.slots) == null ? void 0 : C.panelRight, [
          "name"
        ]);
        n.value = D;
      } else
        n.value = (I = s.slots) == null ? void 0 : I.panelRight;
    };
    return l(), h(), (m, c) => (r(), d("div", Hs, [
      (r(), y(J(o.value), { data: e.data }, null, 8, ["data"])),
      (r(), y(J(n.value), { data: e.data }, null, 8, ["data"]))
    ]));
  }
}, Ks = {
  __name: "admin-custom-button-add",
  props: {
    slots: Object
  },
  setup(e) {
    var l, h, g, b, f;
    const { asyncTemplateSlot: t } = (f = (b = (g = (h = (l = Ue()) == null ? void 0 : l.appContext) == null ? void 0 : h.app) == null ? void 0 : g.config) == null ? void 0 : b.globalProperties) == null ? void 0 : f.utils, n = H(""), o = e;
    return (() => {
      var u, v, m, c, _;
      if ((u = o.slots) != null && u.addButton || (n.value = "div"), (m = (v = o.slots) == null ? void 0 : v.addButton) != null && m.includes("<")) {
        const C = t("addButton", (c = o.slots) == null ? void 0 : c.addButton, [
          "IconPlus"
        ]);
        n.value = C;
      } else
        n.value = (_ = o.slots) == null ? void 0 : _.addButton;
    })(), (u, v) => n.value ? (r(), y(J(n.value), {
      key: 0,
      IconPlus: K
    })) : k("", !0);
  }
}, Gs = {
  key: 0,
  class: "px-1 py-3 text-gray-800 font-[500]"
}, Qs = {
  key: 1,
  class: "px-1 py-3 text-gray-800 font-[700]"
}, Xs = {
  __name: "admin-table-totals-list",
  props: {
    columns: { type: Array, default: () => [] },
    agg: { type: Object, default: () => {
    } }
  },
  setup(e) {
    return (t, n) => (r(), d("tr", null, [
      (r(!0), d($, null, V(e.columns, (o) => {
        var s;
        return r(), d($, {
          key: o == null ? void 0 : o.name
        }, [
          (s = e.agg) != null && s[o == null ? void 0 : o.name] ? (r(), d("td", Gs, [
            x(G, {
              column: o,
              row: e.agg
            }, null, 8, ["column", "row"])
          ])) : (r(), d("td", Qs))
        ], 64);
      }), 128))
    ]));
  }
}, Ys = {}, Zs = {
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2",
  "stroke-linecap": "round",
  "stroke-linejoin": "round",
  class: "icon icon-tabler icons-tabler-outline icon-tabler-check"
};
function en(e, t, n, o, s, l) {
  return r(), d("svg", Zs, [...t[0] || (t[0] = [
    a("path", {
      stroke: "none",
      d: "M0 0h24v24H0z",
      fill: "none"
    }, null, -1),
    a("path", { d: "M5 12l5 5l10 -10" }, null, -1)
  ])]);
}
const tn = /* @__PURE__ */ T(Ys, [["render", en]]), sn = ht({
  components: { IconChevronDown: nt, IconCheck: tn },
  props: {
    total: { type: Number, default: () => 0 },
    pageSize: { type: Number, default: () => 20 },
    maxPages: { type: Number, default: () => 10 },
    defaultPage: { type: Number, default: () => 1 },
    pageSizes: { type: Array, default: [] }
  },
  data() {
    return {
      page: 1,
      pages: [],
      isDropdownOpen: !1,
      pageSizeLocal: null
    };
  },
  mounted() {
    this.pageSizeLocal = this.pageSize;
  },
  watch: {
    total: {
      immediate: !0,
      handler() {
        this.initPages();
      }
    },
    defaultPage: {
      immediate: !0,
      handler(e) {
        this.page = e, this.updatePages(e);
      }
    },
    pageSizeLocal(e, t) {
      t && (this.isDropdownOpen = !1, this.setCurrentPage(1));
    }
  },
  computed: {
    pagesCount() {
      return Math.ceil(this.total / this.pageSizeLocal);
    },
    disableNextClick() {
      return this.page >= this.pagesCount;
    },
    disablePrevClick() {
      return this.page <= 1;
    }
  },
  methods: {
    initPages() {
      if (this.total <= 0) {
        this.pages = [1];
        return;
      }
      this.updatePages(this.page);
    },
    handleSetPage(e) {
      const t = e.replace(/\D/g, "");
      if (t > this.pagesCount) {
        this.$refs.currentPage.innerText = this.page;
        return;
      } else
        this.$refs.currentPage.innerText = t;
      this.setCurrentPage(t);
    },
    updatePages(e) {
      const t = Math.floor(this.maxPages / 2);
      let n = Math.max(e - t, 1), o = n + this.maxPages - 1;
      o > this.pagesCount && (o = this.pagesCount, n = Math.max(o - this.maxPages + 1, 1)), this.pages = Array.from(
        { length: o - n + 1 },
        (s, l) => n + l
      );
    },
    handleClickPrev() {
      this.disablePrevClick || (this.setCurrentPage(this.page - 1), this.updatePages(this.page), this.$emit("prevClick"));
    },
    handleClickNext() {
      this.disableNextClick || (this.setCurrentPage(parseInt(this.page) + 1), this.updatePages(this.page), this.$emit("nextClick"));
    },
    setCurrentPage(e) {
      this.page = e, this.$emit("pageChange", this.page, this.pageSizeLocal), this.updatePages(e);
    },
    keydownEnter(e) {
      e.preventDefault(), e.target.blur();
    }
  }
}), nn = { class: "flex items-center w-full" }, an = { class: "flex items-center mx-[8px]" }, ln = { class: "min-h-[38px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm" }, rn = {
  key: 0,
  class: "flex items-center justify-center ml-3 gap-x-5"
}, on = { class: "relative" }, dn = { class: "z-50 bg-white shadow-md rounded-lg p-1 space-y-0.5 dark:bg-neutral-800 dark:border dark:border-neutral-700 dark:divide-neutral-700 absolute bottom-[100%]" }, un = ["onClick"];
function cn(e, t, n, o, s, l) {
  const h = p("IconChevronDown"), g = p("IconCheck");
  return r(), d("nav", nn, [
    a("button", {
      type: "button",
      onClick: t[0] || (t[0] = (...b) => e.handleClickPrev && e.handleClickPrev(...b)),
      class: w(["min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100", { "opacity-50 pointer-events-none": e.disablePrevClick }])
    }, [
      x(h, {
        height: "16",
        width: "16",
        class: "rotate-90"
      })
    ], 2),
    a("div", an, [
      a("span", {
        ref: "currentPage",
        contenteditable: "true",
        onKeydown: t[1] || (t[1] = pt((...b) => e.keydownEnter && e.keydownEnter(...b), ["enter"])),
        onBlur: t[2] || (t[2] = (b) => e.handleSetPage(b.target.innerText)),
        class: "min-h-[38px] max-h-[38px] overflow-hidden min-w-[38px] flex justify-center items-center bg-stone-100 text-stone-800 py-2 px-3 outline-blue-600 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:text-white"
      }, A(e.page), 545),
      t[5] || (t[5] = a("span", { class: "min-h-[38px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm" }, "з", -1)),
      a("span", ln, A(e.pagesCount), 1)
    ]),
    a("button", {
      type: "button",
      onClick: t[3] || (t[3] = (...b) => e.handleClickNext && e.handleClickNext(...b)),
      class: w([{ "opacity-50 pointer-events-none": e.disableNextClick }, "min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"])
    }, [
      x(h, {
        height: "16",
        width: "16",
        class: "-rotate-90"
      })
    ], 2),
    e.pageSizes.length ? (r(), d("div", rn, [
      a("div", on, [
        X(a("div", dn, [
          (r(!0), d($, null, V(e.pageSizes, (b) => (r(), d("button", {
            type: "button",
            class: "w-full flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm",
            onClick: (f) => e.pageSizeLocal = b
          }, [
            z(A(b) + " ", 1),
            b === e.pageSizeLocal ? (r(), y(g, {
              key: 0,
              width: "14",
              height: "14",
              class: "text-blue-600"
            })) : k("", !0)
          ], 8, un))), 256))
        ], 512), [
          [Y, e.isDropdownOpen]
        ]),
        e.pageSizes.length ? (r(), d("button", {
          key: 0,
          type: "button",
          class: "text-sm h-[32px] min-w-8 py-3 px-3.5 inline-flex items-center gap-x-1 rounded-lg border border-gray-200 text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",
          onClick: t[4] || (t[4] = (b) => e.isDropdownOpen = !e.isDropdownOpen)
        }, [
          z(A(e.pageSizeLocal) + " ", 1),
          x(h, {
            height: "16",
            width: "16"
          })
        ])) : k("", !0)
      ])
    ])) : k("", !0)
  ]);
}
const hn = /* @__PURE__ */ T(sn, [["render", cn]]), pn = {
  props: { table: String, title: String, search: String },
  components: {
    AdminTableControl: Ft,
    AdminTableExport: ns,
    // AdminTablePrint,
    AdminTableColumnsHidden: it,
    AdminTableColumn: yt,
    AdminNodata: ot,
    IconPlus: K,
    IconSearch: rt,
    AdminTableCardInfo: ws,
    IconOpenCard: lt,
    AdminComponentIs: G,
    AdminTableFilters: Is,
    AdminTableTabs: js,
    AdminTableCustomFilters: Ws,
    AdminTableCustomButtons: Js,
    AdminCustomButtonAdd: Ks,
    AdminTableTotalsList: Xs,
    AdminTablePagination: hn
  },
  data() {
    return {
      tableData: {},
      filterScheme: [],
      page: 1,
      searchValue: "",
      limit: 0,
      filters: null,
      activeColumn: "",
      isVisibleCardInfo: !1,
      onFilters: 0,
      filterState: null,
      filterCustom: null,
      visibleColumns: [],
      initialHiddenColumns: "",
      columnsWidth: {}
    };
  },
  async mounted() {
    await this.checkUrlMounted(), await this.getTableData(), await this.getFilters(), window.addEventListener("reloadTablePage", this.getTableData);
  },
  unmounted() {
    window.removeEventListener("reloadTablePage", this.getTableData);
  },
  computed: {
    color() {
      return R.value.buttonColor || "blue";
    },
    fontSize() {
      return `text-[${R.value.fontSize || 13}px]`;
    },
    defaultPage() {
      var e, t;
      return ((t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.page) || 1;
    },
    columns() {
      var e, t;
      return (t = (e = this.tableData) == null ? void 0 : e.columns) == null ? void 0 : t.filter((n) => (n == null ? void 0 : n.hidden) !== !0);
    },
    isForm() {
      var e, t, n, o, s;
      return ((e = this.tableData) == null ? void 0 : e.form) && (((n = (t = this.tableData) == null ? void 0 : t.actions) == null ? void 0 : n.includes("add")) || ((s = (o = this.tableData) == null ? void 0 : o.actions) == null ? void 0 : s.includes("edit")));
    },
    isNoData() {
      var e, t;
      return !((e = this.tableData) != null && e.rows) || !((t = this.columns) != null && t.length);
    },
    activeCardRow() {
      var e, t;
      return ((t = (e = this.tableData) == null ? void 0 : e.rows) == null ? void 0 : t.find((n) => {
        var o, s;
        return (n == null ? void 0 : n.id) === ((s = (o = this.$route) == null ? void 0 : o.query) == null ? void 0 : s.card);
      })) || {};
    },
    getActions() {
      var e;
      return (e = this.tableData) == null ? void 0 : e.actions;
    }
  },
  watch: {
    // async table() {
    //   this.tableData = null;
    //   this.columnsWidth = {};
    //   await this.getTableData();
    // },
    searchValue: {
      handler: at(async function(e) {
        var t;
        this.page = 1, await this.getTableData(), this.$router.push({
          ...this.$route,
          query: {
            ...(t = this.$route) == null ? void 0 : t.query,
            search: e || void 0,
            page: 1
          }
        });
      }, 500)
    },
    $route: {
      async handler(e, t) {
        var n, o;
        ((n = e == null ? void 0 : e.params) == null ? void 0 : n.catchAll) !== ((o = t == null ? void 0 : t.params) == null ? void 0 : o.catchAll) && (this.visibleColumns = [], this.tableData = null, this.columnsWidth = {}, this.unmountedData(), this.getFilters(), await this.getTableData());
      },
      deep: !0
    },
    limit(e) {
      var t;
      this.$router.replace({
        ...this.$route,
        query: { ...(t = this.$route) == null ? void 0 : t.query, limit: e }
      });
    },
    filterState(e) {
      var t;
      e && (this.$router.replace({
        ...this.$route,
        query: { ...(t = this.$route) == null ? void 0 : t.query, state: e }
      }), this.getTableData());
    },
    filterCustom(e) {
      var t;
      this.$router.replace({
        ...this.$route,
        query: { ...(t = this.$route) == null ? void 0 : t.query, custom: e }
      }), this.getTableData();
    },
    columns(e) {
      var t, n, o, s;
      this.visibleColumns = e == null ? void 0 : e.map((l) => l == null ? void 0 : l.name), this.initialHiddenColumns === ((t = this.visibleColumns) == null ? void 0 : t.join(",")) && (this.visibleColumns = []), this.$router.replace({
        ...this.$route,
        query: {
          ...(n = this.$route) == null ? void 0 : n.query,
          columns: (o = this.visibleColumns) != null && o.length ? (s = this.visibleColumns) == null ? void 0 : s.join(",") : void 0
        }
      });
    }
  },
  methods: {
    async checkUrlMounted() {
      var e, t, n, o, s, l, h, g, b, f, u, v, m, c, _, C, I, D, S, F, q;
      this.page = ((t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.page) || 1, this.limit = ((o = (n = this.$route) == null ? void 0 : n.query) == null ? void 0 : o.limit) || 20, (l = (s = this.$route) == null ? void 0 : s.query) != null && l.filter && (this.filters = ((b = decodeURI((g = (h = this.$route) == null ? void 0 : h.query) == null ? void 0 : g.filter)) == null ? void 0 : b.replaceAll("+", " ")) || null), this.filters && (this.onFilters = ((u = (f = this.filters) == null ? void 0 : f.split("=")) == null ? void 0 : u.length) - 1), this.filterState = ((m = (v = this.$route) == null ? void 0 : v.query) == null ? void 0 : m.state) || null, this.filterCustom = ((_ = (c = this.$route) == null ? void 0 : c.query) == null ? void 0 : _.custom) || null, this.searchValue = ((I = (C = this.$route) == null ? void 0 : C.query) == null ? void 0 : I.search) || "", this.visibleColumns = ((F = (S = (D = this.$route) == null ? void 0 : D.query) == null ? void 0 : S.columns) == null ? void 0 : F.split(",")) || [], (q = this.$route) != null && q.query.card && (this.isVisibleCardInfo = !0);
    },
    rowWidth(e) {
      var n, o;
      const t = (o = (n = this.tableData) == null ? void 0 : n.columns) == null ? void 0 : o.find((s) => s.name === e);
      if (t) {
        const s = t == null ? void 0 : t.width;
        return typeof s == "number" ? `${s}px` : s != null && s.includes("px") ? s : `${s}px`;
      }
    },
    unmountedData() {
      this.page = 1, this.visibleColumns = [], this.filterCustom = null, this.filterState = null, this.isVisibleCardInfo = !1, this.filterScheme = null, this.filters = null, this.onFilters = 0, this.searchValue = "";
    },
    async getTableData() {
      var e, t, n, o, s, l, h, g, b, f, u;
      try {
        const { data: v } = await L.get(`/api/template/table/${this.table}`), m = await L.get(`/api/table-data/${this.table}`, {
          params: {
            page: this.page,
            search: this.searchValue || null,
            limit: this.limit,
            filter: this.filters || null,
            order: ((t = (e = this.$route) == null ? void 0 : e.query) == null ? void 0 : t.sort) || null,
            state: this.filterState || null,
            custom: this.filterCustom || null
          }
        });
        this.tableData = {
          ...v,
          ...(m == null ? void 0 : m.data) || {}
        }, this.initialHiddenColumns = (l = (s = (o = (n = this.tableData) == null ? void 0 : n.columns) == null ? void 0 : o.filter((c) => (c == null ? void 0 : c.hidden) !== !0)) == null ? void 0 : s.map((c) => c == null ? void 0 : c.name)) == null ? void 0 : l.join(","), (h = this.visibleColumns) != null && h.length ? (g = this.tableData) == null || g.columns.forEach((c) => {
          var _;
          (_ = this.visibleColumns) != null && _.includes(c == null ? void 0 : c.name) ? c.hidden = !1 : c.hidden = !0;
        }) : this.visibleColumns = (u = (f = (b = this.tableData) == null ? void 0 : b.columns) == null ? void 0 : f.filter((c) => (c == null ? void 0 : c.hidden) !== !0)) == null ? void 0 : u.map((c) => c == null ? void 0 : c.name), setTimeout(() => {
          var c, _;
          (_ = (c = this.tableData) == null ? void 0 : c.columns) == null || _.forEach(({ name: C }) => {
            var I, D, S, F, q, E;
            (D = (I = this.columnsWidth) == null ? void 0 : I[C]) != null && D.ref && (this.columnsWidth[C].width = parseInt(
              (E = (q = (F = (S = this.columnsWidth) == null ? void 0 : S[C]) == null ? void 0 : F.ref) == null ? void 0 : q.getBoundingClientRect()) == null ? void 0 : E.width
            ) + "px");
          });
        });
      } catch {
      }
    },
    async getFilters() {
      var e;
      try {
        const { data: t } = await L.get(`/api/table-filter/${this.table}`);
        this.filterScheme = (e = t == null ? void 0 : t.list) == null ? void 0 : e.map((n) => ({
          ...n,
          label: (n == null ? void 0 : n.label) || (n == null ? void 0 : n.ua)
        }));
      } catch {
      }
    },
    async handlePageChange(e, t) {
      const n = this.$route.query;
      this.page = e, this.limit = t, await this.$router.replace({ query: { ...n, page: e, limit: t } }), await this.getTableData();
    },
    async filterChange({ url: e, state: t }) {
      var n;
      this.filters = e !== "no-url" ? e : null, this.onFilters = (n = Object.entries(t)) == null ? void 0 : n.length, this.page = 1, await this.getTableData();
    },
    changeActiveColumn(e) {
      this.activeColumn = e, this.getTableData();
    },
    pushToCard(e) {
      var t;
      ((t = this.tableData) == null ? void 0 : t.card) === !1 || this.$router.push(`/card/${this.table}/${e}`);
    },
    pushToLinkCard(e, t) {
      e != null && e.link && this.$router.push(`/card/${e == null ? void 0 : e.link}/${t == null ? void 0 : t[e == null ? void 0 : e.name]}`);
    },
    changeActiveCardInfo(e) {
      var t;
      this.isVisibleCardInfo && this.$router.push({
        ...this.$route,
        query: { ...(t = this.$route) == null ? void 0 : t.query, card: e }
      });
    },
    toggleCardInfo() {
      var e;
      this.isVisibleCardInfo = !this.isVisibleCardInfo, this.isVisibleCardInfo || this.$router.push({
        ...this.$route,
        query: { ...(e = this.$route) == null ? void 0 : e.query, card: void 0 }
      });
    },
    getCustomStyles(e) {
      return [
        e != null && e.link ? " text-blue-800 hover:underline decoration-1" : "",
        e != null && e.align ? ` text-${(e == null ? void 0 : e.align) || "left"}` : "",
        `text-${(e == null ? void 0 : e.wrap) || "wrap"}`
      ];
    }
  }
}, bn = { class: "w-[calc(100vw - 320px)] bg-gray-100" }, fn = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, gn = { class: "text-lg font-semibold text-gray-800 dark:text-neutral-200" }, mn = { class: "bg-white w-full rounded-xl p-[20px] pr-0" }, xn = { class: "flex" }, yn = { class: "flex gap-[6px] ml-auto" }, vn = { class: "inline-block w-full align-middle" }, kn = { class: "sticky top-[-1px] z-[2] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200" }, _n = { class: "right-0" }, Cn = {
  key: 0,
  class: "w-[70px] sticky right-0 top-0"
}, wn = { class: "divide-y divide-gray-200 z-[1] relative text-gray-600" }, $n = ["onClick"], Sn = ["onClick"], An = ["onClick"], Tn = { class: "flex items-center justify-start w-full px-1 py-2" }, In = { class: "w-[200px] md:inline-flex hidden" }, Dn = { class: "text-sm text-gray-600 dark:text-neutral-400" }, Pn = { class: "font-semibold text-gray-800 dark:text-neutral-200" }, Vn = { key: 0 };
function Fn(e, t, n, o, s, l) {
  var Z, ee, te, se, ne, ae, le, re, oe, ie, de, ue, ce, he, pe, be, fe, ge, me, xe, ye, ve, ke, _e, Ce, we, $e, Se, Ae, Te, Ie, De, Pe;
  const h = p("AdminCustomButtonAdd"), g = p("IconPlus"), b = p("router-link"), f = p("AdminTableTabs"), u = p("IconSearch"), v = p("VsText"), m = p("AdminTableCustomButtons"), c = p("AdminTableCustomFilters"), _ = p("AdminTableColumnsHidden"), C = p("AdminTableExport"), I = p("AdminTableFilters"), D = p("IconOpenCard"), S = p("AdminTableColumn"), F = p("AdminComponentIs"), q = p("AdminTableControl"), E = p("AdminTableTotalsList"), Re = p("AdminNodata"), We = p("AdminTablePagination"), He = p("AdminTableCardInfo");
  return r(), d("div", bn, [
    a("div", fn, [
      a("h2", gn, A(n.title), 1),
      l.isForm ? (r(), d($, { key: 0 }, [
        (ee = (Z = s.tableData) == null ? void 0 : Z.slots) != null && ee.addButton ? (r(), y(h, {
          key: 0,
          slots: (te = s.tableData) == null ? void 0 : te.slots
        }, null, 8, ["slots"])) : (r(), y(b, {
          key: 1,
          to: `/add?table=${(ne = (se = e.$route) == null ? void 0 : se.params) == null ? void 0 : ne.catchAll}`,
          class: w(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${l.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${l.color}-800 hover:text-white`)
        }, {
          default: P(() => [
            x(g, {
              height: "16",
              width: "16"
            }),
            t[5] || (t[5] = z(" Додати ", -1))
          ]),
          _: 1
        }, 8, ["to", "class"]))
      ], 64)) : k("", !0)
    ]),
    a("div", {
      style: W({
        height: ((ae = e.$adminSettings) == null ? void 0 : ae.header) === !1 ? "calc(100vh - 91px)" : "calc(100vh - 155px)"
      }),
      class: "bg-gray-100 p-[20px] flex pt-[10px] lg:w-[calc(100vw-260px)] w-[100vw]"
    }, [
      a("div", mn, [
        (re = (le = s.tableData) == null ? void 0 : le.filterState) != null && re.length ? (r(), y(f, {
          key: 0,
          tabsList: (oe = s.tableData) == null ? void 0 : oe.filterState,
          filterState: s.filterState,
          "onUpdate:filterState": t[0] || (t[0] = (i) => s.filterState = i)
        }, null, 8, ["tabsList", "filterState"])) : k("", !0),
        a("div", xn, [
          a("div", {
            class: w([s.isVisibleCardInfo ? "w-[calc(100%-360px)]" : "w-full"])
          }, [
            a("div", {
              class: w(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative", { "pr-[20px]": !s.isVisibleCardInfo }])
            }, [
              x(u, {
                height: "14",
                width: "14",
                class: "absolute top-[10px] left-[14px] text-gray-500 z-[1]"
              }),
              x(v, {
                modelValue: s.searchValue,
                "onUpdate:modelValue": t[1] || (t[1] = (i) => s.searchValue = i),
                placeholder: n.search || "Пошук...",
                clearable: !0,
                class: "[&>input]:py-[7px] [&>input]:max-h-[36px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"
              }, null, 8, ["modelValue", "placeholder"]),
              a("div", yn, [
                (ie = s.tableData) != null && ie.slots ? (r(), y(m, {
                  key: 0,
                  data: s.tableData,
                  slots: (de = s.tableData) == null ? void 0 : de.slots
                }, null, 8, ["data", "slots"])) : k("", !0),
                (ce = (ue = s.tableData) == null ? void 0 : ue.filterCustom) != null && ce.length ? (r(), y(c, {
                  key: 1,
                  customList: (he = s.tableData) == null ? void 0 : he.filterCustom,
                  filterCustom: s.filterCustom,
                  "onUpdate:filterCustom": t[2] || (t[2] = (i) => s.filterCustom = i)
                }, null, 8, ["customList", "filterCustom"])) : k("", !0),
                x(_, {
                  columns: (pe = s.tableData) == null ? void 0 : pe.columns,
                  onUpdateColumns: t[3] || (t[3] = (i) => s.tableData.columns = i)
                }, null, 8, ["columns"]),
                ((be = s.tableData) == null ? void 0 : be.export) !== !1 ? (r(), y(C, {
                  key: 2,
                  table: n.table,
                  columns: (fe = s.tableData) == null ? void 0 : fe.columns,
                  page: s.page,
                  "filter-state": s.filterState,
                  "filter-custom": s.filterCustom,
                  filters: s.filters
                }, null, 8, ["table", "columns", "page", "filter-state", "filter-custom", "filters"])) : k("", !0),
                (ge = s.filterScheme) != null && ge.length ? (r(), y(I, {
                  key: 3,
                  scheme: s.filterScheme,
                  onFilters: s.onFilters,
                  table: n.table,
                  onFilterChange: l.filterChange
                }, null, 8, ["scheme", "onFilters", "table", "onFilterChange"])) : k("", !0),
                a("button", {
                  onClick: t[4] || (t[4] = (...i) => l.toggleCardInfo && l.toggleCardInfo(...i)),
                  class: "py-2 px-2.5 max-h-[34px] md:inline-flex hidden items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"
                }, [
                  x(D, {
                    class: w({ "rotate-180 duration-300": !s.isVisibleCardInfo })
                  }, null, 8, ["class"])
                ])
              ])
            ], 2),
            a("div", {
              class: w(["flex items-start justify-start w-full space-y-5", { "pr-[20px]": !s.isVisibleCardInfo }])
            }, [
              a("div", {
                style: W({
                  height: `calc(100vh - ${((me = e.$adminSettings) == null ? void 0 : me.header) === !1 ? (ye = (xe = s.tableData) == null ? void 0 : xe.filterState) != null && ye.length ? 330 : 270 : (ke = (ve = s.tableData) == null ? void 0 : ve.filterState) != null && ke.length ? 380 : 320}px)`
                }),
                class: "overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"
              }, [
                a("div", vn, [
                  l.isNoData ? (r(), y(Re, { key: 1 })) : (r(), d("table", {
                    key: 0,
                    class: w([l.fontSize, "relative min-w-full my-2 divide-y divide-gray-200 table-fixed w-max dark:divide-neutral-700"])
                  }, [
                    a("thead", kn, [
                      a("tr", _n, [
                        (r(!0), d($, null, V(l.columns, (i) => {
                          var M, B;
                          return r(), y(S, {
                            key: i.name,
                            style: W({
                              width: ((B = (M = s.columnsWidth) == null ? void 0 : M[i == null ? void 0 : i.name]) == null ? void 0 : B.width) || l.rowWidth(i == null ? void 0 : i.name),
                              textAlign: i == null ? void 0 : i.align,
                              wordBreak: i == null ? void 0 : i.wrap
                            }),
                            data: i,
                            activeColumn: s.activeColumn,
                            onUpdateRef: (U) => {
                              var N, O;
                              (O = (N = s.columnsWidth) == null ? void 0 : N[i == null ? void 0 : i.name]) != null && O.ref || (s.columnsWidth[i.name] = { ref: U });
                            },
                            onChangeActive: l.changeActiveColumn
                          }, null, 8, ["style", "data", "activeColumn", "onUpdateRef", "onChangeActive"]);
                        }), 128)),
                        (Ce = (_e = l.getActions) == null ? void 0 : _e.filter(
                          (i) => i !== "add" && i !== "view"
                        )) != null && Ce.length ? (r(), d("th", Cn)) : k("", !0)
                      ])
                    ]),
                    a("tbody", wn, [
                      (r(!0), d($, null, V((we = s.tableData) == null ? void 0 : we.rows, (i, M) => {
                        var B, U, N, O, Ve, Fe, je, Le, ze, qe, Me, Be, Ne, Oe;
                        return r(), d("tr", {
                          key: (i == null ? void 0 : i.id) || M,
                          class: w({
                            "bg-gray-100": ((U = (B = e.$route) == null ? void 0 : B.query) == null ? void 0 : U.card) === (i == null ? void 0 : i.id),
                            "odd:bg-gray-50": ((O = (N = e.$route) == null ? void 0 : N.query) == null ? void 0 : O.card) !== (i == null ? void 0 : i.id)
                          })
                        }, [
                          a("td", {
                            class: w(["px-1 py-2.5 pr-5", [
                              (Ve = l.columns[0]) != null && Ve.align ? `text-${((Fe = l.columns[0]) == null ? void 0 : Fe.align) || "left"}` : ""
                            ]]),
                            onClick: (j) => l.changeActiveCardInfo(i == null ? void 0 : i.id)
                          }, [
                            a("button", {
                              onClick: (j) => {
                                l.pushToCard(i == null ? void 0 : i.id), l.pushToLinkCard(l.columns[0], i);
                              },
                              class: w(["font-medium text-start", [
                                ...l.getCustomStyles(l.columns[0]),
                                ((je = this.tableData) == null ? void 0 : je.card) === !1 ? "" : ` text-${l.color}-800 decoration-2  focus:outline-none focus:underline hover:text-${l.color}-700 hover:underline`
                              ]])
                            }, [
                              x(F, {
                                row: i,
                                column: l.columns[0],
                                table: n.table,
                                onUpdateTable: l.getTableData
                              }, null, 8, ["row", "column", "table", "onUpdateTable"])
                            ], 10, Sn)
                          ], 10, $n),
                          (r(!0), d($, null, V((Le = l.columns) == null ? void 0 : Le.slice(1), (j) => (r(), d("td", {
                            onClick: (Mn) => {
                              l.changeActiveCardInfo(i == null ? void 0 : i.id), l.pushToLinkCard(j, i);
                            },
                            class: w(["px-1 py-2.5 pr-5", l.getCustomStyles(j)]),
                            key: j.name
                          }, [
                            x(F, {
                              row: i,
                              column: j,
                              table: n.table,
                              onUpdateTable: l.getTableData
                            }, null, 8, ["row", "column", "table", "onUpdateTable"])
                          ], 10, An))), 128)),
                          (qe = (ze = l.getActions) == null ? void 0 : ze.filter(
                            (j) => j !== "add" && j !== "view"
                          )) != null && qe.length ? (r(), d("td", {
                            key: 0,
                            class: w(["text-center sticky right-0 w-[80px] px-[10px]", {
                              "bg-gray-50": ((Be = (Me = e.$route) == null ? void 0 : Me.query) == null ? void 0 : Be.card) === (i == null ? void 0 : i.id) || !(M % 2),
                              "bg-white": ((Oe = (Ne = e.$route) == null ? void 0 : Ne.query) == null ? void 0 : Oe.card) !== (i == null ? void 0 : i.id) && M % 2
                            }])
                          }, [
                            x(q, {
                              actions: l.getActions,
                              isForm: l.isForm,
                              item: i,
                              table: n.table,
                              onUpdateTable: l.getTableData
                            }, null, 8, ["actions", "isForm", "item", "table", "onUpdateTable"])
                          ], 2)) : k("", !0)
                        ], 2);
                      }), 128))
                    ]),
                    x(E, {
                      columns: l.columns,
                      agg: ($e = s.tableData) == null ? void 0 : $e.agg
                    }, null, 8, ["columns", "agg"])
                  ], 2))
                ])
              ], 4)
            ], 2),
            a("div", Tn, [
              a("div", In, [
                a("p", Dn, [
                  a("span", Pn, [
                    z(" Об'єктів: " + A(Intl.NumberFormat("ua").format(
                      s.limit < ((Se = s.tableData) == null ? void 0 : Se.filtered) ? s.limit : ((Ae = s.tableData) == null ? void 0 : Ae.filtered) || 0
                    )) + " ", 1),
                    s.limit < ((Te = s.tableData) == null ? void 0 : Te.filtered) ? (r(), d("span", Vn, " з " + A(Intl.NumberFormat("ua").format(((Ie = s.tableData) == null ? void 0 : Ie.filtered) || 0)), 1)) : k("", !0)
                  ])
                ])
              ]),
              Math.ceil((De = s.tableData) == null ? void 0 : De.filtered) > 10 ? (r(), y(We, {
                key: 0,
                class: "justify-end mr-10",
                "default-page": parseInt(l.defaultPage),
                total: ((Pe = s.tableData) == null ? void 0 : Pe.filtered) || 0,
                onPageChange: l.handlePageChange,
                pageSize: parseInt(s.limit),
                pageSizes: [10, 20, 50, 100]
              }, null, 8, ["default-page", "total", "onPageChange", "pageSize"])) : k("", !0)
            ])
          ], 2),
          x(Q, { name: "slide-fade" }, {
            default: P(() => {
              var i;
              return [
                s.isVisibleCardInfo ? (r(), y(He, {
                  key: 0,
                  table: n.table,
                  columns: (i = s.tableData) == null ? void 0 : i.columns,
                  row: l.activeCardRow
                }, null, 8, ["table", "columns", "row"])) : k("", !0)
              ];
            }),
            _: 1
          })
        ])
      ])
    ], 4)
  ]);
}
const jn = /* @__PURE__ */ T(pn, [["render", Fn], ["__scopeId", "data-v-ca941f11"]]), Ln = {
  components: { AdminTable: jn },
  data() {
    return {
      table: !1,
      interface: "",
      search: ""
    };
  },
  watch: {
    $route: {
      async handler() {
        var e;
        (e = Ee) != null && e.value || await this.getMenu(), await this.checkPageType();
      },
      deep: !0
    },
    title(e) {
      var t;
      e && (document.title = (((t = R.value) == null ? void 0 : t.titlePrefix) || "") + e);
    }
  },
  async mounted() {
    await this.checkPageType();
  },
  methods: {
    flattenMenu(e) {
      const t = [];
      return e.forEach((n) => {
        n.menu ? t.push(...this.flattenMenu(n.menu)) : t.push(n);
      }), t;
    },
    async checkPageType() {
      var o, s;
      const e = this.flattenMenu(Ee.value);
      e != null && e.length || this.$router.replace("/404");
      const t = e == null ? void 0 : e.find((l) => {
        var h, g;
        return (l == null ? void 0 : l.path) == ((g = (h = this.$route) == null ? void 0 : h.params) == null ? void 0 : g.catchAll);
      });
      this.title = t == null ? void 0 : t.ua, t || this.$router.replace("/404"), t != null && t.component && this.$router.replace((s = (o = this.$route) == null ? void 0 : o.params) == null ? void 0 : s.catchAll);
      const n = t == null ? void 0 : t.table;
      this.table = n || !1, this.search = (t == null ? void 0 : t.search) || "", !n && this.getInterface();
    },
    async getInterface() {
      var e, t;
      try {
        const { data: n } = await L.get(
          `/api/template/interface/${((t = (e = this.$route) == null ? void 0 : e.params) == null ? void 0 : t.catchAll) || ""}`
        );
        this.interface = n || "";
      } catch {
        this.interface = "";
      }
    }
  }
}, zn = ["innerHTML"];
function qn(e, t, n, o, s, l) {
  const h = p("AdminTable");
  return s.table ? (r(), y(h, {
    key: 0,
    table: s.table,
    title: e.title,
    search: s.search
  }, null, 8, ["table", "title", "search"])) : (r(), d("div", {
    key: 1,
    class: "w-full bg-gray-50",
    style: { height: "calc(100vh - 120px)" },
    innerHTML: s.interface
  }, null, 8, zn));
}
const On = /* @__PURE__ */ T(Ln, [["render", qn]]);
export {
  On as default
};
