import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{pt as t}from"./vendor-primevue-DsBxnwSO.js";import"./vendor-firebase-CdLSXhbt.js";import{$ as n,A as r,Bt as i,D as a,E as o,Et as s,F as c,L as l,P as u,ht as d}from"./vendor-vue-core-D3IvUUeM.js";import"./vendor-other-C_YjAAj3.js";import"./useFeatureFlags-Bfb3fghV.js";import"./api-Ckh8-1rW.js";import"./colorUtil-DCPbkdH3.js";import{n as f}from"./vendor-i18n-CHjQVoSH.js";import"./i18n-C2nvaQjh.js";import"./vendor-reka-ui-djAAohzU.js";import{t as p}from"./Button-CJj3KtkO.js";import{sn as m}from"./dialogService-Daa_oID7.js";import"./systemStatsStore-CSnXy46l.js";import"./useErrorHandling-BfFOVBcK.js";import{t as h}from"./dialogStore-CBXn_TDV.js";import"./useCopyToClipboard-DcMopO23.js";import"./vendor-tiptap-CjhX_1DY.js";import"./vendor-markdown-CyF8uRn7.js";import"./markdownRendererUtil-DU6rKHAL.js";import"./useExternalLink-C8tDmXU8.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=l({__name:`CancelSubscriptionDialogContent`,props:{cancelAt:{}},setup(e){let l=e,{t:C}=f(),w=h(),T=t(),{cancelSubscription:E,fetchStatus:D,subscription:O}=m(),k=s(!1),A=o(()=>{let e=l.cancelAt??O.value?.endDate;return e?new Date(e).toLocaleDateString(`en-US`,{month:`long`,day:`numeric`,year:`numeric`}):C(`subscription.cancelDialog.endOfBillingPeriod`)}),j=o(()=>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)=>(n(),r(`div`,g,[a(`div`,_,[a(`h2`,v,i(e.$t(`subscription.cancelDialog.title`)),1),a(`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]||=[a(`i`,{class:`pi pi-times size-4`},null,-1)],8,y)]),a(`div`,b,[a(`p`,x,i(j.value),1)]),a(`div`,S,[c(p,{variant:`muted-textonly`,disabled:k.value,onClick:onClose},{default:d(()=>[u(i(e.$t(`subscription.cancelDialog.keepSubscription`)),1)]),_:1},8,[`disabled`]),c(p,{variant:`destructive`,size:`lg`,loading:k.value,onClick:onConfirmCancel},{default:d(()=>[u(i(e.$t(`subscription.cancelDialog.confirmCancel`)),1)]),_:1},8,[`loading`])])]))}});export{C as default};
//# sourceMappingURL=CancelSubscriptionDialogContent-Y7CgsqWJ.js.map