import{B as V,r as p,u as B,p as b,b as m,d as e,n as a,e as s,h as n,v as i,C as v,i as M,F as C,x as D,t as f,z,A as h,M as A,_ as F}from"./index-BnjuZaZi.js";const T={class:"p-6 h-screen overflow-y-auto custom-scrollbar"},K={class:"space-y-4"},E={class:"grid grid-cols-1 gap-6"},G={class:"space-y-2"},I={class:"space-y-2"},j={class:"space-y-2"},N={class:"relative"},L={class:"space-y-2"},R={class:"space-y-2"},$={class:"grid grid-cols-1 gap-6 mt-8"},q={class:"space-y-2"},H={class:"space-y-2"},J={class:"mt-8"},O={class:"space-y-4"},P={class:"space-y-2"},Q={key:0,class:"space-y-4"},W={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},X={class:"space-y-2"},Y={class:"space-y-2"},Z={class:"space-y-2"},ee={class:"space-y-2"},oe={class:"mt-8"},re={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},te={class:"space-y-2"},ae={class:"flex items-center space-x-2"},se={class:"space-y-2"},le={class:"flex items-center space-x-2"},ne={class:"space-y-2"},ie={class:"flex items-center space-x-2"},de={class:"space-y-2"},ue={class:"flex flex-wrap gap-3"},ge=["value"],ce={class:"space-y-2"},ye={class:"flex items-center space-x-2"},pe={class:"space-y-2"},be={class:"flex items-center"},me=["aria-checked"],ve={class:"mt-8"},xe={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},fe={class:"space-y-2"},he={class:"flex items-center space-x-2"},_e={class:"space-y-2"},we={class:"flex items-center space-x-2"},ke=V({__name:"SystemSettingsView",setup(Ue){const t=z("isDarkMode"),l=p({name:"",description:"",file_storage:"",expireStyle:[],admin_token:"",robotsText:"",keywords:"",notify_title:"",notify_content:"",openUpload:1,uploadSize:1,uploadMinute:1,max_save_seconds:0,opacity:.9,s3_access_key_id:"",background:"",showAdminAddr:0,page_explain:"",s3_secret_access_key:"",aws_session_token:"",s3_signature_version:"",s3_region_name:"",s3_bucket_name:"",s3_endpoint_url:"",s3_hostname:"",uploadCount:1,errorMinute:1,errorCount:1}),c=p(1),y=p("MB"),u=p(1),g=p("天"),_=(d,o)=>d*{秒:1,分:60,时:3600,天:86400}[o],w=()=>{h({url:"/admin/config/get",method:"get"}).then(d=>{l.value=d.detail;let o=l.value.uploadSize;o>=1024*1024*1024?(c.value=Math.round(o/(1024*1024*1024)),y.value="GB"):o>=1024*1024?(c.value=Math.round(o/(1024*1024)),y.value="MB"):(c.value=Math.round(o/1024),y.value="KB");let r=l.value.max_save_seconds;r===0?(u.value=7,g.value="天"):r%86400===0&&r>=86400?(u.value=r/86400,g.value="天"):r%3600===0&&r>=3600?(u.value=r/3600,g.value="时"):r%60===0&&r>=60?(u.value=r/60,g.value="分"):(u.value=r,g.value="秒")})},x=B(),k=(d,o)=>d*{KB:1024,MB:1048576,GB:1073741824}[o],U=()=>{const d={...l.value};d.uploadSize=k(c.value,y.value),u.value===0?d.max_save_seconds=7*86400:d.max_save_seconds=_(u.value,g.value),h({url:"/admin/config/update",method:"patch",data:d}).then(o=>{o.code==200?x.showAlert("保存成功","success"):x.showAlert(o.message,"error")})};return w(),(d,o)=>(b(),m("div",T,[e("h2",{class:a(["text-2xl font-bold mb-6",[s(t)?"text-white":"text-gray-800"]])}," 系统设置 ",2),e("div",{class:a(["space-y-6 rounded-lg shadow-md p-6",[s(t)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[e("section",K,[e("h3",{class:a(["text-lg font-medium mb-4",[s(t)?"text-white":"text-gray-800"]])}," 基本设置 ",2),e("div",E,[e("div",G,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 网站名称 ",2),n(e("input",{type:"text","onUpdate:modelValue":o[0]||(o[0]=r=>l.value.name=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.name]])]),e("div",I,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 网站描述 ",2),n(e("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=r=>l.value.description=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.description]])]),e("div",j,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 管理员密码 ",2),e("div",N,[n(e("input",{type:"password","onUpdate:modelValue":o[2]||(o[2]=r=>l.value.admin_token=r),placeholder:"留空则不修改密码",class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.admin_token]]),e("div",{class:a(["absolute inset-y-0 right-0 flex items-center pr-3 text-sm text-gray-400",[s(t)?"text-gray-500":"text-gray-400"]])},o[22]||(o[22]=[e("span",{class:"text-xs"},"留空则不修改",-1)]),2)])]),e("div",L,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 关键词 ",2),n(e("input",{type:"text","onUpdate:modelValue":o[3]||(o[3]=r=>l.value.keywords=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.keywords]])]),e("div",R,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," Robots.txt ",2),n(e("textarea",{"onUpdate:modelValue":o[4]||(o[4]=r=>l.value.robotsText=r),rows:"3",class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border resize-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.robotsText]])])]),e("div",$,[e("div",q,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 通知标题 ",2),n(e("input",{type:"text","onUpdate:modelValue":o[5]||(o[5]=r=>l.value.notify_title=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.notify_title]])]),e("div",H,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 通知内容 ",2),n(e("textarea",{"onUpdate:modelValue":o[6]||(o[6]=r=>l.value.notify_content=r),rows:"3",class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border resize-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.notify_content]])])]),e("div",J,[e("h3",{class:a(["text-lg font-medium mb-4",[s(t)?"text-white":"text-gray-800"]])}," 存储设置 ",2),e("div",O,[e("div",P,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 存储方式 ",2),n(e("select",{"onUpdate:modelValue":o[7]||(o[7]=r=>l.value.file_storage=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border appearance-none bg-no-repeat bg-right focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none cursor-pointer",[s(t)?"bg-gray-700 border-gray-600 text-white hover:border-gray-500":"border-gray-300 hover:border-gray-400"]]),style:{"background-image":"url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M7%208l3%203%203-3%22%20stroke%3D%22%236B7280%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E')"}},o[23]||(o[23]=[e("option",{value:"local"},"本地存储",-1),e("option",{value:"s3"},"S3 存储",-1)]),2),[[v,l.value.file_storage]])]),l.value.file_storage==="s3"?(b(),m("div",Q,[e("div",W,[e("div",X,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," S3 AccessKeyId ",2),n(e("input",{type:"text","onUpdate:modelValue":o[8]||(o[8]=r=>l.value.s3_access_key_id=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.s3_access_key_id]])]),e("div",Y,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," S3 SecretAccessKey ",2),n(e("input",{type:"password","onUpdate:modelValue":o[9]||(o[9]=r=>l.value.s3_secret_access_key=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.s3_secret_access_key]])]),e("div",Z,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," S3 BucketName ",2),n(e("input",{type:"text","onUpdate:modelValue":o[10]||(o[10]=r=>l.value.s3_bucket_name=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.s3_bucket_name]])]),e("div",ee,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," S3 EndpointUrl ",2),n(e("input",{type:"text","onUpdate:modelValue":o[11]||(o[11]=r=>l.value.s3_endpoint_url=r),class:a(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.s3_endpoint_url]])])])])):M("",!0)])]),e("div",oe,[e("h3",{class:a(["text-lg font-medium mb-4",[s(t)?"text-white":"text-gray-800"]])}," 上传限制 ",2),e("div",re,[e("div",te,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 每分钟上传限制 ",2),e("div",ae,[n(e("input",{type:"number","onUpdate:modelValue":o[12]||(o[12]=r=>l.value.uploadMinute=r),class:a(["w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.uploadMinute]]),e("span",{class:a([s(t)?"text-gray-300":"text-gray-700"])},"分钟",2)])]),e("div",se,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 上传数量限制 ",2),e("div",le,[n(e("input",{type:"number","onUpdate:modelValue":o[13]||(o[13]=r=>l.value.uploadCount=r),class:a(["w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.uploadCount]]),e("span",{class:a([s(t)?"text-gray-300":"text-gray-700"])},"个文件",2)])]),e("div",ne,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 文件大小限制 ",2),e("div",ie,[n(e("input",{type:"number","onUpdate:modelValue":o[14]||(o[14]=r=>c.value=r),class:a(["w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,c.value]]),n(e("select",{"onUpdate:modelValue":o[15]||(o[15]=r=>y.value=r),class:a(["rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white hover:border-gray-500":"border-gray-300 hover:border-gray-400"]])},o[24]||(o[24]=[e("option",{value:"KB"},"KB",-1),e("option",{value:"MB"},"MB",-1),e("option",{value:"GB"},"GB",-1)]),2),[[v,y.value]])])]),e("div",de,[e("label",{class:a(["block text-sm font-medium mb-2",[s(t)?"text-gray-300":"text-gray-700"]])}," 过期方式 ",2),e("div",ue,[(b(),m(C,null,D(["day","hour","minute","forever","count"],r=>e("label",{key:r,class:"relative inline-flex items-center group cursor-pointer"},[n(e("input",{type:"checkbox",value:r,"onUpdate:modelValue":o[16]||(o[16]=S=>l.value.expireStyle=S),class:"peer sr-only"},null,8,ge),[[A,l.value.expireStyle]]),e("div",{class:a(["px-4 py-2 rounded-full border-2 transition-all duration-200 select-none",[l.value.expireStyle.includes(r)?(s(t),"bg-indigo-600 border-indigo-600 text-white"):s(t)?"bg-gray-700 border-gray-600 text-gray-300 hover:border-indigo-500":"bg-white border-gray-300 text-gray-700 hover:border-indigo-500"]])},f({day:"按天",hour:"按小时",minute:"按分钟",forever:"永久",count:"按次数"}[r]),3)])),64))])]),e("div",ce,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 最长保存时间 ",2),e("div",ye,[n(e("input",{type:"number","onUpdate:modelValue":o[17]||(o[17]=r=>u.value=r),class:a(["w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,u.value]]),n(e("select",{"onUpdate:modelValue":o[18]||(o[18]=r=>g.value=r),class:a(["rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white hover:border-gray-500":"border-gray-300 hover:border-gray-400"]])},o[25]||(o[25]=[e("option",{value:"秒"},"秒",-1),e("option",{value:"分"},"分",-1),e("option",{value:"时"},"时",-1),e("option",{value:"天"},"天",-1)]),2),[[v,g.value]])])]),e("div",pe,[e("label",{class:a(["block text-sm font-medium mb-2",[s(t)?"text-gray-300":"text-gray-700"]])}," 游客上传 ",2),e("div",be,[e("button",{type:"button",onClick:o[19]||(o[19]=r=>l.value.openUpload=l.value.openUpload===1?0:1),class:a(["relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",[l.value.openUpload===1?"bg-indigo-600":"bg-gray-200"]]),role:"switch","aria-checked":l.value.openUpload===1},[e("span",{class:a(["pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",[l.value.openUpload===1?"translate-x-5":"translate-x-0",s(t)&&l.value.openUpload!==1?"bg-gray-100":"bg-white"]])},null,2)],10,me),e("span",{class:a(["ml-3 text-sm",[s(t)?"text-gray-300":"text-gray-700"]])},f(l.value.openUpload===1?"已开启":"已关闭"),3)])])])]),e("div",ve,[e("h3",{class:a(["text-lg font-medium mb-4",[s(t)?"text-white":"text-gray-800"]])}," 错误限制 ",2),e("div",xe,[e("div",fe,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 每分钟错误限制 ",2),e("div",he,[n(e("input",{type:"number","onUpdate:modelValue":o[20]||(o[20]=r=>l.value.errorMinute=r),class:a(["w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.errorMinute]]),e("span",{class:a([s(t)?"text-gray-300":"text-gray-700"])},"分钟",2)])]),e("div",_e,[e("label",{class:a(["block text-sm font-medium",[s(t)?"text-gray-300":"text-gray-700"]])}," 错误次数限制 ",2),e("div",we,[n(e("input",{type:"number","onUpdate:modelValue":o[21]||(o[21]=r=>l.value.errorCount=r),class:a(["w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(t)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[i,l.value.errorCount]]),e("span",{class:a([s(t)?"text-gray-300":"text-gray-700"])},"次",2)])])])]),e("div",{class:"flex justify-end mt-8"},[e("button",{onClick:U,class:"px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200"}," 保存设置 ")])])],2)]))}}),Ve=F(ke,[["__scopeId","data-v-2f785aa5"]]);export{Ve as default};