import{_ as q}from"./C-XkP9tB.js";import{d as C,x as z,M as K,I as F,J as S,v as x,R as J,N as L,a0 as O,a1 as W,e as D,o as p,b as r,l as b,c as k,a as s,m as e,t as l,w as o,C as G,E as Q,q as y,A as U,s as $,n as w,a2 as X}from"./Dk4AzF7j.js";import{P as Y}from"./BV5ggfbi.js";import{_ as Z}from"./RBq99eBL.js";import{_ as ee}from"./DXyvFCCy.js";import{_ as te}from"./BXyDg5m4.js";import{_ as oe}from"./7TXjTTLK.js";import{_ as se}from"./BnFHREeV.js";import{_ as ne}from"./BJPwPKCS.js";import"./BOMWTB7S.js";import"./D7D5X_-3.js";import"./B_jJHUd2.js";import"./DgCXB7yu.js";import"./DMtpgJrn.js";import"./88opOQSr.js";import"./D9EMGUu-.js";const ae={class:"rounded-lg o_border border-uiBorder-subtle"},re={class:"o_p-4 flex flex-col gap-4"},le={key:0,class:"text-uiText-toned max-w-[70ch] text-balance"},ie={class:""},ce={class:"font-medium text-sm truncate group-hover:underline"},ue={class:"text-xs text-uiText-toned truncate"},me={class:"text-base max-w-[70ch] text-pretty"},_e={class:"max-w-[70ch] text-pretty"},de=C({__name:"DeleteAccount",setup(A){const i=z(),c=K(),v=F(),{t:m}=S(),u=x(!1),_=J(),{kapi:g}=L(),{$cpanel:f}=O(),h=x(null),I=()=>{const t=_.userDetails?.masterId,a=_.companyDetails?.masterID||_.companyDetails?.id.replace("m","");if(!t||!a)throw new Error("User details not found");return{uMID:t,cMID:a}},{levels:N}=W(),T=async()=>{const{uMID:t,cMID:a}=I();try{await g("Company").then(d=>d.disconnectUser(X().public.provider,+a,t,{deleteIfNoCompany:!0})),f&&await f.delete(),c.push(N.logout)}catch(d){console.error(d)}},B=[{accessorKey:"name",header:m("Project"),meta:{class:{td:"o_w-[400px]"}}},{accessorKey:"sku",header:m("Sku")}];return(t,a)=>{const d=G,P=Y,V=Z,E=ee,M=te,j=oe,H=$,R=se;return p(),D("div",ae,[r("div",re,[e(i).allSystems.length?(p(),D("p",le,l(t.$t("userDetails.FollowingProjectsWillDeleted")),1)):b("",!0),e(i).allSystems.length?(p(),k(E,{key:1,class:"m-px overflow-hidden",variant:"subtle",ui:{header:"border-b-0 border-t-0",body:"border-b-0"}},{default:o(()=>[s(V,{data:e(i).allSystems,columns:B,sticky:"",ui:{th:"hidden",td:"o_py-2"}},{"name-cell":o(({row:n})=>[s(d,{class:"flex gap-x-4 group",to:{name:"p-pid-sid",params:{pid:n.original.pid,sid:n.original.sid}}},{default:o(()=>[r("div",{class:Q(["rounded-full o_py-5 o_w-2",e(v).getStatusColor(n.original.pid)])},null,2),r("div",ie,[r("div",ce,l(n.original.name),1),r("div",ue,l(n.original.domain),1)])]),_:2},1032,["to"])]),"sku-cell":o(({row:n})=>[s(P,{"sku-name":n.original.skuName,"wanna-upsell":!1},null,8,["sku-name"])]),_:1},8,["data"])]),_:1})):b("",!0),e(h)?(p(),k(M,{key:2,error:e(h),"with-refresh":!1,refresh:()=>{}},null,8,["error"])):b("",!0),s(R,{icon:e(y).icoError,color:"error",variant:"subtle"},{title:o(()=>[r("div",me,l(t.$t("userDetails.deleteConfirmSentence")),1)]),description:o(()=>[r("div",_e,l(t.$t("accountDeletionConsequences")),1),s(j,{modelValue:e(u),"onUpdate:modelValue":a[0]||(a[0]=n=>U(u)?u.value=n:null),class:"my-4",required:"",size:"lg",color:"error",ui:{base:"ring ring-uiError-300",label:"text-uiText font-normal"},label:t.$t("ConfirmStartAccountDeletion")},null,8,["modelValue","label"]),s(H,{ui:{base:"dark:text-uiText-highlighted"},color:"error",size:"lg",disabled:!e(u),icon:e(y).icoTrash,onClick:T},{default:o(()=>[w(l(t.$t("userDetails.delete")),1)]),_:1},8,["disabled","icon"])]),_:1},8,["icon"])])])}}}),pe=Object.assign(de,{__name:"DeleteAccount"}),Ne=C({__name:"customerDetails",setup(A){const{t:i}=S();i("userDetails.delete"),x(["0"]);const c=x(!1);return(v,m)=>{const u=q,_=$,g=pe,f=ne;return p(),D("div",null,[s(u,{"page-key":"pCustomerDetails"}),s(f,{open:e(c),"onUpdate:open":m[0]||(m[0]=h=>U(c)?c.value=h:null)},{content:o(()=>[s(g,{class:"o_mt-4"})]),default:o(()=>[s(_,{color:"error",variant:"outline",icon:e(y).icoTrash,active:e(c),"active-variant":"solid"},{default:o(()=>[w(l(e(i)("userDetails.delete")),1)]),_:1},8,["icon","active"])]),_:1},8,["open"])])}}});export{Ne as default};
