"use client";
import { jsx as a, jsxs as C } from "react/jsx-runtime";
import { Button as g } from "./button.js";
import { cn as l } from "../../../lib/utils.js";
import * as z from "react";
import { a as h } from "../../../useRenderElement-DNB2vtF1.js";
import { u as A, g as b, h as v, i as P, D as w, a as y, b as N, c as R, d as I, e as T, f as k } from "../../../DialogTrigger-C5WbKc3Z.js";
function O(t) {
  const {
    children: e,
    open: r,
    defaultOpen: n = !1,
    onOpenChange: u,
    onOpenChangeComplete: c,
    actionsRef: p,
    handle: f,
    triggerId: i,
    defaultTriggerId: m = null
  } = t, d = A(), s = !!d, o = h(() => f?.store ?? new b({
    open: n,
    openProp: r,
    activeTriggerId: m,
    triggerIdProp: i,
    modal: !0,
    disablePointerDismissal: !0,
    nested: s,
    role: "alertdialog"
  })).current;
  o.useControlledProp("openProp", r), o.useControlledProp("triggerIdProp", i), o.useSyncedValue("nested", s), o.useContextCallback("onOpenChange", u), o.useContextCallback("onOpenChangeComplete", c);
  const x = o.useState("payload");
  v({
    store: o,
    actionsRef: p,
    parentContext: d?.store.context
  });
  const D = z.useMemo(() => ({
    store: o
  }), [o]);
  return /* @__PURE__ */ a(P.Provider, {
    value: D,
    children: typeof e == "function" ? e({
      payload: x
    }) : e
  });
}
function H({ ...t }) {
  return /* @__PURE__ */ a(O, { "data-slot": "alert-dialog", ...t });
}
function W({ ...t }) {
  return /* @__PURE__ */ a(k, { "data-slot": "alert-dialog-trigger", ...t });
}
function j({ ...t }) {
  return /* @__PURE__ */ a(I, { "data-slot": "alert-dialog-portal", ...t });
}
function _({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    R,
    {
      className: l(
        "data-open:fade-in-0 data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 data-closed:animate-out data-open:animate-in supports-backdrop-filter:backdrop-blur-xs",
        t
      ),
      "data-slot": "alert-dialog-overlay",
      ...e
    }
  );
}
function q({
  className: t,
  size: e = "default",
  ...r
}) {
  return /* @__PURE__ */ C(j, { children: [
    /* @__PURE__ */ a(_, {}),
    /* @__PURE__ */ a(
      y,
      {
        className: l(
          "group/alert-dialog-content data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground outline-none ring-1 ring-foreground/10 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-closed:animate-out data-open:animate-in data-[size=default]:sm:max-w-lg",
          t
        ),
        "data-size": e,
        "data-slot": "alert-dialog-content",
        ...r
      }
    )
  ] });
}
function E({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    "div",
    {
      className: l(
        "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
        t
      ),
      "data-slot": "alert-dialog-header",
      ...e
    }
  );
}
function G({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    "div",
    {
      className: l(
        "flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
        t
      ),
      "data-slot": "alert-dialog-footer",
      ...e
    }
  );
}
function J({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    "div",
    {
      className: l(
        "mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
        t
      ),
      "data-slot": "alert-dialog-media",
      ...e
    }
  );
}
function K({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    T,
    {
      className: l(
        "font-medium text-lg sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
        t
      ),
      "data-slot": "alert-dialog-title",
      ...e
    }
  );
}
function L({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    N,
    {
      className: l(
        "text-balance text-muted-foreground text-sm md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
        t
      ),
      "data-slot": "alert-dialog-description",
      ...e
    }
  );
}
function Q({
  className: t,
  ...e
}) {
  return /* @__PURE__ */ a(
    g,
    {
      className: l(t),
      "data-slot": "alert-dialog-action",
      ...e
    }
  );
}
function U({
  className: t,
  variant: e = "outline",
  size: r = "default",
  ...n
}) {
  return /* @__PURE__ */ a(
    w,
    {
      className: l(t),
      "data-slot": "alert-dialog-cancel",
      render: /* @__PURE__ */ a(g, { size: r, variant: e }),
      ...n
    }
  );
}
export {
  H as AlertDialog,
  Q as AlertDialogAction,
  U as AlertDialogCancel,
  q as AlertDialogContent,
  L as AlertDialogDescription,
  G as AlertDialogFooter,
  E as AlertDialogHeader,
  J as AlertDialogMedia,
  _ as AlertDialogOverlay,
  j as AlertDialogPortal,
  K as AlertDialogTitle,
  W as AlertDialogTrigger
};
