llonebot-dist 7.1.2 → 7.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -227,82 +227,82 @@ Error generating stack: `+s.message+`
227
227
  *
228
228
  * This source code is licensed under the ISC license.
229
229
  * See the LICENSE file in the root directory of this source tree.
230
- */const Mp=U("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Rp=({activeTab:e,onTabChange:t,accountInfo:n})=>{const r=[{id:"dashboard",icon:kp,label:"Dashboard"},{id:"onebot",icon:ro,label:"OneBot 11"},{id:"satori",icon:Lc,label:"Satori"},{id:"milky",icon:Np,label:"Milky"},{id:"other",icon:bp,label:"其他配置"},{id:"about",icon:vp,label:"关于"}];return o.jsxs("div",{className:"w-64 bg-white/50 backdrop-blur-2xl h-screen flex flex-col shadow-xl border-r border-white/30 sticky top-0",children:[o.jsx("div",{className:"p-6 border-b border-white/20",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"w-12 h-12 rounded-2xl overflow-hidden shadow-lg flex-shrink-0",children:o.jsx("img",{src:"/logo.jpg",alt:"Logo",className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h1",{className:"text-xl font-bold text-gray-800 truncate",children:"LLBot"}),o.jsx("p",{className:"text-xs text-gray-500",children:"WebUI"})]})]})}),o.jsx("nav",{className:"flex-1 p-4 space-y-1",children:r.map(l=>{const s=l.icon,i=e===l.id;return o.jsxs("button",{onClick:()=>t(l.id),className:`w-full flex items-center space-x-3 px-4 py-3 rounded-2xl transition-all duration-200 ${i?"bg-gradient-to-r from-blue-500 to-purple-600 text-white shadow-lg scale-105":"text-gray-700 hover:bg-white/50 hover:backdrop-blur-sm"}`,children:[o.jsx(s,{size:20}),o.jsx("span",{className:"font-medium",children:l.label})]},l.id)})}),n&&o.jsx("div",{className:"p-4 border-t border-white/20",children:o.jsxs("div",{className:"flex items-center space-x-3 px-3 py-2",children:[o.jsx("img",{src:`https://thirdqq.qlogo.cn/g?b=qq&nk=${n.uin}&s=640`,alt:"头像",className:"w-10 h-10 rounded-full object-cover ring-2 ring-white/50",onError:l=>{const s=l.target;s.style.display="none";const i=s.nextElementSibling;i&&(i.style.display="flex")}}),o.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-400 to-blue-500 rounded-full items-center justify-center text-white font-semibold hidden",style:{display:"none"},children:n.nick.charAt(0).toUpperCase()}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:n.nick}),o.jsx("p",{className:"text-xs text-gray-500 truncate",children:n.uin})]})]})})]})},pa=({children:e})=>{const t=C.useRef(null);return t.current||(t.current=document.createElement("div")),C.useEffect(()=>{const n=document.body,r=t.current;return n.appendChild(r),()=>{n.removeChild(r)}},[]),ti.createPortal(e,t.current)},Ip=({message:e,type:t="success",duration:n=3e3,onClose:r})=>{const[l,s]=C.useState(!0);C.useEffect(()=>{const u=setTimeout(()=>{s(!1),setTimeout(r,300)},n);return()=>clearTimeout(u)},[n,r]);const i={success:o.jsx(gp,{className:"w-5 h-5"}),error:o.jsx(Lp,{className:"w-5 h-5"}),warning:o.jsx(mp,{className:"w-5 h-5"})},a={success:"bg-green-50/90 backdrop-blur-md border-green-200/50 text-green-800",error:"bg-red-50/90 backdrop-blur-md border-red-200/50 text-red-800",warning:"bg-yellow-50/90 backdrop-blur-md border-yellow-200/50 text-yellow-800"};return o.jsxs("div",{className:`fixed top-4 right-4 flex items-center gap-3 px-4 py-3 rounded-2xl border shadow-lg transition-all duration-300 ${a[t]} ${l?"translate-x-0 opacity-100":"translate-x-full opacity-0"}`,style:{minWidth:"300px",maxWidth:"500px",zIndex:99999},children:[o.jsx("div",{className:"flex-shrink-0",children:i[t]}),o.jsx("p",{className:"flex-1 text-sm font-medium",children:e}),o.jsx("button",{onClick:()=>{s(!1),setTimeout(r,300)},className:"flex-shrink-0 hover:opacity-70 transition-opacity",children:o.jsx(sr,{size:18})})]})};let Fp=0;const Hr=[];let yl=[];const Ic=()=>{Hr.forEach(e=>e([...yl]))},ae=(e,t="success",n=3e3)=>{const r=Fp++;yl.push({id:r,message:e,type:t,duration:n}),Ic()},ma=()=>{const[e,t]=C.useState([]);C.useEffect(()=>{const l=s=>t(s);return Hr.push(l),()=>{const s=Hr.indexOf(l);s>-1&&Hr.splice(s,1)}},[]);const n=l=>{yl=yl.filter(s=>s.id!==l),Ic()},r=o.jsx(o.Fragment,{children:e.map((l,s)=>o.jsx("div",{style:{top:`${1+s*4.5}rem`,zIndex:99999},className:"fixed right-4",children:o.jsx(Ip,{message:l.message,type:l.type,duration:l.duration,onClose:()=>n(l.id)})},l.id))});return ti.createPortal(r,document.body)},Op=({config:e,onChange:t,onSave:n,globalConfig:r})=>{const[l,s]=C.useState(null),[i,a]=C.useState(-1),[u,d]=C.useState(!1),[g,h]=C.useState(!1),[m,v]=C.useState(!1),[y,k]=C.useState(!1),[w,f]=C.useState(""),[c,p]=C.useState(!1),x={ws:{icon:ro,name:"WebSocket正向",desc:"提供WebSocket服务器"},"ws-reverse":{icon:fa,name:"WebSocket反向",desc:"作为客户端连接到WebSocket服务"},http:{icon:hl,name:"HTTP服务",desc:"提供HTTP API服务"},"http-post":{icon:lo,name:"HTTP上报",desc:"上报事件到HTTP服务器"}},N=(S,O)=>{s(S),a(O),v(!1),k(!1),f(S.name||""),p(!1),d(!0)},E=S=>{S.stopPropagation(),k(!0)},z=()=>{if(!l)return;const S={...l,name:w.trim()};s(S),k(!1)},_=()=>{f((l==null?void 0:l.name)||""),k(!1)},F=()=>{var I;if(!l)return;if((l.type==="ws"||l.type==="http")&&!r.onlyLocalhost&&!((I=l.token)!=null&&I.trim())){ae('当"只监听本地地址"关闭时,必须设置 Token!',"error");return}let O;if(m)O=[...e.connect,l];else{if(i<0)return;O=[...e.connect],O[i]=l}const X={...e,connect:O};t(X),d(!1),v(!1),n(X)},b=()=>{if(m){d(!1),v(!1);return}if(i<0)return;const S=e.connect.filter((X,I)=>I!==i),O={...e,connect:S};t(O),d(!1),n(O)},L=S=>{const O={enable:!0,token:"",messageFormat:"array",reportSelfMessage:!1,reportOfflineMessage:!1,debug:!1};let X;switch(S){case"ws":X={...O,type:"ws",port:3001,heartInterval:6e4};break;case"ws-reverse":X={...O,type:"ws-reverse",url:"",heartInterval:6e4};break;case"http":X={...O,type:"http",port:3e3};break;case"http-post":X={...O,type:"http-post",url:"",enableHeart:!1,heartInterval:6e4};break}h(!1),s(X),a(-1),v(!0),p(!1),d(!0)},M=(S,O)=>{l&&s({...l,[S]:O})};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"card p-6",children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"OneBot 11 协议"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"启用或禁用 OneBot 11 适配器"})]}),o.jsx("input",{type:"checkbox",checked:e.enable,onChange:S=>{const O={...e,enable:S.target.checked};t(O),console.log("Config updated:",O),n(O)},className:`w-14 h-7 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
231
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
232
- transition-colors duration-200 ease-in-out\r
233
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
234
- before:w-6 before:h-6 before:rounded-full before:bg-white\r
235
- before:transition-transform before:duration-200\r
236
- checked:before:translate-x-7`})]})}),e.enable&&e.connect&&Array.isArray(e.connect)&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:e.connect.map((S,O)=>{const X=x[S.type],I=X.icon;return o.jsxs("div",{className:`card p-6 cursor-pointer hover:scale-105 transition-all ${S.enable?"ring-2 ring-blue-500":""}`,onClick:()=>N(S,O),children:[o.jsxs("div",{className:"flex items-start justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center ${S.enable?"bg-gradient-to-br from-blue-500 to-purple-600 text-white":"bg-gray-200 text-gray-600"}`,children:o.jsx(I,{size:24})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:S.name||X.name}),o.jsx("p",{className:"text-sm text-gray-600",children:X.desc})]})]}),o.jsx(so,{size:20,className:"text-gray-400"})]}),o.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t border-gray-200",children:[o.jsx("span",{className:`text-xs font-medium px-3 py-1 rounded-full ${S.enable?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:S.enable?"已启用":"未启用"}),S.enable&&o.jsxs(o.Fragment,{children:[(S.type==="ws"||S.type==="http")&&o.jsxs("span",{className:"text-sm text-gray-600",children:["端口: ",S.port]}),(S.type==="ws-reverse"||S.type==="http-post")&&o.jsxs("span",{className:"text-sm text-gray-600 truncate max-w-[180px]",title:S.url||"未配置",children:["URL: ",S.url||"未配置"]})]})]})]},O)})}),o.jsx("div",{className:"flex justify-center mt-6",children:o.jsxs("button",{onClick:()=>h(!0),className:"btn-primary flex items-center gap-2",children:[o.jsx(Rc,{size:20}),"添加适配器"]})})]}),u&&l&&o.jsx(pa,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},children:o.jsxs("div",{className:"bg-white/60 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col border border-white/50",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/20",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1",children:y?o.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[o.jsx("input",{type:"text",value:w,onChange:S=>f(S.target.value),onKeyDown:S=>{S.key==="Enter"&&z(),S.key==="Escape"&&_()},placeholder:"输入自定义名称",className:"flex-1 px-3 py-2 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0}),o.jsx("button",{onClick:z,className:"px-4 py-2 bg-blue-500 text-white rounded-xl hover:bg-blue-600 transition-colors",children:"确定"}),o.jsx("button",{onClick:_,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-xl hover:bg-gray-300 transition-colors",children:"取消"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900",children:[m?"新建 - ":"",l.name||x[l.type].name]}),o.jsx("button",{onClick:E,className:"p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",title:"编辑名称",children:o.jsx(Ep,{size:18})})]})}),o.jsx("button",{onClick:()=>{d(!1),v(!1),k(!1)},className:"text-gray-400 hover:text-gray-600",children:o.jsx(sr,{size:24})})]}),o.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto flex-1",children:[o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"启用此适配器"}),o.jsx("input",{type:"checkbox",checked:l.enable,onChange:S=>M("enable",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
237
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
238
- transition-colors duration-200 ease-in-out\r
239
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
240
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
241
- before:transition-transform before:duration-200\r
242
- checked:before:translate-x-6`})]})}),l.type==="ws"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"端口"}),o.jsx("input",{type:"number",value:l.port,onChange:S=>M("port",parseInt(S.target.value)),className:"input-field"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"心跳间隔 (ms)"}),o.jsx("input",{type:"number",value:l.heartInterval,onChange:S=>M("heartInterval",parseInt(S.target.value)),className:"input-field"})]})]}),l.type==="ws-reverse"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"连接地址"}),o.jsx("input",{type:"text",value:l.url,onChange:S=>M("url",S.target.value),placeholder:"ws://example.com:8080",className:"input-field"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"心跳间隔 (ms)"}),o.jsx("input",{type:"number",value:l.heartInterval,onChange:S=>M("heartInterval",parseInt(S.target.value)),className:"input-field"})]})]}),l.type==="http"&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"端口"}),o.jsx("input",{type:"number",value:l.port,onChange:S=>M("port",parseInt(S.target.value)),className:"input-field"})]}),l.type==="http-post"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"上报地址"}),o.jsx("input",{type:"text",value:l.url,onChange:S=>M("url",S.target.value),placeholder:"http://example.com:8080/webhook",className:"input-field"})]}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"启用心跳"}),o.jsx("input",{type:"checkbox",checked:l.enableHeart,onChange:S=>M("enableHeart",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
243
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
244
- transition-colors duration-200 ease-in-out\r
245
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
246
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
247
- before:transition-transform before:duration-200\r
248
- checked:before:translate-x-6`})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"心跳间隔 (ms)"}),o.jsx("input",{type:"number",value:l.heartInterval,onChange:S=>M("heartInterval",parseInt(S.target.value)),className:"input-field"})]})]}),o.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[o.jsx("h4",{className:"text-md font-semibold text-gray-800 mb-4",children:"通用配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Token"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:c?"text":"password",value:l.token,onChange:S=>M("token",S.target.value),placeholder:"访问令牌",className:"input-field pr-12"}),o.jsx("button",{type:"button",onClick:()=>p(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors p-1",children:c?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"消息格式"}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs("label",{className:"flex items-center",children:[o.jsx("input",{type:"radio",value:"array",checked:l.messageFormat==="array",onChange:S=>M("messageFormat",S.target.value),className:"mr-2"}),"消息段 (array)"]}),o.jsxs("label",{className:"flex items-center",children:[o.jsx("input",{type:"radio",value:"string",checked:l.messageFormat==="string",onChange:S=>M("messageFormat",S.target.value),className:"mr-2"}),"CQ码 (string)"]})]})]}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"上报自己发送的消息"}),o.jsx("input",{type:"checkbox",checked:l.reportSelfMessage,onChange:S=>M("reportSelfMessage",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
249
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
250
- transition-colors duration-200 ease-in-out\r
251
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
252
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
253
- before:transition-transform before:duration-200\r
254
- checked:before:translate-x-6`})]})}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"上报离线消息"}),o.jsx("input",{type:"checkbox",checked:l.reportOfflineMessage,onChange:S=>M("reportOfflineMessage",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
255
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
256
- transition-colors duration-200 ease-in-out\r
257
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
258
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
259
- before:transition-transform before:duration-200\r
260
- checked:before:translate-x-6`})]})}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"调试模式"}),o.jsx("input",{type:"checkbox",checked:l.debug,onChange:S=>M("debug",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
261
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
262
- transition-colors duration-200 ease-in-out\r
263
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
264
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
265
- before:transition-transform before:duration-200\r
266
- checked:before:translate-x-6`})]})})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-white/20",children:[!m&&o.jsxs("button",{onClick:b,className:"px-6 py-2.5 bg-red-500 hover:bg-red-600 text-white rounded-xl font-medium transition-colors flex items-center gap-2",children:[o.jsx(gl,{size:18}),"删除"]}),m&&o.jsx("div",{})," ",o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:()=>d(!1),className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-xl font-medium transition-colors",children:"取消"}),o.jsx("button",{onClick:F,className:"btn-primary",children:"保存"})]})]})]})})}),g&&o.jsx(pa,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},children:o.jsxs("div",{className:"bg-white/60 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-md border border-white/50",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/20",children:[o.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:"选择适配器类型"}),o.jsx("button",{onClick:()=>h(!1),className:"text-gray-400 hover:text-gray-600",children:o.jsx(sr,{size:24})})]}),o.jsxs("div",{className:"p-6 space-y-3",children:[o.jsxs("button",{onClick:()=>L("ws"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-blue-50 to-purple-50 hover:from-blue-100 hover:to-purple-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-purple-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(ro,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"WebSocket正向"}),o.jsx("p",{className:"text-sm text-gray-600",children:"作为WebSocket服务器"})]})]}),o.jsxs("button",{onClick:()=>L("ws-reverse"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-green-50 to-teal-50 hover:from-green-100 hover:to-teal-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-green-500 to-teal-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(fa,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"WebSocket反向"}),o.jsx("p",{className:"text-sm text-gray-600",children:"作为客户端连接到WebSocket服务端"})]})]}),o.jsxs("button",{onClick:()=>L("http"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-orange-50 to-red-50 hover:from-orange-100 hover:to-red-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(hl,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"HTTP服务"}),o.jsx("p",{className:"text-sm text-gray-600",children:"提供HTTP API服务"})]})]}),o.jsxs("button",{onClick:()=>L("http-post"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-pink-50 to-rose-50 hover:from-pink-100 hover:to-rose-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-pink-500 to-rose-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(lo,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"HTTP上报"}),o.jsx("p",{className:"text-sm text-gray-600",children:"上报事件到HTTP服务器"})]})]})]}),o.jsx("div",{className:"flex justify-end p-6 border-t border-white/20",children:o.jsx("button",{onClick:()=>h(!1),className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-xl font-medium transition-colors",children:"取消"})})]})})})]})},Dp=({config:e,onChange:t,onOpenChangePassword:n})=>{const r=(l,s)=>{t({...e,[l]:s})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center",children:o.jsx(hl,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"系统功能"}),o.jsx("p",{className:"text-sm text-gray-600",children:"基础功能开关配置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(yp,{size:20,className:"text-green-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"日志记录"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后记录详细的运行日志"})]})]}),o.jsx("input",{type:"checkbox",checked:e.log,onChange:l=>r("log",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
267
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
268
- transition-colors duration-200 ease-in-out\r
269
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
270
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
271
- before:transition-transform before:duration-200\r
272
- checked:before:translate-x-6`})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(hl,{size:20,className:"text-blue-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"只监听本地地址"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"取消后可能会暴露在公网"})]})]}),o.jsx("input",{type:"checkbox",checked:e.onlyLocalhost,onChange:l=>r("onlyLocalhost",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
273
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
274
- transition-colors duration-200 ease-in-out\r
275
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
276
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
277
- before:transition-transform before:duration-200\r
278
- checked:before:translate-x-6`})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Sp,{size:20,className:"text-blue-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"本地文件转URL"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后可将本地文件转换为URL链接"})]})]}),o.jsx("input",{type:"checkbox",checked:e.enableLocalFile2Url,onChange:l=>r("enableLocalFile2Url",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
279
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
280
- transition-colors duration-200 ease-in-out\r
281
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
282
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
283
- before:transition-transform before:duration-200\r
284
- checked:before:translate-x-6`})]})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 flex items-center justify-center",children:o.jsx(gl,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"文件管理"}),o.jsx("p",{className:"text-sm text-gray-600",children:"自动清理文件相关配置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(gl,{size:20,className:"text-red-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"自动删除收到的文件"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后将自动清理接收的临时文件"})]})]}),o.jsx("input",{type:"checkbox",checked:e.autoDeleteFile,onChange:l=>r("autoDeleteFile",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
285
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
286
- transition-colors duration-200 ease-in-out\r
287
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
288
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
289
- before:transition-transform before:duration-200\r
290
- checked:before:translate-x-6`})]}),e.autoDeleteFile&&o.jsx("div",{className:"pl-4",children:o.jsxs("label",{className:"block",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Br,{size:16,className:"text-gray-600"}),o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"自动删除时间(秒)"})]}),o.jsx("input",{type:"number",value:e.autoDeleteFileSecond,onChange:l=>r("autoDeleteFileSecond",parseInt(l.target.value)),min:"1",max:"3600",className:"input-field",placeholder:"60"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"文件接收后多少秒自动删除(1-3600秒)"})]})})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500 to-pink-600 flex items-center justify-center",children:o.jsx(Br,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"缓存设置"}),o.jsx("p",{className:"text-sm text-gray-600",children:"消息缓存相关配置"})]})]}),o.jsxs("label",{className:"block",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Br,{size:16,className:"text-purple-600"}),o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"消息缓存过期时间(秒)"})]}),o.jsx("input",{type:"number",value:e.msgCacheExpire,onChange:l=>r("msgCacheExpire",parseInt(l.target.value)),min:"1",max:"86400",className:"input-field",placeholder:"3600"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"消息在缓存中保留的时间(1-86400秒)"})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-green-500 to-teal-600 flex items-center justify-center",children:o.jsx(da,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"扩展功能"}),o.jsx("p",{className:"text-sm text-gray-600",children:"第三方服务配置"})]})]}),o.jsxs("label",{className:"block",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(da,{size:16,className:"text-green-600"}),o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"音乐签名地址"})]}),o.jsx("input",{type:"text",value:e.musicSignUrl,onChange:l=>r("musicSignUrl",l.target.value),placeholder:"https://example.com/sign",className:"input-field"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"用于音乐卡片签名的服务地址"})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-pink-600 flex items-center justify-center",children:o.jsx(zp,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"安全设置"}),o.jsx("p",{className:"text-sm text-gray-600",children:"WebUI 访问控制"})]})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Mc,{size:20,className:"text-red-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"WebUI 访问密码"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"用于保护 WebUI 访问的密码"})]})]}),o.jsxs("button",{onClick:n,className:"px-4 py-2 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg text-sm font-medium hover:shadow-lg transition-all flex items-center gap-2",children:[o.jsx(Cp,{size:16}),"修改密码"]})]})]})]})};function Fc(e,t){const n=e.trim();return n?t!==void 0&&n.length<t?{isValid:!1,error:`密码长度不能少于${t}位`}:/[\r\n]/.test(n)?{isValid:!1,error:"密码不能包含换行符!"}:/[^\x20-\x7E\t]/.test(n)?{isValid:!1,error:"密码不能包含中文等特殊字符!"}:/[\x00-\x08\x0A-\x1F\x7F]/.test(n)?{isValid:!1,error:"密码包含不可见的控制字符!"}:{isValid:!0}:{isValid:!1,error:"密码不能为空"}}const as=({visible:e,onConfirm:t,onClose:n,error:r})=>{const[l,s]=C.useState(""),[i,a]=C.useState(!1),[u,d]=C.useState(""),g=C.useRef(null);C.useEffect(()=>{e&&g.current&&setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},100)},[e]),C.useEffect(()=>{e&&(s(""),a(!1),d(""))},[e]);const h=()=>{const v=Fc(l);if(!v.isValid){d(v.error||"密码验证失败");return}d(""),t(l.trim())},m=v=>{v.key==="Enter"&&h()};return C.useEffect(()=>{if(!e)return;const v=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e]),e?o.jsx(o.Fragment,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},onClick:v=>v.target===v.currentTarget&&(n==null?void 0:n()),children:o.jsxs("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-md transform transition-all",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/20",children:[o.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:r||"WebUI 密码"}),n&&o.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 transition-colors",children:o.jsx(sr,{size:24})})]}),o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{ref:g,type:i?"text":"password",value:l,onChange:v=>{s(v.target.value),u&&d("")},onKeyPress:m,placeholder:"请输入密码(支持数字、字母、符号)",className:`w-full px-4 py-3 pr-12 border rounded-xl focus:outline-none focus:ring-2 transition-all bg-white/50 backdrop-blur-sm ${u?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-transparent"}`,autoComplete:"off"}),o.jsx("button",{type:"button",onClick:()=>a(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:i?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),u&&o.jsx("p",{className:"text-sm text-red-500 px-1",children:u})]})}),o.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/20",children:[n&&o.jsx("button",{onClick:n,className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-lg font-medium transition-colors",children:"取消"}),o.jsx("button",{onClick:h,disabled:!l.trim(),className:"px-6 py-2.5 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg font-medium hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none",children:"确定"})]})]})})}):null};function Ap(e){const t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=new TextEncoder().encode(e),l=r.length*8,s=Math.ceil((l+65)/512)*64,i=new Uint8Array(s);i.set(r),i[r.length]=128;const a=new DataView(i.buffer);a.setUint32(s-4,l&4294967295,!1);let u=1779033703,d=3144134277,g=1013904242,h=2773480762,m=1359893119,v=2600822924,y=528734635,k=1541459225;for(let w=0;w<s;w+=64){const f=new Uint32Array(64);for(let b=0;b<16;b++)f[b]=a.getUint32(w+b*4,!1);for(let b=16;b<64;b++){const L=(f[b-15]>>>7|f[b-15]<<25)^(f[b-15]>>>18|f[b-15]<<14)^f[b-15]>>>3,M=(f[b-2]>>>17|f[b-2]<<15)^(f[b-2]>>>19|f[b-2]<<13)^f[b-2]>>>10;f[b]=f[b-16]+L+f[b-7]+M>>>0}let c=u,p=d,x=g,N=h,E=m,z=v,_=y,F=k;for(let b=0;b<64;b++){const L=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7),M=E&z^~E&_,S=F+L+M+t[b]+f[b]>>>0,O=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),X=c&p^c&x^p&x,I=O+X>>>0;F=_,_=z,z=E,E=N+S>>>0,N=x,x=p,p=c,c=S+I>>>0}u=u+c>>>0,d=d+p>>>0,g=g+x>>>0,h=h+N>>>0,m=m+E>>>0,v=v+z>>>0,y=y+_>>>0,k=k+F>>>0}return[u.toString(16).padStart(8,"0"),d.toString(16).padStart(8,"0"),g.toString(16).padStart(8,"0"),h.toString(16).padStart(8,"0"),m.toString(16).padStart(8,"0"),v.toString(16).padStart(8,"0"),y.toString(16).padStart(8,"0"),k.toString(16).padStart(8,"0")].join("")}async function Up(e){try{return Ap(e)}catch(t){if(console.error("[PasswordHash] 纯JS SHA-256实现失败:",t),typeof crypto<"u"&&crypto.subtle)try{const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch(n){console.error("[PasswordHash] Web Crypto API失败:",n)}throw new Error("无法计算SHA-256哈希")}}async function ha(e){return await Up(e)}function $p(e,t,n=30){const r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);const l=`expires=${r.toUTCString()}`,i=window.location.protocol==="https:"?"; Secure":"",a=window.location.hostname,d=/^\d+\.\d+\.\d+\.\d+$/.test(a)?"":"; SameSite=Lax",g=`${e}=${t}; ${l}; path=/${d}${i}`;document.cookie=g}function Vp(e){const t=e+"=",n=document.cookie.split(";");for(let r=0;r<n.length;r++){let l=n[r];for(;l.charAt(0)===" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return l.substring(t.length,l.length)}return console.log("[Cookie] 未找到Cookie:",{name:e,allCookies:document.cookie}),null}const Oc="webui_token",Bp=30;let Ln=null;function Hp(e){Ln=e}function Qp(){return Vp(Oc)}function ga(e){$p(Oc,e,Bp)}async function dt(e,t={}){const n=async r=>{const l={...t.headers};return r&&(l["x-webui-token"]=r),fetch(e,{...t,headers:l})};try{let r=await n(Qp());if(r.status===401&&Ln){console.log("401 - Password not set, prompting to set password...");const l=await Ln("请设置密码");if(!l||!l.trim())throw new Error("密码不能为空");if(!(await fetch("/api/set-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l.trim()})})).ok)throw new Error("设置密码失败");const i=await ha(l.trim());ga(i),r=await n(i)}if(r.status===403&&Ln){console.log("403 - Token verification failed, prompting for password...");let l=null;try{l=await r.clone().json()}catch{}l!=null&&l.locked&&ae(l.message||"账户已被锁定","error");let s=0;const i=5;for(;r.status===403&&s<i;)try{const a=s>0?"密码错误,请重新输入":"请输入密码",u=await Ln(a);if(!u||!u.trim())throw new Error("密码不能为空");const d=await ha(u.trim());if(ga(d),r=await n(d),r.status===200){console.log("Authentication successful!");break}try{if(l=await r.clone().json(),l!=null&&l.locked)throw new Error(l.message||"账户已被锁定")}catch{}s++}catch(a){throw console.error("Password prompt error:",a),a}if(r.status===403)throw new Error((l==null?void 0:l.message)||"认证失败")}if(!r.ok){const l=await r.text();throw new Error(`HTTP error! status: ${r.status}, message: ${l}`)}return await r.json()}catch(r){throw console.error("API fetch error:",r),r}}const Wp=({visible:e,onClose:t,onSuccess:n})=>{const[r,l]=C.useState(""),[s,i]=C.useState(""),[a,u]=C.useState(!1),[d,g]=C.useState(!1),[h,m]=C.useState(!1),[v,y]=C.useState(""),k=C.useRef(null);C.useEffect(()=>{e&&k.current&&setTimeout(()=>{var c;return(c=k.current)==null?void 0:c.focus()},100)},[e]),C.useEffect(()=>{e&&(l(""),i(""),u(!1),g(!1),y(""))},[e]);const w=async()=>{const c=Fc(r,6);if(!c.isValid){y(c.error||"密码验证失败");return}if(r!==s){y("两次输入的密码不一致");return}m(!0),y("");try{const p=await dt("/api/set-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r})});p.success?(ae("密码修改成功","success"),n(),t()):y(p.message||"密码修改失败")}catch(p){y(p.message||"密码修改失败")}finally{m(!1)}},f=c=>{c.key==="Enter"&&w()};return e?o.jsx(o.Fragment,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},onClick:c=>c.target===c.currentTarget&&t(),children:o.jsxs("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-md transform transition-all",children:[o.jsxs("div",{className:"flex items-center gap-3 p-6 border-b border-white/20",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-pink-600 flex items-center justify-center",children:o.jsx(Mc,{size:20,className:"text-white"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:"修改 WebUI 密码"}),o.jsx("p",{className:"text-sm text-gray-600 mt-0.5",children:"请输入新密码"})]}),o.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors",children:o.jsx(sr,{size:24})})]}),o.jsxs("div",{className:"p-6 space-y-4",children:[v&&o.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-600 text-sm",children:v}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"新密码"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{ref:k,type:a?"text":"password",value:r,onChange:c=>{l(c.target.value),y("")},onKeyPress:f,placeholder:"请输入新密码(支持数字、字母、符号)",className:"w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all bg-white/50 backdrop-blur-sm",autoComplete:"new-password"}),o.jsx("button",{type:"button",onClick:()=>u(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:a?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"密码长度至少6位"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"确认密码"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:d?"text":"password",value:s,onChange:c=>{i(c.target.value),y("")},onKeyPress:f,placeholder:"请再次输入新密码",className:"w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all bg-white/50 backdrop-blur-sm",autoComplete:"new-password"}),o.jsx("button",{type:"button",onClick:()=>g(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:d?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]})]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/20",children:[o.jsx("button",{onClick:t,disabled:h,className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-lg font-medium transition-colors disabled:opacity-50",children:"取消"}),o.jsx("button",{onClick:w,disabled:h||!r.trim()||!s.trim(),className:"px-6 py-2.5 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg font-medium hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none",children:h?"修改中...":"确定修改"})]})]})})}):null},Kp=({onLoginSuccess:e})=>{const[t,n]=C.useState("quick"),[r,l]=C.useState(!1),[s,i]=C.useState(!1),[a,u]=C.useState(!1),[d,g]=C.useState(""),[h,m]=C.useState([]),[v,y]=C.useState(null),[k,w]=C.useState(!1),f=C.useRef(null),c=C.useRef(null),p=C.useRef(null),x=C.useRef(!1),N={scanning:"扫描成功,请在手机上确认",success:"登录成功",expired:"二维码已过期,请刷新",error:"登录失败,请重试","":""},E=C.useCallback(()=>{x.current=!1,p.current&&(clearTimeout(p.current),p.current=null)},[]),z=C.useCallback(async()=>{if(x.current)return;x.current=!0,console.log("开始轮询登录状态...");const I=60;let oe=0;const P=async()=>{if(oe>=I){E(),ae("登录超时,请重试","error"),t==="qr"&&g("error");return}oe++;try{const R=await dt("/api/login-info");if(R.success&&R.data.online===!0){E(),ae("登录成功!正在跳转到主页面...","success"),t==="qr"&&g("success"),setTimeout(()=>{e()},1e3);return}p.current=setTimeout(P,3e3)}catch(R){console.warn("轮询登录状态失败:",R),p.current=setTimeout(P,3e3)}};await P()},[t,e,E]),_=C.useCallback(I=>{if(!f.current)return;const P=f.current.getContext("2d");if(!P)return;const R=new Image;R.onload=()=>{P.clearRect(0,0,200,200),P.drawImage(R,0,0,200,200)},R.src=I},[]),F=C.useCallback(async()=>{if(f.current)try{const I=await dt("/api/login-qrcode");if(I.success&&I.data){_(I.data.pngBase64QrcodeData);const oe=I.data.expireTime*1e3;c.current&&clearInterval(c.current),c.current=setTimeout(()=>{u(!0),g("expired"),E()},oe),u(!1),g(""),ae("请使用手机QQ扫码登录","warning"),await z()}else throw new Error(I.message||"获取二维码失败")}catch(I){ae(I.message||"获取二维码失败","error"),console.error("QR code generation error:",I)}},[_,z,E]),b=C.useCallback(async()=>{await F(),ae("二维码已刷新","success")},[F]),L=C.useRef(!1),M=C.useCallback(async()=>{if(!L.current){L.current=!0;try{const I=await dt("/api/quick-login-list");if(console.log("Quick login list response:",I),I.success&&I.data&&I.data.LocalLoginInfoList){const oe=I.data.LocalLoginInfoList.filter(P=>P.isQuickLogin&&!P.isUserLogin);m(oe),console.log("Accounts loaded:",oe),oe.length>0?y(P=>P??oe[0]):n("qr")}else console.warn("No quick login accounts available:",I.message),m([])}catch(I){console.error("Failed to fetch quick login list:",I),ae("获取快速登录列表失败","error"),m([])}}},[]),S=C.useCallback(async()=>{if(v){i(!0);try{const oe=(await dt("/api/quick-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uin:v.uin})})).data;if(oe.result==="0")ae(`正在登录 ${v.nickName}...`,"success"),await z();else throw new Error(oe.loginErrorInfo.errMsg||"登录失败")}catch(I){ae(I.message,"error"),console.error("Quick login error:",I),n("qr")}finally{i(!1)}}},[v,z]),O=()=>{l(!r)},X=I=>{y(I),l(!1)};return C.useEffect(()=>(L.current||M(),()=>{c.current&&clearInterval(c.current),E()}),[]),C.useEffect(()=>{t==="qr"?setTimeout(()=>F(),100):c.current&&clearInterval(c.current),t==="quick"&&h.length===0&&!L.current&&M()},[t,h.length,F]),o.jsx("div",{className:"relative min-h-screen flex flex-col items-center justify-center p-5",children:o.jsxs("div",{className:"bg-white/50 backdrop-blur-2xl rounded-3xl p-10 shadow-xl border border-white/30 min-w-[320px] text-center relative z-10",children:[t==="quick"&&o.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!r&&v&&o.jsxs("div",{className:"flex flex-col items-center cursor-pointer p-4 rounded-2xl transition-colors hover:bg-blue-50",onClick:O,children:[o.jsx("div",{className:"w-20 h-20 rounded-full overflow-hidden mb-3 shadow-lg",children:o.jsx("img",{src:v.faceUrl,alt:v.nickName,className:"w-full h-full object-cover"})}),o.jsx("div",{className:"text-base text-gray-800 mb-2",children:v.nickName})]}),r&&o.jsx("div",{className:"grid grid-cols-2 gap-4 my-5 w-full max-w-md",children:h.map(I=>o.jsxs("div",{className:"flex flex-col items-center p-4 rounded-2xl cursor-pointer transition-all border-2 border-transparent hover:bg-blue-50 hover:border-blue-500",onClick:()=>X(I),children:[o.jsx("div",{className:"w-[60px] h-[60px] rounded-full overflow-hidden mb-2 shadow-md",children:o.jsx("img",{src:I.faceUrl,alt:I.nickName,className:"w-full h-full object-cover"})}),o.jsx("div",{className:"text-sm text-gray-800 text-center truncate w-full px-1",children:I.nickName})]},I.uin))}),!r&&o.jsx("button",{onClick:S,disabled:!v||s,className:"w-[280px] h-11 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-full font-medium text-base disabled:opacity-50 disabled:cursor-not-allowed hover:shadow-lg transition-all flex items-center justify-center gap-2",children:s?o.jsxs(o.Fragment,{children:[o.jsx(Vt,{size:20,className:"animate-spin"}),"登录中..."]}):"登录"}),o.jsxs("div",{className:"flex gap-6 justify-center",children:[!r&&o.jsx("button",{onClick:O,className:"text-blue-600 text-sm hover:underline",children:"切换账号"}),o.jsx("button",{onClick:()=>n("qr"),className:"text-blue-600 text-sm hover:underline",children:"扫码登录"})]})]}),t==="qr"&&o.jsxs("div",{className:"flex flex-col items-center gap-5",children:[o.jsx("div",{className:"relative inline-block",children:o.jsxs("div",{className:"relative p-5 bg-white rounded-2xl shadow-lg",children:[o.jsx("canvas",{ref:f,width:"200",height:"200",className:"block rounded-lg"}),a&&o.jsxs("div",{className:"absolute inset-0 bg-black/70 flex flex-col items-center justify-center text-white cursor-pointer rounded-2xl transition-opacity hover:opacity-90",onClick:b,children:[o.jsx(Pp,{size:32,className:"mb-2"}),o.jsx("div",{children:"点击刷新"})]})]})}),o.jsx("div",{className:"text-gray-600",children:"请使用手机QQ扫码登录"}),d&&o.jsx("div",{className:`text-sm px-4 py-2 rounded-lg ${d==="success"?"bg-green-100 text-green-800":d==="error"||d==="expired"?"bg-red-100 text-red-800":"bg-blue-100 text-blue-800"}`,children:N[d]})]}),o.jsx("div",{className:"mt-6",children:t==="qr"&&h.length>0&&o.jsx("button",{onClick:()=>n("quick"),className:"text-blue-600 text-sm hover:underline",children:"快速登录"})})]})})},qp=!1,Gp=()=>({friendCount:128,groupCount:45,messageReceived:12580,messageSent:3842,startupTime:Math.floor(Date.now()/1e3)-3600*5-1234,lastMessageTime:Math.floor(Date.now()/1e3)-30,bot:{memory:(80+Math.random()*40)*1024*1024,totalMemory:16*1024*1024*1024,memoryPercent:2+Math.random()*3,cpu:3+Math.random()*10},qq:{memory:(200+Math.random()*100)*1024*1024,totalMemory:16*1024*1024*1024,memoryPercent:5+Math.random()*8,cpu:5+Math.random()*15}}),ya=e=>!e||e<=0?"0 MB":e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":e<1024*1024*1024?(e/1024/1024).toFixed(0)+" MB":(e/1024/1024/1024).toFixed(2)+" GB",Yp=e=>{const n=Math.floor(Date.now()/1e3)-e,r=Math.floor(n/86400),l=Math.floor(n%86400/3600),s=Math.floor(n%3600/60),i=n%60;return r>0?`${r}天 ${l}时 ${s}分`:l>0?`${l}时 ${s}分 ${i}秒`:s>0?`${s}分 ${i}秒`:`${i}秒`},Xp=e=>e?new Date(e*1e3).toLocaleString("zh-CN"):"暂无",_r=({icon:e,label:t,value:n,gradient:r})=>o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-white/30 hover:bg-white/50 transition-all duration-200 hover:scale-[1.02]",children:[o.jsx("div",{className:`w-10 h-10 rounded-xl ${r} flex items-center justify-center shadow-md`,children:e}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-xs text-gray-500",children:t}),o.jsx("p",{className:"text-lg font-bold text-gray-800 truncate",children:n})]})]}),xa=({value:e,size:t=100,strokeWidth:n=8,gradientId:r,gradientColors:l,label:s,displayValue:i,icon:a})=>{const u=(t-n)/2,d=u*2*Math.PI,g=Math.min(Math.max(e,0),100),h=d-g/100*d;return o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsxs("div",{className:"relative",style:{width:t,height:t},children:[o.jsxs("svg",{width:t,height:t,className:"transform -rotate-90",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[o.jsx("stop",{offset:"0%",stopColor:l[0]}),o.jsx("stop",{offset:"100%",stopColor:l[1]})]})}),o.jsx("circle",{cx:t/2,cy:t/2,r:u,fill:"none",stroke:"rgba(0,0,0,0.06)",strokeWidth:n}),o.jsx("circle",{cx:t/2,cy:t/2,r:u,fill:"none",stroke:`url(#${r})`,strokeWidth:n,strokeDasharray:d,strokeDashoffset:h,strokeLinecap:"round",className:"transition-all duration-1000 ease-out"})]}),o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[o.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${l[0]}, ${l[1]})`},children:a}),o.jsxs("span",{className:"text-sm font-bold text-gray-800 mt-1",children:[g.toFixed(1),"%"]})]})]}),o.jsx("p",{className:"text-xs font-semibold text-gray-700 mt-2",children:s}),o.jsx("p",{className:"text-xs text-gray-500",children:i})]})},va=({title:e,icon:t,gradient:n,cpu:r,memory:l,totalMemory:s,memoryPercent:i,cpuGradientId:a,memGradientId:u,cpuColors:d,memColors:g})=>o.jsxs("div",{className:"card p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsx("div",{className:`w-8 h-8 rounded-lg ${n} flex items-center justify-center shadow-md`,children:t}),o.jsx("h4",{className:"text-sm font-semibold text-gray-800",children:e})]}),o.jsxs("div",{className:"flex justify-around",children:[o.jsx(xa,{value:r,gradientId:a,gradientColors:d,label:"CPU",displayValue:`${r.toFixed(1)}%`,icon:o.jsx(Lc,{size:16,className:"text-white"})}),o.jsx(xa,{value:i,gradientId:u,gradientColors:g,label:"内存",displayValue:`${ya(l)} / ${ya(s)}`,icon:o.jsx(xp,{size:16,className:"text-white"})})]})]}),Zp=()=>{const[e,t]=C.useState(null),[n,r]=C.useState(!0),[l,s]=C.useState(""),i=C.useRef(),a=async()=>{try{const u=qp?Gp():(await dt("/api/dashboard/stats")).data;u&&t(u)}catch(u){console.error("Failed to fetch dashboard stats:",u)}finally{r(!1)}};return C.useEffect(()=>(a(),i.current=window.setInterval(a,5e3),()=>{i.current&&clearInterval(i.current)}),[]),C.useEffect(()=>{if(!(e!=null&&e.startupTime))return;const u=()=>s(Yp(e.startupTime));u();const d=setInterval(u,1e3);return()=>clearInterval(d)},[e==null?void 0:e.startupTime]),n?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("div",{className:"w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"})}):e?o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"card p-4 flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-md",children:o.jsx(Br,{size:20,className:"text-white"})}),o.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"运行时间"}),o.jsxs("div",{className:"ml-auto flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-medium",children:[o.jsx(Mp,{size:12}),"运行中"]})]}),o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-2",children:[o.jsxs("div",{className:"p-3 rounded-xl bg-gradient-to-r from-indigo-50 to-purple-50",children:[o.jsx("p",{className:"text-xs text-gray-500",children:"已运行"}),o.jsx("p",{className:"text-xl font-bold bg-gradient-to-r from-indigo-600 to-purple-600 bg-clip-text text-transparent",children:l})]}),o.jsxs("div",{className:"px-3 py-2",children:[o.jsx("p",{className:"text-xs text-gray-500",children:"启动时间"}),o.jsx("p",{className:"text-sm font-medium text-gray-700",children:Xp(e.startupTime)})]})]})]}),o.jsxs("div",{className:"card p-4 space-y-3",children:[o.jsx(_r,{icon:o.jsx(Tp,{size:20,className:"text-white"}),label:"好友数量",value:e.friendCount.toLocaleString(),gradient:"bg-gradient-to-br from-blue-500 to-cyan-500"}),o.jsx(_r,{icon:o.jsx(_p,{size:20,className:"text-white"}),label:"群组数量",value:e.groupCount.toLocaleString(),gradient:"bg-gradient-to-br from-purple-500 to-pink-500"})]}),o.jsxs("div",{className:"card p-4 space-y-3",children:[o.jsx(_r,{icon:o.jsx(jp,{size:20,className:"text-white"}),label:"收到消息",value:e.messageReceived.toLocaleString(),gradient:"bg-gradient-to-br from-green-500 to-emerald-500"}),o.jsx(_r,{icon:o.jsx(lo,{size:20,className:"text-white"}),label:"发送消息",value:e.messageSent.toLocaleString(),gradient:"bg-gradient-to-br from-orange-500 to-amber-500"})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(va,{title:"QQ 资源",icon:o.jsx(wp,{size:16,className:"text-white"}),gradient:"bg-gradient-to-br from-blue-500 to-cyan-500",cpu:e.qq.cpu,memory:e.qq.memory,totalMemory:e.qq.totalMemory,memoryPercent:e.qq.memoryPercent,cpuGradientId:"qqCpuGradient",memGradientId:"qqMemGradient",cpuColors:["#3b82f6","#06b6d4"],memColors:["#0ea5e9","#22d3ee"]}),o.jsx(va,{title:"Bot 资源",icon:o.jsx(hp,{size:16,className:"text-white"}),gradient:"bg-gradient-to-br from-violet-500 to-purple-600",cpu:e.bot.cpu,memory:e.bot.memory,totalMemory:e.bot.totalMemory,memoryPercent:e.bot.memoryPercent,cpuGradientId:"botCpuGradient",memGradientId:"botMemGradient",cpuColors:["#8b5cf6","#a855f7"],memColors:["#6366f1","#8b5cf6"]})]})]}):o.jsx("div",{className:"card p-8 text-center",children:o.jsx("p",{className:"text-gray-500",children:"无法加载统计数据"})})},us=()=>{const e=C.useRef(null),t=C.useRef([]),n=C.useRef(),r=C.useRef(0);return C.useEffect(()=>{const l=e.current;if(!l)return;const s=l.getContext("2d",{alpha:!0});if(!s)return;const a=1e3/30,u=()=>{l.width=window.innerWidth,l.height=window.innerHeight,t.current.forEach(y=>{y.offscreenCanvas=g(y)})},d=["rgba(139, 92, 246, 0.6)","rgba(59, 130, 246, 0.6)","rgba(236, 72, 153, 0.6)","rgba(16, 185, 129, 0.6)","rgba(245, 158, 11, 0.6)","rgba(168, 85, 247, 0.6)","rgba(14, 165, 233, 0.6)","rgba(251, 113, 133, 0.6)"],g=y=>{const k=Math.ceil(y.baseRadius*2.5),w=document.createElement("canvas");w.width=k,w.height=k;const f=w.getContext("2d");if(!f)return w;const c=k/2,p=k/2,x=y.baseRadius,N=f.createRadialGradient(c,p,0,c,p,x);return N.addColorStop(0,y.color.replace("0.6","0.8")),N.addColorStop(.5,y.color),N.addColorStop(1,y.color.replace("0.6","0")),f.fillStyle=N,f.beginPath(),f.arc(c,p,x,0,Math.PI*2),f.fill(),w},h=()=>{const y=[];for(let w=0;w<8;w++){const f=Math.random()*80+60,c={x:Math.random()*l.width,y:Math.random()*l.height,vx:(Math.random()-.5)*.8,vy:(Math.random()-.5)*.8,radius:f,baseRadius:f,scale:1,scaleSpeed:Math.random()*.002+.001,color:d[Math.floor(Math.random()*d.length)]};c.offscreenCanvas=g(c),y.push(c)}t.current=y},m=(y,k)=>{const w=k.x-y.x,f=k.y-y.y,c=Math.sqrt(w*w+f*f);if(c<y.radius+k.radius){const p=Math.atan2(f,w),x=Math.sin(p),N=Math.cos(p),E=y.vx*N+y.vy*x,z=y.vy*N-y.vx*x,_=k.vx*N+k.vy*x,F=k.vy*N-k.vx*x;y.vx=_*N-z*x,y.vy=z*N+_*x,k.vx=E*N-F*x,k.vy=F*N+E*x;const b=(y.radius+k.radius-c)/2;y.x-=b*N,y.y-=b*x,k.x+=b*N,k.y+=b*x}},v=y=>{n.current=requestAnimationFrame(v);const k=y-r.current;k<a||(r.current=y-k%a,s.clearRect(0,0,l.width,l.height),t.current.forEach((w,f)=>{w.x+=w.vx,w.y+=w.vy,w.scale+=w.scaleSpeed,(w.scale>1.2||w.scale<.8)&&(w.scaleSpeed=-w.scaleSpeed),w.radius=w.baseRadius*w.scale,(w.x-w.radius<0||w.x+w.radius>l.width)&&(w.vx=-w.vx,w.x=Math.max(w.radius,Math.min(l.width-w.radius,w.x))),(w.y-w.radius<0||w.y+w.radius>l.height)&&(w.vy=-w.vy,w.y=Math.max(w.radius,Math.min(l.height-w.radius,w.y)));for(let c=f+1;c<t.current.length;c++)m(w,t.current[c]);if(w.offscreenCanvas){const c=w.offscreenCanvas.width*w.scale;s.drawImage(w.offscreenCanvas,w.x-c/2,w.y-c/2,c,c)}}))};return u(),window.addEventListener("resize",u),h(),n.current=requestAnimationFrame(v),()=>{window.removeEventListener("resize",u),n.current&&cancelAnimationFrame(n.current)}},[]),o.jsx("canvas",{ref:e,className:"fixed inset-0 w-full h-full pointer-events-none",style:{zIndex:0}})},Jp={enable:!0,connect:[]},e0={enable:!1,port:5600,token:""},t0={enable:!1,reportSelfMessage:!1,http:{port:3010,prefix:"",accessToken:""},webhook:{urls:[]}},n0={enable:!0,port:3080},r0={webui:n0,onlyLocalhost:!0,milky:t0,satori:e0,ob11:Jp,enableLocalFile2Url:!1,log:!0,autoDeleteFile:!1,autoDeleteFileSecond:60,musicSignUrl:"https://llob.linyuchen.net/sign/music",msgCacheExpire:120,ffmpeg:"",rawMsgPB:!1},l0="7.1.2";function s0(){const[e,t]=C.useState("dashboard"),[n,r]=C.useState(r0),[l,s]=C.useState(!1),[i,a]=C.useState(!1),[u,d]=C.useState(!0),[g,h]=C.useState(null),[m,v]=C.useState(!1),[y,k]=C.useState(""),[w,f]=C.useState(null),[c,p]=C.useState(!1),[x,N]=C.useState(!1),[E,z]=C.useState(!1);C.useEffect(()=>{Hp(async L=>new Promise(M=>{k(L||""),v(!0),f(()=>M)}))},[]);const _=C.useCallback(L=>{L.trim()?(v(!1),k(""),w&&(w(L),f(null))):k("密码不能为空")},[w]);C.useEffect(()=>{(async()=>{try{const M=await dt("/api/config");M.success&&M.data.selfInfo.online?(a(!0),h({nick:M.data.selfInfo.nick||"",uin:M.data.selfInfo.uin}),r(M.data.config)):a(!1)}catch(M){console.error("Failed to check login status:",M),a(!1)}finally{d(!1)}})()},[]);const F=C.useCallback(async L=>{try{s(!0);const S=await dt("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:L||n})});S.success?ae("配置保存成功","success"):ae("保存失败:"+S.message,"error")}catch(M){ae("保存失败:"+M.message,"error")}finally{s(!1)}},[n]),b=C.useCallback(()=>{window.location.reload()},[]);return u?o.jsxs(o.Fragment,{children:[o.jsx(us,{}),o.jsx("div",{className:"relative flex items-center justify-center min-h-screen z-10",children:o.jsx(Vt,{size:48,className:"animate-spin text-blue-500"})}),o.jsx(as,{visible:m,onConfirm:_,error:y})]}):i?o.jsxs("div",{className:"flex min-h-screen",children:[o.jsx(us,{}),o.jsx(Rp,{activeTab:e,onTabChange:t,accountInfo:g||void 0}),o.jsx("main",{className:"flex-1 p-8 overflow-auto z-10",children:o.jsxs("div",{className:"max-w-6xl mx-auto",children:[o.jsxs("div",{className:"mb-8",children:[o.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:e==="dashboard"&&"Dashboard"}),o.jsx("p",{className:"text-white/80",children:e==="dashboard"&&"欢迎使用 Lucky Lillia Bot"})]}),e==="dashboard"&&o.jsx(Zp,{}),e==="onebot"&&o.jsx(Op,{config:n.ob11,globalConfig:n,onChange:L=>{const M={...n,ob11:L};r(M)},onSave:L=>{if(L){const M={...n,ob11:L};F(M)}else F()}}),e==="satori"&&o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center",children:o.jsx(so,{size:24,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"Satori 协议"}),o.jsx("p",{className:"text-sm text-gray-600",children:"配置 Satori 协议相关设置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"启用 Satori 协议"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"开启后将支持 Satori 协议连接"})]}),o.jsx("input",{type:"checkbox",checked:n.satori.enable,onChange:L=>r({...n,satori:{...n.satori,enable:L.target.checked}}),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
291
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
292
- transition-colors duration-200 ease-in-out\r
293
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
294
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
295
- before:transition-transform before:duration-200\r
296
- checked:before:translate-x-6`})]}),n.satori.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Satori 端口"}),o.jsx("input",{type:"number",value:n.satori.port,onChange:L=>r({...n,satori:{...n.satori,port:parseInt(L.target.value)}}),min:"1",max:"65535",placeholder:"5500",className:"input-field"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Satori 服务监听端口(1-65535)"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Satori Token"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:c?"text":"password",value:n.satori.token,onChange:L=>r({...n,satori:{...n.satori,token:L.target.value}}),placeholder:"请输入 Satori Token",className:"input-field pr-12"}),o.jsx("button",{type:"button",onClick:()=>p(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors p-1",children:c?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"用于 Satori 连接验证的 Token"})]})]})]}),o.jsx("div",{className:"mt-6 flex justify-end",children:o.jsx("button",{onClick:()=>{var L;if(!n.onlyLocalhost&&n.satori.enable&&!((L=n.satori.token)!=null&&L.trim())){ae('当"只监听本地地址"关闭时,必须设置 Satori Token!',"error");return}F()},disabled:l,className:"btn-primary flex items-center gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Vt,{size:20,className:"animate-spin"}),"保存中..."]}):o.jsxs(o.Fragment,{children:[o.jsx(is,{size:20}),"保存配置"]})})})]}),e==="milky"&&o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-pink-500 to-rose-600 flex items-center justify-center",children:o.jsx(so,{size:24,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"Milky 协议"}),o.jsx("p",{className:"text-sm text-gray-600",children:"配置 Milky 协议相关设置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"启用 Milky 协议"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"开启后将支持 Milky 协议连接"})]}),o.jsx("input",{type:"checkbox",checked:n.milky.enable,onChange:L=>r({...n,milky:{...n.milky,enable:L.target.checked}}),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
297
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
298
- transition-colors duration-200 ease-in-out\r
299
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
300
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
301
- before:transition-transform before:duration-200\r
302
- checked:before:translate-x-6`})]}),n.milky.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"上报自己发送的消息"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后将上报自己发送的消息"})]}),o.jsx("input",{type:"checkbox",checked:n.milky.reportSelfMessage,onChange:L=>r({...n,milky:{...n.milky,reportSelfMessage:L.target.checked}}),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none\r
303
- checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600\r
304
- transition-colors duration-200 ease-in-out\r
305
- before:content-[''] before:absolute before:top-0.5 before:left-0.5\r
306
- before:w-5 before:h-5 before:rounded-full before:bg-white\r
307
- before:transition-transform before:duration-200\r
230
+ */const Mp=U("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Rp=({activeTab:e,onTabChange:t,accountInfo:n})=>{const r=[{id:"dashboard",icon:kp,label:"Dashboard"},{id:"onebot",icon:ro,label:"OneBot 11"},{id:"satori",icon:Lc,label:"Satori"},{id:"milky",icon:Np,label:"Milky"},{id:"other",icon:bp,label:"其他配置"},{id:"about",icon:vp,label:"关于"}];return o.jsxs("div",{className:"w-64 bg-white/50 backdrop-blur-2xl h-screen flex flex-col shadow-xl border-r border-white/30 sticky top-0",children:[o.jsx("div",{className:"p-6 border-b border-white/20",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"w-12 h-12 rounded-2xl overflow-hidden shadow-lg flex-shrink-0",children:o.jsx("img",{src:"/logo.jpg",alt:"Logo",className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h1",{className:"text-xl font-bold text-gray-800 truncate",children:"LLBot"}),o.jsx("p",{className:"text-xs text-gray-500",children:"WebUI"})]})]})}),o.jsx("nav",{className:"flex-1 p-4 space-y-1",children:r.map(l=>{const s=l.icon,i=e===l.id;return o.jsxs("button",{onClick:()=>t(l.id),className:`w-full flex items-center space-x-3 px-4 py-3 rounded-2xl transition-all duration-200 ${i?"bg-gradient-to-r from-blue-500 to-purple-600 text-white shadow-lg scale-105":"text-gray-700 hover:bg-white/50 hover:backdrop-blur-sm"}`,children:[o.jsx(s,{size:20}),o.jsx("span",{className:"font-medium",children:l.label})]},l.id)})}),n&&o.jsx("div",{className:"p-4 border-t border-white/20",children:o.jsxs("div",{className:"flex items-center space-x-3 px-3 py-2",children:[o.jsx("img",{src:`https://thirdqq.qlogo.cn/g?b=qq&nk=${n.uin}&s=640`,alt:"头像",className:"w-10 h-10 rounded-full object-cover ring-2 ring-white/50",onError:l=>{const s=l.target;s.style.display="none";const i=s.nextElementSibling;i&&(i.style.display="flex")}}),o.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-400 to-blue-500 rounded-full items-center justify-center text-white font-semibold hidden",style:{display:"none"},children:n.nick.charAt(0).toUpperCase()}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:n.nick}),o.jsx("p",{className:"text-xs text-gray-500 truncate",children:n.uin})]})]})})]})},pa=({children:e})=>{const t=C.useRef(null);return t.current||(t.current=document.createElement("div")),C.useEffect(()=>{const n=document.body,r=t.current;return n.appendChild(r),()=>{n.removeChild(r)}},[]),ti.createPortal(e,t.current)},Ip=({message:e,type:t="success",duration:n=3e3,onClose:r})=>{const[l,s]=C.useState(!0);C.useEffect(()=>{const u=setTimeout(()=>{s(!1),setTimeout(r,300)},n);return()=>clearTimeout(u)},[n,r]);const i={success:o.jsx(gp,{className:"w-5 h-5"}),error:o.jsx(Lp,{className:"w-5 h-5"}),warning:o.jsx(mp,{className:"w-5 h-5"})},a={success:"bg-green-50/90 backdrop-blur-md border-green-200/50 text-green-800",error:"bg-red-50/90 backdrop-blur-md border-red-200/50 text-red-800",warning:"bg-yellow-50/90 backdrop-blur-md border-yellow-200/50 text-yellow-800"};return o.jsxs("div",{className:`fixed top-4 right-4 flex items-center gap-3 px-4 py-3 rounded-2xl border shadow-lg transition-all duration-300 ${a[t]} ${l?"translate-x-0 opacity-100":"translate-x-full opacity-0"}`,style:{minWidth:"300px",maxWidth:"500px",zIndex:99999},children:[o.jsx("div",{className:"flex-shrink-0",children:i[t]}),o.jsx("p",{className:"flex-1 text-sm font-medium",children:e}),o.jsx("button",{onClick:()=>{s(!1),setTimeout(r,300)},className:"flex-shrink-0 hover:opacity-70 transition-opacity",children:o.jsx(sr,{size:18})})]})};let Fp=0;const Hr=[];let yl=[];const Ic=()=>{Hr.forEach(e=>e([...yl]))},ae=(e,t="success",n=3e3)=>{const r=Fp++;yl.push({id:r,message:e,type:t,duration:n}),Ic()},ma=()=>{const[e,t]=C.useState([]);C.useEffect(()=>{const l=s=>t(s);return Hr.push(l),()=>{const s=Hr.indexOf(l);s>-1&&Hr.splice(s,1)}},[]);const n=l=>{yl=yl.filter(s=>s.id!==l),Ic()},r=o.jsx(o.Fragment,{children:e.map((l,s)=>o.jsx("div",{style:{top:`${1+s*4.5}rem`,zIndex:99999},className:"fixed right-4",children:o.jsx(Ip,{message:l.message,type:l.type,duration:l.duration,onClose:()=>n(l.id)})},l.id))});return ti.createPortal(r,document.body)},Op=({config:e,onChange:t,onSave:n,globalConfig:r})=>{const[l,s]=C.useState(null),[i,a]=C.useState(-1),[u,d]=C.useState(!1),[g,h]=C.useState(!1),[m,v]=C.useState(!1),[y,k]=C.useState(!1),[w,f]=C.useState(""),[c,p]=C.useState(!1),x={ws:{icon:ro,name:"WebSocket正向",desc:"提供WebSocket服务器"},"ws-reverse":{icon:fa,name:"WebSocket反向",desc:"作为客户端连接到WebSocket服务"},http:{icon:hl,name:"HTTP服务",desc:"提供HTTP API服务"},"http-post":{icon:lo,name:"HTTP上报",desc:"上报事件到HTTP服务器"}},N=(S,O)=>{s(S),a(O),v(!1),k(!1),f(S.name||""),p(!1),d(!0)},E=S=>{S.stopPropagation(),k(!0)},z=()=>{if(!l)return;const S={...l,name:w.trim()};s(S),k(!1)},_=()=>{f((l==null?void 0:l.name)||""),k(!1)},F=()=>{var I;if(!l)return;if((l.type==="ws"||l.type==="http")&&!r.onlyLocalhost&&!((I=l.token)!=null&&I.trim())){ae('当"只监听本地地址"关闭时,必须设置 Token!',"error");return}let O;if(m)O=[...e.connect,l];else{if(i<0)return;O=[...e.connect],O[i]=l}const X={...e,connect:O};t(X),d(!1),v(!1),n(X)},b=()=>{if(m){d(!1),v(!1);return}if(i<0)return;const S=e.connect.filter((X,I)=>I!==i),O={...e,connect:S};t(O),d(!1),n(O)},L=S=>{const O={enable:!0,token:"",messageFormat:"array",reportSelfMessage:!1,reportOfflineMessage:!1,debug:!1};let X;switch(S){case"ws":X={...O,type:"ws",port:3001,heartInterval:6e4};break;case"ws-reverse":X={...O,type:"ws-reverse",url:"",heartInterval:6e4};break;case"http":X={...O,type:"http",port:3e3};break;case"http-post":X={...O,type:"http-post",url:"",enableHeart:!1,heartInterval:6e4};break}h(!1),s(X),a(-1),v(!0),p(!1),d(!0)},M=(S,O)=>{l&&s({...l,[S]:O})};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"card p-6",children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"OneBot 11 协议"}),o.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"启用或禁用 OneBot 11 适配器"})]}),o.jsx("input",{type:"checkbox",checked:e.enable,onChange:S=>{const O={...e,enable:S.target.checked};t(O),console.log("Config updated:",O),n(O)},className:`w-14 h-7 rounded-full bg-gray-300 relative cursor-pointer appearance-none
231
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
232
+ transition-colors duration-200 ease-in-out
233
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
234
+ before:w-6 before:h-6 before:rounded-full before:bg-white
235
+ before:transition-transform before:duration-200
236
+ checked:before:translate-x-7`})]})}),e.enable&&e.connect&&Array.isArray(e.connect)&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:e.connect.map((S,O)=>{const X=x[S.type],I=X.icon;return o.jsxs("div",{className:`card p-6 cursor-pointer hover:scale-105 transition-all ${S.enable?"ring-2 ring-blue-500":""}`,onClick:()=>N(S,O),children:[o.jsxs("div",{className:"flex items-start justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center ${S.enable?"bg-gradient-to-br from-blue-500 to-purple-600 text-white":"bg-gray-200 text-gray-600"}`,children:o.jsx(I,{size:24})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:S.name||X.name}),o.jsx("p",{className:"text-sm text-gray-600",children:X.desc})]})]}),o.jsx(so,{size:20,className:"text-gray-400"})]}),o.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t border-gray-200",children:[o.jsx("span",{className:`text-xs font-medium px-3 py-1 rounded-full ${S.enable?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:S.enable?"已启用":"未启用"}),S.enable&&o.jsxs(o.Fragment,{children:[(S.type==="ws"||S.type==="http")&&o.jsxs("span",{className:"text-sm text-gray-600",children:["端口: ",S.port]}),(S.type==="ws-reverse"||S.type==="http-post")&&o.jsxs("span",{className:"text-sm text-gray-600 truncate max-w-[180px]",title:S.url||"未配置",children:["URL: ",S.url||"未配置"]})]})]})]},O)})}),o.jsx("div",{className:"flex justify-center mt-6",children:o.jsxs("button",{onClick:()=>h(!0),className:"btn-primary flex items-center gap-2",children:[o.jsx(Rc,{size:20}),"添加适配器"]})})]}),u&&l&&o.jsx(pa,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},children:o.jsxs("div",{className:"bg-white/60 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col border border-white/50",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/20",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1",children:y?o.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[o.jsx("input",{type:"text",value:w,onChange:S=>f(S.target.value),onKeyDown:S=>{S.key==="Enter"&&z(),S.key==="Escape"&&_()},placeholder:"输入自定义名称",className:"flex-1 px-3 py-2 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0}),o.jsx("button",{onClick:z,className:"px-4 py-2 bg-blue-500 text-white rounded-xl hover:bg-blue-600 transition-colors",children:"确定"}),o.jsx("button",{onClick:_,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-xl hover:bg-gray-300 transition-colors",children:"取消"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900",children:[m?"新建 - ":"",l.name||x[l.type].name]}),o.jsx("button",{onClick:E,className:"p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",title:"编辑名称",children:o.jsx(Ep,{size:18})})]})}),o.jsx("button",{onClick:()=>{d(!1),v(!1),k(!1)},className:"text-gray-400 hover:text-gray-600",children:o.jsx(sr,{size:24})})]}),o.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto flex-1",children:[o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"启用此适配器"}),o.jsx("input",{type:"checkbox",checked:l.enable,onChange:S=>M("enable",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
237
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
238
+ transition-colors duration-200 ease-in-out
239
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
240
+ before:w-5 before:h-5 before:rounded-full before:bg-white
241
+ before:transition-transform before:duration-200
242
+ checked:before:translate-x-6`})]})}),l.type==="ws"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"端口"}),o.jsx("input",{type:"number",value:l.port,onChange:S=>M("port",parseInt(S.target.value)),className:"input-field"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"心跳间隔 (ms)"}),o.jsx("input",{type:"number",value:l.heartInterval,onChange:S=>M("heartInterval",parseInt(S.target.value)),className:"input-field"})]})]}),l.type==="ws-reverse"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"连接地址"}),o.jsx("input",{type:"text",value:l.url,onChange:S=>M("url",S.target.value),placeholder:"ws://example.com:8080",className:"input-field"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"心跳间隔 (ms)"}),o.jsx("input",{type:"number",value:l.heartInterval,onChange:S=>M("heartInterval",parseInt(S.target.value)),className:"input-field"})]})]}),l.type==="http"&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"端口"}),o.jsx("input",{type:"number",value:l.port,onChange:S=>M("port",parseInt(S.target.value)),className:"input-field"})]}),l.type==="http-post"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"上报地址"}),o.jsx("input",{type:"text",value:l.url,onChange:S=>M("url",S.target.value),placeholder:"http://example.com:8080/webhook",className:"input-field"})]}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"启用心跳"}),o.jsx("input",{type:"checkbox",checked:l.enableHeart,onChange:S=>M("enableHeart",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
243
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
244
+ transition-colors duration-200 ease-in-out
245
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
246
+ before:w-5 before:h-5 before:rounded-full before:bg-white
247
+ before:transition-transform before:duration-200
248
+ checked:before:translate-x-6`})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"心跳间隔 (ms)"}),o.jsx("input",{type:"number",value:l.heartInterval,onChange:S=>M("heartInterval",parseInt(S.target.value)),className:"input-field"})]})]}),o.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[o.jsx("h4",{className:"text-md font-semibold text-gray-800 mb-4",children:"通用配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Token"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:c?"text":"password",value:l.token,onChange:S=>M("token",S.target.value),placeholder:"访问令牌",className:"input-field pr-12"}),o.jsx("button",{type:"button",onClick:()=>p(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors p-1",children:c?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"消息格式"}),o.jsxs("div",{className:"flex gap-4",children:[o.jsxs("label",{className:"flex items-center",children:[o.jsx("input",{type:"radio",value:"array",checked:l.messageFormat==="array",onChange:S=>M("messageFormat",S.target.value),className:"mr-2"}),"消息段 (array)"]}),o.jsxs("label",{className:"flex items-center",children:[o.jsx("input",{type:"radio",value:"string",checked:l.messageFormat==="string",onChange:S=>M("messageFormat",S.target.value),className:"mr-2"}),"CQ码 (string)"]})]})]}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"上报自己发送的消息"}),o.jsx("input",{type:"checkbox",checked:l.reportSelfMessage,onChange:S=>M("reportSelfMessage",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
249
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
250
+ transition-colors duration-200 ease-in-out
251
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
252
+ before:w-5 before:h-5 before:rounded-full before:bg-white
253
+ before:transition-transform before:duration-200
254
+ checked:before:translate-x-6`})]})}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"上报离线消息"}),o.jsx("input",{type:"checkbox",checked:l.reportOfflineMessage,onChange:S=>M("reportOfflineMessage",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
255
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
256
+ transition-colors duration-200 ease-in-out
257
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
258
+ before:w-5 before:h-5 before:rounded-full before:bg-white
259
+ before:transition-transform before:duration-200
260
+ checked:before:translate-x-6`})]})}),o.jsx("div",{children:o.jsxs("label",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"调试模式"}),o.jsx("input",{type:"checkbox",checked:l.debug,onChange:S=>M("debug",S.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
261
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
262
+ transition-colors duration-200 ease-in-out
263
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
264
+ before:w-5 before:h-5 before:rounded-full before:bg-white
265
+ before:transition-transform before:duration-200
266
+ checked:before:translate-x-6`})]})})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-white/20",children:[!m&&o.jsxs("button",{onClick:b,className:"px-6 py-2.5 bg-red-500 hover:bg-red-600 text-white rounded-xl font-medium transition-colors flex items-center gap-2",children:[o.jsx(gl,{size:18}),"删除"]}),m&&o.jsx("div",{})," ",o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:()=>d(!1),className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-xl font-medium transition-colors",children:"取消"}),o.jsx("button",{onClick:F,className:"btn-primary",children:"保存"})]})]})]})})}),g&&o.jsx(pa,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},children:o.jsxs("div",{className:"bg-white/60 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-md border border-white/50",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/20",children:[o.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:"选择适配器类型"}),o.jsx("button",{onClick:()=>h(!1),className:"text-gray-400 hover:text-gray-600",children:o.jsx(sr,{size:24})})]}),o.jsxs("div",{className:"p-6 space-y-3",children:[o.jsxs("button",{onClick:()=>L("ws"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-blue-50 to-purple-50 hover:from-blue-100 hover:to-purple-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-purple-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(ro,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"WebSocket正向"}),o.jsx("p",{className:"text-sm text-gray-600",children:"作为WebSocket服务器"})]})]}),o.jsxs("button",{onClick:()=>L("ws-reverse"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-green-50 to-teal-50 hover:from-green-100 hover:to-teal-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-green-500 to-teal-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(fa,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"WebSocket反向"}),o.jsx("p",{className:"text-sm text-gray-600",children:"作为客户端连接到WebSocket服务端"})]})]}),o.jsxs("button",{onClick:()=>L("http"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-orange-50 to-red-50 hover:from-orange-100 hover:to-red-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(hl,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"HTTP服务"}),o.jsx("p",{className:"text-sm text-gray-600",children:"提供HTTP API服务"})]})]}),o.jsxs("button",{onClick:()=>L("http-post"),className:"w-full p-4 rounded-2xl bg-gradient-to-br from-pink-50 to-rose-50 hover:from-pink-100 hover:to-rose-100 transition-all flex items-center gap-4 group",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-pink-500 to-rose-600 text-white flex items-center justify-center group-hover:scale-110 transition-transform",children:o.jsx(lo,{size:24})}),o.jsxs("div",{className:"text-left",children:[o.jsx("h4",{className:"text-lg font-semibold text-gray-800",children:"HTTP上报"}),o.jsx("p",{className:"text-sm text-gray-600",children:"上报事件到HTTP服务器"})]})]})]}),o.jsx("div",{className:"flex justify-end p-6 border-t border-white/20",children:o.jsx("button",{onClick:()=>h(!1),className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-xl font-medium transition-colors",children:"取消"})})]})})})]})},Dp=({config:e,onChange:t,onOpenChangePassword:n})=>{const r=(l,s)=>{t({...e,[l]:s})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center",children:o.jsx(hl,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"系统功能"}),o.jsx("p",{className:"text-sm text-gray-600",children:"基础功能开关配置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(yp,{size:20,className:"text-green-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"日志记录"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后记录详细的运行日志"})]})]}),o.jsx("input",{type:"checkbox",checked:e.log,onChange:l=>r("log",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
267
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
268
+ transition-colors duration-200 ease-in-out
269
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
270
+ before:w-5 before:h-5 before:rounded-full before:bg-white
271
+ before:transition-transform before:duration-200
272
+ checked:before:translate-x-6`})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(hl,{size:20,className:"text-blue-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"只监听本地地址"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"取消后可能会暴露在公网"})]})]}),o.jsx("input",{type:"checkbox",checked:e.onlyLocalhost,onChange:l=>r("onlyLocalhost",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
273
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
274
+ transition-colors duration-200 ease-in-out
275
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
276
+ before:w-5 before:h-5 before:rounded-full before:bg-white
277
+ before:transition-transform before:duration-200
278
+ checked:before:translate-x-6`})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Sp,{size:20,className:"text-blue-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"本地文件转URL"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后可将本地文件转换为URL链接"})]})]}),o.jsx("input",{type:"checkbox",checked:e.enableLocalFile2Url,onChange:l=>r("enableLocalFile2Url",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
279
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
280
+ transition-colors duration-200 ease-in-out
281
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
282
+ before:w-5 before:h-5 before:rounded-full before:bg-white
283
+ before:transition-transform before:duration-200
284
+ checked:before:translate-x-6`})]})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 flex items-center justify-center",children:o.jsx(gl,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"文件管理"}),o.jsx("p",{className:"text-sm text-gray-600",children:"自动清理文件相关配置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(gl,{size:20,className:"text-red-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"自动删除收到的文件"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后将自动清理接收的临时文件"})]})]}),o.jsx("input",{type:"checkbox",checked:e.autoDeleteFile,onChange:l=>r("autoDeleteFile",l.target.checked),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
285
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
286
+ transition-colors duration-200 ease-in-out
287
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
288
+ before:w-5 before:h-5 before:rounded-full before:bg-white
289
+ before:transition-transform before:duration-200
290
+ checked:before:translate-x-6`})]}),e.autoDeleteFile&&o.jsx("div",{className:"pl-4",children:o.jsxs("label",{className:"block",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Br,{size:16,className:"text-gray-600"}),o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"自动删除时间(秒)"})]}),o.jsx("input",{type:"number",value:e.autoDeleteFileSecond,onChange:l=>r("autoDeleteFileSecond",parseInt(l.target.value)),min:"1",max:"3600",className:"input-field",placeholder:"60"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"文件接收后多少秒自动删除(1-3600秒)"})]})})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500 to-pink-600 flex items-center justify-center",children:o.jsx(Br,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"缓存设置"}),o.jsx("p",{className:"text-sm text-gray-600",children:"消息缓存相关配置"})]})]}),o.jsxs("label",{className:"block",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Br,{size:16,className:"text-purple-600"}),o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"消息缓存过期时间(秒)"})]}),o.jsx("input",{type:"number",value:e.msgCacheExpire,onChange:l=>r("msgCacheExpire",parseInt(l.target.value)),min:"1",max:"86400",className:"input-field",placeholder:"3600"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"消息在缓存中保留的时间(1-86400秒)"})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-green-500 to-teal-600 flex items-center justify-center",children:o.jsx(da,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"扩展功能"}),o.jsx("p",{className:"text-sm text-gray-600",children:"第三方服务配置"})]})]}),o.jsxs("label",{className:"block",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(da,{size:16,className:"text-green-600"}),o.jsx("span",{className:"text-sm font-medium text-gray-700",children:"音乐签名地址"})]}),o.jsx("input",{type:"text",value:e.musicSignUrl,onChange:l=>r("musicSignUrl",l.target.value),placeholder:"https://example.com/sign",className:"input-field"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"用于音乐卡片签名的服务地址"})]})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-pink-600 flex items-center justify-center",children:o.jsx(zp,{size:20,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"安全设置"}),o.jsx("p",{className:"text-sm text-gray-600",children:"WebUI 访问控制"})]})]}),o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Mc,{size:20,className:"text-red-600"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"WebUI 访问密码"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"用于保护 WebUI 访问的密码"})]})]}),o.jsxs("button",{onClick:n,className:"px-4 py-2 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg text-sm font-medium hover:shadow-lg transition-all flex items-center gap-2",children:[o.jsx(Cp,{size:16}),"修改密码"]})]})]})]})};function Fc(e,t){const n=e.trim();return n?t!==void 0&&n.length<t?{isValid:!1,error:`密码长度不能少于${t}位`}:/[\r\n]/.test(n)?{isValid:!1,error:"密码不能包含换行符!"}:/[^\x20-\x7E\t]/.test(n)?{isValid:!1,error:"密码不能包含中文等特殊字符!"}:/[\x00-\x08\x0A-\x1F\x7F]/.test(n)?{isValid:!1,error:"密码包含不可见的控制字符!"}:{isValid:!0}:{isValid:!1,error:"密码不能为空"}}const as=({visible:e,onConfirm:t,onClose:n,error:r})=>{const[l,s]=C.useState(""),[i,a]=C.useState(!1),[u,d]=C.useState(""),g=C.useRef(null);C.useEffect(()=>{e&&g.current&&setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},100)},[e]),C.useEffect(()=>{e&&(s(""),a(!1),d(""))},[e]);const h=()=>{const v=Fc(l);if(!v.isValid){d(v.error||"密码验证失败");return}d(""),t(l.trim())},m=v=>{v.key==="Enter"&&h()};return C.useEffect(()=>{if(!e)return;const v=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e]),e?o.jsx(o.Fragment,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},onClick:v=>v.target===v.currentTarget&&(n==null?void 0:n()),children:o.jsxs("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-md transform transition-all",children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/20",children:[o.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:r||"WebUI 密码"}),n&&o.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 transition-colors",children:o.jsx(sr,{size:24})})]}),o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{ref:g,type:i?"text":"password",value:l,onChange:v=>{s(v.target.value),u&&d("")},onKeyPress:m,placeholder:"请输入密码(支持数字、字母、符号)",className:`w-full px-4 py-3 pr-12 border rounded-xl focus:outline-none focus:ring-2 transition-all bg-white/50 backdrop-blur-sm ${u?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-transparent"}`,autoComplete:"off"}),o.jsx("button",{type:"button",onClick:()=>a(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:i?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),u&&o.jsx("p",{className:"text-sm text-red-500 px-1",children:u})]})}),o.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/20",children:[n&&o.jsx("button",{onClick:n,className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-lg font-medium transition-colors",children:"取消"}),o.jsx("button",{onClick:h,disabled:!l.trim(),className:"px-6 py-2.5 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg font-medium hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none",children:"确定"})]})]})})}):null};function Ap(e){const t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=new TextEncoder().encode(e),l=r.length*8,s=Math.ceil((l+65)/512)*64,i=new Uint8Array(s);i.set(r),i[r.length]=128;const a=new DataView(i.buffer);a.setUint32(s-4,l&4294967295,!1);let u=1779033703,d=3144134277,g=1013904242,h=2773480762,m=1359893119,v=2600822924,y=528734635,k=1541459225;for(let w=0;w<s;w+=64){const f=new Uint32Array(64);for(let b=0;b<16;b++)f[b]=a.getUint32(w+b*4,!1);for(let b=16;b<64;b++){const L=(f[b-15]>>>7|f[b-15]<<25)^(f[b-15]>>>18|f[b-15]<<14)^f[b-15]>>>3,M=(f[b-2]>>>17|f[b-2]<<15)^(f[b-2]>>>19|f[b-2]<<13)^f[b-2]>>>10;f[b]=f[b-16]+L+f[b-7]+M>>>0}let c=u,p=d,x=g,N=h,E=m,z=v,_=y,F=k;for(let b=0;b<64;b++){const L=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7),M=E&z^~E&_,S=F+L+M+t[b]+f[b]>>>0,O=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),X=c&p^c&x^p&x,I=O+X>>>0;F=_,_=z,z=E,E=N+S>>>0,N=x,x=p,p=c,c=S+I>>>0}u=u+c>>>0,d=d+p>>>0,g=g+x>>>0,h=h+N>>>0,m=m+E>>>0,v=v+z>>>0,y=y+_>>>0,k=k+F>>>0}return[u.toString(16).padStart(8,"0"),d.toString(16).padStart(8,"0"),g.toString(16).padStart(8,"0"),h.toString(16).padStart(8,"0"),m.toString(16).padStart(8,"0"),v.toString(16).padStart(8,"0"),y.toString(16).padStart(8,"0"),k.toString(16).padStart(8,"0")].join("")}async function Up(e){try{return Ap(e)}catch(t){if(console.error("[PasswordHash] 纯JS SHA-256实现失败:",t),typeof crypto<"u"&&crypto.subtle)try{const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch(n){console.error("[PasswordHash] Web Crypto API失败:",n)}throw new Error("无法计算SHA-256哈希")}}async function ha(e){return await Up(e)}function $p(e,t,n=30){const r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3);const l=`expires=${r.toUTCString()}`,i=window.location.protocol==="https:"?"; Secure":"",a=window.location.hostname,d=/^\d+\.\d+\.\d+\.\d+$/.test(a)?"":"; SameSite=Lax",g=`${e}=${t}; ${l}; path=/${d}${i}`;document.cookie=g}function Vp(e){const t=e+"=",n=document.cookie.split(";");for(let r=0;r<n.length;r++){let l=n[r];for(;l.charAt(0)===" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return l.substring(t.length,l.length)}return console.log("[Cookie] 未找到Cookie:",{name:e,allCookies:document.cookie}),null}const Oc="webui_token",Bp=30;let Ln=null;function Hp(e){Ln=e}function Qp(){return Vp(Oc)}function ga(e){$p(Oc,e,Bp)}async function dt(e,t={}){const n=async r=>{const l={...t.headers};return r&&(l["x-webui-token"]=r),fetch(e,{...t,headers:l})};try{let r=await n(Qp());if(r.status===401&&Ln){console.log("401 - Password not set, prompting to set password...");const l=await Ln("请设置密码");if(!l||!l.trim())throw new Error("密码不能为空");if(!(await fetch("/api/set-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:l.trim()})})).ok)throw new Error("设置密码失败");const i=await ha(l.trim());ga(i),r=await n(i)}if(r.status===403&&Ln){console.log("403 - Token verification failed, prompting for password...");let l=null;try{l=await r.clone().json()}catch{}l!=null&&l.locked&&ae(l.message||"账户已被锁定","error");let s=0;const i=5;for(;r.status===403&&s<i;)try{const a=s>0?"密码错误,请重新输入":"请输入密码",u=await Ln(a);if(!u||!u.trim())throw new Error("密码不能为空");const d=await ha(u.trim());if(ga(d),r=await n(d),r.status===200){console.log("Authentication successful!");break}try{if(l=await r.clone().json(),l!=null&&l.locked)throw new Error(l.message||"账户已被锁定")}catch{}s++}catch(a){throw console.error("Password prompt error:",a),a}if(r.status===403)throw new Error((l==null?void 0:l.message)||"认证失败")}if(!r.ok){const l=await r.text();throw new Error(`HTTP error! status: ${r.status}, message: ${l}`)}return await r.json()}catch(r){throw console.error("API fetch error:",r),r}}const Wp=({visible:e,onClose:t,onSuccess:n})=>{const[r,l]=C.useState(""),[s,i]=C.useState(""),[a,u]=C.useState(!1),[d,g]=C.useState(!1),[h,m]=C.useState(!1),[v,y]=C.useState(""),k=C.useRef(null);C.useEffect(()=>{e&&k.current&&setTimeout(()=>{var c;return(c=k.current)==null?void 0:c.focus()},100)},[e]),C.useEffect(()=>{e&&(l(""),i(""),u(!1),g(!1),y(""))},[e]);const w=async()=>{const c=Fc(r,6);if(!c.isValid){y(c.error||"密码验证失败");return}if(r!==s){y("两次输入的密码不一致");return}m(!0),y("");try{const p=await dt("/api/set-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r})});p.success?(ae("密码修改成功","success"),n(),t()):y(p.message||"密码修改失败")}catch(p){y(p.message||"密码修改失败")}finally{m(!1)}},f=c=>{c.key==="Enter"&&w()};return e?o.jsx(o.Fragment,{children:o.jsx("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-sm flex items-center justify-center p-4",style:{zIndex:9e3},onClick:c=>c.target===c.currentTarget&&t(),children:o.jsxs("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl shadow-2xl w-full max-w-md transform transition-all",children:[o.jsxs("div",{className:"flex items-center gap-3 p-6 border-b border-white/20",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-red-500 to-pink-600 flex items-center justify-center",children:o.jsx(Mc,{size:20,className:"text-white"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:"修改 WebUI 密码"}),o.jsx("p",{className:"text-sm text-gray-600 mt-0.5",children:"请输入新密码"})]}),o.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors",children:o.jsx(sr,{size:24})})]}),o.jsxs("div",{className:"p-6 space-y-4",children:[v&&o.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-xl text-red-600 text-sm",children:v}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"新密码"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{ref:k,type:a?"text":"password",value:r,onChange:c=>{l(c.target.value),y("")},onKeyPress:f,placeholder:"请输入新密码(支持数字、字母、符号)",className:"w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all bg-white/50 backdrop-blur-sm",autoComplete:"new-password"}),o.jsx("button",{type:"button",onClick:()=>u(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:a?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"密码长度至少6位"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"确认密码"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:d?"text":"password",value:s,onChange:c=>{i(c.target.value),y("")},onKeyPress:f,placeholder:"请再次输入新密码",className:"w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all bg-white/50 backdrop-blur-sm",autoComplete:"new-password"}),o.jsx("button",{type:"button",onClick:()=>g(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors",children:d?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]})]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-white/20",children:[o.jsx("button",{onClick:t,disabled:h,className:"px-6 py-2.5 text-gray-700 hover:bg-gray-100 rounded-lg font-medium transition-colors disabled:opacity-50",children:"取消"}),o.jsx("button",{onClick:w,disabled:h||!r.trim()||!s.trim(),className:"px-6 py-2.5 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-lg font-medium hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none",children:h?"修改中...":"确定修改"})]})]})})}):null},Kp=({onLoginSuccess:e})=>{const[t,n]=C.useState("quick"),[r,l]=C.useState(!1),[s,i]=C.useState(!1),[a,u]=C.useState(!1),[d,g]=C.useState(""),[h,m]=C.useState([]),[v,y]=C.useState(null),[k,w]=C.useState(!1),f=C.useRef(null),c=C.useRef(null),p=C.useRef(null),x=C.useRef(!1),N={scanning:"扫描成功,请在手机上确认",success:"登录成功",expired:"二维码已过期,请刷新",error:"登录失败,请重试","":""},E=C.useCallback(()=>{x.current=!1,p.current&&(clearTimeout(p.current),p.current=null)},[]),z=C.useCallback(async()=>{if(x.current)return;x.current=!0,console.log("开始轮询登录状态...");const I=60;let oe=0;const P=async()=>{if(oe>=I){E(),ae("登录超时,请重试","error"),t==="qr"&&g("error");return}oe++;try{const R=await dt("/api/login-info");if(R.success&&R.data.online===!0){E(),ae("登录成功!正在跳转到主页面...","success"),t==="qr"&&g("success"),setTimeout(()=>{e()},1e3);return}p.current=setTimeout(P,3e3)}catch(R){console.warn("轮询登录状态失败:",R),p.current=setTimeout(P,3e3)}};await P()},[t,e,E]),_=C.useCallback(I=>{if(!f.current)return;const P=f.current.getContext("2d");if(!P)return;const R=new Image;R.onload=()=>{P.clearRect(0,0,200,200),P.drawImage(R,0,0,200,200)},R.src=I},[]),F=C.useCallback(async()=>{if(f.current)try{const I=await dt("/api/login-qrcode");if(I.success&&I.data){_(I.data.pngBase64QrcodeData);const oe=I.data.expireTime*1e3;c.current&&clearInterval(c.current),c.current=setTimeout(()=>{u(!0),g("expired"),E()},oe),u(!1),g(""),ae("请使用手机QQ扫码登录","warning"),await z()}else throw new Error(I.message||"获取二维码失败")}catch(I){ae(I.message||"获取二维码失败","error"),console.error("QR code generation error:",I)}},[_,z,E]),b=C.useCallback(async()=>{await F(),ae("二维码已刷新","success")},[F]),L=C.useRef(!1),M=C.useCallback(async()=>{if(!L.current){L.current=!0;try{const I=await dt("/api/quick-login-list");if(console.log("Quick login list response:",I),I.success&&I.data&&I.data.LocalLoginInfoList){const oe=I.data.LocalLoginInfoList.filter(P=>P.isQuickLogin&&!P.isUserLogin);m(oe),console.log("Accounts loaded:",oe),oe.length>0?y(P=>P??oe[0]):n("qr")}else console.warn("No quick login accounts available:",I.message),m([])}catch(I){console.error("Failed to fetch quick login list:",I),ae("获取快速登录列表失败","error"),m([])}}},[]),S=C.useCallback(async()=>{if(v){i(!0);try{const oe=(await dt("/api/quick-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uin:v.uin})})).data;if(oe.result==="0")ae(`正在登录 ${v.nickName}...`,"success"),await z();else throw new Error(oe.loginErrorInfo.errMsg||"登录失败")}catch(I){ae(I.message,"error"),console.error("Quick login error:",I),n("qr")}finally{i(!1)}}},[v,z]),O=()=>{l(!r)},X=I=>{y(I),l(!1)};return C.useEffect(()=>(L.current||M(),()=>{c.current&&clearInterval(c.current),E()}),[]),C.useEffect(()=>{t==="qr"?setTimeout(()=>F(),100):c.current&&clearInterval(c.current),t==="quick"&&h.length===0&&!L.current&&M()},[t,h.length,F]),o.jsx("div",{className:"relative min-h-screen flex flex-col items-center justify-center p-5",children:o.jsxs("div",{className:"bg-white/50 backdrop-blur-2xl rounded-3xl p-10 shadow-xl border border-white/30 min-w-[320px] text-center relative z-10",children:[t==="quick"&&o.jsxs("div",{className:"flex flex-col items-center gap-6",children:[!r&&v&&o.jsxs("div",{className:"flex flex-col items-center cursor-pointer p-4 rounded-2xl transition-colors hover:bg-blue-50",onClick:O,children:[o.jsx("div",{className:"w-20 h-20 rounded-full overflow-hidden mb-3 shadow-lg",children:o.jsx("img",{src:v.faceUrl,alt:v.nickName,className:"w-full h-full object-cover"})}),o.jsx("div",{className:"text-base text-gray-800 mb-2",children:v.nickName})]}),r&&o.jsx("div",{className:"grid grid-cols-2 gap-4 my-5 w-full max-w-md",children:h.map(I=>o.jsxs("div",{className:"flex flex-col items-center p-4 rounded-2xl cursor-pointer transition-all border-2 border-transparent hover:bg-blue-50 hover:border-blue-500",onClick:()=>X(I),children:[o.jsx("div",{className:"w-[60px] h-[60px] rounded-full overflow-hidden mb-2 shadow-md",children:o.jsx("img",{src:I.faceUrl,alt:I.nickName,className:"w-full h-full object-cover"})}),o.jsx("div",{className:"text-sm text-gray-800 text-center truncate w-full px-1",children:I.nickName})]},I.uin))}),!r&&o.jsx("button",{onClick:S,disabled:!v||s,className:"w-[280px] h-11 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-full font-medium text-base disabled:opacity-50 disabled:cursor-not-allowed hover:shadow-lg transition-all flex items-center justify-center gap-2",children:s?o.jsxs(o.Fragment,{children:[o.jsx(Vt,{size:20,className:"animate-spin"}),"登录中..."]}):"登录"}),o.jsxs("div",{className:"flex gap-6 justify-center",children:[!r&&o.jsx("button",{onClick:O,className:"text-blue-600 text-sm hover:underline",children:"切换账号"}),o.jsx("button",{onClick:()=>n("qr"),className:"text-blue-600 text-sm hover:underline",children:"扫码登录"})]})]}),t==="qr"&&o.jsxs("div",{className:"flex flex-col items-center gap-5",children:[o.jsx("div",{className:"relative inline-block",children:o.jsxs("div",{className:"relative p-5 bg-white rounded-2xl shadow-lg",children:[o.jsx("canvas",{ref:f,width:"200",height:"200",className:"block rounded-lg"}),a&&o.jsxs("div",{className:"absolute inset-0 bg-black/70 flex flex-col items-center justify-center text-white cursor-pointer rounded-2xl transition-opacity hover:opacity-90",onClick:b,children:[o.jsx(Pp,{size:32,className:"mb-2"}),o.jsx("div",{children:"点击刷新"})]})]})}),o.jsx("div",{className:"text-gray-600",children:"请使用手机QQ扫码登录"}),d&&o.jsx("div",{className:`text-sm px-4 py-2 rounded-lg ${d==="success"?"bg-green-100 text-green-800":d==="error"||d==="expired"?"bg-red-100 text-red-800":"bg-blue-100 text-blue-800"}`,children:N[d]})]}),o.jsx("div",{className:"mt-6",children:t==="qr"&&h.length>0&&o.jsx("button",{onClick:()=>n("quick"),className:"text-blue-600 text-sm hover:underline",children:"快速登录"})})]})})},qp=!1,Gp=()=>({friendCount:128,groupCount:45,messageReceived:12580,messageSent:3842,startupTime:Math.floor(Date.now()/1e3)-3600*5-1234,lastMessageTime:Math.floor(Date.now()/1e3)-30,bot:{memory:(80+Math.random()*40)*1024*1024,totalMemory:16*1024*1024*1024,memoryPercent:2+Math.random()*3,cpu:3+Math.random()*10},qq:{memory:(200+Math.random()*100)*1024*1024,totalMemory:16*1024*1024*1024,memoryPercent:5+Math.random()*8,cpu:5+Math.random()*15}}),ya=e=>!e||e<=0?"0 MB":e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":e<1024*1024*1024?(e/1024/1024).toFixed(0)+" MB":(e/1024/1024/1024).toFixed(2)+" GB",Yp=e=>{const n=Math.floor(Date.now()/1e3)-e,r=Math.floor(n/86400),l=Math.floor(n%86400/3600),s=Math.floor(n%3600/60),i=n%60;return r>0?`${r}天 ${l}时 ${s}分`:l>0?`${l}时 ${s}分 ${i}秒`:s>0?`${s}分 ${i}秒`:`${i}秒`},Xp=e=>e?new Date(e*1e3).toLocaleString("zh-CN"):"暂无",_r=({icon:e,label:t,value:n,gradient:r})=>o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-white/30 hover:bg-white/50 transition-all duration-200 hover:scale-[1.02]",children:[o.jsx("div",{className:`w-10 h-10 rounded-xl ${r} flex items-center justify-center shadow-md`,children:e}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-xs text-gray-500",children:t}),o.jsx("p",{className:"text-lg font-bold text-gray-800 truncate",children:n})]})]}),xa=({value:e,size:t=100,strokeWidth:n=8,gradientId:r,gradientColors:l,label:s,displayValue:i,icon:a})=>{const u=(t-n)/2,d=u*2*Math.PI,g=Math.min(Math.max(e,0),100),h=d-g/100*d;return o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsxs("div",{className:"relative",style:{width:t,height:t},children:[o.jsxs("svg",{width:t,height:t,className:"transform -rotate-90",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[o.jsx("stop",{offset:"0%",stopColor:l[0]}),o.jsx("stop",{offset:"100%",stopColor:l[1]})]})}),o.jsx("circle",{cx:t/2,cy:t/2,r:u,fill:"none",stroke:"rgba(0,0,0,0.06)",strokeWidth:n}),o.jsx("circle",{cx:t/2,cy:t/2,r:u,fill:"none",stroke:`url(#${r})`,strokeWidth:n,strokeDasharray:d,strokeDashoffset:h,strokeLinecap:"round",className:"transition-all duration-1000 ease-out"})]}),o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[o.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${l[0]}, ${l[1]})`},children:a}),o.jsxs("span",{className:"text-sm font-bold text-gray-800 mt-1",children:[g.toFixed(1),"%"]})]})]}),o.jsx("p",{className:"text-xs font-semibold text-gray-700 mt-2",children:s}),o.jsx("p",{className:"text-xs text-gray-500",children:i})]})},va=({title:e,icon:t,gradient:n,cpu:r,memory:l,totalMemory:s,memoryPercent:i,cpuGradientId:a,memGradientId:u,cpuColors:d,memColors:g})=>o.jsxs("div",{className:"card p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsx("div",{className:`w-8 h-8 rounded-lg ${n} flex items-center justify-center shadow-md`,children:t}),o.jsx("h4",{className:"text-sm font-semibold text-gray-800",children:e})]}),o.jsxs("div",{className:"flex justify-around",children:[o.jsx(xa,{value:r,gradientId:a,gradientColors:d,label:"CPU",displayValue:`${r.toFixed(1)}%`,icon:o.jsx(Lc,{size:16,className:"text-white"})}),o.jsx(xa,{value:i,gradientId:u,gradientColors:g,label:"内存",displayValue:`${ya(l)} / ${ya(s)}`,icon:o.jsx(xp,{size:16,className:"text-white"})})]})]}),Zp=()=>{const[e,t]=C.useState(null),[n,r]=C.useState(!0),[l,s]=C.useState(""),i=C.useRef(),a=async()=>{try{const u=qp?Gp():(await dt("/api/dashboard/stats")).data;u&&t(u)}catch(u){console.error("Failed to fetch dashboard stats:",u)}finally{r(!1)}};return C.useEffect(()=>(a(),i.current=window.setInterval(a,5e3),()=>{i.current&&clearInterval(i.current)}),[]),C.useEffect(()=>{if(!(e!=null&&e.startupTime))return;const u=()=>s(Yp(e.startupTime));u();const d=setInterval(u,1e3);return()=>clearInterval(d)},[e==null?void 0:e.startupTime]),n?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("div",{className:"w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"})}):e?o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"card p-4 flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center shadow-md",children:o.jsx(Br,{size:20,className:"text-white"})}),o.jsx("h3",{className:"text-base font-semibold text-gray-800",children:"运行时间"}),o.jsxs("div",{className:"ml-auto flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-medium",children:[o.jsx(Mp,{size:12}),"运行中"]})]}),o.jsxs("div",{className:"flex-1 flex flex-col justify-center space-y-2",children:[o.jsxs("div",{className:"p-3 rounded-xl bg-gradient-to-r from-indigo-50 to-purple-50",children:[o.jsx("p",{className:"text-xs text-gray-500",children:"已运行"}),o.jsx("p",{className:"text-xl font-bold bg-gradient-to-r from-indigo-600 to-purple-600 bg-clip-text text-transparent",children:l})]}),o.jsxs("div",{className:"px-3 py-2",children:[o.jsx("p",{className:"text-xs text-gray-500",children:"启动时间"}),o.jsx("p",{className:"text-sm font-medium text-gray-700",children:Xp(e.startupTime)})]})]})]}),o.jsxs("div",{className:"card p-4 space-y-3",children:[o.jsx(_r,{icon:o.jsx(Tp,{size:20,className:"text-white"}),label:"好友数量",value:e.friendCount.toLocaleString(),gradient:"bg-gradient-to-br from-blue-500 to-cyan-500"}),o.jsx(_r,{icon:o.jsx(_p,{size:20,className:"text-white"}),label:"群组数量",value:e.groupCount.toLocaleString(),gradient:"bg-gradient-to-br from-purple-500 to-pink-500"})]}),o.jsxs("div",{className:"card p-4 space-y-3",children:[o.jsx(_r,{icon:o.jsx(jp,{size:20,className:"text-white"}),label:"收到消息",value:e.messageReceived.toLocaleString(),gradient:"bg-gradient-to-br from-green-500 to-emerald-500"}),o.jsx(_r,{icon:o.jsx(lo,{size:20,className:"text-white"}),label:"发送消息",value:e.messageSent.toLocaleString(),gradient:"bg-gradient-to-br from-orange-500 to-amber-500"})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(va,{title:"QQ 资源",icon:o.jsx(wp,{size:16,className:"text-white"}),gradient:"bg-gradient-to-br from-blue-500 to-cyan-500",cpu:e.qq.cpu,memory:e.qq.memory,totalMemory:e.qq.totalMemory,memoryPercent:e.qq.memoryPercent,cpuGradientId:"qqCpuGradient",memGradientId:"qqMemGradient",cpuColors:["#3b82f6","#06b6d4"],memColors:["#0ea5e9","#22d3ee"]}),o.jsx(va,{title:"Bot 资源",icon:o.jsx(hp,{size:16,className:"text-white"}),gradient:"bg-gradient-to-br from-violet-500 to-purple-600",cpu:e.bot.cpu,memory:e.bot.memory,totalMemory:e.bot.totalMemory,memoryPercent:e.bot.memoryPercent,cpuGradientId:"botCpuGradient",memGradientId:"botMemGradient",cpuColors:["#8b5cf6","#a855f7"],memColors:["#6366f1","#8b5cf6"]})]})]}):o.jsx("div",{className:"card p-8 text-center",children:o.jsx("p",{className:"text-gray-500",children:"无法加载统计数据"})})},us=()=>{const e=C.useRef(null),t=C.useRef([]),n=C.useRef(),r=C.useRef(0);return C.useEffect(()=>{const l=e.current;if(!l)return;const s=l.getContext("2d",{alpha:!0});if(!s)return;const a=1e3/30,u=()=>{l.width=window.innerWidth,l.height=window.innerHeight,t.current.forEach(y=>{y.offscreenCanvas=g(y)})},d=["rgba(139, 92, 246, 0.6)","rgba(59, 130, 246, 0.6)","rgba(236, 72, 153, 0.6)","rgba(16, 185, 129, 0.6)","rgba(245, 158, 11, 0.6)","rgba(168, 85, 247, 0.6)","rgba(14, 165, 233, 0.6)","rgba(251, 113, 133, 0.6)"],g=y=>{const k=Math.ceil(y.baseRadius*2.5),w=document.createElement("canvas");w.width=k,w.height=k;const f=w.getContext("2d");if(!f)return w;const c=k/2,p=k/2,x=y.baseRadius,N=f.createRadialGradient(c,p,0,c,p,x);return N.addColorStop(0,y.color.replace("0.6","0.8")),N.addColorStop(.5,y.color),N.addColorStop(1,y.color.replace("0.6","0")),f.fillStyle=N,f.beginPath(),f.arc(c,p,x,0,Math.PI*2),f.fill(),w},h=()=>{const y=[];for(let w=0;w<8;w++){const f=Math.random()*80+60,c={x:Math.random()*l.width,y:Math.random()*l.height,vx:(Math.random()-.5)*.8,vy:(Math.random()-.5)*.8,radius:f,baseRadius:f,scale:1,scaleSpeed:Math.random()*.002+.001,color:d[Math.floor(Math.random()*d.length)]};c.offscreenCanvas=g(c),y.push(c)}t.current=y},m=(y,k)=>{const w=k.x-y.x,f=k.y-y.y,c=Math.sqrt(w*w+f*f);if(c<y.radius+k.radius){const p=Math.atan2(f,w),x=Math.sin(p),N=Math.cos(p),E=y.vx*N+y.vy*x,z=y.vy*N-y.vx*x,_=k.vx*N+k.vy*x,F=k.vy*N-k.vx*x;y.vx=_*N-z*x,y.vy=z*N+_*x,k.vx=E*N-F*x,k.vy=F*N+E*x;const b=(y.radius+k.radius-c)/2;y.x-=b*N,y.y-=b*x,k.x+=b*N,k.y+=b*x}},v=y=>{n.current=requestAnimationFrame(v);const k=y-r.current;k<a||(r.current=y-k%a,s.clearRect(0,0,l.width,l.height),t.current.forEach((w,f)=>{w.x+=w.vx,w.y+=w.vy,w.scale+=w.scaleSpeed,(w.scale>1.2||w.scale<.8)&&(w.scaleSpeed=-w.scaleSpeed),w.radius=w.baseRadius*w.scale,(w.x-w.radius<0||w.x+w.radius>l.width)&&(w.vx=-w.vx,w.x=Math.max(w.radius,Math.min(l.width-w.radius,w.x))),(w.y-w.radius<0||w.y+w.radius>l.height)&&(w.vy=-w.vy,w.y=Math.max(w.radius,Math.min(l.height-w.radius,w.y)));for(let c=f+1;c<t.current.length;c++)m(w,t.current[c]);if(w.offscreenCanvas){const c=w.offscreenCanvas.width*w.scale;s.drawImage(w.offscreenCanvas,w.x-c/2,w.y-c/2,c,c)}}))};return u(),window.addEventListener("resize",u),h(),n.current=requestAnimationFrame(v),()=>{window.removeEventListener("resize",u),n.current&&cancelAnimationFrame(n.current)}},[]),o.jsx("canvas",{ref:e,className:"fixed inset-0 w-full h-full pointer-events-none",style:{zIndex:0}})},Jp={enable:!0,connect:[]},e0={enable:!1,port:5600,token:""},t0={enable:!1,reportSelfMessage:!1,http:{port:3010,prefix:"",accessToken:""},webhook:{urls:[]}},n0={enable:!0,port:3080},r0={webui:n0,onlyLocalhost:!0,milky:t0,satori:e0,ob11:Jp,enableLocalFile2Url:!1,log:!0,autoDeleteFile:!1,autoDeleteFileSecond:60,musicSignUrl:"https://llob.linyuchen.net/sign/music",msgCacheExpire:120,ffmpeg:"",rawMsgPB:!1},l0="7.1.3";function s0(){const[e,t]=C.useState("dashboard"),[n,r]=C.useState(r0),[l,s]=C.useState(!1),[i,a]=C.useState(!1),[u,d]=C.useState(!0),[g,h]=C.useState(null),[m,v]=C.useState(!1),[y,k]=C.useState(""),[w,f]=C.useState(null),[c,p]=C.useState(!1),[x,N]=C.useState(!1),[E,z]=C.useState(!1);C.useEffect(()=>{Hp(async L=>new Promise(M=>{k(L||""),v(!0),f(()=>M)}))},[]);const _=C.useCallback(L=>{L.trim()?(v(!1),k(""),w&&(w(L),f(null))):k("密码不能为空")},[w]);C.useEffect(()=>{(async()=>{try{const M=await dt("/api/config");M.success&&M.data.selfInfo.online?(a(!0),h({nick:M.data.selfInfo.nick||"",uin:M.data.selfInfo.uin}),r(M.data.config)):a(!1)}catch(M){console.error("Failed to check login status:",M),a(!1)}finally{d(!1)}})()},[]);const F=C.useCallback(async L=>{try{s(!0);const S=await dt("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:L||n})});S.success?ae("配置保存成功","success"):ae("保存失败:"+S.message,"error")}catch(M){ae("保存失败:"+M.message,"error")}finally{s(!1)}},[n]),b=C.useCallback(()=>{window.location.reload()},[]);return u?o.jsxs(o.Fragment,{children:[o.jsx(us,{}),o.jsx("div",{className:"relative flex items-center justify-center min-h-screen z-10",children:o.jsx(Vt,{size:48,className:"animate-spin text-blue-500"})}),o.jsx(as,{visible:m,onConfirm:_,error:y})]}):i?o.jsxs("div",{className:"flex min-h-screen",children:[o.jsx(us,{}),o.jsx(Rp,{activeTab:e,onTabChange:t,accountInfo:g||void 0}),o.jsx("main",{className:"flex-1 p-8 overflow-auto z-10",children:o.jsxs("div",{className:"max-w-6xl mx-auto",children:[o.jsxs("div",{className:"mb-8",children:[o.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:e==="dashboard"&&"Dashboard"}),o.jsx("p",{className:"text-white/80",children:e==="dashboard"&&"欢迎使用 Lucky Lillia Bot"})]}),e==="dashboard"&&o.jsx(Zp,{}),e==="onebot"&&o.jsx(Op,{config:n.ob11,globalConfig:n,onChange:L=>{const M={...n,ob11:L};r(M)},onSave:L=>{if(L){const M={...n,ob11:L};F(M)}else F()}}),e==="satori"&&o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center",children:o.jsx(so,{size:24,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"Satori 协议"}),o.jsx("p",{className:"text-sm text-gray-600",children:"配置 Satori 协议相关设置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"启用 Satori 协议"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"开启后将支持 Satori 协议连接"})]}),o.jsx("input",{type:"checkbox",checked:n.satori.enable,onChange:L=>r({...n,satori:{...n.satori,enable:L.target.checked}}),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
291
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
292
+ transition-colors duration-200 ease-in-out
293
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
294
+ before:w-5 before:h-5 before:rounded-full before:bg-white
295
+ before:transition-transform before:duration-200
296
+ checked:before:translate-x-6`})]}),n.satori.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Satori 端口"}),o.jsx("input",{type:"number",value:n.satori.port,onChange:L=>r({...n,satori:{...n.satori,port:parseInt(L.target.value)}}),min:"1",max:"65535",placeholder:"5500",className:"input-field"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Satori 服务监听端口(1-65535)"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Satori Token"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:c?"text":"password",value:n.satori.token,onChange:L=>r({...n,satori:{...n.satori,token:L.target.value}}),placeholder:"请输入 Satori Token",className:"input-field pr-12"}),o.jsx("button",{type:"button",onClick:()=>p(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors p-1",children:c?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"用于 Satori 连接验证的 Token"})]})]})]}),o.jsx("div",{className:"mt-6 flex justify-end",children:o.jsx("button",{onClick:()=>{var L;if(!n.onlyLocalhost&&n.satori.enable&&!((L=n.satori.token)!=null&&L.trim())){ae('当"只监听本地地址"关闭时,必须设置 Satori Token!',"error");return}F()},disabled:l,className:"btn-primary flex items-center gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Vt,{size:20,className:"animate-spin"}),"保存中..."]}):o.jsxs(o.Fragment,{children:[o.jsx(is,{size:20}),"保存配置"]})})})]}),e==="milky"&&o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-pink-500 to-rose-600 flex items-center justify-center",children:o.jsx(so,{size:24,className:"text-white"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"Milky 协议"}),o.jsx("p",{className:"text-sm text-gray-600",children:"配置 Milky 协议相关设置"})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"启用 Milky 协议"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"开启后将支持 Milky 协议连接"})]}),o.jsx("input",{type:"checkbox",checked:n.milky.enable,onChange:L=>r({...n,milky:{...n.milky,enable:L.target.checked}}),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
297
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
298
+ transition-colors duration-200 ease-in-out
299
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
300
+ before:w-5 before:h-5 before:rounded-full before:bg-white
301
+ before:transition-transform before:duration-200
302
+ checked:before:translate-x-6`})]}),n.milky.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl hover:bg-gray-100/50 transition-colors",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"上报自己发送的消息"}),o.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:"启用后将上报自己发送的消息"})]}),o.jsx("input",{type:"checkbox",checked:n.milky.reportSelfMessage,onChange:L=>r({...n,milky:{...n.milky,reportSelfMessage:L.target.checked}}),className:`w-12 h-6 rounded-full bg-gray-300 relative cursor-pointer appearance-none
303
+ checked:bg-gradient-to-r checked:from-blue-500 checked:to-purple-600
304
+ transition-colors duration-200 ease-in-out
305
+ before:content-[''] before:absolute before:top-0.5 before:left-0.5
306
+ before:w-5 before:h-5 before:rounded-full before:bg-white
307
+ before:transition-transform before:duration-200
308
308
  checked:before:translate-x-6`})]}),o.jsxs("div",{className:"border-t border-gray-200 pt-4 mt-4",children:[o.jsx("h4",{className:"text-md font-semibold text-gray-800 mb-4",children:"HTTP 配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"HTTP 端口"}),o.jsx("input",{type:"number",value:n.milky.http.port,onChange:L=>r({...n,milky:{...n.milky,http:{...n.milky.http,port:parseInt(L.target.value)}}}),min:"1",max:"65535",placeholder:"3010",className:"input-field"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Milky HTTP 服务监听端口(1-65535)"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"路径前缀"}),o.jsx("input",{type:"text",value:n.milky.http.prefix,onChange:L=>r({...n,milky:{...n.milky,http:{...n.milky.http,prefix:L.target.value}}}),placeholder:"/api",className:"input-field"}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"HTTP API 路径前缀(可选)"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:x?"text":"password",value:n.milky.http.accessToken,onChange:L=>r({...n,milky:{...n.milky,http:{...n.milky.http,accessToken:L.target.value}}}),placeholder:"请输入 Access Token",className:"input-field pr-12"}),o.jsx("button",{type:"button",onClick:()=>N(!x),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors p-1",children:x?o.jsx(hn,{size:20}):o.jsx(gn,{size:20})})]}),o.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"用于 Milky HTTP 连接验证的 Token"})]})]})]}),o.jsxs("div",{className:"border-t border-gray-200 pt-4 mt-4",children:[o.jsx("h4",{className:"text-md font-semibold text-gray-800 mb-4",children:"Webhook 配置"}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Webhook URLs"}),o.jsxs("div",{className:"space-y-2",children:[n.milky.webhook.urls.map((L,M)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"text",value:L,onChange:S=>{const O=[...n.milky.webhook.urls];O[M]=S.target.value,r({...n,milky:{...n.milky,webhook:{...n.milky.webhook,urls:O}}})},placeholder:"http:// 或 https://",className:`input-field flex-1 ${L&&!L.match(/^https?:\/\//)?"border-red-300 focus:ring-red-500":""}`}),o.jsx("button",{type:"button",onClick:()=>{const S=n.milky.webhook.urls.filter((O,X)=>X!==M);r({...n,milky:{...n.milky,webhook:{...n.milky.webhook,urls:S}}})},className:"p-2 text-red-500 hover:bg-red-50 rounded-lg transition-colors",title:"删除",children:o.jsx(gl,{size:18})})]},M)),n.milky.webhook.urls.some(L=>L&&!L.match(/^https?:\/\//))&&o.jsx("p",{className:"text-xs text-red-500",children:"URL 必须以 http:// 或 https:// 开头"}),o.jsxs("button",{type:"button",onClick:()=>{r({...n,milky:{...n.milky,webhook:{...n.milky.webhook,urls:[...n.milky.webhook.urls,""]}}})},className:"flex items-center gap-2 px-4 py-2 text-blue-600 hover:bg-blue-50 rounded-lg transition-colors text-sm font-medium",children:[o.jsx(Rc,{size:18}),"添加 Webhook URL"]})]}),o.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"事件上报的 Webhook 地址"})]})]})]})]}),o.jsx("div",{className:"mt-6 flex justify-end",children:o.jsx("button",{onClick:()=>{var S;if(!n.onlyLocalhost&&n.milky.enable&&!((S=n.milky.http.accessToken)!=null&&S.trim())){ae('当"只监听本地地址"关闭时,必须设置 Milky Access Token!',"error");return}if(n.milky.webhook.urls.filter(O=>O.trim()&&!O.match(/^https?:\/\//)).length>0){ae("Webhook URL 必须以 http:// 或 https:// 开头","error");return}const M={...n,milky:{...n.milky,webhook:{...n.milky.webhook,urls:n.milky.webhook.urls.filter(O=>O.trim())}}};r(M),F(M)},disabled:l,className:"btn-primary flex items-center gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Vt,{size:20,className:"animate-spin"}),"保存中..."]}):o.jsxs(o.Fragment,{children:[o.jsx(is,{size:20}),"保存配置"]})})})]}),e==="other"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pb-24",children:o.jsx(Dp,{config:n,onChange:r,onOpenChangePassword:()=>z(!0)})}),o.jsx("div",{className:"fixed bottom-8 right-8 z-40",children:o.jsx("button",{onClick:()=>F(),disabled:l,className:"btn-primary flex items-center gap-2 shadow-2xl hover:shadow-3xl",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Vt,{size:20,className:"animate-spin"}),"保存中..."]}):o.jsxs(o.Fragment,{children:[o.jsx(is,{size:20}),"保存配置"]})})})]}),e==="about"&&o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"card p-8 text-center",children:[o.jsx("div",{className:"w-20 h-20 rounded-3xl overflow-hidden mx-auto mb-6 shadow-lg",children:o.jsx("img",{src:"/logo.jpg",alt:"Logo",className:"w-full h-full object-cover"})}),o.jsx("h1",{className:"text-3xl font-bold text-gray-800 mb-2",children:"Lucky Lillia Bot"}),o.jsx("p",{className:"text-gray-600 mb-6",children:"使你的 QQNT 支持 OneBot 11 协议、Satori 协议、Milky 协议进行 QQ 机器人开发"}),o.jsxs("div",{className:"flex items-center justify-center gap-4",children:[o.jsxs("a",{href:"https://github.com/LLOneBot/LLOneBot",target:"_blank",rel:"noopener noreferrer",className:"px-6 py-2.5 bg-gray-800 text-white rounded-xl hover:bg-gray-900 transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"GitHub"]}),o.jsxs("a",{href:"https://llonebot.com",target:"_blank",rel:"noopener noreferrer",className:"px-6 py-2.5 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl hover:shadow-lg transition-all flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),"文档"]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-cyan-600 flex items-center justify-center",children:o.jsx("svg",{className:"w-6 h-6 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M16.5 3c-1.862 0-3.505.928-4.5 2.344C11.005 3.928 9.362 3 7.5 3 4.462 3 2 5.462 2 8.5c0 4.171 4.912 8.213 6.281 9.49a2.94 2.94 0 0 0 2.438.94 2.94 2.94 0 0 0 2.438-.94C14.588 16.713 19.5 12.671 19.5 8.5 19.5 5.462 17.038 3 16.5 3z"})})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"Telegram 群"}),o.jsx("p",{className:"text-sm text-gray-600"})]})]}),o.jsx("a",{href:"https://t.me/+nLZEnpne-pQ1OWFl",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 hover:underline text-sm break-all",children:"https://t.me/+nLZEnpne-pQ1OWFl"})]}),o.jsxs("div",{className:"card p-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-green-500 to-emerald-600 flex items-center justify-center",children:o.jsx("svg",{className:"w-6 h-6 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M16.5 3c-1.862 0-3.505.928-4.5 2.344C11.005 3.928 9.362 3 7.5 3 4.462 3 2 5.462 2 8.5c0 4.171 4.912 8.213 6.281 9.49a2.94 2.94 0 0 0 2.438.94 2.94 2.94 0 0 0 2.438-.94C14.588 16.713 19.5 12.671 19.5 8.5 19.5 5.462 17.038 3 16.5 3z"})})}),o.jsx("div",{children:o.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"QQ 群"})})]}),o.jsx("div",{className:"flex items-center gap-3",children:o.jsx("a",{href:"https://qm.qq.com/q/EZndy3xntQ",target:"_blank",rel:"noopener noreferrer",className:" text-blue-600 hover:text-blue-700 hover:underline",children:"545402644"})})]})]}),o.jsx("div",{className:"card p-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500 to-pink-600 flex items-center justify-center",children:o.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-gray-800",children:"版本信息"}),o.jsxs("div",{className:"text-xs text-gray-500",children:["Lucky Lillia Bot ",l0]})]})]}),o.jsxs("div",{className:"text-sm text-gray-600",children:["WebUI Powered by ",o.jsx("span",{className:"font-semibold text-purple-600",children:"React + Tailwind"})]})]})})]})]})}),l&&o.jsx("div",{className:"fixed inset-0 bg-black/20 flex items-center justify-center",style:{zIndex:9e3},children:o.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-2xl",children:[o.jsx(Vt,{size:48,className:"animate-spin text-blue-600 mx-auto"}),o.jsx("p",{className:"mt-4 text-gray-700",children:"加载中..."})]})}),o.jsx(as,{visible:m,onConfirm:_,error:y}),o.jsx(Wp,{visible:E,onClose:()=>z(!1),onSuccess:()=>{window.location.reload()}}),o.jsx(ma,{})]}):o.jsxs(o.Fragment,{children:[o.jsx(us,{}),o.jsx(Kp,{onLoginSuccess:b}),o.jsx(as,{visible:m,onConfirm:_,error:y}),o.jsx(ma,{})]})}cs.createRoot(document.getElementById("root")).render(o.jsx(ed.StrictMode,{children:o.jsx(s0,{})}));
package/webui/index.html CHANGED
@@ -1,13 +1,13 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>WebUI</title>
7
- <script type="module" crossorigin src="/assets/index-B8SmuMJC.js"></script>
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>WebUI</title>
7
+ <script type="module" crossorigin src="/assets/index-CAnlmz3O.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CO7Tbtyt.css">
9
- </head>
10
- <body>
11
- <div id="root"></div>
12
- </body>
13
- </html>
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ </body>
13
+ </html>
@@ -1,4 +1,4 @@
1
- 官网 https://luckylillia.com
2
- GitHub: https://github.com/LLOneBot/LuckyLilliaBot
3
- QQ Group: https://qm.qq.com/q/NsbdKiQ3eg
4
-
1
+ 官网 https://luckylillia.com
2
+ GitHub: https://github.com/LLOneBot/LuckyLilliaBot
3
+ QQ Group: https://qm.qq.com/q/NsbdKiQ3eg
4
+