import { $n as e, D as t, E as n, Lt as r, On as i, Zn as a, _ as o, b as s, et as c, g as l, jt as u, mt as d, o as f, qt as p, tr as m, v as h, wn as g, xt as _, y as v, z as y } from "./runtime-core.esm-bundler-C_RgxGrN.js";
import { N as b, b as x, q as ee, t as S, y as C } from "./Button-C1y42oVo.js";
import { A as w, r as T } from "./dist-BVQ2eZ4j.js";
import { d as E, i as D, v as O } from "./Tooltip-C9kG7ywk.js";
import { a as k, c as A, i as j, l as M, n as N, o as P, r as F, s as I } from "./useOverlay-Db99omlQ.js";
import { t as L } from "./overlay-DdDSYYrH.js";
var R = { slots: { overlay: `fixed inset-0`, content: `bg-default divide-y divide-default flex flex-col focus:outline-none`, header: `flex items-center gap-1.5 p-4 sm:px-6 min-h-(--ui-header-height)`, wrapper: ``, body: `flex-1 p-4 sm:p-6`, footer: `flex items-center gap-1.5 p-4 sm:px-6`, title: `text-highlighted font-semibold`, description: `mt-1 text-muted text-sm`, close: `absolute top-4 end-4` }, variants: { transition: { true: { overlay: `data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]`, content: `data-[state=open]:animate-[scale-in_200ms_ease-out] data-[state=closed]:animate-[scale-out_200ms_ease-in]` } }, fullscreen: { true: { content: `inset-0` }, false: { content: `w-[calc(100vw-2rem)] max-w-lg rounded-lg shadow-lg ring ring-default` } }, overlay: { true: { overlay: `bg-elevated/75` } }, scrollable: { true: { overlay: `overflow-y-auto`, content: `relative` }, false: { content: `fixed`, body: `overflow-y-auto` } } }, compoundVariants: [{ scrollable: true, fullscreen: false, class: { overlay: `grid place-items-center p-4 sm:py-8` } }, { scrollable: false, fullscreen: false, class: { content: `top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)] overflow-hidden` } }] }, z = { __name: `Modal`, props: { title: { type: String, required: false }, description: { type: String, required: false }, content: { type: Object, required: false }, overlay: { type: Boolean, required: false, default: true }, scrollable: { type: Boolean, required: false }, transition: { type: Boolean, required: false, default: true }, fullscreen: { type: Boolean, required: false }, portal: { type: [Boolean, String], required: false, skipCheck: true, default: true }, close: { type: [Boolean, Object], required: false, default: true }, closeIcon: { type: null, required: false }, dismissible: { type: Boolean, required: false, default: true }, class: { type: null, required: false }, ui: { type: Object, required: false }, open: { type: Boolean, required: false }, defaultOpen: { type: Boolean, required: false }, modal: { type: Boolean, required: false, default: true } }, emits: [`after:leave`, `after:enter`, `close:prevent`, `update:open`], setup(z2, { emit: B }) {
  let V = z2, H = B, U = r(), { t: W } = b(), G = ee(), K = x(`modal`, V), q = O(w(V, `open`, `defaultOpen`, `modal`), H), J = D(g(() => V.portal)), Y = g(() => V.content), X = l(() => V.dismissible ? { pointerDownOutside: (e2) => L(e2, { scrollable: V.scrollable }) } : [`interactOutside`, `escapeKeyDown`].reduce((e2, t2) => (e2[t2] = (e3) => {
    e3.preventDefault(), H(`close:prevent`);
  }, e2), {})), [Z, Q] = T(), $ = l(() => C({ extend: C(R), ...G.ui?.modal || {} })({ transition: V.transition, fullscreen: V.fullscreen, overlay: V.overlay, scrollable: V.scrollable }));
  return (r2, l2) => (d(), h(i(M), e(y(i(q))), { default: p(({ open: g2, close: b2 }) => [t(i(Z), null, { default: p(() => [t(i(I), c({ "data-slot": `content`, class: $.value.content({ class: [!U.default && V.class, i(K)?.content] }) }, Y.value, { onAfterEnter: l2[0] || (l2[0] = (e2) => H(`after:enter`)), onAfterLeave: l2[1] || (l2[1] = (e2) => H(`after:leave`)) }, u(X.value)), { default: p(() => [!z2.title && !U.title || !z2.description && !U.description || U.content ? (d(), h(i(E), { key: 0 }, { default: p(() => [!z2.title && !U.title ? (d(), h(i(F), { key: 0 })) : U.content ? (d(), h(i(F), { key: 1 }, { default: p(() => [_(r2.$slots, `title`, {}, () => [n(m(z2.title), 1)])]), _: 3 })) : v(``, true), !z2.description && !U.description ? (d(), h(i(P), { key: 2 })) : U.content ? (d(), h(i(P), { key: 3 }, { default: p(() => [_(r2.$slots, `description`, {}, () => [n(m(z2.description), 1)])]), _: 3 })) : v(``, true)]), _: 3 })) : v(``, true), _(r2.$slots, `content`, { close: b2 }, () => [U.header || z2.title || U.title || z2.description || U.description || V.close || U.close ? (d(), s(`div`, { key: 0, "data-slot": `header`, class: a($.value.header({ class: i(K)?.header })) }, [_(r2.$slots, `header`, { close: b2 }, () => [o(`div`, { "data-slot": `wrapper`, class: a($.value.wrapper({ class: i(K)?.wrapper })) }, [z2.title || U.title ? (d(), h(i(F), { key: 0, "data-slot": `title`, class: a($.value.title({ class: i(K)?.title })) }, { default: p(() => [_(r2.$slots, `title`, {}, () => [n(m(z2.title), 1)])]), _: 3 }, 8, [`class`])) : v(``, true), z2.description || U.description ? (d(), h(i(P), { key: 1, "data-slot": `description`, class: a($.value.description({ class: i(K)?.description })) }, { default: p(() => [_(r2.$slots, `description`, {}, () => [n(m(z2.description), 1)])]), _: 3 }, 8, [`class`])) : v(``, true)], 2), _(r2.$slots, `actions`), V.close || U.close ? (d(), h(i(A), { key: 0, "as-child": `` }, { default: p(() => [_(r2.$slots, `close`, { ui: $.value }, () => [V.close ? (d(), h(S, c({ key: 0, icon: z2.closeIcon || i(G).ui.icons.close, color: `neutral`, variant: `ghost`, "aria-label": i(W)(`modal.close`) }, typeof V.close == `object` ? V.close : {}, { "data-slot": `close`, class: $.value.close({ class: i(K)?.close }) }), null, 16, [`icon`, `aria-label`, `class`])) : v(``, true)])]), _: 2 }, 1024)) : v(``, true)])], 2)) : v(``, true), U.body ? (d(), s(`div`, { key: 1, "data-slot": `body`, class: a($.value.body({ class: i(K)?.body })) }, [_(r2.$slots, `body`, { close: b2 })], 2)) : v(``, true), U.footer ? (d(), s(`div`, { key: 2, "data-slot": `footer`, class: a($.value.footer({ class: i(K)?.footer })) }, [_(r2.$slots, `footer`, { close: b2 })], 2)) : v(``, true)])]), _: 2 }, 1040, [`class`])]), _: 2 }, 1024), U.default ? (d(), h(i(N), { key: 0, "as-child": ``, class: a(V.class) }, { default: p(() => [_(r2.$slots, `default`, { open: g2 })]), _: 2 }, 1032, [`class`])) : v(``, true), t(i(j), e(y(i(J))), { default: p(() => [z2.scrollable ? (d(), h(i(k), { key: 0, "data-slot": `overlay`, class: a($.value.overlay({ class: i(K)?.overlay })) }, { default: p(() => [t(i(Q))]), _: 1 }, 8, [`class`])) : (d(), s(f, { key: 1 }, [z2.overlay ? (d(), h(i(k), { key: 0, "data-slot": `overlay`, class: a($.value.overlay({ class: i(K)?.overlay })) }, null, 8, [`class`])) : v(``, true), t(i(Q))], 64))]), _: 1 }, 16)]), _: 3 }, 16));
} };
export {
  z as t
};
