karin-plugin-adapter-all 0.0.0-stage → 1.2.2
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.
- package/LICENSE +21 -0
- package/README.md +106 -2
- package/dist/config-BB-E59pC.js +73 -0
- package/dist/dir.js +49 -0
- package/dist/icqq-BR8miqDV.js +1771 -0
- package/dist/index.js +10 -0
- package/dist/server.js +13577 -0
- package/dist/web.config.js +36 -0
- package/package.json +71 -4
- package/resources/image//345/220/257/347/250/213/345/256/243/345/217/221.png +0 -0
- package/resources/reactions.json +50 -0
- package/resources/template/test.html +21 -0
- package/resources/web/404/index.html +1 -0
- package/resources/web/404.html +1 -0
- package/resources/web/_next/static/chunks/2592325e-57fbed9f64536727.js +1 -0
- package/resources/web/_next/static/chunks/634-7552fa79f7816d81.js +1 -0
- package/resources/web/_next/static/chunks/778-0a7f658317254539.js +1 -0
- package/resources/web/_next/static/chunks/78-98f9c6d536c55c8d.js +1 -0
- package/resources/web/_next/static/chunks/app/_not-found/page-479700a6cdca1b89.js +1 -0
- package/resources/web/_next/static/chunks/app/layout-2fcd97f6eeeb705f.js +1 -0
- package/resources/web/_next/static/chunks/app/not-found-479700a6cdca1b89.js +1 -0
- package/resources/web/_next/static/chunks/app/page-32d138e107d21bbf.js +1 -0
- package/resources/web/_next/static/chunks/framework-939e80bc3ec79f24.js +1 -0
- package/resources/web/_next/static/chunks/main-app-9148086af618c8de.js +1 -0
- package/resources/web/_next/static/chunks/main-bff001951bd96286.js +1 -0
- package/resources/web/_next/static/chunks/pages/_app-04ed26170c78d2cb.js +1 -0
- package/resources/web/_next/static/chunks/pages/_error-2a3f5266a349ca5b.js +1 -0
- package/resources/web/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/resources/web/_next/static/chunks/webpack-eb9f7b784f442cad.js +1 -0
- package/resources/web/_next/static/css/5ca80a6ff000abd3.css +1 -0
- package/resources/web/_next/static/mDmGoxfU3tdu5Q8jddnw7/_buildManifest.js +1 -0
- package/resources/web/_next/static/mDmGoxfU3tdu5Q8jddnw7/_ssgManifest.js +1 -0
- package/resources/web/index.html +1 -0
- package/resources/web/index.txt +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{450:(e,t,a)=>{Promise.resolve().then(a.bind(a,7262))},7262:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>ta});var s=a(2544),r=a(1708),l=a(7560),n=a(6048),o=a(1205),i=a(363),c=a(4559),d=a(6975),u=a(7336),m=a(5780),x=a(9829);let h=["onebot11","onebot12","icqq","milky","kook","qqbot","douyin","wxoc"],p=["snowluma","napcat","lagrange","std"],g=["ws","ws-reverse","http","sse"],f=["ws","sse","webhook"],b="adapter-all-auth",v="adapter-all:unauthorized",j=()=>{var e;let t=localStorage.getItem(b);return t||(k?"":null!=(e=localStorage.getItem("accessToken"))?e:"")},k=!1,w=()=>{let e=j();return e?{Authorization:"Bearer ".concat(e)}:{}},N=()=>{localStorage.removeItem(b),k=!0,window.dispatchEvent(new Event(v))},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Accept:"application/json",...e,...w()}},q=async e=>{var t;let a=await fetch("".concat("/adapter-all/api/config","/login"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(e.trim())},body:JSON.stringify({authorization:"Bearer ".concat(e.trim())})}),s=await a.json().catch(()=>({})),r=null!=(t=null==s?void 0:s.message)?t:a.ok?"登录成功":"token 错误";return{success:a.ok&&(null==s?void 0:s.code)!==500,message:r}},S=async()=>{var e;let t=await fetch("/adapter-all/api/config",{headers:y()});if(401===t.status)throw N(),Error("未登录或登录已失效");if(!t.ok)throw Error("加载配置失败: HTTP ".concat(t.status));let a=await t.json();return null!=(e=null==a?void 0:a.data)?e:{}},C=async e=>{var t;let a=await fetch("/adapter-all/api/config",{method:"POST",headers:{"Content-Type":"application/json",...w()},body:JSON.stringify(e)});if(401===a.status)return N(),{success:!1,message:"未登录或登录已失效"};let s=await a.json().catch(()=>({})),r=null!=(t=null==s?void 0:s.message)?t:a.ok?"保存成功":"HTTP ".concat(a.status);return{success:a.ok&&(null==s?void 0:s.code)!==500,message:r}},T=async()=>{var e;let t=await fetch("".concat("/adapter-all/api/config","/icqq/status"),{headers:y()});if(401===t.status)return N(),!1;let a=await t.json().catch(()=>null);return!!(null==a||null==(e=a.data)?void 0:e.available)},A=async(e,t)=>{var a;let s=new URLSearchParams({addr:e.trim()});(null==t?void 0:t.trim())&&s.set("uin",t.trim());let r=await fetch("".concat("/adapter-all/api/config","/sign/ver?").concat(s),{headers:y()});if(401===r.status)throw N(),Error("未登录或登录已失效");let l=await r.json().catch(()=>null);if(!r.ok){let e=(null==l?void 0:l.message)||(null==l?void 0:l.error)||"HTTP ".concat(r.status);throw Error("获取版本失败: ".concat(e))}if((null==l?void 0:l.code)!==0&&(null==l?void 0:l.code)!==200||!(null==l?void 0:l.data))throw Error((null==l?void 0:l.message)||"签名服务返回异常");let n=null!=(a=l.data.ver)?a:[];if(!n.length)throw Error("签名服务未返回可用的 ver 列表");return{ver:n}},I=async(e,t)=>{let a=await fetch("/adapter-all/api".concat(e),{method:"POST",headers:{"Content-Type":"application/json",...w()},body:JSON.stringify(null!=t?t:{})});if(401===a.status)return N(),{success:!1,message:"未登录或登录已失效"};let s=await a.json().catch(()=>null);return s?{success:a.ok&&500!==s.code,data:s.data,message:s.message||(a.ok?"":"接口异常 (HTTP ".concat(a.status,")"))}:{success:!1,message:"接口响应异常 (HTTP ".concat(a.status,")")}},E=e=>{var t,a,s,r,l,n,o,i,c,d,u,m,x,h,p,g,f,b,v,j,k,w,N,y,q,S,C;return{enable:(null==e?void 0:e.enable)!==!1,protocol:null!=(t=null==e?void 0:e.protocol)?t:"onebot11",impl:null!=(a=null==e?void 0:e.impl)?a:"snowluma",communication:null!=(s=null==e?void 0:e.communication)?s:"ws",url:null!=(r=null==e?void 0:e.url)?r:"",eventUrl:null!=(l=null==e?void 0:e.eventUrl)?l:"",eventMode:null!=(n=null==e?void 0:e.eventMode)?n:"ws",accessToken:null!=(o=null==e?void 0:e.accessToken)?o:"",reconnect:(null==e?void 0:e.reconnect)!==!1,heartbeatInterval:(null==e?void 0:e.heartbeatInterval)?String(e.heartbeatInterval):"",requestTimeout:(null==e?void 0:e.requestTimeout)?String(e.requestTimeout):"",uin:(null==e?void 0:e.uin)!==void 0?String(e.uin):"",password:null!=(i=null==e?void 0:e.password)?i:"",loginType:null!=(c=null==e?void 0:e.loginType)?c:"fast",platform:(null==e?void 0:e.platform)!==void 0?String(e.platform):"",ver:null!=(d=null==e?void 0:e.ver)?d:"",signApiAddr:null!=(u=null==e?void 0:e.sign_api_addr)?u:"",sliderMode:null!=(m=null==e?void 0:e.sliderMode)?m:"gt",kookToken:null!=(x=null==e?void 0:e.kookToken)?x:"",kookEventMode:null!=(h=null==e?void 0:e.kookEventMode)?h:"ws",kookWebhookUrl:null!=(p=null==e?void 0:e.kookWebhookUrl)?p:"",qqbotAppId:null!=(g=null==e?void 0:e.qqbotAppId)?g:"",qqbotClientSecret:null!=(f=null==e?void 0:e.qqbotClientSecret)?f:"",qqbotEventMode:null!=(b=null==e?void 0:e.qqbotEventMode)?b:"ws",qqbotWebhookUrl:null!=(v=null==e?void 0:e.qqbotWebhookUrl)?v:"",douyinUid:null!=(j=null==e?void 0:e.douyinUid)?j:"",douyinName:null!=(k=null==e?void 0:e.douyinName)?k:"",wxocToken:null!=(w=null==e?void 0:e.wxocToken)?w:"",wxocAccountId:null!=(N=null==e?void 0:e.wxocAccountId)?N:"",wxocUserId:null!=(y=null==e?void 0:e.wxocUserId)?y:"",wxocNickname:null!=(q=null==e?void 0:e.wxocNickname)?q:"",wxocBaseUrl:null!=(S=null==e?void 0:e.wxocBaseUrl)?S:"",msgReplaceEnable:(null==e?void 0:e.msgReplaceEnable)!==!1,msgReplace:e?(null!=(C=e.msgReplace)?C:[]).map(e=>"".concat(e.match," ").concat(e.to)).join("\n"):"^\\s*/ #"}},z=e=>{let t=[];for(let a of e.split("\n")){let e=a.trim();if(!e)continue;let s=e.search(/\s/);t.push(-1===s?{match:e,to:""}:{match:e.slice(0,s).trim(),to:e.slice(s).trim()})}return t.length?t:void 0},U=e=>{if(!h.includes(e.protocol))return;let t=e.url.trim(),a="icqq"===e.protocol;if(!a&&"kook"!==e.protocol&&"qqbot"!==e.protocol&&"douyin"!==e.protocol&&"wxoc"!==e.protocol&&!t)return;let s={enable:e.enable,protocol:e.protocol,url:t};if(a){let t=Number(e.uin.trim());e.uin.trim()&&Number.isFinite(t)&&(s.uin=t),e.password&&(s.password=e.password),("password"===e.loginType||"qrcode"===e.loginType||"fast"===e.loginType)&&(s.loginType=e.loginType);let a=Number(e.platform.trim());if(e.platform.trim()&&Number.isFinite(a)&&(s.platform=a),e.ver.trim()&&(s.ver=e.ver.trim()),e.signApiAddr.trim()&&(s.sign_api_addr=e.signApiAddr.trim()),("gt"===e.sliderMode||"txhelper"===e.sliderMode||"manual"===e.sliderMode)&&(s.sliderMode=e.sliderMode),void 0===s.uin&&!s.password&&"qrcode"!==s.loginType)return;return delete s.url,s}if("onebot11"===e.protocol&&p.includes(e.impl)&&(s.impl=e.impl),"onebot11"===e.protocol){var r,l;if(g.includes(e.communication)){let t=e.communication;"ws"!==t&&(s.communication=t)}if((null!=(r=s.communication)?r:"ws")==="http"||(null!=(l=s.communication)?l:"ws")==="sse"){let t=e.eventUrl.trim();t&&(s.eventUrl=t)}}if("milky"===e.protocol&&(("sse"===e.eventMode||"webhook"===e.eventMode)&&(s.eventMode=e.eventMode),"webhook"===e.eventMode)){let t=e.eventUrl.trim();t&&(s.eventUrl=t)}if("kook"===e.protocol){if(!e.kookToken.trim())return;if(s.kookToken=e.kookToken.trim(),"webhook"===e.kookEventMode){if(!e.kookWebhookUrl.trim())return;s.kookEventMode="webhook",s.kookWebhookUrl=e.kookWebhookUrl.trim()}let t=z(e.msgReplace);return t&&(s.msgReplace=t),!1===e.msgReplaceEnable&&(s.msgReplaceEnable=!1),delete s.url,s}if("qqbot"===e.protocol){let t=e.qqbotAppId.trim(),a=e.qqbotClientSecret.trim();if(!t||!a)return;if(s.qqbotAppId=t,s.qqbotClientSecret=a,"webhook"===e.qqbotEventMode){if(!e.qqbotWebhookUrl.trim())return;s.qqbotEventMode="webhook",s.qqbotWebhookUrl=e.qqbotWebhookUrl.trim()}let r=z(e.msgReplace);return r&&(s.msgReplace=r),!1===e.msgReplaceEnable&&(s.msgReplaceEnable=!1),delete s.url,s}if("douyin"===e.protocol){let t=e.douyinUid.trim();if(!t)return;s.douyinUid=t,e.douyinName.trim()&&(s.douyinName=e.douyinName.trim());let a=z(e.msgReplace);return a&&(s.msgReplace=a),!1===e.msgReplaceEnable&&(s.msgReplaceEnable=!1),delete s.url,s}if("wxoc"===e.protocol){let t=e.wxocToken.trim(),a=e.wxocAccountId.trim();if(!t||!a)return;s.wxocToken=t,s.wxocAccountId=a,e.wxocUserId.trim()&&(s.wxocUserId=e.wxocUserId.trim()),e.wxocNickname.trim()&&(s.wxocNickname=e.wxocNickname.trim()),e.wxocBaseUrl.trim()&&(s.wxocBaseUrl=e.wxocBaseUrl.trim());let r=z(e.msgReplace);return r&&(s.msgReplace=r),!1===e.msgReplaceEnable&&(s.msgReplaceEnable=!1),delete s.url,s}e.accessToken.trim()&&(s.accessToken=e.accessToken.trim()),!0!==e.reconnect&&(s.reconnect=!1);let n=Number(e.heartbeatInterval),o=Number(e.requestTimeout);return Number.isFinite(n)&&n>0&&(s.heartbeatInterval=n),Number.isFinite(o)&&o>0&&(s.requestTimeout=o),s};var R=a(8719),M=a(1529);let F={onebot11:"OneBot 11",onebot12:"OneBot 12",icqq:"ICQQ",milky:"Milky",kook:"Kook",qqbot:"QQBot",douyin:"抖音",wxoc:"微信 Claw"},P={snowluma:"SnowLuma",napcat:"NapCat",lagrange:"Lagrange",std:"OneBot11"},Q={http:"HTTP POST",ws:"正向 WebSocket","ws-reverse":"反向 WebSocket",sse:"HTTP SSE"};var W=a(2160),O=a(3797),B=a(9917),D=a(7564);function _(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,D.QP)((0,B.$)(t))}let H=(0,O.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function L(e){let{className:t,variant:a,size:r,asChild:l=!1,...n}=e,o=l?W.DX:"button";return(0,s.jsx)(o,{"data-slot":"button",className:_(H({variant:a,size:r,className:t})),...n})}function K(e){let{className:t,type:a,...r}=e;return(0,s.jsx)("input",{type:a,"data-slot":"input",className:_("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 aria-invalid:border-destructive",t),...r})}var J=a(1860);function V(e){let{className:t,...a}=e;return(0,s.jsx)(J.b,{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}var G=a(7198);let Y=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(G.bL,{className:_("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...r,ref:t,children:(0,s.jsx)(G.zi,{className:_("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});Y.displayName=G.bL.displayName;var Z=a(4425);let X=R.bL,$=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(R.q7,{ref:t,className:_("border-b",a),...r})});$.displayName="AccordionItem",r.forwardRef((e,t)=>{let{className:a,children:r,...l}=e;return(0,s.jsx)(R.Y9,{className:"flex",children:(0,s.jsxs)(R.l9,{ref:t,className:_("flex flex-1 items-center justify-between gap-3 py-3 text-sm font-medium transition-all [&[data-state=open]>svg]:rotate-180",a),...l,children:[r,(0,s.jsx)(Z.A,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})})}).displayName=R.l9.displayName;let ee=r.forwardRef((e,t)=>{let{className:a,children:r,...l}=e;return(0,s.jsx)(R.UC,{ref:t,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...l,children:(0,s.jsx)("div",{className:_("pb-4 pt-0",a),children:r})})});ee.displayName=R.UC.displayName;var et=a(3651),ea=a(3037),es=a(8139);let er=(0,O.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function el(e){let{className:t,variant:a,asChild:r=!1,...l}=e,n=r?W.DX:"span";return(0,s.jsx)(n,{"data-slot":"badge",className:_(er({variant:a}),t),...l})}let en=new Map,eo=new Set,ei=null,ec=!1,ed={idle:{label:"空闲",className:"bg-muted text-muted-foreground"},slider:{label:"待滑动验证",className:"bg-amber-500/15 text-amber-600 dark:text-amber-400"},auth:{label:"待登录验证",className:"bg-amber-500/15 text-amber-600 dark:text-amber-400"},device:{label:"设备锁验证",className:"bg-amber-500/15 text-amber-600 dark:text-amber-400"},submitting:{label:"验证通过, 正在登录...",className:"bg-sky-500/15 text-sky-600 dark:text-sky-400"},relogin:{label:"验证通过, 重新登录中",className:"bg-sky-500/15 text-sky-600 dark:text-sky-400"},online:{label:"已登录",className:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400"},failed:{label:"登录失败",className:"bg-red-500/15 text-red-600 dark:text-red-400"}};function eu(e){var t;let a,{uin:l}=e,n=(e=>{let t=String(null!=e?e:"").trim();(0,r.useEffect)(()=>{t&&(()=>{if(!ec){ec=!0;try{ei=new EventSource("/adapter-all/api/login/events?token=".concat(encodeURIComponent(j())))}catch(e){return}ei.onmessage=e=>{try{var t=JSON.parse(e.data);if((null==t?void 0:t.snapshot)&&Array.isArray(t.states))for(let e of(en.clear(),t.states))en.set(String(e.uin),e);else(null==t?void 0:t.removed)?en.delete(String(t.removed)):(null==t?void 0:t.state)&&en.set(String(t.state.uin),t.state);for(let e of[...eo])e()}catch(e){}}}})()},[t]);let a=(0,r.useCallback)(e=>(eo.add(e),()=>{eo.delete(e)}),[]);return(0,r.useSyncExternalStore)(a,()=>{let t;return t=e,en.get(String(null!=t?t:"").trim())})})(l),[i,c]=(0,r.useState)(!1),[d,u]=(0,r.useState)(""),[m,x]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),g=async e=>{if(n){x(e),p(null);try{var t,a;let s=await fetch("".concat("/adapter-all/api/login","/sms"),{method:"POST",headers:{"Content-Type":"application/json",...w()},body:JSON.stringify({uin:n.uin,action:e,code:"submit"===e?d:void 0})}),r=await s.json().catch(()=>({}));if(!s.ok||(null==r?void 0:r.code)===500)throw Error(null!=(t=null==r?void 0:r.message)?t:"HTTP ".concat(s.status));p(null!=(a=null==r?void 0:r.message)?a:"send"===e?"验证码已发送":"submit"===e?"验证码已提交":"已触发重新登录"),"submit"===e&&u("")}catch(e){p(e instanceof Error?e.message:String(e))}finally{x(null)}}};if(!String(null!=l?l:"").trim()||!n||0===n.events.length)return null;let f=null!=(t=ed[n.phase])?t:ed.idle,b=[...n.events].reverse().slice(0,6);return(0,s.jsxs)("div",{className:"space-y-2 rounded-lg border bg-muted/30 p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(el,{variant:"outline",className:_("text-xs",f.className),children:f.label}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"登录验证"})]}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:n.url&&("slider"===n.phase||"auth"===n.phase)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(L,{size:"sm",variant:i?"outline":"default",className:"gap-1.5",onClick:()=>c(e=>!e),children:i?"收起":"内嵌显示"}),(0,s.jsxs)(L,{size:"sm",variant:"outline",className:"gap-1.5",onClick:()=>window.open(n.url,"_blank","noopener,noreferrer"),children:[(0,s.jsx)(o.A,{className:"size-3.5"}),"新窗口打开"]})]})})]}),n.url&&i&&("slider"===n.phase||"auth"===n.phase)&&(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("div",{className:"overflow-hidden rounded-md border bg-background",children:(0,s.jsx)("iframe",{src:n.url,title:"登录验证链接 (".concat(n.uin,")"),className:"h-96 w-full"},n.url)}),(0,s.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground/70",children:"若内嵌页面显示空白或「拒绝连接」,说明该验证站点禁止内嵌,请点击「新窗口打开」完成验证。"})]}),"device"===n.phase&&(0,s.jsxs)("div",{className:"space-y-2 rounded-md border bg-background/60 p-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-foreground/85",children:[(0,s.jsx)(et.A,{className:"size-3.5 text-amber-500"}),"设备锁验证 \xb7 新设备保护"]}),n.phone?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-xs leading-relaxed text-muted-foreground/70",children:["密保手机 ",(0,s.jsx)("span",{className:"font-medium text-foreground/80",children:(a=n.phone,/^\d{11}$/.test(a)?"".concat(a.slice(0,3),"****").concat(a.slice(7)):a)}),": 可直接发送/提交短信验证码, 无需打开网页。"]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)(L,{size:"sm",variant:"outline",disabled:null!==m,onClick:()=>g("send"),children:[(0,s.jsx)(ea.A,{className:"size-3.5"}),"send"===m?"发送中...":"发送验证码"]}),(0,s.jsx)(K,{value:d,onChange:e=>u(e.target.value),placeholder:"6 位验证码",inputMode:"numeric",maxLength:6,className:"w-32",disabled:null!==m}),(0,s.jsx)(L,{size:"sm",disabled:!d.trim()||null!==m,onClick:()=>g("submit"),children:"submit"===m?"提交中...":"提交验证码"})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground/70",children:"无可用密保手机号, 请使用绑定的手机 QQ 扫码或确认完成:"}),n.url&&(0,s.jsxs)("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex max-w-full items-start gap-1.5 break-all text-xs leading-relaxed text-sky-600 underline underline-offset-2 hover:text-sky-500 dark:text-sky-400",children:[(0,s.jsx)(o.A,{className:"mt-px size-3.5 shrink-0"}),(0,s.jsx)("span",{className:"min-w-0",children:n.url})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[(0,s.jsxs)(L,{size:"sm",variant:"outline",disabled:null!==m,onClick:()=>g("retry"),children:[(0,s.jsx)(es.A,{className:_("size-3.5","retry"===m&&"animate-spin")}),"retry"===m?"重新登录中...":"我已验证完成, 继续登录"]}),h&&(0,s.jsx)("span",{className:_("text-xs",/失败|错误/.test(h)?"text-red-500":"text-muted-foreground"),children:h})]})]}),(0,s.jsx)("ul",{className:"space-y-1",children:b.map((e,t)=>(0,s.jsxs)("li",{className:"flex items-baseline gap-2 text-xs leading-relaxed",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground/60",children:new Date(e.time).toLocaleTimeString("zh-CN",{hour12:!1})}),(0,s.jsx)("span",{className:"text-foreground/85",children:e.title}),e.message&&(0,s.jsx)("span",{className:"min-w-0 truncate text-muted-foreground",children:e.message})]},"".concat(e.time,"-").concat(t)))})]})}var em=a(7706),ex=a(5369),eh=a(8584),ep=a(3221);function eg(e){let{...t}=e;return(0,s.jsx)(ep.bL,{"data-slot":"alert-dialog",...t})}function ef(e){let{...t}=e;return(0,s.jsx)(ep.l9,{"data-slot":"alert-dialog-trigger",...t})}function eb(e){let{...t}=e;return(0,s.jsx)(ep.ZL,{"data-slot":"alert-dialog-portal",...t})}function ev(e){let{className:t,...a}=e;return(0,s.jsx)(ep.hJ,{"data-slot":"alert-dialog-overlay",className:_("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ej(e){let{className:t,...a}=e;return(0,s.jsxs)(eb,{children:[(0,s.jsx)(ev,{}),(0,s.jsx)(ep.UC,{"data-slot":"alert-dialog-content",className:_("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...a})]})}function ek(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"alert-dialog-header",className:_("flex flex-col gap-2 text-center sm:text-left",t),...a})}function ew(e){let{className:t,...a}=e;return(0,s.jsx)("div",{"data-slot":"alert-dialog-footer",className:_("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function eN(e){let{className:t,...a}=e;return(0,s.jsx)(ep.hE,{"data-slot":"alert-dialog-title",className:_("text-lg font-semibold",t),...a})}function ey(e){let{className:t,...a}=e;return(0,s.jsx)(ep.VY,{"data-slot":"alert-dialog-description",className:_("text-muted-foreground text-sm",t),...a})}function eq(e){let{className:t,...a}=e;return(0,s.jsx)(ep.rc,{className:_(H(),t),...a})}function eS(e){let{className:t,...a}=e;return(0,s.jsx)(ep.ZD,{className:_(H({variant:"outline"}),t),...a})}let eC="/adapter-all/api/qqbot/qr";function eT(e){let{onBound:t}=e,[a,l]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),[i,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(""),m=(0,r.useRef)(""),[x,h]=(0,r.useState)("idle"),p=(0,r.useRef)(null),g=(0,r.useRef)(t);g.current=t;let f=(0,r.useCallback)(()=>{p.current&&(clearInterval(p.current),p.current=null)},[]),b=async e=>{try{var t,a,s,r;let l=await fetch("".concat(eC,"/status"),{method:"POST",headers:{"Content-Type":"application/json",...w()},body:JSON.stringify({sid:e})}),n=await l.json().catch(()=>({}));if(!l.ok||(null==n?void 0:n.code)===500)throw Error(null!=(t=null==n?void 0:n.message)?t:"HTTP ".concat(l.status));let o=null!=(a=null==n?void 0:n.data)?a:{};if("scanned"===o.phase){f();let e=String(null!=(s=o.appId)?s:"");g.current({appId:e,appSecret:String(null!=(r=o.appSecret)?r:""),userOpenid:o.userOpenid}),h("connecting"),p.current=setInterval(()=>{v(e)},2e3)}else"expired"===o.phase&&(f(),h("expired"))}catch(e){f(),c(e instanceof Error?e.message:String(e))}},v=async e=>{try{var t,a;let s=await fetch("".concat(eC,"/connected?appId=").concat(encodeURIComponent(e)),{headers:w()}),r=await s.json().catch(()=>({}));if(!s.ok||(null==r?void 0:r.code)===500)throw Error(null!=(a=null==r?void 0:r.message)?a:"HTTP ".concat(s.status));(null==r||null==(t=r.data)?void 0:t.connected)&&(f(),h("online"))}catch(e){f(),c(e instanceof Error?e.message:String(e))}},j=async()=>{f(),o(!0),c(""),h("idle"),u("");try{var e,t;let a=await fetch("".concat(eC,"/start"),{method:"POST",headers:w()}),s=await a.json().catch(()=>({}));if(!a.ok||(null==s?void 0:s.code)===500)throw Error(null!=(e=null==s?void 0:s.message)?e:"HTTP ".concat(a.status));let r=null!=(t=null==s?void 0:s.data)?t:{};if(!r.id||!r.image)throw Error("扫码任务创建失败: 响应缺少二维码");m.current=String(r.id),u(String(r.image)),h("pending"),p.current=setInterval(()=>{b(String(r.id))},2e3)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},k=(0,r.useCallback)(()=>{f(),m.current&&(fetch("".concat(eC,"/cancel"),{method:"POST",headers:{"Content-Type":"application/json",...w()},body:JSON.stringify({sid:m.current})}).catch(()=>{}),m.current=""),l(!1)},[f]);return(0,r.useEffect)(()=>{!a||d||n||"idle"!==x||j()},[a]),(0,r.useEffect)(()=>()=>f(),[f]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(L,{variant:"ghost",size:"sm",className:"px-2 text-muted-foreground hover:text-foreground",title:"扫码绑定 (自动获取 AppID / AppSecret)",onClick:()=>l(!0),children:(0,s.jsx)(em.A,{className:"size-4"})}),(0,s.jsx)(eg,{open:a,onOpenChange:e=>{e||k()},children:(0,s.jsxs)(ej,{className:"sm:max-w-sm",children:[(0,s.jsxs)(ek,{children:[(0,s.jsxs)(eN,{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)(em.A,{className:"size-4 text-muted-foreground"}),"扫码绑定 QQ 机器人"]}),(0,s.jsx)(ey,{className:"text-center",children:"无需手动填写凭证,手机 QQ 扫码后自动获取 AppID / AppSecret 并回填表单"})]}),(0,s.jsxs)("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 rounded-lg border bg-muted/30 p-4",children:[(!d||"idle"===x)&&!i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"size-56 animate-pulse rounded-md bg-muted"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"正在生成二维码...":""})]}),d&&"pending"===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("img",{src:d,alt:"QQBot 扫码绑定二维码",className:"size-56 rounded-md border bg-background p-2"}),(0,s.jsx)("span",{className:"absolute inset-x-6 -bottom-2.5 mx-auto w-fit",children:(0,s.jsx)(el,{className:"animate-pulse bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"等待扫码"})})]}),(0,s.jsx)("p",{className:"mt-2 text-center text-xs leading-relaxed text-muted-foreground",children:"请使用手机 QQ「扫一扫」扫码并确认绑定"})]}),"connecting"===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.A,{className:"size-10 animate-spin text-muted-foreground"}),(0,s.jsx)(el,{className:"bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"正在连接机器人"}),(0,s.jsx)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:"凭证已自动保存并回填,等待机器人连接成功"})]}),"online"===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eh.A,{className:"size-14 text-emerald-500"}),(0,s.jsx)(el,{className:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",children:"登录成功"}),(0,s.jsx)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:"机器人已连接,可以开始使用了。"})]}),"expired"===x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(el,{variant:"outline",className:"text-red-600 dark:text-red-400",children:"二维码已过期"}),(0,s.jsxs)(L,{size:"sm",className:"gap-1.5",onClick:j,disabled:n,children:[(0,s.jsx)(es.A,{className:"size-3.5"})," 重新生成"]})]}),i&&(0,s.jsx)("p",{className:"text-xs leading-relaxed text-red-500",children:i})]}),(0,s.jsx)(ew,{className:"sm:justify-center",children:(0,s.jsx)(eS,{onClick:k,children:"online"===x?"完成":"取消"})})]})})]})}function eA(e){let{onBound:t}=e,[a,l]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),[i,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(""),[m,x]=(0,r.useState)(""),[h,p]=(0,r.useState)(""),[g,f]=(0,r.useState)("idle"),[b,v]=(0,r.useState)(""),[j,k]=(0,r.useState)(""),[N,y]=(0,r.useState)([]),[q,S]=(0,r.useState)(""),[C,T]=(0,r.useState)(""),A=(0,r.useRef)(""),E=(0,r.useRef)(null),z=(0,r.useRef)(t);z.current=t;let U=(0,r.useCallback)(()=>{E.current&&(clearInterval(E.current),E.current=null)},[]),R=(0,r.useCallback)(()=>{U(),A.current&&(I("/douyin/login/cancel",{sid:A.current}).catch(()=>{}),A.current=""),l(!1)},[U]),M=async e=>{try{var t,a,s,r,l,n,o;let i=await I("/douyin/login/status",{sid:e});if(!i.success)throw Error(null!=(t=i.message)?t:"登录状态查询失败");let d=i.data;if(!d)return;if(f(d.phase),d.image&&u(d.image),d.statusText&&x(d.statusText),d.mfaKind&&v(d.mfaKind),d.maskedMobile&&k(d.maskedMobile),y(null!=(a=d.ways)?a:[]),S(null!=(s=d.verifyUrl)?s:""),d.error&&c(d.error),"success"===d.phase){U(),A.current="",p(null!=(r=d.name)?r:""),z.current({uid:String(null!=(l=d.uid)?l:""),name:String(null!=(n=d.name)?n:"")});let e=String(null!=(o=d.uid)?o:"");f("connecting"),E.current=setInterval(()=>{F(e)},2e3)}else"expired"===d.phase&&U()}catch(e){U(),c(e instanceof Error?e.message:String(e))}},F=async e=>{try{var t,a;let s=await fetch("/adapter-all/api/douyin/login/connected?uid=".concat(encodeURIComponent(e)),{headers:w()}),r=await s.json().catch(()=>({}));if(!s.ok||(null==r?void 0:r.code)===500)throw Error(null!=(a=null==r?void 0:r.message)?a:"HTTP ".concat(s.status));(null==r||null==(t=r.data)?void 0:t.connected)&&(U(),f("online"),setTimeout(R,1200))}catch(e){U(),c(e instanceof Error?e.message:String(e))}},P=async()=>{U(),o(!0),c(""),p(""),f("idle"),u(""),x(""),v(""),k(""),y([]),S(""),T("");try{var e,t;let a=await I("/douyin/login/start");if(!a.success||!(null==(e=a.data)?void 0:e.id))throw Error(null!=(t=a.message)?t:"登录任务创建失败");A.current=a.data.id,f("pending"),E.current=setInterval(()=>{M(A.current)},2e3)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},Q=async()=>{let e=C.trim();if(e&&A.current&&!n){o(!0),c("");try{var t;let a,s=await (a=A.current,I("/douyin/login/mfa",{sid:a,code:e}));s.success?T(""):c(null!=(t=s.message)?t:"验证失败 请重试")}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}},W=async e=>{if(A.current&&!n){o(!0),c("");try{var t;let a,s=await (a=A.current,I("/douyin/login/mfa",{sid:a,way:e}));s.success||c(null!=(t=s.message)?t:"选择失败 请重试")}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}};return(0,r.useEffect)(()=>{a&&P()},[a]),(0,r.useEffect)(()=>()=>U(),[U]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(L,{variant:"ghost",size:"sm",className:"px-2 text-muted-foreground hover:text-foreground",title:"扫码登录 (自动获取抖音 UID)",onClick:()=>l(!0),children:(0,s.jsx)(em.A,{className:"size-4"})}),(0,s.jsx)(eg,{open:a,onOpenChange:e=>{e||R()},children:(0,s.jsxs)(ej,{className:"sm:max-w-sm",children:[(0,s.jsxs)(ek,{children:[(0,s.jsxs)(eN,{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)(em.A,{className:"size-4 text-muted-foreground"}),"扫码登录抖音"]}),(0,s.jsx)(ey,{className:"text-center",children:"使用抖音 App 扫码确认登录,成功后自动回填 UID 与昵称"})]}),(0,s.jsxs)("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 rounded-lg border bg-muted/30 p-4",children:[("idle"===g||"pending"===g&&!d)&&!i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"size-56 animate-pulse rounded-md bg-muted"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"正在获取二维码...":m||"正在获取二维码..."})]}),"pending"===g&&d&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("img",{src:d,alt:"抖音扫码登录二维码",className:"size-56 rounded-md border bg-background p-2"}),(0,s.jsx)("span",{className:"absolute inset-x-6 -bottom-2.5 mx-auto w-fit",children:(0,s.jsx)(el,{className:"animate-pulse bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"等待扫码"})})]}),(0,s.jsx)("p",{className:"mt-2 text-center text-xs leading-relaxed text-muted-foreground",children:"请使用抖音 App「扫一扫」扫码并确认登录"})]}),"scanned"===g&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.A,{className:"size-10 animate-spin text-muted-foreground"}),(0,s.jsx)(el,{className:"bg-amber-500/15 text-amber-600 dark:text-amber-400",children:m||"已扫码"})]}),"verifying"===g&&q&&(0,s.jsxs)("div",{className:"flex w-full flex-col items-center gap-2",children:[(0,s.jsx)(el,{className:"bg-amber-500/15 text-amber-600 dark:text-amber-400",children:m||"需要安全验证"}),(0,s.jsx)("iframe",{src:q,title:"抖音安全验证",className:"h-80 w-full max-w-sm rounded-lg border bg-white"}),(0,s.jsxs)("p",{className:"text-center text-xs text-muted-foreground",children:["在上方完成安全验证(可选可用验证方式),通过后自动继续; 如未展示请",(0,s.jsx)("a",{href:q,target:"_blank",rel:"noreferrer",className:"text-red-500 underline",children:"新窗口打开"})]})]}),"verifying"===g&&!q&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.A,{className:"size-10 animate-spin text-muted-foreground"}),(0,s.jsx)(el,{className:"bg-amber-500/15 text-amber-600 dark:text-amber-400",children:m||"验证中"})]}),"mfa"===g&&N.length>0&&(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,s.jsx)(el,{className:"mx-auto bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"请选择验证方式"}),N.map(e=>(0,s.jsx)(L,{variant:"outline",size:"sm",disabled:n,onClick:()=>void W(e.way),children:e.smsContent||(e.mobile?"短信验证 (".concat(e.mobile,")"):e.way)},e.way||e.mobile))]}),"mfa"===g&&0===N.length&&(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,s.jsx)(el,{className:"mx-auto bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"需要验证"}),(0,s.jsx)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:"password"===b?"需要密码验证 请输入抖音账号密码":j?"验证码已发送至 ".concat(j):"请输入短信验证码"}),(0,s.jsx)(K,{value:C,type:"password"===b?"password":"text",inputMode:"password"===b?void 0:"numeric",placeholder:"password"===b?"账号密码":"短信验证码",onChange:e=>T(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Q()}}),(0,s.jsx)(L,{size:"sm",disabled:n||!C.trim(),onClick:()=>void Q(),children:n?"提交中...":"提交验证"})]}),"connecting"===g&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.A,{className:"size-10 animate-spin text-muted-foreground"}),(0,s.jsx)(el,{className:"bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"连接中..."}),h&&(0,s.jsxs)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:["登录成功 正在连接账号 ",h]})]}),"online"===g&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eh.A,{className:"size-14 text-emerald-500"}),(0,s.jsx)(el,{className:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",children:"登录成功"}),h&&(0,s.jsxs)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:["账号 ",h," 已连接上线"]})]}),("expired"===g||"error"===g)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(el,{variant:"outline",className:"text-red-600 dark:text-red-400",children:"expired"===g?"二维码已过期":"登录失败"}),(0,s.jsxs)(L,{size:"sm",className:"gap-1.5",onClick:()=>void P(),disabled:n,children:[(0,s.jsx)(es.A,{className:"size-3.5"})," 重新获取"]})]}),i&&"error"!==g&&(0,s.jsx)("p",{className:"text-xs leading-relaxed text-red-500",children:i})]}),(0,s.jsx)(ew,{className:"sm:justify-center",children:(0,s.jsx)(eS,{onClick:R,children:"online"===g?"完成":"取消"})})]})})]})}function eI(e){let{onBound:t}=e,[a,l]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),[i,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(""),[m,x]=(0,r.useState)("idle"),h=(0,r.useRef)(""),p=(0,r.useRef)(null),g=(0,r.useRef)(t);g.current=t;let f=(0,r.useCallback)(()=>{p.current&&(clearInterval(p.current),p.current=null)},[]),b=(0,r.useCallback)(()=>{f(),h.current&&(I("/wxoc/qr/cancel",{sid:h.current}).catch(()=>{}),h.current=""),l(!1)},[f]),v=async e=>{try{var t,a,s,r,l,n;let o=await I("/wxoc/qr/status",{sid:e});if(!o.success)throw Error(null!=(t=o.message)?t:"扫码状态查询失败");let i=o.data;if(!i)return;if("scanned"===i.phase){f();let e=String(null!=(a=i.accountId)?a:"");h.current="",g.current({token:String(null!=(s=i.token)?s:""),accountId:e,userId:String(null!=(r=i.userId)?r:""),nickname:String(null!=(l=i.nickname)?l:""),baseUrl:String(null!=(n=i.baseUrl)?n:"")}),x("connecting"),p.current=setInterval(()=>{j(e)},2e3)}else"expired"===i.phase&&(f(),x("expired"))}catch(e){f(),c(e instanceof Error?e.message:String(e))}},j=async e=>{try{var t,a;let s=await fetch("/adapter-all/api/wxoc/qr/connected?accountId=".concat(encodeURIComponent(e)),{headers:w()}),r=await s.json().catch(()=>({}));if(!s.ok||(null==r?void 0:r.code)===500)throw Error(null!=(a=null==r?void 0:r.message)?a:"HTTP ".concat(s.status));(null==r||null==(t=r.data)?void 0:t.connected)&&(f(),x("online"),setTimeout(b,1200))}catch(e){f(),c(e instanceof Error?e.message:String(e))}},k=async()=>{f(),o(!0),c(""),x("idle"),u("");try{var e,t,a;let s=await I("/wxoc/qr/start");if(!s.success||!(null==(e=s.data)?void 0:e.id)||!(null==(t=s.data)?void 0:t.image))throw Error(null!=(a=s.message)?a:"扫码任务创建失败: 响应缺少二维码");h.current=s.data.id,u(s.data.image),x("pending"),p.current=setInterval(()=>{v(h.current)},2e3)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,r.useEffect)(()=>{a&&k()},[a]),(0,r.useEffect)(()=>()=>f(),[f]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(L,{variant:"ghost",size:"sm",className:"px-2 text-muted-foreground hover:text-foreground",title:"扫码登录 (自动获取登录凭据)",onClick:()=>l(!0),children:(0,s.jsx)(em.A,{className:"size-4"})}),(0,s.jsx)(eg,{open:a,onOpenChange:e=>{e||b()},children:(0,s.jsxs)(ej,{className:"sm:max-w-sm",children:[(0,s.jsxs)(ek,{children:[(0,s.jsxs)(eN,{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)(em.A,{className:"size-4 text-muted-foreground"}),"扫码登录微信 Claw"]}),(0,s.jsx)(ey,{className:"text-center",children:"微信扫码确认登录,成功后自动回填登录凭据"})]}),(0,s.jsxs)("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 rounded-lg border bg-muted/30 p-4",children:["idle"===m&&!i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"size-56 animate-pulse rounded-md bg-muted"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"正在生成二维码...":""})]}),"pending"===m&&d&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("img",{src:d,alt:"微信 Claw 扫码登录二维码",className:"size-56 rounded-md border bg-background p-2"}),(0,s.jsx)("span",{className:"absolute inset-x-6 -bottom-2.5 mx-auto w-fit",children:(0,s.jsx)(el,{className:"animate-pulse bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"等待扫码"})})]}),(0,s.jsx)("p",{className:"mt-2 text-center text-xs leading-relaxed text-muted-foreground",children:"请使用微信「扫一扫」扫码并确认登录"})]}),"connecting"===m&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.A,{className:"size-10 animate-spin text-muted-foreground"}),(0,s.jsx)(el,{className:"bg-amber-500/15 text-amber-600 dark:text-amber-400",children:"连接中..."}),(0,s.jsx)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:"扫码成功 正在连接账号"})]}),"online"===m&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(el,{className:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",children:"登录成功"}),(0,s.jsx)("p",{className:"text-center text-xs leading-relaxed text-muted-foreground",children:"账号已连接上线"})]}),"expired"===m&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(el,{variant:"outline",className:"text-red-600 dark:text-red-400",children:"二维码已过期"}),(0,s.jsxs)(L,{size:"sm",className:"gap-1.5",onClick:()=>void k(),disabled:n,children:[(0,s.jsx)(es.A,{className:"size-3.5"})," 重新获取"]})]}),i&&(0,s.jsx)("p",{className:"text-xs leading-relaxed text-red-500",children:i})]}),(0,s.jsx)(ew,{className:"sm:justify-center",children:(0,s.jsx)(eS,{onClick:b,children:"online"===m?"完成":"取消"})})]})})]})}var eE=a(1633),ez=a(3719),eU=a(8466);function eR(e){let{...t}=e;return(0,s.jsx)(eE.bL,{"data-slot":"select",...t})}function eM(e){let{...t}=e;return(0,s.jsx)(eE.WT,{"data-slot":"select-value",...t})}function eF(e){let{className:t,size:a="default",children:r,...l}=e;return(0,s.jsxs)(eE.l9,{"data-slot":"select-trigger","data-size":a,className:_("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","w-full",t),...l,children:[r,(0,s.jsx)(eE.In,{asChild:!0,children:(0,s.jsx)(Z.A,{className:"size-4 opacity-50"})})]})}function eP(e){let{className:t,children:a,position:r="popper",...l}=e;return(0,s.jsx)(eE.ZL,{children:(0,s.jsxs)(eE.UC,{"data-slot":"select-content",className:_("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...l,children:[(0,s.jsx)(eW,{}),(0,s.jsx)(eE.LM,{className:_("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:a}),(0,s.jsx)(eO,{})]})})}function eQ(e){let{className:t,children:a,...r}=e;return(0,s.jsxs)(eE.q7,{"data-slot":"select-item",className:_("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[(0,s.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,s.jsx)(eE.VF,{children:(0,s.jsx)(ez.A,{className:"size-4"})})}),(0,s.jsx)(eE.p4,{children:a})]})}function eW(e){let{className:t,...a}=e;return(0,s.jsx)(eE.PP,{"data-slot":"select-scroll-up-button",className:_("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(eU.A,{className:"size-4"})})}function eO(e){let{className:t,...a}=e;return(0,s.jsx)(eE.wn,{"data-slot":"select-scroll-down-button",className:_("flex cursor-default items-center justify-center py-1",t),...a,children:(0,s.jsx)(Z.A,{className:"size-4"})})}let eB=[{value:"on",label:"自动重连"},{value:"off",label:"关闭"}],eD=[{value:"none",label:"默认"},{value:"10000",label:"10 秒"},{value:"30000",label:"30 秒"},{value:"60000",label:"1 分钟"},{value:"300000",label:"5 分钟"}],e_=[{value:"none",label:"默认"},{value:"5000",label:"5 秒"},{value:"10000",label:"10 秒"},{value:"15000",label:"15 秒"},{value:"30000",label:"30 秒"},{value:"60000",label:"1 分钟"}],eH=[{value:"ws",label:"WebSocket"},{value:"sse",label:"SSE"},{value:"webhook",label:"WebHook"}],eL=[{value:"fast",label:"快速登录 (已有 token)"},{value:"password",label:"密码登录"},{value:"qrcode",label:"扫码登录 (需 Watch 平台)"}],eK=[{value:"1",label:"Android (安卓)"},{value:"2",label:"aPad (安卓平板)"},{value:"3",label:"Watch (手表, 扫码用)"},{value:"4",label:"iMac"},{value:"5",label:"iPad"},{value:"6",label:"Tim"},{value:"7",label:"Custom"}],eJ=[{value:"gt",label:"GT 网页验证"},{value:"txhelper",label:"txhelper 请求码"},{value:"manual",label:"手动 ticket 文件"}],eV=[{value:"ws",label:"WebSocket"},{value:"webhook",label:"WebHook"}],eG=(e,t)=>{let a=t.trim();return!a||e.some(e=>e.value===a)?e:[{value:a,label:"".concat(a," ms (自定义)")},...e]};function eY(e){let{label:t,children:a,className:r,required:l,optional:n,hint:o,hidden:i}=e;return i?null:(0,s.jsxs)("div",{className:_("space-y-1.5",r),children:[(0,s.jsxs)(V,{className:"text-muted-foreground text-xs font-normal",children:[t,l&&(0,s.jsx)("span",{className:"ml-0.5 text-red-500",children:"*"}),n&&(0,s.jsx)("span",{className:"ml-1 font-normal text-muted-foreground/60",children:"(选填)"})]}),a,o&&(0,s.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground/70",children:o})]})}function eZ(e){let{value:t,onChange:a,options:r,disabled:l,placeholder:n}=e;return(0,s.jsxs)(eR,{value:t,onValueChange:a,disabled:l,children:[(0,s.jsx)(eF,{children:(0,s.jsx)(eM,{placeholder:null!=n?n:"请选择"})}),(0,s.jsx)(eP,{children:r.map(e=>(0,s.jsx)(eQ,{value:e.value,children:e.label},e.value))})]})}function eX(e){let{form:t,onChange:a}=e;return(0,s.jsxs)("div",{className:"space-y-1.5 @[26rem]:col-span-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)(V,{className:"text-muted-foreground text-xs font-normal",children:["消息正则替换",(0,s.jsx)("span",{className:"ml-1 font-normal text-muted-foreground/60",children:"(选填)"})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:t.msgReplaceEnable?"开启":"关闭"}),(0,s.jsx)(Y,{checked:t.msgReplaceEnable,onCheckedChange:e=>a({msgReplaceEnable:e}),title:"启用 / 禁用消息正则替换","aria-label":"启用 / 禁用消息正则替换"})]})]}),(0,s.jsx)("textarea",{value:t.msgReplace,onChange:e=>a({msgReplace:e.target.value}),placeholder:"^\\s*/ #",rows:3,spellCheck:!1,className:"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 flex min-h-20 w-full rounded-md border bg-transparent px-3 py-2 font-mono text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:ring-[3px]"}),(0,s.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground/70",children:"每行一条「正则 替换」"})]})}let e$=e=>e.trim()?e:"none",e0=e=>"none"===e?"":e,e1=(e,t)=>{let a=e.trim(),s=t.trim();return a&&s?"ws://".concat(a,":").concat(s,"/"):""};function e5(e){var t,a,l,n,o,i,c;let{value:d,index:u,form:m,icqqAvailable:x,showErrors:b,onChange:v,onRemove:j,onQrBound:k,onDouyinBound:w,onWxocBound:N}=e,y=e=>v(e),[q,S]=(0,r.useState)([]),[C,T]=(0,r.useState)(!1),[I,E]=(0,r.useState)(""),z=async()=>{T(!0),E("");try{let{ver:e}=await A(m.signApiAddr,m.uin);S(e)}catch(e){S([]),E(e instanceof Error?e.message:String(e))}finally{T(!1)}},U=[m.protocol?null!=(t=F[m.protocol])?t:m.protocol:"","onebot11"===m.protocol&&m.impl?null!=(a=P[m.impl])?a:m.impl:""].filter(Boolean).join(" \xb7 "),W="icqq"===m.protocol,O="kook"===m.protocol,B="qqbot"===m.protocol,D="douyin"===m.protocol,H="wxoc"===m.protocol,J=W?m.uin.trim()?"QQ ".concat(m.uin.trim()):"未配置 QQ 号":O?m.kookToken.trim()?"Token 已配置":"未配置 Token":B?m.qqbotAppId.trim()?"AppID ".concat(m.qqbotAppId.trim()):"未配置 AppID":D?m.douyinUid.trim()?m.douyinName.trim()||"UID ".concat(m.douyinUid.trim()):"未扫码登录":H?m.wxocToken.trim()?"Token 已配置":"未扫码登录":m.url.trim()||"未配置连接地址",V=W||O||B||D||H,G=b&&m.enable&&(W?"qrcode"!==m.loginType&&!m.uin.trim():O?!m.kookToken.trim():B?!m.qqbotAppId.trim()||!m.qqbotClientSecret.trim():D?!m.douyinUid.trim():H?!m.wxocToken.trim()||!m.wxocAccountId.trim():!m.url.trim()),Z="onebot11"===m.protocol,X="milky"===m.protocol,et=Z?m.communication||"ws":"",ea=X?m.eventMode||"ws":"",es="ws"===et,er="ws-reverse"===et,el="http"===et,en="sse"===et,eo=X?"webhook"!==ea:er||en,ei=X?"ws"===ea:er,ec={ws:"本端监听 (正向 WS)","ws-reverse":"协议端地址 (反向 WS)",http:"协议端 API 地址 (HTTP)",sse:"协议端 API 地址 (HTTP SSE)"},ed=Z?null!=(l=ec[et])?l:ec.ws:X?"协议端地址 (milky)":"连接地址",em=X?"http://127.0.0.1:8000":el||en?"http://127.0.0.1:3000":"ws://127.0.0.1:3001/",ex=es?(e=>{let t=e.trim();if(!t)return{host:"",port:""};try{let e=new URL(/^\w+:\/\//.test(t)?t:"ws://".concat(t.replace(/^\/+/,"")));return{host:e.hostname,port:e.port}}catch(e){return{host:"",port:""}}})(m.url):null,eh={ws:"协议端连入此地址","ws-reverse":"本端连接的协议端地址",http:"协议端 API 地址",sse:"协议端 API 地址",milky:"milky 协议端地址"},ep=Z?null!=(n=eh[et])?n:eh.ws:X?eh.milky:"",eb=el||en||X&&"webhook"===ea,ev=X?"WebHook 监听地址":el?"事件上报地址 (协议端 POST)":"事件流地址 (协议端 SSE)",eC=X?"如 0.0.0.0:8088":el?"协议端事件上报地址":"协议端 SSE 事件流地址",eE={ws:"协议端连入时携带","ws-reverse":"与协议端一致",http:"调用 API 时携带",sse:"调用 API 时携带",milky:"与协议端一致","milky-webhook":"与协议端一致"},ez=Z?null!=(o=eE[et])?o:eE.ws:X?"webhook"===ea?eE["milky-webhook"]:eE.milky:"";return(0,s.jsxs)($,{value:d,className:"@container overflow-hidden rounded-xl border bg-card shadow-sm data-[state=open]:col-span-full",children:[(0,s.jsxs)(R.Y9,{className:"flex min-w-0 items-center border-b border-border/60",children:[(0,s.jsxs)(R.l9,{className:"group flex min-w-0 flex-1 items-center gap-2.5 py-3 pl-4 text-sm font-medium transition-colors select-none hover:bg-accent/50 [&[data-state=open]>svg]:rotate-180",children:[(0,s.jsx)("span",{className:_("h-2 w-2 shrink-0 rounded-full",G?"bg-red-500":m.enable?"bg-emerald-500":"bg-muted-foreground/50"),title:G?W?"缺少必填的 QQ 号":O?"缺少必填的 Kook Token":B?"缺少必填的 AppID / Token":D?"缺少必填的抖音 UID":H?"缺少必填的 Token / 机器人 ID":"缺少必填的连接地址":m.enable?"已启用":"已停用"}),(0,s.jsx)("span",{className:"truncate",children:U||"连接 ".concat(u+1)}),(0,s.jsxs)("span",{className:"hidden min-w-0 truncate text-xs font-normal text-muted-foreground group-data-[state=open]:hidden @[34rem]:inline",children:["\xb7 ",J]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 pr-2.5",children:[B&&(0,s.jsx)(eT,{onBound:e=>{y({qqbotAppId:e.appId,qqbotClientSecret:e.appSecret}),null==k||k(e)}}),D&&(0,s.jsx)(eA,{onBound:e=>{y({douyinUid:e.uid,douyinName:e.name||m.douyinName}),null==w||w({douyinUid:e.uid,douyinName:e.name||m.douyinName})}}),H&&(0,s.jsx)(eI,{onBound:e=>{let t={wxocToken:e.token,wxocAccountId:e.accountId,wxocUserId:e.userId,wxocNickname:e.nickname,wxocBaseUrl:e.baseUrl};y(t),null==N||N(t)}}),(0,s.jsx)(Y,{checked:m.enable,onCheckedChange:e=>y({enable:e}),title:m.enable?"停用该连接":"启用该连接","aria-label":m.enable?"停用该连接":"启用该连接"}),(0,s.jsxs)(eg,{children:[(0,s.jsx)(ef,{asChild:!0,children:(0,s.jsx)(L,{variant:"ghost",size:"sm",className:"px-2 text-destructive hover:text-destructive",title:"删除该连接",children:(0,s.jsx)(M.A,{className:"size-4"})})}),(0,s.jsxs)(ej,{children:[(0,s.jsxs)(ek,{children:[(0,s.jsx)(eN,{children:"删除该连接?"}),(0,s.jsx)(ey,{children:"删除后需点击「保存配置」才会真正生效。"})]}),(0,s.jsxs)(ew,{children:[(0,s.jsx)(eS,{children:"取消"}),(0,s.jsx)(eq,{className:"bg-destructive text-white hover:bg-destructive/90",onClick:j,children:"删除"})]})]})]})]})]}),(0,s.jsxs)(ee,{className:"px-4 pt-4",children:[W&&!x&&(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-1.5 rounded-lg border border-amber-300/70 bg-amber-50 p-3 text-xs leading-relaxed text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:[(0,s.jsx)("p",{className:"font-medium",children:"需安装 icqq (@icqqjs/icqq),未安装时无法保存。"}),(0,s.jsx)("p",{className:"font-mono break-all",dir:"ltr",children:"pnpm add icqq@npm:@icqqjs/icqq -w"}),(0,s.jsx)("p",{children:"装好后回到本页保存即生效,无需重启。"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-x-4 gap-y-4 @[26rem]:grid-cols-2",children:[(0,s.jsx)(eY,{label:"协议",required:!0,children:(0,s.jsx)(eZ,{value:m.protocol,onChange:e=>y({protocol:e}),options:h.map(e=>{var t;return{value:e,label:null!=(t=F[e])?t:e}})})}),(0,s.jsx)(eY,{label:"onebot11"===m.protocol?"实现":"实现 (仅 OneBot 11)",required:!0,children:(0,s.jsx)(eZ,{value:m.impl,onChange:e=>y({impl:e}),options:p.map(e=>{var t;return{value:e,label:null!=(t=P[e])?t:e}}),disabled:"onebot11"!==m.protocol})}),"onebot11"===m.protocol&&(0,s.jsx)(eY,{label:"通信方式",required:!0,children:(0,s.jsx)(eZ,{value:et,onChange:e=>y({communication:e}),options:g.map(e=>{var t;return{value:e,label:null!=(t=Q[e])?t:e}})})}),X&&(0,s.jsx)(eY,{label:"事件推送方式",required:!0,hint:"webhook"===ea?"需填下方监听地址":void 0,children:(0,s.jsx)(eZ,{value:ea,onChange:e=>y({eventMode:e}),options:f.map(e=>{var t,a;return{value:e,label:null!=(a=null==(t=eH.find(t=>t.value===e))?void 0:t.label)?a:e}})})}),(0,s.jsx)(eY,{label:"断线重连",hidden:!eo,children:(0,s.jsx)(eZ,{value:m.reconnect?"on":"off",onChange:e=>y({reconnect:"on"===e}),options:eB})}),(0,s.jsx)(eY,{label:"心跳间隔",hidden:!ei,children:(0,s.jsx)(eZ,{value:e$(m.heartbeatInterval),onChange:e=>y({heartbeatInterval:e0(e)}),options:eG(eD,m.heartbeatInterval)})}),(0,s.jsx)(eY,{label:"请求超时",hidden:!Z,children:(0,s.jsx)(eZ,{value:e$(m.requestTimeout),onChange:e=>y({requestTimeout:e0(e)}),options:eG(e_,m.requestTimeout)})}),!V&&(0,s.jsx)(s.Fragment,{children:es?(0,s.jsx)(eY,{label:ed,required:!0,className:"@[26rem]:col-span-2",hint:ep,children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"font-mono text-sm text-muted-foreground/80",children:"ws://"}),(0,s.jsx)(K,{value:null!=(i=null==ex?void 0:ex.host)?i:"",placeholder:"0.0.0.0","aria-label":"监听 IP",className:_("flex-1 min-w-[8rem]",b&&!m.url.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>{var t;return y({url:e1(e.target.value,null!=(t=null==ex?void 0:ex.port)?t:"")})}}),(0,s.jsx)("span",{className:"font-mono text-sm text-muted-foreground/80",children:":"}),(0,s.jsx)(K,{value:null!=(c=null==ex?void 0:ex.port)?c:"",placeholder:"8082","aria-label":"监听端口",inputMode:"numeric",className:_("w-28",b&&!m.url.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>{var t;return y({url:e1(null!=(t=null==ex?void 0:ex.host)?t:"",e.target.value)})}})]})}):(0,s.jsx)(eY,{label:ed,required:!0,className:"@[26rem]:col-span-2",hint:ep,children:(0,s.jsx)(K,{value:m.url,placeholder:em,className:_(b&&!m.url.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({url:e.target.value})})})}),eb&&(0,s.jsx)(eY,{label:ev,required:!0,className:"@[26rem]:col-span-2",hint:eC,children:(0,s.jsx)(K,{value:m.eventUrl,placeholder:X?"0.0.0.0:8088":el?"http://0.0.0.0:8090/":"http://127.0.0.1:3000/events",className:_(b&&m.enable&&!m.eventUrl.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({eventUrl:e.target.value})})}),(0,s.jsx)(eY,{label:"鉴权 Token",optional:!0,hidden:V,hint:ez,children:(0,s.jsx)(K,{type:"password",value:m.accessToken,placeholder:es?"协议端连接须携带":"与协议端一致",onChange:e=>y({accessToken:e.target.value})})}),W&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eY,{label:"QQ 号",required:"qrcode"!==m.loginType,hint:"扫码登录可不填",children:(0,s.jsx)(K,{value:m.uin,placeholder:"10001",inputMode:"numeric",className:_(b&&m.enable&&"qrcode"!==m.loginType&&!m.uin.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({uin:e.target.value})})}),(0,s.jsx)(eY,{label:"登录方式",required:!0,children:(0,s.jsx)(eZ,{value:m.loginType,onChange:e=>y({loginType:e}),options:eL})}),"password"===m.loginType&&(0,s.jsx)(eY,{label:"密码",required:!0,hint:"首次登录后自动保存",children:(0,s.jsx)(K,{type:"password",value:m.password,placeholder:"QQ 密码",onChange:e=>y({password:e.target.value})})}),(0,s.jsx)(eY,{label:"协议平台",optional:!0,hint:"qrcode"===m.loginType?"扫码登录须使用 Watch (3)":"默认 Android (1)",children:(0,s.jsx)(eZ,{value:m.platform||"1",onChange:e=>y({platform:e}),options:eK})}),(0,s.jsx)(eY,{label:"协议版本",optional:!0,hint:I||(q.length?"共 ".concat(q.length," 个版本"):"拉取可选版本"),children:(0,s.jsxs)("div",{className:"flex gap-2",children:[q.length>0?(0,s.jsx)(eZ,{value:q.includes(m.ver)?m.ver:"",onChange:e=>y({ver:e}),options:q.map(e=>({value:e,label:e})),placeholder:"选择版本"}):(0,s.jsx)(K,{value:m.ver,placeholder:"9.1.70",onChange:e=>y({ver:e.target.value})}),(0,s.jsx)(L,{type:"button",variant:"outline",size:"sm",className:"shrink-0 px-3",disabled:!m.signApiAddr.trim()||C,onClick:z,children:C?"获取中…":"获取版本"})]})}),(0,s.jsx)(eY,{label:"签名服务地址",optional:!0,hint:"留空用库默认",children:(0,s.jsx)(K,{value:m.signApiAddr,placeholder:"http://127.0.0.1:8080/",onChange:e=>y({signApiAddr:e.target.value})})}),(0,s.jsx)(eY,{label:"滑块验证方式",optional:!0,children:(0,s.jsx)(eZ,{value:m.sliderMode||"gt",onChange:e=>y({sliderMode:e}),options:eJ})}),(0,s.jsx)("div",{className:"@[26rem]:col-span-2",children:(0,s.jsx)(eu,{uin:m.uin})})]}),O&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eY,{label:"事件推送方式",required:!0,hint:"webhook"===m.kookEventMode?"需填下方监听地址":void 0,children:(0,s.jsx)(eZ,{value:m.kookEventMode||"ws",onChange:e=>y({kookEventMode:e}),options:eV})}),(0,s.jsx)(eY,{label:"Bot Token",required:!0,hint:"Kook 机器人 Token",children:(0,s.jsx)(K,{type:"password",value:m.kookToken,placeholder:"1/MjE4Nxxxx",className:_(b&&m.enable&&!m.kookToken.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({kookToken:e.target.value})})}),"webhook"===m.kookEventMode&&(0,s.jsx)(eY,{label:"WebHook 监听地址",required:!0,hint:"如 0.0.0.0:8091",children:(0,s.jsx)(K,{value:m.kookWebhookUrl,placeholder:"0.0.0.0:8091",className:_(b&&m.enable&&!m.kookWebhookUrl.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({kookWebhookUrl:e.target.value})})}),(0,s.jsx)(eX,{form:m,onChange:y})]}),B&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eY,{label:"事件推送方式",required:!0,hint:"webhook"===m.qqbotEventMode?"需填下方监听地址":void 0,children:(0,s.jsx)(eZ,{value:m.qqbotEventMode||"ws",onChange:e=>y({qqbotEventMode:e}),options:eV})}),(0,s.jsx)(eY,{label:"AppID",required:!0,hint:"开放平台后台获取",children:(0,s.jsx)(K,{value:m.qqbotAppId,placeholder:"1020xxxx",className:_(b&&m.enable&&!m.qqbotAppId.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({qqbotAppId:e.target.value})})}),(0,s.jsx)(eY,{label:"App Secret",required:!0,hint:"开放平台后台获取",children:(0,s.jsx)(K,{type:"password",value:m.qqbotClientSecret,placeholder:"xxxxxxxx",className:_(b&&m.enable&&!m.qqbotClientSecret.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({qqbotClientSecret:e.target.value})})}),"webhook"===m.qqbotEventMode&&(0,s.jsx)(eY,{label:"WebHook 监听地址",required:!0,hint:"如 0.0.0.0:8092",children:(0,s.jsx)(K,{value:m.qqbotWebhookUrl,placeholder:"0.0.0.0:8092",className:_(b&&m.enable&&!m.qqbotWebhookUrl.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({qqbotWebhookUrl:e.target.value})})}),(0,s.jsx)(eX,{form:m,onChange:y})]}),D&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eY,{label:"抖音 UID",required:!0,className:"@[26rem]:col-span-2",hint:"右上角扫码登录后自动回填",children:(0,s.jsx)(K,{value:m.douyinUid,placeholder:"扫码登录后自动获取",readOnly:!0,className:_("min-w-0",b&&m.enable&&!m.douyinUid.trim()&&"border-destructive focus-visible:ring-destructive")})}),(0,s.jsx)(eY,{label:"账号昵称",optional:!0,hint:"备注用 可留空",children:(0,s.jsx)(K,{value:m.douyinName,placeholder:"扫码登录后自动回填",onChange:e=>y({douyinName:e.target.value})})}),(0,s.jsx)(eX,{form:m,onChange:y})]}),H&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eY,{label:"登录凭证 Token",required:!0,className:"@[26rem]:col-span-2",hint:"右上角扫码登录后自动回填",children:(0,s.jsx)(K,{type:"password",value:m.wxocToken,placeholder:"扫码登录后自动获取",className:_("min-w-0",b&&m.enable&&!m.wxocToken.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({wxocToken:e.target.value})})}),(0,s.jsx)(eY,{label:"机器人 ID",required:!0,hint:"ilink 机器人 ID 扫码后自动回填",children:(0,s.jsx)(K,{value:m.wxocAccountId,placeholder:"扫码登录后自动获取",className:_(b&&m.enable&&!m.wxocAccountId.trim()&&"border-destructive focus-visible:ring-destructive"),onChange:e=>y({wxocAccountId:e.target.value})})}),(0,s.jsx)(eY,{label:"用户 ID",optional:!0,hint:"ilink 用户 ID 扫码后自动回填",children:(0,s.jsx)(K,{value:m.wxocUserId,placeholder:"扫码登录后自动获取",onChange:e=>y({wxocUserId:e.target.value})})}),(0,s.jsx)(eY,{label:"昵称",optional:!0,children:(0,s.jsx)(K,{value:m.wxocNickname,placeholder:"扫码登录后自动回填",onChange:e=>y({wxocNickname:e.target.value})})}),(0,s.jsx)(eY,{label:"API 地址",optional:!0,hint:"登录返回的服务地址 留空用默认",children:(0,s.jsx)(K,{value:m.wxocBaseUrl,placeholder:"扫码登录后自动回填",onChange:e=>y({wxocBaseUrl:e.target.value})})}),(0,s.jsx)(eX,{form:m,onChange:y})]})]})]})]})}function e2(e){let{onSuccess:t}=e,[a,l]=(0,r.useState)(""),[n,o]=(0,r.useState)(!1),[i,c]=(0,r.useState)(""),d=async()=>{let e=a.trim();if(!e)return void c("请输入 token");o(!0),c("");try{let a=await q(e);if(a.success)localStorage.setItem(b,e),t();else c(a.message||"token 错误")}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,s.jsx)("div",{className:"flex h-screen items-center justify-center px-4",children:(0,s.jsxs)("div",{className:"w-full max-w-xs space-y-4",children:[(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("h1",{className:"text-lg font-semibold",children:"Karin 适配器"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"请输入 WebUI token 登录"})]}),(0,s.jsx)(K,{type:"password",value:a,autoFocus:!0,placeholder:"WebUI token",disabled:n,onKeyDown:e=>{"Enter"===e.key&&d()},onChange:e=>l(e.target.value)}),i&&(0,s.jsx)("p",{className:"text-center text-xs text-destructive",children:i}),(0,s.jsx)(L,{className:"w-full",disabled:n,onClick:()=>void d(),children:n?"登录中...":"登录"})]})})}function e4(e){let{className:t}=e;return(0,s.jsx)("div",{className:_("animate-pulse rounded-md bg-muted",t)})}function e3(e){let{src:t,alt:a,className:l}=e,[n,o]=(0,r.useState)(!1);return(0,s.jsxs)("span",{className:_("relative inline-block shrink-0 overflow-hidden rounded-full",l),children:[!n&&(0,s.jsx)(e4,{className:"absolute inset-0 rounded-full"}),(0,s.jsx)("img",{src:t,alt:a,onLoad:()=>o(!0),className:_("size-full rounded-full transition-opacity duration-300",n?"opacity-100":"opacity-0")})]})}function e6(){return(0,s.jsxs)("div",{className:"rounded-xl border bg-card p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(e4,{className:"size-10 shrink-0 rounded-full"}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)(e4,{className:"h-4 w-1/3"}),(0,s.jsx)(e4,{className:"h-3 w-1/2"})]}),(0,s.jsx)(e4,{className:"h-6 w-16 rounded-full"})]}),(0,s.jsxs)("div",{className:"mt-4 space-y-2.5",children:[(0,s.jsx)(e4,{className:"h-3 w-16"}),(0,s.jsx)(e4,{className:"h-9 w-full rounded-md"}),(0,s.jsx)(e4,{className:"h-3 w-16"}),(0,s.jsx)(e4,{className:"h-9 w-full rounded-md"})]})]})}function e9(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-4",children:[(0,s.jsx)(e4,{className:"h-4 w-44"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(e4,{className:"size-9 rounded-md"}),(0,s.jsx)(e4,{className:"h-9 w-24 rounded-md"}),(0,s.jsx)(e4,{className:"h-9 w-28 rounded-md"})]})]}),(0,s.jsx)("div",{className:"pb-4",children:(0,s.jsx)(e4,{className:"h-10 w-full max-w-xl rounded-lg"})}),(0,s.jsx)("div",{className:"grid grid-cols-1 items-start gap-4 md:grid-cols-2 2xl:grid-cols-3",children:Array.from({length:6},(e,t)=>(0,s.jsx)(e6,{},t))})]})}function e8(){return(0,s.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex w-60 shrink-0 flex-col gap-4 border-r bg-muted/40 p-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(e4,{className:"size-9 rounded-full"}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)(e4,{className:"h-3.5 w-20"}),(0,s.jsx)(e4,{className:"h-3 w-14"})]})]}),(0,s.jsx)(e4,{className:"h-9 w-full rounded-md"}),(0,s.jsx)(e4,{className:"h-9 w-full rounded-md"})]}),(0,s.jsx)("div",{className:"flex-1 overflow-hidden p-6",children:(0,s.jsx)("div",{className:"mx-auto max-w-[1440px]",children:(0,s.jsx)(e9,{})})})]})}let e7={name:"dmmdekkd",url:"https://github.com/dmmdekkd",avatar:"https://github.com/dmmdekkd.png"},te=[{key:"config",label:"连接配置",icon:l.A},{key:"settings",label:"设置",icon:n.A}],tt=[{key:"onebot11",label:"OneBot 11"},{key:"onebot12",label:"OneBot 12"},{key:"icqq",label:"ICQQ"},{key:"milky",label:"Milky"},{key:"kook",label:"Kook"},{key:"qqbot",label:"QQBot"},{key:"douyin",label:"抖音"},{key:"wxoc",label:"微信 Claw"}];function ta(){let{theme:e,setTheme:t}=(0,m.D)(),[a,l]=(0,r.useState)([]),n=(0,r.useRef)(0),[h,p]=(0,r.useState)(!0),[g,f]=(0,r.useState)(!1),[b,k]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!0),[y,q]=(0,r.useState)(!1),[A,I]=(0,r.useState)(!0),[z,R]=(0,r.useState)("config"),[M,F]=(0,r.useState)(null);(0,r.useEffect)(()=>{F(!!j());let e=()=>F(!1);return window.addEventListener(v,e),()=>window.removeEventListener(v,e)},[]);let[P,Q]=(0,r.useState)("onebot11"),W=(0,r.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await S(),a=Array.isArray(t.bots)?t.bots:[];l(a.map(e=>({id:++n.current,form:E(e)}))),q(!1),e&&x.oR.success("配置已刷新")}catch(e){x.oR.error("加载配置失败: ".concat(e instanceof Error?e.message:String(e)))}finally{p(!1)}},[]),O=(0,r.useCallback)(async()=>{k(!0),await W(!0),T().then(N).catch(()=>N(!0)),k(!1)},[W]);(0,r.useEffect)(()=>{!0===M&&(W(),T().then(N).catch(()=>N(!0)))},[M,W]);let B=(0,r.useCallback)((e,t)=>{l(a=>a.map(a=>a.id===e?{...a,form:{...a.form,...t}}:a)),t.protocol&&tt.some(e=>e.key===t.protocol)&&Q(t.protocol)},[]),D=(0,r.useCallback)(e=>{l(t=>t.filter(t=>t.id!==e))},[]),H=(0,r.useCallback)(e=>{let t=E();e&&(t.protocol=e),l(e=>[...e,{id:++n.current,form:t}])},[]),K=e=>{H(null!=e?e:P),e&&e!==P&&Q(e)},J=a.map(e=>U(e.form)).filter(e=>!!e),G=a.filter(e=>e.form.protocol===P),Y=async()=>{q(!0);let e=a.filter(e=>e.form.enable&&("icqq"===e.form.protocol&&"qrcode"!==e.form.loginType&&!e.form.uin.trim()||"kook"===e.form.protocol&&(!e.form.kookToken.trim()||"webhook"===e.form.kookEventMode&&!e.form.kookWebhookUrl.trim())||"qqbot"===e.form.protocol&&(!e.form.qqbotAppId.trim()||!e.form.qqbotClientSecret.trim()||"webhook"===e.form.qqbotEventMode&&!e.form.qqbotWebhookUrl.trim())||"douyin"===e.form.protocol&&!e.form.douyinUid.trim()||"wxoc"===e.form.protocol&&(!e.form.wxocToken.trim()||!e.form.wxocAccountId.trim())||!["icqq","kook","qqbot","douyin","wxoc"].includes(e.form.protocol)&&!e.form.url.trim()));if(e.length){let t=e.some(e=>"icqq"===e.form.protocol)?"QQ 号":e.some(e=>"kook"===e.form.protocol)?"Kook Token":e.some(e=>"qqbot"===e.form.protocol)?"AppID / Token":e.some(e=>"douyin"===e.form.protocol)?"抖音 UID":e.some(e=>"wxoc"===e.form.protocol)?"Token / 机器人 ID":"连接地址";x.oR.error("有 ".concat(e.length," 个已启用的连接未填写「").concat(t,"」,请补充必填项后再保存"));return}let t=a.filter(e=>e.form.enable&&"onebot11"===e.form.protocol&&["http","sse"].includes(e.form.communication)&&!e.form.eventUrl.trim());if(t.length)return void x.oR.error("有 ".concat(t.length," 个已启用的连接未填写「事件上报/流地址」,请补充后再保存"));if(a.some(e=>e.form.enable&&"icqq"===e.form.protocol)&&!w)return void x.oR.error("ICQQ 机器人需要安装 icqq (@icqqjs/icqq),安装命令见 ICQQ 卡片提示,装好后保存即生效");f(!0);try{let e=await C({bots:J});e.success?(x.oR.success(e.message),q(!1)):x.oR.error(e.message)}catch(e){x.oR.error(e instanceof Error?e.message:String(e))}finally{f(!1)}},Z=async(e,t)=>{let s=a.map(a=>a.id===e?{...a,form:{...a.form,qqbotAppId:t.appId,qqbotClientSecret:t.appSecret}}:a);l(s);let r=s.map(e=>U(e.form)).filter(e=>!!e);f(!0);try{let e=await C({bots:r});e.success?x.oR.success("绑定成功,正在连接机器人"):x.oR.error(e.message)}catch(e){x.oR.error(e instanceof Error?e.message:String(e))}finally{f(!1)}},$=async(e,t,s)=>{let r=a.map(t=>t.id===e?{...t,form:{...t.form,...s}}:t);l(r);let n=r.map(e=>U(e.form)).filter(e=>!!e);f(!0);try{let e=await C({bots:n});e.success?x.oR.success("douyin"===t?"登录成功,正在连接抖音账号":"登录成功,正在连接微信账号"):x.oR.error(e.message)}catch(e){x.oR.error(e instanceof Error?e.message:String(e))}finally{f(!1)}};return!0!==M?null===M?(0,s.jsx)(e8,{}):(0,s.jsx)(e2,{onSuccess:()=>F(!0)}):(0,s.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,s.jsxs)("aside",{className:_("flex h-full shrink-0 flex-col border-r bg-muted/40 transition-[width] duration-200",A?"w-14":"w-60"),children:[(0,s.jsxs)("div",{className:_("flex items-center gap-3 p-3",A&&"justify-center px-0"),children:[(0,s.jsx)("a",{href:e7.url,target:"_blank",rel:"noreferrer",className:"shrink-0",title:"GitHub",children:(0,s.jsx)(e3,{src:e7.avatar,alt:e7.name,className:"size-9 ring-1 ring-border"})}),!A&&(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm font-semibold",children:e7.name}),(0,s.jsxs)("p",{className:"flex items-center gap-1 truncate text-xs text-muted-foreground",children:[(0,s.jsx)(o.A,{className:"size-3"})," GitHub"]})]})]}),(0,s.jsx)("div",{className:"mx-3 my-2 h-px bg-border"}),(0,s.jsx)("nav",{className:"flex flex-col gap-1 px-2",children:te.map(e=>{let{key:t,label:a,icon:r}=e;return(0,s.jsxs)("button",{onClick:()=>R(t),title:a,className:_("flex items-center gap-3 rounded-md px-2.5 py-2 text-sm font-medium transition-colors",A&&"justify-center px-0",z===t?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[(0,s.jsx)(r,{className:"size-4 shrink-0"}),!A&&a]},t)})}),(0,s.jsx)("div",{className:"mt-auto p-2",children:(0,s.jsxs)(L,{variant:"ghost",size:A?"icon":"default",className:_("gap-3",A?"mx-auto flex size-8 p-0":"w-full justify-start px-2.5"),onClick:()=>I(e=>!e),title:A?"展开侧边栏":"收起侧边栏",children:[(0,s.jsx)(i.A,{className:"size-4 shrink-0"}),!A&&(0,s.jsx)("span",{className:"text-sm",children:"收起侧边栏"})]})})]}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:"settings"===z?(0,s.jsx)("div",{className:"mx-auto max-w-2xl px-6 py-8",children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"设置"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"界面外观"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(V,{children:"主题"}),(0,s.jsxs)(eR,{value:null!=e?e:"system",onValueChange:t,children:[(0,s.jsx)(eF,{children:(0,s.jsx)(eM,{})}),(0,s.jsxs)(eP,{children:[(0,s.jsx)(eQ,{value:"light",children:"浅色"}),(0,s.jsx)(eQ,{value:"dark",children:"深色"}),(0,s.jsx)(eQ,{value:"system",children:"跟随系统"})]})]})]})]})}):(0,s.jsx)("div",{className:"mx-auto max-w-[1440px] px-4 py-6 sm:px-6",children:h?(0,s.jsx)(e9,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-4",children:[(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["管理适配器下的 Bot 连接,共"," ",(0,s.jsx)("span",{className:"font-medium text-foreground",children:a.length})," 个配置",J.length<a.length&&(0,s.jsxs)(s.Fragment,{children:[",有效 ",(0,s.jsx)("span",{className:"font-medium text-foreground",children:J.length})," 个"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(L,{variant:"outline",size:"icon",title:"重新加载配置 (丢弃未保存的修改)",disabled:b,onClick:()=>void O(),children:(0,s.jsx)(c.A,{className:_(b&&"animate-spin")})}),(0,s.jsxs)(L,{variant:"outline",onClick:()=>K(),children:[(0,s.jsx)(d.A,{})," 添加连接"]}),(0,s.jsxs)(L,{onClick:Y,disabled:g,children:[(0,s.jsx)(u.A,{})," ",g?"保存中...":"保存配置"]})]})]}),(0,s.jsx)("div",{className:"pb-4",children:(0,s.jsx)("div",{className:"inline-flex max-w-full flex-wrap items-center gap-1 rounded-lg bg-muted p-1",children:tt.map(e=>{let{key:t,label:r}=e,l=a.filter(e=>e.form.protocol===t).length;return(0,s.jsxs)("button",{onClick:()=>Q(t),className:_("flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors",P===t?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r,(0,s.jsx)("span",{className:_("rounded-full px-1.5 text-xs tabular-nums",P===t?"bg-primary text-primary-foreground":"bg-border text-muted-foreground"),children:l})]},t)})})}),0===G.length?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-4 rounded-xl border border-dashed py-24",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:0===a.length?"暂无连接配置":"该分类下暂无连接"}),(0,s.jsxs)(L,{onClick:()=>K(),children:[(0,s.jsx)(d.A,{})," 添加连接"]})]}):(0,s.jsx)(X,{type:"multiple",className:_("grid grid-cols-1 items-start gap-4",G.length>1&&"md:grid-cols-2 2xl:grid-cols-3"),children:G.map((e,t)=>(0,s.jsx)(e5,{value:String(e.id),index:t,form:e.form,icqqAvailable:w,showErrors:y,onChange:t=>B(e.id,t),onRemove:()=>D(e.id),onQrBound:t=>void Z(e.id,t),onDouyinBound:t=>void $(e.id,"douyin",t),onWxocBound:t=>void $(e.id,"wxoc",t)},e.id))})]})})})]})}}},e=>{e.O(0,[634,78,748,778,358],()=>e(e.s=450)),_N_E=e.O()}]);
|