import"./rolldown-runtime-DIIn1E2Q.js";import{dt as e}from"./vendor-primevue-BDZ_jj__.js";import"./vendor-firebase-D7u00oy9.js";import{D as t,F as n,I as r,O as i,R as a,Ut as o,_t as s,et as c,j as l,kt as u}from"./vendor-vue-core-DO0afONr.js";import"./vendor-other-CiPV8GBG.js";import"./useFeatureFlags-CeS8LuDc.js";import"./api-Cw7jP9TY.js";import"./vendor-markdown-Da9QPS2x.js";import"./colorUtil-Bsa2N3Sq.js";import{n as d}from"./vendor-i18n-JbyM4Qz7.js";import"./i18n-CF_88JEG.js";import"./vendor-reka-ui-B53kLmAc.js";import{t as f}from"./Button-Ca3rDegY.js";import{Mi as p}from"./dialogService-CfgsFapJ.js";import"./formatUtil-CeKPWstn.js";import{t as m}from"./dialogStore-G2juoay4.js";import"./userStore-Czt6jT20.js";import"./useErrorHandling-DXaBpHI1.js";import"./extensionStore-MnMxnUwx.js";import"./useExternalLink-BItqlDxr.js";import"./vendor-tiptap-Bk1lVUYZ.js";import"./markdownRendererUtil-_EbNpPBW.js";import"./Popover-CXKWNrM3.js";import"./electronDownloadStore-DudKQmD7.js";var h={class:`flex w-full max-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},g={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},_={class:`m-0 text-sm font-normal text-base-foreground`},v=[`aria-label`,`disabled`],y={class:`flex flex-col gap-4 p-4`},b={class:`m-0 text-sm text-muted-foreground`},x={class:`flex items-center justify-end gap-4 p-4`},S=a({__name:`CancelSubscriptionDialogContent`,props:{cancelAt:{}},setup(a){let S=a,{t:C}=d(),w=m(),T=e(),{cancelSubscription:E,fetchStatus:D,subscription:O}=p(),k=u(!1),A=t(()=>{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=t(()=>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`)})}finally{k.value=!1}}return(e,t)=>(c(),l(`div`,h,[i(`div`,g,[i(`h2`,_,o(e.$t(`subscription.cancelDialog.title`)),1),i(`button`,{class:`focus-visible:ring-secondary-foreground cursor-pointer rounded-sm border-none bg-transparent p-0 text-muted-foreground transition-colors hover:text-base-foreground focus-visible:ring-1 focus-visible:outline-none`,"aria-label":e.$t(`g.close`),disabled:k.value,onClick:onClose},t[0]||=[i(`i`,{class:`pi pi-times size-4`},null,-1)],8,v)]),i(`div`,y,[i(`p`,b,o(j.value),1)]),i(`div`,x,[r(f,{variant:`muted-textonly`,disabled:k.value,onClick:onClose},{default:s(()=>[n(o(e.$t(`subscription.cancelDialog.keepSubscription`)),1)]),_:1},8,[`disabled`]),r(f,{variant:`destructive`,size:`lg`,loading:k.value,onClick:onConfirmCancel},{default:s(()=>[n(o(e.$t(`subscription.cancelDialog.confirmCancel`)),1)]),_:1},8,[`loading`])])]))}});export{S as default};
//# sourceMappingURL=CancelSubscriptionDialogContent-AY7h5-DH.js.map