import{c as b,r as T,b as S,j as t}from"./app-BiexncSX.js";import{a as y,c as C,d as E,e as _,f as k,h as B,b as N,g as $,i as z,A as F}from"./alert-dialog-Sv-TtVWh.js";import{B as R}from"./button-Cwvd_D5X.js";import{c as w}from"./utils-DvRnx1Xn.js";import{t as v}from"./index-BphRgCCf.js";import{S as H}from"./spinner-BshPoFqP.js";import{T as I}from"./lucide-react-C-jOYeYF.js";import{T as M}from"./trash-2-B8EoOc8P.js";function U(D){const e=b.c(21),{deleteId:u,model:h,onDeleted:o,className:x,variant:j}=D,g=j===void 0?"outline":j,[s,c]=T.useState(!1);let n;e[0]!==u||e[1]!==h||e[2]!==o?(n=()=>{c(!0),S.delete(`/dashboard/${h}/${u}`,{onSuccess:()=>{v.success("Successfuly Deleted..!"),c(!1),o&&o()},onError:A=>{v.error(A.message),c(!1)},onFinish:()=>{c(!1)}})},e[0]=u,e[1]=h,e[2]=o,e[3]=n):n=e[3];const p=n;let r;e[4]!==x?(r=w("text-destructive hover:border-destructive/10 hover:text-destructive hover:scale-105 active:scale-98 ",x),e[4]=x,e[5]=r):r=e[5];let l;e[6]!==s?(l=s?t.jsx(H,{}):t.jsx(I,{}),e[6]=s,e[7]=l):l=e[7];let i;e[8]!==s||e[9]!==r||e[10]!==l||e[11]!==g?(i=t.jsx(y,{asChild:!0,children:t.jsxs(R,{disabled:s,size:"icon-sm",variant:g,className:r,children:["  ",l,"                "]})}),e[8]=s,e[9]=r,e[10]=l,e[11]=g,e[12]=i):i=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsxs(C,{children:[t.jsx(E,{className:"bg-destructive/10 text-destructive dark:bg-destructive/20 dark:text-destructive",children:t.jsx(M,{})}),t.jsx(_,{children:"Are you sure?"}),t.jsx(k,{children:"This action cannot be undone. This will permanently delete from the database."})]}),e[13]=d):d=e[13];let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(B,{children:"Cancel"}),e[14]=m):m=e[14];let a;e[15]!==p||e[16]!==s?(a=t.jsxs(N,{size:"sm",children:[d,t.jsxs($,{children:[m,t.jsx(z,{variant:"destructive",type:"button",onClick:p,disabled:s,children:"Delete"})]})]}),e[15]=p,e[16]=s,e[17]=a):a=e[17];let f;return e[18]!==i||e[19]!==a?(f=t.jsxs(F,{children:[i,a]}),e[18]=i,e[19]=a,e[20]=f):f=e[20],f}export{U as D};
