"use client";
import { B as J } from "./chunks/badge-mrshucy2530o70cq.js";
import { B as S } from "./chunks/banner-vzdjbqsb6em7tmdk.js";
import { a as Y } from "./chunks/banner-vzdjbqsb6em7tmdk.js";
import { B as n } from "./chunks/button-b1yp3lbrhjr9eg07.js";
import { L as aa, R as ea, b as oa } from "./chunks/button-b1yp3lbrhjr9eg07.js";
import { D as ta } from "./chunks/date-range-picker-j318zxjyqz4o3dak.js";
import { C as ia } from "./chunks/checkbox-khvh0efmlzvlo6qi.js";
import { C as na } from "./chunks/clipboard-text-jvrlvyz5ulm49h5b.js";
import { C as pa, a as fa } from "./chunks/code-liq1g6f5lhee305d.js";
import { C as ca } from "./chunks/combobox-lvbzwi9lymjnkzht.js";
import { a as g, D as N, c as O, e as A } from "./chunks/dialog-emk68n0piw8u7hkb.js";
import { d as Ta, b as ua } from "./chunks/dialog-emk68n0piw8u7hkb.js";
import { D as _a } from "./chunks/dropdown-ejgjnn9gq3daua1h.js";
import { C as Ia } from "./chunks/collapsible-jhzee3ks51d3xowb.js";
import { F as La, a as Ra, K as ha, f as Ea } from "./chunks/field-ftrgblg9mbmz9eo3.js";
import { b as ga, K as Na, L as Oa, a as Ua, l as Da } from "./chunks/label-eooot7dhtfvw7n3x.js";
import { I as U } from "./chunks/input-me56hug8sl0u650q.js";
import { i as Ka } from "./chunks/input-me56hug8sl0u650q.js";
import { I as ka, T as va } from "./chunks/input-area-hxtyrqpp44m18j72.js";
import { I as ya } from "./chunks/input-group-g6qyhe5jvpe02hee.js";
import { L as Ba } from "./chunks/layer-card-8azgeai6zsrdbeoj.js";
import { L as za } from "./chunks/loader-m5wfmqwgucrr4i5v.js";
import { S as ja } from "./chunks/skeleton-line-1j5exu6vv07mmhfb.js";
import { M as qa, u as Wa } from "./chunks/menubar-c2zwv4mbo3xqq7is.js";
import { M as Ha } from "./chunks/meter-em2hfu8j2rhmf5ae.js";
import { P as Qa } from "./chunks/pagination-xt93wvwvow4z44lc.js";
import { S as Za } from "./chunks/select-jxxef2rf76pgdrf8.js";
import { S as ee } from "./chunks/surface-dhshylwccuaz91d1.js";
import { S as re } from "./chunks/switch-b0xo8fxsfzv87krj.js";
import { T as se } from "./chunks/tabs-n3rcvuzx0gbslyy6.js";
import { T as le } from "./chunks/table-d4ql7fjvok30xs1f.js";
import { T as me } from "./chunks/text-gzt92mlji1lug13d.js";
import { a as fe, T as de, u as ce } from "./chunks/toast-j05qj3vk688ht1i1.js";
import { T as Te, a as ue } from "./chunks/tooltip-es2dwwbhftg4k2jy.js";
import { g as _e, K as Ce, P as Ie } from "./chunks/popover-irccwetx73p8pnua.js";
import { a as Le, K as Re, S as he } from "./chunks/sensitive-input-i7ey1w0ky7nco012.js";
import { b as Se, K as ge, R as Ne, a as Oe } from "./chunks/radio-394mfs3au5m8cgd8.js";
import { C as De, a as Ve, K as Ke } from "./chunks/command-palette-l8dym46a74o7j8ci.js";
import { a as ke, K as ve, L as Pe, l as ye } from "./chunks/link-moetfdbgxda0yhwg.js";
import { B as Be } from "./chunks/breadcrumbs-e564gabk59go37cg.js";
import { E as ze } from "./chunks/empty-crbntv0dhud7besh.js";
import { G as je, a as $e, c as qe, K as We, b as Xe, g as He } from "./chunks/grid-m9r71jxo2b8q1972.js";
import { C as Qe, a as Ye, K as Ze, P as ao, g as eo } from "./chunks/cloudflare-logo-bgts2jgsdh7sslw4.js";
import { D as ro } from "./chunks/date-picker-mjocqqbggb76n8rt.js";
import { Flow as so } from "./components/flow.js";
import { C as lo, a as no, b as mo, T as po } from "./chunks/Legend-glsgxdtqiwf3jebj.js";
import { c as D } from "./chunks/cn-ct4n7r74mh8y0f48.js";
import { s as co } from "./chunks/cn-ct4n7r74mh8y0f48.js";
import { L as To, u as uo } from "./chunks/link-provider-mn2voeohon7cj9o4.js";
import { jsx as a, jsxs as e } from "react/jsx-runtime";
import { useState as _, useEffect as V, useCallback as m } from "react";
import { XIcon as K, WarningCircleIcon as M, CheckIcon as k, CopyIcon as v } from "@phosphor-icons/react";
import { i as _o } from "./chunks/vendor-base-ui-kxxocm122zr4pipe.js";
const W = {
  size: {
    sm: {
      classes: "",
      description: "Small dialog for simple delete confirmations"
    },
    base: {
      classes: "",
      description: "Default delete confirmation dialog size"
    }
  }
}, P = {
  size: "base"
};
function y({
  open: s,
  onOpenChange: C,
  resourceType: p,
  resourceName: o,
  onDelete: f,
  isDeleting: t = !1,
  caseSensitive: d = !0,
  deleteButtonText: I,
  size: b = P.size,
  errorMessage: c,
  className: L
}) {
  const [x, T] = _(""), [R, i] = _(!1);
  V(() => {
    s || (T(""), i(!1));
  }, [s]);
  const u = m(
    (r) => d ? r : r.toLowerCase(),
    [d]
  ), l = u(x) === u(o), h = m(async () => {
    !l || t || await f();
  }, [l, t, f]), E = m(async () => {
    await navigator.clipboard.writeText(o), i(!0), setTimeout(() => i(!1), 1500);
  }, [o]);
  return /* @__PURE__ */ a(g, { open: s, onOpenChange: C, children: /* @__PURE__ */ e(N, { size: b, className: D("p-0", L), children: [
    /* @__PURE__ */ e("div", { className: "flex items-center justify-between border-b border-kumo-line px-6 py-4", children: [
      /* @__PURE__ */ e(O, { className: "text-lg font-semibold", children: [
        "Delete ",
        o
      ] }),
      /* @__PURE__ */ a(
        A,
        {
          render: (r) => /* @__PURE__ */ a(
            n,
            {
              ...r,
              variant: "ghost",
              shape: "square",
              size: "sm",
              "aria-label": "Close",
              disabled: t,
              children: /* @__PURE__ */ a(K, { size: 18 })
            }
          )
        }
      )
    ] }),
    /* @__PURE__ */ e("div", { className: "flex flex-col p-6 gap-4", children: [
      /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: [
        c && /* @__PURE__ */ a(S, { icon: /* @__PURE__ */ a(M, {}), variant: "error", children: c }),
        /* @__PURE__ */ e("p", { className: "text-base text-kumo-subtle max-w-prose text-pretty", children: [
          "This action cannot be undone. This will permanently delete the",
          " ",
          /* @__PURE__ */ a("span", { className: "font-medium text-kumo-default", children: o }),
          " ",
          p.toLowerCase(),
          "."
        ] })
      ] }),
      /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ a("div", { className: "flex items-center gap-1.5 text-base", children: /* @__PURE__ */ e("span", { children: [
          "Type",
          " ",
          /* @__PURE__ */ e(
            "button",
            {
              className: "font-mono text-sm inline font-semibold bg-kumo-tint hover:bg-kumo-fill rounded-md px-2 py-1 group hover:cursor-pointer",
              onClick: E,
              "aria-label": `Copy ${o} to clipboard`,
              children: [
                o,
                R ? /* @__PURE__ */ a(
                  k,
                  {
                    size: 12,
                    weight: "bold",
                    className: "inline ml-1.5"
                  }
                ) : /* @__PURE__ */ a(
                  v,
                  {
                    size: 12,
                    weight: "bold",
                    className: "inline text-kumo-subtle group-hover:text-kumo-default ml-1.5"
                  }
                )
              ]
            }
          ),
          " ",
          "to confirm:"
        ] }) }),
        /* @__PURE__ */ a(
          U,
          {
            placeholder: o,
            value: x,
            onChange: (r) => T(r.target.value),
            disabled: t,
            autoComplete: "off",
            autoCorrect: "off",
            autoCapitalize: "off",
            spellCheck: !1,
            "aria-label": `Type ${o} to confirm deletion`,
            className: "w-full"
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ e("div", { className: "flex justify-end gap-3 border-t border-kumo-line px-6 py-4", children: [
      /* @__PURE__ */ a(
        A,
        {
          render: (r) => /* @__PURE__ */ a(n, { ...r, variant: "secondary", disabled: t, children: "Cancel" })
        }
      ),
      /* @__PURE__ */ a(
        n,
        {
          variant: "destructive",
          onClick: h,
          disabled: !l || t,
          loading: t,
          children: I || `Delete ${p}`
        }
      )
    ] })
  ] }) });
}
y.displayName = "DeleteResource";
export {
  J as Badge,
  S as Banner,
  Y as BannerVariant,
  Be as Breadcrumbs,
  n as Button,
  lo as Chart,
  no as ChartLegend,
  mo as ChartPalette,
  ia as Checkbox,
  na as ClipboardText,
  Qe as CloudflareLogo,
  pa as Code,
  fa as CodeBlock,
  Ia as Collapsible,
  ca as Combobox,
  De as CommandPalette,
  ro as DatePicker,
  ta as DateRangePicker,
  y as DeleteResource,
  N as Dialog,
  A as DialogClose,
  Ta as DialogDescription,
  g as DialogRoot,
  O as DialogTitle,
  ua as DialogTrigger,
  _a as DropdownMenu,
  ze as Empty,
  La as Field,
  so as Flow,
  je as Grid,
  $e as GridItem,
  U as Input,
  ka as InputArea,
  ya as InputGroup,
  Ye as KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS,
  Ze as KUMO_CLOUDFLARE_LOGO_VARIANTS,
  Ve as KUMO_COMMAND_PALETTE_DEFAULT_VARIANTS,
  Ke as KUMO_COMMAND_PALETTE_VARIANTS,
  P as KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS,
  W as KUMO_DELETE_RESOURCE_VARIANTS,
  Ra as KUMO_FIELD_DEFAULT_VARIANTS,
  ha as KUMO_FIELD_VARIANTS,
  qe as KUMO_GRID_DEFAULT_VARIANTS,
  We as KUMO_GRID_VARIANTS,
  ga as KUMO_LABEL_DEFAULT_VARIANTS,
  Na as KUMO_LABEL_VARIANTS,
  ke as KUMO_LINK_DEFAULT_VARIANTS,
  ve as KUMO_LINK_VARIANTS,
  _e as KUMO_POPOVER_DEFAULT_VARIANTS,
  Ce as KUMO_POPOVER_VARIANTS,
  Se as KUMO_RADIO_DEFAULT_VARIANTS,
  ge as KUMO_RADIO_VARIANTS,
  Le as KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS,
  Re as KUMO_SENSITIVE_INPUT_VARIANTS,
  Oa as Label,
  Ba as LayerCard,
  Pe as Link,
  aa as LinkButton,
  To as LinkProvider,
  za as Loader,
  qa as MenuBar,
  Ha as Meter,
  Qa as Pagination,
  Ie as Popover,
  ao as PoweredByCloudflare,
  Ne as Radio,
  Oe as RadioGroup,
  ea as RefreshButton,
  Za as Select,
  he as SensitiveInput,
  ja as SkeletonLine,
  ee as Surface,
  re as Switch,
  le as Table,
  se as Tabs,
  me as Text,
  va as Textarea,
  po as TimeseriesChart,
  _o as Toast,
  fe as ToastProvider,
  de as Toasty,
  Te as Tooltip,
  ue as TooltipProvider,
  oa as buttonVariants,
  D as cn,
  Ea as fieldVariants,
  eo as generateCloudflareLogoSvg,
  Xe as gridItemVariants,
  He as gridVariants,
  Ka as inputVariants,
  Ua as labelContentVariants,
  Da as labelVariants,
  ye as linkVariants,
  co as safeRandomId,
  ce as useKumoToastManager,
  uo as useLinkComponent,
  Wa as useMenuNavigation
};
//# sourceMappingURL=index.js.map
