@luckylillia-dev/plugin-webqq 1.0.4 → 1.0.5
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/lib/client/chunks/WebQQEntry-XPGB72PJ.js +110 -0
- package/lib/client/chunks/chunk-OQTWS3NO.js +1 -0
- package/lib/client/index.js +1 -1
- package/lib/client/module.js +1 -1
- package/lib/client/style.css +1 -1
- package/lib/index.js +88 -0
- package/lib/index.js.map +4 -4
- package/lib/types/flashFiles.d.ts +4 -0
- package/package.json +2 -1
- package/lib/client/chunks/WebQQEntry-QUBLXEFH.js +0 -91
- package/lib/client/chunks/chunk-MBPE66O6.js +0 -1
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import{b as vt,c as T,d as Je}from"./chunk-MBPE66O6.js";import{useEffect as ld,useState as id}from"react";import{forwardRef as Bd,createElement as Ud}from"react";var js=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Ws(e,o,t=[]){if(o==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:js(e),size:24,node:o,...t.length>0?{aliases:t}:{}}}var Vs=e=>{let o="",t=!1;for(let a of e){if(a==="-"||a==="_"||a<=" "){t=o.length>0;continue}o.length===0?o+=a.toLowerCase():o+=t?a.toUpperCase():a,t=!1}return o};var $s=e=>{let o=Vs(e);return o.charAt(0).toUpperCase()+o.slice(1)};import{forwardRef as qd,createElement as Zs}from"react";var Ra=(...e)=>e.filter((o,t,a)=>!!o&&o.trim()!==""&&a.indexOf(o)===t).join(" ").trim();var _t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function br(e){return e!=null}function Xs(e,o={}){let t=o.attributeNames??{},a=f=>t[f]??f,r=e.size??e.width??_t.width,s=e.size??e.height??_t.height,l=e.aliases?.filter(f=>typeof f=="string"&&f.trim()!=="").map(f=>`lucide-${f}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...l],i=o.className?.split(" ").filter(Boolean)??[],u=o.includeDefaultClasses===!1?Ra(...i):Ra("lucide",...n,...i),d=o.absoluteStrokeWidth?Number(o.strokeWidth??_t["stroke-width"])*Number(e.size??e.width??_t.width)/Number(o.size??o.width??_t.width):o.strokeWidth??_t["stroke-width"];return["svg",{...Object.entries(_t).reduce((f,[h,p])=>(f[a(h)]=p,f),{}),..."color"in o&&o.color&&{[a("stroke")]:o.color},..."size"in o&&br(o.size)&&{[a("width")]:o.size,[a("height")]:o.size},..."width"in o&&br(o.width)&&{[a("width")]:o.width},..."height"in o&&br(o.height)&&{[a("height")]:o.height},[a("stroke-width")]:d,...u&&{[a("class")]:u},[a("viewBox")]:`0 0 ${r} ${s}`,...o.hasA11yProp===!1?{[a("aria-hidden")]:"true"}:{},..."attributes"in o&&o.attributes},e.node.map(f=>{let[h,p,m]=f,g=o.nonScalingStroke?{[a("vector-effect")]:"non-scaling-stroke",...p}:p;return m?[h,g,m]:[h,g]})]}function Ks(e,o={}){return Xs(e,{...o,attributeNames:{...o.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Qs=e=>{for(let o in e)if(o.startsWith("aria-")||o==="role"||o==="title")return!0;return!1};import{createContext as Fd,useContext as Dd,useMemo as Mf,createElement as Pf}from"react";var Ed=Fd({});var Js=()=>Dd(Ed);var Ys=qd(({color:e,size:o,width:t,height:a,strokeWidth:r,absoluteStrokeWidth:s,nonScalingStroke:l,className:n="",children:i,iconNode:u=[],icon:d={node:u,aliases:[],size:24},...c},f)=>{let{size:h=24,strokeWidth:p=2,absoluteStrokeWidth:m=!1,nonScalingStroke:g=!1,color:L="currentColor",className:C=""}=Js()??{},I=!!i||Qs(c),[A,b,F=[]]=Ks(d,{color:e??L,width:t??o??h,height:a??o??h,strokeWidth:r??p,absoluteStrokeWidth:s??m,nonScalingStroke:l??g,className:Ra(C,n),hasA11yProp:I,attributes:c});return Zs(A,{ref:f,...b},[...F.map(([M,O])=>Zs(M,O)),...Array.isArray(i)?i:[i]])});function k(e,o=[],t=[]){let a=typeof e=="string"?Ws(e,o,t):e,r=Bd(({className:s,...l},n)=>Ud(Ys,{ref:n,icon:a,className:s,...l}));return a.name&&(r.displayName=$s(a.name)),r}var en={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};en.node;var Ta=k(en);var tn={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};tn.node;var Na=k(tn);var an={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};an.node;var Fa=k(an);var on={name:"at-sign",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]};on.node;var Da=k(on);var rn={name:"award",size:24,node:[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]};rn.node;var Ea=k(rn);var sn={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};sn.node;var qa=k(sn);var nn={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};nn.node;var Ba=k(nn);var ln={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};ln.node;var jt=k(ln);var dn={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};dn.node;var Ua=k(dn);var un={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};un.node;var Zt=k(un);var cn={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};cn.node;var Oa=k(cn);var fn={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};fn.node;var et=k(fn);var mn={name:"circle-exclamation-point",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle","circle-alert"]};mn.node;var ft=k(mn);var pn={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};pn.node;var za=k(pn);var hn={name:"crown",size:24,node:[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]};hn.node;var mt=k(hn);var gn={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};gn.node;var Dt=k(gn);var xn={name:"face-slightly-smiling",size:24,node:[["path",{d:"M15 10V9",key:"4dkmfx"}],["path",{d:"M16.472 15a6 6 0 01-8.943 0",key:"7qomzy"}],["path",{d:"M9 10V9",key:"1lazqi"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["smile"]};xn.node;var yt=k(xn);var Ln={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};Ln.node;var Yt=k(Ln);var In={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};In.node;var Ha=k(In);var Cn={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Cn.node;var Ga=k(Cn);var Sn={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Sn.node;var ua=k(Sn);var bn={name:"forward",size:24,node:[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]};bn.node;var ea=k(bn);var vn={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};vn.node;var _a=k(vn);var yn={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};yn.node;var ja=k(yn);var wn={name:"list-checks",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};wn.node;var Wa=k(wn);var kn={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};kn.node;var Q=k(kn);var Mn={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};Mn.node;var ta=k(Mn);var Pn={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};Pn.node;var Va=k(Pn);var An={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};An.node;var ca=k(An);var Rn={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};Rn.node;var $a=k(Rn);var Tn={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};Tn.node;var Xa=k(Tn);var Nn={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};Nn.node;var Ka=k(Nn);var Fn={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};Fn.node;var fa=k(Fn);var Dn={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};Dn.node;var Wt=k(Dn);var En={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};En.node;var Qa=k(En);var qn={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};qn.node;var aa=k(qn);var Bn={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};Bn.node;var oa=k(Bn);var Un={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};Un.node;var Et=k(Un);var On={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};On.node;var Ja=k(On);var zn={name:"shield-exclamation-point",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],aliases:["shield-alert"]};zn.node;var Vt=k(zn);var Hn={name:"shield-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]};Hn.node;var Za=k(Hn);var Gn={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};Gn.node;var pt=k(Gn);var _n={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};_n.node;var ra=k(_n);var jn={name:"sticker",size:24,node:[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]};jn.node;var Ya=k(jn);var Wn={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};Wn.node;var eo=k(Wn);var Vn={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};Vn.node;var ze=k(Vn);var $n={name:"triangle-exclamation-point",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle","triangle-alert"]};$n.node;var ht=k($n);var Xn={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};Xn.node;var to=k(Xn);var Kn={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};Kn.node;var ao=k(Kn);var Qn={name:"user-plus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};Qn.node;var oo=k(Qn);var Jn={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};Jn.node;var ro=k(Jn);var Zn={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};Zn.node;var gt=k(Zn);var Yn={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};Yn.node;var so=k(Yn);var el={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};el.node;var we=k(el);import{useBots as sf,usePageView as nf,useSidebar as lf}from"@luckylillia-dev/plugin-sdk/webui";import nt,{useEffect as fr,useCallback as At,useState as ef}from"react";import{useState as jr,useMemo as wt,useRef as iu}from"react";import{createPortal as du}from"react-dom";async function K(e,o={}){let t=await vt().fetch(e,o);if(!t.ok){let a=`HTTP error! status: ${t.status}`;try{a=(await t.json()).message||a}catch{}throw new Error(a)}return t.json()}var tl=null,al=null;function ol(e,o){tl=e,al=o}function Ze(){return tl}function lt(){return al}function Be(e,o=140){return`https://q1.qlogo.cn/g?b=qq&nk=${e}&s=${o}`}function no(e){return`https://p.qlogo.cn/gh/${e}/${e}/640/`}async function rl(){let e=await K("/api/webqq/rkey");if(!e.success)throw new Error(e.message||"\u83B7\u53D6 rkey \u5931\u8D25");return e.data}async function sl(e){let o=await K("/api/webqq/self",{signal:e});if(!o.success)throw new Error(o.message||"\u83B7\u53D6\u767B\u5F55\u4FE1\u606F\u5931\u8D25");return o.data}async function vr(){let e=await K("/api/webqq/friends");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u597D\u53CB\u5217\u8868\u5931\u8D25");let o=e.data,t=Object.values(o.categories).map(a=>{let r=o.friends.filter(s=>s.categoryId===a.categoryId).map(s=>({uid:s.uid,uin:s.uin.toString(),nickname:s.nick,remark:s.remark,avatar:Be(s.uin),online:s.status!==0}));return{categoryId:a.categoryId,categoryName:a.categoryName,categorySort:a.categorySortId,onlineCount:r.filter(s=>s.online).length,memberCount:a.categoryMemberCount,friends:r}});return t.sort((a,r)=>a.categorySort-r.categorySort),t}async function yr(){let e=await K("/api/webqq/groups");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u7FA4\u7EC4\u5217\u8868\u5931\u8D25");return(e.data||[]).map(t=>({groupCode:t.groupCode.toString(),groupName:t.groupName,remarkName:t.remarkName||"",avatar:no(t.groupCode),memberCount:t.memberCount,isTop:t.isTop||!1,msgMask:t.cmdUinMsgMask||1}))}async function wr(){return[]}async function Fo(e,o,t,a=20,r){let s=new URLSearchParams({chatType:String(e),peerId:o,limit:a.toString()});t&&s.append("beforeMsgSeq",String(t)),r&&s.append("afterMsgSeq",String(r));let l=await K(`/api/webqq/messages?${s}`);if(!l.success)throw new Error(l.message||"\u83B7\u53D6\u6D88\u606F\u5386\u53F2\u5931\u8D25");return l.data||{messages:[],hasMore:!1}}async function kr(e){let o=await K("/api/webqq/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.success)throw new Error(o.message||"\u53D1\u9001\u6D88\u606F\u5931\u8D25");return o.data||{msgId:""}}async function nl(e,o,t){let a=await K("/api/webqq/messages/forward",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({srcChatType:e.chatType,srcPeerId:e.peerId,msgSeq:o,targetChatType:t.chatType,targetPeerId:t.peerId})});if(!a.success)throw new Error(a.message||"\u8F6C\u53D1\u5931\u8D25")}async function ll(e,o,t){let a=await K("/api/webqq/messages/forward-multi",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({srcChatType:e.chatType,srcPeerId:e.peerId,msgSeqs:o,targetChatType:t.chatType,targetPeerId:t.peerId})});if(!a.success)throw new Error(a.message||"\u5408\u5E76\u8F6C\u53D1\u5931\u8D25")}async function il(e){let o=new FormData;o.append("image",e);let t=await K("/api/webqq/upload",{method:"POST",body:o});if(!t.success)throw new Error(t.message||"\u4E0A\u4F20\u56FE\u7247\u5931\u8D25");return t.data}async function dl(e){let o=await K("/api/webqq/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageUrl:e})});if(!o.success)throw new Error(o.message||"\u4E0A\u4F20\u56FE\u7247\u5931\u8D25");return o.data}async function Mr(e){let o=new FormData;o.append("file",e);let t=await K("/api/webqq/upload-file",{method:"POST",body:o});if(!t.success)throw new Error(t.message||"\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25");return t.data}async function ul(e){let o=await K(`/api/webqq/members?groupCode=${e}`);if(!o.success)throw new Error(o.message||"\u83B7\u53D6\u7FA4\u6210\u5458\u5931\u8D25");return o.data||[]}async function cl(e,o){if(!e)throw new Error("getVideoUrl: \u9700\u8981 fileUuid");let t=new URLSearchParams({fileUuid:e,isGroup:String(o??!1)}),a=await K(`/api/webqq/video-url?${t}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u89C6\u9891 URL \u5931\u8D25");return a.data||""}async function fl(e,o,t){let a=await K("/api/webqq/messages/recall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatType:e,peerUid:o,msgId:t})});if(!a.success)throw new Error(a.message||"\u64A4\u56DE\u5931\u8D25")}async function lo(e,o,t,a,r){let l=await K("/api/webqq/messages/emoji-like",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:o,msgSeq:t,emojiId:a,set:r})});if(!l.success)throw new Error(l.message||"\u8D34\u8868\u60C5\u5931\u8D25")}async function ml(e,o){let t=new URLSearchParams({groupCode:e,uid:o}),a=await K(`/api/webqq/group-member?${t}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u7FA4\u6210\u5458\u5931\u8D25");return a.data??null}async function Pr(e,o){let t=new URLSearchParams;e&&t.set("uid",e),o&&t.set("uin",o);let a=await K(`/api/webqq/user?${t}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u7528\u6237\u8BE6\u60C5\u5931\u8D25");return a.data}async function pl(e,o){let t=new URLSearchParams({uin:e});o&&t.set("groupCode",o);let a=await K(`/api/webqq/uid?${t}`);if(!a.success)throw new Error(a.message||"uin \u8F6C uid \u5931\u8D25");return a.data||""}async function hl(e){let o=new URLSearchParams({uid:e}),t=await K(`/api/webqq/uin?${o}`);if(!t.success)throw new Error(t.message||"uid \u8F6C uin \u5931\u8D25");return t.data||""}async function gl(e,o){try{if(o){let a=await ml(o,e);if(a)return a.cardName||a.nick||"\u672A\u77E5\u7528\u6237"}let t=await Pr(e);return t.remark||t.nick||"\u672A\u77E5\u7528\u6237"}catch{return"\u672A\u77E5\u7528\u6237"}}async function Ar(e,o,t){let s=await K(e===2?"/api/webqq/group/poke":"/api/webqq/friend/poke",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e===2?{groupCode:t,uin:o}:{uin:o})});if(!s.success)throw new Error(s.message||"\u6233\u4E00\u6233\u5931\u8D25")}async function xl(e,o,t,a){let r=await K("/api/webqq/messages/ptt-to-text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({msgId:e,chatType:o,peerUid:t})});if(!r.success)throw new Error(r.message||"\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");return r.data||""}async function Do(e,o,t=!1){let a=await K("/api/webqq/group/kick",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:o,refuseForever:t})});if(!a.success)throw new Error(a.message||"\u8E22\u51FA\u5931\u8D25")}async function Eo(e,o,t){let a=await K("/api/webqq/group/ban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:o,duration:t})});if(!a.success)throw new Error(a.message||"\u7981\u8A00\u5931\u8D25")}async function qo(e,o,t){let a=await K("/api/webqq/group/special-title",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:o,title:t})});if(!a.success)throw new Error(a.message||"\u8BBE\u7F6E\u5934\u8854\u5931\u8D25")}async function Ll(e,o,t){let a=await K("/api/webqq/group/member-role",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:o,isAdmin:t})});if(!a.success)throw new Error(a.message||"\u8BBE\u7F6E\u7BA1\u7406\u5458\u5931\u8D25")}async function Il(){let e=await K("/api/webqq/fav-emoji");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u6536\u85CF\u8868\u60C5\u5931\u8D25");return e.data?.emojiInfoList||[]}async function Cl(e){let o=await K("/api/webqq/fav-emoji/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({emojiIds:[e]})});if(!o.success)throw new Error(o.message||"\u5220\u9664\u6536\u85CF\u8868\u60C5\u5931\u8D25");return o.data}async function Sl(e){let o=await K("/api/webqq/fav-emoji/add-from-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})});if(!o.success)throw new Error(o.message||"\u6DFB\u52A0\u6536\u85CF\u8868\u60C5\u5931\u8D25");return o.data}function Od(e,o,t){let a=`/api/webqq/audio-proxy?fileUuid=${encodeURIComponent(e)}&isGroup=${o}`;return t&&(a+=`&filePath=${encodeURIComponent(t)}`),a}async function bl(e,o,t,a){let r=await vt().fetch(Od(e,o,t),{signal:a});if(!r.ok){let s="\u83B7\u53D6\u8BED\u97F3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";try{let l=await r.json();typeof l.message=="string"&&l.message&&(s=l.message)}catch{}throw new Error(s)}return r.blob()}async function vl(e){let o=await K("/api/webqq/group/quit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e})});if(!o.success)throw new Error(o.message||"\u9000\u7FA4\u5931\u8D25")}async function Rr(e,o="/"){let t=await K(`/api/webqq/group-files?groupCode=${encodeURIComponent(e)}&folderId=${encodeURIComponent(o)}`);if(!t.success)throw new Error(t.message||"\u83B7\u53D6\u7FA4\u6587\u4EF6\u5217\u8868\u5931\u8D25");return t.data||{files:[],folders:[]}}async function yl(e,o){let t=await K(`/api/webqq/group-file-url?groupCode=${encodeURIComponent(e)}&fileId=${encodeURIComponent(o)}`);if(!t.success)throw new Error(t.message||"\u83B7\u53D6\u4E0B\u8F7D\u94FE\u63A5\u5931\u8D25");return t.data.url}async function wl(e,o,t){let a=await K(`/api/webqq/private-file-url?peerUid=${encodeURIComponent(e)}&fileId=${encodeURIComponent(o)}&isSelfSend=${t}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u4E0B\u8F7D\u94FE\u63A5\u5931\u8D25");return a.data.url}async function Bo(e,o){let a=e.startsWith("blob:")||e.startsWith("data:")?await fetch(e):await vt().fetch(`/api/webqq/image-proxy?url=${encodeURIComponent(e)}`);if(!a.ok)throw new Error("\u4E0B\u8F7D\u56FE\u7247\u5931\u8D25");let r=await a.blob(),s=o||"image";if(!/\.[a-z0-9]+$/i.test(s)){let i=(r.type.split("/")[1]||"jpg").replace("jpeg","jpg");s=`${s}.${i}`}let l=URL.createObjectURL(r),n=document.createElement("a");n.href=l,n.download=s,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(l)}async function kl(e,o,t="/"){let{filePath:a,fileName:r}=await Mr(o),s=await K("/api/webqq/group-file/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,filePath:a,fileName:r,folderId:t})});if(!s.success)throw new Error(s.message||"\u4E0A\u4F20\u7FA4\u6587\u4EF6\u5931\u8D25");return s.data.fileId}async function Ml(e,o,t){let a=await K("/api/webqq/group-file/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,fileId:o,busId:t})});if(!a.success)throw new Error(a.message||"\u5220\u9664\u7FA4\u6587\u4EF6\u5931\u8D25")}async function Pl(e,o,t,a){let r=await K("/api/webqq/group-file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,fileId:o,parentFolderId:t,newName:a})});if(!r.success)throw new Error(r.message||"\u91CD\u547D\u540D\u7FA4\u6587\u4EF6\u5931\u8D25")}async function Al(e,o){let t=await K("/api/webqq/group-folder/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,folderName:o})});if(!t.success)throw new Error(t.message||"\u65B0\u5EFA\u6587\u4EF6\u5939\u5931\u8D25")}async function Rl(e,o){let t=await K("/api/webqq/group-folder/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,folderId:o})});if(!t.success)throw new Error(t.message||"\u5220\u9664\u6587\u4EF6\u5939\u5931\u8D25")}async function Tl(e,o,t){let a=await K("/api/webqq/group-folder/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,folderId:o,newName:t})});if(!a.success)throw new Error(a.message||"\u91CD\u547D\u540D\u6587\u4EF6\u5939\u5931\u8D25")}async function io(e,o,t){let a=e;if(!a&&o&&(a=await pl(o)),!a)throw new Error("\u65E0\u6CD5\u83B7\u53D6\u7528\u6237\u4FE1\u606F");let r=await Pr(a),s=o||r.uin||await hl(a),l={uid:a,uin:s||"",nickname:r.nick||"",remark:r.remark||"",signature:r.bio||"",sex:r.gender??0,birthday:r.birthdayYear?`${r.birthdayYear}-${r.birthdayMonth}-${r.birthdayDay}`:"",location:[r.country,r.city].filter(Boolean).join(" ")||"",qid:r.qid||"",level:r.level||0,regTime:r.registerTime||void 0,avatar:Be(s||"")};if(t)try{let n=await ml(t,a);n&&(l.groupCard=n.cardName||"",l.groupRole=n.role===4?"owner":n.role===3?"admin":"member",l.groupTitle=n.specialTitle||"",l.groupLevel=n.level||0,l.joinTime=n.joinedAt,l.lastSpeakTime=n.lastSpokeAt)}catch{}return l}function Nl(e,o,t){let a=vt().authUrl("/api/webqq/events"),r,s=0,l=null,n=!1,i=()=>(r=new EventSource(a),r.addEventListener("message",d=>{try{let c=JSON.parse(d.data);e(c)}catch(c){console.error("\u89E3\u6790 SSE \u6D88\u606F\u5931\u8D25:",c)}}),r.addEventListener("connected",()=>{console.log("[SSE] \u8FDE\u63A5\u5DF2\u5EFA\u7ACB"),s=0}),r.onopen=()=>{console.log("[SSE] \u8FDE\u63A5\u6253\u5F00"),s>0&&(console.log("[SSE] \u91CD\u8FDE\u6210\u529F"),t?.()),s=0},r.onerror=d=>{if(console.error("[SSE] \u8FDE\u63A5\u9519\u8BEF:",d),n)return;r.close();let c=Math.min(1e3*Math.pow(2,s),3e4);s++,console.log(`[SSE] \u5C06\u5728 ${c}ms \u540E\u5C1D\u8BD5\u7B2C ${s} \u6B21\u91CD\u8FDE...`),l=setTimeout(()=>{n||(console.log("[SSE] \u6B63\u5728\u91CD\u8FDE..."),i())},c),o?.(d)},r);return r=i(),{close:()=>{n=!0,l&&(clearTimeout(l),l=null),r.close(),console.log("[SSE] \u8FDE\u63A5\u5DF2\u5173\u95ED")},get readyState(){return r.readyState},get url(){return r.url},addEventListener:r.addEventListener.bind(r),removeEventListener:r.removeEventListener.bind(r),dispatchEvent:r.dispatchEvent.bind(r),onerror:r.onerror,onmessage:r.onmessage,onopen:r.onopen,CONNECTING:EventSource.CONNECTING,OPEN:EventSource.OPEN,CLOSED:EventSource.CLOSED,withCredentials:r.withCredentials}}async function Fl(e){let o=await K(`/api/webqq/forward-msg?resId=${encodeURIComponent(e)}`);if(!o.success)throw new Error(o.message||"\u83B7\u53D6\u5408\u5E76\u8F6C\u53D1\u6D88\u606F\u5931\u8D25");return o.data||[]}function Dl(e,o){if(!o.trim())return e;let t=o.toLowerCase();return e.filter(a=>a.groupName.toLowerCase().includes(t)||a.groupCode.includes(o))}function El(e,o){if(!o.trim())return e;let t=o.toLowerCase();return e.filter(a=>a.nickname.toLowerCase().includes(t)||a.card.toLowerCase().includes(t)||a.uin.includes(o))}function ql(e){let o=e.toLowerCase().split(".").pop()||"";return["jpg","jpeg","png","gif"].includes(o)}async function Bl(e){let o=await K(`/api/webqq/group-detail?groupCode=${e}`);if(!o.success)throw new Error(o.message||"\u83B7\u53D6\u7FA4\u8BE6\u60C5\u5931\u8D25");let t=o.data,a="",r="";if(t.ownerUid)try{r=await hl(t.ownerUid),a=(await Pr(t.ownerUid)).nick||r||""}catch{}return{groupCode:String(t.groupCode),groupName:t.groupName,remarkName:t.remark||"",avatar:no(String(t.groupCode)),memberCount:t.memberCount??0,maxMemberCount:t.maxMemberCount,ownerUin:r,ownerName:a,createTime:t.createdAt||void 0,description:t.description||"",announcement:t.announcementPreview||""}}function uo(e){let o=new Date(e),t=new Date;if(o.toDateString()===t.toDateString())return o.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});let r=new Date(t);return r.setDate(r.getDate()-1),o.toDateString()===r.toDateString()?`\u6628\u5929 ${o.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}`:o.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}async function Ul(e){let o=await K("/api/webqq/friend/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uid:e})});if(!o.success)throw new Error(o.message||"\u5220\u9664\u597D\u53CB\u5931\u8D25")}async function Ol(e,o,t){if(e===2){let a=await K("/api/webqq/group/set-top",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:o,isTop:t})});if(!a.success)throw new Error(a.message||"\u8BBE\u7F6E\u7F6E\u9876\u5931\u8D25")}else{let a=await pl(o);if(!a)throw new Error("\u65E0\u6CD5\u83B7\u53D6\u7528\u6237\u4FE1\u606F");let r=await K("/api/webqq/friend/set-top",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uid:a,isTop:t})});if(!r.success)throw new Error(r.message||"\u8BBE\u7F6E\u7F6E\u9876\u5931\u8D25")}}async function zl(e,o){let t=await K("/api/webqq/group/msg-mask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,msgMask:o})});if(!t.success)throw new Error(t.message||"\u8BBE\u7F6E\u6D88\u606F\u63A5\u6536\u65B9\u5F0F\u5931\u8D25")}async function Hl(){let e=await K("/api/webqq/notifications/group");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u7FA4\u901A\u77E5\u5931\u8D25");return e.data||[]}async function Gl(e,o,t){let a=await K("/api/webqq/notifications/group/handle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flag:e,action:o,reason:t})});if(!a.success)throw new Error(a.message||"\u5904\u7406\u7FA4\u901A\u77E5\u5931\u8D25")}async function Tr(e,o){let t=await K("/api/webqq/notifications/friend/handle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flag:e,action:o})});if(!t.success)throw new Error(t.message||"\u5904\u7406\u597D\u53CB\u7533\u8BF7\u5931\u8D25")}async function _l(){let e=await K("/api/webqq/notifications/friend");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u597D\u53CB\u7533\u8BF7\u5931\u8D25");return e.data||[]}async function jl(){let e=await K("/api/webqq/notifications/friend/doubt");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u88AB\u8FC7\u6EE4\u597D\u53CB\u7533\u8BF7\u5931\u8D25");return e.data||[]}async function Wl(e){let o=await K("/api/webqq/notifications/friend/doubt/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uid:e})});if(!o.success)throw new Error(o.message||"\u5904\u7406\u88AB\u8FC7\u6EE4\u597D\u53CB\u7533\u8BF7\u5931\u8D25")}var Vl=e=>{let o,t=new Set,a=(u,d)=>{let c=typeof u=="function"?u(o):u;if(!Object.is(c,o)){let f=o;o=d??(typeof c!="object"||c===null)?c:Object.assign({},o,c),t.forEach(h=>h(o,f))}},r=()=>o,n={setState:a,getState:r,getInitialState:()=>i,subscribe:u=>(t.add(u),()=>t.delete(u))},i=o=e(a,r,n);return n},$l=(e=>e?Vl(e):Vl);import Nr from"react";var zd=e=>e;function Hd(e,o=zd){let t=Nr.useSyncExternalStore(e.subscribe,Nr.useCallback(()=>o(e.getState()),[e,o]),()=>o(e.getInitialState()));return Nr.useDebugValue(t),t}var Xl=e=>{let o=$l(e),t=a=>Hd(o,a);return Object.assign(t,o),t},Uo=(e=>e?Xl(e):Xl);function Fr(e,o){let t;try{t=e()}catch{return}return{getItem:r=>{var s;let l=i=>i===null?null:JSON.parse(i,o?.reviver),n=(s=t.getItem(r))!=null?s:null;return Dr(n)?n.then(l):l(n)},setItem:(r,s)=>t.setItem(r,JSON.stringify(s,o?.replacer)),removeItem:r=>t.removeItem(r)}}var Dr=e=>typeof e?.then=="function",Gd=e=>({then(o){return o?Er(o)(e):this}}),Er=e=>o=>{try{let t=e(o);return Dr(t)?t:Gd(t)}catch(t){return{then(a,r){return r?Er(r)(t):this}}}},_d=(e,o)=>(t,a,r)=>{let s={storage:Fr(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,L)=>({...L,...g}),...o},l=!1,n=0,i=new Set,u=new Set,d=s.storage;if(!d)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),t(...g)},a,r);let c=()=>{let g=s.partialize({...a()});return d.setItem(s.name,{state:g,version:s.version})},f=r.setState;r.setState=(...g)=>(f(...g),c());let h=e((...g)=>(t(...g),c()),a,r);r.getInitialState=()=>h;let p,m=()=>{var g,L;if(!d)return;let C=++n;l=!1,i.forEach(A=>{var b;return A((b=a())!=null?b:h)});let I=((L=s.onRehydrateStorage)==null?void 0:L.call(s,(g=a())!=null?g:h))||void 0;return Er(d.getItem.bind(d))(s.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==s.version){if(s.migrate){let b=s.migrate(A.state,A.version);return Dr(b)?b.then(F=>[!0,F]):[!0,b]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var b;if(C!==n)return;let[F,M]=A;if(p=s.merge(M,(b=a())!=null?b:h),t(p,!0),F)return c()}).then(()=>{C===n&&(I?.(a(),void 0),p=a(),l=!0,u.forEach(A=>A(p)))}).then(()=>{},A=>{C===n&&I?.(void 0,A)})};return r.persist={setOptions:g=>{s={...s,...g},g.storage&&(d=g.storage)},clearStorage:()=>{++n,d?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>{try{return Promise.resolve(m())}catch(g){return Promise.reject(g)}},hasHydrated:()=>l,onHydrate:g=>(i.add(g),()=>{i.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},s.skipHydration||m(),p||h},Kl=_d;var Yl="webqq-storage",qt="",$e=0,jd=Fr(()=>({getItem:e=>qt?localStorage.getItem(`${qt}-${e}`):null,setItem:(e,o)=>{qt&&localStorage.setItem(`${qt}-${e}`,o)},removeItem:e=>{qt&&localStorage.removeItem(`${qt}-${e}`)}})),Wd=3600*1e3,Ql=1800*1e3,co=new Map,qr=new Set,Br=new Set,Oo=()=>{qr=new Set,Br=new Set},ma=(e,o)=>qr.has(`${e}_${o}`),ei=(e,o)=>{qr.add(`${e}_${o}`)};var ti=e=>Br.has(e),ai=e=>{Br.add(e)},Jl={friendCategories:[],groups:[],recentChats:[],groupLastTimeMap:{},groupLastMessageMap:{},expandedCategories:[],membersCache:{},showMemberPanel:!1,scrollPositions:{},contactsCacheTimestamp:0,unreadCounts:{},activeTab:"recent",currentChat:null},Zl={contactsLoading:!1,contactsError:null,groupAssistantMode:"normal",notifications:[],notificationUnreadCount:0},re=Uo()(Kl((e,o)=>({...Jl,...Zl,setFriendCategories:t=>e({friendCategories:t}),setGroups:t=>e({groups:t}),setRecentChats:t=>e({recentChats:t}),setContactsLoading:t=>e({contactsLoading:t}),setContactsError:t=>e({contactsError:t}),setCurrentChat:t=>e({currentChat:t}),setActiveTab:t=>e({activeTab:t}),setGroupAssistantMode:t=>e({groupAssistantMode:t}),enterGroupAssistant:()=>e({groupAssistantMode:"assistant"}),exitGroupAssistant:()=>e({groupAssistantMode:"normal"}),setUnreadCount:(t,a)=>e(r=>({unreadCounts:{...r.unreadCounts,[t]:a}})),incrementUnreadCount:t=>e(a=>({unreadCounts:{...a.unreadCounts,[t]:(a.unreadCounts[t]||0)+1}})),clearUnreadCount:t=>e(a=>{let{[t]:r,...s}=a.unreadCounts;return{unreadCounts:s}}),initUnreadCounts:t=>{let a={};t.forEach(r=>{r.unreadCount>0&&(a[`${r.chatType}_${r.peerId}`]=r.unreadCount)}),e({unreadCounts:a})},toggleCategory:t=>e(a=>{let r=new Set(a.expandedCategories);return r.has(t)?r.delete(t):r.add(t),{expandedCategories:Array.from(r)}}),setExpandedCategories:t=>e({expandedCategories:t}),getCachedMembers:t=>{let r=o().membersCache[t];return r&&Date.now()-r.timestamp<Ql?r.members:null},setCachedMembers:(t,a)=>e(r=>{let s=Date.now(),l={};for(let[n,i]of Object.entries(r.membersCache))s-i.timestamp<Ql&&(l[n]=i);return{membersCache:{...l,[t]:{members:a,timestamp:s}}}}),fetchGroupMembers:async(t,a=!1)=>{let r=$e,s=o();if(console.log("[Store] fetchGroupMembers called:",t,"forceRefresh:",a),!a){let i=s.getCachedMembers(t);if(i)return console.log("[Store] Cache hit, returning cached members"),i}let l=co.get(t);if(l)return console.log("[Store] Already loading, returning existing promise"),l;console.log("[Store] Fetching from API");let n=(async()=>{let i=await ul(t);return r!==$e?[]:(console.log("[Store] API success, caching members"),o().setCachedMembers(t,i),i)})().catch(i=>{if(r!==$e)return[];throw console.log("[Store] API error:",i.message),i}).finally(()=>{co.get(t)===n&&co.delete(t)});return co.set(t,n),n},setShowMemberPanel:t=>e({showMemberPanel:t}),addNotification:t=>e(a=>a.notifications.some(s=>s.type==="group-notify"&&t.type==="group-notify"||s.type==="friend-request"&&t.type==="friend-request"?s.data.flag===t.data.flag:!1)?{notifications:a.notifications.map(s=>s.type===t.type&&(s.type==="group-notify"&&t.type==="group-notify"&&s.data.flag===t.data.flag||s.type==="friend-request"&&t.type==="friend-request"&&s.data.flag===t.data.flag)?t:s)}:{notifications:[t,...a.notifications].slice(0,200),notificationUnreadCount:a.notificationUnreadCount+1}),setNotifications:t=>e({notifications:t}),clearNotificationUnread:()=>e({notificationUnreadCount:0}),updateNotificationStatus:(t,a,r)=>e(s=>({notifications:s.notifications.map(l=>{if(l.type===t){if(l.type==="group-notify"&&l.data.flag===a)return{...l,data:{...l.data,status:r}};if(l.type==="friend-request"&&l.data.flag===a)return{...l,data:{...l.data,isDecide:!0}}}return l})})),loadGroupNotifications:async()=>{let t=$e;try{let[a,r,s]=await Promise.all([Hl().catch(()=>[]),_l().catch(()=>[]),jl().catch(()=>[])]);if(t!==$e)return;let l=a.map(f=>({type:"group-notify",data:f,time:f.actionTime?parseInt(f.actionTime)*1e3:parseInt(f.seq)/1e3})),n=r.map(f=>({type:"friend-request",data:f,time:f.reqTime?parseInt(f.reqTime)*1e3:Date.now()})),i=s.map(f=>({type:"doubt-buddy",data:f,time:f.reqTime?parseInt(f.reqTime)*1e3:Date.now()})),d=o().notifications.filter(f=>f.type!=="group-notify"&&f.type!=="friend-request"&&f.type!=="doubt-buddy"),c=[...l,...n,...i,...d].sort((f,h)=>h.time-f.time).slice(0,200);e({notifications:c})}catch(a){if(t!==$e)return;console.error("\u52A0\u8F7D\u901A\u77E5\u5931\u8D25:",a)}},getScrollPosition:(t,a)=>{let r=o(),s=`${t}_${a}`;return r.scrollPositions[s]||null},setScrollPosition:(t,a,r)=>e(s=>({scrollPositions:{...s.scrollPositions,[`${t}_${a}`]:r}})),clearScrollPosition:(t,a)=>e(r=>{let{[`${t}_${a}`]:s,...l}=r.scrollPositions;return{scrollPositions:l}}),isContactsCacheValid:()=>{let t=o();return t.contactsCacheTimestamp>0&&Date.now()-t.contactsCacheTimestamp<Wd&&(t.friendCategories.length>0||t.groups.length>0)},loadContacts:async()=>{let t=$e,a=o();if(a.isContactsCacheValid()){a.refreshContacts();return}e({contactsLoading:!0,contactsError:null});try{let[r,s,l]=await Promise.all([vr(),yr(),wr()]);if(t!==$e)return;let n=l.filter(p=>p.peerId&&p.peerId!=="0"&&p.peerId!==""),i=new Map;a.recentChats.forEach(p=>{p.peerId&&p.peerId!=="0"&&p.peerId!==""&&i.set(`${p.chatType}_${p.peerId}`,p)}),n.forEach(p=>{let m=`${p.chatType}_${p.peerId}`,g=i.get(m);g?(p.lastTime>g.lastTime||p.lastTime===g.lastTime&&!g.lastMessage&&p.lastMessage)&&i.set(m,p):i.set(m,p)});let u=Array.from(i.values()).sort((p,m)=>m.lastTime-p.lastTime),d={},c={};n.forEach(p=>{p.chatType===2&&(d[p.peerId]=p.lastTime,p.lastMessage&&(c[p.peerId]=p.lastMessage))}),e({friendCategories:r,groups:s,recentChats:u,groupLastTimeMap:d,groupLastMessageMap:c,contactsCacheTimestamp:Date.now(),contactsLoading:!1});let h={...o().unreadCounts};n.forEach(p=>{let m=`${p.chatType}_${p.peerId}`;!(m in h)&&p.unreadCount>0&&(h[m]=p.unreadCount)}),e({unreadCounts:h})}catch(r){if(t!==$e)return;e({contactsError:r.message||"\u52A0\u8F7D\u8054\u7CFB\u4EBA\u5931\u8D25",contactsLoading:!1})}},refreshContacts:async()=>{let t=$e;try{let[a,r,s]=await Promise.all([vr(),yr(),wr()]);if(t!==$e)return;let l=s.filter(p=>p.peerId&&p.peerId!=="0"&&p.peerId!==""),n=o(),i=new Map;n.recentChats.forEach(p=>{p.peerId&&p.peerId!=="0"&&p.peerId!==""&&i.set(`${p.chatType}_${p.peerId}`,p)}),l.forEach(p=>{let m=`${p.chatType}_${p.peerId}`,g=i.get(m);g?(p.lastTime>g.lastTime||p.lastTime===g.lastTime&&!g.lastMessage&&p.lastMessage)&&i.set(m,p):i.set(m,p)});let u=Array.from(i.values()).sort((p,m)=>m.lastTime-p.lastTime),d={...n.groupLastTimeMap},c={...n.groupLastMessageMap};l.forEach(p=>{p.chatType===2&&(d[p.peerId]=p.lastTime,p.lastMessage&&(c[p.peerId]=p.lastMessage))}),e({friendCategories:a,groups:r,recentChats:u,groupLastTimeMap:d,groupLastMessageMap:c,contactsCacheTimestamp:Date.now()});let h={...o().unreadCounts};l.forEach(p=>{let m=`${p.chatType}_${p.peerId}`;!(m in h)&&p.unreadCount>0&&(h[m]=p.unreadCount)}),e({unreadCounts:h})}catch(a){if(t!==$e)return;console.error("Failed to refresh contacts:",a)}},updateRecentChat:(t,a,r,s,l,n)=>e(i=>{let u=i.recentChats.filter((m,g,L)=>L.findIndex(C=>C.chatType===m.chatType&&C.peerId===m.peerId)===g),d=u.find(m=>m.chatType===t&&m.peerId===a),c=i.currentChat,f=c?.chatType===t&&c?.peerId===a,h=t===2?{...i.groupLastTimeMap,[a]:s}:i.groupLastTimeMap,p=t===2?{...i.groupLastMessageMap,[a]:r||"[\u6D88\u606F]"}:i.groupLastMessageMap;if(d){let m=u.filter(I=>!(I.chatType===t&&I.peerId===a)),g={...d,lastMessage:r,lastTime:s,unreadCount:f?0:d.unreadCount+1};if(d.pinned){let I=m.filter(b=>b.pinned),A=m.filter(b=>!b.pinned);return{recentChats:[g,...I,...A],groupLastTimeMap:h,groupLastMessageMap:p}}let L=m.filter(I=>I.pinned),C=m.filter(I=>!I.pinned);return{recentChats:[...L,g,...C],groupLastTimeMap:h,groupLastMessageMap:p}}else{let m=l||a,g=n||"";if(t===1||t===100){for(let C of i.friendCategories){let I=C.friends.find(A=>A.uin===a);if(I){m=I.remark||I.nickname,g=I.avatar;break}}g||(g=Be(a))}else if(t===2){let C=i.groups.find(I=>I.groupCode===a);if(C){if(C.msgMask===2)return{groupLastTimeMap:h,groupLastMessageMap:p};m=C.groupName,g=C.avatar}g||(g=`https://p.qlogo.cn/gh/${a}/${a}/640/`)}return{recentChats:[{chatType:t,peerId:a,peerName:m,peerAvatar:g,lastMessage:r,lastTime:s,unreadCount:f?0:1},...u],groupLastTimeMap:h,groupLastMessageMap:p}}}),togglePinChat:async(t,a)=>{let r=$e,l=o().recentChats.find(i=>i.chatType===t&&i.peerId===a);if(!l)return;let n=!l.pinned;try{if(await Ol(t,a,n),r!==$e)return;e(i=>{let u=i.recentChats.map(d=>d.chatType===t&&d.peerId===a?{...d,pinned:n}:d);return u.sort((d,c)=>d.pinned&&!c.pinned?-1:!d.pinned&&c.pinned?1:c.lastTime-d.lastTime),{recentChats:u}})}catch(i){if(r!==$e)return;throw console.error("\u8BBE\u7F6E\u7F6E\u9876\u5931\u8D25:",i),i}},removeRecentChat:(t,a)=>e(r=>({recentChats:r.recentChats.filter(s=>!(s.chatType===t&&s.peerId===a))})),removeFriend:t=>e(a=>({friendCategories:a.friendCategories.map(s=>({...s,friends:s.friends.filter(l=>l.uid!==t),memberCount:s.friends.filter(l=>l.uid!==t).length}))}))}),{name:Yl,storage:jd,skipHydration:!0,partialize:e=>({_uin:qt,friendCategories:e.friendCategories,groups:e.groups,recentChats:e.recentChats,groupLastTimeMap:e.groupLastTimeMap,groupLastMessageMap:e.groupLastMessageMap,expandedCategories:e.expandedCategories,membersCache:e.membersCache,showMemberPanel:e.showMemberPanel,scrollPositions:e.scrollPositions,contactsCacheTimestamp:e.contactsCacheTimestamp,unreadCounts:e.unreadCounts,activeTab:e.activeTab,currentChat:e.currentChat}),merge:(e,o)=>{let{_uin:t,...a}=e??{};return{...o,...Jl,...a,...Zl}},onRehydrateStorage:()=>e=>{if(e&&e.recentChats){let o=new Set;e.recentChats=e.recentChats.filter(t=>{if(!t.peerId||t.peerId==="0"||t.peerId==="")return!1;let a=`${t.chatType}_${t.peerId}`;return o.has(a)?!1:(o.add(a),!0)})}}}));function oi(e){if(!e||e===qt)return;qt=e,$e++,co.clear(),Oo();let o=`${e}-${Yl}`;try{let t=localStorage.getItem(o);t&&JSON.parse(t)?.state?._uin!==e&&localStorage.removeItem(o)}catch{localStorage.removeItem(o)}re.persist.rehydrate()}import{useState as zo,useRef as Ur,useEffect as Or}from"react";import{createPortal as ri}from"react-dom";import{Fragment as li,jsx as ge,jsxs as Ue}from"react/jsx-runtime";function Ho(e,o,t){let[a,r]=zo({left:-9999,top:-9999,ready:!1});return Or(()=>{r({left:-9999,top:-9999,ready:!1});let s=requestAnimationFrame(()=>{if(!t.current){r({left:e,top:o,ready:!0});return}let l=t.current.getBoundingClientRect(),n=10,i=e,u=o;e+l.width>window.innerWidth-n&&(i=e-l.width),i<n&&(i=n),o+l.height>window.innerHeight-n&&(u=o-l.height),u<n&&(u=n),r({left:i,top:u,ready:!0})});return()=>cancelAnimationFrame(s)},[e,o]),a}var zr=({groupCode:e,onClose:o})=>{let{groups:t,setGroups:a}=re(),[r,s]=zo(!1),l=Ur(null),n=async u=>{try{await zl(e,u);let d=t.map(c=>c.groupCode===e?{...c,msgMask:u}:c);a(d)}catch(d){console.error("\u8BBE\u7F6E\u6D88\u606F\u63A5\u6536\u65B9\u5F0F\u5931\u8D25:",d),alert(`\u8BBE\u7F6E\u5931\u8D25: ${d.message||"\u672A\u77E5\u9519\u8BEF"}`)}o()},i=t.find(u=>u.groupCode===e)?.msgMask;return Ue("div",{className:"relative",children:[Ue("button",{onMouseEnter:()=>s(!0),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(jt,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u6D88\u606F\u63A5\u6536\u65B9\u5F0F"}),ge(et,{size:14,className:"flex-shrink-0"})]}),r&&Ue("div",{ref:l,className:"absolute left-full top-0 ml-1 bg-popup r-control glass-pop origin-top-left py-1 min-w-[140px] z-[10000]",onMouseLeave:()=>s(!1),children:[Ue("button",{onClick:()=>n(1),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(jt,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u63A5\u6536\u5E76\u63D0\u9192"}),i===1&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]}),Ue("button",{onClick:()=>n(4),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(Ba,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u63A5\u6536\u4F46\u4E0D\u63D0\u9192"}),i===4&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]}),Ue("button",{onClick:()=>n(2),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(Ta,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u6536\u8FDB\u7FA4\u52A9\u624B"}),i===2&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]}),Ue("button",{onClick:()=>n(3),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(qa,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u5C4F\u853D\u7FA4\u6D88\u606F"}),i===3&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]})]})]})},si=({friend:e,isSelected:o,onClick:t})=>{let{togglePinChat:a}=re(),[r,s]=zo(null),l=Ur(null),n=Ho(r?.x||0,r?.y||0,l),i=c=>{c.preventDefault(),c.stopPropagation(),s({x:c.clientX,y:c.clientY})},u=()=>s(null),d=async()=>{try{await a(1,e.uin)}catch(c){console.error("\u7F6E\u9876\u5931\u8D25:",c),alert(`\u7F6E\u9876\u5931\u8D25: ${c.message||"\u672A\u77E5\u9519\u8BEF"}`)}u()};return Or(()=>{if(!r)return;let c=()=>u();return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[r]),Ue(li,{children:[Ue("div",{onClick:t,onContextMenu:i,className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors ${o?"bg-pink-500/20":"hover:bg-theme-item-hover"}`,children:[Ue("div",{className:"relative flex-shrink-0",children:[ge("img",{src:e.avatar,alt:e.nickname,className:"w-10 h-10 rounded-full object-cover",onError:c=>{c.currentTarget.src=Be(e.uin)}}),e.online&&ge("div",{className:"absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white dark:border-neutral-800"})]}),Ue("div",{className:"flex-1 min-w-0",children:[ge("div",{className:"text-sm font-medium text-theme truncate",children:e.remark||e.nickname}),e.remark&&ge("div",{className:"text-xs text-theme-hint truncate",children:e.nickname})]})]}),r&&ri(ge("div",{ref:l,className:"fixed glass glass-thick r-control glass-pop origin-top-left py-1 min-w-[120px] z-[9999]",style:{left:`${n.left}px`,top:`${n.top}px`,opacity:n.ready?1:0,pointerEvents:n.ready?"auto":"none"},onClick:c=>c.stopPropagation(),children:Ue("button",{onClick:d,className:"w-full px-3 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center gap-2 text-theme",children:[ge(Wt,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:e.topTime&&e.topTime!=="0"?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"})]})}),document.body)]})},ni=({group:e,isSelected:o,onClick:t,showPinnedStyle:a=!1,unreadCount:r=0,subtitle:s})=>{let{togglePinChat:l}=re(),[n,i]=zo(null),u=Ur(null),d=Ho(n?.x||0,n?.y||0,u),c=p=>{p.preventDefault(),p.stopPropagation(),i({x:p.clientX,y:p.clientY})},f=()=>{i(null)},h=async()=>{try{await l(2,e.groupCode)}catch(p){console.error("\u7F6E\u9876\u5931\u8D25:",p),alert(`\u7F6E\u9876\u5931\u8D25: ${p.message||"\u672A\u77E5\u9519\u8BEF"}`)}f()};return Or(()=>{if(!n)return;let p=()=>f();return document.addEventListener("click",p),()=>document.removeEventListener("click",p)},[n]),Ue(li,{children:[Ue("div",{onClick:t,onContextMenu:c,className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors ${o?"bg-pink-500/20":a&&e.isTop?"bg-theme-item-hover":"hover:bg-theme-item-hover"}`,children:[Ue("div",{className:"relative flex-shrink-0",children:[ge("img",{src:e.avatar,alt:e.groupName,className:"w-10 h-10 rounded-full object-cover",onError:p=>{p.currentTarget.src=`https://p.qlogo.cn/gh/${e.groupCode}/${e.groupCode}/640/`}}),r>0&&ge("div",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-xs font-medium rounded-full flex items-center justify-center px-1",children:r})]}),Ue("div",{className:"flex-1 min-w-0",children:[ge("div",{className:"text-sm font-medium text-theme truncate",children:e.groupName}),ge("div",{className:"text-xs text-theme-hint truncate",children:s||`${e.memberCount} \u4EBA`})]})]}),n&&ri(Ue("div",{ref:u,className:"fixed glass glass-thick r-control glass-pop origin-top-left py-1 min-w-[160px] z-[9999]",style:{left:`${d.left}px`,top:`${d.top}px`,opacity:d.ready?1:0,pointerEvents:d.ready?"auto":"none"},onClick:p=>p.stopPropagation(),children:[Ue("button",{onClick:h,className:"w-full px-3 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center gap-2 text-theme",children:[ge(Wt,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:e.isTop?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"})]}),ge(zr,{groupCode:e.groupCode,onClose:f})]}),document.body)]})};import{useState as xt,useEffect as Zd}from"react";import{useEffect as Xd,useRef as Kd}from"react";import{createPortal as Qd}from"react-dom";var Jd=({children:e})=>{let o=Kd(null);return o.current||(o.current=document.createElement("div")),Xd(()=>{let t=o.current;return document.body.appendChild(t),()=>{document.body.removeChild(t)}},[]),Qd(e,o.current)},Hr=Jd;import{jsx as V,jsxs as se}from"react/jsx-runtime";function Go(e){if(!e||e<=0)return"";let o=new Date(e),t=new Date;return o.toDateString()===t.toDateString()?o.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):o.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Yd(e){let o=e.user1.nickName||e.user1.uin||"\u672A\u77E5\u7528\u6237",t=e.user2.nickName||e.user2.uin||"";switch(e.notifyType){case 7:return`${o} \u7533\u8BF7\u52A0\u5165\u7FA4`;case 1:return`${t} \u9080\u8BF7\u4F60\u52A0\u5165\u7FA4`;case 5:return`${t} \u9080\u8BF7 ${o} \u52A0\u5165\u7FA4`;case 4:return`${o} \u5DF2\u52A0\u5165\u7FA4`;case 6:return`\u7BA1\u7406\u5458\u5DF2\u540C\u610F ${o} \u52A0\u5165\u7FA4`;case 2:return`${o} \u62D2\u7EDD\u4E86\u9080\u8BF7`;case 3:return`\u7BA1\u7406\u5458\u62D2\u7EDD\u4E86 ${o} \u7684\u52A0\u7FA4\u8BF7\u6C42`;case 8:return`${o} \u88AB\u8BBE\u4E3A\u7BA1\u7406\u5458`;case 9:return`${o} \u88AB ${t} \u79FB\u51FA\u7FA4`;case 10:return`\u4F60\u88AB ${t} \u79FB\u51FA\u7FA4`;case 11:return`${o} \u9000\u51FA\u4E86\u7FA4`;case 12:return"\u4F60\u88AB\u53D6\u6D88\u4E86\u7BA1\u7406\u5458";case 13:return`${o} \u88AB\u53D6\u6D88\u4E86\u7BA1\u7406\u5458`;case 14:return`\u7FA4\u4E3B\u5DF2\u8F6C\u8BA9\u7ED9 ${t}`;case 15:return`${o} \u5C06\u7FA4\u4E3B\u8F6C\u8BA9\u7ED9 ${t}`;default:return"\u7FA4\u901A\u77E5"}}function ii(e){return e.status===1&&(e.notifyType===7||e.notifyType===1||e.notifyType===5)}function eu(e){switch(e.status){case 2:return"\u5DF2\u540C\u610F";case 3:return"\u5DF2\u62D2\u7EDD";case 4:return"\u5DF2\u5FFD\u7565";default:return null}}var Gr="flex items-center gap-1 px-3 py-1 text-xs text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30 rounded-md transition-colors disabled:opacity-50",_r="flex items-center gap-1 px-3 py-1 text-xs text-theme-secondary hover:bg-neutral-100 dark:hover:bg-neutral-700/50 rounded-md transition-colors disabled:opacity-50",tu="flex items-center gap-1 px-3 py-1 text-xs text-red-500 hover:bg-red-50 dark:hover:bg-red-900/30 rounded-md transition-colors disabled:opacity-50",au="px-3 py-1 text-xs text-theme-muted hover:text-theme hover:bg-theme-item rounded-md transition-colors",ou=({item:e,time:o})=>{let[t,a]=xt(null),[r,s]=xt(!1),[l,n]=xt(""),i=re(h=>h.updateNotificationStatus),u=async(h,p)=>{a(h);try{await Gl(e.flag,h,p),i("group-notify",e.flag,h==="approve"?2:3),T(h==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD","success"),s(!1)}catch(m){T(m.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{a(null)}},d=eu(e),c=ii(e),f=no(e.group.groupCode);return se("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[V("img",{src:f,alt:"",className:"w-10 h-10 rounded-full flex-shrink-0 object-cover"}),se("div",{className:"flex-1 min-w-0",children:[se("div",{className:"flex items-center gap-2",children:[V("span",{className:"text-sm font-medium text-theme truncate",children:e.group.groupName}),e.doubt&&V("span",{className:"text-xs text-amber-500 flex-shrink-0",children:"\u88AB\u8FC7\u6EE4"}),V("span",{className:"text-xs text-theme-hint flex-shrink-0",children:Go(o)})]}),V("div",{className:"text-xs text-theme-secondary mt-0.5",children:Yd(e)}),e.postscript&&se("div",{className:"text-xs text-theme-hint mt-1 bg-theme-input rounded px-2 py-1 break-words whitespace-pre-wrap",children:["\u9A8C\u8BC1\u4FE1\u606F\uFF1A",e.postscript]}),c&&!r&&se("div",{className:"flex gap-2 mt-2",children:[se("button",{onClick:()=>u("approve"),disabled:t!==null,className:Gr,children:[t==="approve"?V(Q,{size:12,className:"animate-spin"}):V(Zt,{size:12}),"\u540C\u610F"]}),se("button",{onClick:()=>s(!0),disabled:t!==null,className:_r,children:[V(we,{size:12}),"\u62D2\u7EDD"]})]}),c&&r&&se("div",{className:"mt-2 space-y-1.5",children:[V("input",{type:"text",value:l,onChange:h=>n(h.target.value),placeholder:"\u62D2\u7EDD\u7406\u7531\uFF08\u53EF\u9009\uFF09",className:"w-full px-2 py-1 text-xs bg-theme-input text-theme rounded border border-theme-divider focus:outline-none focus:border-pink-400",onKeyDown:h=>{h.key==="Enter"&&u("reject",l)},autoFocus:!0}),se("div",{className:"flex gap-2",children:[se("button",{onClick:()=>u("reject",l),disabled:t!==null,className:tu,children:[t==="reject"?V(Q,{size:12,className:"animate-spin"}):V(we,{size:12}),"\u786E\u8BA4\u62D2\u7EDD"]}),V("button",{onClick:()=>{s(!1),n("")},disabled:t!==null,className:au,children:"\u53D6\u6D88"})]})]}),d&&V("div",{className:`text-xs mt-1 ${e.status===2?"text-pink-500":e.status===3?"text-theme-secondary":"text-theme-hint"}`,children:d})]})]})},ru=({item:e,time:o})=>{let[t,a]=xt(null),[r,s]=xt(e.isDecide),[l,n]=xt(null),i=re(c=>c.updateNotificationStatus),u=async c=>{a(c);try{await Tr(e.flag,c),i("friend-request",e.flag,0),s(!0),n(c),T(c==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD","success")}catch(f){T(f.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{a(null)}},d=Be(e.friendUin);return se("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[V("img",{src:d,alt:"",className:"w-10 h-10 rounded-full flex-shrink-0 object-cover"}),se("div",{className:"flex-1 min-w-0",children:[se("div",{className:"flex items-center gap-2",children:[V("span",{className:"text-sm font-medium text-theme truncate",children:e.friendNick||e.friendUin}),V("span",{className:"text-xs text-theme-hint flex-shrink-0",children:Go(o)})]}),V("div",{className:"text-xs text-theme-secondary mt-0.5",children:"\u8BF7\u6C42\u6DFB\u52A0\u4F60\u4E3A\u597D\u53CB"}),e.extWords&&se("div",{className:"text-xs text-theme-hint mt-1 bg-theme-input rounded px-2 py-1 break-words whitespace-pre-wrap",children:["\u9A8C\u8BC1\u4FE1\u606F\uFF1A",e.extWords]}),e.addSource&&se("div",{className:"text-xs text-theme-hint mt-0.5",children:["\u6765\u6E90\uFF1A",e.addSource]}),!r&&se("div",{className:"flex gap-2 mt-2",children:[se("button",{onClick:()=>u("approve"),disabled:t!==null,className:Gr,children:[t==="approve"?V(Q,{size:12,className:"animate-spin"}):V(Zt,{size:12}),"\u540C\u610F"]}),se("button",{onClick:()=>u("reject"),disabled:t!==null,className:_r,children:[t==="reject"?V(Q,{size:12,className:"animate-spin"}):V(we,{size:12}),"\u62D2\u7EDD"]})]}),r&&V("div",{className:`text-xs mt-1 ${l==="approve"?"text-pink-500":l==="reject"?"text-theme-secondary":"text-theme-hint"}`,children:l==="approve"?"\u5DF2\u540C\u610F":l==="reject"?"\u5DF2\u62D2\u7EDD":"\u5DF2\u5904\u7406"})]})]})},su=({item:e,time:o})=>{let[t,a]=xt(null),[r,s]=xt(!1),[l,n]=xt(null),i=re(c=>c.updateNotificationStatus),u=async c=>{a(c);try{c==="approve"?await Wl(e.uid):await Tr(e.uid,"reject"),i("doubt-buddy",e.flag,0),s(!0),n(c),T(c==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD","success")}catch(f){T(f.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{a(null)}},d=Be(e.uid);return se("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[se("div",{className:"relative flex-shrink-0",children:[V("img",{src:d,alt:"",className:"w-10 h-10 rounded-full object-cover"}),V("div",{className:"absolute -bottom-0.5 -right-0.5 bg-amber-500 rounded-full p-0.5",children:V(Vt,{size:10,className:"text-white"})})]}),se("div",{className:"flex-1 min-w-0",children:[se("div",{className:"flex items-center gap-2",children:[V("span",{className:"text-sm font-medium text-theme truncate",children:e.nick||e.uid}),V("span",{className:"text-xs text-amber-500 flex-shrink-0",children:"\u88AB\u8FC7\u6EE4"}),V("span",{className:"text-xs text-theme-hint flex-shrink-0",children:Go(o)})]}),V("div",{className:"text-xs text-theme-secondary mt-0.5",children:"\u8BF7\u6C42\u6DFB\u52A0\u4F60\u4E3A\u597D\u53CB"}),e.msg&&se("div",{className:"text-xs text-theme-hint mt-1 bg-theme-input rounded px-2 py-1 break-words whitespace-pre-wrap",children:["\u9A8C\u8BC1\u4FE1\u606F\uFF1A",e.msg]}),e.source&&se("div",{className:"text-xs text-theme-hint mt-0.5",children:["\u6765\u6E90\uFF1A",e.source]}),e.reason&&se("div",{className:"text-xs text-amber-500/80 mt-0.5",children:["\u8FC7\u6EE4\u539F\u56E0\uFF1A",e.reason]}),!r&&se("div",{className:"flex gap-2 mt-2",children:[se("button",{onClick:()=>u("approve"),disabled:t!==null,className:Gr,children:[t==="approve"?V(Q,{size:12,className:"animate-spin"}):V(Zt,{size:12}),"\u540C\u610F"]}),se("button",{onClick:()=>u("reject"),disabled:t!==null,className:_r,children:[t==="reject"?V(Q,{size:12,className:"animate-spin"}):V(we,{size:12}),"\u62D2\u7EDD"]})]}),r&&V("div",{className:`text-xs mt-1 ${l==="approve"?"text-pink-500":"text-theme-secondary"}`,children:l==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD"})]})]})},nu=({type:e,data:o,time:t})=>{let a=no(o.groupCode),r=e==="group-dismiss"?ht:ta,s=e==="group-dismiss"?"\u7FA4\u5DF2\u89E3\u6563":"\u5DF2\u9000\u51FA\u7FA4\u804A";return se("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[se("div",{className:"relative flex-shrink-0",children:[V("img",{src:a,alt:"",className:"w-10 h-10 rounded-full object-cover"}),V("div",{className:"absolute -bottom-0.5 -right-0.5 bg-orange-500 rounded-full p-0.5",children:V(r,{size:10,className:"text-white"})})]}),se("div",{className:"flex-1 min-w-0",children:[se("div",{className:"flex items-center gap-2",children:[V("span",{className:"text-sm font-medium text-theme truncate",children:o.groupName||o.groupCode}),V("span",{className:"text-xs text-theme-hint flex-shrink-0",children:Go(t)})]}),V("div",{className:"text-xs text-orange-500 mt-0.5",children:s})]})]})},lu=()=>{let e=re(f=>f.notifications),o=re(f=>f.clearNotificationUnread),t=re(f=>f.loadGroupNotifications),[a,r]=xt(!1),[s,l]=xt("friend");Zd(()=>{o()},[o]);let n=async()=>{r(!0);try{await t()}finally{r(!1)}},i=e.filter(f=>f.type==="friend-request"||f.type==="doubt-buddy"),u=e.filter(f=>f.type==="group-notify"||f.type==="group-dismiss"||f.type==="group-quit"),d=i.filter(f=>f.type==="friend-request"&&!f.data.isDecide||f.type==="doubt-buddy").length,c=u.filter(f=>f.type==="group-notify"&&ii(f.data)).length;return se("div",{className:"flex flex-col h-full",children:[se("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-theme-divider",children:[se("div",{className:"flex items-center gap-1",children:[se("button",{onClick:()=>l("friend"),className:`flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium rounded-md transition-colors ${s==="friend"?"text-pink-600 dark:text-pink-400 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[V(oo,{size:13}),"\u597D\u53CB\u7533\u8BF7",d>0&&V("span",{className:"ml-0.5 min-w-[16px] h-[16px] bg-red-500 text-white text-[10px] font-medium rounded-full flex items-center justify-center px-1",children:d})]}),se("button",{onClick:()=>l("group"),className:`flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium rounded-md transition-colors ${s==="group"?"text-pink-600 dark:text-pink-400 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[V(gt,{size:13}),"\u7FA4\u901A\u77E5",c>0&&V("span",{className:"ml-0.5 min-w-[16px] h-[16px] bg-red-500 text-white text-[10px] font-medium rounded-full flex items-center justify-center px-1",children:c})]})]}),V("div",{className:"flex items-center gap-1.5",children:V("button",{onClick:n,disabled:a,className:"text-xs text-pink-500 hover:text-pink-600 disabled:opacity-50",children:a?V(Q,{size:14,className:"animate-spin"}):"\u5237\u65B0"})})]}),V("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(s==="friend"?i:u).length===0?V("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:s==="friend"?"\u6682\u65E0\u597D\u53CB\u7533\u8BF7":"\u6682\u65E0\u7FA4\u901A\u77E5"}):V("div",{className:"divide-y divide-theme-divider",children:s==="friend"?i.map((f,h)=>f.type==="friend-request"?V(ru,{item:f.data,time:f.time},`fr-${f.data.flag}-${h}`):f.type==="doubt-buddy"?V(su,{item:f.data,time:f.time},`db-${f.data.flag}-${h}`):null):u.map((f,h)=>f.type==="group-notify"?V(ou,{item:f.data,time:f.time},`gn-${f.data.flag}-${h}`):f.type==="group-dismiss"||f.type==="group-quit"?V(nu,{type:f.type,data:f.data,time:f.time},`info-${f.type}-${h}`):null)})})]})},di=lu;import{Fragment as fi,jsx as te,jsxs as Ce}from"react/jsx-runtime";var uu=({activeTab:e,onTabChange:o,friendCategories:t,groups:a,recentChats:r,unreadCounts:s,selectedPeerId:l,onSelectFriend:n,onSelectGroup:i,onSelectRecent:u})=>{let[d,c]=jr(""),{groupAssistantMode:f,enterGroupAssistant:h,exitGroupAssistant:p}=re(),m=re(M=>M.groupLastTimeMap),g=re(M=>M.groupLastMessageMap),L=wt(()=>{if(!d.trim())return t;let M=d.toLowerCase();return t.map(O=>({...O,friends:O.friends.filter(Z=>Z.nickname.toLowerCase().includes(M)||Z.remark.toLowerCase().includes(M)||Z.uin.includes(d))})).filter(O=>O.friends.length>0)},[t,d]),C=wt(()=>Dl(a,d),[a,d]),I=[{id:"recent",icon:za,label:"\u6700\u8FD1"},{id:"friends",icon:gt,label:"\u597D\u53CB"},{id:"groups",icon:ca,label:"\u7FA4\u7EC4"}],A=re(M=>M.notificationUnreadCount),[b,F]=jr(!1);return Ce("div",{className:"flex flex-col h-full",children:[Ce("div",{className:"flex items-center border-b border-theme-divider px-2 pt-2",children:[te("div",{className:"flex flex-1",children:I.map(M=>{let O=M.icon,Z=!b&&e===M.id;return Ce("button",{onClick:()=>{F(!1),o(M.id)},className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 text-sm font-medium transition-colors rounded-t-lg ${Z?"text-pink-600 dark:text-pink-400 bg-pink-50/50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[te(O,{size:16}),M.label]},M.id)})}),Ce("button",{onClick:()=>F(!b),className:`relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors flex-shrink-0 ${b?"text-pink-600 dark:text-pink-400 bg-pink-50/50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[te(jt,{size:16}),A>0&&te("div",{className:"absolute top-1 right-1 min-w-[14px] h-[14px] bg-red-500 text-white text-[10px] font-medium rounded-full flex items-center justify-center px-0.5",children:A>99?"99+":A})]})]}),b?te("div",{className:"flex-1 min-h-0",children:te(di,{onClose:()=>F(!1)})}):Ce(fi,{children:[(e==="friends"||e==="groups")&&te("div",{className:"p-3",children:Ce("div",{className:"relative",children:[te(Et,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-theme-hint"}),te("input",{type:"text",value:d,onChange:M=>c(M.target.value),placeholder:e==="friends"?"\u641C\u7D22\u597D\u53CB...":"\u641C\u7D22\u7FA4\u7EC4...",className:"w-full pl-9 pr-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme placeholder:text-theme-hint"})]})}),Ce("div",{className:"flex-1 overflow-y-auto",children:[e==="recent"&&f==="normal"&&te(fu,{items:r,unreadCounts:s,selectedPeerId:l,onSelect:u,onEnterGroupAssistant:h}),e==="recent"&&f==="assistant"&&te(pu,{groups:a,recentChats:r,groupLastTimeMap:m,groupLastMessageMap:g,unreadCounts:s,selectedPeerId:l,onSelect:i,onBack:p}),e==="friends"&&te(cu,{categories:L,selectedPeerId:l,onSelect:n}),e==="groups"&&te(ui,{items:C,unreadCounts:s,groupLastTimeMap:m,selectedPeerId:l,onSelect:i})]})]})]})},cu=({categories:e,selectedPeerId:o,onSelect:t})=>{let{expandedCategories:a,toggleCategory:r}=re(),s=wt(()=>new Set(a),[a]),l=wt(()=>e.map(n=>({...n,friends:[...n.friends].sort((i,u)=>{let d=!!(i.topTime&&i.topTime!=="0"),c=!!(u.topTime&&u.topTime!=="0");return d&&!c?-1:!d&&c?1:0})})),[e]);return l.length===0?te("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u597D\u53CB"}):te("div",{className:"py-1",children:l.map(n=>{let i=s.has(n.categoryId);return Ce("div",{children:[Ce("div",{onClick:()=>r(n.categoryId),className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-theme-item-hover text-theme-secondary",children:[i?te(Oa,{size:14}):te(et,{size:14}),te("span",{className:"text-xs font-medium",children:n.categoryName}),Ce("span",{className:"text-xs text-theme-hint",children:[n.onlineCount,"/",n.memberCount]})]}),i&&n.friends.map(u=>te(si,{friend:u,isSelected:o===u.uin,onClick:()=>t(u)},u.uid))]},n.categoryId)})})},ui=({items:e,unreadCounts:o,selectedPeerId:t,onSelect:a,groupLastTimeMap:r,subtitleMap:s,showPinnedStyle:l=!1})=>{let n=wt(()=>[...e].sort((u,d)=>{if(u.isTop&&!d.isTop)return-1;if(!u.isTop&&d.isTop)return 1;if(r){let c=r[u.groupCode]||0,f=r[d.groupCode]||0;if(c!==f)return f-c}return 0}),[e,r]);return n.length===0?te("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u7FA4\u7EC4"}):te("div",{className:"py-1",children:n.map(i=>{let u=o.get(`2_${i.groupCode}`)||0;return te(ni,{group:i,isSelected:t===i.groupCode,onClick:()=>a(i),showPinnedStyle:l,unreadCount:u,subtitle:s?.[i.groupCode]},i.groupCode)})})},fu=({items:e,unreadCounts:o,selectedPeerId:t,onSelect:a,onEnterGroupAssistant:r})=>{let{togglePinChat:s,removeRecentChat:l,friendCategories:n,groups:i}=re(),[u,d]=jr(null),c=iu(null),f=Ho(u?.x||0,u?.y||0,c),h=wt(()=>{let b=i.filter(M=>M.msgMask===2),F=0;return b.forEach(M=>{let O=o.get(`2_${M.groupCode}`)||0;F+=O}),F},[i,o]),p=wt(()=>i.filter(b=>b.msgMask===2).length,[i]),m=wt(()=>e.filter(b=>b.chatType!==2?!0:i.find(M=>M.groupCode===b.peerId)?.msgMask!==2),[e,i]),g=b=>{if(b.chatType===2){let F=i.find(M=>M.groupCode===b.peerId);if(F?.remarkName&&F.remarkName!==F.groupName)return F.remarkName}else if(b.chatType===1||b.chatType===100)for(let F of n){let M=F.friends.find(O=>O.uin===b.peerId);if(M?.remark&&M.remark!==M.nickname)return M.remark}return b.peerName},L=(b,F)=>{b.preventDefault(),d({x:b.clientX,y:b.clientY,item:F})},C=()=>{d(null)},I=async()=>{if(u){try{await s(u.item.chatType,u.item.peerId)}catch(b){console.error("\u7F6E\u9876\u5931\u8D25:",b),alert(`\u7F6E\u9876\u5931\u8D25: ${b.message||"\u672A\u77E5\u9519\u8BEF"}`)}C()}},A=()=>{u&&(l(u.item.chatType,u.item.peerId),C())};return m.length===0&&p===0?te("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u6700\u8FD1\u4F1A\u8BDD"}):Ce("div",{className:"py-1",onClick:C,children:[p>0&&Ce("div",{onClick:r,className:"flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors hover:bg-theme-item-hover",children:[Ce("div",{className:"relative flex-shrink-0",children:[te("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-blue-400 to-blue-600 flex items-center justify-center",children:te(ca,{size:20,className:"text-white"})}),h>0&&te("div",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-xs font-medium rounded-full flex items-center justify-center px-1",children:h})]}),Ce("div",{className:"flex-1 min-w-0",children:[te("div",{className:"flex items-center justify-between",children:te("span",{className:"text-sm font-medium text-theme",children:"\u7FA4\u52A9\u624B"})}),Ce("div",{className:"text-xs text-theme-hint truncate mt-0.5",children:[p," \u4E2A\u7FA4\u804A"]})]})]}),m.map(b=>te(mu,{item:b,displayName:g(b),unreadCount:o.get(`${b.chatType}_${b.peerId}`)||b.unreadCount,isSelected:t===b.peerId,onClick:()=>a(b),onContextMenu:F=>L(F,b)},`${b.chatType}_${b.peerId}`)),u&&du(Ce(fi,{children:[te("div",{className:"fixed inset-0 z-40",onClick:C,onContextMenu:b=>{b.preventDefault(),C()}}),Ce("div",{ref:c,className:"fixed z-50 bg-popup r-control glass-pop origin-top-left py-1 min-w-[160px]",style:{left:f.left,top:f.top,visibility:f.ready?"visible":"hidden"},onContextMenu:b=>b.preventDefault(),children:[Ce("button",{onClick:I,className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[te(Wt,{size:14,className:"flex-shrink-0"}),te("span",{className:"flex-1",children:u.item.pinned?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"})]}),u.item.chatType===2&&te(zr,{groupCode:u.item.peerId,onClose:C}),Ce("button",{onClick:A,className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-red-500",children:[te(ze,{size:14,className:"flex-shrink-0"}),te("span",{className:"flex-1",children:"\u5220\u9664"})]})]})]}),document.body)]})},mu=({item:e,displayName:o,unreadCount:t,isSelected:a,onClick:r,onContextMenu:s})=>Ce("div",{onClick:r,onContextMenu:s,className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors ${a?"bg-pink-500/20":e.pinned?"bg-theme-item-hover":"hover:bg-theme-item-hover"}`,children:[Ce("div",{className:"relative flex-shrink-0",children:[te("img",{src:e.peerAvatar,alt:o,className:"w-10 h-10 rounded-full object-cover"}),t>0&&te("div",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-xs font-medium rounded-full flex items-center justify-center px-1",children:t})]}),Ce("div",{className:"flex-1 min-w-0",children:[Ce("div",{className:"flex items-center justify-between",children:[te("span",{className:"text-sm font-medium text-theme truncate",children:o}),te("span",{className:"text-xs text-theme-hint flex-shrink-0 ml-2",children:uo(e.lastTime)})]}),te("div",{className:"text-xs text-theme-hint truncate mt-0.5",children:e.lastMessage})]})]}),pu=({groups:e,recentChats:o,groupLastTimeMap:t,groupLastMessageMap:a,unreadCounts:r,selectedPeerId:s,onSelect:l,onBack:n})=>{let i=wt(()=>e.filter(d=>d.msgMask===2),[e]),u=wt(()=>{let d={...a};return o.forEach(c=>{c.chatType===2&&c.lastMessage&&(d[c.peerId]=c.lastMessage)}),d},[a,o]);return Ce("div",{className:"py-1",children:[Ce("div",{onClick:n,className:"flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors hover:bg-theme-item-hover border-b border-theme-divider",children:[te(et,{size:16,className:"transform rotate-180 text-theme-secondary"}),te("span",{className:"text-sm font-medium text-theme",children:"\u8FD4\u56DE\u6700\u8FD1\u4F1A\u8BDD"})]}),Ce("div",{className:"px-3 py-2 text-xs text-theme-hint",children:["\u7FA4\u52A9\u624B (",i.length,")"]}),i.length===0?te("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u7FA4\u804A"}):te(ui,{items:i,unreadCounts:r,groupLastTimeMap:t,subtitleMap:u,selectedPeerId:s,onSelect:l,showPinnedStyle:!0})]})},ci=uu;import{useState as Ie,useEffect as at,useLayoutEffect as Oc,useRef as De,useCallback as Ae,useMemo as ut}from"react";import{createPortal as zc}from"react-dom";import*as Lt from"react";import{flushSync as ku}from"react-dom";function mi(e){return typeof e=="object"?e.key:e}function pi(e,o){let t=e.length;return new Proxy(e,{get(a,r,s){if(typeof r=="string"){let l=r.charCodeAt(0);if(l>=48&&l<=57){let n=+r;if(Number.isInteger(n)&&n>=0&&n<t){let i=a[n];if(typeof i!="object"){let u=o[n*2];i=a[n]={index:n,key:i,start:u,size:o[n*2+1],end:u+o[n*2+1],lane:0}}return i}}if(r==="length")return t}return Reflect.get(a,r,s)}})}function sa(e,o,t){let a=t.initialDeps??[],r,s=!0;function l(){var n;let u=0,d=e();if(!(d.length!==a.length||d.some((h,p)=>a[p]!==h)))return r;a=d;let f=0;return r=o(...d),t?.onChange&&!(s&&t.skipInitialOnChange)&&t.onChange(r),s=!1,r}return l.updateDeps=n=>{a=n},l}function Wr(e,o){if(e===void 0)throw new Error(`Unexpected undefined${o?`: ${o}`:""}`);return e}var Bt=(e,o)=>Math.abs(e-o)<1.01,hi=(e,o,t)=>{let a;return Object.assign(function(...r){e.clearTimeout(a),a=e.setTimeout(()=>o.apply(this,r),t)},{cancel:()=>{e.clearTimeout(a)}})};function gi({offset:e,isScrolling:o,elementMax:t,holdOffset:a,scrollOffset:r,pendingWrite:s,clampedMaxAtWrite:l}){var n;return o&&s===null&&e===r?"spurious":s!==null&&Math.abs(e-s.target)<1.5?"readBack":s!==null&&!s.smooth&&t!==null&&s.target>t+a+.5&&Math.abs(e-(t+a))<1.5||s!==null&&!s.smooth&&((n=s.lowMaxes)!=null&&n.some(i=>Math.abs(e-i)<1.5))?"clampedReadBack":l!==null&&Math.abs(e-l)<1.5?"clampedEcho":"external"}var hu=e=>e==="smooth"||e==="smoothFinishing";function xi({kind:e,offset:o,command:t,target:a}){return e!=="spurious"&&e!=="readBack"&&e!=="clampedReadBack"&&t?.index!=null&&t.phase!=="queued"&&!hu(t.phase)&&!Bt(o,t.lastTargetOffset)&&!Bt(o,a())&&e!=="clampedEcho"}var Vr=40;function Li(e){let o=e[e.length-1];if(o===void 0)return!1;let t=e.length-2;for(;t>=0&&o.t-e[t].t<Vr;)t--;if(t<0)return!1;let a=e[t],r=t-1;for(;r>=0&&a.t-e[r].t<Vr;)r--;if(r<0)return!1;let s=e[r],l=(o.offset-a.offset)/(o.t-a.t),n=(a.offset-s.offset)/(a.t-s.t);return l*n>=0&&Math.abs(l)>=2*Math.abs(n)&&Math.abs(l)-Math.abs(n)>=.8}function Ii(e){let o=e[e.length-1];if(o===void 0)return!1;let t=e.length-2;for(;t>=0&&o.t-e[t].t<Vr;)t--;if(t<0)return!1;let a=e[t];return Math.abs(o.offset-a.offset)/(o.t-a.t)>=.05}var fo,mo=()=>{if(fo!==void 0)return fo;if(typeof navigator>"u")return fo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return fo=!0;let e=navigator.maxTouchPoints;return fo=navigator.platform==="MacIntel"&&e!==void 0&&e>0},$r,gu=()=>$r!==void 0?$r:$r=mo()&&typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("overflow-anchor: auto"),Ci=()=>!mo()||gu();var pa={capture:!0,passive:!0},_o=class{constructor(o){this.host=o,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!=="lateFling",this.dragging=()=>{var t;return((t=this._touch)==null?void 0:t.phase)==="down"&&this._touch.moved},this.tail=()=>{var t;return((t=this._touch)==null?void 0:t.phase)==="tail"?this._touch.moved?"fling":"tap":null},this.onScroll=({isScrolling:t,ownReadBack:a,moved:r,external:s})=>{var l,n,i;return t&&((l=this._touch)==null?void 0:l.phase)==="tail"?this._openTail(this._touch.moved||!a,!1):((n=this._touch)==null?void 0:n.phase)==="lateFling"&&(this.host.now()>this._touch.until?this._touch=null:s&&t&&r&&this._openTail(!0,!1)),!a&&t&&r&&((i=this._touch)==null?void 0:i.phase)==="down"?(this._touch.moved=!0,!0):!1},this.touchStart=()=>{this.end(),this._touch={phase:"down",moved:!1}},this.touchEnd=()=>{var t;let a=((t=this._touch)==null?void 0:t.phase)==="down"&&this._touch.moved;this.end(),this._openTail(a,a)},this.end=()=>{var t;let a=this.host.getWindow();((t=this._touch)==null?void 0:t.phase)==="tail"&&a!=null&&a.clearTimeout(this._touch.timerId),this._touch=null},this.listen=t=>{let a=()=>this.touchStart(),r=()=>this.touchEnd();return t.addEventListener("touchstart",a,pa),t.addEventListener("touchend",r,pa),t.addEventListener("touchcancel",r,pa),()=>{t.removeEventListener("touchstart",a,pa),t.removeEventListener("touchend",r,pa),t.removeEventListener("touchcancel",r,pa),this.end()}},this._openTail=(t,a)=>{let r=this.host.getWindow();if(r==null)return;this.end();let s={phase:"tail",moved:t,awaitingFling:a,timerId:r.setTimeout(()=>{if(this.host.tailStillMoving()){this._openTail(s.moved,s.awaitingFling);return}this._touch=s.awaitingFling?{phase:"lateFling",until:this.host.now()+1e3}:null,this.host.onTailClosed()},150)};this._touch=s}}get touch(){return this._touch}};var Si=e=>{let{clientWidth:o,clientHeight:t}=e;return{width:o,height:t}},yi=e=>{let o=new Set;return{schedule:t=>{let a=e.requestAnimationFrame(()=>{o.delete(a),t()});o.add(a)},cancel:()=>{o.forEach(t=>e.cancelAnimationFrame(t)),o.clear()}}},xu=e=>e,Lu=e=>{let o=e.overscan*Math.max(e.lanes??1,1),t=Math.max(e.startIndex-o,0),r=Math.min(e.endIndex+o,e.count-1)-t+1,s=new Array(r);for(let l=0;l<r;l++)s[l]=t+l;return s},wi=(e,o)=>{let t=e.scrollElement;if(!t)return;let a=e.targetWindow;if(!a)return;let r=n=>{let{width:i,height:u}=n;o({width:Math.round(i),height:Math.round(u)})};if(r(Si(t)),!a.ResizeObserver)return()=>{};let s=yi(a),l=new a.ResizeObserver(()=>{let n=()=>{r(Si(t))};e.options.useAnimationFrameWithResizeObserver?s.schedule(n):n()});return l.observe(t,{box:"content-box"}),()=>{l.unobserve(t),s.cancel()}},bi={passive:!0};var Iu=typeof window>"u"?!0:"onscrollend"in window,Cu=(e,o,t)=>{let a=e.scrollElement;if(!a)return;let r=e.targetWindow;if(!r)return;let s=e.options.useScrollendEvent&&Iu,l=0,n=s?null:hi(r,()=>o(t(a),!1),e.options.isScrollingResetDelay),i=c=>()=>{l=t(a),n?.(),o(l,c)},u=i(!0),d=i(!1);return a.addEventListener("scroll",u,bi),s&&a.addEventListener("scrollend",d,bi),()=>{a.removeEventListener("scroll",u),s&&a.removeEventListener("scrollend",d),n?.cancel()}},ki=(e,o)=>Cu(e,o,t=>{let{horizontal:a,isRtl:r}=e.options;return a?t.scrollLeft*(r&&-1||1):t.scrollTop});var Su=(e,o,t)=>{if(t.options.useCachedMeasurements){let a=t.indexFromElement(e),r=t.options.getItemKey(a);return t.itemSizeCache.get(r)??t.options.estimateSize(a)}if(o?.borderBoxSize){let a=o.borderBoxSize[0];if(a)return Math.round(a[t.options.horizontal?"inlineSize":"blockSize"])}if(!o){let a=t.indexFromElement(e),r=t.options.getItemKey(a),s=t.itemSizeCache.get(r);if(s!==void 0)return s}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},bu=(e,{adjustments:o=0,behavior:t},a)=>{var r;let{scrollElement:s,options:l}=a,n=e+o,i=l.horizontal&&l.isRtl&&s!==null&&"ownerDocument"in s;(r=s?.scrollTo)==null||r.call(s,{[l.horizontal?"left":"top"]:i?-n:n,behavior:t})};var Mi=bu,vi=(e,o)=>e==="smooth"?o?"smoothLanded":"smooth":"instant",po=e=>e?.phase==="smooth"||e?.phase==="smoothLanded";function vu(e,o,t,a){if(o===0)return!1;let r=a(0),s=new Set,l=0;for(;l<e;){let i=t(l);if(i===r)break;s.add(i),l++}let n=e-l;if(n===0||n>=o)return!1;for(let i=0;i<n;i++)if(a(i)!==t(l+i))return!1;for(let i=n;i<o;i++)if(s.has(a(i)))return!1;return!0}var jo=class{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new _o({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let t=this.scrollState;if(t?.phase!=="queued"||this.pendingWrite!==null)return!1;let a=this._readElementOffset();return a===null||this._lastElementOffset===null||Math.abs(a-this._lastElementOffset)<1?!1:(this._lastElementOffset=a,t.samples=[...t.samples??[],{t:this.now(),offset:a}],!0)},onTailClosed:()=>{let t=this.scrollState;t?.phase==="queued"&&Ii(t.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var t,a,r;return((r=(a=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:a.now)==null?void 0:r.call(a))??Date.now()},this.observer=(()=>{let t=null,a=null,r=!1,s=!1,l=new Set,n=()=>{if(t)return t;let u=this.targetWindow;if(!u||!u.ResizeObserver)return null;let d=a=yi(u);return t=new u.ResizeObserver(c=>{let f=()=>{let h={sync:!1};this._resizeBatch=h;try{c.forEach(i)}finally{this._resizeBatch=null,h.notify&&(this.notify(h.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)d.schedule(f);else{r=!0;try{f()}finally{r=!1}}})},i=u=>{let d=u.target,c=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(let[f,h]of this.elementsCache)if(h===d){this.elementsCache.delete(f);break}return}this.isIndexInRange(c)&&this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(d,u,this))};return{disconnect:()=>{var u;(u=n())==null||u.disconnect(),a?.cancel(),l.clear(),s=!1,t=null,a=null},observe:u=>{let d=n();if(d){if(!r){d.observe(u,{box:"border-box"});return}l.add(u),s||(s=!0,a?.schedule(()=>{s=!1,l.forEach(c=>{c.isConnected&&t?.observe(c,{box:"border-box"})}),l.clear()}))}},unobserve:u=>{var d;l.delete(u),(d=n())==null||d.unobserve(u)}}})(),this.range=null,this.setOptions=t=>{var a;let r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:xu,rangeExtractor:Lu,onChange:()=>{},measureElement:Su,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let d in t){let c=t[d];c!==void 0&&(r[d]=c)}let s=this.options,l=null,n=null,i=!1;if(s!==void 0&&s.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){let d=s.count,c=r.count,f=this.getMeasurements(),h=((a=this._singleLaneMeasurements)==null?void 0:a.items)??f,p=I=>mi(h[I]),m=d>0?p(0):null,g=d>0?p(d-1):null;if(c!==d||d>0&&c>0&&(r.getItemKey(0)!==m||r.getItemKey(c-1)!==g)){i=!0;let I=d>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;I&&(l=[I.key,this.getScrollOffset()-I.start]);let A=r.followOnAppend===!0?"auto":r.followOnAppend||null;A&&c>0&&this.isAtEnd(s.scrollEndThreshold)&&(d===0||r.getItemKey(c-1)!==g)&&(c>d||vu(d,c,p,r.getItemKey))&&(n=A)}}this.options=r,i&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=null;if(l&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[d,c]=l,f=this.getMeasurements(),{count:h,getItemKey:p}=this.options,m=0;for(;m<h&&p(m)!==d;)m++;if(m<h){let g=f[m];if(g){let L=Math.max(0,g.start+c);!n&&L!==this.scrollOffset&&(u=L-this.scrollOffset,this.scrollOffset=L)}}}n?this.pendingScrollAnchor={kind:"follow",behavior:n}:u!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:"anchor",delta:u}:(this._holdOffset+=u,this._followOffsetTarget(u)))},this.notify=t=>{var a,r;(r=(a=this.options).onChange)==null||r.call(a,this,t)},this.maybeNotify=sa(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var t;this.unsubs.filter(Boolean).forEach(a=>a()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(t=this._momentumStop)==null||t.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;let a=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==a){if(this.cleanup(),!a){this.maybeNotify();return}this.scrollElement=a,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,l)=>{var n,i,u,d;let c=l?this._elementMaxScrollOffset():null,f=this._reportedOverscroll;this._reportedOverscroll=s<0||c!==null&&s>c+1;let h=s;this._lastElementOffset=h,s=this._toLayoutOffset(s);let p=this._classifyScrollEvent(s,l,c);if(p==="spurious")return;p==="readBack"?s=this.pendingWrite.target:p==="clampedReadBack"&&((n=this.scrollState)==null?void 0:n.index)!=null&&s<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=s:xi({kind:p,offset:s,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(s-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let m=this.getScrollOffset(),g=this.scrollDirection;this.scrollDirection=l?m===s?this.scrollDirection:m<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=l;let L=this.scrollState;if(L?.phase==="queued"&&p==="external"&&l)if(f||this._reportedOverscroll)L.samples=[];else{let C=this.now();L.samples=[...(L.samples??[]).filter(I=>C-I.t<=200),{t:C,offset:h}],(g!==null&&this.scrollDirection!==g||Li(L.samples))&&(this.scrollState=null)}this._iosGesture.onScroll({isScrolling:l,ownReadBack:p==="readBack",moved:s!==m,external:p==="external"&&((i=this.scrollState)==null?void 0:i.phase)!=="smooth"&&((u=this.scrollState)==null?void 0:u.phase)!=="smoothFinishing"})&&((d=this.scrollState)==null?void 0:d.phase)==="queued"&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let r=this.pendingScrollAnchor;this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled&&(r.kind==="anchor"?this._canWriteScroll()?po(this.scrollState)&&!Bt(this.getScrollOffset()-r.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(r.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=r.delta,this._followOffsetTarget(r.delta),this.notify(!1)):this.scrollToEnd({behavior:r.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(t,a,r)=>{var s;return gi({offset:t,isScrolling:a,elementMax:r,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:((s=this._clampedAdjustment)==null?void 0:s.maxAtWrite)??null})},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:t,maxAtWrite:a}=this._clampedAdjustment,r=this.getMaxScrollOffset();r>a+.5&&(this._clampedAdjustment=t>r+.5?{target:t,maxAtWrite:r}:null,this._scrollToOffset(t))},this._writeAwaitingCommand=()=>{let t=this.scrollState;if(t===null||t.phase!=="queued")return;let{behavior:a}=t;this.getMeasurements();let r=this.getScrollStateTarget(t);t.lastTargetOffset=r,this._clampedAdjustment=null,t.phase=vi(a,t.index!=null&&Bt(r,this.getScrollOffset())),this._scrollToOffset(r,{behavior:a}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let t=this.scrollElement;if(t==null)return null;let{horizontal:a,isRtl:r}=this.options;return typeof t.scrollTop=="number"?a?t.scrollLeft*(r&&-1||1):t.scrollTop:typeof t.scrollY=="number"?a?t.scrollX:t.scrollY:null},this._canWriteScroll=()=>!(mo()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=t=>{var a;if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||((a=this.scrollState)==null?void 0:a.phase)==="smooth")return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(t);let r=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(r),this._scrollToOffset(r)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=sa(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,a,r,s,l,n,i,u)=>(this.prevLanes!==void 0&&this.prevLanes!==n&&(this.lanesChangedFlag=!0),this.prevLanes=n,this.pendingMin=null,{count:t,paddingStart:a,scrollMargin:r,getItemKey:s,enabled:l,lanes:n,laneAssignmentMode:i,gap:u}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=sa(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:a,scrollMargin:r,getItemKey:s,enabled:l,lanes:n,laneAssignmentMode:i,gap:u},d)=>{var c;let f=this.itemSizeCache;if(!l)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(let C of this.laneAssignments.keys())C>=t&&this.laneAssignments.delete(C);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(C=>{this.itemSizeCache.set(C.key,C.size)}));let h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),n===1){let C=t*2,I=(c=this._singleLaneMeasurements)==null?void 0:c.flat;if(!I||I.length<C){let M=new Float64Array(C);I&&h>0&&M.set(I.subarray(0,h*2)),I=M}let A=h===0?new Array(t):this._singleLaneMeasurements.items.slice(),b;if(h===0)b=a+r;else{let M=h-1;b=I[M*2]+I[M*2+1]+u}for(let M=h;M<t;M++){let O=s(M);A[M]=O;let Z=f.get(O),H=typeof Z=="number"?Z:this.options.estimateSize(M);I[M*2]=b,I[M*2+1]=H,b+=H+u}this._singleLaneMeasurements={flat:I,items:A};let F=pi(A,I);return this.measurementsCache=F,F}let p=this.measurementsCache.slice(0,h),m=new Array(n).fill(void 0),g=new Float64Array(n),L=0;for(let C=0;C<h;C++){let I=p[C];I&&(m[I.lane]===void 0&&L++,m[I.lane]=C,g[I.lane]=I.end)}for(let C=h;C<t;C++){let I=s(C),A=this.laneAssignments.get(C),b,F,M=i==="estimate"||f.has(I);if(A!==void 0&&this.options.lanes>1){b=A;let W=m[b],le=W!==void 0?p[W]:void 0;F=le?le.end+u:a+r}else if(L===n){let W=0,le=g[0],R=m[0];for(let E=1;E<n;E++){let v=g[E];(v<le||v===le&&m[E]<R)&&(W=E,le=v,R=m[E])}b=W,F=le+u,M&&this.laneAssignments.set(C,b)}else b=C%this.options.lanes,F=a+r,M&&this.laneAssignments.set(C,b);let O=f.get(I),Z=typeof O=="number"?O:this.options.estimateSize(C),H=F+Z;p[C]={index:C,start:F,size:Z,end:H,key:I,lane:b},m[b]===void 0&&L++,m[b]=C,g[b]=H}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=sa(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes,this._getLayoutTotalSize()+this.options.scrollMargin],(t,a,r,s,l)=>{if(t.length===0||a===0)return this.range=null,null;let n=Math.max(l-a,0);return this.range=wu(t,a,Math.min(r,n),s,s===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range},{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=sa(()=>{let t=null,a=null,r=this.calculateRange();return r&&(t=r.startIndex,a=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,a]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,a,this.options.lanes]},(t,a,r,s,l,n)=>s===null||l===null?[]:t({startIndex:s,endIndex:l,overscan:a,count:r,lanes:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{let a=this.options.indexAttribute,r=t.getAttribute(a);return r?parseInt(r,10):(console.warn(`Missing attribute name '${a}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var a;if(!po(this.scrollState))return!0;let r=this.scrollState.index??((a=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:a.index);if(r!==void 0&&this.range){let s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,r-s),n=Math.min(this.options.count-1,r+s);return t>=l&&t<=n}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,n)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(n))});return}let a=this.indexFromElement(t);if(!this.isIndexInRange(a))return;let r=this.options.getItemKey(a),s=this.elementsCache.get(r);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(r,t)),t.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,a)=>{var r,s,l;if(!this.isIndexInRange(t))return;(r=this._resizeBatch)!=null&&r.sync&&this.getMeasurements();let n,i,u,d=(s=this._singleLaneMeasurements)==null?void 0:s.flat;if(this.options.lanes===1&&d!=null)u=this.options.getItemKey(t),i=d[t*2],n=d[t*2+1];else{let h=this.measurementsCache[t];if(!h)return;u=h.key,i=h.start,n=h.size}let c=this.itemSizeCache.get(u)??n,f=a-c;if(f!==0){let h=this.options.anchorTo==="end"&&!po(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=h?this._getLayoutTotalSize():0,m=this.getScrollOffset(),L=!this.itemSizeCache.has(u)?i<m:i+c<=m&&this.scrollDirection!=="backward",C=!po(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:i,size:n,end:i+n,lane:0},f,this):L);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,a),this.itemSizeCacheVersion++;let I=!1;if(this._awaitingCommandReadBack()||(h?I=this.applyScrollAdjustment(this._getLayoutTotalSize()-p):C&&(I=this.applyScrollAdjustment(f))),this._resizeBatch){this._resizeBatch.notify=!0,(l=this._resizeBatch).sync||(l.sync=I);return}this.notify(I),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=sa(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(t,a,r)=>{let s=[];for(let l=0,n=t.length;l<n;l++){let i=t[l],u=a[i];s.push(r===0?u:{...u,start:u.start-r,end:u.end-r})}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var a;let r=this.getMeasurements();if(r.length===0)return;let s=(a=this._singleLaneMeasurements)==null?void 0:a.flat,l=this.options.lanes===1&&s!=null,n=Pi(0,r.length-1,l?i=>s[i*2]:i=>Wr(r[i]).start,t);return Wr(r[n])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let t=this._elementMaxScrollOffset();if(t===null)return;let a=this.pendingWrite,r=Math.max(t,0)+this._holdOffset;if(r>=a.target)return;let s=a.lowMaxes??(a.lowMaxes=[]);s[s.length-1]!==r&&s.push(r)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=t=>{var a;let r=t+this._holdOffset;return((a=this.pendingScrollAnchor)==null?void 0:a.kind)==="anchor"&&(r+=this.pendingScrollAnchor.delta),r},this._elementMaxScrollOffset=()=>{let t=this.scrollElement;if(t===null)return null;if("scrollHeight"in t)return this.options.horizontal?t.scrollWidth-t.clientWidth:t.scrollHeight-t.clientHeight;if("document"in t){let a=t.document.documentElement;return this.options.horizontal?a.scrollWidth-t.innerWidth:a.scrollHeight-t.innerHeight}return null},this._momentumStop=null,this._stopMomentum=t=>{let a=this.scrollElement,r=this.targetWindow;if(a===null||r===null)return;let s="document"in a?a.document.scrollingElement:a;if(!s?.style)return;if(this._momentumStop){this._momentumStop.done=t;return}let{style:l}=s,n=this.options.horizontal?"overflow-x":"overflow-y",i=l.getPropertyValue(n),u=l.getPropertyPriority(n),d=()=>this.options.horizontal?s.clientHeight:s.clientWidth,c=d();if(l.setProperty(n,"hidden","important"),d()!==c){l.setProperty(n,i,u);return}let f={restore:()=>l.getPropertyValue(n)!=="hidden"||l.getPropertyPriority(n)!=="important"?!1:(l.setProperty(n,i,u),!0),done:t};this._momentumStop=f,r.requestAnimationFrame(()=>r.requestAnimationFrame(()=>{this._momentumStop===f&&(this._momentumStop=null,f.restore()&&f.done())}))},this._clampedBy=t=>{let a=this._elementMaxScrollOffset();if(a===null)return null;let r=a+this._holdOffset;return t>r+.5?{target:t,maxAtWrite:r}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,a,r=0)=>{if(!this.scrollElement)return 0;let s=this.getSize(),l=this.getScrollOffset();a==="auto"&&(a=t>=l+s?"end":"start"),a==="center"?t+=(r-s)/2:a==="end"&&(t-=s);let n=this.getMaxScrollOffset();return Math.max(Math.min(n,t),0)},this.getOffsetForIndex=(t,a="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let r=this.getSize(),s=this.getScrollOffset(),l=this.getMeasurements()[t];if(!l)return;if(a==="auto")if(l.end>=s+r-this.options.scrollPaddingEnd)a="end";else if(l.start<=s+this.options.scrollPaddingStart)a="start";else return[s,a];if(a==="end"&&t===this.options.count-1){let i=this.getMaxScrollOffset(),u=i-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(u,i),0),a]}let n=a==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(n,a,l.size),a]},this.scrollToOffset=(t,{align:a="start",behavior:r="auto"}={})=>{this._startScroll({index:null,align:a},this.getOffsetForAlignment(t,a),r,"absolute")},this.scrollToIndex=(t,{align:a="auto",behavior:r="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));let s=this.getOffsetForIndex(t,a);if(!s)return;let[l,n]=s;this._startScroll({index:t,align:n},l,r,"absolute")},this.scrollBy=(t,{behavior:a="auto"}={})=>{let r=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+t,"start");this._startScroll({index:null,align:"start"},r,a,"relative")},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this._startScroll({index:this.options.count-1,align:"end",toEnd:!0},Math.max(this.getMaxScrollOffset(),0),t,"absolute");return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{var t,a;let r=this.getMeasurements(),s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){let l=r.length-1,n=(t=this._singleLaneMeasurements)==null?void 0:t.flat;n!=null?s=n[l*2]+n[l*2+1]:s=((a=r[l])==null?void 0:a.end)??0}else{let l=Array(this.options.lanes).fill(null),n=r.length-1;for(;n>=0&&l.some(i=>i===null);){let i=r[n];l[i.lane]===null&&(l[i.lane]=i.end),n--}s=Math.max(...l.filter(i=>i!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let t=[];if(this.itemSizeCache.size===0)return t;let a=this.getMeasurements();for(let r of a)r&&this.itemSizeCache.has(r.key)&&t.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return t},this._scrollToOffset=(t,{adjustments:a,behavior:r}={})=>{let s={target:t+(a??0),smooth:r==="smooth"};return this.pendingWrite=s,this.options.scrollToFn(t-this._holdOffset,{behavior:r,adjustments:a},this),s},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let t=this.getCommandWrittenOffset();return!(mo()&&this._iosGesture.dragging())&&t!==null&&!Bt(t,this.getScrollOffset())},this._followOffsetTarget=t=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=t)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(o)}get scrollAdjustments(){return 0}applyScrollAdjustment(o,t){if(o===0)return!1;if(this._followOffsetTarget(o),this._canWriteScroll()){let a=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(a+o);let r=this._scrollToOffset(a,{adjustments:o,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=o),this.scrollOffset<0&&(this.scrollOffset=0)),!0}else return this._holdOffset+=o,this.scrollOffset!==null&&(this.scrollOffset+=o),!0}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}getScrollStateTarget(o){let t=o.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:o.index!=null?this.getOffsetForIndex(o.index,o.align):void 0;return t?t[0]:o.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase==="queued"){this.scheduleScrollReconcile();return}this.getMeasurements();let a=this.getScrollStateTarget(this.scrollState),r=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,s=a!==this.scrollState.lastTargetOffset;if(!s&&Bt(a,this.getScrollOffset())){if(this.scrollState.phase==="smooth"?this.scrollState.phase="smoothLanded":this.scrollState.phase==="smoothFinishing"&&(this.scrollState.phase="instant"),this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==a&&this._scrollToOffset(a,{behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let l=this.getSize()||600,n=Math.abs(a-this.getScrollOffset()),i=po(this.scrollState)&&n>l;this.scrollState.lastTargetOffset=a,i?this.scrollState.phase="smooth":this.scrollState.phase==="smooth"?this.scrollState.phase="smoothFinishing":this.scrollState.phase==="smoothLanded"&&(this.scrollState.phase="instant"),this._scrollToOffset(a,{behavior:i?"smooth":"auto"})}this.scheduleScrollReconcile()}_startScroll(o,t,a,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let s=this._iosGesture.tail();if(r==="absolute"&&s!==null){if(s==="fling"&&Ci()){this._stopMomentum(()=>{let l=this.scrollState;l?.phase!=="queued"||this._iosGesture.tail()!=="fling"||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...o,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:"queued",behavior:a,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...o,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:a,phase:vi(a,o.index!=null&&Bt(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:a}),this.scheduleScrollReconcile()}},Pi=(e,o,t,a)=>{for(;e<=o;){let r=(e+o)/2|0,s=t(r);if(s<a)e=r+1;else if(s>a)o=r-1;else return r}return e>0?e-1:0};function yu(e,o,t){let a=0;for(;a<=o;){let r=(a+o)/2|0,s=e[r*2];if(s<t)a=r+1;else if(s>t)o=r-1;else return r}return a>0?a-1:0}function wu(e,o,t,a,r){let s=e.length-1;if(e.length<=a)return{startIndex:0,endIndex:s};if(a===1&&r!==null){let u=yu(r,s,t),d=u,c=t+o;for(;d<s&&r[d*2]+r[d*2+1]<c;)d++;return{startIndex:u,endIndex:d}}let n=Pi(0,s,u=>e[u].start,t),i=n;if(a===1)for(;i<s&&e[i].end<t+o;)i++;else if(a>1){let u=Array(a).fill(0);for(;i<s&&u.some(c=>c<t+o);){let c=e[i];u[c.lane]=c.end,i++}let d=Array(a).fill(t+o);for(;n>=0&&d.some(c=>c>=t);){let c=e[n];d[c.lane]=c.start,n--}n=Math.max(0,n-n%a),i=Math.min(s,i+(a-1-i%a))}return{startIndex:n,endIndex:i}}var Xr=typeof document<"u"?Lt.useLayoutEffect:Lt.useEffect;function Mu({useFlushSync:e=!0,directDomUpdates:o=!1,directDomUpdatesMode:t="transform",...a}){let r=Lt.useReducer(f=>f+1,0)[1],s=Lt.useRef({enabled:o,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=o,s.current.mode=t;let l=Lt.useRef(!1),n=f=>{let h=s.current;if(!h.enabled||!h.container)return;let p=f.getTotalSize();if(p!==h.lastSize){h.lastSize=p;let m=f.options.horizontal?"width":"height";h.container.style[m]=`${p}px`}},i=(f,h,p)=>{let m=s.current,g=!!f.options.horizontal,L=h.start-f.options.scrollMargin;m.lastPositions.get(p)!==L&&(m.lastPositions.set(p,L),m.mode==="transform"?p.style.transform=g?`translate3d(${L}px, 0, 0)`:`translate3d(0, ${L}px, 0)`:p.style[g?"left":"top"]=`${L}px`)},u=f=>{let h=s.current;if(!(!h.enabled||!h.container)){n(f);for(let p of f.getVirtualItems()){let m=f.elementsCache.get(p.key);m&&i(f,p,m)}}},d={...a,onChange:(f,h)=>{var p;let m=s.current,g=!0;if(m.enabled){u(f);let L=f.range,C=m.prevRange;g=!C||C.isScrolling!==f.isScrolling||C.startIndex!==L?.startIndex||C.endIndex!==L?.endIndex,g&&(m.prevRange=L?{startIndex:L.startIndex,endIndex:L.endIndex,isScrolling:f.isScrolling}:null)}g&&(e&&h&&!l.current?ku(r):r()),(p=a.onChange)==null||p.call(a,f,h)}},[c]=Lt.useState(()=>{let f=new jo(d),h=f.measureElement;return f.measureElement=p=>{l.current=!0;try{h(p)}finally{l.current=!1}let m=s.current;if(p!==null&&m.enabled&&m.container){let g=f.measurementsCache[f.indexFromElement(p)];g&&i(f,g,p)}},Object.assign(f,{containerRef:p=>{let m=s.current;m.container=p,m.lastSize=null,p!==null&&u(f)}})});return c.setOptions(d),Xr(()=>c._didMount(),[]),Xr(()=>(n(c),c._willUpdate())),Xr(()=>{u(c)}),c}function Wo(e){return Mu({observeElementRect:wi,observeElementOffset:ki,scrollToFn:Mi,...e})}import{Slot as Hc}from"@luckylillia-dev/plugin-sdk/webui";var ha="current-uin",Pu=/^\/i\/([^/]+)(?:\/|$)/;function Ai(){if(typeof location>"u")return ha;let e=Pu.exec(location.pathname);if(!e)return ha;try{return`${ha}:${decodeURIComponent(e[1])}`}catch{return`${ha}:${e[1]}`}}function ga(){let e=Ai();return localStorage.getItem(e)||e!==ha&&localStorage.getItem(ha)||""}function Ri(e){localStorage.setItem(Ai(),e)}var Au="webqq-messages",Ru="webqq-messages-",Tu=1,xa="messages",Fi=100,na=null,Ti="";function Nu(e){return`${Ru}${e||"anon"}`}var Ni=!1;function Fu(){if(!Ni){Ni=!0;try{indexedDB.deleteDatabase(Au)}catch{}}}function Di(){Fu();let e=ga();if(na&&Ti!==e){try{na.close()}catch{}na=null}return na?Promise.resolve(na):new Promise((o,t)=>{let a=indexedDB.open(Nu(e),Tu);a.onerror=()=>t(a.error),a.onsuccess=()=>{na=a.result,Ti=e,o(na)},a.onupgradeneeded=r=>{let s=r.target.result;s.objectStoreNames.contains(xa)||s.createObjectStore(xa,{keyPath:"chatKey"})}})}async function La(e,o){try{let t=await Di(),a=`${e}_${o}`;return new Promise(r=>{let n=t.transaction(xa,"readonly").objectStore(xa).get(a);n.onsuccess=()=>{let i=n.result;i&&i.messages?r(i.messages):r(null)},n.onerror=()=>r(null)})}catch{return null}}async function $t(e,o,t){try{let a=await Di(),r=`${e}_${o}`,s=t.slice(-Fi);return new Promise((l,n)=>{let d=a.transaction(xa,"readwrite").objectStore(xa).put({chatKey:r,messages:s,timestamp:Date.now()});d.onsuccess=()=>l(),d.onerror=()=>n(d.error)})}catch(a){console.error("Failed to cache messages:",a)}}async function Vo(e,o,t){try{let a=await La(e,o);if(a){let r=[...a.slice(-(Fi-1)),t];await $t(e,o,r)}}catch(a){console.error("Failed to append message:",a)}}async function Ei(e,o,t){try{let a=await La(e,o);if(a){let r=a.filter(s=>s.msgId!==t);await $t(e,o,r)}}catch(a){console.error("Failed to remove message:",a)}}async function $o(e,o,t,a,r,s=!1){try{let l=await La(e,o);if(!l)return;let n=l.map(i=>{if(String(i.msgSeq)!==String(t))return i;let u=i.emojiLikesList||[];if(r){let d=u.findIndex(c=>c.emojiId===a);if(d>=0){let c=[...u];return c[d]={...c[d],likesCnt:String(parseInt(c[d].likesCnt)+1),isClicked:c[d].isClicked||s},{...i,emojiLikesList:c}}else return{...i,emojiLikesList:[...u,{emojiId:a,emojiType:parseInt(a)>999?"2":"1",likesCnt:"1",isClicked:s}]}}else{let d=u.findIndex(c=>c.emojiId===a);if(d>=0){let c=[...u],f=parseInt(c[d].likesCnt)-1;return f<=0?c.splice(d,1):c[d]={...c[d],likesCnt:String(f),isClicked:s?!1:c[d].isClicked},{...i,emojiLikesList:c}}}return i});await $t(e,o,n)}catch(l){console.error("Failed to update emoji reaction:",l)}}async function qi(e,o,t,a){try{let r=await La(e,o);if(!r)return!1;let s=!1,l=r.map(n=>n.msgId===t||a&&String(n.msgSeq)===String(a)?(s=!0,{...n,recallTime:String(Math.floor(Date.now()/1e3))}):n);return s&&await $t(e,o,l),s}catch(r){return console.error("Failed to mark message as recalled:",r),!1}}import{useState as Kr,useEffect as Du,useRef as Eu}from"react";import{createPortal as qu}from"react-dom";import{Fragment as it,jsx as ae,jsxs as he}from"react/jsx-runtime";var Bu=({level:e})=>{let o=e%4,t=Math.floor(e/4)%4,a=Math.floor(e/16)%4,r=Math.floor(e/64)%4,s=Math.floor(e/256),l=[];for(let n=0;n<s;n++)l.push(ae("span",{className:"text-amber-400 text-xs font-bold",title:"\u91D1\u4F01\u9E45",children:"\u{1F427}"},`penguin-${n}`));for(let n=0;n<r;n++)l.push(ae(mt,{size:14,className:"text-amber-500"},`crown-${n}`));for(let n=0;n<a;n++)l.push(ae(eo,{size:14,className:"text-orange-400"},`sun-${n}`));for(let n=0;n<t;n++)l.push(ae($a,{size:14,className:"text-blue-400"},`moon-${n}`));for(let n=0;n<o;n++)l.push(ae(ra,{size:14,className:"text-yellow-400 fill-yellow-400"},`star-${n}`));return ae("div",{className:"flex items-center gap-0.5 flex-wrap",children:l})},ho=({profile:e,loading:o,position:t,onClose:a,isFriend:r,onFriendDeleted:s})=>{let l=Eu(null),[n,i]=Kr({left:t.x,top:t.y}),[u,d]=Kr(!1),[c,f]=Kr(!1);if(Du(()=>{if(!l.current)return;let I=320,A=l.current.offsetHeight||400,b=t.x,F=t.y;b+I>window.innerWidth-20&&(b=window.innerWidth-I-20),b<20&&(b=20),F+A>window.innerHeight-20&&(F=window.innerHeight-A-20),F<20&&(F=20),i({left:b,top:F})},[t,e,o]),!e&&!o)return null;let h=I=>I===1?"\u7537":I===2?"\u5973":"",p=I=>{if(!I)return"";let A=new Date(I*1e3),b=new Date,F=b.getFullYear()-A.getFullYear(),M=b.getMonth()-A.getMonth(),O=F+(M<0?-1:0);if(O<1){let Z=F*12+M;return Z>0?`${Z}\u4E2A\u6708`:"\u4E0D\u8DB31\u4E2A\u6708"}return`${O}\u5E74`},m=I=>I==="owner"?"\u7FA4\u4E3B":I==="admin"?"\u7BA1\u7406\u5458":"",g=I=>I==="owner"?"bg-amber-500 text-white":I==="admin"?"bg-green-500 text-white":"",L=async()=>{if(e){f(!0);try{await Ul(e.uid),T("\u5DF2\u5220\u9664\u597D\u53CB","success"),s?.(e.uid),a()}catch(I){T(I.message||"\u5220\u9664\u597D\u53CB\u5931\u8D25","error")}finally{f(!1),d(!1)}}},C=I=>I?new Date(I*1e3).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"";return qu(he(it,{children:[ae("div",{className:"fixed inset-0 z-40",onClick:a}),he("div",{ref:l,className:"fixed z-50 r-card overflow-hidden bg-popup glass-pop origin-top-left",style:{left:n.left,top:n.top,width:320,maxHeight:"calc(100vh - 40px)"},onClick:I=>I.stopPropagation(),children:[o?ae("div",{className:"flex items-center justify-center h-40",children:ae(Q,{size:24,className:"animate-spin text-pink-500"})}):e&&he(it,{children:[he("div",{className:"bg-gradient-to-r from-pink-400 to-amber-300 p-4 relative",children:[r&&!e.groupRole&&ae("button",{onClick:()=>d(!0),className:"absolute top-2 right-2 p-1.5 rounded-full bg-white/20 hover:bg-white/40 text-white transition-colors",title:"\u5220\u9664\u597D\u53CB",children:ae(ze,{size:16})}),he("div",{className:"flex items-start gap-4",children:[ae("img",{src:e.avatar,alt:e.nickname,className:"w-16 h-16 rounded-full border-3 border-white/80 object-cover flex-shrink-0"}),he("div",{className:"flex-1 min-w-0 text-white pt-1",children:[he("div",{className:"flex items-center gap-2 mb-1",children:[ae("span",{className:"font-bold text-lg truncate",children:e.nickname}),e.groupRole&&m(e.groupRole)&&ae("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${g(e.groupRole)}`,children:m(e.groupRole)})]}),e.remark&&e.remark!==e.nickname&&he("div",{className:"text-white/80 text-sm truncate mb-1",children:["\u5907\u6CE8: ",e.remark]}),ae("div",{className:"text-white/90 text-sm",children:e.uin}),e.qid&&he("div",{className:"text-white/70 text-xs mt-0.5",children:["QID: ",e.qid]})]})]})]}),he("div",{className:"p-4 overflow-y-auto",style:{maxHeight:"calc(100vh - 40px - 120px)"},children:[e.signature&&ae("div",{className:"text-theme-secondary text-sm mb-3 bg-theme-item/50 rounded-lg px-3 py-2 max-h-24 overflow-y-auto break-words",children:e.signature}),he("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[h(e.sex)&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u6027\u522B"}),ae("span",{className:"text-theme",children:h(e.sex)})]}),e.birthday&&e.birthday!=="0-0-0"&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u751F\u65E5"}),ae("span",{className:"text-theme",children:e.birthday})]}),p(e.regTime)&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"Q\u9F84"}),ae("span",{className:"text-theme",children:p(e.regTime)})]}),e.level>0&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u7B49\u7EA7"}),he("div",{className:"flex items-center gap-2",children:[he("span",{className:"text-theme",children:["Lv.",e.level]}),ae(Bu,{level:e.level})]})]})]}),!!(e.groupCard||e.groupTitle||e.groupLevel||e.joinTime||e.lastSpeakTime)&&he(it,{children:[ae("div",{className:"border-t border-theme-divider my-3"}),ae("div",{className:"text-xs text-theme-hint mb-2",children:"\u7FA4\u4FE1\u606F"}),he("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.groupCard&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u7FA4\u540D\u7247"}),ae("span",{className:"text-theme truncate",children:e.groupCard})]}),e.groupTitle&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u7FA4\u5934\u8854"}),ae("span",{className:"text-pink-500",children:e.groupTitle})]}),e.groupLevel!==void 0&&e.groupLevel>0&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u7FA4\u7B49\u7EA7"}),he("span",{className:"text-theme",children:["Lv.",e.groupLevel]})]}),!!e.joinTime&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u5165\u7FA4\u65F6\u95F4"}),ae("span",{className:"text-theme",children:C(e.joinTime)})]}),!!e.lastSpeakTime&&he(it,{children:[ae("span",{className:"text-theme-hint",children:"\u6700\u540E\u53D1\u8A00"}),ae("span",{className:"text-theme",children:C(e.lastSpeakTime)})]})]})]})]})]}),u&&e&&ae("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center rounded-xl",children:he("div",{className:"bg-popup m-4 p-4 rounded-lg shadow-lg max-w-[280px]",children:[he("div",{className:"flex items-center justify-between mb-3",children:[ae("span",{className:"font-medium text-theme",children:"\u5220\u9664\u597D\u53CB"}),ae("button",{onClick:()=>d(!1),className:"text-theme-muted hover:text-theme",children:ae(we,{size:18})})]}),he("p",{className:"text-sm text-theme-secondary mb-4",children:["\u786E\u5B9A\u8981\u5220\u9664\u597D\u53CB ",ae("span",{className:"font-medium text-theme",children:e.remark||e.nickname})," \u5417\uFF1F\u5220\u9664\u540E\u5C06\u65E0\u6CD5\u6062\u590D\u3002"]}),he("div",{className:"flex gap-2 justify-end",children:[ae("button",{onClick:()=>d(!1),className:"px-3 py-1.5 text-sm rounded-lg bg-theme-item hover:bg-theme-hover text-theme transition-colors",disabled:c,children:"\u53D6\u6D88"}),he("button",{onClick:L,className:"px-3 py-1.5 text-sm rounded-lg bg-red-500 hover:bg-red-600 text-white transition-colors flex items-center gap-1",disabled:c,children:[c&&ae(Q,{size:14,className:"animate-spin"}),"\u5220\u9664"]})]})]})})]})]}),document.body)};import{useState as Bi,useEffect as Uu,useRef as Ou}from"react";import{createPortal as zu}from"react-dom";import{Fragment as Ut,jsx as Le,jsxs as Me}from"react/jsx-runtime";var Qr=({profile:e,loading:o,position:t,onClose:a,onQuitGroup:r})=>{let s=Ou(null),[l,n]=Bi({left:t.x,top:t.y}),[i,u]=Bi(!1),d=lt(),c=e?.ownerUin===d;if(Uu(()=>{if(!s.current)return;let m=320,g=s.current.offsetHeight||300,L=t.x,C=t.y;L+m>window.innerWidth-20&&(L=window.innerWidth-m-20),L<20&&(L=20),C+g>window.innerHeight-20&&(C=window.innerHeight-g-20),C<20&&(C=20),n({left:L,top:C})},[t,e,o]),!e&&!o)return null;let f=m=>m?new Date(m*1e3).toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}):"",h=()=>{u(!0)},p=()=>{e&&r&&r(e.groupCode,c),u(!1),a()};return zu(Me(Ut,{children:[Le("div",{className:"fixed inset-0 z-40",onClick:a}),Le("div",{ref:s,className:"fixed z-50 r-card overflow-hidden bg-popup glass-pop origin-top-left",style:{left:l.left,top:l.top,width:320,maxHeight:"calc(100vh - 40px)"},onClick:m=>m.stopPropagation(),children:o?Le("div",{className:"flex items-center justify-center h-40",children:Le(Q,{size:24,className:"animate-spin text-pink-500"})}):e&&Me(Ut,{children:[Me("div",{className:"bg-gradient-to-r from-blue-400 to-cyan-300 p-4 relative",children:[r&&Le("button",{onClick:h,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",title:c?"\u89E3\u6563\u8BE5\u7FA4":"\u9000\u51FA\u8BE5\u7FA4",children:Le(ta,{size:16})}),Me("div",{className:"flex items-start gap-4",children:[Le("img",{src:e.avatar,alt:e.groupName,className:"w-16 h-16 rounded-lg border-3 border-white/80 object-cover flex-shrink-0"}),Me("div",{className:"flex-1 min-w-0 text-white pt-1 pr-6",children:[Le("div",{className:"font-bold text-lg truncate mb-1",children:e.groupName}),e.remarkName&&e.remarkName!==e.groupName&&Me("div",{className:"text-white/80 text-sm truncate mb-1",children:["\u5907\u6CE8: ",e.remarkName]}),Le("div",{className:"text-white/90 text-sm",children:e.groupCode})]})]})]}),Me("div",{className:"p-4 overflow-y-auto",style:{maxHeight:"calc(100vh - 40px - 140px)"},children:[Me("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[Me("span",{className:"text-theme-hint flex items-center gap-1",children:[Le(gt,{size:14}),"\u6210\u5458"]}),Me("span",{className:"text-theme",children:[e.memberCount,e.maxMemberCount?` / ${e.maxMemberCount}`:""]}),e.ownerName&&Me(Ut,{children:[Me("span",{className:"text-theme-hint flex items-center gap-1",children:[Le(mt,{size:14}),"\u7FA4\u4E3B"]}),Le("span",{className:"text-theme truncate",children:e.ownerName})]}),e.createTime&&Me(Ut,{children:[Me("span",{className:"text-theme-hint flex items-center gap-1",children:[Le(Ua,{size:14}),"\u521B\u5EFA"]}),Le("span",{className:"text-theme",children:f(e.createTime)})]})]}),e.description&&Me(Ut,{children:[Le("div",{className:"border-t border-theme-divider my-3"}),Le("div",{className:"text-xs text-theme-hint mb-2",children:"\u7FA4\u7B80\u4ECB"}),Le("div",{className:"text-theme-secondary text-sm bg-theme-item/50 rounded-lg px-3 py-2 break-words whitespace-pre-wrap",style:{maxHeight:"120px",overflowY:"auto"},children:e.description})]}),e.announcement&&Me(Ut,{children:[Le("div",{className:"border-t border-theme-divider my-3"}),Me("div",{className:"text-xs text-theme-hint mb-2 flex items-center gap-1",children:[Le(pt,{size:12}),"\u7FA4\u516C\u544A"]}),Le("div",{className:"text-theme-secondary text-sm bg-theme-item/50 rounded-lg px-3 py-2 break-words whitespace-pre-wrap",style:{maxHeight:"120px",overflowY:"auto"},children:e.announcement})]})]})]})}),i&&e&&Me(Ut,{children:[Le("div",{className:"fixed inset-0 z-[60] bg-black/50",onClick:()=>u(!1)}),Me("div",{className:"fixed z-[70] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[320px]",children:[Le("h3",{className:"text-lg font-medium text-theme mb-4",children:c?"\u786E\u8BA4\u89E3\u6563\u7FA4\u804A":"\u786E\u8BA4\u9000\u51FA\u7FA4\u804A"}),Le("p",{className:"text-theme-secondary mb-6",children:c?Me(Ut,{children:["\u786E\u5B9A\u8981\u89E3\u6563\u7FA4 ",Le("span",{className:"font-medium text-theme",children:e.groupName})," \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u6240\u6709\u7FA4\u6210\u5458\u5C06\u88AB\u79FB\u51FA\u3002"]}):Me(Ut,{children:["\u786E\u5B9A\u8981\u9000\u51FA\u7FA4 ",Le("span",{className:"font-medium text-theme",children:e.groupName})," \u5417\uFF1F"]})}),Me("div",{className:"flex justify-end gap-3",children:[Le("button",{onClick:()=>u(!1),className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),Le("button",{onClick:p,className:"px-4 py-2 text-sm bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors",children:c?"\u786E\u8BA4\u89E3\u6563":"\u786E\u8BA4\u9000\u51FA"})]})]})]})]}),document.body)};import{useState as Jr,useEffect as Hu}from"react";import{createPortal as Ui}from"react-dom";import{jsx as kt,jsxs as Zr}from"react/jsx-runtime";var Yr=({url:e,onClose:o})=>e?Ui(Zr("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/80",onClick:o,children:[kt("button",{onClick:async a=>{a.stopPropagation();try{let r=new URL(e,location.origin).pathname.split("/").pop()||"image";await Bo(e,r)}catch(r){T(r.message||"\u4E0B\u8F7D\u5931\u8D25","error")}},title:"\u4E0B\u8F7D\u56FE\u7247",className:"absolute top-4 right-16 p-2 text-white/80 hover:text-white bg-black/50 rounded-full",children:kt(Dt,{size:24})}),kt("button",{onClick:o,className:"absolute top-4 right-4 p-2 text-white/80 hover:text-white bg-black/50 rounded-full",children:kt(we,{size:24})}),kt("img",{src:e,alt:"\u9884\u89C8",className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:a=>a.stopPropagation()})]}),document.body):null,es=({videoInfo:e,onClose:o})=>{let[t,a]=Jr(null),[r,s]=Jr(!1),[l,n]=Jr(null);return Hu(()=>{if(!e){a(null),n(null);return}s(!0),n(null),cl(e.fileUuid,e.isGroup).then(a).catch(i=>n(i.message||"\u83B7\u53D6\u89C6\u9891\u5931\u8D25")).finally(()=>s(!1))},[e]),e?Ui(Zr("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/80",onClick:o,children:[kt("button",{onClick:o,className:"absolute top-4 right-4 p-2 text-white/80 hover:text-white bg-black/50 rounded-full z-10",children:kt(we,{size:24})}),r&&Zr("div",{className:"text-white flex items-center gap-2",children:[kt(Q,{size:24,className:"animate-spin"}),"\u52A0\u8F7D\u4E2D..."]}),l&&kt("div",{className:"text-red-400",children:l}),t&&!r&&kt("video",{src:t,controls:!0,autoPlay:!0,className:"max-w-[90vw] max-h-[90vh]",onClick:i=>i.stopPropagation()})]}),document.body):null};import Mt,{useState as Xe,useEffect as as,memo as os,useRef as ts}from"react";import{createPortal as ju}from"react-dom";import{Slot as Wu}from"@luckylillia-dev/plugin-sdk/webui";var Oi=new WeakMap;function Xo(e){let o=Oi.get(e);return o||(o={msgId:e.msgId,msgSeq:String(e.msgSeq),chatType:Number(e.chatType),peerId:String(e.peerUin),senderUin:String(e.senderUin),senderName:e.sendMemberName||e.sendNickName||String(e.senderUin),time:Number(e.msgTime),text:(e.elements??[]).map(t=>t.textElement?.content??"").join(""),self:e.senderUid===Ze()},Oi.set(e,o)),o}var Gu=600*1e3,_u=30*1e3,Ot=Uo((e,o)=>({privateRkey:"",groupRkey:"",fetchedAt:0,loading:!1,ensureRkey:()=>{let{fetchedAt:t,loading:a}=o();a||t&&Date.now()-t<Gu||o().refresh()},refresh:async()=>{let{loading:t,fetchedAt:a}=o();if(!t&&!(a&&Date.now()-a<_u)){e({loading:!0});try{let r=await rl();e({privateRkey:r.private_rkey||"",groupRkey:r.group_rkey||"",fetchedAt:Date.now(),loading:!1})}catch{e({loading:!1})}}}}));import{Fragment as Qo,jsx as U,jsxs as be}from"react/jsx-runtime";var go=Mt.createContext(null),Ko=Mt.createContext(null),rs=Mt.createContext(null),ss=Mt.createContext(null),ns=(e,o)=>{if(!e)return"";if(e.startsWith("blob:"))return e;if(e.includes("qpic.cn")||e.includes("multimedia.nt.qq.com.cn")){if(e.includes("rkey="))return e;try{let t=new URL(e).searchParams.get("appid");if(t==="1406"&&o?.privateRkey)return e+o.privateRkey;if(t==="1407"&&o?.groupRkey)return e+o.groupRkey}catch{}return e}return e},xo=os(({element:e,message:o})=>U(Wu,{name:"webqq.message.element",match:String(e.elementType),props:{element:e,message:o&&Xo(o)},children:U(Vu,{element:e,message:o})})),Vu=os(({element:e,message:o})=>{let[t,a]=Xe(!1),[r,s]=Xe(!1),[l,n]=Xe(!1),[i,u]=Xe(!1),d=Mt.useContext(go),c=Mt.useContext(Ko),f=Mt.useContext(rs),h=Ot(m=>m.privateRkey),p=Ot(m=>m.groupRkey);if(as(()=>{e.picElement&&Ot.getState().ensureRkey()},[e]),e.textElement)return U("span",{className:"whitespace-pre-wrap break-all",style:{overflowWrap:"anywhere",wordBreak:"break-all"},children:e.textElement.content});if(e.picElement){let m=e.picElement,g=m.originImageUrl?m.originImageUrl.startsWith("http")?m.originImageUrl:`https://gchat.qpic.cn${m.originImageUrl}`:"",L=ns(g,{privateRkey:h,groupRkey:p}),C=200,I=300,A=m.picWidth||200,b=m.picHeight||200;return b>C&&(A=A*C/b,b=C),A>I&&(b=b*I/A,A=I),be("div",{className:"relative rounded-lg overflow-hidden bg-theme-item cursor-pointer",style:{width:A,height:b},onClick:()=>d?.showPreview(L),onContextMenu:M=>{o&&(M.preventDefault(),M.stopPropagation(),f?.showMenu(M,o,e.elementId))},children:[!t&&!r&&U("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint",children:U(Q,{size:24,className:"animate-spin"})}),r&&U("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint text-xs",children:"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"}),U("img",{src:L,alt:"\u56FE\u7247",loading:"lazy",referrerPolicy:"no-referrer",className:`w-full h-full object-cover transition-opacity ${t?"opacity-100":"opacity-0"}`,onLoad:()=>a(!0),onError:()=>{s(!0),Ot.getState().refresh()}})]})}if(e.faceElement){let m=e.faceElement.faceIndex,g=e.faceElement.faceText;return U("img",{src:Je(`/face/${m}.png`),alt:g||`[\u8868\u60C5${m}]`,title:g||`\u8868\u60C5${m}`,className:"inline-block align-text-bottom",style:{width:24,height:24},onError:L=>{let C=L.target;C.style.display="none";let I=document.createElement("span");I.textContent=g||`[\u8868\u60C5${m}]`,C.parentNode?.insertBefore(I,C)}})}if(e.fileElement){let m=e.fileElement,g=o?.chatType===2,L=g?{fileId:m.fileUuid,folderId:m.folderId}:void 0,C=o&&!g&&m.fileUuid?{fileId:m.fileUuid,peerUid:o.peerUid,isSelfSend:o.senderUid===Ze()}:void 0;return U($u,{fileName:m.fileName,fileSize:m.fileSize,groupFile:L,privateFile:C})}if(e.pttElement)return U(Ku,{element:e,message:o});if(e.videoElement){let m=e.videoElement,g=200,L=300,C=m.thumbWidth||200,I=m.thumbHeight||150;I>g&&(C=C*g/I,I=g),C>L&&(I=I*L/C,C=L);let A="";if(m.thumbPath){let H;m.thumbPath instanceof Map?H=m.thumbPath.values().next().value:typeof m.thumbPath=="object"&&(H=Object.values(m.thumbPath)[0]),H&&(A=vt().authUrl(`/api/webqq/file-proxy?path=${encodeURIComponent(H)}`))}let b=m.fileTime||0,F=Math.floor(b/60),M=b%60,O=`${F}:${M.toString().padStart(2,"0")}`;return be("div",{className:"relative rounded-lg overflow-hidden bg-theme-item cursor-pointer group",style:{width:C,height:I},onClick:()=>{m.fileUuid&&c?.showPreview(m.fileUuid,o?.chatType===2)},children:[U("div",{className:"absolute inset-0 fill-quiet"}),A?be(Qo,{children:[!l&&!i&&U("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint",children:U(Q,{size:24,className:"animate-spin"})}),U("img",{src:A,alt:"\u89C6\u9891\u7F29\u7565\u56FE",loading:"lazy",className:`absolute inset-0 w-full h-full object-cover transition-opacity ${l?"opacity-100":"opacity-0"}`,onLoad:()=>n(!0),onError:()=>u(!0)})]}):U("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint text-xs",children:"\u89C6\u9891"}),U("div",{className:"absolute inset-0 flex items-center justify-center",children:U("div",{className:"w-12 h-12 rounded-full bg-black/50 flex items-center justify-center group-hover:bg-black/70 transition-colors",children:U("div",{className:"w-0 h-0 border-t-8 border-t-transparent border-l-12 border-l-white border-b-8 border-b-transparent ml-1",style:{borderLeftWidth:"14px"}})})}),U("div",{className:"absolute bottom-1 right-1 px-1.5 py-0.5 bg-black/60 rounded text-white text-xs",children:O})]})}if(e.grayTipElement){let m=e.grayTipElement;if(m.jsonGrayTipElement?.jsonStr)try{let g=JSON.parse(m.jsonGrayTipElement.jsonStr);if(g.items){let L=g.items.map(C=>C.txt||"").join("");return U("span",{className:"text-theme-hint text-xs",children:L||"[\u6233\u4E00\u6233]"})}}catch{}return U("span",{className:"text-theme-hint text-xs",children:"[\u7CFB\u7EDF\u63D0\u793A]"})}if(e.multiForwardMsgElement)return U(Yu,{element:e});if(e.arkElement){try{let m=JSON.parse(e.arkElement.bytesData);if(m.app==="com.tencent.multimsg"&&m.meta?.detail?.resid)return U(ec,{arkData:m})}catch{}return U("span",{children:"[\u5361\u7247\u6D88\u606F]"})}if(e.marketFaceElement){let{emojiId:m,faceName:g,supportSize:L}=e.marketFaceElement,{width:C=200,height:I=200}=L?.[0]??{},b=`https://gxh.vip.qq.com/club/item/parcel/item/${m.substring(0,2)}/${m}/raw${Math.min(C,300)}.gif`;return U("img",{src:b,alt:g||"[\u8868\u60C5\u5305]",title:g,className:"inline-block align-text-bottom rounded",style:{maxWidth:Math.min(C,200),maxHeight:Math.min(I,200)},onError:F=>{let M=F.target;M.style.display="none";let O=document.createElement("span");O.textContent=`[${g||"\u8868\u60C5\u5305"}]`,M.parentNode?.insertBefore(O,M)}})}return null}),$u=os(({fileName:e,fileSize:o,groupFile:t,privateFile:a})=>{let r=Xu(o),s=Mt.useContext(ss),[l,n]=Xe(!1),i=!!t&&!!s,u=!!a,d=i||u;return be("div",{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg bg-white/5 dark:bg-white/5 border border-white/10 min-w-[220px] max-w-[280px]${d?" cursor-pointer hover:bg-white/10 transition-colors":""}`,onClick:d?async()=>{if(i){s.open(t);return}if(u&&!l){n(!0);try{let f=await wl(a.peerUid,a.fileId,a.isSelfSend);window.open(f,"_blank")}catch(f){T(f.message||"\u4E0B\u8F7D\u5931\u8D25","error")}finally{n(!1)}}}:void 0,title:i?"\u5728\u7FA4\u6587\u4EF6\u4E2D\u67E5\u770B":u?"\u70B9\u51FB\u4E0B\u8F7D":void 0,children:[be("div",{className:"flex-1 min-w-0",children:[U("div",{className:"text-sm font-medium leading-snug line-clamp-2 break-all",children:e}),r&&U("div",{className:"text-xs opacity-60 mt-1",children:r})]}),U("div",{className:"flex-shrink-0 w-10 h-10 rounded bg-white/10 flex items-center justify-center",children:l?U(Q,{className:"w-5 h-5 opacity-70 animate-spin"}):U(Yt,{className:"w-5 h-5 opacity-70"})})]})});function Xu(e){if(!e||e<=0)return"";let o=["B","KB","MB","GB","TB"],t=0,a=e;for(;a>=1024&&t<o.length-1;)a/=1024,t++;return`${a.toFixed(a>=100||t===0?0:a>=10?1:2)} ${o[t]}`}var ls=e=>!!(e.textElement||e.picElement||e.fileElement||e.pttElement||e.videoElement||e.faceElement||e.grayTipElement||e.arkElement||e.marketFaceElement||e.multiForwardMsgElement),is=e=>!e.elements||e.elements.length===0?!1:e.elements.every(o=>o.grayTipElement||o.replyElement),Ku=({element:e,message:o})=>{let[t,a]=Xe(null),[r,s]=Xe(!1),[l,n]=Xe(!1),[i,u]=Xe(!1),[d,c]=Xe(!1),f=ts(null),h=ts(null),p=ts(null);as(()=>()=>{p.current?.abort(),f.current&&(f.current.onended=null,f.current.onerror=null,f.current.onloadeddata=null,f.current.pause(),f.current.src=""),h.current&&URL.revokeObjectURL(h.current)},[]);let m=e.pttElement,g=m.duration||0,L=Math.floor(g/60),C=g%60,I=L>0?`${L}:${C.toString().padStart(2,"0")}`:`${C}"`,A=m.text,b=80,M=Math.min(200,Math.max(b,b+g*3)),O=async()=>{if(!o||!m.fileUuid&&!m.filePath||d)return;if(i&&f.current){f.current.pause(),u(!1);return}if(f.current&&f.current.readyState>=2){try{if(await f.current.play(),p.current?.signal.aborted)return;u(!0)}catch{if(p.current?.signal.aborted)return;u(!1),T("\u8BED\u97F3\u64AD\u653E\u5931\u8D25\uFF0C\u8BF7\u518D\u6B21\u70B9\u51FB\u64AD\u653E","error")}return}c(!0);let H=new AbortController;p.current=H;try{let W=o.chatType===2,le=await bl(m.fileUuid||"",W,m.filePath,H.signal);if(H.signal.aborted)return;f.current&&(f.current.onended=null,f.current.onerror=null,f.current.onloadeddata=null,f.current.pause(),f.current.src=""),h.current&&URL.revokeObjectURL(h.current);let R=URL.createObjectURL(le);h.current=R;let E=new Audio;f.current=E,E.onended=()=>u(!1),E.onerror=()=>{u(!1),c(!1),T("\u8BED\u97F3\u65E0\u6CD5\u64AD\u653E\uFF0C\u8BF7\u91CD\u8BD5","error")},E.onloadeddata=async()=>{c(!1);try{if(await E.play(),H.signal.aborted)return;u(!0)}catch{if(H.signal.aborted)return;u(!1),T("\u8BED\u97F3\u64AD\u653E\u5931\u8D25\uFF0C\u8BF7\u518D\u6B21\u70B9\u51FB\u64AD\u653E","error")}},E.src=R}catch(W){if(H.signal.aborted)return;T(W instanceof Error?W.message:"\u83B7\u53D6\u8BED\u97F3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","error"),u(!1),c(!1)}},Z=async()=>{if(!(!o||r||t!==null)){s(!0),n(!1);try{let H=await xl(o.msgId,o.chatType,o.peerUid,e);a(H||"(\u65E0\u6CD5\u8BC6\u522B)")}catch(H){console.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25:",H),n(!0),a("\u8F6C\u6362\u5931\u8D25")}finally{s(!1)}}};return be("div",{className:"flex flex-col gap-1",children:[be("div",{className:"flex items-center gap-2",children:[be("div",{className:"flex items-center gap-2 px-3 py-2 bg-green-100 dark:bg-green-900/40 rounded-full cursor-pointer hover:bg-green-200 dark:hover:bg-green-900/60 transition-colors",style:{width:M},onClick:O,title:"\u70B9\u51FB\u64AD\u653E",children:[d?U(Q,{size:16,className:"text-green-600 dark:text-green-400 flex-shrink-0 animate-spin"}):i?U(Ka,{size:16,className:"text-green-600 dark:text-green-400 flex-shrink-0"}):U(Qa,{size:16,className:"text-green-600 dark:text-green-400 flex-shrink-0"}),U("div",{className:"flex-1 flex items-center gap-0.5",children:[1,2,3,4,5].map(H=>U("div",{className:`w-0.5 bg-green-400 dark:bg-green-500 rounded-full transition-all ${i?"animate-pulse":""}`,style:{height:`${8+Math.random()*8}px`}},H))}),U("span",{className:"text-xs text-green-700 dark:text-green-300 flex-shrink-0",children:I})]}),!A&&t===null&&U("button",{onClick:Z,disabled:r,className:"w-6 h-6 flex items-center justify-center rounded-full fill-quiet fill-quiet-hover text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-white text-xs font-medium transition-colors disabled:opacity-50",title:"\u8BED\u97F3\u8F6C\u6587\u5B57",children:r?U(Q,{size:12,className:"animate-spin"}):"\u6587"})]}),(A||t)&&U("div",{className:`text-sm px-3 py-1.5 fill-quiet r-control max-w-[250px] ${l?"text-red-500":"text-theme-secondary"}`,children:A||t})]})},Qu=({segment:e})=>{let o=Mt.useContext(go),t=Ot(r=>r.privateRkey),a=Ot(r=>r.groupRkey);if(as(()=>{e.type==="image"&&Ot.getState().ensureRkey()},[e]),e.type==="text"&&e.data.text)return U("span",{className:"whitespace-pre-wrap break-all",style:{overflowWrap:"anywhere"},children:e.data.text});if(e.type==="image"&&e.data.url){let r=ns(e.data.url,{privateRkey:t,groupRkey:a});return U("img",{src:r,alt:"\u56FE\u7247",loading:"lazy",referrerPolicy:"no-referrer",className:"max-w-[200px] max-h-[150px] rounded-lg cursor-pointer object-cover",onClick:()=>o?.showPreview(r),onError:()=>Ot.getState().refresh()})}return e.type==="face"&&e.data.faceId!==void 0?U("img",{src:Je(`/face/${e.data.faceId}.png`),alt:`[\u8868\u60C5${e.data.faceId}]`,className:"inline-block align-text-bottom",style:{width:24,height:24},onError:r=>{let s=r.target;s.style.display="none";let l=document.createElement("span");l.textContent=`[\u8868\u60C5${e.data.faceId}]`,s.parentNode?.insertBefore(l,s)}}):e.type==="forward"&&e.data.resId?U(Ju,{resId:e.data.resId,title:e.data.title||"[\u804A\u5929\u8BB0\u5F55]"}):null},Ju=({resId:e,title:o})=>{let[t,a]=Xe(!1);return be(Qo,{children:[be("div",{className:"flex items-center gap-2 px-3 py-2 fill-quiet r-control cursor-pointer fill-quiet-hover transition-colors",onClick:()=>a(!0),children:[U("span",{className:"text-sm text-theme-secondary",children:o}),U(et,{size:14,className:"text-theme-hint flex-shrink-0"})]}),t&&U(ds,{resId:e,title:o,onClose:()=>a(!1)})]})};function Zu(e){let o=e.match(/<title[^>]*color="#000000"[^>]*>(.*?)<\/title>/)?.[1]||"[\u804A\u5929\u8BB0\u5F55]",a=e.match(/<title[^>]*color="#777777"[^>]*>(.*?)<\/title>/g)?.map(s=>s.replace(/<[^>]+>/g,""))||[],r=e.match(/<summary[^>]*>(.*?)<\/summary>/)?.[1]||"";return{title:o,previews:a,summary:r}}var Yu=({element:e})=>{let[o,t]=Xe(!1),a=e.multiForwardMsgElement,{title:r,previews:s,summary:l}=Zu(a.xmlContent);return be(Qo,{children:[be("div",{className:"w-[240px] fill-quiet r-control overflow-hidden cursor-pointer fill-quiet-hover transition-colors border border-theme-divider",onClick:()=>t(!0),children:[be("div",{className:"px-3 pt-2.5 pb-1",children:[U("div",{className:"text-sm font-medium text-theme mb-1.5",children:r}),s.map((n,i)=>U("div",{className:"text-xs text-theme-secondary truncate leading-5",children:n},i))]}),be("div",{className:"flex items-center justify-between px-3 py-1.5 border-t border-theme-divider",children:[U("span",{className:"text-xs text-theme-hint",children:l}),U(et,{size:12,className:"text-theme-hint"})]})]}),o&&U(ds,{resId:a.resId,title:r,onClose:()=>t(!1)})]})},ec=({arkData:e})=>{let[o,t]=Xe(!1),a=e.meta?.detail||{},r=a.source||"[\u804A\u5929\u8BB0\u5F55]",s=(a.news||[]).map(i=>i.text||""),l=a.summary||"",n=a.resid||"";return be(Qo,{children:[be("div",{className:"w-[240px] fill-quiet r-control overflow-hidden cursor-pointer fill-quiet-hover transition-colors border border-theme-divider",onClick:()=>t(!0),children:[be("div",{className:"px-3 pt-2.5 pb-1",children:[U("div",{className:"text-sm font-medium text-theme mb-1.5",children:r}),s.map((i,u)=>U("div",{className:"text-xs text-theme-secondary truncate leading-5",children:i},u))]}),be("div",{className:"flex items-center justify-between px-3 py-1.5 border-t border-theme-divider",children:[U("span",{className:"text-xs text-theme-hint",children:l}),U(et,{size:12,className:"text-theme-hint"})]})]}),o&&U(ds,{resId:n,title:r,onClose:()=>t(!1)})]})},ds=({resId:e,title:o,onClose:t})=>{let[a,r]=Xe([]),[s,l]=Xe(!0),[n,i]=Xe(null);Mt.useEffect(()=>{let d=!1;return(async()=>{try{l(!0),i(null);let f=await Fl(e);d||r(f)}catch(f){d||i(f.message||"\u52A0\u8F7D\u5931\u8D25")}finally{d||l(!1)}})(),()=>{d=!0}},[e]);let u=d=>d?new Date(d*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):"";return ju(U("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center scrim",onClick:t,children:be("div",{className:"glass glass-thick r-window glass-pop w-[90vw] max-w-[480px] max-h-[80vh] flex flex-col overflow-hidden",onClick:d=>d.stopPropagation(),children:[be("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider flex-shrink-0",children:[U("span",{className:"font-medium text-theme",children:o}),U("button",{onClick:t,className:"p-1 rounded-full fill-quiet-hover transition-colors",children:U(we,{size:18,className:"text-theme-hint"})})]}),be("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[s&&U("div",{className:"flex items-center justify-center py-8",children:U(Q,{size:24,className:"animate-spin text-pink-500"})}),n&&U("div",{className:"text-center py-8 text-red-500 text-sm",children:n}),!s&&!n&&a.length===0&&U("div",{className:"text-center py-8 text-theme-hint text-sm",children:"\u6682\u65E0\u6D88\u606F"}),!s&&!n&&a.map((d,c)=>be("div",{className:"flex gap-2",children:[U("img",{src:Be(d.senderUin),alt:d.senderName,className:"w-7 h-7 rounded-full object-cover flex-shrink-0 mt-0.5"}),be("div",{className:"flex-1 min-w-0",children:[be("div",{className:"flex items-center gap-2 mb-0.5",children:[U("span",{className:"text-xs font-medium text-theme-secondary",children:d.senderName}),U("span",{className:"text-xs text-theme-hint",children:u(d.time)})]}),be("div",{className:"text-sm text-theme break-words",children:[d.segments.map((f,h)=>U(Qu,{segment:f},h)),d.segments.length===0&&U("span",{className:"text-theme-hint",children:"[\u4E0D\u652F\u6301\u7684\u6D88\u606F\u7C7B\u578B]"})]})]})]},c))]})]})}),document.body)};import tt,{useState as Hi,useEffect as tc,memo as Zo}from"react";import{Slot as ac,useSlotMatches as oc}from"@luckylillia-dev/plugin-sdk/webui";import{jsx as oe,jsxs as Ye}from"react/jsx-runtime";var Yo=tt.createContext(null),cs=tt.createContext(null),fs=tt.createContext(null),er=tt.createContext(null),tr=tt.createContext(null),ar=tt.createContext(null),or=tt.createContext(null),zi=e=>{for(let o of e.elements)if(o.grayTipElement?.jsonGrayTipElement?.jsonStr)try{let t=JSON.parse(o.grayTipElement.jsonGrayTipElement.jsonStr);if(Array.isArray(t.items))return t.items}catch{}return null},Jo=(e,o,t)=>!!(o&&e.uid&&String(e.uid)===String(o)||t&&e.uin&&String(e.uin)===String(t)),us=(e,o,t)=>{let a=[],r=0;for(let s of e)if(s.type==="qq"){let l=Jo(s,o,t)?"\u4F60":s.nm||s.uin||s.uid||"";l&&a.push(oe("span",{className:"text-blue-500",children:l},r++))}else s.type==="nor"&&s.txt?a.push(oe("span",{children:s.txt},r++)):s.type==="img"&&s.src&&a.push(oe("img",{src:s.src,alt:"",referrerPolicy:"no-referrer",className:"inline-block w-4 h-4 mx-0.5 align-text-bottom",onError:l=>{l.currentTarget.style.display="none"}},r++));return a.length>0?a:"[\u7CFB\u7EDF\u63D0\u793A]"},la=new Map,rc=Zo(({message:e,groupCode:o})=>{let t=Ze(),a=lt(),r=zi(e),s=!!r?.some(u=>u.type==="qq"&&u.uid&&!u.nm&&!Jo(u,t,a)),l=la.get(e.msgId)??(r&&!s?us(r,t,a):void 0),[n,i]=Hi(l??"[\u7CFB\u7EDF\u63D0\u793A]");return tc(()=>{if(la.has(e.msgId)){i(la.get(e.msgId));return}let u=zi(e);if(!u){for(let f of e.elements)if(f.grayTipElement?.xmlElement?.content){let h=f.grayTipElement.xmlElement.content.replace(/<[^>]+>/g,"");la.set(e.msgId,h),i(h);return}la.set(e.msgId,"[\u7CFB\u7EDF\u63D0\u793A]"),i("[\u7CFB\u7EDF\u63D0\u793A]");return}if(!u.some(f=>f.type==="qq"&&f.uid&&!f.nm&&!Jo(f,t,a))){let f=us(u,t,a);la.set(e.msgId,f),i(f);return}(async()=>{let f=await Promise.all(u.map(async p=>{if(p.type==="qq"&&p.uid&&!p.nm&&!Jo(p,t,a)){let m=await gl(p.uid,o);return{...p,nm:m}}return p})),h=us(f,t,a);la.set(e.msgId,h),i(h)})()},[e.msgId,t,a,o]),oe("div",{className:"flex justify-center py-2",children:oe("span",{className:"text-xs text-theme-hint bg-theme-item/50 px-3 py-1 rounded-full",children:n})})}),ms=Zo(({message:e,allMessages:o,isHighlighted:t})=>{if(is(e)){let v=e.chatType===2?String(e.peerUin):void 0;return oe(rc,{message:e,groupCode:v})}let a=Ze(),r=a?e.senderUid===a:!1,s=tt.useContext(Yo),l=tt.useContext(er),n=tt.useContext(tr),i=tt.useContext(ar),u=tt.useContext(or),d=tt.useContext(cs),c=oc("webqq.message.element"),f=e.sendMemberName||e.sendNickName||String(e.senderUin);if(e.chatType===1&&!r&&u){let v=u.getFriend(String(e.senderUin));v&&(f=v.remark||v.nickname||f)}let h=Be(e.senderUin),p=Number(e.msgTime)*1e3,m,g,L;if(e.chatType===2){let v=e.msgAttrs;if(v){let q=(w=>{if(v instanceof Map)return v.get(w);if(typeof v=="object")return v[w.toString()]})(2);q?.groupHonor&&(m=q.groupHonor.level,g=q.groupHonor.uniqueTitle||void 0)}if(i){let q=i.getMembers(String(e.peerUin))?.find(w=>w.uid===e.senderUid||w.uin===String(e.senderUin));q&&(L=q.role,m===void 0&&q.level&&(m=q.level),!g&&q.specialTitle&&(g=q.specialTitle))}}if(!e.elements||!Array.isArray(e.elements))return null;let C=e.recallTime&&e.recallTime!=="0",I=e.elements.find(v=>v.replyElement)?.replyElement,A=e.elements.filter(v=>!v.replyElement);if(!(A.some(v=>ls(v)||c.includes(String(v.elementType)))||I))return null;let F=A.length===1&&A[0].pttElement&&!I,M=I?.replayMsgSeq??I?.replyMsgSeq,O=I?o.find(v=>v.msgId===I.replayMsgId||String(v.msgSeq)===String(M)):null,Z=v=>{d?.enabled||(v.preventDefault(),v.stopPropagation(),s?.showMenu(v,e))},H=v=>{v.preventDefault(),v.stopPropagation(),l?.showMenu(v,{senderUid:e.senderUid,senderUin:String(e.senderUin),senderName:f,chatType:e.chatType,groupCode:e.chatType===2?String(e.peerUin):void 0})},W=v=>{("ontouchstart"in window||navigator.maxTouchPoints>0)&&(v.preventDefault(),v.stopPropagation(),l?.showMenu(v,{senderUid:e.senderUid,senderUin:String(e.senderUin),senderName:f,chatType:e.chatType,groupCode:e.chatType===2?String(e.peerUin):void 0}))},le=()=>{I&&n?.scrollToMessage(I.replayMsgId,M===void 0?void 0:String(M))},R=Ye("div",{className:`flex gap-2 w-full ${r?"flex-row-reverse":""} ${t?"animate-pulse fill-selected r-control -mx-2 px-2":""}`,children:[oe("img",{src:h,alt:f,loading:"lazy",className:"w-8 h-8 rounded-full object-cover flex-shrink-0 cursor-pointer hover:opacity-80 transition-opacity",onClick:W,onContextMenu:H}),Ye("div",{className:`flex flex-col ${r?"items-end":"items-start"} max-w-[calc(100%-48px)] md:max-w-[70%] min-w-0 overflow-hidden`,children:[Ye("div",{className:`flex items-center gap-1.5 mb-1 ${r?"flex-row-reverse":""}`,children:[oe("span",{className:"text-xs text-theme-hint",children:f}),m!==void 0&&m>0&&Ye("span",{className:"text-xs px-1 py-0.5 fill-quiet text-theme-secondary r-inner",children:["Lv.",m]}),L==="owner"&&oe("span",{className:"text-xs px-1.5 py-0.5 bg-amber-100 dark:bg-amber-900/50 text-amber-600 dark:text-amber-300 rounded",children:g||"\u7FA4\u4E3B"}),L==="admin"&&oe("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 dark:bg-blue-900/50 text-blue-600 dark:text-blue-300 rounded",children:g||"\u7BA1\u7406\u5458"}),L==="member"&&g&&oe("span",{className:"text-xs px-1.5 py-0.5 bg-pink-100 dark:bg-pink-900/50 text-pink-600 dark:text-pink-300 rounded",children:g})]}),oe(ac,{name:"webqq.message.bubble",props:{message:Xo(e)},children:F?Ye("div",{onContextMenu:Z,className:C?"opacity-50":"",children:[A.map((v,B)=>oe(xo,{element:v,message:e},B)),C&&oe("div",{className:"text-xs text-theme-muted italic mt-1",children:"\u5DF2\u64A4\u56DE"})]}):Ye("div",{className:"relative",children:[Ye("div",{className:`rounded-[18px] px-4 py-2 min-w-[80px] max-w-full break-words overflow-hidden bg-theme-item text-theme ${C?"opacity-50":""}`,onContextMenu:Z,children:[I&&oe("div",{className:"text-xs mb-2 pb-2 border-b border-theme-divider cursor-pointer hover:opacity-80 transition-opacity",onClick:le,children:oe("div",{className:"bg-theme-input rounded px-2 py-1",children:O?Ye("div",{className:"space-y-1",children:[Ye("div",{className:"font-medium text-theme-secondary",children:[O.sendMemberName||O.sendNickName||O.senderUin,":"]}),oe("div",{className:"text-theme-muted",children:O.elements?.filter(v=>!v.replyElement).map((v,B)=>oe(xo,{element:v},B))})]}):oe("span",{className:"text-theme-muted",children:I.sourceMsgText||"[\u6D88\u606F]"})})}),A.map((v,B)=>oe(xo,{element:v,message:e},B))]}),C&&oe("div",{className:"text-xs text-theme-muted italic mt-1",children:"\u5DF2\u64A4\u56DE"})]})}),oe(nc,{message:e,isSelf:r}),oe("span",{className:"text-xs text-theme-hint mt-1",children:uo(p)})]})]});if(!d?.enabled)return R;let E=d.isSelected(e.msgId);return Ye("div",{onClick:()=>d.toggle(e.msgId),className:`flex items-center gap-2 cursor-pointer rounded-lg -mx-2 px-2 py-1 transition-colors ${E?"fill-selected":"hover:bg-theme-item-hover"}`,children:[oe("input",{type:"checkbox",checked:E,readOnly:!0,className:"w-4 h-4 flex-shrink-0 accent-pink-500 pointer-events-none"}),oe("div",{className:"flex-1 min-w-0 pointer-events-none",children:R})]})});function sc(e,o){if(o==="2"){let t=parseInt(e).toString(16);return Je(`/face/emoji-${t}.png`)}return Je(`/face/${e}.png`)}var nc=Zo(({message:e,isSelf:o})=>{let[t,a]=Hi(null),r=tt.useContext(fs);if(!e.emojiLikesList||e.emojiLikesList.length===0)return null;let s=async(l,n)=>{if(!t){a(l);try{await lo(e.chatType,String(e.peerUin),e.msgSeq,l,!n),r?.onSelfReact(e.msgSeq,l,!n,String(e.peerUin))}catch(i){T(i.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{a(null)}}};return oe("div",{className:`flex flex-wrap gap-1 mt-1 ${o?"justify-end":"justify-start"}`,children:e.emojiLikesList.map((l,n)=>{let i=sc(l.emojiId,l.emojiType);return Ye("button",{onClick:()=>s(l.emojiId,l.isClicked),disabled:t===l.emojiId,className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-xs transition-all cursor-pointer hover:scale-105 active:scale-95 ${l.isClicked?"bg-pink-100 dark:bg-pink-900/40 border border-pink-300 dark:border-pink-700":"bg-theme-item border border-theme-divider hover:border-pink-300 dark:hover:border-pink-700"} ${t===l.emojiId?"opacity-50":""}`,title:l.isClicked?"\u70B9\u51FB\u53D6\u6D88":"\u70B9\u51FB\u8DDF\u8D34",children:[oe("img",{src:i,alt:`\u8868\u60C5${l.emojiId}`,className:"w-4 h-4",onError:u=>{if(l.emojiType==="2"){let d=u.target,c=String.fromCodePoint(parseInt(l.emojiId));d.style.display="none",d.insertAdjacentHTML("afterend",`<span class="text-sm">${c}</span>`)}}}),oe("span",{className:"text-theme-secondary",children:l.likesCnt})]},`${l.emojiId}-${n}`)})})}),ps=Zo(({message:e,onRetry:o})=>{let t=lt(),a=t?Be(t):"";return Ye("div",{className:"flex gap-2 flex-row-reverse w-full",children:[a&&oe("img",{src:a,alt:"\u6211",loading:"lazy",className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),Ye("div",{className:"flex flex-col items-end max-w-[calc(100%-48px)] md:max-w-[70%] min-w-0 overflow-hidden",children:[oe("span",{className:"text-xs text-theme-hint mb-1",children:"\u6211"}),Ye("div",{className:"flex items-end gap-1",children:[e.status==="failed"&&oe("button",{onClick:o,className:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/30 rounded",title:"\u91CD\u65B0\u53D1\u9001",children:oe(aa,{size:14})}),oe("div",{className:"rounded-[18px] px-4 py-2 bg-theme-item text-theme min-w-[80px] max-w-full break-words overflow-hidden",children:e.items.map((r,s)=>r.type==="text"&&r.content?oe("span",{className:"whitespace-pre-wrap break-words",children:r.content},s):r.type==="face"&&r.faceId!==void 0?oe("img",{src:Je(`/face/${r.faceId}.png`),alt:`[\u8868\u60C5${r.faceId}]`,className:"inline-block align-text-bottom",style:{width:24,height:24}},s):r.type==="image"&&r.imageUrl?oe("img",{src:r.imageUrl,alt:"\u56FE\u7247",loading:"lazy",className:"max-w-full rounded-lg",style:{maxHeight:"200px"}},s):r.type==="at"&&r.atName?Ye("span",{className:"text-blue-500",children:["@",r.atName]},s):null)}),e.status==="sending"&&oe(Q,{size:14,className:"animate-spin text-theme-hint"}),e.status==="failed"&&oe(ft,{size:14,className:"text-red-500"})]}),oe("span",{className:"text-xs text-theme-hint mt-1",children:uo(e.timestamp)})]})]})});import{useState as Lo}from"react";import{createPortal as hs}from"react-dom";import{Fragment as gs,jsx as Se,jsxs as Ne}from"react/jsx-runtime";var rr=({name:e,onMute:o,onClose:t})=>{let[a,r]=Lo(0),[s,l]=Lo(0),[n,i]=Lo(0),[u,d]=Lo(0),c=()=>{let h=a+s*60+n*3600+u*86400;h>0&&o(h)},f=a+s*60+n*3600+u*86400;return hs(Ne(gs,{children:[Se("div",{className:"fixed inset-0 z-50 bg-black/30",onClick:t}),Ne("div",{className:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[340px]",children:[Ne("h3",{className:"text-lg font-medium text-theme mb-4",children:["\u7981\u8A00 ",e]}),Ne("div",{className:"mb-4",children:[Se("p",{className:"text-sm text-theme-secondary mb-3",children:"\u8BBE\u7F6E\u7981\u8A00\u65F6\u957F\uFF1A"}),Ne("div",{className:"grid grid-cols-4 gap-2",children:[Ne("div",{className:"flex flex-col items-center",children:[Se("input",{type:"number",min:0,max:59,value:a,onChange:h=>r(Math.min(59,Math.max(0,parseInt(h.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),Se("span",{className:"text-xs text-theme-secondary mt-1",children:"\u79D2"})]}),Ne("div",{className:"flex flex-col items-center",children:[Se("input",{type:"number",min:0,max:59,value:s,onChange:h=>l(Math.min(59,Math.max(0,parseInt(h.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),Se("span",{className:"text-xs text-theme-secondary mt-1",children:"\u5206\u949F"})]}),Ne("div",{className:"flex flex-col items-center",children:[Se("input",{type:"number",min:0,max:23,value:n,onChange:h=>i(Math.min(23,Math.max(0,parseInt(h.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),Se("span",{className:"text-xs text-theme-secondary mt-1",children:"\u5C0F\u65F6"})]}),Ne("div",{className:"flex flex-col items-center",children:[Se("input",{type:"number",min:0,max:29,value:u,onChange:h=>d(Math.min(29,Math.max(0,parseInt(h.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),Se("span",{className:"text-xs text-theme-secondary mt-1",children:"\u5929"})]})]}),Se("p",{className:"text-xs text-theme-secondary mt-2 text-center",children:"\u6700\u957F29\u592923\u5C0F\u65F659\u520659\u79D2"})]}),Ne("div",{className:"flex justify-between",children:[Se("button",{onClick:()=>o(0),className:"px-4 py-2 text-sm text-green-500 hover:bg-green-50 dark:hover:bg-green-900/30 rounded-lg transition-colors",children:"\u89E3\u9664\u7981\u8A00"}),Ne("div",{className:"flex gap-2",children:[Se("button",{onClick:t,className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),Se("button",{onClick:c,disabled:f===0,className:"px-4 py-2 text-sm bg-orange-500 text-white hover:bg-orange-600 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"\u786E\u8BA4\u7981\u8A00"})]})]})]})]}),document.body)},sr=({name:e,groupName:o,onConfirm:t,onClose:a})=>hs(Ne(gs,{children:[Se("div",{className:"fixed inset-0 z-50 bg-black/50",onClick:a}),Ne("div",{className:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[320px]",children:[Se("h3",{className:"text-lg font-medium text-theme mb-4",children:"\u786E\u8BA4\u8E22\u51FA"}),Ne("p",{className:"text-theme-secondary mb-6",children:["\u786E\u5B9A\u8981\u5C06 ",Se("span",{className:"font-medium text-theme",children:e})," \u79FB\u51FA\u7FA4 ",Se("span",{className:"font-medium text-theme",children:o})," \u5417\uFF1F"]}),Ne("div",{className:"flex justify-end gap-3",children:[Se("button",{onClick:a,className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),Se("button",{onClick:t,className:"px-4 py-2 text-sm bg-red-500 text-white hover:bg-red-600 rounded-lg transition-colors",children:"\u786E\u8BA4\u8E22\u51FA"})]})]})]}),document.body),nr=({name:e,onConfirm:o,onClose:t})=>{let[a,r]=Lo("");return hs(Ne(gs,{children:[Se("div",{className:"fixed inset-0 z-50 bg-black/30",onClick:t}),Ne("div",{className:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[320px]",children:[Se("h3",{className:"text-lg font-medium text-theme mb-4",children:"\u8BBE\u7F6E\u5934\u8854"}),Ne("p",{className:"text-sm text-theme-secondary mb-3",children:["\u4E3A ",e," \u8BBE\u7F6E\u4E13\u5C5E\u5934\u8854\uFF1A"]}),Se("input",{type:"text",maxLength:12,value:a,onChange:s=>r(s.target.value),placeholder:"\u7559\u7A7A\u6E05\u9664\u5934\u8854",className:"w-full px-3 py-2 bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20 placeholder:text-theme-hint",autoFocus:!0,onKeyDown:s=>{s.key==="Enter"&&o(a.trim())}}),Se("p",{className:"text-xs text-theme-secondary mt-2",children:"\u4E2D\u6587\u6700\u591A6\u5B57\uFF0C\u82F1\u6587\u6700\u591A12\u5B57\uFF0C\u6309\u56DE\u8F66\u786E\u8BA4"}),Ne("div",{className:"flex justify-end gap-2 mt-4",children:[Se("button",{onClick:t,className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),Se("button",{onClick:()=>o(a.trim()),className:"px-4 py-2 text-sm bg-pink-500 text-white hover:bg-pink-600 rounded-lg transition-colors",children:"\u786E\u8BA4"})]})]})]}),document.body)};import{useState as lc,useEffect as ic,useRef as Gi}from"react";import{createPortal as _i}from"react-dom";import{Fragment as xs,jsx as He,jsxs as Fe}from"react/jsx-runtime";function ji(e,o,t){let[a,r]=lc({left:-9999,top:-9999,ready:!1});return ic(()=>{r({left:-9999,top:-9999,ready:!1});let s=requestAnimationFrame(()=>{if(!t.current){r({left:e,top:o,ready:!0});return}let l=t.current.getBoundingClientRect(),n=10,i=e,u=o;e+l.width>window.innerWidth-n&&(i=e-l.width),i<n&&(i=n),o+l.height>window.innerHeight-n&&(u=o-l.height),u<n&&(u=n),r({left:i,top:u,ready:!0})});return()=>cancelAnimationFrame(s)},[e,o]),a}var Wi=({contextMenu:e,session:o,getCachedMembers:t,onClose:a,onReply:r,onEmojiReaction:s,onRecall:l,onForward:n,onMultiSelect:i})=>{let u=e.message,d=Ze(),c=d&&u.senderUid===d,f=u.chatType===2,h=f&&o?t(o.peerId):null,m=(h&&d?h.find(W=>W.uid===d):null)?.role,g=m==="owner",L=m==="admin"||m==="owner",I=(h?h.find(W=>W.uid===u.senderUid):null)?.role,b=c||f&&(g||L&&!(I==="admin"||I==="owner")),F=!!e.elementId,M=Gi(null),O=ji(e.x,e.y,M),Z=async()=>{if(e.elementId){a();try{let R=u.elements.find(B=>B.elementId===e.elementId)?.picElement?.originImageUrl||"";if(!R){T("\u56FE\u7247\u5730\u5740\u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u6DFB\u52A0","error");return}let E=R.startsWith("http")?R:`https://gchat.qpic.cn${R}`,v=await Sl(E);v.result===0?T(v.isExist?"\u8868\u60C5\u5DF2\u5B58\u5728":"\u5DF2\u6DFB\u52A0\u5230\u8868\u60C5","success"):T(v.errMsg||"\u6DFB\u52A0\u5931\u8D25","error")}catch(W){T(W.message||"\u6DFB\u52A0\u5931\u8D25","error")}}},H=async()=>{if(e.elementId){a();try{let le=u.elements.find(v=>v.elementId===e.elementId)?.picElement,R=le?.originImageUrl||"";if(!R){T("\u56FE\u7247\u5730\u5740\u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4E0B\u8F7D","error");return}let E=R.startsWith("http")?R:`https://gchat.qpic.cn${R}`;await Bo(E,le?.fileName||le?.md5HexStr)}catch(W){T(W.message||"\u4E0B\u8F7D\u5931\u8D25","error")}}};return _i(Fe(xs,{children:[He("div",{className:"fixed inset-0 z-40",onClick:a,onContextMenu:W=>{W.preventDefault(),a()}}),Fe("div",{ref:M,className:"fixed z-50 bg-popup r-control glass-pop origin-top-left py-1 min-w-[100px]",style:{left:O.left,top:O.top,visibility:O.ready?"visible":"hidden"},onContextMenu:W=>W.preventDefault(),children:[Fe("button",{onClick:()=>{r(u),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(oa,{size:14})," \u56DE\u590D"]}),!F&&Fe(xs,{children:[Fe("button",{onClick:()=>{n(u),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(ea,{size:14})," \u8F6C\u53D1"]}),Fe("button",{onClick:()=>{i(u),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(Wa,{size:14})," \u591A\u9009\u8F6C\u53D1"]})]}),o.chatType===2&&Fe("button",{onClick:()=>{s(u,e.x,e.y),a()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(yt,{size:14})," \u8D34\u8868\u60C5"]}),F&&Fe("button",{onClick:H,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(Dt,{size:14})," \u4E0B\u8F7D\u56FE\u7247"]}),F&&Fe("button",{onClick:Z,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(ra,{size:14})," \u6DFB\u52A0\u5230\u8868\u60C5"]}),b&&Fe("button",{onClick:async()=>{a();try{await fl(u.chatType,u.peerUid,u.msgId),l(u.msgId),T("\u6D88\u606F\u5DF2\u64A4\u56DE","success")}catch(W){T(W.message||"\u64A4\u56DE\u5931\u8D25","error")}},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-500 hover:bg-theme-item-hover transition-colors",children:[He(ze,{size:14})," \u64A4\u56DE"]})]})]}),document.body)},lr=({avatarContextMenu:e,getCachedMembers:o,onClose:t,onInsertAt:a,onShowProfile:r,onSetTitle:s,onMute:l,onKick:n,onAdminChanged:i,groupName:u})=>{let d=Ze(),c=e.groupCode?o(e.groupCode):null,h=(c&&d?c.find(H=>H.uid===d):null)?.role,p=h==="owner",m=h==="admin",L=(c?c.find(H=>H.uid===e.senderUid):null)?.role,C=L==="admin",I=p||m&&L==="member",A=p||m&&L==="member",b=e.senderUid===d,F=p&&!b,M=Gi(null),O=ji(e.x,e.y,M),Z=async()=>{let H=e;t();try{await Ll(H.groupCode,H.senderUid,!C),T(C?"\u5DF2\u53D6\u6D88\u7BA1\u7406\u5458":"\u5DF2\u8BBE\u4E3A\u7BA1\u7406\u5458","success"),i?.()}catch(W){T(W.message||"\u64CD\u4F5C\u5931\u8D25","error")}};return _i(Fe(xs,{children:[He("div",{className:"fixed inset-0 z-40",onClick:t,onContextMenu:H=>{H.preventDefault(),t()}}),Fe("div",{ref:M,className:"fixed z-50 bg-popup r-control glass-pop origin-top-left py-1 min-w-[120px]",style:{left:O.left,top:O.top,visibility:O.ready?"visible":"hidden"},onContextMenu:H=>H.preventDefault(),children:[e.chatType===2&&Fe("button",{onClick:()=>{a(e.senderUid,e.senderUin,e.senderName),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(Da,{size:14})," \u53EC\u5524ta"]}),Fe("button",{onClick:async()=>{let H=e;t();try{H.chatType===2&&H.groupCode?await Ar(H.chatType,parseInt(H.senderUin),parseInt(H.groupCode)):await Ar(H.chatType,parseInt(H.senderUin))}catch(W){T(W.message||"\u6233\u4E00\u6233\u5931\u8D25","error")}},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(_a,{size:14})," \u6233\u4E00\u6233"]}),Fe("button",{onClick:()=>{r(e.senderUid,e.senderUin,e.x,e.y,e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(ro,{size:14})," \u67E5\u770B\u8D44\u6599"]}),e.chatType===2&&e.groupCode&&p&&Fe("button",{onClick:()=>{s(e.senderUid,e.senderName,e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[He(Ea,{size:14})," \u8BBE\u7F6E\u5934\u8854"]}),e.chatType===2&&e.groupCode&&F&&Fe("button",{onClick:Z,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[C?He(Za,{size:14}):He(pt,{size:14}),C?"\u53D6\u6D88\u7BA1\u7406\u5458":"\u8BBE\u4E3A\u7BA1\u7406\u5458"]}),e.chatType===2&&e.groupCode&&!b&&I&&Fe("button",{onClick:()=>{l(e.senderUid,e.senderName,e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-orange-500 hover:bg-theme-item-hover transition-colors",children:[He(so,{size:14})," \u7981\u8A00"]}),e.chatType===2&&e.groupCode&&!b&&A&&Fe("button",{onClick:()=>{n(e.senderUid,e.senderName,e.groupCode,u||e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-500 hover:bg-theme-item-hover transition-colors",children:[He(ao,{size:14})," \u8E22\u51FA\u7FA4"]})]})]}),document.body)};import{useRef as ba,useCallback as It,useState as va,forwardRef as Nc,useImperativeHandle as Fc,useEffect as Dc}from"react";import{useRef as Ls,useCallback as Ge,forwardRef as dc,useImperativeHandle as uc,useState as cc}from"react";import{jsx as Vi,jsxs as fc}from"react/jsx-runtime";var Is=dc(({placeholder:e="\u8F93\u5165\u6D88\u606F...",disabled:o=!1,onEnter:t,onPaste:a,onChange:r,onMentionChange:s},l)=>{let n=Ls(null),i=Ls(!1),u=Ls(null),[d,c]=cc(!1),f=Ge(()=>{let R=n.current;if(!R)return[];let E=[],v=R.childNodes;for(let B=0;B<v.length;B++){let q=v[B];if(q.nodeType===Node.TEXT_NODE){let D=(q.textContent||"").replace(/\u200B/g,"");D&&E.push({type:"text",content:D})}else if(q.nodeType===Node.ELEMENT_NODE){let w=q;if(w.dataset.type==="face")E.push({type:"face",faceId:parseInt(w.dataset.faceId||"0")});else if(w.dataset.type==="image")E.push({type:"image",imageUrl:w.dataset.imageUrl,imageFile:w.__file});else if(w.dataset.type==="at")E.push({type:"at",atUid:w.dataset.atUid,atUin:w.dataset.atUin,atName:w.dataset.atName});else if(w.tagName==="BR")E.push({type:"text",content:`
|
|
2
|
-
`});else{let Y=(w.textContent||"").replace(/\u200B/g,"");Y&&E.push({type:"text",content:Y})}}}return E},[]),h=Ge(()=>{let R=f();return R.length===0||R.length===1&&R[0].type==="text"&&!R[0].content?.trim()},[f]),p=Ge(()=>{let R=window.getSelection();if(!R||R.rangeCount===0)return{top:0,left:0};let v=R.getRangeAt(0).getBoundingClientRect(),B=n.current?.getBoundingClientRect();return B?{top:B.bottom-v.top+8,left:v.left-B.left}:{top:0,left:0}},[]),m=Ge(()=>{if(!u.current)return"";let R=window.getSelection();if(!R||R.rangeCount===0)return"";let E=R.getRangeAt(0),{node:v,offset:B}=u.current;return E.startContainer!==v?"":(v.textContent||"").slice(B,E.startOffset)},[]),g=Ge(()=>{u.current=null,c(!1),s?.({active:!1,query:"",position:{top:0,left:0}})},[s]),L=Ge(()=>{let R=window.getSelection();if(!R||R.rangeCount===0)return;let E=R.getRangeAt(0),v=E.startContainer;if(v.nodeType!==Node.TEXT_NODE){d&&g();return}let B=v.textContent||"",q=E.startOffset;if(d&&u.current){if(u.current.node===v&&q>=u.current.offset){let Y=m();Y.includes(" ")?g():s?.({active:!0,query:Y,position:p()})}else g();return}let w=B.slice(0,q),D=w.lastIndexOf("@");if(D!==-1){let Y=D>0?w[D-1]:" ";if(Y===" "||Y===`
|
|
3
|
-
`||D===0){let ie=w.slice(D+1);ie.includes(" ")||(u.current={node:v,offset:D+1},c(!0),s?.({active:!0,query:ie,position:p()}))}}},[d,m,p,g,s]),C=Ge(R=>{let E=n.current;if(!E)return;g();let v=document.createTextNode(R),B=window.getSelection();if(B&&B.rangeCount>0){let q=B.getRangeAt(0);E.contains(q.commonAncestorContainer)?(q.deleteContents(),q.insertNode(v),q.setStartAfter(v),q.setEndAfter(v),B.removeAllRanges(),B.addRange(q)):E.appendChild(v)}else E.appendChild(v);E.focus(),r?.(f())},[r,f,g]),I=Ge(R=>{let E=n.current;if(!E)return;g();let v=document.createElement("span");v.contentEditable="false",v.dataset.type="face",v.dataset.faceId=String(R),v.className="inline-block align-middle mx-0.5 select-all";let B=document.createElement("img");B.src=Je(`/face/${R}.png`),B.alt="[\u8868\u60C5]",B.className="w-6 h-6 inline-block",B.draggable=!1,v.appendChild(B);let q=window.getSelection();if(q&&q.rangeCount>0){let w=q.getRangeAt(0);if(E.contains(w.commonAncestorContainer)){w.deleteContents(),w.insertNode(v);let D=document.createTextNode("\u200B");v.after(D),w.setStartAfter(D),w.setEndAfter(D),q.removeAllRanges(),q.addRange(w)}else{E.appendChild(v);let D=document.createTextNode("\u200B");E.appendChild(D)}}else{E.appendChild(v);let w=document.createTextNode("\u200B");E.appendChild(w)}E.focus(),r?.(f())},[r,f,g]),A=Ge((R,E)=>{let v=n.current;if(!v)return;g();let B=document.createElement("span");B.contentEditable="false",B.dataset.type="image",B.dataset.imageUrl=E,R&&(B.__file=R),B.className="inline-block align-middle mx-0.5 select-all",B.innerHTML=`<img src="${E}" alt="[\u56FE\u7247]" class="h-16 max-w-[200px] rounded inline-block object-cover" draggable="false" />`;let q=window.getSelection();if(q&&q.rangeCount>0){let w=q.getRangeAt(0);if(v.contains(w.commonAncestorContainer)){w.deleteContents(),w.insertNode(B);let D=document.createTextNode("\u200B");B.after(D),w.setStartAfter(D),w.setEndAfter(D),q.removeAllRanges(),q.addRange(w)}else{v.appendChild(B);let D=document.createTextNode("\u200B");v.appendChild(D)}}else{v.appendChild(B);let w=document.createTextNode("\u200B");v.appendChild(w)}v.focus(),r?.(f())},[r,f,g]),b=Ge((R,E,v)=>{let B=n.current;if(!B)return;if(d&&u.current){let{node:ie,offset:Oe}=u.current,Ke=window.getSelection();if(Ke&&Ke.rangeCount>0){let Ee=Ke.getRangeAt(0),j=document.createRange();j.setStart(ie,Oe-1),j.setEnd(Ee.startContainer,Ee.startOffset),j.deleteContents()}}g();let q=document.createElement("span");q.contentEditable="false",q.dataset.type="at",q.dataset.atUid=R,q.dataset.atUin=E,q.dataset.atName=v,q.className="inline-block align-middle mx-0.5 px-1 py-0.5 bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300 text-sm rounded select-all",q.textContent=`@${v}`;let w=window.getSelection();if(w&&w.rangeCount>0){let ie=w.getRangeAt(0);B.contains(ie.commonAncestorContainer)?(ie.deleteContents(),ie.insertNode(q),ie.setStartAfter(q),ie.setEndAfter(q),w.removeAllRanges(),w.addRange(ie)):B.appendChild(q)}else B.appendChild(q);let D=document.createTextNode(" ");q.after(D);let Y=document.createRange();Y.setStartAfter(D),Y.setEndAfter(D),w?.removeAllRanges(),w?.addRange(Y),B.focus(),r?.(f())},[d,r,f,g]),F=Ge(()=>{let R=n.current;R&&(R.innerHTML="",g(),r?.([]))},[r,g]),M=Ge(()=>{let R=n.current;if(!R)return;R.focus();let E=window.getSelection();if(E){let v=document.createRange();v.selectNodeContents(R),v.collapse(!1),E.removeAllRanges(),E.addRange(v)}},[]);uc(l,()=>({focus:M,clear:F,insertFace:I,insertText:C,insertImage:A,insertAt:b,getContent:f,isEmpty:h,cancelMention:g}),[M,F,I,C,A,b,f,h,g]);let O=Ge(R=>{if(d){if(["ArrowUp","ArrowDown","Enter","Tab"].includes(R.key))return;if(R.key==="Escape"){R.preventDefault(),g();return}}R.key==="Enter"&&!R.shiftKey&&!i.current&&!d&&(R.preventDefault(),t?.())},[t,d,g]),Z=Ge(()=>{L(),r?.(f())},[r,f,L]),H=Ge(R=>{let E=R.clipboardData?.items;if(E){for(let B=0;B<E.length;B++)if(E[B].type.startsWith("image/")){R.preventDefault(),a?.(R);return}}R.preventDefault();let v=R.clipboardData?.getData("text/plain");v&&document.execCommand("insertText",!1,v)},[a]),W=Ge(()=>{setTimeout(L,0)},[L]),le=Ge(()=>{setTimeout(()=>{d&&g()},200)},[d,g]);return fc("div",{className:"relative",children:[Vi("div",{ref:n,contentEditable:!o,onKeyDown:O,onInput:Z,onPaste:H,onClick:W,onBlur:le,onCompositionStart:()=>{i.current=!0},onCompositionEnd:()=>{i.current=!1,Z()},className:`min-h-[36px] max-h-[120px] overflow-y-auto px-3 py-2 outline-none text-theme whitespace-pre-wrap break-words ${o?"opacity-50 cursor-not-allowed":""}`,style:{wordBreak:"break-word"},"data-placeholder":e,suppressContentEditableWarning:!0}),Vi("style",{children:`
|
|
4
|
-
[data-placeholder]:empty:before {
|
|
5
|
-
content: attr(data-placeholder);
|
|
6
|
-
color: var(--theme-hint, #9ca3af);
|
|
7
|
-
pointer-events: none;
|
|
8
|
-
}
|
|
9
|
-
`})]})});Is.displayName="RichInput";import{useState as mc,useEffect as ir,useRef as pc,useMemo as hc}from"react";import{jsx as Pt,jsxs as Cs}from"react/jsx-runtime";var $i=({members:e,loading:o,query:t,onSelect:a,onClose:r})=>{let s=pc(null),[l,n]=mc(0),i=hc(()=>{if(!t)return e.slice(0,20);let d=t.toLowerCase();return e.filter(c=>c.nickname.toLowerCase().includes(d)||c.card?.toLowerCase().includes(d)||c.uin.includes(t)).slice(0,20)},[e,t]);ir(()=>{n(0)},[t]),ir(()=>{let d=c=>{c.key==="ArrowDown"?(c.preventDefault(),n(f=>Math.min(f+1,i.length-1))):c.key==="ArrowUp"?(c.preventDefault(),n(f=>Math.max(f-1,0))):c.key==="Enter"||c.key==="Tab"?(c.preventDefault(),i[l]&&a(i[l])):c.key==="Escape"&&(c.preventDefault(),r())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[i,l,a,r]),ir(()=>{let d=c=>{s.current&&!s.current.contains(c.target)&&r()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]),ir(()=>{let d=s.current;if(!d)return;let c=d.querySelector(`[data-index="${l}"]`);c&&c.scrollIntoView({block:"nearest"})},[l]);let u=d=>d==="owner"?Pt(mt,{size:12,className:"text-yellow-500"}):d==="admin"?Pt(pt,{size:12,className:"text-green-500"}):null;return Pt("div",{ref:s,className:"absolute z-50 glass glass-thick glass-dense r-card glass-pop origin-bottom-left overflow-hidden",style:{bottom:"100%",left:0,marginBottom:8,minWidth:240,maxWidth:300},children:o?Pt("div",{className:"flex items-center justify-center py-4",children:Pt(Q,{size:20,className:"animate-spin text-pink-500"})}):i.length===0?Pt("div",{className:"py-3 px-4 text-sm text-theme-muted text-center",children:t?"\u6CA1\u6709\u5339\u914D\u7684\u6210\u5458":"\u6682\u65E0\u6210\u5458"}):Pt("div",{className:"max-h-[200px] overflow-y-auto py-1",children:i.map((d,c)=>Cs("div",{"data-index":c,onClick:()=>a(d),className:`flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${c===l?"bg-pink-50 dark:bg-pink-900/30":"hover:bg-theme-item-hover"}`,children:[Pt("img",{src:d.avatar||`https://q1.qlogo.cn/g?b=qq&nk=${d.uin}&s=40`,alt:"",className:"w-7 h-7 rounded-full flex-shrink-0",loading:"lazy"}),Cs("div",{className:"flex-1 min-w-0",children:[Cs("div",{className:"flex items-center gap-1",children:[Pt("span",{className:"text-sm text-theme truncate",children:d.card||d.nickname}),u(d.role)]}),d.card&&d.card!==d.nickname&&Pt("div",{className:"text-xs text-theme-muted truncate",children:d.nickname})]})]},d.uid))})})};import{useState as Ss,useEffect as gc,useRef as xc}from"react";import{Fragment as bc,jsx as dt,jsxs as dr}from"react/jsx-runtime";var Lc=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,43,46,49,53,56,59,60,63,64,66,67,74,75,76,77,78,79,85,86,89,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,114,116,118,119,120,121,123,124,125,129,137,144,146,147,169,171,172,173,174,175,176,177,178,179,181,182,183,185,187,201,212,262,263,264,265,266,267,268,269,270,271,272,273,277,281,282,283,284,285,286,287,289,293,294,295,297,298,299,300,302,303,305,306,307,311,312,314,317,318,319,320,323,324,325,326,332,333,334,336,337,338,339,341,342,343,344,345,346,347,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,415,416,417,419,420,421,422,423,424,425,426,427,428,429,430,431,432,451,453,454,458,459,460,461,462],Ic=[{codePoint:9728,char:"\u2600"},{codePoint:9749,char:"\u2615"},{codePoint:9786,char:"\u263A"},{codePoint:10024,char:"\u2728"},{codePoint:10068,char:"\u2754"},{codePoint:127801,char:"\u{1F339}"},{codePoint:127817,char:"\u{1F349}"},{codePoint:127822,char:"\u{1F34E}"},{codePoint:127827,char:"\u{1F353}"},{codePoint:127836,char:"\u{1F35C}"},{codePoint:127838,char:"\u{1F35E}"},{codePoint:127847,char:"\u{1F367}"},{codePoint:127866,char:"\u{1F37A}"},{codePoint:127867,char:"\u{1F37B}"},{codePoint:127881,char:"\u{1F389}"},{codePoint:127978,char:"\u{1F3EA}"},{codePoint:128014,char:"\u{1F40E}"},{codePoint:128020,char:"\u{1F414}"},{codePoint:128027,char:"\u{1F41B}"},{codePoint:128046,char:"\u{1F42E}"},{codePoint:128051,char:"\u{1F433}"},{codePoint:128053,char:"\u{1F435}"},{codePoint:128054,char:"\u{1F436}"},{codePoint:128055,char:"\u{1F437}"},{codePoint:128056,char:"\u{1F438}"},{codePoint:128064,char:"\u{1F440}"},{codePoint:128070,char:"\u{1F446}"},{codePoint:128074,char:"\u{1F44A}"},{codePoint:128076,char:"\u{1F44C}"},{codePoint:128077,char:"\u{1F44D}"},{codePoint:128078,char:"\u{1F44E}"},{codePoint:128079,char:"\u{1F44F}"},{codePoint:128098,char:"\u{1F462}"},{codePoint:128102,char:"\u{1F466}"},{codePoint:128103,char:"\u{1F467}"},{codePoint:128123,char:"\u{1F47B}"},{codePoint:128137,char:"\u{1F489}"},{codePoint:128147,char:"\u{1F493}"},{codePoint:128157,char:"\u{1F49D}"},{codePoint:128163,char:"\u{1F4A3}"},{codePoint:128164,char:"\u{1F4A4}"},{codePoint:128166,char:"\u{1F4A6}"},{codePoint:128168,char:"\u{1F4A8}"},{codePoint:128169,char:"\u{1F4A9}"},{codePoint:128170,char:"\u{1F4AA}"},{codePoint:128235,char:"\u{1F4EB}"},{codePoint:128293,char:"\u{1F525}"},{codePoint:128299,char:"\u{1F52B}"},{codePoint:128513,char:"\u{1F601}"},{codePoint:128514,char:"\u{1F602}"},{codePoint:128516,char:"\u{1F604}"},{codePoint:128522,char:"\u{1F60A}"},{codePoint:128524,char:"\u{1F60C}"},{codePoint:128525,char:"\u{1F60D}"},{codePoint:128527,char:"\u{1F60F}"},{codePoint:128530,char:"\u{1F612}"},{codePoint:128531,char:"\u{1F613}"},{codePoint:128532,char:"\u{1F614}"},{codePoint:128536,char:"\u{1F618}"},{codePoint:128538,char:"\u{1F61A}"},{codePoint:128540,char:"\u{1F61C}"},{codePoint:128541,char:"\u{1F61D}"},{codePoint:128557,char:"\u{1F62D}"},{codePoint:128560,char:"\u{1F630}"},{codePoint:128561,char:"\u{1F631}"},{codePoint:128563,char:"\u{1F633}"},{codePoint:128591,char:"\u{1F64F}"},{codePoint:128684,char:"\u{1F6AC}"}],Cc="webqq_recent_emojis";function Ki(){let e=ga();return e?`${e}-${Cc}`:null}var Sc=10;function ur(){let e=Ki();if(!e)return[];try{let o=localStorage.getItem(e);if(!o)return[];let t=JSON.parse(o);return Array.isArray(t)&&t.length>0&&typeof t[0]=="number"?t.map(a=>({type:"face",faceId:a})):t}catch{return[]}}function Xi(e){let o=Ki();if(!o)return;let t=ur().filter(a=>a.type!==e.type?!0:a.type==="face"?a.faceId!==e.faceId:a.codePoint!==e.codePoint);t.unshift(e),localStorage.setItem(o,JSON.stringify(t.slice(0,Sc)))}var Io=({onSelect:e,onSelectEmoji:o,onClose:t,position:a,inline:r})=>{let[s,l]=Ss(new Set),[n,i]=Ss(ur()),[u,d]=Ss("qq"),c=xc(null);gc(()=>{let m=g=>{c.current&&!c.current.contains(g.target)&&t()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t]);let f=m=>{Xi({type:"face",faceId:m}),i(ur()),e(m)},h=(m,g)=>{Xi({type:"emoji",codePoint:m,char:g}),i(ur()),o&&o(g)},p=(m,g)=>m.type==="face"&&m.faceId!==void 0?dt("button",{onClick:()=>f(m.faceId),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors",title:`\u8868\u60C5 ${m.faceId}`,children:dt("img",{src:Je(`/face/${m.faceId}.png`),alt:`\u8868\u60C5${m.faceId}`,className:"w-6 h-6"})},`recent-face-${m.faceId}`):m.type==="emoji"&&m.char?dt("button",{onClick:()=>h(m.codePoint,m.char),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors text-xl",title:m.char,children:m.char},`recent-emoji-${m.codePoint}`):null;return dr("div",{ref:c,className:`${r?"":"absolute bottom-full left-0 mb-2"} glass glass-thick glass-dense r-card glass-pop origin-bottom-left z-50`,style:a?{left:a.x,bottom:a.y}:void 0,children:[dr("div",{className:"flex border-b border-theme-divider",children:[dt("button",{className:`flex-1 px-3 py-2 text-sm ${u==="qq"?"text-pink-500 border-b-2 border-pink-500":"text-theme-secondary"}`,onClick:()=>d("qq"),children:"QQ\u8868\u60C5"}),dt("button",{className:`flex-1 px-3 py-2 text-sm ${u==="emoji"?"text-pink-500 border-b-2 border-pink-500":"text-theme-secondary"}`,onClick:()=>d("emoji"),children:"Emoji"})]}),dr("div",{className:"p-2 max-h-[280px] overflow-y-auto w-[320px]",children:[n.length>0&&dr(bc,{children:[dt("div",{className:"text-xs text-theme-hint mb-1",children:"\u6700\u8FD1\u4F7F\u7528"}),dt("div",{className:"grid grid-cols-8 gap-1 mb-2 pb-2 border-b border-theme-divider",children:n.map((m,g)=>p(m,g))})]}),u==="qq"?dt("div",{className:"grid grid-cols-8 gap-1",children:Lc.map(m=>dt("button",{onClick:()=>f(m),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors",title:`\u8868\u60C5 ${m}`,children:dt("img",{src:Je(`/face/${m}.png`),alt:`\u8868\u60C5${m}`,className:`w-6 h-6 transition-opacity ${s.has(m)?"opacity-100":"opacity-0"}`,onLoad:()=>l(g=>new Set(g).add(m)),onError:g=>{g.target.style.display="none"}})},m))}):dt("div",{className:"grid grid-cols-8 gap-1",children:Ic.map(({codePoint:m,char:g})=>dt("button",{onClick:()=>h(m,g),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors text-xl",title:g,children:g},m))})]})]})};import{useState as Ca,useEffect as bs,useRef as vs}from"react";import{createPortal as vc}from"react-dom";import{Fragment as ys,jsx as _e,jsxs as Sa}from"react/jsx-runtime";var Ia=null;var yc="webqq_recent_fav_emojis",wc=10;function ws(){let e=ga();return e?`${e}-${yc}`:null}function Co(){let e=ws();if(!e)return[];try{let o=localStorage.getItem(e);return o?JSON.parse(o):[]}catch{return[]}}function kc(e){let o=ws();if(!o)return;let t=Co().filter(a=>a.emoId!==e.emoId);t.unshift(e),localStorage.setItem(o,JSON.stringify(t.slice(0,wc)))}function Mc(e){let o=ws();if(!o)return;let t=Co().filter(a=>a.emoId!==e);localStorage.setItem(o,JSON.stringify(t))}var Pc=({x:e,y:o,onClose:t,onDelete:a})=>{let r=vs(null),[s,l]=Ca({left:e,top:o});return bs(()=>{if(!r.current)return;let n=r.current.getBoundingClientRect(),i=10,u=e,d=o;e+n.width>window.innerWidth-i&&(u=e-n.width),u<i&&(u=i),o+n.height>window.innerHeight-i&&(d=o-n.height),d<i&&(d=i),l({left:u,top:d})},[e,o]),vc(Sa(ys,{children:[_e("div",{className:"fixed inset-0 z-[60]",onClick:t,onContextMenu:n=>{n.preventDefault(),t()}}),_e("div",{ref:r,className:"fixed z-[60] bg-popup r-control glass-pop origin-top-left py-1 min-w-[100px]",style:{left:s.left,top:s.top},onContextMenu:n=>n.preventDefault(),children:Sa("button",{onClick:a,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-500 hover:bg-theme-item-hover transition-colors",children:[_e(ze,{size:14})," \u5220\u9664"]})})]}),document.body)},ks=({onSelect:e,onClose:o})=>{let[t,a]=Ca(Ia||[]),[r,s]=Ca(!Ia),[l,n]=Ca(null),[i,u]=Ca(Co()),[d,c]=Ca(null),f=vs(null);bs(()=>{if(Ia){a(Ia),s(!1);return}(async()=>{try{let I=(await Il()).map(A=>({emoId:A.emoId,resId:A.resId||"",url:A.url,desc:A.desc||""}));Ia=I,a(I)}catch{n("\u52A0\u8F7D\u5931\u8D25")}finally{s(!1)}})()},[]);let h=vs(d);h.current=d,bs(()=>{let L=C=>{h.current||f.current&&!f.current.contains(C.target)&&o()};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[o]);let p=L=>{kc(L),u(Co()),e(L)},m=(L,C)=>{L.preventDefault(),L.stopPropagation(),c({x:L.clientX,y:L.clientY,emoji:C})},g=async()=>{if(!d)return;let{emoji:L}=d;c(null);try{let C=await Cl(L.resId);if(C.result===0){T("\u5DF2\u5220\u9664","success");let I=t.filter(A=>A.emoId!==L.emoId);a(I),Ia=I,Mc(L.emoId),u(Co())}else T(C.errMsg||"\u5220\u9664\u5931\u8D25","error")}catch(C){T(C.message||"\u5220\u9664\u5931\u8D25","error")}};return Sa("div",{ref:f,className:"absolute bottom-full left-0 mb-2 glass glass-thick glass-dense r-card glass-pop origin-bottom-left z-50 w-[320px]",children:[_e("div",{className:"p-2 border-b border-theme-divider text-sm text-theme-secondary",children:"\u6536\u85CF\u8868\u60C5"}),Sa("div",{className:"p-2 max-h-[300px] overflow-y-auto",children:[i.length>0&&Sa(ys,{children:[_e("div",{className:"text-xs text-theme-hint mb-1",children:"\u6700\u8FD1\u4F7F\u7528"}),_e("div",{className:"grid grid-cols-4 gap-1 mb-2 pb-2 border-b border-theme-divider",children:i.map(L=>_e("button",{onClick:()=>p(L),onContextMenu:C=>m(C,L),className:"p-1 rounded-lg hover:bg-theme-item transition-colors",title:L.desc,children:_e("img",{src:L.url,alt:L.desc,className:"w-16 h-16 object-contain"})},`recent-${L.emoId}`))})]}),r?_e("div",{className:"flex items-center justify-center py-8",children:_e(Q,{size:24,className:"animate-spin text-pink-500"})}):l?_e("div",{className:"text-center py-8 text-theme-hint text-sm",children:l}):t.length===0?_e("div",{className:"text-center py-8 text-theme-hint text-sm",children:"\u6682\u65E0\u6536\u85CF\u8868\u60C5"}):Sa(ys,{children:[_e("div",{className:"text-xs text-theme-hint mb-1",children:"\u5168\u90E8"}),_e("div",{className:"grid grid-cols-4 gap-1",children:t.map(L=>_e("button",{onClick:()=>p(L),onContextMenu:C=>m(C,L),className:"p-1 rounded-lg hover:bg-theme-item transition-colors",title:L.desc,children:_e("img",{src:L.url,alt:L.desc,className:"w-16 h-16 object-contain",loading:"lazy"})},L.emoId))})]})]}),d&&_e(Pc,{x:d.x,y:d.y,emoji:d.emoji,onClose:()=>c(null),onDelete:g})]})};import{createPortal as Ac}from"react-dom";import{Fragment as Rc,jsx as Ms,jsxs as Tc}from"react/jsx-runtime";var Ps=({target:e,onClose:o,onReacted:t,containerRef:a})=>{let r=async i=>{let u=e.message;o();try{await lo(u.chatType,String(u.peerUin),u.msgSeq,String(i),!0),t?.(String(i))}catch(d){T(d.message||"\u8D34\u8868\u60C5\u5931\u8D25","error")}},s=async i=>{let u=e.message;o();try{let d=i.codePointAt(0);if(!d){T("\u65E0\u6548\u7684\u8868\u60C5","error");return}await lo(u.chatType,String(u.peerUin),u.msgSeq,String(d),!0),t?.(String(d))}catch(d){T(d.message||"\u8D34\u8868\u60C5\u5931\u8D25","error")}},n=(()=>{if(a?.current){let i=a.current.getBoundingClientRect();return{left:i.left+i.width/2,top:i.top+i.height/2}}return{left:window.innerWidth/2,top:window.innerHeight/2}})();return Ac(Tc(Rc,{children:[Ms("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:o}),Ms("div",{className:"fixed z-50 -translate-x-1/2 -translate-y-1/2",style:{left:n.left,top:n.top},children:Ms(Io,{onSelect:r,onSelectEmoji:s,onClose:o,inline:!0})})]}),document.body)};import{jsx as ye,jsxs as ya}from"react/jsx-runtime";var As=Nc((e,o)=>{let{session:t,replyTo:a,onReplyCancel:r,onSendStart:s,onSendEnd:l,onTempMessage:n,onTempMessageRemove:i,onTempMessageFail:u}=e,d=ba(null),c=ba(null),f=ba(null),[h,p]=va(!1),[m,g]=va(!1),[L,C]=va(!1),[I,A]=va({active:!1,query:"",position:{top:0,left:0}}),[b,F]=va([]),[M,O]=va(!1),{getCachedMembers:Z,fetchGroupMembers:H}=re(),W=ba(null),le=ba(Z);le.current=Z;let R=ba(H);R.current=H,Fc(o,()=>({insertAt:(j,ce,fe)=>{d.current?.insertAt(j,ce,fe)},insertText:j=>{d.current?.insertText(j)},focus:()=>{d.current?.focus()}}),[]),Dc(()=>{let j=t?.chatType===2?t.peerId:null;if(W.current=j,!j){F([]),O(!1);return}let ce=!ma(2,j);if(!ce){let fe=le.current(j);if(fe){F(fe),O(!1);return}}O(!0),F([]),R.current(j,ce).then(fe=>{W.current===j&&(F(fe),O(!1))}).catch(()=>{W.current===j&&O(!1)})},[t?.chatType,t?.peerId]);let E=It(j=>{if(t?.chatType!==2){A({active:!1,query:"",position:{top:0,left:0}});return}A(j)},[t?.chatType]),v=It(j=>{d.current?.insertAt(j.uid,j.uin,j.card||j.nickname)},[]),B=It(()=>{d.current?.cancelMention()},[]),q=It(async()=>{if(!t||!d.current)return;let j=d.current.getContent();if(d.current.isEmpty())return;s();let fe=a;d.current.clear(),r(),C(!1),setTimeout(()=>d.current?.focus(),0);let qe=j.map($=>({type:$.type,content:$.content,faceId:$.faceId,imageUrl:$.imageUrl,atName:$.atName})),P=`temp_${Date.now()}`;n({msgId:P,items:qe,timestamp:Date.now(),status:"sending"});try{let $=[];fe&&$.push({type:"reply",msgId:fe.msgId,msgSeq:fe.msgSeq});for(let ne of j)if(ne.type==="text"&&ne.content)$.push({type:"text",text:ne.content});else if(ne.type==="face"&&ne.faceId!==void 0)$.push({type:"face",faceId:ne.faceId});else if(ne.type==="image"){if(ne.imageFile){let ke=await il(ne.imageFile);$.push({type:"image",imagePath:ke.imagePath})}else if(ne.imageUrl){let ke=await dl(ne.imageUrl);$.push({type:"image",imagePath:ke.imagePath})}}else ne.type==="at"&&ne.atUid&&$.push({type:"at",uid:ne.atUid,uin:ne.atUin,name:ne.atName});if($.length===0){i(P);return}await kr({chatType:t.chatType,peerId:t.peerId,content:$}),i(P)}catch{T("\u53D1\u9001\u5931\u8D25","error"),u(P)}finally{l()}},[t,a,s,l,r,n,i,u]),w=It(j=>{d.current?.insertFace(j),p(!1)},[]),D=It(j=>{d.current?.insertText(j),p(!1)},[]),Y=It(j=>{g(!1),d.current?.insertImage(null,j.url)},[]),ie=It(j=>{let ce=j.target.files?.[0];if(ce){if(!ql(ce.name)){T("\u4E0D\u652F\u6301\u7684\u56FE\u7247\u683C\u5F0F\uFF0C\u4EC5\u652F\u6301 JPG\u3001PNG\u3001GIF","error");return}d.current?.insertImage(ce,URL.createObjectURL(ce)),c.current&&(c.current.value="")}},[]),Oe=It(async j=>{let ce=j.target.files?.[0];if(!ce||!t)return;if(ce.size>100*1024*1024){T("\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 100MB","error");return}f.current&&(f.current.value=""),s();let fe=`temp_${Date.now()}`;n({msgId:fe,items:[{type:"text",content:`[\u6587\u4EF6] ${ce.name}`}],timestamp:Date.now(),status:"sending"});try{let qe=await Mr(ce);await kr({chatType:t.chatType,peerId:t.peerId,content:[{type:"file",filePath:qe.filePath,fileName:qe.fileName}]}),i(fe)}catch{T("\u53D1\u9001\u5931\u8D25","error"),u(fe)}finally{l()}},[t,s,l,n,i,u]),Ke=It(j=>{let ce=j.clipboardData?.items;if(ce){for(let fe=0;fe<ce.length;fe++)if(ce[fe].type.startsWith("image/")){let qe=ce[fe].getAsFile();if(!qe)continue;let P=qe.type.split("/")[1]?.toLowerCase();if(!["jpeg","jpg","png","gif"].includes(P)){T("\u4E0D\u652F\u6301\u7684\u56FE\u7247\u683C\u5F0F","error");return}d.current?.insertImage(qe,URL.createObjectURL(qe));return}}},[]),Ee=It(j=>{C(j.length>0&&!(j.length===1&&j[0].type==="text"&&!j[0].content?.trim()))},[]);return ya("div",{className:"glass-bar hairline-t",children:[a&&ye("div",{className:"px-4 py-2 hairline-b bg-theme-item",children:ya("div",{className:"flex items-center gap-2",children:[ye(oa,{size:16,className:"text-pink-500 flex-shrink-0"}),ya("div",{className:"flex-1 min-w-0 text-sm text-theme-secondary truncate",children:["\u56DE\u590D ",a.sendMemberName||a.sendNickName||a.senderUin,"\uFF1A",a.elements?.filter(j=>!j.replyElement).map((j,ce)=>j.textElement?ye("span",{children:j.textElement.content},ce):j.picElement?ye("span",{children:"[\u56FE\u7247]"},ce):j.faceElement?ye("span",{children:"[\u8868\u60C5]"},ce):null)]}),ye("button",{onClick:r,className:"p-1 text-theme-hint hover:text-theme rounded",children:ye(we,{size:16})})]})}),ya("div",{className:"px-4 pt-0.5 pb-3",children:[ya("div",{className:"flex items-center gap-1 mb-2 relative",children:[ye("button",{onClick:()=>{p(!h),g(!1)},className:`p-2 rounded-lg transition-colors ${h?"text-pink-500 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30"}`,title:"\u8868\u60C5",children:ye(yt,{size:18})}),ye("button",{onClick:()=>{g(!m),p(!1)},className:`p-2 rounded-lg transition-colors ${m?"text-pink-500 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30"}`,title:"\u6536\u85CF\u8868\u60C5",children:ye(Ya,{size:18})}),ye("button",{onClick:()=>c.current?.click(),className:"p-2 text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30 rounded-lg transition-colors",title:"\u56FE\u7247",children:ye(ja,{size:18})}),ye("button",{onClick:()=>f.current?.click(),className:"p-2 text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30 rounded-lg transition-colors",title:"\u6587\u4EF6",children:ye(Xa,{size:18})}),h&&ye(Io,{onSelect:w,onSelectEmoji:D,onClose:()=>p(!1)}),m&&ye(ks,{onSelect:Y,onClose:()=>g(!1)})]}),ya("div",{className:"flex items-end gap-2 relative",children:[ye("input",{type:"file",ref:c,onChange:ie,accept:"image/jpeg,image/png,image/gif",className:"hidden"}),ye("input",{type:"file",ref:f,onChange:Oe,className:"hidden"}),ye("div",{className:"flex-1 bg-theme-input border border-theme-input rounded-xl focus-within:ring-2 focus-within:ring-pink-500/20 overflow-hidden",children:ye(Is,{ref:d,placeholder:"\u8F93\u5165\u6D88\u606F...",onEnter:q,onPaste:Ke,onChange:Ee,onMentionChange:E})}),I.active&&t?.chatType===2&&ye($i,{members:b,loading:M,query:I.query,position:I.position,onSelect:v,onClose:B}),ye("button",{onClick:q,disabled:!L,className:"p-2.5 bg-pink-500 text-white rounded-full hover:bg-pink-600 disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0",children:ye(Ja,{size:20})})]})]})]})});As.displayName="ChatInput";import{useState as Ec,useMemo as Qi}from"react";import{createPortal as qc}from"react-dom";import{Fragment as Uc,jsx as Ct,jsxs as zt}from"react/jsx-runtime";var Bc=({count:e,onSelect:o,onClose:t,sending:a})=>{let{recentChats:r,friendCategories:s,groups:l}=re(),[n,i]=Ec(""),u=Qi(()=>{let c=new Set,f=[],h=p=>{if(p.chatType!==1&&p.chatType!==2)return;let m=`${p.chatType}_${p.peerId}`;c.has(m)||(c.add(m),f.push(p))};for(let p of r)h({chatType:p.chatType,peerId:p.peerId,name:p.peerName,avatar:p.peerAvatar});for(let p of l)h({chatType:2,peerId:p.groupCode,name:p.remarkName||p.groupName,avatar:p.avatar});for(let p of s)for(let m of p.friends)h({chatType:1,peerId:m.uin,name:m.remark||m.nickname,avatar:m.avatar});return f},[r,s,l]),d=Qi(()=>{let c=n.trim().toLowerCase();return c?u.filter(f=>f.name.toLowerCase().includes(c)||f.peerId.includes(c)):u},[u,n]);return qc(zt(Uc,{children:[Ct("div",{className:"fixed inset-0 z-[60] bg-black/40",onClick:a?void 0:t}),zt("div",{className:"fixed z-[60] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop w-[360px] max-w-[92vw] max-h-[70vh] flex flex-col",children:[zt("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider",children:[zt("div",{className:"font-medium text-theme",children:["\u8F6C\u53D1\u5230",e>1?`\uFF08\u5408\u5E76 ${e} \u6761\uFF09`:""]}),Ct("button",{onClick:t,disabled:a,className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors disabled:opacity-50",children:Ct(we,{size:18})})]}),Ct("div",{className:"p-3 border-b border-theme-divider",children:zt("div",{className:"relative",children:[Ct(Et,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-theme-hint"}),Ct("input",{autoFocus:!0,value:n,onChange:c=>i(c.target.value),placeholder:"\u641C\u7D22\u4F1A\u8BDD / \u597D\u53CB / \u7FA4",className:"w-full pl-9 pr-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme placeholder:text-theme-hint"})]})}),zt("div",{className:"flex-1 overflow-y-auto py-1 relative",children:[a&&Ct("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[rgb(var(--glass-tint)/0.6)]",children:Ct(Q,{size:24,className:"animate-spin text-pink-500"})}),d.length===0?Ct("div",{className:"flex items-center justify-center h-24 text-theme-hint text-sm",children:"\u672A\u627E\u5230\u4F1A\u8BDD"}):d.map(c=>zt("button",{onClick:()=>o(c),disabled:a,className:"w-full flex items-center gap-3 px-3 py-2 hover:bg-theme-item-hover transition-colors text-left disabled:opacity-50",children:[Ct("img",{src:c.avatar,alt:c.name,loading:"lazy",className:"w-9 h-9 rounded-full object-cover flex-shrink-0",onError:f=>{f.currentTarget.src=c.chatType===2?`https://p.qlogo.cn/gh/${c.peerId}/${c.peerId}/100/`:`https://q1.qlogo.cn/g?b=qq&nk=${c.peerId}&s=100`}}),zt("div",{className:"flex-1 min-w-0",children:[Ct("div",{className:"text-sm text-theme truncate",children:c.name}),zt("div",{className:"text-xs text-theme-hint truncate",children:[c.chatType===2?"\u7FA4\u804A":"\u597D\u53CB"," \xB7 ",c.peerId]})]})]},`${c.chatType}_${c.peerId}`))]})]})]}),document.body)},Ji=Bc;import{Fragment as Wc,jsx as G,jsxs as je}from"react/jsx-runtime";function Gc(e){let o=parseInt(e);if(o>1e3){let t=o.toString(16);return Je(`/face/emoji-${t}.png`)}return Je(`/face/${e}.png`)}var _c=({tip:e,onScrollToMessage:o})=>{let t=Gc(e.emojiId),a=parseInt(e.emojiId);return G("div",{className:"flex justify-center py-2",children:je("span",{className:"text-xs text-theme-hint bg-theme-item/50 px-3 py-1 rounded-full",children:[G("span",{className:"text-blue-500",children:e.userName}),G("span",{children:" \u56DE\u5E94\u4E86"}),G("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>o(e.msgSeq),children:"\u6D88\u606F"}),G("span",{children:" "}),G("img",{src:t,alt:"emoji",className:"inline-block w-4 h-4 align-text-bottom",onError:r=>{let s=r.target;s.dataset.fallback||(s.dataset.fallback="1",a>1e3?(s.style.display="none",s.insertAdjacentHTML("afterend",`<span class="text-sm">${String.fromCodePoint(a)}</span>`)):s.src=`https://gxh.vip.qq.com/club/item/parcel/item/${e.emojiId.slice(0,2)}/${e.emojiId}/100x100.png`)}})]})})},jc=({session:e,onShowMembers:o,onShowFiles:t,onNewMessageCallback:a,onEmojiReactionCallback:r,onMessageRecalledCallback:s,appendInputMention:l,onAppendInputMentionConsumed:n,onBack:i,showBackButton:u})=>{let[d,c]=Ie([]),[f,h]=Ie([]),[p,m]=Ie([]),[g,L]=Ie(!1),[C,I]=Ie(!1),[A,b]=Ie(!0),[F,M]=Ie(null),[O,Z]=Ie(null),[H,W]=Ie(null),[le,R]=Ie(null),[E,v]=Ie(null),[B,q]=Ie(null),[w,D]=Ie(null),[Y,ie]=Ie(!1),[Oe,Ke]=Ie(null),[Ee,j]=Ie(null),[ce,fe]=Ie(null),[qe,P]=Ie(null),[$,ne]=Ie(null),[ke,Xt]=Ie(!1),[J,de]=Ie(!1),[X,We]=Ie(new Set),[Pe,st]=Ie(null),[Rt,St]=Ie(!1),[Re,Tt]=Ie(null),vo=ut(()=>({showPreview:x=>M(x)}),[]),yo=ut(()=>({showPreview:(x,S)=>Z({fileUuid:x,isGroup:S})}),[]),Ns=ut(()=>({open:x=>t?.(x)}),[t]),ud=ut(()=>({showMenu:(x,S)=>{R({x:x.clientX,y:x.clientY,message:S})}}),[]),Fs=Ae(x=>{We(S=>{let y=new Set(S);return y.has(x)?y.delete(x):y.add(x),y})},[]),cd=ut(()=>({enabled:J,isSelected:x=>X.has(x),toggle:Fs}),[J,X,Fs]),mr=Ae(()=>{de(!1),We(new Set)},[]),fd=Ae(()=>d.filter(x=>X.has(x.msgId)).map(x=>Number(x.msgSeq)).filter(x=>Number.isFinite(x)),[d,X]),md=Ae(async x=>{if(!(!Pe||!e)){St(!0);try{let S={chatType:Number(e.chatType),peerId:e.peerId},y={chatType:x.chatType,peerId:x.peerId};Pe.single?await nl(S,Pe.msgSeqs[0],y):await ll(S,Pe.msgSeqs,y),st(null),mr(),Tt(x)}catch(S){T(S.message||"\u8F6C\u53D1\u5931\u8D25","error")}finally{St(!1)}}},[Pe,e,mr]),pd=Ae(()=>{Re&&(re.getState().setCurrentChat({chatType:Re.chatType,peerId:Re.peerId,peerName:Re.name,peerAvatar:Re.avatar}),Tt(null))},[Re]),hd=ut(()=>({showMenu:(x,S,y)=>{R({x:x.clientX,y:x.clientY,message:S,elementId:y})}}),[]),gd=ut(()=>({showMenu:(x,S)=>{v({x:x.clientX,y:x.clientY,...S})}}),[]),{getCachedMembers:wo,setCachedMembers:uf,fetchGroupMembers:xd,friendCategories:Ds}=re(),Es=De(null),ia=De(null),wa=De(null),ka=De(e),Kt=De(!0),pr=De(!1),qs=De(null),ko=De([]),Ma=De(new Map),Bs=De(null),hr=De(!1),Mo=De(null),Us=De(!0),Ld=De(0),gr=De(!1);at(()=>{ka.current=e},[e]);let ct=ut(()=>{let x=new Set,S=d.filter(z=>!z||!z.elements||!Array.isArray(z.elements)||x.has(z.msgId)?!1:(x.add(z.msgId),!0)).map(z=>({type:"raw",data:z})),y=f.map(z=>({type:"temp",data:z})),N=p.map(z=>({type:"system",data:z})),_=[...S,...y,...N];return _.sort((z,me)=>{let ue=pe=>pe.type==="raw"?Number(pe.data.msgTime)*1e3:(pe.type==="temp",pe.data.timestamp);return ue(z)-ue(me)}),ko.current=_,_},[d,f,p]),Nt=Wo({count:ct.length,getScrollElement:()=>ia.current,estimateSize:()=>80,overscan:5}),xr=Ae((x,S)=>{let y=ct.findIndex(N=>N.type!=="raw"?!1:N.data.msgId===x||!!S&&String(N.data.msgSeq)===String(S));if(y!==-1){Nt.scrollToIndex(y,{align:"center"});let N=ct[y];N.type==="raw"&&(Ke(N.data.msgId),setTimeout(()=>Ke(null),2e3))}},[ct,Nt]),Id=ut(()=>({scrollToMessage:xr}),[xr]),Cd=ut(()=>({getMembers:x=>wo(x)}),[wo]),Sd=ut(()=>({getFriend:x=>{for(let S of Ds){let y=S.friends.find(N=>N.uin===x);if(y)return{uid:y.uid,uin:y.uin,nickname:y.nickname,remark:y.remark}}return null}}),[Ds]),Qt=Ae(()=>{ko.current.length>0&&Nt.scrollToIndex(ko.current.length-1,{align:"end"});let x=ia.current;x&&(x.scrollTop=x.scrollHeight)},[Nt]),[Os,zs]=Ie(!1),Hs=De(0),Pa=De(null),Po=Ae(()=>{Pa.current!==null&&(cancelAnimationFrame(Pa.current),Pa.current=null)},[]),Ao=Ae((x=800)=>{Hs.current=Date.now()+x,Po();let S=()=>{if(Date.now()>Hs.current){Pa.current=null;return}Qt(),Pa.current=requestAnimationFrame(S)};S()},[Qt,Po]);at(()=>{let x=e?`${e.chatType}_${e.peerId}`:null;x!==qs.current&&(qs.current=x,pr.current=!1,ie(!1),zs(!0))},[e?.chatType,e?.peerId]),at(()=>{de(!1),We(new Set),st(null),Tt(null)},[e?.chatType,e?.peerId]),at(()=>{if(!Os||g)return;let x=0,S=0,y=Date.now(),N=5e3,_=()=>{let z=ia.current,me=!!z&&z.scrollHeight>0&&ko.current.length>0;if(me?(Qt(),S=z.scrollHeight<=z.clientHeight||z.scrollHeight-z.scrollTop-z.clientHeight<4?S+1:0):S=0,me&&S>=5||Date.now()-y>N){zs(!1),pr.current=!0,ie(!0);return}x=requestAnimationFrame(_)};return x=requestAnimationFrame(_),()=>cancelAnimationFrame(x)},[Os,g,Qt]),at(()=>()=>Po(),[Po]),at(()=>{Kt.current&&ct.length>0&&(Qt(),Kt.current=!1)},[ct.length,Qt]),at(()=>(a&&a(S=>{if(!S||!S.msgId||!S.elements||!Array.isArray(S.elements))return;let y=Ze();c(N=>{if(N.some(me=>me&&me.msgId===S.msgId))return N;let _=[...N,S],z=ka.current;return z&&Vo(z.chatType,z.peerId,S),_}),S.senderUid===y&&h(N=>{let _=N.filter(z=>z.status==="sending");return _.length===0?N:(console.warn(`[SSE] \u6536\u5230\u81EA\u5DF1\u7684\u6D88\u606F\u65F6\uFF0C\u4ECD\u5B58\u5728 ${_.length} \u6761\u4E34\u65F6\u6D88\u606F\uFF0C\u73B0\u5DF2\u6E05\u9664`,_),N.filter(z=>z.status!=="sending"))})}),()=>{a&&a(null)}),[a]);let Lr=Ae(x=>{let S=lt(),y=!!S&&x.userId===S;if(c(N=>N.map(_=>{if(String(_.msgSeq)!==String(x.msgSeq))return _;let z=_.emojiLikesList||[];if(x.isAdd){let me=z.findIndex(ue=>ue.emojiId===x.emojiId);if(me>=0){let ue=[...z];return ue[me]={...ue[me],likesCnt:String(parseInt(ue[me].likesCnt)+1),isClicked:ue[me].isClicked||y},{..._,emojiLikesList:ue}}else return{..._,emojiLikesList:[...z,{emojiId:x.emojiId,emojiType:parseInt(x.emojiId)>999?"2":"1",likesCnt:"1",isClicked:y}]}}else{let me=z.findIndex(ue=>ue.emojiId===x.emojiId);if(me>=0){let ue=[...z],pe=parseInt(ue[me].likesCnt)-1;return pe<=0?ue.splice(me,1):ue[me]={...ue[me],likesCnt:String(pe),isClicked:y?!1:ue[me].isClicked},{..._,emojiLikesList:ue}}}return _})),x.isAdd&&!y){let N={id:`tip_${Date.now()}_${Math.random()}`,type:"emoji-reaction",userName:x.userName,emojiId:x.emojiId,msgSeq:x.msgSeq,timestamp:Date.now()};m(_=>[..._,N])}},[]),Ir=Ae((x,S,y,N)=>{let _=lt()||"";Lr({groupCode:N,msgSeq:String(x),emojiId:S,userId:_,userName:"",isAdd:y}),$o(2,N,String(x),S,y,!0)},[Lr]),bd=ut(()=>({onSelfReact:Ir}),[Ir]);at(()=>(r&&r(S=>{Lr(S)}),()=>{r&&r(null)}),[r]),at(()=>(s&&s(S=>{c(y=>y.map(N=>N.msgId===S.msgId||S.msgSeq&&String(N.msgSeq)===String(S.msgSeq)?{...N,recallTime:String(Math.floor(Date.now()/1e3))}:N))}),()=>{s&&s(null)}),[s]);let Gs=(x,S)=>`${x}_${S}`,_s=Ae(async(x,S)=>{if(!e)return;let y=e.chatType,N=e.peerId,_=()=>{let z=ka.current;return z&&z.chatType===y&&z.peerId===N};console.log("[ChatWindow] loadMessages called:",{chatType:y,peerId:N,beforeMsgSeq:x,afterMsgSeq:S}),x?I(!0):L(!0),x&&d.length>0&&(Mo.current=d[0]?.msgId||null);try{let z=await Fo(y,N,x,20,S);if(console.log("[ChatWindow] API response:",{messagesCount:z.messages.length,hasMore:z.hasMore}),!_()){console.log("[ChatWindow] Session changed after API call, skipping");return}let me=z.messages.filter(ue=>ue!=null&&ue.elements&&Array.isArray(ue.elements));return console.log("[ChatWindow] Valid messages:",me.length),c(ue=>{let pe=new Set(ue.map(Qe=>Qe.msgId)),Ve=me.filter(Qe=>!pe.has(Qe.msgId)),Te=x?[...Ve,...ue]:[...ue,...Ve];return Te.sort((Qe,No)=>Number(Qe.msgTime)-Number(No.msgTime)),console.log("[ChatWindow] Merged messages:",Te.length,"new:",Ve.length),$t(y,N,Te),Te}),b(z.hasMore),{validMessages:me,hasMore:z.hasMore}}catch(z){if(console.error("[ChatWindow] loadMessages error:",z),Mo.current=null,!_())return;T(x?"\u52A0\u8F7D\u66F4\u591A\u6D88\u606F\u5931\u8D25":"\u52A0\u8F7D\u6D88\u606F\u5931\u8D25","error")}finally{_()&&(L(!1),I(!1))}},[e,d]),vd=Ae(async x=>{if(!e)return;let S=e.chatType,y=e.peerId;L(!0);let N=()=>{let _=ka.current;return _&&_.chatType===S&&_.peerId===y};try{let _=await Fo(S,y);if(!N()){console.log("[ChatWindow] Session changed during API call, skipping");return}let z=_.messages.filter(pe=>pe!=null&&pe.elements&&Array.isArray(pe.elements));if(console.log("[ChatWindow] Latest messages from API:",z.length),z.length===0){b(!1);return}let me=new Set(x.map(pe=>pe.msgId));if(z.some(pe=>me.has(pe.msgId))||x.length===0){console.log("[ChatWindow] Has overlap with cache, merging directly");let Ve=[...x,...z].filter((Te,Qe,No)=>No.findIndex(Aa=>Aa.msgId===Te.msgId)===Qe);Ve.sort((Te,Qe)=>Number(Te.msgTime)-Number(Qe.msgTime)),c(Ve),$t(S,y,Ve),b(_.hasMore)}else{console.log("[ChatWindow] No overlap, need to fill gap");let pe=[...z],Ve=z[0]?.msgSeq,Te=_.hasMore,Qe=[...x].reverse().find(Ft=>Number(Ft.msgSeq)>0)?.msgSeq;for(let Ft=0;Ft<10&&Te;Ft++){if(!N()){console.log("[ChatWindow] Session changed during gap fill, skipping");return}let da=await Fo(S,y,Ve),Jt=da.messages.filter(bt=>bt!=null&&bt.elements&&Array.isArray(bt.elements));if(Jt.length===0)break;pe=[...Jt,...pe],Ve=Jt[0]?.msgSeq,Te=da.hasMore;let Sr=new Set(Jt.map(bt=>bt.msgId));if(x.some(bt=>Sr.has(bt.msgId))||!!Qe&&Jt.some(bt=>Number(bt.msgSeq)<=Number(Qe))){console.log("[ChatWindow] Connected with cache after",Ft+1,"iterations");break}}let Aa=[...x,...pe].filter((Ft,da,Jt)=>Jt.findIndex(Sr=>Sr.msgId===Ft.msgId)===da);Aa.sort((Ft,da)=>Number(Ft.msgTime)-Number(da.msgTime)),c(Aa),$t(S,y,Aa),b(Te)}}catch(_){console.error("[ChatWindow] loadMessagesAndMergeWithCache error:",_),T("\u52A0\u8F7D\u6D88\u606F\u5931\u8D25","error")}finally{N()&&L(!1)}},[e]);at(()=>{let x=Mo.current;if(x&&ct.length>0){let S=ct.findIndex(y=>y.type==="raw"&&y.data.msgId===x);S!==-1&&Nt.scrollToIndex(S,{align:"start"}),Mo.current=null}},[ct,Nt]),at(()=>{if(e){let x=++Ld.current,S=Gs(e.chatType,e.peerId),y=e.chatType,N=e.peerId;console.log("[ChatWindow] Session changed:",{chatType:y,peerId:N,version:x}),gr.current=!1,L(!1);let _=Ma.current.get(S);_&&_.length>0?(console.log("[ChatWindow] Memory cache hit:",_.length,"messages"),c(_)):(console.log("[ChatWindow] Memory cache miss"),c([])),h([]),m([]),Kt.current=!0;let z=Us.current,me=ma(y,N),ue=z||!me;console.log("[ChatWindow] Check load:",{isFirstMount:z,hasVisited:me,shouldLoadFromApi:ue}),La(y,N).then(async pe=>{let Ve=ka.current;if(!Ve||Ve.chatType!==y||Ve.peerId!==N){console.log("[ChatWindow] Session changed after IndexedDB read, skipping");return}let Te=[];pe&&pe.length>0?(Te=pe.filter(Qe=>Qe.elements&&Array.isArray(Qe.elements)),console.log("[ChatWindow] IndexedDB cache hit:",Te.length,"valid messages"),Te.length>0&&(Ma.current.set(S,Te),c(Te))):console.log("[ChatWindow] IndexedDB cache miss"),ue&&!gr.current&&(gr.current=!0,Us.current=!1,ei(y,N),console.log("[ChatWindow] Calling loadMessagesAndMergeWithCache()"),await vd(Te))})}else c([]),h([]),m([])},[e?.peerId,e?.chatType]),at(()=>{if(e&&d.length>0){let x=Gs(e.chatType,e.peerId);Ma.current.set(x,d)}},[d,e?.chatType,e?.peerId]),at(()=>{let x=Bs.current,S=ia.current;if(!x||!S)return;let y=new IntersectionObserver(N=>{if(N[0].isIntersecting&&pr.current&&A&&!hr.current&&!g&&d.length>0){let z=d.find(me=>Number(me.msgSeq)>0)?.msgSeq;z&&(hr.current=!0,_s(z).finally(()=>{hr.current=!1}))}},{root:S,rootMargin:"50px 0px 0px 0px",threshold:0});return y.observe(x),()=>y.disconnect()},[A,d,_s]);let yd=Ae(()=>{let x=ia.current;if(!x||d.length===0)return;let S=x.scrollHeight-x.scrollTop-x.clientHeight<100;Kt.current=S,Xt(!S)},[d]),wd=Ae(x=>{h(S=>S.filter(y=>y.msgId!==x.msgId))},[]),kd=Ae(async(x,S,y,N,_)=>{q({profile:null,loading:!0,position:{x:y,y:N}});try{let z=await io(x,S,_);q({profile:z,loading:!1,position:{x:y,y:N}})}catch{q(null),T("\u83B7\u53D6\u7528\u6237\u8D44\u6599\u5931\u8D25","error")}},[]),Md=Ae(x=>{h(S=>[...S,x]),Kt.current=!0},[]),Pd=Ae(()=>{Kt.current=!0,Xt(!1),Ao(900)},[Ao]),Ad=Ae(()=>{Kt.current=!0,Ao(1400)},[Ao]),Rd=Ae(x=>{h(S=>S.filter(y=>y.msgId!==x))},[]),Td=Ae(x=>{h(S=>S.map(y=>y.msgId===x?{...y,status:"failed"}:y))},[]);at(()=>{l&&(wa.current?.insertAt?.(l.uid,l.uin,l.name),wa.current?.focus?.(),n?.())},[l,n]);let Ro=De(null),To=De(null),[Cr,Nd]=Ie({head:56,foot:72});return Oc(()=>{let x=()=>Nd({head:Ro.current?.offsetHeight??0,foot:To.current?.offsetHeight??0}),S=new ResizeObserver(x);return Ro.current&&S.observe(Ro.current),To.current&&S.observe(To.current),x(),()=>S.disconnect()},[e?.peerId]),e?G(go.Provider,{value:vo,children:G(Ko.Provider,{value:yo,children:G(ss.Provider,{value:Ns,children:G(rs.Provider,{value:hd,children:G(Yo.Provider,{value:ud,children:G(er.Provider,{value:gd,children:G(tr.Provider,{value:Id,children:G(ar.Provider,{value:Cd,children:G(or.Provider,{value:Sd,children:G(cs.Provider,{value:cd,children:je(fs.Provider,{value:bd,children:[je("div",{ref:Es,className:"flex flex-col h-full relative",children:[je("div",{ref:Ro,className:"absolute top-0 left-0 right-0 z-20 glass-bar hairline-b flex items-center justify-between px-2 md:px-4 py-3",children:[u&&G("button",{onClick:i,className:"p-2 mr-1 text-theme-muted hover:text-theme hover:bg-theme-item rounded-lg transition-colors md:hidden",children:G(Fa,{size:20})}),je("div",{className:"flex items-center gap-3 cursor-pointer hover:opacity-80 transition-opacity flex-1 min-w-0",onClick:async x=>{let S=x.currentTarget.getBoundingClientRect(),y=S.left,N=S.bottom+8;if(e.chatType===2){D({profile:null,loading:!0,position:{x:y,y:N}});try{let _=await Bl(e.peerId);D({profile:_,loading:!1,position:{x:y,y:N}})}catch{D(null),T("\u83B7\u53D6\u7FA4\u8D44\u6599\u5931\u8D25","error")}}else{q({profile:null,loading:!0,position:{x:y,y:N}});try{let{friendCategories:_}=re.getState(),z="";for(let ue of _){let pe=ue.friends.find(Ve=>Ve.uin===e.peerId);if(pe){z=pe.uid;break}}let me=await io(z||void 0,e.peerId);q({profile:me,loading:!1,position:{x:y,y:N}})}catch(_){console.log(_),q(null),T("\u83B7\u53D6\u7528\u6237\u8D44\u6599\u5931\u8D25","error")}}},children:[G("img",{src:e.peerAvatar,alt:e.peerName,className:"w-10 h-10 rounded-full object-cover flex-shrink-0"}),je("div",{className:"min-w-0",children:[G("div",{className:"font-medium text-theme truncate",children:(()=>{let{groups:x,friendCategories:S}=re.getState();if(e.chatType===2){let y=x.find(N=>N.groupCode===e.peerId);if(y?.remarkName&&y.remarkName!==y.groupName)return`${y.remarkName}(${y.groupName})`}else for(let y of S){let N=y.friends.find(_=>_.uin===e.peerId);if(N?.remark&&N.remark!==N.nickname)return`${N.remark}(${N.nickname})`}return e.peerName})()}),G("div",{className:"text-xs text-theme-hint",children:e.chatType===2?(()=>{let{groups:x}=re.getState(),S=x.find(y=>y.groupCode===e.peerId);return`\u7FA4\u804A ${e.peerId}${S?.memberCount?` \xB7 ${S.memberCount}\u4EBA`:""}`})():e.chatType===100?`\u4E34\u65F6\u4F1A\u8BDD ${e.peerId}`:`\u79C1\u804A ${e.peerId}`})]})]}),je("div",{className:"flex items-center flex-shrink-0 empty:hidden",children:[G(Hc,{name:"webqq.chat.actions",props:{chat:{chatType:Number(e.chatType),peerId:e.peerId,name:e.peerName}}}),e.chatType===2&&t&&G("button",{onClick:()=>t(),className:"p-2 text-theme-muted hover:text-theme hover:bg-theme-item rounded-lg",title:"\u7FA4\u6587\u4EF6",children:G(Ha,{size:20})}),e.chatType===2&&o&&G("button",{onClick:o,className:"p-2 text-theme-muted hover:text-theme hover:bg-theme-item rounded-lg",title:"\u67E5\u770B\u7FA4\u6210\u5458",children:G(gt,{size:20})})]})]}),je("div",{ref:ia,onScroll:yd,className:"flex-1 overflow-y-auto overflow-x-hidden px-4",style:{paddingTop:Cr.head+16,paddingBottom:Cr.foot+16},children:[G("div",{ref:Bs,className:"h-1"}),C&&G("div",{className:"flex justify-center py-2",children:G(Q,{size:20,className:"animate-spin text-pink-500"})}),g?G("div",{className:"flex items-center justify-center h-full",children:G(Q,{size:32,className:"animate-spin text-pink-500"})}):ct.length===0?G("div",{className:"flex items-center justify-center h-full text-theme-hint",children:"\u6682\u65E0\u6D88\u606F"}):G("div",{style:{height:`${Nt.getTotalSize()}px`,width:"100%",position:"relative",opacity:Y?1:0},className:"overflow-hidden",children:Nt.getVirtualItems().map(x=>{let S=ct[x.index];return G("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${x.start}px)`,padding:"8px 0"},"data-index":x.index,ref:Nt.measureElement,className:"overflow-hidden box-border",children:S.type==="raw"?G(ms,{message:S.data,allMessages:d,isHighlighted:Oe===S.data.msgId}):S.type==="temp"?G(ps,{message:S.data,onRetry:()=>wd(S.data)}):G(_c,{tip:S.data,onScrollToMessage:y=>xr("",y)})},x.key)})})]}),ke&&G("button",{onClick:Qt,className:"absolute right-4 w-7 h-7 glass glass-chrome glass-interactive r-capsule flex items-center justify-center text-theme-muted hover:text-theme transition-all z-30",style:{bottom:Cr.foot+16},title:"\u6EDA\u52A8\u5230\u5E95\u90E8",children:G(Na,{size:12})}),G("div",{ref:To,className:"absolute bottom-0 left-0 right-0 z-20",children:J?je("div",{className:"glass-bar hairline-t px-4 py-3 flex items-center justify-between gap-3",children:[je("span",{className:"text-sm text-theme-secondary",children:["\u5DF2\u9009 ",X.size," \u6761"]}),je("div",{className:"flex items-center gap-2",children:[G("button",{onClick:mr,className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors",children:"\u53D6\u6D88"}),je("button",{onClick:()=>{let x=fd();if(x.length===0){T("\u8BF7\u5148\u9009\u62E9\u6D88\u606F","warning");return}st({single:!1,msgSeqs:x})},disabled:X.size===0,className:"px-4 py-1.5 text-sm gradient-primary text-white rounded-full font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5 transition-all",children:[G(ea,{size:15})," \u8F6C\u53D1 (",X.size,")"]})]})]}):G(As,{ref:wa,session:e,replyTo:H,onReplyCancel:()=>W(null),onSendStart:Pd,onSendEnd:Ad,onTempMessage:Md,onTempMessageRemove:Rd,onTempMessageFail:Td})})]}),le&&G(Wi,{contextMenu:le,session:e,getCachedMembers:wo,onClose:()=>R(null),onReply:x=>{W(x),setTimeout(()=>wa.current?.focus?.(),50)},onEmojiReaction:(x,S,y)=>ne({message:x,x:S,y}),onRecall:x=>{if(c(S=>S.filter(y=>y.msgId!==x)),e){let S=`${e.chatType}_${e.peerId}`,y=Ma.current.get(S);y&&Ma.current.set(S,y.filter(N=>N.msgId!==x)),Ei(e.chatType,e.peerId,x)}},onForward:x=>st({single:!0,msgSeqs:[Number(x.msgSeq)]}),onMultiSelect:x=>{de(!0),We(new Set([x.msgId]))}}),$&&G(Ps,{target:$,onClose:()=>ne(null),onReacted:x=>{let S=$.message;Ir(S.msgSeq,x,!0,String(S.peerUin))},containerRef:Es}),E&&G(lr,{avatarContextMenu:E,getCachedMembers:wo,onClose:()=>v(null),onInsertAt:(x,S,y)=>wa.current?.insertAt?.(x,S,y),onShowProfile:kd,onSetTitle:(x,S,y)=>P({uid:x,name:S,groupCode:y}),onMute:(x,S,y)=>fe({uid:x,name:S,groupCode:y}),onKick:(x,S,y,N)=>j({uid:x,name:S,groupCode:y,groupName:N}),onAdminChanged:()=>e&&xd(e.peerId,!0),groupName:e?.peerName}),B&&G(ho,{profile:B.profile,loading:B.loading,position:B.position,onClose:()=>q(null),isFriend:e?.chatType===1,onFriendDeleted:x=>{let{removeFriend:S,setCurrentChat:y,removeRecentChat:N}=re.getState();S(x),e?.chatType===1&&(y(null),N(1,e.peerId))}}),w&&G(Qr,{profile:w.profile,loading:w.loading,position:w.position,onClose:()=>D(null),onQuitGroup:async(x,S)=>{try{await vl(x),T(S?"\u7FA4\u5DF2\u89E3\u6563":"\u5DF2\u9000\u51FA\u7FA4\u804A","success");let{setCurrentChat:y,removeRecentChat:N}=re.getState();y(null),N(2,x)}catch(y){T(y.message||(S?"\u89E3\u6563\u5931\u8D25":"\u9000\u7FA4\u5931\u8D25"),"error")}}}),Ee&&G(sr,{name:Ee.name,groupName:Ee.groupName,onConfirm:async()=>{let{uid:x,name:S,groupCode:y}=Ee;j(null);try{await Do(y,x),T(`\u5DF2\u5C06 ${S} \u79FB\u51FA\u7FA4\u804A`,"success")}catch(N){T(N.message||"\u8E22\u51FA\u5931\u8D25","error")}},onClose:()=>j(null)}),ce&&G(rr,{name:ce.name,onMute:async x=>{let{uid:S,name:y,groupCode:N}=ce;fe(null);try{if(await Eo(N,S,x),x===0)T(`\u5DF2\u89E3\u9664 ${y} \u7684\u7981\u8A00`,"success");else{let _=x>=86400?`${Math.floor(x/86400)}\u5929`:x>=3600?`${Math.floor(x/3600)}\u5C0F\u65F6`:x>=60?`${Math.floor(x/60)}\u5206\u949F`:`${x}\u79D2`;T(`\u5DF2\u7981\u8A00 ${y} ${_}`,"success")}}catch(_){T(_.message||"\u7981\u8A00\u5931\u8D25","error")}},onClose:()=>fe(null)}),qe&&G(nr,{name:qe.name,onConfirm:async x=>{let{uid:S,name:y,groupCode:N}=qe;P(null);try{await qo(N,S,x),T(x?`\u5DF2\u8BBE\u7F6E ${y} \u7684\u5934\u8854\u4E3A\u300C${x}\u300D`:`\u5DF2\u6E05\u9664 ${y} \u7684\u5934\u8854`,"success")}catch(_){T(_.message||"\u8BBE\u7F6E\u5934\u8854\u5931\u8D25","error")}},onClose:()=>P(null)}),G(Yr,{url:F,onClose:()=>M(null)}),G(es,{videoInfo:O,onClose:()=>Z(null)}),Pe&&G(Ji,{count:Pe.msgSeqs.length,sending:Rt,onSelect:md,onClose:()=>st(null)}),Re&&zc(je(Wc,{children:[G("div",{className:"fixed inset-0 z-[60] bg-black/40",onClick:()=>Tt(null)}),je("div",{className:"fixed z-[60] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-5 w-80 max-w-[90vw]",children:[G("div",{className:"font-medium text-theme mb-2",children:"\u8F6C\u53D1\u6210\u529F"}),je("div",{className:"text-sm text-theme-secondary mb-4 break-all",children:["\u662F\u5426\u8DF3\u8F6C\u5230\u300C",Re.name,"\u300D\uFF1F"]}),je("div",{className:"flex justify-end gap-2",children:[G("button",{onClick:()=>Tt(null),className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors",children:"\u7559\u5728\u5F53\u524D"}),G("button",{onClick:pd,className:"px-4 py-1.5 text-sm btn-primary transition-all",children:"\u8DF3\u8F6C\u8FC7\u53BB"})]})]})]}),document.body)]})})})})})})})})})})}):G("div",{className:"flex-1 flex items-center justify-center bg-theme-item",children:je("div",{className:"text-center text-theme-hint",children:[G("div",{className:"text-6xl mb-4",children:"\u{1F4AC}"}),G("p",{children:"\u9009\u62E9\u4E00\u4E2A\u8054\u7CFB\u4EBA\u5F00\u59CB\u804A\u5929"})]})})},Zi=jc;import{useState as Ht,useEffect as Yi,useMemo as ed,useCallback as td,useRef as So}from"react";import{jsx as ve,jsxs as Gt}from"react/jsx-runtime";var Vc=({member:e,onContextMenu:o,onClick:t})=>{let a=e.card||e.nickname,r=e.role==="owner"?ve(mt,{size:14,className:"text-yellow-500"}):e.role==="admin"?ve(pt,{size:14,className:"text-blue-500"}):null;return Gt("div",{className:"flex items-center gap-3 px-3 py-2 hover:bg-theme-item-hover transition-colors cursor-pointer",onClick:l=>{("ontouchstart"in window||navigator.maxTouchPoints>0)&&t?.(l)},onContextMenu:o,children:[ve("img",{src:e.avatar,alt:a,className:"w-8 h-8 rounded-full object-cover flex-shrink-0",loading:"lazy",onError:l=>{l.currentTarget.src=Be(e.uin)}}),Gt("div",{className:"flex-1 min-w-0",children:[Gt("div",{className:"flex items-center gap-1.5",children:[ve("span",{className:"text-sm text-theme truncate",children:a}),r]}),e.card&&e.card!==e.nickname&&ve("div",{className:"text-xs text-theme-hint truncate",children:e.nickname})]})]})},$c=({groupCode:e,onClose:o,onAtMember:t})=>{let[a,r]=Ht([]),[s,l]=Ht(!1),[n,i]=Ht(""),[u,d]=Ht(null),[c,f]=Ht(null),[h,p]=Ht(null),[m,g]=Ht(null),[L,C]=Ht(null),[I,A]=Ht(null),{getCachedMembers:b,fetchGroupMembers:F,currentChat:M}=re(),O=So(null),Z=So(e);Yi(()=>{Z.current=e},[e]);let H=So(b);H.current=b;let W=So(F);W.current=F;let le=So(!1);Yi(()=>{let w=e,D=!ma(2,w),Y=ti(w);console.log("[GroupMemberPanel] useEffect triggered:",{groupCode:w,isFirstVisit:D,alreadyFetched:Y});let ie=H.current(w);if(ie&&(console.log("[GroupMemberPanel] Cache hit:",ie.length,"members"),r(ie),d(null),Y)){l(!1);return}if(Y){l(!1);return}if(le.current){console.log("[GroupMemberPanel] Already loading, skip");return}return console.log("[GroupMemberPanel] Fetching from API, isFirstVisit:",D),le.current=!0,ie||(l(!0),d(null),r([])),W.current(w,D).then(Oe=>{console.log("[GroupMemberPanel] API success:",Oe.length,"members, currentGroupCode:",Z.current),Z.current===w&&(r(Oe),l(!1),ai(w))}).catch(Oe=>{console.log("[GroupMemberPanel] API error:",Oe.message),Z.current===w&&(ie||d(Oe.message||"\u52A0\u8F7D\u7FA4\u6210\u5458\u5931\u8D25"),T("\u52A0\u8F7D\u7FA4\u6210\u5458\u5931\u8D25","error"),l(!1))}).finally(()=>{Z.current===w&&(le.current=!1)}),()=>{console.log("[GroupMemberPanel] Cleanup, reset isLoading"),le.current=!1}},[e]);let R=ed(()=>El(a,n),[a,n]),E=Wo({count:R.length,getScrollElement:()=>O.current,estimateSize:()=>48,overscan:5}),v=ed(()=>{let w=a.filter(Y=>Y.role==="owner").length,D=a.filter(Y=>Y.role==="admin").length;return{owner:w,admin:D,total:a.length}},[a]),B=td((w,D)=>{w.preventDefault(),w.stopPropagation(),f({x:w.clientX,y:w.clientY,senderUid:D.uid,senderUin:D.uin,senderName:D.card||D.nickname,chatType:2,groupCode:e})},[e]),q=td(async(w,D,Y,ie,Oe)=>{let Ke={x:Y,y:ie};p({profile:null,loading:!0,position:Ke});try{let Ee=await io(w,D,Oe);p({profile:Ee,loading:!1,position:Ke})}catch(Ee){T(Ee.message||"\u83B7\u53D6\u8D44\u6599\u5931\u8D25","error"),p(null)}},[]);return Gt("div",{className:"flex flex-col h-full",children:[Gt("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider",children:[Gt("div",{children:[ve("div",{className:"font-medium text-theme",children:"\u7FA4\u6210\u5458"}),Gt("div",{className:"text-xs text-theme-hint",children:[v.total," \u4EBA"]})]}),ve("button",{onClick:o,className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors",children:ve(we,{size:18})})]}),ve("div",{className:"p-3",children:Gt("div",{className:"relative",children:[ve(Et,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-theme-hint"}),ve("input",{type:"text",value:n,onChange:w=>i(w.target.value),placeholder:"\u641C\u7D22\u6210\u5458...",className:"w-full pl-9 pr-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme placeholder:text-theme-hint"})]})}),ve("div",{ref:O,className:"flex-1 overflow-y-auto",children:s?ve("div",{className:"flex items-center justify-center h-32",children:ve(Q,{size:24,className:"animate-spin text-pink-500"})}):u?Gt("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[ve("p",{className:"text-sm text-red-500",children:u}),ve("button",{onClick:()=>F(e),className:"text-sm text-pink-500 hover:text-pink-600",children:"\u91CD\u8BD5"})]}):R.length===0?ve("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:n?"\u672A\u627E\u5230\u5339\u914D\u7684\u6210\u5458":"\u6682\u65E0\u6210\u5458"}):ve("div",{className:"py-1 relative",style:{height:E.getTotalSize()},children:E.getVirtualItems().map(w=>{let D=R[w.index];return ve("div",{className:"absolute left-0 right-0",style:{top:w.start,height:w.size},children:ve(Vc,{member:D,onClick:Y=>B(Y,D),onContextMenu:Y=>B(Y,D)})},D.uid)})})}),c&&ve(lr,{avatarContextMenu:c,getCachedMembers:b,onClose:()=>f(null),onInsertAt:(w,D,Y)=>{t?.({uid:w,uin:D,name:Y})},onShowProfile:q,onSetTitle:(w,D)=>A({uid:w,name:D}),onMute:(w,D)=>g({uid:w,name:D}),onKick:(w,D)=>C({uid:w,name:D}),onAdminChanged:()=>F(e,!0),groupName:M?.peerName}),h&&ve(ho,{profile:h.profile,loading:h.loading,position:h.position,onClose:()=>p(null)}),m&&ve(rr,{name:m.name,onMute:async w=>{let{uid:D,name:Y}=m;g(null);try{if(await Eo(e,D,w),w===0)T(`\u5DF2\u89E3\u9664 ${Y} \u7684\u7981\u8A00`,"success");else{let ie=w>=86400?`${Math.floor(w/86400)}\u5929`:w>=3600?`${Math.floor(w/3600)}\u5C0F\u65F6`:w>=60?`${Math.floor(w/60)}\u5206\u949F`:`${w}\u79D2`;T(`\u5DF2\u7981\u8A00 ${Y} ${ie}`,"success")}}catch(ie){T(ie.message||"\u7981\u8A00\u5931\u8D25","error")}},onClose:()=>g(null)}),L&&ve(sr,{name:L.name,groupName:M?.peerName||e,onConfirm:async()=>{let{uid:w,name:D}=L;C(null);try{await Do(e,w),T(`\u5DF2\u5C06 ${D} \u79FB\u51FA\u7FA4\u804A`,"success")}catch(Y){T(Y.message||"\u8E22\u51FA\u5931\u8D25","error")}},onClose:()=>C(null)}),I&&ve(nr,{name:I.name,onConfirm:async w=>{let{uid:D,name:Y}=I;A(null);try{await qo(e,D,w),T(w?`\u5DF2\u8BBE\u7F6E ${Y} \u7684\u5934\u8854\u4E3A\u300C${w}\u300D`:`\u5DF2\u6E05\u9664 ${Y} \u7684\u5934\u8854`,"success")}catch(ie){T(ie.message||"\u8BBE\u7F6E\u5934\u8854\u5931\u8D25","error")}},onClose:()=>A(null)})]})},ad=$c;import Xc,{useState as ot,useEffect as Rs,useCallback as Kc,useRef as od}from"react";import{jsx as ee,jsxs as xe}from"react/jsx-runtime";function Qc(e){return!e||e<=0?"0 B":e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":e<1024*1024*1024?(e/1024/1024).toFixed(1)+" MB":(e/1024/1024/1024).toFixed(2)+" GB"}function Jc(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}var Zc=({groupCode:e,onClose:o,locateTarget:t})=>{let[a,r]=ot([]),[s,l]=ot([]),[n,i]=ot(!1),[u,d]=ot(null),[c,f]=ot(!1),[h,p]=ot([]),[m,g]=ot(null),[L,C]=ot(""),[I,A]=ot(!1),[b,F]=ot(""),[M,O]=ot(null),[Z,H]=ot(!1),[W,le]=ot(null),[R,E]=ot(null),v=od(new Map),B=(P,$,ne)=>{let ke=P.currentTarget.getBoundingClientRect(),Xt=Math.min(ke.left,window.innerWidth-268);le({title:$,detail:ne,x:Math.max(8,Xt),y:ke.bottom+4})},q=od(null),w=h.length>0?h[h.length-1].folderId:"/",D=Kc(async()=>{i(!0),d(null);try{let P=await Rr(e,w);r(P.files),l(P.folders)}catch(P){d(P.message||"\u83B7\u53D6\u7FA4\u6587\u4EF6\u5931\u8D25")}finally{i(!1)}},[e,w]);Rs(()=>{D()},[D]),Rs(()=>{if(!t)return;let{folderId:P,fileId:$}=t;if(E($),!P||P==="/"){p([]);return}let ne=!1;return Rr(e,"/").then(ke=>{if(ne)return;let Xt=ke.folders.find(J=>J.folderId===P);p([{folderId:P,folderName:Xt?.folderName||P}])}).catch(()=>{ne||p([{folderId:P,folderName:P}])}),()=>{ne=!0}},[t?.folderId,t?.fileId,e]),Rs(()=>{if(!R||n)return;let P=a.find(ke=>ke.fileId===R||ke.fileName===R);if(!P)return;v.current.get(P.fileId)?.scrollIntoView({behavior:"smooth",block:"center"});let ne=setTimeout(()=>E(null),2500);return()=>clearTimeout(ne)},[R,a,n]);let Y=P=>{p($=>[...$,{folderId:P.folderId,folderName:P.folderName}])},ie=P=>{p($=>$.slice(0,P+1))},Oe=()=>q.current?.click(),Ke=async P=>{let $=P.target.files?.[0];if(P.target&&(P.target.value=""),!!$){if($.size>2*1024*1024*1024){T("\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 2GB","error");return}f(!0),T(`\u6B63\u5728\u4E0A\u4F20 ${$.name}...`,"warning");try{await kl(e,$,w),T("\u4E0A\u4F20\u6210\u529F","success"),D()}catch(ne){T(`${ne.message||"\u4E0A\u4F20\u5931\u8D25"}\uFF0C\u53EF\u80FD\u8BE5\u7FA4\u4E0D\u5141\u8BB8\u4E0A\u4F20\u7FA4\u6587\u4EF6`,"error")}finally{f(!1)}}},Ee=async P=>{try{let $=await yl(e,P.fileId);window.open($+encodeURIComponent(P.fileName),"_blank")}catch($){T($.message||"\u83B7\u53D6\u4E0B\u8F7D\u94FE\u63A5\u5931\u8D25","error")}},j=async()=>{if(!(!M||Z)){H(!0);try{M.type==="file"?await Ml(e,M.id,M.busId):await Rl(e,M.id),T("\u5DF2\u5220\u9664","success"),O(null),D()}catch(P){T(P.message||"\u5220\u9664\u5931\u8D25","error")}finally{H(!1)}}},ce=(P,$,ne,ke)=>{g({type:P,id:$,oldName:ne,busId:ke}),C(ne)},fe=async()=>{if(!m)return;let P=L.trim();if(!P||P===m.oldName){g(null);return}try{m.type==="file"?await Pl(e,m.id,w,P):await Tl(e,m.id,P),T("\u5DF2\u91CD\u547D\u540D","success"),g(null),D()}catch($){T($.message||"\u91CD\u547D\u540D\u5931\u8D25","error")}},qe=async()=>{let P=b.trim();if(!P){A(!1);return}try{await Al(e,P),T("\u6587\u4EF6\u5939\u5DF2\u521B\u5EFA","success"),A(!1),F(""),D()}catch($){T($.message||"\u65B0\u5EFA\u6587\u4EF6\u5939\u5931\u8D25","error")}};return xe("div",{className:"flex flex-col h-full",children:[xe("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider",children:[ee("div",{className:"font-medium text-theme",children:"\u7FA4\u6587\u4EF6"}),xe("div",{className:"flex items-center gap-1",children:[ee("button",{onClick:D,title:"\u5237\u65B0",className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors",children:ee(aa,{size:16})}),ee("button",{onClick:o,className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors",children:ee(we,{size:18})})]})]}),xe("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-theme-divider",children:[xe("button",{onClick:Oe,disabled:c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm btn-primary disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:[c?ee(Q,{size:15,className:"animate-spin"}):ee(to,{size:15}),"\u4E0A\u4F20"]}),h.length===0&&xe("button",{onClick:()=>{A(!0),F("")},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-theme-item hover:bg-theme-item-hover text-theme rounded-lg transition-colors",children:[ee(Ga,{size:15}),"\u65B0\u5EFA\u6587\u4EF6\u5939"]}),ee("input",{ref:q,type:"file",className:"hidden",onChange:Ke})]}),xe("div",{className:"flex items-center flex-wrap gap-0.5 px-3 py-2 text-sm text-theme-hint border-b border-theme-divider",children:[ee("button",{onClick:()=>ie(-1),className:`hover:text-pink-500 transition-colors ${h.length===0?"text-theme font-medium":""}`,children:"\u5168\u90E8\u6587\u4EF6"}),h.map((P,$)=>xe(Xc.Fragment,{children:[ee(et,{size:14,className:"text-theme-hint/60"}),ee("button",{onClick:()=>ie($),className:`hover:text-pink-500 transition-colors truncate max-w-[120px] ${$===h.length-1?"text-theme font-medium":""}`,children:P.folderName})]},P.folderId))]}),I&&xe("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-theme-divider bg-theme-item/40",children:[ee(ua,{size:16,className:"text-yellow-500 flex-shrink-0"}),ee("input",{autoFocus:!0,value:b,onChange:P=>F(P.target.value),onKeyDown:P=>{P.key==="Enter"&&qe(),P.key==="Escape"&&A(!1)},placeholder:"\u6587\u4EF6\u5939\u540D\u79F0",className:"flex-1 min-w-0 px-2 py-1 text-sm bg-theme-input border border-theme-input rounded focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme"}),ee("button",{onClick:qe,className:"text-sm text-pink-500 hover:text-pink-600",children:"\u786E\u5B9A"}),ee("button",{onClick:()=>A(!1),className:"text-sm text-theme-hint hover:text-theme",children:"\u53D6\u6D88"})]}),ee("div",{className:"flex-1 overflow-y-auto",children:n?ee("div",{className:"flex items-center justify-center h-32",children:ee(Q,{size:24,className:"animate-spin text-pink-500"})}):u?xe("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[ee("p",{className:"text-sm text-red-500",children:u}),ee("button",{onClick:D,className:"text-sm text-pink-500 hover:text-pink-600",children:"\u91CD\u8BD5"})]}):s.length===0&&a.length===0?ee("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6B64\u76EE\u5F55\u6682\u65E0\u6587\u4EF6"}):xe("div",{className:"py-1",children:[s.map(P=>xe("div",{className:"group flex items-center gap-3 px-3 py-2 hover:bg-theme-item-hover transition-colors",children:[xe("button",{onClick:()=>Y(P),className:"flex items-center gap-3 flex-1 min-w-0 text-left",children:[ee(ua,{size:20,className:"text-yellow-500 flex-shrink-0"}),xe("div",{className:"flex-1 min-w-0",onMouseEnter:$=>B($,P.folderName,`${P.fileCount} \u4E2A\u6587\u4EF6 \xB7 ${P.creatorName}`),onMouseLeave:()=>le(null),children:[ee("div",{className:"text-sm text-theme truncate",children:P.folderName}),xe("div",{className:"text-xs text-theme-hint truncate",children:[P.fileCount," \u4E2A\u6587\u4EF6 \xB7 ",P.creatorName]})]})]}),xe("div",{className:"flex md:hidden md:group-hover:flex items-center gap-0.5 flex-shrink-0",children:[ee("button",{onClick:()=>ce("folder",P.folderId,P.folderName),title:"\u91CD\u547D\u540D",className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded transition-colors",children:ee(fa,{size:14})}),ee("button",{onClick:()=>O({type:"folder",id:P.folderId,name:P.folderName}),title:"\u5220\u9664",className:"p-1.5 text-theme-hint hover:text-red-500 hover:bg-theme-item rounded transition-colors",children:ee(ze,{size:14})})]})]},P.folderId)),a.map(P=>{let $=`${Qc(P.fileSize)} \xB7 ${P.uploaderName||""}${P.uploadTime?` \xB7 ${Jc(P.uploadTime)}`:""}`,ne=R!=null&&(P.fileId===R||P.fileName===R);return xe("div",{ref:ke=>{ke?v.current.set(P.fileId,ke):v.current.delete(P.fileId)},className:`group flex items-center gap-3 px-3 py-2 transition-colors ${ne?"bg-pink-500/10 ring-1 ring-inset ring-pink-500/60":"hover:bg-theme-item-hover"}`,children:[ee(Yt,{size:20,className:"text-blue-400 flex-shrink-0"}),xe("div",{className:"flex-1 min-w-0",onMouseEnter:ke=>B(ke,P.fileName,$),onMouseLeave:()=>le(null),children:[ee("div",{className:"text-sm text-theme truncate",children:P.fileName}),ee("div",{className:"text-xs text-theme-hint truncate",children:$})]}),xe("div",{className:"flex md:hidden md:group-hover:flex items-center gap-0.5 flex-shrink-0",children:[ee("button",{onClick:()=>Ee(P),title:"\u4E0B\u8F7D",className:"p-1.5 text-theme-hint hover:text-pink-500 hover:bg-theme-item rounded transition-colors",children:ee(Dt,{size:14})}),ee("button",{onClick:()=>ce("file",P.fileId,P.fileName,P.busId),title:"\u91CD\u547D\u540D",className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded transition-colors",children:ee(fa,{size:14})}),ee("button",{onClick:()=>O({type:"file",id:P.fileId,busId:P.busId,name:P.fileName}),title:"\u5220\u9664",className:"p-1.5 text-theme-hint hover:text-red-500 hover:bg-theme-item rounded transition-colors",children:ee(ze,{size:14})})]})]},P.fileId)})]})}),m&&ee("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40",children:xe("div",{className:"glass glass-thick r-panel glass-pop p-5 w-80 max-w-[90vw]",children:[xe("div",{className:"font-medium text-theme mb-3",children:["\u91CD\u547D\u540D",m.type==="folder"?"\u6587\u4EF6\u5939":"\u6587\u4EF6"]}),ee("input",{autoFocus:!0,value:L,onChange:P=>C(P.target.value),onKeyDown:P=>{P.key==="Enter"&&fe(),P.key==="Escape"&&g(null)},className:"w-full px-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme"}),xe("div",{className:"flex justify-end gap-2 mt-4",children:[ee("button",{onClick:()=>g(null),className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors",children:"\u53D6\u6D88"}),ee("button",{onClick:fe,className:"px-4 py-1.5 text-sm btn-primary transition-all",children:"\u786E\u5B9A"})]})]})}),M&&ee("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40",children:xe("div",{className:"glass glass-thick r-panel glass-pop p-5 w-80 max-w-[90vw]",children:[xe("div",{className:"font-medium text-theme mb-2",children:["\u5220\u9664",M.type==="folder"?"\u6587\u4EF6\u5939":"\u6587\u4EF6"]}),xe("div",{className:"text-sm text-theme-secondary mb-4 break-all",children:["\u786E\u5B9A\u5220\u9664",M.type==="folder"?"\u6587\u4EF6\u5939":"\u6587\u4EF6","\u300C",M.name,"\u300D",M.type==="folder"?"\u53CA\u5176\u4E2D\u6240\u6709\u6587\u4EF6\uFF1F":"\uFF1F","\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002"]}),xe("div",{className:"flex justify-end gap-2",children:[ee("button",{onClick:()=>O(null),disabled:Z,className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors disabled:opacity-50",children:"\u53D6\u6D88"}),xe("button",{onClick:j,disabled:Z,className:"px-4 py-1.5 text-sm bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[Z&&ee(Q,{size:14,className:"animate-spin"}),"\u5220\u9664"]})]})]})}),W&&ee(Hr,{children:xe("div",{className:"fixed z-[100] pointer-events-none max-w-[260px] px-3 py-2 glass glass-thick r-control",style:{left:W.x,top:W.y},children:[ee("div",{className:"text-sm text-theme break-all",children:W.title}),ee("div",{className:"text-xs text-theme-secondary break-all mt-0.5",children:W.detail})]})})]})},rd=Zc;import{usePluginConfig as Yc}from"@luckylillia-dev/plugin-sdk/webui";function cr(){let{value:e}=Yc();return{autoHideSidebar:e?.autoHideSidebar??!1,fullscreenButton:e?.fullscreenButton??!0}}import{Fragment as of,jsx as rt,jsxs as Ts}from"react/jsx-runtime";function tf(e){if(!e||!e.elements||!Array.isArray(e.elements))return"[\u6D88\u606F]";let o=[];for(let a of e.elements){if(a.textElement?.content){o.push(a.textElement.content);continue}if(a.picElement){o.push("[\u56FE\u7247]");continue}if(a.faceElement){o.push("[\u8868\u60C5]");continue}if(a.fileElement){o.push("[\u6587\u4EF6]");continue}if(a.pttElement){o.push("[\u8BED\u97F3]");continue}if(a.videoElement){o.push("[\u89C6\u9891]");continue}if(a.replyElement){o.push("[\u56DE\u590D]");continue}if(a.multiForwardMsgElement){o.push("[\u804A\u5929\u8BB0\u5F55]");continue}if(a.grayTipElement?.jsonGrayTipElement?.jsonStr)try{let r=JSON.parse(a.grayTipElement.jsonGrayTipElement.jsonStr);if(Array.isArray(r.items)){let s=Ze(),l=lt(),n=r.items.map(i=>i.type==="qq"?s&&i.uid===s||l&&String(i.uin)===String(l)?"\u4F60":i.nm||i.uin||"":i.type==="nor"&&i.txt||"").join("").trim();if(n){o.push(n);continue}}}catch{}if(a.grayTipElement?.xmlElement?.content){let r=a.grayTipElement.xmlElement.content.replace(/<[^>]+>/g,"").trim();if(r){o.push(r);continue}}if(a.arkElement)try{if(JSON.parse(a.arkElement.bytesData).app==="com.tencent.multimsg"){o.push("[\u804A\u5929\u8BB0\u5F55]");continue}}catch{}}let t=o.join("").replace(/\s+/g," ").trim();return t?/^@[^\s]+$/.test(t)?`${t} [\u63D0\u53CA]`:t:"[\u6D88\u606F]"}var af=({isFullscreen:e=!1})=>{let o=nt.useRef(null),t=nt.useRef(null),a=nt.useRef(null),r=nt.useRef([]),[,s]=nt.useState(0),{fullscreenButton:l}=cr(),{friendCategories:n,groups:i,contactsLoading:u,contactsError:d,currentChat:c,activeTab:f,unreadCounts:h,showMemberPanel:p,setCurrentChat:m,setActiveTab:g,setShowMemberPanel:L,clearUnreadCount:C,incrementUnreadCount:I,updateRecentChat:A,loadContacts:b,setRecentChats:F}=re(),M=re(J=>J.recentChats),O=re(J=>J.addNotification),Z=re(J=>J.loadGroupNotifications),[H,W]=nt.useState(null),[le,R]=nt.useState(!1),[E,v]=nt.useState(null),B=At(J=>{if(J){v(J),R(!0),L(!1);return}v(null),R(de=>{let X=!de;return X&&L(!1),X})},[L]),q=At(()=>{L(!p),p||R(!1)},[p,L]),w=At(J=>{W(J)},[]),D=At(()=>{W(null)},[]);fr(()=>{Oo(),b(),Z()},[b,Z]),fr(()=>{d&&T(d,"error")},[d]);let Y=nt.useRef(c);fr(()=>{Y.current=c},[c]);let ie=nt.useCallback(J=>{if(o.current=J,J&&r.current.length>0){let de=[...r.current];r.current=[],de.forEach(X=>J(X))}s(de=>de+1)},[]),Oe=nt.useCallback(J=>{t.current=J},[]),Ke=nt.useCallback(J=>{a.current=J},[]);fr(()=>{let J=Nl(de=>{if(de.type==="message-created"||de.type==="message-sent"){let X=de.data;if(!X||!X.msgId||!X.elements||!Array.isArray(X.elements)){console.warn("SSE \u6536\u5230\u65E0\u6548\u6D88\u606F:",X);return}let We=X.chatType,Pe=String(X.peerUin||X.peerUid),st=`${We}_${Pe}`,Rt=Y.current;if(Vo(We,Pe,X),Rt&&Rt.chatType===We&&Rt.peerId===Pe)o.current?o.current(X):r.current.push(X);else{let vo=Ze(),yo=lt();vo&&X.senderUid===vo||yo&&String(X.senderUin)===String(yo)||I(st)}let St=tf(X),Re,Tt;We===2?(Re=X.peerName||void 0,Tt=`https://p.qlogo.cn/gh/${Pe}/${Pe}/640/`):(Re=X.sendNickName||X.sendMemberName||void 0,Tt=Be(Pe)),A(We,Pe,St,X.msgTime*1e3,Re,Tt)}else if(de.type==="emoji-reaction"){let{groupCode:X,msgSeq:We,emojiId:Pe,userId:st,userName:Rt,isAdd:St}=de.data;if(st&&String(st)===String(lt()))return;let Re=Y.current;$o(2,X,We,Pe,St),Re&&Re.chatType===2&&Re.peerId===X&&t.current&&t.current({groupCode:X,msgSeq:We,emojiId:Pe,userId:st,userName:Rt,isAdd:St})}else if(de.type==="message-deleted"){let{msgId:X,msgSeq:We,chatType:Pe,peerUid:st,peerUin:Rt}=de.data,St=Rt||st,Re=Y.current;qi(Pe,St,X,We),Re&&Re.chatType===Pe&&Re.peerId===St&&a.current&&a.current({msgId:X,msgSeq:We})}else if(de.type==="group-notify"){let X=de.data;O({type:"group-notify",data:X,time:X.actionTime?parseInt(X.actionTime)*1e3:Date.now()})}else if(de.type==="friend-request"){let X=de.data;O({type:"friend-request",data:X,time:X.reqTime?parseInt(X.reqTime)*1e3:Date.now()})}else de.type==="group-dismiss"?O({type:"group-dismiss",data:de.data,time:Date.now()}):de.type==="group-quit"&&O({type:"group-quit",data:de.data,time:Date.now()})},de=>{console.error("SSE \u8FDE\u63A5\u9519\u8BEF:",de)},()=>{console.log("[WebQQ] SSE \u91CD\u8FDE\u6210\u529F\uFF0C\u91CD\u7F6E\u5DF2\u8BBF\u95EE\u804A\u5929\u6807\u5FD7"),Oo(),b()});return()=>{J.close()}},[I,A,b,O]);let Ee=At(J=>{r.current=[],m(J),v(null),J.chatType!==2&&(L(!1),R(!1));let de=`${J.chatType}_${J.peerId}`;C(de),F(M.map(X=>X.chatType===J.chatType&&X.peerId===J.peerId?{...X,unreadCount:0}:X))},[m,C,F,M,L]),[j,ce]=ef(!1),fe=At(J=>{Ee(J),ce(!0)},[Ee]),qe=At(()=>{ce(!1)},[]),P=At(J=>{let de={chatType:1,peerId:J.uin,peerName:J.remark||J.nickname,peerAvatar:J.avatar};fe(de)},[fe]),$=At(J=>{let de={chatType:2,peerId:J.groupCode,peerName:J.groupName,peerAvatar:J.avatar};fe(de)},[fe]),ne=At(J=>{let de={chatType:J.chatType,peerId:J.peerId,peerName:J.peerName,peerAvatar:J.peerAvatar};fe(de)},[fe]),ke=nt.useMemo(()=>new Map(Object.entries(h)),[h]);return u&&n.length===0&&i.length===0?rt("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:rt(Q,{size:48,className:"animate-spin text-pink-500"})}):d&&n.length===0&&i.length===0?Ts("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)] gap-4",children:[rt("p",{className:"text-red-500",children:d}),rt("button",{onClick:()=>b(),className:"px-4 py-2 bg-pink-500 text-white rounded-lg hover:bg-pink-600 transition-colors",children:"\u91CD\u8BD5"})]}):Ts(of,{children:[Ts("div",{className:"flex h-[calc(100vh-80px)] md:h-[calc(100vh-120px)] glass glass-regular rounded-none md:r-panel overflow-hidden",children:[rt("div",{className:`
|
|
10
|
-
w-full md:w-72 md:hairline-r flex-shrink-0
|
|
11
|
-
${j?"hidden md:block":"block"}
|
|
12
|
-
`,children:rt(ci,{activeTab:f,onTabChange:g,friendCategories:n,groups:i,recentChats:M,unreadCounts:ke,selectedPeerId:c?.peerId,onSelectFriend:P,onSelectGroup:$,onSelectRecent:ne})}),rt("div",{className:`
|
|
13
|
-
flex-1 flex flex-col min-w-0
|
|
14
|
-
${j?"block":"hidden md:flex"}
|
|
15
|
-
`,children:rt(Zi,{session:c,onShowMembers:q,onShowFiles:B,onNewMessageCallback:ie,onEmojiReactionCallback:Oe,onMessageRecalledCallback:Ke,appendInputMention:H,onAppendInputMentionConsumed:D,onBack:qe,showBackButton:j})}),p&&c?.chatType===2&&rt("div",{className:"fixed inset-0 z-50 bg-[rgb(var(--glass-tint)/0.92)] backdrop-blur-xl md:static md:inset-auto md:z-auto md:bg-transparent md:backdrop-blur-none md:w-64 md:hairline-l md:flex-shrink-0",children:rt(ad,{groupCode:c.peerId,onClose:()=>L(!1),onAtMember:w})}),le&&c?.chatType===2&&rt("div",{className:"fixed inset-0 z-50 bg-[rgb(var(--glass-tint)/0.92)] backdrop-blur-xl md:static md:inset-auto md:z-auto md:bg-transparent md:backdrop-blur-none md:w-80 md:hairline-l md:flex-shrink-0",children:rt(rd,{groupCode:c.peerId,locateTarget:E,onClose:()=>{R(!1),v(null)}})})]}),!e&&l&&rt("button",{onClick:()=>window.open(vt().pageHref("webqq",{fullscreen:!0}),"_blank"),className:"fixed top-4 right-4 md:top-auto md:bottom-6 md:right-6 z-50 p-3 glass glass-chrome glass-interactive r-capsule text-[var(--accent)] transition-all duration-200 group",title:"\u5728\u65B0\u7A97\u53E3\u4E2D\u5168\u5C4F\u6253\u5F00",children:rt(Va,{size:20,className:"group-hover:scale-110 transition-transform"})})]})},sd=af;function rf(e){return new Promise(o=>{let t=()=>{clearTimeout(a),e.removeEventListener("abort",t),o()},a=setTimeout(t,2e3);e.addEventListener("abort",t,{once:!0}),e.aborted&&t()})}async function nd(e,o,t,a){for(;!o.aborted;){try{let r=await e(o);if(o.aborted)return;if(r.online&&r.uin&&r.uid)return a?.(r),r;t({message:"NTQQ \u8D26\u53F7\u8FD8\u6CA1\u6709\u767B\u5F55\uFF0C\u767B\u5F55\u540E\u4F1A\u81EA\u52A8\u8FDB\u5165\u804A\u5929",error:!1})}catch(r){if(o.aborted)return;t({message:r instanceof Error?r.message:"\u83B7\u53D6\u767B\u5F55\u4FE1\u606F\u5931\u8D25",error:!0})}await rf(o)}}import{jsx as bo,jsxs as dd}from"react/jsx-runtime";var df=()=>{let{fullscreen:e}=nf(),{setCollapsed:o}=lf(),{autoHideSidebar:t}=cr(),a=sf()?.find(i=>i.platform==="ntqq"),[r,s]=id(null),[l,n]=id(null);return ld(()=>{t&&!e&&o(!0)},[t,e,o]),ld(()=>{let i=new AbortController;return s(null),n(null),nd(sl,i.signal,n,u=>{ol(u.uid,u.uin),Ri(u.uin),oi(u.uin)}).then(u=>{!u||i.signal.aborted||(n(null),s(u.uin))}),()=>i.abort()},[a?.selfId,a?.status]),l?dd("div",{className:"card p-6 flex items-center gap-3 text-sm",role:"status",children:[bo(Q,{size:18,className:"animate-spin text-pink-500 shrink-0"}),dd("div",{className:l.error?"text-red-500":"text-theme-secondary",children:[l.message,l.error&&bo("p",{className:"mt-1 text-xs text-theme-muted",children:"\u6B63\u5728\u91CD\u8BD5\u8FDE\u63A5..."})]})]}):r?bo(sd,{isFullscreen:e},r):bo("div",{className:"flex justify-center py-16",children:bo(Q,{size:40,className:"animate-spin text-pink-500"})})},iS=df;export{iS as default};
|
|
16
|
-
/*! Bundled license information:
|
|
17
|
-
|
|
18
|
-
lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
|
|
19
|
-
lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs:
|
|
20
|
-
lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs:
|
|
21
|
-
lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs:
|
|
22
|
-
lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
|
|
23
|
-
lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs:
|
|
24
|
-
lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs:
|
|
25
|
-
lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs:
|
|
26
|
-
lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs:
|
|
27
|
-
lucide-react/dist/esm/context.mjs:
|
|
28
|
-
lucide-react/dist/esm/Icon.mjs:
|
|
29
|
-
lucide-react/dist/esm/createLucideIcon.mjs:
|
|
30
|
-
lucide-react/dist/esm/icons/archive.mjs:
|
|
31
|
-
lucide-react/dist/esm/icons/arrow-down.mjs:
|
|
32
|
-
lucide-react/dist/esm/icons/arrow-left.mjs:
|
|
33
|
-
lucide-react/dist/esm/icons/at-sign.mjs:
|
|
34
|
-
lucide-react/dist/esm/icons/award.mjs:
|
|
35
|
-
lucide-react/dist/esm/icons/ban.mjs:
|
|
36
|
-
lucide-react/dist/esm/icons/bell-off.mjs:
|
|
37
|
-
lucide-react/dist/esm/icons/bell.mjs:
|
|
38
|
-
lucide-react/dist/esm/icons/calendar.mjs:
|
|
39
|
-
lucide-react/dist/esm/icons/check.mjs:
|
|
40
|
-
lucide-react/dist/esm/icons/chevron-down.mjs:
|
|
41
|
-
lucide-react/dist/esm/icons/chevron-right.mjs:
|
|
42
|
-
lucide-react/dist/esm/icons/circle-exclamation-point.mjs:
|
|
43
|
-
lucide-react/dist/esm/icons/clock.mjs:
|
|
44
|
-
lucide-react/dist/esm/icons/crown.mjs:
|
|
45
|
-
lucide-react/dist/esm/icons/download.mjs:
|
|
46
|
-
lucide-react/dist/esm/icons/face-slightly-smiling.mjs:
|
|
47
|
-
lucide-react/dist/esm/icons/file-text.mjs:
|
|
48
|
-
lucide-react/dist/esm/icons/folder-open.mjs:
|
|
49
|
-
lucide-react/dist/esm/icons/folder-plus.mjs:
|
|
50
|
-
lucide-react/dist/esm/icons/folder.mjs:
|
|
51
|
-
lucide-react/dist/esm/icons/forward.mjs:
|
|
52
|
-
lucide-react/dist/esm/icons/hand.mjs:
|
|
53
|
-
lucide-react/dist/esm/icons/image.mjs:
|
|
54
|
-
lucide-react/dist/esm/icons/list-checks.mjs:
|
|
55
|
-
lucide-react/dist/esm/icons/loader-circle.mjs:
|
|
56
|
-
lucide-react/dist/esm/icons/log-out.mjs:
|
|
57
|
-
lucide-react/dist/esm/icons/maximize-2.mjs:
|
|
58
|
-
lucide-react/dist/esm/icons/message-circle.mjs:
|
|
59
|
-
lucide-react/dist/esm/icons/moon.mjs:
|
|
60
|
-
lucide-react/dist/esm/icons/paperclip.mjs:
|
|
61
|
-
lucide-react/dist/esm/icons/pause.mjs:
|
|
62
|
-
lucide-react/dist/esm/icons/pencil.mjs:
|
|
63
|
-
lucide-react/dist/esm/icons/pin.mjs:
|
|
64
|
-
lucide-react/dist/esm/icons/play.mjs:
|
|
65
|
-
lucide-react/dist/esm/icons/refresh-cw.mjs:
|
|
66
|
-
lucide-react/dist/esm/icons/reply.mjs:
|
|
67
|
-
lucide-react/dist/esm/icons/search.mjs:
|
|
68
|
-
lucide-react/dist/esm/icons/send.mjs:
|
|
69
|
-
lucide-react/dist/esm/icons/shield-exclamation-point.mjs:
|
|
70
|
-
lucide-react/dist/esm/icons/shield-off.mjs:
|
|
71
|
-
lucide-react/dist/esm/icons/shield.mjs:
|
|
72
|
-
lucide-react/dist/esm/icons/star.mjs:
|
|
73
|
-
lucide-react/dist/esm/icons/sticker.mjs:
|
|
74
|
-
lucide-react/dist/esm/icons/sun.mjs:
|
|
75
|
-
lucide-react/dist/esm/icons/trash.mjs:
|
|
76
|
-
lucide-react/dist/esm/icons/triangle-exclamation-point.mjs:
|
|
77
|
-
lucide-react/dist/esm/icons/upload.mjs:
|
|
78
|
-
lucide-react/dist/esm/icons/user-minus.mjs:
|
|
79
|
-
lucide-react/dist/esm/icons/user-plus.mjs:
|
|
80
|
-
lucide-react/dist/esm/icons/user.mjs:
|
|
81
|
-
lucide-react/dist/esm/icons/users.mjs:
|
|
82
|
-
lucide-react/dist/esm/icons/volume-x.mjs:
|
|
83
|
-
lucide-react/dist/esm/icons/x.mjs:
|
|
84
|
-
lucide-react/dist/esm/lucide-react.mjs:
|
|
85
|
-
(**
|
|
86
|
-
* @license lucide-react v1.73.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*)
|
|
91
|
-
*/
|