PageSourceSearch

https://v3.quickbox.io/_next/static/chunks/71112-5f1691829be15fc5.js

js quickbox.io collected 2026-09-24 10:05:50 UTC 58,244 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[71112],{2595:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(95155),r=s(12115);function i(e){let{value:t,onChange:s,min:i,max:o,step:l=1,placeholder:n="0",className:c="",disabled:d=!1,prefix:x,suffix:m,decimals:h=2,allowNegative:p=!0}=e,[u,b]=(0,r.useState)(!1),g=(0,r.useRef)(null),f=e=>{if(""===e||"-"===e)return 0;let t="string"==typeof e?parseFloat(e):e;return isNaN(t)?0:t},w=e=>0===h?Math.round(e).toString():e.toFixed(h),j=e=>{let t=e;return void 0!==i&&t<i&&(t=i),void 0!==o&&t>o&&(t=o),t},y=()=>{d||s(w(j(f(t)+l)))},v=()=>{d||s(w(j(f(t)-l)))};return(0,a.jsxs)("div",{className:"relative rounded-lg ".concat(c),children:[x&&(0,a.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none select-none",children:x}),(0,a.jsx)("input",{ref:g,type:"text",inputMode:"decimal",value:t,onChange:e=>{let t=e.target.value;if(""===t||p&&"-"===t)return void s(t);(p?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/).test(t)&&s(t)},onFocus:()=>b(!0),onBlur:()=>{if(b(!1),""===t||"-"===t)return void s(void 0!==i?w(i):"0");s(w(j(f(t))))},onKeyDown:e=>{d||("ArrowUp"===e.key?(e.preventDefault(),y()):"ArrowDown"===e.key&&(e.preventDefault(),v()))},placeholder:n,disabled:d,className:"\n          w-full py-3 bg-black/30 border rounded-lg\n          focus:outline-none focus:border-[#26AE7F] focus:ring-1 focus:ring-[#26AE7F]\n          transition-all text-white\n          disabled:opacity-50 disabled:cursor-not-allowed\n          ".concat(x?"pl-8":"pl-4","\n          ").concat(m?"pr-24":"pr-16","\n          ").concat(u?"border-[#26AE7F]":"border-white/10","\n        ")}),m&&(0,a.jsx)("span",{className:"absolute right-16 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none select-none text-sm",children:m}),(0,a.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex flex-col gap-0.5",children:[(0,a.jsx)("button",{type:"button",onClick:y,disabled:d||void 0!==o&&f(t)>=o,className:" w-10 h-5 flex items-center justify-center bg-white/5 hover:bg-[#26AE7F]/20 border border-white/10 hover:border-[#26AE7F]/30 rounded transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-white/5 disabled:hover:border-white/10 group ",tabIndex:-1,children:(0,a.jsx)("svg",{className:"w-3 h-3 text-gray-400 group-hover:text-[#26AE7F] transition-colors group-disabled:group-hover:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 15l7-7 7 7"})})}),(0,a.jsx)("button",{type:"button",onClick:v,disabled:d||void 0!==i&&f(t)<=i,className:" w-10 h-5 flex items-center justify-center bg-white/5 hover:bg-[#26AE7F]/20 border border-white/10 hover:border-[#26AE7F]/30 rounded transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-white/5 disabled:hover:border-white/10 group ",tabIndex:-1,children:(0,a.jsx)("svg",{className:"w-3 h-3 text-gray-400 group-hover:text-[#26AE7F] transition-colors group-disabled:group-hover:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M19 9l-7 7-7-7"})})})]})]})}},71112:(e,t,s)=>{s.r(t),s.d(t,{default:()=>w});var a=s(95155),r=s(12115),i=s(20063),o=s(58261),l=s(96199),n=s(15927),c=s(26497),d=s(4496),x=s(2595),m=s(12769);function h(e){let{value:t,onChange:s,className:i="",disabled:o=!1,use24Hour:l=!0,minuteStep:d=5}=e,[x,m]=(0,r.useState)(!1),h=(0,r.useRef)(null),p=(0,r.useRef)(null),u=(0,r.useRef)(null),{hour:b,minute:g,period:f}=(e=>{let[t,s]=e.split(":"),a=parseInt(t,10)||0,r=parseInt(s,10)||0,i="AM";return!l&&(a>=12?(i="PM",a>12&&(a-=12)):0===a&&(a=12)),{hour:a,minute:r,period:i}})(t),w=l?Array.from({length:24},(e,t)=>t):Array.from({length:12},(e,t)=>0===t?12:t),j=Array.from({length:60/d},(e,t)=>t*d);(0,r.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&m(!1)};return x&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[x]),(0,r.useEffect)(()=>{x&&setTimeout(()=>{if(p.current){let e=l?b:12===b?0:b;p.current.scrollTop=Math.max(0,40*e-80)}if(u.current){let e=Math.floor(g/d);u.current.scrollTop=Math.max(0,40*e-80)}},50)},[x,b,g,d,l]);let y=(0,r.useCallback)((e,t,a)=>{let r=e;l||("PM"===a&&12!==e?r=e+12:"AM"===a&&12===e&&(r=0)),s("".concat(r.toString().padStart(2,"0"),":").concat(t.toString().padStart(2,"0")))},[s,l]),v=()=>l?"".concat(b.toString().padStart(2,"0"),":").concat(g.toString().padStart(2,"0")):"".concat(b,":").concat(g.toString().padStart(2,"0")," ").concat(f);return(0,a.jsxs)("div",{ref:h,className:"relative ".concat(i),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>!o&&m(!x),disabled:o,className:"\n          w-full px-4 py-2.5 flex items-center justify-between gap-3\n          bg-white/5 border border-white/10 rounded-lg\n          text-left text-sm transition-all duration-200\n          ".concat(o?"opacity-50 cursor-not-allowed":"hover:border-white/20 focu
1s:outline-none focus:ring-2 focus:ring-[#26AE7F]/50","\n          ").concat(x?"ring-2 ring-[#26AE7F]/50":"","\n        "),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-white/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("span",{className:"text-white",children:v()})]}),(0,a.jsx)(n.P.svg,{animate:{rotate:180*!!x},transition:{duration:.2},className:"w-4 h-4 text-white/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(0,a.jsx)(c.N,{children:x&&(0,a.jsxs)(n.P.div,{initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},transition:{duration:.15},className:"absolute z-50 mt-2 w-full min-w-[280px] bg-[#0e1726] border border-white/10 rounded-xl shadow-2xl overflow-hidden",children:[(0,a.jsx)("div",{className:"px-4 py-3 border-b border-white/10 bg-white/[0.02]",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white/50 uppercase tracking-wider font-semibold",children:"Select Time"}),(0,a.jsx)("span",{className:"text-lg font-bold text-[#26AE7F]",children:v()})]})}),(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsxs)("div",{className:"flex-1 border-r border-white/10",children:[(0,a.jsx)("div",{className:"px-3 py-2 text-xs text-white/40 uppercase tracking-wider font-semibold text-center bg-white/[0.02]",children:"Hour"}),(0,a.jsx)("div",{ref:p,className:"h-48 overflow-y-auto scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent hover:scrollbar-thumb-white/20",children:w.map(e=>{let t=e===b;return(0,a.jsx)("button",{type:"button",onClick:()=>y(e,g,f),className:"\n                          w-full py-2.5 text-center text-sm font-medium transition-all duration-150\n                          ".concat(t?"bg-[#26AE7F] text-[#060818] font-bold":"text-white/80 hover:bg-white/5 hover:text-[#2aebcb]","\n                        "),children:l?e.toString().padStart(2,"0"):e.toString()},e)})})]}),(0,a.jsxs)("div",{className:"flex-1 ".concat(l?"":"border-r border-white/10"),children:[(0,a.jsx)("div",{className:"px-3 py-2 text-xs text-white/40 uppercase tracking-wider font-semibold text-center bg-white/[0.02]",children:"Min"}),(0,a.jsx)("div",{ref:u,className:"h-48 overflow-y-auto scrollbar-thin scrollbar-thumb-white/10 scrollbar-track-transparent hover:scrollbar-thumb-white/20",children:j.map(e=>{let t=e===g;return(0,a.jsx)("button",{type:"button",onClick:()=>y(b,e,f),className:"\n                          w-full py-2.5 text-center text-sm font-medium transition-all duration-150\n                          ".concat(t?"bg-[#26AE7F] text-[#060818] font-bold":"text-white/80 hover:bg-white/5 hover:text-[#2aebcb]","\n                        "),children:e.toString().padStart(2,"0")},e)})})]}),!l&&(0,a.jsxs)("div",{className:"w-20",children:[(0,a.jsx)("div",{className:"px-3 py-2 text-xs text-white/40 uppercase tracking-wider font-semibold text-center bg-white/[0.02]",children:"\xa0"}),(0,a.jsx)("div",{className:"h-48 flex flex-col justify-center gap-2 px-2",children:["AM","PM"].map(e=>{let t=e===f;return(0,a.jsx)("button",{type:"button",onClick:()=>y(b,g,e),className:"\n                            w-full py-3 rounded-lg text-sm font-bold transition-all duration-150\n                            ".concat(t?"bg-[#26AE7F] text-[#060818]":"bg-white/5 text-white/60 hover:bg-white/10 hover:text-white","\n                          "),children:e},e)})})]})]}),(0,a.jsx)("div",{className:"px-3 py-3 border-t border-white/10 bg-white/[0.02]",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:[{label:"Midnight",time:"00:00"},{label:"3 AM",time:"03:00"},{label:"6 AM",time:"06:00"},{label:"Noon",time:"12:00"},{label:"6 PM",time:"18:00"}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>{s(e.time),m(!1)},className:"\n                      px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150\n                      ".concat(t===e.time?"bg-[#26AE7F]/20 text-[#26AE7F] border border-[#26AE7F]/30":"bg-white/5 text-white/60 hover:bg-white/10 hover:text-white border border-transparent","\n                    "),children:e.label},e.time))})})]})})]})}var p=s(1559),u=s(17244),b=s(45871),g=s(95780),f=s(55763);function w(){var e,t,s;let w=(0,i.useRouter)(),{data:j,status:y}=(0,l.wV)(),v=(0,p.d)(),{confirm:N}=(0,u.S)(),[k,A]=(0,r.useState)(!0),[S,F]=(0,r.useState)(!1),[E,D]=(0,r.useState)(!1),[C,B]=(0,r.useState)(!1),[M,T]=(0,r.useState)(!1),[L,P]=(0,r.useState)("automated"),I=(0,r.useRef)(null),z=(0,r.useRef)(null),[U,_]=(0,r.useState)({dropboxEnabled:!1,dropboxAppKey:"",dropboxAppSecret:"",dropboxFolder:"/QuickBox-Backups",backupEnabled:!1,frequency:"DAILY",primaryTime:"03:00",weeklyDay:0,monthlyDay:1,timezone:"UTC",includeDatabase:!0,includeUploads:!0,includePublicAssets:!1,includeEnvConfig:!0,includePrismaSchema:!0,includeInfluxdb:!0,retentionDays:30,maxBackups:50,notifyOnSuccess:!1,notifyOnFailure:!0,notificationEmail
1:""}),[O,R]=(0,r.useState)([]),[W,q]=(0,r.useState)(1),[K,Y]=(0,r.useState)(0),[H,V]=(0,r.useState)(0),[G,J]=(0,r.useState)(""),[Q,X]=(0,r.useState)(null),[$,Z]=(0,r.useState)(null),[ee,et]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(null),[er,ei]=(0,r.useState)([]),[eo,el]=(0,r.useState)(!1),[en,ec]=(0,r.useState)(void 0),[ed,ex]=(0,r.useState)(["DATABASE","UPLOADS","ENV_CONFIG","PRISMA_SCHEMA","INFLUXDB"]),em=null==j||null==(t=j.user)||null==(e=t.permissions)?void 0:e.includes("admin.settings.backup");(0,r.useEffect)(()=>{var e;"unauthenticated"===y?(0,o.j)(w):"authenticated"===y&&(null==j||null==(e=j.user)?void 0:e.permissions)&&!em&&w.push("/admin")},[y,j,w,em]),(0,r.useEffect)(()=>{"authenticated"===y&&em&&eh()},[y,em]),(0,r.useEffect)(()=>{"manual"===L&&"authenticated"===y&&em&&ep()},[L,W,G,y,em]);let eh=async()=>{try{let e=await fetch("/api/admin/settings/backup");if(!e.ok){if(403===e.status)return void w.push("/admin");let t=await e.json().catch(()=>({error:"Failed to fetch settings"}));console.error("API Error:",t),v.error(t.error||"Failed to load backup settings - using defaults"),A(!1);return}let t=await e.json();_({...t,dropboxAppSecret:t.dropboxAppSecret||"",notificationEmail:t.notificationEmail||""})}catch(e){console.error("Failed to fetch backup settings:",e),v.error("Failed to load backup settings - using defaults")}finally{A(!1)}},ep=async()=>{T(!0);try{let e=new URLSearchParams({page:W.toString(),limit:"10"});G&&e.append("status",G);let t=await fetch("/api/admin/backups?".concat(e.toString()));if(!t.ok)throw Error("Failed to fetch backup history");let s=await t.json();R(s.backups),Y(s.pagination.total),V(s.pagination.pages)}catch(e){console.error("Failed to fetch backup history:",e),v.error(e.message||"Failed to load backup history")}finally{T(!1)}},eu=async()=>{F(!0);try{let e=await fetch("/api/admin/settings/backup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to save settings")}let t=await e.json();_({...t,dropboxAppSecret:t.dropboxAppSecret||"",notificationEmail:t.notificationEmail||""}),v.success("Backup settings saved successfully")}catch(e){console.error("Failed to save backup settings:",e),v.error(e.message||"Failed to save backup settings")}finally{F(!1)}},eb=async()=>{et(!0);try{await eu();let e="".concat(window.location.origin,"/api/admin/settings/backup/dropbox/callback"),t=await fetch("/api/admin/settings/backup/dropbox/auth-url?redirect_uri=".concat(encodeURIComponent(e)));if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to generate authorization URL")}let{authUrl:s,codeVerifier:a}=await t.json();sessionStorage.setItem("dropbox_code_verifier",a),sessionStorage.setItem("dropbox_redirect_uri",e);let r=window.screen.width/2-300,i=window.screen.height/2-350;if(!window.open(s,"Dropbox Authorization","width=".concat(600,",height=").concat(700,",left=").concat(r,",top=").concat(i)))throw Error("Failed to open authorization popup. Please allow popups for this site.");let o=async e=>{if(e.origin===window.location.origin&&"dropbox-oauth-callback"===e.data.type){let{code:t}=e.data,s=sessionStorage.getItem("dropbox_code_verifier"),a=sessionStorage.getItem("dropbox_redirect_uri");if(!t||!s)return void v.error("OAuth authorization failed. Please try again.");try{let e=await fetch("/api/admin/settings/backup/dropbox/callback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,codeVerifier:s,redirectUri:a})}),r=await e.json();if(!e.ok)throw Error(r.error||"Failed to connect Dropbox");v.success("Dropbox connected successfully!"),sessionStorage.removeItem("dropbox_code_verifier"),sessionStorage.removeItem("dropbox_redirect_uri"),window.removeEventListener("message",o),await eh()}catch(e){console.error("Failed to exchange code for tokens:",e),v.error(e.message||"Failed to connect Dropbox")}}};window.addEventListener("message",o),setTimeout(()=>{window.removeEventListener("message",o)},3e5)}catch(e){console.error("Failed to connect Dropbox:",e),v.error(e.message||"Failed to connect Dropbox")}finally{et(!1)}},eg=async()=>
1{if(await N({title:"Disconnect Dropbox?",message:"This will remove the connection to your Dropbox account. You can reconnect at any time.",type:"warning"}))try{let e=await fetch("/api/admin/settings/backup/dropbox/disconnect",{method:"POST"});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to disconnect Dropbox")}v.success("Dropbox disconnected successfully"),await eh()}catch(e){console.error("Failed to disconnect Dropbox:",e),v.error(e.message||"Failed to disconnect Dropbox")}},ef=async()=>{D(!0);try{let t=await fetch("/api/admin/settings/backup",{method:"POST"}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to test Dropbox connection");if(s.success){var e;v.success("Dropbox connected successfully! Account: ".concat((null==(e=s.accountInfo)?void 0:e.email)||"Unknown"))}else v.error(s.error||"Dropbox connection test failed")}catch(e){console.error("Failed to test Dropbox connection:",e),v.error(e.message||"Failed to test Dropbox connection")}finally{D(!1)}},ew=async()=>{if(0===ed.length)return void v.error("Please select at least one component to backup");if(await N({title:"Trigger Manual Backup?",message:"This will create a backup with the following components:\n\n".concat(ed.join(", "),"\n\nThis may take several minutes."),type:"info"})){B(!0);try{let e=await fetch("/api/admin/backups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({components:ed})}),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to start backup");t.success?(v.success("Backup started successfully! Check the backup history below."),setTimeout(()=>{ep()},2e3)):v.error(t.error||"Backup failed")}catch(e){console.error("Failed to trigger manual backup:",e),v.error(e.message||"Failed to trigger manual backup")}finally{B(!1)}}},ej=async e=>{Z(e);try{let t=await fetch("/api/admin/backups/".concat(e,"/download")),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to get download link");window.open(s.downloadUrl,"_blank"),v.success("Download started for ".concat(s.fileName))}catch(e){console.error("Failed to download backup:",e),v.error(e.message||"Failed to download backup")}finally{Z(null)}},[ey,ev]=(0,r.useState)(null),eN=async e=>{let t='Are you sure you want to delete "'.concat(e.backupName,'"?');if("completed"===e.status&&e.dropboxPath&&!e.deletedFromDropbox?t+=" This will permanently remove the backup file from Dropbox and all records from the database.":"failed"===e.status?t+=" This will remove the failed backup record from the database.":"in_progress"===e.status?t+=" This backup is currently in progress. Deleting it will cancel the operation and remove any partial data.":t+=" This will permanently remove the backup record from the database.",t+="\n\nThis action cannot be undone.",await N({title:"Delete Backup",message:t,confirmText:"Delete Permanently",cancelText:"Cancel",type:"danger"})){ev(e.id);try{let t=await fetch("/api/admin/backups/".concat(e.id),{method:"DELETE"}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to delete backup");v.success(s.message||"Backup deleted successfully"),Q===e.id&&X(null),ep()}catch(e){console.error("Failed to delete backup:",e),v.error(e.message||"Failed to delete backup")}finally{ev(null)}}},ek=e=>{if(!e)return"0 Bytes";let t="string"==typeof e?parseInt(e):e;if(0===t)return"0 Bytes";let s=Math.floor(Math.log(t)/Math.log(1024));return Math.round(t/Math.pow(1024,s)*100)/100+" "+["Bytes","KB","MB","GB","TB"][s]},eA=e=>{if(!e)return"0s";if(e<60)return"".concat(e,"s");let t=Math.floor(e/60);return"".concat(t,"m ").concat(e%60,"s")};return"loading"!==y&&("authenticated"!==y||(null==j||null==(s=j.user)?void 0:s.permissions))&&!k?(0,a.jsxs)(d.U,{children:[(0,a.jsxs)("div",{ref:I,className:"space-y-6 sm:space-y-8 pb-16",children:[(0,a.jsxs)(n.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold text-white mb-1 sm:mb-2",children:"Backup Settings"}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-white/60",children:"Configure automated backups, storage providers, and retention policies"})]}),(0,a.jsx)("button",{onClick:eu,disabled:S,"aria-busy":S,className:"w-full sm:w-auto px-6 py-2.5 bg-gradient-to-r from-[#26AE7F] to-[#2aebcb] text-white rounded-lg font-medium hover:shadow-lg hover:shadow-[#26AE7F]/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:S?"Saving...":"Save Settings"})]}),U.lastBackupAt&&(0,a.jsx)(n.P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.05},className:"p-4 rounded-lg border ".concat("completed"===U.lastBackupStatus||"success"===U.lastBackupStatus?"bg-green-500/10 border-green-500/30":"failed"===U.lastBackupStatus?"bg-red-500/10 border-red-500/30":"bg-blue-500/10 border-blue-500/30"),children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"text-xl flex-shrink-0",children:"completed"===U.lastBackupStatus||"success"===U.lastBackupStatus?"✓":"failed"===U.lastBackupStatus?"✗":"⟳"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("p",{className:"font-medium ".concat("completed"===U.lastBackupStatus||"success"===U.lastBackupStatus?"text-green-400":"failed"===U.lastBackupStatus?"text-red-400":"text-blue-400"),children:["Last Backup: ","completed"===U.lastBackupStatus||"success"===U.lastBackupStatus?"Completed":"failed"===U.lastBackupStatus?"Failed":"In Progress"]}),(0,a.jsxs)("p",{className:"text-sm text-white/60 mt-1",children:[new Date(U.lastBackupAt).toLocaleString(),U.lastBackupDuration&&" • ".concat(eA(U.lastBackupDuration)),U.lastBackupSize&&" • ".concat(ek(U.lastBackupSize))]}),U.lastBackupMessage&&(0,a.jsx)("p",{className:"text-sm text-white/60 mt-1",children:U.lastBackupMessage})]})]})}),(0,a.jsx)(n.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:(0,a.jsxs)("div",{className:"flex gap-1 sm:gap-2 border-b border-white/10 min-w-max",role:"tablist","aria-label":"Backup settings tabs",children:[(0,a.jsxs)("button",{onClick:()=>P("automated"),role:"tab","aria-selected":"automated"===L,className:"px-3 sm:px-6 py-2.5 sm:py-3 text-sm sm:text-base font-medium transition-all relative whitespace-nowrap ".concat("automated"===L?"text-[#26AE7F]":"text-white/60 hover:text-white/80"),children:["Automated Backups","automated"===L&&(0,a.jsx)(n.P.div,{layoutId:"activeBackupTab",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-gradient-to-r from-[#26AE7F] to-[#2aebcb]"})]}),(0,a.jsxs)("button",{onClick:()=>P("manual"),role:"tab","aria-selected":"manual"===L,className:"px-3 sm:px-6 py-2.5 sm:py-3 text-sm sm:text-base font-medium transition-all relative whitespace-nowrap ".concat("manual"===L?"text-[#26AE7F]":"text-white/60 hover:text-white/80"),children:["Backup History","manual"===L&&(0,a.jsx)(n.P.div,{layoutId:"activeBackupTab",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-gradient-to-r from-[#26AE7F] to-[#2aebcb]"})]}),(0,a.jsxs)("button",{onClick:()=>P("storage"),role:"tab","aria-selected":"storage"===L,className:"px-3 sm:px-6 py-2.5 sm:py-3 text-sm sm:text-base font-medium transition-all relative whitespace-nowrap ".concat("storage"===L?"text-[#26AE7F]":"text-white/60 hover:text-white/80"),children:["Storage Providers","storage"===L&&(0,a.jsx)(n.P.div,{layoutId:"activeBackupTab",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-gradient-to-r from-[#26AE7F] to-[#2aebcb]"})]})]})}),"automated"===L&&(0,a.jsxs)(n.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"space-y-4 sm:space-y-6",children:[(0,a.jsx)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-1",children:"Enable Automated Backups"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-white/60",children:"Automatically backup your data on a schedule"})]}),(0,a.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer flex-shrink-0",children:[(0,a.jsx)("input",{type:"checkbox",checked:U.backupEnabled,onChange:e=>_({...U,backupEnabled:e.target.checked}),className:"sr-only peer"}),(0,a.jsx)("div",{className:"w-11 h-6 bg-white/10 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[#26AE7F]/50 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-gradient-to-r peer-checked:from-[#26AE7F] peer-checked:to-[#2aebcb]"})]})]})}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-4",children:"Backup Schedule"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Backup Frequency"}),(0,a.jsx)(m.l,{value:U.frequency,onChange:e=>_({...U,frequency:e}),"aria-label":"Backup Frequency",options:[{value:"MANUAL",label:"Manual Only"},{value:"DAILY",label:"Daily"},{value:"TWICE_DAILY",label:"Twice Daily"},{value:"WEEKLY",label:"Weekly"},{value:"MONTHLY",label:"Monthly"}]})]}),"MANUAL"!==U.frequency&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Primary Backup Time"}),(0,a.jsx)(h,{value:U.primaryTime,onChange:e=>_({...U,primaryTime:e}),use24Hour:!0,minuteStep:5})]}),"TWICE_DAILY"===U.frequency&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Secondary Backup Time"}),(0,a.jsx)(h,{value:U.secondaryTime||"15:00",onChange:e=>_({...U,secondaryTime:e}),use24Hour:!0,minuteStep:5})]}),"WEEKLY"===U.frequency&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Day of Week"}),(0,a.jsx)(m.l,{value:String(U.weeklyDay),onChange:e=>_({...U,weeklyDay:parseInt(e)}),"aria-label":"Day of Week",options:[{value:"0",label:"Sunday"},{value:"1",label:"Monday"},{value:"2",label:"Tuesday"},{value:"3",label:"Wednesday"},{value:"4",label:"Thursday"},{value:"5",label:"Friday"},{value:"6",label:"Saturday"}]})]}),"MONTHLY"===U.frequency&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Day of Month"}),(0,a.jsx)(x.A,{value:U.monthlyDay,onChange:e=>_({...U,monthlyDay:"string"==typeof e?parseInt(e)||1:e}),min:1,max:28,step:1,decimals:0,allowNegative:!1}),(0,a.jsx)("p",{className:"text-xs text-white/50 mt-1",children:"Day 1-28 (28th 
1is last day of every month)"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Timezone"}),(0,a.jsx)("input",{type:"text",value:U.timezone,onChange:e=>_({...U,timezone:e.target.value}),placeholder:"UTC",className:"w-full px-4 py-2.5 bg-white/5 border border-white/10 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-[#26AE7F]/50"}),(0,a.jsx)("p",{className:"text-xs text-white/50 mt-1",children:"IANA timezone (e.g., America/New_York, UTC)"})]})]}),U.nextScheduledAt&&(0,a.jsx)("div",{className:"p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:(0,a.jsxs)("p",{className:"text-sm text-blue-400",children:["Next scheduled backup: ",new Date(U.nextScheduledAt).toLocaleString()]})})]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-4",children:"Backup Components"}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:"Database"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:"MariaDB database dump (compressed)"})]}),(0,a.jsx)("input",{type:"checkbox",checked:U.includeDatabase,onChange:e=>_({...U,includeDatabase:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:"User Uploads"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Avatars and uploaded files"})]}),(0,a.jsx)("input",{type:"checkbox",checked:U.includeUploads,onChange:e=>_({...U,includeUploads:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:"Public Assets"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Static files (usually in git, optional)"})]}),(0,a.jsx)("input",{type:"checkbox",checked:U.includePublicAssets,onChange:e=>_({...U,includePublicAssets:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:"Environment Configuration"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:".env files (encrypted)"})]}),(0,a.jsx)("input",{type:"checkbox",checked:U.includeEnvConfig,onChange:e=>_({...U,includeEnvConfig:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:"Prisma Schema"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Database schema definition"})]}),(0,a.jsx)("input",{type:"checkbox",checked:U.includePrismaSchema,onChange:e=>_({...U,includePrismaSchema:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:"InfluxDB Metrics"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Time-series metrics data (CPU, memory, API performance)"})]}),(0,a.jsx)("input",{type:"checkbox",checked:U.includeInfluxdb,onChange:e=>_({...U,includeInfluxdb:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-4",children:"Retention Policy"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Keep Backups (Days)"}),(0,a.jsx)(x.A,{value:U.retentionDays,onChange:e=>
1_({...U,retentionDays:"string"==typeof e?parseInt(e)||30:e}),min:1,step:1,decimals:0,allowNegative:!1}),(0,a.jsx)("p",{className:"text-xs text-white/50 mt-1",children:"Delete backups older than this many days"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Maximum Backups"}),(0,a.jsx)(x.A,{value:U.maxBackups,onChange:e=>_({...U,maxBackups:"string"==typeof e?parseInt(e)||50:e}),min:1,step:1,decimals:0,allowNegative:!1}),(0,a.jsx)("p",{className:"text-xs text-white/50 mt-1",children:"Keep only this many most recent backups"})]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-4",children:"Email Notifications"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Notification Email"}),(0,a.jsx)("input",{type:"email",value:U.notificationEmail,onChange:e=>_({...U,notificationEmail:e.target.value}),placeholder:"[email protected]",className:"w-full px-4 py-2.5 bg-white/5 border border-white/10 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:U.notifyOnSuccess,onChange:e=>_({...U,notifyOnSuccess:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"}),(0,a.jsx)("span",{className:"text-sm text-white/80",children:"Notify on successful backup"})]}),(0,a.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:U.notifyOnFailure,onChange:e=>_({...U,notifyOnFailure:e.target.checked}),className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"}),(0,a.jsx)("span",{className:"text-sm text-white/80",children:"Notify on failed backup"})]})]})]})]})]}),"manual"===L&&(0,a.jsxs)(n.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"space-y-4 sm:space-y-6",children:[(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-4",children:"Create Backup Now"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-white/60 mb-3",children:"Select components to backup:"}),(0,a.jsx)("div",{className:"space-y-2",children:[{key:"DATABASE",label:"Database",desc:"MariaDB database dump"},{key:"UPLOADS",label:"User Uploads",desc:"Avatars and uploaded files"},{key:"PUBLIC_ASSETS",label:"Public Assets",desc:"Static files"},{key:"ENV_CONFIG",label:"Environment Config",desc:".env files (encrypted)"},{key:"PRISMA_SCHEMA",label:"Prisma Schema",desc:"Database schema"},{key:"INFLUXDB",label:"InfluxDB Metrics",desc:"Time-series metrics data"}].map(e=>(0,a.jsxs)("label",{className:"flex items-center justify-between gap-4 p-3 bg-white/5 rounded-lg hover:bg-white/10 transition-all cursor-pointer",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:e.label}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:e.desc})]}),(0,a.jsx)("input",{type:"checkbox",checked:ed.includes(e.key),onChange:()=>{var t;return t=e.key,void(ed.includes(t)?ex(ed.filter(e=>e!==t)):ex([...ed,t]))},className:"w-5 h-5 bg-white/5 border-white/20 rounded text-[#26AE7F] focus:ring-[#26AE7F]/50"})]},e.key))})]}),(0,a.jsx)("button",{onClick:ew,disabled:C||0===ed.length,className:"w-full px-6 py-3 bg-gradient-to-r from-[#26AE7F] to-[#2aebcb] text-white rounded-lg font-medium hover:shadow-lg hover:shadow-[#26AE7F]/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:C?"Creating Backup...":"Create Backup Now"})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-1",children:"Backup History"}),U.dropboxEnabled&&U.dropboxFolder&&(0,a.jsxs)("p",{className:"text-xs text-white/60",children:["Stored in Dropbox: ",(0,a.jsx)("code",{className:"px-1.5 py-0.5 bg-white/10 rounded text-[#26AE7F]",children:U.dropboxFolder})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-40",children:(0,a.jsx)(m.l,{size:"sm",value:G,onChange:e=>{J(e),q(1)},"aria-label":"Filter by status",options:[{value:"",label:"All Statuses"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"in_progress",label:"In Progress"}]})}),O.some(e=>"failed"===e.status)&&(0,a.jsx)(b.m,{content:"Delete all failed backup records",position:"top",children:(0,a.jsx)("button",{onClick:async()=>{let e=O.filter(e=>"failed"===e.status);if(!await N({title:"Delete All Failed Backups",message:"Are you sure you want to delete ".concat(e.length," failed backup").concat(e.length>
11?"s":"","? This will remove all failed backup records from the database.\n\n⚠️ This action cannot be undone."),confirmText:"Delete All Failed",cancelText:"Cancel",type:"danger"}))return;let t=0,s=0;for(let a of e)try{(await fetch("/api/admin/backups/".concat(a.id),{method:"DELETE"})).ok?t++:s++}catch(e){s++}0===s?v.success("Deleted ".concat(t," failed backup").concat(t>1?"s":"")):v.warning("Deleted ".concat(t," backup").concat(t>1?"s":"",", ").concat(s," failed")),ep()},className:"px-3 py-1.5 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 text-red-400 text-xs rounded transition-all whitespace-nowrap",children:"Clean Up Failed"})})]})]}),M?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)("div",{className:"w-8 h-8 border-4 border-white/10 border-t-[#26AE7F] rounded-full animate-spin"})}):0===O.length?(0,a.jsx)("div",{className:"text-center py-12",children:(0,a.jsx)("p",{className:"text-white/60",children:"No backups found"})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-3",children:O.map(e=>{var t,s,r,i,o,l,d,x;return(0,a.jsxs)("div",{className:"border border-white/10 rounded-lg overflow-hidden bg-gradient-to-br from-white/5 to-white/0",children:[(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsxs)("button",{onClick:()=>X(Q===e.id?null:e.id),className:"flex items-center gap-2 hover:text-[#26AE7F] transition-colors",children:[(0,a.jsx)(n.P.svg,{animate:{rotate:90*(Q===e.id)},transition:{duration:.2},className:"w-4 h-4 text-white/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,a.jsx)("span",{className:"font-medium text-white truncate",children:e.backupName})]}),(0,a.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full ".concat("completed"===e.status?"bg-green-500/20 text-green-400":"failed"===e.status?"bg-red-500/20 text-red-400":"bg-blue-500/20 text-blue-400"),children:e.status}),e.deletedFromDropbox&&e.dropboxPath&&(0,a.jsx)(b.m,{content:"File removed from Dropbox",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-0.5 text-xs rounded-full bg-yellow-500/20 text-yellow-400 flex items-center gap-1",children:[(0,a.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"File Deleted"]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-white/60",children:[(0,a.jsx)("span",{children:e.backupType}),(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:new Date(e.startedAt).toLocaleString()}),e.totalSize&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{className:"text-[#26AE7F]",children:ek(e.totalSize)})]}),e.duration&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"•"}),(0,a.jsx)("span",{children:eA(e.duration)})]}),e.errorMessage&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"•"}),(0,a.jsxs)("span",{className:"text-red-400/80 truncate max-w-md",title:e.errorMessage,children:["Error: ",e.errorMessage]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:["completed"===e.status&&e.dropboxPath&&!e.deletedFromDropbox&&(0,a.jsx)(b.m,{content:"Download backup",position:"top",children:(0,a.jsx)("button",{onClick:()=>ej(e.id),disabled:$===e.id||ey===e.id,className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 border border-white/20 text-white text-xs rounded transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:$===e.id?(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-white/20 border-t-white rounded-full animate-spin"}):(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})})}),(0,a.jsx)(b.m,{content:"failed"===e.status?"Delete failed backup record":"in_progress"===e.status?"Cancel and delete backup":e.deletedFromDropbox?"Delete backup record":"Delete backup and remove from Dropbox",position:"top",children:(0,a.jsx)("button",{onClick:()=>eN(e),disabled:ey===e.id||$===e.id,className:"px-3 py-1.5 bg-red-500/10 hover:bg-red-500/20 border border-red-500/30 text-red-400 text-xs rounded transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:ey===e.id?(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-red-400/20 border-t-red-400 rounded-full animate-spin"}):(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})})]})]})}),(0,a.jsx)(c.N,{children:Q===e.id&&(0,a.jsx)(n.P.div,{initial:{height:0,opacity:0}
1,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},className:"overflow-hidden border-t border-white/10 bg-white/[0.02]",children:(0,a.jsxs)("div",{className:"p-4 space-y-4",children:[e.components&&e.components.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-white mb-2",children:"Backup Components"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.components.map(e=>(0,a.jsx)("span",{className:"px-2 py-1 bg-white/10 text-white/80 text-xs rounded",children:e.replace("_"," ")},e))})]}),e.dropboxPath&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-white mb-2",children:"Storage Location"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-[#0061FF]",viewBox:"0 0 24 24",fill:"currentColor",children:(0,a.jsx)("path",{d:"M6 1.807L0 5.629l6 3.822 6-3.822L6 1.807zM18 1.807l-6 3.822 6 3.822 6-3.822-6-3.822zM0 13.274l6 3.822 6-3.822-6-3.822-6 3.822zM18 9.452l-6 3.822 6 3.822 6-3.822-6-3.822zM6 17.918l6 3.822 6-3.822-6-3.822-6 3.822z"})}),(0,a.jsx)("code",{className:"text-xs text-white/80",children:e.dropboxPath})]})]}),(null==(t=e.metadata)?void 0:t.sizes)&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-white mb-2",children:"Component Sizes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[e.metadata.sizes.database&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Database"}),(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:ek(e.metadata.sizes.database)})]}),e.metadata.sizes.uploads&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Uploads"}),(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:ek(e.metadata.sizes.uploads)})]}),e.metadata.sizes.publicAssets&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Public Assets"}),(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:ek(e.metadata.sizes.publicAssets)})]}),e.metadata.sizes.envConfig&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"ENV Config"}),(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:ek(e.metadata.sizes.envConfig)})]}),e.metadata.sizes.prismaSchema&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Prisma Schema"}),(0,a.jsx)("p",{className:"text-sm font-medium text-white",children:ek(e.metadata.sizes.prismaSchema)})]}),e.metadata.sizes.influxdb&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-cyan-500/10 rounded-lg border border-cyan-500/20",children:[(0,a.jsx)("p",{className:"text-xs text-cyan-400/80",children:"InfluxDB Metrics"}),(0,a.jsx)("p",{className:"text-sm font-medium text-cyan-400",children:ek(e.metadata.sizes.influxdb)})]})]})]}),(null==(s=e.metadata)?void 0:s.influxdbStats)&&e.metadata.influxdbStats.buckets.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-white mb-2",children:"InfluxDB Buckets"}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.metadata.influxdbStats.buckets.map(e=>(0,a.jsxs)("div",{className:"px-3 py-2 bg-cyan-500/10 rounded-lg border border-cyan-500/20",children:[(0,a.jsx)("p",{className:"text-xs text-cyan-400/80 font-medium",children:e.name}),(0,a.jsxs)("p",{className:"text-xs text-white/60",children:["Retention: ",e.retentionPeriod]})]},e.name))})]}),(null==(r=e.metadata)?void 0:r.tableSizes)&&e.metadata.tableSizes.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("h4",{className:"text-sm font-semibold text-white mb-3",children:["Database Tables (",e.metadata.tableSizes.length,")",(0,a.jsx)("span",{className:"ml-2 text-xs text-white/50 font-normal",children:"Click a table to analyze"})]}),(0,a.jsx)(g.O,{tables:e.metadata.tableSizes,onTableClick:t=>{var s;ea(t),ei(e.metadata.tableSizes),ec(null==(s=e.metadata)?void 0:s.versions)}})]}),(null==(i=e.metadata)?void 0:i.counts)&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-white mb-2",children:"Database Statistics"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Users"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-white",children:(null==(o=e.metadata.counts.users)?void 0:o.toLocaleStr
1ing())||0})]}),(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Licenses"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-white",children:(null==(l=e.metadata.counts.licenses)?void 0:l.toLocaleString())||0})]}),(0,a.jsxs)("div",{className:"px-3 py-2 bg-white/5 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-white/60",children:"Activations"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-white",children:(null==(d=e.metadata.counts.activations)?void 0:d.toLocaleString())||0})]}),void 0!==e.metadata.counts.apiLogs&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-amber-500/10 rounded-lg border border-amber-500/20",children:[(0,a.jsx)("p",{className:"text-xs text-amber-400/80",children:"API Logs"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-amber-400",children:e.metadata.counts.apiLogs.toLocaleString()})]})]})]}),(null==(x=e.metadata)?void 0:x.versions)&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-white mb-2",children:"System Versions"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(b.m,{content:"Node.js runtime version used when backup was created",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-white/10 text-white/80 text-xs rounded",children:["Node.js ",e.metadata.versions.node]})}),(0,a.jsx)(b.m,{content:"Prisma ORM version for database access",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-white/10 text-white/80 text-xs rounded",children:["Prisma ",e.metadata.versions.prisma]})}),(0,a.jsx)(b.m,{content:"Next.js framework version",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-white/10 text-white/80 text-xs rounded",children:["Next.js ",e.metadata.versions.next]})}),e.metadata.versions.docker&&"unknown"!==e.metadata.versions.docker&&(0,a.jsx)(b.m,{content:"Docker engine version running the database containers",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs rounded border border-blue-500/30",children:["Docker ",e.metadata.versions.docker]})}),e.metadata.versions.mariadb&&"unknown"!==e.metadata.versions.mariadb&&(0,a.jsx)(b.m,{content:"MariaDB version for main database (users, licenses, etc.)",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 text-xs rounded border border-green-500/30",children:["MariaDB ",e.metadata.versions.mariadb]})}),e.metadata.versions.mariadbLogs&&"unknown"!==e.metadata.versions.mariadbLogs&&(0,a.jsx)(b.m,{content:"MariaDB version for logs database (API usage logs)",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-amber-500/20 text-amber-400 text-xs rounded border border-amber-500/30",children:["MariaDB Logs ",e.metadata.versions.mariadbLogs]})}),e.metadata.versions.influxdb&&"unknown"!==e.metadata.versions.influxdb&&(0,a.jsx)(b.m,{content:"InfluxDB version for time-series metrics (CPU, memory, API performance)",position:"top",children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-cyan-500/20 text-cyan-400 text-xs rounded border border-cyan-500/30",children:["InfluxDB ",e.metadata.versions.influxdb]})})]})]}),e.errorMessage&&(0,a.jsxs)("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg",children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-red-400 mb-1",children:"Error Details"}),(0,a.jsx)("p",{className:"text-xs text-red-400/80",children:e.errorMessage})]})]})})})]},e.id)})}),H>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t border-white/10",children:[(0,a.jsxs)("p",{className:"text-sm text-white/60",children:["Showing ",(W-1)*10+1,"-",Math.min(10*W,K)," of ",K]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>q(Math.max(1,W-1)),disabled:1===W,className:"px-3 py-1.5 bg-white/5 hover:bg-white/10 border border-white/10 rounded text-sm text-white disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:"Previous"}),(0,a.jsx)("button",{onClick:()=>q(Math.min(H,W+1)),disabled:W===H,className:"px-3 py-1.5 bg-white/5 hover:bg-white/10 border border-white/10 rounded text-sm text-white disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:"Next"})]})]})]})]})]}),"storage"===L&&(0,a.jsxs)(n.P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.2},className:"space-y-4 sm:space-y-6",children:[(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-1",children:"Dropbox Integration"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-white/60",children:"Store backups in your Dropbox account"})]}),(0,a.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer flex-shrink-0",children:[(0,a.jsx)("input",{type:"checkbox",checked:U.dropboxEnabled,onChange:e=>_({...U,dropboxEnabled:e.target.checked}),className:"sr-only peer"}),(0,a.jsx)("div",{className:"w-11 h-6 bg-white/10 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[#26AE7F]/50 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-gradient-to-r peer-checked:from-[#26AE7F] peer-checked:to-[#2aebcb]"})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"App Key"}),(0,a.jsx)("input",{type:"text",value:U.dropboxAppKey,onChange:e=>_({...U,dropboxAppKey:e.target.value}),placeholder:"Your Dropbox app key",className:"w-full px-4 py-2.5 bg-white/5 border border-white/10 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-[#26AE7F]/50"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"App Secret"}),(0,a.jsx)("input",{type:"password",value:U.dropboxAppSecret,onChange:e=>_({...U,dropboxAppSecret:e.target.value}),placeholder:"••••••••"===U.dropboxAppSecret?"Secret is set":"Your Dropbox app secret",className:"w-full px-4 py-2.5 bg-white/5 border border-white/10 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-[#26AE7F]/50"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-white/80 mb-2",children:"Backup Folder Path"}),(0,a.jsx)("input",{type:"text",value:U.dropboxFolder,onChange:e=>_({...U,dropboxFolder:e.target.value}),placeholder:"/QuickBox-Backups",className:"w-full px-4 py-2.5 bg-white/5 border border-white/10 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-[#26AE7F]/50"}),(0,a.jsx)("p",{className:"text-xs text-white/50 mt-1",children:"Path in your Dropbox where backups will be stored"})]}),U.dropboxAccessToken&&U.dropboxTokenExpiry&&(0,a.jsx)("div",{className:"p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-green-400",children:"Dropbox Connected"}),(0,a.jsxs)("p",{className:"text-xs text-green-400/80",children:["Token expires: ",new Date(U.dropboxTokenExpiry).toLocaleString()]})]})]})}),(0,a.jsx)("div",{className:"flex flex-wrap gap-3",children:U.dropboxAccessToken?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:ef,disabled:E,className:"px-6 py-2.5 bg-white/10 hover:bg-white/20 border border-white/20 text-white rounded-lg text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:E?"Testing...":"Test Connection"}),(0,a.jsx)("button",{onClick:eg,className:"px-6 py-2.5 bg-red-500/20 hover:bg-red-500/30 border border-red-500/30 text-red-400 rounded-lg text-sm font-medium transition-all",children:"Disconnect"})]}):(0,a.jsx)("button",{onClick:eb,disabled:ee||!U.dropboxEnabled||!U.dropboxAppKey||!U.dropboxAppSecret,className:"px-6 py-2.5 bg-gradient-to-r from-[#26AE7F] to-[#2aebcb] hover:opacity-90 text-white rounded-lg text-sm font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:ee?"Connecting...":"Connect to Dropbox"})}),!U.dropboxAccessToken&&(0,a.jsxs)("div",{className:"p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-blue-400 mb-2 font-medium",children:"Setup Instru
1ctions:"}),(0,a.jsxs)("ol",{className:"text-xs text-blue-400/80 space-y-1 list-decimal list-inside",children:[(0,a.jsxs)("li",{children:["Create a Dropbox App at ",(0,a.jsx)("a",{href:"https://www.dropbox.com/developers/apps",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-blue-300",children:"dropbox.com/developers/apps"})]}),(0,a.jsx)("li",{children:'Choose "Scoped access" and "Full Dropbox" access'}),(0,a.jsx)("li",{children:"Enter the App Key and App Secret above"}),(0,a.jsxs)("li",{children:["Add ",(0,a.jsxs)("code",{className:"px-1 py-0.5 bg-white/10 rounded",children:[window.location.origin,"/api/admin/settings/backup/dropbox/callback"]})," to your app's Redirect URIs"]}),(0,a.jsx)("li",{children:'Enable Dropbox integration and click "Connect to Dropbox"'})]})]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-1",children:"Local Storage"}),(0,a.jsxs)("p",{className:"text-sm text-white/60",children:["Backups are temporarily stored locally at ",(0,a.jsx)("code",{className:"px-2 py-0.5 bg-white/10 rounded text-xs",children:"/tmp/quickbox-backups"})," during creation and upload. Local files are automatically cleaned up after successful upload to remote storage."]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-white/5 to-white/0 border border-white/10 rounded-xl p-4 sm:p-6 opacity-50",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold text-white mb-1",children:"Amazon S3 (Coming Soon)"}),(0,a.jsx)("p",{className:"text-sm text-white/60",children:"S3-compatible storage support is planned for a future release."})]})]})]}),es&&(0,a.jsx)(f.l,{table:es,allTables:er,versions:en,onClose:()=>{ea(null),el(!1),ec(void 0)},contentRef:I,isDetached:eo,onDetach:()=>{z.current=es,ea(null),el(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ea(z.current),z.current=null})})},onDock:()=>{z.current=es,ea(null),el(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ea(z.current),z.current=null})})}})]}):(0,a.jsx)(d.U,{children:(0,a.jsx)("div",{className:"flex items-center justify-center min-h-[60vh]",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 border-4 border-white/10 border-t-[#26AE7F] rounded-full animate-spin"}),(0,a.jsx)("p",{className:"text-white/60",children:"Loading backup settings..."})]})})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.