"use client";
import { B as Y } from "./chunks/badge-dan90i0rzy4pwa1j.js";
import { B as O } from "./chunks/banner-eiwcnk7ts21s3bnb.js";
import { a as Q } from "./chunks/banner-eiwcnk7ts21s3bnb.js";
import { B as n } from "./chunks/button-6by9ntsa3nj553mq.js";
import { L as aa, R as ea, b as oa } from "./chunks/button-6by9ntsa3nj553mq.js";
import { D as sa } from "./chunks/date-range-picker-c9wnx9tbwohai7jy.js";
import { C as ia } from "./chunks/checkbox-eren6w2csum1xghg.js";
import { C as na } from "./chunks/clipboard-text-f9q753udny1uyxr5.js";
import { C as ma, a as pa } from "./chunks/code-cz0w1y5z4h29a9eg.js";
import { C as Ta } from "./chunks/combobox-n9qht9h9ag6kh5sn.js";
import { a as M, D as U, c as N, e as u } from "./chunks/dialog-94v7wiz7j3in6528.js";
import { d as Aa, b as ba } from "./chunks/dialog-94v7wiz7j3in6528.js";
import { D as Sa } from "./chunks/dropdown-zbax0zowy6m9zhmt.js";
import { C as _a } from "./chunks/collapsible-k8urhi16pg90jvxa.js";
import { F as Ia, a as La, K as Ra, f as Ea } from "./chunks/field-lnj619xpe8zjd26r.js";
import { b as Ma, K as Ua, L as Na, a as Ka, l as ga } from "./chunks/label-be8m7qzlakzig2sl.js";
import { I as K } from "./chunks/input-lpa5fc75tgrraafv.js";
import { i as Da } from "./chunks/input-lpa5fc75tgrraafv.js";
import { I as va, T as Pa } from "./chunks/input-area-h8xbqturegdfm1mi.js";
import { I as ka } from "./chunks/input-group-dh4pg8p20rh4mdi0.js";
import { L as ya } from "./chunks/layer-card-hvivdirwwnyq88wa.js";
import { L as Ga } from "./chunks/loader-hr2w7cpqeev3p3vl.js";
import { S as ja } from "./chunks/skeleton-line-epxenksfesr2fkcv.js";
import { M as qa, u as Ha } from "./chunks/menubar-hwev159bm4rw9ixk.js";
import { M as Xa } from "./chunks/meter-bqetlujwg8gm2u7m.js";
import { P as Ja } from "./chunks/pagination-ho8zesqfyp6ckmrl.js";
import { S as Za } from "./chunks/select-kpfbib9l8xrrmzpz.js";
import { S as ee } from "./chunks/surface-o63tktyrifcjejyb.js";
import { S as re } from "./chunks/switch-lclhiplr9zqf73tj.js";
import { T as te } from "./chunks/tabs-jywwt8ebjqjkux75.js";
import { T as le } from "./chunks/table-fyy8gl875yyevqs3.js";
import { T as de } from "./chunks/text-f7t467waymhb30sx.js";
import { a as pe, T as fe, u as Te } from "./chunks/toast-h573o0tc7tefivk2.js";
import { T as Ae, a as be } from "./chunks/tooltip-odudhkxe282wxinq.js";
import { g as Se, K as xe, P as _e } from "./chunks/popover-iayd9ya5yhujz6ve.js";
import { a as Ie, K as Le, S as Re } from "./chunks/sensitive-input-i1upqytzaw2pus8v.js";
import { b as Oe, K as Me, R as Ue, a as Ne, r as Ke } from "./chunks/radio-datzh3pilz8ojak1.js";
import { C as he, a as De, K as Ve } from "./chunks/command-palette-gk9m34ymp2b3hfc5.js";
import { a as Pe, K as Be, L as ke, l as Fe } from "./chunks/link-kt74pxkud4olmcer.js";
import { B as we } from "./chunks/breadcrumbs-cxcwf2l1ki3ffg5d.js";
import { E as ze } from "./chunks/empty-kpymw59thjf2ip8g.js";
import { G as $e, a as qe, c as He, K as We, b as Xe, g as Ye } from "./chunks/grid-hj1ylz16p7g5uelh.js";
import { C as Qe, a as Ze, K as ao, P as eo, g as oo } from "./chunks/cloudflare-logo-pbavoe1wu8nr5c4n.js";
import { D as so } from "./chunks/date-picker-mjocqqbggb76n8rt.js";
import { Flow as io } from "./components/flow.js";
import { C as no, a as mo, b as po, T as fo } from "./chunks/Legend-ibjxhfm9pn2vrb6f.js";
import { A as co, b as Ao, K as bo, a as uo } from "./chunks/autocomplete-cs3fwy6lwzlyirpq.js";
import { A as xo, B as _o, K as Co, S as Io, w as Lo, y as Ro, x as Eo, d as Oo, e as Mo, f as Uo, h as No, g as Ko, c as go, r as ho, i as Do, l as Vo, m as vo, k as Po, v as Bo, j as ko, n as Fo, p as yo, o as wo, a as Go, t as zo, u as jo, b as $o, q as qo, s as Ho, z as Wo } from "./chunks/sidebar-kh37grvfxto14ek6.js";
import { a as Yo, K as Jo, T as Qo } from "./chunks/table-of-contents-fzyv7uhnnyr13dqu.js";
import { c as g } from "./chunks/cn-ct4n7r74mh8y0f48.js";
import { s as ar } from "./chunks/cn-ct4n7r74mh8y0f48.js";
import { L as or, u as rr } from "./chunks/link-provider-mn2voeohon7cj9o4.js";
import { K as tr } from "./chunks/portal-provider-hwmkdmkpvct0cb76.js";
import { jsx as a, jsxs as e } from "react/jsx-runtime";
import { useState as S, useEffect as h, useCallback as d } from "react";
import { XIcon as D, WarningCircleIcon as V, CheckIcon as v, CopyIcon as P } from "@phosphor-icons/react";
import { i as lr } from "./chunks/vendor-base-ui-ie71jahf0czyf58j.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 k({
  open: t,
  onOpenChange: x,
  resourceType: m,
  resourceName: o,
  onDelete: p,
  isDeleting: s = !1,
  caseSensitive: f = !0,
  deleteButtonText: _,
  size: C = B.size,
  errorMessage: T,
  className: I
}) {
  const [c, A] = S(""), [L, i] = S(!1);
  h(() => {
    t || (A(""), i(!1));
  }, [t]);
  const b = d(
    (r) => f ? r : r.toLowerCase(),
    [f]
  ), l = b(c) === b(o), R = d(async () => {
    !l || s || await p();
  }, [l, s, p]), E = d(async () => {
    await navigator.clipboard.writeText(o), i(!0), setTimeout(() => i(!1), 1500);
  }, [o]);
  return /* @__PURE__ */ a(M, { open: t, onOpenChange: x, children: /* @__PURE__ */ e(U, { size: C, className: g("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(N, { className: "text-lg font-semibold", children: [
        "Delete ",
        o
      ] }),
      /* @__PURE__ */ a(
        u,
        {
          render: (r) => /* @__PURE__ */ a(
            n,
            {
              ...r,
              variant: "ghost",
              shape: "square",
              size: "sm",
              "aria-label": "Close",
              disabled: s,
              children: /* @__PURE__ */ a(D, { size: 18 })
            }
          )
        }
      )
    ] }),
    /* @__PURE__ */ e("div", { className: "flex flex-col p-6 gap-4", children: [
      /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: [
        T && /* @__PURE__ */ a(O, { icon: /* @__PURE__ */ a(V, {}), variant: "error", children: T }),
        /* @__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 }),
          " ",
          m.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(
                  P,
                  {
                    size: 12,
                    weight: "bold",
                    className: "inline text-kumo-subtle group-hover:text-kumo-default ml-1.5"
                  }
                )
              ]
            }
          ),
          " ",
          "to confirm:"
        ] }) }),
        /* @__PURE__ */ a(
          K,
          {
            placeholder: o,
            value: c,
            onChange: (r) => A(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(
        u,
        {
          render: (r) => /* @__PURE__ */ a(n, { ...r, variant: "secondary", disabled: s, children: "Cancel" })
        }
      ),
      /* @__PURE__ */ a(
        n,
        {
          variant: "destructive",
          onClick: R,
          disabled: !l || s,
          loading: s,
          children: _ || `Delete ${m}`
        }
      )
    ] })
  ] }) });
}
k.displayName = "DeleteResource";
export {
  co as Autocomplete,
  Y as Badge,
  O as Banner,
  Q as BannerVariant,
  we as Breadcrumbs,
  n as Button,
  no as Chart,
  mo as ChartLegend,
  po as ChartPalette,
  ia as Checkbox,
  na as ClipboardText,
  Qe as CloudflareLogo,
  ma as Code,
  pa as CodeBlock,
  _a as Collapsible,
  Ta as Combobox,
  he as CommandPalette,
  so as DatePicker,
  sa as DateRangePicker,
  k as DeleteResource,
  U as Dialog,
  u as DialogClose,
  Aa as DialogDescription,
  M as DialogRoot,
  N as DialogTitle,
  ba as DialogTrigger,
  Sa as DropdownMenu,
  ze as Empty,
  Ia as Field,
  io as Flow,
  $e as Grid,
  qe as GridItem,
  K as Input,
  va as InputArea,
  ka as InputGroup,
  Ao as KUMO_AUTOCOMPLETE_DEFAULT_VARIANTS,
  bo as KUMO_AUTOCOMPLETE_VARIANTS,
  Ze as KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS,
  ao as KUMO_CLOUDFLARE_LOGO_VARIANTS,
  De 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,
  Ma as KUMO_LABEL_DEFAULT_VARIANTS,
  Ua as KUMO_LABEL_VARIANTS,
  Pe as KUMO_LINK_DEFAULT_VARIANTS,
  Be as KUMO_LINK_VARIANTS,
  Se as KUMO_POPOVER_DEFAULT_VARIANTS,
  xe as KUMO_POPOVER_VARIANTS,
  Oe as KUMO_RADIO_DEFAULT_VARIANTS,
  Me as KUMO_RADIO_VARIANTS,
  Ie as KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS,
  Le as KUMO_SENSITIVE_INPUT_VARIANTS,
  xo as KUMO_SIDEBAR_DEFAULT_VARIANTS,
  _o as KUMO_SIDEBAR_STYLING,
  Co as KUMO_SIDEBAR_VARIANTS,
  Yo as KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS,
  Jo as KUMO_TABLE_OF_CONTENTS_VARIANTS,
  tr as KumoPortalProvider,
  Na as Label,
  ya as LayerCard,
  ke as Link,
  aa as LinkButton,
  or as LinkProvider,
  Ga as Loader,
  qa as MenuBar,
  Xa as Meter,
  Ja as Pagination,
  _e as Popover,
  eo as PoweredByCloudflare,
  Ue as Radio,
  Ne as RadioGroup,
  ea as RefreshButton,
  Za as Select,
  Re as SensitiveInput,
  Io as Sidebar,
  Lo as SidebarCollapsible,
  Ro as SidebarCollapsibleContent,
  Eo as SidebarCollapsibleTrigger,
  Oo as SidebarContent,
  Mo as SidebarFooter,
  Uo as SidebarGroup,
  No as SidebarGroupContent,
  Ko as SidebarGroupLabel,
  go as SidebarHeader,
  ho as SidebarInput,
  Do as SidebarMenu,
  Vo as SidebarMenuAction,
  vo as SidebarMenuBadge,
  Po as SidebarMenuButton,
  Bo as SidebarMenuChevron,
  ko as SidebarMenuItem,
  Fo as SidebarMenuSub,
  yo as SidebarMenuSubButton,
  wo as SidebarMenuSubItem,
  Go as SidebarProvider,
  zo as SidebarRail,
  jo as SidebarResizeHandle,
  $o as SidebarRoot,
  qo as SidebarSeparator,
  Ho as SidebarTrigger,
  ja as SkeletonLine,
  ee as Surface,
  re as Switch,
  le as Table,
  Qo as TableOfContents,
  te as Tabs,
  de as Text,
  Pa as Textarea,
  fo as TimeseriesChart,
  lr as Toast,
  pe as ToastProvider,
  fe as Toasty,
  Ae as Tooltip,
  be as TooltipProvider,
  uo as autocompleteVariants,
  oa as buttonVariants,
  g as cn,
  Ea as fieldVariants,
  oo as generateCloudflareLogoSvg,
  Xe as gridItemVariants,
  Ye as gridVariants,
  Da as inputVariants,
  Ka as labelContentVariants,
  ga as labelVariants,
  Fe as linkVariants,
  Ke as radioVariants,
  ar as safeRandomId,
  Te as useKumoToastManager,
  rr as useLinkComponent,
  Ha as useMenuNavigation,
  Wo as useSidebar
};
//# sourceMappingURL=index.js.map
