'use strict';

var jsxRuntime = require('react/jsx-runtime');
var utils = require('../utils-BhM0B89p.js');
var button = require('../button-CMl9rLXi.js');
var React = require('react');
var index$3 = require('../index-CGUGhyIp.js');
var index$1 = require('../index-D-iDn9RI.js');
var index = require('../index-BTsnrFFc.js');
var index$2 = require('../index-COPkC3I5.js');
require('../index-vioSzJOw.js');
require('../index-DuNgWCXZ.js');
require('../index-BwAq9ba8.js');
require('../index-CCdG4z4E.js');
require('../index-CyrAgb4H.js');
require('../index-Bvu9MiFi.js');
require('../index-DMbj7vXd.js');
require('react-dom');
require('../index-lWVw05cs.js');
require('../index-CS_WSHYi.js');
require('../index-Df-Ffa3s.js');
require('../index-DcCSSgb7.js');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);

// src/slot.tsx
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
// @__NO_SIDE_EFFECTS__
function createSlottable(ownerName) {
  const Slottable2 = ({ children }) => {
    return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
  };
  Slottable2.displayName = `${ownerName}.Slottable`;
  Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
  return Slottable2;
}

var ROOT_NAME = "AlertDialog";
var [createAlertDialogContext] = index$3.createContextScope(ROOT_NAME, [
  index.createDialogScope
]);
var useDialogScope = index.createDialogScope();
var AlertDialog$2 = (props) => {
  const { __scopeAlertDialog, ...alertDialogProps } = props;
  const dialogScope = useDialogScope(__scopeAlertDialog);
  return /* @__PURE__ */ jsxRuntime.jsx(index.Root, { ...dialogScope, ...alertDialogProps, modal: true });
};
AlertDialog$2.displayName = ROOT_NAME;
var TRIGGER_NAME = "AlertDialogTrigger";
var AlertDialogTrigger$2 = React__namespace.forwardRef(
  (props, forwardedRef) => {
    const { __scopeAlertDialog, ...triggerProps } = props;
    const dialogScope = useDialogScope(__scopeAlertDialog);
    return /* @__PURE__ */ jsxRuntime.jsx(index.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
  }
);
AlertDialogTrigger$2.displayName = TRIGGER_NAME;
var PORTAL_NAME = "AlertDialogPortal";
var AlertDialogPortal$2 = (props) => {
  const { __scopeAlertDialog, ...portalProps } = props;
  const dialogScope = useDialogScope(__scopeAlertDialog);
  return /* @__PURE__ */ jsxRuntime.jsx(index.Portal, { ...dialogScope, ...portalProps });
};
AlertDialogPortal$2.displayName = PORTAL_NAME;
var OVERLAY_NAME = "AlertDialogOverlay";
var AlertDialogOverlay$2 = React__namespace.forwardRef(
  (props, forwardedRef) => {
    const { __scopeAlertDialog, ...overlayProps } = props;
    const dialogScope = useDialogScope(__scopeAlertDialog);
    return /* @__PURE__ */ jsxRuntime.jsx(index.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
  }
);
AlertDialogOverlay$2.displayName = OVERLAY_NAME;
var CONTENT_NAME = "AlertDialogContent";
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
var Slottable = createSlottable("AlertDialogContent");
var AlertDialogContent$2 = React__namespace.forwardRef(
  (props, forwardedRef) => {
    const { __scopeAlertDialog, children, ...contentProps } = props;
    const dialogScope = useDialogScope(__scopeAlertDialog);
    const contentRef = React__namespace.useRef(null);
    const composedRefs = index$1.useComposedRefs(forwardedRef, contentRef);
    const cancelRef = React__namespace.useRef(null);
    return /* @__PURE__ */ jsxRuntime.jsx(
      index.WarningProvider,
      {
        contentName: CONTENT_NAME,
        titleName: TITLE_NAME,
        docsSlug: "alert-dialog",
        children: /* @__PURE__ */ jsxRuntime.jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsxRuntime.jsxs(
          index.Content,
          {
            role: "alertdialog",
            ...dialogScope,
            ...contentProps,
            ref: composedRefs,
            onOpenAutoFocus: index$2.composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
              event.preventDefault();
              cancelRef.current?.focus({ preventScroll: true });
            }),
            onPointerDownOutside: (event) => event.preventDefault(),
            onInteractOutside: (event) => event.preventDefault(),
            children: [
              /* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
              /* @__PURE__ */ jsxRuntime.jsx(DescriptionWarning, { contentRef })
            ]
          }
        ) })
      }
    );
  }
);
AlertDialogContent$2.displayName = CONTENT_NAME;
var TITLE_NAME = "AlertDialogTitle";
var AlertDialogTitle$2 = React__namespace.forwardRef(
  (props, forwardedRef) => {
    const { __scopeAlertDialog, ...titleProps } = props;
    const dialogScope = useDialogScope(__scopeAlertDialog);
    return /* @__PURE__ */ jsxRuntime.jsx(index.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
  }
);
AlertDialogTitle$2.displayName = TITLE_NAME;
var DESCRIPTION_NAME = "AlertDialogDescription";
var AlertDialogDescription$2 = React__namespace.forwardRef((props, forwardedRef) => {
  const { __scopeAlertDialog, ...descriptionProps } = props;
  const dialogScope = useDialogScope(__scopeAlertDialog);
  return /* @__PURE__ */ jsxRuntime.jsx(index.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
});
AlertDialogDescription$2.displayName = DESCRIPTION_NAME;
var ACTION_NAME = "AlertDialogAction";
var AlertDialogAction$2 = React__namespace.forwardRef(
  (props, forwardedRef) => {
    const { __scopeAlertDialog, ...actionProps } = props;
    const dialogScope = useDialogScope(__scopeAlertDialog);
    return /* @__PURE__ */ jsxRuntime.jsx(index.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
  }
);
AlertDialogAction$2.displayName = ACTION_NAME;
var CANCEL_NAME = "AlertDialogCancel";
var AlertDialogCancel$2 = React__namespace.forwardRef(
  (props, forwardedRef) => {
    const { __scopeAlertDialog, ...cancelProps } = props;
    const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
    const dialogScope = useDialogScope(__scopeAlertDialog);
    const ref = index$1.useComposedRefs(forwardedRef, cancelRef);
    return /* @__PURE__ */ jsxRuntime.jsx(index.Close, { ...dialogScope, ...cancelProps, ref });
  }
);
AlertDialogCancel$2.displayName = CANCEL_NAME;
var DescriptionWarning = ({ contentRef }) => {
  const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.

Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.

For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
  React__namespace.useEffect(() => {
    const hasDescription = document.getElementById(
      contentRef.current?.getAttribute("aria-describedby")
    );
    if (!hasDescription) console.warn(MESSAGE);
  }, [MESSAGE, contentRef]);
  return null;
};
var Root2 = AlertDialog$2;
var Trigger2 = AlertDialogTrigger$2;
var Portal2 = AlertDialogPortal$2;
var Overlay2 = AlertDialogOverlay$2;
var Content2 = AlertDialogContent$2;
var Action = AlertDialogAction$2;
var Cancel = AlertDialogCancel$2;
var Title2 = AlertDialogTitle$2;
var Description2 = AlertDialogDescription$2;

function AlertDialog$1({
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(Root2, { "data-slot": "alert-dialog", ...props });
}
function AlertDialogTrigger$1({
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(Trigger2, { "data-slot": "alert-dialog-trigger", ...props });
}
function AlertDialogPortal$1({
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(Portal2, { "data-slot": "alert-dialog-portal", ...props });
}
function AlertDialogOverlay$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    Overlay2,
    {
      "data-slot": "alert-dialog-overlay",
      className: utils.cn(
        "fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
        className
      ),
      ...props
    }
  );
}
function AlertDialogContent$1({
  className,
  size = "default",
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal$1, { children: [
    /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay$1, {}),
    /* @__PURE__ */ jsxRuntime.jsx(
      Content2,
      {
        "data-slot": "alert-dialog-content",
        "data-size": size,
        className: utils.cn(
          "group/alert-dialog-content fixed top-1/2 start-1/2 z-50 grid w-full -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
          className
        ),
        ...props
      }
    )
  ] });
}
function AlertDialogHeader$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    {
      "data-slot": "alert-dialog-header",
      className: utils.cn(
        "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-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-start sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
        className
      ),
      ...props
    }
  );
}
function AlertDialogFooter$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    {
      "data-slot": "alert-dialog-footer",
      className: utils.cn(
        "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
        className
      ),
      ...props
    }
  );
}
function AlertDialogMedia$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    {
      "data-slot": "alert-dialog-media",
      className: utils.cn(
        "mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
        className
      ),
      ...props
    }
  );
}
function AlertDialogTitle$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    Title2,
    {
      "data-slot": "alert-dialog-title",
      className: utils.cn(
        "text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
        className
      ),
      ...props
    }
  );
}
function AlertDialogDescription$1({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    Description2,
    {
      "data-slot": "alert-dialog-description",
      className: utils.cn(
        "text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
        className
      ),
      ...props
    }
  );
}
function AlertDialogAction$1({
  className,
  variant = "default",
  size = "default",
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
    Action,
    {
      "data-slot": "alert-dialog-action",
      className: utils.cn(className),
      ...props
    }
  ) });
}
function AlertDialogCancel$1({
  className,
  variant = "outline",
  size = "default",
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
    Cancel,
    {
      "data-slot": "alert-dialog-cancel",
      className: utils.cn(className),
      ...props
    }
  ) });
}

