4 lines
60 KiB
JavaScript
4 lines
60 KiB
JavaScript
import{b as ie,j as e,a as l,c as Me}from"./react-vendor-l-BBvuKH.js";import{r as T,c as L}from"./index-CiBUw4Te.js";import{c as Ae,o as Pe}from"./contract-COFcZjyb.js";import{n as de,X as ce,f as Be,L as J,o as qe,p as Ge,q as Oe,r as Te,s as Le,U as Ee,t as ae,u as ze,k as we,Q as _e,v as Ie,R as We,w as Ve,x as Ke,y as Ne,K as He,z as Je,F as Xe,e as Ye,H as Ze}from"./icons-vendor-Bgrth_9N.js";import"./vendor-cRYyTeIw.js";const Fe=(t,s)=>{const r=t.avatar_url||"";if(!r)return"";try{const a=new URL(r,window.location.origin);return a.hostname.endsWith("alicdn.com")&&a.searchParams.set("_v",s),a.toString()}catch{return r}},es=async t=>{const s=await T(n=>L.GET("/api/v1/accounts/details",{signal:n}),t),r=Ae(s,["data","accounts","details"]),a=Date.now().toString();return r.map(n=>({id:n.id,cookie_configured:n.has_cookie===!0,enabled:n.enabled,auto_confirm:n.auto_confirm,remark:n.remark,pause_duration:n.pause_duration,paused_until:Number(n.paused_until||0),paused:n.paused===!0,username:n.username||"",login_password_configured:void 0,show_browser:n.show_browser===!0||n.show_browser===1||n.show_browser==="1"||n.show_browser==="true",nickname:n.nickname||n.remark||`账号 ${n.id.substring(0,6)}`,avatar_url:Fe(n,a),profile_error:n.profile_error||"",ai_enabled:!1,auto_rate_enabled:n.auto_rate_enabled,rate_content:n.rate_content||"不错的买家,交易愉快",auto_polish_enabled:n.auto_polish_enabled,polish_time:n.polish_time||"03:00",last_rate_scan_at:Number(n.last_rate_scan_at||0),last_polish_date:n.last_polish_date||"",last_polish_at:Number(n.last_polish_at||0)}))},ve=async(t,s)=>T(r=>L.GET("/api/v1/account-tasks/{cid}",{params:{path:{cid:t}},signal:r}),s),ke=async(t,s,r)=>T(a=>L.PUT("/api/v1/account-tasks/{cid}",{params:{path:{cid:t}},body:s,signal:a}),r),ss=async(t,s,r)=>T(a=>L.POST("/api/v1/account-tasks/{cid}/run",{params:{path:{cid:t}},body:{task_type:s},signal:a}),{timeoutMs:12e4,...r}),ts=async t=>await T(r=>L.GET("/api/v1/accounts/runtime-status",{signal:r}),t),as=async t=>T(s=>L.POST("/api/v1/qr-login/generate",{signal:s}),{...t,timeoutMs:(t==null?void 0:t.timeoutMs)??13e4}),rs=async(t,s)=>T(r=>L.GET("/api/v1/qr-login/check/{session_id}",{params:{path:{session_id:t}},signal:r}),{signal:s,timeoutMs:1e4}),ns=async(t,s)=>T(r=>L.POST("/api/v1/qr-login/complete-verification/{session_id}",{params:{path:{session_id:t}},body:{target_account_id:s||""},signal:r})),ls=async(t,s)=>T(r=>L.PUT("/api/v1/accounts/{cid}/status",{params:{path:{cid:t}},body:{enabled:s},signal:r})),os=async t=>T(s=>L.DELETE("/api/v1/accounts/{cid}",{params:{path:{cid:t}},signal:s})),is=async(t,s,r)=>T(a=>L.PUT("/api/v1/accounts/{cid}/pause-duration",{params:{path:{cid:t}},body:{pause_duration:s},signal:a}),r),cs=async(t,s,r)=>T(a=>L.PUT("/api/v1/accounts/{cid}/settings",{params:{path:{cid:t}},body:s,signal:a}),r),ds=async(t,s)=>T(r=>L.GET("/api/v1/accounts/{cid}/long-login",{params:{path:{cid:t}},signal:r}),s),us=async(t,s,r)=>T(a=>L.PUT("/api/v1/accounts/{cid}/long-login",{params:{path:{cid:t}},body:{enabled:s},signal:a}),r),xs=async(t,s)=>T(r=>L.POST("/api/v1/password-login",{body:t,signal:r}),s),ms=async(t,s)=>T(a=>L.GET("/api/v1/password-login/check/{session_id}",{params:{path:{session_id:t}},signal:a}),{signal:s,timeoutMs:1e4}),bs=async(t,s)=>T(r=>L.DELETE("/api/v1/password-login/cancel/{session_id}",{params:{path:{session_id:t}},signal:r}),s),hs=async t=>T(s=>L.POST("/api/v1/accounts/{cid}/refresh-profile",{params:{path:{cid:t}},signal:s})),gs=async t=>{const s=await T(r=>L.GET("/api/v1/settings/ai-reply",{signal:r}),t);return Pe(s,["settings","data","result"])||{}},ps=async(t,s)=>T(r=>L.GET("/api/v1/settings/ai-reply/{cookie_id}",{params:{path:{cookie_id:t}},signal:r}),s),fs=async(t,s,r)=>{const a={ai_enabled:s.ai_enabled??!1,max_discount_percent:s.max_discount_percent??10,max_discount_amount:s.max_discount_amount??100,max_bargain_rounds:s.max_bargain_rounds??3,custom_prompts:s.custom_prompts??""};return T(n=>L.PUT("/api/v1/settings/ai-reply/{cookie_id}",{params:{path:{cookie_id:t}},body:a,signal:n}),r)},ys=t=>{if(Array.isArray(t))return t.filter(Boolean);if(typeof t!="string"||!t.trim())return[];try{const s=JSON.parse(t);if(Array.isArray(s))return s.filter(Boolean)}catch{}return t.split(/[,\s;]+/).map(s=>s.trim()).filter(Boolean)},js=async t=>{const s=await T(a=>L.GET("/api/v1/notifications/channels",{signal:a}),t);return{success:!0,data:Ae(s,["data","channels","items"]).map(a=>{const n={},c=a.type==="ding_talk"?"dingtalk":a.type==="lark"?"feishu":a.type;return{id:String(a.id),name:a.name,type:c,config:n,event_types:ys(a.event_types),enabled:a.enabled}})}},ws=async(t,s)=>{const r=await T(n=>L.GET("/api/v1/notifications/accounts/{cid}/bindings",{params:{path:{cid:t}},signal:n}),s),a=Pe(r,["data","result"])||{};return Array.isArray(a.channel_ids)?a.channel_ids:[]},_s=({account:t,settings:s,saving:r,onChange:a,onClose:n,onSave:c})=>{const i=u=>a({...s,...u}),d=()=>i({ai_enabled:!s.ai_enabled}),b=u=>i({max_discount_percent:parseInt(u.target.value,10)||0}),m=u=>i({max_discount_amount:parseInt(u.target.value,10)||0}),f=u=>i({max_bargain_rounds:parseInt(u.target.value,10)||1}),h=u=>i({custom_prompts:u.target.value});return ie.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"600px"},children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-2xl font-extrabold text-gray-900 flex items-center gap-2",children:[e.jsx(de,{className:"w-6 h-6 text-purple-500"}),"AI助手设置"]}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:t.nickname||t.remark||t.id})]}),e.jsx("button",{onClick:n,className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0","aria-label":"关闭 AI 设置",children:e.jsx(ce,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"modal-body space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-purple-50 rounded-xl",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(de,{className:"w-4 h-4 text-purple-500"}),"启用AI自动回复"]}),e.jsx("div",{className:"text-xs text-gray-500",children:"AI将自动处理买家的砍价消息"})]}),e.jsx("button",{type:"button",onClick:d,className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${s.ai_enabled?"bg-brand":"bg-gray-300"}`,"aria-label":"切换 AI 自动回复",children:e.jsx("span",{className:`absolute left-1 top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 ${s.ai_enabled?"translate-x-6":"translate-x-0"}`})})]}),e.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"砍价策略"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最大折扣比例 (%)"}),e.jsx("input",{type:"number",value:s.max_discount_percent,onChange:b,className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"100"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"例如:10 表示最多降价 10%;设为 0 表示不允许降价"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最大折扣金额 (元)"}),e.jsx("input",{type:"number",value:s.max_discount_amount,onChange:m,className:"w-full ios-input px-4 py-3 rounded-xl",min:"0"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"例如:100 表示最多降价 100 元;设为 0 表示不允许降价"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最大砍价轮次"}),e.jsx("input",{type:"number",value:s.max_bargain_rounds,onChange:f,className:"w-full ios-input px-4 py-3 rounded-xl",min:"1",max:"10"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"买家最多可以砍价的次数"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"自定义提示词(可选)"}),e.jsx("textarea",{value:s.custom_prompts,onChange:h,placeholder:`输入自定义的AI回复规则或风格指引...
|
|
|
|
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(Be,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:n,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:r,children:"取消"}),e.jsxs("button",{onClick:(()=>void c()),className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:r,children:[r?e.jsx(J,{className:"w-4 h-4 animate-spin"}):e.jsx(qe,{className:"w-4 h-4"}),r?"保存中...":"保存"]})]})})]})}),document.body)},Ce=t=>({account_id:t.id,auto_rate_enabled:t.auto_rate_enabled===!0,rate_content:t.rate_content||"不错的买家,交易愉快",auto_polish_enabled:t.auto_polish_enabled===!0,polish_time:t.polish_time||"03:00",last_rate_scan_at:t.last_rate_scan_at,last_polish_date:t.last_polish_date,last_polish_at:t.last_polish_at}),Z=(t,s,r)=>t===s&&!r.aborted,ye=(t,s)=>t instanceof Error?t.message:s,je=t=>t instanceof Error&&t.message==="请求已取消",Se=(t,s)=>!t&&s==="",Ns=({account:t,onSaved:s})=>{const[r,a]=l.useState(()=>Ce(t)),[n,c]=l.useState(!0),[i,d]=l.useState(!1),[b,m]=l.useState(""),[f,h]=l.useState(""),[u,A]=l.useState(null),[k,g]=l.useState(null),p=l.useRef(0),E=l.useRef(null);l.useEffect(()=>{var N;const S=++p.current;(N=E.current)==null||N.abort();const j=new AbortController;return E.current=j,a(Ce(t)),A(null),h(""),d(!1),m(""),g(null),c(!0),ve(t.id,{signal:j.signal}).then(R=>{Z(p.current,S,j.signal)&&a(R)}).catch(R=>{Z(p.current,S,j.signal)&&!je(R)&&h(ye(R,"加载任务设置失败"))}).finally(()=>{Z(p.current,S,j.signal)&&c(!1)}),(()=>j.abort())},[t.id]),l.useEffect(()=>(()=>{var S;return(S=E.current)==null?void 0:S.abort()}),[]);const B=l.useCallback(async()=>{var N;if(!Se(i,b))return;const S=++p.current;(N=E.current)==null||N.abort();const j=new AbortController;E.current=j,d(!0),h(""),g(null);try{const R=await ke(t.id,r,{signal:j.signal});if(!Z(p.current,S,j.signal))return;a(R),s(R)}catch(R){Z(p.current,S,j.signal)&&!je(R)&&(h(ye(R,"保存失败")),g(()=>B))}finally{Z(p.current,S,j.signal)&&d(!1)}},[t.id,r,s,b,i]),G=l.useCallback(async S=>{var R;if(!Se(i,b)||!t.enabled)return;const j=++p.current;(R=E.current)==null||R.abort();const N=new AbortController;E.current=N,m(S),h(""),A(null),g(null);try{await ke(t.id,r,{signal:N.signal});const w=await ss(t.id,S,{signal:N.signal}),P=await ve(t.id,{signal:N.signal});if(!Z(p.current,j,N.signal))return;A(w.summary),a(P),s(P)}catch(w){Z(p.current,j,N.signal)&&!je(w)&&(h(ye(w,"任务执行失败")),g(()=>(()=>G(S))))}finally{Z(p.current,j,N.signal)&&m("")}},[t.enabled,t.id,r,s,b,i]),D=l.useCallback(async()=>{k&&await k()},[k]);return{form:r,loading:n,saving:i,running:b,summary:u,error:f,retryAvailable:k!==null,setForm:a,save:B,run:G,retry:D}},Re=({checked:t,onChange:s,label:r})=>e.jsx("button",{type:"button","aria-label":r,"aria-pressed":t,onClick:s,className:`relative h-8 w-14 shrink-0 rounded-full transition-colors ${t?"bg-sky-500":"bg-slate-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-sm transition-transform ${t?"translate-x-6":""}`})}),vs=({account:t,onClose:s,onSaved:r})=>{const{form:a,loading:n,saving:c,running:i,error:d,summary:b,retryAvailable:m,setForm:f,save:h,run:u,retry:A}=Ns({account:t,onSaved:r});return e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"640px"},role:"dialog","aria-modal":"true","aria-labelledby":"account-task-title",children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"account-task-title",className:"text-2xl font-extrabold text-slate-950",children:"账号自动任务"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:t.nickname||t.remark||t.id})]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-xl p-2 text-slate-400 hover:bg-slate-100 hover:text-slate-700","aria-label":"关闭",children:e.jsx(ce,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"modal-body space-y-5",children:[n&&e.jsx("div",{className:"rounded-xl bg-slate-50 px-4 py-3 text-sm text-slate-500",children:"正在读取任务设置..."}),e.jsx("section",{className:"rounded-2xl border border-slate-200 bg-white p-5",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-emerald-50 text-emerald-600",children:e.jsx(Ge,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-black text-slate-900",children:"自动评价"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-500",children:"持续扫描待评价订单,按订单执行;不是每日任务。"})]}),e.jsx(Re,{checked:a.auto_rate_enabled,onChange:(()=>f(k=>({...k,auto_rate_enabled:!k.auto_rate_enabled}))),label:"自动评价"})]}),e.jsx("label",{className:"mt-4 block text-xs font-extrabold text-slate-600",children:"统一好评文案"}),e.jsx("textarea",{"aria-label":"统一好评文案",value:a.rate_content,maxLength:500,onChange:(k=>f(g=>({...g,rate_content:k.target.value}))),className:"mt-2 h-24 w-full resize-none rounded-xl border border-slate-200 bg-slate-50 px-3 py-2.5 text-sm leading-6 text-slate-800 placeholder:text-slate-400 outline-none focus:border-sky-400 focus:ring-2 focus:ring-sky-100"}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"text-xs text-slate-400",children:["最近扫描:",a.last_rate_scan_at?new Date(a.last_rate_scan_at*1e3).toLocaleString("zh-CN"):"尚未执行"]}),e.jsxs("button",{type:"button",disabled:i!==""||!t.enabled,onClick:(()=>void u("auto_rate")),className:"flex items-center gap-2 rounded-xl bg-emerald-50 px-3 py-2 text-xs font-extrabold text-emerald-700 hover:bg-emerald-100 disabled:opacity-50",children:[i==="auto_rate"?e.jsx(J,{className:"h-4 w-4 animate-spin"}):e.jsx(Oe,{className:"h-4 w-4"}),"立即评价"]})]})]})]})}),e.jsx("section",{className:"rounded-2xl border border-slate-200 bg-white p-5",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-amber-50 text-amber-600",children:e.jsx(Te,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-black text-slate-900",children:"每日自动擦亮"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-500",children:"每个账号每天最多执行一次,按北京时间判断。"})]}),e.jsx(Re,{checked:a.auto_polish_enabled,onChange:(()=>f(k=>({...k,auto_polish_enabled:!k.auto_polish_enabled}))),label:"每日自动擦亮"})]}),e.jsxs("div",{className:"mt-4 flex items-end justify-between gap-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-extrabold text-slate-600",children:"每日执行时间"}),e.jsx("input",{type:"time",value:a.polish_time,onChange:(k=>f(g=>({...g,polish_time:k.target.value}))),className:"mt-2 block rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-bold text-slate-800 outline-none focus:border-sky-400"})]}),e.jsxs("button",{type:"button",disabled:i!==""||!t.enabled,onClick:(()=>void u("auto_polish")),className:"flex items-center gap-2 rounded-xl bg-amber-50 px-3 py-2 text-xs font-extrabold text-amber-700 hover:bg-amber-100 disabled:opacity-50",children:[i==="auto_polish"?e.jsx(J,{className:"h-4 w-4 animate-spin"}):e.jsx(Le,{className:"h-4 w-4"}),"立即擦亮"]})]}),e.jsxs("div",{className:"mt-3 text-xs text-slate-400",children:["上次完成:",a.last_polish_at?new Date(a.last_polish_at*1e3).toLocaleString("zh-CN"):"尚未执行"]})]})]})}),b&&e.jsxs("div",{className:"rounded-xl border border-sky-100 bg-sky-50 px-4 py-3 text-sm text-sky-900",children:["本次发现 ",b.found," 项,成功 ",b.success,",失败 ",b.failed,",跳过 ",b.skipped,"。",b.message||""]}),d&&e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700",children:[e.jsx("span",{children:d}),m&&e.jsx("button",{type:"button",className:"font-bold underline",onClick:(()=>void A()),children:"重试"})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex w-full gap-3",children:[e.jsx("button",{type:"button",onClick:s,disabled:c||i!=="",className:"flex-1 rounded-xl bg-gray-100 px-6 py-3 font-bold text-gray-700 transition-colors hover:bg-gray-200 disabled:opacity-50",children:"关闭"}),e.jsxs("button",{type:"button",onClick:(()=>void h()),disabled:c||i!==""||a.auto_rate_enabled&&!a.rate_content.trim(),className:"ios-btn-primary flex flex-1 items-center justify-center gap-2 rounded-xl px-6 py-3 font-bold disabled:opacity-50",children:[c?e.jsx(J,{className:"h-4 w-4 animate-spin"}):e.jsx(qe,{className:"h-4 w-4"}),"保存"]})]})})]})})},ks=(t,s)=>{if(!t||!s)return!1;const r=Date.parse(t),a=Date.parse(s);return Number.isFinite(r)&&Number.isFinite(a)&&a<r},Cs=(t,s)=>t.map(r=>{const a=s[r.id];return!a||ks(r.runtime_updated_at,a.updated_at)?r:{...r,runtime_state:a.state,runtime_message:a.message||"",runtime_connected:a.connected,runtime_updated_at:a.updated_at}}),Ss=t=>{if(!t.enabled||t.runtime_state==="disabled")return{label:"已停用",badge:"bg-gray-100 text-gray-500",dot:"bg-gray-300"};switch(t.runtime_state){case"online":return{label:"在线",badge:"bg-green-100 text-green-700",dot:"bg-green-500"};case"starting":case"connecting":return{label:"连接中",badge:"bg-blue-100 text-blue-700",dot:"bg-blue-500"};case"reconnecting":return{label:"重连中",badge:"bg-amber-100 text-amber-700",dot:"bg-amber-500"};case"auth_expired":return{label:"登录已失效",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};case"verification_required":return{label:"需要验证",badge:"bg-orange-100 text-orange-700",dot:"bg-orange-500"};case"runtime_conflict":return{label:"运行状态冲突",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};case"error":case"stopped":return{label:"运行异常",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};default:return{label:"状态检测中",badge:"bg-gray-100 text-gray-600",dot:"bg-gray-400"}}},Rs=Me.memo(function({account:s,refreshing:r,deleting:a,onRefreshProfile:n,onReauthorize:c,onEdit:i,onAI:d,onTasks:b,onToggle:m,onDelete:f}){const h=Ss(s),u=s.runtime_state==="auth_expired"||s.runtime_state==="verification_required";return e.jsx("div",{className:"ios-card rounded-xl p-6 group transition-all duration-300 hover:border-brand",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-5 sm:gap-8",children:[e.jsxs("div",{className:"relative",children:[s.avatar_url?e.jsx("img",{src:s.avatar_url,alt:s.nickname||"账号头像",className:"w-20 h-20 rounded-full object-cover shadow-md ring-4 ring-white bg-gray-100"}):e.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 text-gray-400 shadow-md ring-4 ring-white flex items-center justify-center",children:e.jsx(Ee,{className:"w-9 h-9"})}),e.jsx("div",{className:`absolute -bottom-1 -right-1 w-6 h-6 rounded-full border-4 border-white flex items-center justify-center ${h.dot}`,children:s.runtime_state==="online"&&e.jsx(ae,{className:"w-3 h-3 text-white"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 mb-1",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900 break-words",children:s.nickname||s.remark||`账号 ${s.id.substring(0,6)}...`}),e.jsx("span",{className:`px-2.5 py-0.5 rounded-lg text-xs font-bold ${h.badge}`,children:h.label}),s.ai_enabled&&e.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-purple-100 text-purple-700 text-xs font-bold flex items-center gap-1",children:[e.jsx(de,{className:"w-3 h-3"})," AI"]}),s.auto_rate_enabled&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-emerald-100 px-2.5 py-0.5 text-xs font-bold text-emerald-700",children:[e.jsx(ze,{className:"h-3 w-3"})," 自动评价"]}),s.auto_polish_enabled&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-amber-100 px-2.5 py-0.5 text-xs font-bold text-amber-700",children:[e.jsx(Te,{className:"h-3 w-3"})," 每日擦亮"]}),s.auto_confirm&&e.jsxs("span",{className:"flex items-center gap-1 rounded-lg bg-blue-50 px-2.5 py-0.5 text-xs font-bold text-blue-700",children:[e.jsx(ae,{className:"h-3 w-3"})," 自动确认发货"]}),s.profile_error&&e.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-amber-100 text-amber-700 text-xs font-bold flex items-center gap-1",title:s.profile_error,children:[e.jsx(we,{className:"w-3 h-3"})," 资料未同步"]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"text-sm font-medium text-gray-500",children:[e.jsx("p",{children:s.remark||"暂无备注"}),e.jsxs("p",{className:"font-mono text-xs text-gray-400",children:["ID: ",s.id]})]}),s.runtime_message&&s.runtime_state!=="online"&&s.runtime_state!=="disabled"&&e.jsxs("div",{className:`mb-3 flex flex-wrap items-center gap-2 text-sm font-medium ${u?"text-red-700":"text-amber-700"}`,children:[e.jsx(we,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{children:s.runtime_message}),u&&e.jsxs("button",{type:"button",onClick:(()=>c(s)),className:"inline-flex items-center gap-1.5 rounded-lg bg-red-50 px-2.5 py-1 text-xs font-bold text-red-700 hover:bg-red-100",children:[e.jsx(_e,{className:"w-3.5 h-3.5"})," 重新授权"]})]}),s.paused&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-lg bg-blue-50 px-3 py-1.5 text-xs font-bold text-blue-700",children:[e.jsx(Ie,{className:"h-3 w-3"})," 暂停处理中"]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2",children:[e.jsx("button",{onClick:(()=>n(s)),disabled:r,className:"p-3 rounded-xl transition-colors text-gray-600 hover:bg-gray-100 disabled:opacity-50",title:"刷新昵称和头像",children:e.jsx(We,{className:`w-5 h-5 ${r?"animate-spin":""}`})}),e.jsx("button",{onClick:(()=>c(s)),className:`p-3 rounded-xl transition-colors ${u?"text-red-600 bg-red-50 hover:bg-red-100":"text-blue-600 hover:bg-blue-50"}`,title:"重新扫码授权当前账号",children:e.jsx(_e,{className:"w-5 h-5"})}),e.jsx("button",{onClick:(()=>i(s)),className:"p-3 rounded-xl hover:bg-gray-100 transition-colors text-gray-600",title:"编辑账号",children:e.jsx(Ve,{className:"w-5 h-5"})}),e.jsx("button",{onClick:(()=>d(s)),className:"p-3 rounded-xl hover:bg-purple-100 transition-colors text-purple-600",title:"AI设置",children:e.jsx(de,{className:"w-5 h-5"})}),e.jsx("button",{onClick:(()=>b(s)),className:"p-3 rounded-xl hover:bg-amber-100 transition-colors text-amber-600",title:"自动评价与每日擦亮",children:e.jsx(Le,{className:"w-5 h-5"})}),e.jsx("button",{onClick:(()=>m(s.id,s.enabled)),className:`p-3 rounded-xl transition-colors ${s.enabled?"text-green-600 hover:bg-green-50":"text-gray-400 hover:bg-gray-100"}`,title:s.enabled?"停用账号":"启用账号",children:e.jsx(Ke,{className:"w-5 h-5"})}),e.jsx("button",{onClick:(()=>f(s)),disabled:a,className:"p-3 rounded-xl hover:bg-red-100 transition-colors text-red-500 disabled:cursor-not-allowed disabled:opacity-40",title:a?"删除中…":`删除账号 ${s.nickname||s.remark||s.id}`,children:a?e.jsx(J,{className:"w-5 h-5 animate-spin"}):e.jsx(Ne,{className:"w-5 h-5"})})]})]})]})]})})}),As=({account:t,deleting:s,error:r,onClose:a,onConfirm:n})=>ie.createPortal(e.jsx("div",{className:"modal-overlay-centered",role:"presentation",children:e.jsxs("div",{className:"h-fit w-full max-w-[400px] self-center overflow-hidden rounded-2xl border border-white/80 bg-white shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"delete-account-title","aria-describedby":"delete-account-description",children:[e.jsxs("div",{className:"relative overflow-hidden border-b border-red-100 bg-gradient-to-br from-red-50 via-white to-orange-50 px-5 py-5",children:[e.jsx("div",{className:"absolute -right-12 -top-16 h-36 w-36 rounded-full bg-red-200/35 blur-2xl"}),e.jsxs("div",{className:"relative flex items-start gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl bg-red-600 text-white shadow-md shadow-red-200",children:e.jsx(Ne,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{id:"delete-account-title",className:"text-lg font-extrabold tracking-tight text-gray-950",children:"删除这个账号?"}),e.jsx("p",{id:"delete-account-description",className:"mt-1 text-xs leading-5 text-gray-600",children:"删除后,该账号的关联配置也会一并清理,此操作无法撤销。"})]}),e.jsx("button",{type:"button",onClick:a,disabled:s,className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full text-gray-400 transition-colors hover:bg-white hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"关闭删除确认",children:e.jsx(ce,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-gray-50/80 px-4 py-3",children:[e.jsx("div",{className:"text-sm font-extrabold text-gray-900",children:t.nickname||t.remark||"未命名账号"}),t.remark&&t.nickname&&e.jsxs("div",{className:"mt-1 text-sm text-gray-500",children:["备注:",t.remark]}),e.jsxs("div",{className:"mt-1.5 break-all font-mono text-[11px] text-gray-400",children:["ID: ",t.id]})]}),s&&e.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-xl border border-blue-100 bg-blue-50 px-4 py-3",role:"progressbar","aria-label":"正在删除账号",children:[e.jsx(J,{className:"h-5 w-5 flex-shrink-0 animate-spin text-brand"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-extrabold text-blue-950",children:"正在删除账号"}),e.jsx("div",{className:"mt-0.5 text-xs text-blue-700",children:"正在清理关联数据,请保持页面打开…"})]})]}),r&&e.jsxs("div",{className:"mt-4 flex items-start gap-3 rounded-xl border border-red-100 bg-red-50 px-4 py-3",role:"alert",children:[e.jsx(we,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-red-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-extrabold text-red-800",children:"删除失败"}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-red-700",children:r})]})]})]}),e.jsxs("div",{className:"flex gap-3 border-t border-gray-100 bg-gray-50/70 px-5 py-4",children:[e.jsx("button",{type:"button",onClick:a,disabled:s,className:"flex-1 rounded-xl bg-white px-5 py-3 text-sm font-extrabold text-gray-700 ring-1 ring-gray-200 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",children:"取消"}),e.jsx("button",{type:"button",onClick:(()=>void n()),disabled:s,className:"flex flex-1 items-center justify-center gap-2 rounded-xl bg-red-600 px-5 py-3 text-sm font-extrabold text-white shadow-lg shadow-red-200 transition-colors hover:bg-red-700 disabled:cursor-not-allowed disabled:bg-red-400",children:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"h-4 w-4 animate-spin"}),"处理中"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-4 w-4"}),"确认删除"]})})]})]})}),document.body),De=({src:t,alt:s,className:r=""})=>e.jsx("img",{src:t,alt:s,className:`block aspect-square h-auto w-full object-contain ${r}`.trim()}),Ps=({account:t,editForm:s,setEditForm:r,saving:a,onClose:n,onSave:c,onRestartPause:i,longLogin:d,onToggleLongLogin:b,passwordLoginView:m,onPasswordLogin:f,onCancelPasswordLogin:h,notifChannels:u,selectedChannelIds:A,bindingsLoaded:k,bindingsLoading:g,bindingsLoadError:p,onRetryBindings:E,onToggleChannel:B,onSettingsDirty:G})=>{const D=(C,K)=>{r(se=>({...se,[C]:K}))},S=()=>void n(),j=()=>void c(),N=C=>D("remark",C.target.value),R=C=>D("cookie",C.target.value),w=()=>D("auto_confirm",!s.auto_confirm),P=C=>D("pause_duration",parseInt(C.target.value,10)||0),U=()=>void i(),Y=()=>void b(),X=C=>D("username",C.target.value),V=C=>r(K=>({...K,login_password:C.target.value,clear_password:!1})),H=()=>D("showLoginPassword",!s.showLoginPassword),z=C=>r(K=>({...K,clear_password:C.target.checked,login_password:C.target.checked?"":K.login_password})),I=()=>D("show_browser",!s.show_browser),W=()=>void h(),$=()=>void f(),M=()=>void E(),ee=C=>{k&&(B(C),G())},re=C=>{const K=A.includes(Number(C.id)),se=()=>ee(Number(C.id));return e.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-xl border border-gray-200 hover:bg-gray-50 cursor-pointer transition-colors",children:[e.jsx("button",{type:"button",onClick:se,disabled:!k,className:`w-5 h-5 rounded-md border-2 flex items-center justify-center transition-colors flex-shrink-0 ${K?"bg-brand border-brand":"bg-white border-gray-300"}`,children:K&&e.jsx(ae,{className:"w-3.5 h-3.5 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-bold text-gray-900 text-sm",children:C.name}),e.jsxs("div",{className:"text-xs text-gray-500",children:[C.type,C.enabled?"":" · 已停用"]})]})]},C.id)};return ie.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"600px"},children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑账号"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:t.nickname||t.remark||t.id})]}),e.jsx("button",{onClick:S,className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",children:e.jsx(ce,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"modal-body space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"账号ID"}),e.jsx("input",{type:"text",value:t.id,disabled:!0,className:"w-full ios-input px-4 py-3 rounded-xl bg-gray-50 text-gray-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注"}),e.jsx("input",{type:"text",value:s.remark,onChange:N,placeholder:"为账号添加备注",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"Cookie"}),e.jsx("textarea",{value:s.cookie,onChange:R,placeholder:"更新账号Cookie",className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none font-mono text-xs"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["当前Cookie长度: ",s.cookie.length," 字符"]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4 text-green-500"}),"自动确认发货"]}),e.jsx("div",{className:"text-xs text-gray-500",children:"自动将闲鱼订单标记为已发货"})]}),e.jsx("button",{type:"button",onClick:w,className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${s.auto_confirm?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 ${s.auto_confirm?"translate-x-6":"translate-x-0"}`})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2 flex items-center gap-2",children:[e.jsx(Ie,{className:"w-4 h-4 text-blue-500"}),"暂停处理时长(分钟)"]}),e.jsx("input",{type:"number",value:s.pause_duration,onChange:P,placeholder:"0",min:"0",max:"1440",className:"w-full ios-input px-4 py-3 rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"设置后会暂停处理该账号的订单,到时间后自动恢复"}),s.pause_duration>0&&!t.paused&&s.pause_duration===(t.pause_duration||0)&&e.jsx("button",{type:"button",disabled:a,onClick:U,className:"mt-3 px-4 py-2 rounded-xl bg-amber-50 text-amber-700 hover:bg-amber-100 text-sm font-bold disabled:opacity-50",children:"立即按当前时长重新暂停"})]}),e.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(He,{className:"w-5 h-5 text-blue-500"}),"登录信息"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl bg-blue-50 p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-gray-900",children:"保存登录信息"}),e.jsx("div",{className:"mt-1 text-xs text-gray-500",children:"状态直接读取并修改闲鱼官方长登录设置"}),d.error&&e.jsx("div",{className:"mt-1 text-xs text-red-600",children:d.error})]}),e.jsx("button",{type:"button","aria-label":"保存登录信息",disabled:d.loading||d.saving||!d.canOpen,onClick:Y,className:`relative h-8 w-14 flex-shrink-0 rounded-full transition-colors ${d.enabled?"bg-brand":"bg-gray-300"} disabled:cursor-not-allowed disabled:opacity-50`,children:e.jsx("span",{className:`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-md transition-transform ${d.enabled?"translate-x-6":"translate-x-0"}`})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"用户名"}),e.jsx("input",{type:"text",value:s.username,onChange:X,placeholder:"闲鱼账号/手机号",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"登录密码"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:s.showLoginPassword?"text":"password",value:s.login_password,onChange:V,placeholder:"用于自动登录",className:"w-full ios-input px-4 py-3 rounded-xl pr-12"}),e.jsx("button",{type:"button",onClick:H,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:s.showLoginPassword?e.jsx(Je,{className:"w-5 h-5"}):e.jsx(Xe,{className:"w-5 h-5"})})]}),e.jsxs("label",{className:"mt-3 flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.clear_password,onChange:z,className:"w-4 h-4 accent-brand"}),e.jsx("span",{className:"text-sm font-bold text-gray-700",children:"清空已保存密码"})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-gray-900",children:"登录时显示浏览器"}),e.jsx("div",{className:"text-xs text-gray-500",children:"调试时可开启查看登录过程"})]}),e.jsx("button",{type:"button",onClick:I,className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${s.show_browser?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 ${s.show_browser?"translate-x-6":"translate-x-0"}`})})]}),e.jsxs("div",{className:"rounded-xl border border-blue-100 bg-blue-50 p-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-blue-950",children:"立即执行账号密码登录"}),e.jsx("div",{className:"text-xs text-blue-700 mt-1",children:"需要在上方重新输入本次登录密码;成功后后端会更新 Cookie 和保存的登录信息。"})]}),m.status==="processing"||m.status==="verification_required"?e.jsx("button",{type:"button",onClick:W,className:"px-4 py-2 rounded-xl bg-white text-red-600 font-bold text-sm border border-red-100",children:"取消登录"}):e.jsx("button",{type:"button",onClick:$,className:"px-4 py-2 rounded-xl bg-blue-600 text-white font-bold text-sm whitespace-nowrap",children:"密码登录刷新授权"})]}),m.message&&e.jsx("div",{className:`text-sm font-medium ${m.status==="failed"?"text-red-700":m.status==="success"?"text-green-700":"text-blue-800"}`,children:m.message}),m.status==="verification_required"&&e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 p-3 text-amber-900",children:[e.jsx("div",{className:"font-extrabold",children:"账号已触发平台风控,需要完成人脸识别"}),e.jsx("div",{className:"text-xs mt-1 leading-5",children:"请在闲鱼 App 或已打开的登录浏览器中按提示完成验证。本页面不会提供可直接打开的风控链接。"}),m.qrCodeUrl&&e.jsx("div",{className:"mt-3 aspect-square w-48 overflow-hidden rounded-xl border bg-white",children:e.jsx(De,{src:m.qrCodeUrl,alt:"密码登录风控二维码",className:"p-2"})})]})]})]})]}),(u.length>0||g||p)&&e.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-gray-900 mb-1 flex items-center gap-2",children:[e.jsx(Ye,{className:"w-5 h-5 text-blue-500"}),"通知渠道绑定"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-4",children:"勾选后,该账号的 token 失效、自动恢复失败、风控验证等事件会推送到这些渠道"}),g&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx(J,{className:"w-4 h-4 animate-spin"}),"正在加载通知绑定"]}),p&&!g&&e.jsxs("div",{className:"mb-3 rounded-xl bg-amber-50 p-3 text-sm text-amber-800 flex items-center justify-between gap-3",children:[e.jsx("span",{children:p}),e.jsx("button",{type:"button",className:"font-bold whitespace-nowrap",onClick:M,children:"重试"})]}),e.jsx("div",{className:"space-y-2",children:u.map(re)})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:S,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:a,children:"取消"}),e.jsxs("button",{onClick:j,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:a,children:[a?e.jsx(J,{className:"w-4 h-4 animate-spin"}):e.jsx(ae,{className:"w-4 h-4"}),a?"保存中...":"保存"]})]})})]})}),document.body)},qs=({faceQrUrl:t,verificationScreenshot:s})=>e.jsxs("div",{className:"w-full min-w-0 max-h-[min(64vh,28rem)] overflow-y-auto overscroll-contain px-1 py-2 text-center",children:[e.jsx("div",{className:"mx-auto mb-2 flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 text-amber-700",children:e.jsx(Ze,{className:"h-5 w-5","aria-hidden":"true"})}),e.jsx("h4",{className:"break-words text-base font-extrabold leading-6 text-amber-900",children:"需要完成安全风控验证"}),e.jsx("p",{className:"mx-auto mt-1 max-w-[15rem] break-words text-xs leading-5 text-amber-800",children:"当前账号触发了闲鱼平台风控。请使用手机闲鱼 App 扫描下方二维码,并按 App 提示完成人脸识别。"}),e.jsx("div",{className:"mx-auto mt-3 flex min-h-36 w-full max-w-[12rem] items-center justify-center overflow-hidden rounded-xl border border-amber-200 bg-white p-2 shadow-sm",children:t?e.jsx("img",{src:t,alt:"闲鱼安全风控验证二维码",className:"block max-h-44 w-full object-contain"}):s?e.jsx("img",{src:s,alt:"闲鱼风控验证页面",className:"block max-h-44 w-full object-contain"}):e.jsxs("div",{className:"flex flex-col items-center gap-2 text-amber-700",children:[e.jsx(J,{className:"h-6 w-6 animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-bold",children:"正在准备风控二维码…"})]})}),e.jsx("p",{className:"mx-auto mt-2 max-w-[15rem] break-words text-[11px] leading-4 text-gray-500",children:"请勿在浏览器中打开验证链接。完成验证后系统会自动检测并刷新登录状态,无需手动确认。"})]}),Ts=({target:t,status:s,codeUrl:r,errorMessage:a,faceQrUrl:n,verificationScreenshot:c,onClose:i})=>ie.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container relative",style:{maxWidth:"26rem"},children:[e.jsx("button",{onClick:i,className:"absolute top-4 right-4 z-10 w-9 h-9 flex items-center justify-center bg-gray-100 hover:bg-gray-200 rounded-full transition-colors","aria-label":"关闭二维码登录",children:e.jsx(ce,{className:"w-5 h-5 text-gray-600"})}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900 mb-2",children:t?"重新授权账号":"扫码添加账号"}),e.jsx("p",{className:"text-gray-500 mb-8 font-medium",children:t?`请用闲鱼APP扫码,为「${t.nickname||t.remark||t.id}」刷新授权`:"请打开闲鱼APP扫描下方二维码"}),e.jsxs("div",{className:`w-full bg-surface-subtle rounded-xl mx-auto flex items-center justify-center overflow-hidden border-4 border-white shadow-inner mb-6 relative ${s==="verification"?"max-w-72 min-h-64 h-auto p-2":"max-w-64 aspect-square"}`,children:[s==="loading"&&e.jsx(J,{className:"w-10 h-10 text-brand animate-spin"}),s==="waiting"&&e.jsx(De,{src:r,alt:"闲鱼登录二维码",className:"p-2"}),s==="success"&&e.jsxs("div",{className:"absolute inset-0 bg-white/95 flex flex-col items-center justify-center text-green-600 animate-fade-in",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:e.jsx(ae,{className:"w-8 h-8"})}),e.jsx("span",{className:"font-bold text-lg",children:"登录成功"})]}),s==="error"&&e.jsxs("div",{className:"px-5 text-center",children:[e.jsx("span",{className:"block text-red-600 font-bold",children:"二维码获取失败"}),e.jsx("span",{className:"mt-2 block text-xs leading-5 text-gray-500",children:a||"请关闭窗口后重新发起扫码登录。"})]}),s==="verification"&&e.jsx(qs,{faceQrUrl:n,verificationScreenshot:c})]}),s!=="verification"&&e.jsx("p",{className:"text-xs text-gray-400 font-medium bg-gray-50 py-2 rounded-xl",children:"二维码有效期为5分钟,请尽快扫码。"})]})})]})}),document.body),Ls=(t,s)=>t.map(r=>{var a,n,c,i,d;return{...r,ai_enabled:((a=s[r.id])==null?void 0:a.ai_enabled)??!1,max_discount_percent:((n=s[r.id])==null?void 0:n.max_discount_percent)??10,max_discount_amount:((c=s[r.id])==null?void 0:c.max_discount_amount)??100,max_bargain_rounds:((i=s[r.id])==null?void 0:i.max_bargain_rounds)??3,custom_prompts:((d=s[r.id])==null?void 0:d.custom_prompts)??""}}),Es=()=>{const[t,s]=l.useState([]),[r,a]=l.useState(!0),n=l.useRef(0),c=l.useRef(null),i=l.useCallback(async()=>{var m;const d=++n.current;(m=c.current)==null||m.abort();const b=new AbortController;c.current=b,a(!0);try{const f={signal:b.signal},[h,u]=await Promise.allSettled([es(f),gs(f)]);if(d!==n.current)return;if(h.status==="rejected")throw h.reason;const A=u.status==="fulfilled"?u.value:{};u.status==="rejected"&&console.error("加载 AI 设置失败:",u.reason),s(Ls(h.value,A))}catch(f){d===n.current&&!b.signal.aborted&&console.error("加载账号失败:",f)}finally{d===n.current&&a(!1)}},[]);return l.useEffect(()=>{let d=!1,b=null;const m=new AbortController,f=async()=>{try{const u=await ts({signal:m.signal,timeoutMs:1e4});d||s(A=>Cs(A,u))}catch(u){d||console.error("加载账号运行状态失败:",u)}finally{d||(b=window.setTimeout(()=>void f(),2e3))}};return i().finally(()=>{d||f()}),()=>{var u;d=!0,m.abort(),n.current+=1,(u=c.current)==null||u.abort(),b!==null&&window.clearTimeout(b)}},[i]),{accounts:t,setAccounts:s,loading:r,loadAccounts:i}},Is=new Set(["expired","cancelled","error","not_found"]),Ds=()=>{let t=0;return{next:()=>(t+=1,t),cancel:()=>{t+=1},isCurrent:(s=>s===t)}},Qs=(t={setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)})=>{let s=null,r=null,a=-1,n=0;const c=()=>{n+=1,r==null||r.abort(),r=null,s!==null&&(t.clearInterval(s),s=null)};return{start:(d,b,m,f=2e3)=>{c();const h=n;r=new AbortController;const u=r.signal;s=t.setInterval(()=>{a===h||h!==n||(a=h,(async()=>{var A,k;try{const g=await b(d,u);if(g.status==="success"){c(),await m.onSuccess(g);return}if(g.status==="scanned"){(A=m.onScanned)==null||A.call(m,g);return}if(g.status==="verification_required"){(k=m.onVerificationRequired)==null||k.call(m,g);return}g.status&&Is.has(g.status)&&(c(),m.onTerminalError(g))}catch(g){if(u.aborted||h!==n)return;c(),m.onPollError(g)}finally{a===h&&(a=-1)}})())},f)},stop:c,isActive:(()=>s!==null)}},Us=({onLoginSuccess:t})=>{const[s,r]=l.useState(!1),[a,n]=l.useState(""),[c,i]=l.useState("pending"),[d,b]=l.useState(""),[m,f]=l.useState(""),[h,u]=l.useState(""),[A,k]=l.useState(null),g=l.useRef(null),p=l.useRef(null),E=l.useRef(null),B=l.useRef(null);g.current===null&&(g.current=Qs()),p.current===null&&(p.current=Ds());const G=()=>{B.current!==null&&(window.clearTimeout(B.current),B.current=null)},D=()=>{var w;(w=g.current)==null||w.stop()},S=()=>{var w,P;(w=E.current)==null||w.abort(),(P=p.current)==null||P.cancel(),D(),G(),r(!1)},j=()=>{G(),B.current=window.setTimeout(()=>{B.current=null,r(!1),t()},1e3)};l.useEffect(()=>()=>{var P,U;D(),(P=p.current)==null||P.cancel(),(U=E.current)==null||U.abort(),G()},[]);const N=async(w,P)=>{const U=await ns(w,P==null?void 0:P.id);if(!U.success||!U.account_id)throw new Error("保存扫码授权失败");return U.account_id};return{showQRModal:s,qrCodeUrl:a,qrStatus:c,qrErrorMessage:d,verificationScreenshot:m,faceQrUrl:h,qrReauthTarget:A,startQRLogin:async w=>{var X,V,H,z;D(),(X=E.current)==null||X.abort();const P=new AbortController;E.current=P;const U=p.current.next();G();const Y=w||null;k(Y),r(!0),i("loading"),b(""),n(""),f(""),u("");try{const I=await as({signal:P.signal});if(!((V=p.current)!=null&&V.isCurrent(U)))return;if(!I.success||!I.qr_code_url||!I.session_id)throw new Error(I.message||"闲鱼未返回可用的登录二维码");const W=I.session_id;n(I.qr_code_url),i("waiting"),(H=g.current)==null||H.start(W,rs,{onSuccess:(async()=>{try{await N(W,Y)}catch($){console.error("保存扫码授权失败",$),i("error");return}i("success"),j()}),onScanned:(()=>{i("waiting")}),onTerminalError:(()=>{i("error")}),onPollError:($=>{console.error("轮询扫码状态失败",$),i("error")}),onVerificationRequired:($=>{i("verification"),$.face_qr_url&&u($.face_qr_url),$.verification_screenshot&&f($.verification_screenshot)})})}catch(I){if(!((z=p.current)!=null&&z.isCurrent(U))||P.signal.aborted)return;b(I instanceof Error?I.message:"二维码获取失败,请稍后重试"),i("error")}finally{E.current===P&&(E.current=null)}},closeQRModal:S}},$s=(t,s)=>t&&s,Ms=(t,s)=>t!==(s.pause_duration||0),Bs=(t,s)=>{const r=s.username!==(t.username||""),a=s.show_browser!==(t.show_browser||!1),n=s.login_password!=="",c=s.clear_password===!0;if(!r&&!a&&!n&&!c)return null;const i={username:s.username,show_browser:s.show_browser};return c?i.clear_password=!0:n&&(i.login_password=s.login_password),i},F=(t,s,r,a)=>t===s&&r===a,Gs=t=>t.status==="success"?{sessionId:"",status:"success",message:t.message||"账号密码登录成功,授权信息已更新",qrCodeUrl:""}:t.status==="processing"||t.status==="verification_required"?{sessionId:"",status:t.status,message:t.message||(t.status==="verification_required"?"账号触发风控,需要完成人脸识别":"登录处理中"),qrCodeUrl:t.qr_code_url||""}:{sessionId:"",status:"failed",message:t.error||t.message||"密码登录失败,请检查账号信息后重试",qrCodeUrl:""},Os=({editingAccount:t,setEditingAccount:s,setActiveModal:r,editForm:a,setEditForm:n,loadAccounts:c})=>{const[i,d]=l.useState({loading:!1,saving:!1,canOpen:!1,enabled:!1,error:""}),[b,m]=l.useState([]),[f,h]=l.useState([]),[u,A]=l.useState(!1),[k,g]=l.useState(!1),[p,E]=l.useState(!1),[B,G]=l.useState(""),[D,S]=l.useState({ai_enabled:!1,max_discount_percent:10,max_discount_amount:100,max_bargain_rounds:3,custom_prompts:""}),[j,N]=l.useState(!1),[R,w]=l.useState({sessionId:"",status:"idle",message:"",qrCodeUrl:""}),P=l.useRef(0),U=l.useRef(null),Y=l.useRef(0),X=l.useRef(null),V=l.useRef(0),H=l.useRef(null),z=l.useRef(0),I=l.useRef(""),W=l.useRef(null),$=l.useRef(null),M=l.useCallback(()=>{$.current!==null&&(window.clearTimeout($.current),$.current=null)},[]),ee=l.useCallback(async o=>{var O;const x=++P.current;(O=U.current)==null||O.abort();const v=new AbortController;U.current=v,g(!0),A(!1),E(!1),G("");const[Q,_]=await Promise.allSettled([js({signal:v.signal}),ws(o,{signal:v.signal})]);F(x,P.current,o,o)&&(Q.status==="fulfilled"?m(Q.value.data||[]):(m([]),G("通知渠道列表加载失败,请重试")),_.status==="fulfilled"?(h(_.value||[]),A(!0)):(h([]),G("通知绑定加载失败;本次保存不会修改现有绑定")),g(!1))},[]),re=l.useCallback(o=>{h(x=>x.includes(o)?x.filter(v=>v!==o):[...x,o]),E(!0)},[]),C=l.useCallback(async o=>{var _,O;const x=++Y.current;(_=X.current)==null||_.abort();const v=new AbortController;X.current=v,z.current+=1,I.current=o.id,(O=W.current)==null||O.abort(),M(),w({sessionId:"",status:"idle",message:"",qrCodeUrl:""}),s(o),n({remark:o.remark||"",cookie:"",auto_confirm:o.auto_confirm||!1,pause_duration:o.pause_duration||0,username:o.username||"",login_password:"",show_browser:o.show_browser||!1,showLoginPassword:!1,clear_password:!1}),r("edit"),d({loading:!0,saving:!1,canOpen:!1,enabled:!1,error:""});const[,Q]=await Promise.allSettled([ee(o.id),ds(o.id,{signal:v.signal})]);x===Y.current&&(Q.status==="fulfilled"?d({loading:!1,saving:!1,canOpen:Q.value.can_open_long_login,enabled:Q.value.enabled,error:""}):d({loading:!1,saving:!1,canOpen:!1,enabled:!1,error:"无法读取闲鱼保存登录信息状态"}))},[M,ee,r,n,s]),K=l.useCallback(async()=>{if(!t||i.loading||i.saving||!i.canOpen)return;const o=!i.enabled;d(x=>({...x,saving:!0,error:""}));try{const x=await us(t.id,o);d({loading:!1,saving:!1,canOpen:x.can_open_long_login,enabled:x.enabled,error:""})}catch(x){d(v=>({...v,saving:!1,error:x instanceof Error?x.message:"保存登录信息设置失败"}))}},[t,i]),se=l.useCallback(async o=>{var Q;const x=++V.current;(Q=H.current)==null||Q.abort();const v=new AbortController;H.current=v,s(o),r("ai-settings"),N(!0);try{const _=await ps(o.id,{signal:v.signal});if(!F(x,V.current,o.id,o.id))return;S({ai_enabled:_.ai_enabled??!1,max_discount_percent:_.max_discount_percent??10,max_discount_amount:_.max_discount_amount??100,max_bargain_rounds:_.max_bargain_rounds??3,custom_prompts:_.custom_prompts??""})}catch(_){F(x,V.current,o.id,o.id)&&console.error("加载 AI 设置失败:",_)}finally{F(x,V.current,o.id,o.id)&&N(!1)}},[r,s]),ue=l.useCallback(async()=>{if(!(!t||j)){N(!0);try{await fs(t.id,D),r(null),await c()}catch(o){console.error("更新 AI 设置失败:",o)}finally{N(!1)}}},[D,t,c,j,r]),xe=l.useCallback(async()=>{if(!(!t||j)){N(!0);try{const o={};a.remark!==(t.remark||"")&&(o.remark=a.remark),a.cookie&&(o.cookie=a.cookie),a.auto_confirm!==t.auto_confirm&&(o.auto_confirm=a.auto_confirm),Ms(a.pause_duration,t)&&(o.pause_duration=a.pause_duration);const x=Bs(t,a);x&&Object.assign(o,x),$s(u,p)&&(o.channel_ids=f),Object.keys(o).length>0&&await cs(t.id,o),r(null),await c()}catch(o){console.error("更新账号失败:",o)}finally{N(!1)}}},[p,u,a,t,c,f,j,r]),me=l.useCallback(async()=>{if(!(!t||a.pause_duration<=0||j)){N(!0);try{const o=await is(t.id,a.pause_duration);s(x=>x&&{...x,pause_duration:a.pause_duration,paused:(o==null?void 0:o.paused)===!0,paused_until:Number((o==null?void 0:o.paused_until)||0)}),await c()}catch(o){console.error("重新暂停失败:",o)}finally{N(!1)}}},[a.pause_duration,t,c,j,s]),ne=l.useCallback(async(o,x,v)=>{var _;(_=W.current)==null||_.abort();const Q=new AbortController;W.current=Q;try{const O=await ms(o,Q.signal);if(!F(x,z.current,v,I.current))return;const oe={...Gs(O),sessionId:o};if(O.status==="success"){M(),w(oe),n(pe=>({...pe,login_password:"",showLoginPassword:!1})),await c();return}if(O.status==="processing"||O.status==="verification_required"){w(oe),M(),$.current=window.setTimeout(()=>void ne(o,x,v),1500);return}M(),w(oe)}catch(O){if(!F(x,z.current,v,I.current))return;M(),w({sessionId:o,status:"failed",message:O instanceof Error?O.message:"查询密码登录状态失败",qrCodeUrl:""})}},[M,c,n]),be=l.useCallback(async()=>{var Q;if(!t)return;const o=a.username.trim();if(!o||!a.login_password)return;M(),(Q=W.current)==null||Q.abort();const x=++z.current;I.current=t.id;const v=new AbortController;W.current=v,w({sessionId:"",status:"processing",message:"正在启动密码登录…",qrCodeUrl:""});try{const _=await xs({account_id:t.id,account:o,password:a.login_password,show_browser:a.show_browser},{signal:v.signal});if(!F(x,z.current,t.id,I.current))return;if(!_.success||!_.session_id)throw new Error(_.message||"无法启动密码登录");w({sessionId:_.session_id,status:"processing",message:_.message||"登录处理中",qrCodeUrl:""}),await ne(_.session_id,x,t.id)}catch(_){if(!F(x,z.current,t.id,I.current))return;w({sessionId:"",status:"failed",message:_ instanceof Error?_.message:"启动密码登录失败",qrCodeUrl:""})}},[M,a.login_password,a.show_browser,a.username,t,ne]),le=l.useCallback(async()=>{var x;const o=R.sessionId;z.current+=1,I.current="",(x=W.current)==null||x.abort(),M(),o&&await bs(o).catch(()=>{}),w({sessionId:"",status:"idle",message:"",qrCodeUrl:""})},[M,R.sessionId]),he=l.useCallback(async()=>{var o,x,v;(o=U.current)==null||o.abort(),Y.current+=1,(x=X.current)==null||x.abort(),(v=H.current)==null||v.abort(),(R.status==="processing"||R.status==="verification_required")&&await le(),r(null)},[le,R.status,r]),ge=l.useCallback(()=>{var o;V.current+=1,(o=H.current)==null||o.abort(),r(null)},[r]);return l.useEffect(()=>(()=>{var o,x,v,Q;(o=U.current)==null||o.abort(),(x=X.current)==null||x.abort(),(v=H.current)==null||v.abort(),(Q=W.current)==null||Q.abort(),M()}),[M]),{longLogin:i,notifChannels:b,selectedChannelIds:f,bindingsLoaded:u,bindingsLoading:k,bindingsDirty:p,bindingsLoadError:B,aiSettings:D,saving:j,passwordLoginView:R,setAiSettings:S,setBindingsDirty:E,setEditForm:n,openEditModal:C,closeEditModal:he,openAIModal:se,closeAIModal:ge,loadNotificationBindings:ee,toggleNotificationChannel:re,handleLongLoginToggle:K,handleSaveAISettings:ue,handleSaveEdit:xe,handleRestartPause:me,handlePasswordLogin:be,handleCancelPasswordLogin:le}},Js=()=>{const{accounts:t,setAccounts:s,loading:r,loadAccounts:a}=Es(),[n,c]=l.useState(""),[i,d]=l.useState(""),[b,m]=l.useState(""),[f,h]=l.useState(null),[u,A]=l.useState(""),[k,g]=l.useState(null),[p,E]=l.useState(null),[B,G]=l.useState(null),[D,S]=l.useState({remark:"",cookie:"",auto_confirm:!1,pause_duration:0,username:"",login_password:"",show_browser:!1,showLoginPassword:!1,clear_password:!1}),j=Os({editingAccount:p,setEditingAccount:E,setActiveModal:g,editForm:D,setEditForm:S,loadAccounts:a}),{longLogin:N,notifChannels:R,selectedChannelIds:w,bindingsLoaded:P,bindingsLoading:U,bindingsLoadError:Y,aiSettings:X,saving:V,passwordLoginView:H,setAiSettings:z,setBindingsDirty:I,openEditModal:W,closeEditModal:$,openAIModal:M,closeAIModal:ee,loadNotificationBindings:re,toggleNotificationChannel:C,handleLongLoginToggle:K,handleSaveAISettings:se,handleSaveEdit:ue,handleRestartPause:xe,handlePasswordLogin:me,handleCancelPasswordLogin:ne}=j,be=Us({onLoginSuccess:a}),{showQRModal:le,qrCodeUrl:he,qrStatus:ge,qrErrorMessage:o,verificationScreenshot:x,faceQrUrl:v,qrReauthTarget:Q,startQRLogin:_,closeQRModal:O}=be,oe=async(y,q)=>{await ls(y,!q),a()},pe=y=>{b||(A(""),h(y))},Qe=()=>{b||(A(""),h(null))},Ue=async()=>{const y=f;if(!(!y||b)){m(y.id),A("");try{await os(y.id),s(q=>q.filter(te=>te.id!==y.id)),h(null)}catch(q){console.error("删除账号失败:",q),A((q==null?void 0:q.message)||"删除账号失败,请稍后重试")}finally{m("")}}},$e=async y=>{d(y.id);try{const q=await hs(y.id);q!=null&&q.profile_error&&alert("资料刷新失败:"+q.profile_error),await a()}catch(q){console.error("刷新账号资料失败:",q),alert((q==null?void 0:q.message)||"刷新账号资料失败,请先重新授权该账号")}finally{d("")}};if(r)return e.jsx("div",{className:"p-20 flex justify-center",children:e.jsx(J,{className:"w-8 h-8 text-brand animate-spin"})});const fe=t.filter(y=>{const q=n.trim().toLowerCase();return q?[y.id,y.nickname,y.remark,y.username,y.runtime_message].some(te=>(te||"").toLowerCase().includes(q)):!0});return e.jsxs("div",{className:"space-y-8 animate-fade-in relative",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:justify-between xl:items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"账号管理"}),e.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理您的闲鱼授权账号及设置。建议给账号填写备注,便于多账号区分。"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx("input",{value:n,onChange:(y=>c(y.target.value)),placeholder:"搜索昵称 / 备注 / 账号ID",className:"ios-input px-4 py-3 rounded-2xl text-sm w-full sm:w-72"}),e.jsxs("button",{onClick:(()=>_()),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[e.jsx(_e,{className:"w-5 h-5"}),"扫码添加新账号"]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-blue-100 bg-blue-50 px-5 py-4 text-sm text-blue-900 flex flex-col md:flex-row md:items-center md:justify-between gap-2",children:[e.jsxs("div",{className:"font-bold",children:["当前显示 ",fe.length," / ",t.length," 个账号"]}),e.jsx("div",{className:"text-blue-700",children:"如果某个账号只显示 ID,点该账号右侧“刷新资料”;若刷新失败,先点二维码重新授权。"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[fe.map(y=>e.jsx(Rs,{account:y,refreshing:i===y.id,deleting:b===y.id,onRefreshProfile:$e,onReauthorize:_,onEdit:W,onAI:M,onTasks:G,onToggle:oe,onDelete:pe},y.id)),t.length===0&&e.jsxs("div",{className:"ios-card p-12 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Ee,{className:"w-10 h-10 text-gray-400"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:"暂无账号"}),e.jsx("p",{className:"text-gray-500 mt-1",children:"请点击右上角扫码添加您的闲鱼账号"})]}),t.length>0&&fe.length===0&&e.jsxs("div",{className:"ios-card p-12 text-center",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:"没有匹配的账号"}),e.jsx("p",{className:"text-gray-500 mt-1",children:"换一个关键词搜索昵称、备注或账号ID。"})]})]}),B&&ie.createPortal(e.jsx(vs,{account:B,onClose:(()=>G(null)),onSaved:(y=>{s(q=>q.map(te=>te.id===B.id?{...te,auto_rate_enabled:y.auto_rate_enabled,rate_content:y.rate_content,auto_polish_enabled:y.auto_polish_enabled,polish_time:y.polish_time,last_rate_scan_at:y.last_rate_scan_at,last_polish_date:y.last_polish_date,last_polish_at:y.last_polish_at}:te))})}),document.body),f&&e.jsx(As,{account:f,deleting:b===f.id,error:u,onClose:Qe,onConfirm:Ue}),le&&e.jsx(Ts,{target:Q,status:ge,codeUrl:he,errorMessage:o,faceQrUrl:v,verificationScreenshot:x,onClose:O}),k==="edit"&&p&&e.jsx(Ps,{account:p,editForm:D,setEditForm:S,saving:V,onClose:$,onSave:ue,onRestartPause:xe,longLogin:N,onToggleLongLogin:K,passwordLoginView:H,onPasswordLogin:me,onCancelPasswordLogin:ne,notifChannels:R,selectedChannelIds:w,bindingsLoaded:P,bindingsLoading:U,bindingsLoadError:Y,onRetryBindings:(()=>re(p.id)),onToggleChannel:C,onSettingsDirty:(()=>I(!0))}),k==="ai-settings"&&p&&e.jsx(_s,{account:p,settings:X,saving:V,onChange:z,onClose:ee,onSave:se})]})};export{Js as default};
|