import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{Tu as s}from"./shared-0-C4kdVF7Y.js";import{Mi as a,it as t,ki as i,nt as n,ot as l,rt as r,st as o,tt as d}from"./vendor-frame-CwiylG4Y.js";import{nn as c}from"./vendor-all-2-BJdkbLSj.js";import{J as x,X as m}from"./shared-frame-DbQbH4Yr.js";import{t as f}from"./c96d008db-DbUQM_V_.js";import{Yi as j,Zi as h}from"./shared-4-6CEyRAHb.js";import{Yi as g,Zi as u}from"./shared-8-C1HP2d2B.js";import{St as p,kt as b}from"./shared-13-Uoqh3mCb.js";import{It as v}from"./shared-15-B0mLQAfh.js";var k=e(a()),N=i();var y=(0,k.memo)(function({isOpen:e,onClose:a,onDontAskAgain:i}){const y=s(),w=g(),C=u(),[M,Y]=(0,k.useState)(!1),I=b(),S=m(50),{data:T}=j(),{mutateAsync:z}=h(),G=(0,k.useCallback)(async()=>{Y(!0);try{const{success:e}=await C();if(e){const e=T?.preferences||{};await z({preferences:{...e,feature_preference:{...e.feature_preference,bogosort:{...e.feature_preference?.bogosort,enable_push:!0,enable_email:e.feature_preference?.bogosort?.enable_email??!0}}}}),i?.(),a()}}finally{Y(!1)}},[C,T,z,i,a]),_=(0,k.useCallback)(()=>{i?.(),a()},[i,a]),A=(0,k.useCallback)(()=>{y.push("/settings/general"),a()},[y,a]),D=(0,k.useCallback)(e=>{e||M||a()},[a,M]);let E;return E="default"===w?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(f,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),(0,N.jsxs)("div",{className:"flex flex-col items-center gap-g6",children:[(0,N.jsx)(d,{className:"text-heading-semibold text-t9",children:(0,N.jsx)(c,{defaultMessage:"Enable notifications",id:"AIUVfaT9og"})}),(0,N.jsx)(t,{className:"text-body text-t6",children:(0,N.jsx)(c,{defaultMessage:"Get notified when your tasks complete so you don\u2019t have to keep checking back.",id:"/GY9xNc1u1"})})]}),(0,N.jsxs)("div",{className:"flex justify-center gap-g4",children:[(0,N.jsx)(v,{variant:"contained",onClick:a,disabled:M,children:(0,N.jsx)(c,{defaultMessage:"Not now",id:"dUCA4Khx0S"})}),(0,N.jsx)(v,{variant:"primary",onClick:G,busy:M,children:(0,N.jsx)(c,{defaultMessage:"Enable",id:"TqSTI0/TZI"})})]}),(0,N.jsx)(v,{variant:"link",size:"small",onClick:_,children:(0,N.jsx)(c,{defaultMessage:"Don\u2019t ask me again",id:"+xRY6yy3uz"})})]}):"denied"===w?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(f,{className:"h-[var(--h6)] w-[var(--h6)] text-t5"}),(0,N.jsxs)("div",{className:"flex flex-col items-center gap-g6",children:[(0,N.jsx)(d,{className:"text-heading-semibold text-t9",children:(0,N.jsx)(c,{defaultMessage:"Notifications blocked",id:"E7B/kovpEi"})}),(0,N.jsx)(t,{className:"text-body text-t6",children:(0,N.jsx)(c,{defaultMessage:"Enable notifications in your browser settings to get updates when tasks complete.",id:"ZNQ/KiYXaG"})})]}),(0,N.jsx)("div",{className:"flex justify-center gap-g4",children:(0,N.jsx)(v,{variant:"contained",onClick:a,children:(0,N.jsx)(c,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})}),(0,N.jsx)(v,{variant:"link",size:"small",onClick:_,children:(0,N.jsx)(c,{defaultMessage:"Don\u2019t ask me again",id:"+xRY6yy3uz"})})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(f,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),(0,N.jsxs)("div",{className:"flex flex-col items-center gap-g6",children:[(0,N.jsx)(d,{className:"text-heading-semibold text-t9",children:(0,N.jsx)(c,{defaultMessage:"Notifications enabled",id:"SkJDT6Yg8Y"})}),(0,N.jsx)(t,{className:"text-body text-t6",children:(0,N.jsx)(c,{defaultMessage:"You\u2019ll receive notifications when your tasks need attention.",id:"ZG1w2HTdIt"})})]}),(0,N.jsxs)("div",{className:"flex justify-center gap-g4",children:[(0,N.jsx)(v,{variant:"contained",onClick:A,children:(0,N.jsx)(c,{defaultMessage:"Settings",id:"D3idYvSLF9"})}),(0,N.jsx)(v,{variant:"primary",onClick:a,children:(0,N.jsx)(c,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})]})]}),(0,N.jsx)(o,{open:e,onOpenChange:D,children:(0,N.jsxs)(n,{container:I,children:[(0,N.jsx)(l,{className:"fixed inset-0 bg-always-black/50 backdrop-blur-[2px] draggable-none",style:{zIndex:S}}),(0,N.jsx)(r,{className:"epitaxy-root fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[26rem] max-w-[calc(100vw-2rem)] draggable-none outline-none",style:{zIndex:S},children:(0,N.jsx)(x,{children:(0,N.jsxs)("div",{className:"relative isolate rounded-r6 p-[var(--h4)] flex flex-col items-center gap-g8 text-center",children:[(0,N.jsx)(p,{elevation:"popover"}),E]})})})]})})});export{y as EpitaxyNotificationPermissionModal};