const AlertDialog = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialog$1, { ...props });
const AlertDialogAction = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogAction$1, { ...props });
const AlertDialogCancel = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogCancel$1, { ...props });
const AlertDialogContent = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogContent$1, { ...props });
const AlertDialogDescription = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogDescription$1, { ...props });
const AlertDialogFooter = ({
  className,
  ...props
}) => /* @__PURE__ */ jsxRuntime.jsx(
  AlertDialogFooter$1,
  {
    className: utils.cn("border-border", className),
    ...props
  }
);
const AlertDialogHeader = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogHeader$1, { ...props });
const AlertDialogMedia = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogMedia$1, { ...props });
const AlertDialogOverlay = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay$1, { ...props });
const AlertDialogPortal = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogPortal$1, { ...props });
const AlertDialogTitle = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogTitle$1, { ...props });
const AlertDialogTrigger = (props) => /* @__PURE__ */ jsxRuntime.jsx(AlertDialogTrigger$1, { ...props });

exports.AlertDialog = AlertDialog;
exports.AlertDialogAction = AlertDialogAction;
exports.AlertDialogCancel = AlertDialogCancel;
exports.AlertDialogContent = AlertDialogContent;
exports.AlertDialogDescription = AlertDialogDescription;
exports.AlertDialogFooter = AlertDialogFooter;
exports.AlertDialogHeader = AlertDialogHeader;
exports.AlertDialogMedia = AlertDialogMedia;
exports.AlertDialogOverlay = AlertDialogOverlay;
exports.AlertDialogPortal = AlertDialogPortal;
exports.AlertDialogTitle = AlertDialogTitle;
exports.AlertDialogTrigger = AlertDialogTrigger;
//# sourceMappingURL=AlertDialog.js.map
