import{r as l,l as lt,j as e,L as ee,D as o,a as at,c as nt,s as it,b as ct,d as Pe,e as rt,f as te,h as Ee,i as ot,k as dt,m as mt,n as ht,o as ut,u as xt,p as pt,q as jt}from"./index-Cvh4tLHo.js";import{M as n}from"./Modal-CCihVZTY.js";import{A as F}from"./AdminAlert-Bt3L8_zJ.js";import{A as _}from"./AdminButton-BKglG8kI.js";import{A as bt}from"./AdminTable-BQ5Lf7EC.js";import{E as Te}from"./EmptyState-D6lCh4WN.js";import{P as se}from"./PageHeader-D6k34vvM.js";function gt(d){return{74:"7.4",80:"8.0",81:"8.1",82:"8.2"}[d]||d}function wt(){const[d,le]=l.useState([]),[Re,ae]=l.useState(!0),[P,c]=l.useState(""),[De,E]=l.useState(!1),[ne,ie]=l.useState(!1),[ce,M]=l.useState(""),[j,T]=l.useState(null),[re,$]=l.useState([]),[G,R]=l.useState(!1),[q,D]=l.useState(null),[i,m]=l.useState(null),[oe,de]=l.useState(!1),[me,C]=l.useState(""),[he,ue]=l.useState(null),[g,W]=l.useState(null),[xe,U]=l.useState([]),[O,V]=l.useState(""),[Q,K]=l.useState(""),[pe,je]=l.useState(301),[Ie,be]=l.useState(!1),[w,v]=l.useState(null),[J,ge]=l.useState(""),[fe,Ne]=l.useState("main"),[I,b]=l.useState(null),[L,H]=l.useState(!1),[B,Le]=l.useState(""),[h,A]=l.useState(()=>new Set),[f,z]=l.useState(1),[S,He]=l.useState(25),[ve,Se]=l.useState(null),[X,ye]=l.useState(!1),[ke,Ce]=l.useState(null),u=()=>{ae(!0),at().then(le).catch(t=>c(t.message)).finally(()=>ae(!1))};l.useEffect(()=>{u()},[]),l.useEffect(()=>{lt().then(t=>{const s=t.services.find(a=>a.id==="nginx");Se((s==null?void 0:s.status)??null)}).catch(()=>Se(null))},[]);const y=l.useMemo(()=>{const t=B.trim().toLowerCase();return t?d.filter(s=>[s.name,s.path,s.ps,s.primary_domain,...s.domains||[]].join(" ").toLowerCase().includes(t)):d},[d,B]);l.useEffect(()=>z(1),[B,S]);const k=Math.max(1,Math.ceil(y.length/S)),N=l.useMemo(()=>{const t=(f-1)*S;return y.slice(t,t+S)},[y,f,S]);l.useEffect(()=>{f>k&&z(k)},[f,k]);const Ae=t=>{A(s=>{const a=new Set(s);return a.has(t)?a.delete(t):a.add(t),a})},ze=()=>{const t=new Set(N.map(a=>a.id)),s=N.length>0&&N.every(a=>h.has(a.id));A(s?a=>{const r=new Set(a);return N.forEach(x=>r.delete(x.id)),r}:a=>new Set([...a,...t]))},Y=async t=>{const s=[...h];if(s.length===0)return;const a=t==="delete"?`Delete ${s.length} site(s)? This cannot be undone.`:`${t==="enable"?"Enable":"Disable"} ${s.length} site(s)?`;if(confirm(a)){ye(!0);try{const x=(await it(t,s)).results.filter(p=>!p.ok);x.length?c(x.map(p=>`${p.id}: ${p.msg}`).join("; ")):c(""),A(new Set),u()}catch(r){c(r instanceof Error?r.message:"Batch failed")}finally{ye(!1)}}},Fe=t=>{Ce(t),Pe(t).then(()=>u()).catch(s=>c(s.message)).finally(()=>Ce(null))},Me=t=>{var Be,_e;t.preventDefault();const s=t.currentTarget,a=s.elements.namedItem("name").value.trim(),r=s.elements.namedItem("domains").value.trim(),x=s.elements.namedItem("path").value.trim(),p=s.elements.namedItem("ps").value.trim();if(!a||!r){M("Name and domain(s) are required");return}const Z=r.split(/[\s,]+/).filter(Boolean),et=((Be=s.elements.namedItem("php_version"))==null?void 0:Be.value)||"74",tt=((_e=s.elements.namedItem("force_https"))==null?void 0:_e.checked)||!1;ie(!0),M(""),nt({name:a,domains:Z,path:x||void 0,ps:p||void 0,php_version:et,force_https:tt}).then(()=>{E(!1),s.reset(),u()}).catch(st=>M(st.message)).finally(()=>ie(!1))},$e=(t,s)=>{confirm(`Delete site "${s}"? This cannot be undone.`)&&ot(t).then(u).catch(a=>c(a.message))},Ge=t=>{T(t),$([]),Ee(t).then(s=>$(s.backups)).catch(s=>c(s.message))},qe=()=>{j&&(R(!0),Pe(j).then(()=>Ee(j).then(t=>$(t.backups))).catch(t=>c(t.message)).finally(()=>R(!1)))},We=t=>{!j||!confirm(`Restore from ${t}? This will overwrite existing files.`)||(R(!0),jt(j,t).then(()=>T(null)).catch(s=>c(s.message)).finally(()=>R(!1)))},Ue=t=>{j&&pt(j,t).catch(s=>c(s.message))},Oe=t=>{D(t),C(""),rt(t).then(s=>m({domains:(s.domains||[]).join(", "),path:s.path||"",ps:s.ps||"",php_version:s.php_version||"74",force_https:!!(s.force_https&&s.force_https!==0)})).catch(s=>C(s.message))},Ve=t=>{if(t.preventDefault(),!q||!i)return;const s=i.domains.split(/[\s,]+/).filter(Boolean);if(s.length===0){C("At least one domain is required");return}de(!0),C(""),xt(q,{domains:s,path:i.path||void 0,ps:i.ps||void 0,php_version:i.php_version,force_https:i.force_https}).then(()=>{D(null),m(null),u()}).catch(a=>C(a.message)).finally(()=>de(!1))},we=(t,s)=>{ue(t),ct(t,s).then(u).catch(a=>c(a.message)).finally(()=>ue(null))},Qe=t=>{W(t),V(""),K(""),je(301),te(t).then(U).catch(s=>c(s.message))},Ke=t=>{t.preventDefault(),!(!g||!O.trim()||!Q.trim())&&(be(!0),ht(g,O.trim(),Q.trim(),pe).then(()=>te(g).then(U)).then(()=>{V(""),K("")}).catch(s=>c(s.message)).finally(()=>be(!1)))},Je=t=>{g&&ut(g,t).then(()=>te(g).then(U)).catch(s=>c(s.message))},Xe=t=>{t.preventDefault(),!(!w||!J.trim())&&(H(!0),dt(w,J.trim(),fe.trim()||"main").then(()=>{v(null),b(null),u()}).catch(s=>c(s.message)).finally(()=>H(!1)))},Ye=()=>{w&&(H(!0),mt(w).then(()=>{v(null),b(null),u()}).catch(t=>c(t.message)).finally(()=>H(!1)))},Ze=t=>t<1024?t+" B":t<1024*1024?(t/1024).toFixed(1)+" KB":(t/1024/1024).toFixed(1)+" MB";return Re?e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Website"}),e.jsx("div",{className:"text-center py-5 text-muted",children:"Loading…"})]}):P&&!d.length?e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Website"}),e.jsx(F,{variant:"danger",children:P})]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{title:"Website",actions:e.jsxs(_,{onClick:()=>E(!0),children:[e.jsx("i",{className:"ti ti-plus me-1"}),"Add Site"]})}),P?e.jsx(F,{variant:"warning",children:P}):null,e.jsxs(n,{show:De,onHide:()=>E(!1),centered:!0,children:[e.jsx(n.Header,{closeButton:!0,children:e.jsx(n.Title,{children:"Create Site"})}),e.jsxs("form",{onSubmit:Me,children:[e.jsxs(n.Body,{children:[ce?e.jsx(F,{variant:"danger",children:ce}):null,e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Site Name"}),e.jsx("input",{name:"name",type:"text",placeholder:"example.com",className:"form-control",required:!0})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Domain(s) (comma or space separated)"}),e.jsx("input",{name:"domains",type:"text",placeholder:"example.com www.example.com",className:"form-control",required:!0})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Path (optional)"}),e.jsx("input",{name:"path",type:"text",placeholder:"/www/wwwroot/example.com",className:"form-control"})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"PHP Version"}),e.jsxs("select",{name:"php_version",className:"form-select",children:[e.jsx("option",{value:"74",children:"7.4"}),e.jsx("option",{value:"80",children:"8.0"}),e.jsx("option",{value:"81",children:"8.1"}),e.jsx("option",{value:"82",children:"8.2"})]})]}),e.jsxs("div",{className:"form-check mb-3",children:[e.jsx("input",{name:"force_https",type:"checkbox",id:"create_force_https",className:"form-check-input"}),e.jsx("label",{htmlFor:"create_force_https",className:"form-check-label",children:"Force HTTPS (redirect HTTP to HTTPS)"})]}),e.jsxs("div",{className:"mb-0",children:[e.jsx("label",{className:"form-label",children:"Note (optional)"}),e.jsx("input",{name:"ps",type:"text",placeholder:"My website",className:"form-control"})]})]}),e.jsxs(n.Footer,{children:[e.jsx("button",{type:"button",className:"btn btn-light",onClick:()=>E(!1),children:"Cancel"}),e.jsx("button",{type:"submit",disabled:ne,className:"btn btn-primary",children:ne?"Creating…":"Create"})]})]})]}),e.jsx("div",{className:"card shadow-sm border-0 mb-3",children:e.jsx("div",{className:"card-body py-3",children:e.jsxs("div",{className:"row g-2 align-items-center",children:[e.jsx("div",{className:"col-md-4",children:e.jsxs("div",{className:"input-group input-group-sm",children:[e.jsx("span",{className:"input-group-text",children:e.jsx("i",{className:"ti ti-search","aria-hidden":!0})}),e.jsx("input",{type:"search",className:"form-control",placeholder:"Site name, domain, path, or note…",value:B,onChange:t=>Le(t.target.value),"aria-label":"Search sites"})]})}),e.jsx("div",{className:"col-md-5",children:e.jsxs("div",{className:"d-flex flex-wrap gap-2 align-items-center",children:[e.jsx(_,{variant:"secondary",size:"sm",onClick:()=>Y("enable"),disabled:X||h.size===0,children:"Enable"}),e.jsx(_,{variant:"secondary",size:"sm",onClick:()=>Y("disable"),disabled:X||h.size===0,children:"Disable"}),e.jsx(_,{variant:"danger",size:"sm",onClick:()=>Y("delete"),disabled:X||h.size===0,children:"Delete"}),e.jsx("span",{className:"text-secondary small ms-md-2",children:h.size>0?`${h.size} selected`:""})]})}),e.jsxs("div",{className:"col-md-3 text-md-end",children:[e.jsxs("span",{className:`badge ${ve==="active"?"bg-success":"bg-secondary"} me-2`,title:"Nginx (systemd)",children:["Nginx ",ve??"—"]}),e.jsxs("select",{className:"form-select form-select-sm d-inline-block w-auto",value:S,onChange:t=>He(Number(t.target.value)),"aria-label":"Rows per page",children:[e.jsx("option",{value:10,children:"10 / page"}),e.jsx("option",{value:25,children:"25 / page"}),e.jsx("option",{value:50,children:"50 / page"})]})]})]})})}),e.jsxs("div",{className:"card shadow-sm border-0",children:[e.jsx("div",{className:"card-body p-0",children:e.jsxs(bt,{children:[e.jsx("thead",{className:"table-light",children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:40},children:e.jsx("input",{type:"checkbox",className:"form-check-input",checked:N.length>0&&N.every(t=>h.has(t.id)),onChange:ze,"aria-label":"Select all on page"})}),e.jsx("th",{children:"Site"}),e.jsx("th",{className:"text-center",children:"Status"}),e.jsx("th",{children:"Backup"}),e.jsx("th",{className:"text-center",children:"Quick"}),e.jsx("th",{className:"text-center",children:"PHP"}),e.jsx("th",{children:"SSL"}),e.jsx("th",{className:"d-none d-xl-table-cell",children:"Note"}),e.jsx("th",{className:"text-end",children:"Operate"})]})}),e.jsx("tbody",{children:d.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"p-0",children:e.jsx(Te,{title:"No sites yet",description:'Click "Add Site" to create one.'})})}):y.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"p-0",children:e.jsx(Te,{title:"No matches",description:"Try a different search."})})}):N.map(t=>{var s,a,r,x,p;return e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",onClick:Z=>Z.stopPropagation(),children:e.jsx("input",{type:"checkbox",className:"form-check-input",checked:h.has(t.id),onChange:()=>Ae(t.id),"aria-label":`Select ${t.name}`})}),e.jsx("td",{className:"align-middle",children:e.jsxs("div",{className:"d-flex align-items-start gap-2",children:[t.primary_domain?e.jsx("a",{href:`https://${t.primary_domain.split(":")[0]}`,target:"_blank",rel:"noreferrer",className:"text-decoration-none",title:"Open site",children:e.jsx("i",{className:"ti ti-external-link text-muted","aria-hidden":!0})}):null,e.jsxs("div",{className:"small",children:[e.jsx("div",{className:"fw-medium",children:t.primary_domain||t.name}),e.jsxs("div",{className:"text-muted text-truncate",style:{maxWidth:220},title:t.path,children:[t.project_type," · ",t.path]})]})]})}),e.jsx("td",{className:"align-middle text-center",children:t.status===1?e.jsx("button",{type:"button",onClick:()=>we(t.id,!1),disabled:he===t.id,className:"btn btn-sm btn-link text-success p-0",title:"Running — click to stop",children:e.jsx("i",{className:"ti ti-player-play"})}):e.jsx("button",{type:"button",onClick:()=>we(t.id,!0),disabled:he===t.id,className:"btn btn-sm btn-link text-secondary p-0",title:"Stopped — click to start",children:e.jsx("i",{className:"ti ti-player-stop"})})}),e.jsxs("td",{className:"align-middle small",children:[e.jsx("span",{className:"me-2",children:t.backup_count}),e.jsx("button",{type:"button",className:"btn btn-link btn-sm text-danger p-0 text-decoration-none",onClick:()=>Fe(t.id),disabled:ke===t.id,children:ke===t.id?"…":"Backup now"})]}),e.jsx("td",{className:"align-middle text-center text-nowrap",children:e.jsx(ee,{to:`/files?path=${encodeURIComponent(t.path)}`,className:"btn btn-sm btn-light border",title:"Site directory",children:e.jsx("i",{className:"ti ti-folder"})})}),e.jsx("td",{className:"align-middle text-center small",children:e.jsx("span",{className:"badge bg-light text-dark border",children:gt(t.php_version||"74")})}),e.jsx("td",{className:"align-middle small",children:(((s=t.ssl)==null?void 0:s.status)??"none")==="none"?e.jsx("span",{className:"text-warning",children:"Not set"}):((a=t.ssl)==null?void 0:a.status)==="expired"?e.jsx("span",{className:"text-danger",children:"Expired"}):((r=t.ssl)==null?void 0:r.status)==="expiring"?e.jsxs("span",{className:"text-warning",children:[((x=t.ssl)==null?void 0:x.days_left)??0,"d left"]}):e.jsxs("span",{className:"text-success",children:[((p=t.ssl)==null?void 0:p.days_left)??0," days"]})}),e.jsx("td",{className:"align-middle small text-muted d-none d-xl-table-cell text-truncate",style:{maxWidth:140},title:t.ps,children:t.ps||"—"}),e.jsx("td",{className:"align-middle text-end",children:e.jsxs(o,{align:"end",children:[e.jsx(o.Toggle,{variant:"light",size:"sm",className:"py-0 border",children:"More"}),e.jsxs(o.Menu,{children:[e.jsxs(o.Item,{onClick:()=>Oe(t.id),children:[e.jsx("i",{className:"ti ti-settings me-2"}),"Config"]}),e.jsxs(o.Item,{as:ee,to:"/logs",children:[e.jsx("i",{className:"ti ti-file-text me-2"}),"Logs"]}),e.jsxs(o.Item,{as:ee,to:"/ssl_domain",children:[e.jsx("i",{className:"ti ti-shield-lock me-2"}),"SSL / Domains"]}),e.jsx(o.Divider,{}),e.jsxs(o.Item,{onClick:()=>{v(t.id),b("clone"),ge(""),Ne("main")},children:[e.jsx("i",{className:"ti ti-git-branch me-2"}),"Git"]}),e.jsxs(o.Item,{onClick:()=>Qe(t.id),children:[e.jsx("i",{className:"ti ti-arrows-right-left me-2"}),"Redirects"]}),e.jsxs(o.Item,{onClick:()=>Ge(t.id),children:[e.jsx("i",{className:"ti ti-archive me-2"}),"Backups"]}),e.jsx(o.Divider,{}),e.jsxs(o.Item,{className:"text-danger",onClick:()=>$e(t.id,t.name),children:[e.jsx("i",{className:"ti ti-trash me-2"}),"Delete"]})]})]})})]},t.id)})})]})}),d.length>0&&y.length>0?e.jsxs("div",{className:"card-footer py-2 d-flex flex-wrap align-items-center justify-content-between gap-2 small text-secondary",children:[e.jsxs("span",{children:["Total ",e.jsx("strong",{children:y.length})," site(s)",B.trim()?` (filtered from ${d.length})`:""]}),e.jsxs("div",{className:"d-flex align-items-center gap-2",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-outline-secondary",disabled:f<=1,onClick:()=>z(t=>Math.max(1,t-1)),children:"Prev"}),e.jsxs("span",{children:["Page ",f," / ",k]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-outline-secondary",disabled:f>=k,onClick:()=>z(t=>Math.min(k,t+1)),children:"Next"})]})]}):null]}),e.jsxs(n,{show:!!w&&!!I,onHide:()=>{v(null),b(null)},centered:!0,children:[e.jsx(n.Header,{closeButton:!0,children:e.jsx(n.Title,{children:"Git Deploy"})}),e.jsxs(n.Body,{children:[e.jsxs("div",{className:"btn-group mb-3",role:"group",children:[e.jsx("button",{type:"button",className:`btn btn-sm ${I==="clone"?"btn-success":"btn-outline-secondary"}`,onClick:()=>b("clone"),children:"Clone"}),e.jsx("button",{type:"button",className:`btn btn-sm ${I==="pull"?"btn-success":"btn-outline-secondary"}`,onClick:()=>b("pull"),children:"Pull"})]}),I==="clone"?e.jsxs("form",{onSubmit:Xe,children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Repository URL"}),e.jsx("input",{value:J,onChange:t=>ge(t.target.value),placeholder:"https://github.com/user/repo.git",className:"form-control",required:!0})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Branch"}),e.jsx("input",{value:fe,onChange:t=>Ne(t.target.value),placeholder:"main",className:"form-control"})]}),e.jsx("p",{className:"small text-muted",children:"Site path must be empty for clone."}),e.jsxs("div",{className:"d-flex justify-content-end gap-2",children:[e.jsx("button",{type:"button",className:"btn btn-light",onClick:()=>{v(null),b(null)},children:"Cancel"}),e.jsx("button",{type:"submit",disabled:L,className:"btn btn-success",children:L?"Cloning…":"Clone"})]})]}):e.jsxs("div",{children:[e.jsx("p",{className:"text-muted small",children:"Pull latest changes from the remote repository."}),e.jsxs("div",{className:"d-flex justify-content-end gap-2",children:[e.jsx("button",{type:"button",className:"btn btn-light",onClick:()=>{v(null),b(null)},children:"Cancel"}),e.jsx("button",{type:"button",onClick:Ye,disabled:L,className:"btn btn-success",children:L?"Pulling…":"Pull"})]})]})]})]}),e.jsxs(n,{show:g!=null,onHide:()=>W(null),size:"lg",centered:!0,scrollable:!0,children:[e.jsx(n.Header,{closeButton:!0,children:e.jsx(n.Title,{children:"Redirects"})}),e.jsxs(n.Body,{children:[e.jsxs("form",{onSubmit:Ke,className:"row g-2 align-items-end mb-3",children:[e.jsxs("div",{className:"col-md-3",children:[e.jsx("label",{className:"form-label small",children:"Source"}),e.jsx("input",{value:O,onChange:t=>V(t.target.value),placeholder:"/old-path",className:"form-control form-control-sm"})]}),e.jsxs("div",{className:"col-md-3",children:[e.jsx("label",{className:"form-label small",children:"Target"}),e.jsx("input",{value:Q,onChange:t=>K(t.target.value),placeholder:"/new-path",className:"form-control form-control-sm"})]}),e.jsxs("div",{className:"col-md-2",children:[e.jsx("label",{className:"form-label small",children:"Code"}),e.jsxs("select",{value:pe,onChange:t=>je(Number(t.target.value)),className:"form-select form-select-sm",children:[e.jsx("option",{value:301,children:"301"}),e.jsx("option",{value:302,children:"302"})]})]}),e.jsx("div",{className:"col-md-2",children:e.jsx("button",{type:"submit",disabled:Ie,className:"btn btn-primary btn-sm w-100",children:"Add"})})]}),xe.length===0?e.jsx("p",{className:"text-muted small mb-0",children:"No redirects"}):e.jsx("ul",{className:"list-group list-group-flush",children:xe.map(t=>e.jsxs("li",{className:"list-group-item d-flex align-items-center gap-2 small",children:[e.jsx("code",{className:"text-truncate",children:t.source}),e.jsx("span",{className:"text-muted",children:"→"}),e.jsx("code",{className:"text-truncate flex-grow-1",children:t.target}),e.jsx("span",{className:"badge bg-secondary",children:t.code}),e.jsx("button",{type:"button",className:"btn btn-sm btn-link text-danger p-0",onClick:()=>Je(t.id),children:e.jsx("i",{className:"ti ti-trash"})})]},t.id))})]}),e.jsx(n.Footer,{children:e.jsx("button",{type:"button",className:"btn btn-light",onClick:()=>W(null),children:"Close"})})]}),e.jsxs(n,{show:q!=null&&i!=null,onHide:()=>{D(null),m(null)},centered:!0,children:[e.jsx(n.Header,{closeButton:!0,children:e.jsx(n.Title,{children:"Edit Site"})}),i?e.jsxs("form",{onSubmit:Ve,children:[e.jsxs(n.Body,{children:[me?e.jsx(F,{variant:"danger",children:me}):null,e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Domain(s)"}),e.jsx("input",{value:i.domains,onChange:t=>m({...i,domains:t.target.value}),type:"text",className:"form-control",required:!0})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"Path (optional)"}),e.jsx("input",{value:i.path,onChange:t=>m({...i,path:t.target.value}),type:"text",className:"form-control"})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"form-label",children:"PHP Version"}),e.jsxs("select",{value:i.php_version,onChange:t=>m({...i,php_version:t.target.value}),className:"form-select",children:[e.jsx("option",{value:"74",children:"7.4"}),e.jsx("option",{value:"80",children:"8.0"}),e.jsx("option",{value:"81",children:"8.1"}),e.jsx("option",{value:"82",children:"8.2"})]})]}),e.jsxs("div",{className:"form-check mb-3",children:[e.jsx("input",{type:"checkbox",id:"edit_force_https",className:"form-check-input",checked:i.force_https,onChange:t=>m({...i,force_https:t.target.checked})}),e.jsx("label",{htmlFor:"edit_force_https",className:"form-check-label",children:"Force HTTPS"})]}),e.jsxs("div",{className:"mb-0",children:[e.jsx("label",{className:"form-label",children:"Note (optional)"}),e.jsx("input",{value:i.ps,onChange:t=>m({...i,ps:t.target.value}),type:"text",className:"form-control"})]})]}),e.jsxs(n.Footer,{children:[e.jsx("button",{type:"button",className:"btn btn-light",onClick:()=>{D(null),m(null)},children:"Cancel"}),e.jsx("button",{type:"submit",disabled:oe,className:"btn btn-primary",children:oe?"Saving…":"Save"})]})]}):null]}),e.jsxs(n,{show:j!=null,onHide:()=>T(null),size:"lg",centered:!0,children:[e.jsx(n.Header,{closeButton:!0,children:e.jsx(n.Title,{children:"Site Backup"})}),e.jsxs(n.Body,{children:[e.jsx("div",{className:"mb-3",children:e.jsxs(_,{onClick:qe,disabled:G,children:[e.jsx("i",{className:"ti ti-archive me-1"}),G?"Creating…":"Create Backup"]})}),e.jsx("h6",{className:"text-muted small",children:"Existing backups"}),re.length===0?e.jsx("p",{className:"text-muted small",children:"No backups yet"}):e.jsx("ul",{className:"list-group list-group-flush",children:re.map(t=>e.jsxs("li",{className:"list-group-item d-flex align-items-center justify-content-between gap-2",children:[e.jsx("code",{className:"small text-truncate flex-grow-1",children:t.filename}),e.jsx("span",{className:"text-muted small",children:Ze(t.size)}),e.jsx("button",{type:"button",className:"btn btn-sm btn-link",onClick:()=>Ue(t.filename),title:"Download",children:e.jsx("i",{className:"ti ti-download"})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-link text-warning",onClick:()=>We(t.filename),disabled:G,children:e.jsx("i",{className:"ti ti-restore"})})]},t.filename))})]}),e.jsx(n.Footer,{children:e.jsx("button",{type:"button",className:"btn btn-light",onClick:()=>T(null),children:"Close"})})]})]})}export{wt as SitePage};