import{jsx as a,jsxs as r}from"react/jsx-runtime";import{B as m}from"./button-BvFBRYHq.js";import{D as f,a as N,b as k,c as q,d as D,e as w}from"./dialog-BfGkTFdF.js";import{I as c}from"./input-qMvM9qch.js";import{L as i}from"./label-DMnntKPk.js";import{Plus as P,Folder as x,X as C,Loader2 as B,Save as L}from"lucide-react";import{useState as F}from"react";import"@radix-ui/react-slot";import"class-variance-authority";import"./utils-CMbmcP35.js";import"clsx";import"tailwind-merge";import"@radix-ui/react-dialog";import"@radix-ui/react-label";function _({open:n,onOpenChange:t,settings:e,onSettingsChange:o,onSave:y,saving:h}){const[d,p]=F(""),u=()=>{d.trim()&&(o({...e,customPaths:[...e.customPaths,d.trim()]}),p(""))},v=l=>{o({...e,customPaths:e.customPaths.filter((s,b)=>b!==l)})};return a(f,{open:n,onOpenChange:t,children:r(N,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r(k,{children:[a(q,{children:"Backup Settings"}),a(D,{children:"Configure MySQL connection and custom backup paths"})]}),r("div",{className:"space-y-4 py-4",children:[r("div",{children:[a(i,{htmlFor:"backupDirectory",children:"Backup Directory"}),a(c,{id:"backupDirectory",value:e.backupDirectory,onChange:l=>o({...e,backupDirectory:l.target.value}),placeholder:"/path/to/backups",className:"mt-1"})]}),r("div",{className:"space-y-2",children:[a(i,{children:"MySQL Configuration"}),r("div",{className:"grid grid-cols-2 gap-2",children:[a(c,{value:e.mysql.host,onChange:l=>o({...e,mysql:{...e.mysql,host:l.target.value}}),placeholder:"Host"}),a(c,{value:e.mysql.port,onChange:l=>o({...e,mysql:{...e.mysql,port:l.target.value}}),placeholder:"Port"}),a(c,{value:e.mysql.database,onChange:l=>o({...e,mysql:{...e.mysql,database:l.target.value}}),placeholder:"Database"}),a(c,{value:e.mysql.username,onChange:l=>o({...e,mysql:{...e.mysql,username:l.target.value}}),placeholder:"Username"})]}),a(c,{type:"password",value:e.mysql.password,onChange:l=>o({...e,mysql:{...e.mysql,password:l.target.value}}),placeholder:"Password"})]}),r("div",{className:"space-y-2",children:[a(i,{children:"Custom Backup Paths"}),r("div",{className:"flex gap-2",children:[a(c,{value:d,onChange:l=>p(l.target.value),placeholder:"e.g., /home/gamedbd/dbhomewdb",onKeyPress:l=>l.key==="Enter"&&u()}),a(m,{type:"button",onClick:u,variant:"outline",size:"icon",children:a(P,{className:"h-4 w-4"})})]}),a("div",{className:"space-y-2 mt-2",children:e.customPaths.map((l,s)=>r("div",{className:"flex items-center gap-2 p-2 border rounded-md",children:[a(x,{className:"h-4 w-4 text-muted-foreground"}),a("span",{className:"flex-1 text-sm",children:l}),a(m,{type:"button",onClick:()=>v(s),variant:"ghost",size:"sm",children:a(C,{className:"h-4 w-4"})})]},s))})]})]}),r(w,{children:[a(m,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r(m,{onClick:y,disabled:h,children:[h?a(B,{className:"h-4 w-4 mr-2 animate-spin"}):a(L,{className:"h-4 w-4 mr-2"}),"Save Settings"]})]})]})})}export{_ as BackupSettingsDialog};
