import { defineComponent as p, ref as x, onMounted as u, openBlock as s, createBlock as m, resolveDynamicComponent as v, normalizeClass as E, withCtx as d, createVNode as g, Transition as k, createElementBlock as i, Fragment as w, renderSlot as l, createCommentVNode as C, withDirectives as B, vShow as N } from "vue";
const z = /* @__PURE__ */ p({
  name: "ll-expand",
  __name: "Expand",
  props: {
    is: { default: "div" },
    isExpanded: { type: Boolean, default: !1 },
    isLazy: { type: Boolean, default: !1 },
    transitionName: { default: "expand" }
  },
  emits: ["after-expand"],
  setup(t, { emit: r }) {
    const o = t, f = r, a = x(null);
    u(() => {
      !o.isExpanded && a.value && (a.value.style.overflow = "hidden");
    });
    const h = (e) => {
      e.style.visibility = "hidden", e.style.height = "auto";
      const n = e.offsetHeight;
      e.style.visibility = "", e.style.display = "", e.style.height = 0, requestAnimationFrame(() => {
        e.style.height = `${n}px`;
      });
    }, c = (e) => {
      e.style.height = "", e.style.overflow = "", f("after-expand");
    }, y = (e) => {
      const n = e.offsetHeight;
      e.style.height = `${n}px`, e.style.overflow = "hidden", requestAnimationFrame(() => {
        e.style.height = 0;
      });
    };
    return (e, n) => (s(), m(v(o.is), {
      class: E(["stash-expand", {
        "stash-expand--expanded": t.isExpanded,
        "stash-expand--collapsed": !t.isExpanded
      }]),
      "data-test": "stash-expand"
    }, {
      default: d(() => [
        g(k, {
          name: t.transitionName,
          onAfterEnter: c,
          onEnter: h,
          onLeave: y
        }, {
          default: d(() => [
            t.isLazy ? (s(), i(w, { key: 0 }, [
              t.isExpanded ? (s(), i("div", {
                key: 0,
                ref_key: "contentRef",
                ref: a
              }, [
                l(e.$slots, "default")
              ], 512)) : C("", !0)
            ], 64)) : B((s(), i("div", {
              key: 1,
              ref_key: "contentRef",
              ref: a
            }, [
              l(e.$slots, "default")
            ], 512)), [
              [N, t.isExpanded]
            ])
          ]),
          _: 3
        }, 8, ["name"])
      ]),
      _: 3
    }, 8, ["class"]));
  }
});
export {
  z as _
};
//# sourceMappingURL=Expand.vue_vue_type_script_setup_true_lang-CSzt6UW3.js.map
