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