import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{pt as t}from"./vendor-primevue-DxVRNMbC.js";import"./vendor-firebase-CdLSXhbt.js";import{D as n,Dt as r,F as i,I as a,O as o,R as s,Vt as c,et as l,gt as u,j as d}from"./vendor-vue-core-X6q-rGJs.js";import"./vendor-other-CyG3qq8S.js";import"./useFeatureFlags-CxRWjdi1.js";import"./api-DQLKc1Xa.js";import"./vendor-markdown-Cola12Wc.js";import"./colorUtil-Cth7eqhK.js";import{n as f}from"./vendor-i18n-B5g6Drzm.js";import"./i18n-DjV_9lZM.js";import"./vendor-reka-ui-CHPbCe4i.js";import{t as p}from"./Button-C7dWyQyS.js";import{ln as m}from"./dialogService-Cqui0UMO.js";import"./systemStatsStore-D9aNY5gT.js";import"./useErrorHandling-BFB8eSj5.js";import{t as h}from"./dialogStore-CXD5Bcfy.js";import"./useCopyToClipboard-C74olorb.js";import"./vendor-tiptap-BXSIIPYY.js";import"./markdownRendererUtil-Bm7Umh6C.js";import"./useExternalLink-Cc30SNi3.js";var g={class:`flex w-full max-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},_={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},v={class:`m-0 text-sm font-normal text-base-foreground`},y=[`aria-label`,`disabled`],b={class:`flex flex-col gap-4 px-4 py-4`},x={class:`m-0 text-sm text-muted-foreground`},S={class:`flex items-center justify-end gap-4 px-4 py-4`},C=s({__name:`CancelSubscriptionDialogContent`,props:{cancelAt:{}},setup(e){let s=e,{t:C}=f(),w=h(),T=t(),{cancelSubscription:E,fetchStatus:D,subscription:O}=m(),k=r(!1),A=n(()=>{let e=s.cancelAt??O.value?.endDate;return e?new Date(e).toLocaleDateString(`en-US`,{month:`long`,day:`numeric`,year:`numeric`}):C(`subscription.cancelDialog.endOfBillingPeriod`)}),j=n(()=>C(`subscription.cancelDialog.description`,{date:A.value}));function onClose(){k.value||w.closeDialog({key:`cancel-subscription`})}async function onConfirmCancel(){k.value=!0;try{await E(),await D(),w.closeDialog({key:`cancel-subscription`}),T.add({severity:`success`,summary:C(`subscription.cancelSuccess`),life:5e3})}catch(e){T.add({severity:`error`,summary:C(`subscription.cancelDialog.failed`),detail:e instanceof Error?e.message:C(`g.unknownError`),life:5e3})}finally{k.value=!1}}return(e,t)=>(l(),d(`div`,g,[o(`div`,_,[o(`h2`,v,c(e.$t(`subscription.cancelDialog.title`)),1),o(`button`,{class:`cursor-pointer rounded border-none bg-transparent p-0 text-muted-foreground transition-colors hover:text-base-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-secondary-foreground`,"aria-label":e.$t(`g.close`),disabled:k.value,onClick:onClose},t[0]||=[o(`i`,{class:`pi pi-times size-4`},null,-1)],8,y)]),o(`div`,b,[o(`p`,x,c(j.value),1)]),o(`div`,S,[a(p,{variant:`muted-textonly`,disabled:k.value,onClick:onClose},{default:u(()=>[i(c(e.$t(`subscription.cancelDialog.keepSubscription`)),1)]),_:1},8,[`disabled`]),a(p,{variant:`destructive`,size:`lg`,loading:k.value,onClick:onConfirmCancel},{default:u(()=>[i(c(e.$t(`subscription.cancelDialog.confirmCancel`)),1)]),_:1},8,[`loading`])])]))}});export{C as default};
//# sourceMappingURL=CancelSubscriptionDialogContent-BL8AaC5Z.js.map