import{r as f,j as e,a as m}from"./app-BwDemWQz.js";import{s as u}from"./index-CkDmAPFS.js";import{e as _e,A as ge,S as ye}from"./AppLayout-3zbhnyYw.js";import{P as fe,a as C,S as y,b as n,T as g,B as je,L as ve,c as se,d as be,I as we,V as Ne,e as ke,f as Se,g as Ce}from"./BackupSettings-Bjzwstp9.js";import{u as ne,z as j}from"./LanguageContext-zkEAKPTE.js";import{B as h}from"./Button-B-KWyoQR.js";import{I as d}from"./Input-BJaxI6jp.js";import{S as M,a as A,b as L,c as q,d as x}from"./Select-CfDsuz_M.js";import{S as I}from"./Switch-UfTXafFD.js";import{C as G,b as J,c as O,a as Y}from"./Card-DJ3wHKN-.js";import{B as P}from"./Badge-BmMeMqjk.js";import{c as F}from"./createLucideIcon-BASx8f0E.js";import{C as re}from"./clock-BJENbNTm.js";import{C as K}from"./circle-check-big-StssQwdK.js";import{Z as ze}from"./zap-BsHQ4DWF.js";import{m as Q}from"./proxy-DQ767J20.js";import{C as te}from"./circle-x-Bz8JQIgu.js";import{C as V}from"./copy-WN1DN5DF.js";import{P as Te}from"./play-81q2q0ID.js";import{S as Z}from"./server-s32ObNMT.js";import{T as Me}from"./triangle-alert-BuCSSe2T.js";import{A as ie}from"./index-T7pIFD_D.js";/* empty css            */import"./index-DxJALBsh.js";import"./Label-1lm7x8-L.js";import"./rocket-Dt03WmgU.js";import"./users-g1HvrzO9.js";import"./globe-C_ZhZ5i9.js";import"./countries-DKyaIPud.js";import"./useBulkHandler-CbpUUtsW.js";import"./Checkbox-DUX0c0Hg.js";import"./index-B0gxmCHE.js";import"./DeleteModal-DqFQpSwl.js";import"./trash-2-DJCIoKoz.js";import"./Pagination-BlNwi_HH.js";import"./search-sQ0SJSXK.js";import"./funnel-BGG8ZS5h.js";import"./settings-2-LSCqa0oL.js";import"./database-D44wTjxU.js";import"./useDeleteHandler-C9Bb7ZON.js";import"./useToggleHandler-CyjBJk2W.js";import"./languages-BJDUufDH.js";/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ae=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Le=F("pause",Ae);/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],oe=F("refresh-cw",qe);/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Re=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Pe=F("rotate-ccw",Re);/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ve=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],le=F("terminal",Ve);function Be({cronJobs:r=[],systemStatus:p={},cronUrls:b=[]}){const[X,ee]=f.useState(null),[B,E]=f.useState(!1),i=ne(),T=Array.isArray(r)&&r.length>0?r:[{id:"post_scheduler",name:i("Post Scheduler"),description:i("Automatically publishes scheduled social media posts"),frequency:"* * * * *",command:"posts-schedule",endpoint:"/user/cron/post-scheduler",status:"active",last_run:"2 minutes ago",next_run:"In 58 seconds",success_rate:98.5,total_runs:1247,failures:19,category:"content"},{id:"analytics_sync",name:i("Analytics Sync"),description:i("Syncs analytics data from social platforms"),frequency:"0 */6 * * *",command:"analytics-sync",endpoint:"/user/cron/analytics-sync",status:"active",last_run:"3 hours ago",next_run:"In 3 hours",success_rate:95.2,total_runs:456,failures:22,category:"analytics"},{id:"account_refresh",name:i("Account Token Refresh"),description:i("Refreshes social media account access tokens"),frequency:"0 2 * * *",command:"accounts-refresh-tokens",endpoint:"/user/cron/refresh-tokens",status:"active",last_run:"8 hours ago",next_run:"In 16 hours",success_rate:99.1,total_runs:89,failures:1,category:"security"},{id:"cleanup",name:i("System Cleanup"),description:i("Cleans up temporary files and old logs"),frequency:"0 3 * * 0",command:"system-cleanup",endpoint:"/user/cron/system-cleanup",status:"active",last_run:"2 days ago",next_run:"In 5 days",success_rate:100,total_runs:12,failures:0,category:"maintenance"},{id:"backup",name:i("Automated Backup"),description:i("Creates automated backups of important data"),frequency:"0 1 * * *",command:"backup-run",endpoint:"/user/cron/auto-backup",status:"active",last_run:"9 hours ago",next_run:"In 15 hours",success_rate:97.8,total_runs:67,failures:2,category:"backup"}],H=o=>({content:"from-blue-500 to-cyan-500",analytics:"from-purple-500 to-pink-500",security:"from-green-500 to-emerald-500",maintenance:"from-orange-500 to-red-500",backup:"from-indigo-500 to-purple-500"})[o]||"from-gray-500 to-gray-600",N=o=>{const z={content:_e,analytics:oe,security:K,maintenance:Z,backup:Pe}[o]||re;return e.jsx(z,{className:"w-4 h-4"})},U=(o,c)=>o==="inactive"?e.jsxs(P,{variant:"secondary",className:"flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3"})," ",i("Paused")]}):c>=98?e.jsxs(P,{className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300 flex items-center gap-1",children:[e.jsx(K,{className:"w-3 h-3"})," ",i("Healthy")]}):c>=90?e.jsxs(P,{className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300 flex items-center gap-1",children:[e.jsx(Me,{className:"w-3 h-3"})," ",i("Warning")]}):e.jsxs(P,{className:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300 flex items-center gap-1",children:[e.jsx(te,{className:"w-3 h-3"})," ",i("Error")]}),v=async o=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(o),j.success(i("Copied to clipboard"));else{const c=document.createElement("textarea");c.value=o,c.style.position="fixed",c.style.left="-999999px",c.style.top="-999999px",document.body.appendChild(c),c.focus(),c.select();try{if(document.execCommand("copy"))j.success(i("Copied to clipboard"));else throw new Error("Copy command failed")}catch(z){console.error("Fallback copy failed:",z),j.error(i("Failed to copy to clipboard"))}finally{document.body.removeChild(c)}}}catch(c){console.error("Copy to clipboard failed:",c),j.error(i("Failed to copy to clipboard. Please copy manually."))}},W=async()=>{E(!0);try{await m.reload({only:["cronJobs","systemStatus"]}),j.success(i("Status refreshed successfully"))}catch{j.error(i("Failed to refresh status"))}finally{E(!1)}},_=async(o,c)=>{try{await m.post(route("user.cron.toggle"),{job_id:o,status:c==="active"?"inactive":"active"}),j.success(i("Cron job status updated"))}catch{j.error(i("Failed to update cron job status"))}},k=async o=>{try{await m.post(route("user.cron.run-now"),{job_id:o}),j.success(i("Cron job executed successfully"))}catch{j.error(i("Failed to execute cron job"))}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(G,{className:"border-0 shadow-lg bg-gradient-to-br from-white to-blue-50 dark:from-zinc-900 dark:to-blue-950",children:[e.jsx(J,{className:"pb-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsx("div",{className:"flex items-center space-x-3",children:e.jsxs("div",{children:[e.jsx(O,{className:"text-lg sm:text-xl",children:i("System Status")}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:i("Real-time automation monitoring")})]})}),e.jsxs(h,{variant:"outline",size:"sm",onClick:W,disabled:B,className:"flex items-center gap-2 w-full sm:w-auto justify-center",children:[e.jsx(oe,{className:`w-4 h-4 ${B?"animate-spin":""}`}),i("Refresh")]})]})}),e.jsx(Y,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"text-start",children:[e.jsxs("div",{className:"flex items-center justify-start mb-2",children:[e.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full animate-pulse mr-2"}),e.jsx("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:i("All systems operational")})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("All cron jobs running normally")})]}),e.jsxs("div",{className:"text-start",children:[e.jsxs("div",{className:"flex items-center justify-start mb-2",children:[e.jsx(re,{className:"w-4 h-4 text-blue-500 mr-2"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(p==null?void 0:p.last_cron_run)||i("2 minutes ago")})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("Last cron job run")})]}),e.jsxs("div",{className:"text-start",children:[e.jsxs("div",{className:"flex items-center justify-start mb-2",children:[e.jsx(K,{className:"w-4 h-4 text-green-500 mr-2"}),e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(p==null?void 0:p.success_rate)||"98.7%"})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("Overall success rate")})]})]})})]}),e.jsxs(G,{className:"border-0 shadow-none",children:[e.jsx(J,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs(O,{className:"flex items-center gap-2 text-base sm:text-lg",children:[e.jsx(ze,{className:"w-5 h-5 text-yellow-500"}),i("Automation Jobs")]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:i("Manage and monitor your automated tasks")})]}),e.jsxs(P,{variant:"outline",className:"text-xs self-start sm:self-auto",children:[T.filter(o=>o.status==="active").length," ",i("Active")]})]})}),e.jsx(Y,{className:"space-y-4 px-0 pt-4",children:T.map((o,c)=>e.jsxs(Q.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:c*.1},className:"border border-gray-200 dark:border-zinc-800 rounded-lg p-4 hover:shadow-md transition-all duration-200",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:`w-8 h-8 bg-gradient-to-br ${H(o.category)} rounded-lg flex items-center justify-center text-white`,children:N(o.category)}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:o.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:o.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[U(o.status,o.success_rate),e.jsx(I,{checked:o.status==="active",onCheckedChange:()=>_(o.id,o.status),size:"sm"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i("Last Run")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:o.last_run})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i("Next Run")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:o.next_run})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i("Success Rate")}),e.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[o.success_rate,"%"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i("Total Runs")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:o.total_runs.toLocaleString()})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mt-4 pt-3 border-t border-gray-100 dark:border-zinc-700",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(le,{className:"w-3 h-3 mr-1"}),o.frequency]}),o.failures>0&&e.jsxs("span",{className:"flex items-center text-red-500",children:[e.jsx(te,{className:"w-3 h-3 mr-1"}),o.failures," ",i("failures")]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>v(o.url||`${window.location.origin}/cron/${o.command}`),className:"text-xs px-2 py-1 h-6",children:[e.jsx(V,{className:"w-3 h-3 mr-1"}),i("Copy URL")]}),e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>k(o.id),className:"text-xs px-2 py-1 h-6",disabled:o.status==="inactive",children:[e.jsx(Te,{className:"w-3 h-3 mr-1"}),i("Run Now")]})]})]})]},o.id))})]}),e.jsxs(G,{className:"border-0 shadow-none",children:[e.jsxs(J,{className:"p-0",children:[e.jsxs(O,{className:"flex items-center gap-2 text-base sm:text-lg",children:[e.jsx(Z,{className:"w-5 h-5 text-blue-500"}),i("Server Setup Guide")]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i("Configure cron jobs on your server for automated task execution")})]}),e.jsxs(Y,{className:"space-y-6 pt-4 px-0",children:[e.jsxs("div",{className:"border border-gray-200 dark:border-zinc-800 rounded-lg p-4",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-3 gap-2",children:e.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white flex items-center gap-2 text-sm sm:text-base",children:[e.jsx(Z,{className:"w-4 h-4"}),i("cPanel / Shared Hosting")]})}),e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:i("For shared hosting providers like cPanel, GoDaddy, Bluehost, etc. Choose either method:")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white text-sm sm:text-base",children:i("Method 1: Artisan Command (Traditional)")}),e.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-800 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-2 gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:i("Add this cron job (every minute):")}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>v("* * * * * /usr/bin/php /path/to/your/website/artisan schedule:run >> /dev/null 2>&1"),className:"p-1 self-start sm:self-auto",children:e.jsx(V,{className:"w-3 h-3"})})]}),e.jsxs("code",{className:"text-blue-600 dark:text-blue-400 block",children:["* * * * * /usr/bin/php /path/to/your/website/artisan schedule:run ",">>"," /dev/null 2>&1"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white text-sm sm:text-base",children:i("Method 2: URL/cURL (Recommended for Shared Hosting)")}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i("Setup individual cron jobs for each task using URLs. This works even if Artisan commands are restricted.")}),e.jsx("div",{className:"space-y-2",children:T.map(o=>e.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-800 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-2 gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:o.name}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>v(`${o.frequency||"* * * * *"} curl -s "${window.location.origin}/cron/${o.command}" > /dev/null 2>&1`),className:"p-1 self-start sm:self-auto",children:e.jsx(V,{className:"w-3 h-3"})})]}),e.jsxs("code",{className:"text-xs text-blue-600 dark:text-blue-400 block break-all",children:[o.frequency||"* * * * *",' curl -s "',window.location.origin,"/cron/",o.command,'" ',">>"," /dev/null 2>&1"]}),e.jsxs("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 break-all",children:["URL: ",window.location.origin,"/cron/",o.command]})]},o.id))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:i("General Steps:")}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-gray-600 dark:text-gray-400 text-sm",children:[e.jsx("li",{children:i("Log in to your cPanel or hosting control panel")}),e.jsx("li",{children:i('Navigate to "Cron Jobs" or "Scheduled Tasks"')}),e.jsx("li",{children:i("Choose Method 1 (Artisan) or Method 2 (URLs) above")}),e.jsx("li",{children:i('For Method 1: Replace "/path/to/your/website" with your actual site path')}),e.jsx("li",{children:i("For Method 2: Set up separate cron jobs for each URL with their frequencies")}),e.jsx("li",{children:i("Save the cron job(s)")})]})]})]})]}),e.jsxs("div",{className:"border border-gray-200 dark:border-zinc-800 rounded-lg p-4",children:[e.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white flex items-center gap-2 mb-3 text-sm sm:text-base",children:[e.jsx(le,{className:"w-4 h-4"}),i("VPS / Dedicated Server")]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:i("For VPS, dedicated servers, or when you have SSH access.")}),e.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-800 rounded-lg p-3 font-mono text-xs space-y-2 overflow-x-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:i("1. Edit crontab:")}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>v("crontab -e"),className:"p-1 self-start sm:self-auto",children:e.jsx(V,{className:"w-3 h-3"})})]}),e.jsx("code",{className:"text-green-600 dark:text-green-400 block",children:"crontab -e"}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:i("2. Add this line:")}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>v("* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1"),className:"p-1 self-start sm:self-auto",children:e.jsx(V,{className:"w-3 h-3"})})]}),e.jsxs("code",{className:"text-blue-600 dark:text-blue-400 block",children:["* * * * * cd /path/to/your/project && php artisan schedule:run ",">>"," /dev/null 2>&1"]})]})]})]})]})]})]})}function Sa({settings:r,settingConfig:p,aiSettings:b,languages:X,backups:ee,backupPath:B,cronJobs:E,systemStatus:i}){const[T,H]=f.useState("app-setting"),[N,U]=f.useState("basic-setting"),[v,W]=f.useState("text-ai"),[_,k]=f.useState(!1),[o,c]=f.useState(!1),[z,ae]=f.useState(!1),ce=()=>{const w=Math.floor(Math.random()*5)+1;return new Date(Date.now()-w*60*60*1e3).toISOString()},[de]=f.useState(ce()),a=ne(),[t,me]=f.useState({site_name:r.site_name||"",phone:r.phone||"",phone_code:r.phone_code||"",email:r.email||"",country:r.country||"",address:r.address||"",time_zone:r.time_zone||"",date_format:r.date_format||"",data_per_page:r.data_per_page||"15",preloader_enabled:r.preloader_enabled||"1",smtp_host:r.smtp_host||"",smtp_port:r.smtp_port||"587",smtp_username:r.smtp_username||"",smtp_password:r.smtp_password||"",smtp_encryption:r.smtp_encryption||"tls",mail_from_address:r.mail_from_address||"",mail_from_name:r.mail_from_name||"",email_notifications:r.email_notifications||"1",welcome_email:r.welcome_email||"1",password_reset_email:r.password_reset_email||"1",security_alerts:r.security_alerts||"1",mail_password_reset:r.mail_password_reset||"1",mail_account_verification:r.mail_account_verification||"1",mail_notifications:r.mail_notifications||"1",mail_test_mode:r.mail_test_mode||"0",max_file_size:r.max_file_size||"10",allowed_file_types:r.allowed_file_types||"jpg,jpeg,png,gif,mp4,mov,pdf,doc,docx",image_quality:r.image_quality||"80",storage_driver:r.storage_driver||"local",aws_access_key_id:r.aws_access_key_id||"",aws_secret_access_key:r.aws_secret_access_key||"",aws_default_region:r.aws_default_region||"us-east-1",aws_bucket:r.aws_bucket||"",auto_resize_images:r.auto_resize_images||"1",generate_thumbnails:r.generate_thumbnails||"1",thumbnail_width:r.thumbnail_width||"300",thumbnail_height:r.thumbnail_height||"300",cache_driver:r.cache_driver||"file",cache_ttl:r.cache_ttl||"60",two_factor_auth:r.two_factor_auth||"0",session_timeout:r.session_timeout||"30",max_login_attempts:r.max_login_attempts||"5",lockout_duration:r.lockout_duration||"15",security_notifications:r.security_notifications||"1",password_min_length:r.password_min_length||"6",password_require_uppercase:r.password_require_uppercase||"0",password_require_numbers:r.password_require_numbers||"0",password_require_special:r.password_require_special||"0",privacy_mode:r.privacy_mode||"0",data_retention_days:r.data_retention_days||"365",gdpr_compliance:r.gdpr_compliance||"0",data_export_enabled:r.data_export_enabled||"1",account_deletion_enabled:r.account_deletion_enabled||"1",audit_logs_enabled:r.audit_logs_enabled||"0"}),[R,$]=f.useState({primary_color:r.primary_color??"#667eea",secondary_color:r.secondary_color??"#764ba2",primary_color_text:r.primary_color_text??"#ffffff",secondary_color_text:r.secondary_color_text??"#ffffff",body_text_primary:r.body_text_primary??"#1a202c",body_text_secondary:r.body_text_secondary??"#718096"});f.useEffect(()=>{$({primary_color:r.primary_color??"#667eea",secondary_color:r.secondary_color??"#764ba2",primary_color_text:r.primary_color_text??"#ffffff",secondary_color_text:r.secondary_color_text??"#ffffff",body_text_primary:r.body_text_primary??"#1a202c",body_text_secondary:r.body_text_secondary??"#718096"})},[r]),f.useEffect(()=>{const w={site_name:r.site_name||"",phone:r.phone||"",phone_code:r.phone_code||"",email:r.email||"",country:r.country||"",address:r.address||"",time_zone:r.time_zone||"",date_format:r.date_format||"",data_per_page:r.data_per_page||"15",preloader_enabled:r.preloader_enabled||"1",smtp_host:r.smtp_host||"",smtp_port:r.smtp_port||"587",smtp_username:r.smtp_username||"",smtp_password:r.smtp_password||"",smtp_encryption:r.smtp_encryption||"tls",mail_from_address:r.mail_from_address||"",mail_from_name:r.mail_from_name||"",email_notifications:r.email_notifications||"1",welcome_email:r.welcome_email||"1",password_reset_email:r.password_reset_email||"1",security_alerts:r.security_alerts||"1",mail_password_reset:r.mail_password_reset||"1",mail_account_verification:r.mail_account_verification||"1",mail_notifications:r.mail_notifications||"1",mail_test_mode:r.mail_test_mode||"0",max_file_size:r.max_file_size||"10",allowed_file_types:r.allowed_file_types||"jpg,jpeg,png,gif,mp4,mov,pdf,doc,docx",image_quality:r.image_quality||"80",storage_driver:r.storage_driver||"local",aws_access_key_id:r.aws_access_key_id||"",aws_secret_access_key:r.aws_secret_access_key||"",aws_default_region:r.aws_default_region||"us-east-1",aws_bucket:r.aws_bucket||"",auto_resize_images:r.auto_resize_images||"1",generate_thumbnails:r.generate_thumbnails||"1",thumbnail_width:r.thumbnail_width||"300",thumbnail_height:r.thumbnail_height||"300",cache_driver:r.cache_driver||"file",cache_ttl:r.cache_ttl||"60",two_factor_auth:r.two_factor_auth||"0",session_timeout:r.session_timeout||"30",max_login_attempts:r.max_login_attempts||"5",lockout_duration:r.lockout_duration||"15",security_notifications:r.security_notifications||"1",password_min_length:r.password_min_length||"6",password_require_uppercase:r.password_require_uppercase||"0",password_require_numbers:r.password_require_numbers||"0",password_require_special:r.password_require_special||"0",privacy_mode:r.privacy_mode||"0",data_retention_days:r.data_retention_days||"365",gdpr_compliance:r.gdpr_compliance||"0",data_export_enabled:r.data_export_enabled||"1",account_deletion_enabled:r.account_deletion_enabled||"1",audit_logs_enabled:r.audit_logs_enabled||"0"},s=JSON.stringify(t)!==JSON.stringify(w);c(s)},[t,r]);const ue=[{label:a("Dashboard"),href:"/user/dashboard",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})})},{label:a("Settings"),icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"})})}],l=(w,s)=>{me(S=>({...S,[w]:s})),c(!0)},xe=(w,s)=>{$(S=>({...S,[w]:s})),c(!0)},D=()=>{k(!0),m.post(u("user.setting.store"),t,{preserveScroll:!0,preserveState:!1,onSuccess:()=>{c(!1)},onFinish:()=>{k(!1)},onError:()=>{k(!1),j.error(a("Failed to save settings"))}})},pe=()=>{k(!0),m.post(u("user.setting.store"),R,{preserveScroll:!0,preserveState:!1,onSuccess:()=>{c(!1)},onFinish:()=>{k(!1)},onError:()=>{k(!1),j.error(a("Failed to save theme settings"))}})},he=()=>{var w;switch(R.primary_color,R.secondary_color,T){case"app-setting":return e.jsxs(C,{variant:"glass",className:"min-h-[600px]",title:a("Application Settings"),description:a("Configure and customize your application settings, preferences, and integrations"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})}),children:[e.jsx(se,{activeTab:N,onTabChange:U,tabs:[{id:"basic-setting",label:a("General Settings")},{id:"theme-setting",label:a("Theme & Appearance")},{id:"logo-setting",label:a("Logo & Branding")},{id:"logging",label:a("System Logs")}]}),e.jsx(ie,{mode:"wait",children:e.jsxs(Q.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},className:"mt-6",children:[N==="basic-setting"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("General Settings")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a("Configure general application settings and preferences")})]}),e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(h,{variant:"outline",onClick:()=>window.location.reload(),disabled:!o,className:`px-4 py-2.5 border border-gray-300 dark:border-zinc-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-zinc-800 rounded-lg font-medium transition-colors ${o?"":"opacity-50 cursor-not-allowed"}`,children:a("Cancel")}),e.jsxs(h,{onClick:D,isLoading:_,className:"bg-gradient-to-r from-primary to-secondary hover:from-primary/90 hover:to-secondary/90 text-white px-6 py-2.5 rounded-lg font-medium shadow-sm transition-all duration-200 flex items-center gap-2",children:[!_&&e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a(_?"Saving...":"Save Changes")]})]})]}),o&&e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 mb-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("svg",{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400 mr-3",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:a("You have unsaved changes")}),e.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:a("Don't forget to save your changes before leaving this page")})]})]})}),e.jsxs(y,{title:a("Company Information"),children:[e.jsx(n,{label:a("Site Name"),description:a("Your company or website name"),required:!0,children:e.jsx(d,{value:t.site_name,onChange:s=>l("site_name",s.target.value),placeholder:a("Enter site name"),className:"max-w-md"})}),e.jsx(n,{label:a("Contact Email"),description:a("Primary contact email address"),required:!0,children:e.jsx(d,{type:"email",value:t.email,onChange:s=>l("email",s.target.value),placeholder:a("email@example.com"),className:"max-w-md"})}),e.jsx(n,{label:a("Phone Number"),description:a("Contact phone number"),children:e.jsxs("div",{className:"flex space-x-2 max-w-md",children:[e.jsx(d,{value:t.phone_code,onChange:s=>l("phone_code",s.target.value),placeholder:"+1",className:"w-20"}),e.jsx(d,{value:t.phone,onChange:s=>l("phone",s.target.value),placeholder:a("Phone number"),className:"flex-1"})]})})]}),e.jsx(y,{title:a("User Experience"),children:e.jsx(n,{label:a("Enable Preloader"),description:a("Show loading animation when navigating between pages"),children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(I,{checked:t.preloader_enabled==="1",onCheckedChange:s=>l("preloader_enabled",s?"1":"0"),className:"data-[state=checked]:bg-gradient-to-r data-[state=checked]:from-sky-400 data-[state=checked]:to-cyan-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:t.preloader_enabled==="1"?a("Enabled"):a("Disabled")})]})})}),e.jsxs(y,{title:a("Regional Settings"),children:[e.jsx(n,{label:a("Time Zone"),description:a("Your local time zone"),children:e.jsxs(M,{value:t.time_zone||"",onValueChange:s=>l("time_zone",s),children:[e.jsx(A,{className:"max-w-md h-9 px-3 py-2 bg-gray-50 dark:bg-zinc-800 border-gray-200 dark:border-zinc-800 text-sm",children:e.jsx(L,{placeholder:a("Select time zone")})}),e.jsx(q,{children:(p==null?void 0:p.time_zone)&&Object.entries(p.time_zone).map(([s,S])=>e.jsx(x,{value:s,children:S},s))})]})}),e.jsx(n,{label:a("Date Format"),description:a("How dates are displayed"),children:e.jsxs(M,{value:t.date_format||"",onValueChange:s=>l("date_format",s),children:[e.jsx(A,{className:"max-w-md h-9 px-3 py-2 bg-gray-50 dark:bg-zinc-800 border-gray-200 dark:border-zinc-800 text-sm",children:e.jsx(L,{placeholder:a("Select date format")})}),e.jsx(q,{children:(w=p==null?void 0:p.date_format)==null?void 0:w.map(s=>e.jsx(x,{value:s.format,children:s.label},s.format))})]})})]})]}),N==="theme-setting"&&e.jsx(ke,{themeData:R,onThemeChange:xe,onSubmit:pe,onReset:()=>{$({primary_color:"#667eea",secondary_color:"#764ba2",primary_color_text:"#ffffff",secondary_color_text:"#ffffff",body_text_primary:"#1a202c",body_text_secondary:"#718096"})},isSubmitting:_}),N==="logo-setting"&&e.jsx(Se,{}),N==="logging"&&e.jsx(Ce,{settings:r})]},N)})]});case"ai-configuration":return e.jsxs(C,{title:a("AI Configuration"),description:a("Configure AI modules and settings"),icon:e.jsxs("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:[e.jsx("path",{d:"M13 7H7v6h6V7z"}),e.jsx("path",{fillRule:"evenodd",d:"M7 2a1 1 0 012 0v1h2V2a1 1 0 112 0v1h2a2 2 0 012 2v2h1a1 1 0 110 2h-1v2h1a1 1 0 110 2h-1v2a2 2 0 01-2 2h-2v1a1 1 0 11-2 0v-1H9v1a1 1 0 11-2 0v-1H5a2 2 0 01-2-2v-2H2a1 1 0 110-2h1V9H2a1 1 0 010-2h1V5a2 2 0 012-2h2V2z",clipRule:"evenodd"})]}),badge:{text:"Pro",type:"pro"},children:[e.jsx(se,{activeTab:v,onTabChange:W,tabs:[{id:"text-ai",label:a("Text AI")},{id:"image-ai",label:a("Image AI")},{id:"video-ai",label:a("Video AI")}]}),e.jsx(ie,{mode:"wait",children:e.jsxs(Q.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},className:"mt-6",children:[v==="text-ai"&&e.jsx(be,{settingConfig:p,textAiSetting:b==null?void 0:b.find(s=>s.module==="text_ai")}),v==="image-ai"&&e.jsx(we,{settingConfig:p,imageAiSetting:b==null?void 0:b.find(s=>s.module==="image_ai")}),v==="video-ai"&&e.jsx(Ne,{settingConfig:p,videoAiSetting:b==null?void 0:b.find(s=>s.module==="video_ai")})]},v)})]});case"languages":return e.jsx(C,{title:a("Language & Region"),description:a("Manage languages and regional settings"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M7 2a1 1 0 011 1v1h3a1 1 0 110 2H9.578a18.87 18.87 0 01-1.724 4.78c.29.354.596.696.914 1.026a1 1 0 11-1.44 1.389c-.188-.196-.373-.396-.554-.6a19.098 19.098 0 01-3.107 3.567 1 1 0 01-1.334-1.49 17.087 17.087 0 003.13-3.733 18.992 18.992 0 01-1.487-2.494 1 1 0 111.79-.89c.234.47.489.928.764 1.372.417-.934.752-1.913.997-2.927H3a1 1 0 110-2h3V3a1 1 0 011-1zm6 6a1 1 0 01.894.553l2.991 5.982a.869.869 0 01.02.037l.99 1.98a1 1 0 11-1.79.895L15.383 16h-4.764l-.724 1.447a1 1 0 11-1.788-.894l.99-1.98.019-.038 2.99-5.982A1 1 0 0113 8zm-1.382 6h2.764L13 11.236 11.618 14z",clipRule:"evenodd"})}),children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("Language & Regional Settings")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a("Manage application languages, regional preferences, and localization settings")})]}),e.jsx("div",{className:"flex gap-3",children:e.jsxs("button",{onClick:()=>ae(!0),className:"inline-flex items-center px-4 py-2.5 bg-gradient-to-r from-primary to-secondary hover:from-primary/90 hover:to-secondary/90 text-white text-sm font-medium rounded-lg shadow-sm transition-all duration-200",children:[e.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),a("Add Language")]})})]}),e.jsx(ve,{languages:X,isModalOpen:z,setIsModalOpen:ae})]})});case"backup-setting":return e.jsx(je,{settings:r,backups:ee,backupPath:B});case"automation":return e.jsx(C,{title:a("Automation & Cron Jobs"),description:a("Manage automated tasks and scheduled processes"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3z"})}),badge:{text:"Pro",type:"pro"},children:e.jsx(Be,{cronJobs:E,systemStatus:i,cronUrls:[]})});case"mail-setting":return e.jsx(C,{title:a("Email Configuration"),description:a("Configure SMTP settings and email notifications"),icon:e.jsxs("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:[e.jsx("path",{d:"M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z"}),e.jsx("path",{d:"M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z"})]}),children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("Email Configuration")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a("Configure SMTP server settings and email notification preferences")})]}),e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(h,{variant:"outline",onClick:()=>window.location.reload(),disabled:!o,className:`px-4 py-2.5 border border-gray-300 dark:border-zinc-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-zinc-800 rounded-lg font-medium transition-colors ${o?"":"opacity-50 cursor-not-allowed"}`,children:a("Cancel")}),e.jsxs(h,{onClick:D,isLoading:_,className:"bg-gradient-to-r from-primary to-secondary hover:from-primary/90 hover:to-secondary/90 text-white px-6 py-2.5 rounded-lg font-medium shadow-sm transition-all duration-200 flex items-center gap-2",children:[!_&&e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a(_?"Saving...":"Save Email Settings")]})]})]}),e.jsxs(y,{title:a("SMTP Configuration"),children:[e.jsx(n,{label:a("SMTP Host"),description:a("Your email server hostname"),required:!0,children:e.jsx(d,{value:t.smtp_host||"",onChange:s=>l("smtp_host",s.target.value),placeholder:a("smtp.gmail.com"),className:"max-w-md"})}),e.jsx(n,{label:a("SMTP Port"),description:a("Email server port (usually 587 or 465)"),required:!0,children:e.jsx(d,{type:"number",value:t.smtp_port||"",onChange:s=>l("smtp_port",s.target.value),placeholder:"587",className:"max-w-md"})}),e.jsx(n,{label:a("SMTP Username"),description:a("Your email account username"),required:!0,children:e.jsx(d,{type:"email",value:t.smtp_username||"",onChange:s=>l("smtp_username",s.target.value),placeholder:a("your-email@domain.com"),className:"max-w-md"})}),e.jsx(n,{label:a("SMTP Password"),description:a("Your email account password"),required:!0,children:e.jsx(d,{type:"password",value:t.smtp_password||"",onChange:s=>l("smtp_password",s.target.value),placeholder:a("Your password"),className:"max-w-md"})}),e.jsx(n,{label:a("Encryption"),description:a("SMTP encryption method"),children:e.jsxs(M,{value:t.smtp_encryption||"tls",onValueChange:s=>l("smtp_encryption",s),children:[e.jsx(A,{className:"h-9 px-3 py-2 bg-gray-50 dark:bg-zinc-800 border-gray-200 dark:border-zinc-800 text-sm",children:e.jsx(L,{placeholder:a("Select encryption method")})}),e.jsxs(q,{children:[e.jsx(x,{value:"tls",children:a("TLS")}),e.jsx(x,{value:"ssl",children:a("SSL")}),e.jsx(x,{value:"none",children:a("None")})]})]})}),e.jsx(n,{label:a("From Address"),description:a("Default sender email address"),required:!0,children:e.jsx(d,{type:"email",value:t.mail_from_address||"",onChange:s=>l("mail_from_address",s.target.value),placeholder:a("noreply@yourdomain.com"),className:"max-w-md"})}),e.jsx(n,{label:a("From Name"),description:a("Default sender name"),children:e.jsx(d,{value:t.mail_from_name||"",onChange:s=>l("mail_from_name",s.target.value),placeholder:a("Your App Name"),className:"max-w-md"})})]}),e.jsxs(y,{title:a("Email Notifications"),children:[e.jsx(g,{title:a("Password Reset Emails"),description:a("Send password reset emails to users"),enabled:t.mail_password_reset==="1",onToggle:()=>{const s=t.mail_password_reset==="1"?"0":"1";l("mail_password_reset",s),setTimeout(()=>{m.post(u("user.setting.store"),{mail_password_reset:s})},300)}}),e.jsx(g,{title:a("Account Verification Emails"),description:a("Send verification emails for new accounts"),enabled:t.mail_account_verification==="1",onToggle:()=>{const s=t.mail_account_verification==="1"?"0":"1";l("mail_account_verification",s),setTimeout(()=>{m.post(u("user.setting.store"),{mail_account_verification:s})},300)}}),e.jsx(g,{title:a("General Notifications"),description:a("Send general notification emails"),enabled:t.mail_notifications==="1",onToggle:()=>{const s=t.mail_notifications==="1"?"0":"1";l("mail_notifications",s),setTimeout(()=>{m.post(u("user.setting.store"),{mail_notifications:s})},300)}}),e.jsx(g,{title:a("Test Mode"),description:a("Enable test mode for email sending"),enabled:t.mail_test_mode==="1",onToggle:()=>{const s=t.mail_test_mode==="1"?"0":"1";l("mail_test_mode",s),setTimeout(()=>{m.post(u("user.setting.store"),{mail_test_mode:s})},300)}})]}),e.jsx(y,{title:a("Test Email"),children:e.jsx(n,{label:a("Send Test Email"),description:a("Send a test email to verify your configuration"),children:e.jsxs("div",{className:"flex items-center space-x-2 max-w-md",children:[e.jsx(d,{type:"email",placeholder:a("test@example.com"),className:"flex-1",id:"test-email-input"}),e.jsx(h,{variant:"outline",onClick:()=>{var S;const s=(S=document.getElementById("test-email-input"))==null?void 0:S.value;s&&m.post(u("user.setting.test-email"),{...t,test_email:s})},children:a("Send Test")})]})})})]})});case"security":return e.jsx(C,{title:a("Security & Privacy"),description:a("Configure security settings and privacy options"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("Security & Privacy Settings")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a("Configure authentication, password policies, and privacy options")})]}),e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(h,{variant:"outline",onClick:()=>window.location.reload(),disabled:!o,className:`px-4 py-2.5 border border-gray-300 dark:border-zinc-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-zinc-800 rounded-lg font-medium transition-colors ${o?"":"opacity-50 cursor-not-allowed"}`,children:a("Cancel")}),e.jsxs(h,{onClick:D,isLoading:_,className:"bg-gradient-to-r from-primary to-secondary hover:from-primary/90 hover:to-secondary/90 text-white px-6 py-2.5 rounded-lg font-medium shadow-sm transition-all duration-200 flex items-center gap-2",children:[!_&&e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a(_?"Saving...":"Save Security Settings")]})]})]}),e.jsxs(y,{title:a("Authentication Security"),children:[e.jsx("div",{className:"space-y-4",children:e.jsx(g,{title:a("Enforce 2FA for All Users"),description:a("Require all users to enable two-factor authentication"),enabled:t.two_factor_auth==="1",onToggle:()=>{const s=t.two_factor_auth==="1"?"0":"1";l("two_factor_auth",s),setTimeout(()=>{m.post(u("user.setting.store"),{two_factor_auth:s},{preserveScroll:!0,preserveState:!0})},500)}})}),e.jsx(n,{label:a("Session Timeout"),description:a("Auto-logout users after inactivity (minutes)"),children:e.jsxs(M,{value:t.session_timeout||"30",onValueChange:s=>l("session_timeout",s),children:[e.jsx(A,{className:"w-full h-9 px-3 py-2 bg-gray-50 dark:bg-zinc-800 border-gray-200 dark:border-zinc-800 text-sm",children:e.jsx(L,{placeholder:a("Select timeout duration")})}),e.jsxs(q,{children:[e.jsx(x,{value:"15",children:a("15 minutes")}),e.jsx(x,{value:"30",children:a("30 minutes")}),e.jsx(x,{value:"60",children:a("1 hour")}),e.jsx(x,{value:"120",children:a("2 hours")}),e.jsx(x,{value:"480",children:a("8 hours")})]})]})}),e.jsx(n,{label:a("Max Login Attempts"),description:a("Maximum failed login attempts before lockout"),children:e.jsx(d,{type:"number",value:t.max_login_attempts||"5",onChange:s=>l("max_login_attempts",s.target.value),placeholder:"5",className:"max-w-md",min:"1",max:"10"})}),e.jsx(n,{label:a("Lockout Duration"),description:a("Account lockout duration (minutes)"),children:e.jsx(d,{type:"number",value:t.lockout_duration||"15",onChange:s=>l("lockout_duration",s.target.value),placeholder:"15",className:"max-w-md",min:"5",max:"1440"})}),e.jsx(g,{title:a("Security Notifications"),description:a("Send notifications for security events"),enabled:t.security_notifications==="1",onToggle:()=>{const s=t.security_notifications==="1"?"0":"1";l("security_notifications",s),setTimeout(()=>{m.post(u("user.setting.store"),{security_notifications:s},{preserveScroll:!0,preserveState:!0})},500)}})]}),e.jsxs(y,{title:a("Password Security"),children:[e.jsx(n,{label:a("Minimum Password Length"),description:a("Minimum number of characters required"),children:e.jsx(d,{type:"number",value:t.password_min_length||"6",onChange:s=>l("password_min_length",s.target.value),placeholder:"6",className:"max-w-md",min:"4",max:"50"})}),e.jsx(g,{title:a("Require Uppercase Letters"),description:a("Password must contain uppercase letters"),enabled:t.password_require_uppercase==="1",onToggle:()=>{const s=t.password_require_uppercase==="1"?"0":"1";l("password_require_uppercase",s),setTimeout(()=>{m.post(u("user.setting.store"),{password_require_uppercase:s},{preserveScroll:!0,preserveState:!0})},500)}}),e.jsx(g,{title:a("Require Numbers"),description:a("Password must contain numbers"),enabled:t.password_require_numbers==="1",onToggle:()=>{const s=t.password_require_numbers==="1"?"0":"1";l("password_require_numbers",s),setTimeout(()=>{m.post(u("user.setting.store"),{password_require_numbers:s},{preserveScroll:!0,preserveState:!0})},500)}}),e.jsx(g,{title:a("Require Special Characters"),description:a("Password must contain special characters"),enabled:t.password_require_special==="1",onToggle:()=>{const s=t.password_require_special==="1"?"0":"1";l("password_require_special",s),setTimeout(()=>{m.post(u("user.setting.store"),{password_require_special:s},{preserveScroll:!0,preserveState:!0})},500)}})]}),e.jsxs(y,{title:a("Privacy & Data"),children:[e.jsx(g,{title:a("Privacy Mode"),description:a("Hide sensitive information in logs"),enabled:t.privacy_mode==="1",onToggle:()=>{const s=t.privacy_mode==="1"?"0":"1";l("privacy_mode",s),setTimeout(()=>{m.post(u("user.setting.store"),{privacy_mode:s},{preserveScroll:!0,preserveState:!0})},500)}}),e.jsx(n,{label:a("Data Retention Days"),description:a("Days to retain user data after deletion"),children:e.jsx(d,{type:"number",value:t.data_retention_days||"365",onChange:s=>l("data_retention_days",s.target.value),placeholder:"365",className:"max-w-md",min:"30",max:"3650"})}),e.jsx(g,{title:a("GDPR Compliance"),description:a("Enable GDPR compliance features"),enabled:t.gdpr_compliance==="1",onToggle:()=>{const s=t.gdpr_compliance==="1"?"0":"1";l("gdpr_compliance",s),setTimeout(()=>{m.post(u("user.setting.store"),{gdpr_compliance:s},{preserveScroll:!0,preserveState:!0})},500)}}),e.jsx(g,{title:a("Data Export"),description:a("Allow users to export their data"),enabled:t.data_export_enabled==="1",onToggle:()=>{const s=t.data_export_enabled==="1"?"0":"1";l("data_export_enabled",s),setTimeout(()=>{m.post(u("user.setting.store"),{data_export_enabled:s},{preserveScroll:!0,preserveState:!0})},500)}}),e.jsx(g,{title:a("Account Deletion"),description:a("Allow users to delete their accounts"),enabled:t.account_deletion_enabled==="1",onToggle:()=>{const s=t.account_deletion_enabled==="1"?"0":"1";l("account_deletion_enabled",s),setTimeout(()=>{m.post(u("user.setting.store"),{account_deletion_enabled:s},{preserveScroll:!0,preserveState:!0})},500)}}),e.jsx(g,{title:a("Audit Logs"),description:a("Enable detailed audit logging"),enabled:t.audit_logs_enabled==="1",onToggle:()=>{const s=t.audit_logs_enabled==="1"?"0":"1";l("audit_logs_enabled",s),setTimeout(()=>{m.post(u("user.setting.store"),{audit_logs_enabled:s},{preserveScroll:!0,preserveState:!0})},500)}})]})]})});case"storage-setting":return e.jsx(C,{title:a("Storage & Media"),description:a("Manage file storage and media settings"),icon:e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{d:"M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z"})}),children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:a("Storage & Media Settings")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:a("Configure file storage, media processing, and cache settings")})]}),e.jsxs(h,{onClick:D,isLoading:_,className:"bg-gradient-to-r from-primary to-secondary hover:from-primary/90 hover:to-secondary/90 text-white px-6 py-2.5 rounded-lg font-medium shadow-sm transition-all duration-200 flex items-center gap-2",children:[!_&&e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),a(_?"Saving...":"Save Storage Settings")]})]}),e.jsxs(y,{title:a("File Upload Settings"),children:[e.jsx(n,{label:a("Maximum File Size"),description:a("Maximum size for file uploads (MB)"),children:e.jsx(d,{type:"number",value:t.max_file_size||"10",onChange:s=>l("max_file_size",s.target.value),min:"1",max:"100"})}),e.jsx(n,{label:a("Allowed File Types"),description:a("Comma-separated list of allowed file extensions"),children:e.jsx(d,{value:t.allowed_file_types||"jpg,jpeg,png,gif,mp4,mov,pdf,doc,docx",onChange:s=>l("allowed_file_types",s.target.value),placeholder:"jpg,jpeg,png,gif,mp4,mov,pdf"})}),e.jsx(n,{label:a("Image Quality"),description:a("JPEG compression quality (1-100)"),children:e.jsx(d,{type:"number",value:t.image_quality||"80",onChange:s=>l("image_quality",s.target.value),min:"1",max:"100"})})]}),e.jsxs(y,{title:a("Storage Configuration"),children:[e.jsx(n,{label:a("Storage Driver"),description:a("Select storage driver for file uploads"),children:e.jsxs(M,{value:t.storage_driver||"local",onValueChange:s=>l("storage_driver",s),children:[e.jsx(A,{className:"w-full h-9 px-3 py-2 bg-gray-50 dark:bg-zinc-800 border-gray-200 dark:border-zinc-800 text-sm",children:e.jsx(L,{placeholder:a("Select storage driver")})}),e.jsxs(q,{children:[e.jsx(x,{value:"local",children:a("Local Storage")}),e.jsx(x,{value:"s3",children:a("Amazon S3")}),e.jsx(x,{value:"digitalocean",children:a("DigitalOcean Spaces")}),e.jsx(x,{value:"google",children:a("Google Cloud Storage")})]})]})}),t.storage_driver==="s3"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{label:a("AWS Access Key"),required:!0,children:e.jsx(d,{value:t.aws_access_key_id||"",onChange:s=>l("aws_access_key_id",s.target.value),placeholder:a("Your AWS Access Key")})}),e.jsx(n,{label:a("AWS Secret Key"),required:!0,children:e.jsx(d,{type:"password",value:t.aws_secret_access_key||"",onChange:s=>l("aws_secret_access_key",s.target.value),placeholder:a("Your AWS Secret Key")})}),e.jsx(n,{label:a("AWS Region"),required:!0,children:e.jsx(d,{value:t.aws_default_region||"us-east-1",onChange:s=>l("aws_default_region",s.target.value),placeholder:"us-east-1"})}),e.jsx(n,{label:a("S3 Bucket Name"),required:!0,children:e.jsx(d,{value:t.aws_bucket||"",onChange:s=>l("aws_bucket",s.target.value),placeholder:a("your-bucket-name")})})]})]}),e.jsxs(y,{title:a("Media Processing"),children:[e.jsx(n,{label:a("Auto-resize Images"),children:e.jsx(I,{checked:t.auto_resize_images==="1"||t.auto_resize_images===!0,onCheckedChange:s=>l("auto_resize_images",s?"1":"0")})}),e.jsx(n,{label:a("Generate Thumbnails"),children:e.jsx(I,{checked:t.generate_thumbnails==="1"||t.generate_thumbnails===!0,onCheckedChange:s=>l("generate_thumbnails",s?"1":"0")})}),e.jsx(n,{label:a("Thumbnail Size"),description:a("Thumbnail dimensions in pixels"),children:e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(d,{type:"number",value:t.thumbnail_width||"300",onChange:s=>l("thumbnail_width",s.target.value),placeholder:"300"}),e.jsx("span",{className:"flex items-center text-gray-500",children:"×"}),e.jsx(d,{type:"number",value:t.thumbnail_height||"300",onChange:s=>l("thumbnail_height",s.target.value),placeholder:"300"})]})})]}),e.jsxs(y,{title:a("Cache Settings"),children:[e.jsx(n,{label:a("Cache Driver"),description:a("Select cache driver for application"),children:e.jsxs(M,{value:t.cache_driver||"file",onValueChange:s=>l("cache_driver",s),children:[e.jsx(A,{className:"w-full h-9 px-3 py-2 bg-gray-50 dark:bg-zinc-800 border-gray-200 dark:border-zinc-800 text-sm",children:e.jsx(L,{placeholder:a("Select cache driver")})}),e.jsxs(q,{children:[e.jsx(x,{value:"file",children:a("File Cache")}),e.jsx(x,{value:"redis",children:a("Redis")}),e.jsx(x,{value:"memcached",children:a("Memcached")}),e.jsx(x,{value:"database",children:a("Database")})]})]})}),e.jsx(n,{label:a("Cache TTL"),description:a("Cache time-to-live in minutes"),children:e.jsx(d,{type:"number",value:t.cache_ttl||"60",onChange:s=>l("cache_ttl",s.target.value),min:"1",placeholder:"60"})})]})]})});default:return e.jsx(C,{title:a("Coming Soon"),description:a("This feature is under development"),variant:"gradient",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-24 h-24 bg-gray-100 dark:bg-zinc-800 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-12 h-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:a("Feature Under Development")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 max-w-md mx-auto",children:a("We're working hard to bring you this feature. Stay tuned for updates!")})]})})}};return e.jsx(ge,{breadcrumbs:ue,children:e.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-zinc-950",children:[e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"px-0 py-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(ye,{className:"h-5 w-5 sm:h-6 sm:w-6 text-primary"}),e.jsx("h1",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:a("Settings")})]}),e.jsx("div",{children:e.jsx("p",{className:"mt-2 text-gray-500 dark:text-gray-400",children:a("Manage your application preferences and configurations")})})]}),e.jsx("div",{className:"flex items-center space-x-3",children:e.jsxs(h,{variant:"outline",className:"flex items-center space-x-2",onClick:()=>m.get(u("user.profile.settings")),children:[e.jsx("svg",{className:"w-4 h-4 text-gray-700 dark:text-gray-200",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),e.jsx("span",{className:"text-gray-700 dark:text-gray-200",children:a("Profile")})]})})]})})}),e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"w-full mx-auto",children:e.jsxs("div",{className:"flex gap-6 lg:flex-row flex-col",children:[e.jsx(fe,{activeSection:T,onSectionChange:H,themeData:R,lastBackupTime:de}),e.jsx("div",{className:"flex-1",children:he()})]})})})]})})}export{Sa as default};
