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