import{q as T,E as k,r as _,Q as j,j as e,f as a,G as F,e as s,T as P,U as E,V as L,W as w,X as A,n as N}from"./main-few-lands-burn.js";import{u as G,S as x}from"./usedebou-9GKFiQAC.js";import{I as S}from"./input-Die5vd97.js";import{u as q,R as u,C as i,b as g,P as h,T as M}from"./index-ubWv-fhI.js";import{a as R}from"./index.es-BzDq1rEQ.js";import{T as I}from"./index-CTlEl9RP.js";import{C as z}from"./index-Budcgb8A.js";import{T as B}from"./index-CyNIBchZ.js";import"./lodash-YpNkAOPN.js";import"./index-DAhFlZRY.js";import"./mutative-C6xjlr6O.js";import"./useclosa-m-cf8k_D.js";function D(){return q({queryFn:()=>T("global-settings",void 0,void 0,"GET"),queryKey:["global-settings"],select:n=>n.data})}function K(){return k({mutationFn:n=>T("global-settings/update",n),mutationKey:["update-global-settings"]})}function U(){const{data:n,isLoading:l}=D(),{error:r,isPending:p,mutateAsync:f}=K(),[o,m]=R(n),{messageApi:y}=_.useContext(j),C=G(async t=>{await f(t),y?.success(s("Settings updated successfully"))},500),b=async(t,c)=>{m(d=>{d&&(d[t]=c)}),await f({[t]:c}),y?.success(s("Settings updated successfully"))},v=(t,c)=>{m(d=>{d&&(d[t]=c)}),C({[t]:c})};return _.useEffect(()=>{n&&m(n)},[n,m]),e(u,{children:e(i,{lg:{span:16},children:a(z,{className:"bg-white dark:bg-transparent",children:[a(u,{gutter:20,justify:"space-between",children:[e(i,{span:16,children:a("div",{className:"flex items-start gap-3",children:[e(F,{className:"mt-0.5 shrink-0 text-slate-500",size:20}),a("div",{children:[e(g,{level:5,style:{marginBottom:0},children:s("Notification of Failed Tasks")}),e(h,{type:"secondary",children:s("To receive notification of failed task, this email will be used.")})]})]})}),e(i,{span:8,children:e(x,{checked:o?.notify_user,disabled:l||p,loading:l,onChange:t=>b("notify_user",t)})})]}),o?.notify_user&&a(u,{className:"mt-2",gutter:20,justify:"space-between",children:[e(i,{span:16,children:a("div",{className:"flex items-start gap-3",children:[e("span",{className:"w-6"}),a("div",{children:[e(g,{level:5,style:{marginBottom:0},children:s("Notification Email")}),e(h,{type:"secondary",children:s("To receive notification of failed task, this email will be used.")})]})]})}),e(i,{span:8,children:e(S,{disabled:l,invalidMessage:r?.data?.notification_email?.[0],onChange:t=>v("notification_email",t.target.value),status:r?.data?.notification_email&&"error",type:"email",value:o?.notification_email})})]}),a(u,{className:"mt-2",gutter:20,justify:"space-between",children:[e(i,{span:16,children:a("div",{className:"flex items-start gap-3",children:[e(P,{className:"mt-0.5 shrink-0 text-slate-500",size:20}),a("div",{children:[e(g,{level:5,style:{marginBottom:0},children:s("Preserve Flow Logs")}),e(h,{type:"secondary",children:s("Enter the number of days to retain task logs. For example, entering 30 will remove task history older than 30 days.")})]})]})}),e(i,{span:8,children:e(S,{addonAfter:s("days"),disabled:l,invalidMessage:r?.data?.preserve_logs?.[0],min:0,onChange:t=>v("preserve_logs",t.target.valueAsNumber),status:r?.data?.preserve_logs&&"error",type:"number",value:o?.preserve_logs})})]}),a(u,{className:w("mt-2","cursor-not-allowed opacity-80"),gutter:20,justify:"space-between",children:[e(E,{title:s("This feature is planned and will be available in the future."),children:e(i,{span:16,children:a("div",{className:"flex items-start gap-3",children:[e(L,{className:"mt-0.5 shrink-0 text-slate-500",size:20}),a("div",{children:[a("div",{className:"flex gap-2",children:[e(g,{className:w("mb-0","text-slate-400"),level:5,children:s("Cloud based cron runner")}),e(I,{color:"orange",icon:e(A,{}),children:s("Pro Feature")})]}),e(h,{type:"secondary",children:s("Enable this option to trigger cron jobs from the cloud, ensuring they run more accurately.")})]})]})})}),a(i,{span:8,children:[e(x,{disabled:!N.IS_PRO||l||p,loading:N.IS_PRO&&l,onChange:t=>b("use_cloud_cron",t),value:o?.use_cloud_cron}),r?.data?.use_cloud_cron&&e(M.Text,{className:"inline-block",type:"danger",children:r?.data?.use_cloud_cron?.[0]})]})]})]})})})}const O=[{children:e(U,{}),key:"1",label:s("Flow Settings")}];function se(){return e("div",{className:"p-6",children:e(B,{defaultActiveKey:"1",items:O,tabPosition:"top"})})}export{se as default};
