import { defineComponent as F, ref as m, computed as s, onMounted as I, onBeforeUnmount as D, openBlock as d, createElementBlock as r, normalizeClass as z, unref as n, createElementVNode as t, withModifiers as C, toDisplayString as w, createCommentVNode as p, createVNode as E, TransitionGroup as R, withCtx as G, Fragment as O, renderList as P, withDirectives as U, createBlock as W, resolveDynamicComponent as $, vShow as j } from "vue";
import { u as q, C as J, A as K, V as Q, m as X, o as Y } from "./index-89cd84f1.mjs";
import "pinia";
import "dayjs";
const Z = { class: "cds-slides-header" }, ee = ["onClick"], se = ["innerHTML"], ne = ["innerHTML"], te = { class: "cds-slides-header__body" }, oe = { class: "cds-slides-header__title" }, ie = ["textContent"], le = {
  key: 0,
  class: "cds-slides-header__sub-title"
}, ce = ["textContent"], de = ["onClick"], re = ["innerHTML"], ae = ["onClick"], ue = ["innerHTML"], _e = { class: "cds-slides-body" }, fe = /* @__PURE__ */ F({
  __name: "index",
  setup(he) {
    const o = q(), u = { iconClose: J, iconBack: K };
    m(null);
    const _ = m({ w: 0, h: 0 }), h = m(null), y = s(() => o.slides), i = s(() => o.sideCurrent), L = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.resizable;
    }), M = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.title;
    }), f = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.subTitle;
    }), k = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.size;
    }), l = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.sizes;
    }), S = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.blockClose;
    }), T = s(() => {
      var e;
      return (e = i.value) == null ? void 0 : e.blockCloseMessage;
    }), v = s(() => o.sideCount), A = { small: Q, medium: X, large: Y }, g = s(() => {
      if (!l.value || !l.value.length > 1)
        return;
      const e = l.value.length, a = l.value.findIndex((c) => c === k.value);
      return a + 1 < e ? l.value[a + 1] : l.value[0];
    }), H = s(() => {
      if (!(!l.value || !l.value.length > 1))
        return A[g.value];
    });
    I(() => {
      const e = new ResizeObserver((a) => {
        a.forEach((c) => {
          const x = c.contentRect;
          _.value.w = Number(x.width.toFixed(0)), _.value.h = Number(x.height.toFixed(0)), o.setSidePanelSize(_.value);
        });
      });
      h.value && e.observe(h.value);
    }), D(() => o.closeAllSlide());
    const b = (e = !0) => {
      S.value && !confirm(T.value || "Закрыть?") || (e ? o.closeLastSlide() : o.closeAllSlide());
    }, B = () => o.changeSize(g.value), N = () => b(!0), V = () => b();
    return (e, a) => (d(), r("div", {
      ref_key: "slide",
      ref: h,
      class: z([`cds-slides-container--${n(k)}`, "cds-slides-container"])
    }, [
      t("div", Z, [
        t("a", {
          class: z([{ "cds-slides-header__side--danger": n(v) === 1 }, "cds-slides-header__side"]),
          role: "button",
          onClick: C(N, ["prevent"])
        }, [
          n(v) > 1 ? (d(), r("span", {
            key: 0,
            class: "cds-slides-header__icon",
            innerHTML: u.iconBack
          }, null, 8, se)) : (d(), r("span", {
            key: 1,
            class: "cds-slides-header__icon cds-slides-header__icon--danger",
            innerHTML: u.iconClose
          }, null, 8, ne))
        ], 10, ee),
        t("div", te, [
          t("div", oe, [
            t("div", {
              textContent: w(n(M))
            }, null, 8, ie)
          ]),
          n(f) ? (d(), r("div", le, [
            t("div", {
              textContent: w(n(f))
            }, null, 8, ce)
          ])) : p("", !0)
        ]),
        n(L) ? (d(), r("a", {
          key: 0,
          class: "cds-slides-header__side",
          onClick: C(B, ["prevent"])
        }, [
          t("span", {
            class: "cds-slides-header__icon",
            innerHTML: n(H)
          }, null, 8, re)
        ], 8, de)) : p("", !0),
        n(v) > 1 ? (d(), r("a", {
          key: 1,
          class: "cds-slides-header__side",
          onClick: C(V, ["prevent"])
        }, [
          t("span", {
            class: "cds-slides-header__icon cds-slides-header__icon--danger",
            innerHTML: u.iconClose
          }, null, 8, ue)
        ], 8, ae)) : p("", !0)
      ]),
      t("div", _e, [
        E(R, {
          mode: "in-out",
          name: "sidenav-child",
          persisted: ""
        }, {
          default: G(() => [
            (d(!0), r(O, null, P(n(y), (c) => U((d(), W($(c.component), {
              key: c.id,
              data: c.data
            }, null, 8, ["data"])), [
              [j, n(i).id === c.id]
            ])), 128))
          ]),
          _: 1
        })
      ])
    ], 2));
  }
});
export {
  fe as default
};
//# sourceMappingURL=index-9cead904.mjs.map
