"use client";
import { B as Y } from "./chunks/badge-mrshucy2530o70cq.js";
import { B as g } from "./chunks/banner-vzdjbqsb6em7tmdk.js";
import { a as Q } from "./chunks/banner-vzdjbqsb6em7tmdk.js";
import { B as l } from "./chunks/button-j0hi0afn33w9lxgi.js";
import { L as aa, R as ea, b as oa } from "./chunks/button-j0hi0afn33w9lxgi.js";
import { D as sa } from "./chunks/date-range-picker-j318zxjyqz4o3dak.js";
import { C as ia } from "./chunks/checkbox-lawmt1894wr6rpgi.js";
import { C as la } from "./chunks/clipboard-text-ohx8kkpxisz382rj.js";
import { C as pa, a as ma } from "./chunks/code-liq1g6f5lhee305d.js";
import { C as ca } from "./chunks/combobox-ft0u7rfaxawk0r0c.js";
import { a as h, D as M, c as U, e as S } from "./chunks/dialog-l5tmwxrzp9g83jmw.js";
import { d as ua, b as xa } from "./chunks/dialog-l5tmwxrzp9g83jmw.js";
import { D as Ta } from "./chunks/dropdown-icy3xatdwhzr4une.js";
import { C as _a } from "./chunks/collapsible-jhzee3ks51d3xowb.js";
import { F as Ia, a as La, K as Ra, f as Ea } from "./chunks/field-csje72m7j9403fj5.js";
import { b as ha, K as Ma, L as Ua, a as Da, l as Na } from "./chunks/label-i46xnnzdh9bsxk6a.js";
import { I as D } from "./chunks/input-c8jmidy7gdqfiky1.js";
import { i as Ka } from "./chunks/input-c8jmidy7gdqfiky1.js";
import { I as va, T as ka } from "./chunks/input-area-jko15sbc6zeage3l.js";
import { I as Pa } from "./chunks/input-group-cjsy8kh4vf9312xl.js";
import { L as Fa } from "./chunks/layer-card-mu2w82x6ko1nhhtr.js";
import { L as Ga } from "./chunks/loader-m5wfmqwgucrr4i5v.js";
import { S as ja } from "./chunks/skeleton-line-1j5exu6vv07mmhfb.js";
import { M as qa, u as Ha } from "./chunks/menubar-g1wqqjuyyfvsim83.js";
import { M as Xa } from "./chunks/meter-cqkrg5axjenbsuue.js";
import { P as Ja } from "./chunks/pagination-e3dp8bd80s35f7sd.js";
import { S as Za } from "./chunks/select-hnt87e3cfos48qql.js";
import { S as ee } from "./chunks/surface-dhshylwccuaz91d1.js";
import { S as re } from "./chunks/switch-fukrbip86khvqjn7.js";
import { T as te } from "./chunks/tabs-n0t7iro7wr0pzgk2.js";
import { T as ne } from "./chunks/table-orfgzwvxh8yr90dk.js";
import { T as de } from "./chunks/text-gzt92mlji1lug13d.js";
import { a as me, T as fe, u as ce } from "./chunks/toast-r9ajsces7xp8l85w.js";
import { T as ue, a as xe } from "./chunks/tooltip-hnc71tg4gz2gpcvc.js";
import { g as Te, K as Ae, P as _e } from "./chunks/popover-jurf834u2uywluux.js";
import { a as Ie, K as Le, S as Re } from "./chunks/sensitive-input-lvtccf3iqc06lj7b.js";
import { b as ge, K as he, R as Me, a as Ue, r as De } from "./chunks/radio-l9dzm6sohcvvrsdc.js";
import { C as Oe, a as Ke, K as Ve } from "./chunks/command-palette-b31nq4wk7o7gx4sa.js";
import { a as ke, K as Be, L as Pe, l as ye } from "./chunks/link-o7yfj4kwgl19fklp.js";
import { B as we } from "./chunks/breadcrumbs-m79gm4gjwbfajpna.js";
import { E as ze } from "./chunks/empty-hrwtammqp0b2nvtf.js";
import { G as $e, a as qe, c as He, K as We, b as Xe, g as Ye } from "./chunks/grid-m9r71jxo2b8q1972.js";
import { C as Qe, a as Ze, K as ao, P as eo, g as oo } from "./chunks/cloudflare-logo-bgts2jgsdh7sslw4.js";
import { D as so } from "./chunks/date-picker-mjocqqbggb76n8rt.js";
import { Flow as io } from "./components/flow.js";
import { C as lo, a as po, b as mo, T as fo } from "./chunks/Legend-bov5dqf08wemc2qj.js";
import { A as bo, B as uo, K as xo, S as So, w as To, y as Ao, x as _o, d as Co, e as Io, f as Lo, h as Ro, g as Eo, c as go, r as ho, i as Mo, l as Uo, m as Do, k as No, v as Oo, j as Ko, n as Vo, p as vo, o as ko, a as Bo, t as Po, u as yo, b as Fo, q as wo, s as Go, z as zo } from "./chunks/sidebar-l6rk9o5qf8k5vth1.js";
import { c as N } from "./chunks/cn-ct4n7r74mh8y0f48.js";
import { s as $o } from "./chunks/cn-ct4n7r74mh8y0f48.js";
import { L as Ho, u as Wo } from "./chunks/link-provider-mn2voeohon7cj9o4.js";
import { jsx as a, jsxs as e } from "react/jsx-runtime";
import { useState as T, useEffect as O, useCallback as d } from "react";
import { XIcon as K, WarningCircleIcon as V, CheckIcon as v, CopyIcon as k } from "@phosphor-icons/react";
import { i as Yo } from "./chunks/vendor-base-ui-ccr5l0ynrievzzv3.js";
const H = {
  size: {
    sm: {
      classes: "",
      description: "Small dialog for simple delete confirmations"
    },
    base: {
      classes: "",
      description: "Default delete confirmation dialog size"
    }
  }
}, B = {
  size: "base"
};
function P({
  open: t,
  onOpenChange: A,
  resourceType: p,
  resourceName: o,
  onDelete: m,
  isDeleting: s = !1,
  caseSensitive: f = !0,
  deleteButtonText: _,
  size: C = B.size,
  errorMessage: c,
  className: I
}) {
  const [b, u] = T(""), [L, i] = T(!1);
  O(() => {
    t || (u(""), i(!1));
  }, [t]);
  const x = d(
    (r) => f ? r : r.toLowerCase(),
    [f]
  ), n = x(b) === x(o), R = d(async () => {
    !n || s || await m();
  }, [n, s, m]), E = d(async () => {
    await navigator.clipboard.writeText(o), i(!0), setTimeout(() => i(!1), 1500);
  }, [o]);
  return /* @__PURE__ */ a(h, { open: t, onOpenChange: A, children: /* @__PURE__ */ e(M, { size: C, className: N("p-0", I), children: [
    /* @__PURE__ */ e("div", { className: "flex items-center justify-between border-b border-kumo-line px-6 py-4", children: [
      /* @__PURE__ */ e(U, { className: "text-lg font-semibold", children: [
        "Delete ",
        o
      ] }),
      /* @__PURE__ */ a(
        S,
        {
          render: (r) => /* @__PURE__ */ a(
            l,
            {
              ...r,
              variant: "ghost",
              shape: "square",
              size: "sm",
              "aria-label": "Close",
              disabled: s,
              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(g, { icon: /* @__PURE__ */ a(V, {}), 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,
                L ? /* @__PURE__ */ a(
                  v,
                  {
                    size: 12,
                    weight: "bold",
                    className: "inline ml-1.5"
                  }
                ) : /* @__PURE__ */ a(
                  k,
                  {
                    size: 12,
                    weight: "bold",
                    className: "inline text-kumo-subtle group-hover:text-kumo-default ml-1.5"
                  }
                )
              ]
            }
          ),
          " ",
          "to confirm:"
        ] }) }),
        /* @__PURE__ */ a(
          D,
          {
            placeholder: o,
            value: b,
            onChange: (r) => u(r.target.value),
            disabled: s,
            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(
        S,
        {
          render: (r) => /* @__PURE__ */ a(l, { ...r, variant: "secondary", disabled: s, children: "Cancel" })
        }
      ),
      /* @__PURE__ */ a(
        l,
        {
          variant: "destructive",
          onClick: R,
          disabled: !n || s,
          loading: s,
          children: _ || `Delete ${p}`
        }
      )
    ] })
  ] }) });
}
P.displayName = "DeleteResource";
export {
  Y as Badge,
  g as Banner,
  Q as BannerVariant,
  we as Breadcrumbs,
  l as Button,
  lo as Chart,
  po as ChartLegend,
  mo as ChartPalette,
  ia as Checkbox,
  la as ClipboardText,
  Qe as CloudflareLogo,
  pa as Code,
  ma as CodeBlock,
  _a as Collapsible,
  ca as Combobox,
  Oe as CommandPalette,
  so as DatePicker,
  sa as DateRangePicker,
  P as DeleteResource,
  M as Dialog,
  S as DialogClose,
  ua as DialogDescription,
  h as DialogRoot,
  U as DialogTitle,
  xa as DialogTrigger,
  Ta as DropdownMenu,
  ze as Empty,
  Ia as Field,
  io as Flow,
  $e as Grid,
  qe as GridItem,
  D as Input,
  va as InputArea,
  Pa as InputGroup,
  Ze as KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS,
  ao as KUMO_CLOUDFLARE_LOGO_VARIANTS,
  Ke as KUMO_COMMAND_PALETTE_DEFAULT_VARIANTS,
  Ve as KUMO_COMMAND_PALETTE_VARIANTS,
  B as KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS,
  H as KUMO_DELETE_RESOURCE_VARIANTS,
  La as KUMO_FIELD_DEFAULT_VARIANTS,
  Ra as KUMO_FIELD_VARIANTS,
  He as KUMO_GRID_DEFAULT_VARIANTS,
  We as KUMO_GRID_VARIANTS,
  ha as KUMO_LABEL_DEFAULT_VARIANTS,
  Ma as KUMO_LABEL_VARIANTS,
  ke as KUMO_LINK_DEFAULT_VARIANTS,
  Be as KUMO_LINK_VARIANTS,
  Te as KUMO_POPOVER_DEFAULT_VARIANTS,
  Ae as KUMO_POPOVER_VARIANTS,
  ge as KUMO_RADIO_DEFAULT_VARIANTS,
  he as KUMO_RADIO_VARIANTS,
  Ie as KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS,
  Le as KUMO_SENSITIVE_INPUT_VARIANTS,
  bo as KUMO_SIDEBAR_DEFAULT_VARIANTS,
  uo as KUMO_SIDEBAR_STYLING,
  xo as KUMO_SIDEBAR_VARIANTS,
  Ua as Label,
  Fa as LayerCard,
  Pe as Link,
  aa as LinkButton,
  Ho as LinkProvider,
  Ga as Loader,
  qa as MenuBar,
  Xa as Meter,
  Ja as Pagination,
  _e as Popover,
  eo as PoweredByCloudflare,
  Me as Radio,
  Ue as RadioGroup,
  ea as RefreshButton,
  Za as Select,
  Re as SensitiveInput,
  So as Sidebar,
  To as SidebarCollapsible,
  Ao as SidebarCollapsibleContent,
  _o as SidebarCollapsibleTrigger,
  Co as SidebarContent,
  Io as SidebarFooter,
  Lo as SidebarGroup,
  Ro as SidebarGroupContent,
  Eo as SidebarGroupLabel,
  go as SidebarHeader,
  ho as SidebarInput,
  Mo as SidebarMenu,
  Uo as SidebarMenuAction,
  Do as SidebarMenuBadge,
  No as SidebarMenuButton,
  Oo as SidebarMenuChevron,
  Ko as SidebarMenuItem,
  Vo as SidebarMenuSub,
  vo as SidebarMenuSubButton,
  ko as SidebarMenuSubItem,
  Bo as SidebarProvider,
  Po as SidebarRail,
  yo as SidebarResizeHandle,
  Fo as SidebarRoot,
  wo as SidebarSeparator,
  Go as SidebarTrigger,
  ja as SkeletonLine,
  ee as Surface,
  re as Switch,
  ne as Table,
  te as Tabs,
  de as Text,
  ka as Textarea,
  fo as TimeseriesChart,
  Yo as Toast,
  me as ToastProvider,
  fe as Toasty,
  ue as Tooltip,
  xe as TooltipProvider,
  oa as buttonVariants,
  N as cn,
  Ea as fieldVariants,
  oo as generateCloudflareLogoSvg,
  Xe as gridItemVariants,
  Ye as gridVariants,
  Ka as inputVariants,
  Da as labelContentVariants,
  Na as labelVariants,
  ye as linkVariants,
  De as radioVariants,
  $o as safeRandomId,
  ce as useKumoToastManager,
  Wo as useLinkComponent,
  Ha as useMenuNavigation,
  zo as useSidebar
};
//# sourceMappingURL=index.js.map
