import{c as z,r as i,j as e,F as E,i as X,f as k,g as Z,U as H,k as J,S as G}from"./index-HUEYA8gO.js";import{X as O}from"./x-CRpu2A8N.js";import{C as ee}from"./calendar-96DrS3w3.js";import{C as D}from"./circle-x-G-FxAdSE.js";import{C as R}from"./clock-DgYiYlPW.js";/**
 * @license lucide-react v0.545.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const se=[["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"}]],U=z("maximize-2",se);/**
 * @license lucide-react v0.545.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const te=[["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"}]],ae=z("triangle-alert",te);/**
 * @license lucide-react v0.545.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const le=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],P=z("zoom-in",le);/**
 * @license lucide-react v0.545.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const re=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],V=z("zoom-out",re);function ne({open:h,onClose:w,kyc:t,onApprove:o,onReject:y}){const[f,C]=i.useState({front:100,back:100}),[m,p]=i.useState(null);if(!h||!t)return null;const x=l=>{switch(l==null?void 0:l.toLowerCase()){case"approved":return"bg-green-500/10 border-green-500/30 text-green-400";case"pending":return"bg-yellow-500/10 border-yellow-500/30 text-yellow-400";case"rejected":return"bg-red-500/10 border-red-500/30 text-red-400";default:return"bg-slate-500/10 border-slate-500/30 text-slate-400"}},_=l=>{switch(l==null?void 0:l.toLowerCase()){case"approved":return e.jsx(k,{className:"w-4 h-4"});case"rejected":return e.jsx(D,{className:"w-4 h-4"});default:return e.jsx(R,{className:"w-4 h-4"})}},a=l=>{if(!l)return"N/A";try{return new Date(l).toLocaleString()}catch{return l}},b=l=>l?l.startsWith("http")||l.startsWith("/"):!1,N=l=>typeof l=="string"&&l.toLowerCase().endsWith(".pdf"),c=(l,S)=>{C($=>{const A=$[l],M=S==="in"?Math.min(A+25,200):Math.max(A-25,50);return{...$,[l]:M}})},d=t.fields||{},g=d["Front Document"]||t.document_front||"",u=d["Back Document"]||t.document_back||"",j=d.Selfie||t.selfie||"";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-slate-800 border border-slate-700 rounded-xl max-w-5xl w-full shadow-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"sticky top-0 bg-slate-800 flex items-center justify-between p-6 border-b border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(E,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"KYC Verification Details"}),e.jsx("p",{className:"text-sm text-slate-400",children:"Complete verification information"})]})]}),e.jsx("button",{onClick:w,className:"text-slate-400 hover:text-white transition-colors p-1",children:e.jsx(O,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(X,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-sm font-semibold text-slate-300",children:"User Information"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"User:"}),e.jsx("span",{className:"text-white font-medium",children:t.user||t.username||"N/A"})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Email:"}),e.jsx("span",{className:"text-white",children:d.Email||t.email||"N/A"})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"User ID:"}),e.jsxs("span",{className:"text-white font-mono",children:["#",t.user_id||"N/A"]})]})]})]}),e.jsxs("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ee,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-sm font-semibold text-slate-300",children:"Verification Status"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Status:"}),e.jsxs("div",{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full border text-xs font-medium ${x(t.status)}`,children:[_(t.status),e.jsx("span",{className:"capitalize",children:t.status||"Pending"})]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Submitted:"}),e.jsx("span",{className:"text-white font-mono text-xs",children:a(t.submitted||t.submitted_at)})]}),t.reviewed_at&&e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Reviewed:"}),e.jsx("span",{className:"text-white font-mono text-xs",children:a(t.reviewed_at)})]})]})]})]}),e.jsxs("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(E,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-sm font-semibold text-slate-300",children:"Document Information"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Document Type:"}),e.jsx("span",{className:"text-white font-medium capitalize",children:d["Document Type"]||t.document_type||"N/A"})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Document Number:"}),e.jsx("span",{className:"text-white font-mono",children:d["Document Number"]||t.document_number||"N/A"})]})]})]}),(b(g)||b(u)||b(j))&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-sm font-semibold text-slate-300",children:"Uploaded Documents"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[b(g)&&e.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Front Document"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>c("front","out"),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Zoom out",children:e.jsx(V,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c("front","in"),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Zoom in",children:e.jsx(P,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>p(g),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Fullscreen",children:e.jsx(U,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"overflow-auto max-h-96",children:N(g)?e.jsx("iframe",{src:g,className:"w-full h-80 rounded border border-slate-700",title:"Front Document"}):e.jsx("img",{src:g,alt:"Front Document",className:"w-full rounded border border-slate-700",style:{transform:`scale(${f.front/100})`,transformOrigin:"top left"}})}),e.jsx("a",{href:g,target:"_blank",rel:"noreferrer",className:"block mt-2 text-xs text-blue-400 hover:text-blue-300 underline",children:"Open in new tab"})]}),b(u)&&e.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Back Document"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>c("back","out"),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Zoom out",children:e.jsx(V,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c("back","in"),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Zoom in",children:e.jsx(P,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>p(u),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Fullscreen",children:e.jsx(U,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"overflow-auto max-h-96",children:N(u)?e.jsx("iframe",{src:u,className:"w-full h-80 rounded border border-slate-700",title:"Back Document"}):e.jsx("img",{src:u,alt:"Back Document",className:"w-full rounded border border-slate-700",style:{transform:`scale(${f.back/100})`,transformOrigin:"top left"}})}),e.jsx("a",{href:u,target:"_blank",rel:"noreferrer",className:"block mt-2 text-xs text-blue-400 hover:text-blue-300 underline",children:"Open in new tab"})]}),b(j)&&e.jsxs("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-slate-300",children:"Selfie Verification"}),e.jsx("button",{onClick:()=>p(j),className:"p-1 bg-slate-700 hover:bg-slate-600 rounded text-slate-300",title:"Fullscreen",children:e.jsx(U,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"overflow-auto max-h-96",children:e.jsx("img",{src:j,alt:"Selfie",className:"w-full rounded border border-slate-700"})}),e.jsx("a",{href:j,target:"_blank",rel:"noreferrer",className:"block mt-2 text-xs text-blue-400 hover:text-blue-300 underline",children:"Open in new tab"})]})]})]}),t.admin_notes&&e.jsxs("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4",children:[e.jsx("div",{className:"text-sm font-semibold text-slate-300 mb-2",children:"Admin Notes"}),e.jsx("p",{className:"text-sm text-slate-400",children:t.admin_notes})]})]}),t.status==="pending"&&o&&y&&e.jsxs("div",{className:"sticky bottom-0 bg-slate-800 flex items-center justify-end gap-3 p-6 border-t border-slate-700",children:[e.jsxs("button",{onClick:()=>y(t),className:"flex items-center gap-2 px-6 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg font-medium transition-colors",children:[e.jsx(D,{className:"w-4 h-4"}),"Reject"]}),e.jsxs("button",{onClick:()=>o(t),className:"flex items-center gap-2 px-6 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg font-medium transition-colors",children:[e.jsx(k,{className:"w-4 h-4"}),"Approve"]})]})]})}),m&&e.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-[60] p-4",onClick:()=>p(null),children:[e.jsx("button",{onClick:()=>p(null),className:"absolute top-4 right-4 p-2 bg-slate-800 hover:bg-slate-700 rounded-lg text-white",children:e.jsx(O,{className:"w-6 h-6"})}),e.jsx("img",{src:m,alt:"Fullscreen Document",className:"max-w-full max-h-full object-contain",onClick:l=>l.stopPropagation()})]})]})}function ie({open:h,onClose:w,onSubmit:t,kyc:o,action:y}){const[f,C]=i.useState(""),[m,p]=i.useState(""),[x,_]=i.useState(!1);if(!h||!o)return null;const a=y==="reject",b=["Blurry or unclear document images","Document expired or invalid","Name mismatch with account details","Document appears to be tampered","Selfie does not match document photo","Incomplete information provided","Suspected fraudulent document","Other (specify in notes)"],N=async c=>{if(c.preventDefault(),a&&!m){alert("Please select a rejection reason");return}_(!0);try{await t(o.id,y,a?m:f),w()}catch(d){console.error("KYC action failed:",d)}finally{_(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("form",{onSubmit:N,className:"bg-slate-800 border border-slate-700 rounded-xl max-w-lg w-full shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${a?"bg-red-500/10":"bg-green-500/10"}`,children:a?e.jsx(D,{className:"w-5 h-5 text-red-400"}):e.jsx(k,{className:"w-5 h-5 text-green-400"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-bold text-white",children:[a?"Reject":"Approve"," KYC Verification"]}),e.jsx("p",{className:"text-sm text-slate-400",children:o.user||o.username||`User #${o.user_id}`})]})]}),e.jsx("button",{type:"button",onClick:w,className:"text-slate-400 hover:text-white transition-colors p-1",disabled:x,children:e.jsx(O,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"User:"}),e.jsx("span",{className:"text-white font-medium",children:o.user||o.username||"N/A"})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Document Type:"}),e.jsx("span",{className:"text-white capitalize",children:o.document_type||"N/A"})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Document Number:"}),e.jsx("span",{className:"text-white font-mono",children:o.document_number||"N/A"})]})]}),a&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:["Rejection Reason ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsxs("select",{value:m,onChange:c=>p(c.target.value),className:"w-full px-4 py-2 bg-slate-900 border border-slate-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-red-500",required:!0,disabled:x,children:[e.jsx("option",{value:"",children:"Select a reason..."}),b.map((c,d)=>e.jsx("option",{value:c,children:c},d))]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:[a?"Additional Notes":"Admin Notes"," ",a&&"(Optional)"]}),e.jsx("textarea",{value:f,onChange:c=>C(c.target.value),placeholder:a?"Add any additional information for the user...":"Add any notes about this verification...",rows:3,className:"w-full px-4 py-2 bg-slate-900 border border-slate-700 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",disabled:x})]}),e.jsxs("div",{className:`${a?"bg-red-500/10 border-red-500/30":"bg-green-500/10 border-green-500/30"} border rounded-lg p-3 flex items-start gap-2`,children:[e.jsx(ae,{className:`w-5 h-5 flex-shrink-0 mt-0.5 ${a?"text-red-400":"text-green-400"}`}),e.jsx("div",{className:`text-xs ${a?"text-red-400":"text-green-400"}`,children:a?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"Warning:"})," The user will be notified of the rejection and may need to resubmit their documents. This action cannot be undone."]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"Confirm:"})," This will mark the user as verified and grant them full access to all platform features. Make sure all documents are legitimate."]})})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-slate-700",children:[e.jsx("button",{type:"button",onClick:w,disabled:x,className:"px-4 py-2 bg-slate-700 hover:bg-slate-600 disabled:bg-slate-700/50 text-white rounded-lg font-medium transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:x||a&&!m,className:`flex items-center gap-2 px-6 py-2 rounded-lg font-medium transition-colors ${a?"bg-red-600 hover:bg-red-700 disabled:bg-red-600/50":"bg-green-600 hover:bg-green-700 disabled:bg-green-600/50"} text-white disabled:cursor-not-allowed`,children:[a?e.jsx(D,{className:"w-4 h-4"}):e.jsx(k,{className:"w-4 h-4"}),x?"Processing...":a?"Reject KYC":"Approve KYC"]})]})]})})}function ue(){const[h,w]=i.useState([]),[t,o]=i.useState([]),[y,f]=i.useState(!0),[C,m]=i.useState(null),[p,x]=i.useState(""),[_,a]=i.useState(!1),[b,N]=i.useState(!1),[c,d]=i.useState(null),[g,u]=i.useState(null),[j,l]=i.useState("all"),[S,$]=i.useState("");i.useEffect(()=>{A()},[]),i.useEffect(()=>{M()},[h,j,S]);const A=async()=>{f(!0),m(null);try{const s=await fetch(Z("/get_kyc.php"),{credentials:"include"});if(!s.ok)throw new Error("Failed to fetch KYC");const n=await s.json();if(n.success){const v=(n.kyc||[]).map(r=>({id:r.id,user_id:r.user_id,username:r.username||"",email:r.email||"",user:r.username?`@${r.username}`:r.email||`User #${r.user_id}`,status:r.status||"pending",document_type:r.document_type||"",document_number:r.document_number||"",document_front:r.document_front||"",document_back:r.document_back||"",selfie:r.selfie||"",submitted_at:r.submitted_at||"",reviewed_at:r.reviewed_at||"",admin_notes:r.admin_notes||""}));w(v)}else throw new Error(n.message||"Failed to load KYC")}catch(s){m(s.message)}finally{f(!1)}},M=()=>{let s=[...h];if(j!=="all"&&(s=s.filter(n=>n.status===j)),S){const n=S.toLowerCase();s=s.filter(v=>{var r,K,Y,L;return((r=v.username)==null?void 0:r.toLowerCase().includes(n))||((K=v.email)==null?void 0:K.toLowerCase().includes(n))||((Y=v.user_id)==null?void 0:Y.toString().includes(n))||((L=v.document_number)==null?void 0:L.toLowerCase().includes(n))})}o(s)},B=s=>{d(s),a(!0)},T=s=>{d(s),u("approve"),a(!1),N(!0)},I=s=>{d(s),u("reject"),a(!1),N(!0)},q=async(s,n,v)=>{try{const r=n==="approve"?"/approve_kyc.php":"/reject_kyc.php",K={id:s};n==="reject"&&(K.reason=v);const L=await(await fetch(Z(r),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)})).json();if(L.success)x(`KYC ${n==="approve"?"approved":"rejected"} successfully`),A(),setTimeout(()=>x(""),3e3);else throw new Error(L.message||`Failed to ${n} KYC`)}catch(r){throw m(r.message),setTimeout(()=>m(null),3e3),r}},W=s=>{switch(s==null?void 0:s.toLowerCase()){case"approved":return"bg-green-500/10 border-green-500/30 text-green-400";case"pending":return"bg-yellow-500/10 border-yellow-500/30 text-yellow-400";case"rejected":return"bg-red-500/10 border-red-500/30 text-red-400";default:return"bg-slate-500/10 border-slate-500/30 text-slate-400"}},Q=s=>{switch(s==null?void 0:s.toLowerCase()){case"approved":return e.jsx(k,{className:"w-4 h-4"});case"rejected":return e.jsx(D,{className:"w-4 h-4"});default:return e.jsx(R,{className:"w-4 h-4"})}},F={all:h.length,pending:h.filter(s=>s.status==="pending").length,approved:h.filter(s=>s.status==="approved").length,rejected:h.filter(s=>s.status==="rejected").length};return e.jsxs("div",{className:"py-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:"KYC Verification"}),e.jsx("p",{className:"text-slate-400",children:"Review and manage user identity verifications"})]}),C&&e.jsxs("div",{className:"p-4 bg-red-500/10 border border-red-500/30 rounded-xl flex items-center justify-between",children:[e.jsx("p",{className:"text-red-400 text-sm",children:C}),e.jsx("button",{onClick:()=>m(null),className:"text-red-400 hover:text-red-300 text-sm font-medium",children:"Dismiss"})]}),p&&e.jsxs("div",{className:"p-4 bg-green-500/10 border border-green-500/30 rounded-xl flex items-center justify-between",children:[e.jsx("p",{className:"text-green-400 text-sm font-medium",children:p}),e.jsx("button",{onClick:()=>x(""),className:"text-green-400 hover:text-green-300 text-sm font-medium",children:"Dismiss"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(H,{className:"w-4 h-4 text-blue-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Total"})]}),e.jsx("div",{className:"text-2xl font-bold text-white",children:F.all})]}),e.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(R,{className:"w-4 h-4 text-yellow-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Pending"})]}),e.jsx("div",{className:"text-2xl font-bold text-yellow-400",children:F.pending})]}),e.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(k,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Approved"})]}),e.jsx("div",{className:"text-2xl font-bold text-green-400",children:F.approved})]}),e.jsxs("div",{className:"bg-slate-800/50 border border-slate-700 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(D,{className:"w-4 h-4 text-red-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"Rejected"})]}),e.jsx("div",{className:"text-2xl font-bold text-red-400",children:F.rejected})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:["all","pending","approved","rejected"].map(s=>e.jsxs("button",{onClick:()=>l(s),className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors capitalize ${j===s?"bg-blue-600 text-white":"bg-slate-700 text-slate-300 hover:bg-slate-600"}`,children:[s," (",F[s],")"]},s))}),e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(J,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Search users...",value:S,onChange:s=>$(s.target.value),className:"w-full pl-10 pr-4 py-2 bg-slate-900 border border-slate-700 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),e.jsx(ne,{open:_,onClose:()=>{a(!1),d(null)},kyc:c,onApprove:T,onReject:I}),e.jsx(ie,{open:b,onClose:()=>{N(!1),d(null),u(null)},onSubmit:q,kyc:c,action:g}),y?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500"})}):t.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(G,{className:"w-12 h-12 text-slate-600 mx-auto mb-3"}),e.jsx("p",{className:"text-slate-400",children:"No KYC submissions found"})]}):e.jsx("div",{className:"bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-slate-900/50",children:e.jsxs("tr",{className:"border-b border-slate-700",children:[e.jsx("th",{className:"py-3 px-4 text-left text-sm font-semibold text-slate-300",children:"User"}),e.jsx("th",{className:"py-3 px-4 text-left text-sm font-semibold text-slate-300",children:"Document Type"}),e.jsx("th",{className:"py-3 px-4 text-center text-sm font-semibold text-slate-300",children:"Status"}),e.jsx("th",{className:"py-3 px-4 text-left text-sm font-semibold text-slate-300",children:"Submitted"}),e.jsx("th",{className:"py-3 px-4 text-center text-sm font-semibold text-slate-300",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-700/50",children:t.map(s=>{var n;return e.jsxs("tr",{className:"hover:bg-slate-700/20 transition-colors",children:[e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-500/10 flex items-center justify-center",children:e.jsx("span",{className:"text-blue-400 font-bold text-sm",children:((n=s.username)==null?void 0:n.charAt(0).toUpperCase())||"U"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-medium",children:s.user}),e.jsx("div",{className:"text-xs text-slate-400",children:s.email})]})]})}),e.jsx("td",{className:"py-3 px-4",children:e.jsx("span",{className:"text-slate-300 capitalize",children:s.document_type||"N/A"})}),e.jsx("td",{className:"py-3 px-4 text-center",children:e.jsxs("div",{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full border text-xs font-medium capitalize ${W(s.status)}`,children:[Q(s.status),e.jsx("span",{children:s.status})]})}),e.jsx("td",{className:"py-3 px-4",children:e.jsx("span",{className:"text-slate-300 text-sm font-mono",children:s.submitted_at?new Date(s.submitted_at).toLocaleDateString():"N/A"})}),e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("button",{onClick:()=>B(s),className:"px-3 py-1.5 bg-slate-700 hover:bg-slate-600 text-white rounded-lg text-xs font-medium transition-colors",children:"View"}),s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>T(s),className:"px-3 py-1.5 bg-green-600 hover:bg-green-700 text-white rounded-lg text-xs font-medium transition-colors",children:"Approve"}),e.jsx("button",{onClick:()=>I(s),className:"px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white rounded-lg text-xs font-medium transition-colors",children:"Reject"})]})]})})]},s.id)})})]})})})]})}export{ue as default};
