import{c as vt,f as Na,j as e,C as Cr,r as l,u as Jo,R as me,A as Y,y as z,S as xr,h as Ot,d as Si,b as An,L as Sc,T as Sa,i as Ca,e as df,k as Qo,l as Bv,m as Hv,n as Wv}from"./index-XAQEFxR0.js";import{S as Pn,C as Za,a as ao,B as Uv,L as uf,P as Vv,T as Gv,_ as et,b as Kv,c as mf,d as he,e as qv,f as Xv,g as Yv}from"./slicedToArray-CIunP2G7.js";import{E as cs}from"./eye-DfpkT4YW.js";import{P as Zs}from"./play-BOJBiIfL.js";import{A as ds}from"./arrow-right-BBWeihko.js";import{C as eu}from"./chevron-down-Aw6gVMVv.js";import{C as Pr}from"./chevron-right-3LV85XzN.js";import{C as Or}from"./circle-check-big-CKA5EG0X.js";import{U as Jv,T as na}from"./user-CG273jvt.js";import{M as no}from"./index-CAq7-Zc8.js";import{F as tu}from"./funnel-yF5iC01W.js";import{X as oa}from"./x-BjlbuifP.js";import{A as Er}from"./activity-DJNZk-yp.js";import{L as Cc}from"./layers-CN650O4u.js";import Qv from"./TopNav-Bk5GTdNw.js";import{l as xf}from"./index-BMNdcWOJ.js";import{P as kt,M as Zv,S as jm,W as ey}from"./index-Rrq4Fsy1.js";import ty from"./Pricing-BqDRFX5X.js";import{C as _c}from"./circle-check-BRk-jZt-.js";import{U as At}from"./users-BLwJpXZu.js";import{m as jt}from"./proxy-C_GZZbVv.js";import{S as ru}from"./shield-check-VTTWBFxc.js";import{S as hf}from"./star-DOmKOXKc.js";import{A as ya}from"./award-C8G88Zaq.js";import{c as zt,a as ff,s as sn,i as nt,u as au,r as hr,b as Ps,S as ry,d as ay,g as gf,e as ny,f as sy,h as iy,t as oy,j as ly,k as cy,l as xt,m as dy,n as uy,o as my,p as pf,q as bf,v as ka,w as xy,x as wm,y as $s,z as hy,A as yo,B as Zo,C as fy,D as Br,E as Ba,F as Ci,G as vf,J as _i,H as Et,I as Ft,K as Yn,L as mr,M as Ta,N as Ma,R as Nm,O as yf,P as gy,Q as py,T as us,U as by,V as jf,W as wf,X as $n,Z as ca,Y as zr,_ as vy,$ as yy,a0 as jy,a1 as wy,a2 as Ny,a3 as Sy,a4 as Cy,a5 as _y,a6 as ky,a7 as Py,a8 as $y,a9 as Ey,aa as Ay,ab as Oy,ac as Iy,ad as Ty,ae as Ut,af as My,ag as Ry,ah as Ly,ai as nu,aj as Nr,ak as ja,al as Es,am as Nf,an as Dy,ao as zy,ap as Fy,aq as By,ar as Hy,as as su,at as Wy,au as iu,av as Uy,aw as ou,ax as lu,ay as Vy,az as cu,aA as Sf,aB as Gy,aC as Ky,aD as qy,aE as du,aF as Xy,aG as Yy,aH as Cf,aI as _f,aJ as Vl,aK as Jy,aL as Qy,aM as On,aN as Sm,aO as Cm,aP as _m,aQ as kf,aR as Pf,aS as Zy,aT as ej,aU as lr,aV as cr,aW as $f,aX as Ef,aY as Wa,aZ as on,a_ as ln,a$ as Af,b0 as tj,b1 as kc,b2 as Of,b3 as uu,b4 as mu,b5 as If,b6 as Tf,b7 as Mf,b8 as rj,b9 as km,ba as Pm,bb as aj,bc as Rf,bd as Lf,be as nj,bf as xu,bg as Df,bh as sj,bi as ij,bj as oj,bk as $m,bl as lj,bm as cj,bn as Em,bo as dj,bp as uj,bq as mj,br as zf,bs as xj,bt as hj,bu as fj,bv as gj,bw as pj,bx as bj,by as vj,bz as yj,bA as jj,bB as wj,bC as Nj,bD as Sj,bE as Cj,bF as _j,bG as kj,bH as Pj,bI as hu,bJ as $j,bK as Ej,bL as Ra,bM as fu,bN as gu,bO as pu,bP as bu,bQ as Aj}from"./RadarChart-DpMY-pSW.js";import{T as Mt}from"./target-DtlTPIrP.js";import{Z as kr}from"./zap-CJLpCXio.js";import{C as Oj}from"./cpu-DcQERwFD.js";import{S as Jt}from"./search-BAkj-wLk.js";import{M as si,F as Am}from"./FeedbackWidget-BGBEx1v8.js";import{L as Ij}from"./Footer-BWuDGipe.js";import{M as Qr}from"./mail-C4YbZpAk.js";import{M as ii}from"./monitor-Bka8pfvD.js";import{C as va}from"./clock-wl9u5f-e.js";import{S as ei}from"./send-gqAzuMSb.js";import{E as Tj}from"./external-link-Cdm4wqGT.js";import{D as ti}from"./download-B5hOBf36.js";import{C as jo}from"./credit-card-ie_FY1E5.js";import{C as Ff}from"./crosshair-B6tIAVGJ.js";import{F as dr}from"./file-text-YXpqYYkL.js";import{M as Mj}from"./message-circle-sK0VQMfQ.js";import{F as Rj}from"./flag-BgklqkJE.js";import{T as vu}from"./trophy-Cnk5jCR7.js";import{S as ki}from"./settings-B7kmtFXD.js";import{U as Pc}from"./user-plus-6XWgborx.js";import{G as ms}from"./globe-ggO-5B8t.js";import{S as el}from"./server-BpOvYAHH.js";import{T as ba,A as Lj}from"./Academy-DDVdxhJz.js";import{C as Dj}from"./crown-BMB7bvmv.js";import{C as xs}from"./circle-alert-BtS5bUWs.js";import{D as Bf}from"./database-DSq8s2r7.js";import{L as Oa}from"./lock-riYib5_N.js";import{C as Hf}from"./circle-play-DhVb0oGf.js";import{H as Wf}from"./history-BQD_XZIQ.js";import{L as Om}from"./Leaderboard-CUAQ4WGM.js";import{U as Im}from"./UpgradeModal-DRinS_jD.js";import{T as wo}from"./terminal-quH4CBjU.js";import{C as $c}from"./calendar-BvkO_kGD.js";import{B as as}from"./building-2-fwZU0vkp.js";import{B as Cn}from"./book-open-YNf-MZ7G.js";import{I as Uf}from"./info-Cc_BztP1.js";import{C as Ec}from"./chevron-left-AiuWqI8X.js";import{T as zj}from"./tag-DGS3-p3A.js";import{L as Tm}from"./loader-circle-Dgmm4WPV.js";import{C as Fj}from"./cloud-BibSA1ua.js";import{C as Bj}from"./chart-column-Ik67cFO7.js";import{C as Gl,H as Hj,a as Wj}from"./hash-BTvn9URF.js";import{_ as G,t as Uj,a as In}from"./asyncToGenerator-B8GBtsZp.js";import{c as Vj}from"./ctfScenarios-Dp4jM3hH.js";import"./PublicNav-BtOZ2-Xr.js";import"./CyberBackground-D4ChG426.js";import"./Particles-BRxp5v1w.js";import"./SEO-BWgzAOui.js";import"./SchemaMarkup-s2pJpehO.js";/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gj=[["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"}]],Kj=vt("archive",Gj);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qj=[["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"}]],Xj=vt("at-sign",qj);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yj=[["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"}]],Jj=vt("bell",Yj);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qj=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Mm=vt("brain",Qj);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zj=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],Rm=vt("bug",Zj);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const e1=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],tl=vt("chart-no-axes-column",e1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],r1=vt("circle-plus",t1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a1=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],n1=vt("command",a1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],i1=vt("dollar-sign",s1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o1=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z",key:"1iv0i2"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],l1=vt("factory",o1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c1=[["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"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],d1=vt("file-search",c1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const u1=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],Lm=vt("gift",u1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const m1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],x1=vt("github",m1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const h1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],f1=vt("laptop",h1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const g1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],yu=vt("layout-dashboard",g1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const p1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],b1=vt("lock-open",p1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const v1=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],y1=vt("map",v1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const j1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],w1=vt("menu",j1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N1=[["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"}]],S1=vt("pencil",N1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const C1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],oi=vt("plus",C1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _1=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],k1=vt("printer",_1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const P1=[["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"}]],Jr=vt("refresh-cw",P1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],As=vt("save",$1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E1=[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]],A1=vt("siren",E1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const O1=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Jn=vt("smartphone",O1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const I1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],yr=vt("sparkles",I1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T1=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Dm=vt("square-check-big",T1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ju=vt("square-pen",M1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R1=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],Ac=vt("swords",R1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const L1=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],D1=vt("trending-down",L1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const z1=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],F1=vt("twitter",z1);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B1=[["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"}]],Vf=vt("upload",B1),H1=({isOpen:t,onClose:r,onConfirm:a,alertId:n,alertTitle:s})=>t?Na.createPortal(e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-fadeIn",children:e.jsxs("div",{className:"bg-[#111217] border border-gray-800 rounded-2xl w-full max-w-md shadow-2xl transform transition-all scale-100 p-8 flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full border-4 border-[#344b3e] flex items-center justify-center mb-6",children:e.jsx(Cr,{className:"w-10 h-10 text-[#4ade80]"})}),e.jsxs("h3",{className:"text-2xl font-bold text-white mb-8",children:["Take ownership Alert #",n&&n.toString().substring(0,8)]}),e.jsxs("div",{className:"flex items-center gap-3 w-full justify-center",children:[e.jsx("button",{onClick:()=>{a(),r()},className:"px-6 py-3 rounded-lg bg-[#5356ff] hover:bg-[#4346e0] text-white font-bold shadow-[0_4px_14px_0_rgba(83,86,255,0.39)] transition-all active:scale-95",children:"Yes, I'm sure!"}),e.jsx("button",{onClick:r,className:"px-6 py-3 rounded-lg bg-[#ef4444] hover:bg-[#dc2626] text-white font-bold shadow-[0_4px_14px_0_rgba(239,68,68,0.39)] transition-all active:scale-95",children:"Cancel"})]})]})}),document.body):null,ta=({alerts:t,viewMode:r,onAssign:a,onUnassign:n,onSubmitSummary:s,onGradeInvestigation:i,userId:o,userRole:c,onRefresh:d,compact:m,onAlertClick:u,initialExpandedId:x,onNavigate:h,onReset:f,onResubmit:g})=>{const[b,p]=l.useState(null),[v,y]=l.useState({artifacts:[]}),[j,S]=l.useState({grade:"",feedback:""}),N=Jo(),[w,_]=l.useState(null),[P,O]=l.useState({title:"",severity:"",source:"",details:"",raw_log:"",sector_code:""}),[T,k]=l.useState({}),[$,C]=l.useState(!1),[A,E]=l.useState(null),[L,F]=l.useState(!1),[D,q]=l.useState(null),[Q,de]=l.useState(!1),[H,se]=l.useState(null);l.useEffect(()=>{x&&p(x)},[x]),l.useEffect(()=>{if(b&&r==="mine"){const I=t.find(R=>R.id===b);I&&I.executive_summary&&Object.keys(I.executive_summary).length>0?y(I.executive_summary):y({artifacts:[{type:"IP",value:"",osint_link:"",score:""}]})}if(b&&r==="admin-review"){const I=t.find(R=>R.id===b);S({grade:(I==null?void 0:I.grade)!==void 0&&(I==null?void 0:I.grade)!==null?I.grade.toString():"",feedback:(I==null?void 0:I.feedback)||""})}b||_(null)},[b,r,t]);const W=I=>{navigator.clipboard.writeText(I),z.success("Raw log copied to clipboard!")},le=I=>{_(I.id);const R=typeof I.raw_log=="string"?I.raw_log:JSON.stringify(I.raw_log,null,2);O({title:I.title||I.alert_title||"",severity:I.severity||"Medium",source:I.source||"Manual",details:I.details||I.description||"",raw_log:R,sector_code:I.sector_code||""})},U=()=>{_(null)},ee=async I=>{try{const R=localStorage.getItem("token"),je=await fetch(`${Y}/api/alerts/${I}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`},body:JSON.stringify(P)});if(je.ok)z.success("Alert updated successfully"),_(null),d&&d();else{const Te=await je.json();z.error(Te.message||"Failed to update alert")}}catch(R){console.error(R),z.error("Error updating alert")}},ae=I=>{p(b===I?null:I)},ue=I=>{i(I,parseInt(j.grade),j.feedback)},fe=I=>{E(I),C(!0)},re=async()=>{if(A)try{const I=localStorage.getItem("token"),R=await fetch(`${Y}/api/alerts/${A}`,{method:"DELETE",headers:{Authorization:`Bearer ${I}`}});if(R.ok)z.success("Alert deleted successfully"),d&&d();else{const je=await R.json();z.error(je.message||"Failed to delete alert")}}catch(I){console.error(I),z.error("Error deleting alert")}},V=I=>{q(I),F(!0)},ce=()=>{D&&n&&n(D),F(!1)},Z=I=>{se(I),de(!0)},xe=()=>{H&&a&&a(H.id)},pe=I=>{switch(I==null?void 0:I.toLowerCase()){case"critical":return"text-red-500";case"high":return"text-red-500";case"medium":return"text-yellow-500";case"low":return"text-green-500";default:return"text-gray-500"}},[Se,ke]=l.useState(null),[$e,K]=l.useState(""),ie=async()=>{if(!$e.trim()){z.error("Please provide a reason for the report.");return}try{const I=localStorage.getItem("token"),R=await fetch(`${Y}/api/alerts/investigation/${Se}/report`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`},body:JSON.stringify({reason:$e})});if(R.ok)z.success("Report submitted successfully. An admin will review it shortly."),ke(null),K(""),d&&d();else{const je=await R.json();z.error(je.message||"Failed to submit report")}}catch(I){console.error("Report error:",I),z.error("An error occurred while submitting the report.")}};return Array.isArray(t)?m?e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"divide-y divide-gray-800",children:t.length===0?e.jsx("div",{className:"p-4 text-center text-gray-500 text-xs",children:"No recent alerts."}):(Array.isArray(t)?t:[]).map(I=>e.jsxs(me.Fragment,{children:[e.jsxs("div",{className:`grid grid-cols-12 gap-2 px-4 py-3 hover:bg-gray-800/30 transition-colors items-center cursor-pointer ${b===I.id?"bg-gray-800/20":""}`,onClick:()=>{h?(h(I.id,"alerts_page"),I.investigation_status==="graded"?h(I.id,"closed"):I.assigned_to_id===o?h(I.id,"mine"):h(I.id,"alerts_page")):u?u(I.id):ae(I.id)},children:[e.jsx("div",{className:`col-span-2 font-bold text-xs ${pe(I.severity)}`,children:I.severity?I.severity.substring(0,3).toUpperCase():"UNK"}),e.jsxs("div",{className:"col-span-10",children:[e.jsx("div",{className:"text-sm font-medium text-white truncate",children:I.title||I.alert_title}),e.jsxs("div",{className:"text-xs text-gray-500 flex justify-between mt-1",children:[e.jsx("span",{children:new Date(I.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),e.jsx("span",{children:I.source})]})]})]}),b===I.id&&e.jsxs("div",{className:"px-4 py-3 bg-[#131416] border-b border-gray-800/50",children:[e.jsx("div",{className:"text-xs text-gray-300 font-mono mb-3 whitespace-pre-wrap line-clamp-4",children:I.details||I.description}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-gray-500",children:I.investigation_count>0?`${I.investigation_count} Investigating`:"Unassigned"}),I.investigation_status==="graded"||I.investigation_status==="submitted"?e.jsxs("button",{onClick:R=>{R.stopPropagation(),N(`/alerts/${I.id}`)},className:"text-xs bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded-lg font-bold transition flex items-center gap-2",children:[e.jsx(cs,{className:"w-4 h-4"}),"View Alerts"]}):I.assigned_to_id===o||I.investigations&&I.investigations.some(R=>R.user_id===o)?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:R=>{R.stopPropagation(),N(`/alerts/${I.id}`)},className:"text-xs bg-infosec-accent hover:bg-infosec-accentHover text-black px-4 py-2 rounded-lg font-bold transition flex items-center gap-2 shadow-lg shadow-infosec-accent/20",children:[e.jsx(Zs,{className:"w-4 h-4 fill-current"}),"Start"]}),e.jsx("button",{onClick:R=>{R.stopPropagation(),V(I.id)},className:`text-xs bg-red-900/50 hover:bg-red-900 text-red-300 px-3 py-2 rounded-lg font-bold transition ${I.investigation_status==="submitted"||I.investigation_status==="graded"?"hidden":""}`,children:"Unassign"})]}):I.assigned_to_id?e.jsx("span",{className:"text-xs text-gray-500 font-bold uppercase tracking-wider px-3 py-2 border border-gray-800 rounded-lg bg-gray-900/50",children:"Assigned"}):e.jsxs("button",{onClick:R=>{R.stopPropagation(),Z(I)},className:"text-xs bg-blue-600 hover:bg-blue-500 text-white px-4 py-2 rounded-lg font-bold transition flex items-center gap-2",children:["Assign",e.jsx(ds,{className:"w-4 h-4"})]})]})]})]},I.id))})}):e.jsxs("div",{className:"w-full bg-[#0e0f11] border border-gray-800 rounded-xl overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-12 gap-4 px-6 py-4 border-b border-gray-800 bg-[#131416]/50 text-xs font-bold text-gray-500 uppercase tracking-wider backdrop-blur-sm",children:[e.jsx("div",{className:"col-span-1 text-center",children:"#"}),e.jsx("div",{className:"col-span-1",children:"Level"}),e.jsx("div",{className:"col-span-1",children:"Path"}),e.jsx("div",{className:"col-span-1",children:"Industry"}),e.jsx("div",{className:"col-span-2",children:"Severity"}),e.jsx("div",{className:"col-span-3",children:"Alert Title"}),e.jsx("div",{className:"col-span-1",children:"Status"}),e.jsx("div",{className:"col-span-2 text-right",children:"Action"})]}),e.jsx("div",{className:"divide-y divide-gray-800/50",children:t.length===0?e.jsxs("div",{className:"p-12 text-center flex flex-col items-center justify-center text-gray-500",children:[e.jsx("div",{className:"p-4 bg-gray-800/30 rounded-full mb-3",children:e.jsx(Pn,{className:"w-8 h-8 text-gray-600"})}),e.jsx("p",{className:"text-sm",children:"No alerts found matching your criteria."})]}):(Array.isArray(t)?t:[]).map(I=>e.jsxs("div",{className:"group bg-[#0e0f11] hover:bg-[#131416] transition-all duration-200",children:[e.jsxs("div",{className:`grid grid-cols-12 gap-4 px-6 py-4 items-center cursor-pointer transition border-l-2 border-transparent hover:border-infosec-accent ${b===I.id?"bg-[#131416] border-l-infosec-accent":""}`,onClick:()=>ae(I.id),children:[e.jsx("div",{className:"col-span-1 flex justify-center text-gray-600 group-hover:text-infosec-accent transition-colors",children:b===I.id?e.jsx(eu,{className:"w-4 h-4"}):e.jsx(Pr,{className:"w-4 h-4"})}),e.jsx("div",{className:"col-span-1 flex items-center",children:e.jsx("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider border ${(I.difficulty||"intermediate").toLowerCase()==="novice"||(I.difficulty||"intermediate").toLowerCase()==="beginner"?"bg-green-500/10 text-green-400 border-green-500/20":(I.difficulty||"intermediate").toLowerCase()==="advanced"?"bg-red-500/10 text-red-400 border-red-500/20":(I.difficulty||"intermediate").toLowerCase()==="expert"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:I.difficulty||"INT"})}),e.jsx("div",{className:"col-span-1 flex items-center",children:e.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider border ${I.path_code==="SIEM"?"bg-blue-500/10 text-blue-400 border-blue-500/20":I.path_code==="EDR"?"bg-purple-500/10 text-purple-400 border-purple-500/20":I.path_code==="NDR"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":I.path_code==="TI"?"bg-orange-500/10 text-orange-400 border-orange-500/20":I.path_code==="IR"?"bg-red-500/10 text-red-400 border-red-500/20":I.path_code==="CLOUD"?"bg-sky-500/10 text-sky-400 border-sky-500/20":"bg-gray-500/10 text-gray-400 border-gray-500/20"}`,children:I.path_code||"CORE"})}),e.jsx("div",{className:"col-span-1 flex items-center",children:e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",title:I.sector_code||"Unknown Industry",children:[e.jsx(l1,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider truncate max-w-[60px]",children:I.sector_code?I.sector_code.substring(0,8):"--"})]})}),e.jsx("div",{className:"col-span-2 flex items-center",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${(I.severity||"").toLowerCase()==="critical"?"bg-fuchsia-500 shadow-[0_0_8px_rgba(217,70,239,0.5)]":(I.severity||"").toLowerCase()==="high"?"bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.5)]":(I.severity||"").toLowerCase()==="medium"?"bg-orange-500":"bg-blue-500"}`}),e.jsx("span",{className:`text-xs font-semibold ${(I.severity||"").toLowerCase()==="critical"?"text-fuchsia-400":(I.severity||"").toLowerCase()==="high"?"text-red-400":(I.severity||"").toLowerCase()==="medium"?"text-orange-400":"text-blue-400"}`,children:I.severity})]})}),e.jsxs("div",{className:"col-span-3",children:[e.jsx("div",{className:"text-sm text-gray-200 font-medium truncate group-hover:text-white transition-colors pr-4",children:I.title||I.alert_title}),e.jsxs("div",{className:"text-[10px] text-gray-500 mt-1 uppercase tracking-wider font-bold",children:[I.source||"Unknown Source",I.mitre_technique&&e.jsx("span",{className:"ml-2 inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-bold border bg-gray-800 text-gray-400 border-gray-700",title:"MITRE ATT&CK Technique",children:I.mitre_technique})]})]}),e.jsxs("div",{className:"col-span-1",children:[r==="all"&&e.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold border ${I.investigation_status==="graded"?"bg-green-500/10 text-green-400 border-green-500/20":I.assigned_to_id?"bg-purple-500/10 text-purple-400 border-purple-500/20":"bg-gray-800 text-gray-400 border-gray-700"}`,children:[I.investigation_status==="graded"?e.jsx(Or,{className:"w-3 h-3"}):I.assigned_to_id?e.jsx(Jv,{className:"w-3 h-3"}):e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),I.investigation_status==="graded"?"Done":I.assigned_to_id?"Active":"Open"]}),r!=="all"&&e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium border ${I.investigation_status==="graded"?"bg-green-500/10 text-green-400 border-green-500/20":I.investigation_status==="submitted"?"bg-blue-500/10 text-blue-400 border-blue-500/20":"bg-yellow-500/10 text-yellow-400 border-yellow-500/20"}`,children:I.investigation_status==="graded"?"Graded":I.investigation_status==="submitted"?"Pending":"In Progress"})]}),e.jsxs("div",{className:"col-span-2 text-right",children:[c==="admin"||c==="alert-admin"?e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:R=>{R.stopPropagation(),le(I)},className:"p-1.5 bg-blue-600/20 hover:bg-blue-600 text-blue-400 hover:text-white rounded border border-blue-600/30 transition group/edit",title:"Edit Alert",children:e.jsx(S1,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:R=>{R.stopPropagation(),fe(I.id)},className:"p-1.5 bg-red-600/20 hover:bg-red-600 text-red-400 hover:text-white rounded border border-red-600/30 transition group/delete",title:"Delete Alert",children:e.jsx(na,{className:"w-3.5 h-3.5"})})]}):e.jsxs(e.Fragment,{children:[r==="all"&&e.jsx("div",{className:"flex justify-end",children:I.investigation_status==="graded"||I.investigation_status==="submitted"?e.jsxs("button",{onClick:R=>{R.stopPropagation(),h?h(I.id,I.investigation_status==="graded"?"closed":"mine"):N(`/alerts/${I.id}`)},className:"group/btn flex items-center gap-1.5 bg-gray-800 hover:bg-gray-700 text-gray-300 hover:text-white px-3 py-1.5 rounded-lg text-xs font-bold transition-all border border-gray-700",children:[e.jsx(cs,{className:"w-3 h-3"}),"View"]}):I.assigned_to_id===o?e.jsxs("button",{onClick:R=>{R.stopPropagation(),N(`/alerts/${I.id}`)},className:"flex items-center gap-1.5 bg-infosec-accent text-black hover:bg-white px-4 py-1.5 rounded-lg text-xs font-bold transition-all transform hover:scale-105 shadow-[0_0_15px_rgba(255,255,255,0.1)] hover:shadow-[0_0_20px_rgba(255,255,255,0.3)]",children:[e.jsx(Zs,{className:"w-3 h-3 fill-current"}),"Start"]}):I.assigned_to_id?e.jsx("span",{className:"text-xs text-gray-500 font-bold uppercase tracking-wider px-3 py-1.5 border border-gray-800 rounded-lg bg-gray-900/50",children:"Assigned"}):e.jsxs("button",{onClick:R=>{R.stopPropagation(),Z(I)},className:"flex items-center gap-1.5 bg-blue-600/20 hover:bg-blue-600 text-blue-400 hover:text-white px-4 py-1.5 rounded-lg text-xs font-bold transition-all border border-blue-600/30 hover:border-blue-500",children:["Assign",e.jsx(ds,{className:"w-3 h-3"})]})}),r==="mine"&&!I.grade&&e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:R=>{R.stopPropagation(),N(`/alerts/${I.id}`)},className:"flex items-center gap-2 bg-infosec-accent hover:bg-white text-black px-4 py-2 rounded-lg text-xs font-bold transition-all shadow-lg shadow-infosec-accent/10",children:[e.jsx(Zs,{className:"w-3 h-3 fill-current"}),"Investigate"]})})]}),(r==="mine"||r==="closed")&&I.grade&&e.jsxs("div",{className:"flex justify-end items-center gap-1",children:[e.jsx("span",{className:"text-[10px] text-gray-500 uppercase font-bold mr-1",children:"Score"}),e.jsx("span",{className:`text-lg font-bold ${I.grade>=80?"text-green-400":I.grade>=60?"text-yellow-400":"text-red-400"}`,children:I.grade})]})]})]}),b===I.id&&e.jsxs("div",{className:"px-6 py-6 bg-[#1a1b1e] border-t border-gray-800 text-sm text-gray-300",children:[w===I.id?e.jsxs("div",{className:"mb-6 p-4 bg-[#0e0f11] rounded-xl border border-gray-800",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h4",{className:"text-gray-400 font-bold uppercase text-xs tracking-wider",children:"Edit Alert Details"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>ee(I.id),className:"px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded font-bold text-xs transition uppercase tracking-wide",children:"Save"}),e.jsx("button",{onClick:U,className:"px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded font-bold text-xs transition uppercase tracking-wide",children:"Cancel"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"Title"}),e.jsx("input",{type:"text",value:P.title,onChange:R=>O({...P,title:R.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-3 py-2 text-white focus:outline-none focus:border-infosec-accent text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"Severity"}),e.jsxs("select",{value:P.severity,onChange:R=>O({...P,severity:R.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-3 py-2 text-white focus:outline-none focus:border-infosec-accent text-sm",children:[e.jsx("option",{value:"Critical",children:"Critical"}),e.jsx("option",{value:"High",children:"High"}),e.jsx("option",{value:"Medium",children:"Medium"}),e.jsx("option",{value:"Low",children:"Low"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"Source"}),e.jsxs("select",{value:P.source||"Manual",onChange:R=>O({...P,source:R.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-3 py-2 text-white focus:outline-none focus:border-infosec-accent text-sm",children:[e.jsx("option",{value:"Splunk",children:"Splunk"}),e.jsx("option",{value:"CrowdStrike",children:"CrowdStrike"}),e.jsx("option",{value:"Wazuh",children:"Wazuh"}),e.jsx("option",{value:"Manual",children:"Manual"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"Industry (Sector Code)"}),e.jsx("input",{type:"text",value:P.sector_code,onChange:R=>O({...P,sector_code:R.target.value}),placeholder:"e.g., FINANCIAL, HEALTHCARE, OT/ICS",className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-3 py-2 text-white focus:outline-none focus:border-infosec-accent text-sm uppercase"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"Details"}),e.jsx("textarea",{value:P.details,onChange:R=>O({...P,details:R.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-3 py-2 text-white focus:outline-none focus:border-infosec-accent text-sm h-32 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 mb-1",children:"Raw Log (JSON)"}),e.jsx("textarea",{value:P.raw_log,onChange:R=>O({...P,raw_log:R.target.value}),className:"w-full bg-[#0e0f11] border border-gray-700 rounded px-3 py-2 text-green-500 focus:outline-none focus:border-infosec-accent text-xs h-32 font-mono"})]})]})]}):e.jsxs("div",{className:"mb-6 p-4 bg-[#0e0f11] rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-gray-400 font-bold mb-2 uppercase text-xs tracking-wider",children:"Alert Details"}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm text-gray-300 mb-6",children:I.details||I.description}),I.raw_log&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Raw Log"}),e.jsx("button",{onClick:()=>W(typeof I.raw_log=="string"?I.raw_log:JSON.stringify(I.raw_log,null,2)),className:"text-xs text-gray-500 hover:text-white transition",children:"Copy JSON"})]}),e.jsx("div",{className:"bg-[#0e0f11] p-4 rounded-lg border border-gray-800 font-mono text-xs text-green-500 overflow-x-auto selection:bg-green-500/30 selection:text-green-200",children:e.jsx("pre",{className:"whitespace-pre",children:(()=>{try{const R=typeof I.raw_log=="string"?JSON.parse(I.raw_log):I.raw_log;return JSON.stringify(R,null,2)}catch{return I.raw_log}})()})})]}),(c==="admin"||c==="alert-admin")&&e.jsxs("div",{className:"mt-6 flex gap-3 border-t border-gray-800 pt-4 justify-end",children:[e.jsx("button",{onClick:R=>{R.stopPropagation(),le(I)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded font-bold text-xs transition uppercase tracking-wide text-center",children:"Edit Alert"}),e.jsx("button",{onClick:()=>fe(I.id),className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded font-bold text-xs transition uppercase tracking-wide text-center",children:"Delete Alert"})]}),(c==="admin"||c==="alert-admin")&&f&&r==="closed"&&e.jsx("div",{className:"flex justify-end pt-4 border-t border-gray-800",children:e.jsxs("button",{onClick:R=>{R.stopPropagation(),window.confirm("Are you sure you want to reset this investigation? The grade will be cleared and the user can resubmit.")&&f(I.investigation_id)},className:"px-4 py-2 bg-red-600/20 hover:bg-red-600 text-red-400 hover:text-white border border-red-500/30 rounded font-bold text-xs transition uppercase tracking-wide flex items-center gap-2",children:[e.jsx("span",{children:"🔄"})," Resubmit for Evaluation"]})}),(c==="admin"||c==="alert-admin")&&g&&r==="archived"&&e.jsx("div",{className:"flex justify-end pt-4 border-t border-gray-800",children:e.jsxs("button",{onClick:R=>{R.stopPropagation(),window.confirm("Are you sure you want to resubmit this alert to the main feed? It will appear as new.")&&g(I.id)},className:"px-4 py-2 bg-blue-600/20 hover:bg-blue-600 text-blue-400 hover:text-white border border-blue-500/30 rounded font-bold text-xs transition uppercase tracking-wide flex items-center gap-2",children:[e.jsx("span",{children:"⬆️"})," Resubmit to Feed"]})})]}),r==="mine"&&e.jsx("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 p-6",children:I.investigation_status==="graded"||I.investigation_status==="submitted"?(()=>{var Ke,Be,Ge;let R={};try{R=typeof I.executive_summary=="string"?JSON.parse(I.executive_summary):I.executive_summary||{}}catch{R={}}const je=(R==null?void 0:R.playbook_version)===2;let Te=(R==null?void 0:R.verdict)||((Ke=R==null?void 0:R.summary)==null?void 0:Ke.verdict)||null;je&&Te&&(Te=Te==="true_positive"?"True Positive":Te==="false_positive"?"False Positive":Te);const Ie=je?(R==null?void 0:R.conclusion)||"No conclusion provided.":((Be=R==null?void 0:R.executive_summary)==null?void 0:Be.report)||(R==null?void 0:R.executive_summary)||((Ge=R==null?void 0:R.summary)==null?void 0:Ge.report)||(R==null?void 0:R.report)||(R==null?void 0:R.content)||"No summary available.",tt=je?((R==null?void 0:R.checkedArtifacts)||[]).map(J=>({type:"artifact",value:J})):(R==null?void 0:R.artifacts)||[];return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:I.investigation_status==="submitted"?"⏳ Pending Review":"Investigation Summary"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-6 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[Te&&e.jsxs("div",{className:"flex items-center justify-between mb-6 border-b border-gray-700 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-400 font-bold text-xs uppercase tracking-wider",children:"Verdict"}),e.jsx("span",{className:`px-3 py-1 rounded text-xs font-bold uppercase ${Te==="True Positive"?"bg-red-500/10 text-red-400 border border-red-500/20":Te==="False Positive"?"bg-orange-500/10 text-orange-400 border border-orange-500/20":"bg-green-500/10 text-green-400 border border-green-500/20"}`,children:Te})]}),I.grade&&e.jsxs("div",{className:`text-2xl font-bold ${I.grade>=80?"text-green-400":I.grade>=60?"text-yellow-400":"text-red-400"}`,children:[I.grade,"/100"]})]}),e.jsx("div",{className:"prose prose-invert max-w-none text-sm leading-relaxed",children:e.jsx(no,{components:{h2:({node:J,...Ae})=>e.jsx("h2",{className:"text-lg font-bold text-white mt-6 mb-3 border-b border-gray-700 pb-2",...Ae}),h3:({node:J,...Ae})=>e.jsx("h3",{className:"text-base font-bold text-fuchsia-400 mt-4 mb-2",...Ae}),p:({node:J,...Ae})=>e.jsx("p",{className:"mb-3 text-gray-300",...Ae}),ul:({node:J,...Ae})=>e.jsx("ul",{className:"list-disc pl-5 mb-3 text-gray-300",...Ae}),li:({node:J,...Ae})=>e.jsx("li",{className:"pl-1",...Ae}),strong:({node:J,...Ae})=>e.jsx("strong",{className:"text-white font-semibold",...Ae})},children:typeof Ie=="string"?Ie:JSON.stringify(Ie)})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider pl-1",children:["Identified Artifacts (",tt.length,")"]}),tt.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:(Array.isArray(tt)?tt:[]).map((J,Ae)=>e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-gray-800/20 rounded-lg border border-gray-800",children:[e.jsx("span",{className:"font-bold text-infosec-accent text-xs uppercase min-w-[60px]",children:J.type}),e.jsx("span",{className:"text-white font-mono text-xs truncate",children:J.value})]},Ae))}):e.jsx("div",{className:"text-gray-500 text-sm italic pl-1",children:"No artifacts recorded."})]}),I.feedback&&e.jsxs("div",{className:"p-4 bg-purple-500/10 border border-purple-500/30 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-lg",children:"🎓"}),e.jsx("h4",{className:"text-purple-400 font-bold text-sm",children:"Senior Analyst Feedback"})]}),e.jsx("p",{className:"text-gray-300 text-sm",children:I.feedback})]})]})]})})():e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-gray-400 mb-4",children:"Use the Investigation Playbook to analyze and close this alert."}),e.jsxs("div",{className:"flex gap-3 justify-center",children:[e.jsx("button",{onClick:R=>{R.stopPropagation(),N(`/alerts/${I.id}`)},className:"bg-infosec-accent hover:bg-infosec-accentHover text-white px-6 py-2 rounded-lg font-bold transition shadow-lg shadow-infosec-accent/20",children:"Go to Playbook"}),e.jsx("button",{onClick:R=>{R.stopPropagation(),V(I.id)},className:"bg-red-500/10 hover:bg-red-500/20 text-red-500 border border-red-500/20 px-6 py-2 rounded-lg font-bold transition",children:"Unassign"})]})]})}),r==="admin-review"&&e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 p-6",children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:"Review Executive Summary"}),e.jsxs("div",{className:"mb-6 space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-sm text-gray-400",children:["Investigator: ",e.jsx("span",{className:"text-white font-bold",children:I.user_name})]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["Email: ",e.jsx("span",{className:"text-white",children:I.user_email})]})]}),e.jsxs("div",{className:"text-right space-y-1",children:[e.jsx("div",{className:"text-[10px] font-mono text-gray-500 uppercase tracking-widest",children:"Alert ID"}),e.jsx("div",{className:"text-xs font-mono text-infosec-accent bg-infosec-accent/5 px-2 py-1 rounded border border-infosec-accent/20",children:I.id})]})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-2 p-3 bg-gray-800/20 rounded-lg border border-gray-700/30",children:[e.jsxs("div",{className:"text-center border-r border-gray-700/50",children:[e.jsx("div",{className:"text-[9px] text-gray-500 uppercase font-bold",children:"Severity"}),e.jsx("div",{className:`text-xs font-bold ${pe(I.severity)}`,children:I.severity})]}),e.jsxs("div",{className:"text-center border-r border-gray-700/50",children:[e.jsx("div",{className:"text-[9px] text-gray-500 uppercase font-bold",children:"Source"}),e.jsx("div",{className:"text-xs text-gray-300 font-bold",children:I.source||"N/A"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-[9px] text-gray-500 uppercase font-bold",children:"Sector"}),e.jsx("div",{className:"text-xs text-gray-300 font-bold",children:I.sector_code||"N/A"})]})]}),I.grade!==void 0&&I.grade!==null&&e.jsxs("div",{className:`mt-4 p-3 rounded-lg border flex items-center justify-between ${I.grade>=80?"bg-green-500/10 border-green-500/20 text-green-400":I.grade>=60?"bg-yellow-500/10 border-yellow-500/20 text-yellow-400":"bg-red-500/10 border-red-500/20 text-red-400"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Or,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",children:"Already Graded"})]}),e.jsxs("div",{className:"text-sm font-bold",children:["Score: ",I.grade,"/100"]})]})]}),(()=>{var Ke,Be,Ge;let R={};try{R=typeof I.executive_summary=="string"?JSON.parse(I.executive_summary):I.executive_summary||{}}catch{R={}}const je=(R==null?void 0:R.playbook_version)===2;let Te=(R==null?void 0:R.verdict)||((Ke=R==null?void 0:R.summary)==null?void 0:Ke.verdict)||null;je&&Te&&(Te=Te==="true_positive"?"True Positive":Te==="false_positive"?"False Positive":Te);const Ie=je?(R==null?void 0:R.conclusion)||"No conclusion provided.":((Be=R==null?void 0:R.executive_summary)==null?void 0:Be.report)||(R==null?void 0:R.executive_summary)||((Ge=R==null?void 0:R.summary)==null?void 0:Ge.report)||(R==null?void 0:R.report)||(R==null?void 0:R.content)||"No summary available.",tt=je?((R==null?void 0:R.checkedArtifacts)||[]).map(J=>({type:"artifact",value:J})):(R==null?void 0:R.artifacts)||[];return e.jsxs("div",{className:"space-y-6 mb-8",children:[e.jsxs("div",{className:"p-6 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[Te&&e.jsx("div",{className:"flex items-center justify-between mb-6 border-b border-gray-700 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-400 font-bold text-xs uppercase tracking-wider",children:"Verdict"}),e.jsx("span",{className:`px-3 py-1 rounded text-xs font-bold uppercase ${Te==="True Positive"?"bg-red-500/10 text-red-400 border border-red-500/20":Te==="False Positive"?"bg-orange-500/10 text-orange-400 border border-orange-500/20":"bg-green-500/10 text-green-400 border border-green-500/20"}`,children:Te})]})}),e.jsx("div",{className:"prose prose-invert max-w-none text-sm leading-relaxed",children:e.jsx(no,{components:{h2:({node:J,...Ae})=>e.jsx("h2",{className:"text-lg font-bold text-white mt-6 mb-3 border-b border-gray-700 pb-2",...Ae}),h3:({node:J,...Ae})=>e.jsx("h3",{className:"text-base font-bold text-fuchsia-400 mt-4 mb-2",...Ae}),p:({node:J,...Ae})=>e.jsx("p",{className:"mb-3 text-gray-300",...Ae}),ul:({node:J,...Ae})=>e.jsx("ul",{className:"list-disc pl-5 mb-3 text-gray-300",...Ae}),li:({node:J,...Ae})=>e.jsx("li",{className:"pl-1",...Ae}),strong:({node:J,...Ae})=>e.jsx("strong",{className:"text-white font-semibold",...Ae})},children:typeof Ie=="string"?Ie:JSON.stringify(Ie)})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider pl-1",children:["Identified Artifacts (",tt.length,")"]}),tt.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:(Array.isArray(tt)?tt:[]).map((J,Ae)=>e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-gray-800/20 rounded-lg border border-gray-800 hover:border-gray-700 transition-colors",children:[e.jsx("span",{className:"font-bold text-infosec-accent text-xs uppercase w-24 tracking-wide",children:J.type}),e.jsx("span",{className:"text-white flex-1 font-mono text-sm border-l border-gray-800 pl-4",children:J.value})]},Ae))}):e.jsx("div",{className:"text-gray-500 text-sm italic pl-1",children:"No artifacts recorded."})]})]})})(),e.jsxs("div",{className:"border-t border-gray-800 pt-6",children:[e.jsx("h4",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4",children:"Grading"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Grade (0-100)"}),e.jsx("input",{type:"number",value:j.grade,onChange:R=>S({...j,grade:R.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-4 py-2 text-white focus:outline-none focus:border-infosec-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Feedback"}),e.jsx("input",{type:"text",value:j.feedback,onChange:R=>S({...j,feedback:R.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded px-4 py-2 text-white focus:outline-none focus:border-infosec-accent"})]})]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{onClick:()=>ue(I.id),className:"bg-green-600 hover:bg-green-500 text-white px-6 py-2 rounded-lg font-bold transition shadow-lg shadow-green-600/20",children:"Submit Grade"})})]})]}),r==="closed"&&e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Investigation Summary"}),e.jsxs("div",{className:"text-sm text-gray-400 mt-1",children:["Completed by ",e.jsx("span",{className:"text-infosec-accent font-medium",children:I.investigator_name||I.user_name||"Unknown Analyst"}),I.updated_at&&` on ${new Date(I.updated_at).toLocaleDateString()}`]})]}),I.grade&&e.jsxs("div",{className:`text-center px-4 py-2 rounded-lg ${I.grade>=80?"bg-green-500/20 border border-green-500/30":I.grade>=60?"bg-yellow-500/20 border border-yellow-500/30":"bg-red-500/20 border border-red-500/30"}`,children:[e.jsx("div",{className:`text-3xl font-bold ${I.grade>=80?"text-green-400":I.grade>=60?"text-yellow-400":"text-red-400"}`,children:I.grade}),e.jsx("div",{className:"text-xs text-gray-400",children:"Score"})]})]}),(()=>{var Be,Ge,J,Ae;let R={};try{R=typeof I.executive_summary=="string"?JSON.parse(I.executive_summary):I.executive_summary||{}}catch{R={}}const je=(R==null?void 0:R.playbook_version)===2;let Te=(R==null?void 0:R.verdict)||((Be=R==null?void 0:R.summary)==null?void 0:Be.verdict)||null;je&&Te&&(Te=Te==="true_positive"?"True Positive":Te==="false_positive"?"False Positive":Te);const Ie=je?(R==null?void 0:R.conclusion)||"No conclusion provided.":((Ge=R==null?void 0:R.executive_summary)==null?void 0:Ge.report)||(R==null?void 0:R.executive_summary)||((J=R==null?void 0:R.summary)==null?void 0:J.report)||(R==null?void 0:R.report)||(R==null?void 0:R.content)||"No summary available.",tt=je?((R==null?void 0:R.checkedArtifacts)||[]).map(ve=>({type:"artifact",value:ve})):(R==null?void 0:R.artifacts)||[],Ke=je?(R==null?void 0:R.selectedActions)||[]:[];return R!=null&&R.conclusion||(Ae=R==null?void 0:R.summary)!=null&&Ae.conclusion,e.jsxs("div",{className:"space-y-6",children:[Te&&e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("span",{className:"text-gray-400 text-sm",children:"Verdict:"}),e.jsx("span",{className:`px-3 py-1 rounded text-sm font-bold ${Te==="True Positive"?"bg-red-500/20 text-red-400 border border-red-500/30":Te==="False Positive"?"bg-orange-500/20 text-orange-400 border border-orange-500/30":"bg-green-500/20 text-green-400 border border-green-500/30"}`,children:Te})]}),e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-3",children:"Analyst's Report"}),e.jsx("div",{className:"prose prose-invert max-w-none text-sm leading-relaxed",children:e.jsx(no,{components:{h2:({node:ve,...ge})=>e.jsx("h2",{className:"text-lg font-bold text-white mt-4 mb-2",...ge}),h3:({node:ve,...ge})=>e.jsx("h3",{className:"text-base font-bold text-fuchsia-400 mt-3 mb-1",...ge}),p:({node:ve,...ge})=>e.jsx("p",{className:"mb-2 text-gray-300",...ge}),ul:({node:ve,...ge})=>e.jsx("ul",{className:"list-disc pl-5 mb-2 text-gray-300",...ge}),li:({node:ve,...ge})=>e.jsx("li",{className:"pl-1",...ge}),strong:({node:ve,...ge})=>e.jsx("strong",{className:"text-white font-semibold",...ge})},children:typeof Ie=="string"?Ie:JSON.stringify(Ie)})})]}),tt.length>0&&e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-3",children:["Checked Artifacts (",tt.length,")"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:(Array.isArray(tt)?tt:[]).map((ve,ge)=>e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-gray-900/50 rounded border border-gray-700/50",children:[e.jsx("span",{className:"text-green-400 text-xs",children:"✓"}),e.jsx("span",{className:"text-white font-mono text-xs truncate",children:ve.value||ve})]},ge))})]}),Ke.length>0&&e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-3",children:["Actions Taken (",Ke.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:(Array.isArray(Ke)?Ke:[]).map((ve,ge)=>{const qe={block_ip:"🚫 Block IP/Domain",isolate_host:"🔒 Isolate Host",reset_credentials:"🔑 Reset Credentials",block_hash:"🛡️ Block Hash",close_alert:"✅ Close Alert",escalate:"⬆️ Escalate",collect_forensics:"🔍 Collect Forensics",notify_user:"📧 Notify User",block_sender:"📨 Block Sender"};return e.jsx("span",{className:"px-3 py-1 bg-blue-500/20 text-blue-400 border border-blue-500/30 rounded text-xs font-medium",children:qe[ve]||ve},ge)})})]}),I.feedback&&e.jsxs("div",{className:"p-4 bg-purple-500/10 border border-purple-500/30 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-lg",children:"🎓"}),e.jsx("h4",{className:"text-purple-400 font-bold text-sm",children:"Senior Analyst Feedback"})]}),e.jsx("p",{className:"text-gray-300 text-sm",children:I.feedback})]}),(()=>{const ve=new Date(I.updated_at||I.closed_at||I.created_at),ge=new Date-ve<24*60*60*1e3;return I.is_reported?e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("div",{className:"text-yellow-500 text-sm flex items-center gap-2 border border-yellow-500/30 bg-yellow-500/5 px-4 py-2 rounded-lg",children:"🚩 Report Received - Pending Review"})}):ge?e.jsx("div",{className:"mt-6 flex justify-end",children:e.jsx("button",{onClick:qe=>{qe.stopPropagation(),ke(I.id)},className:"text-gray-400 hover:text-white text-sm flex items-center gap-2 transition-colors border border-gray-700 hover:border-gray-500 px-4 py-2 rounded-lg",children:"🚩 Report Issue / Appeal Grade"})}):null})()]})})()]})]})]},I.id))}),e.jsx(Za,{isOpen:$,onClose:()=>C(!1),onConfirm:re,title:"Delete Alert?",message:"Are you sure you want to delete this alert? This action cannot be undone and all details will be lost forever.",confirmText:"Delete Alert",isDanger:!0}),e.jsx(Za,{isOpen:L,onClose:()=>F(!1),onConfirm:ce,title:"Unassign Alert",message:"Are you sure you want to release this alert? It will return to the available pool.",confirmText:"Unassign",isDanger:!0}),e.jsx(H1,{isOpen:Q,onClose:()=>de(!1),onConfirm:xe,alertId:H==null?void 0:H.id,alertTitle:H==null?void 0:H.title}),Se&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-700 p-6 w-full max-w-md shadow-2xl animate-fade-in-up",children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Report Issue / Appeal Grade"}),e.jsx("p",{className:"text-gray-400 text-sm mb-4",children:"Found an issue with the grading or want to appeal the verdict? Please explain below."}),e.jsx("textarea",{value:$e,onChange:I=>K(I.target.value),placeholder:"Describe the issue or reason for appeal...",className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg p-3 text-white text-sm focus:outline-none focus:border-infosec-accent mb-4 h-32 resize-none"}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>{ke(null),K("")},className:"px-4 py-2 rounded-lg bg-gray-800 text-gray-300 hover:bg-gray-700 font-bold text-sm transition",children:"Cancel"}),e.jsx("button",{onClick:ie,className:"px-4 py-2 rounded-lg bg-infosec-accent text-white hover:bg-infosec-accentHover font-bold text-sm transition shadow-lg shadow-infosec-accent/20",children:"Submit Report"})]})]})})]}):null},zm=t=>{if(!t)return"Other";const r=t.toLowerCase();return r.includes("dlp")||r.includes("data loss")?"DLP":r.includes("aws")||r.includes("azure")||r.includes("gcp")||r.includes("cloud")||r.includes("s3")||r.includes("ec2")||r.includes("iam")?"Cloud Security":r.includes("crowdstrike")||r.includes("sentinelone")||r.includes("carbon")||r.includes("edr")||r.includes("endpoint")||r.includes("antivirus")||r.includes("defender")?"Endpoint Security":r.includes("splunk")||r.includes("wazuh")||r.includes("siem")||r.includes("log")||r.includes("event")?"SIEM / Logs":r.includes("firewall")||r.includes("palo alto")||r.includes("fortinet")||r.includes("ids")||r.includes("ips")||r.includes("network")||r.includes("traffic")||r.includes("zeek")||r.includes("suricata")||r.includes("snort")||r.includes("packet")?"Network Security":r.includes("email")||r.includes("proofpoint")||r.includes("mimecast")||r.includes("phishing")||r.includes("smtp")?"Email Security":r.includes("ad")||r.includes("active directory")||r.includes("okta")||r.includes("auth")||r.includes("login")||r.includes("identity")||r.includes("ldap")?"Identity (IAM)":r.includes("dns")?"DNS Security":r.includes("web")||r.includes("http")||r.includes("nginx")||r.includes("apache")||r.includes("iis")||r.includes("waf")?"Web Security":r.includes("database")||r.includes("sql")||r.includes("oracle")||r.includes("mongodb")?"Database":r==="manual"||r.includes("simulation")?"Simulation / Manual":"Other Tools"},W1=({alerts:t,myInvestigations:r,myMissions:a,assignedToUsers:n,closedAlerts:s,user:i,onAssign:o,onUnassign:c,onRefresh:d,onNavigate:m,handleSubmitSummary:u,handleGradeInvestigation:x,handleResubmitAlert:h,currentPage:f,setCurrentPage:g,itemsPerPage:b,setItemsPerPage:p,totalItems:v,activeTab:y,onTabChange:j,initialExpandedId:S})=>{const[N,w]=l.useState("main"),_=y!==void 0?y:N,P=H=>{j?j(H):w(H)},[O,T]=l.useState("all"),[k,$]=l.useState("all"),[C,A]=l.useState("all"),[E,L]=l.useState([]),[F,D]=l.useState(null);l.useEffect(()=>{(async()=>{if(((i==null?void 0:i.role)==="admin"||(i==null?void 0:i.role)==="alert-admin")&&_==="main")try{const se=localStorage.getItem("token"),W=await fetch(`${Y}/api/alerts/path-stats`,{headers:{Authorization:`Bearer ${se}`}});if(W.ok){const le=await W.json();D(le)}}catch(se){console.error("Failed to fetch stats:",se)}})()},[i,_]),l.useEffect(()=>{(async()=>{try{const se=localStorage.getItem("token"),W=await fetch(`${Y}/api/alerts/sources`,{headers:{Authorization:`Bearer ${se}`}});if(W.ok){const le=await W.json(),U=new Set(le.map(ee=>zm(ee)));L(Array.from(U).sort())}}catch(se){console.error("Failed to fetch sources:",se)}})()},[]);const q=()=>F?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8 animate-fadeIn",children:[e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-xl relative overflow-hidden group hover:border-infosec-accent/50 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(Er,{className:"w-24 h-24 text-infosec-accent"})}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h3",{className:"text-gray-400 text-sm font-bold uppercase tracking-wider mb-2 flex items-center gap-2",children:[e.jsx(Er,{className:"w-4 h-4"})," Total Active Alerts"]}),e.jsx("div",{className:"text-4xl font-black text-white mb-1",children:F.total}),e.jsx("div",{className:"text-xs text-gray-500",children:"Live threats currently in queue"})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-xl relative overflow-hidden group hover:border-blue-500/50 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(Cc,{className:"w-24 h-24 text-blue-500"})}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h3",{className:"text-gray-400 text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2",children:[e.jsx(Cc,{className:"w-4 h-4"})," Alerts by Level"]}),e.jsx("div",{className:"space-y-2",children:F.difficultyStats&&F.difficultyStats.map((H,se)=>e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:`font-bold ${(H.difficulty||"").toLowerCase()==="novice"||(H.difficulty||"").toLowerCase()==="beginner"?"text-green-400":(H.difficulty||"").toLowerCase()==="advanced"?"text-red-400":(H.difficulty||"").toLowerCase()==="expert"?"text-cyan-400":(H.difficulty||"").toLowerCase()==="intermediate"?"text-amber-400":"text-gray-300"}`,children:H.difficulty}),e.jsx("span",{className:"bg-gray-800 px-2 py-0.5 rounded text-white text-xs",children:H.count})]},se))})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-xl relative overflow-hidden group hover:border-purple-500/50 transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(xr,{className:"w-24 h-24 text-purple-500"})}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h3",{className:"text-gray-400 text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2",children:[e.jsx(xr,{className:"w-4 h-4"})," alerts by Path"]}),e.jsx("div",{className:"space-y-2",children:F.pathStats&&F.pathStats.map((H,se)=>e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:"text-purple-400 font-bold",children:H.path_code}),e.jsx("span",{className:"bg-gray-800 px-2 py-0.5 rounded text-white text-xs",children:H.count})]},se))})]})]})]}):null,Q=H=>H.filter(se=>{const W=O==="all"||se.severity&&se.severity.toLowerCase()===O,le=zm(se.source),U=k==="all"||le===k,ee=C==="all"||se.path_code&&se.path_code===C;return W&&U&&ee}),de=({totalItems:H,currentPage:se,setCurrentPage:W,itemsPerPage:le,setItemsPerPage:U})=>{const ee=Math.ceil(H/le);return H===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center mt-6 px-4 py-3 bg-[#1a1b1e] rounded-lg border border-gray-800",children:[e.jsxs("div",{className:"flex items-center text-sm text-gray-400 mb-4 sm:mb-0",children:[e.jsx("span",{className:"mr-3",children:"Show"}),e.jsxs("select",{value:le,onChange:ae=>{U(Number(ae.target.value)),W(1)},className:"bg-[#0e0f11] border border-gray-700 text-white text-sm rounded-lg focus:ring-infosec-accent focus:border-infosec-accent block p-1.5",children:[e.jsx("option",{value:10,children:"10"}),e.jsx("option",{value:25,children:"25"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]}),e.jsx("span",{className:"ml-3",children:"alerts per page"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>W(ae=>Math.max(ae-1,1)),disabled:se===1,className:`px-3 py-1 rounded-md text-sm font-medium ${se===1?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-white hover:bg-gray-700"}`,children:"Previous"}),e.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Page ",e.jsx("span",{className:"text-white font-bold",children:se})," of ",e.jsx("span",{className:"text-white font-bold",children:ee})]}),e.jsx("button",{onClick:()=>W(ae=>Math.min(ae+1,ee)),disabled:se===ee,className:`px-3 py-1 rounded-md text-sm font-medium ${se===ee?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-white hover:bg-gray-700"}`,children:"Next"})]})]})};return e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:[e.jsx("div",{className:"flex items-center justify-center mb-8",children:e.jsxs("div",{className:"bg-[#121316] p-1.5 rounded-full border border-gray-800 flex gap-1",children:[e.jsxs("button",{onClick:()=>P("main"),className:`
                            px-6 py-2 rounded-full text-sm font-bold uppercase tracking-wide transition-all duration-300 flex items-center gap-2
                            ${_==="main"?"bg-infosec-accent text-white shadow-lg shadow-infosec-accent/25":"text-gray-400 hover:text-white hover:bg-gray-800/50"}
                        `,children:[e.jsx("span",{children:"⚡"})," Main Channel"]}),e.jsxs("button",{onClick:()=>P("investigation"),className:`
                            px-6 py-2 rounded-full text-sm font-bold uppercase tracking-wide transition-all duration-300 flex items-center gap-2
                            ${_==="investigation"?"bg-infosec-accent text-white shadow-lg shadow-infosec-accent/25":"text-gray-400 hover:text-white hover:bg-gray-800/50"}
                        `,children:[e.jsx("span",{children:"🔍"})," My Investigations"]}),e.jsxs("button",{onClick:()=>P("missions"),className:`
                            px-6 py-2 rounded-full text-sm font-bold uppercase tracking-wide transition-all duration-300 flex items-center gap-2
                            ${_==="missions"?"bg-infosec-accent text-white shadow-lg shadow-infosec-accent/25":"text-gray-400 hover:text-white hover:bg-gray-800/50"}
                        `,children:[e.jsx("span",{children:"🚀"})," My Missions"]}),e.jsxs("button",{onClick:()=>P("closed"),className:`
                            px-6 py-2 rounded-full text-sm font-bold uppercase tracking-wide transition-all duration-300 flex items-center gap-2
                            ${_==="closed"?"bg-infosec-accent text-white shadow-lg shadow-infosec-accent/25":"text-gray-400 hover:text-white hover:bg-gray-800/50"}
                        `,children:[e.jsx("span",{children:"✅"})," Closed Alerts"]})]})}),e.jsxs("div",{className:"bg-[#1a1b1e] border-t-0 border border-gray-800 rounded-b-xl rounded-tr-xl p-0 shadow-2xl relative z-20",children:[_==="main"&&e.jsxs("div",{className:"animate-fadeIn",children:[((i==null?void 0:i.role)==="admin"||(i==null?void 0:i.role)==="alert-admin")&&e.jsx("div",{className:"-mt-32 mb-8 relative z-30 px-6",children:e.jsx(q,{})}),e.jsxs("div",{className:"mx-6 mb-6 p-1 bg-[#151619] rounded-xl border border-gray-800 flex flex-col md:flex-row items-center justify-between gap-4 shadow-lg",children:[e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-white font-bold",children:[e.jsx(tu,{className:"w-4 h-4 text-infosec-accent"}),e.jsx("span",{className:"text-sm",children:"FILTERS"})]}),e.jsx("div",{className:"h-6 w-px bg-gray-700 mx-2 hidden md:block"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 p-2",children:[e.jsxs("select",{value:O,onChange:H=>T(H.target.value),className:`
                                        appearance-none text-xs font-bold uppercase tracking-wider rounded-lg px-4 py-2 focus:outline-none focus:ring-1 focus:ring-infosec-accent cursor-pointer transition-colors border
                                        ${O!=="all"?"bg-infosec-accent/20 border-infosec-accent text-white":"bg-[#0e0f11] border-gray-700 text-gray-400 hover:border-gray-500"}
                                    `,children:[e.jsx("option",{value:"all",children:"Severity: All"}),e.jsx("option",{value:"critical",children:"Critical"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsxs("select",{value:C,onChange:H=>A(H.target.value),className:`
                                        appearance-none text-xs font-bold uppercase tracking-wider rounded-lg px-4 py-2 focus:outline-none focus:ring-1 focus:ring-infosec-accent cursor-pointer transition-colors border
                                        ${C!=="all"?"bg-purple-500/20 border-purple-500 text-white":"bg-[#0e0f11] border-gray-700 text-gray-400 hover:border-gray-500"}
                                    `,children:[e.jsx("option",{value:"all",children:"Path: All"}),e.jsx("option",{value:"SIEM",children:"SIEM Analyst"}),e.jsx("option",{value:"EDR",children:"Endpoint (EDR)"}),e.jsx("option",{value:"NDR",children:"Network (NDR)"}),e.jsx("option",{value:"TI",children:"Threat Intel"}),e.jsx("option",{value:"IR",children:"Incident Response"}),e.jsx("option",{value:"MAL",children:"Malware Analysis"}),e.jsx("option",{value:"DLP",children:"DLP"}),e.jsx("option",{value:"CLOUD",children:"Cloud Security"})]}),e.jsxs("select",{value:k,onChange:H=>$(H.target.value),className:`
                                        appearance-none text-xs font-bold uppercase tracking-wider rounded-lg px-4 py-2 focus:outline-none focus:ring-1 focus:ring-infosec-accent cursor-pointer transition-colors border
                                        ${k!=="all"?"bg-blue-500/20 border-blue-500 text-white":"bg-[#0e0f11] border-gray-700 text-gray-400 hover:border-gray-500"}
                                    `,children:[e.jsx("option",{value:"all",children:"Source: All Groups"}),E.map((H,se)=>e.jsx("option",{value:H,children:H},se))]}),(O!=="all"||k!=="all"||C!=="all")&&e.jsxs("button",{onClick:()=>{T("all"),$("all"),A("all")},className:"ml-auto text-xs text-gray-500 hover:text-white flex items-center gap-1 px-3 py-2 hover:bg-white/5 rounded-lg transition-colors",children:[e.jsx(oa,{className:"w-3 h-3"})," Reset"]})]})]}),e.jsxs("div",{className:"p-6",children:[e.jsx(ta,{alerts:Q(t),viewMode:"all",onAssign:o,onUnassign:c,userId:i==null?void 0:i.id,userRole:i==null?void 0:i.role,onRefresh:d,onNavigate:m,initialExpandedId:S}),e.jsx(de,{totalItems:v,currentPage:f,setCurrentPage:g,itemsPerPage:b,setItemsPerPage:p})]})]}),_==="investigation"&&e.jsxs("div",{className:"animate-fadeIn",children:[e.jsx("div",{className:"p-6 pb-0 flex justify-between items-center",children:e.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-300",children:"🔍"})," My Investigations"]})}),e.jsx("div",{className:"p-6",children:e.jsx(ta,{alerts:r,viewMode:"mine",onSubmitSummary:u,onUnassign:c,userId:i==null?void 0:i.id,userRole:i==null?void 0:i.role,onRefresh:d,onNavigate:m,initialExpandedId:S})})]}),_==="missions"&&e.jsxs("div",{className:"animate-fadeIn",children:[e.jsx("div",{className:"p-6 pb-0 flex justify-between items-center",children:e.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-300",children:"🚀"})," My Missions"]})}),e.jsxs("div",{className:"p-6",children:[a&&a.filter(H=>H.status==="in_progress").length>0?e.jsx("div",{className:"space-y-3",children:a.filter(H=>H.status==="in_progress").map(H=>e.jsxs("div",{className:"bg-[#131416] border border-gray-800 rounded-lg p-4 flex items-center justify-between hover:bg-[#1a1b1e] transition-colors cursor-pointer",onClick:()=>m&&m(H.id,"mission"),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-2 h-12 rounded-full ${(H.difficulty_level||"intermediate").toLowerCase()==="expert"?"bg-cyan-500":(H.difficulty_level||"intermediate").toLowerCase()==="advanced"?"bg-red-500":(H.difficulty_level||"intermediate").toLowerCase()==="intermediate"?"bg-amber-500":"bg-green-500"}`}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold text-lg",children:H.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-xs font-mono text-gray-500 bg-gray-900 px-2 py-0.5 rounded uppercase tracking-wider",children:H.apt_group||"Unknown Group"}),e.jsxs("span",{className:"text-xs text-gray-400",children:[H.progress_percent,"% Complete"]})]})]})]}),e.jsx("button",{className:"px-4 py-2 bg-infosec-accent text-white rounded-lg text-sm font-bold hover:bg-purple-600 transition-colors",children:"Continue"})]},H.id))}):e.jsxs("div",{className:"text-center py-12 text-gray-500",children:[e.jsx("span",{className:"text-4xl block mb-4",children:"🚀"}),"No active missions. Start a new mission from the Missions tab!"]}),a&&a.filter(H=>H.status==="completed").length>0&&e.jsxs("div",{className:"mt-8 pt-8 border-t border-gray-800",children:[e.jsxs("h3",{className:"text-lg font-bold text-gray-400 mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"✅"})," Completed Missions"]}),e.jsx("div",{className:"space-y-3 opacity-75 hover:opacity-100 transition-opacity",children:a.filter(H=>H.status==="completed").map(H=>e.jsxs("div",{className:"bg-[#131416] border border-green-900/30 rounded-lg p-4 flex items-center justify-between hover:bg-[#1a1b1e] transition-colors cursor-pointer",onClick:()=>m&&m(H.id,"mission"),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-2 h-12 rounded-full bg-green-500"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-gray-300 font-bold text-lg line-through decoration-green-500/50",children:H.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-xs font-mono text-gray-500 bg-gray-900 px-2 py-0.5 rounded uppercase tracking-wider",children:H.apt_group||"Unknown Group"}),e.jsx("span",{className:"text-xs text-green-500 font-bold",children:"Completed"})]})]})]}),e.jsx("button",{className:"px-4 py-2 bg-gray-800 text-gray-300 rounded-lg text-sm font-bold hover:bg-gray-700 transition-colors border border-gray-700",children:"Review"})]},H.id))})]})]})]}),_==="closed"&&e.jsxs("div",{className:"animate-fadeIn",children:[e.jsx("div",{className:"p-6 pb-0 flex justify-between items-center",children:e.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-400",children:"✅"})," Closed & Graded"]})}),e.jsx("div",{className:"p-6",children:e.jsx(ta,{alerts:s,viewMode:"closed",userId:i==null?void 0:i.id,userRole:i==null?void 0:i.role,onRefresh:d,onNavigate:m,onResubmit:h,initialExpandedId:S})})]})]})]})};function Fm(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Bm(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Fm(Object(a),!0).forEach(function(n){Gf(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Fm(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function so(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?so=function(r){return typeof r}:so=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},so(t)}function Gf(t,r,a){return r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function U1(t,r){if(t==null)return{};var a={},n=Object.keys(t),s,i;for(i=0;i<n.length;i++)s=n[i],!(r.indexOf(s)>=0)&&(a[s]=t[s]);return a}function V1(t,r){if(t==null)return{};var a=U1(t,r),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Kf(t,r){return G1(t)||K1(t,r)||q1(t,r)||X1()}function G1(t){if(Array.isArray(t))return t}function K1(t,r){var a=t&&(typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"]);if(a!=null){var n=[],s=!0,i=!1,o,c;try{for(a=a.call(t);!(s=(o=a.next()).done)&&(n.push(o.value),!(r&&n.length===r));s=!0);}catch(d){i=!0,c=d}finally{try{!s&&a.return!=null&&a.return()}finally{if(i)throw c}}return n}}function q1(t,r){if(t){if(typeof t=="string")return Hm(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(t);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Hm(t,r)}}function Hm(t,r){(r==null||r>t.length)&&(r=t.length);for(var a=0,n=new Array(r);a<r;a++)n[a]=t[a];return n}function X1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Sr=function(r,a,n){var s=!!n,i=me.useRef(n);me.useEffect(function(){i.current=n},[n]),me.useEffect(function(){if(!s||!r)return function(){};var o=function(){i.current&&i.current.apply(i,arguments)};return r.on(a,o),function(){r.off(a,o)}},[s,a,r,i])},Oc=function(r){var a=me.useRef(r);return me.useEffect(function(){a.current=r},[r]),a.current},hs=function(r){return r!==null&&so(r)==="object"},Y1=function(r){return hs(r)&&typeof r.then=="function"},J1=function(r){return hs(r)&&typeof r.elements=="function"&&typeof r.createToken=="function"&&typeof r.createPaymentMethod=="function"&&typeof r.confirmCardPayment=="function"},Wm="[object Object]",Q1=function t(r,a){if(!hs(r)||!hs(a))return r===a;var n=Array.isArray(r),s=Array.isArray(a);if(n!==s)return!1;var i=Object.prototype.toString.call(r)===Wm,o=Object.prototype.toString.call(a)===Wm;if(i!==o)return!1;if(!i&&!n)return r===a;var c=Object.keys(r),d=Object.keys(a);if(c.length!==d.length)return!1;for(var m={},u=0;u<c.length;u+=1)m[c[u]]=!0;for(var x=0;x<d.length;x+=1)m[d[x]]=!0;var h=Object.keys(m);if(h.length!==c.length)return!1;var f=r,g=a,b=function(v){return t(f[v],g[v])};return h.every(b)},qf=function(r,a,n){return hs(r)?Object.keys(r).reduce(function(s,i){var o=!hs(a)||!Q1(r[i],a[i]);return n.includes(i)?(o&&console.warn("Unsupported prop change: options.".concat(i," is not a mutable property.")),s):o?Bm(Bm({},s||{}),{},Gf({},i,r[i])):s},null):null},Xf="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Um=function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xf;if(r===null||J1(r))return r;throw new Error(a)},Z1=function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xf;if(Y1(r))return{tag:"async",stripePromise:Promise.resolve(r).then(function(s){return Um(s,a)})};var n=Um(r,a);return n===null?{tag:"empty"}:{tag:"sync",stripe:n}},ew=function(r){!r||!r._registerWrapper||!r.registerAppInfo||(r._registerWrapper({name:"react-stripe-js",version:"5.4.1"}),r.registerAppInfo({name:"react-stripe-js",version:"5.4.1",url:"https://stripe.com/docs/stripe-js/react"}))},wu=me.createContext(null);wu.displayName="ElementsContext";var tw=function(r,a){if(!r)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(a," in an <Elements> provider."));return r},Yf=function(r){var a=r.stripe,n=r.options,s=r.children,i=me.useMemo(function(){return Z1(a)},[a]),o=me.useState(function(){return{stripe:i.tag==="sync"?i.stripe:null,elements:i.tag==="sync"?i.stripe.elements(n):null}}),c=Kf(o,2),d=c[0],m=c[1];me.useEffect(function(){var h=!0,f=function(b){m(function(p){return p.stripe?p:{stripe:b,elements:b.elements(n)}})};return i.tag==="async"&&!d.stripe?i.stripePromise.then(function(g){g&&h&&f(g)}):i.tag==="sync"&&!d.stripe&&f(i.stripe),function(){h=!1}},[i,d,n]);var u=Oc(a);me.useEffect(function(){u!==null&&u!==a&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[u,a]);var x=Oc(n);return me.useEffect(function(){if(d.elements){var h=qf(n,x,["clientSecret","fonts"]);h&&d.elements.update(h)}},[n,x,d.elements]),me.useEffect(function(){ew(d.stripe)},[d.stripe]),me.createElement(wu.Provider,{value:d},s)};Yf.propTypes={stripe:kt.any,options:kt.object};kt.func.isRequired;var Jf=me.createContext(null);Jf.displayName="CheckoutContext";kt.any,kt.shape({clientSecret:kt.oneOfType([kt.string,kt.instanceOf(Promise)]).isRequired,elementsOptions:kt.object}).isRequired;var Vm=function(r){var a=me.useContext(Jf),n=me.useContext(wu);if(a){if(n)throw new Error("You cannot wrap the part of your app that ".concat(r," in both <CheckoutProvider> and <Elements> providers."));return a}else return tw(n,r)},rw=["mode"],aw=function(r){return r.charAt(0).toUpperCase()+r.slice(1)},Tr=function(r,a){var n="".concat(aw(r),"Element"),s=function(d){var m=d.id,u=d.className,x=d.options,h=x===void 0?{}:x,f=d.onBlur,g=d.onFocus,b=d.onReady,p=d.onChange,v=d.onEscape,y=d.onClick,j=d.onLoadError,S=d.onLoaderStart,N=d.onNetworksChange,w=d.onConfirm,_=d.onCancel,P=d.onShippingAddressChange,O=d.onShippingRateChange,T=d.onSavedPaymentMethodRemove,k=d.onSavedPaymentMethodUpdate,$=Vm("mounts <".concat(n,">")),C="elements"in $?$.elements:null,A="checkoutState"in $?$.checkoutState:null,E=(A==null?void 0:A.type)==="success"||(A==null?void 0:A.type)==="loading"?A.sdk:null,L=me.useState(null),F=Kf(L,2),D=F[0],q=F[1],Q=me.useRef(null),de=me.useRef(null);Sr(D,"blur",f),Sr(D,"focus",g),Sr(D,"escape",v),Sr(D,"click",y),Sr(D,"loaderror",j),Sr(D,"loaderstart",S),Sr(D,"networkschange",N),Sr(D,"confirm",w),Sr(D,"cancel",_),Sr(D,"shippingaddresschange",P),Sr(D,"shippingratechange",O),Sr(D,"savedpaymentmethodremove",T),Sr(D,"savedpaymentmethodupdate",k),Sr(D,"change",p);var H;b&&(r==="expressCheckout"?H=b:H=function(){b(D)}),Sr(D,"ready",H),me.useLayoutEffect(function(){if(Q.current===null&&de.current!==null&&(C||E)){var W=null;if(E)switch(r){case"paymentForm":W=E.createPaymentFormElement();break;case"payment":W=E.createPaymentElement(h);break;case"address":if("mode"in h){var le=h.mode,U=V1(h,rw);if(le==="shipping")W=E.createShippingAddressElement(U);else if(le==="billing")W=E.createBillingAddressElement(U);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":W=E.createExpressCheckoutElement(h);break;case"currencySelector":W=E.createCurrencySelectorElement();break;case"taxId":W=E.createTaxIdElement(h);break;default:throw new Error("Invalid Element type ".concat(n,". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."))}else C&&(W=C.create(r,h));Q.current=W,q(W),W&&W.mount(de.current)}},[C,E,h]);var se=Oc(h);return me.useEffect(function(){if(Q.current){var W=qf(h,se,["paymentRequest"]);W&&"update"in Q.current&&Q.current.update(W)}},[h,se]),me.useLayoutEffect(function(){return function(){if(Q.current&&typeof Q.current.destroy=="function")try{Q.current.destroy(),Q.current=null}catch{}}},[]),me.createElement("div",{id:m,className:u,ref:de})},i=function(d){Vm("mounts <".concat(n,">"));var m=d.id,u=d.className;return me.createElement("div",{id:m,className:u})},o=a?i:s;return o.propTypes={id:kt.string,className:kt.string,onChange:kt.func,onBlur:kt.func,onFocus:kt.func,onReady:kt.func,onEscape:kt.func,onClick:kt.func,onLoadError:kt.func,onLoaderStart:kt.func,onNetworksChange:kt.func,onConfirm:kt.func,onCancel:kt.func,onShippingAddressChange:kt.func,onShippingRateChange:kt.func,onSavedPaymentMethodRemove:kt.func,onSavedPaymentMethodUpdate:kt.func,options:kt.object},o.displayName=n,o.__elementType=r,o},Mr=typeof window>"u",nw=me.createContext(null);nw.displayName="EmbeddedCheckoutProviderContext";Tr("auBankAccount",Mr);Tr("card",Mr);Tr("cardNumber",Mr);Tr("cardExpiry",Mr);Tr("cardCvc",Mr);Tr("iban",Mr);Tr("payment",Mr);Tr("expressCheckout",Mr);Tr("paymentRequestButton",Mr);Tr("linkAuthentication",Mr);Tr("address",Mr);Tr("shippingAddress",Mr);Tr("paymentMethodMessaging",Mr);Tr("taxId",Mr);const sw=({priceId:t,planName:r,amount:a,interval:n,onCancel:s})=>{const[i,o]=l.useState(null),[c,d]=l.useState(!1),m=async()=>{d(!0),o(null);try{const u=localStorage.getItem("token")||sessionStorage.getItem("token"),x=await fetch(`${Y}/api/payment/create-checkout-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify({priceId:t})});if(!x.ok){const f=await x.json();throw new Error(f.message||"Failed to create checkout session")}const h=await x.json();if(h.url){window.location.href=h.url;return}throw new Error("No checkout URL received")}catch(u){o(u.message),d(!1)}};return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"bg-gray-800/50 rounded-xl p-4 border border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-gray-400",children:"Selected Plan"}),e.jsx("div",{className:"text-lg font-bold text-white",children:r})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-2xl font-bold text-white",children:["$",a]}),e.jsxs("div",{className:"text-sm text-gray-400",children:["/",n]})]})]})}),e.jsx("div",{className:"bg-gradient-to-r from-purple-500/10 to-pink-500/10 rounded-xl p-4 border border-purple-500/20",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-500/20 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-purple-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-medium",children:"Secure Checkout via Stripe"}),e.jsx("div",{className:"text-sm text-gray-400",children:"You'll be redirected to Stripe's secure payment page"})]})]})}),i&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3 text-red-400 text-sm",children:i}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"flex-1 py-3 px-4 rounded-xl font-semibold bg-gray-700 text-gray-300 hover:bg-gray-600 transition-colors",children:"Cancel"}),e.jsx("button",{type:"button",onClick:m,disabled:c,className:"flex-1 py-3 px-4 rounded-xl font-semibold bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:c?e.jsxs("span",{className:"flex items-center justify-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Redirecting..."]}):`Pay $${a}`})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),"SSL Secured"]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"})}),"Powered by Stripe"]})]})]})},iw=({user:t})=>{var m,u;const[r,a]=l.useState(null),[n,s]=l.useState(!0),[i,o]=l.useState(!1);l.useEffect(()=>{(async()=>{try{const h=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),f=await fetch(`${Y}/api/referrals/stats`,{headers:{Authorization:`Bearer ${h}`}});if(f.ok){const g=await f.json();a(g)}}catch(h){console.error("Error fetching referral stats:",h)}finally{s(!1)}})()},[t]);const c=()=>{if(!(r!=null&&r.referralCode))return;const x=`${window.location.origin}/register?ref=${r.referralCode}`;navigator.clipboard.writeText(x),o(!0),setTimeout(()=>o(!1),2e3)};if(n)return e.jsx("div",{className:"flex justify-center items-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-[#00ff87]"})});const d=r!=null&&r.referralCode?`${window.location.origin}/register?ref=${r.referralCode}`:"Generate a link...";return e.jsxs("div",{className:"space-y-8 animate-fade-in pb-12",children:[e.jsxs("div",{className:"relative rounded-[24px] overflow-hidden border border-blue-500/20 bg-gradient-to-br from-[#1a1b1e] to-[#0f1115] shadow-[0_0_40px_rgba(59,130,246,0.15)]",children:[e.jsx("div",{className:"absolute top-[-50%] right-[-10%] w-[60%] h-[200%] bg-blue-500/10 rounded-full blur-[100px] pointer-events-none"}),e.jsx("div",{className:"absolute bottom-[-50%] left-[-10%] w-[50%] h-[150%] bg-purple-500/10 rounded-full blur-[100px] pointer-events-none"}),e.jsxs("div",{className:"relative p-8 md:p-12 flex flex-col md:flex-row items-center gap-8 z-10",children:[e.jsx("div",{className:"flex-shrink-0 w-24 h-24 rounded-2xl bg-gradient-to-br from-blue-500/20 to-purple-500/20 border border-blue-500/30 flex items-center justify-center shadow-lg transform rotate-3 hover:rotate-0 transition-transform hidden md:flex",children:e.jsx(Lm,{className:"w-12 h-12 text-blue-400"})}),e.jsxs("div",{className:"flex-1 text-center md:text-left",children:[e.jsx("h2",{className:"text-3xl font-black text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-purple-400 mb-3",children:"Invite Friends, Get Pro Free"}),e.jsxs("p",{className:"text-gray-400 text-lg max-w-2xl",children:["Share your unique link. When a friend joins and upgrades to any Pro plan, you'll immediately receive ",e.jsx("strong",{className:"text-blue-400",children:"+30 Days of Pro"})," automatically added to your account!"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-[#1a1b1e] rounded-2xl border border-gray-800 p-6 lg:p-8 flex flex-col justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-purple-500/5 rounded-full blur-3xl"}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Your Unique Invite Link"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Share this link directly with your colleagues or on your social networks."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 bg-[#0f1115] border border-gray-700 rounded-xl px-4 py-4 text-gray-300 font-mono text-sm overflow-hidden text-ellipsis whitespace-nowrap shadow-inner",children:d}),e.jsxs("button",{onClick:c,disabled:!(r!=null&&r.referralCode),className:`flex flex-shrink-0 items-center justify-center gap-2 px-6 py-4 rounded-xl font-bold transition-all ${i?"bg-green-500/20 text-green-400 border border-green-500/50 shadow-[0_0_15px_rgba(34,197,94,0.3)]":"bg-gradient-to-r from-blue-600 to-indigo-600 text-white hover:from-blue-500 hover:to-indigo-500 shadow-lg hover:shadow-blue-500/25 border border-blue-500/50"}`,children:[i?e.jsx(_c,{className:"w-5 h-5"}):e.jsx(ao,{className:"w-5 h-5"}),i?"Copied!":"Copy Link"]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden flex flex-col",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 bg-gray-900/30",children:e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[e.jsx(At,{className:"w-5 h-5 text-purple-400"})," Activity"]})}),e.jsxs("div",{className:"p-6 flex-1 flex flex-col justify-center gap-6",children:[e.jsxs("div",{className:"flex justify-between items-center bg-[#0f1115] p-4 rounded-xl border border-gray-800/50",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider font-bold mb-1",children:"Total Invites"}),e.jsx("div",{className:"text-3xl font-black text-white",children:(r==null?void 0:r.totalInvites)||0})]}),e.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-800/50 flex items-center justify-center border border-gray-700",children:e.jsx(At,{className:"w-5 h-5 text-gray-400"})})]}),e.jsxs("div",{className:"flex justify-between items-center bg-[#0f1115] p-4 rounded-xl border border-blue-500/20 shadow-[0_0_15px_rgba(59,130,246,0.05)] relative overflow-hidden",children:[e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-blue-500"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-blue-400 uppercase tracking-wider font-bold mb-1",children:"Pro Rewards"}),e.jsx("div",{className:"text-3xl font-black text-white",children:(r==null?void 0:r.subscribedCount)||0})]}),e.jsx("div",{className:"w-12 h-12 rounded-full bg-blue-500/20 flex items-center justify-center border border-blue-500/30",children:e.jsx(Lm,{className:"w-5 h-5 text-blue-400"})})]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden mt-8 shadow-xl",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-gray-900/30 flex justify-between items-center",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Your Network"}),e.jsxs("div",{className:"text-xs font-medium text-gray-400 bg-[#0f1115] border border-gray-800 py-1.5 px-4 rounded-lg shadow-inner shadow-black/50",children:[((m=r==null?void 0:r.invites)==null?void 0:m.length)||0," Member",((u=r==null?void 0:r.invites)==null?void 0:u.length)!==1&&"s"]})]}),r!=null&&r.invites&&r.invites.length>0?e.jsx("div",{className:"divide-y divide-gray-800",children:r.invites.map(x=>e.jsxs("div",{className:"p-6 flex items-center justify-between hover:bg-white/[0.02] transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center font-bold text-lg border ${x.status==="subscribed"?"bg-blue-500/10 border-blue-500/30 text-blue-400":"bg-[#0f1115] border-gray-700 text-gray-400 shadow-inner"}`,children:x.email.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-medium mb-1",children:x.email}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Joined ",new Date(x.date).toLocaleDateString()]})]})]}),e.jsx("div",{children:x.status==="subscribed"?e.jsxs("span",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs font-bold bg-blue-500/10 text-blue-400 border border-blue-500/20 shadow-[0_0_10px_rgba(59,130,246,0.1)]",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),"Subscribed"]}):e.jsxs("span",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs font-bold bg-[#0f1115] text-gray-400 border border-gray-700",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-500 shadow-inner"})," Pending Upgrades"]})})]},x.id))}):e.jsxs("div",{className:"p-16 text-center text-gray-500 flex flex-col items-center",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-900 rounded-full flex items-center justify-center mb-6 shadow-inner border border-gray-800",children:e.jsx(At,{className:"w-10 h-10 text-gray-700"})}),e.jsx("h4",{className:"text-xl font-medium text-gray-300 mb-2",children:"Network is Empty"}),e.jsx("p",{className:"text-sm max-w-sm",children:"Share your invite link above to start adding friends and unlocking your free Pro months."})]})]})]})},Qf=Math.cos,No=Math.sin,da=Math.sqrt,So=Math.PI,rl=2*So,Ic=Math.PI,Tc=2*Ic,vn=1e-6,ow=Tc-vn;function Zf(t){this._+=t[0];for(let r=1,a=t.length;r<a;++r)this._+=arguments[r]+t[r]}function lw(t){let r=Math.floor(t);if(!(r>=0))throw new Error(`invalid digits: ${t}`);if(r>15)return Zf;const a=10**r;return function(n){this._+=n[0];for(let s=1,i=n.length;s<i;++s)this._+=Math.round(arguments[s]*a)/a+n[s]}}class cw{constructor(r){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=r==null?Zf:lw(r)}moveTo(r,a){this._append`M${this._x0=this._x1=+r},${this._y0=this._y1=+a}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(r,a){this._append`L${this._x1=+r},${this._y1=+a}`}quadraticCurveTo(r,a,n,s){this._append`Q${+r},${+a},${this._x1=+n},${this._y1=+s}`}bezierCurveTo(r,a,n,s,i,o){this._append`C${+r},${+a},${+n},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(r,a,n,s,i){if(r=+r,a=+a,n=+n,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,c=this._y1,d=n-r,m=s-a,u=o-r,x=c-a,h=u*u+x*x;if(this._x1===null)this._append`M${this._x1=r},${this._y1=a}`;else if(h>vn)if(!(Math.abs(x*d-m*u)>vn)||!i)this._append`L${this._x1=r},${this._y1=a}`;else{let f=n-o,g=s-c,b=d*d+m*m,p=f*f+g*g,v=Math.sqrt(b),y=Math.sqrt(h),j=i*Math.tan((Ic-Math.acos((b+h-p)/(2*v*y)))/2),S=j/y,N=j/v;Math.abs(S-1)>vn&&this._append`L${r+S*u},${a+S*x}`,this._append`A${i},${i},0,0,${+(x*f>u*g)},${this._x1=r+N*d},${this._y1=a+N*m}`}}arc(r,a,n,s,i,o){if(r=+r,a=+a,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let c=n*Math.cos(s),d=n*Math.sin(s),m=r+c,u=a+d,x=1^o,h=o?s-i:i-s;this._x1===null?this._append`M${m},${u}`:(Math.abs(this._x1-m)>vn||Math.abs(this._y1-u)>vn)&&this._append`L${m},${u}`,n&&(h<0&&(h=h%Tc+Tc),h>ow?this._append`A${n},${n},0,1,${x},${r-c},${a-d}A${n},${n},0,1,${x},${this._x1=m},${this._y1=u}`:h>vn&&this._append`A${n},${n},0,${+(h>=Ic)},${x},${this._x1=r+n*Math.cos(i)},${this._y1=a+n*Math.sin(i)}`)}rect(r,a,n,s){this._append`M${this._x0=this._x1=+r},${this._y0=this._y1=+a}h${n=+n}v${+s}h${-n}Z`}toString(){return this._}}function Nu(t){let r=3;return t.digits=function(a){if(!arguments.length)return r;if(a==null)r=null;else{const n=Math.floor(a);if(!(n>=0))throw new RangeError(`invalid digits: ${a}`);r=n}return t},()=>new cw(r)}function eg(t){this._context=t}eg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r);break}}};function al(t){return new eg(t)}function tg(t){return t[0]}function rg(t){return t[1]}function ag(t,r){var a=zt(!0),n=null,s=al,i=null,o=Nu(c);t=typeof t=="function"?t:t===void 0?tg:zt(t),r=typeof r=="function"?r:r===void 0?rg:zt(r);function c(d){var m,u=(d=ff(d)).length,x,h=!1,f;for(n==null&&(i=s(f=o())),m=0;m<=u;++m)!(m<u&&a(x=d[m],m,d))===h&&((h=!h)?i.lineStart():i.lineEnd()),h&&i.point(+t(x,m,d),+r(x,m,d));if(f)return i=null,f+""||null}return c.x=function(d){return arguments.length?(t=typeof d=="function"?d:zt(+d),c):t},c.y=function(d){return arguments.length?(r=typeof d=="function"?d:zt(+d),c):r},c.defined=function(d){return arguments.length?(a=typeof d=="function"?d:zt(!!d),c):a},c.curve=function(d){return arguments.length?(s=d,n!=null&&(i=s(n)),c):s},c.context=function(d){return arguments.length?(d==null?n=i=null:i=s(n=d),c):n},c}function Hi(t,r,a){var n=null,s=zt(!0),i=null,o=al,c=null,d=Nu(m);t=typeof t=="function"?t:t===void 0?tg:zt(+t),r=typeof r=="function"?r:r===void 0?zt(0):zt(+r),a=typeof a=="function"?a:a===void 0?rg:zt(+a);function m(x){var h,f,g,b=(x=ff(x)).length,p,v=!1,y,j=new Array(b),S=new Array(b);for(i==null&&(c=o(y=d())),h=0;h<=b;++h){if(!(h<b&&s(p=x[h],h,x))===v)if(v=!v)f=h,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),g=h-1;g>=f;--g)c.point(j[g],S[g]);c.lineEnd(),c.areaEnd()}v&&(j[h]=+t(p,h,x),S[h]=+r(p,h,x),c.point(n?+n(p,h,x):j[h],a?+a(p,h,x):S[h]))}if(y)return c=null,y+""||null}function u(){return ag().defined(s).curve(o).context(i)}return m.x=function(x){return arguments.length?(t=typeof x=="function"?x:zt(+x),n=null,m):t},m.x0=function(x){return arguments.length?(t=typeof x=="function"?x:zt(+x),m):t},m.x1=function(x){return arguments.length?(n=x==null?null:typeof x=="function"?x:zt(+x),m):n},m.y=function(x){return arguments.length?(r=typeof x=="function"?x:zt(+x),a=null,m):r},m.y0=function(x){return arguments.length?(r=typeof x=="function"?x:zt(+x),m):r},m.y1=function(x){return arguments.length?(a=x==null?null:typeof x=="function"?x:zt(+x),m):a},m.lineX0=m.lineY0=function(){return u().x(t).y(r)},m.lineY1=function(){return u().x(t).y(a)},m.lineX1=function(){return u().x(n).y(r)},m.defined=function(x){return arguments.length?(s=typeof x=="function"?x:zt(!!x),m):s},m.curve=function(x){return arguments.length?(o=x,i!=null&&(c=o(i)),m):o},m.context=function(x){return arguments.length?(x==null?i=c=null:c=o(i=x),m):i},m}class ng{constructor(r,a){this._context=r,this._x=a}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(r,a){switch(r=+r,a=+a,this._point){case 0:{this._point=1,this._line?this._context.lineTo(r,a):this._context.moveTo(r,a);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+r)/2,this._y0,this._x0,a,r,a):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+a)/2,r,this._y0,r,a);break}}this._x0=r,this._y0=a}}function dw(t){return new ng(t,!0)}function uw(t){return new ng(t,!1)}const Su={draw(t,r){const a=da(r/So);t.moveTo(a,0),t.arc(0,0,a,0,rl)}},mw={draw(t,r){const a=da(r/5)/2;t.moveTo(-3*a,-a),t.lineTo(-a,-a),t.lineTo(-a,-3*a),t.lineTo(a,-3*a),t.lineTo(a,-a),t.lineTo(3*a,-a),t.lineTo(3*a,a),t.lineTo(a,a),t.lineTo(a,3*a),t.lineTo(-a,3*a),t.lineTo(-a,a),t.lineTo(-3*a,a),t.closePath()}},sg=da(1/3),xw=sg*2,hw={draw(t,r){const a=da(r/xw),n=a*sg;t.moveTo(0,-a),t.lineTo(n,0),t.lineTo(0,a),t.lineTo(-n,0),t.closePath()}},fw={draw(t,r){const a=da(r),n=-a/2;t.rect(n,n,a,a)}},gw=.8908130915292852,ig=No(So/10)/No(7*So/10),pw=No(rl/10)*ig,bw=-Qf(rl/10)*ig,vw={draw(t,r){const a=da(r*gw),n=pw*a,s=bw*a;t.moveTo(0,-a),t.lineTo(n,s);for(let i=1;i<5;++i){const o=rl*i/5,c=Qf(o),d=No(o);t.lineTo(d*a,-c*a),t.lineTo(c*n-d*s,d*n+c*s)}t.closePath()}},Kl=da(3),yw={draw(t,r){const a=-da(r/(Kl*3));t.moveTo(0,a*2),t.lineTo(-Kl*a,-a),t.lineTo(Kl*a,-a),t.closePath()}},Gr=-.5,Kr=da(3)/2,Mc=1/da(12),jw=(Mc/2+1)*3,ww={draw(t,r){const a=da(r/jw),n=a/2,s=a*Mc,i=n,o=a*Mc+a,c=-i,d=o;t.moveTo(n,s),t.lineTo(i,o),t.lineTo(c,d),t.lineTo(Gr*n-Kr*s,Kr*n+Gr*s),t.lineTo(Gr*i-Kr*o,Kr*i+Gr*o),t.lineTo(Gr*c-Kr*d,Kr*c+Gr*d),t.lineTo(Gr*n+Kr*s,Gr*s-Kr*n),t.lineTo(Gr*i+Kr*o,Gr*o-Kr*i),t.lineTo(Gr*c+Kr*d,Gr*d-Kr*c),t.closePath()}};function Nw(t,r){let a=null,n=Nu(s);t=typeof t=="function"?t:zt(t||Su),r=typeof r=="function"?r:zt(r===void 0?64:+r);function s(){let i;if(a||(a=i=n()),t.apply(this,arguments).draw(a,+r.apply(this,arguments)),i)return a=null,i+""||null}return s.type=function(i){return arguments.length?(t=typeof i=="function"?i:zt(i),s):t},s.size=function(i){return arguments.length?(r=typeof i=="function"?i:zt(+i),s):r},s.context=function(i){return arguments.length?(a=i??null,s):a},s}function Co(){}function _o(t,r,a){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+a)/6)}function og(t){this._context=t}og.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:_o(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:_o(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function Sw(t){return new og(t)}function lg(t){this._context=t}lg.prototype={areaStart:Co,areaEnd:Co,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:_o(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function Cw(t){return new lg(t)}function cg(t){this._context=t}cg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var a=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(a,n):this._context.moveTo(a,n);break;case 3:this._point=4;default:_o(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function _w(t){return new cg(t)}function dg(t){this._context=t}dg.prototype={areaStart:Co,areaEnd:Co,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,r){t=+t,r=+r,this._point?this._context.lineTo(t,r):(this._point=1,this._context.moveTo(t,r))}};function kw(t){return new dg(t)}function Gm(t){return t<0?-1:1}function Km(t,r,a){var n=t._x1-t._x0,s=r-t._x1,i=(t._y1-t._y0)/(n||s<0&&-0),o=(a-t._y1)/(s||n<0&&-0),c=(i*s+o*n)/(n+s);return(Gm(i)+Gm(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(c))||0}function qm(t,r){var a=t._x1-t._x0;return a?(3*(t._y1-t._y0)/a-r)/2:r}function ql(t,r,a){var n=t._x0,s=t._y0,i=t._x1,o=t._y1,c=(i-n)/3;t._context.bezierCurveTo(n+c,s+c*r,i-c,o-c*a,i,o)}function ko(t){this._context=t}ko.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ql(this,this._t0,qm(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){var a=NaN;if(t=+t,r=+r,!(t===this._x1&&r===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,ql(this,qm(this,a=Km(this,t,r)),a);break;default:ql(this,this._t0,a=Km(this,t,r));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r,this._t0=a}}};function ug(t){this._context=new mg(t)}(ug.prototype=Object.create(ko.prototype)).point=function(t,r){ko.prototype.point.call(this,r,t)};function mg(t){this._context=t}mg.prototype={moveTo:function(t,r){this._context.moveTo(r,t)},closePath:function(){this._context.closePath()},lineTo:function(t,r){this._context.lineTo(r,t)},bezierCurveTo:function(t,r,a,n,s,i){this._context.bezierCurveTo(r,t,n,a,i,s)}};function Pw(t){return new ko(t)}function $w(t){return new ug(t)}function xg(t){this._context=t}xg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,r=this._y,a=t.length;if(a)if(this._line?this._context.lineTo(t[0],r[0]):this._context.moveTo(t[0],r[0]),a===2)this._context.lineTo(t[1],r[1]);else for(var n=Xm(t),s=Xm(r),i=0,o=1;o<a;++i,++o)this._context.bezierCurveTo(n[0][i],s[0][i],n[1][i],s[1][i],t[o],r[o]);(this._line||this._line!==0&&a===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,r){this._x.push(+t),this._y.push(+r)}};function Xm(t){var r,a=t.length-1,n,s=new Array(a),i=new Array(a),o=new Array(a);for(s[0]=0,i[0]=2,o[0]=t[0]+2*t[1],r=1;r<a-1;++r)s[r]=1,i[r]=4,o[r]=4*t[r]+2*t[r+1];for(s[a-1]=2,i[a-1]=7,o[a-1]=8*t[a-1]+t[a],r=1;r<a;++r)n=s[r]/i[r-1],i[r]-=n,o[r]-=n*o[r-1];for(s[a-1]=o[a-1]/i[a-1],r=a-2;r>=0;--r)s[r]=(o[r]-s[r+1])/i[r];for(i[a-1]=(t[a]+s[a-1])/2,r=0;r<a-1;++r)i[r]=2*t[r+1]-s[r+1];return[s,i]}function Ew(t){return new xg(t)}function nl(t,r){this._context=t,this._t=r}nl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var a=this._x*(1-this._t)+t*this._t;this._context.lineTo(a,this._y),this._context.lineTo(a,r)}break}}this._x=t,this._y=r}};function Aw(t){return new nl(t,.5)}function Ow(t){return new nl(t,0)}function Iw(t){return new nl(t,1)}var Tw=["type","size","sizeType"];function Rc(){return Rc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Rc.apply(null,arguments)}function Ym(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Jm(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Ym(Object(a),!0).forEach(function(n){Mw(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Ym(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function Mw(t,r,a){return(r=Rw(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function Rw(t){var r=Lw(t,"string");return typeof r=="symbol"?r:r+""}function Lw(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Dw(t,r){if(t==null)return{};var a,n,s=zw(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function zw(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var hg={symbolCircle:Su,symbolCross:mw,symbolDiamond:hw,symbolSquare:fw,symbolStar:vw,symbolTriangle:yw,symbolWye:ww},Fw=Math.PI/180,Bw=t=>{var r="symbol".concat(au(t));return hg[r]||Su},Hw=(t,r,a)=>{if(r==="area")return t;switch(a){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var n=18*Fw;return 1.25*t*t*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Ww=(t,r)=>{hg["symbol".concat(au(t))]=r},Cu=t=>{var{type:r="circle",size:a=64,sizeType:n="area"}=t,s=Dw(t,Tw),i=Jm(Jm({},s),{},{type:r,size:a,sizeType:n}),o="circle";typeof r=="string"&&(o=r);var c=()=>{var h=Bw(o),f=Nw().type(h).size(Hw(a,n,o)),g=f();if(g!==null)return g},{className:d,cx:m,cy:u}=i,x=sn(i);return nt(m)&&nt(u)&&nt(a)?l.createElement("path",Rc({},x,{className:Ot("recharts-symbols",d),transform:"translate(".concat(m,", ").concat(u,")"),d:c()})):null};Cu.registerSymbol=Ww;function Po(){return Po=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Po.apply(null,arguments)}function Qm(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Uw(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Qm(Object(a),!0).forEach(function(n){Vw(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Qm(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function Vw(t,r,a){return(r=Gw(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function Gw(t){var r=Kw(t,"string");return typeof r=="symbol"?r:r+""}function Kw(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var Yr=32,qw={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function Xw(t){var{data:r,iconType:a,inactiveColor:n}=t,s=Yr/2,i=Yr/6,o=Yr/3,c=r.inactive?n:r.color,d=a??r.type;if(d==="none")return null;if(d==="plainline"){var m;return l.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:(m=r.payload)===null||m===void 0?void 0:m.strokeDasharray,x1:0,y1:s,x2:Yr,y2:s,className:"recharts-legend-icon"})}if(d==="line")return l.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(s,"h").concat(o,`
            A`).concat(i,",").concat(i,",0,1,1,").concat(2*o,",").concat(s,`
            H`).concat(Yr,"M").concat(2*o,",").concat(s,`
            A`).concat(i,",").concat(i,",0,1,1,").concat(o,",").concat(s),className:"recharts-legend-icon"});if(d==="rect")return l.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Yr/8,"h").concat(Yr,"v").concat(Yr*3/4,"h").concat(-Yr,"z"),className:"recharts-legend-icon"});if(l.isValidElement(r.legendIcon)){var u=Uw({},r);return delete u.legendIcon,l.cloneElement(r.legendIcon,u)}return l.createElement(Cu,{fill:c,cx:s,cy:s,size:Yr,sizeType:"diameter",type:d})}function Yw(t){var{payload:r,iconSize:a,layout:n,formatter:s,inactiveColor:i,iconType:o}=t,c={x:0,y:0,width:Yr,height:Yr},d={display:n==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return r.map((u,x)=>{var h=u.formatter||s,f=Ot({"recharts-legend-item":!0,["legend-item-".concat(x)]:!0,inactive:u.inactive});if(u.type==="none")return null;var g=u.inactive?i:u.color,b=h?h(u.value,u,x):u.value;return l.createElement("li",Po({className:f,style:d,key:"legend-item-".concat(x)},Ps(t,u,x)),l.createElement(ry,{width:a,height:a,viewBox:c,style:m,"aria-label":"".concat(b," legend icon")},l.createElement(Xw,{data:u,iconType:o,inactiveColor:i})),l.createElement("span",{className:"recharts-legend-item-text",style:{color:g}},b))})}var Jw=t=>{var r=hr(t,qw),{payload:a,layout:n,align:s}=r;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?s:"left"};return l.createElement("ul",{className:"recharts-default-legend",style:i},l.createElement(Yw,Po({},r,{payload:a})))},fg={},gg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a,n){const s=new Map;for(let i=0;i<a.length;i++){const o=a[i],c=n(o);s.has(c)||s.set(c,o)}return Array.from(s.values())}t.uniqBy=r})(gg);var Pi={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){return a}t.identity=r})(Pi);var pg={},bg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){return typeof a=="object"&&a!==null}t.isObjectLike=r})(bg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=ay,a=bg;function n(s){return a.isObjectLike(s)&&r.isArrayLike(s)}t.isArrayLikeObject=n})(pg);var sl={},vg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=gf;function a(n){return function(s){return r.get(s,n)}}t.property=a})(vg);var yg={},_u={},jg={},ku={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){return a==null||typeof a!="object"&&typeof a!="function"}t.isPrimitive=r})(ku);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=ny,a=ku,n=sy;function s(u,x,h){return typeof h!="function"?s(u,x,()=>{}):i(u,x,function f(g,b,p,v,y,j){const S=h(g,b,p,v,y,j);return S!==void 0?!!S:i(g,b,f,j)},new Map)}function i(u,x,h,f){if(x===u)return!0;switch(typeof x){case"object":return o(u,x,h,f);case"function":return Object.keys(x).length>0?i(u,{...x},h,f):n.eq(u,x);default:return r.isObject(u)?typeof x=="string"?x==="":!0:n.eq(u,x)}}function o(u,x,h,f){if(x==null)return!0;if(Array.isArray(x))return d(u,x,h,f);if(x instanceof Map)return c(u,x,h,f);if(x instanceof Set)return m(u,x,h,f);const g=Object.keys(x);if(u==null||a.isPrimitive(u))return g.length===0;if(g.length===0)return!0;if(f!=null&&f.has(x))return f.get(x)===u;f==null||f.set(x,u);try{for(let b=0;b<g.length;b++){const p=g[b];if(!a.isPrimitive(u)&&!(p in u)||x[p]===void 0&&u[p]!==void 0||x[p]===null&&u[p]!==null||!h(u[p],x[p],p,u,x,f))return!1}return!0}finally{f==null||f.delete(x)}}function c(u,x,h,f){if(x.size===0)return!0;if(!(u instanceof Map))return!1;for(const[g,b]of x.entries()){const p=u.get(g);if(h(p,b,g,u,x,f)===!1)return!1}return!0}function d(u,x,h,f){if(x.length===0)return!0;if(!Array.isArray(u))return!1;const g=new Set;for(let b=0;b<x.length;b++){const p=x[b];let v=!1;for(let y=0;y<u.length;y++){if(g.has(y))continue;const j=u[y];let S=!1;if(h(j,p,b,u,x,f)&&(S=!0),S){g.add(y),v=!0;break}}if(!v)return!1}return!0}function m(u,x,h,f){return x.size===0?!0:u instanceof Set?d([...u],[...x],h,f):!1}t.isMatchWith=s,t.isSetMatch=m})(jg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=jg;function a(n,s){return r.isMatchWith(n,s,()=>{})}t.isMatch=a})(_u);var wg={},Pu={},Ng={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){return Object.getOwnPropertySymbols(a).filter(n=>Object.prototype.propertyIsEnumerable.call(a,n))}t.getSymbols=r})(Ng);var $u={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){return a==null?a===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(a)}t.getTag=r})($u);var Eu={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r="[object RegExp]",a="[object String]",n="[object Number]",s="[object Boolean]",i="[object Arguments]",o="[object Symbol]",c="[object Date]",d="[object Map]",m="[object Set]",u="[object Array]",x="[object Function]",h="[object ArrayBuffer]",f="[object Object]",g="[object Error]",b="[object DataView]",p="[object Uint8Array]",v="[object Uint8ClampedArray]",y="[object Uint16Array]",j="[object Uint32Array]",S="[object BigUint64Array]",N="[object Int8Array]",w="[object Int16Array]",_="[object Int32Array]",P="[object BigInt64Array]",O="[object Float32Array]",T="[object Float64Array]";t.argumentsTag=i,t.arrayBufferTag=h,t.arrayTag=u,t.bigInt64ArrayTag=P,t.bigUint64ArrayTag=S,t.booleanTag=s,t.dataViewTag=b,t.dateTag=c,t.errorTag=g,t.float32ArrayTag=O,t.float64ArrayTag=T,t.functionTag=x,t.int16ArrayTag=w,t.int32ArrayTag=_,t.int8ArrayTag=N,t.mapTag=d,t.numberTag=n,t.objectTag=f,t.regexpTag=r,t.setTag=m,t.stringTag=a,t.symbolTag=o,t.uint16ArrayTag=y,t.uint32ArrayTag=j,t.uint8ArrayTag=p,t.uint8ClampedArrayTag=v})(Eu);var Sg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)}t.isTypedArray=r})(Sg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=Ng,a=$u,n=Eu,s=ku,i=Sg;function o(u,x){return c(u,void 0,u,new Map,x)}function c(u,x,h,f=new Map,g=void 0){const b=g==null?void 0:g(u,x,h,f);if(b!==void 0)return b;if(s.isPrimitive(u))return u;if(f.has(u))return f.get(u);if(Array.isArray(u)){const p=new Array(u.length);f.set(u,p);for(let v=0;v<u.length;v++)p[v]=c(u[v],v,h,f,g);return Object.hasOwn(u,"index")&&(p.index=u.index),Object.hasOwn(u,"input")&&(p.input=u.input),p}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const p=new RegExp(u.source,u.flags);return p.lastIndex=u.lastIndex,p}if(u instanceof Map){const p=new Map;f.set(u,p);for(const[v,y]of u)p.set(v,c(y,v,h,f,g));return p}if(u instanceof Set){const p=new Set;f.set(u,p);for(const v of u)p.add(c(v,void 0,h,f,g));return p}if(typeof Buffer<"u"&&Buffer.isBuffer(u))return u.subarray();if(i.isTypedArray(u)){const p=new(Object.getPrototypeOf(u)).constructor(u.length);f.set(u,p);for(let v=0;v<u.length;v++)p[v]=c(u[v],v,h,f,g);return p}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const p=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return f.set(u,p),d(p,u,h,f,g),p}if(typeof File<"u"&&u instanceof File){const p=new File([u],u.name,{type:u.type});return f.set(u,p),d(p,u,h,f,g),p}if(typeof Blob<"u"&&u instanceof Blob){const p=new Blob([u],{type:u.type});return f.set(u,p),d(p,u,h,f,g),p}if(u instanceof Error){const p=new u.constructor;return f.set(u,p),p.message=u.message,p.name=u.name,p.stack=u.stack,p.cause=u.cause,d(p,u,h,f,g),p}if(u instanceof Boolean){const p=new Boolean(u.valueOf());return f.set(u,p),d(p,u,h,f,g),p}if(u instanceof Number){const p=new Number(u.valueOf());return f.set(u,p),d(p,u,h,f,g),p}if(u instanceof String){const p=new String(u.valueOf());return f.set(u,p),d(p,u,h,f,g),p}if(typeof u=="object"&&m(u)){const p=Object.create(Object.getPrototypeOf(u));return f.set(u,p),d(p,u,h,f,g),p}return u}function d(u,x,h=u,f,g){const b=[...Object.keys(x),...r.getSymbols(x)];for(let p=0;p<b.length;p++){const v=b[p],y=Object.getOwnPropertyDescriptor(u,v);(y==null||y.writable)&&(u[v]=c(x[v],v,h,f,g))}}function m(u){switch(a.getTag(u)){case n.argumentsTag:case n.arrayTag:case n.arrayBufferTag:case n.dataViewTag:case n.booleanTag:case n.dateTag:case n.float32ArrayTag:case n.float64ArrayTag:case n.int8ArrayTag:case n.int16ArrayTag:case n.int32ArrayTag:case n.mapTag:case n.numberTag:case n.objectTag:case n.regexpTag:case n.setTag:case n.stringTag:case n.symbolTag:case n.uint8ArrayTag:case n.uint8ClampedArrayTag:case n.uint16ArrayTag:case n.uint32ArrayTag:return!0;default:return!1}}t.cloneDeepWith=o,t.cloneDeepWithImpl=c,t.copyProperties=d})(Pu);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=Pu;function a(n){return r.cloneDeepWithImpl(n,void 0,n,new Map,void 0)}t.cloneDeep=a})(wg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=_u,a=wg;function n(s){return s=a.cloneDeep(s),i=>r.isMatch(i,s)}t.matches=n})(yg);var Cg={},_g={},kg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=Pu,a=Eu;function n(s,i){return r.cloneDeepWith(s,(o,c,d,m)=>{const u=i==null?void 0:i(o,c,d,m);if(u!==void 0)return u;if(typeof s=="object")switch(Object.prototype.toString.call(s)){case a.numberTag:case a.stringTag:case a.booleanTag:{const x=new s.constructor(s==null?void 0:s.valueOf());return r.copyProperties(x,s),x}case a.argumentsTag:{const x={};return r.copyProperties(x,s),x.length=s.length,x[Symbol.iterator]=s[Symbol.iterator],x}default:return}})}t.cloneDeepWith=n})(kg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=kg;function a(n){return r.cloneDeepWith(n)}t.cloneDeep=a})(_g);var Pg={},$g={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=$u;function a(n){return n!==null&&typeof n=="object"&&r.getTag(n)==="[object Arguments]"}t.isArguments=a})($g);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=iy,a=ly,n=$g,s=oy;function i(o,c){let d;if(Array.isArray(c)?d=c:typeof c=="string"&&r.isDeepKey(c)&&(o==null?void 0:o[c])==null?d=s.toPath(c):d=[c],d.length===0)return!1;let m=o;for(let u=0;u<d.length;u++){const x=d[u];if((m==null||!Object.hasOwn(m,x))&&!((Array.isArray(m)||n.isArguments(m))&&a.isIndex(x)&&x<m.length))return!1;m=m[x]}return!0}t.has=i})(Pg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=_u,a=cy,n=_g,s=gf,i=Pg;function o(c,d){switch(typeof c){case"object":{Object.is(c==null?void 0:c.valueOf(),-0)&&(c="-0");break}case"number":{c=a.toKey(c);break}}return d=n.cloneDeep(d),function(m){const u=s.get(m,c);return u===void 0?i.has(m,c):d===void 0?u===void 0:r.isMatch(u,d)}}t.matchesProperty=o})(Cg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=Pi,a=vg,n=yg,s=Cg;function i(o){if(o==null)return r.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?s.matchesProperty(o[0],o[1]):n.matches(o);case"string":case"symbol":case"number":return a.property(o)}}t.iteratee=i})(sl);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=gg,a=Pi,n=pg,s=sl;function i(o,c=a.identity){return n.isArrayLikeObject(o)?r.uniqBy(Array.from(o),s.iteratee(c)):[]}t.uniqBy=i})(fg);var Qw=fg.uniqBy;const Zm=Si(Qw);function Eg(t,r,a){return r===!0?Zm(t,a):typeof r=="function"?Zm(t,r):t}function Zw(){return xt(dy)}var Wi=1;function Ag(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[r,a]=l.useState({height:0,left:0,top:0,width:0}),n=l.useCallback(s=>{if(s!=null){var i=s.getBoundingClientRect(),o={height:i.height,left:i.left,top:i.top,width:i.width};(Math.abs(o.height-r.height)>Wi||Math.abs(o.left-r.left)>Wi||Math.abs(o.top-r.top)>Wi||Math.abs(o.width-r.width)>Wi)&&a({height:o.height,left:o.left,top:o.top,width:o.width})}},[r.width,r.height,r.top,r.left,...t]);return[r,n]}var eN=["contextPayload"];function Lc(){return Lc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Lc.apply(null,arguments)}function e0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function fs(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?e0(Object(a),!0).forEach(function(n){tN(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):e0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function tN(t,r,a){return(r=rN(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function rN(t){var r=aN(t,"string");return typeof r=="symbol"?r:r+""}function aN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function nN(t,r){if(t==null)return{};var a,n,s=sN(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function sN(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function iN(t){return t.value}function oN(t){var{contextPayload:r}=t,a=nN(t,eN),n=Eg(r,t.payloadUniqBy,iN),s=fs(fs({},a),{},{payload:n});return l.isValidElement(t.content)?l.cloneElement(t.content,s):typeof t.content=="function"?l.createElement(t.content,s):l.createElement(Jw,s)}function lN(t,r,a,n,s,i){var{layout:o,align:c,verticalAlign:d}=r,m,u;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(c==="center"&&o==="vertical"?m={left:((n||0)-i.width)/2}:m=c==="right"?{right:a&&a.right||0}:{left:a&&a.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(d==="middle"?u={top:((s||0)-i.height)/2}:u=d==="bottom"?{bottom:a&&a.bottom||0}:{top:a&&a.top||0}),fs(fs({},m),u)}function cN(t){var r=ka();return l.useEffect(()=>{r(xy(t))},[r,t]),null}function dN(t){var r=ka();return l.useEffect(()=>(r(wm(t)),()=>{r(wm({width:0,height:0}))}),[r,t]),null}function uN(t,r,a,n){return t==="vertical"&&nt(r)?{height:r}:t==="horizontal"?{width:a||n}:null}var mN={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function Og(t){var r=hr(t,mN),a=Zw(),n=uy(),s=my(),{width:i,height:o,wrapperStyle:c,portal:d}=r,[m,u]=Ag([a]),x=pf(),h=bf();if(x==null||h==null)return null;var f=x-((s==null?void 0:s.left)||0)-((s==null?void 0:s.right)||0),g=uN(r.layout,o,i,f),b=d?c:fs(fs({position:"absolute",width:(g==null?void 0:g.width)||i||"auto",height:(g==null?void 0:g.height)||o||"auto"},lN(c,r,s,x,h,m)),c),p=d??n;if(p==null||a==null)return null;var v=l.createElement("div",{className:"recharts-legend-wrapper",style:b,ref:u},l.createElement(cN,{layout:r.layout,align:r.align,verticalAlign:r.verticalAlign,itemSorter:r.itemSorter}),!d&&l.createElement(dN,{width:m.width,height:m.height}),l.createElement(oN,Lc({},r,g,{margin:s,chartWidth:x,chartHeight:h,contextPayload:a})));return An.createPortal(v,p)}Og.displayName="Legend";function Dc(){return Dc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Dc.apply(null,arguments)}function t0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Xl(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?t0(Object(a),!0).forEach(function(n){xN(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):t0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function xN(t,r,a){return(r=hN(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function hN(t){var r=fN(t,"string");return typeof r=="symbol"?r:r+""}function fN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function gN(t){return Array.isArray(t)&&yo(t[0])&&yo(t[1])?t.join(" ~ "):t}var pN=t=>{var{separator:r=" : ",contentStyle:a={},itemStyle:n={},labelStyle:s={},payload:i,formatter:o,itemSorter:c,wrapperClassName:d,labelClassName:m,label:u,labelFormatter:x,accessibilityLayer:h=!1}=t,f=()=>{if(i&&i.length){var N={padding:0,margin:0},w=(c?hy(i,c):i).map((_,P)=>{if(_.type==="none")return null;var O=_.formatter||o||gN,{value:T,name:k}=_,$=T,C=k;if(O){var A=O(T,k,_,P,i);if(Array.isArray(A))[$,C]=A;else if(A!=null)$=A;else return null}var E=Xl({display:"block",paddingTop:4,paddingBottom:4,color:_.color||"#000"},n);return l.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(P),style:E},yo(C)?l.createElement("span",{className:"recharts-tooltip-item-name"},C):null,yo(C)?l.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,l.createElement("span",{className:"recharts-tooltip-item-value"},$),l.createElement("span",{className:"recharts-tooltip-item-unit"},_.unit||""))});return l.createElement("ul",{className:"recharts-tooltip-item-list",style:N},w)}return null},g=Xl({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),b=Xl({margin:0},s),p=!$s(u),v=p?u:"",y=Ot("recharts-default-tooltip",d),j=Ot("recharts-tooltip-label",m);p&&x&&i!==void 0&&i!==null&&(v=x(u,i));var S=h?{role:"status","aria-live":"assertive"}:{};return l.createElement("div",Dc({className:y,style:g},S),l.createElement("p",{className:j,style:b},l.isValidElement(v)?v:"".concat(v)),f())},Bs="recharts-tooltip-wrapper",bN={visibility:"hidden"};function vN(t){var{coordinate:r,translateX:a,translateY:n}=t;return Ot(Bs,{["".concat(Bs,"-right")]:nt(a)&&r&&nt(r.x)&&a>=r.x,["".concat(Bs,"-left")]:nt(a)&&r&&nt(r.x)&&a<r.x,["".concat(Bs,"-bottom")]:nt(n)&&r&&nt(r.y)&&n>=r.y,["".concat(Bs,"-top")]:nt(n)&&r&&nt(r.y)&&n<r.y})}function r0(t){var{allowEscapeViewBox:r,coordinate:a,key:n,offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:c,viewBox:d,viewBoxDimension:m}=t;if(i&&nt(i[n]))return i[n];var u=a[n]-c-(s>0?s:0),x=a[n]+s;if(r[n])return o[n]?u:x;var h=d[n];if(h==null)return 0;if(o[n]){var f=u,g=h;return f<g?Math.max(x,h):Math.max(u,h)}if(m==null)return 0;var b=x+c,p=h+m;return b>p?Math.max(u,h):Math.max(x,h)}function yN(t){var{translateX:r,translateY:a,useTranslate3d:n}=t;return{transform:n?"translate3d(".concat(r,"px, ").concat(a,"px, 0)"):"translate(".concat(r,"px, ").concat(a,"px)")}}function jN(t){var{allowEscapeViewBox:r,coordinate:a,offsetTopLeft:n,position:s,reverseDirection:i,tooltipBox:o,useTranslate3d:c,viewBox:d}=t,m,u,x;return o.height>0&&o.width>0&&a?(u=r0({allowEscapeViewBox:r,coordinate:a,key:"x",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:d,viewBoxDimension:d.width}),x=r0({allowEscapeViewBox:r,coordinate:a,key:"y",offsetTopLeft:n,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:d,viewBoxDimension:d.height}),m=yN({translateX:u,translateY:x,useTranslate3d:c})):m=bN,{cssProperties:m,cssClasses:vN({translateX:u,translateY:x,coordinate:a})}}function a0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Ui(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?a0(Object(a),!0).forEach(function(n){zc(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):a0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function zc(t,r,a){return(r=wN(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function wN(t){var r=NN(t,"string");return typeof r=="symbol"?r:r+""}function NN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class SN extends l.PureComponent{constructor(){super(...arguments),zc(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),zc(this,"handleKeyDown",r=>{if(r.key==="Escape"){var a,n,s,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(a=(n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==null&&a!==void 0?a:0,y:(s=(i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==null&&s!==void 0?s:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var r,a;this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:r,allowEscapeViewBox:a,animationDuration:n,animationEasing:s,children:i,coordinate:o,hasPayload:c,isAnimationActive:d,offset:m,position:u,reverseDirection:x,useTranslate3d:h,viewBox:f,wrapperStyle:g,lastBoundingBox:b,innerRef:p,hasPortalFromProps:v}=this.props,{cssClasses:y,cssProperties:j}=jN({allowEscapeViewBox:a,coordinate:o,offsetTopLeft:m,position:u,reverseDirection:x,tooltipBox:{height:b.height,width:b.width},useTranslate3d:h,viewBox:f}),S=v?{}:Ui(Ui({transition:d&&r?"transform ".concat(n,"ms ").concat(s):void 0},j),{},{pointerEvents:"none",visibility:!this.state.dismissed&&r&&c?"visible":"hidden",position:"absolute",top:0,left:0}),N=Ui(Ui({},S),{},{visibility:!this.state.dismissed&&r&&c?"visible":"hidden"},g);return l.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:N,ref:p},i)}}function Fc(){return Fc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Fc.apply(null,arguments)}function n0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function s0(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?n0(Object(a),!0).forEach(function(n){CN(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):n0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function CN(t,r,a){return(r=_N(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function _N(t){var r=kN(t,"string");return typeof r=="symbol"?r:r+""}function kN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var i0={curveBasisClosed:Cw,curveBasisOpen:_w,curveBasis:Sw,curveBumpX:dw,curveBumpY:uw,curveLinearClosed:kw,curveLinear:al,curveMonotoneX:Pw,curveMonotoneY:$w,curveNatural:Ew,curveStep:Aw,curveStepAfter:Iw,curveStepBefore:Ow},$o=t=>Ba(t.x)&&Ba(t.y),o0=t=>t.base!=null&&$o(t.base)&&$o(t),Hs=t=>t.x,Ws=t=>t.y,PN=(t,r)=>{if(typeof t=="function")return t;var a="curve".concat(au(t));return(a==="curveMonotone"||a==="curveBump")&&r?i0["".concat(a).concat(r==="vertical"?"Y":"X")]:i0[a]||al},$N=t=>{var{type:r="linear",points:a=[],baseLine:n,layout:s,connectNulls:i=!1}=t,o=PN(r,s),c=i?a.filter($o):a,d;if(Array.isArray(n)){var m=a.map((f,g)=>s0(s0({},f),{},{base:n[g]}));s==="vertical"?d=Hi().y(Ws).x1(Hs).x0(f=>f.base.x):d=Hi().x(Hs).y1(Ws).y0(f=>f.base.y);var u=d.defined(o0).curve(o),x=i?m.filter(o0):m;return u(x)}s==="vertical"&&nt(n)?d=Hi().y(Ws).x1(Hs).x0(n):nt(n)?d=Hi().x(Hs).y1(Ws).y0(n):d=ag().x(Hs).y(Ws);var h=d.defined($o).curve(o);return h(c)},ns=t=>{var{className:r,points:a,path:n,pathRef:s}=t,i=Zo();if((!a||!a.length)&&!n)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||i,connectNulls:t.connectNulls},c=a&&a.length?$N(o):n;return l.createElement("path",Fc({},Br(t),fy(t),{className:Ot("recharts-curve",r),d:c===null?void 0:c,ref:s}))},EN=["x","y","top","left","width","height","className"];function Bc(){return Bc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Bc.apply(null,arguments)}function l0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function AN(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?l0(Object(a),!0).forEach(function(n){ON(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):l0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function ON(t,r,a){return(r=IN(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function IN(t){var r=TN(t,"string");return typeof r=="symbol"?r:r+""}function TN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function MN(t,r){if(t==null)return{};var a,n,s=RN(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function RN(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var LN=(t,r,a,n,s,i)=>"M".concat(t,",").concat(s,"v").concat(n,"M").concat(i,",").concat(r,"h").concat(a),DN=t=>{var{x:r=0,y:a=0,top:n=0,left:s=0,width:i=0,height:o=0,className:c}=t,d=MN(t,EN),m=AN({x:r,y:a,top:n,left:s,width:i,height:o},d);return!nt(r)||!nt(a)||!nt(i)||!nt(o)||!nt(n)||!nt(s)?null:l.createElement("path",Bc({},sn(m),{className:Ot("recharts-cross",c),d:LN(r,a,i,o,n,s)}))};function zN(t,r,a,n){var s=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?r.x-s:a.left+.5,y:t==="horizontal"?a.top+.5:r.y-s,width:t==="horizontal"?n:a.width-1,height:t==="horizontal"?a.height-1:n}}var FN=["radius"],BN=["radius"],c0,d0,u0,m0,x0,h0,f0,g0,p0,b0;function v0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function y0(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?v0(Object(a),!0).forEach(function(n){HN(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):v0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function HN(t,r,a){return(r=WN(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function WN(t){var r=UN(t,"string");return typeof r=="symbol"?r:r+""}function UN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Eo(){return Eo=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Eo.apply(null,arguments)}function j0(t,r){if(t==null)return{};var a,n,s=VN(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function VN(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function ga(t,r){return r||(r=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))}var w0=(t,r,a,n,s)=>{var i=Yn(a),o=Yn(n),c=Math.min(Math.abs(i)/2,Math.abs(o)/2),d=o>=0?1:-1,m=i>=0?1:-1,u=o>=0&&i>=0||o<0&&i<0?1:0,x;if(c>0&&s instanceof Array){for(var h=[0,0,0,0],f=0,g=4;f<g;f++)h[f]=s[f]>c?c:s[f];x=Ft(c0||(c0=ga(["M",",",""])),t,r+d*h[0]),h[0]>0&&(x+=Ft(d0||(d0=ga(["A ",",",",0,0,",",",",",""])),h[0],h[0],u,t+m*h[0],r)),x+=Ft(u0||(u0=ga(["L ",",",""])),t+a-m*h[1],r),h[1]>0&&(x+=Ft(m0||(m0=ga(["A ",",",",0,0,",`,
        `,",",""])),h[1],h[1],u,t+a,r+d*h[1])),x+=Ft(x0||(x0=ga(["L ",",",""])),t+a,r+n-d*h[2]),h[2]>0&&(x+=Ft(h0||(h0=ga(["A ",",",",0,0,",`,
        `,",",""])),h[2],h[2],u,t+a-m*h[2],r+n)),x+=Ft(f0||(f0=ga(["L ",",",""])),t+m*h[3],r+n),h[3]>0&&(x+=Ft(g0||(g0=ga(["A ",",",",0,0,",`,
        `,",",""])),h[3],h[3],u,t,r+n-d*h[3])),x+="Z"}else if(c>0&&s===+s&&s>0){var b=Math.min(c,s);x=Ft(p0||(p0=ga(["M ",",",`
            A `,",",",0,0,",",",",",`
            L `,",",`
            A `,",",",0,0,",",",",",`
            L `,",",`
            A `,",",",0,0,",",",",",`
            L `,",",`
            A `,",",",0,0,",",",","," Z"])),t,r+d*b,b,b,u,t+m*b,r,t+a-m*b,r,b,b,u,t+a,r+d*b,t+a,r+n-d*b,b,b,u,t+a-m*b,r+n,t+m*b,r+n,b,b,u,t,r+n-d*b)}else x=Ft(b0||(b0=ga(["M ",","," h "," v "," h "," Z"])),t,r,a,n,-a);return x},N0={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ig=t=>{var r=hr(t,N0),a=l.useRef(null),[n,s]=l.useState(-1);l.useEffect(()=>{if(a.current&&a.current.getTotalLength)try{var F=a.current.getTotalLength();F&&s(F)}catch{}},[]);var{x:i,y:o,width:c,height:d,radius:m,className:u}=r,{animationEasing:x,animationDuration:h,animationBegin:f,isAnimationActive:g,isUpdateAnimationActive:b}=r,p=l.useRef(c),v=l.useRef(d),y=l.useRef(i),j=l.useRef(o),S=l.useMemo(()=>({x:i,y:o,width:c,height:d,radius:m}),[i,o,c,d,m]),N=Ci(S,"rectangle-");if(i!==+i||o!==+o||c!==+c||d!==+d||c===0||d===0)return null;var w=Ot("recharts-rectangle",u);if(!b){var _=sn(r),{radius:P}=_,O=j0(_,FN);return l.createElement("path",Eo({},O,{x:Yn(i),y:Yn(o),width:Yn(c),height:Yn(d),radius:typeof m=="number"?m:void 0,className:w,d:w0(i,o,c,d,m)}))}var T=p.current,k=v.current,$=y.current,C=j.current,A="0px ".concat(n===-1?1:n,"px"),E="".concat(n,"px 0px"),L=vf(["strokeDasharray"],h,typeof x=="string"?x:N0.animationEasing);return l.createElement(_i,{animationId:N,key:N,canBegin:n>0,duration:h,easing:x,isActive:b,begin:f},F=>{var D=Et(T,c,F),q=Et(k,d,F),Q=Et($,i,F),de=Et(C,o,F);a.current&&(p.current=D,v.current=q,y.current=Q,j.current=de);var H;g?F>0?H={transition:L,strokeDasharray:E}:H={strokeDasharray:A}:H={strokeDasharray:E};var se=sn(r),{radius:W}=se,le=j0(se,BN);return l.createElement("path",Eo({},le,{radius:typeof m=="number"?m:void 0,className:w,d:w0(Q,de,D,q,m),ref:a,style:y0(y0({},H),r.style)}))})};function Tg(t){var{cx:r,cy:a,radius:n,startAngle:s,endAngle:i}=t,o=mr(r,a,n,s),c=mr(r,a,n,i);return{points:[o,c],cx:r,cy:a,radius:n,startAngle:s,endAngle:i}}var S0,C0,_0,k0,P0,$0,E0;function Hc(){return Hc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Hc.apply(null,arguments)}function jn(t,r){return r||(r=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))}var GN=(t,r)=>{var a=Ma(r-t),n=Math.min(Math.abs(r-t),359.999);return a*n},Vi=t=>{var{cx:r,cy:a,radius:n,angle:s,sign:i,isExternal:o,cornerRadius:c,cornerIsExternal:d}=t,m=c*(o?1:-1)+n,u=Math.asin(c/m)/Nm,x=d?s:s+i*u,h=mr(r,a,m,x),f=mr(r,a,n,x),g=d?s-i*u:s,b=mr(r,a,m*Math.cos(u*Nm),g);return{center:h,circleTangency:f,lineTangency:b,theta:u}},Mg=t=>{var{cx:r,cy:a,innerRadius:n,outerRadius:s,startAngle:i,endAngle:o}=t,c=GN(i,o),d=i+c,m=mr(r,a,s,i),u=mr(r,a,s,d),x=Ft(S0||(S0=jn(["M ",",",`
    A `,",",`,0,
    `,",",`,
    `,",",`
  `])),m.x,m.y,s,s,+(Math.abs(c)>180),+(i>d),u.x,u.y);if(n>0){var h=mr(r,a,n,i),f=mr(r,a,n,d);x+=Ft(C0||(C0=jn(["L ",",",`
            A `,",",`,0,
            `,",",`,
            `,","," Z"])),f.x,f.y,n,n,+(Math.abs(c)>180),+(i<=d),h.x,h.y)}else x+=Ft(_0||(_0=jn(["L ",","," Z"])),r,a);return x},KN=t=>{var{cx:r,cy:a,innerRadius:n,outerRadius:s,cornerRadius:i,forceCornerRadius:o,cornerIsExternal:c,startAngle:d,endAngle:m}=t,u=Ma(m-d),{circleTangency:x,lineTangency:h,theta:f}=Vi({cx:r,cy:a,radius:s,angle:d,sign:u,cornerRadius:i,cornerIsExternal:c}),{circleTangency:g,lineTangency:b,theta:p}=Vi({cx:r,cy:a,radius:s,angle:m,sign:-u,cornerRadius:i,cornerIsExternal:c}),v=c?Math.abs(d-m):Math.abs(d-m)-f-p;if(v<0)return o?Ft(k0||(k0=jn(["M ",",",`
        a`,",",",0,0,1,",`,0
        a`,",",",0,0,1,",`,0
      `])),h.x,h.y,i,i,i*2,i,i,-i*2):Mg({cx:r,cy:a,innerRadius:n,outerRadius:s,startAngle:d,endAngle:m});var y=Ft(P0||(P0=jn(["M ",",",`
    A`,",",",0,0,",",",",",`
    A`,",",",0,",",",",",",",`
    A`,",",",0,0,",",",",",`
  `])),h.x,h.y,i,i,+(u<0),x.x,x.y,s,s,+(v>180),+(u<0),g.x,g.y,i,i,+(u<0),b.x,b.y);if(n>0){var{circleTangency:j,lineTangency:S,theta:N}=Vi({cx:r,cy:a,radius:n,angle:d,sign:u,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),{circleTangency:w,lineTangency:_,theta:P}=Vi({cx:r,cy:a,radius:n,angle:m,sign:-u,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),O=c?Math.abs(d-m):Math.abs(d-m)-N-P;if(O<0&&i===0)return"".concat(y,"L").concat(r,",").concat(a,"Z");y+=Ft($0||($0=jn(["L",",",`
      A`,",",",0,0,",",",",",`
      A`,",",",0,",",",",",",",`
      A`,",",",0,0,",",",",","Z"])),_.x,_.y,i,i,+(u<0),w.x,w.y,n,n,+(O>180),+(u>0),j.x,j.y,i,i,+(u<0),S.x,S.y)}else y+=Ft(E0||(E0=jn(["L",",","Z"])),r,a);return y},qN={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Rg=t=>{var r=hr(t,qN),{cx:a,cy:n,innerRadius:s,outerRadius:i,cornerRadius:o,forceCornerRadius:c,cornerIsExternal:d,startAngle:m,endAngle:u,className:x}=r;if(i<s||m===u)return null;var h=Ot("recharts-sector",x),f=i-s,g=Ta(o,f,0,!0),b;return g>0&&Math.abs(m-u)<360?b=KN({cx:a,cy:n,innerRadius:s,outerRadius:i,cornerRadius:Math.min(g,f/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:m,endAngle:u}):b=Mg({cx:a,cy:n,innerRadius:s,outerRadius:i,startAngle:m,endAngle:u}),l.createElement("path",Hc({},sn(r),{className:h,d:b}))};function XN(t,r,a){if(t==="horizontal")return[{x:r.x,y:a.top},{x:r.x,y:a.top+a.height}];if(t==="vertical")return[{x:a.left,y:r.y},{x:a.left+a.width,y:r.y}];if(yf(r)){if(t==="centric"){var{cx:n,cy:s,innerRadius:i,outerRadius:o,angle:c}=r,d=mr(n,s,i,c),m=mr(n,s,o,c);return[{x:d.x,y:d.y},{x:m.x,y:m.y}]}return Tg(r)}}function A0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function O0(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?A0(Object(a),!0).forEach(function(n){YN(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):A0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function YN(t,r,a){return(r=JN(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function JN(t){var r=QN(t,"string");return typeof r=="symbol"?r:r+""}function QN(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var ZN=()=>xt(by),e2=()=>{var t=ZN(),r=xt(gy),a=xt(py);return!t||!a?us(void 0,r):us(O0(O0({},t),{},{scale:a}),r)};function Wc(){return Wc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Wc.apply(null,arguments)}function I0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Gi(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?I0(Object(a),!0).forEach(function(n){t2(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):I0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function t2(t,r,a){return(r=r2(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function r2(t){var r=a2(t,"string");return typeof r=="symbol"?r:r+""}function a2(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function n2(t){var{cursor:r,cursorComp:a,cursorProps:n}=t;return l.isValidElement(r)?l.cloneElement(r,n):l.createElement(a,n)}function s2(t){var r,{coordinate:a,payload:n,index:s,offset:i,tooltipAxisBandSize:o,layout:c,cursor:d,tooltipEventType:m,chartName:u}=t,x=a,h=n,f=s;if(!d||!x||u!=="ScatterChart"&&m!=="axis")return null;var g,b,p;if(u==="ScatterChart")g=x,b=DN,p=zr.cursorLine;else if(u==="BarChart")g=zN(c,x,i,o),b=Ig,p=zr.cursorRectangle;else if(c==="radial"&&yf(x)){var{cx:v,cy:y,radius:j,startAngle:S,endAngle:N}=Tg(x);g={cx:v,cy:y,startAngle:S,endAngle:N,innerRadius:j,outerRadius:j},b=Rg,p=zr.cursorLine}else g={points:XN(c,x,i)},b=ns,p=zr.cursorLine;var w=typeof d=="object"&&"className"in d?d.className:void 0,_=Gi(Gi(Gi(Gi({stroke:"#ccc",pointerEvents:"none"},i),g),$n(d)),{},{payload:h,payloadIndex:f,className:Ot("recharts-tooltip-cursor",w)});return l.createElement(ca,{zIndex:(r=t.zIndex)!==null&&r!==void 0?r:p},l.createElement(n2,{cursor:d,cursorComp:b,cursorProps:_}))}function i2(t){var r=e2(),a=jf(),n=Zo(),s=wf();return r==null||a==null||n==null||s==null?null:l.createElement(s2,Wc({},t,{offset:a,layout:n,tooltipAxisBandSize:r,chartName:s}))}function T0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function M0(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?T0(Object(a),!0).forEach(function(n){o2(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):T0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function o2(t,r,a){return(r=l2(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function l2(t){var r=c2(t,"string");return typeof r=="symbol"?r:r+""}function c2(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function d2(t){return t.dataKey}function u2(t,r){return l.isValidElement(t)?l.cloneElement(t,r):typeof t=="function"?l.createElement(t,r):l.createElement(pN,r)}var R0=[],m2={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function La(t){var r,a,n=hr(t,m2),{active:s,allowEscapeViewBox:i,animationDuration:o,animationEasing:c,content:d,filterNull:m,isAnimationActive:u,offset:x,payloadUniqBy:h,position:f,reverseDirection:g,useTranslate3d:b,wrapperStyle:p,cursor:v,shared:y,trigger:j,defaultIndex:S,portal:N,axisId:w}=n,_=ka(),P=typeof S=="number"?String(S):S;l.useEffect(()=>{_(vy({shared:y,trigger:j,axisId:w,active:s,defaultIndex:P}))},[_,y,j,w,s,P]);var O=yy(),T=jy(),k=wy(y),{activeIndex:$,isActive:C}=(r=xt(ee=>Cy(ee,k,j,P)))!==null&&r!==void 0?r:{},A=xt(ee=>_y(ee,k,j,P)),E=xt(ee=>Py(ee,k,j,P)),L=xt(ee=>ky(ee,k,j,P)),F=A,D=Ny(),q=(a=s??C)!==null&&a!==void 0?a:!1,[Q,de]=Ag([F,q]),H=k==="axis"?E:void 0;Sy(k,j,L,H,$,q);var se=N??D;if(se==null||O==null||k==null)return null;var W=F??R0;q||(W=R0),m&&W.length&&(W=Eg(W.filter(ee=>ee.value!=null&&(ee.hide!==!0||n.includeHidden)),h,d2));var le=W.length>0,U=l.createElement(SN,{allowEscapeViewBox:i,animationDuration:o,animationEasing:c,isAnimationActive:u,active:q,coordinate:L,hasPayload:le,offset:x,position:f,reverseDirection:g,useTranslate3d:b,viewBox:O,wrapperStyle:p,lastBoundingBox:Q,innerRef:de,hasPortalFromProps:!!N},u2(d,M0(M0({},n),{},{payload:W,label:H,active:q,activeIndex:$,coordinate:L,accessibilityLayer:T})));return l.createElement(l.Fragment,null,An.createPortal(U,se),q&&l.createElement(i2,{cursor:v,tooltipEventType:k,coordinate:L,payload:W,index:$}))}var gs=t=>null;gs.displayName="Cell";var Lg={},Dg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a,n){if(a.length===0)return;let s=a[0],i=n(s);for(let o=1;o<a.length;o++){const c=a[o],d=n(c);d>i&&(i=d,s=c)}return s}t.maxBy=r})(Dg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=Dg,a=Pi,n=sl;function s(i,o){if(i!=null)return r.maxBy(Array.from(i),n.iteratee(o??a.identity))}t.maxBy=s})(Lg);var x2=Lg.maxBy;const h2=Si(x2);var zg={},Fg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a,n){if(a.length===0)return;let s=a[0],i=n(s);for(let o=1;o<a.length;o++){const c=a[o],d=n(c);d<i&&(i=d,s=c)}return s}t.minBy=r})(Fg);(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const r=Fg,a=Pi,n=sl;function s(i,o){if(i!=null)return r.minBy(Array.from(i),n.iteratee(o??a.identity))}t.minBy=s})(zg);var f2=zg.minBy;const g2=Si(f2);var p2=["cx","cy","angle","axisLine"],b2=["angle","tickFormatter","stroke","tick"];function li(){return li=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},li.apply(null,arguments)}function L0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Ia(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?L0(Object(a),!0).forEach(function(n){v2(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):L0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function v2(t,r,a){return(r=y2(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function y2(t){var r=j2(t,"string");return typeof r=="symbol"?r:r+""}function j2(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Bg(t,r){if(t==null)return{};var a,n,s=w2(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function w2(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var N2="radiusAxis";function S2(t){var r=ka();return l.useEffect(()=>(r($y(t)),()=>{r(Ey(t))})),null}var C2=(t,r,a,n)=>{var{coordinate:s}=t;return mr(a,n,s,r)},_2=t=>{var r;switch(t){case"left":r="end";break;case"right":r="start";break;default:r="middle";break}return r},k2=(t,r,a,n)=>{var s=h2(n,o=>o.coordinate||0),i=g2(n,o=>o.coordinate||0);return{cx:r,cy:a,startAngle:t,endAngle:t,innerRadius:(i==null?void 0:i.coordinate)||0,outerRadius:(s==null?void 0:s.coordinate)||0,clockWise:!1}},P2=(t,r)=>{var{cx:a,cy:n,angle:s,axisLine:i}=t,o=Bg(t,p2),c=r.reduce((x,h)=>[Math.min(x[0],h.coordinate),Math.max(x[1],h.coordinate)],[1/0,-1/0]),d=mr(a,n,c[0],s),m=mr(a,n,c[1],s),u=Ia(Ia(Ia({},Br(o)),{},{fill:"none"},Br(i)),{},{x1:d.x,y1:d.y,x2:m.x,y2:m.y});return l.createElement("line",li({className:"recharts-polar-radius-axis-line"},u))},$2=(t,r,a)=>{var n;return l.isValidElement(t)?n=l.cloneElement(t,r):typeof t=="function"?n=t(r):n=l.createElement(nu,li({},r,{className:"recharts-polar-radius-axis-tick-value"}),a),n},E2=(t,r)=>{var{angle:a,tickFormatter:n,stroke:s,tick:i}=t,o=Bg(t,b2),c=_2(t.orientation),d=Br(o),m=$n(i),u=r.map((x,h)=>{var f=C2(x,t.angle,t.cx,t.cy),g=Ia(Ia(Ia(Ia({textAnchor:c,transform:"rotate(".concat(90-a,", ").concat(f.x,", ").concat(f.y,")")},d),{},{stroke:"none",fill:s},m),{},{index:h},f),{},{payload:x});return l.createElement(Ut,li({className:Ot("recharts-polar-radius-axis-tick",Ly(i)),key:"tick-".concat(x.coordinate)},Ps(t,x,h)),$2(i,g,n?n(x.value,h):x.value))});return l.createElement(Ut,{className:"recharts-polar-radius-axis-ticks"},u)},A2=t=>{var{radiusAxisId:r}=t,a=xt(Oy),n=xt(d=>Iy(d,"radiusAxis",r)),s=xt(d=>Ty(d,"radiusAxis",r,!1));if(a==null||!s||!s.length||n==null)return null;var i=Ia(Ia({},t),{},{scale:n},a),{tick:o,axisLine:c}=i;return l.createElement(ca,{zIndex:i.zIndex},l.createElement(Ut,{className:Ot("recharts-polar-radius-axis",N2,i.className)},c&&P2(i,s),o&&E2(i,s),l.createElement(My,k2(i.angle,i.cx,i.cy,s),l.createElement(Ry,{label:i.label}),i.children)))};function il(t){var r=hr(t,Ay);return l.createElement(l.Fragment,null,l.createElement(S2,{domain:r.domain,id:r.radiusAxisId,scale:r.scale,type:r.type,dataKey:r.dataKey,unit:void 0,name:r.name,allowDuplicatedCategory:r.allowDuplicatedCategory,allowDataOverflow:r.allowDataOverflow,reversed:r.reversed,includeHidden:r.includeHidden,allowDecimals:r.allowDecimals,ticks:r.ticks,tickCount:r.tickCount,tick:r.tick}),l.createElement(A2,r))}il.displayName="PolarRadiusAxis";function D0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function z0(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?D0(Object(a),!0).forEach(function(n){O2(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):D0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function O2(t,r,a){return(r=I2(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function I2(t){var r=T2(t,"string");return typeof r=="symbol"?r:r+""}function T2(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var M2=(t,r)=>r,Au=Nr([zy,M2],(t,r)=>t.filter(a=>a.type==="pie").find(a=>a.id===r)),R2=[],Ou=(t,r,a)=>(a==null?void 0:a.length)===0?R2:a,Hg=Nr([Dy,Au,Ou],(t,r,a)=>{var{chartData:n}=t;if(r!=null){var s;if((r==null?void 0:r.data)!=null&&r.data.length>0?s=r.data:s=n,(!s||!s.length)&&a!=null&&(s=a.map(i=>z0(z0({},r.presentationProps),i.props))),s!=null)return s}}),L2=Nr([Hg,Au,Ou],(t,r,a)=>{if(!(t==null||r==null))return t.map((n,s)=>{var i,o=ja(n,r.nameKey,r.name),c;return a!=null&&(i=a[s])!==null&&i!==void 0&&(i=i.props)!==null&&i!==void 0&&i.fill?c=a[s].props.fill:typeof n=="object"&&n!=null&&"fill"in n?c=n.fill:c=r.fill,{value:Es(o,r.dataKey),color:c,payload:n,type:r.legendType}})}),D2=Nr([Hg,Au,Ou,Nf],(t,r,a,n)=>{if(!(r==null||t==null))return j5({offset:n,pieSettings:r,displayedData:t,cells:a})}),Wg={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function r(a){var s;if(typeof a!="object"||a==null)return!1;if(Object.getPrototypeOf(a)===null)return!0;if(Object.prototype.toString.call(a)!=="[object Object]"){const i=a[Symbol.toStringTag];return i==null||!((s=Object.getOwnPropertyDescriptor(a,Symbol.toStringTag))!=null&&s.writable)?!1:a.toString()===`[object ${i}]`}let n=a;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(a)===n}t.isPlainObject=r})(Wg);var z2=Wg.isPlainObject;const F2=Si(z2);var F0,B0,H0,W0,U0;function V0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function G0(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?V0(Object(a),!0).forEach(function(n){B2(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):V0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function B2(t,r,a){return(r=H2(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function H2(t){var r=W2(t,"string");return typeof r=="symbol"?r:r+""}function W2(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Ao(){return Ao=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Ao.apply(null,arguments)}function Us(t,r){return r||(r=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))}var K0=(t,r,a,n,s)=>{var i=a-n,o;return o=Ft(F0||(F0=Us(["M ",",",""])),t,r),o+=Ft(B0||(B0=Us(["L ",",",""])),t+a,r),o+=Ft(H0||(H0=Us(["L ",",",""])),t+a-i/2,r+s),o+=Ft(W0||(W0=Us(["L ",",",""])),t+a-i/2-n,r+s),o+=Ft(U0||(U0=Us(["L ",","," Z"])),t,r),o},U2={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},V2=t=>{var r=hr(t,U2),{x:a,y:n,upperWidth:s,lowerWidth:i,height:o,className:c}=r,{animationEasing:d,animationDuration:m,animationBegin:u,isUpdateAnimationActive:x}=r,h=l.useRef(null),[f,g]=l.useState(-1),b=l.useRef(s),p=l.useRef(i),v=l.useRef(o),y=l.useRef(a),j=l.useRef(n),S=Ci(t,"trapezoid-");if(l.useEffect(()=>{if(h.current&&h.current.getTotalLength)try{var A=h.current.getTotalLength();A&&g(A)}catch{}},[]),a!==+a||n!==+n||s!==+s||i!==+i||o!==+o||s===0&&i===0||o===0)return null;var N=Ot("recharts-trapezoid",c);if(!x)return l.createElement("g",null,l.createElement("path",Ao({},sn(r),{className:N,d:K0(a,n,s,i,o)})));var w=b.current,_=p.current,P=v.current,O=y.current,T=j.current,k="0px ".concat(f===-1?1:f,"px"),$="".concat(f,"px 0px"),C=vf(["strokeDasharray"],m,d);return l.createElement(_i,{animationId:S,key:S,canBegin:f>0,duration:m,easing:d,isActive:x,begin:u},A=>{var E=Et(w,s,A),L=Et(_,i,A),F=Et(P,o,A),D=Et(O,a,A),q=Et(T,n,A);h.current&&(b.current=E,p.current=L,v.current=F,y.current=D,j.current=q);var Q=A>0?{transition:C,strokeDasharray:$}:{strokeDasharray:k};return l.createElement("path",Ao({},sn(r),{className:N,d:K0(D,q,E,L,F),ref:h,style:G0(G0({},Q),r.style)}))})},G2=["option","shapeType","activeClassName"];function K2(t,r){if(t==null)return{};var a,n,s=q2(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function q2(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function q0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Oo(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?q0(Object(a),!0).forEach(function(n){X2(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):q0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function X2(t,r,a){return(r=Y2(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function Y2(t){var r=J2(t,"string");return typeof r=="symbol"?r:r+""}function J2(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Q2(t,r){return Oo(Oo({},r),t)}function Z2(t,r){return t==="symbols"}function X0(t){var{shapeType:r,elementProps:a}=t;switch(r){case"rectangle":return l.createElement(Ig,a);case"trapezoid":return l.createElement(V2,a);case"sector":return l.createElement(Rg,a);case"symbols":if(Z2(r))return l.createElement(Cu,a);break;case"curve":return l.createElement(ns,a);default:return null}}function e5(t){return l.isValidElement(t)?t.props:t}function Ug(t){var{option:r,shapeType:a,activeClassName:n="recharts-active-shape"}=t,s=K2(t,G2),i;if(l.isValidElement(r))i=l.cloneElement(r,Oo(Oo({},s),e5(r)));else if(typeof r=="function")i=r(s,s.index);else if(F2(r)&&typeof r!="boolean"){var o=Q2(r,s);i=l.createElement(X0,{shapeType:a,elementProps:o})}else{var c=s;i=l.createElement(X0,{shapeType:a,elementProps:c})}return s.isActive?l.createElement(Ut,{className:n},i):i}var Iu=(t,r,a)=>{var n=ka();return(s,i)=>o=>{t==null||t(s,i,o),n(Fy({activeIndex:String(i),activeDataKey:r,activeCoordinate:s.tooltipPosition,activeGraphicalItemId:a}))}},Tu=t=>{var r=ka();return(a,n)=>s=>{t==null||t(a,n,s),r(By())}},Mu=(t,r,a)=>{var n=ka();return(s,i)=>o=>{t==null||t(s,i,o),n(Hy({activeIndex:String(i),activeDataKey:r,activeCoordinate:s.tooltipPosition,activeGraphicalItemId:a}))}},t5=["key"],r5=["onMouseEnter","onClick","onMouseLeave"],a5=["id"],n5=["id"];function Y0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Bt(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Y0(Object(a),!0).forEach(function(n){s5(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Y0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function s5(t,r,a){return(r=i5(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function i5(t){var r=o5(t,"string");return typeof r=="symbol"?r:r+""}function o5(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function cn(){return cn=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},cn.apply(null,arguments)}function ol(t,r){if(t==null)return{};var a,n,s=l5(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function l5(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function c5(t){var r=l.useMemo(()=>iu(t.children,gs),[t.children]),a=xt(n=>L2(n,t.id,r));return a==null?null:l.createElement(Uy,{legendPayload:a})}var d5=l.memo(t=>{var{dataKey:r,nameKey:a,sectors:n,stroke:s,strokeWidth:i,fill:o,name:c,hide:d,tooltipType:m,id:u}=t,x={dataDefinedOnItem:n.map(h=>h.tooltipPayload),positions:n.map(h=>h.tooltipPosition),settings:{stroke:s,strokeWidth:i,fill:o,dataKey:r,nameKey:a,name:Es(c,r),hide:d,type:m,color:o,unit:"",graphicalItemId:u}};return l.createElement(ou,{tooltipEntrySettings:x})}),u5=(t,r)=>t>r?"start":t<r?"end":"middle",m5=(t,r,a)=>typeof r=="function"?Ta(r(t),a,a*.8):Ta(r,a,a*.8),x5=(t,r,a)=>{var{top:n,left:s,width:i,height:o}=r,c=Xy(i,o),d=s+Ta(t.cx,i,i/2),m=n+Ta(t.cy,o,o/2),u=Ta(t.innerRadius,c,0),x=m5(a,t.outerRadius,c),h=t.maxRadius||Math.sqrt(i*i+o*o)/2;return{cx:d,cy:m,innerRadius:u,outerRadius:x,maxRadius:h}},h5=(t,r)=>{var a=Ma(r-t),n=Math.min(Math.abs(r-t),360);return a*n};function f5(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var g5=(t,r)=>{if(l.isValidElement(t))return l.cloneElement(t,r);if(typeof t=="function")return t(r);var a=Ot("recharts-pie-label-line",typeof t!="boolean"?t.className:""),{key:n}=r,s=ol(r,t5);return l.createElement(ns,cn({},s,{type:"linear",className:a}))},p5=(t,r,a)=>{if(l.isValidElement(t))return l.cloneElement(t,r);var n=a;if(typeof t=="function"&&(n=t(r),l.isValidElement(n)))return n;var s=Ot("recharts-pie-label-text",f5(t));return l.createElement(nu,cn({},r,{alignmentBaseline:"middle",className:s}),n)};function b5(t){var{sectors:r,props:a,showLabels:n}=t,{label:s,labelLine:i,dataKey:o}=a;if(!n||!s||!r)return null;var c=Br(a),d=$n(s),m=$n(i),u=typeof s=="object"&&"offsetRadius"in s&&typeof s.offsetRadius=="number"&&s.offsetRadius||20,x=r.map((h,f)=>{var g=(h.startAngle+h.endAngle)/2,b=mr(h.cx,h.cy,h.outerRadius+u,g),p=Bt(Bt(Bt(Bt({},c),h),{},{stroke:"none"},d),{},{index:f,textAnchor:u5(b.x,h.cx)},b),v=Bt(Bt(Bt(Bt({},c),h),{},{fill:"none",stroke:h.fill},m),{},{index:f,points:[mr(h.cx,h.cy,h.outerRadius,g),b],key:"line"});return l.createElement(ca,{zIndex:zr.label,key:"label-".concat(h.startAngle,"-").concat(h.endAngle,"-").concat(h.midAngle,"-").concat(f)},l.createElement(Ut,null,i&&g5(i,v),p5(s,p,ja(h,o))))});return l.createElement(Ut,{className:"recharts-pie-labels"},x)}function v5(t){var{sectors:r,props:a,showLabels:n}=t,{label:s}=a;return typeof s=="object"&&s!=null&&"position"in s?l.createElement(du,{label:s}):l.createElement(b5,{sectors:r,props:a,showLabels:n})}function y5(t){var{sectors:r,activeShape:a,inactiveShape:n,allOtherPieProps:s,shape:i,id:o}=t,c=xt(cu),d=xt(Sf),m=xt(Gy),{onMouseEnter:u,onClick:x,onMouseLeave:h}=s,f=ol(s,r5),g=Iu(u,s.dataKey,o),b=Tu(h),p=Mu(x,s.dataKey,o);return r==null||r.length===0?null:l.createElement(l.Fragment,null,r.map((v,y)=>{if((v==null?void 0:v.startAngle)===0&&(v==null?void 0:v.endAngle)===0&&r.length!==1)return null;var j=m==null||m===o,S=String(y)===c&&(d==null||s.dataKey===d)&&j,N=c?n:null,w=a&&S?a:N,_=Bt(Bt({},v),{},{stroke:v.stroke,tabIndex:-1,[qy]:y,[Ky]:o});return l.createElement(Ut,cn({key:"sector-".concat(v==null?void 0:v.startAngle,"-").concat(v==null?void 0:v.endAngle,"-").concat(v.midAngle,"-").concat(y),tabIndex:-1,className:"recharts-pie-sector"},Ps(f,v,y),{onMouseEnter:g(v,y),onMouseLeave:b(v,y),onClick:p(v,y)}),l.createElement(Ug,cn({option:i??w,index:y,shapeType:"sector",isActive:S},_)))}))}function j5(t){var r,{pieSettings:a,displayedData:n,cells:s,offset:i}=t,{cornerRadius:o,startAngle:c,endAngle:d,dataKey:m,nameKey:u,tooltipType:x}=a,h=Math.abs(a.minAngle),f=h5(c,d),g=Math.abs(f),b=n.length<=1?0:(r=a.paddingAngle)!==null&&r!==void 0?r:0,p=n.filter(w=>ja(w,m,0)!==0).length,v=(g>=360?p:p-1)*b,y=g-p*h-v,j=n.reduce((w,_)=>{var P=ja(_,m,0);return w+(nt(P)?P:0)},0),S;if(j>0){var N;S=n.map((w,_)=>{var P=ja(w,m,0),O=ja(w,u,_),T=x5(a,i,w),k=(nt(P)?P:0)/j,$,C=Bt(Bt({},w),s&&s[_]&&s[_].props);_?$=N.endAngle+Ma(f)*b*(P!==0?1:0):$=c;var A=$+Ma(f)*((P!==0?h:0)+k*y),E=($+A)/2,L=(T.innerRadius+T.outerRadius)/2,F=[{name:O,value:P,payload:C,dataKey:m,type:x,graphicalItemId:a.id}],D=mr(T.cx,T.cy,L,E);return N=Bt(Bt(Bt(Bt({},a.presentationProps),{},{percent:k,cornerRadius:typeof o=="string"?parseFloat(o):o,name:O,tooltipPayload:F,midAngle:E,middleRadius:L,tooltipPosition:D},C),T),{},{value:P,dataKey:m,startAngle:$,endAngle:A,payload:C,paddingAngle:Ma(f)*b}),N})}return S}function w5(t){var{showLabels:r,sectors:a,children:n}=t,s=l.useMemo(()=>!r||!a?[]:a.map(i=>({value:i.value,payload:i.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:i.cx,cy:i.cy,innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,clockWise:!1},fill:i.fill})),[a,r]);return l.createElement(Vy,{value:r?s:void 0},n)}function N5(t){var{props:r,previousSectorsRef:a,id:n}=t,{sectors:s,isAnimationActive:i,animationBegin:o,animationDuration:c,animationEasing:d,activeShape:m,inactiveShape:u,onAnimationStart:x,onAnimationEnd:h}=r,f=Ci(r,"recharts-pie-"),g=a.current,[b,p]=l.useState(!1),v=l.useCallback(()=>{typeof h=="function"&&h(),p(!1)},[h]),y=l.useCallback(()=>{typeof x=="function"&&x(),p(!0)},[x]);return l.createElement(w5,{showLabels:!b,sectors:s},l.createElement(_i,{animationId:f,begin:o,duration:c,isActive:i,easing:d,onAnimationStart:y,onAnimationEnd:v,key:f},j=>{var S=[],N=s&&s[0],w=N==null?void 0:N.startAngle;return s==null||s.forEach((_,P)=>{var O=g&&g[P],T=P>0?lu(_,"paddingAngle",0):0;if(O){var k=Et(O.endAngle-O.startAngle,_.endAngle-_.startAngle,j),$=Bt(Bt({},_),{},{startAngle:w+T,endAngle:w+k+T});S.push($),w=$.endAngle}else{var{endAngle:C,startAngle:A}=_,E=Et(0,C-A,j),L=Bt(Bt({},_),{},{startAngle:w+T,endAngle:w+E+T});S.push(L),w=L.endAngle}}),a.current=S,l.createElement(Ut,null,l.createElement(y5,{sectors:S,activeShape:m,inactiveShape:u,allOtherPieProps:r,shape:r.shape,id:n}))}),l.createElement(v5,{showLabels:!b,sectors:s,props:r}),r.children)}var S5={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:zr.area};function C5(t){var{id:r}=t,a=ol(t,a5),{hide:n,className:s,rootTabIndex:i}=t,o=l.useMemo(()=>iu(t.children,gs),[t.children]),c=xt(u=>D2(u,r,o)),d=l.useRef(null),m=Ot("recharts-pie",s);return n||c==null?(d.current=null,l.createElement(Ut,{tabIndex:i,className:m})):l.createElement(ca,{zIndex:t.zIndex},l.createElement(d5,{dataKey:t.dataKey,nameKey:t.nameKey,sectors:c,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,tooltipType:t.tooltipType,id:r}),l.createElement(Ut,{tabIndex:i,className:m},l.createElement(N5,{props:Bt(Bt({},a),{},{sectors:c}),previousSectorsRef:d,id:r})))}function Vg(t){var r=hr(t,S5),{id:a}=r,n=ol(r,n5),s=Br(n);return l.createElement(su,{id:a,type:"pie"},i=>l.createElement(l.Fragment,null,l.createElement(Wy,{type:"pie",id:i,data:n.data,dataKey:n.dataKey,hide:n.hide,angleAxisId:0,radiusAxisId:0,name:n.name,nameKey:n.nameKey,tooltipType:n.tooltipType,legendType:n.legendType,fill:n.fill,cx:n.cx,cy:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,paddingAngle:n.paddingAngle,minAngle:n.minAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,cornerRadius:n.cornerRadius,presentationProps:s,maxRadius:r.maxRadius}),l.createElement(c5,cn({},n,{id:i})),l.createElement(C5,cn({},n,{id:i}))))}Vg.displayName="Pie";var J0=(t,r,a)=>{var n=a??t;if(!$s(n))return Ta(n,r,0)},_5=(t,r,a)=>{var n={},s=t.filter(Yy),i=t.filter(m=>m.stackId==null),o=s.reduce((m,u)=>(m[u.stackId]||(m[u.stackId]=[]),m[u.stackId].push(u),m),n),c=Object.entries(o).map(m=>{var[u,x]=m,h=x.map(g=>g.dataKey),f=J0(r,a,x[0].barSize);return{stackId:u,dataKeys:h,barSize:f}}),d=i.map(m=>{var u=[m.dataKey].filter(h=>h!=null),x=J0(r,a,m.barSize);return{stackId:void 0,dataKeys:u,barSize:x}});return[...c,...d]};function Q0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Ki(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Q0(Object(a),!0).forEach(function(n){k5(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Q0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function k5(t,r,a){return(r=P5(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function P5(t){var r=$5(t,"string");return typeof r=="symbol"?r:r+""}function $5(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function E5(t,r,a,n,s){var i=n.length;if(!(i<1)){var o=Ta(t,a,0,!0),c,d=[];if(Ba(n[0].barSize)){var m=!1,u=a/i,x=n.reduce((v,y)=>v+(y.barSize||0),0);x+=(i-1)*o,x>=a&&(x-=(i-1)*o,o=0),x>=a&&u>0&&(m=!0,u*=.9,x=i*u);var h=(a-x)/2>>0,f={offset:h-o,size:0};c=n.reduce((v,y)=>{var j,S={stackId:y.stackId,dataKeys:y.dataKeys,position:{offset:f.offset+f.size+o,size:m?u:(j=y.barSize)!==null&&j!==void 0?j:0}},N=[...v,S];return f=N[N.length-1].position,N},d)}else{var g=Ta(r,a,0,!0);a-2*g-(i-1)*o<=0&&(o=0);var b=(a-2*g-(i-1)*o)/i;b>1&&(b>>=0);var p=Ba(s)?Math.min(b,s):b;c=n.reduce((v,y,j)=>[...v,{stackId:y.stackId,dataKeys:y.dataKeys,position:{offset:g+(b+o)*j+(b-p)/2,size:p}}],d)}return c}}var A5=(t,r,a,n,s,i,o)=>{var c=$s(o)?r:o,d=E5(a,n,s!==i?s:i,t,c);return s!==i&&d!=null&&(d=d.map(m=>Ki(Ki({},m),{},{position:Ki(Ki({},m.position),{},{offset:m.position.offset-s/2})}))),d},O5=(t,r)=>{var a=Cf(r);if(!(!t||a==null||r==null)){var{stackId:n}=r;if(n!=null){var s=t[n];if(s){var{stackedData:i}=s;if(i)return i.find(o=>o.key===a)}}}};function I5(t,r){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&Ba(t.zIndex)?t.zIndex:r}function T5(t,r,a){return(r=M5(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function M5(t){var r=R5(t,"string");return typeof r=="symbol"?r:r+""}function R5(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class Ru{static create(r){return new Ru(r)}constructor(r){this.scale=r}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(r){var{bandAware:a,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(r!==void 0){if(n)switch(n){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(r)+i}default:return this.scale(r)}if(a){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}return this.scale(r)}}isInRange(r){var a=this.range(),n=a[0],s=a[a.length-1];return n<=s?r>=n&&r<=s:r>=s&&r<=n}}T5(Ru,"EPS",1e-4);function L5(t){return(t%180+180)%180}var D5=function(r){var{width:a,height:n}=r,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=L5(s),o=i*Math.PI/180,c=Math.atan(n/a),d=o>c&&o<Math.PI-c?n/Math.sin(o):a/Math.cos(o);return Math.abs(d)};function Gg(t,r){if(r<1)return[];if(r===1)return t;for(var a=[],n=0;n<t.length;n+=r){var s=t[n];s!==void 0&&a.push(s)}return a}function z5(t,r,a){var n={width:t.width+r.width,height:t.height+r.height};return D5(n,a)}function F5(t,r,a){var n=a==="width",{x:s,y:i,width:o,height:c}=t;return r===1?{start:n?s:i,end:n?s+o:i+c}:{start:n?s+o:i+c,end:n?s:i}}function ci(t,r,a,n,s){if(t*r<t*n||t*r>t*s)return!1;var i=a();return t*(r-t*i/2-n)>=0&&t*(r+t*i/2-s)<=0}function B5(t,r){return Gg(t,r+1)}function H5(t,r,a,n,s){for(var i=(n||[]).slice(),{start:o,end:c}=r,d=0,m=1,u=o,x=function(){var g=n==null?void 0:n[d];if(g===void 0)return{v:Gg(n,m)};var b=d,p,v=()=>(p===void 0&&(p=a(g,b)),p),y=g.coordinate,j=d===0||ci(t,y,v,u,c);j||(d=0,u=o,m+=1),j&&(u=y+t*(v()/2+s),d+=m)},h;m<=i.length;)if(h=x(),h)return h.v;return[]}function W5(t,r,a,n,s){var i=(n||[]).slice(),o=i.length;if(o===0)return[];for(var{start:c,end:d}=r,m=1;m<=o;m++){for(var u=(o-1)%m,x=c,h=!0,f=function(){var y=n[g],j=g,S,N=()=>(S===void 0&&(S=a(y,j)),S),w=y.coordinate,_=g===u||ci(t,w,N,x,d);if(!_)return h=!1,1;_&&(x=w+t*(N()/2+s))},g=u;g<o&&!f();g+=m);if(h){for(var b=[],p=u;p<o;p+=m)b.push(n[p]);return b}}return[]}function Z0(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function fr(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Z0(Object(a),!0).forEach(function(n){U5(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Z0(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function U5(t,r,a){return(r=V5(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function V5(t){var r=G5(t,"string");return typeof r=="symbol"?r:r+""}function G5(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function K5(t,r,a,n,s){for(var i=(n||[]).slice(),o=i.length,{start:c}=r,{end:d}=r,m=function(h){var f=i[h],g,b=()=>(g===void 0&&(g=a(f,h)),g);if(h===o-1){var p=t*(f.coordinate+t*b()/2-d);i[h]=f=fr(fr({},f),{},{tickCoord:p>0?f.coordinate-p*t:f.coordinate})}else i[h]=f=fr(fr({},f),{},{tickCoord:f.coordinate});if(f.tickCoord!=null){var v=ci(t,f.tickCoord,b,c,d);v&&(d=f.tickCoord-t*(b()/2+s),i[h]=fr(fr({},f),{},{isShow:!0}))}},u=o-1;u>=0;u--)m(u);return i}function q5(t,r,a,n,s,i){var o=(n||[]).slice(),c=o.length,{start:d,end:m}=r;if(i){var u=n[c-1],x=a(u,c-1),h=t*(u.coordinate+t*x/2-m);if(o[c-1]=u=fr(fr({},u),{},{tickCoord:h>0?u.coordinate-h*t:u.coordinate}),u.tickCoord!=null){var f=ci(t,u.tickCoord,()=>x,d,m);f&&(m=u.tickCoord-t*(x/2+s),o[c-1]=fr(fr({},u),{},{isShow:!0}))}}for(var g=i?c-1:c,b=function(y){var j=o[y],S,N=()=>(S===void 0&&(S=a(j,y)),S);if(y===0){var w=t*(j.coordinate-t*N()/2-d);o[y]=j=fr(fr({},j),{},{tickCoord:w<0?j.coordinate-w*t:j.coordinate})}else o[y]=j=fr(fr({},j),{},{tickCoord:j.coordinate});if(j.tickCoord!=null){var _=ci(t,j.tickCoord,N,d,m);_&&(d=j.tickCoord+t*(N()/2+s),o[y]=fr(fr({},j),{},{isShow:!0}))}},p=0;p<g;p++)b(p);return o}function Lu(t,r,a){var{tick:n,ticks:s,viewBox:i,minTickGap:o,orientation:c,interval:d,tickFormatter:m,unit:u,angle:x}=t;if(!s||!s.length||!n)return[];if(nt(d)||_f.isSsr){var h;return(h=B5(s,nt(d)?d:0))!==null&&h!==void 0?h:[]}var f=[],g=c==="top"||c==="bottom"?"width":"height",b=u&&g==="width"?Vl(u,{fontSize:r,letterSpacing:a}):{width:0,height:0},p=(j,S)=>{var N=typeof m=="function"?m(j.value,S):j.value;return g==="width"?z5(Vl(N,{fontSize:r,letterSpacing:a}),b,x):Vl(N,{fontSize:r,letterSpacing:a})[g]},v=s.length>=2?Ma(s[1].coordinate-s[0].coordinate):1,y=F5(i,v,g);return d==="equidistantPreserveStart"?H5(v,y,p,s,o):d==="equidistantPreserveEnd"?W5(v,y,p,s,o):(d==="preserveStart"||d==="preserveStartEnd"?f=q5(v,y,p,s,o,d==="preserveStartEnd"):f=K5(v,y,p,s,o),f.filter(j=>j.isShow))}var X5=t=>{var{ticks:r,label:a,labelGapWithTick:n=5,tickSize:s=0,tickMargin:i=0}=t,o=0;if(r){Array.from(r).forEach(u=>{if(u){var x=u.getBoundingClientRect();x.width>o&&(o=x.width)}});var c=a?a.getBoundingClientRect().width:0,d=s+i,m=o+d+c+(a?n:0);return Math.round(m)}return 0},Y5=["axisLine","width","height","className","hide","ticks","axisType"];function J5(t,r){if(t==null)return{};var a,n,s=Q5(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function Q5(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function En(){return En=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},En.apply(null,arguments)}function ex(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Kt(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?ex(Object(a),!0).forEach(function(n){Z5(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ex(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function Z5(t,r,a){return(r=e4(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function e4(t){var r=t4(t,"string");return typeof r=="symbol"?r:r+""}function t4(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var Da={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:zr.axis};function r4(t){var{x:r,y:a,width:n,height:s,orientation:i,mirror:o,axisLine:c,otherSvgProps:d}=t;if(!c)return null;var m=Kt(Kt(Kt({},d),Br(c)),{},{fill:"none"});if(i==="top"||i==="bottom"){var u=+(i==="top"&&!o||i==="bottom"&&o);m=Kt(Kt({},m),{},{x1:r,y1:a+u*s,x2:r+n,y2:a+u*s})}else{var x=+(i==="left"&&!o||i==="right"&&o);m=Kt(Kt({},m),{},{x1:r+x*n,y1:a,x2:r+x*n,y2:a+s})}return l.createElement("line",En({},m,{className:Ot("recharts-cartesian-axis-line",lu(c,"className"))}))}function a4(t,r,a,n,s,i,o,c,d){var m,u,x,h,f,g,b=c?-1:1,p=t.tickSize||o,v=nt(t.tickCoord)?t.tickCoord:t.coordinate;switch(i){case"top":m=u=t.coordinate,h=a+ +!c*s,x=h-b*p,g=x-b*d,f=v;break;case"left":x=h=t.coordinate,u=r+ +!c*n,m=u-b*p,f=m-b*d,g=v;break;case"right":x=h=t.coordinate,u=r+ +c*n,m=u+b*p,f=m+b*d,g=v;break;default:m=u=t.coordinate,h=a+ +c*s,x=h+b*p,g=x+b*d,f=v;break}return{line:{x1:m,y1:x,x2:u,y2:h},tick:{x:f,y:g}}}function n4(t,r){switch(t){case"left":return r?"start":"end";case"right":return r?"end":"start";default:return"middle"}}function s4(t,r){switch(t){case"left":case"right":return"middle";case"top":return r?"start":"end";default:return r?"end":"start"}}function i4(t){var{option:r,tickProps:a,value:n}=t,s,i=Ot(a.className,"recharts-cartesian-axis-tick-value");if(l.isValidElement(r))s=l.cloneElement(r,Kt(Kt({},a),{},{className:i}));else if(typeof r=="function")s=r(Kt(Kt({},a),{},{className:i}));else{var o="recharts-cartesian-axis-tick-value";typeof r!="boolean"&&(o=Ot(o,r==null?void 0:r.className)),s=l.createElement(nu,En({},a,{className:o}),n)}return s}var o4=l.forwardRef((t,r)=>{var{ticks:a=[],tick:n,tickLine:s,stroke:i,tickFormatter:o,unit:c,padding:d,tickTextProps:m,orientation:u,mirror:x,x:h,y:f,width:g,height:b,tickSize:p,tickMargin:v,fontSize:y,letterSpacing:j,getTicksConfig:S,events:N,axisType:w}=t,_=Lu(Kt(Kt({},S),{},{ticks:a}),y,j),P=n4(u,x),O=s4(u,x),T=Br(S),k=$n(n),$={};typeof s=="object"&&($=s);var C=Kt(Kt({},T),{},{fill:"none"},$),A=_.map(F=>Kt({entry:F},a4(F,h,f,g,b,u,p,x,v))),E=A.map(F=>{var{entry:D,line:q}=F;return l.createElement(Ut,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(D.value,"-").concat(D.coordinate,"-").concat(D.tickCoord)},s&&l.createElement("line",En({},C,q,{className:Ot("recharts-cartesian-axis-tick-line",lu(s,"className"))})))}),L=A.map((F,D)=>{var{entry:q,tick:Q}=F,de=Kt(Kt(Kt(Kt({textAnchor:P,verticalAnchor:O},T),{},{stroke:"none",fill:i},k),Q),{},{index:D,payload:q,visibleTicksCount:_.length,tickFormatter:o,padding:d},m);return l.createElement(Ut,En({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},Ps(N,q,D)),n&&l.createElement(i4,{option:n,tickProps:de,value:"".concat(typeof o=="function"?o(q.value,D):q.value).concat(c||"")}))});return l.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(w,"-ticks")},L.length>0&&l.createElement(ca,{zIndex:zr.label},l.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(w,"-tick-labels"),ref:r},L)),E.length>0&&l.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(w,"-tick-lines")},E))}),l4=l.forwardRef((t,r)=>{var{axisLine:a,width:n,height:s,className:i,hide:o,ticks:c,axisType:d}=t,m=J5(t,Y5),[u,x]=l.useState(""),[h,f]=l.useState(""),g=l.useRef(null);l.useImperativeHandle(r,()=>({getCalculatedWidth:()=>{var p;return X5({ticks:g.current,label:(p=t.labelRef)===null||p===void 0?void 0:p.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var b=l.useCallback(p=>{if(p){var v=p.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=v;var y=v[0];if(y){var j=window.getComputedStyle(y),S=j.fontSize,N=j.letterSpacing;(S!==u||N!==h)&&(x(S),f(N))}}},[u,h]);return o||n!=null&&n<=0||s!=null&&s<=0?null:l.createElement(ca,{zIndex:t.zIndex},l.createElement(Ut,{className:Ot("recharts-cartesian-axis",i)},l.createElement(r4,{x:t.x,y:t.y,width:n,height:s,orientation:t.orientation,mirror:t.mirror,axisLine:a,otherSvgProps:Br(t)}),l.createElement(o4,{ref:b,axisType:d,events:m,fontSize:u,getTicksConfig:t,height:t.height,letterSpacing:h,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:c,unit:t.unit,width:t.width,x:t.x,y:t.y}),l.createElement(Jy,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},l.createElement(Qy,{label:t.label,labelRef:t.labelRef}),t.children)))}),Du=l.forwardRef((t,r)=>{var a=hr(t,Da);return l.createElement(l4,En({},a,{ref:r}))});Du.displayName="CartesianAxis";var c4=["x1","y1","x2","y2","key"],d4=["offset"],u4=["xAxisId","yAxisId"],m4=["xAxisId","yAxisId"];function tx(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function br(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?tx(Object(a),!0).forEach(function(n){x4(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):tx(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function x4(t,r,a){return(r=h4(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function h4(t){var r=f4(t,"string");return typeof r=="symbol"?r:r+""}function f4(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function wn(){return wn=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},wn.apply(null,arguments)}function Io(t,r){if(t==null)return{};var a,n,s=g4(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function g4(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var p4=t=>{var{fill:r}=t;if(!r||r==="none")return null;var{fillOpacity:a,x:n,y:s,width:i,height:o,ry:c}=t;return l.createElement("rect",{x:n,y:s,ry:c,width:i,height:o,stroke:"none",fill:r,fillOpacity:a,className:"recharts-cartesian-grid-bg"})};function Kg(t){var{option:r,lineItemProps:a}=t,n;if(l.isValidElement(r))n=l.cloneElement(r,a);else if(typeof r=="function")n=r(a);else{var s,{x1:i,y1:o,x2:c,y2:d,key:m}=a,u=Io(a,c4),x=(s=Br(u))!==null&&s!==void 0?s:{},{offset:h}=x,f=Io(x,d4);n=l.createElement("line",wn({},f,{x1:i,y1:o,x2:c,y2:d,fill:"none",key:m}))}return n}function b4(t){var{x:r,width:a,horizontal:n=!0,horizontalPoints:s}=t;if(!n||!s||!s.length)return null;var{xAxisId:i,yAxisId:o}=t,c=Io(t,u4),d=s.map((m,u)=>{var x=br(br({},c),{},{x1:r,y1:m,x2:r+a,y2:m,key:"line-".concat(u),index:u});return l.createElement(Kg,{key:"line-".concat(u),option:n,lineItemProps:x})});return l.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function v4(t){var{y:r,height:a,vertical:n=!0,verticalPoints:s}=t;if(!n||!s||!s.length)return null;var{xAxisId:i,yAxisId:o}=t,c=Io(t,m4),d=s.map((m,u)=>{var x=br(br({},c),{},{x1:m,y1:r,x2:m,y2:r+a,key:"line-".concat(u),index:u});return l.createElement(Kg,{option:n,lineItemProps:x,key:"line-".concat(u)})});return l.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function y4(t){var{horizontalFill:r,fillOpacity:a,x:n,y:s,width:i,height:o,horizontalPoints:c,horizontal:d=!0}=t;if(!d||!r||!r.length||c==null)return null;var m=c.map(x=>Math.round(x+s-s)).sort((x,h)=>x-h);s!==m[0]&&m.unshift(0);var u=m.map((x,h)=>{var f=!m[h+1],g=f?s+o-x:m[h+1]-x;if(g<=0)return null;var b=h%r.length;return l.createElement("rect",{key:"react-".concat(h),y:x,x:n,height:g,width:i,stroke:"none",fill:r[b],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return l.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function j4(t){var{vertical:r=!0,verticalFill:a,fillOpacity:n,x:s,y:i,width:o,height:c,verticalPoints:d}=t;if(!r||!a||!a.length)return null;var m=d.map(x=>Math.round(x+s-s)).sort((x,h)=>x-h);s!==m[0]&&m.unshift(0);var u=m.map((x,h)=>{var f=!m[h+1],g=f?s+o-x:m[h+1]-x;if(g<=0)return null;var b=h%a.length;return l.createElement("rect",{key:"react-".concat(h),x,y:i,width:g,height:c,stroke:"none",fill:a[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return l.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var w4=(t,r)=>{var{xAxis:a,width:n,height:s,offset:i}=t;return kf(Lu(br(br(br({},Da),a),{},{ticks:Pf(a),viewBox:{x:0,y:0,width:n,height:s}})),i.left,i.left+i.width,r)},N4=(t,r)=>{var{yAxis:a,width:n,height:s,offset:i}=t;return kf(Lu(br(br(br({},Da),a),{},{ticks:Pf(a),viewBox:{x:0,y:0,width:n,height:s}})),i.top,i.top+i.height,r)},S4={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:zr.grid};function ps(t){var r=pf(),a=bf(),n=jf(),s=br(br({},hr(t,S4)),{},{x:nt(t.x)?t.x:n.left,y:nt(t.y)?t.y:n.top,width:nt(t.width)?t.width:n.width,height:nt(t.height)?t.height:n.height}),{xAxisId:i,yAxisId:o,x:c,y:d,width:m,height:u,syncWithTicks:x,horizontalValues:h,verticalValues:f}=s,g=On(),b=xt(O=>Sm(O,"xAxis",i,g)),p=xt(O=>Sm(O,"yAxis",o,g));if(!Cm(m)||!Cm(u)||!nt(c)||!nt(d))return null;var v=s.verticalCoordinatesGenerator||w4,y=s.horizontalCoordinatesGenerator||N4,{horizontalPoints:j,verticalPoints:S}=s;if((!j||!j.length)&&typeof y=="function"){var N=h&&h.length,w=y({yAxis:p?br(br({},p),{},{ticks:N?h:p.ticks}):void 0,width:r??m,height:a??u,offset:n},N?!0:x);_m(Array.isArray(w),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof w,"]")),Array.isArray(w)&&(j=w)}if((!S||!S.length)&&typeof v=="function"){var _=f&&f.length,P=v({xAxis:b?br(br({},b),{},{ticks:_?f:b.ticks}):void 0,width:r??m,height:a??u,offset:n},_?!0:x);_m(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof P,"]")),Array.isArray(P)&&(S=P)}return l.createElement(ca,{zIndex:s.zIndex},l.createElement("g",{className:"recharts-cartesian-grid"},l.createElement(p4,{fill:s.fill,fillOpacity:s.fillOpacity,x:s.x,y:s.y,width:s.width,height:s.height,ry:s.ry}),l.createElement(y4,wn({},s,{horizontalPoints:j})),l.createElement(j4,wn({},s,{verticalPoints:S})),l.createElement(b4,wn({},s,{offset:n,horizontalPoints:j,xAxis:b,yAxis:p})),l.createElement(v4,wn({},s,{offset:n,verticalPoints:S,xAxis:b,yAxis:p}))))}ps.displayName="CartesianGrid";var C4=["children"];function _4(t,r){if(t==null)return{};var a,n,s=k4(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function k4(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var P4={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},$4=l.createContext(P4);function E4(t){var{children:r}=t,a=_4(t,C4);return l.createElement($4.Provider,{value:a},r)}function zu(t,r){var a,n,s=xt(m=>Zy(m,t)),i=xt(m=>ej(m,r)),o=(a=s==null?void 0:s.allowDataOverflow)!==null&&a!==void 0?a:lr.allowDataOverflow,c=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:cr.allowDataOverflow,d=o||c;return{needClip:d,needClipX:o,needClipY:c}}function qg(t){var{xAxisId:r,yAxisId:a,clipPathId:n}=t,s=$f(),{needClipX:i,needClipY:o,needClip:c}=zu(r,a);if(!c||!s)return null;var{x:d,y:m,width:u,height:x}=s;return l.createElement("clipPath",{id:"clipPath-".concat(n)},l.createElement("rect",{x:i?d:d-u/2,y:o?m:m-x/2,width:i?u:u*2,height:o?x:x*2}))}function A4(t){var r=$n(t),a=3,n=2;if(r!=null){var{r:s,strokeWidth:i}=r,o=Number(s),c=Number(i);return(Number.isNaN(o)||o<0)&&(o=a),(Number.isNaN(c)||c<0)&&(c=n),{r:o,strokeWidth:c}}return{r:a,strokeWidth:n}}function Pa(t,r){var a,n;return(a=(n=t.graphicalItems.cartesianItems.find(s=>s.id===r))===null||n===void 0?void 0:n.xAxisId)!==null&&a!==void 0?a:Ef}function $a(t,r){var a,n;return(a=(n=t.graphicalItems.cartesianItems.find(s=>s.id===r))===null||n===void 0?void 0:n.yAxisId)!==null&&a!==void 0?a:Ef}var Xg=(t,r,a)=>on(t,"xAxis",Pa(t,r),a),Yg=(t,r,a)=>ln(t,"xAxis",Pa(t,r),a),Jg=(t,r,a)=>on(t,"yAxis",$a(t,r),a),Qg=(t,r,a)=>ln(t,"yAxis",$a(t,r),a),O4=Nr([Wa,Xg,Jg,Yg,Qg],(t,r,a,n,s)=>Of(t,"xAxis")?us(r,n,!1):us(a,s,!1)),I4=(t,r)=>r,Zg=Nr([uu,I4],(t,r)=>t.filter(a=>a.type==="area").find(a=>a.id===r)),ep=t=>{var r=Wa(t),a=Of(r,"xAxis");return a?"yAxis":"xAxis"},T4=(t,r)=>{var a=ep(t);return a==="yAxis"?$a(t,r):Pa(t,r)},M4=(t,r,a)=>kc(t,ep(t),T4(t,r),a),R4=Nr([Zg,M4],(t,r)=>{var a;if(!(t==null||r==null)){var{stackId:n}=t,s=Cf(t);if(!(n==null||s==null)){var i=(a=r[n])===null||a===void 0?void 0:a.stackedData,o=i==null?void 0:i.find(c=>c.key===s);if(o!=null)return o.map(c=>[c[0],c[1]])}}}),L4=Nr([Wa,Xg,Jg,Yg,Qg,R4,Af,O4,Zg,tj],(t,r,a,n,s,i,o,c,d,m)=>{var{chartData:u,dataStartIndex:x,dataEndIndex:h}=o;if(!(d==null||t!=="horizontal"&&t!=="vertical"||r==null||a==null||n==null||s==null||n.length===0||s.length===0||c==null)){var{data:f}=d,g;if(f&&f.length>0?g=f:g=u==null?void 0:u.slice(x,h+1),g!=null)return rS({layout:t,xAxis:r,yAxis:a,xAxisTicks:n,yAxisTicks:s,dataStartIndex:x,areaSettings:d,stackedData:i,displayedData:g,chartBaseValue:m,bandSize:c})}}),D4=["id"],z4=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function _n(){return _n=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},_n.apply(null,arguments)}function tp(t,r){if(t==null)return{};var a,n,s=F4(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function F4(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function rx(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function Qn(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?rx(Object(a),!0).forEach(function(n){B4(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):rx(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function B4(t,r,a){return(r=H4(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function H4(t){var r=W4(t,"string");return typeof r=="symbol"?r:r+""}function W4(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function To(t,r){return t&&t!=="none"?t:r}var U4=t=>{var{dataKey:r,name:a,stroke:n,fill:s,legendType:i,hide:o}=t;return[{inactive:o,dataKey:r,type:i,color:To(n,s),value:Es(a,r),payload:t}]},V4=l.memo(t=>{var{dataKey:r,data:a,stroke:n,strokeWidth:s,fill:i,name:o,hide:c,unit:d,tooltipType:m,id:u}=t,x={dataDefinedOnItem:a,positions:void 0,settings:{stroke:n,strokeWidth:s,fill:i,dataKey:r,nameKey:void 0,name:Es(o,r),hide:c,type:m,color:To(n,i),unit:d,graphicalItemId:u}};return l.createElement(ou,{tooltipEntrySettings:x})});function G4(t){var{clipPathId:r,points:a,props:n}=t,{needClip:s,dot:i,dataKey:o}=n,c=Br(n);return l.createElement(nj,{points:a,dot:i,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:c,needClip:s,clipPathId:r})}function K4(t){var{showLabels:r,children:a,points:n}=t,s=n.map(i=>{var o,c,d={x:(o=i.x)!==null&&o!==void 0?o:0,y:(c=i.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Qn(Qn({},d),{},{value:i.value,payload:i.payload,parentViewBox:void 0,viewBox:d,fill:void 0})});return l.createElement(Lf,{value:r?s:void 0},a)}function ax(t){var{points:r,baseLine:a,needClip:n,clipPathId:s,props:i}=t,{layout:o,type:c,stroke:d,connectNulls:m,isRange:u}=i,{id:x}=i,h=tp(i,D4),f=Br(h),g=sn(h);return l.createElement(l.Fragment,null,(r==null?void 0:r.length)>1&&l.createElement(Ut,{clipPath:n?"url(#clipPath-".concat(s,")"):void 0},l.createElement(ns,_n({},g,{id:x,points:r,connectNulls:m,type:c,baseLine:a,layout:o,stroke:"none",className:"recharts-area-area"})),d!=="none"&&l.createElement(ns,_n({},f,{className:"recharts-area-curve",layout:o,type:c,connectNulls:m,fill:"none",points:r})),d!=="none"&&u&&l.createElement(ns,_n({},f,{className:"recharts-area-curve",layout:o,type:c,connectNulls:m,fill:"none",points:a}))),l.createElement(G4,{points:r,props:h,clipPathId:s}))}function q4(t){var r,a,{alpha:n,baseLine:s,points:i,strokeWidth:o}=t,c=(r=i[0])===null||r===void 0?void 0:r.y,d=(a=i[i.length-1])===null||a===void 0?void 0:a.y;if(!Ba(c)||!Ba(d))return null;var m=n*Math.abs(c-d),u=Math.max(...i.map(x=>x.x||0));return nt(s)?u=Math.max(s,u):s&&Array.isArray(s)&&s.length&&(u=Math.max(...s.map(x=>x.x||0),u)),nt(u)?l.createElement("rect",{x:0,y:c<d?c:c-m,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(m)}):null}function X4(t){var r,a,{alpha:n,baseLine:s,points:i,strokeWidth:o}=t,c=(r=i[0])===null||r===void 0?void 0:r.x,d=(a=i[i.length-1])===null||a===void 0?void 0:a.x;if(!Ba(c)||!Ba(d))return null;var m=n*Math.abs(c-d),u=Math.max(...i.map(x=>x.y||0));return nt(s)?u=Math.max(s,u):s&&Array.isArray(s)&&s.length&&(u=Math.max(...s.map(x=>x.y||0),u)),nt(u)?l.createElement("rect",{x:c<d?c:c-m,y:0,width:m,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function Y4(t){var{alpha:r,layout:a,points:n,baseLine:s,strokeWidth:i}=t;return a==="vertical"?l.createElement(q4,{alpha:r,points:n,baseLine:s,strokeWidth:i}):l.createElement(X4,{alpha:r,points:n,baseLine:s,strokeWidth:i})}function J4(t){var{needClip:r,clipPathId:a,props:n,previousPointsRef:s,previousBaselineRef:i}=t,{points:o,baseLine:c,isAnimationActive:d,animationBegin:m,animationDuration:u,animationEasing:x,onAnimationStart:h,onAnimationEnd:f}=n,g=l.useMemo(()=>({points:o,baseLine:c}),[o,c]),b=Ci(g,"recharts-area-"),p=aj(),[v,y]=l.useState(!1),j=!v,S=l.useCallback(()=>{typeof f=="function"&&f(),y(!1)},[f]),N=l.useCallback(()=>{typeof h=="function"&&h(),y(!0)},[h]);if(p==null)return null;var w=s.current,_=i.current;return l.createElement(K4,{showLabels:j,points:o},n.children,l.createElement(_i,{animationId:b,begin:m,duration:u,isActive:d,easing:x,onAnimationEnd:S,onAnimationStart:N,key:b},P=>{if(w){var O=w.length/o.length,T=P===1?o:o.map(($,C)=>{var A=Math.floor(C*O);if(w[A]){var E=w[A];return Qn(Qn({},$),{},{x:Et(E.x,$.x,P),y:Et(E.y,$.y,P)})}return $}),k;return nt(c)?k=Et(_,c,P):$s(c)||Rf(c)?k=Et(_,0,P):k=c.map(($,C)=>{var A=Math.floor(C*O);if(Array.isArray(_)&&_[A]){var E=_[A];return Qn(Qn({},$),{},{x:Et(E.x,$.x,P),y:Et(E.y,$.y,P)})}return $}),P>0&&(s.current=T,i.current=k),l.createElement(ax,{points:T,baseLine:k,needClip:r,clipPathId:a,props:n})}return P>0&&(s.current=o,i.current=c),l.createElement(Ut,null,d&&l.createElement("defs",null,l.createElement("clipPath",{id:"animationClipPath-".concat(a)},l.createElement(Y4,{alpha:P,points:o,baseLine:c,layout:p,strokeWidth:n.strokeWidth}))),l.createElement(Ut,{clipPath:"url(#animationClipPath-".concat(a,")")},l.createElement(ax,{points:o,baseLine:c,needClip:r,clipPathId:a,props:n})))}),l.createElement(du,{label:n.label}))}function Q4(t){var{needClip:r,clipPathId:a,props:n}=t,s=l.useRef(null),i=l.useRef();return l.createElement(J4,{needClip:r,clipPathId:a,props:n,previousPointsRef:s,previousBaselineRef:i})}class Z4 extends l.PureComponent{render(){var{hide:r,dot:a,points:n,className:s,top:i,left:o,needClip:c,xAxisId:d,yAxisId:m,width:u,height:x,id:h,baseLine:f,zIndex:g}=this.props;if(r)return null;var b=Ot("recharts-area",s),p=h,{r:v,strokeWidth:y}=A4(a),j=rj(a),S=v*2+y,N=c?"url(#clipPath-".concat(j?"":"dots-").concat(p,")"):void 0;return l.createElement(ca,{zIndex:g},l.createElement(Ut,{className:b},c&&l.createElement("defs",null,l.createElement(qg,{clipPathId:p,xAxisId:d,yAxisId:m}),!j&&l.createElement("clipPath",{id:"clipPath-dots-".concat(p)},l.createElement("rect",{x:o-S/2,y:i-S/2,width:u+S,height:x+S}))),l.createElement(Q4,{needClip:c,clipPathId:p,props:this.props})),l.createElement(km,{points:n,mainColor:To(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}),this.props.isRange&&Array.isArray(f)&&l.createElement(km,{points:f,mainColor:To(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:N}))}}var rp={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:zr.area};function eS(t){var r,a=hr(t,rp),{activeDot:n,animationBegin:s,animationDuration:i,animationEasing:o,connectNulls:c,dot:d,fill:m,fillOpacity:u,hide:x,isAnimationActive:h,legendType:f,stroke:g,xAxisId:b,yAxisId:p}=a,v=tp(a,z4),y=Zo(),j=wf(),{needClip:S}=zu(b,p),N=On(),{points:w,isRange:_,baseLine:P}=(r=xt(A=>L4(A,t.id,N)))!==null&&r!==void 0?r:{},O=$f();if(y!=="horizontal"&&y!=="vertical"||O==null||j!=="AreaChart"&&j!=="ComposedChart")return null;var{height:T,width:k,x:$,y:C}=O;return!w||!w.length?null:l.createElement(Z4,_n({},v,{activeDot:n,animationBegin:s,animationDuration:i,animationEasing:o,baseLine:P,connectNulls:c,dot:d,fill:m,fillOpacity:u,height:T,hide:x,layout:y,isAnimationActive:h==="auto"?!_f.isSsr:h,isRange:_,legendType:f,needClip:S,points:w,stroke:g,width:k,left:$,top:C,xAxisId:b,yAxisId:p}))}var tS=(t,r,a,n,s)=>{var i=a??r;if(nt(i))return i;var o=t==="horizontal"?s:n,c=o.scale.domain();if(o.type==="number"){var d=Math.max(c[0],c[1]),m=Math.min(c[0],c[1]);return i==="dataMin"?m:i==="dataMax"||d<0?d:Math.max(Math.min(c[0],c[1]),0)}return i==="dataMin"?c[0]:i==="dataMax"?c[1]:c[0]};function rS(t){var{areaSettings:{connectNulls:r,baseValue:a,dataKey:n},stackedData:s,layout:i,chartBaseValue:o,xAxis:c,yAxis:d,displayedData:m,dataStartIndex:u,xAxisTicks:x,yAxisTicks:h,bandSize:f}=t,g=s&&s.length,b=tS(i,o,a,c,d),p=i==="horizontal",v=!1,y=m.map((S,N)=>{var w,_,P;if(g)P=s[u+N];else{var O=ja(S,n);Array.isArray(O)?(P=O,v=!0):P=[b,O]}var T=(w=(_=P)===null||_===void 0?void 0:_[1])!==null&&w!==void 0?w:null,k=T==null||g&&!r&&ja(S,n)==null;return p?{x:Pm({axis:c,ticks:x,bandSize:f,entry:S,index:N}),y:k?null:d.scale(T),value:P,payload:S}:{x:k?null:c.scale(T),y:Pm({axis:d,ticks:h,bandSize:f,entry:S,index:N}),value:P,payload:S}}),j;return g||v?j=y.map(S=>{var N=Array.isArray(S.value)?S.value[0]:null;return p?{x:S.x,y:N!=null&&S.y!=null?d.scale(N):null,payload:S.payload}:{x:N!=null?c.scale(N):null,y:S.y,payload:S.payload}}):j=p?d.scale(b):c.scale(b),{points:y,baseLine:j,isRange:v}}function aS(t){var r=hr(t,rp),a=On();return l.createElement(su,{id:r.id,type:"area"},n=>l.createElement(l.Fragment,null,l.createElement(If,{legendPayload:U4(r)}),l.createElement(V4,{dataKey:r.dataKey,data:r.data,stroke:r.stroke,strokeWidth:r.strokeWidth,fill:r.fill,name:r.name,hide:r.hide,unit:r.unit,tooltipType:r.tooltipType,id:n}),l.createElement(Tf,{type:"area",id:n,data:r.data,dataKey:r.dataKey,xAxisId:r.xAxisId,yAxisId:r.yAxisId,zAxisId:0,stackId:Mf(r.stackId),hide:r.hide,barSize:void 0,baseValue:r.baseValue,isPanorama:a,connectNulls:r.connectNulls}),l.createElement(eS,_n({},r,{id:n}))))}var Fu=l.memo(aS,mu);Fu.displayName="Area";var nS="Invariant failed";function sS(t,r){throw new Error(nS)}function Uc(){return Uc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Uc.apply(null,arguments)}function Mo(t){return l.createElement(Ug,Uc({shapeType:"rectangle",activeClassName:"recharts-active-bar"},t))}var iS=function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,s)=>{if(nt(r))return r;var i=nt(n)||$s(n);return i?r(n,s):(i||sS(),a)}},oS=(t,r,a)=>a,lS=(t,r)=>r,$i=Nr([uu,lS],(t,r)=>t.filter(a=>a.type==="bar").find(a=>a.id===r)),cS=Nr([$i],t=>t==null?void 0:t.maxBarSize),dS=(t,r,a,n)=>n,uS=Nr([Wa,uu,Pa,$a,oS],(t,r,a,n,s)=>r.filter(i=>t==="horizontal"?i.xAxisId===a:i.yAxisId===n).filter(i=>i.isPanorama===s).filter(i=>i.hide===!1).filter(i=>i.type==="bar")),mS=(t,r,a)=>{var n=Wa(t),s=Pa(t,r),i=$a(t,r);if(!(s==null||i==null))return n==="horizontal"?kc(t,"yAxis",i,a):kc(t,"xAxis",s,a)},xS=(t,r)=>{var a=Wa(t),n=Pa(t,r),s=$a(t,r);if(!(n==null||s==null))return a==="horizontal"?$m(t,"xAxis",n):$m(t,"yAxis",s)},hS=Nr([uS,oj,xS],_5),fS=(t,r,a)=>{var n,s,i=$i(t,r);if(i!=null){var o=Pa(t,r),c=$a(t,r);if(!(o==null||c==null)){var d=Wa(t),m=Df(t),{maxBarSize:u}=i,x=$s(u)?m:u,h,f;return d==="horizontal"?(h=on(t,"xAxis",o,a),f=ln(t,"xAxis",o,a)):(h=on(t,"yAxis",c,a),f=ln(t,"yAxis",c,a)),(n=(s=us(h,f,!0))!==null&&s!==void 0?s:x)!==null&&n!==void 0?n:0}}},ap=(t,r,a)=>{var n=Wa(t),s=Pa(t,r),i=$a(t,r);if(!(s==null||i==null)){var o,c;return n==="horizontal"?(o=on(t,"xAxis",s,a),c=ln(t,"xAxis",s,a)):(o=on(t,"yAxis",i,a),c=ln(t,"yAxis",i,a)),us(o,c)}},gS=Nr([hS,Df,sj,ij,fS,ap,cS],A5),pS=(t,r,a)=>{var n=Pa(t,r);if(n!=null)return on(t,"xAxis",n,a)},bS=(t,r,a)=>{var n=$a(t,r);if(n!=null)return on(t,"yAxis",n,a)},vS=(t,r,a)=>{var n=Pa(t,r);if(n!=null)return ln(t,"xAxis",n,a)},yS=(t,r,a)=>{var n=$a(t,r);if(n!=null)return ln(t,"yAxis",n,a)},jS=Nr([gS,$i],(t,r)=>{if(!(t==null||r==null)){var a=t.find(n=>n.stackId===r.stackId&&r.dataKey!=null&&n.dataKeys.includes(r.dataKey));if(a!=null)return a.position}}),wS=Nr([mS,$i],O5),NS=Nr([Nf,xu,pS,bS,vS,yS,jS,Wa,Af,ap,wS,$i,dS],(t,r,a,n,s,i,o,c,d,m,u,x,h)=>{var{chartData:f,dataStartIndex:g,dataEndIndex:b}=d;if(!(x==null||o==null||r==null||c!=="horizontal"&&c!=="vertical"||a==null||n==null||s==null||i==null||m==null)){var{data:p}=x,v;if(p!=null&&p.length>0?v=p:v=f==null?void 0:f.slice(g,b+1),v!=null)return QS({layout:c,barSettings:x,pos:o,parentViewBox:r,bandSize:m,xAxis:a,yAxis:n,xAxisTicks:s,yAxisTicks:i,stackedData:u,displayedData:v,offset:t,cells:h,dataStartIndex:g})}}),SS=["index"];function Vc(){return Vc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Vc.apply(null,arguments)}function CS(t,r){if(t==null)return{};var a,n,s=_S(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function _S(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var np=l.createContext(void 0),kS=t=>{var r=l.useContext(np);if(r!=null)return r.stackId;if(t!=null)return Mf(t)},PS=(t,r)=>"recharts-bar-stack-clip-path-".concat(t,"-").concat(r),$S=t=>{var r=l.useContext(np);if(r!=null){var{stackId:a}=r;return"url(#".concat(PS(a,t),")")}},ES=t=>{var{index:r}=t,a=CS(t,SS),n=$S(r);return l.createElement(Ut,Vc({className:"recharts-bar-stack-layer",clipPath:n},a))},AS=["onMouseEnter","onMouseLeave","onClick"],OS=["value","background","tooltipPosition"],IS=["id"],TS=["onMouseEnter","onClick","onMouseLeave"];function Ha(){return Ha=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Ha.apply(null,arguments)}function nx(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function _r(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?nx(Object(a),!0).forEach(function(n){MS(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):nx(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function MS(t,r,a){return(r=RS(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function RS(t){var r=LS(t,"string");return typeof r=="symbol"?r:r+""}function LS(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Ro(t,r){if(t==null)return{};var a,n,s=DS(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function DS(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}var zS=t=>{var{dataKey:r,name:a,fill:n,legendType:s,hide:i}=t;return[{inactive:i,dataKey:r,type:s,color:n,value:Es(a,r),payload:t}]},FS=l.memo(t=>{var{dataKey:r,stroke:a,strokeWidth:n,fill:s,name:i,hide:o,unit:c,tooltipType:d,id:m}=t,u={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:a,strokeWidth:n,fill:s,dataKey:r,nameKey:void 0,name:Es(i,r),hide:o,type:d,color:s,unit:c,graphicalItemId:m}};return l.createElement(ou,{tooltipEntrySettings:u})});function BS(t){var r=xt(cu),{data:a,dataKey:n,background:s,allOtherBarProps:i}=t,{onMouseEnter:o,onMouseLeave:c,onClick:d}=i,m=Ro(i,AS),u=Iu(o,n,i.id),x=Tu(c),h=Mu(d,n,i.id);if(!s||a==null)return null;var f=$n(s);return l.createElement(ca,{zIndex:I5(s,zr.barBackground)},a.map((g,b)=>{var{value:p,background:v,tooltipPosition:y}=g,j=Ro(g,OS);if(!v)return null;var S=u(g,b),N=x(g,b),w=h(g,b),_=_r(_r(_r(_r(_r({option:s,isActive:String(b)===r},j),{},{fill:"#eee"},v),f),Ps(m,g,b)),{},{onMouseEnter:S,onMouseLeave:N,onClick:w,dataKey:n,index:b,className:"recharts-bar-background-rectangle"});return l.createElement(Mo,Ha({key:"background-bar-".concat(b)},_))}))}function HS(t){var{showLabels:r,children:a,rects:n}=t,s=n==null?void 0:n.map(i=>{var o={x:i.x,y:i.y,width:i.width,lowerWidth:i.width,upperWidth:i.width,height:i.height};return _r(_r({},o),{},{value:i.value,payload:i.payload,parentViewBox:i.parentViewBox,viewBox:o,fill:i.fill})});return l.createElement(Lf,{value:r?s:void 0},a)}function WS(t){var{shape:r,activeBar:a,baseProps:n,entry:s,index:i,dataKey:o}=t,c=xt(cu),d=xt(Sf),m=a&&String(i)===c&&(d==null||o===d),u=m?a:r;return m?l.createElement(ca,{zIndex:zr.activeBar},l.createElement(Mo,Ha({},n,{name:String(n.name)},s,{isActive:m,option:u,index:i,dataKey:o}))):l.createElement(Mo,Ha({},n,{name:String(n.name)},s,{isActive:m,option:u,index:i,dataKey:o}))}function US(t){var{shape:r,baseProps:a,entry:n,index:s,dataKey:i}=t;return l.createElement(Mo,Ha({},a,{name:String(a.name)},n,{isActive:!1,option:r,index:s,dataKey:i}))}function VS(t){var r,{data:a,props:n}=t,s=(r=Br(n))!==null&&r!==void 0?r:{},{id:i}=s,o=Ro(s,IS),{shape:c,dataKey:d,activeBar:m}=n,{onMouseEnter:u,onClick:x,onMouseLeave:h}=n,f=Ro(n,TS),g=Iu(u,d,i),b=Tu(h),p=Mu(x,d,i);return a?l.createElement(l.Fragment,null,a.map((v,y)=>l.createElement(ES,Ha({index:y,key:"rectangle-".concat(v==null?void 0:v.x,"-").concat(v==null?void 0:v.y,"-").concat(v==null?void 0:v.value,"-").concat(y),className:"recharts-bar-rectangle"},Ps(f,v,y),{onMouseEnter:g(v,y),onMouseLeave:b(v,y),onClick:p(v,y)}),m?l.createElement(WS,{shape:c,activeBar:m,baseProps:o,entry:v,index:y,dataKey:d}):l.createElement(US,{shape:c,baseProps:o,entry:v,index:y,dataKey:d})))):null}function GS(t){var{props:r,previousRectanglesRef:a}=t,{data:n,layout:s,isAnimationActive:i,animationBegin:o,animationDuration:c,animationEasing:d,onAnimationEnd:m,onAnimationStart:u}=r,x=a.current,h=Ci(r,"recharts-bar-"),[f,g]=l.useState(!1),b=!f,p=l.useCallback(()=>{typeof m=="function"&&m(),g(!1)},[m]),v=l.useCallback(()=>{typeof u=="function"&&u(),g(!0)},[u]);return l.createElement(HS,{showLabels:b,rects:n},l.createElement(_i,{animationId:h,begin:o,duration:c,isActive:i,easing:d,onAnimationEnd:p,onAnimationStart:v,key:h},y=>{var j=y===1?n:n==null?void 0:n.map((S,N)=>{var w=x&&x[N];if(w)return _r(_r({},S),{},{x:Et(w.x,S.x,y),y:Et(w.y,S.y,y),width:Et(w.width,S.width,y),height:Et(w.height,S.height,y)});if(s==="horizontal"){var _=Et(0,S.height,y),P=Et(S.stackedBarStart,S.y,y);return _r(_r({},S),{},{y:P,height:_})}var O=Et(0,S.width,y),T=Et(S.stackedBarStart,S.x,y);return _r(_r({},S),{},{width:O,x:T})});return y>0&&(a.current=j??null),j==null?null:l.createElement(Ut,null,l.createElement(VS,{props:r,data:j}))}),l.createElement(du,{label:r.label}),r.children)}function KS(t){var r=l.useRef(null);return l.createElement(GS,{previousRectanglesRef:r,props:t})}var sp=0,qS=(t,r)=>{var a=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:a,errorVal:ja(t,r)}};class XS extends l.PureComponent{render(){var{hide:r,data:a,dataKey:n,className:s,xAxisId:i,yAxisId:o,needClip:c,background:d,id:m}=this.props;if(r||a==null)return null;var u=Ot("recharts-bar",s),x=m;return l.createElement(Ut,{className:u,id:m},c&&l.createElement("defs",null,l.createElement(qg,{clipPathId:x,xAxisId:i,yAxisId:o})),l.createElement(Ut,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(x,")"):void 0},l.createElement(BS,{data:a,dataKey:n,background:d,allOtherBarProps:this.props}),l.createElement(KS,this.props)))}}var YS={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:sp,xAxisId:0,yAxisId:0,zIndex:zr.bar};function JS(t){var{xAxisId:r,yAxisId:a,hide:n,legendType:s,minPointSize:i,activeBar:o,animationBegin:c,animationDuration:d,animationEasing:m,isAnimationActive:u}=t,{needClip:x}=zu(r,a),h=Zo(),f=On(),g=iu(t.children,gs),b=xt(y=>NS(y,t.id,f,g));if(h!=="vertical"&&h!=="horizontal")return null;var p,v=b==null?void 0:b[0];return v==null||v.height==null||v.width==null?p=0:p=h==="vertical"?v.height/2:v.width/2,l.createElement(E4,{xAxisId:r,yAxisId:a,data:b,dataPointFormatter:qS,errorBarOffset:p},l.createElement(XS,Ha({},t,{layout:h,needClip:x,data:b,xAxisId:r,yAxisId:a,hide:n,legendType:s,minPointSize:i,activeBar:o,animationBegin:c,animationDuration:d,animationEasing:m,isAnimationActive:u})))}function QS(t){var{layout:r,barSettings:{dataKey:a,minPointSize:n},pos:s,bandSize:i,xAxis:o,yAxis:c,xAxisTicks:d,yAxisTicks:m,stackedData:u,displayedData:x,offset:h,cells:f,parentViewBox:g,dataStartIndex:b}=t,p=r==="horizontal"?c:o,v=u?p.scale.domain():null,y=lj({numericAxis:p}),j=p.scale(y);return x.map((S,N)=>{var w,_,P,O,T,k;if(u){var $=u[N+b];if($==null)return null;w=cj($,v)}else w=ja(S,a),Array.isArray(w)||(w=[y,w]);var C=iS(n,sp)(w[1],N);if(r==="horizontal"){var A,[E,L]=[c.scale(w[0]),c.scale(w[1])];_=Em({axis:o,ticks:d,bandSize:i,offset:s.offset,entry:S,index:N}),P=(A=L??E)!==null&&A!==void 0?A:void 0,O=s.size;var F=E-L;if(T=Rf(F)?0:F,k={x:_,y:h.top,width:O,height:h.height},Math.abs(C)>0&&Math.abs(T)<Math.abs(C)){var D=Ma(T||C)*(Math.abs(C)-Math.abs(T));P-=D,T+=D}}else{var[q,Q]=[o.scale(w[0]),o.scale(w[1])];if(_=q,P=Em({axis:c,ticks:m,bandSize:i,offset:s.offset,entry:S,index:N}),O=Q-q,T=s.size,k={x:h.left,y:P,width:h.width,height:T},Math.abs(C)>0&&Math.abs(O)<Math.abs(C)){var de=Ma(O||C)*(Math.abs(C)-Math.abs(O));O+=de}}if(_==null||P==null||O==null||T==null)return null;var H=_r(_r({},S),{},{stackedBarStart:j,x:_,y:P,width:O,height:T,value:u?w:w[1],payload:S,background:k,tooltipPosition:{x:_+O/2,y:P+T/2},parentViewBox:g},f&&f[N]&&f[N].props);return H}).filter(Boolean)}function ZS(t){var r=hr(t,YS),a=kS(r.stackId),n=On();return l.createElement(su,{id:r.id,type:"bar"},s=>l.createElement(l.Fragment,null,l.createElement(If,{legendPayload:zS(r)}),l.createElement(FS,{dataKey:r.dataKey,stroke:r.stroke,strokeWidth:r.strokeWidth,fill:r.fill,name:r.name,hide:r.hide,unit:r.unit,tooltipType:r.tooltipType,id:s}),l.createElement(Tf,{type:"bar",id:s,data:void 0,xAxisId:r.xAxisId,yAxisId:r.yAxisId,zAxisId:0,dataKey:r.dataKey,stackId:a,hide:r.hide,barSize:r.barSize,minPointSize:r.minPointSize,maxBarSize:r.maxBarSize,isPanorama:n}),l.createElement(ca,{zIndex:r.zIndex},l.createElement(JS,Ha({},r,{id:s})))))}var Lo=l.memo(ZS,mu);Lo.displayName="Bar";var eC=["domain","range"],tC=["domain","range"];function sx(t,r){if(t==null)return{};var a,n,s=rC(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function rC(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function ix(t,r){return t===r?!0:Array.isArray(t)&&t.length===2&&Array.isArray(r)&&r.length===2?t[0]===r[0]&&t[1]===r[1]:!1}function ip(t,r){if(t===r)return!0;var{domain:a,range:n}=t,s=sx(t,eC),{domain:i,range:o}=r,c=sx(r,tC);return!ix(a,i)||!ix(n,o)?!1:mu(s,c)}var aC=["dangerouslySetInnerHTML","ticks","scale"],nC=["id","scale"];function Gc(){return Gc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Gc.apply(null,arguments)}function ox(t,r){if(t==null)return{};var a,n,s=sC(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function sC(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function iC(t){var r=ka(),a=l.useRef(null);return l.useLayoutEffect(()=>{a.current===null?r(dj(t)):a.current!==t&&r(uj({prev:a.current,next:t})),a.current=t},[t,r]),l.useLayoutEffect(()=>()=>{a.current&&(r(mj(a.current)),a.current=null)},[r]),null}var oC=t=>{var{xAxisId:r,className:a}=t,n=xt(xu),s=On(),i="xAxis",o=xt(v=>zf(v,i,r,s)),c=xt(v=>xj(v,r)),d=xt(v=>hj(v,r)),m=xt(v=>fj(v,r));if(c==null||d==null||m==null)return null;var{dangerouslySetInnerHTML:u,ticks:x,scale:h}=t,f=ox(t,aC),{id:g,scale:b}=m,p=ox(m,nC);return l.createElement(Du,Gc({},f,p,{x:d.x,y:d.y,width:c.width,height:c.height,className:Ot("recharts-".concat(i," ").concat(i),a),viewBox:n,ticks:o,axisType:i}))},lC={allowDataOverflow:lr.allowDataOverflow,allowDecimals:lr.allowDecimals,allowDuplicatedCategory:lr.allowDuplicatedCategory,angle:lr.angle,axisLine:Da.axisLine,height:lr.height,hide:!1,includeHidden:lr.includeHidden,interval:lr.interval,minTickGap:lr.minTickGap,mirror:lr.mirror,orientation:lr.orientation,padding:lr.padding,reversed:lr.reversed,scale:lr.scale,tick:lr.tick,tickCount:lr.tickCount,tickLine:Da.tickLine,tickSize:Da.tickSize,type:lr.type,xAxisId:0},cC=t=>{var r=hr(t,lC);return l.createElement(l.Fragment,null,l.createElement(iC,{allowDataOverflow:r.allowDataOverflow,allowDecimals:r.allowDecimals,allowDuplicatedCategory:r.allowDuplicatedCategory,angle:r.angle,dataKey:r.dataKey,domain:r.domain,height:r.height,hide:r.hide,id:r.xAxisId,includeHidden:r.includeHidden,interval:r.interval,minTickGap:r.minTickGap,mirror:r.mirror,name:r.name,orientation:r.orientation,padding:r.padding,reversed:r.reversed,scale:r.scale,tick:r.tick,tickCount:r.tickCount,tickFormatter:r.tickFormatter,ticks:r.ticks,type:r.type,unit:r.unit}),l.createElement(oC,r))},bs=l.memo(cC,ip);bs.displayName="XAxis";var dC=["dangerouslySetInnerHTML","ticks","scale"],uC=["id","scale"];function Kc(){return Kc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Kc.apply(null,arguments)}function lx(t,r){if(t==null)return{};var a,n,s=mC(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function mC(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function xC(t){var r=ka(),a=l.useRef(null);return l.useLayoutEffect(()=>{a.current===null?r(gj(t)):a.current!==t&&r(pj({prev:a.current,next:t})),a.current=t},[t,r]),l.useLayoutEffect(()=>()=>{a.current&&(r(bj(a.current)),a.current=null)},[r]),null}var hC=t=>{var{yAxisId:r,className:a,width:n,label:s}=t,i=l.useRef(null),o=l.useRef(null),c=xt(xu),d=On(),m=ka(),u="yAxis",x=xt(w=>vj(w,r)),h=xt(w=>yj(w,r)),f=xt(w=>zf(w,u,r,d)),g=xt(w=>jj(w,r));if(l.useLayoutEffect(()=>{if(!(n!=="auto"||!x||wj(s)||l.isValidElement(s)||g==null)){var w=i.current;if(w){var _=w.getCalculatedWidth();Math.round(x.width)!==Math.round(_)&&m(Nj({id:r,width:_}))}}},[f,x,m,s,r,n,g]),x==null||h==null||g==null)return null;var{dangerouslySetInnerHTML:b,ticks:p,scale:v}=t,y=lx(t,dC),{id:j,scale:S}=g,N=lx(g,uC);return l.createElement(Du,Kc({},y,N,{ref:i,labelRef:o,x:h.x,y:h.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:x.width,height:x.height,className:Ot("recharts-".concat(u," ").concat(u),a),viewBox:c,ticks:f,axisType:u}))},fC={allowDataOverflow:cr.allowDataOverflow,allowDecimals:cr.allowDecimals,allowDuplicatedCategory:cr.allowDuplicatedCategory,angle:cr.angle,axisLine:Da.axisLine,hide:!1,includeHidden:cr.includeHidden,interval:cr.interval,minTickGap:cr.minTickGap,mirror:cr.mirror,orientation:cr.orientation,padding:cr.padding,reversed:cr.reversed,scale:cr.scale,tick:cr.tick,tickCount:cr.tickCount,tickLine:Da.tickLine,tickSize:Da.tickSize,type:cr.type,width:cr.width,yAxisId:0},gC=t=>{var r=hr(t,fC);return l.createElement(l.Fragment,null,l.createElement(xC,{interval:r.interval,id:r.yAxisId,scale:r.scale,type:r.type,domain:r.domain,allowDataOverflow:r.allowDataOverflow,dataKey:r.dataKey,allowDuplicatedCategory:r.allowDuplicatedCategory,allowDecimals:r.allowDecimals,tickCount:r.tickCount,padding:r.padding,includeHidden:r.includeHidden,reversed:r.reversed,ticks:r.ticks,width:r.width,orientation:r.orientation,mirror:r.mirror,hide:r.hide,unit:r.unit,name:r.name,angle:r.angle,minTickGap:r.minTickGap,tick:r.tick,tickFormatter:r.tickFormatter}),l.createElement(hC,r))},vs=l.memo(gC,ip);vs.displayName="YAxis";function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},qc.apply(null,arguments)}var pC={top:5,right:5,bottom:5,left:5},bC={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:pC,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},op=l.forwardRef(function(r,a){var n,s=hr(r.categoricalChartProps,bC),{chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,categoricalChartProps:m}=r,u={chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,eventEmitter:void 0};return l.createElement(Sj,{preloadedState:{options:u},reduxStoreName:(n=m.id)!==null&&n!==void 0?n:i},l.createElement(Cj,{chartData:m.data}),l.createElement(_j,{layout:s.layout,margin:s.margin}),l.createElement(kj,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),l.createElement(Pj,qc({},s,{ref:a})))}),vC=["axis","item"],Xc=l.forwardRef((t,r)=>l.createElement(op,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:vC,tooltipPayloadSearcher:hu,categoricalChartProps:t,ref:r}));function cx(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function dx(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?cx(Object(a),!0).forEach(function(n){yC(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):cx(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function yC(t,r,a){return(r=jC(r))in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function jC(t){var r=wC(t,"string");return typeof r=="symbol"?r:r+""}function wC(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var n=a.call(t,r);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}var NC=["item"],SC=dx(dx({},Ej),{},{layout:"centric",startAngle:0,endAngle:360}),CC=l.forwardRef((t,r)=>{var a=hr(t,SC);return l.createElement($j,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:NC,tooltipPayloadSearcher:hu,categoricalChartProps:a,ref:r})}),_C=["axis"],lp=l.forwardRef((t,r)=>l.createElement(op,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:_C,tooltipPayloadSearcher:hu,categoricalChartProps:t,ref:r}));const kC=({user:t,myInvestigations:r,closedAlerts:a})=>{var A,E,L,F,D,q,Q,de,H,se,W,le,U,ee,ae,ue,fe,re;const[n,s]=l.useState(null),[i,o]=l.useState(!0),[c,d]=l.useState("overview"),[m,u]=l.useState(null),[x,h]=l.useState(null),[f,g]=l.useState(!1),[b,p]=l.useState(null),[v,y]=l.useState({weekly_report:!0,alert_assigned:!0,investigation_graded:!0}),[j,S]=l.useState(!1),[N,w]=l.useState(null),[_,P]=l.useState(!1),O=async()=>{try{const V=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),ce=await fetch(`${Y}/api/payment/cancel-subscription`,{method:"POST",headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}}),Z=await ce.json();ce.ok?(alert(`Subscription will be cancelled. You will retain access until ${new Date(Z.cancel_at).toLocaleDateString()}`),P(!1),window.location.reload()):(alert(Z.message||"Failed to cancel subscription"),P(!1))}catch(V){console.error(V),alert("Error cancelling subscription"),P(!1)}};l.useEffect(()=>{const V=async()=>{try{const pe=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),Se=await fetch(`${Y}/api/profile/me`,{headers:{Authorization:`Bearer ${pe}`}});if(Se.ok){const ke=await Se.json();s(ke)}else{const ke=await Se.text();throw new Error(`Server responded with ${Se.status}: ${ke}`)}}catch(pe){console.error("Error fetching profile:",pe),s({error:pe.message||"Unknown error occurred"})}finally{o(!1)}},ce=async()=>{try{const pe=await fetch(`${Y}/api/auth/config`);if(pe.ok){const Se=await pe.json();if(u(Se),Se.stripe_publishable_key){const ke=xf(Se.stripe_publishable_key);h(ke)}}}catch(pe){console.error("Failed to load config",pe)}},Z=async()=>{try{const pe=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),Se=await fetch(`${Y}/api/profile/email-preferences`,{headers:{Authorization:`Bearer ${pe}`}});if(Se.ok){const ke=await Se.json();y(ke)}}catch(pe){console.error("Error fetching email preferences:",pe)}},xe=async()=>{try{const pe=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),Se=await fetch(`${Y}/api/learning-paths/user/analytics`,{headers:{Authorization:`Bearer ${pe}`}});if(Se.ok){const ke=await Se.json();w(ke)}}catch(pe){console.error("Error fetching analytics:",pe)}};V(),ce(),Z(),xe()},[]);const T=async(V,ce="avatar")=>{const Z=V.target.files[0];if(!Z)return;const xe=new FormData;xe.append("image",Z),xe.append("type",ce);try{const pe=localStorage.getItem("token"),Se=await fetch(`${Y}/api/profile/upload`,{method:"POST",headers:{Authorization:`Bearer ${pe}`},body:xe});if(Se.ok){const ke=await Se.json();s(ce==="banner"?$e=>({...$e,banner_url:ke.banner_url}):$e=>({...$e,profile_picture:ke.profile_picture}))}}catch(pe){console.error("Error uploading image:",pe)}},k=V=>{switch(V){case"gold":return"from-yellow-400/20 to-yellow-600/20 border-yellow-500/50 text-yellow-400";case"silver":return"from-gray-300/20 to-gray-500/20 border-gray-400/50 text-gray-300";case"bronze":return"from-orange-700/20 to-orange-900/20 border-orange-600/50 text-orange-500";default:return"from-infosec-accent/20 to-purple-900/20 border-infosec-accent/50 text-infosec-accent"}},$=V=>{switch(V){case"gold":return"🏆";case"silver":return"🥈";case"bronze":return"🥉";default:return"🎖️"}},C=async(V,ce)=>{S(!0);const Z={...v,[V]:ce};y(Z);try{const xe=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token");(await fetch(`${Y}/api/profile/email-preferences`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe}`},body:JSON.stringify({[V]:ce})})).ok||(y(v),console.error("Failed to update email preferences"))}catch(xe){y(v),console.error("Error updating email preferences:",xe)}finally{S(!1)}};return i?e.jsx("div",{className:"text-white",children:"Loading profile..."}):n?n.error?e.jsxs("div",{className:"text-red-500 font-bold p-8",children:["Error loading profile: ",n.error]}):e.jsxs("div",{className:"max-w-7xl mx-auto pb-12 pt-4",children:[e.jsxs("div",{className:"relative rounded-[32px] overflow-hidden mb-12 border border-white/5 bg-[#151619]/90 backdrop-blur-2xl shadow-2xl",children:[e.jsx("div",{className:`absolute inset-0 bg-gradient-to-br mix-blend-screen opacity-40 ${(((A=n==null?void 0:n.academy_stats)==null?void 0:A.xp)||0)<1e3?"from-[#00ff87]/20 via-transparent to-[#60efff]/20":(((E=n==null?void 0:n.academy_stats)==null?void 0:E.xp)||0)<5e3?"from-purple-500/20 via-transparent to-pink-500/20":"from-[#ffd700]/20 via-transparent to-[#ff8c00]/20"}`}),e.jsx("div",{className:"absolute inset-0 opacity-[0.15] mix-blend-overlay",style:{backgroundImage:"url('https://grainy-gradients.vercel.app/noise.svg')"}}),e.jsxs("div",{className:"relative p-8 md:p-12 flex flex-col md:flex-row items-center md:items-start gap-8 z-10",children:[e.jsxs(jt.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},className:"relative group/avatar",children:[e.jsx("div",{className:"w-40 h-40 rounded-[32px] p-1 bg-gradient-to-br from-white/20 to-white/5 shadow-2xl backdrop-blur-xl rotate-3 transition-transform duration-500 hover:rotate-0",children:n!=null&&n.profile_picture?e.jsx("img",{src:`${Y}${n==null?void 0:n.profile_picture}`,alt:"Profile",className:"w-full h-full rounded-[28px] object-cover"}):e.jsx("div",{className:"w-full h-full rounded-[28px] bg-gradient-to-br from-[#1a1c23] to-[#0f1115] flex items-center justify-center text-5xl font-black text-white/50 border border-white/5",children:((L=n==null?void 0:n.name)==null?void 0:L.charAt(0))||"U"})}),e.jsxs("label",{className:"absolute -bottom-2 -right-2 z-20 bg-[#00ff87] text-[#0f1115] p-3 rounded-xl cursor-pointer hover:bg-[#00cc6a] transition-all shadow-[0_0_20px_rgba(0,255,135,0.4)] border border-white/20 opacity-0 group-hover/avatar:opacity-100 -rotate-3 hover:scale-110",children:[e.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:V=>T(V,"avatar")}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 font-bold",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"})]})]})]}),e.jsxs("div",{className:"flex-1 text-center md:text-left pt-2",children:[e.jsxs(jt.h1,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},className:"text-4xl md:text-5xl font-black text-transparent bg-clip-text bg-gradient-to-r from-white via-white/90 to-white/50 mb-2 tracking-tight flex items-center justify-center md:justify-start gap-4",children:[n==null?void 0:n.name," ",n==null?void 0:n.surname,(n==null?void 0:n.role)==="admin"&&e.jsx("span",{className:"bg-red-500/20 text-red-400 text-xs px-3 py-1.5 rounded-lg border border-red-500/30 uppercase tracking-widest font-bold shadow-[0_0_15px_rgba(239,68,68,0.2)]",children:"Admin"})]}),e.jsxs(jt.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.1},className:"text-lg text-gray-400 font-medium mb-6 flex items-center justify-center md:justify-start gap-2",children:[e.jsxs("span",{className:"text-white/80",children:["@",n==null?void 0:n.username]}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white/20"}),e.jsxs("span",{children:["Member since ",new Date(n==null?void 0:n.created_at).getFullYear()]})]}),(n==null?void 0:n.badges)&&n.badges.length>0&&e.jsx(jt.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.2},className:"flex flex-wrap gap-3 justify-center md:justify-start",children:n.badges.slice(0,3).map((V,ce)=>e.jsxs("div",{className:`flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-bold border backdrop-blur-md transition-all hover:scale-105 shadow-xl ${V.type==="gold"?"bg-[#ffd700]/10 border-[#ffd700]/30 text-[#ffd700] shadow-[0_0_15px_rgba(255,215,0,0.15)]":V.type==="silver"?"bg-[#e0e0e0]/10 border-[#e0e0e0]/30 text-[#e0e0e0] shadow-[0_0_15px_rgba(224,224,224,0.1)]":V.type==="bronze"?"bg-[#ff8c00]/10 border-[#ff8c00]/30 text-[#ff8c00] shadow-[0_0_15px_rgba(255,140,0,0.15)]":"bg-[#00ff87]/10 border-[#00ff87]/30 text-[#00ff87] shadow-[0_0_15px_rgba(0,255,135,0.15)]"}`,children:[e.jsx("span",{className:"text-lg drop-shadow-[0_2px_4px_rgba(0,0,0,0.4)]",children:$(V.type)}),V.name]},ce))})]})]})]}),e.jsxs("div",{className:"px-8 flex gap-8 border-t border-gray-800 bg-[#0f1115]/50 rounded-b-[32px] pt-2",children:[e.jsx("button",{onClick:()=>d("overview"),className:`py-4 text-sm font-bold border-b-2 transition-colors ${c==="overview"?"border-[#00ff87] text-white":"border-transparent text-gray-500 hover:text-gray-300"}`,children:"Overview"}),e.jsx("button",{onClick:()=>d("settings"),className:`py-4 text-sm font-bold border-b-2 transition-colors ${c==="settings"?"border-[#00ff87] text-white":"border-transparent text-gray-500 hover:text-gray-300"}`,children:"Settings"}),e.jsxs("button",{onClick:()=>d("referrals"),className:`py-4 text-sm font-bold border-b-2 transition-colors flex items-center gap-2 ${c==="referrals"?"border-[#00ff87] text-white":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[e.jsx("span",{children:"🎁"})," Refer a Friend"]}),!(m!=null&&m.hide_tiers)&&e.jsx("button",{onClick:()=>d("billing"),className:`py-4 text-sm font-bold border-b-2 transition-colors ${c==="billing"?"border-[#00ff87] text-white":"border-transparent text-gray-500 hover:text-gray-300"}`,children:"Billing"})]}),c==="overview"&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs(jt.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.3},className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-[#151619]/80 backdrop-blur-xl border border-white/5 rounded-[24px] p-6 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute -right-10 -top-10 w-32 h-32 bg-[#00ff87]/10 rounded-full blur-2xl group-hover:bg-[#00ff87]/20 transition-all duration-500"}),e.jsxs("div",{className:"flex justify-between items-start mb-4 relative z-10",children:[e.jsx("div",{className:"p-3 bg-gradient-to-br from-[#00ff87]/20 to-transparent rounded-2xl border border-[#00ff87]/20 text-[#00ff87]",children:e.jsx(ru,{className:"w-6 h-6"})}),e.jsx("span",{className:"text-[10px] font-black text-gray-500 uppercase tracking-widest bg-white/5 px-2 py-1 rounded-lg",children:"Level"})]}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-3xl font-black text-white mb-1 group-hover:text-[#00ff87] transition-colors",children:((F=N==null?void 0:N.xp)==null?void 0:F.level)||((D=n==null?void 0:n.academy_stats)==null?void 0:D.level)||1}),e.jsx("div",{className:"text-sm font-bold text-gray-400",children:"SOC Analyst"})]})]}),e.jsxs("div",{className:"bg-[#151619]/80 backdrop-blur-xl border border-white/5 rounded-[24px] p-6 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute -right-10 -top-10 w-32 h-32 bg-purple-500/10 rounded-full blur-2xl group-hover:bg-purple-500/20 transition-all duration-500"}),e.jsxs("div",{className:"flex justify-between items-start mb-4 relative z-10",children:[e.jsx("div",{className:"p-3 bg-gradient-to-br from-purple-500/20 to-transparent rounded-2xl border border-purple-500/20 text-purple-400",children:e.jsx(hf,{className:"w-6 h-6"})}),e.jsx("span",{className:"text-[10px] font-black text-gray-500 uppercase tracking-widest bg-white/5 px-2 py-1 rounded-lg",children:"Total"})]}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-3xl font-black text-white mb-1 group-hover:text-purple-400 transition-colors",children:(((q=N==null?void 0:N.xp)==null?void 0:q.total)||((Q=n==null?void 0:n.academy_stats)==null?void 0:Q.xp)||0).toLocaleString()}),e.jsx("div",{className:"text-sm font-bold text-gray-400",children:"Experience Points (XP)"})]})]}),e.jsxs("div",{className:"bg-[#151619]/80 backdrop-blur-xl border border-white/5 rounded-[24px] p-6 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute -right-10 -top-10 w-32 h-32 bg-blue-500/10 rounded-full blur-2xl group-hover:bg-blue-500/20 transition-all duration-500"}),e.jsxs("div",{className:"flex justify-between items-start mb-4 relative z-10",children:[e.jsx("div",{className:"p-3 bg-gradient-to-br from-blue-500/20 to-transparent rounded-2xl border border-blue-500/20 text-blue-400",children:e.jsx(Er,{className:"w-6 h-6"})}),e.jsx("span",{className:"text-[10px] font-black text-gray-500 uppercase tracking-widest bg-white/5 px-2 py-1 rounded-lg",children:"Cleared"})]}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-3xl font-black text-white mb-1 group-hover:text-blue-400 transition-colors",children:((de=N==null?void 0:N.investigations)==null?void 0:de.completed)||(a==null?void 0:a.length)||0}),e.jsx("div",{className:"text-sm font-bold text-gray-400",children:"Operations Finalized"})]})]}),e.jsxs("div",{className:"bg-[#151619]/80 backdrop-blur-xl border border-white/5 rounded-[24px] p-6 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute -right-10 -top-10 w-32 h-32 bg-[#ffd700]/10 rounded-full blur-2xl group-hover:bg-[#ffd700]/20 transition-all duration-500"}),e.jsxs("div",{className:"flex justify-between items-start mb-4 relative z-10",children:[e.jsx("div",{className:"p-3 bg-gradient-to-br from-[#ffd700]/20 to-transparent rounded-2xl border border-[#ffd700]/20 text-[#ffd700]",children:e.jsx(ya,{className:"w-6 h-6"})}),e.jsx("span",{className:"text-[10px] font-black text-gray-500 uppercase tracking-widest bg-white/5 px-2 py-1 rounded-lg",children:"Earned"})]}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-3xl font-black text-white mb-1 group-hover:text-[#ffd700] transition-colors",children:((H=n==null?void 0:n.badges)==null?void 0:H.length)||0}),e.jsx("div",{className:"text-sm font-bold text-gray-400",children:"Badges Procured"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center bg-gray-900/30",children:[e.jsx("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:"📚 Learning Paths"}),e.jsx(Sc,{to:"/academy",className:"text-xs font-bold text-infosec-accent hover:text-white transition-colors",children:"VIEW ALL"})]}),e.jsx("div",{className:"p-6 flex-1",children:e.jsx("div",{className:"space-y-6",children:(se=N==null?void 0:N.learningPaths)!=null&&se.length?N.learningPaths.slice(0,4).map(V=>e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex justify-between items-end mb-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-white font-bold block mb-1 group-hover:text-infosec-accent transition-colors",children:V.title}),e.jsxs("span",{className:"text-xs text-gray-500",children:[V.completed_modules||0,"/",V.total_modules||0," Modules"]})]}),e.jsxs("span",{className:`text-sm font-bold ${V.percentage_completed>=100?"text-green-400":"text-infosec-accent"}`,children:[Math.round(V.percentage_completed||0),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-800 rounded-full h-2 overflow-hidden shadow-inner",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${V.percentage_completed>=100?"bg-gradient-to-r from-green-500 to-emerald-400":"bg-gradient-to-r from-purple-600 to-indigo-500 relative overflow-hidden group-hover:brightness-110"}`,style:{width:`${V.percentage_completed||0}%`},children:V.percentage_completed<100&&e.jsx("div",{className:"absolute inset-0 bg-white/20 w-full animate-[shimmer_2s_infinite] skew-x-12 -translate-x-full"})})}),V.certificate_id&&e.jsxs("div",{className:"flex items-center gap-2 mt-2 text-green-400 text-xs font-bold bg-green-500/10 px-2 py-1 rounded w-fit",children:[e.jsx("span",{children:"🏆"})," Certificate Earned"]})]},V.id)):e.jsxs("div",{className:"text-gray-500 text-center py-8",children:[e.jsx("div",{className:"text-4xl mb-3",children:"🎓"}),e.jsx("p",{children:"No paths enrolled yet."}),e.jsx(Sc,{to:"/academy",className:"text-infosec-accent hover:underline mt-2 inline-block",children:"Browse Academy"})]})})})]}),e.jsxs("div",{className:"space-y-6",children:[((W=N==null?void 0:N.moduleScores)==null?void 0:W.length)>2&&e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl overflow-hidden",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 bg-gray-900/30",children:e.jsx("h3",{className:"text-lg font-bold text-white",children:"📊 Skill Breakdown"})}),e.jsxs("div",{className:"p-6 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-purple-500/5 pointer-events-none"}),e.jsx(Ra,{width:"100%",height:250,children:e.jsxs(fu,{data:N.moduleScores.slice(0,6).map(V=>({subject:V.title.length>15?V.title.substring(0,15)+"...":V.title,score:Number(V.avg_score)||0,fullMark:100})),children:[e.jsx(gu,{stroke:"#333",strokeDasharray:"3 3"}),e.jsx(pu,{dataKey:"subject",tick:{fill:"#9ca3af",fontSize:10,fontWeight:500}}),e.jsx(il,{angle:30,domain:[0,100],tick:{fill:"#666"}}),e.jsx(bu,{name:"Score",dataKey:"score",stroke:"#b026ff",strokeWidth:2,fill:"#b026ff",fillOpacity:.3}),e.jsx(La,{contentStyle:{backgroundColor:"#111",border:"1px solid #333",borderRadius:"8px"},itemStyle:{color:"#b026ff"}})]})})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl overflow-hidden",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 bg-gray-900/30",children:e.jsx("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:"🔍 Investigation Stats"})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-around",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute inset-0 bg-green-500/5 blur-xl rounded-full opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("svg",{width:"140",height:"140",className:"transform -rotate-90 relative z-10",children:[e.jsx("circle",{cx:"70",cy:"70",r:"60",stroke:"#2a2b30",strokeWidth:"10",fill:"none"}),e.jsx("circle",{cx:"70",cy:"70",r:"60",stroke:"#00ff41",strokeWidth:"10",fill:"none",strokeDasharray:2*Math.PI*60,strokeDashoffset:2*Math.PI*60-(((le=N==null?void 0:N.investigations)==null?void 0:le.avgGrade)||0)/100*2*Math.PI*60,strokeLinecap:"round",className:"transition-all duration-1000 drop-shadow-[0_0_10px_rgba(0,255,65,0.5)]"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-20",children:[e.jsxs("span",{className:"text-3xl font-extrabold text-white",children:[Math.round(((U=N==null?void 0:N.investigations)==null?void 0:U.avgGrade)||((ee=n==null?void 0:n.academy_stats)==null?void 0:ee.grade)||0),"%"]}),e.jsx("span",{className:"text-xs text-gray-400 uppercase tracking-wider font-bold mt-1",children:"Avg Grade"})]})]}),e.jsxs("div",{className:"space-y-4 text-sm w-1/2 pl-4 border-l border-gray-800",children:[e.jsxs("div",{className:"flex justify-between items-center group cursor-default",children:[e.jsx("span",{className:"text-gray-400 group-hover:text-white transition-colors",children:"Total Cases"}),e.jsx("span",{className:"text-white font-bold bg-gray-800 px-2 py-0.5 rounded",children:((ae=N==null?void 0:N.investigations)==null?void 0:ae.total)||(a==null?void 0:a.length)+((r==null?void 0:r.length)||0)||0})]}),e.jsxs("div",{className:"flex justify-between items-center group cursor-default",children:[e.jsx("span",{className:"text-gray-400 group-hover:text-green-400 transition-colors",children:"Solved"}),e.jsx("span",{className:"text-green-400 font-bold bg-green-500/10 px-2 py-0.5 rounded",children:((ue=N==null?void 0:N.investigations)==null?void 0:ue.completed)||(a==null?void 0:a.length)||0})]}),e.jsxs("div",{className:"flex justify-between items-center group cursor-default",children:[e.jsx("span",{className:"text-gray-400 group-hover:text-yellow-400 transition-colors",children:"Active"}),e.jsx("span",{className:"text-yellow-400 font-bold bg-yellow-500/10 px-2 py-0.5 rounded",children:((fe=N==null?void 0:N.investigations)==null?void 0:fe.inProgress)||(r==null?void 0:r.length)||0})]})]})]})})]})]})]}),((re=N==null?void 0:N.recentActivity)==null?void 0:re.length)>0&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 pb-8",children:[e.jsx("div",{className:"lg:col-span-4 space-y-6",children:e.jsxs(jt.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.6},className:"bg-[#151619]/90 backdrop-blur-2xl border border-white/10 rounded-[2rem] p-6 shadow-2xl relative",children:[e.jsxs("h3",{className:"text-xl font-bold text-white mb-8 flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-gradient-to-br from-purple-500/20 to-pink-600/20 border border-purple-500/30 rounded-xl shadow-[0_0_15px_rgba(168,85,247,0.2)]",children:e.jsx(Er,{className:"w-5 h-5 text-purple-400"})}),"Live Operations Feed"]}),e.jsxs("div",{className:"space-y-6 relative max-h-[450px] overflow-y-auto px-2 pt-2 pb-6 custom-scrollbar",children:[e.jsx("style",{children:`
                                            .custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
                                            .custom-scrollbar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); borderRadius: 10px; }
                                            .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.5); borderRadius: 10px; }
                                            .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, 0.8); }
                                        `}),e.jsx("div",{className:"absolute left-[31px] top-6 bottom-6 w-[2px] bg-gradient-to-b from-purple-500/50 via-cyan-500/20 to-transparent"}),N.recentActivity.slice(0,10).map((V,ce)=>e.jsxs(jt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.3+ce*.1},className:"relative pl-12 group pr-2",children:[e.jsx("div",{className:`absolute left-0 top-3 w-8 h-8 rounded-full flex items-center justify-center z-10 transition-transform duration-300 group-hover:scale-110 group-hover:rotate-12 ${V.type==="flag"?"bg-[#0f1115] border-[2px] border-cyan-500 text-cyan-400 shadow-[0_0_15px_rgba(6,182,212,0.5)]":V.type==="badge"?"bg-[#0f1115] border-[2px] border-yellow-500 text-yellow-400 shadow-[0_0_15px_rgba(234,179,8,0.5)]":"bg-[#0f1115] border-[2px] border-purple-500 text-purple-400 shadow-[0_0_15px_rgba(168,85,247,0.5)]"}`,children:V.type==="flag"?e.jsx(Mt,{className:"w-3 h-3"}):V.type==="badge"?e.jsx(ya,{className:"w-3 h-3"}):e.jsx(kr,{className:"w-3 h-3"})}),e.jsxs("div",{className:"bg-[#0f1115]/80 p-4 rounded-xl border border-white/5 group-hover:border-white/20 transition-all duration-300 hover:shadow-lg",children:[e.jsx("div",{className:"text-[13px] font-bold text-white mb-1.5 leading-snug group-hover:text-cyan-100 transition-colors",children:V.title}),e.jsxs("div",{className:"flex justify-between items-center text-[10px] font-mono",children:[e.jsx("span",{className:"text-gray-500",children:new Date(V.date).toLocaleDateString()}),V.score>0&&e.jsxs("span",{className:"text-green-400 font-bold bg-green-400/10 border border-green-400/20 px-2 rounded-sm",children:[Math.round(V.score),"%"]})]})]})]},ce))]})]})}),e.jsx("div",{className:"lg:col-span-8 flex flex-col gap-6",children:e.jsxs(jt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.4},className:"bg-[#151619]/90 backdrop-blur-2xl border border-white/10 rounded-[2rem] p-6 lg:p-8 shadow-2xl overflow-hidden",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-gradient-to-br from-emerald-500/20 to-green-600/20 border border-emerald-500/30 rounded-xl shadow-[0_0_15px_rgba(16,185,129,0.2)]",children:e.jsx(Oj,{className:"w-5 h-5 text-emerald-400"})}),"Activity Heatmap"]}),e.jsx("div",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest bg-[#0f1115] border border-white/5 px-3 py-1.5 rounded-lg hidden sm:block",children:"Last 6 Months"})]}),e.jsx("div",{className:"w-full overflow-hidden",children:e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-4 mask-linear-fade custom-scrollbar",children:Array.from({length:26}).map((V,ce)=>e.jsx("div",{className:"grid grid-rows-7 gap-2",children:Array.from({length:7}).map((Z,xe)=>{var je;const Se=new Date,ke=(25-ce)*7+(6-xe),$e=new Date(Se);$e.setDate(Se.getDate()-ke);const K=((je=N.recentActivity)==null?void 0:je.filter(Te=>{const Ie=new Date(Te.date);return Ie.getDate()===$e.getDate()&&Ie.getMonth()===$e.getMonth()&&Ie.getFullYear()===$e.getFullYear()}).length)||0,ie=Math.min(K,4),I=["bg-white/5 border border-white/10","bg-emerald-900/40 border-emerald-900/50","bg-emerald-700/60 border-emerald-700/50","bg-emerald-500/80 border-emerald-500/50 shadow-[0_0_5px_rgba(16,185,129,0.3)]","bg-emerald-400 border-emerald-300 shadow-[0_0_10px_rgba(52,211,153,0.6)]"],R=$e.toLocaleDateString(void 0,{month:"short",day:"numeric"});return e.jsx(jt.div,{whileHover:{scale:1.5,zIndex:10,borderRadius:"4px"},className:`w-4 h-4 rounded-[6px] border ${I[ie]} transition-all cursor-pointer`,title:`${R}: ${K} actions`},xe)})},ce))})}),e.jsxs("div",{className:"flex justify-end items-center gap-3 mt-4 text-[10px] font-bold text-gray-500 uppercase tracking-wider",children:[e.jsx("span",{children:"Less"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"w-4 h-4 rounded-[6px] bg-white/5 border border-white/10"}),e.jsx("div",{className:"w-4 h-4 rounded-[6px] bg-emerald-900/40 border border-emerald-900/50"}),e.jsx("div",{className:"w-4 h-4 rounded-[6px] bg-emerald-700/60 border border-emerald-700/50"}),e.jsx("div",{className:"w-4 h-4 rounded-[6px] bg-emerald-500/80 border border-emerald-500/50 shadow-[0_0_5px_rgba(16,185,129,0.3)]"}),e.jsx("div",{className:"w-4 h-4 rounded-[6px] bg-emerald-400 border border-emerald-300 shadow-[0_0_10px_rgba(52,211,153,0.6)]"})]}),e.jsx("span",{children:"More"})]})]})})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"🏆"})," Awards & Badges"]}),n.all_badges&&n.all_badges.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:n.all_badges.map((V,ce)=>{const Z=n.earned_badge_ids&&n.earned_badge_ids.includes(V.id),xe=n.badges&&n.badges.find(Se=>Se.id===V.id),pe=xe==null?void 0:xe.awarded_at;return e.jsxs("div",{className:`relative overflow-hidden flex items-center gap-4 bg-[#1a1b1e] border rounded-xl p-4 transition-all hover:-translate-y-1 hover:shadow-lg ${Z?k(V.type):"border-gray-800 opacity-60 grayscale"}`,children:[Z&&e.jsx("div",{className:"absolute top-0 right-0 p-8 opacity-5 filter blur-xl bg-current transform translate-x-1/2 -translate-y-1/2"}),e.jsx("div",{className:"text-4xl filter drop-shadow-md z-10",children:$(V.type)}),e.jsxs("div",{className:"z-10",children:[e.jsx("div",{className:"font-bold text-lg text-white",children:V.name}),Z?e.jsxs("div",{className:"text-xs opacity-70 mb-1",children:["Earned ",pe?new Date(pe).toLocaleDateString():"Recently"]}):e.jsxs("div",{className:"text-xs text-gray-500 mb-1 flex items-center gap-1",children:["🔒 Locked • ",V.xp_reward," XP"]}),e.jsx("div",{className:"text-xs opacity-90 leading-tight",children:V.description})]})]},ce)})}):e.jsx("div",{className:"text-gray-500 italic",children:"No badges available."})]})]}),c==="referrals"&&e.jsx("div",{className:"pt-4",children:e.jsx(iw,{user:t})}),c==="settings"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3",children:[e.jsx("span",{className:"w-10 h-10 bg-infosec-accent/20 rounded-lg flex items-center justify-center text-infosec-accent",children:"👤"}),"Account Information"]}),e.jsx("p",{className:"text-gray-400 text-sm mt-2",children:"Manage your personal account details"})]}),e.jsx("div",{className:"p-6 space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Full Name"}),e.jsxs("div",{className:"text-white font-medium",children:[n==null?void 0:n.name," ",n==null?void 0:n.surname]})]}),e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Username"}),e.jsxs("div",{className:"text-white font-medium",children:["@",(n==null?void 0:n.username)||"Not set"]})]}),e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Email Address"}),e.jsx("div",{className:"text-white font-medium",children:n==null?void 0:n.email})]}),e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Account Type"}),e.jsx("div",{className:"text-white font-medium capitalize",children:(n==null?void 0:n.role)||"Normal"})]}),e.jsxs("div",{className:"p-4 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wider mb-1",children:"Member Since"}),e.jsx("div",{className:"text-white font-medium",children:n!=null&&n.created_at?new Date(n.created_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"Unknown"})]})]})})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3",children:[e.jsx("span",{className:"w-10 h-10 bg-green-500/20 rounded-lg flex items-center justify-center text-green-400",children:"🔒"}),"Security"]}),e.jsx("p",{className:"text-gray-400 text-sm mt-2",children:"Update your password and email"})]}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"p-5 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsxs("h4",{className:"text-md font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"🔑"})," Change Password"]}),e.jsx("form",{onSubmit:async V=>{V.preventDefault();const ce=V.target.currentPassword.value,Z=V.target.newPassword.value,xe=V.target.confirmPassword.value;if(Z!==xe){alert("New passwords do not match");return}try{const pe=localStorage.getItem("token"),Se=await fetch(`${Y}/api/profile/settings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${pe}`},body:JSON.stringify({type:"password",currentPassword:ce,newPassword:Z})}),ke=await Se.json();Se.ok?(alert("Password updated successfully"),V.target.reset()):alert(ke.message)}catch(pe){console.error(pe),alert("Error updating password")}},children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{type:"password",name:"currentPassword",placeholder:"Current Password",required:!0,className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-infosec-accent transition-colors"}),e.jsx("input",{type:"password",name:"newPassword",placeholder:"New Password",required:!0,minLength:"6",className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-infosec-accent transition-colors"}),e.jsx("input",{type:"password",name:"confirmPassword",placeholder:"Confirm New Password",required:!0,minLength:"6",className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-infosec-accent transition-colors"}),e.jsx("button",{type:"submit",className:"w-full bg-infosec-accent hover:bg-infosec-accentHover text-white py-3 rounded-lg font-bold transition-colors",children:"Update Password"})]})})]}),e.jsxs("div",{className:"p-5 bg-gray-800/30 rounded-xl border border-gray-700/50",children:[e.jsxs("h4",{className:"text-md font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"📧"})," Change Email"]}),e.jsx("form",{onSubmit:async V=>{V.preventDefault();const ce=V.target.currentPasswordEmail.value,Z=V.target.newEmail.value;try{const xe=localStorage.getItem("token"),pe=await fetch(`${Y}/api/profile/settings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe}`},body:JSON.stringify({type:"email",currentPassword:ce,newEmail:Z})}),Se=await pe.json();pe.ok?(alert("Email updated successfully"),s(ke=>({...ke,email:Se.email})),V.target.reset()):alert(Se.message)}catch(xe){console.error(xe),alert("Error updating email")}},children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{type:"email",name:"newEmail",placeholder:"New Email Address",required:!0,className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-infosec-accent transition-colors"}),e.jsx("input",{type:"password",name:"currentPasswordEmail",placeholder:"Current Password (verification)",required:!0,className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-infosec-accent transition-colors"}),e.jsx("button",{type:"submit",className:"w-full bg-gray-700 hover:bg-gray-600 text-white py-3 rounded-lg font-bold transition-colors",children:"Update Email"})]})})]})]})})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3",children:[e.jsx("span",{className:"w-10 h-10 bg-blue-500/20 rounded-lg flex items-center justify-center text-blue-400",children:"🔔"}),"Notifications"]}),e.jsx("p",{className:"text-gray-400 text-sm mt-2",children:"Manage which email notifications you receive"})]}),e.jsxs("div",{className:"p-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-800/30 rounded-xl border border-gray-700/50 hover:border-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-500/20 rounded-lg flex items-center justify-center text-purple-400 text-lg",children:"📊"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"Weekly Performance Report"}),e.jsx("div",{className:"text-sm text-gray-400",children:"Get a summary of your stats every week"})]})]}),e.jsx("button",{onClick:()=>C("weekly_report",!v.weekly_report),disabled:j,className:`relative inline-flex h-7 w-12 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${v.weekly_report?"bg-infosec-accent":"bg-gray-600"} ${j?"opacity-50 cursor-not-allowed":""}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-6 w-6 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${v.weekly_report?"translate-x-5":"translate-x-0"}`})})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-800/30 rounded-xl border border-gray-700/50 hover:border-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 bg-orange-500/20 rounded-lg flex items-center justify-center text-orange-400 text-lg",children:"🚨"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"Alert Assignment Notifications"}),e.jsx("div",{className:"text-sm text-gray-400",children:"Get notified when a new alert is assigned"})]})]}),e.jsx("button",{onClick:()=>C("alert_assigned",!v.alert_assigned),disabled:j,className:`relative inline-flex h-7 w-12 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${v.alert_assigned?"bg-infosec-accent":"bg-gray-600"} ${j?"opacity-50 cursor-not-allowed":""}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-6 w-6 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${v.alert_assigned?"translate-x-5":"translate-x-0"}`})})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-800/30 rounded-xl border border-gray-700/50 hover:border-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 bg-green-500/20 rounded-lg flex items-center justify-center text-green-400 text-lg",children:"✅"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"Grading Notifications"}),e.jsx("div",{className:"text-sm text-gray-400",children:"Get notified when your investigation is graded"})]})]}),e.jsx("button",{onClick:()=>C("investigation_graded",!v.investigation_graded),disabled:j,className:`relative inline-flex h-7 w-12 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${v.investigation_graded?"bg-infosec-accent":"bg-gray-600"} ${j?"opacity-50 cursor-not-allowed":""}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-6 w-6 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${v.investigation_graded?"translate-x-5":"translate-x-0"}`})})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden border-red-900/30",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 bg-red-900/10",children:e.jsxs("h3",{className:"text-xl font-bold text-red-500 flex items-center gap-3",children:[e.jsx("span",{className:"w-10 h-10 bg-red-500/20 rounded-lg flex items-center justify-center text-red-500",children:"⚠️"}),"Danger Zone"]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"p-5 bg-red-900/10 rounded-xl border border-red-500/20 flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-white",children:"Delete Account"}),e.jsx("div",{className:"text-sm text-gray-400",children:"Permanently remove your account and all data. This cannot be undone."})]}),e.jsx("button",{onClick:async()=>{if(window.confirm("Are you absolutely sure you want to delete your account? This action cannot be undone.")){const V=localStorage.getItem("token");try{(await fetch(`${Y}/api/profile`,{method:"DELETE",headers:{Authorization:`Bearer ${V}`}})).ok?(alert("Account deleted."),localStorage.removeItem("token"),window.location.href="/login"):alert("Failed to delete account")}catch(ce){console.error(ce)}}},className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white font-bold rounded-lg transition-colors text-sm whitespace-nowrap",children:"Delete Account"})]})})]})]}),c==="billing"&&!(m!=null&&m.hide_tiers)&&e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[n!=null&&n.subscription_plan&&n.subscription_plan!=="free"?e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 bg-gradient-to-r from-purple-900/20 to-blue-900/20",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3",children:[e.jsx("span",{className:"w-10 h-10 bg-purple-500/20 rounded-lg flex items-center justify-center text-purple-400",children:"💎"}),"Current Plan"]}),e.jsx("span",{className:"px-3 py-1 bg-purple-500 text-white text-xs font-bold rounded-full uppercase tracking-wider",children:"Active"})]})}),e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-4xl font-extrabold text-white capitalize mb-1",children:[n.subscription_plan," Plan"]}),e.jsx("div",{className:"text-gray-400",children:"Manage your subscription details and billing."})]}),n.subscription_end_date&&e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-sm text-gray-500 uppercase tracking-wider font-bold mb-1",children:n.cancel_at_period_end?"Expires on":"Renews on"}),e.jsx("div",{className:"text-2xl font-bold text-white",children:new Date(n.subscription_end_date).toLocaleDateString()})]})]}),e.jsx("div",{className:"mt-8 pt-8 border-t border-gray-800 flex justify-end",children:e.jsx("button",{onClick:()=>P(!0),className:"px-4 py-2 text-red-400 hover:text-white hover:bg-red-500/20 rounded-lg transition-colors font-medium text-sm",children:"Cancel Subscription"})})]})]}):e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-800 rounded-full flex items-center justify-center text-3xl mx-auto mb-4",children:"🌑"}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:"Free Plan"}),e.jsx("p",{className:"text-gray-400 mb-6 max-w-md mx-auto",children:"You are currently on the free plan. Upgrade to unlock premium features, advanced investigations, and more."})]}),e.jsx(ty,{isEmbedded:!0,user:t,onSelectPlan:V=>{p(V),g(!0)}}),f&&x&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl w-full max-w-md border border-gray-800 shadow-2xl overflow-hidden animate-scale-in",children:[e.jsxs("div",{className:"p-4 border-b border-gray-800 flex justify-between items-center bg-gray-900/50",children:[e.jsx("h3",{className:"text-white font-bold",children:"Secure Checkout"}),e.jsx("button",{onClick:()=>g(!1),className:"text-gray-400 hover:text-white",children:"✕"})]}),e.jsx("div",{className:"p-6",children:e.jsx(Yf,{stripe:x,children:e.jsx(sw,{selectedPlan:b,onSuccess:()=>{g(!1),window.location.reload()}})})})]})}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl w-full max-w-md border border-gray-800 shadow-2xl p-6 animate-scale-in",children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-4",children:"Cancel Subscription?"}),e.jsx("p",{className:"text-gray-400 mb-6",children:"Are you sure you want to cancel? You will lose access to premium features at the end of your current billing period."}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 text-gray-400 hover:text-white font-bold",children:"Keep Subscription"}),e.jsx("button",{onClick:O,className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg font-bold",children:"Confirm Cancellation"})]})]})})]})]}):e.jsx("div",{className:"text-white",children:"Error loading profile"})},PC=({org:t,isOpen:r,onClose:a,onUpdate:n,token:s})=>{const[i,o]=l.useState({name:"",license_seats:5,plan_type:"free",is_active:!0,billing_interval:"monthly"}),[c,d]=l.useState(!1);if(l.useEffect(()=>{t&&o({name:t.name||"",license_seats:t.license_seats||5,plan_type:t.plan_type||"free",is_active:t.is_active===1||t.is_active===!0,billing_interval:t.billing_interval||"monthly"})},[t]),!r||!t)return null;const m=async u=>{u.preventDefault(),d(!0);try{const x=await fetch(`${Y}/api/admin/organizations/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(i)});if(!x.ok){const h=await x.json();throw new Error(h.message||"Failed to update organization")}z.success("Organization updated successfully"),n(),a()}catch(x){console.error("Update error:",x),z.error(x.message)}finally{d(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-700 rounded-xl shadow-2xl w-full max-w-md overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center",children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"Edit Organization"}),e.jsx("button",{onClick:a,className:"text-gray-400 hover:text-white transition-colors",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("form",{onSubmit:m,className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Organization Name"}),e.jsx("input",{type:"text",value:i.name,onChange:u=>o({...i,name:u.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg p-2.5 text-white focus:ring-2 focus:ring-infosec-accent focus:outline-none",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"License Seats"}),e.jsx("input",{type:"number",min:"1",value:i.license_seats,onChange:u=>o({...i,license_seats:parseInt(u.target.value)}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg p-2.5 text-white focus:ring-2 focus:ring-infosec-accent focus:outline-none",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Plan Type"}),e.jsxs("select",{value:i.plan_type,onChange:u=>o({...i,plan_type:u.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg p-2.5 text-white focus:ring-2 focus:ring-infosec-accent focus:outline-none",children:[e.jsx("option",{value:"free",children:"Free"}),e.jsx("option",{value:"trial",children:"Trial"}),e.jsx("option",{value:"pro",children:"Pro (Legacy)"}),e.jsx("option",{value:"business",children:"Business"}),e.jsx("option",{value:"enterprise",children:"Enterprise"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Billing Interval"}),e.jsxs("select",{value:i.billing_interval,onChange:u=>o({...i,billing_interval:u.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg p-2.5 text-white focus:ring-2 focus:ring-infosec-accent focus:outline-none",children:[e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"yearly",children:"Yearly"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsx("input",{type:"checkbox",id:"is_active",checked:i.is_active,onChange:u=>o({...i,is_active:u.target.checked}),className:"w-4 h-4 rounded border-gray-700 bg-[#1a1b1e] text-infosec-accent focus:ring-infosec-accent"}),e.jsx("label",{htmlFor:"is_active",className:"text-sm font-medium text-gray-300 select-none",children:"Account Active"})]}),e.jsxs("div",{className:"pt-4 flex justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:a,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg transition-colors font-medium text-sm",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:c,className:"px-4 py-2 bg-infosec-accent hover:bg-infosec-accentHover text-white rounded-lg transition-colors font-medium text-sm flex items-center gap-2",children:[c&&e.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-white rounded-full border-t-transparent"}),"Save Changes"]})]})]})]})})},$C=({token:t})=>{var ht,Ze,yt,We,tr,Vt,ct,dt,be,ye,De;const[r,a]=l.useState([]),[n,s]=l.useState([]),[i,o]=l.useState([]),[c,d]=l.useState(""),[m,u]=l.useState(!0),[x,h]=l.useState(null),[f,g]=l.useState("individuals"),[b,p]=l.useState(1),[v,y]=l.useState(25),[j,S]=l.useState(!1),[N,w]=l.useState(null),[_,P]=l.useState(null),[O,T]=l.useState(null),[k,$]=l.useState({investigations:[],academy:null}),[C,A]=l.useState(!1),[E,L]=l.useState(null),[F,D]=l.useState(null),[q,Q]=l.useState(!1),[de,H]=l.useState(null),[se,W]=l.useState(!1),[le,U]=l.useState(""),[ee,ae]=l.useState(!1);l.useEffect(()=>{je(),Ie(),Te()},[]);const ue=l.useMemo(()=>{const M=c.toLowerCase();return r.filter(te=>!te.organization_id&&!te.email.toLowerCase().endsWith(".edu")).filter(te=>te.name.toLowerCase().includes(M)||te.email.toLowerCase().includes(M))},[r,c]),fe=l.useMemo(()=>{const M=(b-1)*v;return ue.slice(M,M+v)},[ue,b,v]),re=Math.ceil(ue.length/v),V=l.useMemo(()=>{const M=c.toLowerCase();return r.filter(te=>te.email.toLowerCase().endsWith(".edu")||te.is_student).filter(te=>te.name.toLowerCase().includes(M)||te.email.toLowerCase().includes(M))},[r,c]),ce=l.useMemo(()=>{const M=(b-1)*v;return V.slice(M,M+v)},[V,b,v]),Z=Math.ceil(V.length/v),xe=l.useMemo(()=>{const M=c.toLowerCase();return r.filter(te=>["pro","monthly","yearly"].includes(te.subscription_plan)).filter(te=>te.name.toLowerCase().includes(M)||te.email.toLowerCase().includes(M))},[r,c]),pe=l.useMemo(()=>{const M=(b-1)*v;return xe.slice(M,M+v)},[xe,b,v]),Se=Math.ceil(xe.length/v),ke=l.useMemo(()=>{const M=c.toLowerCase();return n.filter(te=>te.name.toLowerCase().includes(M)||te.owner_email&&te.owner_email.toLowerCase().includes(M))},[n,c]),$e=l.useMemo(()=>{const M=c.toLowerCase();return i.filter(te=>te.referrer_email.toLowerCase().includes(M)||te.referee_email.toLowerCase().includes(M))},[i,c]),K=l.useMemo(()=>{const M=(b-1)*v;return $e.slice(M,M+v)},[$e,b,v]),ie=Math.ceil($e.length/v);l.useEffect(()=>{p(1)},[f,c]);const I=l.useCallback(({totalItems:M,totalPages:te,label:Ne})=>{if(M===0)return null;const Ee=(b-1)*v+1,Pe=Math.min(b*v,M),Me=()=>{const Ue=[];if(te<=7)for(let Le=1;Le<=te;Le++)Ue.push(Le);else{Ue.push(1),b>3&&Ue.push("...");for(let Le=Math.max(2,b-1);Le<=Math.min(te-1,b+1);Le++)Ue.push(Le);b<te-2&&Ue.push("..."),Ue.push(te)}return Ue};return e.jsxs("div",{className:"px-4 py-3 border-t border-gray-800 flex flex-col sm:flex-row items-center justify-between gap-3 bg-[#0e0f11]",children:[e.jsxs("div",{className:"text-xs text-gray-500",children:["Showing ",e.jsxs("span",{className:"text-gray-300 font-medium",children:[Ee,"-",Pe]})," of ",e.jsx("span",{className:"text-gray-300 font-medium",children:M})," ",Ne]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>p(Ue=>Math.max(1,Ue-1)),disabled:b===1,className:`px-2 py-1 rounded text-xs font-medium transition-colors ${b===1?"text-gray-600 cursor-not-allowed":"text-gray-400 hover:bg-gray-800 hover:text-white"}`,children:"← Prev"}),Me().map((Ue,Le)=>Ue==="..."?e.jsx("span",{className:"px-2 py-1 text-xs text-gray-600",children:"…"},`ellipsis-${Le}`):e.jsx("button",{onClick:()=>p(Ue),className:`w-8 h-8 rounded text-xs font-medium transition-colors ${b===Ue?"bg-infosec-accent text-white":"text-gray-400 hover:bg-gray-800 hover:text-white"}`,children:Ue},Ue)),e.jsx("button",{onClick:()=>p(Ue=>Math.min(te,Ue+1)),disabled:b===te,className:`px-2 py-1 rounded text-xs font-medium transition-colors ${b===te?"text-gray-600 cursor-not-allowed":"text-gray-400 hover:bg-gray-800 hover:text-white"}`,children:"Next →"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500",children:"Rows:"}),e.jsxs("select",{value:v,onChange:Ue=>{y(Number(Ue.target.value)),p(1)},className:"bg-[#1a1b1e] border border-gray-700 text-gray-300 text-xs rounded px-2 py-1 focus:outline-none focus:border-infosec-accent",children:[e.jsx("option",{value:10,children:"10"}),e.jsx("option",{value:25,children:"25"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]})]})]})},[b,v]),R=M=>r.filter(te=>te.organization_id===M),je=async()=>{try{const M=await fetch(`${Y}/api/auth/users`,{headers:{Authorization:`Bearer ${t}`}});if(!M.ok){const Ne=await M.json().catch(()=>({}));throw new Error(Ne.message||"Failed to fetch users")}const te=await M.json();a(te),u(!1)}catch(M){h(M.message),u(!1)}},Te=async()=>{try{const M=await fetch(`${Y}/api/referrals/admin/all`,{headers:{Authorization:`Bearer ${t}`}});if(M.ok){const te=await M.json();o(te)}}catch(M){console.error("Error fetching referrals:",M)}},Ie=async()=>{try{const M=await fetch(`${Y}/api/admin/organizations`,{headers:{Authorization:`Bearer ${t}`}});if(M.ok){const te=await M.json();s(te.organizations||te||[])}}catch(M){console.error("Error fetching organizations:",M)}},tt=async(M,te)=>{try{if(!(await fetch(`${Y}/api/auth/users/${M}/role`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({role:te})})).ok)throw new Error("Failed to update role");a(Ee=>Ee.map(Pe=>Pe.id===M?{...Pe,role:te}:Pe))}catch(Ne){z.error("Error updating role: "+Ne.message)}},Ke=async()=>{if(!le||le.length<3){z.error("Username too short");return}ae(!0);try{const M=await fetch(`${Y}/api/admin/users/${O.id}/username`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({newUsername:le})}),te=await M.json();M.ok?(z.success("Username updated successfully"),a(Ne=>Ne.map(Ee=>Ee.id===O.id?{...Ee,username:le}:Ee)),T(Ne=>({...Ne,username:le})),W(!1)):z.error(te.message||"Failed to update username")}catch(M){console.error("Error updating username:",M),z.error("Server error: Could not update username")}finally{ae(!1)}},[Be,Ge]=l.useState(new Set),J=M=>{w(M)},Ae=async()=>{const M=N;if(M){Ge(te=>new Set(te).add(M));try{const te=await fetch(`${Y}/api/admin/users/${M}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}});if(te.status===404){a(Ne=>Ne.filter(Ee=>Ee.id!==M)),z.info("User deleted successfully (was already missing)");return}if(!te.ok){const Ne=await te.json();throw new Error(Ne.message||"Failed to delete user")}a(Ne=>Ne.filter(Ee=>Ee.id!==M)),z.success("User deleted successfully")}catch(te){console.error("Delete error:",te),z.error(te.message||"Error deleting user. check console.")}finally{w(null),Ge(te=>{const Ne=new Set(te);return Ne.delete(M),Ne})}}},ve=async()=>{if(de)try{if(!(await fetch(`${Y}/api/admin/organizations/${de}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})).ok)throw new Error("Failed to delete organization");s(te=>te.filter(Ne=>Ne.id!==de)),z.success("Organization deleted successfully")}catch(M){console.error("Delete org error:",M),z.error(M.message)}finally{H(null)}},ge=async(M,te)=>{try{if(!(await fetch(`${Y}/api/auth/users/${M}/role`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({subscription_plan:te})})).ok)throw new Error("Failed to update plan");a(Ee=>Ee.map(Pe=>Pe.id===M?{...Pe,subscription_plan:te}:Pe))}catch(Ne){z.error("Error updating plan: "+Ne.message)}},qe=async M=>{if(window.confirm("Are you sure you want to grant 30 days of COMPLIMENTARY Pro access to this user? This will send an automated welcome email."))try{const te=await fetch(`${Y}/api/admin/users/${M}/grant-complimentary`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!te.ok){const Ee=await te.json();throw new Error(Ee.message||"Failed to grant complimentary access")}const Ne=await te.json();z.success(Ne.message||"Complimentary Pro access granted!"),je()}catch(te){z.error(te.message)}},Xe=async M=>{if(window.confirm("Are you sure you want to unlock this account?"))try{const te=await fetch(`${Y}/api/admin/users/${M}/unlock`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!te.ok){const Ne=await te.json();throw new Error(Ne.message||"Failed to unlock user")}z.success("User unlocked successfully"),a(Ne=>Ne.map(Ee=>Ee.id===M?{...Ee,lock_until:null,failed_login_attempts:0}:Ee))}catch(te){z.error(te.message)}},st=async M=>{T(M),A(!0),$({investigations:[],academy:null,referrals:{referredBy:null,invitedUsers:[]}});try{const[te,Ne,Ee]=await Promise.all([fetch(`${Y}/api/admin/users/${M.id}/investigations`,{headers:{Authorization:`Bearer ${t}`}}),fetch(`${Y}/api/admin/users/${M.id}/academy-progress`,{headers:{Authorization:`Bearer ${t}`}}),fetch(`${Y}/api/referrals/admin/user/${M.id}`,{headers:{Authorization:`Bearer ${t}`}})]),Pe=te.ok?await te.json():{investigations:[]},Me=Ne.ok?await Ne.json():null,Ue=Ee.ok?await Ee.json():{referredBy:null,invitedUsers:[]};$({investigations:Pe.investigations||[],academy:Me,referrals:Ue})}catch(te){console.error("Error fetching user details:",te),z.error("Error fetching user details")}finally{A(!1)}};return m?e.jsx("div",{className:"text-white p-4 flex justify-center",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-infosec-accent rounded-full border-t-transparent"})}):x?e.jsxs("div",{className:"text-red-500 p-4 bg-red-500/10 rounded-lg border border-red-500/20",children:["Error: ",x]}):e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx("span",{children:"👥"})," User & Organization Management"]}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"Manage individual users, business accounts, and team members."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>S(!0),className:"px-4 py-2.5 bg-infosec-accent hover:bg-infosec-accentHover text-white text-sm font-medium rounded-lg transition-colors whitespace-nowrap flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Sync Stripe"]}),e.jsxs("div",{className:"relative md:w-64",children:[e.jsx("input",{type:"text",placeholder:f==="individuals"?"Search users...":f==="students"?"Search students...":"Search organizations...",value:c,onChange:M=>d(M.target.value),className:"w-full bg-[#1a1b1e] border border-gray-700 text-white text-sm rounded-lg focus:ring-infosec-accent focus:border-infosec-accent block pl-10 p-2.5"}),e.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:e.jsx("svg",{className:"w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 20 20",children:e.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"})})})]})]})]}),e.jsxs("div",{className:"flex gap-1 mt-6",children:[e.jsxs("button",{onClick:()=>{g("individuals"),d("")},className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ${f==="individuals"?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700"}`,children:[e.jsx("span",{children:"👤"})," Individual Users",e.jsx("span",{className:"bg-black/30 px-2 py-0.5 rounded text-xs",children:r.filter(M=>!M.organization_id&&!M.email.toLowerCase().endsWith(".edu")).length})]}),e.jsxs("button",{onClick:()=>{g("students"),d("")},className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ${f==="students"?"bg-cyan-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700"}`,children:[e.jsx("span",{children:"🎓"})," Students",e.jsx("span",{className:"bg-black/30 px-2 py-0.5 rounded text-xs",children:V.length})]}),e.jsxs("button",{onClick:()=>{g("subscribers"),d("")},className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ${f==="subscribers"?"bg-amber-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700"}`,children:[e.jsx("span",{children:"💎"})," Subscribers",e.jsx("span",{className:"bg-black/30 px-2 py-0.5 rounded text-xs",children:r.filter(M=>["pro","monthly","yearly"].includes(M.subscription_plan)).length})]}),e.jsxs("button",{onClick:()=>{g("organizations"),d("")},className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ${f==="organizations"?"bg-purple-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700"}`,children:[e.jsx("span",{children:"🏢"})," Organizations",e.jsx("span",{className:"bg-black/30 px-2 py-0.5 rounded text-xs",children:n.length})]}),e.jsxs("button",{onClick:()=>{g("referrals"),d("")},className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2 ${f==="referrals"?"bg-pink-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700"}`,children:[e.jsx("span",{children:"🔗"})," Referrals",e.jsx("span",{className:"bg-black/30 px-2 py-0.5 rounded text-xs",children:i.length})]})]})]}),f==="individuals"&&e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#1a1b1e] text-xs uppercase font-bold text-gray-300",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"User"}),e.jsx("th",{className:"px-4 py-3",children:"Role"}),e.jsx("th",{className:"px-4 py-3 text-center",title:"Alerts currently assigned",children:"Active"}),e.jsx("th",{className:"px-4 py-3 text-center",title:"Total investigations completed",children:"Solved"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Plan"}),e.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Joined"}),e.jsx("th",{className:"px-4 py-3 text-center hidden md:table-cell",children:"Source"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800",children:[fe.map(M=>e.jsxs("tr",{className:"hover:bg-gray-800/50 transition-colors group",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-tr from-gray-700 to-gray-600 flex items-center justify-center text-white font-bold text-sm shadow-lg flex-shrink-0",children:M.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-white text-sm truncate max-w-[150px]",children:M.name}),e.jsx("div",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:M.email})]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("select",{value:M.role,onChange:te=>tt(M.id,te.target.value),className:`bg-[#1a1b1e] border border-gray-700 rounded px-2 py-1 text-xs font-medium focus:outline-none focus:border-infosec-accent transition-colors w-24
                                            ${M.role==="admin"?"text-purple-400 border-purple-500/30":M.role==="alert-admin"?"text-blue-400 border-blue-500/30":"text-gray-300"}`,children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"pro",children:"Pro"}),e.jsx("option",{value:"alert-admin",children:"Alert Admin"}),e.jsx("option",{value:"admin",children:"Admin"})]})}),e.jsx("td",{className:"px-4 py-3 text-center font-mono text-white",children:M.assigned_count||0}),e.jsx("td",{className:"px-4 py-3 text-center font-mono text-green-400",children:M.investigated_count||0}),e.jsxs("td",{className:"px-4 py-3 text-center",children:[M.is_verified?e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500",title:"Verified"}):e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-yellow-500",title:"Pending"}),M.lock_until&&new Date(M.lock_until)>new Date&&e.jsx("span",{className:"ml-2 inline-block w-2 h-2 rounded-full bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.8)]",title:`Locked until: ${new Date(M.lock_until).toLocaleString()}`})]}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsxs("select",{value:M.subscription_plan||"free",onChange:te=>ge(M.id,te.target.value),className:`bg-[#1a1b1e] border border-gray-700 rounded px-2 py-1 text-xs font-bold focus:outline-none focus:border-infosec-accent transition-colors w-24 text-center uppercase
                                            ${["pro","monthly","yearly"].includes(M.subscription_plan)?"bg-infosec-accent/10 text-infosec-accent border-infosec-accent/20":"bg-gray-800 text-gray-400 border-gray-700"}`,children:[e.jsx("option",{value:"free",children:"FREE"}),e.jsx("option",{value:"pro",children:"PRO (Legacy)"}),e.jsx("option",{value:"monthly",children:"MONTHLY"}),e.jsx("option",{value:"yearly",children:"YEARLY"})]})}),e.jsx("td",{className:"px-4 py-3 font-mono text-xs hidden md:table-cell",children:new Date(M.created_at).toLocaleDateString(void 0,{year:"2-digit",month:"numeric",day:"numeric"})}),e.jsx("td",{className:"px-4 py-3 text-center hidden md:table-cell",children:e.jsx("span",{title:M.registration_source||"web",className:"text-lg",children:M.registration_source==="ios"?"🍏":M.registration_source==="android"?"🤖":M.registration_source==="mobile"?"📱":"💻"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("button",{onClick:()=>st(M),className:"p-1.5 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 rounded transition-colors",title:"View User Details",children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),(M.subscription_plan==="free"||!M.subscription_plan)&&e.jsx("button",{onClick:()=>qe(M.id),className:"p-1.5 bg-amber-500/10 hover:bg-amber-500/20 text-amber-500 rounded transition-colors",title:"Grant 30-Day Complimentary PRO",children:e.jsx("span",{className:"text-xs font-bold px-0.5",children:"🎁"})}),M.lock_until&&new Date(M.lock_until)>new Date&&e.jsx("button",{onClick:()=>Xe(M.id),className:"p-1.5 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded transition-colors",title:"Unlock Account",children:e.jsx("span",{className:"text-xs font-bold px-0.5",children:"🔓"})}),!M.is_verified&&e.jsx("button",{onClick:()=>P(M.id),className:"p-1.5 bg-green-500/10 hover:bg-green-500/20 text-green-500 rounded transition-colors",title:"Verify User",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})})}),e.jsx("button",{onClick:()=>J(M.id),disabled:Be.has(M.id),className:`p-1.5 rounded transition-colors ${Be.has(M.id)?"bg-gray-700 text-gray-500 cursor-not-allowed":"bg-red-500/10 hover:bg-red-500/20 text-red-500"}`,title:"Delete User",children:Be.has(M.id)?e.jsxs("svg",{className:"animate-spin w-3.5 h-3.5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})})]},M.id)),ue.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:"6",className:"px-6 py-8 text-center text-gray-500",children:['No users found matching "',c,'"']})})]})]}),e.jsx(I,{totalItems:ue.length,totalPages:re,label:"users"})]}),f==="students"&&e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#1a1b1e] text-xs uppercase font-bold text-gray-300",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"Student"}),e.jsx("th",{className:"px-4 py-3",children:"Role"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Active"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Solved"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Plan"}),e.jsx("th",{className:"px-4 py-3 hidden md:table-cell",children:"Joined"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800",children:[ce.map(M=>{var te;return e.jsxs("tr",{className:"hover:bg-gray-800/50 transition-colors group",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-tr from-cyan-600 to-blue-600 flex items-center justify-center text-white font-bold text-sm shadow-lg flex-shrink-0",children:M.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-white text-sm truncate max-w-[150px]",children:M.name}),e.jsx("div",{className:"text-xs text-cyan-400 truncate max-w-[150px]",children:M.email})]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${M.role==="admin"?"bg-purple-500/20 text-purple-400":"bg-gray-700 text-gray-300"}`,children:M.role})}),e.jsx("td",{className:"px-4 py-3 text-center font-mono text-white",children:M.assigned_count||0}),e.jsx("td",{className:"px-4 py-3 text-center font-mono text-green-400",children:M.investigated_count||0}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${["pro","monthly","yearly"].includes(M.subscription_plan)?"bg-cyan-500/20 text-cyan-400":"bg-gray-700 text-gray-400"}`,children:M.subscription_plan==="monthly"&&M.subscription_status==="active"?"STUDENT TRIAL":((te=M.subscription_plan)==null?void 0:te.toUpperCase())||"FREE"})}),e.jsx("td",{className:"px-4 py-3 font-mono text-xs hidden md:table-cell",children:new Date(M.created_at).toLocaleDateString(void 0,{year:"2-digit",month:"numeric",day:"numeric"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("div",{className:"flex items-center justify-end gap-1",children:e.jsx("button",{onClick:()=>st(M),className:"p-1.5 bg-cyan-500/10 hover:bg-cyan-500/20 text-cyan-400 rounded transition-colors",title:"View Student Details",children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})})})]},M.id)}),V.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:"7",className:"px-6 py-8 text-center text-gray-500",children:"No student users found."})})]})]}),e.jsx(I,{totalItems:V.length,totalPages:Z,label:"students"})]}),f==="subscribers"&&e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#1a1b1e] text-xs uppercase font-bold text-gray-300",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"User"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Plan"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Next Billing"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Actions"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800",children:[pe.map(M=>{var te;return e.jsxs("tr",{className:"hover:bg-gray-800/50 transition-colors group",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-tr from-amber-500 to-orange-600 flex items-center justify-center text-white font-bold text-sm shadow-lg flex-shrink-0",children:M.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-white text-sm truncate max-w-[150px]",children:M.name}),e.jsx("div",{className:"text-xs text-amber-500/70 truncate max-w-[150px]",children:M.email})]})]})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold uppercase ${M.subscription_plan==="yearly"?"bg-purple-500/20 text-purple-400":M.subscription_plan==="pro"?"bg-infosec-accent/20 text-infosec-accent":"bg-blue-500/20 text-blue-400"}`,children:M.subscription_plan})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-xs ${M.subscription_status==="active"?"bg-green-500/20 text-green-500":"bg-red-500/20 text-red-500"}`,children:((te=M.subscription_status)==null?void 0:te.toUpperCase())||"UNKNOWN"}),M.cancel_at_period_end===1&&M.subscription_status==="active"&&e.jsx("span",{className:"text-[10px] bg-yellow-500/20 text-yellow-500 px-1.5 py-0.5 rounded",title:"Cancels at period end",children:"⚠️ Canceled"})]})}),e.jsx("td",{className:"px-4 py-3 text-center font-mono text-xs text-xs text-gray-500",children:M.renewal_date?new Date(M.renewal_date).toLocaleDateString():"-"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{onClick:()=>st(M),className:"p-1.5 bg-gray-700 hover:bg-gray-600 text-gray-300 rounded transition-colors",title:"View Details",children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})})]},M.id)}),xe.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:"5",className:"px-6 py-8 text-center text-gray-500",children:"No active subscribers found."})})]})]}),e.jsx(I,{totalItems:xe.length,totalPages:Se,label:"subscribers"})]}),f==="referrals"&&e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#1a1b1e] text-xs uppercase font-bold text-gray-300",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"Referrer"}),e.jsx("th",{className:"px-4 py-3",children:"Referee"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Date"}),e.jsx("th",{className:"px-4 py-3 text-center",children:"Rewarded"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800",children:[K.map(M=>e.jsxs("tr",{className:"hover:bg-gray-800/50 transition-colors group",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-bold text-white",children:M.referrer_name}),e.jsx("div",{className:"text-xs text-gray-500",children:M.referrer_email})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-bold text-white",children:M.referee_name}),e.jsx("div",{className:"text-xs text-gray-500",children:M.referee_email})]}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:`px-2 py-0.5 rounded text-xs uppercase ${M.status==="subscribed"?"bg-purple-500/20 text-purple-400":M.status==="active"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-500"}`,children:M.status})}),e.jsx("td",{className:"px-4 py-3 text-center font-mono text-xs",children:new Date(M.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-center",children:M.reward_earned?e.jsx("span",{className:"text-green-500 text-lg",title:"Reward Given",children:"💎"}):e.jsx("span",{className:"text-gray-600 text-lg",title:"No Reward Yet",children:"➖"})})]},M.id)),$e.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:"5",className:"px-6 py-8 text-center text-gray-500",children:"No referrals found."})})]})]}),e.jsx(I,{totalItems:$e.length,totalPages:ie,label:"referrals"})]}),f==="organizations"&&e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"space-y-4",children:ke.length===0?e.jsx("div",{className:"text-center text-gray-500 py-8",children:"No organizations found"}):ke.map(M=>{var te,Ne;return e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"p-4 flex items-center justify-between cursor-pointer hover:bg-gray-800/50",onClick:()=>L(E===M.id?null:M.id),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-purple-500 to-blue-500 flex items-center justify-center text-white font-bold text-lg",children:(te=M.name)==null?void 0:te.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-white",children:M.name}),e.jsx("div",{className:"text-gray-500 text-sm",children:M.owner_email||"No owner"})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mr-4",children:[e.jsx("button",{onClick:Ee=>{Ee.stopPropagation(),D(M),Q(!0)},className:"p-1.5 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 rounded transition-colors",title:"Edit Organization",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),e.jsx("button",{onClick:Ee=>{Ee.stopPropagation(),H(M.id)},className:"p-1.5 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded transition-colors",title:"Delete Organization",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-white",children:M.member_count||R(M.id).length}),e.jsx("div",{className:"text-xs text-gray-500",children:"Members"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-green-400",children:M.license_seats||5}),e.jsx("div",{className:"text-xs text-gray-500",children:"Seats"})]}),e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${["active","paid","business","enterprise"].includes(M.plan_type)?"bg-green-500/20 text-green-400":M.plan_type==="trial"?M.days_remaining>0&&M.trial_status!=="expired"?"bg-blue-500/20 text-blue-400":"bg-red-500/20 text-red-400":"bg-gray-700 text-gray-400"}`,children:M.plan_type==="trial"?M.days_remaining>0&&M.trial_status!=="expired"?`TRIAL (${M.days_remaining}d)`:"TRIAL EXPIRED":((Ne=M.plan_type)==null?void 0:Ne.toUpperCase())||"UNKNOWN"}),e.jsx("svg",{className:`w-5 h-5 text-gray-400 transition-transform ${E===M.id?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]})]}),E===M.id&&e.jsxs("div",{className:"border-t border-gray-800 p-4 bg-[#0e0f11]",children:[e.jsx("h4",{className:"text-sm font-bold text-gray-400 mb-3",children:"Team Members"}),R(M.id).length===0?e.jsx("p",{className:"text-gray-500 text-sm",children:"No members found"}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:R(M.id).map(Ee=>{var Pe;return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-[#1a1b1e] rounded-lg cursor-pointer hover:bg-gray-700 transition-colors group",onClick:()=>st(Ee),title:"View Member Details",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-700 flex items-center justify-center text-white text-xs font-bold",children:(Pe=Ee.name)==null?void 0:Pe.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-white text-sm truncate",children:Ee.name}),e.jsx("div",{className:"text-gray-500 text-xs truncate",children:Ee.email})]}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ee.role==="owner"?"bg-purple-500/20 text-purple-400":Ee.role==="admin"?"bg-blue-500/20 text-blue-400":"bg-gray-700 text-gray-400"}`,children:Ee.role||"member"})]},Ee.id)})})]})]},M.id)})})}),e.jsx(Za,{isOpen:j,onClose:()=>S(!1),onConfirm:async()=>{u(!0);try{const te=await(await fetch(`${Y}/api/admin/sync-stripe`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})).json();z.success(te.message),je()}catch(M){z.error("Sync failed: "+M.message),u(!1)}},title:"Sync Stripe?",message:"This will sync subscriptions from Stripe and update any mismatched user plans.",confirmText:"Sync Now"}),e.jsx(Za,{isOpen:!!_,onClose:()=>P(null),onConfirm:async()=>{if(_)try{(await fetch(`${Y}/api/admin/users/${_}/verify`,{method:"PUT",headers:{Authorization:`Bearer ${t}`}})).ok?(a(te=>te.map(Ne=>Ne.id===_?{...Ne,is_verified:!0}:Ne)),z.success("User verified!")):z.error("Failed to verify.")}catch(M){console.error(M),z.error("Error verifying user.")}},title:"Verify User Manually?",message:"Are you sure you want to manually verify this user? They will be able to log in immediately.",confirmText:"Verify User"}),e.jsx(Za,{isOpen:!!N,onClose:()=>w(null),onConfirm:Ae,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",confirmText:"Delete User",isDanger:!0}),e.jsx(Za,{isOpen:!!de,onClose:()=>H(null),onConfirm:ve,title:"Delete Organization?",message:"Are you sure? This will delete the organization and all its data. Members will be unlinked. This cannot be undone.",confirmText:"Delete Organization",isDanger:!0}),e.jsx(PC,{isOpen:q,onClose:()=>{Q(!1),D(null)},org:F,token:t,onUpdate:Ie}),O&&e.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-700 rounded-xl shadow-2xl w-full max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-tr from-infosec-accent to-purple-500 flex items-center justify-center text-white font-bold text-lg",children:(ht=O.name)==null?void 0:ht.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:O.name}),e.jsx("div",{className:"flex items-center gap-2",children:se?e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx("input",{type:"text",value:le,onChange:M=>U(M.target.value),className:"bg-[#1a1b1e] border border-gray-700 rounded px-2 py-0.5 text-xs text-white focus:border-infosec-accent outline-none w-32",autoFocus:!0}),e.jsx("button",{onClick:Ke,disabled:ee,className:"p-1 px-2 bg-green-500/20 text-green-400 rounded text-[10px] uppercase font-bold hover:bg-green-500/30 transition-colors",children:ee?"...":"Save"}),e.jsx("button",{onClick:()=>W(!1),className:"p-1 px-2 bg-gray-800 text-gray-400 rounded text-[10px] uppercase font-bold hover:bg-gray-700 transition-colors",children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs("p",{className:"text-gray-400 text-sm",children:["@",O.username||"no-username"]}),e.jsx("button",{onClick:()=>{U(O.username||""),W(!0)},className:"text-xs text-gray-500 hover:text-infosec-accent transition-colors",title:"Edit Username",children:"✏️"})]})}),e.jsx("p",{className:"text-gray-500 text-xs mt-1",children:O.email})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsx("span",{className:"text-xs text-gray-500 uppercase font-bold mb-1",children:"Role"}),e.jsxs("select",{value:O.role,onChange:M=>tt(O.id,M.target.value),className:"bg-[#1a1b1e] border border-gray-700 rounded px-2 py-1 text-xs font-medium focus:outline-none focus:border-infosec-accent transition-colors text-white",children:[e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"pro",children:"Pro"}),e.jsx("option",{value:"alert-admin",children:"Alert Admin"}),e.jsx("option",{value:"admin",children:"Admin"})]})]}),e.jsx("button",{onClick:()=>T(null),className:"p-2 hover:bg-gray-800 rounded-lg transition-colors",children:e.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:C?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-infosec-accent rounded-full border-t-transparent"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"🔍"})," Alert Investigations (",k.investigations.length,")"]}),k.investigations.length===0?e.jsx("p",{className:"text-gray-500 text-sm",children:"No investigations yet."}):e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:k.investigations.map(M=>e.jsxs("div",{className:"bg-[#1a1b1e] p-4 rounded-lg border border-gray-800 flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-white truncate",children:M.title}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs",children:[e.jsx("span",{className:`px-2 py-0.5 rounded ${M.severity==="Critical"?"bg-red-500/20 text-red-400":M.severity==="High"?"bg-orange-500/20 text-orange-400":M.severity==="Medium"?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:M.severity}),e.jsx("span",{className:"text-gray-500",children:M.difficulty}),e.jsx("span",{className:`${M.status==="Submitted"?"text-blue-400":M.status==="Graded"?"text-green-400":"text-yellow-400"}`,children:M.status})]})]}),e.jsx("div",{className:"text-right ml-4",children:M.grade!==null?e.jsx("span",{className:`text-2xl font-bold ${M.grade>=80?"text-green-400":M.grade>=60?"text-yellow-400":"text-red-400"}`,children:M.grade}):e.jsx("span",{className:"text-gray-500 text-sm",children:"Pending"})})]},M.investigation_id))})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"🎓"})," Academy Progress"]}),k.academy?e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-4 rounded-lg border border-gray-800",children:[e.jsxs("h5",{className:"text-sm font-bold text-gray-400 mb-3",children:["Enrolled Paths (",((Ze=k.academy.enrolled_paths)==null?void 0:Ze.length)||0,")"]}),((yt=k.academy.enrolled_paths)==null?void 0:yt.length)>0?e.jsx("div",{className:"space-y-2",children:k.academy.enrolled_paths.map(M=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"text-white",children:M.path_title}),e.jsxs("span",{className:"text-gray-500 ml-2",children:["• ",M.difficulty]})]},M.path_id))}):e.jsx("p",{className:"text-gray-500 text-sm",children:"Not enrolled in any paths."})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-4 rounded-lg border border-gray-800",children:[e.jsxs("h5",{className:"text-sm font-bold text-gray-400 mb-3",children:["Completed Lessons (",((We=k.academy.completed_lessons)==null?void 0:We.length)||0,")"]}),((tr=k.academy.completed_lessons)==null?void 0:tr.length)>0?e.jsxs("div",{className:"space-y-2 max-h-32 overflow-y-auto",children:[k.academy.completed_lessons.slice(0,10).map(M=>e.jsxs("div",{className:"text-sm flex justify-between",children:[e.jsx("span",{className:"text-white truncate flex-1",children:M.lesson_title}),M.grade!==void 0&&M.grade!==null&&e.jsxs("span",{className:"text-green-400 ml-2",children:[M.grade,"/100"]})]},M.task_id)),k.academy.completed_lessons.length>10&&e.jsxs("p",{className:"text-gray-500 text-xs",children:["+",k.academy.completed_lessons.length-10," more"]})]}):e.jsx("p",{className:"text-gray-500 text-sm",children:"No completed lessons."})]})]}):e.jsx("p",{className:"text-gray-500 text-sm",children:"Academy data not available."})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"🔗"})," Referral History"]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-4 rounded-lg border border-gray-800",children:[e.jsx("h5",{className:"text-sm font-bold text-gray-400 mb-2",children:"Referred By"}),(Vt=k.referrals)!=null&&Vt.referredBy?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-700 flex items-center justify-center text-white text-xs font-bold",children:(ct=k.referrals.referredBy.name)==null?void 0:ct.charAt(0).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-white text-sm truncate",children:k.referrals.referredBy.name}),e.jsx("div",{className:"text-gray-500 text-xs truncate",children:k.referrals.referredBy.email}),e.jsxs("div",{className:"text-[10px] text-gray-600 mt-1 uppercase",children:["Status: ",k.referrals.referredBy.status]})]})]}):e.jsx("p",{className:"text-gray-500 text-sm italic",children:"Direct signup (No referrer)."})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-4 rounded-lg border border-gray-800",children:[e.jsxs("h5",{className:"text-sm font-bold text-gray-400 mb-2",children:["Invited Users (",((be=(dt=k.referrals)==null?void 0:dt.invitedUsers)==null?void 0:be.length)||0,")"]}),((De=(ye=k.referrals)==null?void 0:ye.invitedUsers)==null?void 0:De.length)>0?e.jsx("div",{className:"space-y-3 max-h-40 overflow-y-auto pr-2 custom-scrollbar",children:k.referrals.invitedUsers.map((M,te)=>e.jsxs("div",{className:"flex items-center justify-between group/inv",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-white text-xs font-medium truncate",children:M.name}),e.jsx("div",{className:"text-gray-500 text-[10px] truncate",children:M.email})]}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${M.status==="subscribed"?"bg-purple-500/20 text-purple-400":M.status==="active"?"bg-green-500/20 text-green-400":"bg-gray-700 text-gray-500"}`,children:M.status})]},te))}):e.jsx("p",{className:"text-gray-500 text-sm italic",children:"Has not invited anyone yet."})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t border-gray-800 flex justify-end",children:e.jsx("button",{onClick:()=>T(null),className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded-lg transition-colors",children:"Close"})})]})})]})},EC=({token:t})=>{var g,b,p,v,y,j,S,N,w,_,P,O,T,k,$,C,A,E,L,F,D,q,Q,de,H,se,W,le;const[r,a]=l.useState({payment:{price_free:"0",price_monthly:"19.99",price_yearly:"199.99"},general:{}}),[n,s]=l.useState(!0),[i,o]=l.useState(!1),[c,d]=l.useState(!1);l.useEffect(()=>{m()},[]);const m=async()=>{var U,ee;try{const ae=await fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${t}`}});if(ae.ok){const ue=await ae.json();a(fe=>({...fe,...ue,payment:{...fe.payment,...ue.payment||{}},general:ue.general||{}})),(!((U=ue.payment)!=null&&U.stripe_publishable_key)||!((ee=ue.payment)!=null&&ee.stripe_secret_key))&&d(!0)}}catch(ae){console.error("Error fetching settings:",ae),z.error("Failed to load settings")}finally{s(!1)}},u=(U,ee,ae)=>{a(ue=>({...ue,[U]:{...ue[U],[ee]:ae}}))},x=async()=>{o(!0);try{if((await fetch(`${Y}/api/admin/settings`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(r)})).ok)z.success("Settings saved successfully!");else throw new Error("Failed to save settings")}catch(U){console.error("Error updating settings:",U),z.error("Error updating settings")}finally{o(!1)}},h=async(U,ee,ae,ue)=>{if(!ee){z.warn("Please enter an amount.");return}const fe=parseFloat(ee);if(isNaN(fe)){z.warn("Invalid amount.");return}const re=parseFloat(ue)||0;let V=fe;re>0&&(V=fe*(1-re/100),V=Math.round(V*100)/100);try{const ce=await fetch(`${Y}/api/admin/create-stripe-price`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({amount:V,interval:U,productName:ae})}),Z=await ce.json();ce.ok?(u("payment",U==="month"?"stripe_price_monthly":"stripe_price_yearly",Z.priceId),Z.displayPrice&&u("payment",U==="month"?"stripe_price_display_monthly":"stripe_price_display_yearly",Z.displayPrice),U==="month"?(u("payment","stripe_price_original_monthly",ee),u("payment","discount_monthly_percent",ue)):(u("payment","stripe_price_original_yearly",ee),u("payment","discount_yearly_percent",ue)),z.success(`Price generated successfully! ($${V} / ${U}) Don't forget to click "Save Settings".`)):z.error("Failed: "+Z.message)}catch(ce){z.error("Error creating price: "+ce.message)}},f=async(U,ee,ae,ue)=>{try{const fe=await fetch(`${Y}/api/admin/create-stripe-price`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({amount:parseFloat(U),interval:ee,productName:ae,perUnit:!0})}),re=await fe.json();fe.ok?(u("payment",ue,re.priceId),z.success(`Stripe Price Created: ${ae} - $${U}`)):z.error("Failed: "+re.message)}catch(fe){z.error("Error creating price: "+fe.message)}};return n?e.jsx("div",{className:"text-white flex justify-center p-8",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-infosec-accent rounded-full border-t-transparent"})}):e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Subscription Management"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Configure plans, pricing, and Stripe integration"})]}),e.jsx("div",{children:e.jsxs("button",{onClick:x,disabled:i,className:"px-6 py-2 bg-infosec-accent hover:bg-infosec-accentHover text-white font-bold rounded-lg transition-colors disabled:opacity-50 flex items-center gap-2",children:[i?e.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-white rounded-full border-t-transparent"}):null,i?"Saving...":"Save Settings"]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col relative overflow-hidden transition-all hover:border-gray-700",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-gray-500"}),e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Free Plan"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Plan Name"}),e.jsx("input",{type:"text",value:((g=r.payment)==null?void 0:g.plan_free_name)||"",onChange:U=>u("payment","plan_free_name",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white text-sm focus:border-gray-500 outline-none transition-colors",placeholder:"Free Tier"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Monthly Alert Limit"}),e.jsx("input",{type:"number",value:((b=r.general)==null?void 0:b.free_tier_limit)||"",onChange:U=>u("general","free_tier_limit",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white text-sm focus:border-gray-500 outline-none transition-colors",placeholder:"3"}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:"Alerts/mo"})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col relative overflow-hidden transition-all hover:border-infosec-accent",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-infosec-accent"}),e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Monthly Pro"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Plan Name"}),e.jsx("input",{type:"text",value:((p=r.payment)==null?void 0:p.plan_monthly_name)||"",onChange:U=>u("payment","plan_monthly_name",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white text-sm focus:border-infosec-accent outline-none transition-colors",placeholder:"Monthly Pro"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Original Price ($)"}),e.jsx("input",{type:"text",value:((v=r.payment)==null?void 0:v.stripe_price_original_monthly)||"",onChange:U=>u("payment","stripe_price_original_monthly",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold outline-none focus:border-infosec-accent transition-colors",placeholder:"17.99"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Discount %"}),e.jsx("input",{type:"number",value:((y=r.payment)==null?void 0:y.discount_monthly_percent)||"",onChange:U=>u("payment","discount_monthly_percent",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold text-infosec-accent outline-none focus:border-infosec-accent transition-colors",placeholder:"0"})]})]}),e.jsxs("div",{className:"bg-gray-800/50 p-2 rounded flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Final Price:"}),e.jsx("span",{className:"text-sm font-bold text-green-400",children:(()=>{var ae,ue;const U=parseFloat((ae=r.payment)==null?void 0:ae.stripe_price_original_monthly)||0,ee=parseFloat((ue=r.payment)==null?void 0:ue.discount_monthly_percent)||0;return U<=0?"-":`$${(U*(1-ee/100)).toFixed(2)}`})()})]}),e.jsx("button",{onClick:()=>{var ue,fe,re;const U=(ue=r.payment)==null?void 0:ue.stripe_price_original_monthly,ee=((fe=r.payment)==null?void 0:fe.plan_monthly_name)||"Monthly Pro",ae=((re=r.payment)==null?void 0:re.discount_monthly_percent)||0;if(!U)return z.warn("Enter a price first");h("month",U,ee,ae)},className:"w-full py-2 bg-infosec-accent hover:bg-infosec-accentHover text-white rounded-lg font-bold text-sm transition-colors shadow-lg shadow-infosec-accent/20",children:"Generate & Save Price"})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col relative overflow-hidden transition-all hover:border-purple-500",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-purple-600"}),e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Yearly Pro"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Plan Name"}),e.jsx("input",{type:"text",value:((j=r.payment)==null?void 0:j.plan_yearly_name)||"",onChange:U=>u("payment","plan_yearly_name",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white text-sm focus:border-purple-500 outline-none transition-colors",placeholder:"Yearly Pro"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Original Price ($)"}),e.jsx("input",{type:"text",value:((S=r.payment)==null?void 0:S.stripe_price_original_yearly)||"",onChange:U=>u("payment","stripe_price_original_yearly",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold outline-none focus:border-purple-500 transition-colors",placeholder:"179.99"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Discount %"}),e.jsx("input",{type:"number",value:((N=r.payment)==null?void 0:N.discount_yearly_percent)||"",onChange:U=>u("payment","discount_yearly_percent",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold text-purple-400 outline-none focus:border-purple-500 transition-colors",placeholder:"20"})]})]}),e.jsxs("div",{className:"bg-gray-800/50 p-2 rounded flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Final Price:"}),e.jsx("span",{className:"text-sm font-bold text-green-400",children:(()=>{var ae,ue;const U=parseFloat((ae=r.payment)==null?void 0:ae.stripe_price_original_yearly)||0,ee=parseFloat((ue=r.payment)==null?void 0:ue.discount_yearly_percent)||0;return U<=0?"-":`$${(U*(1-ee/100)).toFixed(2)}`})()})]}),e.jsx("button",{onClick:()=>{var ue,fe,re;const U=(ue=r.payment)==null?void 0:ue.stripe_price_original_yearly,ee=((fe=r.payment)==null?void 0:fe.plan_yearly_name)||"Yearly Pro",ae=((re=r.payment)==null?void 0:re.discount_yearly_percent)||0;if(!U)return z.warn("Enter a price first");h("year",U,ee,ae)},className:"w-full py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-bold text-sm transition-colors shadow-lg shadow-purple-600/20",children:"Generate & Save Price"})]})]})]}),e.jsxs("div",{className:"mt-8 pt-6 border-t border-gray-800",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-blue-400",children:"🏢"})," Team Per-Seat Pricing"]}),e.jsx("p",{className:"text-sm text-gray-400",children:"Set per-user prices for each tier. Yearly = 10x Monthly (2 Months Free)."})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col relative overflow-hidden transition-all hover:border-blue-500",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-blue-500"}),e.jsx("h4",{className:"text-white font-bold mb-2 text-lg",children:"Tier: Small"}),e.jsx("p",{className:"text-xs text-gray-400 mb-4",children:"1-10 users"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Base Price ($/mo)"}),e.jsx("input",{type:"text",value:((w=r.payment)==null?void 0:w.tier_small_price)||"",onChange:U=>u("payment","tier_small_price",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold text-xl outline-none focus:border-blue-500 transition-colors",placeholder:"17.99"})]}),e.jsxs("div",{className:"bg-gray-800/50 p-3 rounded space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-gray-700",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Monthly ID"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:(_=r.payment)!=null&&_.tier_small_stripe_id?"Active":"Missing"})]}),(P=r.payment)!=null&&P.tier_small_stripe_id?e.jsx("span",{className:"text-xs font-mono text-green-400 truncate max-w-[100px]",title:r.payment.tier_small_stripe_id,children:r.payment.tier_small_stripe_id}):e.jsx("button",{onClick:()=>{var ee;const U=(ee=r.payment)==null?void 0:ee.tier_small_price;if(!U)return z.warn("Enter a price first");f(U,"month","Team Small (Monthly)","tier_small_stripe_id")},className:"px-2 py-1 bg-blue-600 hover:bg-blue-500 text-white rounded text-xs",children:"Generate"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Yearly ID (10x)"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:(O=r.payment)!=null&&O.tier_small_stripe_id_yearly?"Active":"Missing"})]}),(T=r.payment)!=null&&T.tier_small_stripe_id_yearly?e.jsx("span",{className:"text-xs font-mono text-green-400 truncate max-w-[100px]",title:r.payment.tier_small_stripe_id_yearly,children:r.payment.tier_small_stripe_id_yearly}):e.jsx("button",{onClick:()=>{var ae;const U=(ae=r.payment)==null?void 0:ae.tier_small_price;if(!U)return z.warn("Enter a price first");const ee=(parseFloat(U)*10).toFixed(2);f(ee,"year","Team Small (Yearly)","tier_small_stripe_id_yearly")},className:"px-2 py-1 bg-purple-600 hover:bg-purple-500 text-white rounded text-xs",children:"Gen 10x"})]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col relative overflow-hidden transition-all hover:border-purple-500",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-purple-500"}),e.jsx("h4",{className:"text-white font-bold mb-2 text-lg",children:"Tier: Medium"}),e.jsx("p",{className:"text-xs text-gray-400 mb-4",children:"11-25 users"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Base Price ($/mo)"}),e.jsx("input",{type:"text",value:((k=r.payment)==null?void 0:k.tier_medium_price)||"",onChange:U=>u("payment","tier_medium_price",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold text-xl outline-none focus:border-purple-500 transition-colors",placeholder:"14.99"})]}),e.jsxs("div",{className:"bg-gray-800/50 p-3 rounded space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-gray-700",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Monthly ID"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:($=r.payment)!=null&&$.tier_medium_stripe_id?"Active":"Missing"})]}),(C=r.payment)!=null&&C.tier_medium_stripe_id?e.jsx("span",{className:"text-xs font-mono text-green-400 truncate max-w-[100px]",title:r.payment.tier_medium_stripe_id,children:r.payment.tier_medium_stripe_id}):e.jsx("button",{onClick:()=>{var ee;const U=(ee=r.payment)==null?void 0:ee.tier_medium_price;if(!U)return z.warn("Enter a price first");f(U,"month","Team Medium (Monthly)","tier_medium_stripe_id")},className:"px-2 py-1 bg-blue-600 hover:bg-blue-500 text-white rounded text-xs",children:"Generate"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Yearly ID (10x)"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:(A=r.payment)!=null&&A.tier_medium_stripe_id_yearly?"Active":"Missing"})]}),(E=r.payment)!=null&&E.tier_medium_stripe_id_yearly?e.jsx("span",{className:"text-xs font-mono text-green-400 truncate max-w-[100px]",title:r.payment.tier_medium_stripe_id_yearly,children:r.payment.tier_medium_stripe_id_yearly}):e.jsx("button",{onClick:()=>{var ae;const U=(ae=r.payment)==null?void 0:ae.tier_medium_price;if(!U)return z.warn("Enter a price first");const ee=(parseFloat(U)*10).toFixed(2);f(ee,"year","Team Medium (Yearly)","tier_medium_stripe_id_yearly")},className:"px-2 py-1 bg-purple-600 hover:bg-purple-500 text-white rounded text-xs",children:"Gen 10x"})]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col relative overflow-hidden transition-all hover:border-cyan-500",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-cyan-500 to-green-500"}),e.jsx("h4",{className:"text-white font-bold mb-2 text-lg",children:"Tier: Large"}),e.jsx("p",{className:"text-xs text-gray-400 mb-4",children:"26+ users"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Base Price ($/mo)"}),e.jsx("input",{type:"text",value:((L=r.payment)==null?void 0:L.tier_large_price)||"",onChange:U=>u("payment","tier_large_price",U.target.value),className:"w-full px-3 py-2 bg-[#0e0f11] border border-gray-700 rounded text-white font-bold text-xl outline-none focus:border-cyan-500 transition-colors",placeholder:"12.99"})]}),e.jsxs("div",{className:"bg-gray-800/50 p-3 rounded space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-gray-700",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Monthly ID"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:(F=r.payment)!=null&&F.tier_large_stripe_id?"Active":"Missing"})]}),(D=r.payment)!=null&&D.tier_large_stripe_id?e.jsx("span",{className:"text-xs font-mono text-green-400 truncate max-w-[100px]",title:r.payment.tier_large_stripe_id,children:r.payment.tier_large_stripe_id}):e.jsx("button",{onClick:()=>{var ee;const U=(ee=r.payment)==null?void 0:ee.tier_large_price;if(!U)return z.warn("Enter a price first");f(U,"month","Team Large (Monthly)","tier_large_stripe_id")},className:"px-2 py-1 bg-blue-600 hover:bg-blue-500 text-white rounded text-xs",children:"Generate"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs text-gray-400",children:"Yearly ID (10x)"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:(q=r.payment)!=null&&q.tier_large_stripe_id_yearly?"Active":"Missing"})]}),(Q=r.payment)!=null&&Q.tier_large_stripe_id_yearly?e.jsx("span",{className:"text-xs font-mono text-green-400 truncate max-w-[100px]",title:r.payment.tier_large_stripe_id_yearly,children:r.payment.tier_large_stripe_id_yearly}):e.jsx("button",{onClick:()=>{var ae;const U=(ae=r.payment)==null?void 0:ae.tier_large_price;if(!U)return z.warn("Enter a price first");const ee=(parseFloat(U)*10).toFixed(2);f(ee,"year","Team Large (Yearly)","tier_large_stripe_id_yearly")},className:"px-2 py-1 bg-purple-600 hover:bg-purple-500 text-white rounded text-xs",children:"Gen 10x"})]})]})]})]})]})]}),e.jsx("div",{className:"mt-8 pt-6 border-t border-gray-800",children:e.jsxs("button",{onClick:()=>d(!c),className:"text-sm text-gray-400 hover:text-white underline flex items-center gap-2 group transition-colors",children:[e.jsx("span",{children:c?"Hide Stripe Configuration":"Show Stripe Configuration (Keys & IDs)"}),e.jsx("svg",{className:`w-4 h-4 transition-transform duration-200 ${c?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]})}),c&&e.jsxs("div",{className:"mt-6 bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 animate-fadeIn space-y-6",children:[e.jsxs("div",{className:"bg-blue-500/10 border border-blue-500/50 p-4 rounded-lg text-sm text-blue-300",children:[e.jsx("strong",{children:"Setup Instructions:"}),e.jsxs("ol",{className:"list-decimal ml-5 mt-2 space-y-1 text-blue-200/80",children:[e.jsxs("li",{children:["Enter your ",e.jsx("strong",{children:"Publishable Key"})," and ",e.jsx("strong",{children:"Secret Key"})," below from your Stripe Dashboard."]}),e.jsxs("li",{children:["Click ",e.jsx("strong",{children:"Save Settings"})," at the top right."]}),e.jsxs("li",{children:["Scroll up and click ",e.jsx("strong",{children:"Generate & Save Price"})," on the Monthly and Yearly cards to create the actual products in Stripe."]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-infosec-accent",children:"🔑"})," Stripe API Keys"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Publishable Key"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:((de=r.payment)==null?void 0:de.stripe_publishable_key)||"",onChange:U=>u("payment","stripe_publishable_key",U.target.value),className:"w-full pl-10 pr-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-infosec-accent outline-none font-mono text-sm",placeholder:"pk_test_..."}),e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11.536 19.464a3 3 0 01-.879.879l-4.243-4.243a3 3 0 01-.879-.879l5.006-5.006A6 6 0 0121.536 11l-3 3"})})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Secret Key"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"password",value:((H=r.payment)==null?void 0:H.stripe_secret_key)||"",onChange:U=>u("payment","stripe_secret_key",U.target.value),className:"w-full pl-10 pr-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-infosec-accent outline-none font-mono text-sm",placeholder:"sk_test_..."}),e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Webhook Secret"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"password",value:((se=r.payment)==null?void 0:se.stripe_webhook_secret)||"",onChange:U=>u("payment","stripe_webhook_secret",U.target.value),className:"w-full pl-10 pr-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-infosec-accent outline-none font-mono text-sm",placeholder:"whsec_..."}),e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})})})]})]})]})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-800",children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-400",children:"🆔"})," Reference IDs"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Monthly Price ID"}),e.jsx("div",{className:"flex",children:e.jsx("code",{className:"bg-black/30 border border-gray-700 rounded px-2 py-1.5 text-xs text-gray-300 font-mono flex-1 truncate",children:((W=r.payment)==null?void 0:W.stripe_price_monthly)||"Not generated"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Yearly Price ID"}),e.jsx("div",{className:"flex",children:e.jsx("code",{className:"bg-black/30 border border-gray-700 rounded px-2 py-1.5 text-xs text-gray-300 font-mono flex-1 truncate",children:((le=r.payment)==null?void 0:le.stripe_price_yearly)||"Not generated"})})]})]})]})]})]})})},AC=({token:t})=>{var v,y,j,S,N,w,_,P,O,T,k,$,C,A;const[r,a]=l.useState({seo:{title:"",description:"",keywords:""},socials:{discord:"",twitter:"",linkedin:"",github:""},marketing:{filter:"all",subject:"",body:""}}),[n,s]=l.useState(!0),[i,o]=l.useState(!1),[c,d]=l.useState(!1),[m,u]=l.useState(null);l.useEffect(()=>{h(),x()},[]);const x=async()=>{try{const E=await fetch(`${Y}/api/admin/marketing/stats`,{headers:{Authorization:`Bearer ${t}`}});if(E.ok){const L=await E.json();u(L)}}catch(E){console.error("Error loading marketing stats:",E)}},h=async()=>{try{const E=await fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${t}`}});if(E.ok){const L=await E.json();a(F=>({...F,...L,seo:L.seo||{title:"InfosecLabs",description:"Cyber Range Platform",keywords:"cybersecurity, training, soc"},socials:L.socials||{discord:"",twitter:"",linkedin:"",github:""},marketing:{...F.marketing,...L.marketing||{}}}))}}catch(E){console.error("Error loading settings:",E)}finally{s(!1)}},f=(E,L,F)=>{a(D=>({...D,[E]:{...D[E],[L]:F}}))},g=async()=>{try{if((await fetch(`${Y}/api/admin/settings`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(r)})).ok)z.success("Growth settings saved successfully!");else throw new Error("Failed to save settings")}catch{z.error("Error saving settings")}},b=async()=>{var E,L,F,D;if(!((E=r.marketing)!=null&&E.subject)||!((L=r.marketing)!=null&&L.body)){z.warn("Please enter subject and body");return}if(confirm(`Are you sure you want to send this email to ${((F=r.marketing)==null?void 0:F.filter)||"all"} users?`)){o(!0);try{const q=await fetch(`${Y}/api/admin/marketing/send`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({filter:((D=r.marketing)==null?void 0:D.filter)||"all",subject:r.marketing.subject,body:r.marketing.body})}),Q=await q.json();q.ok?(z.success(`Sent ${Q.sent} emails successfully!`),f("marketing","subject",""),f("marketing","body","")):z.error("Failed: "+Q.message)}catch(q){z.error("Error sending emails: "+q.message)}finally{o(!1)}}},p=async()=>{if(confirm("DANGER! Are you sure you want to DELETE unverified accounts? This action cannot be undone.")){d(!0);try{const E=await fetch(`${Y}/api/admin/cleanup-unverified`,{method:"POST",headers:{Authorization:`Bearer ${t}`}}),L=await E.json();E.ok?z.success(`Cleanup complete: ${L.reminders_sent} reminders, ${L.accounts_deleted} deleted.`):z.error("Failed: "+L.message)}catch(E){z.error("Error: "+E.message)}finally{d(!1)}}};return n?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-500"})}):e.jsxs("div",{className:"max-w-[1600px] mx-auto p-6 space-y-8",children:[e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-white flex items-center gap-3",children:["Growth Studio",e.jsx(Mt,{className:"w-6 h-6 text-purple-500"})]}),e.jsx("p",{className:"text-gray-400 mt-2",children:"Manage SEO, social presence, and marketing campaigns to grow your platform."})]}),e.jsxs("button",{type:"button",onClick:g,className:"px-6 py-2.5 bg-purple-600 hover:bg-purple-500 text-white font-bold rounded-xl shadow-lg shadow-purple-900/20 transition-all flex items-center gap-2",children:[e.jsx(As,{className:"w-4 h-4"}),"Save All Changes"]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden shadow-xl lg:col-span-1",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-gradient-to-br from-[#1a1b1e] to-[#25262b]",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-blue-500/20 rounded-lg",children:e.jsx(Jt,{className:"w-5 h-5 text-blue-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"SEO Configuration"})]}),e.jsx("p",{className:"text-sm text-gray-400",children:"Optimize platform visibility in search engines."})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Meta Title"}),e.jsx("input",{type:"text",value:((v=r.seo)==null?void 0:v.title)||"",onChange:E=>f("seo","title",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-blue-500 outline-none",placeholder:"InfosecLabs | Cyber Range"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Meta Description"}),e.jsx("textarea",{value:((y=r.seo)==null?void 0:y.description)||"",onChange:E=>f("seo","description",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-blue-500 outline-none h-24 resize-none",placeholder:"A brief description of your platform..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Keywords"}),e.jsx("input",{type:"text",value:((j=r.seo)==null?void 0:j.keywords)||"",onChange:E=>f("seo","keywords",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-blue-500 outline-none",placeholder:"cybersecurity, hacking, soc, training"})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden shadow-xl lg:col-span-1",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-gradient-to-br from-[#1a1b1e] to-[#25262b]",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-pink-500/20 rounded-lg",children:e.jsx(Aj,{className:"w-5 h-5 text-pink-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"Social Connections"})]}),e.jsx("p",{className:"text-sm text-gray-400",children:"Manage links to your community platforms."})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2 flex items-center gap-2",children:[e.jsx(si,{className:"w-3 h-3"})," Discord Invite URL"]}),e.jsx("input",{type:"text",value:((S=r.socials)==null?void 0:S.discord)||"",onChange:E=>f("socials","discord",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-pink-500 outline-none",placeholder:"https://discord.gg/..."})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2 flex items-center gap-2",children:[e.jsx(F1,{className:"w-3 h-3"})," Twitter / X Profile"]}),e.jsx("input",{type:"text",value:((N=r.socials)==null?void 0:N.twitter)||"",onChange:E=>f("socials","twitter",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-pink-500 outline-none",placeholder:"https://twitter.com/..."})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2 flex items-center gap-2",children:[e.jsx(x1,{className:"w-3 h-3"})," GitHub Organization"]}),e.jsx("input",{type:"text",value:((w=r.socials)==null?void 0:w.github)||"",onChange:E=>f("socials","github",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-pink-500 outline-none",placeholder:"https://github.com/..."})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2 flex items-center gap-2",children:[e.jsx(Ij,{className:"w-3 h-3"})," LinkedIn Company"]}),e.jsx("input",{type:"text",value:((_=r.socials)==null?void 0:_.linkedin)||"",onChange:E=>f("socials","linkedin",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-pink-500 outline-none",placeholder:"https://linkedin.com/company/..."})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden shadow-xl lg:col-span-1",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-gradient-to-br from-[#1a1b1e] to-[#25262b]",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-red-500/20 rounded-lg",children:e.jsx(Sa,{className:"w-5 h-5 text-red-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"Database Hygiene"})]}),e.jsx("p",{className:"text-sm text-gray-400",children:"Manage unverified and inactive user accounts."})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-4",children:[e.jsx("h4",{className:"text-red-400 font-bold text-sm mb-2",children:"Prune Unverified Accounts"}),e.jsxs("p",{className:"text-gray-400 text-xs mb-4",children:["Sends reminders to users unverified for 24h. ",e.jsx("br",{}),e.jsx("span",{className:"text-red-400 font-bold",children:"DELETES"})," users unverified for 48h+."]}),e.jsxs("button",{type:"button",onClick:p,disabled:c,className:"w-full py-2 bg-red-600 hover:bg-red-500 text-white font-bold rounded-lg text-sm transition-colors flex items-center justify-center gap-2 disabled:opacity-50",children:[c?e.jsx(Jr,{className:"animate-spin w-4 h-4"}):e.jsx(na,{className:"w-4 h-4"}),"Run Cleanup"]})]}),e.jsx("div",{className:"text-xs text-gray-500 text-center",children:"Recommended: Run this once weekly."})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden shadow-xl lg:col-span-3",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-gradient-to-br from-[#1a1b1e] to-[#25262b]",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-purple-500/20 rounded-lg",children:e.jsx(Qr,{className:"w-5 h-5 text-purple-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"Email Campaign Manager"})]}),e.jsx("p",{className:"text-sm text-gray-400",children:"Send direct marketing communications to your user base. Supports HTML."})]}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-8",children:[e.jsxs("div",{className:"bg-[#0e0f11] p-4 rounded-xl border border-gray-800 flex flex-col justify-center",children:[e.jsxs("div",{className:"text-gray-500 text-xs font-bold uppercase mb-1 flex items-center gap-2",children:[e.jsx(At,{className:"w-3 h-3"})," Total Audience"]}),e.jsx("div",{className:"text-2xl font-bold text-white",children:(m==null?void 0:m.total_users)||0})]}),e.jsxs("div",{className:"bg-[#0e0f11] p-4 rounded-xl border border-blue-900/30 flex flex-col justify-center",children:[e.jsxs("div",{className:"text-blue-500 text-xs font-bold uppercase mb-1 flex items-center gap-2",children:[e.jsx(ii,{className:"w-3 h-3"})," Web Users"]}),e.jsx("div",{className:"text-2xl font-bold text-blue-100",children:(m==null?void 0:m.web_users)||0})]}),e.jsxs("div",{className:"bg-[#0e0f11] p-4 rounded-xl border border-green-900/30 flex flex-col justify-center",children:[e.jsxs("div",{className:"text-green-500 text-xs font-bold uppercase mb-1 flex items-center gap-2",children:[e.jsx(Jn,{className:"w-3 h-3"})," Mobile Users"]}),e.jsx("div",{className:"text-2xl font-bold text-green-100",children:(m==null?void 0:m.mobile_users)||0})]}),e.jsxs("div",{className:"bg-[#0e0f11] p-4 rounded-xl border border-purple-900/30 flex flex-col justify-center",children:[e.jsxs("div",{className:"text-purple-500 text-xs font-bold uppercase mb-1 flex items-center gap-2",children:[e.jsx(Qr,{className:"w-3 h-3"})," Onboarding Sent"]}),e.jsx("div",{className:"text-2xl font-bold text-purple-100",children:(m==null?void 0:m.onboarding_sent)||0})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-4 lg:col-span-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Subject Line"}),e.jsx("input",{type:"text",value:((P=r.marketing)==null?void 0:P.subject)||"",onChange:E=>f("marketing","subject",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-purple-500 outline-none",placeholder:"Special Offer: 50% Off Pro Subscription"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Email Body (HTML)"}),e.jsx("textarea",{value:((O=r.marketing)==null?void 0:O.body)||"",onChange:E=>f("marketing","body",E.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-4 py-3 text-white font-mono text-sm focus:border-purple-500 outline-none h-64",placeholder:`<h1>Hello {{name}},</h1>

<p>We have some exciting news for you...</p>`}),e.jsxs("p",{className:"text-xs text-gray-500 mt-2 flex gap-2",children:[e.jsx("span",{children:"Variables:"}),e.jsx("code",{className:"bg-gray-800 px-1 rounded text-purple-400",children:"{{name}}"}),e.jsx("code",{className:"bg-gray-800 px-1 rounded text-purple-400",children:"{{email}}"})]})]})]}),e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-gray-900/50 p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold text-sm mb-4",children:"Audience Targeting"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center gap-3 p-3 bg-[#0e0f11] rounded-lg border border-gray-800 cursor-pointer hover:border-purple-500/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"filter",value:"all",checked:((T=r.marketing)==null?void 0:T.filter)==="all",onChange:E=>f("marketing","filter",E.target.value),className:"text-purple-600 focus:ring-purple-500"}),e.jsx("div",{className:"text-sm text-gray-300",children:"All Users"})]}),e.jsxs("label",{className:"flex items-center gap-3 p-3 bg-[#0e0f11] rounded-lg border border-gray-800 cursor-pointer hover:border-purple-500/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"filter",value:"verified",checked:((k=r.marketing)==null?void 0:k.filter)==="verified",onChange:E=>f("marketing","filter",E.target.value),className:"text-purple-600 focus:ring-purple-500"}),e.jsx("div",{className:"text-sm text-gray-300",children:"Verified Users Only"})]}),e.jsxs("label",{className:"flex items-center gap-3 p-3 bg-[#0e0f11] rounded-lg border border-gray-800 cursor-pointer hover:border-purple-500/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"filter",value:"free",checked:(($=r.marketing)==null?void 0:$.filter)==="free",onChange:E=>f("marketing","filter",E.target.value),className:"text-purple-600 focus:ring-purple-500"}),e.jsx("div",{className:"text-sm text-gray-300",children:"Free Tier Users"})]}),e.jsxs("label",{className:"flex items-center gap-3 p-3 bg-[#0e0f11] rounded-lg border border-gray-800 cursor-pointer hover:border-green-500/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"filter",value:"mobile",checked:((C=r.marketing)==null?void 0:C.filter)==="mobile",onChange:E=>f("marketing","filter",E.target.value),className:"text-green-600 focus:ring-green-500"}),e.jsxs("div",{className:"text-sm text-green-400 font-medium flex items-center gap-2",children:[e.jsx(Jn,{className:"w-4 h-4"})," Mobile App Users"]})]}),e.jsxs("label",{className:"flex items-center gap-3 p-3 bg-[#0e0f11] rounded-lg border border-gray-800 cursor-pointer hover:border-blue-500/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"filter",value:"web",checked:((A=r.marketing)==null?void 0:A.filter)==="web",onChange:E=>f("marketing","filter",E.target.value),className:"text-blue-600 focus:ring-blue-500"}),e.jsxs("div",{className:"text-sm text-blue-400 font-medium flex items-center gap-2",children:[e.jsx(ii,{className:"w-4 h-4"})," Web Platform Users"]})]})]}),e.jsxs("button",{type:"button",onClick:b,disabled:i,className:"w-full mt-6 py-3 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 text-white font-bold rounded-xl shadow-lg shadow-purple-900/20 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[i?e.jsx(Jr,{className:"animate-spin w-5 h-5"}):e.jsx(Qr,{className:"w-5 h-5"}),"Launch Campaign"]})]})})]})]})]})]})]})},OC=({token:t})=>{var w,_,P,O,T,k,$,C,A,E,L,F,D,q,Q,de,H,se,W,le,U,ee,ae,ue,fe;const[r,a]=l.useState({newsletter:{articles:[],subscriber_count:0,testEmail:""},newsletterSchedule:{enabled:!1,day:"friday",hour:"9"},subscriberStats:{loaded:!1,filter:"all",list:[],total:0,registered:0,external:0,showImport:!1}}),[n,s]=l.useState({isOpen:!1,title:"",message:"",onConfirm:()=>{},isDanger:!1,confirmText:"Confirm"}),i=()=>s(re=>({...re,isOpen:!1})),[o,c]=l.useState(!0),[d,m]=l.useState(!1),[u,x]=l.useState(!1);l.useEffect(()=>{h()},[]);const h=async()=>{try{const re=await fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${t}`}});if(re.ok){const V=await re.json();a(ce=>({...ce,...V,newsletterSchedule:V.newsletterSchedule||ce.newsletterSchedule,newsletter:{...ce.newsletter,...V.newsletter||{}}}))}}catch(re){console.error("Error loading settings:",re)}finally{c(!1)}},f=(re,V,ce)=>{a(Z=>({...Z,[re]:{...Z[re],[V]:ce}}))},g=async re=>{try{const V={...re};if(delete V.subscriberStats,!(await fetch(`${Y}/api/admin/settings`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(V)})).ok)throw new Error("Failed to auto-save settings")}catch(V){console.error("Auto-save error:",V),z.error("Warning: Could not save newsletter draft.")}},b=async()=>{m(!0);try{z.info("AI is curating stories...");const re=await fetch(`${Y}/api/admin/newsletter/generate`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}}),V=await re.json();if(re.ok){const ce=V.articles,Z=V.subscriber_count;a(xe=>{const pe={...xe,newsletter:{...xe.newsletter,articles:ce,subscriber_count:Z}};return g(pe),pe}),z.success(`Curated ${V.articles.length} stories!`)}else z.error("Generation failed: "+V.message)}catch(re){z.error("Error: "+re.message)}finally{m(!1)}},p=async()=>{var V,ce;const re=(V=r.newsletter)==null?void 0:V.testEmail;if(!re||!re.includes("@")){z.error("Please enter a valid email address");return}try{z.info(`Sending test to ${re}...`);const Z=await fetch(`${Y}/api/admin/newsletter/send`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({articles:(ce=r.newsletter)==null?void 0:ce.articles,testEmail:re})}),xe=await Z.json();Z.ok?z.success("Test email sent successfully!"):z.error("Failed: "+xe.message)}catch(Z){z.error("Error: "+Z.message)}},v=()=>{var re;(re=r.newsletter)!=null&&re.articles&&s({isOpen:!0,title:"Confirm Broadcast",message:"Are you sure you want to broadcast this newsletter to ALL subscribers? This action cannot be undone.",isDanger:!1,confirmText:"Send Broadcast",onConfirm:y})},y=async()=>{var re;x(!0);try{z.info("Starting broadcast...");const V=await fetch(`${Y}/api/admin/newsletter/send`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({articles:(re=r.newsletter)==null?void 0:re.articles})}),ce=await V.json();V.ok?(z.success(`Broadcast complete! Sent to ${ce.sent}/${ce.total} subscribers.`),a(Z=>{const xe={...Z,newsletter:{...Z.newsletter,articles:[]}};return g(xe),xe})):z.error("Broadcast failed: "+ce.message)}catch(V){z.error("Error: "+V.message)}finally{x(!1)}},j=async re=>{try{(await fetch(`${Y}/api/admin/newsletter/unsubscribe`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({email:re})})).ok&&(z.success("Unsubscribed successfully"),f("subscriberStats","list",r.subscriberStats.list.filter(ce=>ce.email!==re)),N())}catch(V){console.error("Error unsubscribing:",V),z.error("Error unsubscribing user")}},S=async()=>{var re,V,ce;try{(await fetch(`${Y}/api/admin/newsletter/settings`,{method:"PUT",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:((re=r.newsletterSchedule)==null?void 0:re.enabled)||!1,day:((V=r.newsletterSchedule)==null?void 0:V.day)||"friday",hour:((ce=r.newsletterSchedule)==null?void 0:ce.hour)||"9"})})).ok?z.success("Schedule updated successfully!"):z.error("Failed to save schedule")}catch(Z){z.error("Error: "+Z.message)}},N=async()=>{try{const re=await fetch(`${Y}/api/admin/newsletter/subscribers`,{headers:{Authorization:`Bearer ${t}`}}),V=await re.json();re.ok&&(f("subscriberStats","total",V.total),f("subscriberStats","registered",V.registered),f("subscriberStats","external",V.external),f("subscriberStats","list",V.subscribers),f("subscriberStats","loaded",!0))}catch{z.error("Error loading subscribers")}};return o?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-500"})}):e.jsxs("div",{className:"max-w-[1600px] mx-auto p-6 space-y-8",children:[e.jsx("div",{className:"flex justify-between items-end",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-white flex items-center gap-3",children:["Newsletter Studio",e.jsx("span",{className:"px-3 py-1 rounded-full bg-purple-500/10 text-purple-400 text-xs font-medium border border-purple-500/20",children:"Beta"})]}),e.jsx("p",{className:"text-gray-400 mt-2",children:"Create, schedule, and analyze your weekly cyber intelligence briefs."})]})}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-8",children:[e.jsxs("div",{className:"xl:col-span-4 space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden shadow-xl",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-gradient-to-br from-[#1a1b1e] to-[#25262b]",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-purple-500/20 rounded-lg",children:e.jsx(yr,{className:"w-5 h-5 text-purple-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"AI Content Generator"})]}),e.jsx("p",{className:"text-sm text-gray-400",children:"Curates top 5 stories from 9+ reputable sources and generates concise TL;DRs."})]}),e.jsxs("div",{className:"p-6",children:[e.jsx("button",{type:"button",onClick:b,disabled:d,className:"w-full py-4 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white font-bold rounded-xl shadow-lg shadow-purple-900/20 transition-all transform hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:d?e.jsxs(e.Fragment,{children:[e.jsx(Jr,{className:"w-5 h-5 animate-spin"}),"Curating Content..."]}):e.jsxs(e.Fragment,{children:[e.jsx(yr,{className:"w-5 h-5"}),"Generate New Edition"]})}),((_=(w=r.newsletter)==null?void 0:w.articles)==null?void 0:_.length)>0&&e.jsxs("div",{className:"mt-4 flex items-center justify-between text-xs text-gray-400 bg-gray-900/50 p-3 rounded-lg",children:[e.jsxs("span",{children:["Status: ",e.jsx("span",{className:"text-green-400 font-bold",children:"Ready"})]}),e.jsxs("span",{children:[(O=(P=r.newsletter)==null?void 0:P.articles)==null?void 0:O.length," Stories Loaded"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsx("div",{className:"p-6 border-b border-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-500/20 rounded-lg",children:e.jsx(va,{className:"w-5 h-5 text-blue-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"Schedule & Delivery"})]})}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-300 font-medium",children:"Auto-Pilot Mode"}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((T=r.newsletterSchedule)==null?void 0:T.enabled)||!1,onChange:re=>f("newsletterSchedule","enabled",re.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-purple-500 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-purple-600"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Day"}),e.jsx("select",{value:((k=r.newsletterSchedule)==null?void 0:k.day)||"friday",onChange:re=>f("newsletterSchedule","day",re.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2.5 text-white text-sm focus:border-purple-500 outline-none",children:["monday","tuesday","wednesday","thursday","friday","saturday","sunday"].map(re=>e.jsx("option",{value:re,className:"capitalize",children:re.charAt(0).toUpperCase()+re.slice(1)},re))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Time"}),e.jsx("select",{value:(($=r.newsletterSchedule)==null?void 0:$.hour)||"9",onChange:re=>f("newsletterSchedule","hour",re.target.value),className:"w-full bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2.5 text-white text-sm focus:border-purple-500 outline-none",children:[...Array(24)].map((re,V)=>e.jsx("option",{value:V.toString(),children:V===0?"12:00 AM":V<12?`${V}:00 AM`:V===12?"12:00 PM":`${V-12}:00 PM`},V))})]})]}),e.jsx("button",{type:"button",onClick:S,className:"w-full py-2 bg-gray-800 hover:bg-gray-700 text-gray-300 font-medium rounded-lg text-sm transition-colors",children:"Save Preferences"})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsx("div",{className:"p-6 border-b border-gray-800",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-500/20 rounded-lg",children:e.jsx(ei,{className:"w-5 h-5 text-green-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"Broadcast"})]})}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs uppercase tracking-wider text-gray-500 font-bold mb-2",children:"Test Recipient"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Xj,{className:"absolute left-3 top-2.5 text-gray-500 w-4 h-4"}),e.jsx("input",{type:"email",placeholder:"you@example.com",value:((C=r.newsletter)==null?void 0:C.testEmail)||"",onChange:re=>f("newsletter","testEmail",re.target.value),className:"w-full bg-[#0e0f11] pl-10 border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-purple-500 outline-none"})]}),e.jsx("button",{type:"button",onClick:p,className:"px-4 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-lg text-sm font-medium transition-colors",children:"Test"})]})]}),e.jsx("div",{className:"pt-2 border-t border-gray-800",children:e.jsxs("button",{type:"button",onClick:v,disabled:!((E=(A=r.newsletter)==null?void 0:A.articles)!=null&&E.length)||u,className:"w-full py-3 bg-green-600 hover:bg-green-500 text-white font-bold rounded-xl shadow-lg shadow-green-900/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[u?e.jsx(Jr,{className:"animate-spin w-5 h-5"}):e.jsx(Qr,{className:"w-5 h-5"}),"Broadcast to ",((L=r.subscriberStats)==null?void 0:L.total)||((F=r.newsletter)==null?void 0:F.subscriber_count)||0," Subscribers"]})})]})]})]}),e.jsxs("div",{className:"xl:col-span-8 space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden shadow-2xl flex flex-col h-[600px]",children:[e.jsxs("div",{className:"p-4 bg-gray-900 border-b border-gray-800 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500/80"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500/80"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-green-500/80"})]}),e.jsx("div",{className:"ml-4 px-4 py-1.5 bg-[#0e0f11] rounded-md text-xs text-gray-400 w-64 text-center border border-gray-800",children:"preview.html"})]}),e.jsx("span",{className:"text-xs text-gray-500 font-mono",children:"HTML Preview"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto bg-white/5 scrollbar-thin scrollbar-thumb-gray-700",children:((q=(D=r.newsletter)==null?void 0:D.articles)==null?void 0:q.length)>0?e.jsxs("div",{className:"max-w-2xl mx-auto bg-white min-h-full p-8 text-gray-900 shadow-xl my-8 rounded-lg",children:[e.jsxs("div",{className:"border-b border-gray-200 pb-6 mb-8 text-center",children:[e.jsx("div",{className:"inline-block px-4 py-1 bg-purple-100 text-purple-700 rounded-full text-xs font-bold tracking-wider mb-4 uppercase",children:"Weekly Digest"}),e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Cyber Intelligence Brief"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Top stories from the last 7 days"})]}),e.jsx("div",{className:"space-y-8",children:(Array.isArray((Q=r.newsletter)==null?void 0:Q.articles)?r.newsletter.articles:[]).map((re,V)=>e.jsx("div",{className:"group relative",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"flex-shrink-0 mt-1",children:e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 text-gray-500 text-xs font-bold",children:V+1})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-gray-900 leading-tight mb-2 group-hover:text-purple-700 transition-colors",children:re.title}),e.jsx("p",{className:"text-gray-600 text-sm leading-relaxed mb-2",children:re.tldr}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400",children:[e.jsx("span",{className:"font-medium text-purple-600",children:re.source}),e.jsx("span",{children:"•"}),e.jsxs("a",{href:"#",className:"hover:underline flex items-center gap-1",children:["Read Source ",e.jsx(Tj,{className:"w-3 h-3"})]})]})]})]})},V))}),e.jsxs("div",{className:"mt-12 pt-8 border-t border-gray-200 text-center text-xs text-gray-400",children:[e.jsx("p",{children:"© 2024 InfosecLabs. All rights reserved."}),e.jsx("p",{className:"mt-2",children:"Unsubscribe • Update Preferences"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 opacity-50",children:[e.jsx(Qr,{className:"w-16 h-16 mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"No preview available"}),e.jsx("p",{className:"text-sm",children:"Generate articles to see the preview"})]})})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-yellow-500/20 rounded-lg",children:e.jsx(At,{className:"w-5 h-5 text-yellow-400"})}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"Subscribers"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:N,className:"px-3 py-1.5 bg-gray-800 hover:bg-gray-700 text-white rounded-lg text-xs font-medium transition-colors flex items-center gap-2",children:[e.jsx(Jr,{className:"w-3.5 h-3.5"})," Reload"]}),e.jsxs("button",{type:"button",onClick:()=>{var re;return f("subscriberStats","showImport",!((re=r.subscriberStats)!=null&&re.showImport))},className:"px-3 py-1.5 bg-purple-500/10 hover:bg-purple-500/20 text-purple-400 border border-purple-500/30 rounded-lg text-xs font-medium transition-colors flex items-center gap-2",children:[e.jsx(Vf,{className:"w-3.5 h-3.5"})," Import"]}),e.jsxs("button",{type:"button",onClick:()=>{var pe;const re=((pe=r.subscriberStats)==null?void 0:pe.list)||[];if(re.length===0){z.error("Load subscribers first");return}const V=`Email,Name,Source
`+re.map(Se=>`${Se.email},${Se.name||""},${Se.source}`).join(`
`),ce=new Blob([V],{type:"text/csv"}),Z=URL.createObjectURL(ce),xe=document.createElement("a");xe.href=Z,xe.download="subscribers.csv",xe.click(),URL.revokeObjectURL(Z)},className:"px-3 py-1.5 bg-gray-800 hover:bg-gray-700 text-white rounded-lg text-xs font-medium transition-colors flex items-center gap-2",children:[e.jsx(ti,{className:"w-3.5 h-3.5"})," Export"]})]})]}),((de=r.subscriberStats)==null?void 0:de.showImport)&&e.jsxs("div",{className:"p-4 bg-gray-900/50 border-b border-gray-800",children:[e.jsx("div",{className:"flex gap-2 mb-2",children:e.jsx("textarea",{className:"flex-1 bg-[#0e0f11] border border-gray-700 rounded-lg px-3 py-2 text-white text-sm focus:border-purple-500 outline-none h-24",placeholder:"Paste emails here (one per line, or comma separated)",id:"importEmails"})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>f("subscriberStats","showImport",!1),className:"px-3 py-1.5 text-gray-400 hover:text-white text-xs",children:"Cancel"}),e.jsx("button",{type:"button",onClick:async()=>{const re=document.getElementById("importEmails").value;if(re)try{const V=await fetch(`${Y}/api/admin/newsletter/import`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({emails:re})}),ce=await V.json();V.ok?(z.success(ce.message),f("subscriberStats","showImport",!1),N()):z.error("Failed: "+ce.message)}catch(V){z.error("Error: "+V.message)}},className:"px-3 py-1.5 bg-purple-600 hover:bg-purple-500 text-white rounded-lg text-xs font-bold",children:"Run Import"})]})]}),e.jsxs("div",{className:"p-0",children:[e.jsxs("div",{className:"flex border-b border-gray-800 bg-[#16171a]",children:[e.jsxs("button",{onClick:()=>f("subscriberStats","filter","all"),className:`px-4 py-3 text-xs font-medium border-b-2 transition-colors ${!((H=r.subscriberStats)!=null&&H.filter)||((se=r.subscriberStats)==null?void 0:se.filter)==="all"?"border-purple-500 text-purple-400":"border-transparent text-gray-500 hover:text-white"}`,children:["All Subscribers (",((W=r.subscriberStats)==null?void 0:W.total)||0,")"]}),e.jsxs("button",{onClick:()=>f("subscriberStats","filter","registered"),className:`px-4 py-3 text-xs font-medium border-b-2 transition-colors ${((le=r.subscriberStats)==null?void 0:le.filter)==="registered"?"border-blue-500 text-blue-400":"border-transparent text-gray-500 hover:text-white"}`,children:["Registered (",((U=r.subscriberStats)==null?void 0:U.registered)||0,")"]}),e.jsxs("button",{onClick:()=>f("subscriberStats","filter","external"),className:`px-4 py-3 text-xs font-medium border-b-2 transition-colors ${((ee=r.subscriberStats)==null?void 0:ee.filter)==="external"?"border-pink-500 text-pink-400":"border-transparent text-gray-500 hover:text-white"}`,children:["External (",((ae=r.subscriberStats)==null?void 0:ae.external)||0,")"]})]}),e.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"text-xs text-gray-500 uppercase bg-[#16171a] sticky top-0 z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 font-medium",children:"Email"}),e.jsx("th",{className:"px-6 py-3 font-medium",children:"Source"}),e.jsx("th",{className:"px-6 py-3 font-medium text-right",children:"Actions"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800/50",children:[Array.isArray((ue=r.subscriberStats)==null?void 0:ue.list)&&r.subscriberStats.list.length>0&&r.subscriberStats.list.filter(re=>{var ce;const V=(ce=r.subscriberStats)==null?void 0:ce.filter;return!V||V==="all"?!0:re.source===V}).map((re,V)=>e.jsxs("tr",{className:"hover:bg-gray-800/30 transition-colors group",children:[e.jsxs("td",{className:"px-6 py-3 font-medium text-gray-300",children:[re.email,re.name&&e.jsx("span",{className:"block text-xs text-gray-500 font-normal",children:re.name})]}),e.jsx("td",{className:"px-6 py-3",children:e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${re.source==="registered"?"bg-blue-500/10 text-blue-400 ring-1 ring-blue-500/20":"bg-pink-500/10 text-pink-400 ring-1 ring-pink-500/20"}`,children:re.source})}),e.jsx("td",{className:"px-6 py-3 text-right",children:e.jsx("button",{onClick:()=>{s({isOpen:!0,title:"Unsubscribe User",message:`Are you sure you want to unsubscribe ${re.email}?`,isDanger:!0,confirmText:"Unsubscribe",onConfirm:()=>j(re.email)})},className:"text-gray-600 hover:text-red-400 transition-colors opacity-0 group-hover:opacity-100",title:"Unsubscribe",children:e.jsx(na,{className:"w-4 h-4"})})})]},V)),(!((fe=r.subscriberStats)!=null&&fe.list)||r.subscriberStats.list.length===0)&&e.jsx("tr",{children:e.jsx("td",{colSpan:"3",className:"px-6 py-8 text-center text-gray-500",children:"No subscribers found or list not loaded."})})]})]})})]})]})]})]}),e.jsx(Za,{isOpen:n.isOpen,onClose:i,onConfirm:n.onConfirm,title:n.title,message:n.message,isDanger:n.isDanger,confirmText:n.confirmText})]})},ux=()=>{const[t,r]=l.useState("https://livethreatmap.radware.com"),[a,n]=l.useState(!0),s=[{name:"Radware",url:"https://livethreatmap.radware.com"},{name:"SonicWall",url:"https://attackmap.sonicwall.com/live-attack-map/"},{name:"Check Point",url:"https://threatmap.checkpoint.com/"},{name:"Fortinet",url:"https://threatmap.fortiguard.com/"},{name:"Bitdefender",url:"https://threatmap.bitdefender.com/"},{name:"Threatbutt",url:"https://threatbutt.com/map/"}];return l.useEffect(()=>{(async()=>{try{const o=await fetch(`${Y}/api/settings/public`);if(o.ok){const c=await o.json();c.default_threat_map&&r(c.default_threat_map)}}catch(o){console.error("Error fetching default threat map:",o)}finally{n(!1)}})()},[]),e.jsx("div",{className:"w-full h-full flex flex-col relative animate-fadeIn",children:e.jsxs("div",{className:`flex-grow w-full h-full bg-[#121212] rounded-lg shadow-2xl overflow-hidden relative ${a?"animate-pulse":""}`,children:[e.jsx("iframe",{src:t,title:"Live Attack Map",className:"w-full h-full border-none",allowFullScreen:!0}),e.jsx("div",{className:"absolute bottom-6 left-6 z-10",children:e.jsxs("div",{className:"bg-[#1f1f1f]/90 backdrop-blur-sm p-2 rounded-lg border border-gray-700 shadow-lg",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-400 mb-1 ml-1 uppercase tracking-wider",children:"Select Provider"}),e.jsx("select",{value:t,onChange:i=>r(i.target.value),className:"bg-[#2C2D31] text-white text-sm font-medium py-2 px-4 pr-8 rounded-md border border-gray-600 focus:outline-none focus:ring-2 focus:ring-infosec-accent cursor-pointer appearance-none hover:bg-[#3A3B3F] transition-colors min-w-[200px]",style:{backgroundImage:`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,backgroundPosition:"right 0.5rem center",backgroundRepeat:"no-repeat",backgroundSize:"1.5em 1.5em"},children:s.map(i=>e.jsx("option",{value:i.url,children:i.name},i.name))})]})})]})})},IC="0.2.0",TC={version:IC},MC=({currentView:t,setView:r,user:a,logout:n,isOpen:s,setIsOpen:i})=>{var c;l.useEffect(()=>{i&&i(!1)},[t,i]);const o=[{title:"Overview",items:[{id:"overview",label:"Dashboard",icon:yu},{id:"users",label:"User Management",icon:At},{id:"organizations",label:"Organizations (B2B)",icon:Uv},{id:"payments",label:"Payments",icon:jo}]},{title:"Operations Center",items:[{id:"create_alert",label:"Create Alert/Mission",icon:r1},{id:"content_tagging",label:"Content Tagging",icon:Ff},{id:"admin_missions",label:"Missions",icon:Ac},{id:"alerts_page",label:"Active Alerts",icon:Pn},{id:"admin-review",label:"Review Queue",icon:dr},{id:"mentor_feedbacks",label:"Task Feedback",icon:Mj}]},{title:"Records",items:[{id:"case_history",label:"Case History",icon:Kj},{id:"reported",label:"Reports & Appeals",icon:Rj}]},{title:"Growth",items:[{id:"blog",label:"Blog / Content",icon:dr},{id:"marketing",label:"Marketing",icon:Mt},{id:"newsletter",label:"Newsletter",icon:Qr},{id:"admin_notifications",label:"Push Notifications",icon:Jj},{id:"leaderboard",label:"Global Leaderboard",icon:vu}]},{title:"System",items:[{id:"settings",label:"System Properties",icon:ki},{id:"emails",label:"Email Management",icon:Qr},{id:"feedbacks",label:"App Feedback",icon:si}]}];return e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40 lg:hidden",onClick:()=>i(!1)}),e.jsxs("aside",{className:`
                fixed inset-y-0 left-0 z-50 w-72 bg-[#111215] border-r border-[#1a1b1e] flex flex-col transition-transform duration-300 ease-in-out lg:translate-x-0
                ${s?"translate-x-0":"-translate-x-full"}
            `,children:[e.jsxs("div",{className:"h-16 flex items-center justify-between px-6 border-b border-[#1a1b1e]",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(Sc,{to:"/",className:"flex items-center gap-3 hover:opacity-80 transition-opacity",children:[e.jsx("img",{src:"/favicon.png",alt:"Logo",className:"h-8 w-auto"}),e.jsxs("span",{className:"font-bold text-lg text-white tracking-tight",children:["Admin",e.jsx("span",{className:"text-infosec-accent",children:"Console"})]})]})}),e.jsx("button",{onClick:()=>i(!1),className:"lg:hidden text-gray-400 hover:text-white",children:e.jsx(oa,{size:24})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-6 px-4 space-y-8 custom-scrollbar",children:o.map((d,m)=>e.jsxs("div",{children:[e.jsx("h3",{className:"px-3 text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3",children:d.title}),e.jsx("div",{className:"space-y-1",children:d.items.map(u=>{const x=u.icon,h=t===u.id;return e.jsxs("button",{onClick:()=>r(u.id),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200 group ${h?"bg-infosec-accent/10 text-infosec-accent border-l-2 border-infosec-accent":"text-gray-400 hover:bg-[#1a1b1e] hover:text-white"}`,children:[e.jsx(x,{size:18,className:`transition-colors ${h?"text-infosec-accent":"text-gray-500 group-hover:text-white"}`}),u.label]},u.id)})})]},m))}),e.jsxs("div",{className:"p-4 border-t border-[#1a1b1e] bg-[#0e0f11]",children:[e.jsxs("div",{onClick:()=>r("profile"),className:"flex items-center gap-3 mb-4 px-2 cursor-pointer hover:bg-white/5 rounded-lg transition-colors py-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-tr from-infosec-accent to-purple-600 flex items-center justify-center text-white font-bold shadow-lg shadow-purple-900/20",children:((c=a==null?void 0:a.name)==null?void 0:c.charAt(0))||"A"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:a==null?void 0:a.name}),e.jsx("p",{className:"text-xs text-gray-500 truncate",children:"Administrator"})]})]}),e.jsx("a",{href:"/",className:"flex items-center justify-center w-full px-4 py-2 mb-2 text-sm font-medium text-gray-400 bg-[#1a1b1e] rounded-lg hover:bg-gray-800 hover:text-white transition-colors",children:"Return Home"}),e.jsxs("button",{onClick:n,className:"flex items-center justify-center w-full px-4 py-2 text-sm font-medium text-red-400 bg-red-500/5 rounded-lg hover:bg-red-500/10 transition-colors",children:[e.jsx(uf,{size:16,className:"mr-2"}),"Sign Out"]}),e.jsx("div",{className:"mt-4 text-center",children:e.jsxs("span",{className:"text-[10px] text-gray-600 font-mono",children:["v",TC.version,e.jsxs("span",{className:"text-gray-700 ml-1",children:["(","2026-04-09",")"]})]})})]})]})]})},RC=({isOpen:t,onClose:r,setView:a})=>{const[n,s]=l.useState(""),[i,o]=l.useState(0),c=l.useRef(null),m=[{category:"Navigation",items:[{id:"dashboard",label:"Go to Dashboard",icon:yu,action:()=>a("dashboard")},{id:"users",label:"User Management",icon:At,action:()=>a("users")},{id:"missions",label:"Manage Missions",icon:dr,action:()=>a("admin_missions")},{id:"payments",label:"Payments & Plans",icon:jo,action:()=>a("payments")}]},{category:"Quick Actions",items:[{id:"create_alert",label:"Create New Alert",icon:Pn,action:()=>a("create")},{id:"review_queue",label:"Review Submissions",icon:kr,action:()=>a("admin-review")}]}].map(x=>({...x,items:x.items.filter(h=>h.label.toLowerCase().includes(n.toLowerCase()))})).filter(x=>x.items.length>0),u=m.flatMap(x=>x.items);return l.useEffect(()=>{t&&(setTimeout(()=>{var x;return(x=c.current)==null?void 0:x.focus()},50),s(""),o(0))},[t]),l.useEffect(()=>{const x=h=>{t&&(h.key==="ArrowDown"?(h.preventDefault(),o(f=>(f+1)%u.length)):h.key==="ArrowUp"?(h.preventDefault(),o(f=>(f-1+u.length)%u.length)):h.key==="Enter"?(h.preventDefault(),u[i]&&(u[i].action(),r())):h.key==="Escape"&&r())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,i,u,r]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh] px-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity",onClick:r}),e.jsxs("div",{className:"relative w-full max-w-lg bg-[#141517] border border-gray-800 rounded-xl shadow-2xl overflow-hidden animate-fadeIn",children:[e.jsxs("div",{className:"flex items-center px-4 py-3 border-b border-gray-800",children:[e.jsx(Jt,{className:"text-gray-500 w-5 h-5 mr-3"}),e.jsx("input",{ref:c,type:"text",className:"flex-1 bg-transparent border-none outline-none text-white placeholder-gray-500 text-lg",placeholder:"Type a command or search...",value:n,onChange:x=>{s(x.target.value),o(0)}}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("kbd",{className:"hidden sm:inline-block px-2 py-0.5 bg-gray-800 border border-gray-700 rounded text-xs text-gray-400 font-mono",children:"ESC"})})]}),e.jsx("div",{className:"max-h-[60vh] overflow-y-auto py-2 custom-scrollbar",children:m.length>0?m.map((x,h)=>e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"px-4 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wider sticky top-0 bg-[#141517]/95",children:x.category}),x.items.map((f,g)=>{const b=u.indexOf(f),p=b===i;return e.jsxs("button",{onClick:()=>{f.action(),r()},onMouseEnter:()=>o(b),className:`w-full flex items-center px-4 py-3 text-left transition-colors ${p?"bg-infosec-accent/10 border-l-2 border-infosec-accent":"border-l-2 border-transparent hover:bg-white/5"}`,children:[e.jsx(f.icon,{className:`w-5 h-5 mr-3 ${p?"text-infosec-accent":"text-gray-400"}`}),e.jsx("span",{className:`text-sm ${p?"text-white font-medium":"text-gray-300"}`,children:f.label}),p&&e.jsx("span",{className:"ml-auto text-xs text-gray-500 font-mono",children:"↵ Enter"})]},f.id)})]},x.category)):e.jsx("div",{className:"px-4 py-8 text-center text-gray-500",children:"No results found."})}),e.jsxs("div",{className:"px-4 py-2 bg-gray-900/50 border-t border-gray-800 flex items-center justify-between text-[10px] text-gray-500",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:"↑↓ to navigate"}),e.jsx("span",{children:"↵ to select"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(n1,{size:10}),e.jsx("span",{children:"+ K to open"})]})]})]})]}):null},LC=[{key:"today",label:"Today"},{key:"7d",label:"7 Days"},{key:"30d",label:"30 Days"}],Yl=(t,r)=>{if(r===0&&t===0)return null;if(r===0&&t>0)return{icon:ba,color:"text-emerald-400",label:`+${t}`};const a=((t-r)/r*100).toFixed(0);return t>r?{icon:ba,color:"text-emerald-400",label:`+${a}%`}:t<r?{icon:D1,color:"text-red-400",label:`${a}%`}:{icon:Zv,color:"text-gray-500",label:"0%"}},qi=me.memo(({icon:t,label:r,value:a,color:n="text-white",trend:s,glow:i=!1})=>e.jsxs("div",{className:`bg-[#1a1b1e] rounded-xl p-4 border relative overflow-hidden group transition-all 
        ${i?"border-emerald-500/30 hover:border-emerald-400/60 shadow-[0_0_15px_rgba(16,185,129,0.1)] hover:shadow-[0_0_20px_rgba(16,185,129,0.2)]":"border-white/5 hover:border-white/10 hover:bg-white/[0.02]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold leading-tight flex-1 break-words",children:r}),e.jsx("div",{className:`p-2 rounded-lg ${n.replace("text-","bg-")}/20 border ${i?"border-emerald-500/20":"border-white/5"} shrink-0`,children:e.jsx(t,{size:20,className:n})})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("p",{className:"text-2xl font-bold text-white leading-none",children:a??0}),s&&e.jsxs("div",{className:`text-[10px] font-semibold ${s.color} flex items-center gap-1 bg-white/5 px-1.5 py-0.5 rounded-md`,children:[e.jsx(s.icon,{size:10}),s.label]})]})]})),DC=({isOpen:t,onClose:r,token:a})=>{const[n,s]=l.useState({users:[],periodStats:null}),[i,o]=l.useState(!0),[c,d]=l.useState("today"),m=l.useCallback(async S=>{try{const N=await fetch(`${Y}/api/admin/active-users?range=${S}`,{headers:{Authorization:`Bearer ${a}`}});if(N.ok){const w=await N.json();Array.isArray(w)?s({users:w,periodStats:null}):s(w)}}catch(N){console.error("Failed to fetch active users",N)}finally{o(!1)}},[a]);l.useEffect(()=>{if(t){o(!0),m(c);const S=setInterval(()=>m(c),1e4);return()=>clearInterval(S)}},[t,c,m]);const u=S=>{d(S),o(!0)},{users:x,periodStats:h}=n,f=l.useMemo(()=>x.filter(S=>S.type==="registered"),[x]),g=l.useMemo(()=>x.filter(S=>S.type==="guest"),[x]);if(!t)return null;const b=(S,N,w)=>{const _=N>0?S/N*100:0;return e.jsx("div",{className:"w-full bg-white/5 rounded-full h-1 mt-2 overflow-hidden",children:e.jsx("div",{className:`h-full ${w} rounded-full`,style:{width:`${_}%`}})})},p=(S,N)=>S>24?`${Math.floor(S/24)}d ${S%24}h`:S>0?`${S}h ${N}m`:`${N}m`,v=()=>c==="7d"?"Last 7 Days":c==="30d"?"Last 30 Days":"Today's",y=(S,N)=>S==="admin"?{bg:"bg-purple-500/15",text:"text-purple-400",label:"ADMIN"}:S==="alert-admin"?{bg:"bg-amber-500/15",text:"text-amber-400",label:"MOD"}:N==="monthly"||N==="yearly"||N==="pro"?{bg:"bg-emerald-500/15",text:"text-emerald-400",label:"PRO"}:{bg:"bg-blue-500/15",text:"text-blue-400",label:"FREE"},j=S=>S==="android"?{icon:Jn,color:"text-green-400",label:"Android"}:S==="ios"?{icon:Jn,color:"text-blue-400",label:"iOS"}:{icon:ii,color:"text-gray-400",label:"Web"};return An.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 w-screen h-screen",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:"relative w-full max-w-lg bg-[#141517] border border-gray-800 rounded-2xl shadow-2xl overflow-hidden animate-fadeIn mb-[5vh]",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-32 bg-emerald-500/10 blur-3xl -z-10 pointer-events-none"}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-800 bg-[#1a1b1e]/80 backdrop-blur-md",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center shadow-[0_0_10px_rgba(16,185,129,0.2)]",children:e.jsx(Er,{size:18,className:"text-emerald-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-white text-sm",children:"Command Center"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-[pulse_2s_cubic-bezier(0.4,0,0.6,1)_infinite]"}),e.jsx("p",{className:"text-[11px] text-emerald-400 font-mono tracking-wide",children:"Live Feed · Auto-refresh 10s"})]})]})]}),e.jsx("button",{onClick:r,className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors group",children:e.jsx(oa,{size:18,className:"text-gray-400 group-hover:text-white transition-colors"})})]}),e.jsx("div",{className:"px-5 pt-3 pb-0 bg-[#141517]",children:e.jsx("div",{className:"flex gap-1 bg-white/[0.03] p-1 rounded-lg border border-white/5",children:LC.map(S=>e.jsx("button",{onClick:()=>u(S.key),className:`flex-1 text-[11px] font-semibold py-1.5 rounded-md transition-all ${c===S.key?"bg-emerald-500/15 text-emerald-400 shadow-sm":"text-gray-500 hover:text-gray-300 hover:bg-white/5"}`,children:S.label},S.key))})}),e.jsxs("div",{className:"max-h-[60vh] overflow-y-auto custom-scrollbar relative min-h-[200px]",children:[i&&e.jsxs("div",{className:"absolute inset-0 z-10 bg-[#141517]/80 backdrop-blur-sm flex flex-col items-center justify-center text-gray-500 gap-2 min-h-[200px]",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-emerald-500/30 border-t-emerald-500 rounded-full animate-spin"}),e.jsx("span",{className:"text-xs mt-1",children:"Loading dashboard..."})]}),e.jsxs("div",{className:i&&!h?"opacity-0":"opacity-100 transition-opacity duration-300",children:[h?e.jsxs("div",{className:"p-5 border-b border-gray-800/50 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest font-bold mb-3 flex items-center gap-1.5 opacity-80",children:[e.jsx(va,{size:10})," ",v()," Activity"]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(qi,{icon:cs,label:"Online Now",value:h.currentOnline,color:"text-emerald-400",glow:!0}),e.jsx(qi,{icon:Pc,label:"New Signups",value:h.newSignups,color:"text-blue-400",trend:Yl(h.newSignups,h.prevSignups)}),e.jsx(qi,{icon:d1,label:"Investigations",value:h.investigations,color:"text-amber-400",trend:Yl(h.investigations,h.prevInvestigations)}),e.jsx(qi,{icon:xr,label:"Alerts",value:h.alertsCreated,color:"text-red-400",trend:Yl(h.alertsCreated,h.prevAlerts)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-white/[0.02] rounded-xl p-3 border border-white/5 flex flex-col justify-center",children:[e.jsx("p",{className:"text-[10px] text-gray-500 uppercase font-semibold mb-2",children:"User Types"}),e.jsxs("div",{className:"flex items-center justify-between px-2",children:[e.jsxs("div",{className:"text-center w-full",children:[e.jsx("p",{className:"text-lg font-bold text-white",children:h.totalRegisteredUsers}),e.jsx("p",{className:"text-[9px] text-gray-500 uppercase",children:"Total"})]}),e.jsx("div",{className:"w-px h-8 bg-white/10 mx-2"}),e.jsxs("div",{className:"text-center w-full",children:[e.jsx("p",{className:"text-lg font-bold text-emerald-400",children:h.registeredOnline}),e.jsx("p",{className:"text-[9px] text-gray-500 uppercase",children:"Registered"}),b(h.registeredOnline,h.currentOnline,"bg-emerald-500")]}),e.jsx("div",{className:"w-px h-8 bg-white/10 mx-2"}),e.jsxs("div",{className:"text-center w-full",children:[e.jsx("p",{className:"text-lg font-bold text-gray-400",children:h.guestsOnline}),e.jsx("p",{className:"text-[9px] text-gray-500 uppercase",children:"Guests"}),b(h.guestsOnline,h.currentOnline,"bg-gray-500")]})]})]}),e.jsxs("div",{className:"bg-white/[0.02] rounded-xl p-3 border border-white/5 flex flex-col justify-center",children:[e.jsx("p",{className:"text-[10px] text-gray-500 uppercase font-semibold mb-2",children:"Active Devices"}),e.jsxs("div",{className:"flex items-center justify-between px-2",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1 w-full",children:[e.jsx(ii,{size:14,className:"text-gray-400 mb-0.5"}),e.jsx("p",{className:"text-sm font-bold text-white leading-none",children:h.webOnline??0}),e.jsx("p",{className:"text-[9px] text-gray-500 uppercase",children:"Web"}),b(h.webOnline,h.currentOnline,"bg-gray-400")]}),e.jsx("div",{className:"w-px h-6 bg-white/10 mt-1 mx-2"}),e.jsxs("div",{className:"flex flex-col items-center gap-1 w-full",children:[e.jsx(Jn,{size:14,className:"text-green-400 mb-0.5"}),e.jsx("p",{className:"text-sm font-bold text-green-400 leading-none",children:h.androidOnline??0}),e.jsx("p",{className:"text-[9px] text-gray-500 uppercase",children:"Android"}),b(h.androidOnline,h.currentOnline,"bg-green-500")]}),e.jsx("div",{className:"w-px h-6 bg-white/10 mt-1 mx-2"}),e.jsxs("div",{className:"flex flex-col items-center gap-1 w-full",children:[e.jsx(Jn,{size:14,className:"text-blue-400 mb-0.5"}),e.jsx("p",{className:"text-sm font-bold text-blue-400 leading-none",children:h.iosOnline??0}),e.jsx("p",{className:"text-[9px] text-gray-500 uppercase",children:"iOS"}),b(h.iosOnline,h.currentOnline,"bg-blue-500")]})]})]})]})]}):null,e.jsxs("div",{className:"p-4",children:[f.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest font-bold mb-2 flex items-center gap-1.5",children:[e.jsx(At,{size:10})," Authenticated Users (",f.length,")"]}),e.jsx("div",{className:"space-y-1",children:f.map(S=>{var _,P;const N=y(S.role,S.subscription_plan),w=j(S.platform);return e.jsxs("div",{className:"flex items-center gap-3 p-2.5 hover:bg-white/[0.04] rounded-xl border border-transparent hover:border-emerald-500/20 transition-all duration-300 group cursor-default hover:scale-[1.01]",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-gray-700 to-gray-800 flex items-center justify-center font-bold text-sm text-gray-300 border border-gray-600 group-hover:border-emerald-500/50 transition-colors",children:((P=(_=S.name)==null?void 0:_.charAt(0))==null?void 0:P.toUpperCase())||"?"}),e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 bg-emerald-500 rounded-full border-2 border-[#141517] shadow-[0_0_5px_rgba(16,185,129,0.5)]"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-white truncate",children:S.name}),e.jsx("p",{className:"text-[11px] text-gray-500 truncate group-hover:text-gray-400 transition-colors",children:S.email})]}),e.jsxs("div",{className:"flex items-center gap-1.5 opacity-80 group-hover:opacity-100 transition-opacity",children:[e.jsx(w.icon,{size:12,className:w.color,title:w.label}),e.jsx("span",{className:`text-[9px] uppercase font-bold px-2 py-1 rounded-md ${N.bg} ${N.text}`,children:N.label})]})]},S.id)})})]}),g.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] text-gray-500 uppercase tracking-widest font-bold mb-2 flex items-center gap-1.5",children:[e.jsx(ms,{size:10})," Guest Sessions (",g.length,")"]}),e.jsx("div",{className:"space-y-1",children:g.map(S=>{var w;const N=j(S.platform);return e.jsxs("div",{className:"flex items-center gap-3 p-2.5 hover:bg-white/5 rounded-xl transition-colors",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-gray-800/50 flex items-center justify-center text-gray-500 border border-gray-700/50",children:e.jsx(ms,{size:14})}),e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 bg-gray-500 rounded-full border-2 border-[#141517]"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Anonymous Visitor"}),e.jsxs("p",{className:"text-[11px] text-gray-600",children:["Session ",(w=S.id)==null?void 0:w.replace("guest-","#")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(N.icon,{size:12,className:N.color,title:N.label}),e.jsx("span",{className:"text-[9px] uppercase font-bold px-2 py-1 rounded-md bg-gray-800 text-gray-500",children:"GUEST"})]})]},S.id)})})]}),x.length===0&&!i&&e.jsxs("div",{className:"p-6 text-center text-gray-500",children:[e.jsx(At,{size:24,className:"mx-auto mb-2 opacity-30"}),e.jsx("p",{className:"text-sm",children:"No active sessions"})]})]})]})]}),h&&e.jsxs("div",{className:"px-5 py-2.5 bg-[#1a1b1e] border-t border-gray-800 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(el,{size:10,className:"text-gray-600"}),e.jsxs("p",{className:"text-[10px] text-gray-600",children:["Uptime: ",p(h.serverUptimeHours,h.serverUptimeMinutes)]})]}),e.jsx("p",{className:"text-[10px] text-gray-600",children:new Date().toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})})]})]})]}),document.body)},zC=({setView:t})=>e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[e.jsxs("button",{onClick:()=>t("create"),className:"flex flex-col md:flex-row items-center gap-3 p-4 bg-gradient-to-br from-[#1a1b1e] to-[#25262b] rounded-xl border border-gray-800 hover:border-emerald-500/50 hover:bg-emerald-500/5 transition-all duration-300 group shadow-lg",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-emerald-500/10 flex items-center justify-center group-hover:bg-emerald-500/20 group-hover:scale-110 transition-all",children:e.jsx(oi,{size:20,className:"text-emerald-400"})}),e.jsxs("div",{className:"text-center md:text-left",children:[e.jsx("p",{className:"font-bold text-white text-sm",children:"Create Alert"}),e.jsx("p",{className:"hidden md:block text-[10px] text-gray-500 uppercase tracking-wider",children:"New Scenario"})]})]}),e.jsxs("button",{onClick:()=>t("admin_missions"),className:"flex flex-col md:flex-row items-center gap-3 p-4 bg-gradient-to-br from-[#1a1b1e] to-[#25262b] rounded-xl border border-gray-800 hover:border-purple-500/50 hover:bg-purple-500/5 transition-all duration-300 group shadow-lg",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center group-hover:bg-purple-500/20 group-hover:scale-110 transition-all",children:e.jsx(dr,{size:20,className:"text-purple-400"})}),e.jsxs("div",{className:"text-center md:text-left",children:[e.jsx("p",{className:"font-bold text-white text-sm",children:"Manage Missions"}),e.jsx("p",{className:"hidden md:block text-[10px] text-gray-500 uppercase tracking-wider",children:"Campaigns"})]})]}),e.jsxs("button",{onClick:()=>t("admin-review"),className:"flex flex-col md:flex-row items-center gap-3 p-4 bg-gradient-to-br from-[#1a1b1e] to-[#25262b] rounded-xl border border-gray-800 hover:border-blue-500/50 hover:bg-blue-500/5 transition-all duration-300 group shadow-lg",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-500/10 flex items-center justify-center group-hover:bg-blue-500/20 group-hover:scale-110 transition-all",children:e.jsx(Jt,{size:20,className:"text-blue-400"})}),e.jsxs("div",{className:"text-center md:text-left",children:[e.jsx("p",{className:"font-bold text-white text-sm",children:"Review Queue"}),e.jsx("p",{className:"hidden md:block text-[10px] text-gray-500 uppercase tracking-wider",children:"Pending Tasks"})]})]}),e.jsxs("button",{onClick:()=>t("users"),className:"flex flex-col md:flex-row items-center gap-3 p-4 bg-gradient-to-br from-[#1a1b1e] to-[#25262b] rounded-xl border border-gray-800 hover:border-amber-500/50 hover:bg-amber-500/5 transition-all duration-300 group shadow-lg",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-500/10 flex items-center justify-center group-hover:bg-amber-500/20 group-hover:scale-110 transition-all",children:e.jsx(At,{size:20,className:"text-amber-400"})}),e.jsxs("div",{className:"text-center md:text-left",children:[e.jsx("p",{className:"font-bold text-white text-sm",children:"Users"}),e.jsx("p",{className:"hidden md:block text-[10px] text-gray-500 uppercase tracking-wider",children:"Directory"})]})]})]}),FC=({stats:t,calculateRevenue:r})=>{var a,n,s,i,o;return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md p-6 rounded-2xl border border-gray-800 relative overflow-hidden group hover:border-blue-500/50 transition-all",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity bg-blue-500 rounded-bl-2xl",children:e.jsx(At,{size:32,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-xs font-bold uppercase tracking-wider mb-1",children:"Total Users"}),e.jsx("h3",{className:"text-3xl font-bold text-white",children:(t==null?void 0:t.totalUsers)||0}),e.jsxs("div",{className:`flex items-center gap-1 mt-2 text-xs ${(t==null?void 0:t.userGrowthPercentage)>=0?"text-blue-400":"text-red-400"}`,children:[e.jsx(ba,{size:12,className:(t==null?void 0:t.userGrowthPercentage)<0?"rotate-180":""}),e.jsxs("span",{children:[(t==null?void 0:t.userGrowthPercentage)!==void 0?`${t.userGrowthPercentage>0?"+":""}${typeof t.userGrowthPercentage=="number"?t.userGrowthPercentage.toFixed(1):t.userGrowthPercentage}%`:"0%"," from last week"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md p-6 rounded-2xl border border-gray-800 relative overflow-hidden group hover:border-green-400/50 transition-all",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity bg-green-500 rounded-bl-2xl",children:e.jsx(i1,{size:32,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-xs font-bold uppercase tracking-wider mb-1",children:"Monthly Revenue"}),e.jsx("h3",{className:"text-3xl font-bold text-white",children:r()}),e.jsxs("div",{className:"flex items-center gap-1 mt-2 text-xs text-green-400",children:[e.jsx(ba,{size:12}),e.jsxs("span",{children:["Est. Active Subs: ",(((a=t==null?void 0:t.planCounts)==null?void 0:a.monthly)||0)+(((n=t==null?void 0:t.planCounts)==null?void 0:n.yearly)||0)]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md p-6 rounded-2xl border border-gray-800 relative overflow-hidden group hover:border-yellow-500/50 transition-all flex flex-col justify-center",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity bg-yellow-500 rounded-bl-2xl",children:e.jsx(Dj,{size:32,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-xs font-bold uppercase tracking-wider mb-3",children:"Subscriptions"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-gray-300",children:((s=t==null?void 0:t.planCounts)==null?void 0:s.free)||0}),e.jsx("div",{className:"text-[10px] text-gray-500 uppercase font-medium",children:"Free"})]}),e.jsx("div",{className:"w-px h-6 bg-gray-700"}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-purple-400",children:((i=t==null?void 0:t.planCounts)==null?void 0:i.monthly)||0}),e.jsx("div",{className:"text-[10px] text-purple-400 uppercase font-medium",children:"Monthly"})]}),e.jsx("div",{className:"w-px h-6 bg-gray-700"}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-yellow-400",children:((o=t==null?void 0:t.planCounts)==null?void 0:o.yearly)||0}),e.jsx("div",{className:"text-[10px] text-yellow-400 uppercase font-medium",children:"Yearly"})]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md p-6 rounded-2xl border border-gray-800 relative overflow-hidden group hover:border-purple-500/50 transition-all",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity bg-purple-500 rounded-bl-2xl",children:e.jsx(ya,{size:32,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-xs font-bold uppercase tracking-wider mb-1",children:"Total Investigations"}),e.jsx("h3",{className:"text-3xl font-bold text-white",children:(t==null?void 0:t.closedAlerts)||0}),e.jsxs("div",{className:"flex items-center gap-1 mt-2 text-xs text-purple-400",children:[e.jsx(Or,{size:12}),e.jsx("span",{children:"Resolved Incidents"})]})]})]})]})},BC=({stats:t})=>{const r=l.useMemo(()=>{const a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=[],s=new Date;for(let i=6;i>=0;i--){const o=new Date(s);o.setDate(s.getDate()-i);const c=a[o.getDay()];let d,m;i===0?(d=(t==null?void 0:t.totalUsers)||0,m=(t==null?void 0:t.totalAlerts)||0):(d=Math.max(Math.round(((t==null?void 0:t.totalUsers)||0)*(.8+.03*(6-i))),10),m=Math.max(Math.round(((t==null?void 0:t.totalAlerts)||0)*(.7+.04*(6-i))),5)),n.push({name:c,users:d,alerts:m})}return n},[t==null?void 0:t.totalUsers,t==null?void 0:t.totalAlerts]);return e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md rounded-2xl border border-gray-800 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Platform Growth"}),e.jsxs("select",{className:"bg-[#0e0f11] border border-gray-700 text-gray-300 text-xs rounded-lg px-2 py-1 outline-none focus:border-purple-500 transition-colors",children:[e.jsx("option",{children:"Last 7 Days"}),e.jsx("option",{children:"Last 30 Days"})]})]}),e.jsx("div",{className:"h-64 w-full",children:e.jsx(Ra,{width:"100%",height:"100%",children:e.jsxs(lp,{data:r,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"colorUsers",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#8b5cf6",stopOpacity:.4}),e.jsx("stop",{offset:"95%",stopColor:"#8b5cf6",stopOpacity:0})]})}),e.jsx(ps,{strokeDasharray:"3 3",stroke:"#374151",vertical:!1}),e.jsx(bs,{dataKey:"name",stroke:"#6b7280",fontSize:12,tickLine:!1,axisLine:!1}),e.jsx(vs,{stroke:"#6b7280",fontSize:12,tickLine:!1,axisLine:!1}),e.jsx(La,{contentStyle:{backgroundColor:"#0e0f11",border:"1px solid #1f2937",borderRadius:"8px"},itemStyle:{color:"#fff"}}),e.jsx(Fu,{type:"monotone",dataKey:"users",stroke:"#8b5cf6",strokeWidth:3,fillOpacity:1,fill:"url(#colorUsers)"})]})})})]})},HC=({stats:t,setView:r})=>{var a;return e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md rounded-2xl border border-gray-800 p-6 flex flex-col h-[400px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6 shrink-0",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Recent Registrations"}),e.jsx("button",{onClick:()=>r("users"),className:"text-xs text-infosec-accent hover:underline",children:"View All Users"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto pr-2 space-y-3 custom-scrollbar",children:[(a=t==null?void 0:t.recentUsers)==null?void 0:a.map((n,s)=>{var i;return e.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0e0f11] rounded-xl border border-gray-800/50 hover:border-gray-700 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-800 flex items-center justify-center text-gray-400 font-bold shrink-0",children:((i=n.name)==null?void 0:i.charAt(0))||"U"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-white truncate max-w-[120px] sm:max-w-[200px]",children:n.name}),e.jsx("p",{className:"text-xs text-gray-500",children:"Joined the platform"})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-500 block",children:new Date(n.created_at).toLocaleDateString()}),e.jsx("span",{className:`text-[10px] uppercase font-bold px-2 py-0.5 rounded ${n.subscription_plan==="pro"?"bg-purple-500/10 text-purple-400":"bg-gray-700 text-gray-400"}`,children:n.subscription_plan||"FREE"})]})]},n.id||s)}),(!(t!=null&&t.recentUsers)||t.recentUsers.length===0)&&e.jsx("div",{className:"h-full flex flex-col items-center justify-center text-gray-500",children:e.jsx("p",{className:"text-sm italic",children:"No recent activity."})})]})]})},WC=({stats:t,setView:r})=>{var a;return e.jsxs("div",{className:"bg-[#1a1b1e]/80 backdrop-blur-md rounded-2xl border border-gray-800 p-6 flex flex-col h-[400px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6 shrink-0",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[e.jsx(Pn,{size:18,className:"text-red-400"})," New Alerts"]}),e.jsx("button",{onClick:()=>r("alerts_page"),className:"text-xs text-blue-400 hover:underline",children:"View All"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto pr-2 space-y-3 custom-scrollbar",children:[(a=t==null?void 0:t.recentAlerts)==null?void 0:a.map(n=>e.jsxs("div",{onClick:()=>r("alerts_page"),className:"cursor-pointer p-3 bg-[#0e0f11] rounded-lg border border-gray-800 hover:border-gray-600 transition-all",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${n.severity==="Critical"?"bg-red-500/20 text-red-400":n.severity==="High"?"bg-orange-500/20 text-orange-400":"bg-blue-500/20 text-blue-400"}`,children:n.severity}),e.jsx("span",{className:"text-[10px] text-gray-500",children:new Date(n.created_at).toLocaleDateString()})]}),e.jsx("h4",{className:"text-sm font-medium text-white line-clamp-2",children:n.title})]},n.id)),(!(t!=null&&t.recentAlerts)||t.recentAlerts.length===0)&&e.jsx("div",{className:"h-full flex flex-col items-center justify-center text-gray-500",children:e.jsx("p",{className:"text-sm italic text-center mt-10",children:"No new alerts."})})]})]})},UC=({token:t,setView:r})=>{const[a,n]=l.useState(null),[s,i]=l.useState(null),[o,c]=l.useState(!0),[d,m]=l.useState(!1),[u,x]=l.useState(!1);l.useEffect(()=>{const b=p=>{(p.metaKey||p.ctrlKey)&&p.key==="k"&&(p.preventDefault(),m(v=>!v))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const[h,f]=l.useState(null);l.useEffect(()=>{const b=async()=>{try{const[y,j]=await Promise.all([fetch(`${Y}/api/admin/stats`,{headers:{Authorization:`Bearer ${t}`}}),fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${t}`}})]);if(y.ok){const S=await y.json();n(S)}if(j.ok){const S=await j.json();i(S)}}catch(y){console.error("Error fetching admin data:",y)}finally{c(!1)}},p=async()=>{try{const y=await fetch(`${Y}/api/admin/pulse`,{headers:{Authorization:`Bearer ${t}`}});if(y.ok){const j=await y.json();console.log("Pulse Data Received:",j),f(j)}else console.error("Pulse Request Failed",y.status)}catch(y){console.error("Pulse Fetch Error:",y)}};b(),p();const v=setInterval(p,3e4);return()=>clearInterval(v)},[t]);const g=me.useCallback(()=>{var S,N;if(!(a!=null&&a.planCounts)||!(s!=null&&s.payment))return"$0.00";const b=a.planCounts.monthly||0,p=a.planCounts.yearly||0,v=parseFloat(((S=s.payment.stripe_price_display_monthly)==null?void 0:S.replace("$",""))||s.payment.price_monthly||0),y=parseFloat(((N=s.payment.stripe_price_display_yearly)==null?void 0:N.replace("$",""))||s.payment.price_yearly||0);return(b*v+p*y/12).toLocaleString("en-US",{style:"currency",currency:"USD"})},[a==null?void 0:a.planCounts,s==null?void 0:s.payment]);return o?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-infosec-accent"})}):e.jsxs("div",{className:"space-y-8 animate-fadeIn relative",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-96 bg-infosec-accent/5 rounded-full blur-3xl -z-10 pointer-events-none"}),e.jsx(RC,{isOpen:d,onClose:()=>m(!1),setView:r}),e.jsx(DC,{isOpen:u,onClose:()=>x(!1),token:t}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white tracking-tight",children:"Command Center"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"Platform overview and system status."})]}),e.jsxs("div",{className:"flex items-center gap-4 bg-[#0e0f11] px-4 py-2 rounded-xl border border-gray-800 shadow-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>x(!0),title:"Click to view online users",children:[e.jsx("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-emerald-500/10 group-hover:bg-emerald-500/20 transition-colors",children:e.jsx(Er,{size:16,className:"text-emerald-500 animate-pulse"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-wider group-hover:text-gray-300 transition-colors",children:"Live Users"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl font-bold text-white",children:(h==null?void 0:h.activeUsers)??"--"}),e.jsx("span",{className:"w-2 h-2 bg-emerald-500 rounded-full animate-ping"})]}),h&&e.jsxs("p",{className:"text-[9px] text-gray-500 mt-0.5",children:[h.registeredUsers??0," users · ",h.guestUsers??0," guests"]})]})]}),e.jsx("div",{className:"w-px h-8 bg-gray-800"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`relative flex items-center justify-center w-8 h-8 rounded-lg ${(h==null?void 0:h.status)==="healthy"?"bg-green-500/10":"bg-red-500/10"}`,children:e.jsx(kr,{size:16,className:(h==null?void 0:h.status)==="healthy"?"text-green-500":"text-red-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-wider",children:"System"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-medium ${(h==null?void 0:h.status)==="healthy"?"text-green-400":(h==null?void 0:h.status)==="degraded"?"text-yellow-400":"text-red-400"}`,children:(h==null?void 0:h.latency)!==void 0&&h.latency>=0?`${h.latency}ms`:"--"}),e.jsx("div",{className:`w-2 h-2 rounded-full ${(h==null?void 0:h.status)==="healthy"?"bg-green-500":(h==null?void 0:h.status)==="degraded"?"bg-yellow-500":"bg-red-500"}`})]})]})]})]})]}),e.jsx(zC,{setView:r}),e.jsx(FC,{stats:a,calculateRevenue:g}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[e.jsx(BC,{stats:a}),e.jsx(HC,{stats:a,setView:r})]}),e.jsx("div",{className:"flex flex-col gap-8 h-full",children:e.jsx(WC,{stats:a,setView:r})})]})]})},VC=({token:t})=>{const[r,a]=l.useState("logs"),[n,s]=l.useState(!0),[i,o]=l.useState([]),[c,d]=l.useState({page:1,total:0,pages:1}),[m,u]=l.useState(null),[x,h]=l.useState([]),[f,g]=l.useState(""),[b,p]=l.useState(""),[v,y]=l.useState("");l.useEffect(()=>{r==="logs"&&j(1),r==="templates"&&S()},[r]);const j=async _=>{s(!0);try{const P=await fetch(`${Y}/api/admin/emails/logs?page=${_}&limit=20`,{headers:{Authorization:`Bearer ${t}`}});if(P.ok){const O=await P.json();o(O.logs),d({page:O.page,total:O.total,pages:O.pages})}}catch(P){console.error(P),z.error("Failed to load email logs")}s(!1)},S=async()=>{s(!0);try{const _=await fetch(`${Y}/api/admin/emails/templates`,{headers:{Authorization:`Bearer ${t}`}});if(_.ok){const P=await _.json();h(P.templates)}}catch(_){console.error(_),z.error("Failed to load templates")}s(!1)},N=async()=>{if(f)try{const _={key:f,value:b};(await fetch(`${Y}/api/admin/emails/templates`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(_)})).ok?(z.success("Template updated successfully"),S()):z.error("Failed to update template")}catch{z.error("Error saving template")}},w=async()=>{if(!v||!f){z.warn("Provide an email and select a template first");return}try{const _=await fetch(`${Y}/api/admin/emails/test`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({email:v,template_key:f,mock_data:{name:"Test User",title:"Test Alert",grade:100,verdict:"True Positive",feedback:"Great job!"}})});if(_.ok)z.success("Test email dispatched");else{const P=await _.json();z.error(P.message||"Dispatch failed")}}catch{z.error("Error testing template")}};return e.jsxs("div",{className:"bg-[#111215] min-h-full rounded-2xl border border-gray-800",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center bg-[#1a1b1e]/50 rounded-t-2xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 flex items-center justify-center border border-blue-500/20",children:e.jsx(Qr,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Email Management"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Track delivery logs and edit system templates"})]})]})}),e.jsxs("div",{className:"flex border-b border-gray-800 px-4",children:[e.jsx("button",{onClick:()=>a("logs"),className:`px-6 py-4 text-sm font-medium transition-colors ${r==="logs"?"text-blue-400 border-b-2 border-blue-400":"text-gray-400 hover:text-white"}`,children:"Activity Logs"}),e.jsx("button",{onClick:()=>a("templates"),className:`px-6 py-4 text-sm font-medium transition-colors ${r==="templates"?"text-blue-400 border-b-2 border-blue-400":"text-gray-400 hover:text-white"}`,children:"Template Editor"})]}),e.jsxs("div",{className:"p-6",children:[r==="logs"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center bg-[#1a1b1e] p-4 rounded-xl border border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-400",children:[e.jsx(Jt,{className:"w-4 h-4"}),e.jsxs("span",{className:"text-sm",children:["Showing recent ",i.length," emails"]})]}),e.jsx("button",{onClick:()=>j(c.page),className:"text-xs bg-gray-800 hover:bg-gray-700 text-white px-3 py-1.5 rounded-lg transition-colors",children:"Refresh"})]}),n?e.jsx("div",{className:"text-center py-10 text-gray-500",children:"Loading logs..."}):e.jsx("div",{className:"border border-gray-800 rounded-xl overflow-hidden",children:e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#1a1b1e] text-xs uppercase text-gray-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 font-medium",children:"Status"}),e.jsx("th",{className:"px-6 py-4 font-medium",children:"Recipient"}),e.jsx("th",{className:"px-6 py-4 font-medium",children:"Subject"}),e.jsx("th",{className:"px-6 py-4 font-medium",children:"Date"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-800/50 bg-[#0e0f11]",children:[i.map(_=>e.jsxs("tr",{className:"hover:bg-white/[0.02] transition-colors cursor-pointer",onClick:()=>u(_),children:[e.jsx("td",{className:"px-6 py-4",children:_.status==="sent"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-green-400 bg-green-400/10 px-2.5 py-1 rounded-full text-xs font-medium",children:[e.jsx(Or,{className:"w-3 h-3"})," Sent"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-red-400 bg-red-400/10 px-2.5 py-1 rounded-full text-xs font-medium",title:_.error_message,children:[e.jsx(Sa,{className:"w-3 h-3"})," Failed"]})}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("div",{className:"font-medium text-white",children:_.recipient_email}),_.user_name&&e.jsx("div",{className:"text-xs text-gray-500",children:_.user_name})]}),e.jsx("td",{className:"px-6 py-4 text-gray-300",children:_.subject}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-500",children:new Date(_.sent_at).toLocaleString()})]},_.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:"4",className:"px-6 py-10 text-center text-gray-500",children:"No email logs found."})})]})]})}),c.pages>1&&e.jsxs("div",{className:"flex justify-center gap-2 mt-4",children:[e.jsx("button",{disabled:c.page<=1,onClick:()=>j(c.page-1),className:"px-4 py-2 bg-[#1a1b1e] disabled:opacity-50 text-white text-sm rounded-lg",children:"Previous"}),e.jsx("button",{disabled:c.page>=c.pages,onClick:()=>j(c.page+1),className:"px-4 py-2 bg-[#1a1b1e] disabled:opacity-50 text-white text-sm rounded-lg",children:"Next"})]})]}),r==="templates"&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 border border-gray-800 rounded-xl overflow-hidden bg-[#0e0f11]",children:[e.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#1a1b1e]",children:e.jsx("h3",{className:"text-sm font-bold text-white",children:"System Templates"})}),e.jsxs("div",{className:"max-h-[600px] overflow-y-auto",children:[x.map(_=>e.jsxs("button",{onClick:()=>{g(_.key),p(typeof _.value=="string"&&_.value.startsWith('"')?JSON.parse(_.value):_.value)},className:`w-full text-left px-4 py-3 text-sm transition-colors border-b border-gray-800/10 ${f===_.key?"bg-blue-500/10 text-blue-400 border-l-4 border-l-blue-500":"text-gray-400 hover:bg-white/[0.02] hover:text-white"}`,children:[e.jsx("div",{className:"font-medium truncate",children:_.key.replace(/_/g," ")}),e.jsx("div",{className:"text-[10px] opacity-50 uppercase tracking-tighter mt-0.5",children:_.category||"email"})]},_.key)),x.length===0&&!n&&e.jsx("div",{className:"p-8 text-center text-gray-600 text-xs italic",children:"No templates found."})]})]}),e.jsx("div",{className:"lg:col-span-3 space-y-4",children:f?e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 flex flex-col min-h-[600px]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-800 flex justify-between items-center bg-[#0e0f11] rounded-t-xl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ju,{className:"w-4 h-4 text-blue-400"}),e.jsx("span",{className:"text-sm font-bold text-white uppercase",children:f.replace(/_/g," ")})]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("button",{onClick:N,className:"bg-blue-600 hover:bg-blue-500 text-white px-4 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 shadow-lg shadow-blue-500/20",children:[e.jsx(Or,{className:"w-3.5 h-3.5"})," Save Changes"]})})]}),e.jsx("div",{className:"flex-1 p-4 bg-[#050505]",children:e.jsx("textarea",{value:b,onChange:_=>p(_.target.value),className:"w-full h-full min-h-[500px] bg-transparent text-gray-300 font-mono text-sm border-none focus:ring-0 resize-none",placeholder:"<!-- HTML Email Code Goes Here -->",spellCheck:!1})}),e.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#0e0f11] rounded-b-xl flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx("input",{type:"email",placeholder:"Enter test email address...",value:v,onChange:_=>y(_.target.value),className:"w-full bg-[#1a1b1e] border border-gray-800 rounded-lg px-4 py-2 text-sm text-white focus:border-blue-500 outline-none pr-10"}),e.jsx(ei,{className:"w-4 h-4 text-gray-500 absolute right-3 top-2.5"})]}),e.jsx("button",{onClick:w,className:"bg-gray-800 hover:bg-gray-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors border border-gray-700",children:"Send Test Email"})]}),e.jsxs("p",{className:"text-[10px] text-gray-500 italic",children:["Supports variables like ","{{name}}",", ","{{link}}",", etc."]})]})]}):e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 h-full flex flex-col items-center justify-center text-gray-500 p-20 text-center min-h-[600px]",children:[e.jsx(cs,{className:"w-16 h-16 mb-4 opacity-10"}),e.jsx("h4",{className:"text-xl font-bold text-gray-400 mb-2",children:"Select a Template"}),e.jsx("p",{className:"max-w-xs text-sm",children:"Choose a system email template from the left to start editing its HTML structure and content."})]})})]})]}),m&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-[#1a1b1e] w-full max-w-4xl max-h-[90vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in duration-200",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center bg-[#0e0f11]",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:m.subject}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Sent to: ",e.jsx("span",{className:"text-gray-300",children:m.recipient_email})," • ",new Date(m.sent_at).toLocaleString()]})]}),e.jsx("button",{onClick:()=>u(null),className:"w-10 h-10 rounded-full bg-gray-800 hover:bg-gray-700 flex items-center justify-center text-gray-400 hover:text-white transition-all",children:"✕"})]}),e.jsx("div",{className:"flex-1 overflow-auto bg-white p-8",children:m.body?e.jsx("div",{dangerouslySetInnerHTML:{__html:m.body}}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400 bg-[#0e0f11]",children:[e.jsx(Qr,{className:"w-12 h-12 mb-4 opacity-20"}),e.jsx("p",{children:"No content preview available for this log entry."}),e.jsx("p",{className:"text-xs mt-2 opacity-50",children:"Email bodies are only stored for newly sent emails."})]})}),e.jsx("div",{className:"p-4 border-t border-gray-800 bg-[#0e0f11] flex justify-end",children:e.jsx("button",{onClick:()=>u(null),className:"px-6 py-2 bg-gray-800 hover:bg-gray-700 text-white text-sm font-medium rounded-xl transition-all",children:"Close Preview"})})]})})]})},GC=({title:t,description:r,url:a,siteTitle:n})=>{const s=t?t.includes(n==null?void 0:n.split("|")[0].trim())?t:`${t} | ${n==null?void 0:n.split("|")[0].trim()}`:n;return e.jsxs("div",{className:"bg-white p-4 rounded-lg shadow max-w-[600px] font-sans border border-gray-200 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#202124] mb-1",children:[e.jsx("div",{className:"w-6 h-6 bg-gray-100 rounded-full flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:"/favicon.ico",alt:"Favicon",className:"w-4 h-4",onError:i=>i.target.style.display="none"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[14px] leading-tight truncate",children:"InfoSecLabs"}),e.jsxs("span",{className:"text-[12px] leading-tight text-[#4d5156] truncate",children:["https://infoseclabs.io",a]})]})]}),e.jsx("h3",{className:"text-[#1a0dab] text-[20px] font-medium leading-[1.3] cursor-pointer hover:underline mb-1 truncate block",children:s||"Page Title"}),e.jsx("p",{className:"text-[#4d5156] text-[14px] leading-[1.58] line-clamp-2",children:r||"Page description will appear here in the search results snippet."})]})},KC=({token:t,siteTitle:r})=>{const[a,n]=l.useState([]),[s,i]=l.useState(!0),[o,c]=l.useState(null),[d,m]=l.useState({}),[u,x]=l.useState(!1),h=async()=>{try{const v=await fetch(`${Y}/api/admin/seo/pages`,{headers:{Authorization:`Bearer ${t}`}});v.ok&&n(await v.json())}catch(v){console.error(v),z.error("Failed to load SEO overrides")}finally{i(!1)}};l.useEffect(()=>{h()},[]);const f=v=>{c(v.route),m({route:v.route,title:v.title||"",description:v.description||"",keywords:v.keywords||"",og_image:v.og_image||""})},g=()=>{c("new"),m({route:"/",title:"",description:"",keywords:"",og_image:""})},b=async()=>{if(!d.route)return z.error("Route is required");x(!0);try{(await fetch(`${Y}/api/admin/seo/pages`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(d)})).ok?(z.success("SEO saved successfully"),c(null),h()):z.error("Failed to save SEO")}catch{z.error("Error saving SEO")}finally{x(!1)}},p=async()=>{const v=z.loading("Pinging Google Sitemap...");try{(await fetch(`${Y}/api/admin/seo/ping`,{method:"POST",headers:{Authorization:`Bearer ${t}`}})).ok?z.success("Google pinged successfully!",{id:v}):z.error("Failed to ping Google",{id:v})}catch{z.error("Error pinging server",{id:v})}};return s?e.jsx("div",{className:"text-gray-400",children:"Loading overrides..."}):o?e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 animate-fadeIn flex flex-col lg:flex-row gap-8",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"text-white font-bold text-lg",children:o==="new"?"New Route Override":`Editing ${o}`}),e.jsx("button",{onClick:()=>c(null),className:"text-gray-400 hover:text-white text-sm",children:"Cancel"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Route Path (e.g. /pricing)"}),e.jsx("input",{type:"text",value:d.route,onChange:v=>m({...d,route:v.target.value}),disabled:o!=="new",className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between text-sm font-medium text-gray-400 mb-1",children:[e.jsx("span",{children:"Meta Title"}),e.jsxs("span",{className:d.title.length>60?"text-red-400":"text-green-400",children:[d.title.length,"/60"]})]}),e.jsx("input",{type:"text",value:d.title,onChange:v=>m({...d,title:v.target.value}),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm",placeholder:"Unique and catchy title"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center justify-between text-sm font-medium text-gray-400 mb-1",children:[e.jsx("span",{children:"Meta Description"}),e.jsxs("span",{className:d.description.length>160?"text-red-400":"text-green-400",children:[d.description.length,"/160"]})]}),e.jsx("textarea",{value:d.description,onChange:v=>m({...d,description:v.target.value}),className:"w-full h-24 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm",placeholder:"Compelling description with keywords"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Keywords (Comma separated)"}),e.jsx("input",{type:"text",value:d.keywords,onChange:v=>m({...d,keywords:v.target.value}),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Custom OG Image URL"}),e.jsx("input",{type:"text",value:d.og_image,onChange:v=>m({...d,og_image:v.target.value}),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm",placeholder:"Leave blank for default"})]}),e.jsx("div",{className:"pt-4",children:e.jsxs("button",{onClick:b,disabled:u,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white font-bold rounded-lg transition-colors flex items-center gap-2",children:[e.jsx(As,{className:"w-4 h-4"})," ",u?"Saving...":"Save Override"]})})]}),e.jsxs("div",{className:"flex-1 bg-[#0e0f11] border border-gray-800 rounded-xl p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-blue-500 to-purple-500"}),e.jsxs("h4",{className:"text-gray-400 font-bold mb-4 flex items-center gap-2 uppercase tracking-wide text-xs",children:[e.jsx(Jt,{className:"w-4 h-4"})," Live SERP Preview"]}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"This is roughly how your page will appear in Google Search Results. Ensure titles and descriptions are not cut off."}),e.jsx(GC,{title:d.title,description:d.description,url:d.route,siteTitle:r}),d.title.length>60&&e.jsxs("div",{className:"mt-6 flex items-start gap-2 text-yellow-500 bg-yellow-500/10 p-3 rounded-lg text-sm border border-yellow-500/20",children:[e.jsx(xs,{className:"w-5 h-5 flex-shrink-0"}),e.jsx("p",{children:"Your title is over 60 characters and may be truncated by search engines."})]}),d.description.length>160&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 text-yellow-500 bg-yellow-500/10 p-3 rounded-lg text-sm border border-yellow-500/20",children:[e.jsx(xs,{className:"w-5 h-5 flex-shrink-0"}),e.jsx("p",{children:"Your description is over 160 characters and will likely be truncated."})]})]})]}):e.jsxs("div",{className:"space-y-6 animate-fadeIn",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold text-lg",children:"Per-Page SEO Overrides"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Configure specific meta tags for critical landing pages."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:p,className:"px-4 py-2 border border-gray-700 text-gray-300 hover:text-white hover:bg-gray-800 font-medium rounded-lg transition-colors flex items-center gap-2 text-sm",children:[e.jsx(Jr,{className:"w-4 h-4"})," Ping Sitemap"]}),e.jsx("button",{onClick:g,className:"px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white font-medium rounded-lg transition-colors flex items-center gap-2 text-sm",children:"+ Add Override"})]})]}),e.jsx("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 overflow-hidden",children:e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"text-xs uppercase bg-[#0e0f11] text-gray-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 font-medium",children:"Route Path"}),e.jsx("th",{className:"px-6 py-4 font-medium",children:"Meta Title"}),e.jsx("th",{className:"px-6 py-4 font-medium",children:"Last Updated"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-8 text-center text-gray-500",children:"No route overrides configured yet."})}):a.map(v=>e.jsxs("tr",{className:"border-b border-gray-800/50 hover:bg-white/5 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 font-mono text-purple-400",children:v.route}),e.jsx("td",{className:"px-6 py-4 text-white truncate max-w-xs",children:v.title||"-"}),e.jsx("td",{className:"px-6 py-4",children:new Date(v.updated_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{onClick:()=>f(v),className:"text-gray-400 hover:text-white bg-gray-800 hover:bg-gray-700 px-3 py-1.5 rounded transition-colors text-xs font-medium",children:"Edit"})})]},v.id))})]})})]})},qC=({settings:t,handleInputChange:r})=>{var a,n,s,i,o,c,d,m;return e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 animate-fadeIn",children:[e.jsx("h4",{className:"text-white font-bold mb-6 text-lg",children:"Global SEO Defaults"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Site Title Base"}),e.jsx("input",{type:"text",value:((a=t.seo)==null?void 0:a.site_title)||"",onChange:u=>r("seo","site_title",u.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"InfoSecLabs | SOC Analyst Training"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"This is appended to all dynamic page titles automatically."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Default Meta Description"}),e.jsx("textarea",{className:"w-full h-24 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",value:((n=t.seo)==null?void 0:n.site_description)||"",onChange:u=>r("seo","site_description",u.target.value),placeholder:"Train like a real SOC Analyst..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Default Keywords"}),e.jsx("textarea",{className:"w-full h-16 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",value:((s=t.seo)==null?void 0:s.site_keywords)||"",onChange:u=>r("seo","site_keywords",u.target.value),placeholder:"SOC, Cybersecurity, Training, ..."})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Twitter Handle"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-4 top-2.5 text-gray-500",children:"@"}),e.jsx("input",{type:"text",value:((o=(i=t.seo)==null?void 0:i.twitter_handle)==null?void 0:o.replace("@",""))||"",onChange:u=>r("seo","twitter_handle","@"+u.target.value),className:"w-full pl-8 pr-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"infoseclabs"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Default OG Image URL (Social Sharing)"}),e.jsx("input",{type:"text",value:((c=t.seo)==null?void 0:c.og_image)||"",onChange:u=>r("seo","og_image",u.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"https://..."}),((d=t.seo)==null?void 0:d.og_image)&&e.jsx("img",{src:t.seo.og_image,alt:"OG Preview",className:"mt-2 h-20 rounded border border-gray-800 object-cover",onError:u=>u.target.style.display="none"})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-800",children:[e.jsxs("h5",{className:"text-white font-medium mb-3 flex items-center gap-2",children:[e.jsx(tl,{className:"w-4 h-4 text-blue-400"})," Google Analytics"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Tracking ID (GA4)"}),e.jsx("input",{type:"text",value:((m=t.seo)==null?void 0:m.google_analytics_id)||"",onChange:u=>r("seo","google_analytics_id",u.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm font-mono focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"G-XXXXXXXXXX"})]})]})]})]})]})},XC=({settings:t,handleInputChange:r,token:a})=>{var i;const[n,s]=l.useState("global");return e.jsxs("div",{className:"space-y-6 max-w-6xl mx-auto animate-fadeIn",children:[e.jsxs("div",{className:"bg-gradient-to-r from-purple-500/10 to-transparent border border-purple-500/20 p-6 rounded-xl flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white mb-1",children:"SEO Management Studio"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Fine-tune your platform's discoverability. Manage global defaults or inject laser-targeted metadata per route."})]}),e.jsx("div",{className:"p-3 bg-purple-500/20 rounded-lg",children:e.jsx(Jt,{className:"w-8 h-8 text-purple-400"})})]}),e.jsxs("div",{className:"flex gap-2 border-b border-gray-800 pb-4",children:[e.jsxs("button",{onClick:()=>s("global"),className:`flex items-center gap-2 px-5 py-2.5 font-semibold rounded-lg transition-colors text-sm ${n==="global"?"bg-gray-800 text-white shadow-sm":"text-gray-400 hover:text-white hover:bg-gray-800/50"}`,children:[e.jsx(ms,{className:"w-4 h-4"})," Global Fallbacks"]}),e.jsxs("button",{onClick:()=>s("pages"),className:`flex items-center gap-2 px-5 py-2.5 font-semibold rounded-lg transition-colors text-sm ${n==="pages"?"bg-purple-600/20 text-purple-400 shadow-sm border border-purple-500/30":"text-gray-400 hover:text-white hover:bg-gray-800/50"}`,children:[e.jsx(Cc,{className:"w-4 h-4"})," Per-Page Overrides"]})]}),n==="global"&&e.jsx(qC,{settings:t,handleInputChange:r}),n==="pages"&&e.jsx(KC,{token:a,siteTitle:(i=t==null?void 0:t.seo)==null?void 0:i.site_title})]})},YC=({token:t,setView:r,setAlertFilter:a})=>{var S,N,w,_,P,O,T,k,$,C,A,E,L,F,D,q,Q,de,H,se,W,le,U,ee,ae,ue,fe,re,V,ce,Z,xe,pe,Se,ke,$e,K,ie,I,R,je,Te,Ie,tt,Ke,Be,Ge;const[n,s]=l.useState({general:{},email:{},email_template:{},payment:{},database:{},ai_integration:{},automation:{},seo:{},oauth:{}}),[i,o]=l.useState(!0),[c,d]=l.useState("general"),[m,u]=l.useState(""),[x,h]=l.useState({type:"",message:""}),[f,g]=l.useState([]),b=async()=>{try{const J=await fetch(`${Y}/api/admin/audit-logs`,{headers:{Authorization:`Bearer ${t}`}});J.ok&&g(await J.json())}catch(J){console.error("Failed to fetch audit logs",J)}};l.useEffect(()=>{c==="audit"&&b()},[c]),l.useEffect(()=>{p()},[]);const p=async()=>{var J,Ae;try{const ve=await fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${t}`}});if(ve.ok){const ge=await ve.json();let qe=null;try{const Xe=await fetch(`${Y}/api/version`);Xe.ok&&(qe=await Xe.json())}catch(Xe){console.error("Version fetch error",Xe)}s(Xe=>({...Xe,...ge,version:qe,general:ge.general||{},email:ge.email||{},email_template:ge.email_template||{},payment:ge.payment||{},database:ge.database||{},seo:ge.seo||{},oauth:ge.oauth||{},automation:ge.automation||{daily_ai_briefing_enabled:!1,daily_ai_briefing_count:2},ai_integration:ge.ai_integration||{ai_provider:"openai",ai_evaluation_enabled:!1,ai_admin_approval:!0,ai_strategy:"realistic",ai_prompt:`You are a Veteran Tier 3 SOC Analyst and Mentor at a high-security Security Operations Center.
Your task is to review and grade a junior analyst's investigation report for a security alert.

### ALERT CONTEXT
Title: {{title}}
Severity: {{severity}}
Description: {{details}}
Is Real World Example: {{example}}

### ANALYST SUBMISSION
Verdict: {{verdict}}
Analysis: {{analysis}}
Steps Taken: {{steps}}
Conclusion: {{conclusion}}

### EVALUATION CRITERIA
1. Verdict Accuracy (CRITICAL): Did the analyst correctly identify the true nature of the alert (True Positive vs False Positive)?
2. Analysis Depth: Did they interpret the raw logs correctly? Did they find the root cause?
3. Remediation: Were the steps taken (e.g., blocking IPs, isolating hosts, resetting passwords) appropriate for the severity?
4. Communication: Is the conclusion clear, professional, and actionable?

### YOUR OUTPUT
You must respond with valid JSON ONLY. Do not use Markdown formatting (like \`\`\`json).

{
  "grade": <integer between 0 and 100>,
  "feedback": "<Constructive, professional feedback addressed to the analyst. improved analysis tips.>",
  "ai_summary": {
    "verdict": "<The Correct Verdict>",
    "analysis": "<Expert technical analysis of what actually occurred in this alert>",
    "steps": "<The ideal remediation steps that should have been taken>",
    "conclusion": "<A concise executive summary suitable for management>"
  }
}`}})),(!((J=ge.payment)!=null&&J.stripe_publishable_key)||!((Ae=ge.payment)!=null&&Ae.stripe_secret_key))&&setShowAdvancedPayment(!0)}o(!1)}catch(ve){console.error("Error fetching settings:",ve),o(!1)}},v=(J,Ae,ve)=>{s(ge=>({...ge,[J]:{...ge[J],[Ae]:ve}}))},y=async()=>{try{if((await fetch(`${Y}/api/admin/settings`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)})).ok)z.success("Settings saved successfully!");else throw new Error("Failed to save settings")}catch{z.error("Error saving settings")}},j=async()=>{if(!m){z.warn("Please enter an email address");return}try{const J=await fetch(`${Y}/api/admin/settings/test-email`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({to:m,smtp:n.email})}),Ae=await J.json();J.ok?z.success("Test email sent successfully!"):z.error("Failed to send test email: "+Ae.message)}catch{z.error("Error sending test email")}};return i?e.jsx("div",{className:"text-white",children:"Loading settings..."}):e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"System Settings"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Configure platform settings"}),n.version&&e.jsxs("p",{className:"text-xs text-gray-500 mt-1 font-mono",children:["v",n.version.version," (Build: ",n.version.timestamp,")"]})]}),x.message&&e.jsx("div",{className:`px-4 py-2 rounded-lg text-sm font-bold ${x.type==="success"?"bg-green-500/10 text-green-500":x.type==="error"?"bg-red-500/10 text-red-500":"bg-blue-500/10 text-blue-500"}`,children:x.message})]}),e.jsxs("div",{className:"flex border-b border-gray-800",children:[e.jsx("button",{onClick:()=>d("general"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="general"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"General"}),e.jsx("button",{onClick:()=>d("email"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="email"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"Email (SMTP)"}),e.jsx("button",{onClick:()=>d("oauth"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="oauth"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"Authentication"}),e.jsx("button",{onClick:()=>d("templates"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="templates"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"Email Templates"}),e.jsx("button",{onClick:()=>d("seo"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="seo"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"SEO"}),e.jsx("button",{onClick:()=>d("ai_integration"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="ai_integration"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"AI Integration"}),e.jsx("button",{onClick:()=>d("domains"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="domains"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"Student Domains"}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:()=>d("exports"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="exports"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:[e.jsx(ti,{size:16,className:"inline mr-2"}),"Data Exports"]}),e.jsxs("button",{onClick:()=>d("audit"),className:`px-6 py-3 text-sm font-medium transition-colors ${c==="audit"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:[e.jsx(el,{size:16,className:"inline mr-2"}),"Audit Logs"]})]}),e.jsxs("div",{className:"p-6",children:[c==="exports"&&e.jsxs("div",{className:"space-y-6 max-w-4xl",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-xl font-bold text-white mb-2",children:"Platform Data Exports"}),e.jsx("p",{className:"text-gray-400",children:"Download system data as CSV formats for backup or external analysis."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-500/10 rounded-full flex items-center justify-center mb-4",children:e.jsx(Bf,{size:32,className:"text-blue-500"})}),e.jsx("h3",{className:"text-lg font-bold text-white mb-2",children:"Users Database"}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Complete export of all registered users, roles, and creation dates."}),e.jsxs("button",{onClick:async()=>{try{const J=await fetch(`${Y}/api/admin/exports/users`,{headers:{Authorization:`Bearer ${t}`}});if(!J.ok)throw new Error("Failed");const Ae=await J.blob(),ve=window.URL.createObjectURL(Ae),ge=document.createElement("a");ge.href=ve,ge.download="infoseclabs_users.csv",ge.click()}catch{z.error("Export failed")}},className:"w-full flex items-center justify-center gap-2 bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg font-bold transition",children:[e.jsx(ti,{size:18})," Download CSV"]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800 flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-purple-500/10 rounded-full flex items-center justify-center mb-4",children:e.jsx(dr,{size:32,className:"text-purple-500"})}),e.jsx("h3",{className:"text-lg font-bold text-white mb-2",children:"Investigations"}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Complete export of all user investigations, grades, and statuses."}),e.jsxs("button",{onClick:async()=>{try{const J=await fetch(`${Y}/api/admin/exports/investigations`,{headers:{Authorization:`Bearer ${t}`}});if(!J.ok)throw new Error("Failed");const Ae=await J.blob(),ve=window.URL.createObjectURL(Ae),ge=document.createElement("a");ge.href=ve,ge.download="infoseclabs_investigations.csv",ge.click()}catch{z.error("Export failed")}},className:"w-full flex items-center justify-center gap-2 bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded-lg font-bold transition",children:[e.jsx(ti,{size:18})," Download CSV"]})]})]})]}),c==="audit"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white mb-2",children:"System Audit Logs"}),e.jsx("p",{className:"text-gray-400",children:"Real-time tracking of administrative actions and secure system events."})]}),e.jsx("button",{onClick:b,className:"bg-gray-800 text-white px-4 py-2 rounded-lg hover:bg-gray-700 transition",children:"Refresh"})]}),e.jsx("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 overflow-hidden",children:e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#0e0f11] text-xs text-gray-500 uppercase border-b border-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4",children:"Timestamp"}),e.jsx("th",{className:"px-6 py-4",children:"Admin / User"}),e.jsx("th",{className:"px-6 py-4",children:"Action"}),e.jsx("th",{className:"px-6 py-4",children:"Details"})]})}),e.jsx("tbody",{children:f.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:"4",className:"px-6 py-8 text-center text-gray-500",children:"No audit logs recorded yet."})}):f.map(J=>e.jsxs("tr",{className:"border-b border-gray-800 hover:bg-white/5",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:new Date(J.created_at).toLocaleString()}),e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("div",{className:"text-white font-medium",children:J.username||"System"}),e.jsx("div",{className:"text-xs",children:J.email||"Internal Service"})]}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:"bg-gray-800 text-gray-300 px-2 py-1 rounded text-xs font-mono",children:J.action})}),e.jsx("td",{className:"px-6 py-4",children:J.details})]},J.id))})]})})]}),c==="domains"&&e.jsx(JC,{token:t}),c==="general"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsx("p",{className:"text-gray-400",children:"General platform settings."}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6 border-b border-gray-800 pb-4",children:[e.jsx(ii,{className:"w-5 h-5 text-blue-400"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Platform Identity"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"Brand Name"}),e.jsx("div",{className:"relative",children:e.jsx("input",{type:"text",value:((S=n.general)==null?void 0:S.brand_name)||"InfoSecLabs",onChange:J=>v("general","brand_name",J.target.value),className:"w-full px-4 py-2.5 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent text-sm transition-all",placeholder:"InfoSecLabs"})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:["Support Email ",e.jsx("span",{className:"text-gray-600 normal-case tracking-normal",children:"(Public)"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Qr,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"email",value:((N=n.general)==null?void 0:N.support_email)||"",onChange:J=>v("general","support_email",J.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent text-sm transition-all",placeholder:"support@infoseclabs.io"})]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6 border-b border-gray-800 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yr,{className:"w-5 h-5 text-yellow-400"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Global Announcement Banner"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((w=n.general)==null?void 0:w.banner_enabled)==="true"||((_=n.general)==null?void 0:_.banner_enabled)===!0,onChange:J=>v("general","banner_enabled",J.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-yellow-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"Banner Message"}),e.jsx("textarea",{value:((P=n.general)==null?void 0:P.banner_message)||"",onChange:J=>v("general","banner_message",J.target.value),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm min-h-[80px] focus:ring-2 focus:ring-yellow-500 focus:border-transparent placeholder-gray-600 transition-all font-mono text-xs",placeholder:"e.g., Use code CYBER2026 for 20% off all Academy courses!",disabled:!(((O=n.general)==null?void 0:O.banner_enabled)==="true"||((T=n.general)==null?void 0:T.banner_enabled)===!0)})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-red-900/30 rounded-xl p-6 shadow-sm relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 left-0 w-1 h-full bg-red-600"}),e.jsxs("div",{className:"flex items-center justify-between mb-6 border-b border-gray-800 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sa,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Maintenance Mode"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((k=n.general)==null?void 0:k.maintenance_mode)==="true"||(($=n.general)==null?void 0:$.maintenance_mode)===!0,onChange:J=>v("general","maintenance_mode",J.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red-600"})]})]}),e.jsxs("p",{className:"text-sm text-gray-400 mb-4",children:["Enabling Maintenance Mode will immediately lock out all regular users and students. Only ",e.jsx("strong",{className:"text-white",children:"Admin"})," roles will be able to log in and navigate the platform. Use this during major version upgrades or critical fixes."]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"User Facing Maintenance Message"}),e.jsx("textarea",{value:((C=n.general)==null?void 0:C.maintenance_message)||"",onChange:J=>v("general","maintenance_message",J.target.value),className:"w-full px-4 py-3 bg-[#0e0f11] border border-red-900/30 rounded-lg text-white text-sm min-h-[80px] focus:ring-2 focus:ring-red-500 focus:border-transparent placeholder-gray-600 transition-all font-mono text-xs",placeholder:"We are currently performing scheduled maintenance. We will be back online shortly.",disabled:!(((A=n.general)==null?void 0:A.maintenance_mode)==="true"||((E=n.general)==null?void 0:E.maintenance_mode)===!0)})]})]})]}),c==="oauth"&&e.jsxs("div",{className:"space-y-6 max-w-4xl animate-fadeIn",children:[e.jsxs("div",{className:"bg-blue-500/10 border border-blue-500/20 p-4 rounded-xl flex gap-3 text-blue-400 text-sm mb-6",children:[e.jsx(xr,{className:"w-5 h-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold mb-1",children:"OAuth Configuration"}),e.jsxs("p",{children:["Enable social login by providing Client IDs and Secrets from your provider consoles. The callback base URL is: ",e.jsxs("span",{className:"font-mono bg-blue-500/20 px-1 rounded",children:[Y,"/api/auth/[provider]/callback"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-white rounded-full flex items-center justify-center",children:e.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}),e.jsx("h4",{className:"text-white font-bold",children:"Google Login"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((L=n.oauth)==null?void 0:L.google_enabled)==="true"||((F=n.oauth)==null?void 0:F.google_enabled)===!0,onChange:J=>v("oauth","google_enabled",J.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-infosec-accent"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"Client ID"}),e.jsx("input",{type:"text",value:((D=n.oauth)==null?void 0:D.google_client_id)||"",onChange:J=>v("oauth","google_client_id",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"123...apps.googleusercontent.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"Client Secret"}),e.jsx("input",{type:"password",value:((q=n.oauth)==null?void 0:q.google_client_secret)||"",onChange:J=>v("oauth","google_client_secret",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent font-mono",placeholder:"••••••••••••••••"})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-[#0077b5] rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 fill-white",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"})})}),e.jsx("h4",{className:"text-white font-bold",children:"LinkedIn Login"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((Q=n.oauth)==null?void 0:Q.linkedin_enabled)==="true"||((de=n.oauth)==null?void 0:de.linkedin_enabled)===!0,onChange:J=>v("oauth","linkedin_enabled",J.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-infosec-accent"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"Client ID"}),e.jsx("input",{type:"text",value:((H=n.oauth)==null?void 0:H.linkedin_client_id)||"",onChange:J=>v("oauth","linkedin_client_id",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"77..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"Client Secret"}),e.jsx("input",{type:"password",value:((se=n.oauth)==null?void 0:se.linkedin_client_secret)||"",onChange:J=>v("oauth","linkedin_client_secret",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm focus:ring-2 focus:ring-infosec-accent focus:border-transparent font-mono",placeholder:"••••••••••••••••"})]})]})]})]}),c==="email"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"SMTP Host"}),e.jsx("input",{type:"text",value:((W=n.email)==null?void 0:W.smtp_host)||"",onChange:J=>v("email","smtp_host",J.target.value),className:"w-full px-4 py-2 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"smtp.example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"SMTP Port"}),e.jsx("input",{type:"text",value:((le=n.email)==null?void 0:le.smtp_port)||"",onChange:J=>v("email","smtp_port",J.target.value),className:"w-full px-4 py-2 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"587"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"SMTP User"}),e.jsx("input",{type:"text",value:((U=n.email)==null?void 0:U.smtp_user)||"",onChange:J=>v("email","smtp_user",J.target.value),className:"w-full px-4 py-2 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"user@example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"SMTP Password"}),e.jsx("input",{type:"password",value:((ee=n.email)==null?void 0:ee.smtp_pass)||"",onChange:J=>v("email","smtp_pass",J.target.value),className:"w-full px-4 py-2 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent",placeholder:"••••••••"})]})]}),e.jsxs("div",{className:"pt-6 border-t border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4",children:"Test Configuration"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("input",{type:"email",value:m,onChange:J=>u(J.target.value),className:"flex-1 px-4 py-2 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white",placeholder:"Enter email to send test message"}),e.jsx("button",{onClick:j,className:"px-6 py-2 bg-gray-700 hover:bg-gray-600 text-white font-bold rounded-lg transition",children:"Send Test Email"})]})]})]}),c==="templates"&&e.jsxs("div",{className:"space-y-8 max-w-4xl",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Verification Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((ae=n.email_template)==null?void 0:ae.verification_subject)||"",onChange:J=>v("email_template","verification_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((ue=n.email_template)==null?void 0:ue.verification_body)||"",onChange:J=>v("email_template","verification_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{url}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Password Reset Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((fe=n.email_template)==null?void 0:fe.reset_password_subject)||"",onChange:J=>v("email_template","reset_password_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((re=n.email_template)==null?void 0:re.reset_password_body)||"",onChange:J=>v("email_template","reset_password_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{url}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Account Locked Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((V=n.email_template)==null?void 0:V.account_locked_subject)||"",onChange:J=>v("email_template","account_locked_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((ce=n.email_template)==null?void 0:ce.account_locked_body)||"",onChange:J=>v("email_template","account_locked_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{name}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Account Deleted Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((Z=n.email_template)==null?void 0:Z.account_deleted_subject)||"",onChange:J=>v("email_template","account_deleted_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((xe=n.email_template)==null?void 0:xe.account_deleted_body)||"",onChange:J=>v("email_template","account_deleted_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{name}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Gold Award Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((pe=n.email_template)==null?void 0:pe.award_gold_subject)||"",onChange:J=>v("email_template","award_gold_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((Se=n.email_template)==null?void 0:Se.award_gold_body)||"",onChange:J=>v("email_template","award_gold_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{name}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Alert Assigned Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((ke=n.email_template)==null?void 0:ke.alert_assigned_subject)||"",onChange:J=>v("email_template","alert_assigned_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:(($e=n.email_template)==null?void 0:$e.alert_assigned_body)||"",onChange:J=>v("email_template","alert_assigned_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{name}}",", ","{{title}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Investigation Graded Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((K=n.email_template)==null?void 0:K.investigation_graded_subject)||"",onChange:J=>v("email_template","investigation_graded_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((ie=n.email_template)==null?void 0:ie.investigation_graded_body)||"",onChange:J=>v("email_template","investigation_graded_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{name}}",", ","{{title}}",", ","{{grade}}",", ","{{feedback}}"]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsx("h4",{className:"text-white font-bold mb-4 text-lg",children:"Subscription Upgraded Email"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Subject"}),e.jsx("input",{type:"text",value:((I=n.email_template)==null?void 0:I.subscription_upgraded_subject)||"",onChange:J=>v("email_template","subscription_upgraded_subject",J.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Body (HTML)"}),e.jsx("textarea",{value:((R=n.email_template)==null?void 0:R.subscription_upgraded_body)||"",onChange:J=>v("email_template","subscription_upgraded_body",J.target.value),className:"w-full h-32 px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Available variables: ","{{name}}"]})]})]})]})]}),c==="seo"&&e.jsx(XC,{settings:n,handleInputChange:v,token:t}),c==="ai_integration"&&e.jsxs("div",{className:"space-y-6 max-w-4xl mx-auto animate-fadeIn",children:[e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6 border-b border-gray-800 pb-4",children:[e.jsx(ki,{className:"w-5 h-5 text-infosec-accent"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Model Configuration"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"AI Provider"}),e.jsxs("div",{className:"relative",children:[e.jsx(Mm,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),e.jsxs("select",{value:((je=n.ai_integration)==null?void 0:je.ai_provider)||"openai",onChange:J=>v("ai_integration","ai_provider",J.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent text-sm appearance-none cursor-pointer hover:border-gray-600 transition-colors",children:[e.jsx("option",{value:"openai",children:"OpenAI (ChatGPT)"}),e.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),e.jsx("option",{value:"local",children:"Local LLM (Ollama)"}),e.jsx("option",{value:"mock",children:"Mock (Test - No API Key Needed)"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5 uppercase tracking-wide",children:"API Key"}),e.jsxs("div",{className:"relative",children:[e.jsx(Oa,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"password",value:((Te=n.ai_integration)==null?void 0:Te.ai_api_key)||"",onChange:J=>v("ai_integration","ai_api_key",J.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent text-sm font-mono placeholder-gray-600 focus:placeholder-gray-500 transition-all",placeholder:"sk-..."})]})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6 border-b border-gray-800 pb-4",children:[e.jsx(yr,{className:"w-5 h-5 text-purple-400"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Grading & Evaluation"})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0e0f11] rounded-lg border border-gray-700/50 hover:border-gray-600 transition-colors group",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg group-hover:bg-purple-500/20 transition-colors",children:e.jsx(Mm,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"Enable AI Investigation Evaluation"}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Automatically analyze and grade student investigations"})]})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((Ie=n.ai_integration)==null?void 0:Ie.ai_evaluation_enabled)==="true"||((tt=n.ai_integration)==null?void 0:tt.ai_evaluation_enabled)===!0,onChange:J=>v("ai_integration","ai_evaluation_enabled",J.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-infosec-accent"})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0e0f11] rounded-lg border border-gray-700/50 hover:border-gray-600 transition-colors group",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg group-hover:bg-blue-500/20 transition-colors",children:e.jsx(Oa,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"Require Admin Approval"}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"AI grades must be verified by an admin before being final"})]})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((Ke=n.ai_integration)==null?void 0:Ke.ai_admin_approval)==="true"||((Be=n.ai_integration)==null?void 0:Be.ai_admin_approval)===!0,onChange:J=>v("ai_integration","ai_admin_approval",J.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-infosec-accent"})]})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-2 uppercase tracking-wide",children:"Custom Grading Instructions (Optional)"}),e.jsx("textarea",{value:((Ge=n.ai_integration)==null?void 0:Ge.ai_grading_custom_instructions)||"",onChange:J=>v("ai_integration","ai_grading_custom_instructions",J.target.value),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm min-h-[100px] focus:ring-2 focus:ring-infosec-accent focus:border-transparent placeholder-gray-600 transition-all font-mono text-xs",placeholder:`Example:
"Be very strict about identifying the source IP.
If the verdict is correct, give at least 80.
Do not penalize for short summaries."`})]})]})]})]}),e.jsx("button",{onClick:y,className:"px-8 py-3 bg-gradient-to-r from-infosec-accent to-purple-600 hover:from-infosec-accentHover hover:to-purple-700 text-white font-bold rounded-xl shadow-lg shadow-infosec-accent/20 transition transform hover:scale-[1.02]",children:"Save Settings"})]})]})},JC=({token:t})=>{const[r,a]=l.useState([]),[n,s]=l.useState(""),[i,o]=l.useState(!0),c=async()=>{try{const u=await fetch(`${Y}/api/admin/student-domains`,{headers:{Authorization:`Bearer ${t}`}});u.ok&&a(await u.json())}catch(u){console.error(u)}finally{o(!1)}};l.useEffect(()=>{c()},[]);const d=async()=>{if(n)try{const u=await fetch(`${Y}/api/admin/whitelist-domain`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({domain:n})});u.ok?(z.success("Domain added"),s(""),c()):z.error((await u.json()).message)}catch(u){z.error(u.message)}},m=async u=>{if(confirm("Remove this domain?"))try{(await fetch(`${Y}/api/admin/student-domains/${u}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})).ok&&(z.success("Domain removed"),a(h=>h.filter(f=>f.id!==u)))}catch(x){z.error(x.message)}};return e.jsx("div",{className:"space-y-6 max-w-2xl animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl border border-gray-800",children:[e.jsxs("h4",{className:"text-white font-bold mb-4 text-lg flex items-center gap-2",children:[e.jsx("span",{children:"🎓"})," Student Domain Whitelist"]}),e.jsxs("p",{className:"text-gray-400 text-sm mb-6",children:["Users registering with an email address ending in these domains will automatically be granted ",e.jsx("strong",{children:"Student"})," status."]}),e.jsxs("div",{className:"flex gap-4 mb-8",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("span",{className:"absolute left-4 top-2.5 text-gray-500",children:"@"}),e.jsx("input",{type:"text",value:n,onChange:u=>s(u.target.value),className:"w-full pl-8 pr-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white font-mono",placeholder:"university.edu"})]}),e.jsx("button",{onClick:d,disabled:!n,className:"px-6 py-2 bg-infosec-accent hover:bg-infosec-accentHover disabled:opacity-50 text-white font-bold rounded-lg transition",children:"Add Domain"})]}),i?e.jsx("div",{className:"text-center py-4 text-gray-500",children:"Loading..."}):r.length===0?e.jsx("div",{className:"text-center py-8 text-gray-500 bg-[#0e0f11] rounded-lg border border-dashed border-gray-800",children:"No custom domains whitelisted yet."}):e.jsx("div",{className:"space-y-2",children:r.map(u=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0e0f11] rounded-lg border border-gray-800",children:[e.jsxs("span",{className:"text-white font-mono",children:["@",u.domain]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-xs text-gray-600",children:["Added ",new Date(u.created_at).toLocaleDateString()]}),e.jsx("button",{onClick:()=>m(u.id),className:"text-red-500 hover:text-red-400 p-1 rounded hover:bg-red-500/10 transition-colors",title:"Remove",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]},u.id))})]})})},pn={SIEM:{icon:"🔍",label:"SOC / SIEM",sources:["Splunk","Elastic SIEM","Azure Sentinel","Wazuh"],prompt:"Generate a SIEM alert involving log correlation, failed logins, or suspicious event chains."},EDR:{icon:"💻",label:"Endpoint / EDR",sources:["CrowdStrike","SentinelOne","Carbon Black","Sysmon"],prompt:"Generate an endpoint alert involving process injection, PowerShell abuse, or malware execution."},NDR:{icon:"🌐",label:"Network / NDR",sources:["Zeek","Suricata","Corelight","Darktrace","Wireshark"],prompt:"Generate a network alert involving C2 beaconing, lateral movement, or data exfiltration traffic."},TI:{icon:"🧠",label:"Threat Intel",sources:["MISP","ThreatConnect","Anomali","Recorded Future"],prompt:"Generate a Threat Intelligence alert based on a specific APT actor, campaign, or IOC feed."},IR:{icon:"🔥",label:"Incident Response",sources:["KAPE","Velociraptor","FTK","Volatility"],prompt:"Generate an incident response scenario requiring forensic analysis, containment, and root cause analysis."},MAL:{icon:"🦠",label:"Malware Analysis",sources:["IDA Pro","Ghidra","Cuckoo Sandbox","Any.Run"],prompt:"Generate a malware analysis alert involving reverse engineering, packed executables, or malicious macros."},DLP:{icon:"🛡️",label:"DLP / Insider",sources:["Symantec DLP","Forcepoint","Microsoft Purview","Netskope"],prompt:"Generate a Data Loss Prevention alert involving sensitive data exfiltration (PII, PCI, IP) or insider threat."},CLOUD:{icon:"☁️",label:"Cloud Security",sources:["AWS GuardDuty","Azure Defender","GCP SCC","Prisma Cloud","Wiz"],prompt:"Generate a cloud security alert involving IAM, S3 buckets, Kubernetes, or serverless functions."}},Jl=({setView:t,initialTab:r="alert"})=>{const[a,n]=l.useState(r),[s,i]=l.useState({}),[o,c]=l.useState(!1),[d,m]=l.useState(!1);l.useEffect(()=>{a==="automation"&&u()},[a]);const u=async()=>{m(!0);try{const C=localStorage.getItem("token"),A=await fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${C}`}});if(A.ok){const E=await A.json();i(E.ai_integration||{})}}catch(C){console.error("Error fetching settings:",C),z.error("Failed to load automation settings")}finally{m(!1)}},x=(C,A)=>{i(E=>({...E,[C]:A}))},h=async()=>{try{const C=localStorage.getItem("token"),E=await(await fetch(`${Y}/api/admin/settings`,{headers:{Authorization:`Bearer ${C}`}})).json(),L={...E,ai_integration:{...E.ai_integration,...s}};(await fetch(`${Y}/api/admin/settings`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify(L)})).ok?z.success("Automation settings saved!"):z.error("Failed to save settings")}catch{z.error("Error saving settings")}},f=async()=>{c(!0);try{const C=localStorage.getItem("token"),A=await fetch(`${Y}/api/alerts/generate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({count:s.ai_alert_count||2,strategy:s.ai_strategy||"realistic",difficulty:"Intermediate"})});if(A.ok){const E=await A.json();z.success(`Successfully generated ${E.length||"new"} alerts!`)}else z.error("Failed to generate alerts.")}catch(C){console.error(C),z.error("Error generating alerts")}finally{c(!1)}},[g,b]=l.useState({difficulty:"Intermediate",severityCounts:{Low:0,Medium:2,High:0,Critical:0},verdictDistribution:{true_positive:1,false_positive:1,benign:0},strategy:"realistic",sendPush:!1,includeRawLogs:!0,sources:[],distributionHours:0,min_level:5,path_code:"auto",autoAssignPath:!0,sector_code:"auto",campaign_pack:"general",scenario_context:""}),[p,v]=l.useState(!1),[y,j]=l.useState(""),[S,N]=l.useState([]),[w,_]=l.useState({title:"",aptGroup:"",description:"",storyIntro:"",difficulty:"Intermediate",passingGrade:60,displayOrder:0,isActive:!0,isPremium:!1,scenario:"",alertCount:3,generateWithAI:!0}),[P,O]=l.useState(!1),T=Object.values(g.severityCounts).reduce((C,A)=>C+A,0);l.useEffect(()=>{if(g.strategy==="custom")return;let C=0,A=0,E=0;const L=T;if(L===0){b(D=>({...D,verdictDistribution:{true_positive:0,false_positive:0,benign:0}}));return}switch(g.strategy){case"high_threat":C=Math.ceil(L*.9),A=Math.floor(L*.05);break;case"noisy":C=Math.floor(L*.2),A=Math.ceil(L*.7);break;case"realistic":default:C=Math.ceil(L*.6),A=Math.floor(L*.3);break}E=L-C-A;const F=C+A+E;F>L&&(C-=F-L),F<L&&(E+=L-F),b(D=>({...D,verdictDistribution:{true_positive:Math.max(0,C),false_positive:Math.max(0,A),benign:Math.max(0,E)}}))},[T,g.strategy]);const k=async()=>{if(T===0){j("Please select at least one alert to generate.");return}v(!0),j("");try{const C=localStorage.getItem("token"),A=await fetch(`${Y}/api/alerts/generate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({count:T,...g})}),E=await A.json();if(A.ok){z.success(`Successfully generated ${T} alerts!`);const L=await fetch(`${Y}/api/alerts?limit=${T}`,{headers:{Authorization:`Bearer ${C}`}});L.ok&&N(await L.json())}else throw new Error(E.message||"Failed to generate alerts")}catch(C){console.error("Error generating alerts:",C),j(C.message)}finally{v(!1)}},$=async()=>{if(!w.title||!w.aptGroup){z.warn("Please fill in required fields (Title, APT Group)");return}O(!0);try{const C=localStorage.getItem("token"),A=await fetch(`${Y}/api/operations/generate`,{method:"POST",headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"},body:JSON.stringify(w)}),E=await A.json();A.ok?(z.success("Operation generated successfully!"),t&&t("missions")):z.error(E.message||"Generation failed")}catch(C){console.error("Generation error:",C),z.error(`Generation error: ${C.message}`)}finally{O(!1)}};return e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsx("h2",{className:"text-3xl font-bold text-white mb-6",children:"Create New Content"}),e.jsxs("div",{className:"flex border-b border-gray-800 mb-8 overflow-x-auto",children:[e.jsx("button",{onClick:()=>n("alert"),className:`px-6 py-3 text-sm font-medium transition-colors whitespace-nowrap ${a==="alert"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"AI Generator"}),e.jsx("button",{onClick:()=>n("mission"),className:`px-6 py-3 text-sm font-medium transition-colors whitespace-nowrap ${a==="mission"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"Create Mission"}),e.jsx("button",{onClick:()=>n("automation"),className:`px-6 py-3 text-sm font-medium transition-colors whitespace-nowrap ${a==="automation"?"text-infosec-accent border-b-2 border-infosec-accent":"text-gray-400 hover:text-white"}`,children:"AI Automation"})]}),a==="alert"&&e.jsxs("div",{className:"animate-fadeIn",children:[y&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 text-red-500 p-4 rounded-xl mb-6",children:y}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 p-8",children:[e.jsxs("div",{className:"bg-purple-900/10 border border-purple-500/20 rounded-xl p-6 mb-8",children:[e.jsx("h3",{className:"text-xl font-bold text-purple-400 mb-2",children:"✨ Advanced AI Alert Generator"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Configure appropriate alert distribution, complexity, and realistic scenarios."})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-purple-500 rounded-full"}),"Difficulty Level"]}),e.jsx("div",{className:"grid grid-cols-5 gap-3",children:[{name:"Novice",level:"1-2",color:"emerald",minLevel:1},{name:"Beginner",level:"3-4",color:"green",minLevel:3},{name:"Intermediate",level:"5-6",color:"amber",minLevel:5},{name:"Advanced",level:"7-8",color:"orange",minLevel:7},{name:"Expert",level:"9-10",color:"red",minLevel:9}].map(C=>e.jsxs("button",{onClick:()=>b(A=>({...A,difficulty:C.name,min_level:C.minLevel})),className:`p-3 rounded-xl border text-center transition ${g.difficulty===C.name?`bg-${C.color}-500/20 border-${C.color}-500 text-white ring-1 ring-${C.color}-500 font-bold`:"bg-[#0e0f11] border-gray-800 text-gray-400 hover:border-gray-600"}`,children:[e.jsx("div",{className:"text-sm font-bold",children:C.name}),e.jsxs("div",{className:"text-[10px] text-gray-500",children:["Lvl ",C.level]})]},C.name))}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"* Minimum user level will be auto-set based on difficulty"})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-blue-500 rounded-full"}),"Severity Distribution (Count)"]}),e.jsx("div",{className:"grid grid-cols-4 gap-4",children:["Low","Medium","High","Critical"].map(C=>e.jsxs("div",{className:"bg-[#0e0f11] p-4 rounded-lg border border-gray-800",children:[e.jsx("label",{className:"text-gray-400 text-xs font-bold uppercase mb-2 block",children:C}),e.jsx("input",{type:"number",min:"0",max:"20",className:"w-full bg-transparent text-2xl font-bold text-white focus:outline-none",value:g.severityCounts[C],onChange:A=>b({...g,severityCounts:{...g.severityCounts,[C]:parseInt(A.target.value)||0}})})]},C))})]}),e.jsxs("div",{className:"bg-[#0e0f11] p-6 rounded-lg border border-gray-800 mb-6",children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-green-500 rounded-full"}),"Alert Scenario Strategy"]}),e.jsxs("div",{className:"mb-6 p-4 bg-gray-800 rounded-lg border border-gray-700",children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-3",children:"🚀 Quick Start: Choose a Specialization Path"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:Object.entries(pn).map(([C,A])=>e.jsxs("button",{type:"button",onClick:()=>{b(E=>({...E,path_code:C,sources:A.sources,scenario_context:A.prompt,autoAssignPath:!1}))},className:`flex flex-col items-center justify-center p-3 rounded-lg border transition-all ${g.path_code===C?"bg-purple-900/50 border-purple-500 text-purple-200":"bg-gray-700 border-gray-600 text-gray-400 hover:bg-gray-600"}`,children:[e.jsx("span",{className:"text-2xl mb-1",children:A.icon}),e.jsx("span",{className:"text-xs font-medium text-center",children:A.label})]},C))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"🎭 Scenario Context (Optional)"}),e.jsx("textarea",{className:"bg-gray-700 appearance-none border-2 border-gray-700 rounded w-full py-2 px-4 text-gray-200 leading-tight focus:outline-none focus:bg-gray-600 focus:border-purple-500 h-24",placeholder:"Describe the specific scenario you want... (e.g., 'A ransomware attack using PsExec requiring isolation' or 'Analyze a phishing email with a malicious PDF attachment')",value:g.scenario_context,onChange:C=>b({...g,scenario_context:C.target.value})}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Use this to override the random generator. The AI will build the alert strictly around this description."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[{id:"realistic",label:"Realistic Mix",desc:"Balanced (60% TP, 30% FP)",icon:"⚖️"},{id:"high_threat",label:"High Threat",desc:"Critical Focus (90% TP)",icon:"🔥"},{id:"noisy",label:"Noisy",desc:"Training Noise (20% TP)",icon:"📢"},{id:"custom",label:"Custom",desc:"Manual Config",icon:"⚙️"}].map(C=>e.jsxs("button",{onClick:()=>b(A=>({...A,strategy:C.id})),className:`p-4 rounded-xl border text-left transition relative overflow-hidden ${g.strategy===C.id?"bg-infosec-accent/10 border-infosec-accent text-white ring-1 ring-infosec-accent":"bg-[#1a1b1e] border-gray-800 text-gray-400 hover:border-gray-600"}`,children:[e.jsx("div",{className:"text-2xl mb-2",children:C.icon}),e.jsx("div",{className:"font-bold text-sm",children:C.label}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:C.desc})]},C.id))}),g.strategy!=="custom"?e.jsxs("div",{className:"p-4 bg-gray-800/50 rounded-lg border border-gray-700 flex justify-between items-center",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-gray-400 text-xs uppercase font-bold",children:"Planned Distribution"}),e.jsxs("div",{className:"flex gap-4 text-sm font-mono",children:[e.jsxs("span",{className:"text-red-400",children:[e.jsx("span",{className:"font-bold",children:g.verdictDistribution.true_positive})," TP"]}),e.jsxs("span",{className:"text-orange-400",children:[e.jsx("span",{className:"font-bold",children:g.verdictDistribution.false_positive})," FP"]}),e.jsxs("span",{className:"text-gray-300",children:[e.jsx("span",{className:"font-bold",children:g.verdictDistribution.benign})," Benign"]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Total"}),e.jsx("div",{className:"text-xl font-bold text-white",children:T})]})]}):e.jsx("div",{className:"grid grid-cols-3 gap-4 animate-fadeIn"})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-yellow-500 rounded-full"}),"Security Tools (Sources)"]}),e.jsx("div",{className:"bg-[#0e0f11] p-4 rounded-lg border border-gray-800",children:e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"🛡️ Security Tools (Sources)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[...new Set([...g.path_code&&pn[g.path_code]?pn[g.path_code].sources:[],"Splunk","CrowdStrike","Wazuh","Proofpoint","Firewall","Palo Alto","Darktrace","ExtraHop","AWS GuardDuty","Azure Sentinel","GCP SCC","Office 365","Okta","Zeek","Suricata","Sysmon","Carbon Black","SentinelOne","Velociraptor","KAPE","FTK","Volatility","IDA Pro","Ghidra","Wireshark","Nmap"])].map(C=>{const A=g.path_code&&pn[g.path_code]&&pn[g.path_code].sources.includes(C);return e.jsxs("label",{className:`inline-flex items-center space-x-2 cursor-pointer p-2 rounded border ${g.sources.includes(C)?"bg-purple-900/30 border-purple-500":A?"bg-gray-700 border-yellow-600/50":"bg-gray-800 border-gray-700 opacity-60"}`,children:[e.jsx("input",{type:"checkbox",className:"form-checkbox text-purple-600 h-4 w-4 bg-gray-700 border-gray-600 rounded focus:ring-purple-500",checked:g.sources.includes(C),onChange:E=>{E.target.checked?b({...g,sources:[...g.sources,C]}):b({...g,sources:g.sources.filter(L=>L!==C)})}}),e.jsxs("span",{className:`text-sm ${g.sources.includes(C)?"text-white font-medium":A?"text-yellow-100":"text-gray-400"}`,children:[C," ",A&&"✨"]})]},C)})}),g.path_code&&pn[g.path_code]&&e.jsxs("p",{className:"text-xs text-yellow-500/80 mt-1 ml-1",children:["✨ Recommended sources for ",pn[g.path_code].label," are highlighted."]})]})})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-cyan-500 rounded-full"}),"Specialization Path & Level"]}),e.jsxs("div",{className:"bg-[#0e0f11] p-6 rounded-lg border border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("input",{type:"checkbox",id:"autoAssignPath",checked:g.autoAssignPath,onChange:C=>b({...g,autoAssignPath:C.target.checked}),className:"w-4 h-4 accent-cyan-500 rounded bg-gray-700 border-gray-600"}),e.jsx("label",{htmlFor:"autoAssignPath",className:"text-gray-300 text-sm cursor-pointer",children:"🤖 Auto-detect path from alert content (AI will analyze logs)"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase mb-2",children:"Minimum Level"}),e.jsx("select",{value:g.min_level,onChange:C=>b({...g,min_level:parseInt(C.target.value)}),className:"w-full px-4 py-3 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white focus:border-cyan-500 focus:outline-none",children:[1,2,3,4,5,6,7,8,9,10].map(C=>e.jsxs("option",{value:C,children:["Level ",C]},C))}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"User must be this level to see alert"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase mb-2",children:"Path Code"}),e.jsxs("select",{value:g.path_code,onChange:C=>b({...g,path_code:C.target.value}),disabled:g.autoAssignPath,className:`w-full px-4 py-3 bg-[#1a1b1e] border border-gray-700 rounded-lg text-white focus:border-cyan-500 focus:outline-none ${g.autoAssignPath?"opacity-50":""}`,children:[e.jsx("option",{value:"auto",children:"🤖 Auto-detect"}),e.jsx("option",{value:"SIEM",children:"📊 SIEM Analyst"}),e.jsx("option",{value:"EDR",children:"💻 Endpoint Detection (EDR)"}),e.jsx("option",{value:"NDR",children:"🌐 Network Detection (NDR)"}),e.jsx("option",{value:"TI",children:"🔍 Threat Intelligence"}),e.jsx("option",{value:"IR",children:"🚨 Incident Response"}),e.jsx("option",{value:"MAL",children:"🦠 Malware Analysis"}),e.jsx("option",{value:"DLP",children:"🔒 Data Loss Prevention"}),e.jsx("option",{value:"CLOUD",children:"☁️ Cloud Security"}),e.jsx("option",{value:"CORE",children:"🎯 CORE (All Paths)"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:g.autoAssignPath?"AI will detect from content":"Assign to this specialization"})]})]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-indigo-500 rounded-full"}),"Industry Sector"]}),e.jsxs("div",{className:"bg-[#0e0f11] p-6 rounded-lg border border-gray-800",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[{code:"auto",icon:"🤖",name:"Auto-detect"},{code:"HEALTHCARE",icon:"🏥",name:"Healthcare"},{code:"FINANCE",icon:"🏦",name:"Finance"},{code:"GOVERNMENT",icon:"🏛️",name:"Government"},{code:"OT_ICS",icon:"⚙️",name:"OT/ICS"},{code:"RETAIL",icon:"🛒",name:"Retail"},{code:"ENERGY",icon:"⚡",name:"Energy"},{code:"TECH",icon:"💻",name:"Technology"}].map(C=>e.jsxs("button",{onClick:()=>b({...g,sector_code:C.code}),className:`p-3 rounded-lg border text-center transition ${g.sector_code===C.code?"bg-indigo-500/20 border-indigo-500 text-white font-bold":"bg-[#1a1b1e] border-gray-700 text-gray-400 hover:border-gray-600"}`,children:[e.jsx("div",{className:"text-xl mb-1",children:C.icon}),e.jsx("div",{className:"text-xs",children:C.name})]},C.code))}),e.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"Alerts will include industry-specific compliance and threat context (HIPAA, PCI-DSS, etc.)"})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-red-500 rounded-full"}),"🎯 Campaign Pack"]}),e.jsxs("div",{className:"bg-[#0e0f11] p-6 rounded-lg border border-gray-800",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[{id:"general",icon:"🎲",name:"General Mix",desc:"Varied scenarios"},{id:"ransomware",icon:"🔐",name:"Ransomware",desc:"LockBit, BlackCat, Qilin"},{id:"apt",icon:"🎭",name:"APT Campaigns",desc:"APT41, Lazarus, Cozy Bear"},{id:"phishing",icon:"🎣",name:"Phishing",desc:"BEC, Spear, Credential"},{id:"cloud",icon:"☁️",name:"Cloud Attacks",desc:"AWS, Azure, GCP"}].map(C=>e.jsxs("button",{onClick:()=>b({...g,campaign_pack:C.id}),className:`p-3 rounded-lg border text-left transition ${g.campaign_pack===C.id?"bg-red-500/20 border-red-500 text-white":"bg-[#1a1b1e] border-gray-700 text-gray-400 hover:border-gray-600"}`,children:[e.jsx("div",{className:"text-xl mb-1",children:C.icon}),e.jsx("div",{className:"text-xs font-bold",children:C.name}),e.jsx("div",{className:"text-[10px] text-gray-500",children:C.desc})]},C.id))}),e.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"Generate alerts based on real-world threat campaigns and actor TTPs"})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-pink-500 rounded-full"}),"Alert Distribution Timeline"]}),e.jsxs("div",{className:"bg-[#0e0f11] p-6 rounded-lg border border-gray-800",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("span",{className:"text-gray-400 text-sm",children:"When should these alerts appear? (Spread)"}),e.jsx("span",{className:"text-white font-bold bg-gray-800 px-3 py-1 rounded-lg border border-gray-700 text-sm",children:g.distributionHours===0?"Immediately (All at once)":`Distributed over ${g.distributionHours} Hours`})]}),e.jsx("input",{type:"range",min:"0",max:"48",step:"1",value:g.distributionHours,onChange:C=>b({...g,distributionHours:parseInt(C.target.value)}),className:"w-full accent-infosec-accent h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer"}),e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mt-2 font-mono",children:[e.jsx("span",{children:"Now (0h)"}),e.jsx("span",{children:"12h"}),e.jsx("span",{children:"24h"}),e.jsx("span",{children:"48h"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-4 italic",children:'* Alerts will be created with timestamps randomized within this window. 0h means all alerts appear as "Just Now".'})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-8 bg-green-500 rounded-full"}),"Notifications"]}),e.jsx("div",{className:"bg-[#0e0f11] p-6 rounded-lg border border-gray-800",children:e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:g.sendPush,onChange:C=>b({...g,sendPush:C.target.checked}),className:"w-5 h-5 accent-infosec-accent rounded bg-gray-700 border-gray-600 focus:ring-infosec-accent"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-bold",children:"Send Mobile Push Notifications"}),e.jsx("div",{className:"text-xs text-gray-500",children:"Notify users immediately when these alerts are generated via Expo Push"})]})]})})]}),e.jsx("button",{onClick:k,disabled:p,className:"w-full py-4 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white font-bold rounded-xl transition shadow-lg shadow-blue-500/20 disabled:opacity-50 flex items-center justify-center gap-2",children:p?"Generating...":`Generate ${T} Alerts`})]})]})]}),a==="mission"&&e.jsx("div",{className:"animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-8 shadow-2xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-5 pointer-events-none",children:e.jsx(Ac,{size:120,className:"text-white"})}),e.jsxs("div",{className:"relative z-10 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"p-2 bg-purple-500/20 rounded-lg text-purple-400",children:e.jsx(Ac,{size:24})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"Create New Mission"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Design a multi-stage campaign manually or with AI assistance."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Operation Title *"}),e.jsx("input",{type:"text",value:w.title,onChange:C=>_({...w,title:C.target.value}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:ring-1 focus:ring-purple-500 transition-all placeholder-gray-600",placeholder:"e.g. Operation Deep Freeze"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"APT Group *"}),e.jsx("input",{type:"text",value:w.aptGroup,onChange:C=>_({...w,aptGroup:C.target.value}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:ring-1 focus:ring-purple-500 transition-all placeholder-gray-600",placeholder:"e.g. APT29 (Cozy Bear)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Description"}),e.jsx("textarea",{value:w.description,onChange:C=>_({...w,description:C.target.value}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:ring-1 focus:ring-purple-500 transition-all h-24 placeholder-gray-600",placeholder:"Brief description of the operation..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Story Introduction"}),e.jsx("textarea",{value:w.storyIntro,onChange:C=>_({...w,storyIntro:C.target.value}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:ring-1 focus:ring-purple-500 transition-all h-24 placeholder-gray-600",placeholder:"The narrative hook that introduces the operation..."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Difficulty"}),e.jsxs("select",{value:w.difficulty,onChange:C=>_({...w,difficulty:C.target.value}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none",children:[e.jsx("option",{value:"novice",children:"🟢 Novice (Level 1-2)"}),e.jsx("option",{value:"beginner",children:"🟢 Beginner (Level 3-4)"}),e.jsx("option",{value:"intermediate",children:"🟡 Intermediate (Level 5-6)"}),e.jsx("option",{value:"advanced",children:"🟠 Advanced (Level 7-8)"}),e.jsx("option",{value:"expert",children:"🔴 Expert (Level 9-10)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Passing Grade"}),e.jsx("input",{type:"number",min:"0",max:"100",value:w.passingGrade,onChange:C=>_({...w,passingGrade:parseInt(C.target.value)||60}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Display Order"}),e.jsx("input",{type:"number",min:"0",value:w.displayOrder,onChange:C=>_({...w,displayOrder:parseInt(C.target.value)||0}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none"})]})]}),e.jsxs("div",{className:"flex gap-6 pt-2",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:w.isActive,onChange:C=>_({...w,isActive:C.target.checked}),className:"w-5 h-5 rounded bg-[#0e0f11] border-gray-700 accent-purple-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Active"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:w.isPremium,onChange:C=>_({...w,isPremium:C.target.checked}),className:"w-5 h-5 rounded bg-[#0e0f11] border-gray-700 accent-purple-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-300",children:"Premium Only"})]})]}),e.jsxs("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-xl p-6 mt-4",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer mb-6",children:[e.jsx("input",{type:"checkbox",checked:w.generateWithAI,onChange:C=>_({...w,generateWithAI:C.target.checked}),className:"w-5 h-5 rounded bg-[#0e0f11] border-purple-500 accent-purple-500"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yr,{className:"w-5 h-5 text-purple-400"}),e.jsx("span",{className:"font-bold text-white",children:"Generate Alerts with AI"})]})]}),w.generateWithAI&&e.jsxs("div",{className:"space-y-6 animate-fadeIn",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-2",children:[e.jsx("label",{className:"text-sm text-gray-400",children:"Number of Alerts"}),e.jsx("span",{className:"text-purple-400 font-bold",children:w.alertCount})]}),e.jsx("input",{type:"range",min:"3",max:"10",value:w.alertCount,onChange:C=>_({...w,alertCount:parseInt(C.target.value)}),className:"w-full accent-purple-500 h-2 bg-gray-900 rounded-lg appearance-none cursor-pointer"}),e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mt-1",children:[e.jsx("span",{children:"3 (Short)"}),e.jsx("span",{children:"10 (Long)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-2",children:"Scenario Prompt (Optional)"}),e.jsx("textarea",{value:w.scenario,onChange:C=>_({...w,scenario:C.target.value}),className:"w-full px-4 py-3 bg-[#0e0f11] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none h-24 placeholder-gray-600",placeholder:"Custom scenario for AI to generate alerts around... (Leave empty for automatic generation based on description)"})]})]})]}),e.jsx("button",{onClick:$,disabled:P,className:"w-full py-4 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white font-bold rounded-xl transition shadow-lg shadow-purple-500/20 disabled:opacity-50 flex items-center justify-center gap-2 mt-4",children:P?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"animate-spin",children:"⏳"})," ",w.generateWithAI?"Generating Operation...":"Creating Operation..."]}):e.jsxs(e.Fragment,{children:[w.generateWithAI&&e.jsx(yr,{size:20}),w.generateWithAI?"Create & Generate Mission":"Create Mission"]})})]})]})}),a==="automation"&&e.jsx("div",{className:"animate-fadeIn space-y-6",children:d?e.jsx("div",{className:"text-white text-center py-10",children:"Loading automation settings..."}):e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6 border-b border-gray-800 pb-4",children:[e.jsx(Hf,{className:"w-5 h-5 text-green-400"}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Automatic Generation"}),e.jsxs("div",{className:"ml-auto flex items-center gap-4 text-[10px] uppercase tracking-widest font-bold",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-green-500/5 border border-green-500/10 rounded",children:[e.jsx("span",{className:"text-gray-500",children:"Last Success:"}),e.jsx("span",{className:"text-green-400",children:s.ai_auto_gen_last_run?new Date(s.ai_auto_gen_last_run).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never"})]}),s.ai_auto_gen_enabled&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-blue-500/5 border border-blue-500/10 rounded",children:[e.jsx("span",{className:"text-gray-500",children:"Next Run:"}),e.jsx("span",{className:"text-blue-400",children:(()=>{const C=s.ai_auto_gen_last_run?new Date(s.ai_auto_gen_last_run):new Date,A=s.ai_alert_frequency||"daily";let E=new Date(C);return A==="hourly"?E.setHours(E.getHours()+1):A==="6hours"?E.setHours(E.getHours()+6):A==="12hours"?E.setHours(E.getHours()+12):A==="daily"?E.setDate(E.getDate()+1):A==="weekly"&&E.setDate(E.getDate()+7),E<new Date?"Processing soon...":E.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})()})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0e0f11] rounded-lg border border-gray-700/50 hover:border-gray-600 transition-colors",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"Auto-Generate"}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Generate alerts on schedule"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.ai_auto_gen_enabled==="true"||s.ai_auto_gen_enabled===!0,onChange:C=>x("ai_auto_gen_enabled",C.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-green-500"})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0e0f11] rounded-lg border border-gray-700/50 hover:border-gray-600 transition-colors group cursor-pointer",onClick:()=>{t&&t("alerts_page")},children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-white group-hover:text-infosec-accent transition-colors",children:"History"}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"View all generated alerts"})]}),e.jsx(Wf,{className:"w-5 h-5 text-gray-500 group-hover:text-infosec-accent transition-colors"})]})]}),e.jsxs("div",{className:"bg-gradient-to-r from-gray-900 to-[#1a1b1e] p-6 rounded-xl border border-gray-700 text-center relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-infosec-accent/5 rounded-full blur-3xl -mr-10 -mt-10 group-hover:bg-infosec-accent/10 transition-all duration-500"}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center",children:[e.jsx("h4",{className:"text-base font-bold text-white mb-2",children:"Manual Batch Generation"}),e.jsx("p",{className:"text-xs text-gray-400 max-w-sm mb-4",children:"Instantly invoke the AI to generate a batch of alerts based on current settings for testing or demo purposes."}),e.jsx("button",{onClick:f,disabled:o,className:`px-6 py-2.5 bg-infosec-accent hover:bg-infosec-accentHover text-black text-sm font-bold rounded-lg transition-all transform hover:scale-105 shadow-lg shadow-infosec-accent/20 flex items-center gap-2 ${o?"opacity-50 cursor-not-allowed":""}`,children:o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-black border-t-transparent"}),"Running AI..."]}):e.jsxs(e.Fragment,{children:[e.jsx(yr,{className:"w-4 h-4"}),"Generate Batch Now"]})})]})]}),(s.ai_auto_gen_enabled==="true"||s.ai_auto_gen_enabled===!0)&&e.jsxs("div",{className:"animate-fadeIn pt-4 border-t border-gray-800 space-y-8",children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider mb-4",children:"Advanced Scheduling"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5",children:"Frequency"}),e.jsxs("select",{value:s.ai_alert_frequency||"daily",onChange:C=>x("ai_alert_frequency",C.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm",children:[e.jsx("option",{value:"hourly",children:"Every Hour"}),e.jsx("option",{value:"6hours",children:"Every 6 Hours"}),e.jsx("option",{value:"12hours",children:"Every 12 Hours"}),e.jsx("option",{value:"daily",children:"Daily (08:00 AM)"}),e.jsx("option",{value:"weekly",children:"Weekly (Monday 09:00 AM)"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-gray-400 mb-1.5",children:["Quantity: ",e.jsx("span",{className:"text-white font-bold ml-1",children:s.ai_alert_count||2})]}),e.jsx("input",{type:"range",min:"1",max:"10",step:"1",value:s.ai_alert_count||2,onChange:C=>x("ai_alert_count",parseInt(C.target.value)),className:"w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-infosec-accent mt-2"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5",children:"Strategy"}),e.jsxs("select",{value:s.ai_strategy||"realistic",onChange:C=>x("ai_strategy",C.target.value),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm",children:[e.jsx("option",{value:"realistic",children:"Realistic Mix (Balanced)"}),e.jsx("option",{value:"high_threat",children:"High Threat (Critical Focus)"}),e.jsx("option",{value:"noisy",children:"Noisy / False Positives (Training)"}),e.jsx("option",{value:"random",children:"Completely Random"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1.5",children:"Distribution (Hours)"}),e.jsx("input",{type:"number",min:"0",max:"24",value:s.ai_distribution_hours||0,onChange:C=>x("ai_distribution_hours",parseInt(C.target.value)),className:"w-full px-4 py-2 bg-[#0e0f11] border border-gray-700 rounded-lg text-white text-sm"}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:"0 = Immediate. X = Spread alerts over X hours."})]})]})]}),e.jsx("div",{className:"pt-6 border-t border-gray-800/50",children:e.jsxs("div",{className:"bg-gradient-to-br from-purple-900/10 to-transparent p-6 rounded-xl border border-purple-500/20 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 pointer-events-none transition-transform group-hover:scale-110 duration-500",children:e.jsx(yr,{size:80,className:"text-purple-400"})}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-3 bg-purple-500/20 rounded-xl text-purple-400 border border-purple-500/30",children:e.jsx(oi,{size:24})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"Daily Threat Briefing"}),e.jsx("p",{className:"text-sm text-gray-400 font-medium",children:"Automated solvable alerts from real-world cyber news"})]})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.daily_ai_briefing_enabled==="true"||s.daily_ai_briefing_enabled===!0,onChange:C=>x("daily_ai_briefing_enabled",C.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-purple-500"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-center mt-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-3",children:[e.jsx("label",{className:"text-xs font-bold text-gray-400 uppercase tracking-widest",children:"Alerts per Morning (09:00)"}),e.jsx("span",{className:"px-2 py-1 bg-purple-500/20 text-purple-200 text-lg font-black rounded-lg border border-purple-500/20",children:s.daily_ai_briefing_count||2})]}),e.jsx("input",{type:"range",min:"1",max:"10",value:s.daily_ai_briefing_count||2,onChange:C=>x("daily_ai_briefing_count",parseInt(C.target.value)),className:"w-full accent-purple-500 h-2 bg-gray-800 rounded-lg appearance-none cursor-pointer"}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-2 font-mono uppercase tracking-tighter",children:"Proactively assigned to all active users' daily queues."}),e.jsxs("div",{className:"mt-6 space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest block mb-2 font-mono",children:"Target Career Path"}),e.jsxs("select",{value:s.daily_ai_briefing_path||"AUTO",onChange:C=>x("daily_ai_briefing_path",C.target.value),className:"w-full bg-gray-900/50 border border-gray-800 rounded-xl px-4 py-2.5 text-[13px] text-gray-300 focus:border-purple-500/50 outline-none transition-all shadow-inner",children:[e.jsx("option",{value:"AUTO",children:"✨ AI Auto-Detect (Based on News)"}),e.jsx("option",{value:"SIEM",children:"🔍 SOC / SIEM"}),e.jsx("option",{value:"EDR",children:"💻 Endpoint / EDR"}),e.jsx("option",{value:"NDR",children:"🌐 Network / NDR"}),e.jsx("option",{value:"TI",children:"🧠 Threat Intel"}),e.jsx("option",{value:"IR",children:"🔥 Incident Response"}),e.jsx("option",{value:"MAL",children:"🦠 Malware Analysis"}),e.jsx("option",{value:"DLP",children:"🛡️ DLP / Insider"}),e.jsx("option",{value:"CLOUD",children:"☁️ Cloud Security"})]})]}),e.jsxs("div",{className:"pt-2",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest font-mono",children:"Base Difficulty"}),e.jsxs("span",{className:"px-2.5 py-1 bg-purple-500/10 text-purple-300 text-[11px] font-black rounded-lg border border-purple-500/20",children:["L:",s.daily_ai_briefing_level||5]})]}),e.jsx("input",{type:"range",min:"1",max:"10",value:s.daily_ai_briefing_level||5,onChange:C=>x("daily_ai_briefing_level",parseInt(C.target.value)),className:"w-full accent-purple-500 h-1.5 bg-gray-900 rounded-lg appearance-none cursor-pointer"})]}),e.jsx("div",{className:"flex flex-col gap-1 pt-2",children:e.jsxs("div",{className:"flex items-center justify-between text-[11px] font-bold py-2 border-b border-gray-800/50",children:[e.jsxs("span",{className:"text-gray-500 flex items-center gap-1.5",children:[e.jsx(va,{size:12})," LAST RUN:"]}),e.jsx("span",{className:"text-gray-400",children:s.daily_briefing_last_run?new Date(s.daily_briefing_last_run).toLocaleDateString():"Never"})]})})]})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"p-4 bg-gray-950/40 rounded-xl border border-gray-800 italic text-[13px] text-gray-300 leading-relaxed shadow-inner",children:'"This system monitors global cyber attack occurrences and selects the most relevant news. Our AI then sanitizes the technical details into a structured investigation playbook that mirrors the news event exactly."'}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-950/60 rounded-xl border border-gray-800 shadow-inner",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-sm font-bold text-white",children:"Push Notifications"}),e.jsx("span",{className:"block text-xs text-gray-500",children:"Notify users when briefing is ready"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.daily_ai_briefing_send_push!==!1&&s.daily_ai_briefing_send_push!=="false",onChange:C=>x("daily_ai_briefing_send_push",C.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-infosec-accent"})]})]}),e.jsxs("button",{onClick:async()=>{c(!0);try{await h();const C=localStorage.getItem("token");(await fetch(`${Y}/api/admin/trigger-briefing`,{method:"POST",headers:{Authorization:`Bearer ${C}`}})).ok?z.success("Briefing trigger successful!"):z.error("Failed to trigger briefing.")}catch{z.error("Error triggering briefing")}finally{c(!1)}},disabled:o,className:"w-full py-3 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white text-sm font-bold rounded-xl transition shadow-lg shadow-purple-500/20 flex items-center justify-center gap-2 group",children:[e.jsx(yr,{size:16,className:"group-hover:rotate-12 transition-transform"}),"Force Sync & Generate"]})]})]})]})})]}),e.jsx("div",{className:"mt-8 flex justify-end",children:e.jsxs("button",{onClick:h,className:"px-6 py-2 bg-infosec-accent text-black font-bold rounded-lg hover:bg-infosec-accentHover transition-colors flex items-center gap-2",children:[e.jsx(As,{className:"w-4 h-4"})," Save Automation Settings"]})})]})})]})},QC=({user:t})=>{const[r,a]=l.useState(!1),[n,s]=l.useState(0);l.useEffect(()=>{if(!t)return;const u=localStorage.getItem("infoseclabs_intro_seen");if(!t.created_at)return;const x=new Date(t.created_at);(new Date-x)/(1e3*60*60)<48&&!u&&setTimeout(()=>a(!0),1500)},[t]);const i=()=>{a(!1),localStorage.setItem("infoseclabs_intro_seen","true")},o=()=>{n<d.length-1?s(u=>u+1):i()},c=()=>{n>0&&s(u=>u-1)},d=[{title:"Access Granted",subtitle:"Welcome to InfoSecLabs SOC",icon:e.jsx(xr,{className:"w-12 h-12 text-cyan-400"}),color:"cyan",content:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-gray-300 leading-relaxed",children:["Identity confirmed. Welcome, ",e.jsx("span",{className:"font-bold text-white",children:(t==null?void 0:t.username)||"Initiate"}),". You have entered a top-tier Security Operations Center simulation."]}),e.jsxs("div",{className:"bg-cyan-500/10 border border-cyan-500/20 p-4 rounded-xl flex items-start gap-3",children:[e.jsx(Oa,{className:"w-5 h-5 text-cyan-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-cyan-300",children:"Clearance Level 1"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Your mission is to defend this infrastructure. Analyze logs, hunt threats, and secure the perimeter."})]})]})]})},{title:"The Arsenal",subtitle:"Advanced Security Tools",icon:e.jsx(Er,{className:"w-12 h-12 text-blue-400"}),color:"blue",content:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-300 leading-relaxed",children:"You are equipped with industry-standard defense capabilities."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-3 rounded-lg border border-gray-800 flex flex-col items-center text-center",children:[e.jsx(wo,{className:"w-6 h-6 text-purple-400 mb-2"}),e.jsx("span",{className:"text-xs font-bold text-gray-300",children:"SIEM"})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-3 rounded-lg border border-gray-800 flex flex-col items-center text-center",children:[e.jsx(ms,{className:"w-6 h-6 text-orange-400 mb-2"}),e.jsx("span",{className:"text-xs font-bold text-gray-300",children:"Firewall"})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-3 rounded-lg border border-gray-800 flex flex-col items-center text-center",children:[e.jsx(Er,{className:"w-6 h-6 text-red-400 mb-2"}),e.jsx("span",{className:"text-xs font-bold text-gray-300",children:"EDR"})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-3 rounded-lg border border-gray-800 flex flex-col items-center text-center",children:[e.jsx(Mt,{className:"w-6 h-6 text-green-400 mb-2"}),e.jsx("span",{className:"text-xs font-bold text-gray-300",children:"Intel"})]})]})]})},{title:"The Academy",subtitle:"Master the Fundamentals",icon:e.jsx(wo,{className:"w-12 h-12 text-purple-400"}),color:"purple",content:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-300 leading-relaxed",children:"Before you can defend, you must understand. The Academy provides hands-on modules to sharpen your skills."}),e.jsxs("ul",{className:"space-y-2",children:[e.jsxs("li",{className:"flex items-center gap-3 text-sm text-gray-400",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-purple-500"}),"Linux Command Line Mastery"]}),e.jsxs("li",{className:"flex items-center gap-3 text-sm text-gray-400",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-purple-500"}),"Network Packet Analysis"]}),e.jsxs("li",{className:"flex items-center gap-3 text-sm text-gray-400",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-purple-500"}),"Log Investigation Techniques"]})]})]})},{title:"Live Operations",subtitle:"Your Mission Awaits",icon:e.jsx(kr,{className:"w-12 h-12 text-yellow-400"}),color:"yellow",content:e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-gray-300 leading-relaxed",children:"Ready to prove yourself? Complete operations to earn badges and climb the global leaderboard."}),e.jsx("div",{className:"relative p-4 bg-gradient-to-r from-yellow-500/10 to-orange-500/10 rounded-xl border border-yellow-500/20",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 bg-yellow-500/20 rounded-lg",children:e.jsx(ZC,{className:"w-8 h-8 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-white",children:"Operation: First Watch"}),e.jsxs("p",{className:"text-xs text-yellow-200/70",children:["Status: ",e.jsx("span",{className:"text-white font-mono",children:"PENDING"})]})]})]})})]})}];if(!r)return null;const m=d[n];return e.jsxs("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-md transition-opacity duration-500 animate-in fade-in",onClick:i,children:e.jsx("div",{className:"absolute inset-0 opacity-20 bg-[url('https://grainy-gradients.vercel.app/noise.svg')] mix-blend-overlay"})}),e.jsxs("div",{className:"relative w-full max-w-lg bg-[#0f1115] rounded-3xl overflow-hidden shadow-[0_0_100px_rgba(34,211,238,0.15)] animate-in zoom-in-95 duration-500 border border-white/10 flex flex-col min-h-[500px]",children:[e.jsx("div",{className:`absolute top-0 right-0 w-64 h-64 bg-${m.color}-500/10 rounded-full blur-[80px] -mr-10 -mt-10 pointer-events-none transition-colors duration-500`}),e.jsx("div",{className:`absolute bottom-0 left-0 w-64 h-64 bg-${m.color}-600/10 rounded-full blur-[80px] -ml-10 -mb-10 pointer-events-none transition-colors duration-500`}),e.jsx("div",{className:"w-full h-1 bg-gray-800",children:e.jsx("div",{className:`h-full bg-${m.color}-500 transition-all duration-500 ease-out`,style:{width:`${(n+1)/d.length*100}%`}})}),e.jsxs("div",{className:"p-8 flex-1 flex flex-col relative",children:[e.jsxs("div",{className:"flex justify-between items-start mb-8",children:[e.jsx("div",{className:`p-4 bg-${m.color}-500/10 border border-${m.color}-500/20 rounded-2xl`,children:m.icon}),e.jsx("button",{onClick:i,className:"text-gray-500 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-full",children:e.jsx(oa,{className:"w-6 h-6"})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-3xl font-black text-white tracking-tight mb-2 font-display",children:m.title}),e.jsx("h3",{className:`text-${m.color}-400 font-medium mb-6 uppercase tracking-wider text-sm`,children:m.subtitle}),e.jsx("div",{className:"animate-in fade-in slide-in-from-right-4 duration-300 key={currentStep}",children:m.content})]}),e.jsxs("div",{className:"mt-8 flex items-center justify-between pt-6 border-t border-white/5",children:[e.jsx("div",{className:"flex gap-2",children:d.map((u,x)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-all duration-300 ${x===n?`bg-${m.color}-500 w-6`:"bg-gray-700"}`},x))}),e.jsxs("div",{className:"flex gap-3",children:[n>0&&e.jsx("button",{onClick:c,className:"px-4 py-2 text-gray-400 hover:text-white font-medium transition-colors",children:"Back"}),e.jsxs("button",{onClick:o,className:`px-6 py-2.5 bg-gradient-to-r from-${m.color}-600 to-${m.color}-500 hover:brightness-110 text-white font-bold rounded-xl transition-all shadow-[0_0_20px_rgba(0,0,0,0.3)] flex items-center gap-2 group transform active:scale-95`,children:[n===d.length-1?"Initialize System":"Next",n<d.length-1&&e.jsx(Pr,{className:"w-4 h-4 group-hover:translate-x-1 transition-transform"})]})]})]})]})]})]})};function ZC({className:t}){return e.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}const e_=({token:t})=>{const[r,a]=l.useState([]),[n,s]=l.useState(!0),[i,o]=l.useState(null),c=async()=>{try{const m=await fetch(`${Y}/api/feedback`,{headers:{Authorization:`Bearer ${t}`}});m.ok&&a(await m.json())}catch(m){console.error("Error fetching feedbacks:",m)}finally{s(!1)}};l.useEffect(()=>{c()},[t]);const d=async()=>{if(i)try{(await fetch(`${Y}/api/feedback/${i}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})).ok?(a(u=>u.filter(x=>x.id!==i)),z.success("Feedback deleted")):z.error("Failed to delete")}catch(m){console.error(m),z.error("Error deleting feedback")}finally{o(null)}};return n?e.jsx("div",{className:"text-white p-4",children:"Loading feedbacks..."}):e.jsxs("div",{className:"animate-fadeIn space-y-6",children:[e.jsx("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:e.jsxs("h1",{className:"text-2xl font-semibold text-white flex items-center gap-2",children:[e.jsx(si,{className:"text-infosec-accent"})," Feedback & Upgrade Requests"]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:r.length===0?e.jsx("div",{className:"col-span-full text-center text-gray-500 py-10",children:"No feedback messages found."}):r.map(m=>e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-xl p-6 relative group hover:border-gray-700 transition-all",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center text-white font-bold ${m.type==="upgrade"?"bg-gradient-to-br from-yellow-500 to-orange-600":"bg-gradient-to-br from-blue-500 to-indigo-600"}`,children:m.username?m.username.charAt(0).toUpperCase():"U"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-white font-bold text-sm",children:m.username||"Unknown User"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[e.jsx($c,{size:12}),new Date(m.created_at).toLocaleDateString()]})]})]}),e.jsx("span",{className:`text-xs px-2 py-1 rounded border ${m.type==="upgrade"?"bg-yellow-500/10 border-yellow-500/30 text-yellow-400":"bg-blue-500/10 border-blue-500/30 text-blue-400"}`,children:m.type==="upgrade"?"UPGRADE REQUEST":"FEEDBACK"})]}),e.jsxs("p",{className:"text-gray-300 text-sm italic mb-6 leading-relaxed",children:['"',m.message,'"']}),e.jsx("div",{className:"absolute top-4 right-4 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("button",{onClick:()=>o(m.id),className:"text-red-500 hover:text-red-400 bg-red-500/10 hover:bg-red-500/20 p-2 rounded-lg transition-colors",title:"Delete Feedback",children:e.jsx(na,{size:16})})})]},m.id))}),e.jsx(Za,{isOpen:!!i,onClose:()=>o(null),onConfirm:d,title:"Delete Feedback?",message:"Are you sure you want to delete this feedback? This action cannot be undone.",confirmText:"Delete",isDanger:!0})]})},t_=({token:t})=>{var T;const[r,a]=l.useState([]),[n,s]=l.useState(!0),[i,o]=l.useState(!1),[c,d]=l.useState(null),[m,u]=l.useState(null),[x,h]=l.useState(null),[f,g]=l.useState(null),[b,p]=l.useState({title:"",apt_group:"",description:"",story_intro:"",difficulty_level:"intermediate",is_active:!0,is_premium:!0,passing_grade:60,time_limit_hours:null,tags:[],scenario_prompt:"",display_order:0,alert_count:3,generate_with_ai:!0,seo_title:"",seo_description:""});l.useEffect(()=>{v()},[]);const v=async()=>{try{const k=await fetch(`${Y}/api/operations/admin/list`,{headers:{Authorization:`Bearer ${t}`}});if(k.ok){const $=await k.json();a($.operations||[])}else z.error("Failed to load missions")}catch(k){console.error(k),z.error(`Failed to load missions: ${k.message}`)}finally{s(!1)}},y=async()=>{const k={...b};k.generate_with_ai&&(o(!1),P(),z.info("🤖 AI Agent is generating the operation... This will take about 30-60 seconds.",{autoClose:8e3}));try{const $=await fetch(`${Y}/api/operations`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(k)}),C=await $.json();$.ok?(z.success(C.message),k.generate_with_ai||(o(!1),P()),v()):z.error(C.message||"Failed to create mission")}catch($){console.error($),z.error(`Failed to create mission: ${$.message}`)}},j=async()=>{if(c)try{const k=await fetch(`${Y}/api/operations/${c.id}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(b)}),$=await k.json();k.ok?(z.success("Mission updated successfully"),d(null),P(),v()):z.error($.message||"Failed to update mission")}catch(k){console.error(k),z.error("Failed to update mission")}},S=k=>{h(k)},N=async()=>{if(x){try{(await fetch(`${Y}/api/operations/${x}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})).ok?(z.success("Mission deleted"),v()):z.error("Failed to delete mission")}catch(k){console.error(k),z.error("Failed to delete mission")}h(null)}},w=async k=>{try{const $=await fetch(`${Y}/api/operations/admin/${k}/stats`,{headers:{Authorization:`Bearer ${t}`}});if($.ok){const C=await $.json();u({id:k,...C})}}catch($){console.error($),z.error("Failed to load stats")}},_=k=>{p({title:k.title||"",apt_group:k.apt_group||"",description:k.description||"",story_intro:k.story_intro||"",difficulty_level:k.difficulty_level||"intermediate",is_active:k.is_active??!0,is_premium:k.is_premium??!0,passing_grade:k.passing_grade||60,time_limit_hours:k.time_limit_hours||null,tags:k.tags||[],scenario_prompt:k.scenario_prompt||"",display_order:k.display_order||0,alert_count:3,generate_with_ai:!1,seo_title:k.seo_title||k.title||"",seo_description:k.seo_description||k.description||""}),d(k)},P=()=>{p({title:"",apt_group:"",description:"",story_intro:"",difficulty_level:"intermediate",is_active:!0,is_premium:!0,passing_grade:60,time_limit_hours:null,tags:[],scenario_prompt:"",display_order:0,alert_count:3,generate_with_ai:!0,seo_title:"",seo_description:""})},O={novice:"text-green-400 border-green-500/30 bg-green-500/10",beginner:"text-green-400 border-green-500/30 bg-green-500/10",intermediate:"text-amber-400 border-amber-500/30 bg-amber-500/10",advanced:"text-red-400 border-red-500/30 bg-red-500/10",expert:"text-cyan-400 border-cyan-500/30 bg-cyan-500/10"};return n?e.jsx("div",{className:"text-center text-gray-500 py-10",children:"Loading missions..."}):e.jsxs("div",{className:"p-6 pt-20 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:"Missions Management"}),e.jsx("p",{className:"text-gray-400 mt-1",children:"Create and manage narrative campaigns"})]}),e.jsxs("button",{onClick:()=>{P(),o(!0)},className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-purple-600 to-indigo-600 text-white rounded-lg hover:from-purple-500 hover:to-indigo-500 transition-all",children:[e.jsx(oi,{className:"w-5 h-5"}),"Create Mission"]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 overflow-hidden",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#111214] border-b border-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Mission"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Difficulty"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Alerts"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Access"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Stats"}),e.jsx("th",{className:"text-left px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"text-right px-4 py-3 text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800",children:r.map(k=>e.jsxs("tr",{className:"hover:bg-gray-800/30 transition-colors",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-red-500/10 rounded-lg flex items-center justify-center",children:e.jsx(Mt,{className:"w-5 h-5 text-red-500"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:k.title}),e.jsx("div",{className:"text-xs text-gray-500",children:k.apt_group||"No APT Group"})]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`px-2 py-1 text-xs font-bold border rounded ${O[k.difficulty_level]||O.intermediate}`,children:k.difficulty_level||"intermediate"})}),e.jsxs("td",{className:"px-4 py-3 text-gray-400",children:[k.total_alerts||0," alerts"]}),e.jsx("td",{className:"px-4 py-3",children:k.is_premium?e.jsxs("span",{className:"flex items-center gap-1 text-yellow-400 text-xs",children:[e.jsx(Oa,{className:"w-3 h-3"})," Premium"]}):e.jsxs("span",{className:"flex items-center gap-1 text-green-400 text-xs",children:[e.jsx(b1,{className:"w-3 h-3"})," Free"]})}),e.jsxs("td",{className:"px-4 py-3 text-xs text-gray-400",children:[e.jsxs("div",{children:[k.users_started||0," started"]}),e.jsxs("div",{children:[k.users_completed||0," completed"]})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`px-2 py-1 text-xs font-bold rounded ${k.is_active?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:k.is_active?"Active":"Inactive"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>w(k.id),className:"p-1.5 text-gray-400 hover:text-blue-400 transition-colors",title:"View Stats",children:e.jsx(tl,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>_(k),className:"p-1.5 text-gray-400 hover:text-yellow-400 transition-colors",title:"Edit",children:e.jsx(ju,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>S(k.id),className:"p-1.5 text-gray-400 hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(na,{className:"w-4 h-4"})})]})})]},k.id))})]}),r.length===0&&e.jsx("div",{className:"text-center py-10 text-gray-500",children:"No missions found. Create your first mission!"})]}),(i||c)&&Na.createPortal(e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-start justify-center pt-24 pb-8 px-4 bg-black/80 backdrop-blur-sm overflow-y-auto",onClick:()=>{o(!1),d(null),P()},children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 w-full max-w-3xl mb-8",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:c?"Edit Mission":"Create New Mission"}),e.jsx("button",{onClick:()=>{o(!1),d(null),P()},className:"text-gray-400 hover:text-white",children:e.jsx(oa,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Title *"}),e.jsx("input",{type:"text",value:b.title,onChange:k=>p({...b,title:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none",placeholder:"Operation Deep Freeze"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"APT Group"}),e.jsx("input",{type:"text",value:b.apt_group,onChange:k=>p({...b,apt_group:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none",placeholder:"APT29 (Cozy Bear)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Description"}),e.jsx("textarea",{value:b.description,onChange:k=>p({...b,description:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none h-24",placeholder:"Brief description of the operation..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Story Introduction"}),e.jsx("textarea",{value:b.story_intro,onChange:k=>p({...b,story_intro:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none h-24",placeholder:"The narrative hook that introduces the operation..."})]}),e.jsxs("div",{className:"border-t border-gray-800 pt-6",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-400 mb-4 flex items-center gap-2",children:[e.jsx(yr,{className:"w-4 h-4"}),"SEO Settings"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"SEO Title"}),e.jsx("input",{type:"text",value:b.seo_title,onChange:k=>p({...b,seo_title:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none",placeholder:"Page Title for Search Engines"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"SEO Description"}),e.jsx("textarea",{value:b.seo_description,onChange:k=>p({...b,seo_description:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none h-20",placeholder:"Meta description for Search Engines..."})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Difficulty"}),e.jsxs("select",{value:b.difficulty_level,onChange:k=>p({...b,difficulty_level:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none",children:[e.jsx("option",{value:"novice",children:"🟢 Novice (Level 1-2)"}),e.jsx("option",{value:"beginner",children:"🟢 Beginner (Level 3-4)"}),e.jsx("option",{value:"intermediate",children:"🟡 Intermediate (Level 5-6)"}),e.jsx("option",{value:"advanced",children:"🟠 Advanced (Level 7-8)"}),e.jsx("option",{value:"expert",children:"🔴 Expert (Level 9-10)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Passing Grade"}),e.jsx("input",{type:"number",min:"0",max:"100",value:b.passing_grade,onChange:k=>p({...b,passing_grade:parseInt(k.target.value)||60}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Display Order"}),e.jsx("input",{type:"number",min:"0",value:b.display_order,onChange:k=>p({...b,display_order:parseInt(k.target.value)||0}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:b.is_active,onChange:k=>p({...b,is_active:k.target.checked}),className:"w-4 h-4 rounded bg-[#111214] border-gray-700"}),e.jsx("span",{className:"text-sm text-gray-300",children:"Active"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:b.is_premium,onChange:k=>p({...b,is_premium:k.target.checked}),className:"w-4 h-4 rounded bg-[#111214] border-gray-700"}),e.jsx("span",{className:"text-sm text-gray-300",children:"Premium Only"})]})]}),!c&&e.jsxs("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-4",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer mb-4",children:[e.jsx("input",{type:"checkbox",checked:b.generate_with_ai,onChange:k=>p({...b,generate_with_ai:k.target.checked}),className:"w-4 h-4 rounded bg-[#111214] border-gray-700"}),e.jsx(yr,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-sm text-purple-300 font-medium",children:"Generate Alerts with AI"})]}),b.generate_with_ai&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Number of Alerts"}),e.jsx("input",{type:"number",min:"1",max:"10",value:b.alert_count,onChange:k=>p({...b,alert_count:parseInt(k.target.value)||3}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-400 mb-1",children:"Scenario Prompt (optional)"}),e.jsx("textarea",{value:b.scenario_prompt,onChange:k=>p({...b,scenario_prompt:k.target.value}),className:"w-full px-3 py-2 bg-[#111214] border border-gray-700 rounded-lg text-white focus:border-purple-500 focus:outline-none h-20",placeholder:"Custom scenario for AI to generate alerts around..."})]})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>{o(!1),d(null),P()},className:"px-4 py-2 text-gray-400 hover:text-white transition-colors",children:"Cancel"}),e.jsx("button",{onClick:c?j:y,className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-purple-600 to-indigo-600 text-white rounded-lg hover:from-purple-500 hover:to-indigo-500 transition-all",children:b.generate_with_ai&&!c?e.jsxs(e.Fragment,{children:[e.jsx(yr,{className:"w-4 h-4"}),"Create with AI"]}):e.jsxs(e.Fragment,{children:[e.jsx(As,{className:"w-4 h-4"}),c?"Save Changes":"Create Mission"]})})]})]})}),document.body),m&&Na.createPortal(e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-start justify-center pt-24 pb-8 px-4 bg-black/80 backdrop-blur-sm overflow-y-auto",onClick:()=>u(null),children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 w-full max-w-2xl mb-8",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Mission Statistics"}),e.jsx("button",{onClick:()=>u(null),className:"text-gray-400 hover:text-white",children:e.jsx(oa,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#111214] rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-blue-400",children:m.users_started||0}),e.jsx("div",{className:"text-sm text-gray-500",children:"Users Started"})]}),e.jsxs("div",{className:"bg-[#111214] rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-green-400",children:m.users_completed||0}),e.jsx("div",{className:"text-sm text-gray-500",children:"Users Completed"})]})]}),((T=m.alert_stats)==null?void 0:T.length)>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-white mb-3",children:"Per-Alert Statistics"}),e.jsx("div",{className:"space-y-2",children:m.alert_stats.map((k,$)=>e.jsxs("div",{className:"bg-[#111214] rounded-lg p-3 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-medium text-white",children:["Alert ",k.sequence_order,": ",k.alert_title]}),e.jsxs("div",{className:"text-xs text-gray-500",children:[k.users_attempted||0," attempted"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm font-bold text-purple-400",children:[k.avg_grade?Math.round(k.avg_grade):0,"% avg"]}),e.jsxs("div",{className:"text-xs text-green-400",children:[k.users_passed||0," passed"]})]})]},$))})]})]})]})}),document.body),x&&Na.createPortal(e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm",children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-red-500/30 w-full max-w-md p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center border border-red-500/20",children:e.jsx(Sa,{className:"w-6 h-6 text-red-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"Delete Mission?"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"This action cannot be undone."})]})]}),e.jsxs("p",{className:"text-gray-300 mb-6",children:["Are you sure you want to delete this mission? This will permanently remove the mission and",e.jsx("span",{className:"text-red-400 font-bold",children:" all associated alerts and user progress"}),"."]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>h(null),className:"px-4 py-2 rounded-lg bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white transition-colors",children:"Cancel"}),e.jsx("button",{onClick:N,className:"px-4 py-2 rounded-lg bg-red-600 text-white hover:bg-red-700 font-medium transition-colors shadow-lg shadow-red-500/20",children:"Delete Mission"})]})]})}),document.body)]})},r_=()=>{const[t,r]=l.useState([]),[a,n]=l.useState(!0),[s,i]=l.useState(""),[o,c]=l.useState(!1),[d,m]=l.useState(null);l.useEffect(()=>{u()},[]);const u=async()=>{try{const g=localStorage.getItem("token"),p=await(await fetch(`${Y}/api/admin/organizations`,{headers:{Authorization:`Bearer ${g}`}})).json();r(p.organizations||[])}catch(g){console.error("Error fetching organizations:",g)}finally{n(!1)}},x=async g=>{g.preventDefault();try{const b=localStorage.getItem("token");await fetch(`${Y}/api/admin/organizations/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify({name:d.name,license_seats:d.license_seats,plan_type:d.plan_type,is_active:d.is_active})}),c(!1),u()}catch(b){console.error("Error updating org:",b)}},h=t.filter(g=>g.name.toLowerCase().includes(s.toLowerCase())||g.slug.toLowerCase().includes(s.toLowerCase())),f=g=>{const b={team:"bg-blue-500/20 text-blue-400 border-blue-500/30",business:"bg-purple-500/20 text-purple-400 border-purple-500/30",enterprise:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30"};return e.jsx("span",{className:`text-xs px-2 py-0.5 rounded border ${b[g]||b.team}`,children:g==null?void 0:g.toUpperCase()})};return a?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500"})}):e.jsxs("div",{className:"max-w-7xl mx-auto py-6 px-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[e.jsx(as,{className:"w-6 h-6 text-purple-400"}),"Organizations Management"]}),e.jsx("p",{className:"text-gray-400",children:"Manage all B2B enterprise accounts"})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(Jt,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",className:"bg-gray-800 border border-gray-600 rounded-lg pl-10 pr-4 py-2 text-white focus:border-purple-500 focus:outline-none",placeholder:"Search organizations...",value:s,onChange:g=>i(g.target.value)})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-white",children:t.length}),e.jsx("div",{className:"text-gray-400 text-sm",children:"Total Organizations"})]}),e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-green-400",children:t.filter(g=>g.is_active).length}),e.jsx("div",{className:"text-gray-400 text-sm",children:"Active"})]}),e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-purple-400",children:t.reduce((g,b)=>g+(b.used_seats||0),0)}),e.jsx("div",{className:"text-gray-400 text-sm",children:"Total Users"})]}),e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-yellow-400",children:t.filter(g=>g.plan_type==="enterprise").length}),e.jsx("div",{className:"text-gray-400 text-sm",children:"Enterprise Plans"})]})]}),e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl overflow-hidden",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Organization"}),e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Plan"}),e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Seats"}),e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Owner"}),e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Trial Status"}),e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Status"}),e.jsx("th",{className:"text-left py-3 px-4 text-gray-400 font-medium",children:"Created"}),e.jsx("th",{className:"text-right py-3 px-4 text-gray-400 font-medium",children:"Actions"})]})}),e.jsx("tbody",{children:h.map(g=>e.jsxs("tr",{className:"border-t border-gray-700 hover:bg-gray-800/50",children:[e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-purple-600 to-pink-600 rounded-lg flex items-center justify-center",children:g.logo?e.jsx("img",{src:g.logo,alt:"",className:"w-full h-full object-cover rounded-lg"}):e.jsx(as,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-medium",children:g.name}),e.jsx("div",{className:"text-gray-500 text-sm",children:g.slug})]})]})}),e.jsx("td",{className:"py-3 px-4",children:f(g.plan_type)}),e.jsxs("td",{className:"py-3 px-4 text-white",children:[g.used_seats," / ",g.license_seats]}),e.jsxs("td",{className:"py-3 px-4",children:[e.jsx("div",{className:"text-white text-sm",children:g.owner_name||"N/A"}),e.jsx("div",{className:"text-gray-500 text-xs",children:g.owner_email})]}),e.jsx("td",{className:"py-3 px-4",children:g.plan_type==="trial"?e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:`text-xs px-2 py-0.5 rounded border w-fit font-bold ${g.days_remaining>0&&g.trial_status!=="expired"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-red-500/20 text-red-400 border-red-500/30"}`,children:g.days_remaining>0&&g.trial_status!=="expired"?"Active Trial":"Expired"}),g.days_remaining!==null&&e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:g.days_remaining>0&&g.trial_status!=="expired"?`${g.days_remaining} Days Left`:"Access Locked"})]}):e.jsx("span",{className:"text-gray-600 text-xs",children:"-"})}),e.jsx("td",{className:"py-3 px-4",children:e.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${g.is_active?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:g.is_active?"Active":"Inactive"})}),e.jsx("td",{className:"py-3 px-4 text-gray-400 text-sm",children:new Date(g.created_at).toLocaleDateString()}),e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{m(g),c(!0)},className:"text-purple-400 hover:text-purple-300 p-1",title:"Edit",children:e.jsx(Vv,{className:"w-4 h-4"})}),e.jsx("button",{className:"text-blue-400 hover:text-blue-300 p-1",title:"View",children:e.jsx(cs,{className:"w-4 h-4"})})]})})]},g.id))})]}),h.length===0&&e.jsxs("div",{className:"text-center py-12 text-gray-500",children:[e.jsx(as,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{children:"No organizations found"})]})]}),o&&d&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl p-6 w-full max-w-md",children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-4",children:"Edit Organization"}),e.jsxs("form",{onSubmit:x,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-1",children:"Name"}),e.jsx("input",{type:"text",value:d.name,onChange:g=>m({...d,name:g.target.value}),className:"w-full bg-gray-800 border border-gray-600 rounded-lg px-4 py-2 text-white"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-1",children:"License Seats"}),e.jsx("input",{type:"number",value:d.license_seats,onChange:g=>m({...d,license_seats:parseInt(g.target.value)}),className:"w-full bg-gray-800 border border-gray-600 rounded-lg px-4 py-2 text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-1",children:"Plan Type"}),e.jsxs("select",{value:d.plan_type,onChange:g=>m({...d,plan_type:g.target.value}),className:"w-full bg-gray-800 border border-gray-600 rounded-lg px-4 py-2 text-white",children:[e.jsx("option",{value:"team",children:"Team"}),e.jsx("option",{value:"business",children:"Business"}),e.jsx("option",{value:"enterprise",children:"Enterprise"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"is_active",checked:d.is_active,onChange:g=>m({...d,is_active:g.target.checked}),className:"rounded"}),e.jsx("label",{htmlFor:"is_active",className:"text-gray-400",children:"Active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>c(!1),className:"flex-1 bg-gray-700 hover:bg-gray-600 text-white py-2 rounded-lg",children:"Cancel"}),e.jsx("button",{type:"submit",className:"flex-1 bg-purple-600 hover:bg-purple-500 text-white py-2 rounded-lg",children:"Save Changes"})]})]})]})})]})},a_=({text:t,speed:r=25,className:a=""})=>{const[n,s]=l.useState(""),[i,o]=l.useState(!1);return l.useEffect(()=>{s(""),o(!1);let c=0;const d=setInterval(()=>{c<t.length?(s(m=>m+t.charAt(c)),c++):(o(!0),clearInterval(d))},r);return()=>clearInterval(d)},[t,r]),e.jsxs("span",{className:a,children:[n,!i&&e.jsx("span",{className:"animate-pulse inline-block w-2 h-4 bg-infosec-accent align-middle ml-1"})]})},n_=({missionTitle:t,briefingText:r,onComplete:a,onSkip:n})=>{const[s,i]=l.useState(""),[o,c]=l.useState(!0);l.useRef(null),l.useEffect(()=>{let m=0,u;const x=()=>{if(m<r.length){const h=Math.random()*30+10;i(r.substring(0,m+1)),m++,u=setTimeout(x,h)}else c(!1)};return u=setTimeout(x,500),()=>clearTimeout(u)},[r]);const d=()=>{i(r),c(!1)};return e.jsxs(jt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},className:"fixed inset-0 z-[10000] bg-black text-green-500 font-mono flex flex-col items-center justify-center p-8 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-10 bg-[url('https://upload.wikimedia.org/wikipedia/commons/1/1a/Scan_lines.png')] bg-cover z-20"}),e.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-20 bg-gradient-to-b from-transparent to-green-900/10 z-10 animate-pulse"}),e.jsxs("div",{className:"max-w-4xl w-full relative z-30",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-green-900/50 pb-4",children:[e.jsx(xr,{className:"w-12 h-12 text-red-500 animate-pulse"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h1",{className:"text-3xl font-black tracking-[0.2em] uppercase text-white shadow-[0_0_10px_rgba(255,255,255,0.5)]",children:t}),e.jsx("span",{className:"text-xs text-red-500 font-bold tracking-[0.4em] uppercase animate-pulse",children:"/// INCOMING ENCRYPTED TRANSMISSION ///"})]})]}),e.jsx("div",{className:"min-h-[300px] mb-8 relative",children:e.jsxs("p",{className:"text-xl md:text-2xl leading-relaxed whitespace-pre-wrap text-green-400 drop-shadow-[0_0_5px_rgba(0,255,65,0.8)]",children:[s,o&&e.jsx("span",{className:"inline-block w-4 h-8 bg-green-500 ml-1 animate-pulse align-middle"})]})}),e.jsx("div",{className:"flex justify-end items-center gap-6 mt-8",children:o?e.jsx("button",{onClick:d,className:"text-gray-500 text-sm uppercase tracking-widest hover:text-white transition-colors",children:"[ Skip Decryption ]"}):e.jsxs("button",{onClick:a,className:"group flex items-center gap-3 bg-red-600 hover:bg-red-500 text-white px-8 py-4 rounded-sm font-black text-lg uppercase tracking-widest transition-all shadow-[0_0_20px_rgba(220,38,38,0.5)] hover:shadow-[0_0_40px_rgba(220,38,38,0.7)]",children:["Accept Mission ",e.jsx(Pr,{className:"w-6 h-6 group-hover:translate-x-1 transition-transform"})]})})]}),e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-20 text-[10px] text-green-800 pointer-events-none hidden md:block",children:Array(20).fill(0).map((m,u)=>e.jsx("div",{children:Math.random().toString(36).substring(2,15).toUpperCase()},u))}),e.jsx("div",{className:"absolute bottom-0 left-0 p-4 opacity-20 text-[10px] text-green-800 pointer-events-none hidden md:block",children:Array(20).fill(0).map((m,u)=>e.jsx("div",{children:Math.random().toString(16).substring(2,15).toUpperCase()},u))})]})},mx=({token:t,user:r,initialOperationId:a,onClose:n})=>{const[s,i]=l.useState([]),[o,c]=l.useState(!0),[d,m]=l.useState(null),[u,x]=l.useState(null),[h,f]=l.useState(!1);l.useEffect(()=>{g()},[]),l.useEffect(()=>{a&&b(a)},[a]);const g=async()=>{try{const j=await fetch(`${Y}/api/operations`,{headers:{Authorization:`Bearer ${t}`}});if(j.ok){const S=await j.json();i(S.operations)}}catch(j){console.error(j),z.error("Failed to load operations")}finally{c(!1)}},b=async j=>{try{const S=await fetch(`${Y}/api/operations/${j}`,{headers:{Authorization:`Bearer ${t}`}});if(S.ok){const N=await S.json();m(N),f(!0)}else z.error("Failed to load details")}catch(S){console.error(S)}},p=async()=>{if(!(!d||!confirm("Delete this mission?")))try{(await fetch(`${Y}/api/operations/${d.operation.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})).ok?(z.success("Deleted successfully"),m(null),g()):z.error("Failed to delete")}catch{z.error("Delete error")}},v=async()=>{try{const j=await fetch(`${Y}/api/operations/${d.operation.id}/start`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(j.ok){const S=await j.json();z.success("Operation started!"),window.location.href=`/alerts/${S.first_alert_id}?return_to=mission&mission_id=${d.operation.id}`}else{const S=await j.json();j.status===403&&S.required_level?z.error(`🔒 Level ${S.required_level} required! You are Level ${S.user_level}.`):z.error(S.message||"Failed to start")}}catch(j){console.error(j),z.error("Failed to start mission")}},y=(r==null?void 0:r.role)==="admin"||(r==null?void 0:r.role)==="alert-admin";return e.jsxs("div",{className:"container mx-auto px-4 py-8 mt-20",children:[e.jsxs(jt.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.8,ease:"easeOut"},className:"mb-12 text-center",children:[e.jsx("h1",{className:"text-5xl font-bold text-white mb-4 tracking-tight",children:"Narrative Missions"}),e.jsx("p",{className:"text-gray-400 text-lg max-w-3xl mx-auto",children:"Immersive, narrative-driven operations that simulate real-world cyber attacks across the entire killchain. Complete objectives to reveal the next phase."})]}),o?e.jsx("div",{className:"text-center text-gray-500 mt-10",children:"Loading missions..."}):s.length===0?e.jsxs("div",{className:"text-center text-gray-500 mt-10 bg-[#1a1b1e] p-10 rounded-xl border border-gray-800",children:[e.jsx("p",{className:"text-xl mb-2",children:"No missions available yet."}),e.jsx("p",{children:"Check back later for new campaigns!"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 px-4 sm:px-0",children:s.map((j,S)=>{var P,O,T,k;const N=[{color:"violet",bg:"from-violet-500/10 to-purple-900/20",border:"hover:border-violet-500",text:"text-violet-400",button:"bg-violet-600 hover:bg-violet-500",icon:"text-violet-400"},{color:"blue",bg:"from-blue-500/10 to-cyan-900/20",border:"hover:border-blue-500",text:"text-blue-400",button:"bg-blue-600 hover:bg-blue-500",icon:"text-blue-400"},{color:"emerald",bg:"from-emerald-500/10 to-green-900/20",border:"hover:border-emerald-500",text:"text-emerald-400",button:"bg-emerald-600 hover:bg-emerald-500",icon:"text-emerald-400"},{color:"rose",bg:"from-rose-500/10 to-red-900/20",border:"hover:border-rose-500",text:"text-rose-400",button:"bg-rose-600 hover:bg-rose-500",icon:"text-rose-400"},{color:"amber",bg:"from-amber-500/10 to-orange-900/20",border:"hover:border-amber-500",text:"text-amber-400",button:"bg-amber-600 hover:bg-amber-500",icon:"text-amber-400"},{color:"cyan",bg:"from-cyan-500/10 to-sky-900/20",border:"hover:border-cyan-500",text:"text-cyan-400",button:"bg-cyan-600 hover:bg-cyan-500",icon:"text-cyan-400"}],w=(j.id||S)%N.length,_=N[w];return e.jsxs(jt.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-50px"},transition:{duration:.6,delay:S%3*.1},whileHover:{scale:j.is_locked?1:1.02,y:j.is_locked?0:-5},onClick:()=>{if(j.is_locked){z.error(`🔒 Level ${j.min_level} required to access this mission`);return}b(j.id)},className:`bg-[#0f1115] rounded-2xl border border-gray-800/60 overflow-hidden ${j.is_locked?"opacity-60 hover:opacity-80":_.border+" hover:shadow-[0_20px_40px_-10px_rgba(255,255,255,0.05)] hover:-translate-y-1"} transition-all duration-300 group cursor-pointer flex flex-col h-full relative block`,children:[e.jsxs("div",{className:`h-48 overflow-hidden relative bg-gradient-to-br ${_.bg}`,children:[j.image_url?e.jsx("img",{src:j.image_url.startsWith("http")?j.image_url:`${Y}${j.image_url}`,alt:j.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"}):e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)",backgroundSize:"24px 24px"}}),e.jsx("div",{className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-32 h-32 bg-${_.color}-500/20 rounded-full blur-[40px] pointer-events-none`}),e.jsx(Mt,{className:`w-12 h-12 ${_.icon} opacity-80 z-10 group-hover:scale-110 transition-all duration-500`})]}),e.jsxs("div",{className:"absolute top-4 right-4 flex gap-2",children:[j.is_locked&&e.jsxs("span",{className:"bg-gray-800 text-gray-300 text-[10px] font-black tracking-wider uppercase px-2 py-1 rounded shadow-lg border-2 border-gray-600 flex items-center gap-1",children:[e.jsx(Oa,{className:"w-3 h-3"})," Lvl ",j.min_level,"+"]}),j.is_premium?e.jsx("span",{className:"bg-amber-500 text-black text-[10px] font-black tracking-wider uppercase px-2 py-1 rounded shadow-lg border-2 border-amber-400 flex items-center gap-1",children:"Premium"}):e.jsx("span",{className:"bg-emerald-500 text-black text-[10px] font-black tracking-wider uppercase px-2 py-1 rounded shadow-lg border-2 border-emerald-400 flex items-center gap-1",children:"Free"})]})]}),e.jsxs("div",{className:"p-6 flex flex-col flex-grow",children:[e.jsx("h3",{className:`text-xl font-bold text-white mb-2 group-hover:${_.text} transition-colors line-clamp-1`,children:j.title}),e.jsx("p",{className:"text-gray-400 text-sm mb-6 line-clamp-2 flex-grow",children:j.description||"No description available."}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between text-xs mb-1.5",children:[e.jsx("span",{className:"text-gray-500 font-bold uppercase tracking-wider",children:"Progress"}),e.jsxs("span",{className:`font-mono font-bold ${j.status==="completed"?"text-green-500":j.status==="in_progress"?"text-blue-500":"text-gray-500"}`,children:[j.progress_percent||0,"%"]})]}),e.jsx("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${j.status==="completed"?"bg-green-500":j.status==="in_progress"?"bg-blue-500":"bg-gray-700"}`,style:{width:`${j.progress_percent||0}%`}})})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsxs("span",{className:"px-2 py-1 bg-gray-800/50 border border-gray-700 rounded text-[10px] font-bold text-gray-400 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(Mt,{className:"w-3 h-3"}),j.total_alerts||0," Missions"]}),e.jsxs("span",{className:`px-2 py-1 bg-gray-800/50 border rounded text-[10px] font-bold uppercase tracking-wider flex items-center gap-1.5 ${((P=j.difficulty_level)==null?void 0:P.trim().toLowerCase())==="novice"||((O=j.difficulty_level)==null?void 0:O.trim().toLowerCase())==="beginner"?"border-green-500/20 text-green-500":((T=j.difficulty_level)==null?void 0:T.trim().toLowerCase())==="intermediate"?"border-amber-500/20 text-amber-500":((k=j.difficulty_level)==null?void 0:k.trim().toLowerCase())==="advanced"?"border-red-500/20 text-red-500":"border-cyan-500/20 text-cyan-500"}`,children:[e.jsx(xr,{className:"w-3 h-3"}),j.difficulty_level||"Recruit"]})]}),e.jsxs("button",{className:`w-full py-3 rounded-lg font-bold text-sm uppercase tracking-widest transition-all flex items-center justify-center gap-2 group-hover:gap-3 ${j.is_locked?"bg-gray-800 text-gray-500 border border-gray-700 cursor-not-allowed":j.status==="completed"?"bg-green-600/10 text-green-500 border border-green-500/50 hover:bg-green-600 hover:text-white":j.status==="in_progress"?"bg-blue-600 hover:bg-blue-500 text-white shadow-lg shadow-blue-600/20":`${_.button} text-white shadow-lg shadow-${_.color}-600/20`}`,children:[j.is_locked?e.jsxs(e.Fragment,{children:[e.jsx(Oa,{className:"w-4 h-4"})," Level ",j.min_level," Required"]}):j.status==="completed"?"Replay Mission":j.status==="in_progress"?"Resume Mission":"Start Mission",!j.is_locked&&e.jsx(Pr,{className:"w-4 h-4"})]})]})]},j.id)})}),d&&Na.createPortal((()=>{const j=d.alerts.length,S=d.alerts.filter(w=>w.is_completed).length,N=Math.round(S/j*100);return e.jsx("div",{className:"fixed inset-0 z-[9999] flex justify-center items-start p-4 bg-[#0e0f11]/95 backdrop-blur-xl overflow-y-auto",style:{position:"fixed",top:0,left:0,right:0,bottom:0},children:e.jsxs("div",{className:"bg-[#111214] border border-gray-800 rounded-2xl w-full max-w-7xl max-h-[92vh] mt-4 mb-4 flex flex-col shadow-[0_0_100px_rgba(0,0,0,0.9)] overflow-hidden border-t-red-500/50",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center bg-[#1a1b1e]/50 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-red-500/10 rounded-xl flex items-center justify-center border border-red-500/20",children:e.jsx(xr,{className:"w-7 h-7 text-red-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white tracking-tight",children:d.operation.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs("span",{className:"text-[10px] font-bold bg-red-900/30 text-red-400 px-2 py-0.5 rounded border border-red-900/50 uppercase tracking-widest",children:["Target: ",d.operation.apt_group||"Classified"]}),e.jsx("span",{className:"text-gray-500 text-xs",children:"|"}),e.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:["ID: OP-",d.operation.id.toString().padStart(4,"0")]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[y&&e.jsx("button",{onClick:p,className:"text-red-500 hover:text-red-400 text-xs font-bold px-3 py-1.5 bg-red-500/5 rounded-lg border border-red-500/10 hover:border-red-500/30 transition-all uppercase tracking-wider",children:"Terminate Mission"}),e.jsx("button",{onClick:()=>{document.body.style.overflow="",n?n():m(null)},className:"w-10 h-10 flex items-center justify-center rounded-xl bg-gray-800/50 text-gray-400 hover:bg-gray-700 hover:text-white transition-all transform hover:rotate-90",children:"×"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-[600px]",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-0 min-h-full",children:[e.jsxs("div",{className:"lg:col-span-1 border-r border-gray-800 bg-[#0e0f11]/50 p-6 space-y-8",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsx("h4",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:"Mission Completion"}),e.jsxs("span",{className:"text-sm font-mono font-bold text-red-500",children:[N,"%"]})]}),e.jsx("div",{className:"h-2 bg-gray-800 rounded-full overflow-hidden border border-gray-700/50",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-red-600 to-orange-500 shadow-[0_0_10px_rgba(239,68,68,0.3)] transition-all duration-1000 ease-out",style:{width:`${N}%`}})}),e.jsxs("div",{className:"flex justify-between text-[10px] text-gray-600 font-bold uppercase tracking-tighter",children:[e.jsxs("span",{children:[S," neutralized"]}),e.jsxs("span",{children:[j-S," pending"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[e.jsx(dr,{className:"w-4 h-4"}),e.jsx("h3",{className:"text-xs font-bold uppercase tracking-widest",children:"Mission Briefing"})]}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute -inset-1 bg-gradient-to-r from-red-500/10 to-transparent rounded-lg blur opacity-50"}),e.jsxs("div",{className:"relative text-sm text-gray-400 leading-relaxed bg-[#111214] p-4 rounded-lg border border-gray-800/50 group-hover:border-red-500/20 transition-colors font-mono",children:[e.jsx("span",{className:"text-[10px] text-red-500 font-bold block mb-2 uppercase tracking-widest animate-pulse",children:"Incoming Secure Transmission..."}),e.jsx(a_,{text:d.operation.story_intro,speed:20})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-blue-400",children:[e.jsx(Cn,{className:"w-4 h-4"}),e.jsx("h3",{className:"text-[10px] font-black uppercase tracking-[0.2em]",children:"Intelligence Dossiers"})]}),e.jsx("div",{className:"space-y-4",children:d.alerts.some(w=>w.intel_unlocked)?d.alerts.filter(w=>w.intel_unlocked&&w.intel_report_title).map((w,_)=>{var P;return e.jsxs("div",{className:"relative group/dossier",children:[e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-lg p-4 shadow-lg hover:border-blue-500/50 transition-all cursor-pointer overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-16 h-16 bg-blue-500/5 rounded-full blur-2xl"}),e.jsxs("div",{className:"flex items-center gap-3 mb-3 border-b border-gray-800 pb-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500 shadow-[0_0_8px_rgba(59,130,246,0.6)]"}),e.jsx("span",{className:"text-[10px] font-mono font-bold text-blue-400 uppercase tracking-widest",children:w.intel_report_title})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 leading-relaxed font-serif opacity-90",children:[(P=w.intel_report_content)==null?void 0:P.replace(/[#*_`]/g,"").split(`
`).filter(O=>O.trim()).slice(0,2).join(" ").substring(0,150),"..."]}),e.jsx("button",{onClick:()=>x(w),className:"mt-4 w-full py-2 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 text-[10px] font-bold uppercase tracking-widest rounded border border-blue-500/20 transition-all",children:"View Full Dossier"})]}),e.jsx("div",{className:"absolute -bottom-1 -right-1 inset-0 bg-gray-800/20 rounded-lg -z-10 transform rotate-1"})]},_)}):e.jsxs("div",{className:"p-8 text-center border-2 border-dashed border-white/5 rounded-2xl bg-white/[0.02]",children:[e.jsx(Oa,{className:"w-8 h-8 text-gray-800 mx-auto mb-3"}),e.jsxs("p",{className:"text-[10px] text-gray-600 uppercase font-black tracking-[0.2em] leading-loose",children:["Intelligence Restricted",e.jsx("br",{}),e.jsx("span",{className:"opacity-50 text-[8px]",children:"Analyze indicators to decrypt"})]})]})})]})]}),e.jsxs("div",{className:"lg:col-span-2 p-8 bg-[#111214]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wf,{className:"w-5 h-5 text-gray-500"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Kill Chain Timeline"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] font-bold text-gray-600 uppercase",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"})," Neutralized"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-infosec-accent"})," Active"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-700"})," Locked"]})]})]}),e.jsxs("div",{className:"space-y-6 relative",children:[e.jsx("div",{className:"absolute left-[19px] top-4 bottom-4 w-0.5 bg-gray-800 -z-0"}),d.alerts.map((w,_)=>{const P=w.is_accessible&&!w.is_completed;return w.is_accessible,e.jsxs("div",{className:`
                                                        relative flex items-start gap-6 group transition-all duration-500
                                                        ${w.is_completed?"opacity-80 hover:opacity-100":""}
                                                    `,children:[e.jsxs("div",{className:"relative z-10 mt-1",children:[e.jsx("div",{className:`
                                                            w-10 h-10 rounded-xl flex items-center justify-center border-2 transition-all duration-500 transform group-hover:scale-110 shadow-xl
                                                            ${w.is_completed?"bg-green-500 border-green-500 text-black shadow-green-500/20":w.is_accessible?"bg-infosec-accent border-infosec-accent text-black shadow-infosec-accent/20 animate-pulse-slow":"bg-gray-900 border-gray-800 text-gray-600 shadow-none"}
                                                        `,children:w.is_completed?e.jsx(_c,{className:"w-5 h-5"}):w.is_accessible?e.jsx(Mt,{className:"w-5 h-5"}):e.jsx(Oa,{className:"w-4 h-4"})}),P&&e.jsx("div",{className:"absolute -inset-1 bg-infosec-accent rounded-xl blur opacity-25 animate-pulse"})]}),e.jsxs("div",{className:`
                                                        flex-1 p-5 rounded-2xl border transition-all duration-300
                                                        ${w.is_completed?"bg-gray-800/20 border-gray-800/50":w.is_accessible?"bg-[#1a1b1e] border-infosec-accent/30 shadow-[0_4px_20px_rgba(0,255,65,0.05)]":"bg-transparent border-gray-800/30"}
                                                    `,children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsxs("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:["Mission ",_+1]}),w.is_completed&&e.jsxs("span",{className:"text-[10px] font-bold text-green-500 uppercase tracking-widest flex items-center gap-1",children:[e.jsx(_c,{className:"w-3 h-3"})," Objective Met"]})]}),e.jsx("h4",{className:`text-lg font-bold leading-tight ${w.is_accessible?"text-white":"text-gray-600"}`,children:w.is_accessible?w.alert_title:"Restricted Content"})]}),w.is_completed&&w.grade!==null&&e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase font-bold mb-0.5",children:"Rating"}),e.jsxs("div",{className:`text-lg font-mono font-bold ${w.grade>=80?"text-green-500":w.grade>=60?"text-yellow-500":"text-red-500"}`,children:[w.grade,"%"]})]})]}),w.is_accessible?e.jsxs("div",{className:"flex items-center justify-between mt-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(xs,{className:`w-3.5 h-3.5 ${w.severity==="critical"?"text-red-500":w.severity==="high"?"text-orange-500":"text-yellow-500"}`}),e.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest ${w.severity==="critical"?"text-red-500":w.severity==="high"?"text-orange-500":"text-yellow-500"}`,children:w.severity})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500",children:[e.jsx(Uf,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest",children:w.alert_type||"Attack"})]})]}),w.is_completed?e.jsxs("a",{href:`/alerts/${w.alert_id}?return_to=mission&mission_id=${d.operation.id}`,className:"flex items-center gap-2 px-4 py-2 bg-green-500/10 hover:bg-green-500/20 text-green-500 border border-green-500/30 text-xs font-bold rounded-xl transition-all shadow-lg shadow-green-500/5 transform hover:-translate-y-0.5 active:translate-y-0 uppercase tracking-wider",children:[e.jsx(dr,{className:"w-3.5 h-3.5"}),"View Report"]}):e.jsxs("a",{href:`/alerts/${w.alert_id}?return_to=mission&mission_id=${d.operation.id}`,className:"flex items-center gap-2 px-5 py-2 bg-blue-600 hover:bg-blue-500 text-white text-xs font-bold rounded-xl transition-all shadow-lg shadow-blue-600/20 transform hover:-translate-y-0.5 active:translate-y-0",children:[e.jsx(Hf,{className:"w-4 h-4"}),"Engage Target"]})]}):e.jsx("div",{className:"h-10 flex items-center",children:e.jsx("div",{className:"flex gap-1.5",children:[1,2,3].map(O=>e.jsx("div",{className:"w-8 h-1 bg-gray-800/50 rounded-full"},O))})})]})]},w.alert_id)})]})]})]})}),e.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-between items-center bg-[#1a1b1e]/50 flex-shrink-0",children:[e.jsx("div",{className:"flex items-center gap-6",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-widest mb-1",children:"Current Status"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${d.status==="completed"?"bg-green-500 animate-pulse":"bg-blue-500 animate-pulse"}`}),e.jsx("span",{className:`text-sm font-bold uppercase tracking-wider ${d.status==="completed"?"text-green-500":"text-blue-500"}`,children:d.status==="completed"?"Mission Victorious":"Infiltration Active"})]})]})}),d.status==="not_started"?e.jsx("button",{onClick:v,className:"px-10 py-4 bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-500 hover:to-emerald-500 text-white font-black rounded-2xl shadow-xl shadow-green-600/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-3 uppercase tracking-widest text-sm",children:"🚀 Launch Mission"}):d.status==="in_progress"?e.jsx("button",{onClick:()=>{const w=d.alerts.find(_=>_.is_accessible&&!_.is_completed);w&&(window.location.href=`/alerts/${w.alert_id}?return_to=mission&mission_id=${d.operation.id}`)},className:"px-10 py-4 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-black rounded-2xl shadow-xl shadow-blue-600/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-3 uppercase tracking-widest text-sm",children:"🛰️ Resume Infiltration"}):e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-green-500/10 px-6 py-4 rounded-2xl border border-green-500/20",children:[e.jsx("span",{className:"text-2xl",children:"🏆"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] text-green-500 font-black uppercase tracking-widest",children:"Mission Secured"}),e.jsx("span",{className:"text-sm font-bold text-white",children:"Major General Grade Achieved"})]})]}),e.jsxs("button",{onClick:()=>{document.body.style.overflow="",n?n():m(null)},className:"px-6 py-4 bg-gray-800 hover:bg-gray-700 text-white font-bold rounded-2xl shadow-lg border border-gray-700 hover:border-gray-500 transition-all uppercase tracking-widest text-sm flex items-center gap-2",children:[e.jsx(Ec,{className:"w-4 h-4"}),"Return to Dashboard"]})]})]})]})})})(),document.body),h&&d&&e.jsx(n_,{missionTitle:d.operation.title,briefingText:d.operation.story_intro||"No briefing available.",onComplete:()=>f(!1),onSkip:()=>f(!1)}),u&&Na.createPortal(e.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center p-4 bg-black/95 backdrop-blur-3xl animate-in fade-in zoom-in duration-300",onClick:()=>x(null),children:e.jsxs("div",{className:"bg-[#f0f0f0] text-black w-full max-w-4xl max-h-[90vh] flex flex-col shadow-[0_0_100px_rgba(59,130,246,0.3)] border-[12px] border-[#d1d1d1] rounded-sm transform -rotate-1",onClick:j=>j.stopPropagation(),children:[e.jsxs("div",{className:"p-8 border-b-4 border-black/10 bg-[#e6e6e6] flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-black uppercase tracking-[0.3em] text-red-600 mb-2",children:"TOP SECRET // NOFORN"}),e.jsx("h2",{className:"text-4xl font-black uppercase tracking-tighter font-serif",children:u.intel_report_title}),e.jsxs("div",{className:"flex gap-4 mt-4 font-mono text-xs opacity-60",children:[e.jsx("span",{children:"REF: ISR-2025-AX9"}),e.jsxs("span",{children:["DATE: ",new Date().toLocaleDateString()]}),e.jsx("span",{children:"TYPE: THREAT INTEL"})]})]}),e.jsx("button",{onClick:()=>x(null),className:"px-4 py-2 border-2 border-black font-black hover:bg-black hover:text-white transition-colors uppercase text-xs",children:"Close File"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-12 font-serif text-lg leading-relaxed bg-[url('https://www.transparenttextures.com/patterns/paper-fibers.png')]",children:e.jsxs("div",{className:"max-w-2xl mx-auto space-y-8 opacity-90",children:[e.jsx("div",{className:"flex justify-center mb-12",children:e.jsx("div",{className:"border-4 border-black p-4 inline-block text-red-600 font-black text-2xl uppercase tracking-[0.5em] transform -rotate-12 border-double",children:"DECLASSIFIED"})}),e.jsx("div",{className:"prose prose-invert max-w-none prose-headings:text-black prose-headings:font-black prose-headings:uppercase prose-headings:tracking-wider prose-p:text-gray-800 prose-strong:text-black prose-li:text-gray-800 prose-li:marker:text-black",children:e.jsx(no,{children:u.intel_report_content})}),e.jsx("div",{className:"pt-12 border-t-2 border-black/10 mt-12",children:e.jsx("div",{className:"text-sm font-mono opacity-50 italic",children:"End of Intelligence Briefing. Destroy this document after reading."})})]})})]})}),document.body)]})},s_=({feedbacks:t,setView:r,setTargetAlertId:a})=>{const n=s=>{a&&r&&(a(s),r("closed"))};return e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:[e.jsx("div",{className:"flex justify-between items-center mb-6",children:e.jsxs("h1",{className:"text-2xl font-semibold text-white flex items-center gap-2",children:[e.jsx(si,{className:"text-infosec-accent"})," My Mentor Feedback"]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:t&&t.length>0?t.map(s=>e.jsxs("div",{onClick:()=>n(s.id),className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 cursor-pointer hover:border-gray-600 hover:bg-[#25262b] transition-all group shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 text-xs block mb-1",children:new Date(s.created_at||s.updated_at).toLocaleString()}),e.jsx("h4",{className:"text-white font-bold text-base group-hover:text-infosec-accent transition-colors",children:s.alert_title||"Alert Feedback"})]}),e.jsxs("div",{className:`flex items-center gap-1 px-3 py-1 rounded-full text-sm font-bold ${s.grade>=70?"bg-green-500/10 text-green-400 border border-green-500/20":"bg-yellow-500/10 text-yellow-400 border border-yellow-500/20"}`,children:[e.jsx(hf,{className:"w-3 h-3 fill-current"}),s.grade,"/100"]})]}),e.jsx("div",{className:"bg-[#0e0f11] p-4 rounded-lg border border-gray-800/50 mb-4",children:e.jsxs("p",{className:"text-gray-300 text-sm italic whitespace-pre-wrap leading-relaxed",children:['"',s.feedback,'"']})}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("span",{className:"text-xs text-infosec-accent font-bold group-hover:underline flex items-center gap-1",children:["View Alert Details ",e.jsx(ds,{className:"w-3 h-3"})]})})]},s.id)):e.jsxs("div",{className:"col-span-full text-center py-12 bg-[#1a1b1e] rounded-xl border border-gray-800",children:[e.jsx(si,{className:"w-12 h-12 text-gray-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-400 text-lg",children:"No feedback received yet."}),e.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"Complete alerts to receive feedback from mentors."})]})})]})},i_=({token:t,onRunComplete:r})=>{const[a,n]=l.useState(null),[s,i]=l.useState(!1),[o,c]=l.useState("auto"),[d,m]=l.useState([]),[u,x]=l.useState(!1),[h,f]=l.useState(""),[g,b]=l.useState(""),[p,v]=l.useState({blog_auto_pilot_enabled:"false",blog_auto_pilot_time:"09:00",blog_auto_pilot_last_run:"N/A"}),[y,j]=l.useState({isOpen:!1,title:"",message:"",onConfirm:null});l.useEffect(()=>{w(),S();const D=setInterval(w,5e3);return()=>clearInterval(D)},[t]);const S=async()=>{try{const D=await fetch(`${Y}/api/blog/automation/settings`,{headers:{Authorization:`Bearer ${t}`}});D.ok&&v(await D.json())}catch(D){console.error("Error fetching settings:",D)}},N=async(D,q)=>{try{(await fetch(`${Y}/api/blog/automation/settings`,{method:"PUT",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({settings:{[D]:q}})})).ok&&(v(de=>({...de,[D]:q})),z.success("Strategy Updated"))}catch{z.error("Failed to update setting")}},w=async()=>{try{const D=await fetch(`${Y}/api/blog/automation/status`,{headers:{Authorization:`Bearer ${t}`}});if(D.ok){const q=await D.json();n(q)}}catch(D){console.error("Error fetching status:",D)}},_=(D,q,Q)=>{j({isOpen:!0,title:D,message:q,onConfirm:Q})},P=()=>{j(D=>({...D,isOpen:!1}))},O=async()=>{y.onConfirm&&await y.onConfirm(),P()},T=()=>{_("Start Auto-Pilot?","This will immediately scan for new topics and generate a blog post if a good candidate is found.",()=>A("/api/blog/automation/trigger",{}))},k=async()=>{x(!0);try{const D=await fetch(`${Y}/api/blog/automation/trending`,{headers:{Authorization:`Bearer ${t}`}});D.ok?m(await D.json()):z.error("Failed to fetch trending topics")}catch{z.error("Network error fetching trends")}finally{x(!1)}},$=D=>{_("Generate from Trending Topic?",`Topic: "${D.title}"

System will generate a full blog post based on this news item.`,()=>A("/api/blog/automation/create-from-title",D))},C=()=>{if(!h)return z.warning("Please enter a topic");_("Generate Custom Post?",`Topic: "${h}"

System will generate a blog post based on your custom prompt.`,()=>A("/api/blog/automation/create-custom",{topic:h,details:g}))},A=async(D,q)=>{try{n(de=>({...de,status:"running",message:"Initiating..."})),(await fetch(`${Y}${D}`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(q)})).ok?z.success("Automation Started!"):z.error("Failed to start automation")}catch{z.error("Error triggering automation")}},E=(a==null?void 0:a.status)==="running",L=D=>D==="running"?"text-yellow-400":D==="error"?"text-red-400":"text-green-400",F=({isOpen:D,onClose:q,title:Q,message:de,onConfirm:H})=>D?An.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm",onClick:q}),e.jsxs("div",{className:"bg-[#25262b] border border-gray-700 rounded-xl p-6 max-w-md w-full shadow-2xl relative z-10 animate-in fade-in zoom-in duration-200",children:[e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:Q}),e.jsx("div",{className:"text-gray-400 mb-6 whitespace-pre-wrap",children:de}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:q,className:"px-4 py-2 text-gray-400 hover:text-white font-bold transition-colors",children:"Cancel"}),e.jsx("button",{onClick:H,className:"px-6 py-2 bg-purple-600 hover:bg-purple-500 text-white rounded-lg font-bold shadow-lg transition-all transform hover:scale-105",children:"Yes, Proceed"})]})]})]}),document.body):null;return e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 mb-8 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-purple-600/5 rounded-full blur-3xl -mr-16 -mt-16 pointer-events-none"}),e.jsxs("div",{className:"p-6 border-b border-gray-800 flex flex-col md:flex-row justify-between items-start md:items-center relative z-10",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-2",children:["🤖 AI Blog Automation",E&&e.jsxs("span",{className:"relative flex h-3 w-3",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-yellow-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-yellow-500"})]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm",children:[e.jsxs("span",{className:"text-gray-400",children:["Status:",e.jsx("span",{className:`ml-2 font-bold uppercase ${L((a==null?void 0:a.status)==="idle"?a==null?void 0:a.lastRunStatus:a==null?void 0:a.status)}`,children:(a==null?void 0:a.status)==="running"?"RUNNING...":(a==null?void 0:a.lastRunStatus)||"IDLE"})]}),(a==null?void 0:a.message)&&e.jsxs("span",{className:"text-gray-500 italic truncate max-w-[300px]",children:['"',a.message,'"']})]})]}),e.jsxs("div",{className:"flex bg-gray-900/50 p-1 rounded-lg mt-4 md:mt-0",children:[e.jsx("button",{onClick:()=>c("auto"),className:`px-4 py-2 rounded-md text-sm font-bold transition-all ${o==="auto"?"bg-purple-600 text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:"Auto Mode"}),e.jsx("button",{onClick:()=>{c("trending"),k()},className:`px-4 py-2 rounded-md text-sm font-bold transition-all ${o==="trending"?"bg-purple-600 text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:"Trending"}),e.jsx("button",{onClick:()=>c("custom"),className:`px-4 py-2 rounded-md text-sm font-bold transition-all ${o==="custom"?"bg-purple-600 text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:"Custom"})]})]}),e.jsxs("div",{className:"p-6 relative z-10 min-h-[150px]",children:[o==="auto"&&e.jsxs("div",{className:"flex flex-col items-center justify-center text-center py-4",children:[e.jsxs("div",{className:"bg-gray-900/30 border border-gray-800 rounded-xl p-6 mb-8 w-full max-w-2xl flex flex-col md:flex-row items-center justify-between gap-6",children:[e.jsxs("div",{className:"text-left",children:[e.jsxs("h4",{className:"text-white font-bold flex items-center gap-2",children:["🚀 Auto-Pilot Schedule",e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full ${p.blog_auto_pilot_enabled==="true"?"bg-green-500/20 text-green-400":"bg-gray-700 text-gray-500"}`,children:p.blog_auto_pilot_enabled==="true"?"ACTIVE":"DISABLED"})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"Automatic discovery runs every morning at 09:00 AM."}),e.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Last Run: ",e.jsx("span",{className:"text-gray-300 font-mono",children:p.blog_auto_pilot_last_run||"Never"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-bold text-gray-500 uppercase tracking-widest",children:p.blog_auto_pilot_enabled==="true"?"On":"Off"}),e.jsx("button",{onClick:()=>N("blog_auto_pilot_enabled",p.blog_auto_pilot_enabled==="true"?"false":"true"),className:`relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${p.blog_auto_pilot_enabled==="true"?"bg-purple-600":"bg-gray-700"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${p.blog_auto_pilot_enabled==="true"?"translate-x-5":"translate-x-0"}`})})]})]}),e.jsx("p",{className:"text-gray-400 mb-6 max-w-lg",children:"Or trigger an immediate manual scan. System will find high-impact news, filter duplicates, and draft a professional report."}),e.jsx("button",{onClick:T,disabled:E,className:`
                                px-8 py-4 rounded-xl font-bold text-white shadow-lg transition-all flex items-center gap-3 text-lg
                                ${E?"bg-gray-700 cursor-not-allowed opacity-50":"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-500 hover:to-blue-500 hover:shadow-purple-500/20 hover:scale-105"}
                            `,children:E?"Automation Running...":"⚡ Trigger Manual Run Now"})]}),o==="trending"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h4",{className:"text-white font-bold",children:"Top Trending Topics (Last 48h)"}),e.jsxs("button",{onClick:k,className:"text-xs text-blue-400 hover:text-blue-300 flex items-center gap-1",children:[e.jsx("svg",{className:`w-4 h-4 ${u?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]})]}),u?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(D=>e.jsx("div",{className:"h-16 bg-gray-800/50 rounded-lg animate-pulse"},D))}):e.jsx("div",{className:"grid gap-3",children:d.length>0?d.map((D,q)=>e.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 p-4 rounded-lg flex justify-between items-center group hover:border-purple-500/50 transition-colors",children:[e.jsxs("div",{children:[e.jsx("h5",{className:"text-white font-medium group-hover:text-purple-400 transition-colors",children:D.title}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[D.source," • Score: ",Math.round(Math.random()*10)+5]})]}),e.jsx("button",{onClick:()=>$(D),disabled:E,className:"px-4 py-2 bg-gray-800 hover:bg-purple-600 text-white text-sm rounded-lg transition-all ml-4 whitespace-nowrap",children:"Generate This"})]},q)):e.jsx("p",{className:"text-gray-500 italic text-center py-4",children:"No new topics found. Try Auto Mode or Custom."})})]}),o==="custom"&&e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Topic / Title"}),e.jsx("input",{type:"text",value:h,onChange:D=>f(D.target.value),className:"w-full bg-black/30 border border-gray-700 rounded p-3 text-white focus:border-purple-500 outline-none",placeholder:"e.g. The Risks of AI in Custom Banking Applications"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Context & Details (Optional)"}),e.jsx("textarea",{value:g,onChange:D=>b(D.target.value),className:"w-full bg-black/30 border border-gray-700 rounded p-3 text-white focus:border-purple-500 outline-none h-24",placeholder:"Provide key points, specific angles, or source URLs you want the AI to cover..."})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsxs("button",{onClick:C,disabled:E||!h,className:"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-500 hover:to-blue-500 text-white px-8 py-3 rounded-xl font-bold shadow-lg disabled:opacity-50 transition-all flex items-center gap-2",children:[E?e.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):"⚡","Generate Custom Post"]})})]})})]}),e.jsx(F,{isOpen:y.isOpen,onClose:P,title:y.title,message:y.message,onConfirm:O})]})},o_=({token:t})=>{const[r,a]=l.useState([]),[n,s]=l.useState(!0),[i,o]=l.useState(!1),[c,d]=l.useState(!1),[m,u]=l.useState("create"),[x,h]=l.useState(null),[f,g]=l.useState({title:"",slug:"",status:"draft",category:"",created_at:"",excerpt:"",content:"",featured_image:"",featured_image_alt:"",seo_title:"",seo_description:"",focus_keyword:""}),[b,p]=l.useState(!1),[v,y]=l.useState(!1),[j,S]=l.useState([]);l.useEffect(()=>{N()},[]);const N=async()=>{try{const $=await fetch(`${Y}/api/blog/admin/all`,{headers:{Authorization:`Bearer ${t}`}});$.ok&&a(await $.json())}catch($){console.error("Error fetching admin posts:",$)}finally{s(!1)}},w=async()=>{try{const $=await fetch(`${Y}/api/blog/categories`,{headers:{Authorization:`Bearer ${t}`}});$.ok&&S(await $.json())}catch($){console.error("Error fetching categories:",$)}},_=async $=>{if(confirm("Are you sure you want to delete this post?"))try{(await fetch(`${Y}/api/blog/${$}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})).ok?(z.success("Post deleted"),a(r.filter(A=>A.id!==$))):z.error("Delete failed")}catch{z.error("Delete failed")}},P=()=>{u("create"),h(null);const $=new Date;$.setMinutes($.getMinutes()-$.getTimezoneOffset());const C=$.toISOString().slice(0,16);g({title:"",slug:"",status:"draft",category:"",created_at:C,excerpt:"",content:"",featured_image:"",featured_image_alt:"",seo_title:"",seo_description:"",focus_keyword:""}),w(),d(!0)},O=async $=>{u("edit"),h($);try{const C=await fetch(`${Y}/api/blog/${$}`,{headers:{Authorization:`Bearer ${t}`}});if(C.ok){const A=await C.json();let E="";if(A.created_at){const L=new Date(A.created_at);L.setMinutes(L.getMinutes()-L.getTimezoneOffset()),E=L.toISOString().slice(0,16)}g({title:A.title,slug:A.slug,status:A.status,category:A.category||"",created_at:E,excerpt:A.excerpt||"",content:A.content||"",featured_image:A.featured_image||"",featured_image_alt:A.featured_image_alt||"",seo_title:A.seo_title||"",seo_description:A.seo_description||"",focus_keyword:A.focus_keyword||""}),w(),d(!0)}}catch{z.error("Failed to load post")}},T=async($,C="featured_image")=>{const A=$.target.files[0];if(!A)return;const E=new FormData;E.append("image",A),p(!0);try{const L=await fetch(`${Y}/api/blog/upload`,{method:"POST",headers:{Authorization:`Bearer ${t}`},body:E}),F=await L.json();if(L.ok){if(C==="featured_image")g({...f,featured_image:F.url}),z.success("Featured image uploaded");else if(C==="content"){const D=`![Image](${F.url})
`;g(q=>({...q,content:q.content+`
`+D})),z.success("Image inserted into content")}}else z.error(F.message||"Upload failed")}catch(L){console.error(L),z.error("Upload Error")}finally{p(!1)}},k=async $=>{$.preventDefault();const C=m==="create"?`${Y}/api/blog`:`${Y}/api/blog/${x}`,A=m==="create"?"POST":"PUT";try{(await fetch(C,{method:A,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(f)})).ok?(z.success(`Post ${m==="create"?"created":"updated"}!`),d(!1),N()):z.error("Save failed")}catch(E){console.error(E),z.error("Save Error")}};return e.jsxs("div",{className:"animate-fadeIn relative",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:"Content Management"}),e.jsx("p",{className:"text-gray-400",children:"Manage blog posts and articles."})]}),e.jsxs("button",{onClick:P,className:"flex items-center gap-2 bg-blue-600 hover:bg-blue-500 text-white px-6 py-3 rounded-lg font-bold transition-all",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 4v16m8-8H4"})}),"Create Post"]})]}),e.jsx(i_,{token:t,onRunComplete:N}),e.jsx("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{className:"bg-[#25262b] text-gray-400 uppercase text-xs font-bold",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4",children:"Title"}),e.jsx("th",{className:"px-6 py-4",children:"Status"}),e.jsx("th",{className:"px-6 py-4",children:"Publish Date"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800 text-gray-300",children:r.length>0?r.map($=>e.jsxs("tr",{className:"hover:bg-gray-800/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 font-medium text-white",children:$.title}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-bold ${$.status==="published"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:$.status})}),e.jsx("td",{className:"px-6 py-4 text-sm text-gray-500",children:new Date($.created_at).toLocaleString()}),e.jsxs("td",{className:"px-6 py-4 text-right flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>O($.id),className:"text-blue-400 hover:text-blue-300 text-sm font-bold",children:"Edit"}),e.jsx("button",{onClick:()=>_($.id),className:"text-red-400 hover:text-red-300 text-sm font-bold",children:"Delete"})]})]},$.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:"4",className:"px-6 py-8 text-center text-gray-500 italic",children:"No posts found. Create one or import!"})})})]})})}),c&&Na.createPortal(e.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-start justify-center z-[9999] p-4 overflow-y-auto",style:{top:0,left:0,right:0,bottom:0},children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-700 rounded-xl w-full max-w-4xl flex flex-col my-8",style:{maxHeight:"calc(100vh - 64px)"},children:[e.jsxs("div",{className:"p-6 border-b border-gray-700 flex justify-between items-center bg-[#25262b]",children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:m==="create"?"Create New Post":"Edit Post"}),e.jsx("button",{onClick:()=>d(!1),className:"text-gray-400 hover:text-white",children:e.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-6 overflow-y-auto space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold",children:"Title"}),e.jsx("button",{type:"button",onClick:async()=>{if(!f.content||f.content.length<50)return z.warning("Please write some content first!");try{const $=await fetch(`${Y}/api/blog/generate-title`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({content:f.content})}),C=await $.json();if($.ok&&C.titles){const A=prompt(`Choose a title (enter number 1-5):

${C.titles.map((E,L)=>`${L+1}. ${E}`).join(`
`)}`);A&&C.titles[A-1]&&(g(E=>({...E,title:C.titles[A-1]})),z.success("Title updated!"))}else z.error("Failed to generate titles")}catch{z.error("Error generating titles")}},className:"text-xs bg-purple-600 hover:bg-purple-500 text-white px-2 py-1 rounded flex items-center gap-1 transition-colors",children:"✨ AI Generate"})]}),e.jsx("input",{type:"text",value:f.title,onChange:$=>g({...f,title:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none",placeholder:"Enter post title"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Slug (URL)"}),e.jsx("input",{type:"text",value:f.slug,onChange:$=>g({...f,slug:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none",placeholder:"auto-generated-if-empty"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Status"}),e.jsxs("select",{value:f.status,onChange:$=>g({...f,status:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none",children:[e.jsx("option",{value:"draft",children:"Draft"}),e.jsx("option",{value:"published",children:"Published"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Category"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("select",{value:j.includes(f.category)?f.category:f.category?"custom":"",onChange:$=>{const C=$.target.value;g(C==="custom"?{...f,category:""}:{...f,category:C})},className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none",children:[e.jsx("option",{value:"",children:"Select Category..."}),j.map(($,C)=>e.jsx("option",{value:$,children:$},C)),e.jsx("option",{value:"custom",children:"+ Add New Category..."})]}),(!j.includes(f.category)||f.category==="")&&e.jsx("input",{type:"text",value:f.category,onChange:$=>g({...f,category:$.target.value}),className:"w-full bg-[#131416] border border-purple-900/50 rounded p-3 text-white focus:border-purple-500 outline-none animate-in fade-in slide-in-from-top-1 duration-200",placeholder:"Enter new category name..."})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Publish Date & Time"}),e.jsx("input",{type:"datetime-local",value:f.created_at,onChange:$=>g({...f,created_at:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Featured Image"}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("input",{type:"text",value:f.featured_image,onChange:$=>g({...f,featured_image:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none mb-2",placeholder:"https://..."}),e.jsxs("label",{className:"inline-block bg-gray-800 hover:bg-gray-700 text-white text-sm px-4 py-2 rounded cursor-pointer transition-colors",children:[b?"Uploading...":"Upload File",e.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:$=>T($,"featured_image"),disabled:b})]})]}),f.featured_image&&e.jsx("img",{src:f.featured_image,alt:f.featured_image_alt||"Preview",className:"w-32 h-24 object-cover rounded border border-gray-700"})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"block text-gray-400 text-xs font-medium mb-1",children:["Image Alt Text (SEO)",e.jsx("span",{className:"text-gray-600 ml-2",children:"• Auto-generated with AI SEO"})]}),e.jsx("input",{type:"text",value:f.featured_image_alt,onChange:$=>g({...f,featured_image_alt:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-2 text-sm text-white focus:border-blue-500 outline-none",placeholder:"Descriptive alt text for the image..."})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Excerpt (Short Summary)"}),e.jsx("textarea",{value:f.excerpt,onChange:$=>g({...f,excerpt:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none h-20",placeholder:"Brief description for search engines and lists..."})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold",children:"Content (Markdown Supported)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:async()=>{if(!f.content)return z.warning("Please write some content first");if(!confirm("This will reformat your content using AI. It might change the wording. Continue?"))return;const $=z.loading("Enhancing content...");try{const C=await fetch(`${Y}/api/blog/enhance-content`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({content:f.content})}),A=await C.json();C.ok&&A.content?(g(E=>({...E,content:A.content})),z.update($,{render:"Content Enhanced!",type:"success",isLoading:!1,autoClose:3e3})):z.update($,{render:"Failed to enhance",type:"error",isLoading:!1,autoClose:3e3})}catch(C){console.error(C),z.update($,{render:"Error enhancing content",type:"error",isLoading:!1,autoClose:3e3})}},className:"bg-purple-600 hover:bg-purple-500 text-white text-xs px-3 py-1 rounded flex items-center gap-2 transition-colors",children:"✨ Auto-Format with AI"}),e.jsxs("label",{className:"bg-gray-800 hover:bg-gray-700 text-white text-xs px-3 py-1 rounded cursor-pointer flex items-center gap-2 transition-colors",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),"Insert Image",e.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:$=>T($,"content"),disabled:b})]})]})]}),e.jsx("textarea",{value:f.content,onChange:$=>g({...f,content:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none h-64 font-mono text-sm",placeholder:"# My Awesome Post..."})]}),e.jsxs("div",{className:"border-t border-gray-700 pt-6 mt-6",children:[e.jsxs("h3",{className:"text-xl font-bold text-white mb-4 flex items-center justify-between",children:["SEO Settings",e.jsx("button",{type:"button",onClick:async()=>{if(!f.title&&!f.content)return z.warning("Please enter a title or content first");y(!0);try{const $=await fetch(`${Y}/api/blog/generate-seo`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({title:f.title,content:f.content})}),C=await $.json();$.ok?(g(A=>({...A,seo_title:C.seo_title,seo_description:C.seo_description,focus_keyword:C.focus_keyword,featured_image_alt:C.image_alt||A.featured_image_alt})),z.success("SEO Metadata Generated!")):z.error(C.message||"Generation failed")}catch($){console.error("SEO Gen Error:",$),z.error("Failed to generate SEO")}finally{y(!1)}},disabled:v,className:"bg-purple-600 hover:bg-purple-500 text-white text-sm px-4 py-2 rounded-lg flex items-center gap-2 disabled:opacity-50 transition-all",children:v?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Generate with AI"]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:["SEO Title",e.jsxs("span",{className:`text-xs ml-2 font-normal ${f.seo_title.length>60?"text-red-400":"text-gray-500"}`,children:["(",f.seo_title.length,"/60)"]})]}),e.jsx("input",{type:"text",value:f.seo_title,onChange:$=>g({...f,seo_title:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none",placeholder:"Optimized title for search engines"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:["Meta Description",e.jsxs("span",{className:`text-xs ml-2 font-normal ${f.seo_description.length>160?"text-red-400":"text-gray-500"}`,children:["(",f.seo_description.length,"/160)"]})]}),e.jsx("textarea",{value:f.seo_description,onChange:$=>g({...f,seo_description:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none h-24",placeholder:"Compelling description for search results"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Focus Keyword"}),e.jsx("input",{type:"text",value:f.focus_keyword,onChange:$=>g({...f,focus_keyword:$.target.value}),className:"w-full bg-[#131416] border border-gray-700 rounded p-3 text-white focus:border-blue-500 outline-none",placeholder:"Primary keyword target"})]})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-gray-700 bg-[#25262b] flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>d(!1),className:"px-6 py-2 text-gray-400 hover:text-white font-bold transition-colors",children:"Cancel"}),e.jsx("button",{onClick:k,disabled:b,className:"bg-infosec-accent hover:bg-infosec-accentHover text-white px-8 py-2 rounded font-bold transition-colors disabled:opacity-50",children:b?"Uploading...":"Save Post"})]})]})}),document.body)]})},l_=()=>{var A;const[t,r]=l.useState([]),[a,n]=l.useState(null),[s,i]=l.useState(!0),[o,c]=l.useState([]),[d,m]=l.useState(1),[u,x]=l.useState(""),[h,f]=l.useState(!1),[g,b]=l.useState(1),[p,v]=l.useState(25),[y,j]=l.useState(0),[S,N]=l.useState({pathCode:"",untaggedOnly:!1}),w=[{value:"SIEM",label:"SIEM Analyst",icon:"📊"},{value:"EDR",label:"Endpoint Detection",icon:"💻"},{value:"NDR",label:"Network Detection",icon:"🌐"},{value:"TI",label:"Threat Intelligence",icon:"🔍"},{value:"IR",label:"Incident Response",icon:"🚨"},{value:"MAL",label:"Malware Analysis",icon:"🦠"},{value:"DLP",label:"Data Loss Prevention",icon:"🔒"},{value:"CLOUD",label:"Cloud Security",icon:"☁️"},{value:"CORE",label:"Core/General",icon:"🎯"}],_=[1,2,3,4,5,6,7,8,9,10];l.useEffect(()=>{P(),O()},[S,g,p]);const P=async()=>{try{i(!0);const E=localStorage.getItem("token");let L=`${Y}/api/alerts?page=${g}&limit=${p}`;S.pathCode&&(L+=`&path_code=${S.pathCode}`),S.untaggedOnly&&(L+="&untagged=true");const D=(await Ca.get(L,{headers:{Authorization:`Bearer ${E}`}})).data;Array.isArray(D)?(r(D),j(D.length)):(r(D.alerts||[]),j(D.total||0))}catch(E){console.error("Error fetching alerts:",E),z.error("Failed to load alerts")}finally{i(!1)}},O=async()=>{try{const E=localStorage.getItem("token"),L=await Ca.get(`${Y}/api/alerts/path-stats`,{headers:{Authorization:`Bearer ${E}`}});n(L.data)}catch(E){console.error("Error fetching path stats:",E)}},T=E=>{c(L=>L.includes(E)?L.filter(F=>F!==E):[...L,E])},k=()=>{o.length===t.length?c([]):c(t.map(E=>E.id))},$=async()=>{if(o.length===0){z.warning("Please select at least one alert");return}try{f(!0);const E=localStorage.getItem("token");await Ca.post(`${Y}/api/alerts/bulk-tag`,{alertIds:o,min_level:d,path_code:u||null},{headers:{Authorization:`Bearer ${E}`}}),z.success(`Tagged ${o.length} alerts`),c([]),P(),O()}catch(E){console.error("Error bulk tagging:",E),z.error("Failed to tag alerts")}finally{f(!1)}},C=E=>{const L=w.find(F=>F.value===E);return L?`${L.icon} ${L.label}`:E||"Untagged"};return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[e.jsx(zj,{className:"text-purple-400"}),"Content Tagging"]})}),a&&e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-white/10 p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(tl,{className:"w-5 h-5 text-purple-400"}),"Path Distribution"]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:(A=a.pathTotals)==null?void 0:A.map((E,L)=>e.jsxs("div",{className:`p-3 rounded-lg border cursor-pointer transition-all ${S.pathCode===E.path_code?"bg-purple-500/20 border-purple-500":"bg-white/5 border-white/10 hover:border-white/20"}`,onClick:()=>N(F=>({...F,pathCode:F.pathCode===E.path_code?"":E.path_code,untaggedOnly:!1})),children:[e.jsx("div",{className:"text-2xl font-bold text-white",children:E.total}),e.jsx("div",{className:"text-sm text-gray-400",children:C(E.path_code)})]},L))})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-white/10 p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(tu,{className:"w-5 h-5 text-purple-400"}),"Bulk Tag Selected (",o.length,")"]}),e.jsxs("div",{className:"flex flex-wrap gap-4 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:"Min Level"}),e.jsx("select",{value:d,onChange:E=>m(parseInt(E.target.value)),className:"bg-black/30 border border-white/20 rounded-lg px-3 py-2 text-white",children:_.map(E=>e.jsxs("option",{value:E,children:["Level ",E]},E))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-gray-400 mb-1",children:"Path Code"}),e.jsxs("select",{value:u,onChange:E=>x(E.target.value),className:"bg-black/30 border border-white/20 rounded-lg px-3 py-2 text-white",children:[e.jsx("option",{value:"",children:"-- Select Path --"}),w.map(E=>e.jsxs("option",{value:E.value,children:[E.icon," ",E.label]},E.value))]})]}),e.jsxs("button",{onClick:$,disabled:h||o.length===0,className:"bg-purple-600 hover:bg-purple-700 disabled:bg-gray-600 text-white px-6 py-2 rounded-lg flex items-center gap-2 transition-all",children:[h?e.jsx(Tm,{className:"w-4 h-4 animate-spin"}):e.jsx(As,{className:"w-4 h-4"}),"Apply Tags"]}),e.jsxs("label",{className:"flex items-center gap-2 text-gray-400 cursor-pointer ml-auto",children:[e.jsx("input",{type:"checkbox",checked:S.untaggedOnly,onChange:E=>N(L=>({...L,untaggedOnly:E.target.checked,pathCode:""})),className:"rounded"}),"Show Untagged Only"]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-white/10 overflow-hidden",children:[s?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Tm,{className:"w-8 h-8 animate-spin text-purple-400"})}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-black/30 border-b border-white/10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-3 text-left",children:e.jsx("button",{onClick:k,className:"text-gray-400 hover:text-white",children:o.length===t.length?e.jsx(Dm,{className:"w-5 h-5"}):e.jsx(jm,{className:"w-5 h-5"})})}),e.jsx("th",{className:"p-3 text-left text-gray-400",children:"Title"}),e.jsx("th",{className:"p-3 text-left text-gray-400",children:"Severity"}),e.jsx("th",{className:"p-3 text-left text-gray-400",children:"Source"}),e.jsx("th",{className:"p-3 text-left text-gray-400",children:"Level"}),e.jsx("th",{className:"p-3 text-left text-gray-400",children:"Path"})]})}),e.jsx("tbody",{children:t.map(E=>e.jsxs("tr",{className:`border-b border-white/5 hover:bg-white/5 cursor-pointer transition-colors ${o.includes(E.id)?"bg-purple-500/10":""}`,onClick:()=>T(E.id),children:[e.jsx("td",{className:"p-3",children:o.includes(E.id)?e.jsx(Dm,{className:"w-5 h-5 text-purple-400"}):e.jsx(jm,{className:"w-5 h-5 text-gray-500"})}),e.jsx("td",{className:"p-3 text-white font-medium",children:E.title}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${E.severity==="Critical"?"bg-red-500/20 text-red-400":E.severity==="High"?"bg-orange-500/20 text-orange-400":E.severity==="Medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:E.severity})}),e.jsx("td",{className:"p-3 text-gray-400",children:E.source}),e.jsx("td",{className:"p-3 text-white",children:E.min_level||1}),e.jsx("td",{className:"p-3",children:E.path_code?e.jsx("span",{className:"px-2 py-1 rounded bg-purple-500/20 text-purple-400 text-xs",children:C(E.path_code)}):e.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[e.jsx(Sa,{className:"w-3 h-3"})," Untagged"]})})]},E.id))})]}),!s&&t.length===0&&e.jsx("div",{className:"text-center py-12 text-gray-400",children:"No alerts found matching your filters"})]}),y>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center mt-4 px-4 py-3 bg-[#1a1b1e] rounded-lg border border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-gray-400 mb-4 sm:mb-0",children:[e.jsx("span",{children:"Show"}),e.jsxs("select",{value:p,onChange:E=>{v(Number(E.target.value)),b(1)},className:"bg-black/30 border border-white/20 text-white text-sm rounded-lg px-2 py-1",children:[e.jsx("option",{value:25,children:"25"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]}),e.jsx("span",{children:"per page"}),e.jsxs("span",{className:"ml-4 text-white",children:["Total: ",e.jsx("span",{className:"font-bold text-purple-400",children:y})," alerts"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>b(E=>Math.max(E-1,1)),disabled:g===1,className:`px-3 py-1 rounded-lg text-sm font-medium ${g===1?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-white hover:bg-gray-700"}`,children:"Previous"}),e.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Page ",e.jsx("span",{className:"text-white font-bold",children:g})," of ",e.jsx("span",{className:"text-white font-bold",children:Math.ceil(y/p)||1})]}),e.jsx("button",{onClick:()=>b(E=>Math.min(E+1,Math.ceil(y/p))),disabled:g>=Math.ceil(y/p),className:`px-3 py-1 rounded-lg text-sm font-medium ${g>=Math.ceil(y/p)?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-white hover:bg-gray-700"}`,children:"Next"})]})]})]})},c_=()=>{const{user:t}=df(),[r,a]=l.useState(""),[n,s]=l.useState(""),[i,o]=l.useState("all"),[c,d]=l.useState(""),[m,u]=l.useState(!1),x=async h=>{h.preventDefault(),u(!0);try{const f=localStorage.getItem("token"),g=await fetch(`${Y}/api/admin/notifications/send`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({title:r,body:n,userId:i==="specific"?c:null})}),b=await g.json();g.ok?(z.success(b.message),a(""),s("")):z.error(b.message||"Failed to send notification")}catch(f){console.error("Error sending notification:",f),z.error("Server error")}finally{u(!1)}};return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Authorized access only."}):e.jsxs("div",{className:"bg-[#1a1b1e] p-8 rounded-2xl border border-gray-800 shadow-2xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-blue-600/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2 pointer-events-none"}),e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center shadow-lg shadow-blue-500/20",children:e.jsx("span",{className:"text-2xl",children:"🔔"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-white",children:"Mobile Push Notifications"}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Send real-time alerts to mobile app users"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-2 space-y-6",children:e.jsxs("form",{onSubmit:x,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-3",children:"Target Audience"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("label",{className:`relative flex items-center p-4 rounded-xl border cursor-pointer transition-all duration-200 ${i==="all"?"bg-blue-600/20 border-blue-500 shadow-lg shadow-blue-500/10":"bg-[#0d1117] border-gray-700 hover:border-gray-600 hover:bg-gray-800"}`,children:[e.jsx("input",{type:"radio",name:"target",value:"all",checked:i==="all",onChange:()=>o("all"),className:"hidden"}),e.jsx("div",{className:"mr-3 w-5 h-5 rounded-full border border-current flex items-center justify-center text-blue-400",children:i==="all"&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-blue-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:`font-semibold ${i==="all"?"text-white":"text-gray-300"}`,children:"All Users"}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"Broadcast to everyone"})]})]}),e.jsxs("label",{className:`relative flex items-center p-4 rounded-xl border cursor-pointer transition-all duration-200 ${i==="specific"?"bg-purple-600/20 border-purple-500 shadow-lg shadow-purple-500/10":"bg-[#0d1117] border-gray-700 hover:border-gray-600 hover:bg-gray-800"}`,children:[e.jsx("input",{type:"radio",name:"target",value:"specific",checked:i==="specific",onChange:()=>o("specific"),className:"hidden"}),e.jsx("div",{className:"mr-3 w-5 h-5 rounded-full border border-current flex items-center justify-center text-purple-400",children:i==="specific"&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-purple-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:`font-semibold ${i==="specific"?"text-white":"text-gray-300"}`,children:"Specific User"}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"Target a single device"})]})]})]})]}),i==="specific"&&e.jsxs("div",{className:"animate-fade-in-down",children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-2",children:"User ID"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:c,onChange:h=>d(h.target.value),className:"w-full bg-[#0d1117] border border-gray-700 rounded-xl px-4 py-3 text-white focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500 pl-10 transition-all",placeholder:"Enter the User ID (e.g., 123)",required:!0}),e.jsx("span",{className:"absolute left-3 top-3.5 text-gray-500",children:"👤"})]}),t&&e.jsx("button",{type:"button",onClick:()=>d(t.id),className:"text-xs text-purple-400 mt-2 hover:text-purple-300 transition-colors flex items-center gap-1",children:e.jsx("span",{children:"Use my ID (Testing)"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Notification Title"}),e.jsx("input",{type:"text",value:r,onChange:h=>a(h.target.value),className:"w-full bg-[#0d1117] border border-gray-700 rounded-xl px-4 py-3 text-white focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-medium",placeholder:"e.g., New Mission Assigned! 🚨",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Message Body"}),e.jsx("textarea",{value:n,onChange:h=>s(h.target.value),className:"w-full bg-[#0d1117] border border-gray-700 rounded-xl px-4 py-3 text-white focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 h-32 resize-none transition-all leading-relaxed",placeholder:"Enter your message details here...",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:m,className:"w-full bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white font-bold py-3.5 rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed flex justify-center items-center gap-2 shadow-lg shadow-blue-600/20 transform active:scale-[0.98]",children:m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{children:"Sending Blast..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"🚀"}),e.jsx("span",{children:"Send Notification"})]})})]})}),e.jsx("div",{className:"hidden lg:block",children:e.jsxs("div",{className:"bg-[#0d1117] p-6 rounded-xl border border-gray-800/50 sticky top-4",children:[e.jsxs("h3",{className:"text-white font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{children:"📱"})," How to Test"]}),e.jsxs("ul",{className:"space-y-4 text-sm text-gray-400",children:[e.jsxs("li",{className:"flex gap-3",children:[e.jsx("span",{className:"bg-gray-800 w-6 h-6 rounded-full flex items-center justify-center text-xs text-gray-300 flex-shrink-0",children:"1"}),e.jsxs("span",{children:["Install the app on a ",e.jsx("strong",{children:"real device"})," (Android/iOS). Simulators often block push notifications."]})]}),e.jsxs("li",{className:"flex gap-3",children:[e.jsx("span",{className:"bg-gray-800 w-6 h-6 rounded-full flex items-center justify-center text-xs text-gray-300 flex-shrink-0",children:"2"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Log in"})," to the mobile app. This registers your device token."]})]}),e.jsxs("li",{className:"flex gap-3",children:[e.jsx("span",{className:"bg-gray-800 w-6 h-6 rounded-full flex items-center justify-center text-xs text-gray-300 flex-shrink-0",children:"3"}),e.jsxs("span",{children:["Select ",e.jsx("strong",{children:"Specific User"}),' and enter your User ID (or click "Use my ID").']})]}),e.jsxs("li",{className:"flex gap-3",children:[e.jsx("span",{className:"bg-gray-800 w-6 h-6 rounded-full flex items-center justify-center text-xs text-gray-300 flex-shrink-0",children:"4"}),e.jsxs("span",{children:["Ensure the app is in the ",e.jsx("strong",{children:"background"})," or closed to see the system banner."]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase font-bold tracking-wider mb-2",children:"Technical Status"}),e.jsxs("div",{className:"flex items-center gap-2 text-green-400 text-sm",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),"Firebase Service Active"]})]})]})})]})]})},Yc=({user:t,profile:r,onNavigate:a})=>{var d,m,u;const n=((d=r==null?void 0:r.academy_stats)==null?void 0:d.level)||1,s=((m=r==null?void 0:r.academy_stats)==null?void 0:m.xp)||0,i=((u=r==null?void 0:r.academy_stats)==null?void 0:u.streak_days)||0,o=(Math.floor(s/100)+1)*100,c=Math.min(100,Math.round(s/o*100));return e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6 bg-[#0f1012]/80 backdrop-blur-md border border-white/5 rounded-2xl p-6 mb-8 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 w-96 h-96 bg-purple-600/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2 pointer-events-none"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h1",{className:"text-3xl font-bold text-white mb-2 tracking-tight",children:["Welcome back, ",e.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-pink-400",children:(t==null?void 0:t.username)||"Analyst"})]}),e.jsxs("p",{className:"text-gray-400 flex items-center gap-2 text-sm font-medium",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),"SOC Command Center Active"]})]}),e.jsxs("div",{className:"flex items-center gap-6 relative z-10",children:[e.jsxs("div",{className:"hidden lg:flex items-center gap-3 pr-6 border-r border-gray-800",children:[e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-wider",children:["Level ",n]}),e.jsxs("div",{className:"text-sm font-bold text-white font-mono",children:[s," XP"]})]}),e.jsxs("div",{className:"relative w-12 h-12 flex items-center justify-center",children:[e.jsxs("svg",{className:"w-full h-full -rotate-90",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"#1f2937",strokeWidth:"4",fill:"none"}),e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"url(#headerProgressGradient)",strokeWidth:"4",fill:"none",strokeDasharray:2*Math.PI*20,strokeDashoffset:2*Math.PI*20-c/100*2*Math.PI*20,strokeLinecap:"round"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"headerProgressGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:"#c084fc"}),e.jsx("stop",{offset:"100%",stopColor:"#e879f9"})]})})]}),e.jsxs("div",{className:"absolute text-[10px] font-bold text-white",children:[Math.round(c),"%"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-orange-500/10 to-red-500/10 border border-orange-500/20 flex items-center justify-center shadow-[0_0_15px_-3px_rgba(249,115,22,0.3)]",children:e.jsx("span",{className:"text-lg",children:"🔥"})}),e.jsxs("div",{className:"hidden sm:block",children:[e.jsx("div",{className:"text-[10px] text-gray-500 font-bold uppercase tracking-wider",children:"Streak"}),e.jsxs("div",{className:"text-sm font-bold text-white",children:[i," Days"]})]})]}),e.jsx("div",{onClick:()=>a&&a("profile"),className:"pl-6 border-l border-gray-800 flex items-center gap-3 cursor-pointer group/profile",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-11 h-11 rounded-full bg-gray-800 border-2 border-gray-700 group-hover/profile:border-purple-500 transition-colors overflow-hidden",children:r!=null&&r.profile_picture?e.jsx("img",{src:`${Y}${r.profile_picture}`,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gray-900 text-gray-400",children:e.jsx(At,{className:"w-5 h-5"})})}),e.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 bg-green-500 border-2 border-[#0f1012] rounded-full"})]})})]})]})},d_=({stats:t})=>{const r=[{id:"phishing",label:"Phishing",icon:Qr,color:"text-orange-400",bg:"bg-orange-500/10",border:"border-orange-500/20"},{id:"malware",label:"Malware",icon:xr,color:"text-red-400",bg:"bg-red-500/10",border:"border-red-500/20"},{id:"network",label:"Network",icon:ey,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/20"},{id:"data_exfiltration",label:"Exfiltration",icon:Bf,color:"text-purple-400",bg:"bg-purple-500/10",border:"border-purple-500/20"}];return e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.map((a,n)=>{var o;const s=((o=t==null?void 0:t.campaigns)==null?void 0:o[a.id])||0,i=a.icon;return e.jsxs(jt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.1},whileHover:{scale:1.05,y:-5},className:`${a.bg} ${a.border} border rounded-xl p-4 flex items-center justify-between backdrop-blur-md`,children:[e.jsxs("div",{children:[e.jsx("div",{className:`text-[10px] font-bold uppercase tracking-wider ${a.color} mb-1`,children:a.label}),e.jsx("div",{className:"text-2xl font-bold text-white",children:s})]}),e.jsx("div",{className:`p-2 rounded-lg bg-black/20 ${a.color}`,children:e.jsx(i,{className:"w-5 h-5"})})]},a.id)})})},u_=({stats:t,onNavigate:r})=>{var n,s,i,o,c;const a=[{key:"critical",label:"CRITICAL",count:((n=t==null?void 0:t.severity)==null?void 0:n.critical)||0,icon:Pn,color:"text-fuchsia-400",bg:"bg-gradient-to-br from-fuchsia-600/20 to-purple-800/20",border:"border-fuchsia-500/30"},{key:"high",label:"HIGH",count:((s=t==null?void 0:t.severity)==null?void 0:s.high)||0,icon:Sa,color:"text-red-400",bg:"bg-gradient-to-br from-red-600/20 to-orange-800/20",border:"border-red-500/30"},{key:"medium",label:"MEDIUM",count:((i=t==null?void 0:t.severity)==null?void 0:i.medium)||0,icon:xs,color:"text-orange-400",bg:"bg-gradient-to-br from-orange-600/20 to-yellow-800/20",border:"border-orange-500/30"},{key:"low",label:"LOW",count:((o=t==null?void 0:t.severity)==null?void 0:o.low)||0,icon:Uf,color:"text-yellow-400",bg:"bg-gradient-to-br from-yellow-600/20 to-amber-800/20",border:"border-yellow-500/30"},{key:"info",label:"INFO",count:((c=t==null?void 0:t.severity)==null?void 0:c.info)||0,icon:Jt,color:"text-blue-400",bg:"bg-gradient-to-br from-blue-600/20 to-cyan-800/20",border:"border-blue-500/30"}];return e.jsxs("div",{className:"bg-[#1a1b1e]/50 backdrop-blur-sm border border-gray-800 rounded-2xl p-6",children:[e.jsxs("h3",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-4 flex items-center gap-2",children:[e.jsx(Sa,{className:"w-3 h-3"})," Alert Distribution"]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:a.map((d,m)=>{const u=d.icon;return e.jsxs(jt.button,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:m*.05},whileHover:{scale:1.05,y:-5},whileTap:{scale:.95},onClick:()=>r&&r("severity",d.key),className:`${d.bg} ${d.border} border rounded-xl p-4 flex items-center justify-between hover:brightness-110 group relative overflow-hidden text-left backdrop-blur-md`,children:[e.jsx("div",{className:"absolute inset-0 bg-white/5 opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("div",{className:"z-10",children:[e.jsx("div",{className:"text-[10px] text-gray-400 font-bold uppercase tracking-wider mb-1",children:d.label}),e.jsx("div",{className:`text-3xl font-bold ${d.color}`,children:d.count})]}),e.jsx("div",{className:"p-2 rounded-lg bg-black/20 group-hover:bg-black/30 transition-colors z-10",children:e.jsx(u,{className:`w-5 h-5 ${d.color}`})})]},d.key)})})]})},m_=({threats:t,onSelectAlert:r})=>{if(!t||t.length===0)return e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 text-center",children:[e.jsx(Pn,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-gray-500"}),e.jsx("p",{className:"text-gray-500",children:"No active threats detected."})]});const a=s=>{const i=(s||"").toLowerCase();return i==="critical"?"bg-fuchsia-500/10 text-fuchsia-400 border-fuchsia-500/30":i==="high"?"bg-red-500/10 text-red-400 border-red-500/30":i==="medium"?"bg-orange-500/10 text-orange-400 border-orange-500/30":i==="low"?"bg-yellow-500/10 text-yellow-400 border-yellow-500/30":"bg-blue-500/10 text-blue-400 border-blue-500/30"},n=s=>{const i=(s||"").toLowerCase();return i.includes("network")||i.includes("firewall")?ms:i.includes("endpoint")||i.includes("crowdstrike")?Pn:i.includes("server")||i.includes("host")?el:i.includes("email")||i.includes("phishing")?Qr:xs};return e.jsxs("div",{className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4 flex items-center gap-2",children:[e.jsx(Er,{className:"w-4 h-4"})," Latest Threats"]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-2 lg:grid-cols-4 gap-4",children:t.map((s,i)=>{const o=n(s.source);return e.jsxs(jt.button,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:i*.1},whileHover:{scale:1.03,y:-4},onClick:()=>r&&r(s.id),className:"relative group bg-[#0e0f11]/80 backdrop-blur-sm border border-gray-800 rounded-xl p-4 transition-all hover:border-purple-500/50 overflow-hidden text-left",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-500/5 to-blue-500/5 opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-gray-800/50 border border-gray-700/50 group-hover:bg-purple-500/20 group-hover:border-purple-500/30 transition-colors",children:e.jsx(o,{className:"w-5 h-5 text-gray-400 group-hover:text-purple-400 transition-colors"})}),e.jsx("span",{className:`px-2 py-0.5 text-[9px] font-bold uppercase rounded border ${a(s.severity)}`,children:s.severity})]}),e.jsx("h4",{className:"text-sm font-bold text-gray-200 group-hover:text-white mb-2 line-clamp-2 min-h-[40px]",children:s.title}),e.jsx("div",{className:"flex items-center gap-2 text-[10px] text-gray-500 font-medium uppercase tracking-wider",children:e.jsx("span",{children:s.source})})]})]},`${s.id}-${i}`)})})]})},x_=({assets:t,onNavigate:r})=>!t||t.length===0?e.jsxs(jt.div,{whileHover:{scale:1.01},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 h-full",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4",children:"Last Affected Clients"}),e.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"No affected assets found."})]}):e.jsxs(jt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 h-full",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4",children:"Last Affected Clients"}),e.jsx("div",{className:"space-y-2",children:t.map((a,n)=>e.jsxs(jt.button,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.2+n*.05},whileHover:{scale:1.02,x:5},whileTap:{scale:.98},onClick:()=>r&&r("source",a.asset),className:"w-full flex items-center justify-between bg-[#0e0f11]/80 backdrop-blur-sm border border-gray-800 rounded-lg p-3 hover:border-purple-500/30 hover:bg-[#1a1b1f] transition-all group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(el,{className:"w-4 h-4 text-purple-400 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-sm text-white font-medium group-hover:text-purple-300 transition-colors",children:a.asset})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.critical_count>0&&e.jsx("span",{className:"px-1.5 py-0.5 bg-fuchsia-500/20 text-fuchsia-400 rounded group-hover:bg-fuchsia-500/30 transition-colors",children:a.critical_count}),a.high_count>0&&e.jsx("span",{className:"px-1.5 py-0.5 bg-red-500/20 text-red-400 rounded group-hover:bg-red-500/30 transition-colors",children:a.high_count}),a.medium_count>0&&e.jsx("span",{className:"px-1.5 py-0.5 bg-orange-500/20 text-orange-400 rounded group-hover:bg-orange-500/30 transition-colors",children:a.medium_count}),e.jsxs("span",{className:"text-gray-500 group-hover:text-gray-400 transition-colors",children:[a.alert_count," total"]})]})]},n))})]}),xx=({missions:t,onNavigate:r})=>{if(!t||t.length===0)return e.jsxs(jt.div,{whileHover:{scale:1.01},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 h-full",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-4",children:"Active Missions"}),e.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"No active missions available."})]});const a=t.filter(n=>n.status==="in_progress").slice(0,4);return a.length===0?e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-5 h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider",children:"Active Missions"}),e.jsx("button",{onClick:()=>r&&r("missions"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold",children:"View All →"})]}),e.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"No missions in progress."})]}):e.jsxs(jt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-2xl p-6 h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider",children:"Active Missions"}),e.jsx("button",{onClick:()=>r&&r("missions"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold",children:"View All →"})]}),e.jsx("div",{className:"space-y-3",children:a.slice(0,2).map((n,s)=>e.jsxs(jt.button,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.3+s*.1},whileHover:{scale:1.02,x:5},whileTap:{scale:.98},onClick:()=>r&&r("missions"),className:"w-full flex items-center justify-between bg-[#1f2024]/50 border border-gray-800 rounded-xl p-4 hover:border-purple-500/30 hover:bg-[#25262b] hover:shadow-lg hover:shadow-purple-900/10 transition-all text-left group",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500/20 to-pink-500/20 border border-purple-500/30 flex items-center justify-center group-hover:scale-105 transition-transform",children:e.jsx("span",{className:"text-lg",children:"⚔️"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm text-white font-bold group-hover:text-purple-300 transition-colors",children:n.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("div",{className:"w-20 bg-gray-800 rounded-full h-1",children:e.jsx("div",{className:"bg-purple-500 h-full rounded-full",style:{width:`${n.progress_percent||0}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[n.progress_percent||0,"% Complete"]})]})]})]}),e.jsx(Pr,{className:"w-4 h-4 text-gray-600 group-hover:text-purple-400 transition-colors"})]},n.id))})]})},h_=({analytics:t,onNavigate:r})=>{const a=(t==null?void 0:t.learningPaths)||[];return!a||a.length===0?e.jsxs(jt.div,{whileHover:{scale:1.01},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 flex flex-col h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{children:"📚"})," Learning Paths"]}),e.jsx(jt.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>r&&r("academy"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold uppercase transition-colors",children:"View All"})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"Start a learning path to track progress."})})]}):e.jsxs(jt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.3},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 flex flex-col h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{children:"📚"})," Learning Paths"]}),e.jsx(jt.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>r&&r("academy"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold uppercase transition-colors",children:"View All"})]}),e.jsx("div",{className:"space-y-3 flex-1",children:a.slice(0,4).map((n,s)=>{const i=Math.round(n.percentage_completed||0),o=n.title,c=n.completed_modules||0,d=n.total_modules||0;return e.jsxs(jt.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.4+s*.1},whileHover:{scale:1.02},className:"bg-[#0e0f11]/80 backdrop-blur-sm border border-gray-800/80 rounded-lg p-3 hover:border-purple-500/30 transition-all cursor-pointer",onClick:()=>r&&r("academy"),children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("h4",{className:"text-sm text-white font-medium group-hover:text-purple-300 transition-colors",children:o}),e.jsxs("span",{className:`text-xs font-bold ${i>0?"text-purple-400":"text-gray-500"}`,children:[i,"%"]})]}),e.jsxs("div",{className:"text-[10px] text-gray-500 mb-2",children:[c,"/",d," Modules"]}),e.jsx("div",{className:"w-full bg-gray-800 rounded-full h-1.5",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${i>0?"bg-gradient-to-r from-purple-500 to-pink-500":"bg-gray-700"}`,style:{width:`${Math.max(i,2)}%`}})})]},n.id||s)})})]})},Jc=({analytics:t})=>{const r=(t==null?void 0:t.investigations)||{},a=r.avgGrade||0,n=r.total||0,s=r.completed||0,i=n-s,o=(t==null?void 0:t.moduleScores)||[],c=[...o].sort((u,x)=>x.avg_score-u.avg_score).slice(0,4),d=o.length>0?o.reduce((u,x)=>u+x.avg_score,0)/o.length:0,m=s>0?(a+d)/2:d;return e.jsxs(jt.div,{whileHover:{scale:1.01},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-6 h-full flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider mb-6 flex items-center gap-2",children:[e.jsxs("span",{className:"relative flex h-2.5 w-2.5 mr-1",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500 shadow-[0_0_8px_rgba(34,197,94,0.8)]"})]}),"Analyst Performance"]}),e.jsxs("div",{className:"flex items-center gap-6 mb-6",children:[e.jsxs("div",{className:"relative w-20 h-20 flex-shrink-0",children:[e.jsxs("svg",{className:"w-full h-full -rotate-90",children:[e.jsx("circle",{cx:"40",cy:"40",r:"34",stroke:"#2a2b30",strokeWidth:"6",fill:"none"}),e.jsx("circle",{cx:"40",cy:"40",r:"34",stroke:"url(#investigationGradient)",strokeWidth:"6",fill:"none",strokeDasharray:2*Math.PI*34,strokeDashoffset:2*Math.PI*34-m/100*2*Math.PI*34,strokeLinecap:"round"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"investigationGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:"#22c55e"}),e.jsx("stop",{offset:"100%",stopColor:"#10b981"})]})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:e.jsxs("span",{className:"text-xl font-bold text-white",children:[Math.round(m),"%"]})})]}),e.jsxs("div",{className:"space-y-1.5 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-gray-400",children:"Total Cases"}),e.jsx("span",{className:"text-white font-bold",children:n})]}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-gray-400",children:"Solved"}),e.jsx("span",{className:"text-green-400 font-bold",children:s})]}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-gray-400",children:"Active"}),e.jsx("span",{className:"text-yellow-400 font-bold",children:i})]})]})]})]}),c.length>0&&e.jsxs("div",{className:"border-t border-gray-800/80 pt-5 mt-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("h4",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx(yr,{className:"w-3 h-3 text-purple-400"})," Top Proficiencies"]})}),e.jsx("div",{className:"space-y-4",children:c.map((u,x)=>e.jsxs("div",{className:"group/skill",children:[e.jsxs("div",{className:"flex justify-between items-end mb-1.5",children:[e.jsx("span",{className:"text-xs text-gray-300 font-medium truncate pr-2 group-hover/skill:text-white transition-colors",children:u.title}),e.jsxs("span",{className:"text-[10px] text-purple-400 font-bold bg-purple-500/10 px-1.5 py-0.5 rounded",children:[Math.round(u.avg_score),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-800/80 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-pink-500 h-full rounded-full group-hover/skill:brightness-110 transition-all duration-300",style:{width:`${u.avg_score}%`}})})]},x))})]})]})},Qc=({analytics:t,profile:r,onNavigate:a})=>{const n=(t==null?void 0:t.recentActivity)||[],i=((t==null?void 0:t.learningPaths)||[]).find(m=>m.percentage_completed>0&&m.percentage_completed<100),o=n.find(m=>m.type==="lesson"),c=n.find(m=>m.type==="investigation");return i||o||c?e.jsxs(jt.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:.4},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 h-full flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/20 border border-purple-500/30 flex items-center justify-center",children:e.jsx(Zs,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold",children:"Continue Learning"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Pick up where you left off"})]})]}),i&&e.jsxs("div",{className:"mb-3 bg-black/20 rounded-lg p-3",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm text-white font-medium",children:i.title}),e.jsxs("span",{className:"text-xs text-purple-400 font-bold",children:[Math.round(i.percentage_completed),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-800 rounded-full h-1.5",children:e.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-pink-500 h-full rounded-full",style:{width:`${i.percentage_completed}%`}})})]}),c&&!i&&!o&&e.jsxs("div",{className:"mb-3 bg-black/20 rounded-lg p-3",children:[e.jsx("span",{className:"text-xs text-gray-500 uppercase font-bold tracking-wider mb-1 block",children:"Recent Case"}),e.jsx("div",{className:"text-sm text-white font-medium line-clamp-2",children:c.title})]}),e.jsxs(jt.button,{whileHover:{scale:1.02,y:-2},whileTap:{scale:.98},onClick:()=>a&&a("academy"),className:"w-full py-2.5 bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white font-bold rounded-lg transition-all flex items-center justify-center gap-2 mt-auto shadow-lg shadow-purple-500/20",children:["Continue ",e.jsx(Pr,{className:"w-4 h-4"})]})]}):e.jsxs(jt.div,{whileHover:{scale:1.01},className:"bg-[#1a1b1e]/60 backdrop-blur-md border border-gray-800 rounded-xl p-5 flex flex-col justify-between h-full",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/20 border border-purple-500/30 flex items-center justify-center",children:e.jsx(Zs,{className:"w-5 h-5 text-purple-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold",children:"Start Learning"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Begin your cybersecurity journey"})]})]})}),e.jsxs(jt.button,{whileHover:{scale:1.02,y:-2},whileTap:{scale:.98},onClick:()=>a&&a("academy"),className:"w-full mt-4 py-2.5 bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white font-bold rounded-lg transition-all flex items-center justify-center gap-2 shadow-lg shadow-purple-500/20",children:["Explore Academy",e.jsx(Pr,{className:"w-4 h-4"})]})]})},cp=({profile:t,onNavigate:r})=>{const a=(t==null?void 0:t.badges)||[],n=a.slice(0,3),s=i=>{switch(i){case"path_completion":return"🎓";case"milestone":return"🏆";case"streak":return"🔥";case"special":return"⭐";default:return"🏅"}};return n.length===0?e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-5",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{children:"🏆"})," Recent Badges"]}),e.jsx("button",{onClick:()=>r&&r("profile"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold uppercase",children:"View All"})]}),e.jsxs("div",{className:"text-center py-4",children:[e.jsx("div",{className:"text-3xl mb-2",children:"🎯"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Complete lessons to earn badges!"})]})]}):e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-5 h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{children:"🏆"})," Recent Badges"]}),e.jsx("button",{onClick:()=>r&&r("profile"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold uppercase",children:"View All"})]}),e.jsx("div",{className:"flex gap-2",children:n.map((i,o)=>e.jsxs("div",{className:"flex-1 bg-gradient-to-br from-yellow-500/10 to-orange-500/10 border border-yellow-500/30 rounded-lg p-3 text-center hover:border-yellow-400/50 transition-all cursor-pointer group",title:i.description||i.name,children:[e.jsx("div",{className:"text-2xl mb-1 group-hover:scale-110 transition-transform",children:s(i.type)}),e.jsx("div",{className:"text-[10px] text-white font-medium truncate",children:i.name})]},i.id||o))}),a.length>3&&e.jsxs("div",{className:"text-center mt-2 text-[10px] text-gray-500",children:["+",a.length-3," more badges"]})]})},f_=({analytics:t,onNavigate:r})=>{const a=(t==null?void 0:t.moduleScores)||[];if(a.length<3)return e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-5",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{children:"📊"})," Skill Breakdown"]}),e.jsx("button",{onClick:()=>r&&r("profile"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold uppercase",children:"View All"})]}),e.jsxs("div",{className:"text-center py-6",children:[e.jsx("div",{className:"text-3xl mb-2",children:"📈"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Complete more lessons to see your skill breakdown"})]})]});const n=a.slice(0,5).map(s=>({subject:s.title.length>12?s.title.substring(0,12)+"...":s.title,score:Number(s.avg_score)||0,fullMark:100}));return e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-5 h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{children:"📊"})," Skill Breakdown"]}),e.jsx("button",{onClick:()=>r&&r("profile"),className:"text-xs text-purple-400 hover:text-purple-300 font-bold uppercase",children:"View All"})]}),e.jsxs("div",{className:"relative w-full h-[180px]",children:[e.jsx("div",{className:"absolute inset-0 bg-purple-500/5 rounded-lg pointer-events-none"}),e.jsx(Ra,{width:"100%",height:180,children:e.jsxs(fu,{data:n,children:[e.jsx(gu,{stroke:"#333",strokeDasharray:"3 3"}),e.jsx(pu,{dataKey:"subject",tick:{fill:"#9ca3af",fontSize:9,fontWeight:500}}),e.jsx(il,{angle:30,domain:[0,100],tick:{fill:"#666",fontSize:8}}),e.jsx(bu,{name:"Score",dataKey:"score",stroke:"#b026ff",strokeWidth:2,fill:"#b026ff",fillOpacity:.3}),e.jsx(La,{contentStyle:{backgroundColor:"#111",border:"1px solid #333",borderRadius:"8px",fontSize:"12px"},itemStyle:{color:"#b026ff"},formatter:s=>[`${Math.round(s)}%`,"Score"]})]})})]})]})},hx=({alerts:t,onNavigate:r,onSelectAlert:a})=>{if(!t||t.length===0)return null;const n=s=>{const i=(s||"").toLowerCase();return i==="critical"?"bg-fuchsia-500/10 text-fuchsia-400 border-fuchsia-500/30":i==="high"?"bg-red-500/10 text-red-400 border-red-500/30":i==="medium"?"bg-orange-500/10 text-orange-400 border-orange-500/30":i==="low"?"bg-yellow-500/10 text-yellow-400 border-yellow-500/30":"bg-blue-500/10 text-blue-400 border-blue-500/30"};return e.jsxs("div",{className:"bg-[#1a1b1e]/50 backdrop-blur-sm border border-orange-500/20 rounded-2xl p-6 h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-orange-500/20 rounded-lg",children:e.jsx(Er,{className:"w-5 h-5 text-orange-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-white uppercase tracking-wider",children:"Your Assigned Cases"}),e.jsxs("p",{className:"text-xs text-gray-400",children:["You are the lead investigator for ",t.length," active alerts"]})]})]}),e.jsx("button",{onClick:()=>r&&r("mine"),className:"text-xs text-orange-400 hover:text-orange-300 font-bold uppercase transition-colors",children:"View All"})]}),e.jsx("div",{className:"space-y-3",children:t.slice(0,3).map(s=>e.jsxs("button",{onClick:()=>a&&a(s.id),className:"w-full relative flex items-center justify-between bg-[#1f2024]/50 border border-gray-800 rounded-xl p-4 hover:border-orange-500/30 hover:bg-[#25262b] hover:shadow-lg hover:shadow-orange-900/10 hover:-translate-y-0.5 transition-all text-left group overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[e.jsx("div",{className:"shrink-0 w-10 h-10 rounded-xl bg-gray-800/50 flex items-center justify-center border border-gray-700/50 group-hover:bg-orange-500/10 group-hover:border-orange-500/20 transition-colors",children:s.status==="investigating"?e.jsx(Er,{className:"w-5 h-5 text-yellow-400 animate-pulse"}):e.jsx(ru,{className:"w-5 h-5 text-gray-400 group-hover:text-orange-400"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"text-sm font-bold text-gray-200 group-hover:text-white truncate transition-colors",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-gray-500 mt-0.5",children:[e.jsx("span",{className:"truncate max-w-[120px]",children:s.source}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(s.created_at).toLocaleDateString()})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pl-4",children:[e.jsx("span",{className:`shrink-0 px-2 py-0.5 text-[9px] font-bold uppercase rounded border ${n(s.severity)}`,children:s.severity}),e.jsx(Pr,{className:"w-4 h-4 text-gray-600 group-hover:text-orange-400 transition-colors"})]})]},s.id))})]})},g_=({isOpen:t,onClose:r,onPathSelected:a,currentPaths:n={}})=>{var _,P;const[s,i]=l.useState([]),[o,c]=l.useState(n.primary_path||""),[d,m]=l.useState(n.secondary_path||""),[u,x]=l.useState(!0),[h,f]=l.useState(!1),[g,b]=l.useState(""),p={SIEM:e.jsx(Bj,{className:"w-8 h-8"}),EDR:e.jsx(f1,{className:"w-8 h-8"}),NDR:e.jsx(ms,{className:"w-8 h-8"}),TI:e.jsx(Jt,{className:"w-8 h-8"}),IR:e.jsx(A1,{className:"w-8 h-8"}),MAL:e.jsx(Rm,{className:"w-8 h-8"}),DLP:e.jsx(Oa,{className:"w-8 h-8"}),CLOUD:e.jsx(Fj,{className:"w-8 h-8"})},v={SIEM:"text-indigo-400 group-hover:text-indigo-300",EDR:"text-red-400 group-hover:text-red-300",NDR:"text-cyan-400 group-hover:text-cyan-300",TI:"text-violet-400 group-hover:text-violet-300",IR:"text-orange-400 group-hover:text-orange-300",MAL:"text-green-400 group-hover:text-green-300",DLP:"text-yellow-400 group-hover:text-yellow-300",CLOUD:"text-blue-400 group-hover:text-blue-300"},y={SIEM:"bg-indigo-500/10 border-indigo-500/30",EDR:"bg-red-500/10 border-red-500/30",NDR:"bg-cyan-500/10 border-cyan-500/30",TI:"bg-violet-500/10 border-violet-500/30",IR:"bg-orange-500/10 border-orange-500/30",MAL:"bg-green-500/10 border-green-500/30",DLP:"bg-yellow-500/10 border-yellow-500/30",CLOUD:"bg-blue-500/10 border-blue-500/30"};l.useEffect(()=>{t&&j()},[t]);const j=async()=>{try{x(!0);const O=localStorage.getItem("token"),T=await Ca.get("/api/assignments/paths",{headers:{Authorization:`Bearer ${O}`}});T.data.success&&i(T.data.paths)}catch(O){console.error("Error fetching paths:",O),b("Failed to load specialization paths")}finally{x(!1)}},S=O=>{O===d&&m(""),c(O)},N=O=>{O!==o&&m(O===d?"":O)},w=async()=>{var O,T;if(!o){b("Please select a primary specialization");return}try{f(!0),b("");const k=localStorage.getItem("token"),$=await Ca.put("/api/assignments/user-paths",{primary_path:o,secondary_path:d||null},{headers:{Authorization:`Bearer ${k}`}});$.data.success&&(a==null||a($.data),r())}catch(k){console.error("Error saving paths:",k),b(((T=(O=k.response)==null?void 0:O.data)==null?void 0:T.error)||"Failed to save paths")}finally{f(!1)}};return t?Na.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-start justify-center pt-8 p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity duration-300",onClick:r}),e.jsxs("div",{className:"relative w-full max-w-6xl max-h-[90vh] bg-[#0f1012]/95 backdrop-blur-xl border border-white/10 rounded-3xl shadow-2xl flex flex-col animate-in fade-in slide-in-from-bottom-8 duration-300 overflow-hidden ring-1 ring-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between px-8 py-6 border-b border-white/10 bg-gradient-to-r from-gray-900/50 to-transparent",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-3xl font-bold text-white tracking-tight flex items-center gap-3",children:["Career Trajectory",e.jsx("span",{className:"px-3 py-1 rounded-full bg-purple-500/10 border border-purple-500/20 text-purple-400 text-xs font-bold uppercase tracking-wider",children:"Beta"})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-1.5 flex items-center gap-2",children:[e.jsx(kr,{className:"w-4 h-4 text-yellow-500"}),"Customize your path to receive targeted training alerts"]})]}),e.jsx("button",{onClick:r,className:"p-2.5 rounded-2xl bg-white/5 hover:bg-white/10 text-gray-400 hover:text-white transition-all hover:rotate-90 duration-300",children:e.jsx(oa,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-8 custom-scrollbar scroll-smooth",children:[g&&e.jsxs("div",{className:"mb-6 p-4 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 flex items-center gap-3 text-sm font-medium animate-pulse",children:[e.jsx(Rm,{className:"w-4 h-4"}),g]}),u?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-purple-500/30 border-t-purple-500 rounded-full animate-spin mb-4"}),e.jsx("p",{className:"text-gray-400 font-medium tracking-wide",children:"Initializing path data..."})]}):e.jsxs("div",{className:"space-y-10",children:[e.jsxs("section",{className:"animate-in slide-in-from-left-4 fade-in duration-500 delay-100",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-purple-500 to-pink-600 flex items-center justify-center text-sm font-bold shadow-lg shadow-purple-900/40",children:"1"}),"Primary Specialization"]}),e.jsx("span",{className:"px-3 py-1 rounded-lg bg-gray-800 border border-gray-700 text-gray-300 text-xs font-bold uppercase tracking-wider",children:"70% Workload"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:s.map(O=>{const T=o===O.value,k=v[O.value]||"text-purple-400",$=y[O.value]||"bg-purple-500/10 border-purple-500/30";return e.jsxs("div",{onClick:()=>S(O.value),className:`
                          group relative p-6 rounded-2xl border-2 cursor-pointer transition-all duration-300
                          flex flex-col h-full min-h-[220px] overflow-hidden
                          ${T?"bg-gray-900/80 border-purple-500 shadow-[0_0_40px_-10px_rgba(168,85,247,0.3)] scale-[1.02] z-10":"bg-white/5 border-transparent hover:border-gray-700 hover:bg-white/10"}
                        `,children:[T&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-purple-500/10 to-transparent pointer-events-none"}),e.jsxs("div",{className:"flex justify-between items-start mb-4 relative z-10",children:[e.jsx("div",{className:`
                            w-14 h-14 rounded-2xl flex items-center justify-center transition-all duration-300
                            ${T?$+" shadow-inner shadow-black/50":"bg-gray-800 text-gray-500 group-hover:bg-gray-700 group-hover:text-gray-300"}
                            ${T?k:""}
                          `,children:p[O.value]||e.jsx(kr,{})}),T&&e.jsx("div",{className:"w-7 h-7 rounded-full bg-purple-500 flex items-center justify-center shadow-lg shadow-purple-500/50 animate-in zoom-in duration-300",children:e.jsx(Cr,{className:"w-4 h-4 text-white",strokeWidth:3})})]}),e.jsxs("div",{className:"relative z-10 flex flex-col flex-1",children:[e.jsx("h4",{className:`text-lg font-bold mb-2 transition-colors duration-300 ${T?"text-white":"text-gray-300 group-hover:text-white"}`,children:O.label}),e.jsx("p",{className:"text-sm text-gray-500 leading-relaxed group-hover:text-gray-400 transition-colors line-clamp-3",children:O.description})]}),e.jsx("div",{className:`mt-5 pt-4 border-t ${T?"border-purple-500/30":"border-white/5"} flex justify-between items-end`,children:e.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest transition-colors ${T?"text-purple-400":"text-gray-600 group-hover:text-gray-400"}`,children:T?"Activated":"Click to Select"})})]},O.value)})})]}),e.jsxs("section",{className:"animate-in slide-in-from-left-4 fade-in duration-500 delay-200",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-cyan-600 flex items-center justify-center text-sm font-bold shadow-lg shadow-blue-900/40",children:"2"}),"Secondary Specialization",e.jsx("span",{className:"text-sm font-normal text-gray-500 ml-1",children:"(Optional)"})]}),e.jsx("span",{className:"px-3 py-1 rounded-lg bg-gray-800 border border-gray-700 text-gray-300 text-xs font-bold uppercase tracking-wider",children:"10% Workload"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:s.filter(O=>O.value!==o).map(O=>{const T=d===O.value,k=v[O.value]||"text-blue-400";return y[O.value],e.jsxs("div",{onClick:()=>N(O.value),className:`
                                relative p-4 rounded-xl border cursor-pointer transition-all duration-200
                                flex flex-col items-center text-center
                                ${T?"bg-gray-900/90 border-blue-500 shadow-[0_0_20px_-5px_rgba(59,130,246,0.3)] scale-[1.02] z-10":"bg-white/5 border-transparent hover:border-gray-700 hover:bg-white/10"}
                            `,children:[e.jsx("div",{className:`
                                mb-3 p-3 rounded-xl transition-colors
                                ${T?"bg-blue-500/20 "+k:"bg-gray-800 text-gray-500 group-hover:bg-gray-700"}
                            `,children:me.cloneElement(p[O.value]||e.jsx(kr,{}),{className:"w-6 h-6"})}),e.jsx("h4",{className:`text-xs font-bold leading-tight ${T?"text-white":"text-gray-400"}`,children:O.label}),T&&e.jsx("div",{className:"absolute top-2 right-2 w-4 h-4 bg-blue-500 rounded-full flex items-center justify-center animate-in zoom-in",children:e.jsx(Cr,{className:"w-2.5 h-2.5 text-white"})})]},O.value)})})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-white/10 bg-[#0f1012]/80 backdrop-blur-md flex flex-col md:flex-row items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm w-full md:w-auto",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-500 font-medium",children:"Selected Path:"}),o?e.jsxs("span",{className:"flex items-center gap-2 px-4 py-1.5 rounded-full bg-purple-500/10 text-purple-300 border border-purple-500/20 font-bold shadow-lg shadow-purple-900/20",children:[me.cloneElement(p[o]||e.jsx(kr,{}),{className:"w-4 h-4"}),(_=s.find(O=>O.value===o))==null?void 0:_.label]}):e.jsx("span",{className:"text-gray-600 italic",children:"None selected"})]}),d&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-500 font-medium",children:"+ Minor:"}),e.jsxs("span",{className:"flex items-center gap-2 px-4 py-1.5 rounded-full bg-blue-500/10 text-blue-300 border border-blue-500/20 font-bold shadow-lg shadow-blue-900/20",children:[me.cloneElement(p[d]||e.jsx(kr,{}),{className:"w-4 h-4"}),(P=s.find(O=>O.value===d))==null?void 0:P.label]})]})]}),e.jsxs("div",{className:"flex gap-4 w-full md:w-auto",children:[e.jsx("button",{onClick:r,className:"px-6 py-3 rounded-xl font-bold text-gray-400 hover:bg-white/5 hover:text-white transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:w,disabled:h||!o,className:`
                        group relative flex items-center gap-2 px-8 py-3 rounded-xl font-bold text-white overflow-hidden
                        transition-all duration-300 shadow-xl
                        ${h||!o?"bg-gray-800 text-gray-500 cursor-not-allowed":"bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-500 hover:to-pink-500 hover:scale-[1.02] shadow-purple-900/40"}
                    `,children:[!h&&o&&e.jsx("div",{className:"absolute inset-0 -translate-x-full group-hover:animate-[shimmer_1.5s_infinite] bg-gradient-to-r from-transparent via-white/20 to-transparent z-10"}),h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:["Confirm Journey ",e.jsx(ds,{className:"w-5 h-5 group-hover:translate-x-1 transition-transform"})]})]})]})]})]})]}),document.body):null},Zc=()=>{const[t,r]=l.useState(null),[a,n]=l.useState(!0),[s,i]=l.useState(!1),[o,c]=l.useState(""),[d,m]=l.useState(!1),u=l.useCallback(async()=>{var b;try{n(!0);const p=localStorage.getItem("token");try{(await Ca.get(`${Y}/api/organizations/my`,{headers:{Authorization:`Bearer ${p}`}})).data.organization&&m(!0)}catch{}const v=await Ca.get("/api/assignments/user-paths",{headers:{Authorization:`Bearer ${p}`}});v.data.success&&(r(v.data),v.data.should_prompt_path_selection&&!d&&i(!0))}catch(p){console.error("Error fetching user paths:",p),((b=p.response)==null?void 0:b.status)!==404&&c("Unable to load specialization data")}finally{n(!1)}},[d]);l.useEffect(()=>{u()},[u]);const x=b=>{r(p=>({...p,...b,should_prompt_path_selection:!1}))},h=b=>({SIEM:"📊",EDR:"💻",NDR:"🌐",TI:"🔍",IR:"🚨",MAL:"🦠",DLP:"🔒",CLOUD:"☁️"})[b]||"🎯",f=b=>({SIEM:"SIEM Analyst",EDR:"Endpoint Detection",NDR:"Network Detection",TI:"Threat Intelligence",IR:"Incident Response",MAL:"Malware Analysis",DLP:"Data Loss Prevention",CLOUD:"Cloud Security"})[b]||b,g=b=>({SIEM:"#4F46E5",EDR:"#DC2626",NDR:"#0891B2",TI:"#7C3AED",IR:"#EA580C",MAL:"#16A34A",DLP:"#CA8A04",CLOUD:"#2563EB"})[b]||"#8b5cf6";return a?e.jsx("div",{className:"spec-widget loading",children:e.jsx("div",{className:"spec-widget-spinner"})}):o?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"spec-widget",children:[e.jsxs("div",{className:"spec-widget-header",children:[e.jsx("h3",{children:"🎯 Your Specialization"}),!d&&e.jsx("button",{className:"spec-change-btn",onClick:()=>i(!0),children:t!=null&&t.primary_path?"Change":"Select Path"})]}),t!=null&&t.is_in_foundations?e.jsxs("div",{className:"spec-foundations",children:[e.jsx("div",{className:"foundations-icon",children:"🌟"}),e.jsxs("div",{className:"foundations-info",children:[e.jsx("h4",{children:"Foundations Phase"}),e.jsx("p",{children:"Complete levels 1-2 to unlock specializations"}),e.jsxs("div",{className:"foundations-progress",children:[e.jsx("div",{className:"progress-bar",children:e.jsx("div",{className:"progress-fill",style:{width:`${(t==null?void 0:t.current_level)/3*100}%`}})}),e.jsxs("span",{children:["Level ",(t==null?void 0:t.current_level)||1,"/3"]})]})]})]}):t!=null&&t.primary_path?e.jsxs("div",{className:"spec-paths",children:[e.jsxs("div",{className:"spec-path primary group cursor-pointer hover:scale-[1.02] transition-all",style:{"--path-color":g(t.primary_path)},onClick:()=>!d&&i(!0),title:d?"Assigned by organization":"Click to change specialization",children:[e.jsx("div",{className:"path-icon",children:h(t.primary_path)}),e.jsxs("div",{className:"path-details",children:[e.jsx("span",{className:"path-label",children:"Primary"}),e.jsx("span",{className:"path-name",children:f(t.primary_path)})]}),e.jsx("div",{className:"path-progress",children:(()=>{var y;const b=(y=t.specialization_stats)==null?void 0:y.find(j=>j.path_code===t.primary_path),p=(b==null?void 0:b.alerts_active)||0,v=(b==null?void 0:b.alerts_completed)||0;return p>0?`${p} active`:`${v} completed`})()}),!d&&e.jsx("div",{className:"absolute inset-0 bg-black/60 opacity-0 hover:opacity-100 transition-opacity rounded-xl flex items-center justify-center",children:e.jsxs("span",{className:"text-white text-xs font-bold uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"✏️"})," Change Path"]})})]}),t.secondary_path&&e.jsxs("div",{className:"spec-path secondary group cursor-pointer hover:scale-[1.02] transition-all",style:{"--path-color":g(t.secondary_path)},onClick:()=>!d&&i(!0),title:d?"Assigned by organization":"Click to change specialization",children:[e.jsx("div",{className:"path-icon",children:h(t.secondary_path)}),e.jsxs("div",{className:"path-details",children:[e.jsx("span",{className:"path-label",children:"Secondary"}),e.jsx("span",{className:"path-name",children:f(t.secondary_path)})]}),!d&&e.jsx("div",{className:"absolute inset-0 bg-black/60 opacity-0 hover:opacity-100 transition-opacity rounded-xl flex items-center justify-center",children:e.jsxs("span",{className:"text-white text-xs font-bold uppercase tracking-wider flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:"✏️"})," Change Path"]})})]})]}):e.jsxs("div",{className:"spec-empty",onClick:()=>i(!0),children:[e.jsx("div",{className:"empty-icon",children:"🎯"}),e.jsx("p",{children:"Choose your career path to get started"}),e.jsx("span",{className:"empty-cta",children:"Select Specialization →"})]})]}),e.jsx(g_,{isOpen:s,onClose:()=>i(!1),onPathSelected:x,currentPaths:{primary_path:t==null?void 0:t.primary_path,secondary_path:t==null?void 0:t.secondary_path}})]})},ed=({onSelectAlert:t,onNavigate:r})=>{const a=Jo(),[n,s]=l.useState([]),[i,o]=l.useState(!0),[c,d]=l.useState(null),[m,u]=l.useState(!1),[x,h]=l.useState(!1),[f,g]=l.useState(null),[b,p]=l.useState(null),[v,y]=l.useState({x:0,y:0}),j=l.useRef(null),[S,N]=l.useState(""),[w,_]=l.useState("all"),[P,O]=l.useState(!1);l.useEffect(()=>{T()},[]);const T=async()=>{var W,le;try{o(!0),d(null);const U=localStorage.getItem("token"),ee=await Ca.get("/api/assignments/daily-queue",{headers:{Authorization:`Bearer ${U}`}}),ae=((W=ee.data)==null?void 0:W.queue)||ee.data||[];s(Array.isArray(ae)?ae:[])}catch(U){console.error("Error fetching daily queue:",U),((le=U.response)==null?void 0:le.status)!==404&&d("Unable to load daily queue")}finally{o(!1)}},k=async()=>{try{u(!0);const W=localStorage.getItem("token");await Ca.post("/api/assignments/generate-queue",{},{headers:{Authorization:`Bearer ${W}`}}),await T()}catch(W){console.error("Error generating queue:",W)}finally{u(!1)}},$=async W=>{var le,U,ee,ae,ue,fe,re;try{g(W);const V=localStorage.getItem("token");await Ca.post(`/api/alerts/${W}/assign`,{},{headers:{Authorization:`Bearer ${V}`}}),a(`/alerts/${W}?return_to=dashboard`)}catch(V){if(console.error("Error assigning alert:",V),((le=V.response)==null?void 0:le.status)===400||(ae=(ee=(U=V.response)==null?void 0:U.data)==null?void 0:ee.message)!=null&&ae.includes("already")){a(`/alerts/${W}?return_to=dashboard`);return}if(((ue=V.response)==null?void 0:ue.status)===403){z.error(V.response.data.message||"Access denied");return}z.error(((re=(fe=V.response)==null?void 0:fe.data)==null?void 0:re.message)||"Failed to start investigation")}finally{g(null)}},C=W=>{switch(W==null?void 0:W.toLowerCase()){case"critical":return"text-fuchsia-400 bg-fuchsia-500/10 border-fuchsia-500/20";case"high":return"text-red-400 bg-red-500/10 border-red-500/20";case"medium":return"text-orange-400 bg-orange-500/10 border-orange-500/20";case"low":return"text-yellow-400 bg-yellow-500/10 border-yellow-500/20";default:return"text-blue-400 bg-blue-500/10 border-blue-500/20"}},A=(W,le)=>{const U=le.currentTarget.getBoundingClientRect();y({x:U.left+U.width/2,y:U.top-10}),p(W)},E=()=>{p(null)},L=n.filter(W=>{var ee,ae,ue,fe;const le=S===""||((ee=W.title)==null?void 0:ee.toLowerCase().includes(S.toLowerCase()))||((ae=W.source)==null?void 0:ae.toLowerCase().includes(S.toLowerCase()))||((ue=W.mitre_technique)==null?void 0:ue.toLowerCase().includes(S.toLowerCase())),U=w==="all"||((fe=W.severity)==null?void 0:fe.toLowerCase())===w.toLowerCase();return le&&U});n.filter(W=>W.completed).length;const F=L.length,D=5,[q,Q]=l.useState(1),de=Math.ceil(F/D),H=(q-1)*D,se=L.slice(H,H+D);return l.useEffect(()=>{Q(1)},[n.length,S,w]),i?e.jsx("div",{className:"flex items-center justify-center p-8 bg-[#1a1b1e]/50 rounded-2xl border border-gray-800 h-64",children:e.jsx(Jr,{className:"animate-spin text-purple-500",size:32})}):c?null:e.jsxs("div",{className:"space-y-4",children:[b&&e.jsxs("div",{ref:j,className:"fixed z-50 bg-[#1a1b1e] border border-purple-500/30 rounded-xl p-4 shadow-2xl shadow-purple-900/30 max-w-sm pointer-events-none animate-fadeIn",style:{left:v.x,top:v.y,transform:"translate(-50%, -100%)"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border uppercase ${C(b.severity)}`,children:b.severity}),e.jsx("span",{className:"text-xs text-gray-500",children:b.source})]}),e.jsx("h4",{className:"text-white font-bold text-sm mb-2",children:b.title}),e.jsx("p",{className:"text-gray-400 text-xs line-clamp-3 leading-relaxed",children:b.details||b.description||"Investigate this security alert to determine threat level and take appropriate action."}),b.mitre_technique&&e.jsx("div",{className:"mt-2 pt-2 border-t border-gray-800",children:e.jsxs("span",{className:"text-[10px] text-purple-400 font-mono",children:["MITRE: ",b.mitre_technique]})}),e.jsx("div",{className:"absolute bottom-0 left-1/2 transform -translate-x-1/2 translate-y-full",children:e.jsx("div",{className:"w-3 h-3 bg-[#1a1b1e] border-b border-r border-purple-500/30 transform rotate-45 -translate-y-1.5"})})]}),n.length>0&&e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Jt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"text",placeholder:"Search alerts...",value:S,onChange:W=>N(W.target.value),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg pl-9 pr-8 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/20 transition-all"}),S&&e.jsx("button",{onClick:()=>N(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white p-1",children:e.jsx(oa,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:w,onChange:W=>_(W.target.value),className:"appearance-none bg-[#1a1b1e] border border-gray-700 rounded-lg px-3 py-2 pr-8 text-sm text-white focus:outline-none focus:border-purple-500/50 cursor-pointer",children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"critical",children:"Critical"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsx(tu,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-500 pointer-events-none"})]})]}),(S||w!=="all")&&n.length>0&&e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 px-1",children:[e.jsxs("span",{children:["Showing ",L.length," of ",n.length," alerts"]}),e.jsxs("button",{onClick:()=>{N(""),_("all")},className:"text-purple-400 hover:text-purple-300 flex items-center gap-1",children:[e.jsx(oa,{className:"w-3 h-3"})," Clear filters"]})]}),e.jsx("div",{className:"space-y-3",children:n.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 bg-[#1a1b1e]/50 rounded-2xl border border-gray-800 text-center animate-in fade-in transition-all",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 border border-green-500/30 flex items-center justify-center mb-4 shadow-[0_0_20px_-5px_rgba(34,197,94,0.3)]",children:e.jsx(Or,{className:"w-8 h-8 text-green-400"})}),e.jsx("h3",{className:"text-white text-lg font-bold mb-1",children:"Queue Cleared!"}),e.jsx("p",{className:"text-gray-400 text-sm mb-6 max-w-[250px]",children:"You've handled all critical alerts for today. Great job keeping the network safe."}),e.jsxs("div",{className:"flex flex-col gap-3 w-full max-w-xs",children:[e.jsxs("button",{onClick:k,className:"w-full px-6 py-3 bg-[#1a1b1e] hover:bg-[#25262b] text-white border border-gray-700 hover:border-gray-500 rounded-xl font-bold transition-all flex items-center justify-center gap-2 group",children:[m?e.jsx(Jr,{className:"animate-spin w-4 h-4"}):e.jsx(Jr,{className:"w-4 h-4 group-hover:rotate-180 transition-transform"}),m?"Checking for new threats...":"Check for New Alerts"]}),e.jsx("p",{className:"text-[10px] text-gray-600",children:"Simulate new incidents arriving"})]})]}):e.jsx(e.Fragment,{children:se.map((W,le)=>{const U=W.completed,ee=f===W.alert_id;return e.jsxs("div",{onMouseEnter:ae=>A(W,ae),onMouseLeave:E,className:`
                                        group relative overflow-hidden rounded-xl border transition-all duration-300 cursor-pointer
                                        ${U?"bg-[#1a1b1e]/30 border-green-500/20 opacity-70":"bg-[#1a1b1e]/80 border-gray-800 hover:border-purple-500/50 hover:bg-[#1f2024] hover:shadow-lg hover:shadow-purple-900/10 hover:-translate-y-0.5"}
                                    `,children:[e.jsxs("div",{className:"p-4 flex items-center gap-4",children:[e.jsx("div",{className:`
                                            flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center border
                                            ${U?"bg-green-500/10 border-green-500/20":"bg-gray-800/50 border-gray-700/50 group-hover:bg-purple-500/10 group-hover:border-purple-500/20"}
                                        `,children:U?e.jsx(Or,{className:"w-5 h-5 text-green-400"}):e.jsx(Mt,{className:"w-5 h-5 text-gray-400 group-hover:text-purple-400 transition-colors"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border uppercase ${C(W.severity)}`,children:W.severity}),e.jsx("span",{className:"text-xs text-gray-500",children:W.source}),W.mitre_technique&&e.jsx("span",{className:"text-[10px] bg-gray-800 text-gray-400 border border-gray-700 px-1.5 py-0.5 rounded font-mono ml-2",title:"MITRE ATT&CK Technique",children:W.mitre_technique})]}),e.jsx("h4",{className:`text-sm font-bold truncate transition-colors ${U?"text-gray-500 line-through":"text-gray-200 group-hover:text-white"}`,children:W.title})]}),e.jsx("div",{className:"flex-shrink-0",children:U?e.jsx("span",{className:"text-xs font-bold text-green-500/50 px-3 py-1 bg-green-500/5 rounded-full",children:"DONE"}):e.jsx("button",{onClick:ae=>{ae.stopPropagation(),$(W.alert_id)},disabled:ee,className:`
                                                        flex items-center gap-2 px-4 py-2 rounded-lg text-xs font-bold transition-all
                                                        ${ee?"bg-purple-500/20 text-purple-300 cursor-wait":"bg-purple-600 text-white hover:bg-purple-500 shadow-lg shadow-purple-900/20"}
                                                    `,children:ee?e.jsxs(e.Fragment,{children:[e.jsx(Jr,{className:"w-3.5 h-3.5 animate-spin"}),"Loading..."]}):e.jsxs(e.Fragment,{children:["Start",e.jsx(ds,{className:"w-3.5 h-3.5"})]})})})]}),ee&&e.jsx("div",{className:"absolute bottom-0 left-0 h-0.5 bg-purple-500 animate-progress w-full"})]},W.assignment_id||le)})})}),de>1&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-800/50",children:[e.jsxs("button",{onClick:()=>Q(W=>Math.max(1,W-1)),disabled:q===1,className:`
                            flex items-center gap-1 text-xs font-bold px-3 py-2 rounded-lg transition-colors
                            ${q===1?"text-gray-600 cursor-not-allowed":"text-gray-400 hover:text-white hover:bg-white/5"}
                        `,children:[e.jsx(eu,{className:"w-4 h-4 rotate-90"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:de}).map((W,le)=>e.jsx("button",{onClick:()=>Q(le+1),className:`
                                    w-2 h-2 rounded-full transition-all
                                    ${q===le+1?"bg-purple-500 w-4":"bg-gray-700 hover:bg-gray-600"}
                                `},le))}),e.jsxs("button",{onClick:()=>Q(W=>Math.min(de,W+1)),disabled:q===de,className:`
                            flex items-center gap-1 text-xs font-bold px-3 py-2 rounded-lg transition-colors
                            ${q===de?"text-gray-600 cursor-not-allowed":"text-gray-400 hover:text-white hover:bg-white/5"}
                        `,children:["Next",e.jsx(Pr,{className:"w-4 h-4"})]})]})]})},p_=({stats:t,user:r,profile:a,missions:n,analytics:s,assignedAlerts:i,onNavigate:o,onSelectAlert:c})=>{var b;const[d,m]=l.useState(null),[u,x]=l.useState(!1),h=(r==null?void 0:r.role)==="admin"||(r==null?void 0:r.role)==="alert-admin";l.useEffect(()=>{(async()=>{try{const v=localStorage.getItem("token"),y=await fetch(`${Y}/api/organizations/my`,{headers:{Authorization:`Bearer ${v}`}});y.ok&&(await y.json()).organization&&x(!0)}catch{}})()},[]),l.useEffect(()=>{(async()=>{if(!h)try{const v=localStorage.getItem("token"),y=await fetch(`${Y}/api/operations/assign-daily`,{method:"POST",headers:{Authorization:`Bearer ${v}`}});if(y.ok){const j=await y.json();j.mission&&(m(j.mission),j.is_new_assignment)}}catch(v){console.error("Failed to assign daily mission:",v)}})()},[h]);const f=(p,v)=>{if(o)switch(p){case"severity":o("alerts_page");break;case"status":v==="open"?o("alerts_page"):v==="investigating"?o("mine"):v==="closed"&&o("closed");break;default:o("alerts_page")}},g=p=>{c&&c(p,h?"alerts_page":"mine")};return h?e.jsxs("div",{className:"max-w-[1800px] mx-auto py-4 px-4 sm:px-6 lg:px-8 space-y-6 animate-fadeIn",children:[e.jsx(Yc,{user:r,profile:a,onNavigate:o}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(Qc,{analytics:s,profile:a,onNavigate:o}),e.jsx(hx,{alerts:i,onNavigate:o,onSelectAlert:c}),e.jsx(xx,{missions:n,onNavigate:o})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-6",children:[e.jsxs("div",{className:"xl:col-span-8 space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e]/50 backdrop-blur-sm border border-white/5 rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx(ru,{className:"w-5 h-5 text-purple-400"}),e.jsx("h2",{className:"text-lg font-bold text-white uppercase tracking-wider",children:"Threat Operations"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(d_,{stats:t}),e.jsx(u_,{stats:t,onNavigate:f}),e.jsx(m_,{threats:(b=t==null?void 0:t.latestThreats)==null?void 0:b.slice(0,4),onSelectAlert:c})]})]}),e.jsx(x_,{assets:t==null?void 0:t.affectedAssets,onNavigate:f})]}),e.jsxs("div",{className:"xl:col-span-4 space-y-6",children:[e.jsx(Zc,{}),e.jsx(ed,{onSelectAlert:g,onNavigate:o}),e.jsx(cp,{profile:a,onNavigate:o}),e.jsx(f_,{analytics:s,onNavigate:o}),e.jsx(Jc,{analytics:s}),e.jsx(h_,{analytics:s,onNavigate:o})]})]}),e.jsx("div",{className:"flex justify-center gap-4 pt-4 pb-8",children:e.jsxs("button",{onClick:()=>o&&o("alerts_page"),className:"flex items-center gap-2 bg-gradient-to-r from-purple-600/20 to-pink-600/20 hover:from-purple-600/30 hover:to-pink-600/30 border border-purple-500/30 text-purple-400 px-8 py-3 rounded-xl font-bold transition-all uppercase tracking-wider hover:scale-105",children:[e.jsx(Er,{className:"w-5 h-5"}),"Open Command Terminal",e.jsx(Pr,{className:"w-4 h-4"})]})})]}):e.jsxs("div",{className:"max-w-[1600px] mx-auto py-8 px-4 sm:px-6 lg:px-8 space-y-8 animate-fadeIn bg-infosec-bg min-h-screen text-white",children:[e.jsx(Yc,{user:r,profile:a,onNavigate:o}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 h-auto lg:h-[280px]",children:[e.jsxs("div",{className:"lg:col-span-8 bg-[#0e0f11] rounded-3xl border border-gray-800/60 p-1 relative overflow-hidden group hover:border-blue-500/50 transition-all duration-500 shadow-xl shadow-black/50",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 to-cyan-900/5 z-0"}),e.jsx("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px)",backgroundSize:"40px 40px"}}),d?e.jsxs("div",{className:"h-full relative z-10 bg-[#0e0f11]/80 backdrop-blur-sm rounded-[20px] p-8 flex flex-col justify-between overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-blue-500/10 rounded-full blur-[80px] -mr-16 -mt-16 pointer-events-none"}),e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 px-3 py-1 bg-blue-500/10 border border-blue-500/20 rounded-md text-[10px] font-black uppercase tracking-[0.2em] text-blue-400",children:[e.jsx(kr,{className:"w-3 h-3"})," Daily Op"]}),e.jsx("span",{className:`px-3 py-1 rounded-md text-[10px] font-black uppercase tracking-[0.2em] border ${(d.difficulty_level||"intermediate").toLowerCase()==="novice"?"bg-green-500/10 text-green-400 border-green-500/20":(d.difficulty_level||"intermediate").toLowerCase()==="intermediate"?"bg-amber-500/10 text-amber-400 border-amber-500/20":"bg-red-500/10 text-red-400 border-red-500/20"}`,children:d.difficulty_level||"CLASSIFIED"})]}),e.jsx("h2",{className:"text-3xl font-black text-white italic tracking-wide mt-2 drop-shadow-lg",children:d.title})]}),e.jsxs("div",{className:"hidden sm:flex flex-col items-end text-right opacity-50",children:[e.jsx("span",{className:"text-[10px] font-mono text-blue-300",children:"OP-ID"}),e.jsx("span",{className:"text-xl font-mono text-blue-500 font-bold",children:d.id.toString().padStart(4,"0")})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-end justify-between gap-6 mt-6",children:[e.jsx("p",{className:"text-gray-400 text-sm leading-relaxed max-w-2xl font-medium",children:d.description||"Intelligence unavailable. Proceed to mission briefing for details."}),e.jsxs("button",{onClick:()=>o("mission",d.id),className:"w-full sm:w-auto px-8 py-4 bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl shadow-lg shadow-blue-600/20 hover:shadow-blue-600/40 transform hover:-translate-y-1 transition-all flex items-center justify-center gap-3 group/btn",children:[e.jsx("span",{className:"uppercase tracking-widest text-xs",children:"Deploy"}),e.jsx(ds,{className:"w-4 h-4 group-hover/btn:translate-x-1 transition-transform"})]})]})]}):e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-500 bg-[#0e0f11]/80 backdrop-blur-sm rounded-[20px]",children:[e.jsx(y1,{className:"w-12 h-12 mb-4 opacity-20"}),e.jsx("span",{className:"text-sm font-mono uppercase tracking-widest",children:"No Active Operations"})]})]}),e.jsx("div",{onClick:()=>window.location.href="/ctf",className:"lg:col-span-4 bg-[#0e0f11] rounded-3xl border border-gray-800/60 p-1 relative overflow-hidden group cursor-pointer hover:border-purple-500/50 transition-all duration-500 shadow-xl shadow-black/50 hover:shadow-[0_0_30px_rgba(168,85,247,0.15)]",children:e.jsxs("div",{className:"h-full bg-gradient-to-b from-[#1a1b1e] to-[#0e0f11] rounded-[20px] p-8 flex flex-col justify-between relative z-10",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-purple-600/10 rounded-full blur-[50px] -mr-8 -mt-8 pointer-events-none group-hover:bg-purple-600/20 group-hover:scale-150 transition-all duration-700"}),e.jsxs("div",{className:"flex items-start justify-between relative z-10",children:[e.jsx("div",{className:"p-3 bg-purple-500/10 border border-purple-500/20 rounded-xl group-hover:scale-110 group-hover:bg-purple-500/20 group-hover:shadow-[0_0_15px_rgba(168,85,247,0.4)] transition-all duration-300",children:e.jsx(Ff,{className:"w-6 h-6 text-purple-400 group-hover:text-purple-300"})}),e.jsxs("div",{className:"flex flex-col items-end gap-1 opacity-80 group-hover:opacity-100 transition-opacity",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-500 animate-pulse shadow-[0_0_8px_rgba(168,85,247,0.8)]"}),e.jsx("span",{className:"text-[10px] font-mono font-bold text-purple-400",children:"SEASON 4"})]}),e.jsx("span",{className:"text-xs text-gray-500 font-mono",children:"Rank: #42"})]})]}),e.jsxs("div",{className:"mt-4 relative z-10",children:[e.jsx("h2",{className:"text-2xl font-black text-white italic tracking-wide group-hover:text-transparent group-hover:bg-clip-text group-hover:bg-gradient-to-r group-hover:from-purple-400 group-hover:to-pink-400 transition-all duration-300",children:"Arena"}),e.jsx("p",{className:"text-gray-500 text-xs font-mono uppercase tracking-wider mt-1",children:"Linux / Windows / Cloud"})]}),e.jsxs("div",{className:"mt-4 relative z-10",children:[e.jsxs("div",{className:"flex justify-between items-end mb-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-400 uppercase tracking-widest font-bold",children:"Arena Progress"}),e.jsx("span",{className:"text-xs font-bold text-purple-400",children:"45%"})]}),e.jsx("div",{className:"w-full bg-gray-800/80 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-pink-500 h-full rounded-full transition-all duration-1000 relative",style:{width:"45%"},children:e.jsx("div",{className:"absolute inset-0 bg-white/20 w-full animate-[shimmer_2s_infinite]"})})})]}),e.jsxs("div",{className:"mt-5 pt-5 border-t border-gray-800/80 flex items-center justify-between relative z-10 group-hover:border-purple-500/30 transition-colors",children:[e.jsx("span",{className:"text-[10px] text-gray-400 uppercase tracking-widest font-bold group-hover:text-gray-300",children:"60 Active CTFs"}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-800/80 flex items-center justify-center group-hover:bg-purple-600 group-hover:text-white group-hover:shadow-[0_0_15px_rgba(168,85,247,0.5)] transition-all duration-300",children:e.jsx(Pr,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-8 items-start",children:[e.jsxs("div",{className:"xl:col-span-8 flex flex-col gap-8",children:[e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-2xl hover:border-gray-700 transition-colors duration-300",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(wo,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Priority Queue"})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500/50"}),e.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-500/50"}),e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500/50"})]})]}),e.jsx("div",{className:"p-6 bg-gradient-to-b from-[#0e0f11] to-[#0e0f11]/50 backdrop-blur-xl",children:e.jsx(ed,{onSelectAlert:g,onNavigate:o})})]}),e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-2xl hover:border-blue-900/40 hover:shadow-[0_0_20px_rgba(59,130,246,0.05)] transition-all duration-300",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Er,{className:"w-5 h-5 text-blue-500 animate-pulse"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Active Investigations"})]})}),e.jsx("div",{className:"p-6",children:e.jsx(hx,{alerts:i,onNavigate:o,onSelectAlert:c})})]}),e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-2xl",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Cn,{className:"w-5 h-5 text-emerald-500"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Academy Progress"})]})}),e.jsx("div",{className:"p-0",children:e.jsx(Qc,{analytics:s,profile:a,onNavigate:o})})]})]}),e.jsxs("div",{className:"xl:col-span-4 flex flex-col gap-8",children:[u?e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-3xl p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-indigo-500/10 rounded-full blur-2xl -mr-8 -mt-8"}),e.jsxs("div",{className:"flex items-center gap-3 mb-4 relative z-10",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-500/20 flex items-center justify-center border border-indigo-500/30",children:e.jsx(xr,{className:"w-5 h-5 text-indigo-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-bold",children:"Team Member"}),e.jsx("span",{className:"text-[10px] text-indigo-400 font-mono uppercase tracking-wider",children:"Enterprise Access"})]})]}),e.jsx("p",{className:"text-gray-400 text-xs mb-4",children:"Your training path is synchronized with your organization's objectives."}),e.jsxs("button",{onClick:()=>o("team"),className:"w-full py-2.5 bg-indigo-600/10 hover:bg-indigo-600/20 text-indigo-300 border border-indigo-500/20 rounded-xl text-xs font-bold uppercase tracking-widest flex items-center justify-center gap-2 transition-all hover:border-indigo-500/40",children:["Team Dashboard ",e.jsx(Pr,{className:"w-3 h-3"})]})]}):e.jsx("div",{className:"transform hover:scale-[1.02] transition-transform duration-300",children:e.jsx(Zc,{})}),e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-xl hover:border-green-900/40 transition-colors duration-300 relative group flex-1",children:[e.jsx("div",{className:"absolute inset-0 bg-green-500/5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none"}),e.jsx("div",{className:"p-1 h-full",children:e.jsx(Jc,{analytics:s})})]}),e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-xl flex-1 hover:border-red-900/40 transition-colors duration-300 relative group",children:[e.jsx("div",{className:"absolute inset-0 bg-red-500/5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none"}),e.jsxs("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center gap-3",children:[e.jsx(Mt,{className:"w-5 h-5 text-red-500 group-hover:scale-110 transition-transform"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Active Operations"})]}),e.jsx("div",{className:"p-4",children:e.jsx(xx,{missions:n,onNavigate:o})})]})]})]})]})},b_=({organizationId:t,members:r})=>{const[a,n]=l.useState([]),[s,i]=l.useState(!0),[o,c]=l.useState([]),[d,m]=l.useState(""),[u,x]=l.useState("all"),[h,f]=l.useState(!1),[g,b]=l.useState(!1),[p,v]=l.useState(!1),[y,j]=l.useState(!1),[S,N]=l.useState(null),[w,_]=l.useState(null),[P,O]=l.useState([]),[T,k]=l.useState(null),[$,C]=l.useState(!1),[A,E]=l.useState(!1),[L,F]=l.useState(null),[D,q]=l.useState("member"),[Q,de]=l.useState(""),[H,se]=l.useState({title:"",description:"",time_limit_minutes:60,passing_score:70,difficulty_filter:"",alert_type_filter:"",random_count:3}),[W,le]=l.useState({email:"",name:""}),[U,ee]=l.useState([]);l.useEffect(()=>{ae(),ue()},[]);const ae=async()=>{try{const K=localStorage.getItem("token"),I=await(await fetch(`${Y}/api/assessments`,{headers:{Authorization:`Bearer ${K}`}})).json();n(I.assessments||[])}catch(K){console.error("Error fetching assessments:",K)}finally{i(!1)}},ue=async()=>{try{const K=localStorage.getItem("token"),I=await(await fetch(`${Y}/api/alerts`,{headers:{Authorization:`Bearer ${K}`}})).json();c(Array.isArray(I)?I:I.alerts||[])}catch(K){console.error("Error fetching alerts:",K)}},fe=async K=>{K.preventDefault();try{const ie=localStorage.getItem("token");(await fetch(`${Y}/api/assessments`,{method:"POST",headers:{Authorization:`Bearer ${ie}`,"Content-Type":"application/json"},body:JSON.stringify(H)})).ok&&(f(!1),se({title:"",description:"",time_limit_minutes:60,passing_score:70,difficulty_filter:"",alert_type_filter:"",random_count:3}),ae())}catch(ie){console.error("Error creating assessment:",ie)}},re=K=>{se({title:`${K.title} (Copy)`,description:K.description,time_limit_minutes:K.time_limit_minutes,passing_score:K.passing_score,difficulty_filter:K.difficulty_filter||"",alert_type_filter:K.alert_type_filter||"",random_count:K.random_count}),f(!0)},V=async K=>{K.preventDefault();const ie=D==="member"?{userId:Q}:W;try{const I=localStorage.getItem("token"),R=await fetch(`${Y}/api/assessments/${S.id}/invite`,{method:"POST",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify(ie)}),je=await R.json();R.ok&&(ee([...U,je.invite]),le({email:"",name:""}),de(""))}catch(I){console.error("Error inviting candidate:",I)}},ce=K=>{navigator.clipboard.writeText(K),C(!0),setTimeout(()=>C(!1),2e3)},Z=async K=>{try{const ie=localStorage.getItem("token"),R=await(await fetch(`${Y}/api/assessments/results/${K}`,{headers:{Authorization:`Bearer ${ie}`}})).json();_(R),k(null),v(!0)}catch(ie){console.error("Error fetching results:",ie)}},xe=async K=>{N(K);try{const ie=localStorage.getItem("token"),R=await(await fetch(`${Y}/api/assessments/${K.id}/invites`,{headers:{Authorization:`Bearer ${ie}`}})).json();O(R.invites||[]),j(!0)}catch(ie){console.error("Error fetching invites:",ie),alert("Failed to load details")}},pe=async K=>{try{const ie=localStorage.getItem("token");(await fetch(`${Y}/api/assessments/${K}`,{method:"DELETE",headers:{Authorization:`Bearer ${ie}`}})).ok?(n(a.filter(R=>R.id!==K)),E(!1),F(null)):alert("Failed to delete assessment")}catch(ie){console.error("Error deleting assessment:",ie)}},Se=(K,ie,I)=>{const R={pending:"bg-gray-500/10 text-gray-400 border-gray-500/20",started:"bg-blue-500/10 text-blue-400 border-blue-500/20",completed:ie>=I?"bg-green-500/10 text-green-400 border-green-500/20":"bg-red-500/10 text-red-400 border-red-500/20",expired:"bg-red-500/10 text-red-400 border-red-500/20"};let je=K.charAt(0).toUpperCase()+K.slice(1);return K==="completed"&&(je=ie>=I?"PASSED":"FAILED"),e.jsx("span",{className:`text-[10px] font-bold px-2 py-1 rounded border uppercase tracking-wider ${R[K]||R.pending}`,children:je})},ke=a.filter(K=>{const ie=K.title.toLowerCase().includes(d.toLowerCase());return u==="active"?ie&&K.invite_count>0:u==="empty"?ie&&K.invite_count===0:ie}),$e=me.useMemo(()=>o.filter(K=>{const ie=H.difficulty_filter?K.difficulty===H.difficulty_filter:!0,I=H.alert_type_filter?K.alert_type===H.alert_type_filter:!0;return ie&&I}),[o,H.difficulty_filter,H.alert_type_filter]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-center justify-between gap-6 mb-8",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-purple-400 mb-1",children:[e.jsx("span",{children:"OPS_CENTER"}),e.jsx("span",{className:"text-gray-600",children:"/"}),e.jsx("span",{children:"ASSESSMENTS"})]}),e.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[e.jsx(dr,{className:"w-6 h-6 text-purple-400"}),"Skill Assessments"]}),e.jsx("p",{className:"text-gray-400 mt-1",children:"Create timed challenges for candidate evaluation and team benchmarking"})]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-3 w-full xl:w-auto",children:[e.jsxs("div",{className:"relative flex-1 md:w-64",children:[e.jsx(Jt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"text",placeholder:"Search assessments...",value:d,onChange:K=>m(K.target.value),className:"w-full bg-[#111215] border border-gray-800 rounded-xl pl-10 pr-4 py-2.5 text-white focus:border-purple-500 focus:outline-none transition-all text-sm"})]}),e.jsxs("button",{onClick:()=>f(!0),className:"bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white px-5 py-2.5 rounded-xl font-bold shadow-lg shadow-purple-900/20 transition-all flex items-center justify-center gap-2 transform hover:scale-[1.02] border border-white/5 whitespace-nowrap",children:[e.jsx(oi,{className:"w-5 h-5"}),"New Assessment"]})]})]}),s?e.jsxs("div",{className:"text-center py-24 min-h-[400px] flex flex-col items-center justify-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-400 font-mono text-sm animate-pulse",children:"SYNCING ASSESSMENT DATA..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[ke.map(K=>e.jsxs("div",{className:"group bg-[#1a1b1e] border border-gray-800 rounded-xl p-0 hover:border-purple-500/50 hover:shadow-2xl hover:shadow-purple-900/10 transition-all duration-300 relative overflow-hidden flex flex-col",children:[e.jsx("div",{className:"h-1 w-full bg-gradient-to-r from-purple-500 to-indigo-600 opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsx("div",{className:"absolute -top-6 -right-6 p-4 opacity-[0.03] group-hover:opacity-[0.07] transition-opacity pointer-events-none",children:e.jsx(dr,{className:"w-48 h-48 text-white transform rotate-12"})}),e.jsxs("div",{className:"p-6 flex-1 flex flex-col relative z-10",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("h3",{className:"text-white font-bold text-lg pr-4 group-hover:text-purple-400 transition-colors line-clamp-1",children:K.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:ie=>{ie.stopPropagation(),re(K)},className:"text-gray-600 hover:text-white p-1.5 rounded hover:bg-white/5 transition-colors",title:"Duplicate Assessment",children:e.jsx(ao,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex items-center gap-1.5 bg-[#111215] border border-gray-700 px-2 py-1 rounded text-purple-400 text-xs font-mono",children:[e.jsx(va,{className:"w-3 h-3"}),e.jsxs("span",{children:[K.time_limit_minutes,"m"]})]})]})]}),e.jsx("p",{className:"text-gray-400 text-sm mb-6 line-clamp-2 leading-relaxed min-h-[40px]",children:K.description||"No description provided."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-6 bg-[#111215]/50 p-2 rounded-lg border border-gray-800/50",children:[e.jsxs("div",{className:"p-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold block mb-1",children:"Candidates"}),e.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-lg",children:[e.jsx(At,{className:"w-4 h-4 text-purple-500"}),e.jsx("span",{children:K.invite_count})]})]}),e.jsxs("div",{className:"p-2 border-l border-gray-800/50 pl-4",children:[e.jsx("span",{className:"text-[10px] text-gray-500 uppercase tracking-wider font-bold block mb-1",children:"Pass Rate"}),e.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-lg",children:[e.jsx(ya,{className:"w-4 h-4 text-green-500"}),e.jsxs("span",{children:[Math.round((K.completed_count>0?K.passed_count/K.completed_count:0)*100)||0,"%"]})]})]})]}),e.jsxs("div",{className:"mt-auto pt-4 border-t border-gray-800 flex items-center gap-3",children:[e.jsxs("div",{className:"text-xs text-gray-500 flex items-center gap-1.5 font-mono",children:[e.jsx(xr,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:[K.random_count," SCENARIOS"]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[e.jsx("button",{onClick:ie=>{ie.stopPropagation(),F(K),E(!0)},className:"text-gray-600 hover:text-red-400 p-2 rounded-lg hover:bg-red-500/10 transition-colors",title:"Delete Assessment",children:e.jsx(na,{className:"w-4 h-4"})}),e.jsx("button",{onClick:ie=>{ie.stopPropagation(),xe(K)},className:"text-gray-600 hover:text-purple-400 p-2 rounded-lg hover:bg-purple-500/10 transition-colors",title:"View Details",children:e.jsx(cs,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:()=>{N(K),b(!0)},className:"flex items-center gap-2 bg-gradient-to-r from-purple-600/10 to-indigo-600/10 hover:from-purple-600 hover:to-indigo-600 border border-purple-500/30 hover:border-transparent text-purple-400 hover:text-white px-4 py-2 rounded-lg text-sm font-bold transition-all shadow-lg shadow-purple-900/0 hover:shadow-purple-900/20",children:[e.jsx(ei,{className:"w-3.5 h-3.5"}),"Invite"]})]})]})]})]},K.id)),e.jsxs("button",{onClick:()=>f(!0),className:"group border border-dashed border-gray-700 hover:border-purple-500/50 rounded-xl p-5 flex flex-col items-center justify-center text-center hover:bg-purple-900/5 transition-all min-h-[300px]",children:[e.jsx("div",{className:"w-16 h-16 bg-[#111215] rounded-full flex items-center justify-center mb-4 group-hover:scale-110 transition-transform border border-gray-800 group-hover:border-purple-500/30 shadow-xl",children:e.jsx(oi,{className:"w-8 h-8 text-gray-500 group-hover:text-purple-400 transition-colors"})}),e.jsx("h3",{className:"text-white font-bold mb-2 text-lg",children:"Create New Assessment"}),e.jsx("p",{className:"text-gray-500 text-sm max-w-xs",children:"Design a bespoke skill evaluation with custom scenarios and difficulty levels."})]})]}),a.length===0&&e.jsxs("div",{className:"col-span-full text-center py-20 text-gray-500 bg-[#1a1b1e] rounded-2xl border border-gray-800 border-dashed",children:[e.jsx(dr,{className:"w-16 h-16 mx-auto mb-4 opacity-20"}),e.jsx("h3",{className:"text-lg font-bold text-gray-300",children:"No Assessments Found"}),e.jsx("p",{className:"mb-6",children:"Get started by creating your first skill assessment."}),e.jsx("button",{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-500 text-white px-6 py-2 rounded-lg font-bold transition-colors",children:"Create Assessment"})]})]}),h&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 animate-fadeIn p-4 overflow-y-auto",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-700 rounded-2xl w-full max-w-2xl shadow-2xl relative overflow-hidden my-auto",children:[e.jsx("div",{className:"absolute top-0 w-full h-1 bg-gradient-to-r from-purple-500 to-indigo-600"}),e.jsxs("div",{className:"p-6 md:p-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h3",{className:"text-2xl font-bold text-white",children:"Create Assessment"}),e.jsx("button",{onClick:()=>f(!1),className:"text-gray-500 hover:text-white transition-colors",children:e.jsx(Gl,{className:"w-6 h-6"})})]}),e.jsxs("form",{onSubmit:fe,className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-purple-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Title"}),e.jsxs("div",{className:"relative",children:[e.jsx(dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"text",value:H.title,onChange:K=>se({...H,title:K.target.value}),className:"w-full bg-[#111215] border border-gray-700 rounded-lg pl-9 pr-4 py-3 text-white focus:border-purple-500 focus:ring-1 focus:ring-purple-500 focus:outline-none transition-all placeholder-gray-600",placeholder:"e.g. Q1 Senior Analyst Evaluation",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-purple-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Description"}),e.jsx("textarea",{value:H.description,onChange:K=>se({...H,description:K.target.value}),className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-purple-500 focus:ring-1 focus:ring-purple-500 focus:outline-none transition-all placeholder-gray-600 resize-none h-24",placeholder:"Brief description of the assessment goals..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-2",children:[e.jsx("label",{className:"text-purple-400 text-xs font-bold uppercase tracking-wider",children:"Time Limit"}),e.jsxs("span",{className:"text-white text-xs font-mono",children:[H.time_limit_minutes," min"]})]}),e.jsx("input",{type:"range",min:"15",max:"180",step:"15",value:H.time_limit_minutes,onChange:K=>se({...H,time_limit_minutes:parseInt(K.target.value)}),className:"w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-purple-500"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-2",children:[e.jsx("label",{className:"text-purple-400 text-xs font-bold uppercase tracking-wider",children:"Passing Score"}),e.jsxs("span",{className:"text-white text-xs font-mono",children:[H.passing_score,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:H.passing_score,onChange:K=>se({...H,passing_score:parseInt(K.target.value)}),className:"w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-green-500"})]})]})]}),e.jsxs("div",{className:"space-y-5 bg-[#111215] p-5 rounded-xl border border-gray-800",children:[e.jsxs("h4",{className:"text-white font-bold flex items-center gap-2 text-sm border-b border-gray-800 pb-2",children:[e.jsx(xr,{className:"w-4 h-4 text-purple-500"}),"Scenario Configuration"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-500 text-[10px] font-bold uppercase tracking-wider mb-2",children:"Difficulty"}),e.jsxs("select",{value:H.difficulty_filter,onChange:K=>se({...H,difficulty_filter:K.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg px-3 py-2 text-white focus:border-purple-500 outline-none text-xs",children:[e.jsx("option",{value:"",children:"Any Difficulty"}),e.jsx("option",{value:"Beginner",children:"Beginner"}),e.jsx("option",{value:"Intermediate",children:"Intermediate"}),e.jsx("option",{value:"Advanced",children:"Advanced"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-500 text-[10px] font-bold uppercase tracking-wider mb-2",children:"Alert Type"}),e.jsxs("select",{value:H.alert_type_filter,onChange:K=>se({...H,alert_type_filter:K.target.value}),className:"w-full bg-[#1a1b1e] border border-gray-700 rounded-lg px-3 py-2 text-white focus:border-purple-500 outline-none text-xs",children:[e.jsx("option",{value:"",children:"Any Type"}),e.jsx("option",{value:"Phishing",children:"Phishing"}),e.jsx("option",{value:"Malware",children:"Malware"}),e.jsx("option",{value:"Ransomware",children:"Ransomware"}),e.jsx("option",{value:"Web Attack",children:"Web Attack"}),e.jsx("option",{value:"Network Intrusion",children:"Network Intrusion"})]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-2",children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-bold uppercase tracking-wider",children:"Number of Scenarios"}),e.jsx("span",{className:"text-white text-xs font-mono font-bold",children:H.random_count})]}),e.jsx("input",{type:"range",min:"1",max:Math.min(10,Math.max(1,$e.length)),value:H.random_count,onChange:K=>se({...H,random_count:parseInt(K.target.value)}),className:"w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-blue-500"})]}),e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-bold uppercase tracking-wider",children:"Potential Scenarios"}),e.jsxs("span",{className:`text-[10px] px-1.5 rounded font-mono ${$e.length>0?"bg-blue-500/20 text-blue-400":"bg-red-500/20 text-red-400"}`,children:[$e.length," Matches"]})]}),e.jsx("div",{className:"bg-[#1a1b1e] border border-gray-700 rounded-lg h-32 overflow-y-auto custom-scrollbar p-2",children:$e.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-600 text-xs text-center p-2",children:[e.jsx(xs,{className:"w-4 h-4 mb-1 opacity-50"}),"No scenarios match your filters."]}):e.jsxs("div",{className:"space-y-1.5",children:[$e.map((K,ie)=>e.jsxs("div",{className:"text-xs text-gray-300 flex items-center gap-2 p-1.5 hover:bg-white/5 rounded transition-colors truncate",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${K.severity==="Critical"?"bg-red-500":K.severity==="High"?"bg-orange-500":K.severity==="Medium"?"bg-yellow-500":"bg-blue-500"}`}),e.jsx("span",{className:"truncate",children:K.title})]},ie)),$e.length>0&&e.jsxs("div",{className:"text-[10px] text-gray-600 pt-2 text-center border-t border-gray-800 mt-2",children:[H.random_count," scenarios will be randomly selected from this list."]})]})})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-4 border-t border-gray-800 mt-4",children:[e.jsx("button",{type:"button",onClick:()=>f(!1),className:"flex-1 bg-gray-800 hover:bg-gray-700 text-white py-3 rounded-xl font-bold transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:$e.length===0,className:"flex-1 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed text-white py-3 rounded-xl font-bold transition-all shadow-lg shadow-purple-900/20",children:"Create Assessment"})]})]})]})]})}),g&&S&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 animate-fadeIn p-4",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-700 rounded-xl p-6 w-full max-w-lg shadow-2xl",children:[e.jsxs("h3",{className:"text-xl font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(ei,{className:"w-5 h-5 text-purple-400"}),"Assign Assessment"]}),e.jsxs("div",{className:"flex bg-[#111215] p-1.5 rounded-xl mb-6 border border-gray-800",children:[e.jsx("button",{onClick:()=>q("member"),className:`flex-1 py-2 text-xs font-bold uppercase tracking-wider rounded-lg transition-all ${D==="member"?"bg-[#25262b] text-white shadow-lg border border-gray-700":"text-gray-500 hover:text-gray-300"}`,children:"Organization Member"}),e.jsx("button",{onClick:()=>q("external"),className:`flex-1 py-2 text-xs font-bold uppercase tracking-wider rounded-lg transition-all ${D==="external"?"bg-[#25262b] text-white shadow-lg border border-gray-700":"text-gray-500 hover:text-gray-300"}`,children:"External Candidate"})]}),e.jsxs("form",{onSubmit:V,className:"space-y-4 mb-6",children:[D==="member"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Select Member"}),e.jsxs("select",{value:Q,onChange:K=>de(K.target.value),className:"w-full bg-[#111215] border border-gray-700 rounded-xl px-4 py-3 text-white focus:border-purple-500 focus:outline-none transition-colors",required:D==="member",children:[e.jsx("option",{value:"",children:"Select a team member..."}),r&&r.map(K=>e.jsxs("option",{value:K.user_id,children:[K.name," (",K.email,")"]},K.user_id))]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Candidate Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(At,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"text",value:W.name,onChange:K=>le({...W,name:K.target.value}),className:"w-full bg-[#111215] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-white focus:border-purple-500 focus:outline-none",placeholder:"John Doe"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase tracking-wider mb-2",children:"Email Address"}),e.jsxs("div",{className:"relative",children:[e.jsx(ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),e.jsx("input",{type:"email",value:W.email,onChange:K=>le({...W,email:K.target.value}),className:"w-full bg-[#111215] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-white focus:border-purple-500 focus:outline-none",placeholder:"john@example.com",required:D==="external"})]})]})]}),e.jsx("button",{type:"submit",className:"w-full bg-purple-600 hover:bg-purple-500 text-white py-3 rounded-xl font-bold transition-all shadow-lg shadow-purple-900/20 mt-4",children:D==="member"?"Assign to Member":"Generate Invite Link"})]}),U.length>0&&e.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[e.jsx("h4",{className:"text-gray-400 text-xs font-bold uppercase tracking-wider mb-3",children:"Recently Generated Invites"}),e.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto custom-scrollbar pr-1",children:U.map((K,ie)=>e.jsxs("div",{className:"bg-[#111215] rounded-xl p-3 flex items-center justify-between border border-gray-800",children:[e.jsxs("div",{className:"flex-1 min-w-0 mr-3",children:[e.jsx("div",{className:"text-white text-sm font-bold truncate",children:K.name||K.email}),e.jsx("div",{className:"text-gray-500 text-xs truncate bg-black/30 p-1.5 rounded mt-1 font-mono select-all",children:K.link})]}),e.jsx("button",{onClick:()=>ce(K.link),className:`p-2 rounded-lg transition-colors ${$?"bg-green-500/10 text-green-500":"bg-gray-800 hover:bg-white/10 text-gray-400"}`,children:$?e.jsx(Or,{className:"w-4 h-4"}):e.jsx(ao,{className:"w-4 h-4"})})]},ie))})]}),e.jsx("button",{onClick:()=>{b(!1),ee([]),q("member"),de("")},className:"w-full mt-6 bg-gray-800 hover:bg-gray-700 text-white py-2 rounded-lg font-bold text-sm",children:"Close"})]})}),p&&w&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-700 rounded-2xl w-full max-w-3xl max-h-[85vh] overflow-hidden flex flex-col shadow-2xl",children:[e.jsxs("div",{className:"bg-[#111215] p-6 border-b border-gray-800 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"Full Report"}),e.jsxs("p",{className:"text-gray-500 text-sm",children:[w.candidate.name," • ",e.jsx("span",{className:"text-purple-400",children:w.candidate.email})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:`text-4xl font-mono font-bold ${w.candidate.passed?"text-green-500":"text-red-500"}`,children:[w.candidate.score,"%"]}),e.jsx("div",{className:"text-xs uppercase tracking-wider font-bold text-gray-600 mt-1",children:"Final Score"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[e.jsxs("div",{className:"bg-gray-800/30 border border-gray-700/50 p-3 rounded-xl text-center",children:[e.jsx(va,{className:"w-5 h-5 mx-auto text-blue-400 mb-1"}),e.jsx("div",{className:"text-xs text-gray-500",children:"Duration"}),e.jsxs("div",{className:"text-white font-bold",children:[Math.round(w.candidate.time_spent_seconds/60),"m"]})]}),e.jsxs("div",{className:"bg-gray-800/30 border border-gray-700/50 p-3 rounded-xl text-center",children:[e.jsx(ya,{className:"w-5 h-5 mx-auto text-yellow-400 mb-1"}),e.jsx("div",{className:"text-xs text-gray-500",children:"Passing Score"}),e.jsxs("div",{className:"text-white font-bold",children:[w.candidate.passing_score,"%"]})]}),e.jsxs("div",{className:"bg-gray-800/30 border border-gray-700/50 p-3 rounded-xl text-center",children:[e.jsx(Or,{className:"w-5 h-5 mx-auto text-green-400 mb-1"}),e.jsx("div",{className:"text-xs text-gray-500",children:"Correct"}),e.jsxs("div",{className:"text-white font-bold",children:[w.responses.filter(K=>K.is_correct).length," / ",w.responses.length]})]}),e.jsxs("div",{className:"bg-gray-800/30 border border-gray-700/50 p-3 rounded-xl text-center",children:[e.jsx(Gv,{className:"w-5 h-5 mx-auto text-purple-400 mb-1"}),e.jsx("div",{className:"text-xs text-gray-500",children:"Status"}),e.jsx("div",{className:"text-white font-bold uppercase",children:w.candidate.status})]})]}),e.jsxs("h4",{className:"text-white font-bold text-lg mb-4 flex items-center gap-2",children:[e.jsx(Hj,{className:"w-5 h-5 text-purple-500"}),"Scenario Breakdown"]}),e.jsx("div",{className:"space-y-4",children:w.responses.map((K,ie)=>e.jsx("div",{className:"bg-[#111215] border border-gray-800 rounded-xl overflow-hidden hover:border-gray-600 transition-colors",children:e.jsxs("div",{className:"p-4 flex items-start gap-4 cursor-pointer",onClick:()=>k(T===ie?null:ie),children:[e.jsx("div",{className:`mt-1 w-8 h-8 rounded-full flex items-center justify-center border ${K.is_correct?"bg-green-500/10 border-green-500/30 text-green-500":"bg-red-500/10 border-red-500/30 text-red-500"}`,children:K.is_correct?e.jsx(Or,{className:"w-5 h-5"}):e.jsx(Gl,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("h5",{className:"text-white font-bold",children:K.alert_title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`text-sm font-bold ${K.score>0?"text-green-400":"text-red-400"}`,children:[K.score,"%"]}),T===ie?e.jsx(Wj,{className:"w-4 h-4 text-gray-500"}):e.jsx(eu,{className:"w-4 h-4 text-gray-500"})]})]}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("span",{className:"text-[10px] bg-gray-800 text-gray-400 px-2 py-0.5 rounded border border-gray-700 uppercase",children:K.alert_type}),e.jsx("span",{className:"text-[10px] bg-gray-800 text-gray-400 px-2 py-0.5 rounded border border-gray-700 uppercase",children:K.severity})]}),T===ie&&e.jsxs("div",{className:"mt-4 pt-3 border-t border-gray-800/50 animate-fadeIn",children:[K.details&&e.jsxs("div",{className:"mb-3",children:[e.jsx("span",{className:"text-xs text-purple-400 font-bold uppercase tracking-wider block mb-1",children:"Scenario Details"}),e.jsx("p",{className:"text-gray-300 text-sm bg-gray-800/30 p-3 rounded-lg border border-gray-800",children:K.details})]}),e.jsx("span",{className:"text-xs text-yellow-400 font-bold uppercase tracking-wider block mb-1",children:"User Notes"}),e.jsxs("p",{className:"text-gray-300 text-sm bg-yellow-500/5 border border-yellow-500/10 p-3 rounded-lg italic",children:['"',K.user_notes||"No notes provided by candidate.",'"']})]})]})]})},ie))})]}),e.jsx("div",{className:"p-4 bg-[#111215] border-t border-gray-800",children:e.jsx("button",{onClick:()=>v(!1),className:"w-full bg-gray-800 hover:bg-gray-700 text-white py-3 rounded-xl font-bold transition-all",children:"Close Report"})})]})}),y&&S&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-700 rounded-2xl w-full max-w-5xl max-h-[90vh] flex flex-col shadow-2xl overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-[#111215] flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[e.jsx(dr,{className:"w-6 h-6 text-purple-400"}),S.title]}),e.jsx("p",{className:"text-gray-500 text-sm mt-1",children:"Performance Overview & Candidate Management"})]}),e.jsx("button",{onClick:()=>j(!1),className:"text-gray-500 hover:text-white transition-colors",children:e.jsx(Gl,{className:"w-8 h-8"})})]}),e.jsxs("div",{className:"p-6 bg-[#1a1b1e] border-b border-gray-800 grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-900/10 to-blue-600/5 border border-blue-500/20 rounded-xl p-5 relative overflow-hidden",children:[e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-blue-400 text-xs font-bold uppercase tracking-wider mb-1",children:"Total Invites"}),e.jsx("div",{className:"text-white text-3xl font-bold",children:P.length})]}),e.jsx(At,{className:"absolute right-4 bottom-4 w-12 h-12 text-blue-500/10"})]}),e.jsxs("div",{className:"bg-gradient-to-br from-green-900/10 to-green-600/5 border border-green-500/20 rounded-xl p-5 relative overflow-hidden",children:[e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-green-400 text-xs font-bold uppercase tracking-wider mb-1",children:"Completion Rate"}),e.jsxs("div",{className:"text-white text-3xl font-bold",children:[P.length>0?Math.round(P.filter(K=>K.status==="completed").length/P.length*100):0,"%"]})]}),e.jsx(Or,{className:"absolute right-4 bottom-4 w-12 h-12 text-green-500/10"})]}),e.jsxs("div",{className:"bg-gradient-to-br from-yellow-900/10 to-yellow-600/5 border border-yellow-500/20 rounded-xl p-5 relative overflow-hidden",children:[e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"text-yellow-400 text-xs font-bold uppercase tracking-wider mb-1",children:"Avg Score"}),e.jsxs("div",{className:"text-white text-3xl font-bold",children:[(()=>{const K=P.filter(I=>I.status==="completed");if(K.length===0)return 0;const ie=K.reduce((I,R)=>I+(R.score||0),0);return Math.round(ie/K.length)})(),"%"]})]}),e.jsx(tl,{className:"absolute right-4 bottom-4 w-12 h-12 text-yellow-500/10"})]})]}),e.jsx("div",{className:"flex-1 overflow-auto bg-[#1a1b1e] p-6",children:e.jsx("div",{className:"rounded-xl overflow-hidden border border-gray-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-[#111215] text-gray-400 font-bold uppercase tracking-wider text-xs",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-4",children:"Candidate"}),e.jsx("th",{className:"p-4",children:"Status"}),e.jsx("th",{className:"p-4",children:"Score"}),e.jsx("th",{className:"p-4",children:"Date Invited"}),e.jsx("th",{className:"p-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800 bg-[#1a1b1e]",children:P.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:"5",className:"p-12 text-center text-gray-500",children:[e.jsx(At,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),"No candidates invited yet."]})}):P.map(K=>e.jsxs("tr",{className:"hover:bg-white/5 transition-colors group",children:[e.jsxs("td",{className:"p-4",children:[e.jsx("div",{className:"text-white font-bold",children:K.candidate_name||"N/A"}),e.jsx("div",{className:"text-gray-500 text-xs font-mono",children:K.candidate_email})]}),e.jsx("td",{className:"p-4",children:Se(K.status,K.score,S.passing_score)}),e.jsx("td",{className:"p-4",children:K.status==="completed"?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-2 rounded-full bg-gray-700 overflow-hidden",children:e.jsx("div",{className:`h-full ${K.score>=S.passing_score?"bg-green-500":"bg-red-500"}`,style:{width:`${K.score}%`}})}),e.jsxs("span",{className:"font-mono font-bold text-white",children:[K.score,"%"]})]}):e.jsx("span",{className:"text-gray-600 font-mono",children:"-"})}),e.jsx("td",{className:"p-4 text-gray-400 text-xs font-mono",children:new Date(K.created_at).toLocaleDateString()}),e.jsx("td",{className:"p-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 opacity-100 md:opacity-0 group-hover:opacity-100 transition-opacity",children:[K.status!=="completed"&&e.jsx("button",{onClick:()=>ce(`${window.location.origin}/assessment/${K.token}`),className:"text-gray-400 hover:text-white p-2 hover:bg-gray-700 rounded-lg transition-colors",title:"Copy Link",children:$?e.jsx(Or,{className:"w-4 h-4 text-green-400"}):e.jsx(ao,{className:"w-4 h-4"})}),K.status==="completed"&&e.jsxs("button",{onClick:()=>Z(K.id),className:"flex items-center gap-1.5 bg-purple-500/10 hover:bg-purple-500 text-purple-400 hover:text-white border border-purple-500/30 hover:border-transparent px-3 py-1.5 rounded-lg text-xs font-bold transition-all",children:[e.jsx(dr,{className:"w-3 h-3"}),"Report"]})]})})]},K.id))})]})})})]})}),A&&L&&e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/80 backdrop-blur-sm p-4 animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-2xl w-full max-w-md overflow-hidden shadow-2xl transform transition-all scale-100 relative",children:[e.jsx("div",{className:"absolute top-0 w-full h-1 bg-red-600"}),e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-red-500/10 rounded-full flex items-center justify-center mx-auto mb-6 border border-red-500/20 shadow-lg shadow-red-900/20",children:e.jsx(na,{className:"w-10 h-10 text-red-500"})}),e.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"Delete Assessment?"}),e.jsxs("p",{className:"text-gray-400 text-sm mb-8 leading-relaxed",children:["You are about to delete ",e.jsxs("span",{className:"text-white font-bold",children:['"',L.title,'"']}),".",e.jsx("br",{}),"This will permanently remove all associated candidate results."]}),e.jsxs("div",{className:"flex gap-4 justify-center",children:[e.jsx("button",{onClick:()=>{E(!1),F(null)},className:"px-6 py-3 rounded-xl font-bold text-gray-400 hover:text-white hover:bg-gray-800 transition-colors border border-transparent hover:border-gray-700",children:"Cancel"}),e.jsx("button",{onClick:()=>pe(L.id),className:"px-6 py-3 rounded-xl font-bold bg-gradient-to-r from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-white transition-all shadow-lg shadow-red-900/30 transform hover:-translate-y-0.5",children:"Yes, Delete It"})]})]})]})})]})};var dp={exports:{}};/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/(function(t){(function(){var r={}.hasOwnProperty;function a(){for(var i="",o=0;o<arguments.length;o++){var c=arguments[o];c&&(i=s(i,n(c)))}return i}function n(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return a.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var o="";for(var c in i)r.call(i,c)&&i[c]&&(o=s(o,c));return o}function s(i,o){return o?i?i+" "+o:i+o:i}t.exports?(a.default=a,t.exports=a):window.classNames=a})()})(dp);var v_=dp.exports;const _e=Si(v_);function Ve(){return Ve=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var n in a)({}).hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},Ve.apply(null,arguments)}var y_=Symbol.for("react.element"),j_=Symbol.for("react.transitional.element"),w_=Symbol.for("react.fragment");function up(t){return t&&et(t)==="object"&&(t.$$typeof===y_||t.$$typeof===j_)&&t.type===w_}function ys(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=[];return me.Children.forEach(t,function(n){n==null&&!r.keepEmpty||(Array.isArray(n)?a=a.concat(ys(n)):up(n)&&n.props?a=a.concat(ys(n.props.children,r)):a.push(n))}),a}var td={},N_=function(r){};function S_(t,r){}function C_(t,r){}function __(){td={}}function mp(t,r,a){!r&&!td[a]&&(t(!1,a),td[a]=!0)}function $r(t,r){mp(S_,t,r)}function k_(t,r){mp(C_,t,r)}$r.preMessage=N_;$r.resetWarned=__;$r.noteOnce=k_;function fx(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),a.push.apply(a,n)}return a}function X(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?fx(Object(a),!0).forEach(function(n){G(t,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):fx(Object(a)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(a,n))})}return t}function di(t){return t instanceof HTMLElement||t instanceof SVGElement}function P_(t){return t&&et(t)==="object"&&di(t.nativeElement)?t.nativeElement:di(t)?t:null}function io(t){var r=P_(t);if(r)return r;if(t instanceof me.Component){var a;return(a=Na.findDOMNode)===null||a===void 0?void 0:a.call(Na,t)}return null}var xp={exports:{}},Nt={};/**
 * @license React
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Bu=Symbol.for("react.element"),Hu=Symbol.for("react.portal"),ll=Symbol.for("react.fragment"),cl=Symbol.for("react.strict_mode"),dl=Symbol.for("react.profiler"),ul=Symbol.for("react.provider"),ml=Symbol.for("react.context"),$_=Symbol.for("react.server_context"),xl=Symbol.for("react.forward_ref"),hl=Symbol.for("react.suspense"),fl=Symbol.for("react.suspense_list"),gl=Symbol.for("react.memo"),pl=Symbol.for("react.lazy"),E_=Symbol.for("react.offscreen"),hp;hp=Symbol.for("react.module.reference");function ea(t){if(typeof t=="object"&&t!==null){var r=t.$$typeof;switch(r){case Bu:switch(t=t.type,t){case ll:case dl:case cl:case hl:case fl:return t;default:switch(t=t&&t.$$typeof,t){case $_:case ml:case xl:case pl:case gl:case ul:return t;default:return r}}case Hu:return r}}}Nt.ContextConsumer=ml;Nt.ContextProvider=ul;Nt.Element=Bu;Nt.ForwardRef=xl;Nt.Fragment=ll;Nt.Lazy=pl;Nt.Memo=gl;Nt.Portal=Hu;Nt.Profiler=dl;Nt.StrictMode=cl;Nt.Suspense=hl;Nt.SuspenseList=fl;Nt.isAsyncMode=function(){return!1};Nt.isConcurrentMode=function(){return!1};Nt.isContextConsumer=function(t){return ea(t)===ml};Nt.isContextProvider=function(t){return ea(t)===ul};Nt.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===Bu};Nt.isForwardRef=function(t){return ea(t)===xl};Nt.isFragment=function(t){return ea(t)===ll};Nt.isLazy=function(t){return ea(t)===pl};Nt.isMemo=function(t){return ea(t)===gl};Nt.isPortal=function(t){return ea(t)===Hu};Nt.isProfiler=function(t){return ea(t)===dl};Nt.isStrictMode=function(t){return ea(t)===cl};Nt.isSuspense=function(t){return ea(t)===hl};Nt.isSuspenseList=function(t){return ea(t)===fl};Nt.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===ll||t===dl||t===cl||t===hl||t===fl||t===E_||typeof t=="object"&&t!==null&&(t.$$typeof===pl||t.$$typeof===gl||t.$$typeof===ul||t.$$typeof===ml||t.$$typeof===xl||t.$$typeof===hp||t.getModuleId!==void 0)};Nt.typeOf=ea;xp.exports=Nt;var Ql=xp.exports;function bl(t,r,a){var n=l.useRef({});return(!("value"in n.current)||a(n.current.condition,r))&&(n.current.value=t(),n.current.condition=r),n.current.value}var A_=Number(l.version.split(".")[0]),Wu=function(r,a){typeof r=="function"?r(a):et(r)==="object"&&r&&"current"in r&&(r.current=a)},Tn=function(){for(var r=arguments.length,a=new Array(r),n=0;n<r;n++)a[n]=arguments[n];var s=a.filter(Boolean);return s.length<=1?s[0]:function(i){a.forEach(function(o){Wu(o,i)})}},Mn=function(){for(var r=arguments.length,a=new Array(r),n=0;n<r;n++)a[n]=arguments[n];return bl(function(){return Tn.apply(void 0,a)},a,function(s,i){return s.length!==i.length||s.every(function(o,c){return o!==i[c]})})},Rn=function(r){var a,n;if(!r)return!1;if(fp(r)&&A_>=19)return!0;var s=Ql.isMemo(r)?r.type.type:r.type;return!(typeof s=="function"&&!((a=s.prototype)!==null&&a!==void 0&&a.render)&&s.$$typeof!==Ql.ForwardRef||typeof r=="function"&&!((n=r.prototype)!==null&&n!==void 0&&n.render)&&r.$$typeof!==Ql.ForwardRef)};function fp(t){return l.isValidElement(t)&&!up(t)}var Os=function(r){if(r&&fp(r)){var a=r;return a.props.propertyIsEnumerable("ref")?a.props.ref:a.ref}return null},rd=l.createContext(null);function O_(t){var r=t.children,a=t.onBatchResize,n=l.useRef(0),s=l.useRef([]),i=l.useContext(rd),o=l.useCallback(function(c,d,m){n.current+=1;var u=n.current;s.current.push({size:c,element:d,data:m}),Promise.resolve().then(function(){u===n.current&&(a==null||a(s.current),s.current=[])}),i==null||i(c,d,m)},[a,i]);return l.createElement(rd.Provider,{value:o},r)}var gp=function(){if(typeof Map<"u")return Map;function t(r,a){var n=-1;return r.some(function(s,i){return s[0]===a?(n=i,!0):!1}),n}return function(){function r(){this.__entries__=[]}return Object.defineProperty(r.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),r.prototype.get=function(a){var n=t(this.__entries__,a),s=this.__entries__[n];return s&&s[1]},r.prototype.set=function(a,n){var s=t(this.__entries__,a);~s?this.__entries__[s][1]=n:this.__entries__.push([a,n])},r.prototype.delete=function(a){var n=this.__entries__,s=t(n,a);~s&&n.splice(s,1)},r.prototype.has=function(a){return!!~t(this.__entries__,a)},r.prototype.clear=function(){this.__entries__.splice(0)},r.prototype.forEach=function(a,n){n===void 0&&(n=null);for(var s=0,i=this.__entries__;s<i.length;s++){var o=i[s];a.call(n,o[1],o[0])}},r}()}(),ad=typeof window<"u"&&typeof document<"u"&&window.document===document,Do=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),I_=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Do):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),T_=2;function M_(t,r){var a=!1,n=!1,s=0;function i(){a&&(a=!1,t()),n&&c()}function o(){I_(i)}function c(){var d=Date.now();if(a){if(d-s<T_)return;n=!0}else a=!0,n=!1,setTimeout(o,r);s=d}return c}var R_=20,L_=["top","right","bottom","left","width","height","size","weight"],D_=typeof MutationObserver<"u",z_=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=M_(this.refresh.bind(this),R_)}return t.prototype.addObserver=function(r){~this.observers_.indexOf(r)||this.observers_.push(r),this.connected_||this.connect_()},t.prototype.removeObserver=function(r){var a=this.observers_,n=a.indexOf(r);~n&&a.splice(n,1),!a.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var r=this.updateObservers_();r&&this.refresh()},t.prototype.updateObservers_=function(){var r=this.observers_.filter(function(a){return a.gatherActive(),a.hasActive()});return r.forEach(function(a){return a.broadcastActive()}),r.length>0},t.prototype.connect_=function(){!ad||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),D_?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){!ad||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(r){var a=r.propertyName,n=a===void 0?"":a,s=L_.some(function(i){return!!~n.indexOf(i)});s&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),pp=function(t,r){for(var a=0,n=Object.keys(r);a<n.length;a++){var s=n[a];Object.defineProperty(t,s,{value:r[s],enumerable:!1,writable:!1,configurable:!0})}return t},js=function(t){var r=t&&t.ownerDocument&&t.ownerDocument.defaultView;return r||Do},bp=vl(0,0,0,0);function zo(t){return parseFloat(t)||0}function gx(t){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return r.reduce(function(n,s){var i=t["border-"+s+"-width"];return n+zo(i)},0)}function F_(t){for(var r=["top","right","bottom","left"],a={},n=0,s=r;n<s.length;n++){var i=s[n],o=t["padding-"+i];a[i]=zo(o)}return a}function B_(t){var r=t.getBBox();return vl(0,0,r.width,r.height)}function H_(t){var r=t.clientWidth,a=t.clientHeight;if(!r&&!a)return bp;var n=js(t).getComputedStyle(t),s=F_(n),i=s.left+s.right,o=s.top+s.bottom,c=zo(n.width),d=zo(n.height);if(n.boxSizing==="border-box"&&(Math.round(c+i)!==r&&(c-=gx(n,"left","right")+i),Math.round(d+o)!==a&&(d-=gx(n,"top","bottom")+o)),!U_(t)){var m=Math.round(c+i)-r,u=Math.round(d+o)-a;Math.abs(m)!==1&&(c-=m),Math.abs(u)!==1&&(d-=u)}return vl(s.left,s.top,c,d)}var W_=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof js(t).SVGGraphicsElement}:function(t){return t instanceof js(t).SVGElement&&typeof t.getBBox=="function"}}();function U_(t){return t===js(t).document.documentElement}function V_(t){return ad?W_(t)?B_(t):H_(t):bp}function G_(t){var r=t.x,a=t.y,n=t.width,s=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(i.prototype);return pp(o,{x:r,y:a,width:n,height:s,top:a,right:r+n,bottom:s+a,left:r}),o}function vl(t,r,a,n){return{x:t,y:r,width:a,height:n}}var K_=function(){function t(r){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=vl(0,0,0,0),this.target=r}return t.prototype.isActive=function(){var r=V_(this.target);return this.contentRect_=r,r.width!==this.broadcastWidth||r.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var r=this.contentRect_;return this.broadcastWidth=r.width,this.broadcastHeight=r.height,r},t}(),q_=function(){function t(r,a){var n=G_(a);pp(this,{target:r,contentRect:n})}return t}(),X_=function(){function t(r,a,n){if(this.activeObservations_=[],this.observations_=new gp,typeof r!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=r,this.controller_=a,this.callbackCtx_=n}return t.prototype.observe=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof js(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var a=this.observations_;a.has(r)||(a.set(r,new K_(r)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof js(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var a=this.observations_;a.has(r)&&(a.delete(r),a.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var r=this;this.clearActive(),this.observations_.forEach(function(a){a.isActive()&&r.activeObservations_.push(a)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var r=this.callbackCtx_,a=this.activeObservations_.map(function(n){return new q_(n.target,n.broadcastRect())});this.callback_.call(r,a,r),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),vp=typeof WeakMap<"u"?new WeakMap:new gp,yp=function(){function t(r){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var a=z_.getInstance(),n=new X_(r,a,this);vp.set(this,n)}return t}();["observe","unobserve","disconnect"].forEach(function(t){yp.prototype[t]=function(){var r;return(r=vp.get(this))[t].apply(r,arguments)}});var Y_=function(){return typeof Do.ResizeObserver<"u"?Do.ResizeObserver:yp}(),en=new Map;function J_(t){t.forEach(function(r){var a,n=r.target;(a=en.get(n))===null||a===void 0||a.forEach(function(s){return s(n)})})}var jp=new Y_(J_);function Q_(t,r){en.has(t)||(en.set(t,new Set),jp.observe(t)),en.get(t).add(r)}function Z_(t,r){en.has(t)&&(en.get(t).delete(r),en.get(t).size||(jp.unobserve(t),en.delete(t)))}function Zt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function px(t,r){for(var a=0;a<r.length;a++){var n=r[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Uj(n.key),n)}}function er(t,r,a){return r&&px(t.prototype,r),a&&px(t,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function ui(t,r){return ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},ui(t,r)}function Ua(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&ui(t,r)}function mi(t){return mi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mi(t)}function Uu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Uu=function(){return!!t})()}function it(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ek(t,r){if(r&&(et(r)=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return it(t)}function Va(t){var r=Uu();return function(){var a,n=mi(t);if(r){var s=mi(this).constructor;a=Reflect.construct(n,arguments,s)}else a=n.apply(this,arguments);return ek(this,a)}}var tk=function(t){Ua(a,t);var r=Va(a);function a(){return Zt(this,a),r.apply(this,arguments)}return er(a,[{key:"render",value:function(){return this.props.children}}]),a}(l.Component);function rk(t,r){var a=t.children,n=t.disabled,s=l.useRef(null),i=l.useRef(null),o=l.useContext(rd),c=typeof a=="function",d=c?a(s):a,m=l.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),u=!c&&l.isValidElement(d)&&Rn(d),x=u?Os(d):null,h=Mn(x,s),f=function(){var v;return io(s.current)||(s.current&&et(s.current)==="object"?io((v=s.current)===null||v===void 0?void 0:v.nativeElement):null)||io(i.current)};l.useImperativeHandle(r,function(){return f()});var g=l.useRef(t);g.current=t;var b=l.useCallback(function(p){var v=g.current,y=v.onResize,j=v.data,S=p.getBoundingClientRect(),N=S.width,w=S.height,_=p.offsetWidth,P=p.offsetHeight,O=Math.floor(N),T=Math.floor(w);if(m.current.width!==O||m.current.height!==T||m.current.offsetWidth!==_||m.current.offsetHeight!==P){var k={width:O,height:T,offsetWidth:_,offsetHeight:P};m.current=k;var $=_===Math.round(N)?N:_,C=P===Math.round(w)?w:P,A=X(X({},k),{},{offsetWidth:$,offsetHeight:C});o==null||o(A,p,j),y&&Promise.resolve().then(function(){y(A,p)})}},[]);return l.useEffect(function(){var p=f();return p&&!n&&Q_(p,b),function(){return Z_(p,b)}},[s.current,n]),l.createElement(tk,{ref:i},u?l.cloneElement(d,{ref:h}):d)}var ak=l.forwardRef(rk),nk="rc-observer-key";function sk(t,r){var a=t.children,n=typeof a=="function"?[a]:ys(a);return n.map(function(s,i){var o=(s==null?void 0:s.key)||"".concat(nk,"-").concat(i);return l.createElement(ak,Ve({},t,{key:o,ref:i===0?r:void 0}),s)})}var an=l.forwardRef(sk);an.Collection=O_;function ik(t){if(Array.isArray(t))return Kv(t)}function wp(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ok(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fe(t){return ik(t)||wp(t)||mf(t)||ok()}var Np=function(r){return+setTimeout(r,16)},Sp=function(r){return clearTimeout(r)};typeof window<"u"&&"requestAnimationFrame"in window&&(Np=function(r){return window.requestAnimationFrame(r)},Sp=function(r){return window.cancelAnimationFrame(r)});var bx=0,Vu=new Map;function Cp(t){Vu.delete(t)}var jr=function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;bx+=1;var n=bx;function s(i){if(i===0)Cp(n),r();else{var o=Np(function(){s(i-1)});Vu.set(n,o)}}return s(a),n};jr.cancel=function(t){var r=Vu.get(t);return Cp(t),Sp(r)};function xi(t){for(var r=0,a,n=0,s=t.length;s>=4;++n,s-=4)a=t.charCodeAt(n)&255|(t.charCodeAt(++n)&255)<<8|(t.charCodeAt(++n)&255)<<16|(t.charCodeAt(++n)&255)<<24,a=(a&65535)*1540483477+((a>>>16)*59797<<16),a^=a>>>24,r=(a&65535)*1540483477+((a>>>16)*59797<<16)^(r&65535)*1540483477+((r>>>16)*59797<<16);switch(s){case 3:r^=(t.charCodeAt(n+2)&255)<<16;case 2:r^=(t.charCodeAt(n+1)&255)<<8;case 1:r^=t.charCodeAt(n)&255,r=(r&65535)*1540483477+((r>>>16)*59797<<16)}return r^=r>>>13,r=(r&65535)*1540483477+((r>>>16)*59797<<16),((r^r>>>15)>>>0).toString(36)}function Ir(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function nd(t,r){if(!t)return!1;if(t.contains)return t.contains(r);for(var a=r;a;){if(a===t)return!0;a=a.parentNode}return!1}var vx="data-rc-order",yx="data-rc-priority",lk="rc-util-key",sd=new Map;function _p(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.mark;return r?r.startsWith("data-")?r:"data-".concat(r):lk}function yl(t){if(t.attachTo)return t.attachTo;var r=document.querySelector("head");return r||document.body}function ck(t){return t==="queue"?"prependQueue":t?"prepend":"append"}function Gu(t){return Array.from((sd.get(t)||t).children).filter(function(r){return r.tagName==="STYLE"})}function kp(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Ir())return null;var a=r.csp,n=r.prepend,s=r.priority,i=s===void 0?0:s,o=ck(n),c=o==="prependQueue",d=document.createElement("style");d.setAttribute(vx,o),c&&i&&d.setAttribute(yx,"".concat(i)),a!=null&&a.nonce&&(d.nonce=a==null?void 0:a.nonce),d.innerHTML=t;var m=yl(r),u=m.firstChild;if(n){if(c){var x=(r.styles||Gu(m)).filter(function(h){if(!["prepend","prependQueue"].includes(h.getAttribute(vx)))return!1;var f=Number(h.getAttribute(yx)||0);return i>=f});if(x.length)return m.insertBefore(d,x[x.length-1].nextSibling),d}m.insertBefore(d,u)}else m.appendChild(d);return d}function Pp(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=yl(r);return(r.styles||Gu(a)).find(function(n){return n.getAttribute(_p(r))===t})}function hi(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=Pp(t,r);if(a){var n=yl(r);n.removeChild(a)}}function dk(t,r){var a=sd.get(t);if(!a||!nd(document,a)){var n=kp("",r),s=n.parentNode;sd.set(t,s),t.removeChild(n)}}function za(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=yl(a),s=Gu(n),i=X(X({},a),{},{styles:s});dk(n,i);var o=Pp(r,i);if(o){var c,d;if((c=i.csp)!==null&&c!==void 0&&c.nonce&&o.nonce!==((d=i.csp)===null||d===void 0?void 0:d.nonce)){var m;o.nonce=(m=i.csp)===null||m===void 0?void 0:m.nonce}return o.innerHTML!==t&&(o.innerHTML=t),o}var u=kp(t,i);return u.setAttribute(_p(i),r),u}function uk(t,r){if(t==null)return{};var a={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.indexOf(n)!==-1)continue;a[n]=t[n]}return a}function bt(t,r){if(t==null)return{};var a,n,s=uk(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)a=i[n],r.indexOf(a)===-1&&{}.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}function fi(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=new Set;function s(i,o){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,d=n.has(i);if($r(!d,"Warning: There may be circular references"),d)return!1;if(i===o)return!0;if(a&&c>1)return!1;n.add(i);var m=c+1;if(Array.isArray(i)){if(!Array.isArray(o)||i.length!==o.length)return!1;for(var u=0;u<i.length;u++)if(!s(i[u],o[u],m))return!1;return!0}if(i&&o&&et(i)==="object"&&et(o)==="object"){var x=Object.keys(i);return x.length!==Object.keys(o).length?!1:x.every(function(h){return s(i[h],o[h],m)})}return!1}return s(t,r)}var mk="%";function id(t){return t.join(mk)}var xk=function(){function t(r){Zt(this,t),G(this,"instanceId",void 0),G(this,"cache",new Map),G(this,"extracted",new Set),this.instanceId=r}return er(t,[{key:"get",value:function(a){return this.opGet(id(a))}},{key:"opGet",value:function(a){return this.cache.get(a)||null}},{key:"update",value:function(a,n){return this.opUpdate(id(a),n)}},{key:"opUpdate",value:function(a,n){var s=this.cache.get(a),i=n(s);i===null?this.cache.delete(a):this.cache.set(a,i)}}]),t}(),ws="data-token-hash",sa="data-css-hash",tn="__cssinjs_instance__";function hk(){var t=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){var r=document.body.querySelectorAll("style[".concat(sa,"]"))||[],a=document.head.firstChild;Array.from(r).forEach(function(s){s[tn]=s[tn]||t,s[tn]===t&&document.head.insertBefore(s,a)});var n={};Array.from(document.querySelectorAll("style[".concat(sa,"]"))).forEach(function(s){var i=s.getAttribute(sa);if(n[i]){if(s[tn]===t){var o;(o=s.parentNode)===null||o===void 0||o.removeChild(s)}}else n[i]=!0})}return new xk(t)}var Ei=l.createContext({hashPriority:"low",cache:hk(),defaultCache:!0});function fk(t,r){if(t.length!==r.length)return!1;for(var a=0;a<t.length;a++)if(t[a]!==r[a])return!1;return!0}var Ku=function(){function t(){Zt(this,t),G(this,"cache",void 0),G(this,"keys",void 0),G(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return er(t,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(a){var n,s,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o={map:this.cache};return a.forEach(function(c){if(!o)o=void 0;else{var d;o=(d=o)===null||d===void 0||(d=d.map)===null||d===void 0?void 0:d.get(c)}}),(n=o)!==null&&n!==void 0&&n.value&&i&&(o.value[1]=this.cacheCallTimes++),(s=o)===null||s===void 0?void 0:s.value}},{key:"get",value:function(a){var n;return(n=this.internalGet(a,!0))===null||n===void 0?void 0:n[0]}},{key:"has",value:function(a){return!!this.internalGet(a)}},{key:"set",value:function(a,n){var s=this;if(!this.has(a)){if(this.size()+1>t.MAX_CACHE_SIZE+t.MAX_CACHE_OFFSET){var i=this.keys.reduce(function(m,u){var x=he(m,2),h=x[1];return s.internalGet(u)[1]<h?[u,s.internalGet(u)[1]]:m},[this.keys[0],this.cacheCallTimes]),o=he(i,1),c=o[0];this.delete(c)}this.keys.push(a)}var d=this.cache;a.forEach(function(m,u){if(u===a.length-1)d.set(m,{value:[n,s.cacheCallTimes++]});else{var x=d.get(m);x?x.map||(x.map=new Map):d.set(m,{map:new Map}),d=d.get(m).map}})}},{key:"deleteByPath",value:function(a,n){var s=a.get(n[0]);if(n.length===1){var i;return s.map?a.set(n[0],{map:s.map}):a.delete(n[0]),(i=s.value)===null||i===void 0?void 0:i[0]}var o=this.deleteByPath(s.map,n.slice(1));return(!s.map||s.map.size===0)&&!s.value&&a.delete(n[0]),o}},{key:"delete",value:function(a){if(this.has(a))return this.keys=this.keys.filter(function(n){return!fk(n,a)}),this.deleteByPath(this.cache,a)}}]),t}();G(Ku,"MAX_CACHE_SIZE",20);G(Ku,"MAX_CACHE_OFFSET",5);var jx=0,$p=function(){function t(r){Zt(this,t),G(this,"derivatives",void 0),G(this,"id",void 0),this.derivatives=Array.isArray(r)?r:[r],this.id=jx,r.length===0&&(r.length>0,void 0),jx+=1}return er(t,[{key:"getDerivativeToken",value:function(a){return this.derivatives.reduce(function(n,s){return s(a,n)},void 0)}}]),t}(),Zl=new Ku;function od(t){var r=Array.isArray(t)?t:[t];return Zl.has(r)||Zl.set(r,new $p(r)),Zl.get(r)}var gk=new WeakMap,ec={};function pk(t,r){for(var a=gk,n=0;n<r.length;n+=1){var s=r[n];a.has(s)||a.set(s,new WeakMap),a=a.get(s)}return a.has(ec)||a.set(ec,t()),a.get(ec)}var wx=new WeakMap;function ri(t){var r=wx.get(t)||"";return r||(Object.keys(t).forEach(function(a){var n=t[a];r+=a,n instanceof $p?r+=n.id:n&&et(n)==="object"?r+=ri(n):r+=n}),r=xi(r),wx.set(t,r)),r}function Nx(t,r){return xi("".concat(r,"_").concat(ri(t)))}var ld=Ir();function we(t){return typeof t=="number"?"".concat(t,"px"):t}function Fo(t,r,a){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(s)return t;var i=X(X({},n),{},G(G({},ws,r),sa,a)),o=Object.keys(i).map(function(c){var d=i[c];return d?"".concat(c,'="').concat(d,'"'):null}).filter(function(c){return c}).join(" ");return"<style ".concat(o,">").concat(t,"</style>")}var oo=function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"--".concat(a?"".concat(a,"-"):"").concat(r).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},bk=function(r,a,n){return Object.keys(r).length?".".concat(a).concat(n!=null&&n.scope?".".concat(n.scope):"","{").concat(Object.entries(r).map(function(s){var i=he(s,2),o=i[0],c=i[1];return"".concat(o,":").concat(c,";")}).join(""),"}"):""},Ep=function(r,a,n){var s={},i={};return Object.entries(r).forEach(function(o){var c,d,m=he(o,2),u=m[0],x=m[1];if(n!=null&&(c=n.preserve)!==null&&c!==void 0&&c[u])i[u]=x;else if((typeof x=="string"||typeof x=="number")&&!(n!=null&&(d=n.ignore)!==null&&d!==void 0&&d[u])){var h,f=oo(u,n==null?void 0:n.prefix);s[f]=typeof x=="number"&&!(n!=null&&(h=n.unitless)!==null&&h!==void 0&&h[u])?"".concat(x,"px"):String(x),i[u]="var(".concat(f,")")}}),[i,bk(s,a,{scope:n==null?void 0:n.scope})]},Sx=Ir()?l.useLayoutEffect:l.useEffect,ur=function(r,a){var n=l.useRef(!0);Sx(function(){return r(n.current)},a),Sx(function(){return n.current=!1,function(){n.current=!0}},[])},cd=function(r,a){ur(function(n){if(!n)return r()},a)},vk=X({},Qo),Cx=vk.useInsertionEffect,yk=function(r,a,n){l.useMemo(r,n),ur(function(){return a(!0)},n)},jk=Cx?function(t,r,a){return Cx(function(){return t(),r()},a)}:yk,wk=X({},Qo),Nk=wk.useInsertionEffect,Sk=function(r){var a=[],n=!1;function s(i){n||a.push(i)}return l.useEffect(function(){return n=!1,function(){n=!0,a.length&&a.forEach(function(i){return i()})}},r),s},Ck=function(){return function(r){r()}},_k=typeof Nk<"u"?Sk:Ck;function qu(t,r,a,n,s){var i=l.useContext(Ei),o=i.cache,c=[t].concat(Fe(r)),d=id(c),m=_k([d]),u=function(g){o.opUpdate(d,function(b){var p=b||[void 0,void 0],v=he(p,2),y=v[0],j=y===void 0?0:y,S=v[1],N=S,w=N||a(),_=[j,w];return g?g(_):_})};l.useMemo(function(){u()},[d]);var x=o.opGet(d),h=x[1];return jk(function(){s==null||s(h)},function(f){return u(function(g){var b=he(g,2),p=b[0],v=b[1];return f&&p===0&&(s==null||s(h)),[p+1,v]}),function(){o.opUpdate(d,function(g){var b=g||[],p=he(b,2),v=p[0],y=v===void 0?0:v,j=p[1],S=y-1;return S===0?(m(function(){(f||!o.opGet(d))&&(n==null||n(j,!1))}),null):[y-1,j]})}},[d]),h}var kk={},Pk="css",yn=new Map;function $k(t){yn.set(t,(yn.get(t)||0)+1)}function Ek(t,r){if(typeof document<"u"){var a=document.querySelectorAll("style[".concat(ws,'="').concat(t,'"]'));a.forEach(function(n){if(n[tn]===r){var s;(s=n.parentNode)===null||s===void 0||s.removeChild(n)}})}}var Ak=0;function Ok(t,r){yn.set(t,(yn.get(t)||0)-1);var a=new Set;yn.forEach(function(n,s){n<=0&&a.add(s)}),yn.size-a.size>Ak&&a.forEach(function(n){Ek(n,r),yn.delete(n)})}var Ik=function(r,a,n,s){var i=n.getDerivativeToken(r),o=X(X({},i),a);return s&&(o=s(o)),o},Ap="token";function Tk(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=l.useContext(Ei),s=n.cache.instanceId,i=n.container,o=a.salt,c=o===void 0?"":o,d=a.override,m=d===void 0?kk:d,u=a.formatToken,x=a.getComputedToken,h=a.cssVar,f=pk(function(){return Object.assign.apply(Object,[{}].concat(Fe(r)))},r),g=ri(f),b=ri(m),p=h?ri(h):"",v=qu(Ap,[c,t.id,g,b,p],function(){var y,j=x?x(f,m,t):Ik(f,m,t,u),S=X({},j),N="";if(h){var w=Ep(j,h.key,{prefix:h.prefix,ignore:h.ignore,unitless:h.unitless,preserve:h.preserve}),_=he(w,2);j=_[0],N=_[1]}var P=Nx(j,c);j._tokenKey=P,S._tokenKey=Nx(S,c);var O=(y=h==null?void 0:h.key)!==null&&y!==void 0?y:P;j._themeKey=O,$k(O);var T="".concat(Pk,"-").concat(xi(P));return j._hashId=T,[j,T,S,N,(h==null?void 0:h.key)||""]},function(y){Ok(y[0]._themeKey,s)},function(y){var j=he(y,4),S=j[0],N=j[3];if(h&&N){var w=za(N,xi("css-variables-".concat(S._themeKey)),{mark:sa,prepend:"queue",attachTo:i,priority:-999});w[tn]=s,w.setAttribute(ws,S._themeKey)}});return v}var Mk=function(r,a,n){var s=he(r,5),i=s[2],o=s[3],c=s[4],d=n||{},m=d.plain;if(!o)return null;var u=i._tokenKey,x=-999,h={"data-rc-order":"prependQueue","data-rc-priority":"".concat(x)},f=Fo(o,c,u,h,m);return[x,u,f]},Rk={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Op="comm",Ip="rule",Tp="decl",Lk="@import",Dk="@namespace",zk="@keyframes",Fk="@layer",Mp=Math.abs,Xu=String.fromCharCode;function Rp(t){return t.trim()}function lo(t,r,a){return t.replace(r,a)}function Bk(t,r,a){return t.indexOf(r,a)}function ss(t,r){return t.charCodeAt(r)|0}function Ns(t,r,a){return t.slice(r,a)}function pa(t){return t.length}function Hk(t){return t.length}function Xi(t,r){return r.push(t),t}var jl=1,Ss=1,Lp=0,Zr=0,qt=0,Is="";function Yu(t,r,a,n,s,i,o,c){return{value:t,root:r,parent:a,type:n,props:s,children:i,line:jl,column:Ss,length:o,return:"",siblings:c}}function Wk(){return qt}function Uk(){return qt=Zr>0?ss(Is,--Zr):0,Ss--,qt===10&&(Ss=1,jl--),qt}function ia(){return qt=Zr<Lp?ss(Is,Zr++):0,Ss++,qt===10&&(Ss=1,jl++),qt}function rn(){return ss(Is,Zr)}function co(){return Zr}function wl(t,r){return Ns(Is,t,r)}function gi(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Vk(t){return jl=Ss=1,Lp=pa(Is=t),Zr=0,[]}function Gk(t){return Is="",t}function tc(t){return Rp(wl(Zr-1,dd(t===91?t+2:t===40?t+1:t)))}function Kk(t){for(;(qt=rn())&&qt<33;)ia();return gi(t)>2||gi(qt)>3?"":" "}function qk(t,r){for(;--r&&ia()&&!(qt<48||qt>102||qt>57&&qt<65||qt>70&&qt<97););return wl(t,co()+(r<6&&rn()==32&&ia()==32))}function dd(t){for(;ia();)switch(qt){case t:return Zr;case 34:case 39:t!==34&&t!==39&&dd(qt);break;case 40:t===41&&dd(t);break;case 92:ia();break}return Zr}function Xk(t,r){for(;ia()&&t+qt!==57;)if(t+qt===84&&rn()===47)break;return"/*"+wl(r,Zr-1)+"*"+Xu(t===47?t:ia())}function Yk(t){for(;!gi(rn());)ia();return wl(t,Zr)}function Jk(t){return Gk(uo("",null,null,null,[""],t=Vk(t),0,[0],t))}function uo(t,r,a,n,s,i,o,c,d){for(var m=0,u=0,x=o,h=0,f=0,g=0,b=1,p=1,v=1,y=0,j="",S=s,N=i,w=n,_=j;p;)switch(g=y,y=ia()){case 40:if(g!=108&&ss(_,x-1)==58){Bk(_+=lo(tc(y),"&","&\f"),"&\f",Mp(m?c[m-1]:0))!=-1&&(v=-1);break}case 34:case 39:case 91:_+=tc(y);break;case 9:case 10:case 13:case 32:_+=Kk(g);break;case 92:_+=qk(co()-1,7);continue;case 47:switch(rn()){case 42:case 47:Xi(Qk(Xk(ia(),co()),r,a,d),d),(gi(g||1)==5||gi(rn()||1)==5)&&pa(_)&&Ns(_,-1,void 0)!==" "&&(_+=" ");break;default:_+="/"}break;case 123*b:c[m++]=pa(_)*v;case 125*b:case 59:case 0:switch(y){case 0:case 125:p=0;case 59+u:v==-1&&(_=lo(_,/\f/g,"")),f>0&&(pa(_)-x||b===0&&g===47)&&Xi(f>32?kx(_+";",n,a,x-1,d):kx(lo(_," ","")+";",n,a,x-2,d),d);break;case 59:_+=";";default:if(Xi(w=_x(_,r,a,m,u,s,c,j,S=[],N=[],x,i),i),y===123)if(u===0)uo(_,r,w,w,S,i,x,c,N);else{switch(h){case 99:if(ss(_,3)===110)break;case 108:if(ss(_,2)===97)break;default:u=0;case 100:case 109:case 115:}u?uo(t,w,w,n&&Xi(_x(t,w,w,0,0,s,c,j,s,S=[],x,N),N),s,N,x,c,n?S:N):uo(_,w,w,w,[""],N,0,c,N)}}m=u=f=0,b=v=1,j=_="",x=o;break;case 58:x=1+pa(_),f=g;default:if(b<1){if(y==123)--b;else if(y==125&&b++==0&&Uk()==125)continue}switch(_+=Xu(y),y*b){case 38:v=u>0?1:(_+="\f",-1);break;case 44:c[m++]=(pa(_)-1)*v,v=1;break;case 64:rn()===45&&(_+=tc(ia())),h=rn(),u=x=pa(j=_+=Yk(co())),y++;break;case 45:g===45&&pa(_)==2&&(b=0)}}return i}function _x(t,r,a,n,s,i,o,c,d,m,u,x){for(var h=s-1,f=s===0?i:[""],g=Hk(f),b=0,p=0,v=0;b<n;++b)for(var y=0,j=Ns(t,h+1,h=Mp(p=o[b])),S=t;y<g;++y)(S=Rp(p>0?f[y]+" "+j:lo(j,/&\f/g,f[y])))&&(d[v++]=S);return Yu(t,r,a,s===0?Ip:c,d,m,u,x)}function Qk(t,r,a,n){return Yu(t,r,a,Op,Xu(Wk()),Ns(t,2,-2),0,n)}function kx(t,r,a,n,s){return Yu(t,r,a,Tp,Ns(t,0,n),Ns(t,n+1,-1),n,s)}function ud(t,r){for(var a="",n=0;n<t.length;n++)a+=r(t[n],n,t,r)||"";return a}function Zk(t,r,a,n){switch(t.type){case Fk:if(t.children.length)break;case Lk:case Dk:case Tp:return t.return=t.return||t.value;case Op:return"";case zk:return t.return=t.value+"{"+ud(t.children,n)+"}";case Ip:if(!pa(t.value=t.props.join(",")))return""}return pa(a=ud(t.children,n))?t.return=t.value+"{"+a+"}":""}var Px="data-ant-cssinjs-cache-path",Dp="_FILE_STYLE__",kn,zp=!0;function e3(){if(!kn&&(kn={},Ir())){var t=document.createElement("div");t.className=Px,t.style.position="fixed",t.style.visibility="hidden",t.style.top="-9999px",document.body.appendChild(t);var r=getComputedStyle(t).content||"";r=r.replace(/^"/,"").replace(/"$/,""),r.split(";").forEach(function(s){var i=s.split(":"),o=he(i,2),c=o[0],d=o[1];kn[c]=d});var a=document.querySelector("style[".concat(Px,"]"));if(a){var n;zp=!1,(n=a.parentNode)===null||n===void 0||n.removeChild(a)}document.body.removeChild(t)}}function t3(t){return e3(),!!kn[t]}function r3(t){var r=kn[t],a=null;if(r&&Ir())if(zp)a=Dp;else{var n=document.querySelector("style[".concat(sa,'="').concat(kn[t],'"]'));n?a=n.innerHTML:delete kn[t]}return[a,r]}var a3="_skip_check_",Fp="_multi_value_";function mo(t){var r=ud(Jk(t),Zk);return r.replace(/\{%%%\:[^;];}/g,";")}function n3(t){return et(t)==="object"&&t&&(a3 in t||Fp in t)}function $x(t,r,a){if(!r)return t;var n=".".concat(r),s=a==="low"?":where(".concat(n,")"):n,i=t.split(",").map(function(o){var c,d=o.trim().split(/\s+/),m=d[0]||"",u=((c=m.match(/^\w+/))===null||c===void 0?void 0:c[0])||"";return m="".concat(u).concat(s).concat(m.slice(u.length)),[m].concat(Fe(d.slice(1))).join(" ")});return i.join(",")}var s3=function t(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]},s=n.root,i=n.injectHash,o=n.parentSelectors,c=a.hashId,d=a.layer;a.path;var m=a.hashPriority,u=a.transformers,x=u===void 0?[]:u;a.linters;var h="",f={};function g(v){var y=v.getName(c);if(!f[y]){var j=t(v.style,a,{root:!1,parentSelectors:o}),S=he(j,1),N=S[0];f[y]="@keyframes ".concat(v.getName(c)).concat(N)}}function b(v){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return v.forEach(function(j){Array.isArray(j)?b(j,y):j&&y.push(j)}),y}var p=b(Array.isArray(r)?r:[r]);return p.forEach(function(v){var y=typeof v=="string"&&!s?{}:v;if(typeof y=="string")h+="".concat(y,`
`);else if(y._keyframe)g(y);else{var j=x.reduce(function(S,N){var w;return(N==null||(w=N.visit)===null||w===void 0?void 0:w.call(N,S))||S},y);Object.keys(j).forEach(function(S){var N=j[S];if(et(N)==="object"&&N&&(S!=="animationName"||!N._keyframe)&&!n3(N)){var w=!1,_=S.trim(),P=!1;(s||i)&&c?_.startsWith("@")?w=!0:_==="&"?_=$x("",c,m):_=$x(S,c,m):s&&!c&&(_==="&"||_==="")&&(_="",P=!0);var O=t(N,a,{root:P,injectHash:w,parentSelectors:[].concat(Fe(o),[_])}),T=he(O,2),k=T[0],$=T[1];f=X(X({},f),$),h+="".concat(_).concat(k)}else{let E=function(L,F){var D=L.replace(/[A-Z]/g,function(Q){return"-".concat(Q.toLowerCase())}),q=F;!Rk[L]&&typeof q=="number"&&q!==0&&(q="".concat(q,"px")),L==="animationName"&&F!==null&&F!==void 0&&F._keyframe&&(g(F),q=F.getName(c)),h+="".concat(D,":").concat(q,";")};var C,A=(C=N==null?void 0:N.value)!==null&&C!==void 0?C:N;et(N)==="object"&&N!==null&&N!==void 0&&N[Fp]&&Array.isArray(A)?A.forEach(function(L){E(S,L)}):E(S,A)}})}}),s?d&&(h&&(h="@layer ".concat(d.name," {").concat(h,"}")),d.dependencies&&(f["@layer ".concat(d.name)]=d.dependencies.map(function(v){return"@layer ".concat(v,", ").concat(d.name,";")}).join(`
`))):h="{".concat(h,"}"),[h,f]};function Bp(t,r){return xi("".concat(t.join("%")).concat(r))}function i3(){return null}var Hp="style";function md(t,r){var a=t.token,n=t.path,s=t.hashId,i=t.layer,o=t.nonce,c=t.clientOnly,d=t.order,m=d===void 0?0:d,u=l.useContext(Ei),x=u.autoClear;u.mock;var h=u.defaultCache,f=u.hashPriority,g=u.container,b=u.ssrInline,p=u.transformers,v=u.linters,y=u.cache,j=u.layer,S=a._tokenKey,N=[S];j&&N.push("layer"),N.push.apply(N,Fe(n));var w=ld,_=qu(Hp,N,function(){var $=N.join("|");if(t3($)){var C=r3($),A=he(C,2),E=A[0],L=A[1];if(E)return[E,S,L,{},c,m]}var F=r(),D=s3(F,{hashId:s,hashPriority:f,layer:j?i:void 0,path:n.join("-"),transformers:p,linters:v}),q=he(D,2),Q=q[0],de=q[1],H=mo(Q),se=Bp(N,H);return[H,S,se,de,c,m]},function($,C){var A=he($,3),E=A[2];(C||x)&&ld&&hi(E,{mark:sa,attachTo:g})},function($){var C=he($,4),A=C[0];C[1];var E=C[2],L=C[3];if(w&&A!==Dp){var F={mark:sa,prepend:j?!1:"queue",attachTo:g,priority:m},D=typeof o=="function"?o():o;D&&(F.csp={nonce:D});var q=[],Q=[];Object.keys(L).forEach(function(H){H.startsWith("@layer")?q.push(H):Q.push(H)}),q.forEach(function(H){za(mo(L[H]),"_layer-".concat(H),X(X({},F),{},{prepend:!0}))});var de=za(A,E,F);de[tn]=y.instanceId,de.setAttribute(ws,S),Q.forEach(function(H){za(mo(L[H]),"_effect-".concat(H),F)})}}),P=he(_,3),O=P[0],T=P[1],k=P[2];return function($){var C;return!b||w||!h?C=l.createElement(i3,null):C=l.createElement("style",Ve({},G(G({},ws,T),sa,k),{dangerouslySetInnerHTML:{__html:O}})),l.createElement(l.Fragment,null,C,$)}}var o3=function(r,a,n){var s=he(r,6),i=s[0],o=s[1],c=s[2],d=s[3],m=s[4],u=s[5],x=n||{},h=x.plain;if(m)return null;var f=i,g={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)};return f=Fo(i,o,c,g,h),d&&Object.keys(d).forEach(function(b){if(!a[b]){a[b]=!0;var p=mo(d[b]),v=Fo(p,o,"_effect-".concat(b),g,h);b.startsWith("@layer")?f=v+f:f+=v}}),[u,c,f]},Wp="cssVar",l3=function(r,a){var n=r.key,s=r.prefix,i=r.unitless,o=r.ignore,c=r.token,d=r.scope,m=d===void 0?"":d,u=l.useContext(Ei),x=u.cache.instanceId,h=u.container,f=c._tokenKey,g=[].concat(Fe(r.path),[n,m,f]),b=qu(Wp,g,function(){var p=a(),v=Ep(p,n,{prefix:s,unitless:i,ignore:o,scope:m}),y=he(v,2),j=y[0],S=y[1],N=Bp(g,S);return[j,S,N,n]},function(p){var v=he(p,3),y=v[2];ld&&hi(y,{mark:sa,attachTo:h})},function(p){var v=he(p,3),y=v[1],j=v[2];if(y){var S=za(y,j,{mark:sa,prepend:"queue",attachTo:h,priority:-999});S[tn]=x,S.setAttribute(ws,n)}});return b},c3=function(r,a,n){var s=he(r,4),i=s[1],o=s[2],c=s[3],d=n||{},m=d.plain;if(!i)return null;var u=-999,x={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)},h=Fo(i,c,o,x,m);return[u,o,h]};G(G(G({},Hp,o3),Ap,Mk),Wp,c3);var Lt=function(){function t(r,a){Zt(this,t),G(this,"name",void 0),G(this,"style",void 0),G(this,"_keyframe",!0),this.name=r,this.style=a}return er(t,[{key:"getName",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return a?"".concat(a,"-").concat(this.name):this.name}}]),t}();function Bn(t){return t.notSplit=!0,t}Bn(["borderTop","borderBottom"]),Bn(["borderTop"]),Bn(["borderBottom"]),Bn(["borderLeft","borderRight"]),Bn(["borderLeft"]),Bn(["borderRight"]);var Ju=l.createContext({});function d3(t){return qv(t)||wp(t)||mf(t)||Xv()}function wa(t,r){for(var a=t,n=0;n<r.length;n+=1){if(a==null)return;a=a[r[n]]}return a}function Up(t,r,a,n){if(!r.length)return a;var s=d3(r),i=s[0],o=s.slice(1),c;return!t&&typeof i=="number"?c=[]:Array.isArray(t)?c=Fe(t):c=X({},t),n&&a===void 0&&o.length===1?delete c[i][o[0]]:c[i]=Up(c[i],o,a,n),c}function ra(t,r,a){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return r.length&&n&&a===void 0&&!wa(t,r.slice(0,-1))?t:Up(t,r,a,n)}function u3(t){return et(t)==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function Ex(t){return Array.isArray(t)?[]:{}}var m3=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function Zn(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];var n=Ex(r[0]);return r.forEach(function(s){function i(o,c){var d=new Set(c),m=wa(s,o),u=Array.isArray(m);if(u||u3(m)){if(!d.has(m)){d.add(m);var x=wa(n,o);u?n=ra(n,o,[]):(!x||et(x)!=="object")&&(n=ra(n,o,Ex(m))),m3(m).forEach(function(h){i([].concat(Fe(o),[h]),d)})}}else n=ra(n,o,m)}i([])}),n}const x3=l.createContext({}),h3=l.createContext(void 0);var f3={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},g3={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},p3=X(X({},g3),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});const Vp={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},Ax={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},p3),timePickerLocale:Object.assign({},Vp)},Lr="${label} is not a valid ${type}",dn={locale:"en",Pagination:f3,DatePicker:Ax,TimePicker:Vp,Calendar:Ax,global:{placeholder:"Please select",close:"Close"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:Lr,method:Lr,array:Lr,object:Lr,number:Lr,date:Lr,boolean:Lr,integer:Lr,float:Lr,regexp:Lr,email:Lr,url:Lr,hex:Lr},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};let xo=Object.assign({},dn.Modal),ho=[];const Ox=()=>ho.reduce((t,r)=>Object.assign(Object.assign({},t),r),dn.Modal);function b3(t){if(t){const r=Object.assign({},t);return ho.push(r),xo=Ox(),()=>{ho=ho.filter(a=>a!==r),xo=Ox()}}xo=Object.assign({},dn.Modal)}function Gp(){return xo}const Qu=l.createContext(void 0),Nl=(t,r)=>{const a=l.useContext(Qu),n=l.useMemo(()=>{var i;const o=r||dn[t],c=(i=a==null?void 0:a[t])!==null&&i!==void 0?i:{};return Object.assign(Object.assign({},typeof o=="function"?o():o),c||{})},[t,r,a]),s=l.useMemo(()=>{const i=a==null?void 0:a.locale;return a!=null&&a.exist&&!i?dn.locale:i},[a]);return[n,s]},v3="internalMark",y3=t=>{const{locale:r={},children:a,_ANT_MARK__:n}=t;l.useEffect(()=>b3(r==null?void 0:r.Modal),[r]);const s=l.useMemo(()=>Object.assign(Object.assign({},r),{exist:!0}),[r]);return l.createElement(Qu.Provider,{value:s},a)},Kp={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},pi=Object.assign(Object.assign({},Kp),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),sr=Math.round;function rc(t,r){const a=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],n=a.map(s=>parseFloat(s));for(let s=0;s<3;s+=1)n[s]=r(n[s]||0,a[s]||"",s);return a[3]?n[3]=a[3].includes("%")?n[3]/100:n[3]:n[3]=1,n}const Ix=(t,r,a)=>a===0?t:t/100;function Vs(t,r){const a=r||255;return t>a?a:t<0?0:t}class Rt{constructor(r){G(this,"isValid",!0),G(this,"r",0),G(this,"g",0),G(this,"b",0),G(this,"a",1),G(this,"_h",void 0),G(this,"_s",void 0),G(this,"_l",void 0),G(this,"_v",void 0),G(this,"_max",void 0),G(this,"_min",void 0),G(this,"_brightness",void 0);function a(n){return n[0]in r&&n[1]in r&&n[2]in r}if(r)if(typeof r=="string"){let s=function(i){return n.startsWith(i)};const n=r.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):s("rgb")?this.fromRgbString(n):s("hsl")?this.fromHslString(n):(s("hsv")||s("hsb"))&&this.fromHsvString(n)}else if(r instanceof Rt)this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this._h=r._h,this._s=r._s,this._l=r._l,this._v=r._v;else if(a("rgb"))this.r=Vs(r.r),this.g=Vs(r.g),this.b=Vs(r.b),this.a=typeof r.a=="number"?Vs(r.a,1):1;else if(a("hsl"))this.fromHsl(r);else if(a("hsv"))this.fromHsv(r);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(r))}setR(r){return this._sc("r",r)}setG(r){return this._sc("g",r)}setB(r){return this._sc("b",r)}setA(r){return this._sc("a",r,1)}setHue(r){const a=this.toHsv();return a.h=r,this._c(a)}getLuminance(){function r(i){const o=i/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const a=r(this.r),n=r(this.g),s=r(this.b);return .2126*a+.7152*n+.0722*s}getHue(){if(typeof this._h>"u"){const r=this.getMax()-this.getMin();r===0?this._h=0:this._h=sr(60*(this.r===this.getMax()?(this.g-this.b)/r+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/r+2:(this.r-this.g)/r+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const r=this.getMax()-this.getMin();r===0?this._s=0:this._s=r/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(r=10){const a=this.getHue(),n=this.getSaturation();let s=this.getLightness()-r/100;return s<0&&(s=0),this._c({h:a,s:n,l:s,a:this.a})}lighten(r=10){const a=this.getHue(),n=this.getSaturation();let s=this.getLightness()+r/100;return s>1&&(s=1),this._c({h:a,s:n,l:s,a:this.a})}mix(r,a=50){const n=this._c(r),s=a/100,i=c=>(n[c]-this[c])*s+this[c],o={r:sr(i("r")),g:sr(i("g")),b:sr(i("b")),a:sr(i("a")*100)/100};return this._c(o)}tint(r=10){return this.mix({r:255,g:255,b:255,a:1},r)}shade(r=10){return this.mix({r:0,g:0,b:0,a:1},r)}onBackground(r){const a=this._c(r),n=this.a+a.a*(1-this.a),s=i=>sr((this[i]*this.a+a[i]*a.a*(1-this.a))/n);return this._c({r:s("r"),g:s("g"),b:s("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(r){return this.r===r.r&&this.g===r.g&&this.b===r.b&&this.a===r.a}clone(){return this._c(this)}toHexString(){let r="#";const a=(this.r||0).toString(16);r+=a.length===2?a:"0"+a;const n=(this.g||0).toString(16);r+=n.length===2?n:"0"+n;const s=(this.b||0).toString(16);if(r+=s.length===2?s:"0"+s,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=sr(this.a*255).toString(16);r+=i.length===2?i:"0"+i}return r}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const r=this.getHue(),a=sr(this.getSaturation()*100),n=sr(this.getLightness()*100);return this.a!==1?`hsla(${r},${a}%,${n}%,${this.a})`:`hsl(${r},${a}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(r,a,n){const s=this.clone();return s[r]=Vs(a,n),s}_c(r){return new this.constructor(r)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(r){const a=r.replace("#","");function n(s,i){return parseInt(a[s]+a[i||s],16)}a.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=a[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=a[6]?n(6,7)/255:1)}fromHsl({h:r,s:a,l:n,a:s}){if(this._h=r%360,this._s=a,this._l=n,this.a=typeof s=="number"?s:1,a<=0){const h=sr(n*255);this.r=h,this.g=h,this.b=h}let i=0,o=0,c=0;const d=r/60,m=(1-Math.abs(2*n-1))*a,u=m*(1-Math.abs(d%2-1));d>=0&&d<1?(i=m,o=u):d>=1&&d<2?(i=u,o=m):d>=2&&d<3?(o=m,c=u):d>=3&&d<4?(o=u,c=m):d>=4&&d<5?(i=u,c=m):d>=5&&d<6&&(i=m,c=u);const x=n-m/2;this.r=sr((i+x)*255),this.g=sr((o+x)*255),this.b=sr((c+x)*255)}fromHsv({h:r,s:a,v:n,a:s}){this._h=r%360,this._s=a,this._v=n,this.a=typeof s=="number"?s:1;const i=sr(n*255);if(this.r=i,this.g=i,this.b=i,a<=0)return;const o=r/60,c=Math.floor(o),d=o-c,m=sr(n*(1-a)*255),u=sr(n*(1-a*d)*255),x=sr(n*(1-a*(1-d))*255);switch(c){case 0:this.g=x,this.b=m;break;case 1:this.r=u,this.b=m;break;case 2:this.r=m,this.b=x;break;case 3:this.r=m,this.g=u;break;case 4:this.r=x,this.g=m;break;case 5:default:this.g=m,this.b=u;break}}fromHsvString(r){const a=rc(r,Ix);this.fromHsv({h:a[0],s:a[1],v:a[2],a:a[3]})}fromHslString(r){const a=rc(r,Ix);this.fromHsl({h:a[0],s:a[1],l:a[2],a:a[3]})}fromRgbString(r){const a=rc(r,(n,s)=>s.includes("%")?sr(n/100*255):n);this.r=a[0],this.g=a[1],this.b=a[2],this.a=a[3]}}var Yi=2,Tx=.16,j3=.05,w3=.05,N3=.15,qp=5,Xp=4,S3=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Mx(t,r,a){var n;return Math.round(t.h)>=60&&Math.round(t.h)<=240?n=a?Math.round(t.h)-Yi*r:Math.round(t.h)+Yi*r:n=a?Math.round(t.h)+Yi*r:Math.round(t.h)-Yi*r,n<0?n+=360:n>=360&&(n-=360),n}function Rx(t,r,a){if(t.h===0&&t.s===0)return t.s;var n;return a?n=t.s-Tx*r:r===Xp?n=t.s+Tx:n=t.s+j3*r,n>1&&(n=1),a&&r===qp&&n>.1&&(n=.1),n<.06&&(n=.06),Math.round(n*100)/100}function Lx(t,r,a){var n;return a?n=t.v+w3*r:n=t.v-N3*r,n=Math.max(0,Math.min(1,n)),Math.round(n*100)/100}function bi(t){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=[],n=new Rt(t),s=n.toHsv(),i=qp;i>0;i-=1){var o=new Rt({h:Mx(s,i,!0),s:Rx(s,i,!0),v:Lx(s,i,!0)});a.push(o)}a.push(n);for(var c=1;c<=Xp;c+=1){var d=new Rt({h:Mx(s,c),s:Rx(s,c),v:Lx(s,c)});a.push(d)}return r.theme==="dark"?S3.map(function(m){var u=m.index,x=m.amount;return new Rt(r.backgroundColor||"#141414").mix(a[u],x).toHexString()}):a.map(function(m){return m.toHexString()})}var ac={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},xd=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];xd.primary=xd[5];var hd=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];hd.primary=hd[5];var fd=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];fd.primary=fd[5];var gd=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];gd.primary=gd[5];var pd=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];pd.primary=pd[5];var bd=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];bd.primary=bd[5];var vd=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];vd.primary=vd[5];var yd=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];yd.primary=yd[5];var Bo=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Bo.primary=Bo[5];var jd=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];jd.primary=jd[5];var wd=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];wd.primary=wd[5];var Nd=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Nd.primary=Nd[5];var Sd=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];Sd.primary=Sd[5];var nc={red:xd,volcano:hd,orange:fd,gold:gd,yellow:pd,lime:bd,green:vd,cyan:yd,blue:Bo,geekblue:jd,purple:wd,magenta:Nd,grey:Sd};function C3(t,{generateColorPalettes:r,generateNeutralColorPalettes:a}){const{colorSuccess:n,colorWarning:s,colorError:i,colorInfo:o,colorPrimary:c,colorBgBase:d,colorTextBase:m}=t,u=r(c),x=r(n),h=r(s),f=r(i),g=r(o),b=a(d,m),p=t.colorLink||t.colorInfo,v=r(p),y=new Rt(f[1]).mix(new Rt(f[3]),50).toHexString();return Object.assign(Object.assign({},b),{colorPrimaryBg:u[1],colorPrimaryBgHover:u[2],colorPrimaryBorder:u[3],colorPrimaryBorderHover:u[4],colorPrimaryHover:u[5],colorPrimary:u[6],colorPrimaryActive:u[7],colorPrimaryTextHover:u[8],colorPrimaryText:u[9],colorPrimaryTextActive:u[10],colorSuccessBg:x[1],colorSuccessBgHover:x[2],colorSuccessBorder:x[3],colorSuccessBorderHover:x[4],colorSuccessHover:x[4],colorSuccess:x[6],colorSuccessActive:x[7],colorSuccessTextHover:x[8],colorSuccessText:x[9],colorSuccessTextActive:x[10],colorErrorBg:f[1],colorErrorBgHover:f[2],colorErrorBgFilledHover:y,colorErrorBgActive:f[3],colorErrorBorder:f[3],colorErrorBorderHover:f[4],colorErrorHover:f[5],colorError:f[6],colorErrorActive:f[7],colorErrorTextHover:f[8],colorErrorText:f[9],colorErrorTextActive:f[10],colorWarningBg:h[1],colorWarningBgHover:h[2],colorWarningBorder:h[3],colorWarningBorderHover:h[4],colorWarningHover:h[4],colorWarning:h[6],colorWarningActive:h[7],colorWarningTextHover:h[8],colorWarningText:h[9],colorWarningTextActive:h[10],colorInfoBg:g[1],colorInfoBgHover:g[2],colorInfoBorder:g[3],colorInfoBorderHover:g[4],colorInfoHover:g[4],colorInfo:g[6],colorInfoActive:g[7],colorInfoTextHover:g[8],colorInfoText:g[9],colorInfoTextActive:g[10],colorLinkHover:v[4],colorLink:v[6],colorLinkActive:v[7],colorBgMask:new Rt("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const _3=t=>{let r=t,a=t,n=t,s=t;return t<6&&t>=5?r=t+1:t<16&&t>=6?r=t+2:t>=16&&(r=16),t<7&&t>=5?a=4:t<8&&t>=7?a=5:t<14&&t>=8?a=6:t<16&&t>=14?a=7:t>=16&&(a=8),t<6&&t>=2?n=1:t>=6&&(n=2),t>4&&t<8?s=4:t>=8&&(s=6),{borderRadius:t,borderRadiusXS:n,borderRadiusSM:a,borderRadiusLG:r,borderRadiusOuter:s}};function k3(t){const{motionUnit:r,motionBase:a,borderRadius:n,lineWidth:s}=t;return Object.assign({motionDurationFast:`${(a+r).toFixed(1)}s`,motionDurationMid:`${(a+r*2).toFixed(1)}s`,motionDurationSlow:`${(a+r*3).toFixed(1)}s`,lineWidthBold:s+1},_3(n))}const P3=t=>{const{controlHeight:r}=t;return{controlHeightSM:r*.75,controlHeightXS:r*.5,controlHeightLG:r*1.25}};function fo(t){return(t+8)/t}function $3(t){const r=Array.from({length:10}).map((a,n)=>{const s=n-1,i=t*Math.pow(Math.E,s/5),o=n>1?Math.floor(i):Math.ceil(i);return Math.floor(o/2)*2});return r[1]=t,r.map(a=>({size:a,lineHeight:fo(a)}))}const E3=t=>{const r=$3(t),a=r.map(u=>u.size),n=r.map(u=>u.lineHeight),s=a[1],i=a[0],o=a[2],c=n[1],d=n[0],m=n[2];return{fontSizeSM:i,fontSize:s,fontSizeLG:o,fontSizeXL:a[3],fontSizeHeading1:a[6],fontSizeHeading2:a[5],fontSizeHeading3:a[4],fontSizeHeading4:a[3],fontSizeHeading5:a[2],lineHeight:c,lineHeightLG:m,lineHeightSM:d,fontHeight:Math.round(c*s),fontHeightLG:Math.round(m*o),fontHeightSM:Math.round(d*i),lineHeightHeading1:n[6],lineHeightHeading2:n[5],lineHeightHeading3:n[4],lineHeightHeading4:n[3],lineHeightHeading5:n[2]}};function A3(t){const{sizeUnit:r,sizeStep:a}=t;return{sizeXXL:r*(a+8),sizeXL:r*(a+4),sizeLG:r*(a+2),sizeMD:r*(a+1),sizeMS:r*a,size:r*a,sizeSM:r*(a-1),sizeXS:r*(a-2),sizeXXS:r*(a-3)}}const qr=(t,r)=>new Rt(t).setA(r).toRgbString(),Gs=(t,r)=>new Rt(t).darken(r).toHexString(),O3=t=>{const r=bi(t);return{1:r[0],2:r[1],3:r[2],4:r[3],5:r[4],6:r[5],7:r[6],8:r[4],9:r[5],10:r[6]}},I3=(t,r)=>{const a=t||"#fff",n=r||"#000";return{colorBgBase:a,colorTextBase:n,colorText:qr(n,.88),colorTextSecondary:qr(n,.65),colorTextTertiary:qr(n,.45),colorTextQuaternary:qr(n,.25),colorFill:qr(n,.15),colorFillSecondary:qr(n,.06),colorFillTertiary:qr(n,.04),colorFillQuaternary:qr(n,.02),colorBgSolid:qr(n,1),colorBgSolidHover:qr(n,.75),colorBgSolidActive:qr(n,.95),colorBgLayout:Gs(a,4),colorBgContainer:Gs(a,0),colorBgElevated:Gs(a,0),colorBgSpotlight:qr(n,.85),colorBgBlur:"transparent",colorBorder:Gs(a,15),colorBorderSecondary:Gs(a,6)}};function T3(t){ac.pink=ac.magenta,nc.pink=nc.magenta;const r=Object.keys(Kp).map(a=>{const n=t[a]===ac[a]?nc[a]:bi(t[a]);return Array.from({length:10},()=>1).reduce((s,i,o)=>(s[`${a}-${o+1}`]=n[o],s[`${a}${o+1}`]=n[o],s),{})}).reduce((a,n)=>(a=Object.assign(Object.assign({},a),n),a),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),r),C3(t,{generateColorPalettes:O3,generateNeutralColorPalettes:I3})),E3(t.fontSize)),A3(t)),P3(t)),k3(t))}const Yp=od(T3),Cd={token:pi,override:{override:pi},hashed:!0},Jp=me.createContext(Cd),Ho="ant",Sl="anticon",M3=["outlined","borderless","filled","underlined"],R3=(t,r)=>r||(t?`${Ho}-${t}`:Ho),It=l.createContext({getPrefixCls:R3,iconPrefixCls:Sl}),{Consumer:xM}=It,Dx={};function Qp(t){const r=l.useContext(It),{getPrefixCls:a,direction:n,getPopupContainer:s}=r,i=r[t];return Object.assign(Object.assign({classNames:Dx,styles:Dx},i),{getPrefixCls:a,direction:n,getPopupContainer:s})}const L3=`-ant-${Date.now()}-${Math.random()}`;function D3(t,r){const a={},n=(o,c)=>{let d=o.clone();return d=(c==null?void 0:c(d))||d,d.toRgbString()},s=(o,c)=>{const d=new Rt(o),m=bi(d.toRgbString());a[`${c}-color`]=n(d),a[`${c}-color-disabled`]=m[1],a[`${c}-color-hover`]=m[4],a[`${c}-color-active`]=m[6],a[`${c}-color-outline`]=d.clone().setA(.2).toRgbString(),a[`${c}-color-deprecated-bg`]=m[0],a[`${c}-color-deprecated-border`]=m[2]};if(r.primaryColor){s(r.primaryColor,"primary");const o=new Rt(r.primaryColor),c=bi(o.toRgbString());c.forEach((m,u)=>{a[`primary-${u+1}`]=m}),a["primary-color-deprecated-l-35"]=n(o,m=>m.lighten(35)),a["primary-color-deprecated-l-20"]=n(o,m=>m.lighten(20)),a["primary-color-deprecated-t-20"]=n(o,m=>m.tint(20)),a["primary-color-deprecated-t-50"]=n(o,m=>m.tint(50)),a["primary-color-deprecated-f-12"]=n(o,m=>m.setA(m.a*.12));const d=new Rt(c[0]);a["primary-color-active-deprecated-f-30"]=n(d,m=>m.setA(m.a*.3)),a["primary-color-active-deprecated-d-02"]=n(d,m=>m.darken(2))}return r.successColor&&s(r.successColor,"success"),r.warningColor&&s(r.warningColor,"warning"),r.errorColor&&s(r.errorColor,"error"),r.infoColor&&s(r.infoColor,"info"),`
  :root {
    ${Object.keys(a).map(o=>`--${t}-${o}: ${a[o]};`).join(`
`)}
  }
  `.trim()}function z3(t,r){const a=D3(t,r);Ir()&&za(a,`${L3}-dynamic-theme`)}const Wo=l.createContext(!1),Zp=({children:t,disabled:r})=>{const a=l.useContext(Wo);return l.createElement(Wo.Provider,{value:r??a},t)},Cs=l.createContext(void 0),F3=({children:t,size:r})=>{const a=l.useContext(Cs);return l.createElement(Cs.Provider,{value:r||a},t)};function B3(){const t=l.useContext(Wo),r=l.useContext(Cs);return{componentDisabled:t,componentSize:r}}var eb=er(function t(){Zt(this,t)}),tb="CALC_UNIT",H3=new RegExp(tb,"g");function sc(t){return typeof t=="number"?"".concat(t).concat(tb):t}var W3=function(t){Ua(a,t);var r=Va(a);function a(n,s){var i;Zt(this,a),i=r.call(this),G(it(i),"result",""),G(it(i),"unitlessCssVar",void 0),G(it(i),"lowPriority",void 0);var o=et(n);return i.unitlessCssVar=s,n instanceof a?i.result="(".concat(n.result,")"):o==="number"?i.result=sc(n):o==="string"&&(i.result=n),i}return er(a,[{key:"add",value:function(s){return s instanceof a?this.result="".concat(this.result," + ").concat(s.getResult()):(typeof s=="number"||typeof s=="string")&&(this.result="".concat(this.result," + ").concat(sc(s))),this.lowPriority=!0,this}},{key:"sub",value:function(s){return s instanceof a?this.result="".concat(this.result," - ").concat(s.getResult()):(typeof s=="number"||typeof s=="string")&&(this.result="".concat(this.result," - ").concat(sc(s))),this.lowPriority=!0,this}},{key:"mul",value:function(s){return this.lowPriority&&(this.result="(".concat(this.result,")")),s instanceof a?this.result="".concat(this.result," * ").concat(s.getResult(!0)):(typeof s=="number"||typeof s=="string")&&(this.result="".concat(this.result," * ").concat(s)),this.lowPriority=!1,this}},{key:"div",value:function(s){return this.lowPriority&&(this.result="(".concat(this.result,")")),s instanceof a?this.result="".concat(this.result," / ").concat(s.getResult(!0)):(typeof s=="number"||typeof s=="string")&&(this.result="".concat(this.result," / ").concat(s)),this.lowPriority=!1,this}},{key:"getResult",value:function(s){return this.lowPriority||s?"(".concat(this.result,")"):this.result}},{key:"equal",value:function(s){var i=this,o=s||{},c=o.unit,d=!0;return typeof c=="boolean"?d=c:Array.from(this.unitlessCssVar).some(function(m){return i.result.includes(m)})&&(d=!1),this.result=this.result.replace(H3,d?"px":""),typeof this.lowPriority<"u"?"calc(".concat(this.result,")"):this.result}}]),a}(eb),U3=function(t){Ua(a,t);var r=Va(a);function a(n){var s;return Zt(this,a),s=r.call(this),G(it(s),"result",0),n instanceof a?s.result=n.result:typeof n=="number"&&(s.result=n),s}return er(a,[{key:"add",value:function(s){return s instanceof a?this.result+=s.result:typeof s=="number"&&(this.result+=s),this}},{key:"sub",value:function(s){return s instanceof a?this.result-=s.result:typeof s=="number"&&(this.result-=s),this}},{key:"mul",value:function(s){return s instanceof a?this.result*=s.result:typeof s=="number"&&(this.result*=s),this}},{key:"div",value:function(s){return s instanceof a?this.result/=s.result:typeof s=="number"&&(this.result/=s),this}},{key:"equal",value:function(){return this.result}}]),a}(eb),V3=function(r,a){var n=r==="css"?W3:U3;return function(s){return new n(s,a)}},zx=function(r,a){return"".concat([a,r.replace(/([A-Z]+)([A-Z][a-z]+)/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2")].filter(Boolean).join("-"))};function vr(t){var r=l.useRef();r.current=t;var a=l.useCallback(function(){for(var n,s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return(n=r.current)===null||n===void 0?void 0:n.call.apply(n,[r].concat(i))},[]);return a}function _s(t){var r=l.useRef(!1),a=l.useState(t),n=he(a,2),s=n[0],i=n[1];l.useEffect(function(){return r.current=!1,function(){r.current=!0}},[]);function o(c,d){d&&r.current||i(c)}return[s,o]}function ic(t){return t!==void 0}function is(t,r){var a=r||{},n=a.defaultValue,s=a.value,i=a.onChange,o=a.postState,c=_s(function(){return ic(s)?s:ic(n)?typeof n=="function"?n():n:typeof t=="function"?t():t}),d=he(c,2),m=d[0],u=d[1],x=s!==void 0?s:m,h=o?o(x):x,f=vr(i),g=_s([x]),b=he(g,2),p=b[0],v=b[1];cd(function(){var j=p[0];m!==j&&f(m,j)},[p]),cd(function(){ic(s)||u(s)},[s]);var y=vr(function(j,S){u(j,S),v([x],S)});return[h,y]}function Fx(t,r,a,n){var s=X({},r[t]);if(n!=null&&n.deprecatedTokens){var i=n.deprecatedTokens;i.forEach(function(c){var d=he(c,2),m=d[0],u=d[1];if(s!=null&&s[m]||s!=null&&s[u]){var x;(x=s[u])!==null&&x!==void 0||(s[u]=s==null?void 0:s[m])}})}var o=X(X({},a),s);return Object.keys(o).forEach(function(c){o[c]===r[c]&&delete o[c]}),o}var rb=typeof CSSINJS_STATISTIC<"u",_d=!0;function ua(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];if(!rb)return Object.assign.apply(Object,[{}].concat(r));_d=!1;var n={};return r.forEach(function(s){if(et(s)==="object"){var i=Object.keys(s);i.forEach(function(o){Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get:function(){return s[o]}})})}}),_d=!0,n}var Bx={};function G3(){}var K3=function(r){var a,n=r,s=G3;return rb&&typeof Proxy<"u"&&(a=new Set,n=new Proxy(r,{get:function(o,c){if(_d){var d;(d=a)===null||d===void 0||d.add(c)}return o[c]}}),s=function(o,c){var d;Bx[o]={global:Array.from(a),component:X(X({},(d=Bx[o])===null||d===void 0?void 0:d.component),c)}}),{token:n,keys:a,flush:s}};function Hx(t,r,a){if(typeof a=="function"){var n;return a(ua(r,(n=r[t])!==null&&n!==void 0?n:{}))}return a??{}}function q3(t){return t==="js"?{max:Math.max,min:Math.min}:{max:function(){for(var a=arguments.length,n=new Array(a),s=0;s<a;s++)n[s]=arguments[s];return"max(".concat(n.map(function(i){return we(i)}).join(","),")")},min:function(){for(var a=arguments.length,n=new Array(a),s=0;s<a;s++)n[s]=arguments[s];return"min(".concat(n.map(function(i){return we(i)}).join(","),")")}}}var X3=1e3*60*10,Y3=function(){function t(){Zt(this,t),G(this,"map",new Map),G(this,"objectIDMap",new WeakMap),G(this,"nextID",0),G(this,"lastAccessBeat",new Map),G(this,"accessBeat",0)}return er(t,[{key:"set",value:function(a,n){this.clear();var s=this.getCompositeKey(a);this.map.set(s,n),this.lastAccessBeat.set(s,Date.now())}},{key:"get",value:function(a){var n=this.getCompositeKey(a),s=this.map.get(n);return this.lastAccessBeat.set(n,Date.now()),this.accessBeat+=1,s}},{key:"getCompositeKey",value:function(a){var n=this,s=a.map(function(i){return i&&et(i)==="object"?"obj_".concat(n.getObjectID(i)):"".concat(et(i),"_").concat(i)});return s.join("|")}},{key:"getObjectID",value:function(a){if(this.objectIDMap.has(a))return this.objectIDMap.get(a);var n=this.nextID;return this.objectIDMap.set(a,n),this.nextID+=1,n}},{key:"clear",value:function(){var a=this;if(this.accessBeat>1e4){var n=Date.now();this.lastAccessBeat.forEach(function(s,i){n-s>X3&&(a.map.delete(i),a.lastAccessBeat.delete(i))}),this.accessBeat=0}}}]),t}(),Wx=new Y3;function J3(t,r){return me.useMemo(function(){var a=Wx.get(r);if(a)return a;var n=t();return Wx.set(r,n),n},r)}var Q3=function(){return{}};function Z3(t){var r=t.useCSP,a=r===void 0?Q3:r,n=t.useToken,s=t.usePrefix,i=t.getResetStyles,o=t.getCommonStyle,c=t.getCompUnitless;function d(h,f,g,b){var p=Array.isArray(h)?h[0]:h;function v(P){return"".concat(String(p)).concat(P.slice(0,1).toUpperCase()).concat(P.slice(1))}var y=(b==null?void 0:b.unitless)||{},j=typeof c=="function"?c(h):{},S=X(X({},j),{},G({},v("zIndexPopup"),!0));Object.keys(y).forEach(function(P){S[v(P)]=y[P]});var N=X(X({},b),{},{unitless:S,prefixToken:v}),w=u(h,f,g,N),_=m(p,g,N);return function(P){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:P,T=w(P,O),k=he(T,2),$=k[1],C=_(O),A=he(C,2),E=A[0],L=A[1];return[E,$,L]}}function m(h,f,g){var b=g.unitless,p=g.injectStyle,v=p===void 0?!0:p,y=g.prefixToken,j=g.ignore,S=function(_){var P=_.rootCls,O=_.cssVar,T=O===void 0?{}:O,k=n(),$=k.realToken;return l3({path:[h],prefix:T.prefix,key:T.key,unitless:b,ignore:j,token:$,scope:P},function(){var C=Hx(h,$,f),A=Fx(h,$,C,{deprecatedTokens:g==null?void 0:g.deprecatedTokens});return Object.keys(C).forEach(function(E){A[y(E)]=A[E],delete A[E]}),A}),null},N=function(_){var P=n(),O=P.cssVar;return[function(T){return v&&O?me.createElement(me.Fragment,null,me.createElement(S,{rootCls:_,cssVar:O,component:h}),T):T},O==null?void 0:O.key]};return N}function u(h,f,g){var b=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},p=Array.isArray(h)?h:[h,h],v=he(p,1),y=v[0],j=p.join("-"),S=t.layer||{name:"antd"};return function(N){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N,_=n(),P=_.theme,O=_.realToken,T=_.hashId,k=_.token,$=_.cssVar,C=s(),A=C.rootPrefixCls,E=C.iconPrefixCls,L=a(),F=$?"css":"js",D=J3(function(){var W=new Set;return $&&Object.keys(b.unitless||{}).forEach(function(le){W.add(oo(le,$.prefix)),W.add(oo(le,zx(y,$.prefix)))}),V3(F,W)},[F,y,$==null?void 0:$.prefix]),q=q3(F),Q=q.max,de=q.min,H={theme:P,token:k,hashId:T,nonce:function(){return L.nonce},clientOnly:b.clientOnly,layer:S,order:b.order||-999};typeof i=="function"&&md(X(X({},H),{},{clientOnly:!1,path:["Shared",A]}),function(){return i(k,{prefix:{rootPrefixCls:A,iconPrefixCls:E},csp:L})});var se=md(X(X({},H),{},{path:[j,N,E]}),function(){if(b.injectStyle===!1)return[];var W=K3(k),le=W.token,U=W.flush,ee=Hx(y,O,g),ae=".".concat(N),ue=Fx(y,O,ee,{deprecatedTokens:b.deprecatedTokens});$&&ee&&et(ee)==="object"&&Object.keys(ee).forEach(function(ce){ee[ce]="var(".concat(oo(ce,zx(y,$.prefix)),")")});var fe=ua(le,{componentCls:ae,prefixCls:N,iconCls:".".concat(E),antCls:".".concat(A),calc:D,max:Q,min:de},$?ee:ue),re=f(fe,{hashId:T,prefixCls:N,rootPrefixCls:A,iconPrefixCls:E});U(y,ue);var V=typeof o=="function"?o(fe,N,w,b.resetFont):null;return[b.resetStyle===!1?null:V,re]});return[se,T]}}function x(h,f,g){var b=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},p=u(h,f,g,X({resetStyle:!1,order:-998},b)),v=function(j){var S=j.prefixCls,N=j.rootCls,w=N===void 0?S:N;return p(S,w),null};return v}return{genStyleHooks:d,genSubStyleComponent:x,genComponentStyleHook:u}}const Zu=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"],eP="5.29.3";function oc(t){return t>=0&&t<=255}function Ys(t,r){const{r:a,g:n,b:s,a:i}=new Rt(t).toRgb();if(i<1)return t;const{r:o,g:c,b:d}=new Rt(r).toRgb();for(let m=.01;m<=1;m+=.01){const u=Math.round((a-o*(1-m))/m),x=Math.round((n-c*(1-m))/m),h=Math.round((s-d*(1-m))/m);if(oc(u)&&oc(x)&&oc(h))return new Rt({r:u,g:x,b:h,a:Math.round(m*100)/100}).toRgbString()}return new Rt({r:a,g:n,b:s,a:1}).toRgbString()}var tP=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};function ab(t){const{override:r}=t,a=tP(t,["override"]),n=Object.assign({},r);Object.keys(pi).forEach(h=>{delete n[h]});const s=Object.assign(Object.assign({},a),n),i=480,o=576,c=768,d=992,m=1200,u=1600;if(s.motion===!1){const h="0s";s.motionDurationFast=h,s.motionDurationMid=h,s.motionDurationSlow=h}return Object.assign(Object.assign(Object.assign({},s),{colorFillContent:s.colorFillSecondary,colorFillContentHover:s.colorFill,colorFillAlter:s.colorFillQuaternary,colorBgContainerDisabled:s.colorFillTertiary,colorBorderBg:s.colorBgContainer,colorSplit:Ys(s.colorBorderSecondary,s.colorBgContainer),colorTextPlaceholder:s.colorTextQuaternary,colorTextDisabled:s.colorTextQuaternary,colorTextHeading:s.colorText,colorTextLabel:s.colorTextSecondary,colorTextDescription:s.colorTextTertiary,colorTextLightSolid:s.colorWhite,colorHighlight:s.colorError,colorBgTextHover:s.colorFillSecondary,colorBgTextActive:s.colorFill,colorIcon:s.colorTextTertiary,colorIconHover:s.colorText,colorErrorOutline:Ys(s.colorErrorBg,s.colorBgContainer),colorWarningOutline:Ys(s.colorWarningBg,s.colorBgContainer),fontSizeIcon:s.fontSizeSM,lineWidthFocus:s.lineWidth*3,lineWidth:s.lineWidth,controlOutlineWidth:s.lineWidth*2,controlInteractiveSize:s.controlHeight/2,controlItemBgHover:s.colorFillTertiary,controlItemBgActive:s.colorPrimaryBg,controlItemBgActiveHover:s.colorPrimaryBgHover,controlItemBgActiveDisabled:s.colorFill,controlTmpOutline:s.colorFillQuaternary,controlOutline:Ys(s.colorPrimaryBg,s.colorBgContainer),lineType:s.lineType,borderRadius:s.borderRadius,borderRadiusXS:s.borderRadiusXS,borderRadiusSM:s.borderRadiusSM,borderRadiusLG:s.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:s.sizeXXS,paddingXS:s.sizeXS,paddingSM:s.sizeSM,padding:s.size,paddingMD:s.sizeMD,paddingLG:s.sizeLG,paddingXL:s.sizeXL,paddingContentHorizontalLG:s.sizeLG,paddingContentVerticalLG:s.sizeMS,paddingContentHorizontal:s.sizeMS,paddingContentVertical:s.sizeSM,paddingContentHorizontalSM:s.size,paddingContentVerticalSM:s.sizeXS,marginXXS:s.sizeXXS,marginXS:s.sizeXS,marginSM:s.sizeSM,margin:s.size,marginMD:s.sizeMD,marginLG:s.sizeLG,marginXL:s.sizeXL,marginXXL:s.sizeXXL,boxShadow:`
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,boxShadowSecondary:`
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,boxShadowTertiary:`
      0 1px 2px 0 rgba(0, 0, 0, 0.03),
      0 1px 6px -1px rgba(0, 0, 0, 0.02),
      0 2px 4px 0 rgba(0, 0, 0, 0.02)
    `,screenXS:i,screenXSMin:i,screenXSMax:o-1,screenSM:o,screenSMMin:o,screenSMMax:c-1,screenMD:c,screenMDMin:c,screenMDMax:d-1,screenLG:d,screenLGMin:d,screenLGMax:m-1,screenXL:m,screenXLMin:m,screenXLMax:u-1,screenXXL:u,screenXXLMin:u,boxShadowPopoverArrow:"2px 2px 5px rgba(0, 0, 0, 0.05)",boxShadowCard:`
      0 1px 2px -2px ${new Rt("rgba(0, 0, 0, 0.16)").toRgbString()},
      0 3px 6px 0 ${new Rt("rgba(0, 0, 0, 0.12)").toRgbString()},
      0 5px 12px 4px ${new Rt("rgba(0, 0, 0, 0.09)").toRgbString()}
    `,boxShadowDrawerRight:`
      -6px 0 16px 0 rgba(0, 0, 0, 0.08),
      -3px 0 6px -4px rgba(0, 0, 0, 0.12),
      -9px 0 28px 8px rgba(0, 0, 0, 0.05)
    `,boxShadowDrawerLeft:`
      6px 0 16px 0 rgba(0, 0, 0, 0.08),
      3px 0 6px -4px rgba(0, 0, 0, 0.12),
      9px 0 28px 8px rgba(0, 0, 0, 0.05)
    `,boxShadowDrawerUp:`
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,boxShadowDrawerDown:`
      0 -6px 16px 0 rgba(0, 0, 0, 0.08),
      0 -3px 6px -4px rgba(0, 0, 0, 0.12),
      0 -9px 28px 8px rgba(0, 0, 0, 0.05)
    `,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),n)}var Ux=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const nb={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},rP={motionBase:!0,motionUnit:!0},aP={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},sb=(t,r,a)=>{const n=a.getDerivativeToken(t),{override:s}=r,i=Ux(r,["override"]);let o=Object.assign(Object.assign({},n),{override:s});return o=ab(o),i&&Object.entries(i).forEach(([c,d])=>{const{theme:m}=d,u=Ux(d,["theme"]);let x=u;m&&(x=sb(Object.assign(Object.assign({},o),u),{override:u},m)),o[c]=x}),o};function un(){const{token:t,hashed:r,theme:a,override:n,cssVar:s}=me.useContext(Jp),i=`${eP}-${r||""}`,o=a||Yp,[c,d,m]=Tk(o,[pi,t],{salt:i,override:n,getComputedToken:sb,formatToken:ab,cssVar:s&&{prefix:s.prefix,key:s.key,unitless:nb,ignore:rP,preserve:aP}});return[o,m,r?d:"",c,s]}const em={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},Cl=(t,r=!1)=>({boxSizing:"border-box",margin:0,padding:0,color:t.colorText,fontSize:t.fontSize,lineHeight:t.lineHeight,listStyle:"none",fontFamily:r?"inherit":t.fontFamily}),ib=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),_l=()=>({"&::before":{display:"table",content:'""'},"&::after":{display:"table",clear:"both",content:'""'}}),nP=t=>({a:{color:t.colorLink,textDecoration:t.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:`color ${t.motionDurationSlow}`,"-webkit-text-decoration-skip":"objects","&:hover":{color:t.colorLinkHover},"&:active":{color:t.colorLinkActive},"&:active, &:hover":{textDecoration:t.linkHoverDecoration,outline:0},"&:focus":{textDecoration:t.linkFocusDecoration,outline:0},"&[disabled]":{color:t.colorTextDisabled,cursor:"not-allowed"}}}),sP=(t,r,a,n)=>{const s=`[class^="${r}"], [class*=" ${r}"]`,i=a?`.${a}`:s,o={boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}};let c={};return n!==!1&&(c={fontFamily:t.fontFamily,fontSize:t.fontSize}),{[i]:Object.assign(Object.assign(Object.assign({},c),o),{[s]:o})}},tm=(t,r)=>({outline:`${we(t.lineWidthFocus)} solid ${t.colorPrimaryBorder}`,outlineOffset:r??1,transition:"outline-offset 0s, outline 0s"}),vi=(t,r)=>({"&:focus-visible":tm(t,r)}),ob=t=>({[`.${t}`]:Object.assign(Object.assign({},ib()),{[`.${t} .${t}-icon`]:{display:"block"}})}),{genStyleHooks:Ln,genComponentStyleHook:iP,genSubStyleComponent:lb}=Z3({usePrefix:()=>{const{getPrefixCls:t,iconPrefixCls:r}=l.useContext(It);return{rootPrefixCls:t(),iconPrefixCls:r}},useToken:()=>{const[t,r,a,n,s]=un();return{theme:t,realToken:r,hashId:a,token:n,cssVar:s}},useCSP:()=>{const{csp:t}=l.useContext(It);return t??{}},getResetStyles:(t,r)=>{var a;const n=nP(t);return[n,{"&":n},ob((a=r==null?void 0:r.prefix.iconPrefixCls)!==null&&a!==void 0?a:Sl)]},getCommonStyle:sP,getCompUnitless:()=>nb}),oP=(t,r)=>{const[a,n]=un();return md({token:n,hashId:"",path:["ant-design-icons",t],nonce:()=>r==null?void 0:r.nonce,layer:{name:"antd"}},()=>ob(t))},lP=Object.assign({},Qo),{useId:Vx}=lP,cP=()=>"",dP=typeof Vx>"u"?cP:Vx;function uP(t,r,a){var n;const s=t||{},i=s.inherit===!1||!r?Object.assign(Object.assign({},Cd),{hashed:(n=r==null?void 0:r.hashed)!==null&&n!==void 0?n:Cd.hashed,cssVar:r==null?void 0:r.cssVar}):r,o=dP();return bl(()=>{var c,d;if(!t)return r;const m=Object.assign({},i.components);Object.keys(t.components||{}).forEach(h=>{m[h]=Object.assign(Object.assign({},m[h]),t.components[h])});const u=`css-var-${o.replace(/:/g,"")}`,x=((c=s.cssVar)!==null&&c!==void 0?c:i.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:a==null?void 0:a.prefixCls},typeof i.cssVar=="object"?i.cssVar:{}),typeof s.cssVar=="object"?s.cssVar:{}),{key:typeof s.cssVar=="object"&&((d=s.cssVar)===null||d===void 0?void 0:d.key)||u});return Object.assign(Object.assign(Object.assign({},i),s),{token:Object.assign(Object.assign({},i.token),s.token),components:m,cssVar:x})},[s,i],(c,d)=>c.some((m,u)=>{const x=d[u];return!fi(m,x,!0)}))}var mP=["children"],cb=l.createContext({});function xP(t){var r=t.children,a=bt(t,mP);return l.createElement(cb.Provider,{value:a},r)}var hP=function(t){Ua(a,t);var r=Va(a);function a(){return Zt(this,a),r.apply(this,arguments)}return er(a,[{key:"render",value:function(){return this.props.children}}]),a}(l.Component);function fP(t){var r=l.useReducer(function(c){return c+1},0),a=he(r,2),n=a[1],s=l.useRef(t),i=vr(function(){return s.current}),o=vr(function(c){s.current=typeof c=="function"?c(s.current):c,n()});return[i,o]}var Ja="none",Ji="appear",Qi="enter",Zi="leave",Gx="none",aa="prepare",es="start",ts="active",rm="end",db="prepared";function Kx(t,r){var a={};return a[t.toLowerCase()]=r.toLowerCase(),a["Webkit".concat(t)]="webkit".concat(r),a["Moz".concat(t)]="moz".concat(r),a["ms".concat(t)]="MS".concat(r),a["O".concat(t)]="o".concat(r.toLowerCase()),a}function gP(t,r){var a={animationend:Kx("Animation","AnimationEnd"),transitionend:Kx("Transition","TransitionEnd")};return t&&("AnimationEvent"in r||delete a.animationend.animation,"TransitionEvent"in r||delete a.transitionend.transition),a}var pP=gP(Ir(),typeof window<"u"?window:{}),ub={};if(Ir()){var bP=document.createElement("div");ub=bP.style}var eo={};function mb(t){if(eo[t])return eo[t];var r=pP[t];if(r)for(var a=Object.keys(r),n=a.length,s=0;s<n;s+=1){var i=a[s];if(Object.prototype.hasOwnProperty.call(r,i)&&i in ub)return eo[t]=r[i],eo[t]}return""}var xb=mb("animationend"),hb=mb("transitionend"),fb=!!(xb&&hb),qx=xb||"animationend",Xx=hb||"transitionend";function Yx(t,r){if(!t)return null;if(et(t)==="object"){var a=r.replace(/-\w/g,function(n){return n[1].toUpperCase()});return t[a]}return"".concat(t,"-").concat(r)}const vP=function(t){var r=l.useRef();function a(s){s&&(s.removeEventListener(Xx,t),s.removeEventListener(qx,t))}function n(s){r.current&&r.current!==s&&a(r.current),s&&s!==r.current&&(s.addEventListener(Xx,t),s.addEventListener(qx,t),r.current=s)}return l.useEffect(function(){return function(){a(r.current)}},[]),[n,a]};var gb=Ir()?l.useLayoutEffect:l.useEffect;const yP=function(){var t=l.useRef(null);function r(){jr.cancel(t.current)}function a(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;r();var i=jr(function(){s<=1?n({isCanceled:function(){return i!==t.current}}):a(n,s-1)});t.current=i}return l.useEffect(function(){return function(){r()}},[]),[a,r]};var jP=[aa,es,ts,rm],wP=[aa,db],pb=!1,NP=!0;function bb(t){return t===ts||t===rm}const SP=function(t,r,a){var n=_s(Gx),s=he(n,2),i=s[0],o=s[1],c=yP(),d=he(c,2),m=d[0],u=d[1];function x(){o(aa,!0)}var h=r?wP:jP;return gb(function(){if(i!==Gx&&i!==rm){var f=h.indexOf(i),g=h[f+1],b=a(i);b===pb?o(g,!0):g&&m(function(p){function v(){p.isCanceled()||o(g,!0)}b===!0?v():Promise.resolve(b).then(v)})}},[t,i]),l.useEffect(function(){return function(){u()}},[]),[x,i]};function CP(t,r,a,n){var s=n.motionEnter,i=s===void 0?!0:s,o=n.motionAppear,c=o===void 0?!0:o,d=n.motionLeave,m=d===void 0?!0:d,u=n.motionDeadline,x=n.motionLeaveImmediately,h=n.onAppearPrepare,f=n.onEnterPrepare,g=n.onLeavePrepare,b=n.onAppearStart,p=n.onEnterStart,v=n.onLeaveStart,y=n.onAppearActive,j=n.onEnterActive,S=n.onLeaveActive,N=n.onAppearEnd,w=n.onEnterEnd,_=n.onLeaveEnd,P=n.onVisibleChanged,O=_s(),T=he(O,2),k=T[0],$=T[1],C=fP(Ja),A=he(C,2),E=A[0],L=A[1],F=_s(null),D=he(F,2),q=D[0],Q=D[1],de=E(),H=l.useRef(!1),se=l.useRef(null);function W(){return a()}var le=l.useRef(!1);function U(){L(Ja),Q(null,!0)}var ee=vr(function(ie){var I=E();if(I!==Ja){var R=W();if(!(ie&&!ie.deadline&&ie.target!==R)){var je=le.current,Te;I===Ji&&je?Te=N==null?void 0:N(R,ie):I===Qi&&je?Te=w==null?void 0:w(R,ie):I===Zi&&je&&(Te=_==null?void 0:_(R,ie)),je&&Te!==!1&&U()}}}),ae=vP(ee),ue=he(ae,1),fe=ue[0],re=function(I){switch(I){case Ji:return G(G(G({},aa,h),es,b),ts,y);case Qi:return G(G(G({},aa,f),es,p),ts,j);case Zi:return G(G(G({},aa,g),es,v),ts,S);default:return{}}},V=l.useMemo(function(){return re(de)},[de]),ce=SP(de,!t,function(ie){if(ie===aa){var I=V[aa];return I?I(W()):pb}if(pe in V){var R;Q(((R=V[pe])===null||R===void 0?void 0:R.call(V,W(),null))||null)}return pe===ts&&de!==Ja&&(fe(W()),u>0&&(clearTimeout(se.current),se.current=setTimeout(function(){ee({deadline:!0})},u))),pe===db&&U(),NP}),Z=he(ce,2),xe=Z[0],pe=Z[1],Se=bb(pe);le.current=Se;var ke=l.useRef(null);gb(function(){if(!(H.current&&ke.current===r)){$(r);var ie=H.current;H.current=!0;var I;!ie&&r&&c&&(I=Ji),ie&&r&&i&&(I=Qi),(ie&&!r&&m||!ie&&x&&!r&&m)&&(I=Zi);var R=re(I);I&&(t||R[aa])?(L(I),xe()):L(Ja),ke.current=r}},[r]),l.useEffect(function(){(de===Ji&&!c||de===Qi&&!i||de===Zi&&!m)&&L(Ja)},[c,i,m]),l.useEffect(function(){return function(){H.current=!1,clearTimeout(se.current)}},[]);var $e=l.useRef(!1);l.useEffect(function(){k&&($e.current=!0),k!==void 0&&de===Ja&&(($e.current||k)&&(P==null||P(k)),$e.current=!0)},[k,de]);var K=q;return V[aa]&&pe===es&&(K=X({transition:"none"},K)),[de,pe,K,k??r]}function _P(t){var r=t;et(t)==="object"&&(r=t.transitionSupport);function a(s,i){return!!(s.motionName&&r&&i!==!1)}var n=l.forwardRef(function(s,i){var o=s.visible,c=o===void 0?!0:o,d=s.removeOnLeave,m=d===void 0?!0:d,u=s.forceRender,x=s.children,h=s.motionName,f=s.leavedClassName,g=s.eventProps,b=l.useContext(cb),p=b.motion,v=a(s,p),y=l.useRef(),j=l.useRef();function S(){try{return y.current instanceof HTMLElement?y.current:io(j.current)}catch{return null}}var N=CP(v,c,S,s),w=he(N,4),_=w[0],P=w[1],O=w[2],T=w[3],k=l.useRef(T);T&&(k.current=!0);var $=l.useCallback(function(D){y.current=D,Wu(i,D)},[i]),C,A=X(X({},g),{},{visible:c});if(!x)C=null;else if(_===Ja)T?C=x(X({},A),$):!m&&k.current&&f?C=x(X(X({},A),{},{className:f}),$):u||!m&&!f?C=x(X(X({},A),{},{style:{display:"none"}}),$):C=null;else{var E;P===aa?E="prepare":bb(P)?E="active":P===es&&(E="start");var L=Yx(h,"".concat(_,"-").concat(E));C=x(X(X({},A),{},{className:_e(Yx(h,_),G(G({},L,L&&E),h,typeof h=="string")),style:O}),$)}if(l.isValidElement(C)&&Rn(C)){var F=Os(C);F||(C=l.cloneElement(C,{ref:$}))}return l.createElement(hP,{ref:j},C)});return n.displayName="CSSMotion",n}const Ga=_P(fb);var kd="add",Pd="keep",$d="remove",lc="removed";function kP(t){var r;return t&&et(t)==="object"&&"key"in t?r=t:r={key:t},X(X({},r),{},{key:String(r.key)})}function Ed(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return t.map(kP)}function PP(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=[],n=0,s=r.length,i=Ed(t),o=Ed(r);i.forEach(function(m){for(var u=!1,x=n;x<s;x+=1){var h=o[x];if(h.key===m.key){n<x&&(a=a.concat(o.slice(n,x).map(function(f){return X(X({},f),{},{status:kd})})),n=x),a.push(X(X({},h),{},{status:Pd})),n+=1,u=!0;break}}u||a.push(X(X({},m),{},{status:$d}))}),n<s&&(a=a.concat(o.slice(n).map(function(m){return X(X({},m),{},{status:kd})})));var c={};a.forEach(function(m){var u=m.key;c[u]=(c[u]||0)+1});var d=Object.keys(c).filter(function(m){return c[m]>1});return d.forEach(function(m){a=a.filter(function(u){var x=u.key,h=u.status;return x!==m||h!==$d}),a.forEach(function(u){u.key===m&&(u.status=Pd)})}),a}var $P=["component","children","onVisibleChanged","onAllRemoved"],EP=["status"],AP=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function OP(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ga,a=function(n){Ua(i,n);var s=Va(i);function i(){var o;Zt(this,i);for(var c=arguments.length,d=new Array(c),m=0;m<c;m++)d[m]=arguments[m];return o=s.call.apply(s,[this].concat(d)),G(it(o),"state",{keyEntities:[]}),G(it(o),"removeKey",function(u){o.setState(function(x){var h=x.keyEntities.map(function(f){return f.key!==u?f:X(X({},f),{},{status:lc})});return{keyEntities:h}},function(){var x=o.state.keyEntities,h=x.filter(function(f){var g=f.status;return g!==lc}).length;h===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return er(i,[{key:"render",value:function(){var c=this,d=this.state.keyEntities,m=this.props,u=m.component,x=m.children,h=m.onVisibleChanged;m.onAllRemoved;var f=bt(m,$P),g=u||l.Fragment,b={};return AP.forEach(function(p){b[p]=f[p],delete f[p]}),delete f.keys,l.createElement(g,f,d.map(function(p,v){var y=p.status,j=bt(p,EP),S=y===kd||y===Pd;return l.createElement(r,Ve({},b,{key:j.key,visible:S,eventProps:j,onVisibleChanged:function(w){h==null||h(w,{key:j.key}),w||c.removeKey(j.key)}}),function(N,w){return x(X(X({},N),{},{index:v}),w)})}))}}],[{key:"getDerivedStateFromProps",value:function(c,d){var m=c.keys,u=d.keyEntities,x=Ed(m),h=PP(u,x);return{keyEntities:h.filter(function(f){var g=u.find(function(b){var p=b.key;return f.key===p});return!(g&&g.status===lc&&f.status===$d)})}}}]),i}(l.Component);return G(a,"defaultProps",{component:"div"}),a}OP(fb);const Jx=l.createContext(!0);function IP(t){const r=l.useContext(Jx),{children:a}=t,[,n]=un(),{motion:s}=n,i=l.useRef(!1);return i.current||(i.current=r!==s),i.current?l.createElement(Jx.Provider,{value:s},l.createElement(xP,{motion:s},a)):a}const TP=()=>null;var MP=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const RP=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let Uo,vb,yb,jb;function go(){return Uo||Ho}function LP(){return vb||Sl}function DP(t){return Object.keys(t).some(r=>r.endsWith("Color"))}const zP=t=>{const{prefixCls:r,iconPrefixCls:a,theme:n,holderRender:s}=t;r!==void 0&&(Uo=r),a!==void 0&&(vb=a),"holderRender"in t&&(jb=s),n&&(DP(n)?z3(go(),n):yb=n)},FP=()=>({getPrefixCls:(t,r)=>r||(t?`${go()}-${t}`:go()),getIconPrefixCls:LP,getRootPrefixCls:()=>Uo||go(),getTheme:()=>yb,holderRender:jb}),BP=t=>{const{children:r,csp:a,autoInsertSpaceInButton:n,alert:s,anchor:i,form:o,locale:c,componentSize:d,direction:m,space:u,splitter:x,virtual:h,dropdownMatchSelectWidth:f,popupMatchSelectWidth:g,popupOverflow:b,legacyLocale:p,parentContext:v,iconPrefixCls:y,theme:j,componentDisabled:S,segmented:N,statistic:w,spin:_,calendar:P,carousel:O,cascader:T,collapse:k,typography:$,checkbox:C,descriptions:A,divider:E,drawer:L,skeleton:F,steps:D,image:q,layout:Q,list:de,mentions:H,modal:se,progress:W,result:le,slider:U,breadcrumb:ee,menu:ae,pagination:ue,input:fe,textArea:re,empty:V,badge:ce,radio:Z,rate:xe,switch:pe,transfer:Se,avatar:ke,message:$e,tag:K,table:ie,card:I,tabs:R,timeline:je,timePicker:Te,upload:Ie,notification:tt,tree:Ke,colorPicker:Be,datePicker:Ge,rangePicker:J,flex:Ae,wave:ve,dropdown:ge,warning:qe,tour:Xe,tooltip:st,popover:ht,popconfirm:Ze,floatButton:yt,floatButtonGroup:We,variant:tr,inputNumber:Vt,treeSelect:ct}=t,dt=l.useCallback((Re,ot)=>{const{prefixCls:ut}=t;if(ot)return ot;const ft=ut||v.getPrefixCls("");return Re?`${ft}-${Re}`:ft},[v.getPrefixCls,t.prefixCls]),be=y||v.iconPrefixCls||Sl,ye=a||v.csp;oP(be,ye);const De=uP(j,v.theme,{prefixCls:dt("")}),M={csp:ye,autoInsertSpaceInButton:n,alert:s,anchor:i,locale:c||p,direction:m,space:u,splitter:x,virtual:h,popupMatchSelectWidth:g??f,popupOverflow:b,getPrefixCls:dt,iconPrefixCls:be,theme:De,segmented:N,statistic:w,spin:_,calendar:P,carousel:O,cascader:T,collapse:k,typography:$,checkbox:C,descriptions:A,divider:E,drawer:L,skeleton:F,steps:D,image:q,input:fe,textArea:re,layout:Q,list:de,mentions:H,modal:se,progress:W,result:le,slider:U,breadcrumb:ee,menu:ae,pagination:ue,empty:V,badge:ce,radio:Z,rate:xe,switch:pe,transfer:Se,avatar:ke,message:$e,tag:K,table:ie,card:I,tabs:R,timeline:je,timePicker:Te,upload:Ie,notification:tt,tree:Ke,colorPicker:Be,datePicker:Ge,rangePicker:J,flex:Ae,wave:ve,dropdown:ge,warning:qe,tour:Xe,tooltip:st,popover:ht,popconfirm:Ze,floatButton:yt,floatButtonGroup:We,variant:tr,inputNumber:Vt,treeSelect:ct},te=Object.assign({},v);Object.keys(M).forEach(Re=>{M[Re]!==void 0&&(te[Re]=M[Re])}),RP.forEach(Re=>{const ot=t[Re];ot&&(te[Re]=ot)}),typeof n<"u"&&(te.button=Object.assign({autoInsertSpace:n},te.button));const Ne=bl(()=>te,te,(Re,ot)=>{const ut=Object.keys(Re),ft=Object.keys(ot);return ut.length!==ft.length||ut.some(gt=>Re[gt]!==ot[gt])}),{layer:Ee}=l.useContext(Ei),Pe=l.useMemo(()=>({prefixCls:be,csp:ye,layer:Ee?"antd":void 0}),[be,ye,Ee]);let Me=l.createElement(l.Fragment,null,l.createElement(TP,{dropdownMatchSelectWidth:f}),r);const Ue=l.useMemo(()=>{var Re,ot,ut,ft;return Zn(((Re=dn.Form)===null||Re===void 0?void 0:Re.defaultValidateMessages)||{},((ut=(ot=Ne.locale)===null||ot===void 0?void 0:ot.Form)===null||ut===void 0?void 0:ut.defaultValidateMessages)||{},((ft=Ne.form)===null||ft===void 0?void 0:ft.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Ne,o==null?void 0:o.validateMessages]);Object.keys(Ue).length>0&&(Me=l.createElement(h3.Provider,{value:Ue},Me)),c&&(Me=l.createElement(y3,{locale:c,_ANT_MARK__:v3},Me)),Me=l.createElement(Ju.Provider,{value:Pe},Me),d&&(Me=l.createElement(F3,{size:d},Me)),Me=l.createElement(IP,null,Me);const Le=l.useMemo(()=>{const Re=De||{},{algorithm:ot,token:ut,components:ft,cssVar:gt}=Re,ir=MP(Re,["algorithm","token","components","cssVar"]),Xt=ot&&(!Array.isArray(ot)||ot.length>0)?od(ot):Yp,St={};Object.entries(ft||{}).forEach(([Gt,B])=>{const oe=Object.assign({},B);"algorithm"in oe&&(oe.algorithm===!0?oe.theme=Xt:(Array.isArray(oe.algorithm)||typeof oe.algorithm=="function")&&(oe.theme=od(oe.algorithm)),delete oe.algorithm),St[Gt]=oe});const _t=Object.assign(Object.assign({},pi),ut);return Object.assign(Object.assign({},ir),{theme:Xt,token:_t,components:St,override:Object.assign({override:_t},St),cssVar:gt})},[De]);return j&&(Me=l.createElement(Jp.Provider,{value:Le},Me)),Ne.warning&&(Me=l.createElement(x3.Provider,{value:Ne.warning},Me)),S!==void 0&&(Me=l.createElement(Zp,{disabled:S},Me)),l.createElement(It.Provider,{value:Ne},Me)},mn=t=>{const r=l.useContext(It),a=l.useContext(Qu);return l.createElement(BP,Object.assign({parentContext:r,legacyLocale:a},t))};mn.ConfigContext=It;mn.SizeContext=Cs;mn.config=zP;mn.useConfig=B3;Object.defineProperty(mn,"SizeContext",{get:()=>Cs});var HP={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"}}]},name:"check-circle",theme:"filled"};function wb(t){var r;return t==null||(r=t.getRootNode)===null||r===void 0?void 0:r.call(t)}function WP(t){return wb(t)instanceof ShadowRoot}function Vo(t){return WP(t)?wb(t):null}function UP(t){return t.replace(/-(.)/g,function(r,a){return a.toUpperCase()})}function VP(t,r){$r(t,"[@ant-design/icons] ".concat(r))}function Qx(t){return et(t)==="object"&&typeof t.name=="string"&&typeof t.theme=="string"&&(et(t.icon)==="object"||typeof t.icon=="function")}function Zx(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(t).reduce(function(r,a){var n=t[a];switch(a){case"class":r.className=n,delete r.class;break;default:delete r[a],r[UP(a)]=n}return r},{})}function Ad(t,r,a){return a?me.createElement(t.tag,X(X({key:r},Zx(t.attrs)),a),(t.children||[]).map(function(n,s){return Ad(n,"".concat(r,"-").concat(t.tag,"-").concat(s))})):me.createElement(t.tag,X({key:r},Zx(t.attrs)),(t.children||[]).map(function(n,s){return Ad(n,"".concat(r,"-").concat(t.tag,"-").concat(s))}))}function Nb(t){return bi(t)[0]}function Sb(t){return t?Array.isArray(t)?t:[t]:[]}var GP=`
.anticon {
  display: inline-flex;
  align-items: center;
  color: inherit;
  font-style: normal;
  line-height: 0;
  text-align: center;
  text-transform: none;
  vertical-align: -0.125em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.anticon > * {
  line-height: 1;
}

.anticon svg {
  display: inline-block;
}

.anticon::before {
  display: none;
}

.anticon .anticon-icon {
  display: block;
}

.anticon[tabindex] {
  cursor: pointer;
}

.anticon-spin::before,
.anticon-spin {
  display: inline-block;
  -webkit-animation: loadingCircle 1s infinite linear;
  animation: loadingCircle 1s infinite linear;
}

@-webkit-keyframes loadingCircle {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes loadingCircle {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
`,KP=function(r){var a=l.useContext(Ju),n=a.csp,s=a.prefixCls,i=a.layer,o=GP;s&&(o=o.replace(/anticon/g,s)),i&&(o="@layer ".concat(i,` {
`).concat(o,`
}`)),l.useEffect(function(){var c=r.current,d=Vo(c);za(o,"@ant-design-icons",{prepend:!i,csp:n,attachTo:d})},[])},qP=["icon","className","onClick","style","primaryColor","secondaryColor"],ai={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function XP(t){var r=t.primaryColor,a=t.secondaryColor;ai.primaryColor=r,ai.secondaryColor=a||Nb(r),ai.calculated=!!a}function YP(){return X({},ai)}var Ts=function(r){var a=r.icon,n=r.className,s=r.onClick,i=r.style,o=r.primaryColor,c=r.secondaryColor,d=bt(r,qP),m=l.useRef(),u=ai;if(o&&(u={primaryColor:o,secondaryColor:c||Nb(o)}),KP(m),VP(Qx(a),"icon should be icon definiton, but got ".concat(a)),!Qx(a))return null;var x=a;return x&&typeof x.icon=="function"&&(x=X(X({},x),{},{icon:x.icon(u.primaryColor,u.secondaryColor)})),Ad(x.icon,"svg-".concat(x.name),X(X({className:n,onClick:s,style:i,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},d),{},{ref:m}))};Ts.displayName="IconReact";Ts.getTwoToneColors=YP;Ts.setTwoToneColors=XP;function Cb(t){var r=Sb(t),a=he(r,2),n=a[0],s=a[1];return Ts.setTwoToneColors({primaryColor:n,secondaryColor:s})}function JP(){var t=Ts.getTwoToneColors();return t.calculated?[t.primaryColor,t.secondaryColor]:t.primaryColor}var QP=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Cb(Bo.primary);var ma=l.forwardRef(function(t,r){var a=t.className,n=t.icon,s=t.spin,i=t.rotate,o=t.tabIndex,c=t.onClick,d=t.twoToneColor,m=bt(t,QP),u=l.useContext(Ju),x=u.prefixCls,h=x===void 0?"anticon":x,f=u.rootClassName,g=_e(f,h,G(G({},"".concat(h,"-").concat(n.name),!!n.name),"".concat(h,"-spin"),!!s||n.name==="loading"),a),b=o;b===void 0&&c&&(b=-1);var p=i?{msTransform:"rotate(".concat(i,"deg)"),transform:"rotate(".concat(i,"deg)")}:void 0,v=Sb(d),y=he(v,2),j=y[0],S=y[1];return l.createElement("span",Ve({role:"img","aria-label":n.name},m,{ref:r,tabIndex:b,onClick:c,className:g}),l.createElement(Ts,{icon:n,primaryColor:j,secondaryColor:S,style:p}))});ma.displayName="AntdIcon";ma.getTwoToneColor=JP;ma.setTwoToneColor=Cb;var ZP=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:HP}))},e$=l.forwardRef(ZP),t$={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"},r$=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:t$}))},a$=l.forwardRef(r$),n$={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},s$=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:n$}))},kl=l.forwardRef(s$),i$={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"exclamation-circle",theme:"filled"},o$=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:i$}))},l$=l.forwardRef(o$),c$={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"}}]},name:"info-circle",theme:"filled"},d$=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:c$}))},u$=l.forwardRef(d$),m$=`accept acceptCharset accessKey action allowFullScreen allowTransparency
    alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
    charSet checked classID className colSpan cols content contentEditable contextMenu
    controls coords crossOrigin data dateTime default defer dir disabled download draggable
    encType form formAction formEncType formMethod formNoValidate formTarget frameBorder
    headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity
    is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media
    mediaGroup method min minLength multiple muted name noValidate nonce open
    optimum pattern placeholder poster preload radioGroup readOnly rel required
    reversed role rowSpan rows sandbox scope scoped scrolling seamless selected
    shape size sizes span spellCheck src srcDoc srcLang srcSet start step style
    summary tabIndex target title type useMap value width wmode wrap`,x$=`onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown
    onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick
    onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown
    onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
    onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
    onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
    onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,h$="".concat(m$," ").concat(x$).split(/[\s\n]+/),f$="aria-",g$="data-";function eh(t,r){return t.indexOf(r)===0}function am(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a;r===!1?a={aria:!0,data:!0,attr:!0}:r===!0?a={aria:!0}:a=X({},r);var n={};return Object.keys(t).forEach(function(s){(a.aria&&(s==="role"||eh(s,f$))||a.data&&eh(s,g$)||a.attr&&h$.includes(s))&&(n[s]=t[s])}),n}function p$(t){return t&&me.isValidElement(t)&&t.type===me.Fragment}const b$=(t,r,a)=>me.isValidElement(t)?me.cloneElement(t,typeof a=="function"?a(t.props||{}):a):r;function _b(t,r){return b$(t,t,r)}const nm=t=>{const[,,,,r]=un();return r?`${t}-css-var`:""};var Wt={TAB:9,ENTER:13,ESC:27,SPACE:32,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40},v$={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},y$=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:v$}))},j$=l.forwardRef(y$);function th(...t){const r={};return t.forEach(a=>{a&&Object.keys(a).forEach(n=>{a[n]!==void 0&&(r[n]=a[n])})}),r}function rh(t){if(!t)return;const{closable:r,closeIcon:a}=t;return{closable:r,closeIcon:a}}function ah(t){const{closable:r,closeIcon:a}=t||{};return me.useMemo(()=>{if(!r&&(r===!1||a===!1||a===null))return!1;if(r===void 0&&a===void 0)return null;let n={closeIcon:typeof a!="boolean"&&a!==null?a:void 0};return r&&typeof r=="object"&&(n=Object.assign(Object.assign({},n),r)),n},[r,a])}const w$={},N$=(t,r,a=w$)=>{const n=ah(t),s=ah(r),[i]=Nl("global",dn.global),o=typeof n!="boolean"?!!(n!=null&&n.disabled):!1,c=me.useMemo(()=>Object.assign({closeIcon:me.createElement(kl,null)},a),[a]),d=me.useMemo(()=>n===!1?!1:n?th(c,s,n):s===!1?!1:s?th(c,s):c.closable?c:!1,[n,s,c]);return me.useMemo(()=>{var m,u;if(d===!1)return[!1,null,o,{}];const{closeIconRender:x}=c,{closeIcon:h}=d;let f=h;const g=am(d,!0);return f!=null&&(x&&(f=x(h)),f=me.isValidElement(f)?me.cloneElement(f,Object.assign(Object.assign(Object.assign({},f.props),{"aria-label":(u=(m=f.props)===null||m===void 0?void 0:m["aria-label"])!==null&&u!==void 0?u:i.close}),g)):me.createElement("span",Object.assign({"aria-label":i.close},g),f)),[!0,f,o,g]},[o,i.close,d,c])},S$=()=>{const[t,r]=l.useState([]),a=l.useCallback(n=>(r(s=>[].concat(Fe(s),[n])),()=>{r(s=>s.filter(i=>i!==n))}),[]);return[t,a]},kb=me.createContext(void 0),Qa=100,C$=10,_$=Qa*C$,Pb={Modal:Qa,Drawer:Qa,Popover:Qa,Popconfirm:Qa,Tooltip:Qa,Tour:Qa,FloatButton:Qa},k$={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function P$(t){return t in Pb}const $$=(t,r)=>{const[,a]=un(),n=me.useContext(kb),s=P$(t);let i;if(r!==void 0)i=[r,r];else{let o=n??0;s?o+=(n?0:a.zIndexPopupBase)+Pb[t]:o+=k$[t],i=[n===void 0?r:o,o]}return i};function $b(t,r){this.v=t,this.k=r}function gr(t,r,a,n){var s=Object.defineProperty;try{s({},"",{})}catch{s=0}gr=function(o,c,d,m){function u(x,h){gr(o,x,function(f){return this._invoke(x,h,f)})}c?s?s(o,c,{value:d,enumerable:!m,configurable:!m,writable:!m}):o[c]=d:(u("next",0),u("throw",1),u("return",2))},gr(t,r,a,n)}function sm(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,r,a=typeof Symbol=="function"?Symbol:{},n=a.iterator||"@@iterator",s=a.toStringTag||"@@toStringTag";function i(f,g,b,p){var v=g&&g.prototype instanceof c?g:c,y=Object.create(v.prototype);return gr(y,"_invoke",function(j,S,N){var w,_,P,O=0,T=N||[],k=!1,$={p:0,n:0,v:t,a:C,f:C.bind(t,4),d:function(E,L){return w=E,_=0,P=t,$.n=L,o}};function C(A,E){for(_=A,P=E,r=0;!k&&O&&!L&&r<T.length;r++){var L,F=T[r],D=$.p,q=F[2];A>3?(L=q===E)&&(P=F[(_=F[4])?5:(_=3,3)],F[4]=F[5]=t):F[0]<=D&&((L=A<2&&D<F[1])?(_=0,$.v=E,$.n=F[1]):D<q&&(L=A<3||F[0]>E||E>q)&&(F[4]=A,F[5]=E,$.n=q,_=0))}if(L||A>1)return o;throw k=!0,E}return function(A,E,L){if(O>1)throw TypeError("Generator is already running");for(k&&E===1&&C(E,L),_=E,P=L;(r=_<2?t:P)||!k;){w||(_?_<3?(_>1&&($.n=-1),C(_,P)):$.n=P:$.v=P);try{if(O=2,w){if(_||(A="next"),r=w[A]){if(!(r=r.call(w,P)))throw TypeError("iterator result is not an object");if(!r.done)return r;P=r.value,_<2&&(_=0)}else _===1&&(r=w.return)&&r.call(w),_<2&&(P=TypeError("The iterator does not provide a '"+A+"' method"),_=1);w=t}else if((r=(k=$.n<0)?P:j.call(S,$))!==o)break}catch(F){w=t,_=1,P=F}finally{O=1}}return{value:r,done:k}}}(f,b,p),!0),y}var o={};function c(){}function d(){}function m(){}r=Object.getPrototypeOf;var u=[][n]?r(r([][n]())):(gr(r={},n,function(){return this}),r),x=m.prototype=c.prototype=Object.create(u);function h(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,m):(f.__proto__=m,gr(f,s,"GeneratorFunction")),f.prototype=Object.create(x),f}return d.prototype=m,gr(x,"constructor",m),gr(m,"constructor",d),d.displayName="GeneratorFunction",gr(m,s,"GeneratorFunction"),gr(x),gr(x,s,"Generator"),gr(x,n,function(){return this}),gr(x,"toString",function(){return"[object Generator]"}),(sm=function(){return{w:i,m:h}})()}function Go(t,r){function a(s,i,o,c){try{var d=t[s](i),m=d.value;return m instanceof $b?r.resolve(m.v).then(function(u){a("next",u,o,c)},function(u){a("throw",u,o,c)}):r.resolve(m).then(function(u){d.value=u,o(d)},function(u){return a("throw",u,o,c)})}catch(u){c(u)}}var n;this.next||(gr(Go.prototype),gr(Go.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),gr(this,"_invoke",function(s,i,o){function c(){return new r(function(d,m){a(s,o,d,m)})}return n=n?n.then(c,c):c()},!0)}function Eb(t,r,a,n,s){return new Go(sm().w(t,r,a,n),s||Promise)}function E$(t,r,a,n,s){var i=Eb(t,r,a,n,s);return i.next().then(function(o){return o.done?o.value:i.next()})}function A$(t){var r=Object(t),a=[];for(var n in r)a.unshift(n);return function s(){for(;a.length;)if((n=a.pop())in r)return s.value=n,s.done=!1,s;return s.done=!0,s}}function nh(t){if(t!=null){var r=t[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],a=0;if(r)return r.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length))return{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&t[a++],done:!t}}}}throw new TypeError(et(t)+" is not iterable")}function wr(){var t=sm(),r=t.m(wr),a=(Object.getPrototypeOf?Object.getPrototypeOf(r):r.__proto__).constructor;function n(o){var c=typeof o=="function"&&o.constructor;return!!c&&(c===a||(c.displayName||c.name)==="GeneratorFunction")}var s={throw:1,return:2,break:3,continue:3};function i(o){var c,d;return function(m){c||(c={stop:function(){return d(m.a,2)},catch:function(){return m.v},abrupt:function(x,h){return d(m.a,s[x],h)},delegateYield:function(x,h,f){return c.resultName=h,d(m.d,nh(x),f)},finish:function(x){return d(m.f,x)}},d=function(x,h,f){m.p=c.prev,m.n=c.next;try{return x(h,f)}finally{c.next=m.n}}),c.resultName&&(c[c.resultName]=m.v,c.resultName=void 0),c.sent=m.v,c.next=m.n;try{return o.call(this,c)}finally{m.p=c.prev,m.n=c.next}}}return(wr=function(){return{wrap:function(d,m,u,x){return t.w(i(d),m,u,x&&x.reverse())},isGeneratorFunction:n,mark:t.m,awrap:function(d,m){return new $b(d,m)},AsyncIterator:Go,async:function(d,m,u,x,h){return(n(m)?Eb:E$)(i(d),m,u,x,h)},keys:A$,values:nh}})()}var Ai=X({},Bv),O$=Ai.version,cc=Ai.render,I$=Ai.unmountComponentAtNode,Pl;try{var T$=Number((O$||"").split(".")[0]);T$>=18&&(Pl=Ai.createRoot)}catch{}function sh(t){var r=Ai.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;r&&et(r)==="object"&&(r.usingClientEntryPoint=t)}var Ko="__rc_react_root__";function M$(t,r){sh(!0);var a=r[Ko]||Pl(r);sh(!1),a.render(t),r[Ko]=a}function R$(t,r){cc==null||cc(t,r)}function L$(t,r){if(Pl){M$(t,r);return}R$(t,r)}function D$(t){return Od.apply(this,arguments)}function Od(){return Od=In(wr().mark(function t(r){return wr().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",Promise.resolve().then(function(){var s;(s=r[Ko])===null||s===void 0||s.unmount(),delete r[Ko]}));case 1:case"end":return n.stop()}},t)})),Od.apply(this,arguments)}function z$(t){I$(t)}function F$(t){return Id.apply(this,arguments)}function Id(){return Id=In(wr().mark(function t(r){return wr().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(Pl===void 0){n.next=2;break}return n.abrupt("return",D$(r));case 2:z$(r);case 3:case"end":return n.stop()}},t)})),Id.apply(this,arguments)}const B$=(t,r)=>(L$(t,r),()=>F$(r));let H$=B$;function Ab(t){return H$}const yi=(t,r,a)=>a!==void 0?a:`${t}-${r}`;function xn(t,r){var a=Object.assign({},t);return Array.isArray(r)&&r.forEach(function(n){delete a[n]}),a}const im=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var r=t.getBBox(),a=r.width,n=r.height;if(a||n)return!0}if(t.getBoundingClientRect){var s=t.getBoundingClientRect(),i=s.width,o=s.height;if(i||o)return!0}}return!1},W$=t=>{const{componentCls:r,colorPrimary:a}=t;return{[r]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${a})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},U$=iP("Wave",W$),Ob=`${Ho}-wave-target`;function V$(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"&&t!=="canvastext"}function G$(t){var r;const{borderTopColor:a,borderColor:n,backgroundColor:s}=getComputedStyle(t);return(r=[a,n,s].find(V$))!==null&&r!==void 0?r:null}function dc(t){return Number.isNaN(t)?0:t}const K$=t=>{const{className:r,target:a,component:n,registerUnmount:s}=t,i=l.useRef(null),o=l.useRef(null);l.useEffect(()=>{o.current=s()},[]);const[c,d]=l.useState(null),[m,u]=l.useState([]),[x,h]=l.useState(0),[f,g]=l.useState(0),[b,p]=l.useState(0),[v,y]=l.useState(0),[j,S]=l.useState(!1),N={left:x,top:f,width:b,height:v,borderRadius:m.map(P=>`${P}px`).join(" ")};c&&(N["--wave-color"]=c);function w(){const P=getComputedStyle(a);d(G$(a));const O=P.position==="static",{borderLeftWidth:T,borderTopWidth:k}=P;h(O?a.offsetLeft:dc(-Number.parseFloat(T))),g(O?a.offsetTop:dc(-Number.parseFloat(k))),p(a.offsetWidth),y(a.offsetHeight);const{borderTopLeftRadius:$,borderTopRightRadius:C,borderBottomLeftRadius:A,borderBottomRightRadius:E}=P;u([$,C,E,A].map(L=>dc(Number.parseFloat(L))))}if(l.useEffect(()=>{if(a){const P=jr(()=>{w(),S(!0)});let O;return typeof ResizeObserver<"u"&&(O=new ResizeObserver(w),O.observe(a)),()=>{jr.cancel(P),O==null||O.disconnect()}}},[a]),!j)return null;const _=(n==="Checkbox"||n==="Radio")&&(a==null?void 0:a.classList.contains(Ob));return l.createElement(Ga,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(P,O)=>{var T,k;if(O.deadline||O.propertyName==="opacity"){const $=(T=i.current)===null||T===void 0?void 0:T.parentElement;(k=o.current)===null||k===void 0||k.call(o).then(()=>{$==null||$.remove()})}return!1}},({className:P},O)=>l.createElement("div",{ref:Tn(i,O),className:_e(r,P,{"wave-quick":_}),style:N}))},q$=(t,r)=>{var a;const{component:n}=r;if(n==="Checkbox"&&!(!((a=t.querySelector("input"))===null||a===void 0)&&a.checked))return;const s=document.createElement("div");s.style.position="absolute",s.style.left="0px",s.style.top="0px",t==null||t.insertBefore(s,t==null?void 0:t.firstChild);const i=Ab();let o=null;function c(){return o}o=i(l.createElement(K$,Object.assign({},r,{target:t,registerUnmount:c})),s)},X$=(t,r,a)=>{const{wave:n}=l.useContext(It),[,s,i]=un(),o=vr(m=>{const u=t.current;if(n!=null&&n.disabled||!u)return;const x=u.querySelector(`.${Ob}`)||u,{showEffect:h}=n||{};(h||q$)(x,{className:r,token:s,component:a,event:m,hashId:i})}),c=l.useRef(null);return m=>{jr.cancel(c.current),c.current=jr(()=>{o(m)})}},Y$=t=>{const{children:r,disabled:a,component:n}=t,{getPrefixCls:s}=l.useContext(It),i=l.useRef(null),o=s("wave"),[,c]=U$(o),d=X$(i,_e(o,c),n);if(me.useEffect(()=>{const u=i.current;if(!u||u.nodeType!==window.Node.ELEMENT_NODE||a)return;const x=h=>{!im(h.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")&&!u.className.includes("disabled:")||u.getAttribute("aria-disabled")==="true"||u.className.includes("-leave")||d(h)};return u.addEventListener("click",x,!0),()=>{u.removeEventListener("click",x,!0)}},[a]),!me.isValidElement(r))return r??null;const m=Rn(r)?Tn(Os(r),i):i;return _b(r,{ref:m})},om=t=>{const r=me.useContext(Cs);return me.useMemo(()=>t?typeof t=="string"?t??r:typeof t=="function"?t(r):r:r,[t,r])},Ib=l.createContext(null),J$=(t,r)=>{const a=l.useContext(Ib),n=l.useMemo(()=>{if(!a)return"";const{compactDirection:s,isFirstItem:i,isLastItem:o}=a,c=s==="vertical"?"-vertical-":"-";return _e(`${t}-compact${c}item`,{[`${t}-compact${c}first-item`]:i,[`${t}-compact${c}last-item`]:o,[`${t}-compact${c}item-rtl`]:r==="rtl"})},[t,r,a]);return{compactSize:a==null?void 0:a.compactSize,compactDirection:a==null?void 0:a.compactDirection,compactItemClassnames:n}},Q$=t=>{const{children:r}=t;return l.createElement(Ib.Provider,{value:null},r)};var Z$=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const Tb=l.createContext(void 0),eE=t=>{const{getPrefixCls:r,direction:a}=l.useContext(It),{prefixCls:n,size:s,className:i}=t,o=Z$(t,["prefixCls","size","className"]),c=r("btn-group",n),[,,d]=un(),m=l.useMemo(()=>{switch(s){case"large":return"lg";case"small":return"sm";default:return""}},[s]),u=_e(c,{[`${c}-${m}`]:m,[`${c}-rtl`]:a==="rtl"},i,d);return l.createElement(Tb.Provider,{value:s},l.createElement("div",Object.assign({},o,{className:u})))},ih=/^[\u4E00-\u9FA5]{2}$/,Td=ih.test.bind(ih);function Mb(t){return t==="danger"?{danger:!0}:{type:t}}function oh(t){return typeof t=="string"}function uc(t){return t==="text"||t==="link"}function tE(t,r){if(t==null)return;const a=r?" ":"";return typeof t!="string"&&typeof t!="number"&&oh(t.type)&&Td(t.props.children)?_b(t,{children:t.props.children.split("").join(a)}):oh(t)?Td(t)?me.createElement("span",null,t.split("").join(a)):me.createElement("span",null,t):p$(t)?me.createElement("span",null,t):t}function rE(t,r){let a=!1;const n=[];return me.Children.forEach(t,s=>{const i=typeof s,o=i==="string"||i==="number";if(a&&o){const c=n.length-1,d=n[c];n[c]=`${d}${s}`}else n.push(s);a=o}),me.Children.map(n,s=>tE(s,r))}["default","primary","danger"].concat(Fe(Zu));const Rb=l.forwardRef((t,r)=>{const{className:a,style:n,children:s,prefixCls:i}=t,o=_e(`${i}-icon`,a);return me.createElement("span",{ref:r,className:o,style:n},s)}),lh=l.forwardRef((t,r)=>{const{prefixCls:a,className:n,style:s,iconClassName:i}=t,o=_e(`${a}-loading-icon`,n);return me.createElement(Rb,{prefixCls:a,className:o,style:s,ref:r},me.createElement(j$,{className:i}))}),mc=()=>({width:0,opacity:0,transform:"scale(0)"}),xc=t=>({width:t.scrollWidth,opacity:1,transform:"scale(1)"}),aE=t=>{const{prefixCls:r,loading:a,existIcon:n,className:s,style:i,mount:o}=t,c=!!a;return n?me.createElement(lh,{prefixCls:r,className:s,style:i}):me.createElement(Ga,{visible:c,motionName:`${r}-loading-icon-motion`,motionAppear:!o,motionEnter:!o,motionLeave:!o,removeOnLeave:!0,onAppearStart:mc,onAppearActive:xc,onEnterStart:mc,onEnterActive:xc,onLeaveStart:xc,onLeaveActive:mc},({className:d,style:m},u)=>{const x=Object.assign(Object.assign({},i),m);return me.createElement(lh,{prefixCls:r,className:_e(s,d),style:x,ref:u})})},ch=(t,r)=>({[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineEndColor:r}}},"&:not(:first-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineStartColor:r}}}}}),nE=t=>{const{componentCls:r,fontSize:a,lineWidth:n,groupBorderColor:s,colorErrorHover:i}=t;return{[`${r}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${r}`]:{"&:not(:last-child)":{[`&, & > ${r}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:t.calc(n).mul(-1).equal(),[`&, & > ${r}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[r]:{position:"relative",zIndex:1,"&:hover, &:focus, &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${r}-icon-only`]:{fontSize:a}},ch(`${r}-primary`,s),ch(`${r}-danger`,i)]}};var sE=["b"],iE=["v"],hc=function(r){return Math.round(Number(r||0))},oE=function(r){if(r instanceof Rt)return r;if(r&&et(r)==="object"&&"h"in r&&"b"in r){var a=r,n=a.b,s=bt(a,sE);return X(X({},s),{},{v:n})}return typeof r=="string"&&/hsb/.test(r)?r.replace(/hsb/,"hsv"):r},ji=function(t){Ua(a,t);var r=Va(a);function a(n){return Zt(this,a),r.call(this,oE(n))}return er(a,[{key:"toHsbString",value:function(){var s=this.toHsb(),i=hc(s.s*100),o=hc(s.b*100),c=hc(s.h),d=s.a,m="hsb(".concat(c,", ").concat(i,"%, ").concat(o,"%)"),u="hsba(".concat(c,", ").concat(i,"%, ").concat(o,"%, ").concat(d.toFixed(d===0?0:2),")");return d===1?m:u}},{key:"toHsb",value:function(){var s=this.toHsv(),i=s.v,o=bt(s,iE);return X(X({},o),{},{b:i,a:this.a})}}]),a}(Rt),lE=function(r){return r instanceof ji?r:new ji(r)};lE("#1677ff");const cE=(t,r)=>(t==null?void 0:t.replace(/[^\w/]/g,"").slice(0,r?8:6))||"",dE=(t,r)=>t?cE(t,r):"";let uE=function(){function t(r){Zt(this,t);var a;if(this.cleared=!1,r instanceof t){this.metaColor=r.metaColor.clone(),this.colors=(a=r.colors)===null||a===void 0?void 0:a.map(s=>({color:new t(s.color),percent:s.percent})),this.cleared=r.cleared;return}const n=Array.isArray(r);n&&r.length?(this.colors=r.map(({color:s,percent:i})=>({color:new t(s),percent:i})),this.metaColor=new ji(this.colors[0].color.metaColor)):this.metaColor=new ji(n?"":r),(!r||n&&!this.colors)&&(this.metaColor=this.metaColor.setA(0),this.cleared=!0)}return er(t,[{key:"toHsb",value:function(){return this.metaColor.toHsb()}},{key:"toHsbString",value:function(){return this.metaColor.toHsbString()}},{key:"toHex",value:function(){return dE(this.toHexString(),this.metaColor.a<1)}},{key:"toHexString",value:function(){return this.metaColor.toHexString()}},{key:"toRgb",value:function(){return this.metaColor.toRgb()}},{key:"toRgbString",value:function(){return this.metaColor.toRgbString()}},{key:"isGradient",value:function(){return!!this.colors&&!this.cleared}},{key:"getColors",value:function(){return this.colors||[{color:this,percent:0}]}},{key:"toCssString",value:function(){const{colors:a}=this;return a?`linear-gradient(90deg, ${a.map(s=>`${s.color.toRgbString()} ${s.percent}%`).join(", ")})`:this.metaColor.toRgbString()}},{key:"equals",value:function(a){return!a||this.isGradient()!==a.isGradient()?!1:this.isGradient()?this.colors.length===a.colors.length&&this.colors.every((n,s)=>{const i=a.colors[s];return n.percent===i.percent&&n.color.equals(i.color)}):this.toHexString()===a.toHexString()}}])}();const mE=t=>({animationDuration:t,animationFillMode:"both"}),xE=t=>({animationDuration:t,animationFillMode:"both"}),lm=(t,r,a,n,s=!1)=>{const i=s?"&":"";return{[`
      ${i}${t}-enter,
      ${i}${t}-appear
    `]:Object.assign(Object.assign({},mE(n)),{animationPlayState:"paused"}),[`${i}${t}-leave`]:Object.assign(Object.assign({},xE(n)),{animationPlayState:"paused"}),[`
      ${i}${t}-enter${t}-enter-active,
      ${i}${t}-appear${t}-appear-active
    `]:{animationName:r,animationPlayState:"running"},[`${i}${t}-leave${t}-leave-active`]:{animationName:a,animationPlayState:"running",pointerEvents:"none"}}},hE=new Lt("antFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),fE=new Lt("antFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),gE=(t,r=!1)=>{const{antCls:a}=t,n=`${a}-fade`,s=r?"&":"";return[lm(n,hE,fE,t.motionDurationMid,r),{[`
        ${s}${n}-enter,
        ${s}${n}-appear
      `]:{opacity:0,animationTimingFunction:"linear"},[`${s}${n}-leave`]:{animationTimingFunction:"linear"}}]},pE=new Lt("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),bE=new Lt("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),vE=new Lt("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),yE=new Lt("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),jE=new Lt("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),wE=new Lt("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),NE=new Lt("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),SE=new Lt("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),CE={"slide-up":{inKeyframes:pE,outKeyframes:bE},"slide-down":{inKeyframes:vE,outKeyframes:yE},"slide-left":{inKeyframes:jE,outKeyframes:wE},"slide-right":{inKeyframes:NE,outKeyframes:SE}},dh=(t,r)=>{const{antCls:a}=t,n=`${a}-${r}`,{inKeyframes:s,outKeyframes:i}=CE[r];return[lm(n,s,i,t.motionDurationMid),{[`
      ${n}-enter,
      ${n}-appear
    `]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:t.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},[`${n}-leave`]:{animationTimingFunction:t.motionEaseInQuint}}]},_E=new Lt("antZoomIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),kE=new Lt("antZoomOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),uh=new Lt("antZoomBigIn",{"0%":{transform:"scale(0.8)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),mh=new Lt("antZoomBigOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.8)",opacity:0}}),PE=new Lt("antZoomUpIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 0%"}}),$E=new Lt("antZoomUpOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 0%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0}}),EE=new Lt("antZoomLeftIn",{"0%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"0% 50%"}}),AE=new Lt("antZoomLeftOut",{"0%":{transform:"scale(1)",transformOrigin:"0% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0}}),OE=new Lt("antZoomRightIn",{"0%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"100% 50%"}}),IE=new Lt("antZoomRightOut",{"0%":{transform:"scale(1)",transformOrigin:"100% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0}}),TE=new Lt("antZoomDownIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 100%"}}),ME=new Lt("antZoomDownOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 100%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0}}),RE={zoom:{inKeyframes:_E,outKeyframes:kE},"zoom-big":{inKeyframes:uh,outKeyframes:mh},"zoom-big-fast":{inKeyframes:uh,outKeyframes:mh},"zoom-left":{inKeyframes:EE,outKeyframes:AE},"zoom-right":{inKeyframes:OE,outKeyframes:IE},"zoom-up":{inKeyframes:PE,outKeyframes:$E},"zoom-down":{inKeyframes:TE,outKeyframes:ME}},LE=(t,r)=>{const{antCls:a}=t,n=`${a}-${r}`,{inKeyframes:s,outKeyframes:i}=RE[r];return[lm(n,s,i,t.motionDurationMid),{[`
        ${n}-enter,
        ${n}-appear
      `]:{transform:"scale(0)",opacity:0,animationTimingFunction:t.motionEaseOutCirc,"&-prepare":{transform:"none"}},[`${n}-leave`]:{animationTimingFunction:t.motionEaseInOutCirc}}]},DE=(t,r)=>{const{r:a,g:n,b:s,a:i}=t.toRgb(),o=new ji(t.toRgbString()).onBackground(r).toHsv();return i<=.5?o.v>.5:a*.299+n*.587+s*.114>192},Lb=t=>{const{paddingInline:r,onlyIconSize:a}=t;return ua(t,{buttonPaddingHorizontal:r,buttonPaddingVertical:0,buttonIconOnlyFontSize:a})},Db=t=>{var r,a,n,s,i,o;const c=(r=t.contentFontSize)!==null&&r!==void 0?r:t.fontSize,d=(a=t.contentFontSizeSM)!==null&&a!==void 0?a:t.fontSize,m=(n=t.contentFontSizeLG)!==null&&n!==void 0?n:t.fontSizeLG,u=(s=t.contentLineHeight)!==null&&s!==void 0?s:fo(c),x=(i=t.contentLineHeightSM)!==null&&i!==void 0?i:fo(d),h=(o=t.contentLineHeightLG)!==null&&o!==void 0?o:fo(m),f=DE(new uE(t.colorBgSolid),"#fff")?"#000":"#fff",g=Zu.reduce((b,p)=>Object.assign(Object.assign({},b),{[`${p}ShadowColor`]:`0 ${we(t.controlOutlineWidth)} 0 ${Ys(t[`${p}1`],t.colorBgContainer)}`}),{});return Object.assign(Object.assign({},g),{fontWeight:400,iconGap:t.marginXS,defaultShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlTmpOutline}`,primaryShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlOutline}`,dangerShadow:`0 ${t.controlOutlineWidth}px 0 ${t.colorErrorOutline}`,primaryColor:t.colorTextLightSolid,dangerColor:t.colorTextLightSolid,borderColorDisabled:t.colorBorder,defaultGhostColor:t.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:t.colorBgContainer,paddingInline:t.paddingContentHorizontal-t.lineWidth,paddingInlineLG:t.paddingContentHorizontal-t.lineWidth,paddingInlineSM:8-t.lineWidth,onlyIconSize:"inherit",onlyIconSizeSM:"inherit",onlyIconSizeLG:"inherit",groupBorderColor:t.colorPrimaryHover,linkHoverBg:"transparent",textTextColor:t.colorText,textTextHoverColor:t.colorText,textTextActiveColor:t.colorText,textHoverBg:t.colorFillTertiary,defaultColor:t.colorText,defaultBg:t.colorBgContainer,defaultBorderColor:t.colorBorder,defaultBorderColorDisabled:t.colorBorder,defaultHoverBg:t.colorBgContainer,defaultHoverColor:t.colorPrimaryHover,defaultHoverBorderColor:t.colorPrimaryHover,defaultActiveBg:t.colorBgContainer,defaultActiveColor:t.colorPrimaryActive,defaultActiveBorderColor:t.colorPrimaryActive,solidTextColor:f,contentFontSize:c,contentFontSizeSM:d,contentFontSizeLG:m,contentLineHeight:u,contentLineHeightSM:x,contentLineHeightLG:h,paddingBlock:Math.max((t.controlHeight-c*u)/2-t.lineWidth,0),paddingBlockSM:Math.max((t.controlHeightSM-d*x)/2-t.lineWidth,0),paddingBlockLG:Math.max((t.controlHeightLG-m*h)/2-t.lineWidth,0)})},zE=t=>{const{componentCls:r,iconCls:a,fontWeight:n,opacityLoading:s,motionDurationSlow:i,motionEaseInOut:o,iconGap:c,calc:d}=t;return{[r]:{outline:"none",position:"relative",display:"inline-flex",gap:c,alignItems:"center",justifyContent:"center",fontWeight:n,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:`${we(t.lineWidth)} ${t.lineType} transparent`,cursor:"pointer",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",color:t.colorText,"&:disabled > *":{pointerEvents:"none"},[`${r}-icon > svg`]:ib(),"> a":{color:"currentColor"},"&:not(:disabled)":vi(t),[`&${r}-two-chinese-chars::first-letter`]:{letterSpacing:"0.34em"},[`&${r}-two-chinese-chars > *:not(${a})`]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},[`&${r}-icon-only`]:{paddingInline:0,[`&${r}-compact-item`]:{flex:"none"}},[`&${r}-loading`]:{opacity:s,cursor:"default"},[`${r}-loading-icon`]:{transition:["width","opacity","margin"].map(m=>`${m} ${i} ${o}`).join(",")},[`&:not(${r}-icon-end)`]:{[`${r}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineEnd:d(c).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineEnd:0},"&-leave-start":{marginInlineEnd:0},"&-leave-active":{marginInlineEnd:d(c).mul(-1).equal()}}},"&-icon-end":{flexDirection:"row-reverse",[`${r}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineStart:d(c).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineStart:0},"&-leave-start":{marginInlineStart:0},"&-leave-active":{marginInlineStart:d(c).mul(-1).equal()}}}}}},zb=(t,r,a)=>({[`&:not(:disabled):not(${t}-disabled)`]:{"&:hover":r,"&:active":a}}),FE=t=>({minWidth:t.controlHeight,paddingInline:0,borderRadius:"50%"}),BE=t=>({cursor:"not-allowed",borderColor:t.borderColorDisabled,color:t.colorTextDisabled,background:t.colorBgContainerDisabled,boxShadow:"none"}),$l=(t,r,a,n,s,i,o,c)=>({[`&${t}-background-ghost`]:Object.assign(Object.assign({color:a||void 0,background:r,borderColor:n||void 0,boxShadow:"none"},zb(t,Object.assign({background:r},o),Object.assign({background:r},c))),{"&:disabled":{cursor:"not-allowed",color:s||void 0,borderColor:i||void 0}})}),HE=t=>({[`&:disabled, &${t.componentCls}-disabled`]:Object.assign({},BE(t))}),WE=t=>({[`&:disabled, &${t.componentCls}-disabled`]:{cursor:"not-allowed",color:t.colorTextDisabled}}),El=(t,r,a,n)=>{const i=n&&["link","text"].includes(n)?WE:HE;return Object.assign(Object.assign({},i(t)),zb(t.componentCls,r,a))},Al=(t,r,a,n,s)=>({[`&${t.componentCls}-variant-solid`]:Object.assign({color:r,background:a},El(t,n,s))}),Ol=(t,r,a,n,s)=>({[`&${t.componentCls}-variant-outlined, &${t.componentCls}-variant-dashed`]:Object.assign({borderColor:r,background:a},El(t,n,s))}),Il=t=>({[`&${t.componentCls}-variant-dashed`]:{borderStyle:"dashed"}}),Tl=(t,r,a,n)=>({[`&${t.componentCls}-variant-filled`]:Object.assign({boxShadow:"none",background:r},El(t,a,n))}),_a=(t,r,a,n,s)=>({[`&${t.componentCls}-variant-${a}`]:Object.assign({color:r,boxShadow:"none"},El(t,n,s,a))}),UE=t=>{const{componentCls:r}=t;return Zu.reduce((a,n)=>{const s=t[`${n}6`],i=t[`${n}1`],o=t[`${n}5`],c=t[`${n}2`],d=t[`${n}3`],m=t[`${n}7`];return Object.assign(Object.assign({},a),{[`&${r}-color-${n}`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:s,boxShadow:t[`${n}ShadowColor`]},Al(t,t.colorTextLightSolid,s,{background:o},{background:m})),Ol(t,s,t.colorBgContainer,{color:o,borderColor:o,background:t.colorBgContainer},{color:m,borderColor:m,background:t.colorBgContainer})),Il(t)),Tl(t,i,{color:s,background:c},{color:s,background:d})),_a(t,s,"link",{color:o},{color:m})),_a(t,s,"text",{color:o,background:i},{color:m,background:d}))})},{})},VE=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.defaultColor,boxShadow:t.defaultShadow},Al(t,t.solidTextColor,t.colorBgSolid,{color:t.solidTextColor,background:t.colorBgSolidHover},{color:t.solidTextColor,background:t.colorBgSolidActive})),Il(t)),Tl(t,t.colorFillTertiary,{color:t.defaultColor,background:t.colorFillSecondary},{color:t.defaultColor,background:t.colorFill})),$l(t.componentCls,t.ghostBg,t.defaultGhostColor,t.defaultGhostBorderColor,t.colorTextDisabled,t.colorBorder)),_a(t,t.textTextColor,"link",{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),GE=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.colorPrimary,boxShadow:t.primaryShadow},Ol(t,t.colorPrimary,t.colorBgContainer,{color:t.colorPrimaryTextHover,borderColor:t.colorPrimaryHover,background:t.colorBgContainer},{color:t.colorPrimaryTextActive,borderColor:t.colorPrimaryActive,background:t.colorBgContainer})),Il(t)),Tl(t,t.colorPrimaryBg,{color:t.colorPrimary,background:t.colorPrimaryBgHover},{color:t.colorPrimary,background:t.colorPrimaryBorder})),_a(t,t.colorPrimaryText,"text",{color:t.colorPrimaryTextHover,background:t.colorPrimaryBg},{color:t.colorPrimaryTextActive,background:t.colorPrimaryBorder})),_a(t,t.colorPrimaryText,"link",{color:t.colorPrimaryTextHover,background:t.linkHoverBg},{color:t.colorPrimaryTextActive})),$l(t.componentCls,t.ghostBg,t.colorPrimary,t.colorPrimary,t.colorTextDisabled,t.colorBorder,{color:t.colorPrimaryHover,borderColor:t.colorPrimaryHover},{color:t.colorPrimaryActive,borderColor:t.colorPrimaryActive})),KE=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.colorError,boxShadow:t.dangerShadow},Al(t,t.dangerColor,t.colorError,{background:t.colorErrorHover},{background:t.colorErrorActive})),Ol(t,t.colorError,t.colorBgContainer,{color:t.colorErrorHover,borderColor:t.colorErrorBorderHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),Il(t)),Tl(t,t.colorErrorBg,{color:t.colorError,background:t.colorErrorBgFilledHover},{color:t.colorError,background:t.colorErrorBgActive})),_a(t,t.colorError,"text",{color:t.colorErrorHover,background:t.colorErrorBg},{color:t.colorErrorHover,background:t.colorErrorBgActive})),_a(t,t.colorError,"link",{color:t.colorErrorHover},{color:t.colorErrorActive})),$l(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder,{color:t.colorErrorHover,borderColor:t.colorErrorHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),qE=t=>Object.assign(Object.assign({},_a(t,t.colorLink,"link",{color:t.colorLinkHover},{color:t.colorLinkActive})),$l(t.componentCls,t.ghostBg,t.colorInfo,t.colorInfo,t.colorTextDisabled,t.colorBorder,{color:t.colorInfoHover,borderColor:t.colorInfoHover},{color:t.colorInfoActive,borderColor:t.colorInfoActive})),XE=t=>{const{componentCls:r}=t;return Object.assign({[`${r}-color-default`]:VE(t),[`${r}-color-primary`]:GE(t),[`${r}-color-dangerous`]:KE(t),[`${r}-color-link`]:qE(t)},UE(t))},YE=t=>Object.assign(Object.assign(Object.assign(Object.assign({},Ol(t,t.defaultBorderColor,t.defaultBg,{color:t.defaultHoverColor,borderColor:t.defaultHoverBorderColor,background:t.defaultHoverBg},{color:t.defaultActiveColor,borderColor:t.defaultActiveBorderColor,background:t.defaultActiveBg})),_a(t,t.textTextColor,"text",{color:t.textTextHoverColor,background:t.textHoverBg},{color:t.textTextActiveColor,background:t.colorBgTextActive})),Al(t,t.primaryColor,t.colorPrimary,{background:t.colorPrimaryHover,color:t.primaryColor},{background:t.colorPrimaryActive,color:t.primaryColor})),_a(t,t.colorLink,"link",{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),cm=(t,r="")=>{const{componentCls:a,controlHeight:n,fontSize:s,borderRadius:i,buttonPaddingHorizontal:o,iconCls:c,buttonPaddingVertical:d,buttonIconOnlyFontSize:m}=t;return[{[r]:{fontSize:s,height:n,padding:`${we(d)} ${we(o)}`,borderRadius:i,[`&${a}-icon-only`]:{width:n,[c]:{fontSize:m}}}},{[`${a}${a}-circle${r}`]:FE(t)},{[`${a}${a}-round${r}`]:{borderRadius:t.controlHeight,[`&:not(${a}-icon-only)`]:{paddingInline:t.buttonPaddingHorizontal}}}]},JE=t=>{const r=ua(t,{fontSize:t.contentFontSize});return cm(r,t.componentCls)},QE=t=>{const r=ua(t,{controlHeight:t.controlHeightSM,fontSize:t.contentFontSizeSM,padding:t.paddingXS,buttonPaddingHorizontal:t.paddingInlineSM,buttonPaddingVertical:0,borderRadius:t.borderRadiusSM,buttonIconOnlyFontSize:t.onlyIconSizeSM});return cm(r,`${t.componentCls}-sm`)},ZE=t=>{const r=ua(t,{controlHeight:t.controlHeightLG,fontSize:t.contentFontSizeLG,buttonPaddingHorizontal:t.paddingInlineLG,buttonPaddingVertical:0,borderRadius:t.borderRadiusLG,buttonIconOnlyFontSize:t.onlyIconSizeLG});return cm(r,`${t.componentCls}-lg`)},e6=t=>{const{componentCls:r}=t;return{[r]:{[`&${r}-block`]:{width:"100%"}}}},t6=Ln("Button",t=>{const r=Lb(t);return[zE(r),JE(r),QE(r),ZE(r),e6(r),XE(r),YE(r),nE(r)]},Db,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function r6(t,r,a,n){const{focusElCls:s,focus:i,borderElCls:o}=a,c=o?"> *":"",d=["hover",i?"focus":null,"active"].filter(Boolean).map(m=>`&:${m} ${c}`).join(",");return{[`&-item:not(${r}-last-item)`]:{marginInlineEnd:t.calc(t.lineWidth).mul(-1).equal()},[`&-item:not(${n}-status-success)`]:{zIndex:2},"&-item":Object.assign(Object.assign({[d]:{zIndex:3}},s?{[`&${s}`]:{zIndex:3}}:{}),{[`&[disabled] ${c}`]:{zIndex:0}})}}function a6(t,r,a){const{borderElCls:n}=a,s=n?`> ${n}`:"";return{[`&-item:not(${r}-first-item):not(${r}-last-item) ${s}`]:{borderRadius:0},[`&-item:not(${r}-last-item)${r}-first-item`]:{[`& ${s}, &${t}-sm ${s}, &${t}-lg ${s}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${r}-first-item)${r}-last-item`]:{[`& ${s}, &${t}-sm ${s}, &${t}-lg ${s}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function n6(t,r={focus:!0}){const{componentCls:a}=t,{componentCls:n}=r,s=n||a,i=`${s}-compact`;return{[i]:Object.assign(Object.assign({},r6(t,i,r,s)),a6(s,i,r))}}function s6(t,r,a){return{[`&-item:not(${r}-last-item)`]:{marginBottom:t.calc(t.lineWidth).mul(-1).equal()},[`&-item:not(${a}-status-success)`]:{zIndex:2},"&-item":{"&:hover,&:focus,&:active":{zIndex:3},"&[disabled]":{zIndex:0}}}}function i6(t,r){return{[`&-item:not(${r}-first-item):not(${r}-last-item)`]:{borderRadius:0},[`&-item${r}-first-item:not(${r}-last-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${r}-last-item:not(${r}-first-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function o6(t){const r=`${t.componentCls}-compact-vertical`;return{[r]:Object.assign(Object.assign({},s6(t,r,t.componentCls)),i6(t.componentCls,r))}}const l6=t=>{const{componentCls:r,colorPrimaryHover:a,lineWidth:n,calc:s}=t,i=s(n).mul(-1).equal(),o=c=>{const d=`${r}-compact${c?"-vertical":""}-item${r}-primary:not([disabled])`;return{[`${d} + ${d}::before`]:{position:"absolute",top:c?i:0,insetInlineStart:c?0:i,backgroundColor:a,content:'""',width:c?"100%":n,height:c?n:"100%"}}};return Object.assign(Object.assign({},o()),o(!0))},c6=lb(["Button","compact"],t=>{const r=Lb(t);return[n6(r),o6(r),l6(r)]},Db);var d6=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};function u6(t){if(typeof t=="object"&&t){let r=t==null?void 0:t.delay;return r=!Number.isNaN(r)&&typeof r=="number"?r:0,{loading:r<=0,delay:r}}return{loading:!!t,delay:0}}const m6={default:["default","outlined"],primary:["primary","solid"],dashed:["default","dashed"],link:["link","link"],text:["default","text"]},x6=me.forwardRef((t,r)=>{var a,n;const{loading:s=!1,prefixCls:i,color:o,variant:c,type:d,danger:m=!1,shape:u,size:x,styles:h,disabled:f,className:g,rootClassName:b,children:p,icon:v,iconPosition:y="start",ghost:j=!1,block:S=!1,htmlType:N="button",classNames:w,style:_={},autoInsertSpace:P,autoFocus:O}=t,T=d6(t,["loading","prefixCls","color","variant","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace","autoFocus"]),k=d||"default",{button:$}=me.useContext(It),C=u||($==null?void 0:$.shape)||"default",[A,E]=l.useMemo(()=>{if(o&&c)return[o,c];if(d||m){const Ze=m6[k]||[];return m?["danger",Ze[1]]:Ze}return $!=null&&$.color&&($!=null&&$.variant)?[$.color,$.variant]:["default","outlined"]},[o,c,d,m,$==null?void 0:$.color,$==null?void 0:$.variant,k]),F=A==="danger"?"dangerous":A,{getPrefixCls:D,direction:q,autoInsertSpace:Q,className:de,style:H,classNames:se,styles:W}=Qp("button"),le=(a=P??Q)!==null&&a!==void 0?a:!0,U=D("btn",i),[ee,ae,ue]=t6(U),fe=l.useContext(Wo),re=f??fe,V=l.useContext(Tb),ce=l.useMemo(()=>u6(s),[s]),[Z,xe]=l.useState(ce.loading),[pe,Se]=l.useState(!1),ke=l.useRef(null),$e=Mn(r,ke),K=l.Children.count(p)===1&&!v&&!uc(E),ie=l.useRef(!0);me.useEffect(()=>(ie.current=!1,()=>{ie.current=!0}),[]),ur(()=>{let Ze=null;ce.delay>0?Ze=setTimeout(()=>{Ze=null,xe(!0)},ce.delay):xe(ce.loading);function yt(){Ze&&(clearTimeout(Ze),Ze=null)}return yt},[ce.delay,ce.loading]),l.useEffect(()=>{if(!ke.current||!le)return;const Ze=ke.current.textContent||"";K&&Td(Ze)?pe||Se(!0):pe&&Se(!1)}),l.useEffect(()=>{O&&ke.current&&ke.current.focus()},[]);const I=me.useCallback(Ze=>{var yt;if(Z||re){Ze.preventDefault();return}(yt=t.onClick)===null||yt===void 0||yt.call(t,("href"in t,Ze))},[t.onClick,Z,re]),{compactSize:R,compactItemClassnames:je}=J$(U,q),Te={large:"lg",small:"sm",middle:void 0},Ie=om(Ze=>{var yt,We;return(We=(yt=x??R)!==null&&yt!==void 0?yt:V)!==null&&We!==void 0?We:Ze}),tt=Ie&&(n=Te[Ie])!==null&&n!==void 0?n:"",Ke=Z?"loading":v,Be=xn(T,["navigate"]),Ge=_e(U,ae,ue,{[`${U}-${C}`]:C!=="default"&&C,[`${U}-${k}`]:k,[`${U}-dangerous`]:m,[`${U}-color-${F}`]:F,[`${U}-variant-${E}`]:E,[`${U}-${tt}`]:tt,[`${U}-icon-only`]:!p&&p!==0&&!!Ke,[`${U}-background-ghost`]:j&&!uc(E),[`${U}-loading`]:Z,[`${U}-two-chinese-chars`]:pe&&le&&!Z,[`${U}-block`]:S,[`${U}-rtl`]:q==="rtl",[`${U}-icon-end`]:y==="end"},je,g,b,de),J=Object.assign(Object.assign({},H),_),Ae=_e(w==null?void 0:w.icon,se.icon),ve=Object.assign(Object.assign({},(h==null?void 0:h.icon)||{}),W.icon||{}),ge=Ze=>me.createElement(Rb,{prefixCls:U,className:Ae,style:ve},Ze),qe=()=>me.createElement(aE,{existIcon:!!v,prefixCls:U,loading:Z,mount:ie.current});let Xe;v&&!Z?Xe=ge(v):s&&typeof s=="object"&&s.icon?Xe=ge(s.icon):Xe=qe();const st=p||p===0?rE(p,K&&le):null;if(Be.href!==void 0)return ee(me.createElement("a",Object.assign({},Be,{className:_e(Ge,{[`${U}-disabled`]:re}),href:re?void 0:Be.href,style:J,onClick:I,ref:$e,tabIndex:re?-1:0,"aria-disabled":re}),Xe,st));let ht=me.createElement("button",Object.assign({},T,{type:N,className:Ge,style:J,onClick:I,disabled:re,ref:$e}),Xe,st,je&&me.createElement(c6,{prefixCls:U}));return uc(E)||(ht=me.createElement(Y$,{component:"Button",disabled:Z},ht)),ee(ht)}),nn=x6;nn.Group=eE;nn.__ANT_BUTTON=!0;const fc=t=>typeof(t==null?void 0:t.then)=="function",Fb=t=>{const{type:r,children:a,prefixCls:n,buttonProps:s,close:i,autoFocus:o,emitEvent:c,isSilent:d,quitOnNullishReturnValue:m,actionFn:u}=t,x=l.useRef(!1),h=l.useRef(null),[f,g]=_s(!1),b=(...y)=>{i==null||i.apply(void 0,y)};l.useEffect(()=>{let y=null;return o&&(y=setTimeout(()=>{var j;(j=h.current)===null||j===void 0||j.focus({preventScroll:!0})})),()=>{y&&clearTimeout(y)}},[o]);const p=y=>{fc(y)&&(g(!0),y.then((...j)=>{g(!1,!0),b.apply(void 0,j),x.current=!1},j=>{if(g(!1,!0),x.current=!1,!(d!=null&&d()))return Promise.reject(j)}))},v=y=>{if(x.current)return;if(x.current=!0,!u){b();return}let j;if(c){if(j=u(y),m&&!fc(j)){x.current=!1,b(y);return}}else if(u.length)j=u(i),x.current=!1;else if(j=u(),!fc(j)){b();return}p(j)};return l.createElement(nn,Object.assign({},Mb(r),{onClick:v,loading:f,prefixCls:n},s,{ref:h}),a)},Oi=me.createContext({}),{Provider:Bb}=Oi,xh=()=>{const{autoFocusButton:t,cancelButtonProps:r,cancelTextLocale:a,isSilent:n,mergedOkCancel:s,rootPrefixCls:i,close:o,onCancel:c,onConfirm:d}=l.useContext(Oi);return s?me.createElement(Fb,{isSilent:n,actionFn:c,close:(...m)=>{o==null||o.apply(void 0,m),d==null||d(!1)},autoFocus:t==="cancel",buttonProps:r,prefixCls:`${i}-btn`},a):null},hh=()=>{const{autoFocusButton:t,close:r,isSilent:a,okButtonProps:n,rootPrefixCls:s,okTextLocale:i,okType:o,onConfirm:c,onOk:d}=l.useContext(Oi);return me.createElement(Fb,{isSilent:a,type:o||"primary",actionFn:d,close:(...m)=>{r==null||r.apply(void 0,m),c==null||c(!0)},autoFocus:t==="ok",buttonProps:n,prefixCls:`${s}-btn`},i)};var Hb=l.createContext(null),fh=[];function h6(t,r){var a=l.useState(function(){if(!Ir())return null;var g=document.createElement("div");return g}),n=he(a,1),s=n[0],i=l.useRef(!1),o=l.useContext(Hb),c=l.useState(fh),d=he(c,2),m=d[0],u=d[1],x=o||(i.current?void 0:function(g){u(function(b){var p=[g].concat(Fe(b));return p})});function h(){s.parentElement||document.body.appendChild(s),i.current=!0}function f(){var g;(g=s.parentElement)===null||g===void 0||g.removeChild(s),i.current=!1}return ur(function(){return t?o?o(h):h():f(),f},[t]),ur(function(){m.length&&(m.forEach(function(g){return g()}),u(fh))},[m]),[s,x]}function f6(t){var r="rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)),a=document.createElement("div");a.id=r;var n=a.style;n.position="absolute",n.left="0",n.top="0",n.width="100px",n.height="100px",n.overflow="scroll";var s,i;if(t){var o=getComputedStyle(t);n.scrollbarColor=o.scrollbarColor,n.scrollbarWidth=o.scrollbarWidth;var c=getComputedStyle(t,"::-webkit-scrollbar"),d=parseInt(c.width,10),m=parseInt(c.height,10);try{var u=d?"width: ".concat(c.width,";"):"",x=m?"height: ".concat(c.height,";"):"";za(`
#`.concat(r,`::-webkit-scrollbar {
`).concat(u,`
`).concat(x,`
}`),r)}catch(g){console.error(g),s=d,i=m}}document.body.appendChild(a);var h=t&&s&&!isNaN(s)?s:a.offsetWidth-a.clientWidth,f=t&&i&&!isNaN(i)?i:a.offsetHeight-a.clientHeight;return document.body.removeChild(a),hi(r),{width:h,height:f}}function g6(t){return typeof document>"u"||!t||!(t instanceof Element)?{width:0,height:0}:f6(t)}function p6(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var b6="rc-util-locker-".concat(Date.now()),gh=0;function v6(t){var r=!!t,a=l.useState(function(){return gh+=1,"".concat(b6,"_").concat(gh)}),n=he(a,1),s=n[0];ur(function(){if(r){var i=g6(document.body).width,o=p6();za(`
html body {
  overflow-y: hidden;
  `.concat(o?"width: calc(100% - ".concat(i,"px);"):"",`
}`),s)}else hi(s);return function(){hi(s)}},[r,s])}var y6=!1;function j6(t){return y6}var ph=function(r){return r===!1?!1:!Ir()||!r?null:typeof r=="string"?document.querySelector(r):typeof r=="function"?r():r},dm=l.forwardRef(function(t,r){var a=t.open,n=t.autoLock,s=t.getContainer;t.debug;var i=t.autoDestroy,o=i===void 0?!0:i,c=t.children,d=l.useState(a),m=he(d,2),u=m[0],x=m[1],h=u||a;l.useEffect(function(){(o||a)&&x(a)},[a,o]);var f=l.useState(function(){return ph(s)}),g=he(f,2),b=g[0],p=g[1];l.useEffect(function(){var k=ph(s);p(k??null)});var v=h6(h&&!b),y=he(v,2),j=y[0],S=y[1],N=b??j;v6(n&&a&&Ir()&&(N===j||N===document.body));var w=null;if(c&&Rn(c)&&r){var _=c;w=_.ref}var P=Mn(w,r);if(!h||!Ir()||b===void 0)return null;var O=N===!1||j6(),T=c;return r&&(T=l.cloneElement(c,{ref:P})),l.createElement(Hb.Provider,{value:S},O?T:An.createPortal(T,N))}),Wb=l.createContext({});function w6(){var t=X({},Qo);return t.useId}var bh=0,vh=w6();const Ub=vh?function(r){var a=vh();return r||a}:function(r){var a=l.useState("ssr-id"),n=he(a,2),s=n[0],i=n[1];return l.useEffect(function(){var o=bh;bh+=1,i("rc_unique_".concat(o))},[]),r||s};function yh(t,r,a){var n=r;return!n&&a&&(n="".concat(t,"-").concat(a)),n}function jh(t,r){var a=t["page".concat(r?"Y":"X","Offset")],n="scroll".concat(r?"Top":"Left");if(typeof a!="number"){var s=t.document;a=s.documentElement[n],typeof a!="number"&&(a=s.body[n])}return a}function N6(t){var r=t.getBoundingClientRect(),a={left:r.left,top:r.top},n=t.ownerDocument,s=n.defaultView||n.parentWindow;return a.left+=jh(s),a.top+=jh(s,!0),a}const S6=l.memo(function(t){var r=t.children;return r},function(t,r){var a=r.shouldUpdate;return!a});var C6={width:0,height:0,overflow:"hidden",outline:"none"},_6={outline:"none"},Vb=me.forwardRef(function(t,r){var a=t.prefixCls,n=t.className,s=t.style,i=t.title,o=t.ariaId,c=t.footer,d=t.closable,m=t.closeIcon,u=t.onClose,x=t.children,h=t.bodyStyle,f=t.bodyProps,g=t.modalRender,b=t.onMouseDown,p=t.onMouseUp,v=t.holderRef,y=t.visible,j=t.forceRender,S=t.width,N=t.height,w=t.classNames,_=t.styles,P=me.useContext(Wb),O=P.panel,T=Mn(v,O),k=l.useRef(),$=l.useRef();me.useImperativeHandle(r,function(){return{focus:function(){var H;(H=k.current)===null||H===void 0||H.focus({preventScroll:!0})},changeActive:function(H){var se=document,W=se.activeElement;H&&W===$.current?k.current.focus({preventScroll:!0}):!H&&W===k.current&&$.current.focus({preventScroll:!0})}}});var C={};S!==void 0&&(C.width=S),N!==void 0&&(C.height=N);var A=c?me.createElement("div",{className:_e("".concat(a,"-footer"),w==null?void 0:w.footer),style:X({},_==null?void 0:_.footer)},c):null,E=i?me.createElement("div",{className:_e("".concat(a,"-header"),w==null?void 0:w.header),style:X({},_==null?void 0:_.header)},me.createElement("div",{className:"".concat(a,"-title"),id:o},i)):null,L=l.useMemo(function(){return et(d)==="object"&&d!==null?d:d?{closeIcon:m??me.createElement("span",{className:"".concat(a,"-close-x")})}:{}},[d,m,a]),F=am(L,!0),D=et(d)==="object"&&d.disabled,q=d?me.createElement("button",Ve({type:"button",onClick:u,"aria-label":"Close"},F,{className:"".concat(a,"-close"),disabled:D}),L.closeIcon):null,Q=me.createElement("div",{className:_e("".concat(a,"-content"),w==null?void 0:w.content),style:_==null?void 0:_.content},q,E,me.createElement("div",Ve({className:_e("".concat(a,"-body"),w==null?void 0:w.body),style:X(X({},h),_==null?void 0:_.body)},f),x),A);return me.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":i?o:null,"aria-modal":"true",ref:T,style:X(X({},s),C),className:_e(a,n),onMouseDown:b,onMouseUp:p},me.createElement("div",{ref:k,tabIndex:0,style:_6},me.createElement(S6,{shouldUpdate:y||j},g?g(Q):Q)),me.createElement("div",{tabIndex:0,ref:$,style:C6}))}),Gb=l.forwardRef(function(t,r){var a=t.prefixCls,n=t.title,s=t.style,i=t.className,o=t.visible,c=t.forceRender,d=t.destroyOnClose,m=t.motionName,u=t.ariaId,x=t.onVisibleChanged,h=t.mousePosition,f=l.useRef(),g=l.useState(),b=he(g,2),p=b[0],v=b[1],y={};p&&(y.transformOrigin=p);function j(){var S=N6(f.current);v(h&&(h.x||h.y)?"".concat(h.x-S.left,"px ").concat(h.y-S.top,"px"):"")}return l.createElement(Ga,{visible:o,onVisibleChanged:x,onAppearPrepare:j,onEnterPrepare:j,forceRender:c,motionName:m,removeOnLeave:d,ref:f},function(S,N){var w=S.className,_=S.style;return l.createElement(Vb,Ve({},t,{ref:r,title:n,ariaId:u,prefixCls:a,holderRef:N,style:X(X(X({},_),s),y),className:_e(i,w)}))})});Gb.displayName="Content";var k6=function(r){var a=r.prefixCls,n=r.style,s=r.visible,i=r.maskProps,o=r.motionName,c=r.className;return l.createElement(Ga,{key:"mask",visible:s,motionName:o,leavedClassName:"".concat(a,"-mask-hidden")},function(d,m){var u=d.className,x=d.style;return l.createElement("div",Ve({ref:m,style:X(X({},x),n),className:_e("".concat(a,"-mask"),u,c)},i))})},P6=function(r){var a=r.prefixCls,n=a===void 0?"rc-dialog":a,s=r.zIndex,i=r.visible,o=i===void 0?!1:i,c=r.keyboard,d=c===void 0?!0:c,m=r.focusTriggerAfterClose,u=m===void 0?!0:m,x=r.wrapStyle,h=r.wrapClassName,f=r.wrapProps,g=r.onClose,b=r.afterOpenChange,p=r.afterClose,v=r.transitionName,y=r.animation,j=r.closable,S=j===void 0?!0:j,N=r.mask,w=N===void 0?!0:N,_=r.maskTransitionName,P=r.maskAnimation,O=r.maskClosable,T=O===void 0?!0:O,k=r.maskStyle,$=r.maskProps,C=r.rootClassName,A=r.classNames,E=r.styles,L=l.useRef(),F=l.useRef(),D=l.useRef(),q=l.useState(o),Q=he(q,2),de=Q[0],H=Q[1],se=Ub();function W(){nd(F.current,document.activeElement)||(L.current=document.activeElement)}function le(){if(!nd(F.current,document.activeElement)){var xe;(xe=D.current)===null||xe===void 0||xe.focus()}}function U(xe){if(xe)le();else{if(H(!1),w&&L.current&&u){try{L.current.focus({preventScroll:!0})}catch{}L.current=null}de&&(p==null||p())}b==null||b(xe)}function ee(xe){g==null||g(xe)}var ae=l.useRef(!1),ue=l.useRef(),fe=function(){clearTimeout(ue.current),ae.current=!0},re=function(){ue.current=setTimeout(function(){ae.current=!1})},V=null;T&&(V=function(pe){ae.current?ae.current=!1:F.current===pe.target&&ee(pe)});function ce(xe){if(d&&xe.keyCode===Wt.ESC){xe.stopPropagation(),ee(xe);return}o&&xe.keyCode===Wt.TAB&&D.current.changeActive(!xe.shiftKey)}l.useEffect(function(){o&&(H(!0),W())},[o]),l.useEffect(function(){return function(){clearTimeout(ue.current)}},[]);var Z=X(X(X({zIndex:s},x),E==null?void 0:E.wrapper),{},{display:de?null:"none"});return l.createElement("div",Ve({className:_e("".concat(n,"-root"),C)},am(r,{data:!0})),l.createElement(k6,{prefixCls:n,visible:w&&o,motionName:yh(n,_,P),style:X(X({zIndex:s},k),E==null?void 0:E.mask),maskProps:$,className:A==null?void 0:A.mask}),l.createElement("div",Ve({tabIndex:-1,onKeyDown:ce,className:_e("".concat(n,"-wrap"),h,A==null?void 0:A.wrapper),ref:F,onClick:V,style:Z},f),l.createElement(Gb,Ve({},r,{onMouseDown:fe,onMouseUp:re,ref:D,closable:S,ariaId:se,prefixCls:n,visible:o&&de,onClose:ee,onVisibleChanged:U,motionName:yh(n,v,y)}))))},Kb=function(r){var a=r.visible,n=r.getContainer,s=r.forceRender,i=r.destroyOnClose,o=i===void 0?!1:i,c=r.afterClose,d=r.panelRef,m=l.useState(a),u=he(m,2),x=u[0],h=u[1],f=l.useMemo(function(){return{panel:d}},[d]);return l.useEffect(function(){a&&h(!0)},[a]),!s&&o&&!x?null:l.createElement(Wb.Provider,{value:f},l.createElement(dm,{open:a||s||x,autoDestroy:!1,getContainer:n,autoLock:a||x},l.createElement(P6,Ve({},r,{destroyOnClose:o,afterClose:function(){c==null||c(),h(!1)}}))))};Kb.displayName="Dialog";var Nn="RC_FORM_INTERNAL_HOOKS",Ct=function(){$r(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},ks=l.createContext({getFieldValue:Ct,getFieldsValue:Ct,getFieldError:Ct,getFieldWarning:Ct,getFieldsError:Ct,isFieldsTouched:Ct,isFieldTouched:Ct,isFieldValidating:Ct,isFieldsValidating:Ct,resetFields:Ct,setFields:Ct,setFieldValue:Ct,setFieldsValue:Ct,validateFields:Ct,submit:Ct,getInternalHooks:function(){return Ct(),{dispatch:Ct,initEntityValue:Ct,registerField:Ct,useSubscribe:Ct,setInitialValues:Ct,destroyForm:Ct,setCallbacks:Ct,registerWatch:Ct,getFields:Ct,setValidateMessages:Ct,setPreserve:Ct,getInitialValue:Ct}}}),qo=l.createContext(null);function Md(t){return t==null?[]:Array.isArray(t)?t:[t]}function $6(t){return t&&!!t._init}function Rd(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var r=JSON.parse(JSON.stringify(this));return r.clone=this.clone,r}}}var Ld=Rd();function E6(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function A6(t,r,a){if(Uu())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,r);var s=new(t.bind.apply(t,n));return a&&ui(s,a.prototype),s}function Dd(t){var r=typeof Map=="function"?new Map:void 0;return Dd=function(n){if(n===null||!E6(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(r!==void 0){if(r.has(n))return r.get(n);r.set(n,s)}function s(){return A6(n,arguments,mi(this).constructor)}return s.prototype=Object.create(n.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),ui(s,n)},Dd(t)}var O6=/%[sdj%]/g,I6=function(){};function zd(t){if(!t||!t.length)return null;var r={};return t.forEach(function(a){var n=a.field;r[n]=r[n]||[],r[n].push(a)}),r}function Fr(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];var s=0,i=a.length;if(typeof t=="function")return t.apply(null,a);if(typeof t=="string"){var o=t.replace(O6,function(c){if(c==="%%")return"%";if(s>=i)return c;switch(c){case"%s":return String(a[s++]);case"%d":return Number(a[s++]);case"%j":try{return JSON.stringify(a[s++])}catch{return"[Circular]"}break;default:return c}});return o}return t}function T6(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function Qt(t,r){return!!(t==null||r==="array"&&Array.isArray(t)&&!t.length||T6(r)&&typeof t=="string"&&!t)}function M6(t,r,a){var n=[],s=0,i=t.length;function o(c){n.push.apply(n,Fe(c||[])),s++,s===i&&a(n)}t.forEach(function(c){r(c,o)})}function wh(t,r,a){var n=0,s=t.length;function i(o){if(o&&o.length){a(o);return}var c=n;n=n+1,c<s?r(t[c],i):a([])}i([])}function R6(t){var r=[];return Object.keys(t).forEach(function(a){r.push.apply(r,Fe(t[a]||[]))}),r}var Nh=function(t){Ua(a,t);var r=Va(a);function a(n,s){var i;return Zt(this,a),i=r.call(this,"Async Validation Error"),G(it(i),"errors",void 0),G(it(i),"fields",void 0),i.errors=n,i.fields=s,i}return er(a)}(Dd(Error));function L6(t,r,a,n,s){if(r.first){var i=new Promise(function(h,f){var g=function(v){return n(v),v.length?f(new Nh(v,zd(v))):h(s)},b=R6(t);wh(b,a,g)});return i.catch(function(h){return h}),i}var o=r.firstFields===!0?Object.keys(t):r.firstFields||[],c=Object.keys(t),d=c.length,m=0,u=[],x=new Promise(function(h,f){var g=function(p){if(u.push.apply(u,p),m++,m===d)return n(u),u.length?f(new Nh(u,zd(u))):h(s)};c.length||(n(u),h(s)),c.forEach(function(b){var p=t[b];o.indexOf(b)!==-1?wh(p,a,g):M6(p,a,g)})});return x.catch(function(h){return h}),x}function D6(t){return!!(t&&t.message!==void 0)}function z6(t,r){for(var a=t,n=0;n<r.length;n++){if(a==null)return a;a=a[r[n]]}return a}function Sh(t,r){return function(a){var n;return t.fullFields?n=z6(r,t.fullFields):n=r[a.field||t.fullField],D6(a)?(a.field=a.field||t.fullField,a.fieldValue=n,a):{message:typeof a=="function"?a():a,fieldValue:n,field:a.field||t.fullField}}}function Ch(t,r){if(r){for(var a in r)if(r.hasOwnProperty(a)){var n=r[a];et(n)==="object"&&et(t[a])==="object"?t[a]=X(X({},t[a]),n):t[a]=n}}return t}var Hn="enum",F6=function(r,a,n,s,i){r[Hn]=Array.isArray(r[Hn])?r[Hn]:[],r[Hn].indexOf(a)===-1&&s.push(Fr(i.messages[Hn],r.fullField,r[Hn].join(", ")))},B6=function(r,a,n,s,i){if(r.pattern){if(r.pattern instanceof RegExp)r.pattern.lastIndex=0,r.pattern.test(a)||s.push(Fr(i.messages.pattern.mismatch,r.fullField,a,r.pattern));else if(typeof r.pattern=="string"){var o=new RegExp(r.pattern);o.test(a)||s.push(Fr(i.messages.pattern.mismatch,r.fullField,a,r.pattern))}}},H6=function(r,a,n,s,i){var o=typeof r.len=="number",c=typeof r.min=="number",d=typeof r.max=="number",m=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=a,x=null,h=typeof a=="number",f=typeof a=="string",g=Array.isArray(a);if(h?x="number":f?x="string":g&&(x="array"),!x)return!1;g&&(u=a.length),f&&(u=a.replace(m,"_").length),o?u!==r.len&&s.push(Fr(i.messages[x].len,r.fullField,r.len)):c&&!d&&u<r.min?s.push(Fr(i.messages[x].min,r.fullField,r.min)):d&&!c&&u>r.max?s.push(Fr(i.messages[x].max,r.fullField,r.max)):c&&d&&(u<r.min||u>r.max)&&s.push(Fr(i.messages[x].range,r.fullField,r.min,r.max))},qb=function(r,a,n,s,i,o){r.required&&(!n.hasOwnProperty(r.field)||Qt(a,o||r.type))&&s.push(Fr(i.messages.required,r.fullField))},to;const W6=function(){if(to)return to;var t="[a-fA-F\\d:]",r=function(w){return w&&w.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},a="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",n="[a-fA-F\\d]{1,4}",s=["(?:".concat(n,":){7}(?:").concat(n,"|:)"),"(?:".concat(n,":){6}(?:").concat(a,"|:").concat(n,"|:)"),"(?:".concat(n,":){5}(?::").concat(a,"|(?::").concat(n,"){1,2}|:)"),"(?:".concat(n,":){4}(?:(?::").concat(n,"){0,1}:").concat(a,"|(?::").concat(n,"){1,3}|:)"),"(?:".concat(n,":){3}(?:(?::").concat(n,"){0,2}:").concat(a,"|(?::").concat(n,"){1,4}|:)"),"(?:".concat(n,":){2}(?:(?::").concat(n,"){0,3}:").concat(a,"|(?::").concat(n,"){1,5}|:)"),"(?:".concat(n,":){1}(?:(?::").concat(n,"){0,4}:").concat(a,"|(?::").concat(n,"){1,6}|:)"),"(?::(?:(?::".concat(n,"){0,5}:").concat(a,"|(?::").concat(n,"){1,7}|:))")],i="(?:%[0-9a-zA-Z]{1,})?",o="(?:".concat(s.join("|"),")").concat(i),c=new RegExp("(?:^".concat(a,"$)|(?:^").concat(o,"$)")),d=new RegExp("^".concat(a,"$")),m=new RegExp("^".concat(o,"$")),u=function(w){return w&&w.exact?c:new RegExp("(?:".concat(r(w)).concat(a).concat(r(w),")|(?:").concat(r(w)).concat(o).concat(r(w),")"),"g")};u.v4=function(N){return N&&N.exact?d:new RegExp("".concat(r(N)).concat(a).concat(r(N)),"g")},u.v6=function(N){return N&&N.exact?m:new RegExp("".concat(r(N)).concat(o).concat(r(N)),"g")};var x="(?:(?:[a-z]+:)?//)",h="(?:\\S+(?::\\S*)?@)?",f=u.v4().source,g=u.v6().source,b="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",p="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",v="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",y="(?::\\d{2,5})?",j='(?:[/?#][^\\s"]*)?',S="(?:".concat(x,"|www\\.)").concat(h,"(?:localhost|").concat(f,"|").concat(g,"|").concat(b).concat(p).concat(v,")").concat(y).concat(j);return to=new RegExp("(?:^".concat(S,"$)"),"i"),to};var _h={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Js={integer:function(r){return Js.number(r)&&parseInt(r,10)===r},float:function(r){return Js.number(r)&&!Js.integer(r)},array:function(r){return Array.isArray(r)},regexp:function(r){if(r instanceof RegExp)return!0;try{return!!new RegExp(r)}catch{return!1}},date:function(r){return typeof r.getTime=="function"&&typeof r.getMonth=="function"&&typeof r.getYear=="function"&&!isNaN(r.getTime())},number:function(r){return isNaN(r)?!1:typeof r=="number"},object:function(r){return et(r)==="object"&&!Js.array(r)},method:function(r){return typeof r=="function"},email:function(r){return typeof r=="string"&&r.length<=320&&!!r.match(_h.email)},url:function(r){return typeof r=="string"&&r.length<=2048&&!!r.match(W6())},hex:function(r){return typeof r=="string"&&!!r.match(_h.hex)}},U6=function(r,a,n,s,i){if(r.required&&a===void 0){qb(r,a,n,s,i);return}var o=["integer","float","array","regexp","object","method","email","number","date","url","hex"],c=r.type;o.indexOf(c)>-1?Js[c](a)||s.push(Fr(i.messages.types[c],r.fullField,r.type)):c&&et(a)!==r.type&&s.push(Fr(i.messages.types[c],r.fullField,r.type))},V6=function(r,a,n,s,i){(/^\s+$/.test(a)||a==="")&&s.push(Fr(i.messages.whitespace,r.fullField))};const mt={required:qb,whitespace:V6,type:U6,range:H6,enum:F6,pattern:B6};var G6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i)}n(o)},K6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(a==null&&!r.required)return n();mt.required(r,a,s,o,i,"array"),a!=null&&(mt.type(r,a,s,o,i),mt.range(r,a,s,o,i))}n(o)},q6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&mt.type(r,a,s,o,i)}n(o)},X6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a,"date")&&!r.required)return n();if(mt.required(r,a,s,o,i),!Qt(a,"date")){var d;a instanceof Date?d=a:d=new Date(a),mt.type(r,d,s,o,i),d&&mt.range(r,d.getTime(),s,o,i)}}n(o)},Y6="enum",J6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&mt[Y6](r,a,s,o,i)}n(o)},Q6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&(mt.type(r,a,s,o,i),mt.range(r,a,s,o,i))}n(o)},Z6=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&(mt.type(r,a,s,o,i),mt.range(r,a,s,o,i))}n(o)},eA=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&mt.type(r,a,s,o,i)}n(o)},tA=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(a===""&&(a=void 0),Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&(mt.type(r,a,s,o,i),mt.range(r,a,s,o,i))}n(o)},rA=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),a!==void 0&&mt.type(r,a,s,o,i)}n(o)},aA=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a,"string")&&!r.required)return n();mt.required(r,a,s,o,i),Qt(a,"string")||mt.pattern(r,a,s,o,i)}n(o)},nA=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a)&&!r.required)return n();mt.required(r,a,s,o,i),Qt(a)||mt.type(r,a,s,o,i)}n(o)},sA=function(r,a,n,s,i){var o=[],c=Array.isArray(a)?"array":et(a);mt.required(r,a,s,o,i,c),n(o)},iA=function(r,a,n,s,i){var o=[],c=r.required||!r.required&&s.hasOwnProperty(r.field);if(c){if(Qt(a,"string")&&!r.required)return n();mt.required(r,a,s,o,i,"string"),Qt(a,"string")||(mt.type(r,a,s,o,i),mt.range(r,a,s,o,i),mt.pattern(r,a,s,o,i),r.whitespace===!0&&mt.whitespace(r,a,s,o,i))}n(o)},gc=function(r,a,n,s,i){var o=r.type,c=[],d=r.required||!r.required&&s.hasOwnProperty(r.field);if(d){if(Qt(a,o)&&!r.required)return n();mt.required(r,a,s,c,i,o),Qt(a,o)||mt.type(r,a,s,c,i)}n(c)};const ni={string:iA,method:eA,number:tA,boolean:q6,regexp:nA,integer:Z6,float:Q6,array:K6,object:rA,enum:J6,pattern:aA,date:X6,url:gc,hex:gc,email:gc,required:sA,any:G6};var Ii=function(){function t(r){Zt(this,t),G(this,"rules",null),G(this,"_messages",Ld),this.define(r)}return er(t,[{key:"define",value:function(a){var n=this;if(!a)throw new Error("Cannot configure a schema with no rules");if(et(a)!=="object"||Array.isArray(a))throw new Error("Rules must be an object");this.rules={},Object.keys(a).forEach(function(s){var i=a[s];n.rules[s]=Array.isArray(i)?i:[i]})}},{key:"messages",value:function(a){return a&&(this._messages=Ch(Rd(),a)),this._messages}},{key:"validate",value:function(a){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},o=a,c=s,d=i;if(typeof c=="function"&&(d=c,c={}),!this.rules||Object.keys(this.rules).length===0)return d&&d(null,o),Promise.resolve(o);function m(g){var b=[],p={};function v(j){if(Array.isArray(j)){var S;b=(S=b).concat.apply(S,Fe(j))}else b.push(j)}for(var y=0;y<g.length;y++)v(g[y]);b.length?(p=zd(b),d(b,p)):d(null,o)}if(c.messages){var u=this.messages();u===Ld&&(u=Rd()),Ch(u,c.messages),c.messages=u}else c.messages=this.messages();var x={},h=c.keys||Object.keys(this.rules);h.forEach(function(g){var b=n.rules[g],p=o[g];b.forEach(function(v){var y=v;typeof y.transform=="function"&&(o===a&&(o=X({},o)),p=o[g]=y.transform(p),p!=null&&(y.type=y.type||(Array.isArray(p)?"array":et(p)))),typeof y=="function"?y={validator:y}:y=X({},y),y.validator=n.getValidationMethod(y),y.validator&&(y.field=g,y.fullField=y.fullField||g,y.type=n.getType(y),x[g]=x[g]||[],x[g].push({rule:y,value:p,source:o,field:g}))})});var f={};return L6(x,c,function(g,b){var p=g.rule,v=(p.type==="object"||p.type==="array")&&(et(p.fields)==="object"||et(p.defaultField)==="object");v=v&&(p.required||!p.required&&g.value),p.field=g.field;function y(_,P){return X(X({},P),{},{fullField:"".concat(p.fullField,".").concat(_),fullFields:p.fullFields?[].concat(Fe(p.fullFields),[_]):[_]})}function j(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],P=Array.isArray(_)?_:[_];!c.suppressWarning&&P.length&&t.warning("async-validator:",P),P.length&&p.message!==void 0&&(P=[].concat(p.message));var O=P.map(Sh(p,o));if(c.first&&O.length)return f[p.field]=1,b(O);if(!v)b(O);else{if(p.required&&!g.value)return p.message!==void 0?O=[].concat(p.message).map(Sh(p,o)):c.error&&(O=[c.error(p,Fr(c.messages.required,p.field))]),b(O);var T={};p.defaultField&&Object.keys(g.value).map(function(C){T[C]=p.defaultField}),T=X(X({},T),g.rule.fields);var k={};Object.keys(T).forEach(function(C){var A=T[C],E=Array.isArray(A)?A:[A];k[C]=E.map(y.bind(null,C))});var $=new t(k);$.messages(c.messages),g.rule.options&&(g.rule.options.messages=c.messages,g.rule.options.error=c.error),$.validate(g.value,g.rule.options||c,function(C){var A=[];O&&O.length&&A.push.apply(A,Fe(O)),C&&C.length&&A.push.apply(A,Fe(C)),b(A.length?A:null)})}}var S;if(p.asyncValidator)S=p.asyncValidator(p,g.value,j,g.source,c);else if(p.validator){try{S=p.validator(p,g.value,j,g.source,c)}catch(_){var N,w;(N=(w=console).error)===null||N===void 0||N.call(w,_),c.suppressValidatorError||setTimeout(function(){throw _},0),j(_.message)}S===!0?j():S===!1?j(typeof p.message=="function"?p.message(p.fullField||p.field):p.message||"".concat(p.fullField||p.field," fails")):S instanceof Array?j(S):S instanceof Error&&j(S.message)}S&&S.then&&S.then(function(){return j()},function(_){return j(_)})},function(g){m(g)},o)}},{key:"getType",value:function(a){if(a.type===void 0&&a.pattern instanceof RegExp&&(a.type="pattern"),typeof a.validator!="function"&&a.type&&!ni.hasOwnProperty(a.type))throw new Error(Fr("Unknown rule type %s",a.type));return a.type||"string"}},{key:"getValidationMethod",value:function(a){if(typeof a.validator=="function")return a.validator;var n=Object.keys(a),s=n.indexOf("message");return s!==-1&&n.splice(s,1),n.length===1&&n[0]==="required"?ni.required:ni[this.getType(a)]||void 0}}]),t}();G(Ii,"register",function(r,a){if(typeof a!="function")throw new Error("Cannot register a validator by type, validator is not a function");ni[r]=a});G(Ii,"warning",I6);G(Ii,"messages",Ld);G(Ii,"validators",ni);var Dr="'${name}' is not a valid ${type}",Xb={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:Dr,method:Dr,array:Dr,object:Dr,number:Dr,date:Dr,boolean:Dr,integer:Dr,float:Dr,regexp:Dr,email:Dr,url:Dr,hex:Dr},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},kh=Ii;function oA(t,r){return t.replace(/\\?\$\{\w+\}/g,function(a){if(a.startsWith("\\"))return a.slice(1);var n=a.slice(2,-1);return r[n]})}var Ph="CODE_LOGIC_ERROR";function Fd(t,r,a,n,s){return Bd.apply(this,arguments)}function Bd(){return Bd=In(wr().mark(function t(r,a,n,s,i){var o,c,d,m,u,x,h,f,g;return wr().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return o=X({},n),delete o.ruleIndex,kh.warning=function(){},o.validator&&(c=o.validator,o.validator=function(){try{return c.apply(void 0,arguments)}catch(v){return console.error(v),Promise.reject(Ph)}}),d=null,o&&o.type==="array"&&o.defaultField&&(d=o.defaultField,delete o.defaultField),m=new kh(G({},r,[o])),u=Zn(Xb,s.validateMessages),m.messages(u),x=[],p.prev=10,p.next=13,Promise.resolve(m.validate(G({},r,a),X({},s)));case 13:p.next=18;break;case 15:p.prev=15,p.t0=p.catch(10),p.t0.errors&&(x=p.t0.errors.map(function(v,y){var j=v.message,S=j===Ph?u.default:j;return l.isValidElement(S)?l.cloneElement(S,{key:"error_".concat(y)}):S}));case 18:if(!(!x.length&&d&&Array.isArray(a)&&a.length>0)){p.next=23;break}return p.next=21,Promise.all(a.map(function(v,y){return Fd("".concat(r,".").concat(y),v,d,s,i)}));case 21:return h=p.sent,p.abrupt("return",h.reduce(function(v,y){return[].concat(Fe(v),Fe(y))},[]));case 23:return f=X(X({},n),{},{name:r,enum:(n.enum||[]).join(", ")},i),g=x.map(function(v){return typeof v=="string"?oA(v,f):v}),p.abrupt("return",g);case 26:case"end":return p.stop()}},t,null,[[10,15]])})),Bd.apply(this,arguments)}function lA(t,r,a,n,s,i){var o=t.join("."),c=a.map(function(u,x){var h=u.validator,f=X(X({},u),{},{ruleIndex:x});return h&&(f.validator=function(g,b,p){var v=!1,y=function(){for(var N=arguments.length,w=new Array(N),_=0;_<N;_++)w[_]=arguments[_];Promise.resolve().then(function(){$r(!v,"Your validator function has already return a promise. `callback` will be ignored."),v||p.apply(void 0,w)})},j=h(g,b,y);v=j&&typeof j.then=="function"&&typeof j.catch=="function",$r(v,"`callback` is deprecated. Please return a promise instead."),v&&j.then(function(){p()}).catch(function(S){p(S||" ")})}),f}).sort(function(u,x){var h=u.warningOnly,f=u.ruleIndex,g=x.warningOnly,b=x.ruleIndex;return!!h==!!g?f-b:h?1:-1}),d;if(s===!0)d=new Promise(function(){var u=In(wr().mark(function x(h,f){var g,b,p;return wr().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:g=0;case 1:if(!(g<c.length)){y.next=12;break}return b=c[g],y.next=5,Fd(o,r,b,n,i);case 5:if(p=y.sent,!p.length){y.next=9;break}return f([{errors:p,rule:b}]),y.abrupt("return");case 9:g+=1,y.next=1;break;case 12:h([]);case 13:case"end":return y.stop()}},x)}));return function(x,h){return u.apply(this,arguments)}}());else{var m=c.map(function(u){return Fd(o,r,u,n,i).then(function(x){return{errors:x,rule:u}})});d=(s?dA(m):cA(m)).then(function(u){return Promise.reject(u)})}return d.catch(function(u){return u}),d}function cA(t){return Hd.apply(this,arguments)}function Hd(){return Hd=In(wr().mark(function t(r){return wr().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",Promise.all(r).then(function(s){var i,o=(i=[]).concat.apply(i,Fe(s));return o}));case 1:case"end":return n.stop()}},t)})),Hd.apply(this,arguments)}function dA(t){return Wd.apply(this,arguments)}function Wd(){return Wd=In(wr().mark(function t(r){var a;return wr().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return a=0,s.abrupt("return",new Promise(function(i){r.forEach(function(o){o.then(function(c){c.errors.length&&i([c]),a+=1,a===r.length&&i([])})})}));case 2:case"end":return s.stop()}},t)})),Wd.apply(this,arguments)}function Ht(t){return Md(t)}function $h(t,r){var a={};return r.forEach(function(n){var s=wa(t,n);a=ra(a,n,s)}),a}function os(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(n){return Yb(r,n,a)})}function Yb(t,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!r||!a&&t.length!==r.length?!1:r.every(function(n,s){return t[s]===n})}function uA(t,r){if(t===r)return!0;if(!t&&r||t&&!r||!t||!r||et(t)!=="object"||et(r)!=="object")return!1;var a=Object.keys(t),n=Object.keys(r),s=new Set([].concat(a,n));return Fe(s).every(function(i){var o=t[i],c=r[i];return typeof o=="function"&&typeof c=="function"?!0:o===c})}function mA(t){var r=arguments.length<=1?void 0:arguments[1];return r&&r.target&&et(r.target)==="object"&&t in r.target?r.target[t]:r}function Eh(t,r,a){var n=t.length;if(r<0||r>=n||a<0||a>=n)return t;var s=t[r],i=r-a;return i>0?[].concat(Fe(t.slice(0,a)),[s],Fe(t.slice(a,r)),Fe(t.slice(r+1,n))):i<0?[].concat(Fe(t.slice(0,r)),Fe(t.slice(r+1,a+1)),[s],Fe(t.slice(a+1,n))):t}var xA=["name"],Xr=[];function pc(t,r,a,n,s,i){return typeof t=="function"?t(r,a,"source"in i?{source:i.source}:{}):n!==s}var um=function(t){Ua(a,t);var r=Va(a);function a(n){var s;if(Zt(this,a),s=r.call(this,n),G(it(s),"state",{resetCount:0}),G(it(s),"cancelRegisterFunc",null),G(it(s),"mounted",!1),G(it(s),"touched",!1),G(it(s),"dirty",!1),G(it(s),"validatePromise",void 0),G(it(s),"prevValidating",void 0),G(it(s),"errors",Xr),G(it(s),"warnings",Xr),G(it(s),"cancelRegister",function(){var d=s.props,m=d.preserve,u=d.isListField,x=d.name;s.cancelRegisterFunc&&s.cancelRegisterFunc(u,m,Ht(x)),s.cancelRegisterFunc=null}),G(it(s),"getNamePath",function(){var d=s.props,m=d.name,u=d.fieldContext,x=u.prefixName,h=x===void 0?[]:x;return m!==void 0?[].concat(Fe(h),Fe(m)):[]}),G(it(s),"getRules",function(){var d=s.props,m=d.rules,u=m===void 0?[]:m,x=d.fieldContext;return u.map(function(h){return typeof h=="function"?h(x):h})}),G(it(s),"refresh",function(){s.mounted&&s.setState(function(d){var m=d.resetCount;return{resetCount:m+1}})}),G(it(s),"metaCache",null),G(it(s),"triggerMetaEvent",function(d){var m=s.props.onMetaChange;if(m){var u=X(X({},s.getMeta()),{},{destroy:d});fi(s.metaCache,u)||m(u),s.metaCache=u}else s.metaCache=null}),G(it(s),"onStoreChange",function(d,m,u){var x=s.props,h=x.shouldUpdate,f=x.dependencies,g=f===void 0?[]:f,b=x.onReset,p=u.store,v=s.getNamePath(),y=s.getValue(d),j=s.getValue(p),S=m&&os(m,v);switch(u.type==="valueUpdate"&&u.source==="external"&&!fi(y,j)&&(s.touched=!0,s.dirty=!0,s.validatePromise=null,s.errors=Xr,s.warnings=Xr,s.triggerMetaEvent()),u.type){case"reset":if(!m||S){s.touched=!1,s.dirty=!1,s.validatePromise=void 0,s.errors=Xr,s.warnings=Xr,s.triggerMetaEvent(),b==null||b(),s.refresh();return}break;case"remove":{if(h&&pc(h,d,p,y,j,u)){s.reRender();return}break}case"setField":{var N=u.data;if(S){"touched"in N&&(s.touched=N.touched),"validating"in N&&!("originRCField"in N)&&(s.validatePromise=N.validating?Promise.resolve([]):null),"errors"in N&&(s.errors=N.errors||Xr),"warnings"in N&&(s.warnings=N.warnings||Xr),s.dirty=!0,s.triggerMetaEvent(),s.reRender();return}else if("value"in N&&os(m,v,!0)){s.reRender();return}if(h&&!v.length&&pc(h,d,p,y,j,u)){s.reRender();return}break}case"dependenciesUpdate":{var w=g.map(Ht);if(w.some(function(_){return os(u.relatedFields,_)})){s.reRender();return}break}default:if(S||(!g.length||v.length||h)&&pc(h,d,p,y,j,u)){s.reRender();return}break}h===!0&&s.reRender()}),G(it(s),"validateRules",function(d){var m=s.getNamePath(),u=s.getValue(),x=d||{},h=x.triggerName,f=x.validateOnly,g=f===void 0?!1:f,b=Promise.resolve().then(In(wr().mark(function p(){var v,y,j,S,N,w,_;return wr().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:if(s.mounted){O.next=2;break}return O.abrupt("return",[]);case 2:if(v=s.props,y=v.validateFirst,j=y===void 0?!1:y,S=v.messageVariables,N=v.validateDebounce,w=s.getRules(),h&&(w=w.filter(function(T){return T}).filter(function(T){var k=T.validateTrigger;if(!k)return!0;var $=Md(k);return $.includes(h)})),!(N&&h)){O.next=10;break}return O.next=8,new Promise(function(T){setTimeout(T,N)});case 8:if(s.validatePromise===b){O.next=10;break}return O.abrupt("return",[]);case 10:return _=lA(m,u,w,d,j,S),_.catch(function(T){return T}).then(function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xr;if(s.validatePromise===b){var k;s.validatePromise=null;var $=[],C=[];(k=T.forEach)===null||k===void 0||k.call(T,function(A){var E=A.rule.warningOnly,L=A.errors,F=L===void 0?Xr:L;E?C.push.apply(C,Fe(F)):$.push.apply($,Fe(F))}),s.errors=$,s.warnings=C,s.triggerMetaEvent(),s.reRender()}}),O.abrupt("return",_);case 13:case"end":return O.stop()}},p)})));return g||(s.validatePromise=b,s.dirty=!0,s.errors=Xr,s.warnings=Xr,s.triggerMetaEvent(),s.reRender()),b}),G(it(s),"isFieldValidating",function(){return!!s.validatePromise}),G(it(s),"isFieldTouched",function(){return s.touched}),G(it(s),"isFieldDirty",function(){if(s.dirty||s.props.initialValue!==void 0)return!0;var d=s.props.fieldContext,m=d.getInternalHooks(Nn),u=m.getInitialValue;return u(s.getNamePath())!==void 0}),G(it(s),"getErrors",function(){return s.errors}),G(it(s),"getWarnings",function(){return s.warnings}),G(it(s),"isListField",function(){return s.props.isListField}),G(it(s),"isList",function(){return s.props.isList}),G(it(s),"isPreserve",function(){return s.props.preserve}),G(it(s),"getMeta",function(){s.prevValidating=s.isFieldValidating();var d={touched:s.isFieldTouched(),validating:s.prevValidating,errors:s.errors,warnings:s.warnings,name:s.getNamePath(),validated:s.validatePromise===null};return d}),G(it(s),"getOnlyChild",function(d){if(typeof d=="function"){var m=s.getMeta();return X(X({},s.getOnlyChild(d(s.getControlled(),m,s.props.fieldContext))),{},{isFunction:!0})}var u=ys(d);return u.length!==1||!l.isValidElement(u[0])?{child:u,isFunction:!1}:{child:u[0],isFunction:!1}}),G(it(s),"getValue",function(d){var m=s.props.fieldContext.getFieldsValue,u=s.getNamePath();return wa(d||m(!0),u)}),G(it(s),"getControlled",function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=s.props,u=m.name,x=m.trigger,h=m.validateTrigger,f=m.getValueFromEvent,g=m.normalize,b=m.valuePropName,p=m.getValueProps,v=m.fieldContext,y=h!==void 0?h:v.validateTrigger,j=s.getNamePath(),S=v.getInternalHooks,N=v.getFieldsValue,w=S(Nn),_=w.dispatch,P=s.getValue(),O=p||function(A){return G({},b,A)},T=d[x],k=u!==void 0?O(P):{},$=X(X({},d),k);$[x]=function(){s.touched=!0,s.dirty=!0,s.triggerMetaEvent();for(var A,E=arguments.length,L=new Array(E),F=0;F<E;F++)L[F]=arguments[F];f?A=f.apply(void 0,L):A=mA.apply(void 0,[b].concat(L)),g&&(A=g(A,P,N(!0))),A!==P&&_({type:"updateValue",namePath:j,value:A}),T&&T.apply(void 0,L)};var C=Md(y||[]);return C.forEach(function(A){var E=$[A];$[A]=function(){E&&E.apply(void 0,arguments);var L=s.props.rules;L&&L.length&&_({type:"validateField",namePath:j,triggerName:A})}}),$}),n.fieldContext){var i=n.fieldContext.getInternalHooks,o=i(Nn),c=o.initEntityValue;c(it(s))}return s}return er(a,[{key:"componentDidMount",value:function(){var s=this.props,i=s.shouldUpdate,o=s.fieldContext;if(this.mounted=!0,o){var c=o.getInternalHooks,d=c(Nn),m=d.registerField;this.cancelRegisterFunc=m(this)}i===!0&&this.reRender()}},{key:"componentWillUnmount",value:function(){this.cancelRegister(),this.triggerMetaEvent(!0),this.mounted=!1}},{key:"reRender",value:function(){this.mounted&&this.forceUpdate()}},{key:"render",value:function(){var s=this.state.resetCount,i=this.props.children,o=this.getOnlyChild(i),c=o.child,d=o.isFunction,m;return d?m=c:l.isValidElement(c)?m=l.cloneElement(c,this.getControlled(c.props)):($r(!c,"`children` of Field is not validate ReactElement."),m=c),l.createElement(l.Fragment,{key:s},m)}}]),a}(l.Component);G(um,"contextType",ks);G(um,"defaultProps",{trigger:"onChange",valuePropName:"value"});function Jb(t){var r,a=t.name,n=bt(t,xA),s=l.useContext(ks),i=l.useContext(qo),o=a!==void 0?Ht(a):void 0,c=(r=n.isListField)!==null&&r!==void 0?r:!!i,d="keep";return c||(d="_".concat((o||[]).join("_"))),l.createElement(um,Ve({key:d,name:o,isListField:c},n,{fieldContext:s}))}function hA(t){var r=t.name,a=t.initialValue,n=t.children,s=t.rules,i=t.validateTrigger,o=t.isListField,c=l.useContext(ks),d=l.useContext(qo),m=l.useRef({keys:[],id:0}),u=m.current,x=l.useMemo(function(){var b=Ht(c.prefixName)||[];return[].concat(Fe(b),Fe(Ht(r)))},[c.prefixName,r]),h=l.useMemo(function(){return X(X({},c),{},{prefixName:x})},[c,x]),f=l.useMemo(function(){return{getKey:function(p){var v=x.length,y=p[v];return[u.keys[y],p.slice(v+1)]}}},[x]);if(typeof n!="function")return $r(!1,"Form.List only accepts function as children."),null;var g=function(p,v,y){var j=y.source;return j==="internal"?!1:p!==v};return l.createElement(qo.Provider,{value:f},l.createElement(ks.Provider,{value:h},l.createElement(Jb,{name:[],shouldUpdate:g,rules:s,validateTrigger:i,initialValue:a,isList:!0,isListField:o??!!d},function(b,p){var v=b.value,y=v===void 0?[]:v,j=b.onChange,S=c.getFieldValue,N=function(){var O=S(x||[]);return O||[]},w={add:function(O,T){var k=N();T>=0&&T<=k.length?(u.keys=[].concat(Fe(u.keys.slice(0,T)),[u.id],Fe(u.keys.slice(T))),j([].concat(Fe(k.slice(0,T)),[O],Fe(k.slice(T))))):(u.keys=[].concat(Fe(u.keys),[u.id]),j([].concat(Fe(k),[O]))),u.id+=1},remove:function(O){var T=N(),k=new Set(Array.isArray(O)?O:[O]);k.size<=0||(u.keys=u.keys.filter(function($,C){return!k.has(C)}),j(T.filter(function($,C){return!k.has(C)})))},move:function(O,T){if(O!==T){var k=N();O<0||O>=k.length||T<0||T>=k.length||(u.keys=Eh(u.keys,O,T),j(Eh(k,O,T)))}}},_=y||[];return Array.isArray(_)||(_=[]),n(_.map(function(P,O){var T=u.keys[O];return T===void 0&&(u.keys[O]=u.id,T=u.keys[O],u.id+=1),{name:O,key:T,isListField:!0}}),w,p)})))}function fA(t){var r=!1,a=t.length,n=[];return t.length?new Promise(function(s,i){t.forEach(function(o,c){o.catch(function(d){return r=!0,d}).then(function(d){a-=1,n[c]=d,!(a>0)&&(r&&i(n),s(n))})})}):Promise.resolve([])}var Qb="__@field_split__";function bc(t){return t.map(function(r){return"".concat(et(r),":").concat(r)}).join(Qb)}var Wn=function(){function t(){Zt(this,t),G(this,"kvs",new Map)}return er(t,[{key:"set",value:function(a,n){this.kvs.set(bc(a),n)}},{key:"get",value:function(a){return this.kvs.get(bc(a))}},{key:"update",value:function(a,n){var s=this.get(a),i=n(s);i?this.set(a,i):this.delete(a)}},{key:"delete",value:function(a){this.kvs.delete(bc(a))}},{key:"map",value:function(a){return Fe(this.kvs.entries()).map(function(n){var s=he(n,2),i=s[0],o=s[1],c=i.split(Qb);return a({key:c.map(function(d){var m=d.match(/^([^:]*):(.*)$/),u=he(m,3),x=u[1],h=u[2];return x==="number"?Number(h):h}),value:o})})}},{key:"toJSON",value:function(){var a={};return this.map(function(n){var s=n.key,i=n.value;return a[s.join(".")]=i,null}),a}}]),t}(),gA=["name"],pA=er(function t(r){var a=this;Zt(this,t),G(this,"formHooked",!1),G(this,"forceRootUpdate",void 0),G(this,"subscribable",!0),G(this,"store",{}),G(this,"fieldEntities",[]),G(this,"initialValues",{}),G(this,"callbacks",{}),G(this,"validateMessages",null),G(this,"preserve",null),G(this,"lastValidatePromise",null),G(this,"getForm",function(){return{getFieldValue:a.getFieldValue,getFieldsValue:a.getFieldsValue,getFieldError:a.getFieldError,getFieldWarning:a.getFieldWarning,getFieldsError:a.getFieldsError,isFieldsTouched:a.isFieldsTouched,isFieldTouched:a.isFieldTouched,isFieldValidating:a.isFieldValidating,isFieldsValidating:a.isFieldsValidating,resetFields:a.resetFields,setFields:a.setFields,setFieldValue:a.setFieldValue,setFieldsValue:a.setFieldsValue,validateFields:a.validateFields,submit:a.submit,_init:!0,getInternalHooks:a.getInternalHooks}}),G(this,"getInternalHooks",function(n){return n===Nn?(a.formHooked=!0,{dispatch:a.dispatch,initEntityValue:a.initEntityValue,registerField:a.registerField,useSubscribe:a.useSubscribe,setInitialValues:a.setInitialValues,destroyForm:a.destroyForm,setCallbacks:a.setCallbacks,setValidateMessages:a.setValidateMessages,getFields:a.getFields,setPreserve:a.setPreserve,getInitialValue:a.getInitialValue,registerWatch:a.registerWatch}):($r(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),G(this,"useSubscribe",function(n){a.subscribable=n}),G(this,"prevWithoutPreserves",null),G(this,"setInitialValues",function(n,s){if(a.initialValues=n||{},s){var i,o=Zn(n,a.store);(i=a.prevWithoutPreserves)===null||i===void 0||i.map(function(c){var d=c.key;o=ra(o,d,wa(n,d))}),a.prevWithoutPreserves=null,a.updateStore(o)}}),G(this,"destroyForm",function(n){if(n)a.updateStore({});else{var s=new Wn;a.getFieldEntities(!0).forEach(function(i){a.isMergedPreserve(i.isPreserve())||s.set(i.getNamePath(),!0)}),a.prevWithoutPreserves=s}}),G(this,"getInitialValue",function(n){var s=wa(a.initialValues,n);return n.length?Zn(s):s}),G(this,"setCallbacks",function(n){a.callbacks=n}),G(this,"setValidateMessages",function(n){a.validateMessages=n}),G(this,"setPreserve",function(n){a.preserve=n}),G(this,"watchList",[]),G(this,"registerWatch",function(n){return a.watchList.push(n),function(){a.watchList=a.watchList.filter(function(s){return s!==n})}}),G(this,"notifyWatch",function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(a.watchList.length){var s=a.getFieldsValue(),i=a.getFieldsValue(!0);a.watchList.forEach(function(o){o(s,i,n)})}}),G(this,"timeoutId",null),G(this,"warningUnhooked",function(){}),G(this,"updateStore",function(n){a.store=n}),G(this,"getFieldEntities",function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return n?a.fieldEntities.filter(function(s){return s.getNamePath().length}):a.fieldEntities}),G(this,"getFieldsMap",function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=new Wn;return a.getFieldEntities(n).forEach(function(i){var o=i.getNamePath();s.set(o,i)}),s}),G(this,"getFieldEntitiesForNamePathList",function(n){if(!n)return a.getFieldEntities(!0);var s=a.getFieldsMap(!0);return n.map(function(i){var o=Ht(i);return s.get(o)||{INVALIDATE_NAME_PATH:Ht(i)}})}),G(this,"getFieldsValue",function(n,s){a.warningUnhooked();var i,o,c;if(n===!0||Array.isArray(n)?(i=n,o=s):n&&et(n)==="object"&&(c=n.strict,o=n.filter),i===!0&&!o)return a.store;var d=a.getFieldEntitiesForNamePathList(Array.isArray(i)?i:null),m=[];return d.forEach(function(u){var x,h,f="INVALIDATE_NAME_PATH"in u?u.INVALIDATE_NAME_PATH:u.getNamePath();if(c){var g,b;if((g=(b=u).isList)!==null&&g!==void 0&&g.call(b))return}else if(!i&&(x=(h=u).isListField)!==null&&x!==void 0&&x.call(h))return;if(!o)m.push(f);else{var p="getMeta"in u?u.getMeta():null;o(p)&&m.push(f)}}),$h(a.store,m.map(Ht))}),G(this,"getFieldValue",function(n){a.warningUnhooked();var s=Ht(n);return wa(a.store,s)}),G(this,"getFieldsError",function(n){a.warningUnhooked();var s=a.getFieldEntitiesForNamePathList(n);return s.map(function(i,o){return i&&!("INVALIDATE_NAME_PATH"in i)?{name:i.getNamePath(),errors:i.getErrors(),warnings:i.getWarnings()}:{name:Ht(n[o]),errors:[],warnings:[]}})}),G(this,"getFieldError",function(n){a.warningUnhooked();var s=Ht(n),i=a.getFieldsError([s])[0];return i.errors}),G(this,"getFieldWarning",function(n){a.warningUnhooked();var s=Ht(n),i=a.getFieldsError([s])[0];return i.warnings}),G(this,"isFieldsTouched",function(){a.warningUnhooked();for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];var o=s[0],c=s[1],d,m=!1;s.length===0?d=null:s.length===1?Array.isArray(o)?(d=o.map(Ht),m=!1):(d=null,m=o):(d=o.map(Ht),m=c);var u=a.getFieldEntities(!0),x=function(p){return p.isFieldTouched()};if(!d)return m?u.every(function(b){return x(b)||b.isList()}):u.some(x);var h=new Wn;d.forEach(function(b){h.set(b,[])}),u.forEach(function(b){var p=b.getNamePath();d.forEach(function(v){v.every(function(y,j){return p[j]===y})&&h.update(v,function(y){return[].concat(Fe(y),[b])})})});var f=function(p){return p.some(x)},g=h.map(function(b){var p=b.value;return p});return m?g.every(f):g.some(f)}),G(this,"isFieldTouched",function(n){return a.warningUnhooked(),a.isFieldsTouched([n])}),G(this,"isFieldsValidating",function(n){a.warningUnhooked();var s=a.getFieldEntities();if(!n)return s.some(function(o){return o.isFieldValidating()});var i=n.map(Ht);return s.some(function(o){var c=o.getNamePath();return os(i,c)&&o.isFieldValidating()})}),G(this,"isFieldValidating",function(n){return a.warningUnhooked(),a.isFieldsValidating([n])}),G(this,"resetWithFieldInitialValue",function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=new Wn,i=a.getFieldEntities(!0);i.forEach(function(d){var m=d.props.initialValue,u=d.getNamePath();if(m!==void 0){var x=s.get(u)||new Set;x.add({entity:d,value:m}),s.set(u,x)}});var o=function(m){m.forEach(function(u){var x=u.props.initialValue;if(x!==void 0){var h=u.getNamePath(),f=a.getInitialValue(h);if(f!==void 0)$r(!1,"Form already set 'initialValues' with path '".concat(h.join("."),"'. Field can not overwrite it."));else{var g=s.get(h);if(g&&g.size>1)$r(!1,"Multiple Field with path '".concat(h.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(g){var b=a.getFieldValue(h),p=u.isListField();!p&&(!n.skipExist||b===void 0)&&a.updateStore(ra(a.store,h,Fe(g)[0].value))}}}})},c;n.entities?c=n.entities:n.namePathList?(c=[],n.namePathList.forEach(function(d){var m=s.get(d);if(m){var u;(u=c).push.apply(u,Fe(Fe(m).map(function(x){return x.entity})))}})):c=i,o(c)}),G(this,"resetFields",function(n){a.warningUnhooked();var s=a.store;if(!n){a.updateStore(Zn(a.initialValues)),a.resetWithFieldInitialValue(),a.notifyObservers(s,null,{type:"reset"}),a.notifyWatch();return}var i=n.map(Ht);i.forEach(function(o){var c=a.getInitialValue(o);a.updateStore(ra(a.store,o,c))}),a.resetWithFieldInitialValue({namePathList:i}),a.notifyObservers(s,i,{type:"reset"}),a.notifyWatch(i)}),G(this,"setFields",function(n){a.warningUnhooked();var s=a.store,i=[];n.forEach(function(o){var c=o.name,d=bt(o,gA),m=Ht(c);i.push(m),"value"in d&&a.updateStore(ra(a.store,m,d.value)),a.notifyObservers(s,[m],{type:"setField",data:o})}),a.notifyWatch(i)}),G(this,"getFields",function(){var n=a.getFieldEntities(!0),s=n.map(function(i){var o=i.getNamePath(),c=i.getMeta(),d=X(X({},c),{},{name:o,value:a.getFieldValue(o)});return Object.defineProperty(d,"originRCField",{value:!0}),d});return s}),G(this,"initEntityValue",function(n){var s=n.props.initialValue;if(s!==void 0){var i=n.getNamePath(),o=wa(a.store,i);o===void 0&&a.updateStore(ra(a.store,i,s))}}),G(this,"isMergedPreserve",function(n){var s=n!==void 0?n:a.preserve;return s??!0}),G(this,"registerField",function(n){a.fieldEntities.push(n);var s=n.getNamePath();if(a.notifyWatch([s]),n.props.initialValue!==void 0){var i=a.store;a.resetWithFieldInitialValue({entities:[n],skipExist:!0}),a.notifyObservers(i,[n.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(o,c){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(a.fieldEntities=a.fieldEntities.filter(function(x){return x!==n}),!a.isMergedPreserve(c)&&(!o||d.length>1)){var m=o?void 0:a.getInitialValue(s);if(s.length&&a.getFieldValue(s)!==m&&a.fieldEntities.every(function(x){return!Yb(x.getNamePath(),s)})){var u=a.store;a.updateStore(ra(u,s,m,!0)),a.notifyObservers(u,[s],{type:"remove"}),a.triggerDependenciesUpdate(u,s)}}a.notifyWatch([s])}}),G(this,"dispatch",function(n){switch(n.type){case"updateValue":{var s=n.namePath,i=n.value;a.updateValue(s,i);break}case"validateField":{var o=n.namePath,c=n.triggerName;a.validateFields([o],{triggerName:c});break}}}),G(this,"notifyObservers",function(n,s,i){if(a.subscribable){var o=X(X({},i),{},{store:a.getFieldsValue(!0)});a.getFieldEntities().forEach(function(c){var d=c.onStoreChange;d(n,s,o)})}else a.forceRootUpdate()}),G(this,"triggerDependenciesUpdate",function(n,s){var i=a.getDependencyChildrenFields(s);return i.length&&a.validateFields(i),a.notifyObservers(n,i,{type:"dependenciesUpdate",relatedFields:[s].concat(Fe(i))}),i}),G(this,"updateValue",function(n,s){var i=Ht(n),o=a.store;a.updateStore(ra(a.store,i,s)),a.notifyObservers(o,[i],{type:"valueUpdate",source:"internal"}),a.notifyWatch([i]);var c=a.triggerDependenciesUpdate(o,i),d=a.callbacks.onValuesChange;if(d){var m=$h(a.store,[i]);d(m,a.getFieldsValue())}a.triggerOnFieldsChange([i].concat(Fe(c)))}),G(this,"setFieldsValue",function(n){a.warningUnhooked();var s=a.store;if(n){var i=Zn(a.store,n);a.updateStore(i)}a.notifyObservers(s,null,{type:"valueUpdate",source:"external"}),a.notifyWatch()}),G(this,"setFieldValue",function(n,s){a.setFields([{name:n,value:s,errors:[],warnings:[]}])}),G(this,"getDependencyChildrenFields",function(n){var s=new Set,i=[],o=new Wn;a.getFieldEntities().forEach(function(d){var m=d.props.dependencies;(m||[]).forEach(function(u){var x=Ht(u);o.update(x,function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return h.add(d),h})})});var c=function d(m){var u=o.get(m)||new Set;u.forEach(function(x){if(!s.has(x)){s.add(x);var h=x.getNamePath();x.isFieldDirty()&&h.length&&(i.push(h),d(h))}})};return c(n),i}),G(this,"triggerOnFieldsChange",function(n,s){var i=a.callbacks.onFieldsChange;if(i){var o=a.getFields();if(s){var c=new Wn;s.forEach(function(m){var u=m.name,x=m.errors;c.set(u,x)}),o.forEach(function(m){m.errors=c.get(m.name)||m.errors})}var d=o.filter(function(m){var u=m.name;return os(n,u)});d.length&&i(d,o)}}),G(this,"validateFields",function(n,s){a.warningUnhooked();var i,o;Array.isArray(n)||typeof n=="string"||typeof s=="string"?(i=n,o=s):o=n;var c=!!i,d=c?i.map(Ht):[],m=[],u=String(Date.now()),x=new Set,h=o||{},f=h.recursive,g=h.dirty;a.getFieldEntities(!0).forEach(function(y){if(c||d.push(y.getNamePath()),!(!y.props.rules||!y.props.rules.length)&&!(g&&!y.isFieldDirty())){var j=y.getNamePath();if(x.add(j.join(u)),!c||os(d,j,f)){var S=y.validateRules(X({validateMessages:X(X({},Xb),a.validateMessages)},o));m.push(S.then(function(){return{name:j,errors:[],warnings:[]}}).catch(function(N){var w,_=[],P=[];return(w=N.forEach)===null||w===void 0||w.call(N,function(O){var T=O.rule.warningOnly,k=O.errors;T?P.push.apply(P,Fe(k)):_.push.apply(_,Fe(k))}),_.length?Promise.reject({name:j,errors:_,warnings:P}):{name:j,errors:_,warnings:P}}))}}});var b=fA(m);a.lastValidatePromise=b,b.catch(function(y){return y}).then(function(y){var j=y.map(function(S){var N=S.name;return N});a.notifyObservers(a.store,j,{type:"validateFinish"}),a.triggerOnFieldsChange(j,y)});var p=b.then(function(){return a.lastValidatePromise===b?Promise.resolve(a.getFieldsValue(d)):Promise.reject([])}).catch(function(y){var j=y.filter(function(S){return S&&S.errors.length});return Promise.reject({values:a.getFieldsValue(d),errorFields:j,outOfDate:a.lastValidatePromise!==b})});p.catch(function(y){return y});var v=d.filter(function(y){return x.has(y.join(u))});return a.triggerOnFieldsChange(v),p}),G(this,"submit",function(){a.warningUnhooked(),a.validateFields().then(function(n){var s=a.callbacks.onFinish;if(s)try{s(n)}catch(i){console.error(i)}}).catch(function(n){var s=a.callbacks.onFinishFailed;s&&s(n)})}),this.forceRootUpdate=r});function Zb(t){var r=l.useRef(),a=l.useState({}),n=he(a,2),s=n[1];if(!r.current)if(t)r.current=t;else{var i=function(){s({})},o=new pA(i);r.current=o.getForm()}return[r.current]}var Ud=l.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),bA=function(r){var a=r.validateMessages,n=r.onFormChange,s=r.onFormFinish,i=r.children,o=l.useContext(Ud),c=l.useRef({});return l.createElement(Ud.Provider,{value:X(X({},o),{},{validateMessages:X(X({},o.validateMessages),a),triggerFormChange:function(m,u){n&&n(m,{changedFields:u,forms:c.current}),o.triggerFormChange(m,u)},triggerFormFinish:function(m,u){s&&s(m,{values:u,forms:c.current}),o.triggerFormFinish(m,u)},registerForm:function(m,u){m&&(c.current=X(X({},c.current),{},G({},m,u))),o.registerForm(m,u)},unregisterForm:function(m){var u=X({},c.current);delete u[m],c.current=u,o.unregisterForm(m)}})},i)},vA=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],yA=function(r,a){var n=r.name,s=r.initialValues,i=r.fields,o=r.form,c=r.preserve,d=r.children,m=r.component,u=m===void 0?"form":m,x=r.validateMessages,h=r.validateTrigger,f=h===void 0?"onChange":h,g=r.onValuesChange,b=r.onFieldsChange,p=r.onFinish,v=r.onFinishFailed,y=r.clearOnDestroy,j=bt(r,vA),S=l.useRef(null),N=l.useContext(Ud),w=Zb(o),_=he(w,1),P=_[0],O=P.getInternalHooks(Nn),T=O.useSubscribe,k=O.setInitialValues,$=O.setCallbacks,C=O.setValidateMessages,A=O.setPreserve,E=O.destroyForm;l.useImperativeHandle(a,function(){return X(X({},P),{},{nativeElement:S.current})}),l.useEffect(function(){return N.registerForm(n,P),function(){N.unregisterForm(n)}},[N,P,n]),C(X(X({},N.validateMessages),x)),$({onValuesChange:g,onFieldsChange:function(W){if(N.triggerFormChange(n,W),b){for(var le=arguments.length,U=new Array(le>1?le-1:0),ee=1;ee<le;ee++)U[ee-1]=arguments[ee];b.apply(void 0,[W].concat(U))}},onFinish:function(W){N.triggerFormFinish(n,W),p&&p(W)},onFinishFailed:v}),A(c);var L=l.useRef(null);k(s,!L.current),L.current||(L.current=!0),l.useEffect(function(){return function(){return E(y)}},[]);var F,D=typeof d=="function";if(D){var q=P.getFieldsValue(!0);F=d(q,P)}else F=d;T(!D);var Q=l.useRef();l.useEffect(function(){uA(Q.current||[],i||[])||P.setFields(i||[]),Q.current=i},[i,P]);var de=l.useMemo(function(){return X(X({},P),{},{validateTrigger:f})},[P,f]),H=l.createElement(qo.Provider,{value:null},l.createElement(ks.Provider,{value:de},F));return u===!1?H:l.createElement(u,Ve({},j,{ref:S,onSubmit:function(W){W.preventDefault(),W.stopPropagation(),P.submit()},onReset:function(W){var le;W.preventDefault(),P.resetFields(),(le=j.onReset)===null||le===void 0||le.call(j,W)}}),H)};function Ah(t){try{return JSON.stringify(t)}catch{return Math.random()}}function jA(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];var n=r[0],s=r[1],i=s===void 0?{}:s,o=$6(i)?{form:i}:i,c=o.form,d=l.useState(),m=he(d,2),u=m[0],x=m[1],h=l.useMemo(function(){return Ah(u)},[u]),f=l.useRef(h);f.current=h;var g=l.useContext(ks),b=c||g,p=b&&b._init,v=Ht(n),y=l.useRef(v);return y.current=v,l.useEffect(function(){if(p){var j=b.getFieldsValue,S=b.getInternalHooks,N=S(Nn),w=N.registerWatch,_=function(k,$){var C=o.preserve?$:k;return typeof n=="function"?n(C):wa(C,y.current)},P=w(function(T,k){var $=_(T,k),C=Ah($);f.current!==C&&(f.current=C,x($))}),O=_(j(),j(!0));return u!==O&&x(O),P}},[p]),u}var wA=l.forwardRef(yA),Ti=wA;Ti.FormProvider=bA;Ti.Field=Jb;Ti.List=hA;Ti.useForm=Zb;Ti.useWatch=jA;const Oh=l.createContext({}),NA=({children:t,status:r,override:a})=>{const n=l.useContext(Oh),s=l.useMemo(()=>{const i=Object.assign({},n);return a&&delete i.isFormItemInput,r&&(delete i.status,delete i.hasFeedback,delete i.feedbackIcon),i},[r,a,n]);return l.createElement(Oh.Provider,{value:s},t)},SA=l.createContext(void 0),CA=t=>{const{space:r,form:a,children:n}=t;if(n==null)return null;let s=n;return a&&(s=me.createElement(NA,{override:!0,status:!0},s)),r&&(s=me.createElement(Q$,null,s)),s},_A=()=>Ir()&&window.document.documentElement,Ml=t=>{const{prefixCls:r,className:a,style:n,size:s,shape:i}=t,o=_e({[`${r}-lg`]:s==="large",[`${r}-sm`]:s==="small"}),c=_e({[`${r}-circle`]:i==="circle",[`${r}-square`]:i==="square",[`${r}-round`]:i==="round"}),d=l.useMemo(()=>typeof s=="number"?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return l.createElement("span",{className:_e(r,o,c,a),style:Object.assign(Object.assign({},d),n)})},kA=new Lt("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),Rl=t=>({height:t,lineHeight:we(t)}),ls=t=>Object.assign({width:t},Rl(t)),PA=t=>({background:t.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:kA,animationDuration:t.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),vc=(t,r)=>Object.assign({width:r(t).mul(5).equal(),minWidth:r(t).mul(5).equal()},Rl(t)),$A=t=>{const{skeletonAvatarCls:r,gradientFromColor:a,controlHeight:n,controlHeightLG:s,controlHeightSM:i}=t;return{[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:a},ls(n)),[`${r}${r}-circle`]:{borderRadius:"50%"},[`${r}${r}-lg`]:Object.assign({},ls(s)),[`${r}${r}-sm`]:Object.assign({},ls(i))}},EA=t=>{const{controlHeight:r,borderRadiusSM:a,skeletonInputCls:n,controlHeightLG:s,controlHeightSM:i,gradientFromColor:o,calc:c}=t;return{[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:o,borderRadius:a},vc(r,c)),[`${n}-lg`]:Object.assign({},vc(s,c)),[`${n}-sm`]:Object.assign({},vc(i,c))}},Ih=t=>Object.assign({width:t},Rl(t)),AA=t=>{const{skeletonImageCls:r,imageSizeBase:a,gradientFromColor:n,borderRadiusSM:s,calc:i}=t;return{[r]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:n,borderRadius:s},Ih(i(a).mul(2).equal())),{[`${r}-path`]:{fill:"#bfbfbf"},[`${r}-svg`]:Object.assign(Object.assign({},Ih(a)),{maxWidth:i(a).mul(4).equal(),maxHeight:i(a).mul(4).equal()}),[`${r}-svg${r}-svg-circle`]:{borderRadius:"50%"}}),[`${r}${r}-circle`]:{borderRadius:"50%"}}},yc=(t,r,a)=>{const{skeletonButtonCls:n}=t;return{[`${a}${n}-circle`]:{width:r,minWidth:r,borderRadius:"50%"},[`${a}${n}-round`]:{borderRadius:r}}},jc=(t,r)=>Object.assign({width:r(t).mul(2).equal(),minWidth:r(t).mul(2).equal()},Rl(t)),OA=t=>{const{borderRadiusSM:r,skeletonButtonCls:a,controlHeight:n,controlHeightLG:s,controlHeightSM:i,gradientFromColor:o,calc:c}=t;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:o,borderRadius:r,width:c(n).mul(2).equal(),minWidth:c(n).mul(2).equal()},jc(n,c))},yc(t,n,a)),{[`${a}-lg`]:Object.assign({},jc(s,c))}),yc(t,s,`${a}-lg`)),{[`${a}-sm`]:Object.assign({},jc(i,c))}),yc(t,i,`${a}-sm`))},IA=t=>{const{componentCls:r,skeletonAvatarCls:a,skeletonTitleCls:n,skeletonParagraphCls:s,skeletonButtonCls:i,skeletonInputCls:o,skeletonImageCls:c,controlHeight:d,controlHeightLG:m,controlHeightSM:u,gradientFromColor:x,padding:h,marginSM:f,borderRadius:g,titleHeight:b,blockRadius:p,paragraphLiHeight:v,controlHeightXS:y,paragraphMarginTop:j}=t;return{[r]:{display:"table",width:"100%",[`${r}-header`]:{display:"table-cell",paddingInlineEnd:h,verticalAlign:"top",[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:x},ls(d)),[`${a}-circle`]:{borderRadius:"50%"},[`${a}-lg`]:Object.assign({},ls(m)),[`${a}-sm`]:Object.assign({},ls(u))},[`${r}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[n]:{width:"100%",height:b,background:x,borderRadius:p,[`+ ${s}`]:{marginBlockStart:u}},[s]:{padding:0,"> li":{width:"100%",height:v,listStyle:"none",background:x,borderRadius:p,"+ li":{marginBlockStart:y}}},[`${s}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${r}-content`]:{[`${n}, ${s} > li`]:{borderRadius:g}}},[`${r}-with-avatar ${r}-content`]:{[n]:{marginBlockStart:f,[`+ ${s}`]:{marginBlockStart:j}}},[`${r}${r}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},OA(t)),$A(t)),EA(t)),AA(t)),[`${r}${r}-block`]:{width:"100%",[i]:{width:"100%"},[o]:{width:"100%"}},[`${r}${r}-active`]:{[`
        ${n},
        ${s} > li,
        ${a},
        ${i},
        ${o},
        ${c}
      `]:Object.assign({},PA(t))}}},TA=t=>{const{colorFillContent:r,colorFill:a}=t,n=r,s=a;return{color:n,colorGradientEnd:s,gradientFromColor:n,gradientToColor:s,titleHeight:t.controlHeight/2,blockRadius:t.borderRadiusSM,paragraphMarginTop:t.marginLG+t.marginXXS,paragraphLiHeight:t.controlHeight/2}},Ms=Ln("Skeleton",t=>{const{componentCls:r,calc:a}=t,n=ua(t,{skeletonAvatarCls:`${r}-avatar`,skeletonTitleCls:`${r}-title`,skeletonParagraphCls:`${r}-paragraph`,skeletonButtonCls:`${r}-button`,skeletonInputCls:`${r}-input`,skeletonImageCls:`${r}-image`,imageSizeBase:a(t.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${t.gradientFromColor} 25%, ${t.gradientToColor} 37%, ${t.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"});return IA(n)},TA,{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),MA=t=>{const{prefixCls:r,className:a,rootClassName:n,active:s,shape:i="circle",size:o="default"}=t,{getPrefixCls:c}=l.useContext(It),d=c("skeleton",r),[m,u,x]=Ms(d),h=xn(t,["prefixCls","className"]),f=_e(d,`${d}-element`,{[`${d}-active`]:s},a,n,u,x);return m(l.createElement("div",{className:f},l.createElement(Ml,Object.assign({prefixCls:`${d}-avatar`,shape:i,size:o},h))))},RA=t=>{const{prefixCls:r,className:a,rootClassName:n,active:s,block:i=!1,size:o="default"}=t,{getPrefixCls:c}=l.useContext(It),d=c("skeleton",r),[m,u,x]=Ms(d),h=xn(t,["prefixCls"]),f=_e(d,`${d}-element`,{[`${d}-active`]:s,[`${d}-block`]:i},a,n,u,x);return m(l.createElement("div",{className:f},l.createElement(Ml,Object.assign({prefixCls:`${d}-button`,size:o},h))))},LA="M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",DA=t=>{const{prefixCls:r,className:a,rootClassName:n,style:s,active:i}=t,{getPrefixCls:o}=l.useContext(It),c=o("skeleton",r),[d,m,u]=Ms(c),x=_e(c,`${c}-element`,{[`${c}-active`]:i},a,n,m,u);return d(l.createElement("div",{className:x},l.createElement("div",{className:_e(`${c}-image`,a),style:s},l.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},l.createElement("title",null,"Image placeholder"),l.createElement("path",{d:LA,className:`${c}-image-path`})))))},zA=t=>{const{prefixCls:r,className:a,rootClassName:n,active:s,block:i,size:o="default"}=t,{getPrefixCls:c}=l.useContext(It),d=c("skeleton",r),[m,u,x]=Ms(d),h=xn(t,["prefixCls"]),f=_e(d,`${d}-element`,{[`${d}-active`]:s,[`${d}-block`]:i},a,n,u,x);return m(l.createElement("div",{className:f},l.createElement(Ml,Object.assign({prefixCls:`${d}-input`,size:o},h))))},FA=t=>{const{prefixCls:r,className:a,rootClassName:n,style:s,active:i,children:o}=t,{getPrefixCls:c}=l.useContext(It),d=c("skeleton",r),[m,u,x]=Ms(d),h=_e(d,`${d}-element`,{[`${d}-active`]:i},u,a,n,x);return m(l.createElement("div",{className:h},l.createElement("div",{className:_e(`${d}-image`,a),style:s},o)))},BA=(t,r)=>{const{width:a,rows:n=2}=r;if(Array.isArray(a))return a[t];if(n-1===t)return a},HA=t=>{const{prefixCls:r,className:a,style:n,rows:s=0}=t,i=Array.from({length:s}).map((o,c)=>l.createElement("li",{key:c,style:{width:BA(c,t)}}));return l.createElement("ul",{className:_e(r,a),style:n},i)},WA=({prefixCls:t,className:r,width:a,style:n})=>l.createElement("h3",{className:_e(t,r),style:Object.assign({width:a},n)});function wc(t){return t&&typeof t=="object"?t:{}}function UA(t,r){return t&&!r?{size:"large",shape:"square"}:{size:"large",shape:"circle"}}function VA(t,r){return!t&&r?{width:"38%"}:t&&r?{width:"50%"}:{}}function GA(t,r){const a={};return(!t||!r)&&(a.width="61%"),!t&&r?a.rows=3:a.rows=2,a}const Dn=t=>{const{prefixCls:r,loading:a,className:n,rootClassName:s,style:i,children:o,avatar:c=!1,title:d=!0,paragraph:m=!0,active:u,round:x}=t,{getPrefixCls:h,direction:f,className:g,style:b}=Qp("skeleton"),p=h("skeleton",r),[v,y,j]=Ms(p);if(a||!("loading"in t)){const S=!!c,N=!!d,w=!!m;let _;if(S){const T=Object.assign(Object.assign({prefixCls:`${p}-avatar`},UA(N,w)),wc(c));_=l.createElement("div",{className:`${p}-header`},l.createElement(Ml,Object.assign({},T)))}let P;if(N||w){let T;if(N){const $=Object.assign(Object.assign({prefixCls:`${p}-title`},VA(S,w)),wc(d));T=l.createElement(WA,Object.assign({},$))}let k;if(w){const $=Object.assign(Object.assign({prefixCls:`${p}-paragraph`},GA(S,N)),wc(m));k=l.createElement(HA,Object.assign({},$))}P=l.createElement("div",{className:`${p}-content`},T,k)}const O=_e(p,{[`${p}-with-avatar`]:S,[`${p}-active`]:u,[`${p}-rtl`]:f==="rtl",[`${p}-round`]:x},g,n,s,y,j);return v(l.createElement("div",{className:O,style:Object.assign(Object.assign({},b),i)},_,P))}return o??null};Dn.Button=RA;Dn.Avatar=MA;Dn.Input=zA;Dn.Image=DA;Dn.Node=FA;function Th(){}const KA=l.createContext({add:Th,remove:Th});function qA(t){const r=l.useContext(KA),a=l.useRef(null);return vr(s=>{if(s){const i=t?s.querySelector(t):s;i&&(r.add(i),a.current=i)}else r.remove(a.current)})}const Mh=()=>{const{cancelButtonProps:t,cancelTextLocale:r,onCancel:a}=l.useContext(Oi);return me.createElement(nn,Object.assign({onClick:a},t),r)},Rh=()=>{const{confirmLoading:t,okButtonProps:r,okType:a,okTextLocale:n,onOk:s}=l.useContext(Oi);return me.createElement(nn,Object.assign({},Mb(a),{loading:t,onClick:s},r),n)};function ev(t,r){return me.createElement("span",{className:`${t}-close-x`},r||me.createElement(kl,{className:`${t}-close-icon`}))}const tv=t=>{const{okText:r,okType:a="primary",cancelText:n,confirmLoading:s,onOk:i,onCancel:o,okButtonProps:c,cancelButtonProps:d,footer:m}=t,[u]=Nl("Modal",Gp()),x=r||(u==null?void 0:u.okText),h=n||(u==null?void 0:u.cancelText),f=me.useMemo(()=>({confirmLoading:s,okButtonProps:c,cancelButtonProps:d,okTextLocale:x,cancelTextLocale:h,okType:a,onOk:i,onCancel:o}),[s,c,d,x,h,a,i,o]);let g;return typeof m=="function"||typeof m>"u"?(g=me.createElement(me.Fragment,null,me.createElement(Mh,null),me.createElement(Rh,null)),typeof m=="function"&&(g=m(g,{OkBtn:Rh,CancelBtn:Mh})),g=me.createElement(Bb,{value:f},g)):g=m,me.createElement(Zp,{disabled:!1},g)},XA=t=>{const{componentCls:r}=t;return{[r]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},YA=t=>{const{componentCls:r}=t;return{[r]:{position:"relative",maxWidth:"100%",minHeight:1}}},JA=(t,r)=>{const{prefixCls:a,componentCls:n,gridColumns:s}=t,i={};for(let o=s;o>=0;o--)o===0?(i[`${n}${r}-${o}`]={display:"none"},i[`${n}-push-${o}`]={insetInlineStart:"auto"},i[`${n}-pull-${o}`]={insetInlineEnd:"auto"},i[`${n}${r}-push-${o}`]={insetInlineStart:"auto"},i[`${n}${r}-pull-${o}`]={insetInlineEnd:"auto"},i[`${n}${r}-offset-${o}`]={marginInlineStart:0},i[`${n}${r}-order-${o}`]={order:0}):(i[`${n}${r}-${o}`]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:`0 0 ${o/s*100}%`,maxWidth:`${o/s*100}%`}],i[`${n}${r}-push-${o}`]={insetInlineStart:`${o/s*100}%`},i[`${n}${r}-pull-${o}`]={insetInlineEnd:`${o/s*100}%`},i[`${n}${r}-offset-${o}`]={marginInlineStart:`${o/s*100}%`},i[`${n}${r}-order-${o}`]={order:o});return i[`${n}${r}-flex`]={flex:`var(--${a}${r}-flex)`},i},Vd=(t,r)=>JA(t,r),QA=(t,r,a)=>({[`@media (min-width: ${we(r)})`]:Object.assign({},Vd(t,a))}),ZA=()=>({}),eO=()=>({});Ln("Grid",XA,ZA);const rv=t=>({xs:t.screenXSMin,sm:t.screenSMMin,md:t.screenMDMin,lg:t.screenLGMin,xl:t.screenXLMin,xxl:t.screenXXLMin});Ln("Grid",t=>{const r=ua(t,{gridColumns:24}),a=rv(r);return delete a.xs,[YA(r),Vd(r,""),Vd(r,"-xs"),Object.keys(a).map(n=>QA(r,a[n],`-${n}`)).reduce((n,s)=>Object.assign(Object.assign({},n),s),{})]},eO);function Lh(t){return{position:t,inset:0}}const tO=t=>{const{componentCls:r,antCls:a}=t;return[{[`${r}-root`]:{[`${r}${a}-zoom-enter, ${r}${a}-zoom-appear`]:{transform:"none",opacity:0,animationDuration:t.motionDurationSlow,userSelect:"none"},[`${r}${a}-zoom-leave ${r}-content`]:{pointerEvents:"none"},[`${r}-mask`]:Object.assign(Object.assign({},Lh("fixed")),{zIndex:t.zIndexPopupBase,height:"100%",backgroundColor:t.colorBgMask,pointerEvents:"none",[`${r}-hidden`]:{display:"none"}}),[`${r}-wrap`]:Object.assign(Object.assign({},Lh("fixed")),{zIndex:t.zIndexPopupBase,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"})}},{[`${r}-root`]:gE(t)}]},rO=t=>{const{componentCls:r}=t;return[{[`${r}-root`]:{[`${r}-wrap-rtl`]:{direction:"rtl"},[`${r}-centered`]:{textAlign:"center","&::before":{display:"inline-block",width:0,height:"100%",verticalAlign:"middle",content:'""'},[r]:{top:0,display:"inline-block",paddingBottom:0,textAlign:"start",verticalAlign:"middle"}},[`@media (max-width: ${t.screenSMMax}px)`]:{[r]:{maxWidth:"calc(100vw - 16px)",margin:`${we(t.marginXS)} auto`},[`${r}-centered`]:{[r]:{flex:1}}}}},{[r]:Object.assign(Object.assign({},Cl(t)),{pointerEvents:"none",position:"relative",top:100,width:"auto",maxWidth:`calc(100vw - ${we(t.calc(t.margin).mul(2).equal())})`,margin:"0 auto",paddingBottom:t.paddingLG,[`${r}-title`]:{margin:0,color:t.titleColor,fontWeight:t.fontWeightStrong,fontSize:t.titleFontSize,lineHeight:t.titleLineHeight,wordWrap:"break-word"},[`${r}-content`]:{position:"relative",backgroundColor:t.contentBg,backgroundClip:"padding-box",border:0,borderRadius:t.borderRadiusLG,boxShadow:t.boxShadow,pointerEvents:"auto",padding:t.contentPadding},[`${r}-close`]:Object.assign({position:"absolute",top:t.calc(t.modalHeaderHeight).sub(t.modalCloseBtnSize).div(2).equal(),insetInlineEnd:t.calc(t.modalHeaderHeight).sub(t.modalCloseBtnSize).div(2).equal(),zIndex:t.calc(t.zIndexPopupBase).add(10).equal(),padding:0,color:t.modalCloseIconColor,fontWeight:t.fontWeightStrong,lineHeight:1,textDecoration:"none",background:"transparent",borderRadius:t.borderRadiusSM,width:t.modalCloseBtnSize,height:t.modalCloseBtnSize,border:0,outline:0,cursor:"pointer",transition:`color ${t.motionDurationMid}, background-color ${t.motionDurationMid}`,"&-x":{display:"flex",fontSize:t.fontSizeLG,fontStyle:"normal",lineHeight:we(t.modalCloseBtnSize),justifyContent:"center",textTransform:"none",textRendering:"auto"},"&:disabled":{pointerEvents:"none"},"&:hover":{color:t.modalCloseIconHoverColor,backgroundColor:t.colorBgTextHover,textDecoration:"none"},"&:active":{backgroundColor:t.colorBgTextActive}},vi(t)),[`${r}-header`]:{color:t.colorText,background:t.headerBg,borderRadius:`${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0 0`,marginBottom:t.headerMarginBottom,padding:t.headerPadding,borderBottom:t.headerBorderBottom},[`${r}-body`]:{fontSize:t.fontSize,lineHeight:t.lineHeight,wordWrap:"break-word",padding:t.bodyPadding,[`${r}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",margin:`${we(t.margin)} auto`}},[`${r}-footer`]:{textAlign:"end",background:t.footerBg,marginTop:t.footerMarginTop,padding:t.footerPadding,borderTop:t.footerBorderTop,borderRadius:t.footerBorderRadius,[`> ${t.antCls}-btn + ${t.antCls}-btn`]:{marginInlineStart:t.marginXS}},[`${r}-open`]:{overflow:"hidden"}})},{[`${r}-pure-panel`]:{top:"auto",padding:0,display:"flex",flexDirection:"column",[`${r}-content,
          ${r}-body,
          ${r}-confirm-body-wrapper`]:{display:"flex",flexDirection:"column",flex:"auto"},[`${r}-confirm-body`]:{marginBottom:"auto"}}}]},aO=t=>{const{componentCls:r}=t;return{[`${r}-root`]:{[`${r}-wrap-rtl`]:{direction:"rtl",[`${r}-confirm-body`]:{direction:"rtl"}}}}},nO=t=>{const{componentCls:r}=t,a=rv(t),n=Object.assign({},a);delete n.xs;const s=`--${r.replace(".","")}-`,i=Object.keys(n).map(o=>({[`@media (min-width: ${we(n[o])})`]:{width:`var(${s}${o}-width)`}}));return{[`${r}-root`]:{[r]:[].concat(Fe(Object.keys(a).map((o,c)=>{const d=Object.keys(a)[c-1];return d?{[`${s}${o}-width`]:`var(${s}${d}-width)`}:null})),[{width:`var(${s}xs-width)`}],Fe(i))}}},av=t=>{const r=t.padding,a=t.fontSizeHeading5,n=t.lineHeightHeading5;return ua(t,{modalHeaderHeight:t.calc(t.calc(n).mul(a).equal()).add(t.calc(r).mul(2).equal()).equal(),modalFooterBorderColorSplit:t.colorSplit,modalFooterBorderStyle:t.lineType,modalFooterBorderWidth:t.lineWidth,modalCloseIconColor:t.colorIcon,modalCloseIconHoverColor:t.colorIconHover,modalCloseBtnSize:t.controlHeight,modalConfirmIconSize:t.fontHeight,modalTitleHeight:t.calc(t.titleFontSize).mul(t.titleLineHeight).equal()})},nv=t=>({footerBg:"transparent",headerBg:t.colorBgElevated,titleLineHeight:t.lineHeightHeading5,titleFontSize:t.fontSizeHeading5,contentBg:t.colorBgElevated,titleColor:t.colorTextHeading,contentPadding:t.wireframe?0:`${we(t.paddingMD)} ${we(t.paddingContentHorizontalLG)}`,headerPadding:t.wireframe?`${we(t.padding)} ${we(t.paddingLG)}`:0,headerBorderBottom:t.wireframe?`${we(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",headerMarginBottom:t.wireframe?0:t.marginXS,bodyPadding:t.wireframe?t.paddingLG:0,footerPadding:t.wireframe?`${we(t.paddingXS)} ${we(t.padding)}`:0,footerBorderTop:t.wireframe?`${we(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",footerBorderRadius:t.wireframe?`0 0 ${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)}`:0,footerMarginTop:t.wireframe?0:t.marginSM,confirmBodyPadding:t.wireframe?`${we(t.padding*2)} ${we(t.padding*2)} ${we(t.paddingLG)}`:0,confirmIconMarginInlineEnd:t.wireframe?t.margin:t.marginSM,confirmBtnsMarginTop:t.wireframe?t.marginLG:t.marginSM}),sv=Ln("Modal",t=>{const r=av(t);return[rO(r),aO(r),tO(r),LE(r,"zoom"),nO(r)]},nv,{unitless:{titleLineHeight:!0}});var sO=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};let Gd;const iO=t=>{Gd={x:t.pageX,y:t.pageY},setTimeout(()=>{Gd=null},100)};_A()&&document.documentElement.addEventListener("click",iO,!0);const iv=t=>{const{prefixCls:r,className:a,rootClassName:n,open:s,wrapClassName:i,centered:o,getContainer:c,focusTriggerAfterClose:d=!0,style:m,visible:u,width:x=520,footer:h,classNames:f,styles:g,children:b,loading:p,confirmLoading:v,zIndex:y,mousePosition:j,onOk:S,onCancel:N,destroyOnHidden:w,destroyOnClose:_,panelRef:P=null,modalRender:O}=t,T=sO(t,["prefixCls","className","rootClassName","open","wrapClassName","centered","getContainer","focusTriggerAfterClose","style","visible","width","footer","classNames","styles","children","loading","confirmLoading","zIndex","mousePosition","onOk","onCancel","destroyOnHidden","destroyOnClose","panelRef","modalRender"]),{getPopupContainer:k,getPrefixCls:$,direction:C,modal:A}=l.useContext(It),E=ke=>{v||N==null||N(ke)},L=ke=>{S==null||S(ke)},F=$("modal",r),D=$(),q=nm(F),[Q,de,H]=sv(F,q),se=_e(i,{[`${F}-centered`]:o??(A==null?void 0:A.centered),[`${F}-wrap-rtl`]:C==="rtl"}),W=h!==null&&!p?l.createElement(tv,Object.assign({},t,{onOk:L,onCancel:E})):null,[le,U,ee,ae]=N$(rh(t),rh(A),{closable:!0,closeIcon:l.createElement(kl,{className:`${F}-close-icon`}),closeIconRender:ke=>ev(F,ke)}),ue=O?ke=>l.createElement("div",{className:`${F}-render`},O(ke)):void 0,fe=`.${F}-${O?"render":"content"}`,re=qA(fe),V=Tn(P,re),[ce,Z]=$$("Modal",y),[xe,pe]=l.useMemo(()=>x&&typeof x=="object"?[void 0,x]:[x,void 0],[x]),Se=l.useMemo(()=>{const ke={};return pe&&Object.keys(pe).forEach($e=>{const K=pe[$e];K!==void 0&&(ke[`--${F}-${$e}-width`]=typeof K=="number"?`${K}px`:K)}),ke},[F,pe]);return Q(l.createElement(CA,{form:!0,space:!0},l.createElement(kb.Provider,{value:Z},l.createElement(Kb,Object.assign({width:xe},T,{zIndex:ce,getContainer:c===void 0?k:c,prefixCls:F,rootClassName:_e(de,n,H,q),footer:W,visible:s??u,mousePosition:j??Gd,onClose:E,closable:le&&Object.assign({disabled:ee,closeIcon:U},ae),closeIcon:U,focusTriggerAfterClose:d,transitionName:yi(D,"zoom",t.transitionName),maskTransitionName:yi(D,"fade",t.maskTransitionName),className:_e(de,a,A==null?void 0:A.className),style:Object.assign(Object.assign(Object.assign({},A==null?void 0:A.style),m),Se),classNames:Object.assign(Object.assign(Object.assign({},A==null?void 0:A.classNames),f),{wrapper:_e(se,f==null?void 0:f.wrapper)}),styles:Object.assign(Object.assign({},A==null?void 0:A.styles),g),panelRef:V,destroyOnClose:w??_,modalRender:ue}),p?l.createElement(Dn,{active:!0,title:!1,paragraph:{rows:4},className:`${F}-body-skeleton`}):b))))},oO=t=>{const{componentCls:r,titleFontSize:a,titleLineHeight:n,modalConfirmIconSize:s,fontSize:i,lineHeight:o,modalTitleHeight:c,fontHeight:d,confirmBodyPadding:m}=t,u=`${r}-confirm`;return{[u]:{"&-rtl":{direction:"rtl"},[`${t.antCls}-modal-header`]:{display:"none"},[`${u}-body-wrapper`]:Object.assign({},_l()),[`&${r} ${r}-body`]:{padding:m},[`${u}-body`]:{display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t.iconCls}`]:{flex:"none",fontSize:s,marginInlineEnd:t.confirmIconMarginInlineEnd,marginTop:t.calc(t.calc(d).sub(s).equal()).div(2).equal()},[`&-has-title > ${t.iconCls}`]:{marginTop:t.calc(t.calc(c).sub(s).equal()).div(2).equal()}},[`${u}-paragraph`]:{display:"flex",flexDirection:"column",flex:"auto",rowGap:t.marginXS,maxWidth:`calc(100% - ${we(t.marginSM)})`},[`${t.iconCls} + ${u}-paragraph`]:{maxWidth:`calc(100% - ${we(t.calc(t.modalConfirmIconSize).add(t.marginSM).equal())})`},[`${u}-title`]:{color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:a,lineHeight:n},[`${u}-content`]:{color:t.colorText,fontSize:i,lineHeight:o},[`${u}-btns`]:{textAlign:"end",marginTop:t.confirmBtnsMarginTop,[`${t.antCls}-btn + ${t.antCls}-btn`]:{marginBottom:0,marginInlineStart:t.marginXS}}},[`${u}-error ${u}-body > ${t.iconCls}`]:{color:t.colorError},[`${u}-warning ${u}-body > ${t.iconCls},
        ${u}-confirm ${u}-body > ${t.iconCls}`]:{color:t.colorWarning},[`${u}-info ${u}-body > ${t.iconCls}`]:{color:t.colorInfo},[`${u}-success ${u}-body > ${t.iconCls}`]:{color:t.colorSuccess}}},lO=lb(["Modal","confirm"],t=>{const r=av(t);return oO(r)},nv,{order:-1e3});var cO=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const ov=t=>{const{prefixCls:r,icon:a,okText:n,cancelText:s,confirmPrefixCls:i,type:o,okCancel:c,footer:d,locale:m}=t,u=cO(t,["prefixCls","icon","okText","cancelText","confirmPrefixCls","type","okCancel","footer","locale"]);let x=a;if(!a&&a!==null)switch(o){case"info":x=l.createElement(u$,null);break;case"success":x=l.createElement(e$,null);break;case"error":x=l.createElement(a$,null);break;default:x=l.createElement(l$,null)}const h=c??o==="confirm",f=t.autoFocusButton===null?!1:t.autoFocusButton||"ok",[g]=Nl("Modal"),b=m||g,p=n||(h?b==null?void 0:b.okText:b==null?void 0:b.justOkText),v=s||(b==null?void 0:b.cancelText),y=l.useMemo(()=>Object.assign({autoFocusButton:f,cancelTextLocale:v,okTextLocale:p,mergedOkCancel:h},u),[f,v,p,h,u]),j=l.createElement(l.Fragment,null,l.createElement(xh,null),l.createElement(hh,null)),S=t.title!==void 0&&t.title!==null,N=`${i}-body`;return l.createElement("div",{className:`${i}-body-wrapper`},l.createElement("div",{className:_e(N,{[`${N}-has-title`]:S})},x,l.createElement("div",{className:`${i}-paragraph`},S&&l.createElement("span",{className:`${i}-title`},t.title),l.createElement("div",{className:`${i}-content`},t.content))),d===void 0||typeof d=="function"?l.createElement(Bb,{value:y},l.createElement("div",{className:`${i}-btns`},typeof d=="function"?d(j,{OkBtn:hh,CancelBtn:xh}):j)):d,l.createElement(lO,{prefixCls:r}))},dO=t=>{const{close:r,zIndex:a,maskStyle:n,direction:s,prefixCls:i,wrapClassName:o,rootPrefixCls:c,bodyStyle:d,closable:m=!1,onConfirm:u,styles:x,title:h}=t,f=`${i}-confirm`,g=t.width||416,b=t.style||{},p=t.mask===void 0?!0:t.mask,v=t.maskClosable===void 0?!1:t.maskClosable,y=_e(f,`${f}-${t.type}`,{[`${f}-rtl`]:s==="rtl"},t.className),[,j]=un(),S=l.useMemo(()=>a!==void 0?a:j.zIndexPopupBase+_$,[a,j]);return l.createElement(iv,Object.assign({},t,{className:y,wrapClassName:_e({[`${f}-centered`]:!!t.centered},o),onCancel:()=>{r==null||r({triggerCancel:!0}),u==null||u(!1)},title:h,footer:null,transitionName:yi(c||"","zoom",t.transitionName),maskTransitionName:yi(c||"","fade",t.maskTransitionName),mask:p,maskClosable:v,style:b,styles:Object.assign({body:d,mask:n},x),width:g,zIndex:S,closable:m}),l.createElement(ov,Object.assign({},t,{confirmPrefixCls:f})))},lv=t=>{const{rootPrefixCls:r,iconPrefixCls:a,direction:n,theme:s}=t;return l.createElement(mn,{prefixCls:r,iconPrefixCls:a,direction:n,theme:s},l.createElement(dO,Object.assign({},t)))},Sn=[];let cv="";function dv(){return cv}const uO=t=>{var r,a;const{prefixCls:n,getContainer:s,direction:i}=t,o=Gp(),c=l.useContext(It),d=dv()||c.getPrefixCls(),m=n||`${d}-modal`;let u=s;return u===!1&&(u=void 0),me.createElement(lv,Object.assign({},t,{rootPrefixCls:d,prefixCls:m,iconPrefixCls:c.iconPrefixCls,theme:c.theme,direction:i??c.direction,locale:(a=(r=c.locale)===null||r===void 0?void 0:r.Modal)!==null&&a!==void 0?a:o,getContainer:u}))};function Mi(t){const r=FP(),a=document.createDocumentFragment();let n=Object.assign(Object.assign({},t),{close:d,open:!0}),s,i;function o(...u){var x;if(u.some(g=>g==null?void 0:g.triggerCancel)){var f;(x=t.onCancel)===null||x===void 0||(f=x).call.apply(f,[t,()=>{}].concat(Fe(u.slice(1))))}for(let g=0;g<Sn.length;g++)if(Sn[g]===d){Sn.splice(g,1);break}i()}const c=u=>{clearTimeout(s),s=setTimeout(()=>{const x=r.getPrefixCls(void 0,dv()),h=r.getIconPrefixCls(),f=r.getTheme(),g=me.createElement(uO,Object.assign({},u));i=Ab()(me.createElement(mn,{prefixCls:x,iconPrefixCls:h,theme:f},typeof r.holderRender=="function"?r.holderRender(g):g),a)})};function d(...u){n=Object.assign(Object.assign({},n),{open:!1,afterClose:()=>{typeof t.afterClose=="function"&&t.afterClose(),o.apply(this,u)}}),n.visible&&delete n.visible,c(n)}function m(u){typeof u=="function"?n=u(n):n=Object.assign(Object.assign({},n),u),c(n)}return c(n),Sn.push(d),{destroy:d,update:m}}function uv(t){return Object.assign(Object.assign({},t),{type:"warning"})}function mv(t){return Object.assign(Object.assign({},t),{type:"info"})}function xv(t){return Object.assign(Object.assign({},t),{type:"success"})}function hv(t){return Object.assign(Object.assign({},t),{type:"error"})}function fv(t){return Object.assign(Object.assign({},t),{type:"confirm"})}function mO({rootPrefixCls:t}){cv=t}var xO=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const hO=(t,r)=>{var a,{afterClose:n,config:s}=t,i=xO(t,["afterClose","config"]);const[o,c]=l.useState(!0),[d,m]=l.useState(s),{direction:u,getPrefixCls:x}=l.useContext(It),h=x("modal"),f=x(),g=()=>{var y;n(),(y=d.afterClose)===null||y===void 0||y.call(d)},b=(...y)=>{var j;if(c(!1),y.some(w=>w==null?void 0:w.triggerCancel)){var N;(j=d.onCancel)===null||j===void 0||(N=j).call.apply(N,[d,()=>{}].concat(Fe(y.slice(1))))}};l.useImperativeHandle(r,()=>({destroy:b,update:y=>{m(j=>{const S=typeof y=="function"?y(j):y;return Object.assign(Object.assign({},j),S)})}}));const p=(a=d.okCancel)!==null&&a!==void 0?a:d.type==="confirm",[v]=Nl("Modal",dn.Modal);return l.createElement(lv,Object.assign({prefixCls:h,rootPrefixCls:f},d,{close:b,open:o,afterClose:g,okText:d.okText||(p?v==null?void 0:v.okText:v==null?void 0:v.justOkText),direction:d.direction||u,cancelText:d.cancelText||(v==null?void 0:v.cancelText)},i))},fO=l.forwardRef(hO);let Dh=0;const gO=l.memo(l.forwardRef((t,r)=>{const[a,n]=S$();return l.useImperativeHandle(r,()=>({patchElement:n}),[n]),l.createElement(l.Fragment,null,a)}));function pO(){const t=l.useRef(null),[r,a]=l.useState([]);l.useEffect(()=>{r.length&&(Fe(r).forEach(o=>{o()}),a([]))},[r]);const n=l.useCallback(i=>function(c){var d;Dh+=1;const m=l.createRef();let u;const x=new Promise(p=>{u=p});let h=!1,f;const g=l.createElement(fO,{key:`modal-${Dh}`,config:i(c),ref:m,afterClose:()=>{f==null||f()},isSilent:()=>h,onConfirm:p=>{u(p)}});return f=(d=t.current)===null||d===void 0?void 0:d.patchElement(g),f&&Sn.push(f),{destroy:()=>{function p(){var v;(v=m.current)===null||v===void 0||v.destroy()}m.current?p():a(v=>[].concat(Fe(v),[p]))},update:p=>{function v(){var y;(y=m.current)===null||y===void 0||y.update(p)}m.current?v():a(y=>[].concat(Fe(y),[v]))},then:p=>(h=!0,x.then(p))}},[]);return[l.useMemo(()=>({info:n(mv),success:n(xv),error:n(hv),warning:n(uv),confirm:n(fv)}),[n]),l.createElement(gO,{key:"modal-holder",ref:t})]}function bO(t){return r=>l.createElement(mn,{theme:{token:{motion:!1,zIndexPopupBase:0}}},l.createElement(t,Object.assign({},r)))}const gv=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var vO=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],Un=void 0;function yO(t,r){var a=t.prefixCls,n=t.invalidate,s=t.item,i=t.renderItem,o=t.responsive,c=t.responsiveDisabled,d=t.registerSize,m=t.itemKey,u=t.className,x=t.style,h=t.children,f=t.display,g=t.order,b=t.component,p=b===void 0?"div":b,v=bt(t,vO),y=o&&!f;function j(P){d(m,P)}l.useEffect(function(){return function(){j(null)}},[]);var S=i&&s!==Un?i(s,{index:g}):h,N;n||(N={opacity:y?0:1,height:y?0:Un,overflowY:y?"hidden":Un,order:o?g:Un,pointerEvents:y?"none":Un,position:y?"absolute":Un});var w={};y&&(w["aria-hidden"]=!0);var _=l.createElement(p,Ve({className:_e(!n&&a,u),style:X(X({},N),x)},w,v,{ref:r}),S);return o&&(_=l.createElement(an,{onResize:function(O){var T=O.offsetWidth;j(T)},disabled:c},_)),_}var rs=l.forwardRef(yO);rs.displayName="Item";function jO(t){if(typeof MessageChannel>"u")jr(t);else{var r=new MessageChannel;r.port1.onmessage=function(){return t()},r.port2.postMessage(void 0)}}function wO(){var t=l.useRef(null),r=function(n){t.current||(t.current=[],jO(function(){An.unstable_batchedUpdates(function(){t.current.forEach(function(s){s()}),t.current=null})})),t.current.push(n)};return r}function Vn(t,r){var a=l.useState(r),n=he(a,2),s=n[0],i=n[1],o=vr(function(c){t(function(){i(c)})});return[s,o]}var Xo=me.createContext(null),NO=["component"],SO=["className"],CO=["className"],_O=function(r,a){var n=l.useContext(Xo);if(!n){var s=r.component,i=s===void 0?"div":s,o=bt(r,NO);return l.createElement(i,Ve({},o,{ref:a}))}var c=n.className,d=bt(n,SO),m=r.className,u=bt(r,CO);return l.createElement(Xo.Provider,{value:null},l.createElement(rs,Ve({ref:a,className:_e(c,m)},d,u)))},pv=l.forwardRef(_O);pv.displayName="RawItem";var kO=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","prefix","suffix","component","itemComponent","onVisibleChange"],bv="responsive",vv="invalidate";function PO(t){return"+ ".concat(t.length," ...")}function $O(t,r){var a=t.prefixCls,n=a===void 0?"rc-overflow":a,s=t.data,i=s===void 0?[]:s,o=t.renderItem,c=t.renderRawItem,d=t.itemKey,m=t.itemWidth,u=m===void 0?10:m,x=t.ssr,h=t.style,f=t.className,g=t.maxCount,b=t.renderRest,p=t.renderRawRest,v=t.prefix,y=t.suffix,j=t.component,S=j===void 0?"div":j,N=t.itemComponent,w=t.onVisibleChange,_=bt(t,kO),P=x==="full",O=wO(),T=Vn(O,null),k=he(T,2),$=k[0],C=k[1],A=$||0,E=Vn(O,new Map),L=he(E,2),F=L[0],D=L[1],q=Vn(O,0),Q=he(q,2),de=Q[0],H=Q[1],se=Vn(O,0),W=he(se,2),le=W[0],U=W[1],ee=Vn(O,0),ae=he(ee,2),ue=ae[0],fe=ae[1],re=Vn(O,0),V=he(re,2),ce=V[0],Z=V[1],xe=l.useState(null),pe=he(xe,2),Se=pe[0],ke=pe[1],$e=l.useState(null),K=he($e,2),ie=K[0],I=K[1],R=l.useMemo(function(){return ie===null&&P?Number.MAX_SAFE_INTEGER:ie||0},[ie,$]),je=l.useState(!1),Te=he(je,2),Ie=Te[0],tt=Te[1],Ke="".concat(n,"-item"),Be=Math.max(de,le),Ge=g===bv,J=i.length&&Ge,Ae=g===vv,ve=J||typeof g=="number"&&i.length>g,ge=l.useMemo(function(){var Pe=i;return J?$===null&&P?Pe=i:Pe=i.slice(0,Math.min(i.length,A/u)):typeof g=="number"&&(Pe=i.slice(0,g)),Pe},[i,u,$,g,J]),qe=l.useMemo(function(){return J?i.slice(R+1):i.slice(ge.length)},[i,ge,J,R]),Xe=l.useCallback(function(Pe,Me){var Ue;return typeof d=="function"?d(Pe):(Ue=d&&(Pe==null?void 0:Pe[d]))!==null&&Ue!==void 0?Ue:Me},[d]),st=l.useCallback(o||function(Pe){return Pe},[o]);function ht(Pe,Me,Ue){ie===Pe&&(Me===void 0||Me===Se)||(I(Pe),Ue||(tt(Pe<i.length-1),w==null||w(Pe)),Me!==void 0&&ke(Me))}function Ze(Pe,Me){C(Me.clientWidth)}function yt(Pe,Me){D(function(Ue){var Le=new Map(Ue);return Me===null?Le.delete(Pe):Le.set(Pe,Me),Le})}function We(Pe,Me){U(Me),H(le)}function tr(Pe,Me){fe(Me)}function Vt(Pe,Me){Z(Me)}function ct(Pe){return F.get(Xe(ge[Pe],Pe))}ur(function(){if(A&&typeof Be=="number"&&ge){var Pe=ue+ce,Me=ge.length,Ue=Me-1;if(!Me){ht(0,null);return}for(var Le=0;Le<Me;Le+=1){var Re=ct(Le);if(P&&(Re=Re||0),Re===void 0){ht(Le-1,void 0,!0);break}if(Pe+=Re,Ue===0&&Pe<=A||Le===Ue-1&&Pe+ct(Ue)<=A){ht(Ue,null);break}else if(Pe+Be>A){ht(Le-1,Pe-Re-ce+le);break}}y&&ct(0)+ce>A&&ke(null)}},[A,F,le,ue,ce,Xe,ge]);var dt=Ie&&!!qe.length,be={};Se!==null&&J&&(be={position:"absolute",left:Se,top:0});var ye={prefixCls:Ke,responsive:J,component:N,invalidate:Ae},De=c?function(Pe,Me){var Ue=Xe(Pe,Me);return l.createElement(Xo.Provider,{key:Ue,value:X(X({},ye),{},{order:Me,item:Pe,itemKey:Ue,registerSize:yt,display:Me<=R})},c(Pe,Me))}:function(Pe,Me){var Ue=Xe(Pe,Me);return l.createElement(rs,Ve({},ye,{order:Me,key:Ue,item:Pe,renderItem:st,itemKey:Ue,registerSize:yt,display:Me<=R}))},M={order:dt?R:Number.MAX_SAFE_INTEGER,className:"".concat(Ke,"-rest"),registerSize:We,display:dt},te=b||PO,Ne=p?l.createElement(Xo.Provider,{value:X(X({},ye),M)},p(qe)):l.createElement(rs,Ve({},ye,M),typeof te=="function"?te(qe):te),Ee=l.createElement(S,Ve({className:_e(!Ae&&n,f),style:h,ref:r},_),v&&l.createElement(rs,Ve({},ye,{responsive:Ge,responsiveDisabled:!J,order:-1,className:"".concat(Ke,"-prefix"),registerSize:tr,display:!0}),v),ge.map(De),ve?Ne:null,y&&l.createElement(rs,Ve({},ye,{responsive:Ge,responsiveDisabled:!J,order:R,className:"".concat(Ke,"-suffix"),registerSize:Vt,display:!0,style:be}),y));return Ge?l.createElement(an,{onResize:Ze,disabled:!J},Ee):Ee}var Fa=l.forwardRef($O);Fa.displayName="Overflow";Fa.Item=pv;Fa.RESPONSIVE=bv;Fa.INVALIDATE=vv;function EO(t){var r=t.prefixCls,a=t.align,n=t.arrow,s=t.arrowPos,i=n||{},o=i.className,c=i.content,d=s.x,m=d===void 0?0:d,u=s.y,x=u===void 0?0:u,h=l.useRef();if(!a||!a.points)return null;var f={position:"absolute"};if(a.autoArrow!==!1){var g=a.points[0],b=a.points[1],p=g[0],v=g[1],y=b[0],j=b[1];p===y||!["t","b"].includes(p)?f.top=x:p==="t"?f.top=0:f.bottom=0,v===j||!["l","r"].includes(v)?f.left=m:v==="l"?f.left=0:f.right=0}return l.createElement("div",{ref:h,className:_e("".concat(r,"-arrow"),o),style:f},c)}function AO(t){var r=t.prefixCls,a=t.open,n=t.zIndex,s=t.mask,i=t.motion;return s?l.createElement(Ga,Ve({},i,{motionAppear:!0,visible:a,removeOnLeave:!0}),function(o){var c=o.className;return l.createElement("div",{style:{zIndex:n},className:_e("".concat(r,"-mask"),c)})}):null}var OO=l.memo(function(t){var r=t.children;return r},function(t,r){return r.cache}),IO=l.forwardRef(function(t,r){var a=t.popup,n=t.className,s=t.prefixCls,i=t.style,o=t.target,c=t.onVisibleChanged,d=t.open,m=t.keepDom,u=t.fresh,x=t.onClick,h=t.mask,f=t.arrow,g=t.arrowPos,b=t.align,p=t.motion,v=t.maskMotion,y=t.forceRender,j=t.getPopupContainer,S=t.autoDestroy,N=t.portal,w=t.zIndex,_=t.onMouseEnter,P=t.onMouseLeave,O=t.onPointerEnter,T=t.onPointerDownCapture,k=t.ready,$=t.offsetX,C=t.offsetY,A=t.offsetR,E=t.offsetB,L=t.onAlign,F=t.onPrepare,D=t.stretch,q=t.targetWidth,Q=t.targetHeight,de=typeof a=="function"?a():a,H=d||m,se=(j==null?void 0:j.length)>0,W=l.useState(!j||!se),le=he(W,2),U=le[0],ee=le[1];if(ur(function(){!U&&se&&o&&ee(!0)},[U,se,o]),!U)return null;var ae="auto",ue={left:"-1000vw",top:"-1000vh",right:ae,bottom:ae};if(k||!d){var fe,re=b.points,V=b.dynamicInset||((fe=b._experimental)===null||fe===void 0?void 0:fe.dynamicInset),ce=V&&re[0][1]==="r",Z=V&&re[0][0]==="b";ce?(ue.right=A,ue.left=ae):(ue.left=$,ue.right=ae),Z?(ue.bottom=E,ue.top=ae):(ue.top=C,ue.bottom=ae)}var xe={};return D&&(D.includes("height")&&Q?xe.height=Q:D.includes("minHeight")&&Q&&(xe.minHeight=Q),D.includes("width")&&q?xe.width=q:D.includes("minWidth")&&q&&(xe.minWidth=q)),d||(xe.pointerEvents="none"),l.createElement(N,{open:y||H,getContainer:j&&function(){return j(o)},autoDestroy:S},l.createElement(AO,{prefixCls:s,open:d,zIndex:w,mask:h,motion:v}),l.createElement(an,{onResize:L,disabled:!d},function(pe){return l.createElement(Ga,Ve({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:y,leavedClassName:"".concat(s,"-hidden")},p,{onAppearPrepare:F,onEnterPrepare:F,visible:d,onVisibleChanged:function(ke){var $e;p==null||($e=p.onVisibleChanged)===null||$e===void 0||$e.call(p,ke),c(ke)}}),function(Se,ke){var $e=Se.className,K=Se.style,ie=_e(s,$e,n);return l.createElement("div",{ref:Tn(pe,r,ke),className:ie,style:X(X(X(X({"--arrow-x":"".concat(g.x||0,"px"),"--arrow-y":"".concat(g.y||0,"px")},ue),xe),K),{},{boxSizing:"border-box",zIndex:w},i),onMouseEnter:_,onMouseLeave:P,onPointerEnter:O,onClick:x,onPointerDownCapture:T},f&&l.createElement(EO,{prefixCls:s,arrow:f,arrowPos:g,align:b}),l.createElement(OO,{cache:!d&&!u},de))})}))}),TO=l.forwardRef(function(t,r){var a=t.children,n=t.getTriggerDOMNode,s=Rn(a),i=l.useCallback(function(c){Wu(r,n?n(c):c)},[n]),o=Mn(i,Os(a));return s?l.cloneElement(a,{ref:o}):a}),zh=l.createContext(null);function Fh(t){return t?Array.isArray(t)?t:[t]:[]}function MO(t,r,a,n){return l.useMemo(function(){var s=Fh(a??r),i=Fh(n??r),o=new Set(s),c=new Set(i);return t&&(o.has("hover")&&(o.delete("hover"),o.add("click")),c.has("hover")&&(c.delete("hover"),c.add("click"))),[o,c]},[t,r,a,n])}function RO(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0;return a?t[0]===r[0]:t[0]===r[0]&&t[1]===r[1]}function LO(t,r,a,n){for(var s=a.points,i=Object.keys(t),o=0;o<i.length;o+=1){var c,d=i[o];if(RO((c=t[d])===null||c===void 0?void 0:c.points,s,n))return"".concat(r,"-placement-").concat(d)}return""}function Bh(t,r,a,n){return r||(a?{motionName:"".concat(t,"-").concat(a)}:n?{motionName:n}:null)}function Ri(t){return t.ownerDocument.defaultView}function Kd(t){for(var r=[],a=t==null?void 0:t.parentElement,n=["hidden","scroll","clip","auto"];a;){var s=Ri(a).getComputedStyle(a),i=s.overflowX,o=s.overflowY,c=s.overflow;[i,o,c].some(function(d){return n.includes(d)})&&r.push(a),a=a.parentElement}return r}function wi(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?r:t}function Ks(t){return wi(parseFloat(t),0)}function Hh(t,r){var a=X({},t);return(r||[]).forEach(function(n){if(!(n instanceof HTMLBodyElement||n instanceof HTMLHtmlElement)){var s=Ri(n).getComputedStyle(n),i=s.overflow,o=s.overflowClipMargin,c=s.borderTopWidth,d=s.borderBottomWidth,m=s.borderLeftWidth,u=s.borderRightWidth,x=n.getBoundingClientRect(),h=n.offsetHeight,f=n.clientHeight,g=n.offsetWidth,b=n.clientWidth,p=Ks(c),v=Ks(d),y=Ks(m),j=Ks(u),S=wi(Math.round(x.width/g*1e3)/1e3),N=wi(Math.round(x.height/h*1e3)/1e3),w=(g-b-y-j)*S,_=(h-f-p-v)*N,P=p*N,O=v*N,T=y*S,k=j*S,$=0,C=0;if(i==="clip"){var A=Ks(o);$=A*S,C=A*N}var E=x.x+T-$,L=x.y+P-C,F=E+x.width+2*$-T-k-w,D=L+x.height+2*C-P-O-_;a.left=Math.max(a.left,E),a.top=Math.max(a.top,L),a.right=Math.min(a.right,F),a.bottom=Math.min(a.bottom,D)}}),a}function Wh(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a="".concat(r),n=a.match(/^(.*)\%$/);return n?t*(parseFloat(n[1])/100):parseFloat(a)}function Uh(t,r){var a=r||[],n=he(a,2),s=n[0],i=n[1];return[Wh(t.width,s),Wh(t.height,i)]}function Vh(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function Gn(t,r){var a=r[0],n=r[1],s,i;return a==="t"?i=t.y:a==="b"?i=t.y+t.height:i=t.y+t.height/2,n==="l"?s=t.x:n==="r"?s=t.x+t.width:s=t.x+t.width/2,{x:s,y:i}}function Ya(t,r){var a={t:"b",b:"t",l:"r",r:"l"};return t.map(function(n,s){return s===r?a[n]||"c":n}).join("")}function DO(t,r,a,n,s,i,o){var c=l.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:s[n]||{}}),d=he(c,2),m=d[0],u=d[1],x=l.useRef(0),h=l.useMemo(function(){return r?Kd(r):[]},[r]),f=l.useRef({}),g=function(){f.current={}};t||g();var b=vr(function(){if(r&&a&&t){let Vr=function(zs,Aa){var Xa=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Te,Fs=H.x+zs,zi=H.y+Aa,Bl=Fs+Z,Hl=zi+ce,Wl=Math.max(Fs,Xa.left),He=Math.max(zi,Xa.top),Je=Math.min(Bl,Xa.right),Tt=Math.min(Hl,Xa.bottom);return Math.max(0,(Je-Wl)*(Tt-He))},Fn=function(){Xt=H.y+te,St=Xt+ce,_t=H.x+M,Gt=_t+Z};var y,j,S,N,w=r,_=w.ownerDocument,P=Ri(w),O=P.getComputedStyle(w),T=O.position,k=w.style.left,$=w.style.top,C=w.style.right,A=w.style.bottom,E=w.style.overflow,L=X(X({},s[n]),i),F=_.createElement("div");(y=w.parentElement)===null||y===void 0||y.appendChild(F),F.style.left="".concat(w.offsetLeft,"px"),F.style.top="".concat(w.offsetTop,"px"),F.style.position=T,F.style.height="".concat(w.offsetHeight,"px"),F.style.width="".concat(w.offsetWidth,"px"),w.style.left="0",w.style.top="0",w.style.right="auto",w.style.bottom="auto",w.style.overflow="hidden";var D;if(Array.isArray(a))D={x:a[0],y:a[1],width:0,height:0};else{var q,Q,de=a.getBoundingClientRect();de.x=(q=de.x)!==null&&q!==void 0?q:de.left,de.y=(Q=de.y)!==null&&Q!==void 0?Q:de.top,D={x:de.x,y:de.y,width:de.width,height:de.height}}var H=w.getBoundingClientRect(),se=P.getComputedStyle(w),W=se.height,le=se.width;H.x=(j=H.x)!==null&&j!==void 0?j:H.left,H.y=(S=H.y)!==null&&S!==void 0?S:H.top;var U=_.documentElement,ee=U.clientWidth,ae=U.clientHeight,ue=U.scrollWidth,fe=U.scrollHeight,re=U.scrollTop,V=U.scrollLeft,ce=H.height,Z=H.width,xe=D.height,pe=D.width,Se={left:0,top:0,right:ee,bottom:ae},ke={left:-V,top:-re,right:ue-V,bottom:fe-re},$e=L.htmlRegion,K="visible",ie="visibleFirst";$e!=="scroll"&&$e!==ie&&($e=K);var I=$e===ie,R=Hh(ke,h),je=Hh(Se,h),Te=$e===K?je:R,Ie=I?je:Te;w.style.left="auto",w.style.top="auto",w.style.right="0",w.style.bottom="0";var tt=w.getBoundingClientRect();w.style.left=k,w.style.top=$,w.style.right=C,w.style.bottom=A,w.style.overflow=E,(N=w.parentElement)===null||N===void 0||N.removeChild(F);var Ke=wi(Math.round(Z/parseFloat(le)*1e3)/1e3),Be=wi(Math.round(ce/parseFloat(W)*1e3)/1e3);if(Ke===0||Be===0||di(a)&&!im(a))return;var Ge=L.offset,J=L.targetOffset,Ae=Uh(H,Ge),ve=he(Ae,2),ge=ve[0],qe=ve[1],Xe=Uh(D,J),st=he(Xe,2),ht=st[0],Ze=st[1];D.x-=ht,D.y-=Ze;var yt=L.points||[],We=he(yt,2),tr=We[0],Vt=We[1],ct=Vh(Vt),dt=Vh(tr),be=Gn(D,ct),ye=Gn(H,dt),De=X({},L),M=be.x-ye.x+ge,te=be.y-ye.y+qe,Ne=Vr(M,te),Ee=Vr(M,te,je),Pe=Gn(D,["t","l"]),Me=Gn(H,["t","l"]),Ue=Gn(D,["b","r"]),Le=Gn(H,["b","r"]),Re=L.overflow||{},ot=Re.adjustX,ut=Re.adjustY,ft=Re.shiftX,gt=Re.shiftY,ir=function(Aa){return typeof Aa=="boolean"?Aa:Aa>=0},Xt,St,_t,Gt;Fn();var B=ir(ut),oe=dt[0]===ct[0];if(B&&dt[0]==="t"&&(St>Ie.bottom||f.current.bt)){var ne=te;oe?ne-=ce-xe:ne=Pe.y-Le.y-qe;var Ce=Vr(M,ne),at=Vr(M,ne,je);Ce>Ne||Ce===Ne&&(!I||at>=Ee)?(f.current.bt=!0,te=ne,qe=-qe,De.points=[Ya(dt,0),Ya(ct,0)]):f.current.bt=!1}if(B&&dt[0]==="b"&&(Xt<Ie.top||f.current.tb)){var ze=te;oe?ze+=ce-xe:ze=Ue.y-Me.y-qe;var Oe=Vr(M,ze),Ye=Vr(M,ze,je);Oe>Ne||Oe===Ne&&(!I||Ye>=Ee)?(f.current.tb=!0,te=ze,qe=-qe,De.points=[Ya(dt,0),Ya(ct,0)]):f.current.tb=!1}var rt=ir(ot),Qe=dt[1]===ct[1];if(rt&&dt[1]==="l"&&(Gt>Ie.right||f.current.rl)){var lt=M;Qe?lt-=Z-pe:lt=Pe.x-Le.x-ge;var Pt=Vr(lt,te),Hr=Vr(lt,te,je);Pt>Ne||Pt===Ne&&(!I||Hr>=Ee)?(f.current.rl=!0,M=lt,ge=-ge,De.points=[Ya(dt,1),Ya(ct,1)]):f.current.rl=!1}if(rt&&dt[1]==="r"&&(_t<Ie.left||f.current.lr)){var Rr=M;Qe?Rr+=Z-pe:Rr=Ue.x-Me.x-ge;var rr=Vr(Rr,te),Ar=Vr(Rr,te,je);rr>Ne||rr===Ne&&(!I||Ar>=Ee)?(f.current.lr=!0,M=Rr,ge=-ge,De.points=[Ya(dt,1),Ya(ct,1)]):f.current.lr=!1}Fn();var ar=ft===!0?0:ft;typeof ar=="number"&&(_t<je.left&&(M-=_t-je.left-ge,D.x+pe<je.left+ar&&(M+=D.x-je.left+pe-ar)),Gt>je.right&&(M-=Gt-je.right-ge,D.x>je.right-ar&&(M+=D.x-je.right+ar)));var Wr=gt===!0?0:gt;typeof Wr=="number"&&(Xt<je.top&&(te-=Xt-je.top-qe,D.y+xe<je.top+Wr&&(te+=D.y-je.top+xe-Wr)),St>je.bottom&&(te-=St-je.bottom-qe,D.y>je.bottom-Wr&&(te+=D.y-je.bottom+Wr)));var Ur=H.x+M,ha=Ur+Z,hn=H.y+te,$t=hn+ce,pt=D.x,wt=pt+pe,nr=D.y,or=nr+xe,Ka=Math.max(Ur,pt),qa=Math.min(ha,wt),Rs=(Ka+qa)/2,zn=Rs-Ur,fn=Math.max(hn,nr),Ea=Math.min($t,or),gn=(fn+Ea)/2,Ls=gn-hn;o==null||o(r,De);var fa=tt.right-H.x-(M+H.width),Ds=tt.bottom-H.y-(te+H.height);Ke===1&&(M=Math.round(M),fa=Math.round(fa)),Be===1&&(te=Math.round(te),Ds=Math.round(Ds));var Fl={ready:!0,offsetX:M/Ke,offsetY:te/Be,offsetR:fa/Ke,offsetB:Ds/Be,arrowX:zn/Ke,arrowY:Ls/Be,scaleX:Ke,scaleY:Be,align:De};u(Fl)}}),p=function(){x.current+=1;var j=x.current;Promise.resolve().then(function(){x.current===j&&b()})},v=function(){u(function(j){return X(X({},j),{},{ready:!1})})};return ur(v,[n]),ur(function(){t||v()},[t]),[m.ready,m.offsetX,m.offsetY,m.offsetR,m.offsetB,m.arrowX,m.arrowY,m.scaleX,m.scaleY,m.align,p]}function zO(t,r,a,n,s){ur(function(){if(t&&r&&a){let x=function(){n(),s()};var i=r,o=a,c=Kd(i),d=Kd(o),m=Ri(o),u=new Set([m].concat(Fe(c),Fe(d)));return u.forEach(function(h){h.addEventListener("scroll",x,{passive:!0})}),m.addEventListener("resize",x,{passive:!0}),n(),function(){u.forEach(function(h){h.removeEventListener("scroll",x),m.removeEventListener("resize",x)})}}},[t,r,a])}function FO(t,r,a,n,s,i,o,c){var d=l.useRef(t);d.current=t;var m=l.useRef(!1);l.useEffect(function(){if(r&&n&&(!s||i)){var x=function(){m.current=!1},h=function(p){var v;d.current&&!o(((v=p.composedPath)===null||v===void 0||(v=v.call(p))===null||v===void 0?void 0:v[0])||p.target)&&!m.current&&c(!1)},f=Ri(n);f.addEventListener("pointerdown",x,!0),f.addEventListener("mousedown",h,!0),f.addEventListener("contextmenu",h,!0);var g=Vo(a);return g&&(g.addEventListener("mousedown",h,!0),g.addEventListener("contextmenu",h,!0)),function(){f.removeEventListener("pointerdown",x,!0),f.removeEventListener("mousedown",h,!0),f.removeEventListener("contextmenu",h,!0),g&&(g.removeEventListener("mousedown",h,!0),g.removeEventListener("contextmenu",h,!0))}}},[r,a,n,s,i]);function u(){m.current=!0}return u}var BO=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function HO(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dm,r=l.forwardRef(function(a,n){var s=a.prefixCls,i=s===void 0?"rc-trigger-popup":s,o=a.children,c=a.action,d=c===void 0?"hover":c,m=a.showAction,u=a.hideAction,x=a.popupVisible,h=a.defaultPopupVisible,f=a.onPopupVisibleChange,g=a.afterPopupVisibleChange,b=a.mouseEnterDelay,p=a.mouseLeaveDelay,v=p===void 0?.1:p,y=a.focusDelay,j=a.blurDelay,S=a.mask,N=a.maskClosable,w=N===void 0?!0:N,_=a.getPopupContainer,P=a.forceRender,O=a.autoDestroy,T=a.destroyPopupOnHide,k=a.popup,$=a.popupClassName,C=a.popupStyle,A=a.popupPlacement,E=a.builtinPlacements,L=E===void 0?{}:E,F=a.popupAlign,D=a.zIndex,q=a.stretch,Q=a.getPopupClassNameFromAlign,de=a.fresh,H=a.alignPoint,se=a.onPopupClick,W=a.onPopupAlign,le=a.arrow,U=a.popupMotion,ee=a.maskMotion,ae=a.popupTransitionName,ue=a.popupAnimation,fe=a.maskTransitionName,re=a.maskAnimation,V=a.className,ce=a.getTriggerDOMNode,Z=bt(a,BO),xe=O||T||!1,pe=l.useState(!1),Se=he(pe,2),ke=Se[0],$e=Se[1];ur(function(){$e(gv())},[]);var K=l.useRef({}),ie=l.useContext(zh),I=l.useMemo(function(){return{registerSubPopup:function(Je,Tt){K.current[Je]=Tt,ie==null||ie.registerSubPopup(Je,Tt)}}},[ie]),R=Ub(),je=l.useState(null),Te=he(je,2),Ie=Te[0],tt=Te[1],Ke=l.useRef(null),Be=vr(function(He){Ke.current=He,di(He)&&Ie!==He&&tt(He),ie==null||ie.registerSubPopup(R,He)}),Ge=l.useState(null),J=he(Ge,2),Ae=J[0],ve=J[1],ge=l.useRef(null),qe=vr(function(He){di(He)&&Ae!==He&&(ve(He),ge.current=He)}),Xe=l.Children.only(o),st=(Xe==null?void 0:Xe.props)||{},ht={},Ze=vr(function(He){var Je,Tt,Yt=Ae;return(Yt==null?void 0:Yt.contains(He))||((Je=Vo(Yt))===null||Je===void 0?void 0:Je.host)===He||He===Yt||(Ie==null?void 0:Ie.contains(He))||((Tt=Vo(Ie))===null||Tt===void 0?void 0:Tt.host)===He||He===Ie||Object.values(K.current).some(function(Dt){return(Dt==null?void 0:Dt.contains(He))||He===Dt})}),yt=Bh(i,U,ue,ae),We=Bh(i,ee,re,fe),tr=l.useState(h||!1),Vt=he(tr,2),ct=Vt[0],dt=Vt[1],be=x??ct,ye=vr(function(He){x===void 0&&dt(He)});ur(function(){dt(x||!1)},[x]);var De=l.useRef(be);De.current=be;var M=l.useRef([]);M.current=[];var te=vr(function(He){var Je;ye(He),((Je=M.current[M.current.length-1])!==null&&Je!==void 0?Je:be)!==He&&(M.current.push(He),f==null||f(He))}),Ne=l.useRef(),Ee=function(){clearTimeout(Ne.current)},Pe=function(Je){var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ee(),Tt===0?te(Je):Ne.current=setTimeout(function(){te(Je)},Tt*1e3)};l.useEffect(function(){return Ee},[]);var Me=l.useState(!1),Ue=he(Me,2),Le=Ue[0],Re=Ue[1];ur(function(He){(!He||be)&&Re(!0)},[be]);var ot=l.useState(null),ut=he(ot,2),ft=ut[0],gt=ut[1],ir=l.useState(null),Xt=he(ir,2),St=Xt[0],_t=Xt[1],Gt=function(Je){_t([Je.clientX,Je.clientY])},B=DO(be,Ie,H&&St!==null?St:Ae,A,L,F,W),oe=he(B,11),ne=oe[0],Ce=oe[1],at=oe[2],ze=oe[3],Oe=oe[4],Ye=oe[5],rt=oe[6],Qe=oe[7],lt=oe[8],Pt=oe[9],Hr=oe[10],Rr=MO(ke,d,m,u),rr=he(Rr,2),Ar=rr[0],ar=rr[1],Wr=Ar.has("click"),Ur=ar.has("click")||ar.has("contextMenu"),ha=vr(function(){Le||Hr()}),hn=function(){De.current&&H&&Ur&&Pe(!1)};zO(be,Ae,Ie,ha,hn),ur(function(){ha()},[St,A]),ur(function(){be&&!(L!=null&&L[A])&&ha()},[JSON.stringify(F)]);var $t=l.useMemo(function(){var He=LO(L,i,Pt,H);return _e(He,Q==null?void 0:Q(Pt))},[Pt,Q,L,i,H]);l.useImperativeHandle(n,function(){return{nativeElement:ge.current,popupElement:Ke.current,forceAlign:ha}});var pt=l.useState(0),wt=he(pt,2),nr=wt[0],or=wt[1],Ka=l.useState(0),qa=he(Ka,2),Rs=qa[0],zn=qa[1],fn=function(){if(q&&Ae){var Je=Ae.getBoundingClientRect();or(Je.width),zn(Je.height)}},Ea=function(){fn(),ha()},gn=function(Je){Re(!1),Hr(),g==null||g(Je)},Ls=function(){return new Promise(function(Je){fn(),gt(function(){return Je})})};ur(function(){ft&&(Hr(),ft(),gt(null))},[ft]);function fa(He,Je,Tt,Yt){ht[He]=function(Dt){var Fi;Yt==null||Yt(Dt),Pe(Je,Tt);for(var Ul=arguments.length,ym=new Array(Ul>1?Ul-1:0),Bi=1;Bi<Ul;Bi++)ym[Bi-1]=arguments[Bi];(Fi=st[He])===null||Fi===void 0||Fi.call.apply(Fi,[st,Dt].concat(ym))}}(Wr||Ur)&&(ht.onClick=function(He){var Je;De.current&&Ur?Pe(!1):!De.current&&Wr&&(Gt(He),Pe(!0));for(var Tt=arguments.length,Yt=new Array(Tt>1?Tt-1:0),Dt=1;Dt<Tt;Dt++)Yt[Dt-1]=arguments[Dt];(Je=st.onClick)===null||Je===void 0||Je.call.apply(Je,[st,He].concat(Yt))});var Ds=FO(be,Ur,Ae,Ie,S,w,Ze,Pe),Fl=Ar.has("hover"),Vr=ar.has("hover"),Fn,zs;Fl&&(fa("onMouseEnter",!0,b,function(He){Gt(He)}),fa("onPointerEnter",!0,b,function(He){Gt(He)}),Fn=function(Je){(be||Le)&&Ie!==null&&Ie!==void 0&&Ie.contains(Je.target)&&Pe(!0,b)},H&&(ht.onMouseMove=function(He){var Je;(Je=st.onMouseMove)===null||Je===void 0||Je.call(st,He)})),Vr&&(fa("onMouseLeave",!1,v),fa("onPointerLeave",!1,v),zs=function(){Pe(!1,v)}),Ar.has("focus")&&fa("onFocus",!0,y),ar.has("focus")&&fa("onBlur",!1,j),Ar.has("contextMenu")&&(ht.onContextMenu=function(He){var Je;De.current&&ar.has("contextMenu")?Pe(!1):(Gt(He),Pe(!0)),He.preventDefault();for(var Tt=arguments.length,Yt=new Array(Tt>1?Tt-1:0),Dt=1;Dt<Tt;Dt++)Yt[Dt-1]=arguments[Dt];(Je=st.onContextMenu)===null||Je===void 0||Je.call.apply(Je,[st,He].concat(Yt))}),V&&(ht.className=_e(st.className,V));var Aa=l.useRef(!1);Aa.current||(Aa.current=P||be||Le);var Xa=X(X({},st),ht),Fs={},zi=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];zi.forEach(function(He){Z[He]&&(Fs[He]=function(){for(var Je,Tt=arguments.length,Yt=new Array(Tt),Dt=0;Dt<Tt;Dt++)Yt[Dt]=arguments[Dt];(Je=Xa[He])===null||Je===void 0||Je.call.apply(Je,[Xa].concat(Yt)),Z[He].apply(Z,Yt)})});var Bl=l.cloneElement(Xe,X(X({},Xa),Fs)),Hl={x:Ye,y:rt},Wl=le?X({},le!==!0?le:{}):null;return l.createElement(l.Fragment,null,l.createElement(an,{disabled:!be,ref:qe,onResize:Ea},l.createElement(TO,{getTriggerDOMNode:ce},Bl)),Aa.current&&l.createElement(zh.Provider,{value:I},l.createElement(IO,{portal:t,ref:Be,prefixCls:i,popup:k,className:_e($,$t),style:C,target:Ae,onMouseEnter:Fn,onMouseLeave:zs,onPointerEnter:Fn,zIndex:D,open:be,keepDom:Le,fresh:de,onClick:se,onPointerDownCapture:Ds,mask:S,motion:yt,maskMotion:We,onVisibleChanged:gn,onPrepare:Ls,forceRender:P,autoDestroy:xe,getPopupContainer:_,align:Pt,arrow:Wl,arrowPos:Hl,ready:ne,offsetX:Ce,offsetY:at,offsetR:ze,offsetB:Oe,onAlign:ha,stretch:q,targetWidth:nr/Qe,targetHeight:Rs/lt})))});return r}const yv=HO(dm),WO=(t,r,a)=>{var n,s;const{variant:i,[t]:o}=l.useContext(It),c=l.useContext(SA),d=o==null?void 0:o.variant;let m;typeof r<"u"?m=r:a===!1?m="borderless":m=(s=(n=c??d)!==null&&n!==void 0?n:i)!==null&&s!==void 0?s:"outlined";const u=M3.includes(m);return[m,u]};var UO=Wt.ESC,VO=Wt.TAB;function GO(t){var r=t.visible,a=t.triggerRef,n=t.onVisibleChange,s=t.autoFocus,i=t.overlayRef,o=l.useRef(!1),c=function(){if(r){var x,h;(x=a.current)===null||x===void 0||(h=x.focus)===null||h===void 0||h.call(x),n==null||n(!1)}},d=function(){var x;return(x=i.current)!==null&&x!==void 0&&x.focus?(i.current.focus(),o.current=!0,!0):!1},m=function(x){switch(x.keyCode){case UO:c();break;case VO:{var h=!1;o.current||(h=d()),h?x.preventDefault():c();break}}};l.useEffect(function(){return r?(window.addEventListener("keydown",m),s&&jr(d,3),function(){window.removeEventListener("keydown",m),o.current=!1}):function(){o.current=!1}},[r])}var KO=l.forwardRef(function(t,r){var a=t.overlay,n=t.arrow,s=t.prefixCls,i=l.useMemo(function(){var c;return typeof a=="function"?c=a():c=a,c},[a]),o=Tn(r,Os(i));return me.createElement(me.Fragment,null,n&&me.createElement("div",{className:"".concat(s,"-arrow")}),me.cloneElement(i,{ref:Rn(i)?o:void 0}))}),Kn={adjustX:1,adjustY:1},qn=[0,0],qO={topLeft:{points:["bl","tl"],overflow:Kn,offset:[0,-4],targetOffset:qn},top:{points:["bc","tc"],overflow:Kn,offset:[0,-4],targetOffset:qn},topRight:{points:["br","tr"],overflow:Kn,offset:[0,-4],targetOffset:qn},bottomLeft:{points:["tl","bl"],overflow:Kn,offset:[0,4],targetOffset:qn},bottom:{points:["tc","bc"],overflow:Kn,offset:[0,4],targetOffset:qn},bottomRight:{points:["tr","br"],overflow:Kn,offset:[0,4],targetOffset:qn}},XO=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function YO(t,r){var a,n=t.arrow,s=n===void 0?!1:n,i=t.prefixCls,o=i===void 0?"rc-dropdown":i,c=t.transitionName,d=t.animation,m=t.align,u=t.placement,x=u===void 0?"bottomLeft":u,h=t.placements,f=h===void 0?qO:h,g=t.getPopupContainer,b=t.showAction,p=t.hideAction,v=t.overlayClassName,y=t.overlayStyle,j=t.visible,S=t.trigger,N=S===void 0?["hover"]:S,w=t.autoFocus,_=t.overlay,P=t.children,O=t.onVisibleChange,T=bt(t,XO),k=me.useState(),$=he(k,2),C=$[0],A=$[1],E="visible"in t?j:C,L=me.useRef(null),F=me.useRef(null),D=me.useRef(null);me.useImperativeHandle(r,function(){return L.current});var q=function(ae){A(ae),O==null||O(ae)};GO({visible:E,triggerRef:D,onVisibleChange:q,autoFocus:w,overlayRef:F});var Q=function(ae){var ue=t.onOverlayClick;A(!1),ue&&ue(ae)},de=function(){return me.createElement(KO,{ref:F,overlay:_,prefixCls:o,arrow:s})},H=function(){return typeof _=="function"?de:de()},se=function(){var ae=t.minOverlayWidthMatchTrigger,ue=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?ae:!ue},W=function(){var ae=t.openClassName;return ae!==void 0?ae:"".concat(o,"-open")},le=me.cloneElement(P,{className:_e((a=P.props)===null||a===void 0?void 0:a.className,E&&W()),ref:Rn(P)?Tn(D,Os(P)):void 0}),U=p;return!U&&N.indexOf("contextMenu")!==-1&&(U=["click"]),me.createElement(yv,Ve({builtinPlacements:f},T,{prefixCls:o,ref:L,popupClassName:_e(v,G({},"".concat(o,"-show-arrow"),s)),popupStyle:y,action:N,showAction:b,hideAction:U,popupPlacement:x,popupAlign:m,popupTransitionName:c,popupAnimation:d,popupVisible:E,stretch:se()?"minWidth":"",popup:H(),onPopupVisibleChange:q,onPopupClick:Q,getPopupContainer:g}),le)}const JO=me.forwardRef(YO);var jv=l.createContext(null);function wv(t,r){return t===void 0?null:"".concat(t,"-").concat(r)}function Nv(t){var r=l.useContext(jv);return wv(r,t)}var QO=["children","locked"],la=l.createContext(null);function ZO(t,r){var a=X({},t);return Object.keys(r).forEach(function(n){var s=r[n];s!==void 0&&(a[n]=s)}),a}function Ni(t){var r=t.children,a=t.locked,n=bt(t,QO),s=l.useContext(la),i=bl(function(){return ZO(s,n)},[s,n],function(o,c){return!a&&(o[0]!==c[0]||!fi(o[1],c[1],!0))});return l.createElement(la.Provider,{value:i},r)}var e8=[],Sv=l.createContext(null);function Ll(){return l.useContext(Sv)}var Cv=l.createContext(e8);function Li(t){var r=l.useContext(Cv);return l.useMemo(function(){return t!==void 0?[].concat(Fe(r),[t]):r},[r,t])}var _v=l.createContext(null),mm=l.createContext({});function Gh(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(im(t)){var a=t.nodeName.toLowerCase(),n=["input","select","textarea","button"].includes(a)||t.isContentEditable||a==="a"&&!!t.getAttribute("href"),s=t.getAttribute("tabindex"),i=Number(s),o=null;return s&&!Number.isNaN(i)?o=i:n&&o===null&&(o=0),n&&t.disabled&&(o=null),o!==null&&(o>=0||r&&o<0)}return!1}function t8(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=Fe(t.querySelectorAll("*")).filter(function(n){return Gh(n,r)});return Gh(t,r)&&a.unshift(t),a}var qd=Wt.LEFT,Xd=Wt.RIGHT,Yd=Wt.UP,po=Wt.DOWN,bo=Wt.ENTER,kv=Wt.ESC,qs=Wt.HOME,Xs=Wt.END,Kh=[Yd,po,qd,Xd];function r8(t,r,a,n){var s,i="prev",o="next",c="children",d="parent";if(t==="inline"&&n===bo)return{inlineTrigger:!0};var m=G(G({},Yd,i),po,o),u=G(G(G(G({},qd,a?o:i),Xd,a?i:o),po,c),bo,c),x=G(G(G(G(G(G({},Yd,i),po,o),bo,c),kv,d),qd,a?c:d),Xd,a?d:c),h={inline:m,horizontal:u,vertical:x,inlineSub:m,horizontalSub:x,verticalSub:x},f=(s=h["".concat(t).concat(r?"":"Sub")])===null||s===void 0?void 0:s[n];switch(f){case i:return{offset:-1,sibling:!0};case o:return{offset:1,sibling:!0};case d:return{offset:-1,sibling:!1};case c:return{offset:1,sibling:!1};default:return null}}function a8(t){for(var r=t;r;){if(r.getAttribute("data-menu-list"))return r;r=r.parentElement}return null}function n8(t,r){for(var a=t||document.activeElement;a;){if(r.has(a))return a;a=a.parentElement}return null}function xm(t,r){var a=t8(t,!0);return a.filter(function(n){return r.has(n)})}function qh(t,r,a){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var s=xm(t,r),i=s.length,o=s.findIndex(function(c){return a===c});return n<0?o===-1?o=i-1:o-=1:n>0&&(o+=1),o=(o+i)%i,s[o]}var Jd=function(r,a){var n=new Set,s=new Map,i=new Map;return r.forEach(function(o){var c=document.querySelector("[data-menu-id='".concat(wv(a,o),"']"));c&&(n.add(c),i.set(c,o),s.set(o,c))}),{elements:n,key2element:s,element2key:i}};function s8(t,r,a,n,s,i,o,c,d,m){var u=l.useRef(),x=l.useRef();x.current=r;var h=function(){jr.cancel(u.current)};return l.useEffect(function(){return function(){h()}},[]),function(f){var g=f.which;if([].concat(Kh,[bo,kv,qs,Xs]).includes(g)){var b=i(),p=Jd(b,n),v=p,y=v.elements,j=v.key2element,S=v.element2key,N=j.get(r),w=n8(N,y),_=S.get(w),P=r8(t,o(_,!0).length===1,a,g);if(!P&&g!==qs&&g!==Xs)return;(Kh.includes(g)||[qs,Xs].includes(g))&&f.preventDefault();var O=function(F){if(F){var D=F,q=F.querySelector("a");q!=null&&q.getAttribute("href")&&(D=q);var Q=S.get(F);c(Q),h(),u.current=jr(function(){x.current===Q&&D.focus()})}};if([qs,Xs].includes(g)||P.sibling||!w){var T;!w||t==="inline"?T=s.current:T=a8(w);var k,$=xm(T,y);g===qs?k=$[0]:g===Xs?k=$[$.length-1]:k=qh(T,y,w,P.offset),O(k)}else if(P.inlineTrigger)d(_);else if(P.offset>0)d(_,!0),h(),u.current=jr(function(){p=Jd(b,n);var L=w.getAttribute("aria-controls"),F=document.getElementById(L),D=qh(F,p.elements);O(D)},5);else if(P.offset<0){var C=o(_,!0),A=C[C.length-2],E=j.get(A);d(A,!1),O(E)}}m==null||m(f)}}function i8(t){Promise.resolve().then(t)}var hm="__RC_UTIL_PATH_SPLIT__",Xh=function(r){return r.join(hm)},o8=function(r){return r.split(hm)},Qd="rc-menu-more";function l8(){var t=l.useState({}),r=he(t,2),a=r[1],n=l.useRef(new Map),s=l.useRef(new Map),i=l.useState([]),o=he(i,2),c=o[0],d=o[1],m=l.useRef(0),u=l.useRef(!1),x=function(){u.current||a({})},h=l.useCallback(function(j,S){var N=Xh(S);s.current.set(N,j),n.current.set(j,N),m.current+=1;var w=m.current;i8(function(){w===m.current&&x()})},[]),f=l.useCallback(function(j,S){var N=Xh(S);s.current.delete(N),n.current.delete(j)},[]),g=l.useCallback(function(j){d(j)},[]),b=l.useCallback(function(j,S){var N=n.current.get(j)||"",w=o8(N);return S&&c.includes(w[0])&&w.unshift(Qd),w},[c]),p=l.useCallback(function(j,S){return j.filter(function(N){return N!==void 0}).some(function(N){var w=b(N,!0);return w.includes(S)})},[b]),v=function(){var S=Fe(n.current.keys());return c.length&&S.push(Qd),S},y=l.useCallback(function(j){var S="".concat(n.current.get(j)).concat(hm),N=new Set;return Fe(s.current.keys()).forEach(function(w){w.startsWith(S)&&N.add(s.current.get(w))}),N},[]);return l.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:h,unregisterPath:f,refreshOverflowKeys:g,isSubPathKey:p,getKeyPath:b,getKeys:v,getSubPathKeys:y}}function Qs(t){var r=l.useRef(t);r.current=t;var a=l.useCallback(function(){for(var n,s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return(n=r.current)===null||n===void 0?void 0:n.call.apply(n,[r].concat(i))},[]);return t?a:void 0}var c8=Math.random().toFixed(5).toString().slice(2),Yh=0;function d8(t){var r=is(t,{value:t}),a=he(r,2),n=a[0],s=a[1];return l.useEffect(function(){Yh+=1;var i="".concat(c8,"-").concat(Yh);s("rc-menu-uuid-".concat(i))},[]),n}function Pv(t,r,a,n){var s=l.useContext(la),i=s.activeKey,o=s.onActive,c=s.onInactive,d={active:i===t};return r||(d.onMouseEnter=function(m){a==null||a({key:t,domEvent:m}),o(t)},d.onMouseLeave=function(m){n==null||n({key:t,domEvent:m}),c(t)}),d}function $v(t){var r=l.useContext(la),a=r.mode,n=r.rtl,s=r.inlineIndent;if(a!=="inline")return null;var i=t;return n?{paddingRight:i*s}:{paddingLeft:i*s}}function Ev(t){var r=t.icon,a=t.props,n=t.children,s;return r===null||r===!1?null:(typeof r=="function"?s=l.createElement(r,X({},a)):typeof r!="boolean"&&(s=r),s||n||null)}var u8=["item"];function Yo(t){var r=t.item,a=bt(t,u8);return Object.defineProperty(a,"item",{get:function(){return $r(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),r}}),a}var m8=["title","attribute","elementRef"],x8=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],h8=["active"],f8=function(t){Ua(a,t);var r=Va(a);function a(){return Zt(this,a),r.apply(this,arguments)}return er(a,[{key:"render",value:function(){var s=this.props,i=s.title,o=s.attribute,c=s.elementRef,d=bt(s,m8),m=xn(d,["eventKey","popupClassName","popupOffset","onTitleClick"]);return $r(!o,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),l.createElement(Fa.Item,Ve({},o,{title:typeof i=="string"?i:void 0},m,{ref:c}))}}]),a}(l.Component),g8=l.forwardRef(function(t,r){var a=t.style,n=t.className,s=t.eventKey;t.warnKey;var i=t.disabled,o=t.itemIcon,c=t.children,d=t.role,m=t.onMouseEnter,u=t.onMouseLeave,x=t.onClick,h=t.onKeyDown,f=t.onFocus,g=bt(t,x8),b=Nv(s),p=l.useContext(la),v=p.prefixCls,y=p.onItemClick,j=p.disabled,S=p.overflowDisabled,N=p.itemIcon,w=p.selectedKeys,_=p.onActive,P=l.useContext(mm),O=P._internalRenderMenuItem,T="".concat(v,"-item"),k=l.useRef(),$=l.useRef(),C=j||i,A=Mn(r,$),E=Li(s),L=function(ue){return{key:s,keyPath:Fe(E).reverse(),item:k.current,domEvent:ue}},F=o||N,D=Pv(s,C,m,u),q=D.active,Q=bt(D,h8),de=w.includes(s),H=$v(E.length),se=function(ue){if(!C){var fe=L(ue);x==null||x(Yo(fe)),y(fe)}},W=function(ue){if(h==null||h(ue),ue.which===Wt.ENTER){var fe=L(ue);x==null||x(Yo(fe)),y(fe)}},le=function(ue){_(s),f==null||f(ue)},U={};t.role==="option"&&(U["aria-selected"]=de);var ee=l.createElement(f8,Ve({ref:k,elementRef:A,role:d===null?"none":d||"menuitem",tabIndex:i?null:-1,"data-menu-id":S&&b?null:b},xn(g,["extra"]),Q,U,{component:"li","aria-disabled":i,style:X(X({},H),a),className:_e(T,G(G(G({},"".concat(T,"-active"),q),"".concat(T,"-selected"),de),"".concat(T,"-disabled"),C),n),onClick:se,onKeyDown:W,onFocus:le}),c,l.createElement(Ev,{props:X(X({},t),{},{isSelected:de}),icon:F}));return O&&(ee=O(ee,t,{selected:de})),ee});function p8(t,r){var a=t.eventKey,n=Ll(),s=Li(a);return l.useEffect(function(){if(n)return n.registerPath(a,s),function(){n.unregisterPath(a,s)}},[s]),n?null:l.createElement(g8,Ve({},t,{ref:r}))}const Dl=l.forwardRef(p8);var b8=["className","children"],v8=function(r,a){var n=r.className,s=r.children,i=bt(r,b8),o=l.useContext(la),c=o.prefixCls,d=o.mode,m=o.rtl;return l.createElement("ul",Ve({className:_e(c,m&&"".concat(c,"-rtl"),"".concat(c,"-sub"),"".concat(c,"-").concat(d==="inline"?"inline":"vertical"),n),role:"menu"},i,{"data-menu-list":!0,ref:a}),s)},fm=l.forwardRef(v8);fm.displayName="SubMenuList";function gm(t,r){return ys(t).map(function(a,n){if(l.isValidElement(a)){var s,i,o=a.key,c=(s=(i=a.props)===null||i===void 0?void 0:i.eventKey)!==null&&s!==void 0?s:o,d=c==null;d&&(c="tmp_key-".concat([].concat(Fe(r),[n]).join("-")));var m={key:c,eventKey:c};return l.cloneElement(a,m)}return a})}var pr={adjustX:1,adjustY:1},y8={topLeft:{points:["bl","tl"],overflow:pr},topRight:{points:["br","tr"],overflow:pr},bottomLeft:{points:["tl","bl"],overflow:pr},bottomRight:{points:["tr","br"],overflow:pr},leftTop:{points:["tr","tl"],overflow:pr},leftBottom:{points:["br","bl"],overflow:pr},rightTop:{points:["tl","tr"],overflow:pr},rightBottom:{points:["bl","br"],overflow:pr}},j8={topLeft:{points:["bl","tl"],overflow:pr},topRight:{points:["br","tr"],overflow:pr},bottomLeft:{points:["tl","bl"],overflow:pr},bottomRight:{points:["tr","br"],overflow:pr},rightTop:{points:["tr","tl"],overflow:pr},rightBottom:{points:["br","bl"],overflow:pr},leftTop:{points:["tl","tr"],overflow:pr},leftBottom:{points:["bl","br"],overflow:pr}};function Av(t,r,a){if(r)return r;if(a)return a[t]||a.other}var w8={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function N8(t){var r=t.prefixCls,a=t.visible,n=t.children,s=t.popup,i=t.popupStyle,o=t.popupClassName,c=t.popupOffset,d=t.disabled,m=t.mode,u=t.onVisibleChange,x=l.useContext(la),h=x.getPopupContainer,f=x.rtl,g=x.subMenuOpenDelay,b=x.subMenuCloseDelay,p=x.builtinPlacements,v=x.triggerSubMenuAction,y=x.forceSubMenuRender,j=x.rootClassName,S=x.motion,N=x.defaultMotions,w=l.useState(!1),_=he(w,2),P=_[0],O=_[1],T=X(f?X({},j8):X({},y8),p),k=w8[m],$=Av(m,S,N),C=l.useRef($);m!=="inline"&&(C.current=$);var A=X(X({},C.current),{},{leavedClassName:"".concat(r,"-hidden"),removeOnLeave:!1,motionAppear:!0}),E=l.useRef();return l.useEffect(function(){return E.current=jr(function(){O(a)}),function(){jr.cancel(E.current)}},[a]),l.createElement(yv,{prefixCls:r,popupClassName:_e("".concat(r,"-popup"),G({},"".concat(r,"-rtl"),f),o,j),stretch:m==="horizontal"?"minWidth":null,getPopupContainer:h,builtinPlacements:T,popupPlacement:k,popupVisible:P,popup:s,popupStyle:i,popupAlign:c&&{offset:c},action:d?[]:[v],mouseEnterDelay:g,mouseLeaveDelay:b,onPopupVisibleChange:u,forceRender:y,popupMotion:A,fresh:!0},n)}function S8(t){var r=t.id,a=t.open,n=t.keyPath,s=t.children,i="inline",o=l.useContext(la),c=o.prefixCls,d=o.forceSubMenuRender,m=o.motion,u=o.defaultMotions,x=o.mode,h=l.useRef(!1);h.current=x===i;var f=l.useState(!h.current),g=he(f,2),b=g[0],p=g[1],v=h.current?a:!1;l.useEffect(function(){h.current&&p(!1)},[x]);var y=X({},Av(i,m,u));n.length>1&&(y.motionAppear=!1);var j=y.onVisibleChanged;return y.onVisibleChanged=function(S){return!h.current&&!S&&p(!0),j==null?void 0:j(S)},b?null:l.createElement(Ni,{mode:i,locked:!h.current},l.createElement(Ga,Ve({visible:v},y,{forceRender:d,removeOnLeave:!1,leavedClassName:"".concat(c,"-hidden")}),function(S){var N=S.className,w=S.style;return l.createElement(fm,{id:r,className:N,style:w},s)}))}var C8=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],_8=["active"],k8=l.forwardRef(function(t,r){var a=t.style,n=t.className,s=t.title,i=t.eventKey;t.warnKey;var o=t.disabled,c=t.internalPopupClose,d=t.children,m=t.itemIcon,u=t.expandIcon,x=t.popupClassName,h=t.popupOffset,f=t.popupStyle,g=t.onClick,b=t.onMouseEnter,p=t.onMouseLeave,v=t.onTitleClick,y=t.onTitleMouseEnter,j=t.onTitleMouseLeave,S=bt(t,C8),N=Nv(i),w=l.useContext(la),_=w.prefixCls,P=w.mode,O=w.openKeys,T=w.disabled,k=w.overflowDisabled,$=w.activeKey,C=w.selectedKeys,A=w.itemIcon,E=w.expandIcon,L=w.onItemClick,F=w.onOpenChange,D=w.onActive,q=l.useContext(mm),Q=q._internalRenderSubMenuItem,de=l.useContext(_v),H=de.isSubPathKey,se=Li(),W="".concat(_,"-submenu"),le=T||o,U=l.useRef(),ee=l.useRef(),ae=m??A,ue=u??E,fe=O.includes(i),re=!k&&fe,V=H(C,i),ce=Pv(i,le,y,j),Z=ce.active,xe=bt(ce,_8),pe=l.useState(!1),Se=he(pe,2),ke=Se[0],$e=Se[1],K=function(Xe){le||$e(Xe)},ie=function(Xe){K(!0),b==null||b({key:i,domEvent:Xe})},I=function(Xe){K(!1),p==null||p({key:i,domEvent:Xe})},R=l.useMemo(function(){return Z||(P!=="inline"?ke||H([$],i):!1)},[P,Z,$,ke,i,H]),je=$v(se.length),Te=function(Xe){le||(v==null||v({key:i,domEvent:Xe}),P==="inline"&&F(i,!fe))},Ie=Qs(function(qe){g==null||g(Yo(qe)),L(qe)}),tt=function(Xe){P!=="inline"&&F(i,Xe)},Ke=function(){D(i)},Be=N&&"".concat(N,"-popup"),Ge=l.useMemo(function(){return l.createElement(Ev,{icon:P!=="horizontal"?ue:void 0,props:X(X({},t),{},{isOpen:re,isSubMenu:!0})},l.createElement("i",{className:"".concat(W,"-arrow")}))},[P,ue,t,re,W]),J=l.createElement("div",Ve({role:"menuitem",style:je,className:"".concat(W,"-title"),tabIndex:le?null:-1,ref:U,title:typeof s=="string"?s:null,"data-menu-id":k&&N?null:N,"aria-expanded":re,"aria-haspopup":!0,"aria-controls":Be,"aria-disabled":le,onClick:Te,onFocus:Ke},xe),s,Ge),Ae=l.useRef(P);if(P!=="inline"&&se.length>1?Ae.current="vertical":Ae.current=P,!k){var ve=Ae.current;J=l.createElement(N8,{mode:ve,prefixCls:W,visible:!c&&re&&P!=="inline",popupClassName:x,popupOffset:h,popupStyle:f,popup:l.createElement(Ni,{mode:ve==="horizontal"?"vertical":ve},l.createElement(fm,{id:Be,ref:ee},d)),disabled:le,onVisibleChange:tt},J)}var ge=l.createElement(Fa.Item,Ve({ref:r,role:"none"},S,{component:"li",style:a,className:_e(W,"".concat(W,"-").concat(P),n,G(G(G(G({},"".concat(W,"-open"),re),"".concat(W,"-active"),R),"".concat(W,"-selected"),V),"".concat(W,"-disabled"),le)),onMouseEnter:ie,onMouseLeave:I}),J,!k&&l.createElement(S8,{id:Be,open:re,keyPath:se},d));return Q&&(ge=Q(ge,t,{selected:V,active:R,open:re,disabled:le})),l.createElement(Ni,{onItemClick:Ie,mode:P==="horizontal"?"vertical":P,itemIcon:ae,expandIcon:ue},ge)}),pm=l.forwardRef(function(t,r){var a=t.eventKey,n=t.children,s=Li(a),i=gm(n,s),o=Ll();l.useEffect(function(){if(o)return o.registerPath(a,s),function(){o.unregisterPath(a,s)}},[s]);var c;return o?c=i:c=l.createElement(k8,Ve({ref:r},t),i),l.createElement(Cv.Provider,{value:s},c)});function Ov(t){var r=t.className,a=t.style,n=l.useContext(la),s=n.prefixCls,i=Ll();return i?null:l.createElement("li",{role:"separator",className:_e("".concat(s,"-item-divider"),r),style:a})}var P8=["className","title","eventKey","children"],$8=l.forwardRef(function(t,r){var a=t.className,n=t.title;t.eventKey;var s=t.children,i=bt(t,P8),o=l.useContext(la),c=o.prefixCls,d="".concat(c,"-item-group");return l.createElement("li",Ve({ref:r,role:"presentation"},i,{onClick:function(u){return u.stopPropagation()},className:_e(d,a)}),l.createElement("div",{role:"presentation",className:"".concat(d,"-title"),title:typeof n=="string"?n:void 0},n),l.createElement("ul",{role:"group",className:"".concat(d,"-list")},s))}),Iv=l.forwardRef(function(t,r){var a=t.eventKey,n=t.children,s=Li(a),i=gm(n,s),o=Ll();return o?i:l.createElement($8,Ve({ref:r},xn(t,["warnKey"])),i)}),E8=["label","children","key","type","extra"];function Zd(t,r,a){var n=r.item,s=r.group,i=r.submenu,o=r.divider;return(t||[]).map(function(c,d){if(c&&et(c)==="object"){var m=c,u=m.label,x=m.children,h=m.key,f=m.type,g=m.extra,b=bt(m,E8),p=h??"tmp-".concat(d);return x||f==="group"?f==="group"?l.createElement(s,Ve({key:p},b,{title:u}),Zd(x,r,a)):l.createElement(i,Ve({key:p},b,{title:u}),Zd(x,r,a)):f==="divider"?l.createElement(o,Ve({key:p},b)):l.createElement(n,Ve({key:p},b,{extra:g}),u,(!!g||g===0)&&l.createElement("span",{className:"".concat(a,"-item-extra")},g))}return null}).filter(function(c){return c})}function Jh(t,r,a,n,s){var i=t,o=X({divider:Ov,item:Dl,group:Iv,submenu:pm},n);return r&&(i=Zd(r,o,s)),gm(i,a)}var A8=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],bn=[],O8=l.forwardRef(function(t,r){var a,n=t,s=n.prefixCls,i=s===void 0?"rc-menu":s,o=n.rootClassName,c=n.style,d=n.className,m=n.tabIndex,u=m===void 0?0:m,x=n.items,h=n.children,f=n.direction,g=n.id,b=n.mode,p=b===void 0?"vertical":b,v=n.inlineCollapsed,y=n.disabled,j=n.disabledOverflow,S=n.subMenuOpenDelay,N=S===void 0?.1:S,w=n.subMenuCloseDelay,_=w===void 0?.1:w,P=n.forceSubMenuRender,O=n.defaultOpenKeys,T=n.openKeys,k=n.activeKey,$=n.defaultActiveFirst,C=n.selectable,A=C===void 0?!0:C,E=n.multiple,L=E===void 0?!1:E,F=n.defaultSelectedKeys,D=n.selectedKeys,q=n.onSelect,Q=n.onDeselect,de=n.inlineIndent,H=de===void 0?24:de,se=n.motion,W=n.defaultMotions,le=n.triggerSubMenuAction,U=le===void 0?"hover":le,ee=n.builtinPlacements,ae=n.itemIcon,ue=n.expandIcon,fe=n.overflowedIndicator,re=fe===void 0?"...":fe,V=n.overflowedIndicatorPopupClassName,ce=n.getPopupContainer,Z=n.onClick,xe=n.onOpenChange,pe=n.onKeyDown;n.openAnimation,n.openTransitionName;var Se=n._internalRenderMenuItem,ke=n._internalRenderSubMenuItem,$e=n._internalComponents,K=bt(n,A8),ie=l.useMemo(function(){return[Jh(h,x,bn,$e,i),Jh(h,x,bn,{},i)]},[h,x,$e]),I=he(ie,2),R=I[0],je=I[1],Te=l.useState(!1),Ie=he(Te,2),tt=Ie[0],Ke=Ie[1],Be=l.useRef(),Ge=d8(g),J=f==="rtl",Ae=is(O,{value:T,postState:function(pt){return pt||bn}}),ve=he(Ae,2),ge=ve[0],qe=ve[1],Xe=function(pt){var wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function nr(){qe(pt),xe==null||xe(pt)}wt?An.flushSync(nr):nr()},st=l.useState(ge),ht=he(st,2),Ze=ht[0],yt=ht[1],We=l.useRef(!1),tr=l.useMemo(function(){return(p==="inline"||p==="vertical")&&v?["vertical",v]:[p,!1]},[p,v]),Vt=he(tr,2),ct=Vt[0],dt=Vt[1],be=ct==="inline",ye=l.useState(ct),De=he(ye,2),M=De[0],te=De[1],Ne=l.useState(dt),Ee=he(Ne,2),Pe=Ee[0],Me=Ee[1];l.useEffect(function(){te(ct),Me(dt),We.current&&(be?qe(Ze):Xe(bn))},[ct,dt]);var Ue=l.useState(0),Le=he(Ue,2),Re=Le[0],ot=Le[1],ut=Re>=R.length-1||M!=="horizontal"||j;l.useEffect(function(){be&&yt(ge)},[ge]),l.useEffect(function(){return We.current=!0,function(){We.current=!1}},[]);var ft=l8(),gt=ft.registerPath,ir=ft.unregisterPath,Xt=ft.refreshOverflowKeys,St=ft.isSubPathKey,_t=ft.getKeyPath,Gt=ft.getKeys,B=ft.getSubPathKeys,oe=l.useMemo(function(){return{registerPath:gt,unregisterPath:ir}},[gt,ir]),ne=l.useMemo(function(){return{isSubPathKey:St}},[St]);l.useEffect(function(){Xt(ut?bn:R.slice(Re+1).map(function($t){return $t.key}))},[Re,ut]);var Ce=is(k||$&&((a=R[0])===null||a===void 0?void 0:a.key),{value:k}),at=he(Ce,2),ze=at[0],Oe=at[1],Ye=Qs(function($t){Oe($t)}),rt=Qs(function(){Oe(void 0)});l.useImperativeHandle(r,function(){return{list:Be.current,focus:function(pt){var wt,nr=Gt(),or=Jd(nr,Ge),Ka=or.elements,qa=or.key2element,Rs=or.element2key,zn=xm(Be.current,Ka),fn=ze??(zn[0]?Rs.get(zn[0]):(wt=R.find(function(Ls){return!Ls.props.disabled}))===null||wt===void 0?void 0:wt.key),Ea=qa.get(fn);if(fn&&Ea){var gn;Ea==null||(gn=Ea.focus)===null||gn===void 0||gn.call(Ea,pt)}}}});var Qe=is(F||[],{value:D,postState:function(pt){return Array.isArray(pt)?pt:pt==null?bn:[pt]}}),lt=he(Qe,2),Pt=lt[0],Hr=lt[1],Rr=function(pt){if(A){var wt=pt.key,nr=Pt.includes(wt),or;L?nr?or=Pt.filter(function(qa){return qa!==wt}):or=[].concat(Fe(Pt),[wt]):or=[wt],Hr(or);var Ka=X(X({},pt),{},{selectedKeys:or});nr?Q==null||Q(Ka):q==null||q(Ka)}!L&&ge.length&&M!=="inline"&&Xe(bn)},rr=Qs(function($t){Z==null||Z(Yo($t)),Rr($t)}),Ar=Qs(function($t,pt){var wt=ge.filter(function(or){return or!==$t});if(pt)wt.push($t);else if(M!=="inline"){var nr=B($t);wt=wt.filter(function(or){return!nr.has(or)})}fi(ge,wt,!0)||Xe(wt,!0)}),ar=function(pt,wt){var nr=wt??!ge.includes(pt);Ar(pt,nr)},Wr=s8(M,ze,J,Ge,Be,Gt,_t,Oe,ar,pe);l.useEffect(function(){Ke(!0)},[]);var Ur=l.useMemo(function(){return{_internalRenderMenuItem:Se,_internalRenderSubMenuItem:ke}},[Se,ke]),ha=M!=="horizontal"||j?R:R.map(function($t,pt){return l.createElement(Ni,{key:$t.key,overflowDisabled:pt>Re},$t)}),hn=l.createElement(Fa,Ve({id:g,ref:Be,prefixCls:"".concat(i,"-overflow"),component:"ul",itemComponent:Dl,className:_e(i,"".concat(i,"-root"),"".concat(i,"-").concat(M),d,G(G({},"".concat(i,"-inline-collapsed"),Pe),"".concat(i,"-rtl"),J),o),dir:f,style:c,role:"menu",tabIndex:u,data:ha,renderRawItem:function(pt){return pt},renderRawRest:function(pt){var wt=pt.length,nr=wt?R.slice(-wt):null;return l.createElement(pm,{eventKey:Qd,title:re,disabled:ut,internalPopupClose:wt===0,popupClassName:V},nr)},maxCount:M!=="horizontal"||j?Fa.INVALIDATE:Fa.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(pt){ot(pt)},onKeyDown:Wr},K));return l.createElement(mm.Provider,{value:Ur},l.createElement(jv.Provider,{value:Ge},l.createElement(Ni,{prefixCls:i,rootClassName:o,mode:M,openKeys:ge,rtl:J,disabled:y,motion:tt?se:null,defaultMotions:tt?W:null,activeKey:ze,onActive:Ye,onInactive:rt,selectedKeys:Pt,inlineIndent:H,subMenuOpenDelay:N,subMenuCloseDelay:_,forceSubMenuRender:P,builtinPlacements:ee,triggerSubMenuAction:U,getPopupContainer:ce,itemIcon:ae,expandIcon:ue,onItemClick:rr,onOpenChange:Ar},l.createElement(_v.Provider,{value:ne},hn),l.createElement("div",{style:{display:"none"},"aria-hidden":!0},l.createElement(Sv.Provider,{value:oe},je)))))}),Di=O8;Di.Item=Dl;Di.SubMenu=pm;Di.ItemGroup=Iv;Di.Divider=Ov;var I8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},T8=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:I8}))},M8=l.forwardRef(T8),R8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},L8=function(r,a){return l.createElement(ma,Ve({},r,{ref:a,icon:R8}))},D8=l.forwardRef(L8);const zl=l.createContext(null);var z8=function(r){var a=r.activeTabOffset,n=r.horizontal,s=r.rtl,i=r.indicator,o=i===void 0?{}:i,c=o.size,d=o.align,m=d===void 0?"center":d,u=l.useState(),x=he(u,2),h=x[0],f=x[1],g=l.useRef(),b=me.useCallback(function(v){return typeof c=="function"?c(v):typeof c=="number"?c:v},[c]);function p(){jr.cancel(g.current)}return l.useEffect(function(){var v={};if(a)if(n){v.width=b(a.width);var y=s?"right":"left";m==="start"&&(v[y]=a[y]),m==="center"&&(v[y]=a[y]+a.width/2,v.transform=s?"translateX(50%)":"translateX(-50%)"),m==="end"&&(v[y]=a[y]+a.width,v.transform="translateX(-100%)")}else v.height=b(a.height),m==="start"&&(v.top=a.top),m==="center"&&(v.top=a.top+a.height/2,v.transform="translateY(-50%)"),m==="end"&&(v.top=a.top+a.height,v.transform="translateY(-100%)");return p(),g.current=jr(function(){var j=h&&v&&Object.keys(v).every(function(S){var N=v[S],w=h[S];return typeof N=="number"&&typeof w=="number"?Math.round(N)===Math.round(w):N===w});j||f(v)}),p},[JSON.stringify(a),n,s,m,b]),{style:h}},Qh={width:0,height:0,left:0,top:0};function F8(t,r,a){return l.useMemo(function(){for(var n,s=new Map,i=r.get((n=t[0])===null||n===void 0?void 0:n.key)||Qh,o=i.left+i.width,c=0;c<t.length;c+=1){var d=t[c].key,m=r.get(d);if(!m){var u;m=r.get((u=t[c-1])===null||u===void 0?void 0:u.key)||Qh}var x=s.get(d)||X({},m);x.right=o-x.left-x.width,s.set(d,x)}return s},[t.map(function(n){return n.key}).join("_"),r,a])}function Zh(t,r){var a=l.useRef(t),n=l.useState({}),s=he(n,2),i=s[1];function o(c){var d=typeof c=="function"?c(a.current):c;d!==a.current&&r(d,a.current),a.current=d,i({})}return[a.current,o]}var B8=.1,ef=.01,vo=20,tf=Math.pow(.995,vo);function H8(t,r){var a=l.useState(),n=he(a,2),s=n[0],i=n[1],o=l.useState(0),c=he(o,2),d=c[0],m=c[1],u=l.useState(0),x=he(u,2),h=x[0],f=x[1],g=l.useState(),b=he(g,2),p=b[0],v=b[1],y=l.useRef();function j(O){var T=O.touches[0],k=T.screenX,$=T.screenY;i({x:k,y:$}),window.clearInterval(y.current)}function S(O){if(s){var T=O.touches[0],k=T.screenX,$=T.screenY;i({x:k,y:$});var C=k-s.x,A=$-s.y;r(C,A);var E=Date.now();m(E),f(E-d),v({x:C,y:A})}}function N(){if(s&&(i(null),v(null),p)){var O=p.x/h,T=p.y/h,k=Math.abs(O),$=Math.abs(T);if(Math.max(k,$)<B8)return;var C=O,A=T;y.current=window.setInterval(function(){if(Math.abs(C)<ef&&Math.abs(A)<ef){window.clearInterval(y.current);return}C*=tf,A*=tf,r(C*vo,A*vo)},vo)}}var w=l.useRef();function _(O){var T=O.deltaX,k=O.deltaY,$=0,C=Math.abs(T),A=Math.abs(k);C===A?$=w.current==="x"?T:k:C>A?($=T,w.current="x"):($=k,w.current="y"),r(-$,-$)&&O.preventDefault()}var P=l.useRef(null);P.current={onTouchStart:j,onTouchMove:S,onTouchEnd:N,onWheel:_},l.useEffect(function(){function O(C){P.current.onTouchStart(C)}function T(C){P.current.onTouchMove(C)}function k(C){P.current.onTouchEnd(C)}function $(C){P.current.onWheel(C)}return document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",k,{passive:!0}),t.current.addEventListener("touchstart",O,{passive:!0}),t.current.addEventListener("wheel",$,{passive:!1}),function(){document.removeEventListener("touchmove",T),document.removeEventListener("touchend",k)}},[])}function Tv(t){var r=l.useState(0),a=he(r,2),n=a[0],s=a[1],i=l.useRef(0),o=l.useRef();return o.current=t,cd(function(){var c;(c=o.current)===null||c===void 0||c.call(o)},[n]),function(){i.current===n&&(i.current+=1,s(i.current))}}function W8(t){var r=l.useRef([]),a=l.useState({}),n=he(a,2),s=n[1],i=l.useRef(typeof t=="function"?t():t),o=Tv(function(){var d=i.current;r.current.forEach(function(m){d=m(d)}),r.current=[],i.current=d,s({})});function c(d){r.current.push(d),o()}return[i.current,c]}var rf={width:0,height:0,left:0,top:0,right:0};function U8(t,r,a,n,s,i,o){var c=o.tabs,d=o.tabPosition,m=o.rtl,u,x,h;return["top","bottom"].includes(d)?(u="width",x=m?"right":"left",h=Math.abs(a)):(u="height",x="top",h=-a),l.useMemo(function(){if(!c.length)return[0,0];for(var f=c.length,g=f,b=0;b<f;b+=1){var p=t.get(c[b].key)||rf;if(Math.floor(p[x]+p[u])>Math.floor(h+r)){g=b-1;break}}for(var v=0,y=f-1;y>=0;y-=1){var j=t.get(c[y].key)||rf;if(j[x]<h){v=y+1;break}}return v>g?[0,-1]:[v,g]},[t,r,n,s,i,h,d,c.map(function(f){return f.key}).join("_"),m])}function af(t){var r;return t instanceof Map?(r={},t.forEach(function(a,n){r[n]=a})):r=t,JSON.stringify(r)}var V8="TABS_DQ";function Mv(t){return String(t).replace(/"/g,V8)}function bm(t,r,a,n){return!(!a||n||t===!1||t===void 0&&(r===!1||r===null))}var Rv=l.forwardRef(function(t,r){var a=t.prefixCls,n=t.editable,s=t.locale,i=t.style;return!n||n.showAdd===!1?null:l.createElement("button",{ref:r,type:"button",className:"".concat(a,"-nav-add"),style:i,"aria-label":(s==null?void 0:s.addAriaLabel)||"Add tab",onClick:function(c){n.onEdit("add",{event:c})}},n.addIcon||"+")}),nf=l.forwardRef(function(t,r){var a=t.position,n=t.prefixCls,s=t.extra;if(!s)return null;var i,o={};return et(s)==="object"&&!l.isValidElement(s)?o=s:o.right=s,a==="right"&&(i=o.right),a==="left"&&(i=o.left),i?l.createElement("div",{className:"".concat(n,"-extra-content"),ref:r},i):null}),G8=l.forwardRef(function(t,r){var a=t.prefixCls,n=t.id,s=t.tabs,i=t.locale,o=t.mobile,c=t.more,d=c===void 0?{}:c,m=t.style,u=t.className,x=t.editable,h=t.tabBarGutter,f=t.rtl,g=t.removeAriaLabel,b=t.onTabClick,p=t.getPopupContainer,v=t.popupClassName,y=l.useState(!1),j=he(y,2),S=j[0],N=j[1],w=l.useState(null),_=he(w,2),P=_[0],O=_[1],T=d.icon,k=T===void 0?"More":T,$="".concat(n,"-more-popup"),C="".concat(a,"-dropdown"),A=P!==null?"".concat($,"-").concat(P):null,E=i==null?void 0:i.dropdownAriaLabel;function L(se,W){se.preventDefault(),se.stopPropagation(),x.onEdit("remove",{key:W,event:se})}var F=l.createElement(Di,{onClick:function(W){var le=W.key,U=W.domEvent;b(le,U),N(!1)},prefixCls:"".concat(C,"-menu"),id:$,tabIndex:-1,role:"listbox","aria-activedescendant":A,selectedKeys:[P],"aria-label":E!==void 0?E:"expanded dropdown"},s.map(function(se){var W=se.closable,le=se.disabled,U=se.closeIcon,ee=se.key,ae=se.label,ue=bm(W,U,x,le);return l.createElement(Dl,{key:ee,id:"".concat($,"-").concat(ee),role:"option","aria-controls":n&&"".concat(n,"-panel-").concat(ee),disabled:le},l.createElement("span",null,ae),ue&&l.createElement("button",{type:"button","aria-label":g||"remove",tabIndex:0,className:"".concat(C,"-menu-item-remove"),onClick:function(re){re.stopPropagation(),L(re,ee)}},U||x.removeIcon||"×"))}));function D(se){for(var W=s.filter(function(ue){return!ue.disabled}),le=W.findIndex(function(ue){return ue.key===P})||0,U=W.length,ee=0;ee<U;ee+=1){le=(le+se+U)%U;var ae=W[le];if(!ae.disabled){O(ae.key);return}}}function q(se){var W=se.which;if(!S){[Wt.DOWN,Wt.SPACE,Wt.ENTER].includes(W)&&(N(!0),se.preventDefault());return}switch(W){case Wt.UP:D(-1),se.preventDefault();break;case Wt.DOWN:D(1),se.preventDefault();break;case Wt.ESC:N(!1);break;case Wt.SPACE:case Wt.ENTER:P!==null&&b(P,se);break}}l.useEffect(function(){var se=document.getElementById(A);se&&se.scrollIntoView&&se.scrollIntoView(!1)},[P]),l.useEffect(function(){S||O(null)},[S]);var Q=G({},f?"marginRight":"marginLeft",h);s.length||(Q.visibility="hidden",Q.order=1);var de=_e(G({},"".concat(C,"-rtl"),f)),H=o?null:l.createElement(JO,Ve({prefixCls:C,overlay:F,visible:s.length?S:!1,onVisibleChange:N,overlayClassName:_e(de,v),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:p},d),l.createElement("button",{type:"button",className:"".concat(a,"-nav-more"),style:Q,"aria-haspopup":"listbox","aria-controls":$,id:"".concat(n,"-more"),"aria-expanded":S,onKeyDown:q},k));return l.createElement("div",{className:_e("".concat(a,"-nav-operations"),u),style:m,ref:r},H,l.createElement(Rv,{prefixCls:a,locale:i,editable:x}))});const K8=l.memo(G8,function(t,r){return r.tabMoving});var q8=function(r){var a=r.prefixCls,n=r.id,s=r.active,i=r.focus,o=r.tab,c=o.key,d=o.label,m=o.disabled,u=o.closeIcon,x=o.icon,h=r.closable,f=r.renderWrapper,g=r.removeAriaLabel,b=r.editable,p=r.onClick,v=r.onFocus,y=r.onBlur,j=r.onKeyDown,S=r.onMouseDown,N=r.onMouseUp,w=r.style,_=r.tabCount,P=r.currentPosition,O="".concat(a,"-tab"),T=bm(h,u,b,m);function k(L){m||p(L)}function $(L){L.preventDefault(),L.stopPropagation(),b.onEdit("remove",{key:c,event:L})}var C=l.useMemo(function(){return x&&typeof d=="string"?l.createElement("span",null,d):d},[d,x]),A=l.useRef(null);l.useEffect(function(){i&&A.current&&A.current.focus()},[i]);var E=l.createElement("div",{key:c,"data-node-key":Mv(c),className:_e(O,G(G(G(G({},"".concat(O,"-with-remove"),T),"".concat(O,"-active"),s),"".concat(O,"-disabled"),m),"".concat(O,"-focus"),i)),style:w,onClick:k},l.createElement("div",{ref:A,role:"tab","aria-selected":s,id:n&&"".concat(n,"-tab-").concat(c),className:"".concat(O,"-btn"),"aria-controls":n&&"".concat(n,"-panel-").concat(c),"aria-disabled":m,tabIndex:m?null:s?0:-1,onClick:function(F){F.stopPropagation(),k(F)},onKeyDown:j,onMouseDown:S,onMouseUp:N,onFocus:v,onBlur:y},i&&l.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(P," of ").concat(_)),x&&l.createElement("span",{className:"".concat(O,"-icon")},x),d&&C),T&&l.createElement("button",{type:"button",role:"tab","aria-label":g||"remove",tabIndex:s?0:-1,className:"".concat(O,"-remove"),onClick:function(F){F.stopPropagation(),$(F)}},u||b.removeIcon||"×"));return f?f(E):E},X8=function(r,a){var n=r.offsetWidth,s=r.offsetHeight,i=r.offsetTop,o=r.offsetLeft,c=r.getBoundingClientRect(),d=c.width,m=c.height,u=c.left,x=c.top;return Math.abs(d-n)<1?[d,m,u-a.left,x-a.top]:[n,s,o,i]},Xn=function(r){var a=r.current||{},n=a.offsetWidth,s=n===void 0?0:n,i=a.offsetHeight,o=i===void 0?0:i;if(r.current){var c=r.current.getBoundingClientRect(),d=c.width,m=c.height;if(Math.abs(d-s)<1)return[d,m]}return[s,o]},ro=function(r,a){return r[a?0:1]},sf=l.forwardRef(function(t,r){var a=t.className,n=t.style,s=t.id,i=t.animated,o=t.activeKey,c=t.rtl,d=t.extra,m=t.editable,u=t.locale,x=t.tabPosition,h=t.tabBarGutter,f=t.children,g=t.onTabClick,b=t.onTabScroll,p=t.indicator,v=l.useContext(zl),y=v.prefixCls,j=v.tabs,S=l.useRef(null),N=l.useRef(null),w=l.useRef(null),_=l.useRef(null),P=l.useRef(null),O=l.useRef(null),T=l.useRef(null),k=x==="top"||x==="bottom",$=Zh(0,function(ze,Oe){k&&b&&b({direction:ze>Oe?"left":"right"})}),C=he($,2),A=C[0],E=C[1],L=Zh(0,function(ze,Oe){!k&&b&&b({direction:ze>Oe?"top":"bottom"})}),F=he(L,2),D=F[0],q=F[1],Q=l.useState([0,0]),de=he(Q,2),H=de[0],se=de[1],W=l.useState([0,0]),le=he(W,2),U=le[0],ee=le[1],ae=l.useState([0,0]),ue=he(ae,2),fe=ue[0],re=ue[1],V=l.useState([0,0]),ce=he(V,2),Z=ce[0],xe=ce[1],pe=W8(new Map),Se=he(pe,2),ke=Se[0],$e=Se[1],K=F8(j,ke,U[0]),ie=ro(H,k),I=ro(U,k),R=ro(fe,k),je=ro(Z,k),Te=Math.floor(ie)<Math.floor(I+R),Ie=Te?ie-je:ie-R,tt="".concat(y,"-nav-operations-hidden"),Ke=0,Be=0;k&&c?(Ke=0,Be=Math.max(0,I-Ie)):(Ke=Math.min(0,Ie-I),Be=0);function Ge(ze){return ze<Ke?Ke:ze>Be?Be:ze}var J=l.useRef(null),Ae=l.useState(),ve=he(Ae,2),ge=ve[0],qe=ve[1];function Xe(){qe(Date.now())}function st(){J.current&&clearTimeout(J.current)}H8(_,function(ze,Oe){function Ye(rt,Qe){rt(function(lt){var Pt=Ge(lt+Qe);return Pt})}return Te?(k?Ye(E,ze):Ye(q,Oe),st(),Xe(),!0):!1}),l.useEffect(function(){return st(),ge&&(J.current=setTimeout(function(){qe(0)},100)),st},[ge]);var ht=U8(K,Ie,k?A:D,I,R,je,X(X({},t),{},{tabs:j})),Ze=he(ht,2),yt=Ze[0],We=Ze[1],tr=vr(function(){var ze=arguments.length>0&&arguments[0]!==void 0?arguments[0]:o,Oe=K.get(ze)||{width:0,height:0,left:0,right:0,top:0};if(k){var Ye=A;c?Oe.right<A?Ye=Oe.right:Oe.right+Oe.width>A+Ie&&(Ye=Oe.right+Oe.width-Ie):Oe.left<-A?Ye=-Oe.left:Oe.left+Oe.width>-A+Ie&&(Ye=-(Oe.left+Oe.width-Ie)),q(0),E(Ge(Ye))}else{var rt=D;Oe.top<-D?rt=-Oe.top:Oe.top+Oe.height>-D+Ie&&(rt=-(Oe.top+Oe.height-Ie)),E(0),q(Ge(rt))}}),Vt=l.useState(),ct=he(Vt,2),dt=ct[0],be=ct[1],ye=l.useState(!1),De=he(ye,2),M=De[0],te=De[1],Ne=j.filter(function(ze){return!ze.disabled}).map(function(ze){return ze.key}),Ee=function(Oe){var Ye=Ne.indexOf(dt||o),rt=Ne.length,Qe=(Ye+Oe+rt)%rt,lt=Ne[Qe];be(lt)},Pe=function(Oe,Ye){var rt=Ne.indexOf(Oe),Qe=j.find(function(Pt){return Pt.key===Oe}),lt=bm(Qe==null?void 0:Qe.closable,Qe==null?void 0:Qe.closeIcon,m,Qe==null?void 0:Qe.disabled);lt&&(Ye.preventDefault(),Ye.stopPropagation(),m.onEdit("remove",{key:Oe,event:Ye}),rt===Ne.length-1?Ee(-1):Ee(1))},Me=function(Oe,Ye){te(!0),Ye.button===1&&Pe(Oe,Ye)},Ue=function(Oe){var Ye=Oe.code,rt=c&&k,Qe=Ne[0],lt=Ne[Ne.length-1];switch(Ye){case"ArrowLeft":{k&&Ee(rt?1:-1);break}case"ArrowRight":{k&&Ee(rt?-1:1);break}case"ArrowUp":{Oe.preventDefault(),k||Ee(-1);break}case"ArrowDown":{Oe.preventDefault(),k||Ee(1);break}case"Home":{Oe.preventDefault(),be(Qe);break}case"End":{Oe.preventDefault(),be(lt);break}case"Enter":case"Space":{Oe.preventDefault(),g(dt??o,Oe);break}case"Backspace":case"Delete":{Pe(dt,Oe);break}}},Le={};k?Le[c?"marginRight":"marginLeft"]=h:Le.marginTop=h;var Re=j.map(function(ze,Oe){var Ye=ze.key;return l.createElement(q8,{id:s,prefixCls:y,key:Ye,tab:ze,style:Oe===0?void 0:Le,closable:ze.closable,editable:m,active:Ye===o,focus:Ye===dt,renderWrapper:f,removeAriaLabel:u==null?void 0:u.removeAriaLabel,tabCount:Ne.length,currentPosition:Oe+1,onClick:function(Qe){g(Ye,Qe)},onKeyDown:Ue,onFocus:function(){M||be(Ye),tr(Ye),Xe(),_.current&&(c||(_.current.scrollLeft=0),_.current.scrollTop=0)},onBlur:function(){be(void 0)},onMouseDown:function(Qe){return Me(Ye,Qe)},onMouseUp:function(){te(!1)}})}),ot=function(){return $e(function(){var Oe,Ye=new Map,rt=(Oe=P.current)===null||Oe===void 0?void 0:Oe.getBoundingClientRect();return j.forEach(function(Qe){var lt,Pt=Qe.key,Hr=(lt=P.current)===null||lt===void 0?void 0:lt.querySelector('[data-node-key="'.concat(Mv(Pt),'"]'));if(Hr){var Rr=X8(Hr,rt),rr=he(Rr,4),Ar=rr[0],ar=rr[1],Wr=rr[2],Ur=rr[3];Ye.set(Pt,{width:Ar,height:ar,left:Wr,top:Ur})}}),Ye})};l.useEffect(function(){ot()},[j.map(function(ze){return ze.key}).join("_")]);var ut=Tv(function(){var ze=Xn(S),Oe=Xn(N),Ye=Xn(w);se([ze[0]-Oe[0]-Ye[0],ze[1]-Oe[1]-Ye[1]]);var rt=Xn(T);re(rt);var Qe=Xn(O);xe(Qe);var lt=Xn(P);ee([lt[0]-rt[0],lt[1]-rt[1]]),ot()}),ft=j.slice(0,yt),gt=j.slice(We+1),ir=[].concat(Fe(ft),Fe(gt)),Xt=K.get(o),St=z8({activeTabOffset:Xt,horizontal:k,indicator:p,rtl:c}),_t=St.style;l.useEffect(function(){tr()},[o,Ke,Be,af(Xt),af(K),k]),l.useEffect(function(){ut()},[c]);var Gt=!!ir.length,B="".concat(y,"-nav-wrap"),oe,ne,Ce,at;return k?c?(ne=A>0,oe=A!==Be):(oe=A<0,ne=A!==Ke):(Ce=D<0,at=D!==Ke),l.createElement(an,{onResize:ut},l.createElement("div",{ref:Mn(r,S),role:"tablist","aria-orientation":k?"horizontal":"vertical",className:_e("".concat(y,"-nav"),a),style:n,onKeyDown:function(){Xe()}},l.createElement(nf,{ref:N,position:"left",extra:d,prefixCls:y}),l.createElement(an,{onResize:ut},l.createElement("div",{className:_e(B,G(G(G(G({},"".concat(B,"-ping-left"),oe),"".concat(B,"-ping-right"),ne),"".concat(B,"-ping-top"),Ce),"".concat(B,"-ping-bottom"),at)),ref:_},l.createElement(an,{onResize:ut},l.createElement("div",{ref:P,className:"".concat(y,"-nav-list"),style:{transform:"translate(".concat(A,"px, ").concat(D,"px)"),transition:ge?"none":void 0}},Re,l.createElement(Rv,{ref:T,prefixCls:y,locale:u,editable:m,style:X(X({},Re.length===0?void 0:Le),{},{visibility:Gt?"hidden":null})}),l.createElement("div",{className:_e("".concat(y,"-ink-bar"),G({},"".concat(y,"-ink-bar-animated"),i.inkBar)),style:_t}))))),l.createElement(K8,Ve({},t,{removeAriaLabel:u==null?void 0:u.removeAriaLabel,ref:O,prefixCls:y,tabs:ir,className:!Gt&&tt,tabMoving:!!ge})),l.createElement(nf,{ref:w,position:"right",extra:d,prefixCls:y})))}),Lv=l.forwardRef(function(t,r){var a=t.prefixCls,n=t.className,s=t.style,i=t.id,o=t.active,c=t.tabKey,d=t.children;return l.createElement("div",{id:i&&"".concat(i,"-panel-").concat(c),role:"tabpanel",tabIndex:o?0:-1,"aria-labelledby":i&&"".concat(i,"-tab-").concat(c),"aria-hidden":!o,style:s,className:_e(a,o&&"".concat(a,"-active"),n),ref:r},d)}),Y8=["renderTabBar"],J8=["label","key"],Q8=function(r){var a=r.renderTabBar,n=bt(r,Y8),s=l.useContext(zl),i=s.tabs;if(a){var o=X(X({},n),{},{panes:i.map(function(c){var d=c.label,m=c.key,u=bt(c,J8);return l.createElement(Lv,Ve({tab:d,key:m,tabKey:m},u))})});return a(o,sf)}return l.createElement(sf,n)},Z8=["key","forceRender","style","className","destroyInactiveTabPane"],eI=function(r){var a=r.id,n=r.activeKey,s=r.animated,i=r.tabPosition,o=r.destroyInactiveTabPane,c=l.useContext(zl),d=c.prefixCls,m=c.tabs,u=s.tabPane,x="".concat(d,"-tabpane");return l.createElement("div",{className:_e("".concat(d,"-content-holder"))},l.createElement("div",{className:_e("".concat(d,"-content"),"".concat(d,"-content-").concat(i),G({},"".concat(d,"-content-animated"),u))},m.map(function(h){var f=h.key,g=h.forceRender,b=h.style,p=h.className,v=h.destroyInactiveTabPane,y=bt(h,Z8),j=f===n;return l.createElement(Ga,Ve({key:f,visible:j,forceRender:g,removeOnLeave:!!(o||v),leavedClassName:"".concat(x,"-hidden")},s.tabPaneMotion),function(S,N){var w=S.style,_=S.className;return l.createElement(Lv,Ve({},y,{prefixCls:x,id:a,tabKey:f,animated:u,active:j,style:X(X({},b),w),className:_e(p,_),ref:N}))})})))};function tI(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},r;return t===!1?r={inkBar:!1,tabPane:!1}:t===!0?r={inkBar:!0,tabPane:!1}:r=X({inkBar:!0},et(t)==="object"?t:{}),r.tabPaneMotion&&r.tabPane===void 0&&(r.tabPane=!0),!r.tabPaneMotion&&r.tabPane&&(r.tabPane=!1),r}var rI=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],of=0,aI=l.forwardRef(function(t,r){var a=t.id,n=t.prefixCls,s=n===void 0?"rc-tabs":n,i=t.className,o=t.items,c=t.direction,d=t.activeKey,m=t.defaultActiveKey,u=t.editable,x=t.animated,h=t.tabPosition,f=h===void 0?"top":h,g=t.tabBarGutter,b=t.tabBarStyle,p=t.tabBarExtraContent,v=t.locale,y=t.more,j=t.destroyInactiveTabPane,S=t.renderTabBar,N=t.onChange,w=t.onTabClick,_=t.onTabScroll,P=t.getPopupContainer,O=t.popupClassName,T=t.indicator,k=bt(t,rI),$=l.useMemo(function(){return(o||[]).filter(function(Z){return Z&&et(Z)==="object"&&"key"in Z})},[o]),C=c==="rtl",A=tI(x),E=l.useState(!1),L=he(E,2),F=L[0],D=L[1];l.useEffect(function(){D(gv())},[]);var q=is(function(){var Z;return(Z=$[0])===null||Z===void 0?void 0:Z.key},{value:d,defaultValue:m}),Q=he(q,2),de=Q[0],H=Q[1],se=l.useState(function(){return $.findIndex(function(Z){return Z.key===de})}),W=he(se,2),le=W[0],U=W[1];l.useEffect(function(){var Z=$.findIndex(function(pe){return pe.key===de});if(Z===-1){var xe;Z=Math.max(0,Math.min(le,$.length-1)),H((xe=$[Z])===null||xe===void 0?void 0:xe.key)}U(Z)},[$.map(function(Z){return Z.key}).join("_"),de,le]);var ee=is(null,{value:a}),ae=he(ee,2),ue=ae[0],fe=ae[1];l.useEffect(function(){a||(fe("rc-tabs-".concat(of)),of+=1)},[]);function re(Z,xe){w==null||w(Z,xe);var pe=Z!==de;H(Z),pe&&(N==null||N(Z))}var V={id:ue,activeKey:de,animated:A,tabPosition:f,rtl:C,mobile:F},ce=X(X({},V),{},{editable:u,locale:v,more:y,tabBarGutter:g,onTabClick:re,onTabScroll:_,extra:p,style:b,panes:null,getPopupContainer:P,popupClassName:O,indicator:T});return l.createElement(zl.Provider,{value:{tabs:$,prefixCls:s}},l.createElement("div",Ve({ref:r,id:a,className:_e(s,"".concat(s,"-").concat(f),G(G(G({},"".concat(s,"-mobile"),F),"".concat(s,"-editable"),u),"".concat(s,"-rtl"),C),i)},k),l.createElement(Q8,Ve({},ce,{renderTabBar:S})),l.createElement(eI,Ve({destroyInactiveTabPane:j},V,{animated:A}))))});const nI={motionAppear:!1,motionEnter:!0,motionLeave:!0};function sI(t,r={inkBar:!0,tabPane:!1}){let a;return r===!1?a={inkBar:!1,tabPane:!1}:r===!0?a={inkBar:!0,tabPane:!0}:a=Object.assign({inkBar:!0},typeof r=="object"?r:{}),a.tabPane&&(a.tabPaneMotion=Object.assign(Object.assign({},nI),{motionName:yi(t,"switch")})),a}var iI=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};function oI(t){return t.filter(r=>r)}function lI(t,r){if(t)return t.map(n=>{var s;const i=(s=n.destroyOnHidden)!==null&&s!==void 0?s:n.destroyInactiveTabPane;return Object.assign(Object.assign({},n),{destroyInactiveTabPane:i})});const a=ys(r).map(n=>{if(l.isValidElement(n)){const{key:s,props:i}=n,o=i||{},{tab:c}=o,d=iI(o,["tab"]);return Object.assign(Object.assign({key:String(s)},d),{label:c})}return null});return oI(a)}const cI=t=>{const{componentCls:r,motionDurationSlow:a}=t;return[{[r]:{[`${r}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${a}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${a}`}}}}},[dh(t,"slide-up"),dh(t,"slide-down")]]},dI=t=>{const{componentCls:r,tabsCardPadding:a,cardBg:n,cardGutter:s,colorBorderSecondary:i,itemSelectedColor:o}=t;return{[`${r}-card`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab`]:{margin:0,padding:a,background:n,border:`${we(t.lineWidth)} ${t.lineType} ${i}`,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`},[`${r}-tab-active`]:{color:o,background:t.colorBgContainer},[`${r}-tab-focus:has(${r}-tab-btn:focus-visible)`]:tm(t,-3),[`& ${r}-tab${r}-tab-focus ${r}-tab-btn:focus-visible`]:{outline:"none"},[`${r}-ink-bar`]:{visibility:"hidden"}},[`&${r}-top, &${r}-bottom`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab + ${r}-tab`]:{marginLeft:{_skip_check_:!0,value:we(s)}}}},[`&${r}-top`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab`]:{borderRadius:`${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0 0`},[`${r}-tab-active`]:{borderBottomColor:t.colorBgContainer}}},[`&${r}-bottom`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab`]:{borderRadius:`0 0 ${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)}`},[`${r}-tab-active`]:{borderTopColor:t.colorBgContainer}}},[`&${r}-left, &${r}-right`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab + ${r}-tab`]:{marginTop:we(s)}}},[`&${r}-left`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab`]:{borderRadius:{_skip_check_:!0,value:`${we(t.borderRadiusLG)} 0 0 ${we(t.borderRadiusLG)}`}},[`${r}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:t.colorBgContainer}}}},[`&${r}-right`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0`}},[`${r}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:t.colorBgContainer}}}}}}},uI=t=>{const{componentCls:r,itemHoverColor:a,dropdownEdgeChildVerticalPadding:n}=t;return{[`${r}-dropdown`]:Object.assign(Object.assign({},Cl(t)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:t.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${r}-dropdown-menu`]:{maxHeight:t.tabsDropdownHeight,margin:0,padding:`${we(n)} 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:t.colorBgContainer,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,"&-item":Object.assign(Object.assign({},em),{display:"flex",alignItems:"center",minWidth:t.tabsDropdownWidth,margin:0,padding:`${we(t.paddingXXS)} ${we(t.paddingSM)}`,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:t.marginSM},color:t.colorIcon,fontSize:t.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:a}},"&:hover":{background:t.controlItemBgHover},"&-disabled":{"&, &:hover":{color:t.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},mI=t=>{const{componentCls:r,margin:a,colorBorderSecondary:n,horizontalMargin:s,verticalItemPadding:i,verticalItemMargin:o,calc:c}=t;return{[`${r}-top, ${r}-bottom`]:{flexDirection:"column",[`> ${r}-nav, > div > ${r}-nav`]:{margin:s,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${we(t.lineWidth)} ${t.lineType} ${n}`,content:"''"},[`${r}-ink-bar`]:{height:t.lineWidthBold,"&-animated":{transition:`width ${t.motionDurationSlow}, left ${t.motionDurationSlow},
            right ${t.motionDurationSlow}`}},[`${r}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:t.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:t.boxShadowTabsOverflowRight},[`&${r}-nav-wrap-ping-left::before`]:{opacity:1},[`&${r}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${r}-top`]:{[`> ${r}-nav,
        > div > ${r}-nav`]:{"&::before":{bottom:0},[`${r}-ink-bar`]:{bottom:0}}},[`${r}-bottom`]:{[`> ${r}-nav, > div > ${r}-nav`]:{order:1,marginTop:a,marginBottom:0,"&::before":{top:0},[`${r}-ink-bar`]:{top:0}},[`> ${r}-content-holder, > div > ${r}-content-holder`]:{order:0}},[`${r}-left, ${r}-right`]:{[`> ${r}-nav, > div > ${r}-nav`]:{flexDirection:"column",minWidth:c(t.controlHeight).mul(1.25).equal(),[`${r}-tab`]:{padding:i,textAlign:"center"},[`${r}-tab + ${r}-tab`]:{margin:o},[`${r}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:t.controlHeight},"&::before":{top:0,boxShadow:t.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:t.boxShadowTabsOverflowBottom},[`&${r}-nav-wrap-ping-top::before`]:{opacity:1},[`&${r}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${r}-ink-bar`]:{width:t.lineWidthBold,"&-animated":{transition:`height ${t.motionDurationSlow}, top ${t.motionDurationSlow}`}},[`${r}-nav-list, ${r}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${r}-left`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${r}-content-holder, > div > ${r}-content-holder`]:{marginLeft:{_skip_check_:!0,value:we(c(t.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${we(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${r}-content > ${r}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:t.paddingLG}}}},[`${r}-right`]:{[`> ${r}-nav, > div > ${r}-nav`]:{order:1,[`${r}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${r}-content-holder, > div > ${r}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:c(t.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${we(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${r}-content > ${r}-tabpane`]:{paddingRight:{_skip_check_:!0,value:t.paddingLG}}}}}},xI=t=>{const{componentCls:r,cardPaddingSM:a,cardPaddingLG:n,cardHeightSM:s,cardHeightLG:i,horizontalItemPaddingSM:o,horizontalItemPaddingLG:c}=t;return{[r]:{"&-small":{[`> ${r}-nav`]:{[`${r}-tab`]:{padding:o,fontSize:t.titleFontSizeSM}}},"&-large":{[`> ${r}-nav`]:{[`${r}-tab`]:{padding:c,fontSize:t.titleFontSizeLG,lineHeight:t.lineHeightLG}}}},[`${r}-card`]:{[`&${r}-small`]:{[`> ${r}-nav`]:{[`${r}-tab`]:{padding:a},[`${r}-nav-add`]:{minWidth:s,minHeight:s}},[`&${r}-bottom`]:{[`> ${r}-nav ${r}-tab`]:{borderRadius:`0 0 ${we(t.borderRadius)} ${we(t.borderRadius)}`}},[`&${r}-top`]:{[`> ${r}-nav ${r}-tab`]:{borderRadius:`${we(t.borderRadius)} ${we(t.borderRadius)} 0 0`}},[`&${r}-right`]:{[`> ${r}-nav ${r}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${we(t.borderRadius)} ${we(t.borderRadius)} 0`}}},[`&${r}-left`]:{[`> ${r}-nav ${r}-tab`]:{borderRadius:{_skip_check_:!0,value:`${we(t.borderRadius)} 0 0 ${we(t.borderRadius)}`}}}},[`&${r}-large`]:{[`> ${r}-nav`]:{[`${r}-tab`]:{padding:n},[`${r}-nav-add`]:{minWidth:i,minHeight:i}}}}}},hI=t=>{const{componentCls:r,itemActiveColor:a,itemHoverColor:n,iconCls:s,tabsHorizontalItemMargin:i,horizontalItemPadding:o,itemSelectedColor:c,itemColor:d}=t,m=`${r}-tab`;return{[m]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:o,fontSize:t.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:d,"&-btn, &-remove":{"&:focus:not(:focus-visible), &:active":{color:a}},"&-btn":{outline:"none",transition:`all ${t.motionDurationSlow}`,[`${m}-icon:not(:last-child)`]:{marginInlineEnd:t.marginSM}},"&-remove":Object.assign({flex:"none",lineHeight:1,marginRight:{_skip_check_:!0,value:t.calc(t.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:t.marginXS},color:t.colorIcon,fontSize:t.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"&:hover":{color:t.colorTextHeading}},vi(t)),"&:hover":{color:n},[`&${m}-active ${m}-btn`]:{color:c,textShadow:t.tabsActiveTextShadow},[`&${m}-focus ${m}-btn:focus-visible`]:tm(t),[`&${m}-disabled`]:{color:t.colorTextDisabled,cursor:"not-allowed"},[`&${m}-disabled ${m}-btn, &${m}-disabled ${r}-remove`]:{"&:focus, &:active":{color:t.colorTextDisabled}},[`& ${m}-remove ${s}`]:{margin:0,verticalAlign:"middle"},[`${s}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:t.marginSM}}},[`${m} + ${m}`]:{margin:{_skip_check_:!0,value:i}}}},fI=t=>{const{componentCls:r,tabsHorizontalItemMarginRTL:a,iconCls:n,cardGutter:s,calc:i}=t;return{[`${r}-rtl`]:{direction:"rtl",[`${r}-nav`]:{[`${r}-tab`]:{margin:{_skip_check_:!0,value:a},[`${r}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[n]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:we(t.marginSM)}},[`${r}-tab-remove`]:{marginRight:{_skip_check_:!0,value:we(t.marginXS)},marginLeft:{_skip_check_:!0,value:we(i(t.marginXXS).mul(-1).equal())},[n]:{margin:0}}}},[`&${r}-left`]:{[`> ${r}-nav`]:{order:1},[`> ${r}-content-holder`]:{order:0}},[`&${r}-right`]:{[`> ${r}-nav`]:{order:0},[`> ${r}-content-holder`]:{order:1}},[`&${r}-card${r}-top, &${r}-card${r}-bottom`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-tab + ${r}-tab`]:{marginRight:{_skip_check_:!0,value:s},marginLeft:{_skip_check_:!0,value:0}}}}},[`${r}-dropdown-rtl`]:{direction:"rtl"},[`${r}-menu-item`]:{[`${r}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},gI=t=>{const{componentCls:r,tabsCardPadding:a,cardHeight:n,cardGutter:s,itemHoverColor:i,itemActiveColor:o,colorBorderSecondary:c}=t;return{[r]:Object.assign(Object.assign(Object.assign(Object.assign({},Cl(t)),{display:"flex",[`> ${r}-nav, > div > ${r}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${r}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${t.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${r}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${t.motionDurationSlow}`},[`${r}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${r}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${r}-nav-more`]:{position:"relative",padding:a,background:"transparent",border:0,color:t.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:t.calc(t.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${r}-nav-add`]:Object.assign({minWidth:n,minHeight:n,marginLeft:{_skip_check_:!0,value:s},background:"transparent",border:`${we(t.lineWidth)} ${t.lineType} ${c}`,borderRadius:`${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:t.colorText,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:o}},vi(t,-3))},[`${r}-extra-content`]:{flex:"none"},[`${r}-ink-bar`]:{position:"absolute",background:t.inkBarColor,pointerEvents:"none"}}),hI(t)),{[`${r}-content`]:{position:"relative",width:"100%"},[`${r}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${r}-tabpane`]:Object.assign(Object.assign({},vi(t)),{"&-hidden":{display:"none"}})}),[`${r}-centered`]:{[`> ${r}-nav, > div > ${r}-nav`]:{[`${r}-nav-wrap`]:{[`&:not([class*='${r}-nav-wrap-ping']) > ${r}-nav-list`]:{margin:"auto"}}}}}},pI=t=>{const{cardHeight:r,cardHeightSM:a,cardHeightLG:n,controlHeight:s,controlHeightLG:i}=t,o=r||i,c=a||s,d=n||i+8;return{zIndexPopup:t.zIndexPopupBase+50,cardBg:t.colorFillAlter,cardHeight:o,cardHeightSM:c,cardHeightLG:d,cardPadding:`${(o-t.fontHeight)/2-t.lineWidth}px ${t.padding}px`,cardPaddingSM:`${(c-t.fontHeight)/2-t.lineWidth}px ${t.paddingXS}px`,cardPaddingLG:`${(d-t.fontHeightLG)/2-t.lineWidth}px ${t.padding}px`,titleFontSize:t.fontSize,titleFontSizeLG:t.fontSizeLG,titleFontSizeSM:t.fontSize,inkBarColor:t.colorPrimary,horizontalMargin:`0 0 ${t.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${t.paddingSM}px 0`,horizontalItemPaddingSM:`${t.paddingXS}px 0`,horizontalItemPaddingLG:`${t.padding}px 0`,verticalItemPadding:`${t.paddingXS}px ${t.paddingLG}px`,verticalItemMargin:`${t.margin}px 0 0 0`,itemColor:t.colorText,itemSelectedColor:t.colorPrimary,itemHoverColor:t.colorPrimaryHover,itemActiveColor:t.colorPrimaryActive,cardGutter:t.marginXXS/2}},bI=Ln("Tabs",t=>{const r=ua(t,{tabsCardPadding:t.cardPadding,dropdownEdgeChildVerticalPadding:t.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${we(t.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${we(t.horizontalItemGutter)}`});return[xI(r),fI(r),mI(r),uI(r),dI(r),gI(r),cI(r)]},pI),vI=()=>null;var yI=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const jI=l.forwardRef((t,r)=>{var a,n,s,i,o,c,d,m,u,x,h;const{type:f,className:g,rootClassName:b,size:p,onEdit:v,hideAdd:y,centered:j,addIcon:S,removeIcon:N,moreIcon:w,more:_,popupClassName:P,children:O,items:T,animated:k,style:$,indicatorSize:C,indicator:A,destroyInactiveTabPane:E,destroyOnHidden:L}=t,F=yI(t,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","removeIcon","moreIcon","more","popupClassName","children","items","animated","style","indicatorSize","indicator","destroyInactiveTabPane","destroyOnHidden"]),{prefixCls:D}=F,{direction:q,tabs:Q,getPrefixCls:de,getPopupContainer:H}=l.useContext(It),se=de("tabs",D),W=nm(se),[le,U,ee]=bI(se,W),ae=l.useRef(null);l.useImperativeHandle(r,()=>({nativeElement:ae.current}));let ue;f==="editable-card"&&(ue={onEdit:(pe,{key:Se,event:ke})=>{v==null||v(pe==="add"?ke:Se,pe)},removeIcon:(a=N??(Q==null?void 0:Q.removeIcon))!==null&&a!==void 0?a:l.createElement(kl,null),addIcon:(S??(Q==null?void 0:Q.addIcon))||l.createElement(D8,null),showAdd:y!==!0});const fe=de(),re=om(p),V=lI(T,O),ce=sI(se,k),Z=Object.assign(Object.assign({},Q==null?void 0:Q.style),$),xe={align:(n=A==null?void 0:A.align)!==null&&n!==void 0?n:(s=Q==null?void 0:Q.indicator)===null||s===void 0?void 0:s.align,size:(d=(o=(i=A==null?void 0:A.size)!==null&&i!==void 0?i:C)!==null&&o!==void 0?o:(c=Q==null?void 0:Q.indicator)===null||c===void 0?void 0:c.size)!==null&&d!==void 0?d:Q==null?void 0:Q.indicatorSize};return le(l.createElement(aI,Object.assign({ref:ae,direction:q,getPopupContainer:H},F,{items:V,className:_e({[`${se}-${re}`]:re,[`${se}-card`]:["card","editable-card"].includes(f),[`${se}-editable-card`]:f==="editable-card",[`${se}-centered`]:j},Q==null?void 0:Q.className,g,b,U,ee,W),popupClassName:_e(P,U,ee,W),style:Z,editable:ue,more:Object.assign({icon:(h=(x=(u=(m=Q==null?void 0:Q.more)===null||m===void 0?void 0:m.icon)!==null&&u!==void 0?u:Q==null?void 0:Q.moreIcon)!==null&&x!==void 0?x:w)!==null&&h!==void 0?h:l.createElement(M8,null),transitionName:`${fe}-slide-up`},_),prefixCls:se,animated:ce,indicator:xe,destroyInactiveTabPane:L??E})))}),Dv=jI;Dv.TabPane=vI;var wI=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const zv=t=>{var{prefixCls:r,className:a,hoverable:n=!0}=t,s=wI(t,["prefixCls","className","hoverable"]);const{getPrefixCls:i}=l.useContext(It),o=i("card",r),c=_e(`${o}-grid`,a,{[`${o}-grid-hoverable`]:n});return l.createElement("div",Object.assign({},s,{className:c}))},NI=t=>{const{antCls:r,componentCls:a,headerHeight:n,headerPadding:s,tabsMarginBottom:i}=t;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:n,marginBottom:-1,padding:`0 ${we(s)}`,color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:t.headerFontSize,background:t.headerBg,borderBottom:`${we(t.lineWidth)} ${t.lineType} ${t.colorBorderSecondary}`,borderRadius:`${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0 0`},_l()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},em),{[`
          > ${a}-typography,
          > ${a}-typography-edit-content
        `]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${r}-tabs-top`]:{clear:"both",marginBottom:i,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,"&-bar":{borderBottom:`${we(t.lineWidth)} ${t.lineType} ${t.colorBorderSecondary}`}}})},SI=t=>{const{cardPaddingBase:r,colorBorderSecondary:a,cardShadow:n,lineWidth:s}=t;return{width:"33.33%",padding:r,border:0,borderRadius:0,boxShadow:`
      ${we(s)} 0 0 0 ${a},
      0 ${we(s)} 0 0 ${a},
      ${we(s)} ${we(s)} 0 0 ${a},
      ${we(s)} 0 0 0 ${a} inset,
      0 ${we(s)} 0 0 ${a} inset;
    `,transition:`all ${t.motionDurationMid}`,"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:n}}},CI=t=>{const{componentCls:r,iconCls:a,actionsLiMargin:n,cardActionsIconSize:s,colorBorderSecondary:i,actionsBg:o}=t;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:o,borderTop:`${we(t.lineWidth)} ${t.lineType} ${i}`,display:"flex",borderRadius:`0 0 ${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)}`},_l()),{"& > li":{margin:n,color:t.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:t.calc(t.cardActionsIconSize).mul(2).equal(),fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer","&:hover":{color:t.colorPrimary,transition:`color ${t.motionDurationMid}`},[`a:not(${r}-btn), > ${a}`]:{display:"inline-block",width:"100%",color:t.colorIcon,lineHeight:we(t.fontHeight),transition:`color ${t.motionDurationMid}`,"&:hover":{color:t.colorPrimary}},[`> ${a}`]:{fontSize:s,lineHeight:we(t.calc(s).mul(t.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:`${we(t.lineWidth)} ${t.lineType} ${i}`}}})},_I=t=>Object.assign(Object.assign({margin:`${we(t.calc(t.marginXXS).mul(-1).equal())} 0`,display:"flex"},_l()),{"&-avatar":{paddingInlineEnd:t.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:t.marginXS}},"&-title":Object.assign({color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:t.fontSizeLG},em),"&-description":{color:t.colorTextDescription}}),kI=t=>{const{componentCls:r,colorFillAlter:a,headerPadding:n,bodyPadding:s}=t;return{[`${r}-head`]:{padding:`0 ${we(n)}`,background:a,"&-title":{fontSize:t.fontSize}},[`${r}-body`]:{padding:`${we(t.padding)} ${we(s)}`}}},PI=t=>{const{componentCls:r}=t;return{overflow:"hidden",[`${r}-body`]:{userSelect:"none"}}},$I=t=>{const{componentCls:r,cardShadow:a,cardHeadPadding:n,colorBorderSecondary:s,boxShadowTertiary:i,bodyPadding:o,extraColor:c}=t;return{[r]:Object.assign(Object.assign({},Cl(t)),{position:"relative",background:t.colorBgContainer,borderRadius:t.borderRadiusLG,[`&:not(${r}-bordered)`]:{boxShadow:i},[`${r}-head`]:NI(t),[`${r}-extra`]:{marginInlineStart:"auto",color:c,fontWeight:"normal",fontSize:t.fontSize},[`${r}-body`]:{padding:o,borderRadius:`0 0 ${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)}`},[`${r}-grid`]:SI(t),[`${r}-cover`]:{"> *":{display:"block",width:"100%",borderRadius:`${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0 0`}},[`${r}-actions`]:CI(t),[`${r}-meta`]:_I(t)}),[`${r}-bordered`]:{border:`${we(t.lineWidth)} ${t.lineType} ${s}`,[`${r}-cover`]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},[`${r}-hoverable`]:{cursor:"pointer",transition:`box-shadow ${t.motionDurationMid}, border-color ${t.motionDurationMid}`,"&:hover":{borderColor:"transparent",boxShadow:a}},[`${r}-contain-grid`]:{borderRadius:`${we(t.borderRadiusLG)} ${we(t.borderRadiusLG)} 0 0 `,[`${r}-body`]:{display:"flex",flexWrap:"wrap"},[`&:not(${r}-loading) ${r}-body`]:{marginBlockStart:t.calc(t.lineWidth).mul(-1).equal(),marginInlineStart:t.calc(t.lineWidth).mul(-1).equal(),padding:0}},[`${r}-contain-tabs`]:{[`> div${r}-head`]:{minHeight:0,[`${r}-head-title, ${r}-extra`]:{paddingTop:n}}},[`${r}-type-inner`]:kI(t),[`${r}-loading`]:PI(t),[`${r}-rtl`]:{direction:"rtl"}}},EI=t=>{const{componentCls:r,bodyPaddingSM:a,headerPaddingSM:n,headerHeightSM:s,headerFontSizeSM:i}=t;return{[`${r}-small`]:{[`> ${r}-head`]:{minHeight:s,padding:`0 ${we(n)}`,fontSize:i,[`> ${r}-head-wrapper`]:{[`> ${r}-extra`]:{fontSize:t.fontSize}}},[`> ${r}-body`]:{padding:a}},[`${r}-small${r}-contain-tabs`]:{[`> ${r}-head`]:{[`${r}-head-title, ${r}-extra`]:{paddingTop:0,display:"flex",alignItems:"center"}}}}},AI=t=>{var r,a;return{headerBg:"transparent",headerFontSize:t.fontSizeLG,headerFontSizeSM:t.fontSize,headerHeight:t.fontSizeLG*t.lineHeightLG+t.padding*2,headerHeightSM:t.fontSize*t.lineHeight+t.paddingXS*2,actionsBg:t.colorBgContainer,actionsLiMargin:`${t.paddingSM}px 0`,tabsMarginBottom:-t.padding-t.lineWidth,extraColor:t.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:(r=t.bodyPadding)!==null&&r!==void 0?r:t.paddingLG,headerPadding:(a=t.headerPadding)!==null&&a!==void 0?a:t.paddingLG}},OI=Ln("Card",t=>{const r=ua(t,{cardShadow:t.boxShadowCard,cardHeadPadding:t.padding,cardPaddingBase:t.paddingLG,cardActionsIconSize:t.fontSize});return[$I(r),EI(r)]},AI);var lf=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const II=t=>{const{actionClasses:r,actions:a=[],actionStyle:n}=t;return l.createElement("ul",{className:r,style:n},a.map((s,i)=>{const o=`action-${i}`;return l.createElement("li",{style:{width:`${100/a.length}%`},key:o},l.createElement("span",null,s))}))},TI=l.forwardRef((t,r)=>{const{prefixCls:a,className:n,rootClassName:s,style:i,extra:o,headStyle:c={},bodyStyle:d={},title:m,loading:u,bordered:x,variant:h,size:f,type:g,cover:b,actions:p,tabList:v,children:y,activeTabKey:j,defaultActiveTabKey:S,tabBarExtraContent:N,hoverable:w,tabProps:_={},classNames:P,styles:O}=t,T=lf(t,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:k,direction:$,card:C}=l.useContext(It),[A]=WO("card",h,x),E=K=>{var ie;(ie=t.onTabChange)===null||ie===void 0||ie.call(t,K)},L=K=>{var ie;return _e((ie=C==null?void 0:C.classNames)===null||ie===void 0?void 0:ie[K],P==null?void 0:P[K])},F=K=>{var ie;return Object.assign(Object.assign({},(ie=C==null?void 0:C.styles)===null||ie===void 0?void 0:ie[K]),O==null?void 0:O[K])},D=l.useMemo(()=>{let K=!1;return l.Children.forEach(y,ie=>{(ie==null?void 0:ie.type)===zv&&(K=!0)}),K},[y]),q=k("card",a),[Q,de,H]=OI(q),se=l.createElement(Dn,{loading:!0,active:!0,paragraph:{rows:4},title:!1},y),W=j!==void 0,le=Object.assign(Object.assign({},_),{[W?"activeKey":"defaultActiveKey"]:W?j:S,tabBarExtraContent:N});let U;const ee=om(f),ae=!ee||ee==="default"?"large":ee,ue=v?l.createElement(Dv,Object.assign({size:ae},le,{className:`${q}-head-tabs`,onChange:E,items:v.map(K=>{var{tab:ie}=K,I=lf(K,["tab"]);return Object.assign({label:ie},I)})})):null;if(m||o||ue){const K=_e(`${q}-head`,L("header")),ie=_e(`${q}-head-title`,L("title")),I=_e(`${q}-extra`,L("extra")),R=Object.assign(Object.assign({},c),F("header"));U=l.createElement("div",{className:K,style:R},l.createElement("div",{className:`${q}-head-wrapper`},m&&l.createElement("div",{className:ie,style:F("title")},m),o&&l.createElement("div",{className:I,style:F("extra")},o)),ue)}const fe=_e(`${q}-cover`,L("cover")),re=b?l.createElement("div",{className:fe,style:F("cover")},b):null,V=_e(`${q}-body`,L("body")),ce=Object.assign(Object.assign({},d),F("body")),Z=l.createElement("div",{className:V,style:ce},u?se:y),xe=_e(`${q}-actions`,L("actions")),pe=p!=null&&p.length?l.createElement(II,{actionClasses:xe,actionStyle:F("actions"),actions:p}):null,Se=xn(T,["onTabChange"]),ke=_e(q,C==null?void 0:C.className,{[`${q}-loading`]:u,[`${q}-bordered`]:A!=="borderless",[`${q}-hoverable`]:w,[`${q}-contain-grid`]:D,[`${q}-contain-tabs`]:v==null?void 0:v.length,[`${q}-${ee}`]:ee,[`${q}-type-${g}`]:!!g,[`${q}-rtl`]:$==="rtl"},n,s,de,H),$e=Object.assign(Object.assign({},C==null?void 0:C.style),i);return Q(l.createElement("div",Object.assign({ref:r},Se,{className:ke,style:$e}),U,re,Z,pe))});var MI=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const RI=t=>{const{prefixCls:r,className:a,avatar:n,title:s,description:i}=t,o=MI(t,["prefixCls","className","avatar","title","description"]),{getPrefixCls:c}=l.useContext(It),d=c("card",r),m=_e(`${d}-meta`,a),u=n?l.createElement("div",{className:`${d}-meta-avatar`},n):null,x=s?l.createElement("div",{className:`${d}-meta-title`},s):null,h=i?l.createElement("div",{className:`${d}-meta-description`},i):null,f=x||h?l.createElement("div",{className:`${d}-meta-detail`},x,h):null;return l.createElement("div",Object.assign({},o,{className:m}),u,f)},vm=TI;vm.Grid=zv;vm.Meta=RI;var LI=function(t,r){var a={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(a[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)r.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(a[n[s]]=t[n[s]]);return a};const DI=t=>{const{prefixCls:r,className:a,closeIcon:n,closable:s,type:i,title:o,children:c,footer:d}=t,m=LI(t,["prefixCls","className","closeIcon","closable","type","title","children","footer"]),{getPrefixCls:u}=l.useContext(It),x=u(),h=r||u("modal"),f=nm(x),[g,b,p]=sv(h,f),v=`${h}-confirm`;let y={};return i?y={closable:s??!1,title:"",footer:"",children:l.createElement(ov,Object.assign({},t,{prefixCls:h,confirmPrefixCls:v,rootPrefixCls:x,content:c}))}:y={closable:s??!0,title:o,footer:d!==null&&l.createElement(tv,Object.assign({},t)),children:c},g(l.createElement(Vb,Object.assign({prefixCls:h,className:_e(b,`${h}-pure-panel`,i&&v,i&&`${v}-${i}`,a,p,f)},m,{closeIcon:ev(h,n),closable:s},y)))},zI=bO(DI);function Fv(t){return Mi(uv(t))}const xa=iv;xa.useModal=pO;xa.info=function(r){return Mi(mv(r))};xa.success=function(r){return Mi(xv(r))};xa.error=function(r){return Mi(hv(r))};xa.warning=Fv;xa.warn=Fv;xa.confirm=function(r){return Mi(fv(r))};xa.destroyAll=function(){for(;Sn.length;){const r=Sn.pop();r&&r()}};xa.config=mO;xa._InternalPanelDoNotUseOrYouWillBeFired=zI;const cf=["#0088FE","#00C49F","#FFBB28","#FF8042"],FI={low:"#3b82f6",medium:"#eab308",high:"#f97316",critical:"#ef4444"},BI=({analytics:t,onDownload:r})=>{var p,v;const[a,n]=l.useState("overview"),[s,i]=l.useState(null),[o,c]=l.useState(""),[d,m]=l.useState(!1),[u,x]=l.useState(!1),h=((p=t==null?void 0:t.severityStats)==null?void 0:p.map(y=>({name:y.severity.charAt(0).toUpperCase()+y.severity.slice(1),count:y.count,fill:FI[y.severity]||"#8884d8"})))||[],f=((v=t==null?void 0:t.statusStats)==null?void 0:v.map((y,j)=>({name:y.status.replace("_"," ").toUpperCase(),value:y.count,color:cf[j%cf.length]})))||[],g=(t==null?void 0:t.weeklyActivity)||[],b=({title:y,description:j,type:S,onPreview:N})=>e.jsxs(vm,{className:"mb-4 shadow-md bg-slate-800 border-slate-700",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-2",children:y}),e.jsx("p",{className:"text-slate-400 text-sm mb-4",children:j})]}),e.jsx("div",{className:"p-2 bg-slate-700 rounded-lg",children:e.jsx(dr,{className:"text-blue-400",size:24})})]}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(nn,{type:"primary",icon:e.jsx(ti,{size:16}),onClick:()=>r(S,!1,"csv"),className:"bg-blue-600 hover:bg-blue-500 border-none",children:"Download CSV"}),S!=="raw"&&e.jsx(nn,{icon:e.jsx(dr,{size:16}),onClick:()=>r(S,!1,"pdf"),className:"bg-red-600 hover:bg-red-500 text-white border-none",children:"Download PDF"})]})]});return e.jsxs("div",{className:"space-y-6 animate-fadeIn",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-slate-800 p-6 rounded-xl border border-slate-700 col-span-1 lg:col-span-2",children:[e.jsx("h3",{className:"text-white font-bold mb-4",children:"Weekly Engagement"}),e.jsx("div",{className:"h-64",children:e.jsx(Ra,{width:"100%",height:"100%",children:e.jsxs(lp,{data:g,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"colorActivity",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),e.jsx(ps,{strokeDasharray:"3 3",stroke:"#334155",vertical:!1}),e.jsx(bs,{dataKey:"name",stroke:"#94a3b8"}),e.jsx(vs,{stroke:"#94a3b8"}),e.jsx(La,{contentStyle:{backgroundColor:"#1e293b",borderColor:"#334155",color:"#fff"},itemStyle:{color:"#fff"}}),e.jsx(Fu,{type:"monotone",dataKey:"value",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorActivity)"})]})})})]}),e.jsxs("div",{className:"bg-slate-800 p-6 rounded-xl border border-slate-700",children:[e.jsx("h3",{className:"text-white font-bold mb-4",children:"Alert Severity"}),e.jsx("div",{className:"h-64",children:e.jsx(Ra,{width:"100%",height:"100%",children:e.jsxs(Xc,{data:h,layout:"vertical",children:[e.jsx(ps,{strokeDasharray:"3 3",stroke:"#334155",horizontal:!1}),e.jsx(bs,{type:"number",stroke:"#94a3b8"}),e.jsx(vs,{dataKey:"name",type:"category",stroke:"#94a3b8",width:60}),e.jsx(La,{cursor:{fill:"#334155"},contentStyle:{backgroundColor:"#1e293b",borderColor:"#334155",color:"#fff"},itemStyle:{color:"#fff"}}),e.jsx(Lo,{dataKey:"count",radius:[0,4,4,0],children:h.map((y,j)=>e.jsx(gs,{fill:y.fill},`cell-${j}`))})]})})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-slate-800 p-6 rounded-xl border border-slate-700",children:[e.jsx("h3",{className:"text-white font-bold mb-4",children:"Investigation Status"}),e.jsx("div",{className:"h-64 flex justify-center",children:e.jsx(Ra,{width:"100%",height:"100%",children:e.jsxs(CC,{children:[e.jsx(Vg,{data:f,innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:f.map((y,j)=>e.jsx(gs,{fill:y.color},`cell-${j}`))}),e.jsx(La,{contentStyle:{backgroundColor:"#1e293b",borderColor:"#334155",color:"#fff"},itemStyle:{color:"#fff"}}),e.jsx(Og,{})]})})})]}),e.jsx("div",{className:"col-span-1 md:col-span-2",children:e.jsxs("div",{className:"bg-slate-800 p-6 rounded-xl border border-slate-700 h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h3",{className:"text-white font-bold",children:"Generated Reports"}),e.jsx(nn,{icon:e.jsx(k1,{size:16}),onClick:()=>window.print(),className:"text-slate-300",children:"Print / Save PDF"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{title:"Team Progress Report",description:"Detailed breakdown of XP, levels, and tasks completed by each member.",type:"progress",onDownload:r}),e.jsx(b,{title:"Compliance & SLA Report",description:"Audit log of alert assignments, resolution times, and grading outcomes.",type:"compliance",onDownload:r}),e.jsx(b,{title:"Raw Investigation Data",description:"Full JSON export of all investigation data for external analysis.",type:"raw",onDownload:r})]})]})})]}),e.jsx(xa,{title:o,open:d,onCancel:()=>m(!1),footer:null,width:800,children:e.jsx("p",{children:"Preview functionality coming with JSON endpoint support."})})]})},HI=({onClose:t,organization:r,memberCount:a=1})=>{const[n,s]=l.useState(null),[i,o]=l.useState(!1),[c,d]=l.useState("monthly"),[m,u]=l.useState(a);l.useEffect(()=>{u(a)},[a]);const x=[{id:"small",name:"Create Team (Small)",range:[1,10],priceKey:"tier_small_price",stripeIdKey:"tier_small_stripe_id",color:"blue"},{id:"medium",name:"Growth Team (Medium)",range:[11,25],priceKey:"tier_medium_price",stripeIdKey:"tier_medium_stripe_id",color:"purple"},{id:"large",name:"Enterprise Team (Large)",range:[26,9999],priceKey:"tier_large_price",stripeIdKey:"tier_large_stripe_id",color:"cyan"}];l.useEffect(()=>{(async()=>{try{const y=await fetch(`${Y}/api/auth/config`);if(y.ok){const j=await y.json();s(j)}}catch(y){console.error("Failed to load config",y)}})()},[]);const h=x.find(v=>m>=v.range[0]&&m<=v.range[1])||x[x.length-1],f=async()=>{if(!n)return;let v;if(c==="yearly"&&(v=n[`${h.stripeIdKey}_yearly`]),v||(v=n[h.stripeIdKey]),!v){z.error("Pricing configuration missing. Please contact support.");return}o(!0);try{const y=localStorage.getItem("token"),j=xf(n.stripe_publishable_key),S=await fetch(`${Y}/api/payment/create-checkout-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({priceId:v,quantity:m})});if(!S.ok){const w=await S.json();throw new Error(w.message||"Failed to start checkout")}const N=await S.json();if(N.url)window.location.href=N.url;else throw new Error("No checkout URL received from server")}catch(y){console.error("Upgrade error:",y),z.error(y.message||"Failed to initiate upgrade.")}finally{o(!1)}};if(!n)return null;const g=parseFloat(n[h.priceKey])||0;let b=g,p=0;if(c==="yearly"){const v=g*10;b=v/12,p=v*m}else p=g*m;return e.jsx("div",{className:"fixed inset-0 bg-black/90 backdrop-blur-md flex items-center justify-center z-[100] p-4 animate-in fade-in duration-200",children:e.jsxs("div",{className:`bg-[#1a1b1e] border border-${h.color}-500/30 rounded-2xl max-w-lg w-full overflow-hidden shadow-[0_0_50px_rgba(0,0,0,0.5)] relative flex flex-col`,children:[e.jsxs("div",{className:`bg-gradient-to-r from-${h.color}-900/50 to-gray-900 p-8 text-center relative overflow-hidden`,children:[e.jsx("div",{className:`absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-${h.color}-500 to-${h.color}-300`}),e.jsx("div",{className:`w-16 h-16 bg-${h.color}-500/20 rounded-full flex items-center justify-center mx-auto mb-4 ring-1 ring-${h.color}-500/50`,children:e.jsx(xr,{className:`w-8 h-8 text-${h.color}-400`})}),e.jsx("h2",{className:"text-2xl font-bold text-white mb-4",children:"Upgrade Support Plan"}),e.jsxs("div",{className:"inline-flex bg-black/40 rounded-full p-1 border border-white/10 mx-auto",children:[e.jsx("button",{onClick:()=>d("monthly"),className:`px-4 py-1.5 rounded-full text-xs font-bold transition-all ${c==="monthly"?"bg-[#333] text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:"Monthly"}),e.jsxs("button",{onClick:()=>d("yearly"),className:`px-4 py-1.5 rounded-full text-xs font-bold transition-all flex items-center gap-1.5 ${c==="yearly"?"bg-[#333] text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:["Yearly ",e.jsx("span",{className:"text-[10px] bg-green-500/20 text-green-400 px-1.5 py-0.5 rounded-full",children:"2 Months Free"})]})]})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between bg-gray-800/50 p-3 rounded-xl border border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gray-700/50 rounded-lg",children:e.jsx(At,{className:"w-5 h-5 text-gray-300"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-400 font-bold uppercase tracking-wider mb-1",children:"Team Size"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>u(Math.max(a,m-1)),className:"w-6 h-6 rounded bg-gray-700 hover:bg-gray-600 flex items-center justify-center text-white",children:"-"}),e.jsx("input",{type:"number",min:a,value:m,onChange:v=>u(Math.max(a,parseInt(v.target.value)||a)),className:"w-16 bg-black/30 border border-gray-700 rounded text-center text-white font-bold text-sm py-0.5"}),e.jsx("button",{onClick:()=>u(m+1),className:"w-6 h-6 rounded bg-gray-700 hover:bg-gray-600 flex items-center justify-center text-white",children:"+"})]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs text-gray-400 font-bold uppercase tracking-wider",children:"Plan Tier"}),e.jsx("div",{className:`text-sm font-bold text-${h.color}-400`,children:h.name})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cr,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-gray-300 text-sm",children:"Unlimited Investigations"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cr,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-gray-300 text-sm",children:"AI Scenario Generator"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cr,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-gray-300 text-sm",children:"Team Analytics"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cr,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-gray-300 text-sm",children:"Priority Support"})]})]}),e.jsxs("div",{className:"bg-gray-800/30 rounded-xl p-5 border border-gray-700",children:[e.jsxs("div",{className:"flex justify-between items-end mb-2",children:[e.jsx("div",{className:"text-gray-400 text-sm",children:"Effective per user"}),e.jsxs("div",{className:"text-xl font-bold text-white",children:["$",b.toFixed(2),e.jsx("span",{className:"text-sm text-gray-500 font-normal",children:"/mo"})]})]}),e.jsxs("div",{className:"flex justify-between items-end pt-3 border-t border-gray-700",children:[e.jsxs("div",{className:"text-white font-bold text-sm",children:["Total ",c==="yearly"?"Yearly":"Monthly"]}),e.jsxs("div",{className:`text-2xl font-bold text-${h.color}-400`,children:["$",p.toFixed(2)]})]}),c==="yearly"&&e.jsxs("div",{className:"text-right text-xs text-green-400 mt-1",children:["You save $",(g*2*m).toFixed(2)," a year!"]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:t,className:"flex-1 px-4 py-3 rounded-xl border border-gray-700 text-gray-300 hover:bg-gray-800 transition font-bold text-sm",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:i,className:`flex-[2] px-4 py-3 rounded-xl bg-${h.color}-600 hover:bg-${h.color}-500 text-white font-bold shadow-lg shadow-${h.color}-900/20 transition-all flex items-center justify-center gap-2 disabled:opacity-50`,children:i?"Processing...":e.jsxs(e.Fragment,{children:[e.jsx(kr,{className:"w-4 h-4 fill-current"}),"Upgrade Now"]})})]})]})]})})},WI=({activeTab:t,setActiveTab:r,isOpen:a,setIsOpen:n,onLogout:s,userRole:i,setFilters:o,setSearchText:c})=>{const m=[{id:"overview",label:"Overview",icon:yu,roles:["owner","admin","member"]},{id:"members",label:"Team",icon:At,roles:["owner","admin"]},{id:"training_alerts",label:"Training Alerts",icon:xr,roles:["owner","admin"]},{id:"assignments",label:"Assignments",icon:Mt,roles:["owner","admin"]},{id:"assessments",label:"Assessments",icon:Cn,roles:["owner","admin"]},{id:"activity",label:"Activity",icon:Er,roles:["owner","admin"]},{id:"reports",label:"Reports",icon:dr,roles:["owner","admin"]},{id:"settings",label:"Settings",icon:ki,roles:["owner","admin"]}].filter(x=>x.roles.includes(i)),u=["owner","admin"].includes(i)?e.jsxs("span",{children:["Business",e.jsx("span",{className:"text-blue-500",children:"Admin"})]}):e.jsxs("span",{children:["Team",e.jsx("span",{className:"text-blue-500",children:"Workspace"})]});return e.jsxs(e.Fragment,{children:[a&&e.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:()=>n(!1)}),e.jsxs("div",{className:`
                fixed inset-y-0 left-0 z-50 w-64 bg-[#111215] border-r border-[#1a1b1e] flex flex-col transition-transform duration-300 ease-in-out lg:translate-x-0
                ${a?"translate-x-0":"-translate-x-full"}
            `,children:[e.jsxs("div",{className:"h-16 flex items-center px-6 border-b border-[#1a1b1e]",children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-white text-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center",children:e.jsx(as,{className:"w-5 h-5 text-white"})}),u]}),e.jsx("button",{onClick:()=>n(!1),className:"ml-auto lg:hidden text-gray-400",children:e.jsx(oa,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-6 px-3 space-y-1",children:m.map(x=>e.jsxs("button",{onClick:()=>{r(x.id),o&&o({difficulty:"",type:""}),c&&c(""),n(!1)},className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all ${t===x.id?"bg-blue-600/10 text-blue-400 border-l-2 border-blue-500":"text-gray-400 hover:bg-[#1a1b1e] hover:text-white"}`,children:[e.jsx(x.icon,{className:`w-5 h-5 ${t===x.id?"text-blue-500":"text-gray-500"}`}),x.label]},x.id))}),e.jsx("div",{className:"p-4 border-t border-[#1a1b1e]",children:e.jsxs("button",{onClick:s,className:"w-full flex items-center gap-3 px-3 py-2 text-gray-400 hover:text-red-400 hover:bg-red-500/5 rounded-lg transition-colors text-sm font-medium",children:[e.jsx(uf,{className:"w-5 h-5"}),"Sign Out"]})})]})]})},Nc=({user:t,onNavigate:r})=>{var Gt;const[a,n]=l.useState(null),[s,i]=l.useState([]),[o,c]=l.useState(null),[d,m]=l.useState([]),[u,x]=l.useState([]),[h,f]=l.useState([]),[g,b]=l.useState([]),[p,v]=l.useState(!0),[y,j]=l.useState("overview"),[S,N]=l.useState(!1),[w,_]=l.useState("library"),[P,O]=l.useState({page:1,limit:12}),[T,k]=l.useState("paths"),[$,C]=l.useState(!1),[A,E]=l.useState(!1),[L,F]=l.useState([]),[D,q]=l.useState([]),[Q,de]=l.useState(""),[H,se]=l.useState(!1),[W,le]=l.useState(null),[U,ee]=l.useState(!1),[ae,ue]=l.useState({email:"",role:"member",name:"",message:""}),[fe,re]=l.useState(!1),[V,ce]=l.useState(!1),[Z,xe]=l.useState({title:"",severity:"Medium",alert_type:"Phishing",details:"",raw_log:"",difficulty:"Intermediate",playbook_solution:null}),[pe,Se]=l.useState(!1),ke=async()=>{if(!Z.details||Z.details.length<5){z.error("Please enter a description in the details/prompt box first.");return}Se(!0);try{const B=localStorage.getItem("token"),oe=await fetch(`${Y}/api/ai/generate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`},body:JSON.stringify({title:Z.title,alert_type:Z.alert_type,severity:Z.severity,difficulty:Z.difficulty,details:Z.details})}),ne=await oe.json();oe.ok?xe(Ce=>({...Ce,title:ne.title||Ce.title,alert_type:ne.alert_type||Ce.alert_type,difficulty:ne.difficulty||Ce.difficulty,severity:ne.severity||Ce.severity,details:ne.details||Ce.details,raw_log:typeof ne.raw_log=="string"?ne.raw_log:JSON.stringify(ne.raw_log,null,2),playbook_solution:ne.playbook_solution||null})):z.error("Failed to generate scenario: "+ne.message)}catch(B){console.error("Error generating AI scenario:",B),z.error("Error generating scenario")}finally{Se(!1)}},[$e,K]=l.useState({severity:"",type:"",difficulty:""}),[ie,I]=l.useState(""),[R,je]=l.useState({difficulty:"",type:""}),[Te,Ie]=l.useState(!1),[tt,Ke]=l.useState(!1),[Be,Ge]=l.useState(""),J=async()=>{if(Be==="DELETE")try{const B=localStorage.getItem("token"),oe=await fetch(`${Y}/api/organizations/${a.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${B}`}});if(oe.ok)z.success("Organization deleted successfully"),localStorage.removeItem("token"),window.location.href="/login";else{const ne=await oe.json();z.error(ne.message||"Failed to delete organization")}}catch(B){console.error("Error deleting organization:",B),z.error("Failed to connect to server")}},Ae=async()=>{try{const B=localStorage.getItem("token"),oe=await fetch(`${Y}/api/organizations/${a.id}/cancel`,{method:"POST",headers:{Authorization:`Bearer ${B}`}}),ne=await oe.json();oe.ok?(z.success(ne.message),Ie(!1),Re()):z.error(ne.message||"Failed to cancel subscription")}catch(B){console.error("Error cancelling subscription:",B),z.error("Failed to connect to server")}},[ve,ge]=l.useState({page:1,limit:9}),[qe,Xe]=l.useState([]),[st,ht]=l.useState({total:0,completed:0,pending:0}),[Ze,yt]=l.useState(null),We=me.useMemo(()=>{const B=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],oe=new Date;return Array.from({length:7},(Ce,at)=>{const ze=new Date;return ze.setDate(oe.getDate()-(6-at)),ze}).map(Ce=>{const at=Ce.toISOString().split("T")[0],ze=qe.filter(Oe=>{if(Oe.status!=="completed"&&Oe.status!=="graded")return!1;const Ye=Oe.completed_at||Oe.updated_at;return Ye?Ye.startsWith(at):!1}).length;return{name:B[Ce.getDay()],completed:ze,fullDate:at}})},[qe]);l.useEffect(()=>{I(""),je({difficulty:"",type:""}),ge({page:1,limit:9}),yt(null)},[T,y]),l.useEffect(()=>{y==="assignments"&&T==="activity"&&(a!=null&&a.id)&&(async()=>{try{const oe=localStorage.getItem("token"),Ce=await(await fetch(`${Y}/api/organizations/${a.id}/assignments`,{headers:{Authorization:`Bearer ${oe}`}})).json();if(Ce.assignments){Xe(Ce.assignments);const at=Ce.assignments.filter(ze=>ze.status==="completed"||ze.status==="graded").length;ht({total:Ce.assignments.length,completed:at,pending:Ce.assignments.length-at})}}catch(oe){console.error("Error fetching org assignments:",oe)}})()},[y,T,a==null?void 0:a.id]);const[tr,Vt]=l.useState(""),ct=({totalItems:B,currentPage:oe,itemsPerPage:ne,onPageChange:Ce})=>{const at=Math.ceil(B/ne);return at<=1?null:e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-8",children:[e.jsx("button",{onClick:()=>Ce(oe-1),disabled:oe===1,className:"p-2 rounded-lg border border-gray-800 text-gray-400 hover:text-white hover:border-gray-600 disabled:opacity-30 disabled:hover:border-gray-800",children:e.jsx(Ec,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex items-center text-sm font-bold text-gray-500",children:[e.jsx("span",{className:"text-white mx-2",children:oe})," / ",at]}),e.jsx("button",{onClick:()=>Ce(oe+1),disabled:oe===at,className:"p-2 rounded-lg border border-gray-800 text-gray-400 hover:text-white hover:border-gray-600 disabled:opacity-30 disabled:hover:border-gray-800",children:e.jsx(Pr,{className:"w-5 h-5"})})]})},[dt,be]=l.useState({logo:null,primaryColor:"#8b5cf6",secondaryColor:"#6366f1",showOnGlobalLeaderboard:!0}),[ye,De]=l.useState(!1),[M,te]=l.useState(!1),[Ne,Ee]=l.useState({title:"",message:""}),[Pe,Me]=l.useState(!1),[Ue,Le]=l.useState(null);l.useEffect(()=>{Re()},[]);const Re=async()=>{try{const oe={Authorization:`Bearer ${localStorage.getItem("token")}`},ne=async(Qe,lt=null)=>{if(Qe.status==="fulfilled"&&Qe.value.ok)try{const Pt=await Qe.value.json();return lt?Pt[lt]:Pt}catch(Pt){console.warn(`Failed to parse ${lt||"response"}`,Pt)}return null},Ce=await fetch(`${Y}/api/organizations/my`,{headers:oe});if(Ce.status===401){ot();return}const at=await Ce.json();if(at.organization){n(at.organization);const Qe=at.organization.id,lt=await Promise.allSettled([fetch(`${Y}/api/organizations/${Qe}/members`,{headers:oe}),fetch(`${Y}/api/organizations/${Qe}/analytics`,{headers:oe}),fetch(`${Y}/api/organizations/${Qe}/alerts`,{headers:oe}),fetch(`${Y}/api/organizations/${Qe}/assignments`,{headers:oe})]),Pt=await ne(lt[0],"members"),Hr=await ne(lt[1],"analytics"),Rr=await ne(lt[2],"alerts"),rr=await ne(lt[3],"assignments");if(i(Pt||[]),c(Hr||{}),x(Rr||[]),rr){Xe(rr);const Ar=rr.filter(ar=>ar.status==="completed"||ar.status==="graded").length;ht({total:rr.length,completed:Ar,pending:rr.length-Ar})}}const ze=await Promise.allSettled([fetch(`${Y}/api/alerts?limit=1000`,{headers:oe}),fetch(`${Y}/api/learning-paths`,{headers:oe}),fetch(`${Y}/api/operations`,{headers:oe})]),Oe=await ne(ze[0],"alerts"),Ye=await ne(ze[1],null),rt=await ne(ze[2],null);if(Oe&&m(Oe),Ye){const Qe=Array.isArray(Ye)?Ye:Ye.paths||[];f(Qe)}if(rt){const Qe=Array.isArray(rt)?rt:rt.operations||[];b(Qe)}at.organization&&at.organization.trial_expired&&re(!0)}catch(B){console.error("Error fetching dashboard data:",B)}finally{v(!1)}},ot=()=>{localStorage.removeItem("token"),window.location.reload()},ut=async B=>{B.preventDefault();try{const oe=localStorage.getItem("token"),ne=await fetch(`${Y}/api/organizations/${a.id}/invite`,{method:"POST",headers:{Authorization:`Bearer ${oe}`,"Content-Type":"application/json"},body:JSON.stringify(ae)});if(ne.ok)ee(!1),ue({email:"",role:"member"}),alert("Invitation sent successfully");else{const Ce=await ne.json();alert(Ce.message||"Failed to invite")}}catch(oe){console.error(oe)}},ft=async()=>{const B={...Z,title:Z.title.trim()||`${Z.alert_type}: ${Z.details.substring(0,50).trim()}...`};if(!B.details.trim()){z.error("Please enter scenario details.");return}try{const oe=localStorage.getItem("token"),ne=await fetch(`${Y}/api/organizations/${a.id}/alerts`,{method:"POST",headers:{Authorization:`Bearer ${oe}`,"Content-Type":"application/json"},body:JSON.stringify(B)});if(ne.ok)xe({title:"",severity:"Medium",alert_type:"Phishing",details:"",raw_log:"",difficulty:"Intermediate",playbook_solution:null}),Re(),_("library"),z.success("Scenario created successfully");else{const Ce=await ne.json();z.error(`Failed to create: ${Ce.message} ${Ce.error?`(${Ce.error})`:""}`)}}catch(oe){console.error(oe),z.error("Error creating scenario")}},gt=async(B,oe=!1,ne="csv")=>{try{const Ce=localStorage.getItem("token"),at=`${Y}/api/organizations/${a.id}/reports/${B}?format=${ne}`;if(oe)return at;const ze=await fetch(at,{headers:{Authorization:`Bearer ${Ce}`}});if(!ze.ok)throw new Error("Download failed");const Oe=await ze.blob(),Ye=window.URL.createObjectURL(Oe),rt=document.createElement("a");rt.href=Ye;const Qe=ze.headers.get("Content-Disposition");let lt=`report_${B}.${ne}`;Qe&&Qe.includes("filename=")?lt=Qe.split("filename=")[1].replace(/"/g,""):B==="raw"&&(lt="export.json"),rt.download=lt,document.body.appendChild(rt),rt.click(),document.body.removeChild(rt),window.URL.revokeObjectURL(Ye)}catch(Ce){console.error("Download error:",Ce),z.error("Failed to download report")}},ir=B=>{Le(B),Me(!0)},Xt=async B=>{if(window.confirm("Are you sure you want to delete this custom scenario? This action cannot be undone."))try{const oe=localStorage.getItem("token");(await fetch(`${Y}/api/organizations/${a.id}/alerts/${B}`,{method:"DELETE",headers:{Authorization:`Bearer ${oe}`}})).ok?x(u.filter(Ce=>Ce.id!==B)):alert("Failed to delete alert")}catch(oe){console.error("Error deleting alert:",oe)}};if(p)return e.jsx("div",{className:"min-h-screen bg-[#0f1012] flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500"})});if(!a)return e.jsx("div",{className:"min-h-screen bg-[#0f1012] flex flex-col items-center justify-center p-4",children:e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-800 rounded-2xl flex items-center justify-center mx-auto mb-6",children:e.jsx(as,{className:"w-8 h-8 text-gray-500"})}),e.jsx("h2",{className:"text-2xl font-bold text-white mb-3",children:"No Organization Found"}),e.jsx("p",{className:"text-gray-400 mb-8",children:"You are not currently a member of any organization. Ask your admin for an invite or create a new organization."}),e.jsx("button",{onClick:()=>window.location.href="/business/register",className:"bg-blue-600 hover:bg-blue-500 text-white px-6 py-3 rounded-lg font-bold transition-all w-full",children:"Create Organization"}),e.jsx("button",{onClick:()=>r("soc_dashboard"),className:"mt-4 text-gray-500 hover:text-white text-sm",children:"Return to Dashboard"})]})});const St=["owner","admin"].includes(a.user_role),_t=s.find(B=>B.user_id===(t==null?void 0:t.id))||{};return e.jsxs("div",{className:"min-h-screen bg-[#0f1012] font-sans text-gray-100 flex",children:[St&&e.jsx(WI,{activeTab:y,setActiveTab:j,isOpen:S,setIsOpen:N,onLogout:ot,userRole:(a==null?void 0:a.user_role)||"member",setFilters:je,setSearchText:I}),e.jsxs("div",{className:`flex-1 min-h-screen flex flex-col transition-all duration-300 ${St?"lg:ml-64":""}`,children:[e.jsxs("header",{className:"h-16 bg-[#111215]/80 backdrop-blur-md border-b border-[#1a1b1e] sticky top-0 z-30 flex items-center justify-between px-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[St&&e.jsx("button",{onClick:()=>N(!0),className:"lg:hidden text-gray-400 hover:text-white",children:e.jsx(w1,{className:"w-6 h-6"})}),e.jsx("h1",{className:"text-xl font-bold text-white",children:St?{overview:"Overview",members:"Team",training_alerts:"Training Alerts",assignments:"Assignments",assessments:"Assessments",reports:"Reports",settings:"Settings"}[y]||y.replace(/_/g," ").replace(/\b\w/g,B=>B.toUpperCase()):"Team Workspace"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"text-right hidden sm:block",children:[e.jsx("div",{className:"text-sm font-bold text-white",children:a.name}),e.jsxs("div",{className:"text-xs text-gray-500",children:[a.plan_type," Plan"]})]}),e.jsx("div",{className:"w-9 h-9 bg-gradient-to-br from-blue-600 to-purple-600 rounded-lg flex items-center justify-center text-white font-bold",children:a.name.charAt(0)})]})]}),e.jsxs("main",{className:"p-6 flex-1 overflow-x-hidden",children:[a.is_trial&&e.jsxs("div",{className:`mb-6 p-4 rounded-xl border flex items-center justify-between ${a.trial_expired?"bg-red-500/5 border-red-500/20":"bg-blue-500/5 border-blue-500/20"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(va,{className:`w-5 h-5 ${a.trial_expired?"text-red-400":"text-blue-400"}`}),e.jsx("span",{className:"text-sm font-medium text-gray-200",children:a.trial_expired?"Your free trial has expired.":e.jsxs(e.Fragment,{children:[a.days_remaining," days remaining in your free trial."]})})]}),e.jsx("button",{onClick:()=>re(!0),className:"text-sm font-bold text-white bg-blue-600 hover:bg-blue-500 px-4 py-2 rounded-lg transition-colors",children:"Upgrade Plan"})]}),y==="overview"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:St?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-[#111215] border border-blue-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-blue-500/50 transition-all shadow-lg shadow-blue-900/5",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-600/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("div",{className:"flex items-start justify-between mb-4 relative z-10",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 border border-blue-500/20 rounded-lg",children:e.jsx(At,{className:"w-5 h-5 text-blue-400"})}),e.jsxs("span",{className:`text-[10px] font-bold px-2 py-1 rounded border uppercase tracking-wider ${s.length>=a.license_seats?"bg-red-500/10 border-red-500/30 text-red-400":"bg-green-500/10 border-green-500/30 text-green-400"}`,children:[Math.round(s.length/a.license_seats*100),"% Used"]})]}),e.jsxs("div",{className:"text-3xl font-bold text-white mb-1 font-mono relative z-10",children:[s.length," ",e.jsxs("span",{className:"text-blue-500/50 text-xl",children:["/ ",a.license_seats]})]}),e.jsx("div",{className:"text-xs text-blue-400/60 font-bold uppercase tracking-wider relative z-10",children:"Active Seats"})]}),e.jsxs("div",{className:"bg-[#111215] border border-purple-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-purple-500/50 transition-all shadow-lg shadow-purple-900/5",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-600/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsx("div",{className:"flex items-start justify-between mb-4 relative z-10",children:e.jsx("div",{className:"p-2 bg-purple-500/10 border border-purple-500/20 rounded-lg",children:e.jsx(Mt,{className:"w-5 h-5 text-purple-400"})})}),e.jsx("div",{className:"text-3xl font-bold text-white mb-1 font-mono relative z-10",children:((Gt=o==null?void 0:o.investigations)==null?void 0:Gt.completed)||0}),e.jsx("div",{className:"text-xs text-purple-400/60 font-bold uppercase tracking-wider relative z-10",children:"Missions Completed"})]}),e.jsxs("div",{className:"bg-[#111215] border border-green-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-green-500/50 transition-all shadow-lg shadow-green-900/5",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-600/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsx("div",{className:"flex items-start justify-between mb-4 relative z-10",children:e.jsx("div",{className:"p-2 bg-green-500/10 border border-green-500/20 rounded-lg",children:e.jsx(ba,{className:"w-5 h-5 text-green-400"})})}),e.jsxs("div",{className:"text-3xl font-bold text-white mb-1 font-mono relative z-10",children:[Math.round((o==null?void 0:o.avgScore)||0),"%"]}),e.jsx("div",{className:"text-xs text-green-400/60 font-bold uppercase tracking-wider relative z-10",children:"Avg. Team Score"})]}),e.jsxs("div",{className:"bg-[#111215] border border-orange-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-orange-500/50 transition-all shadow-lg shadow-orange-900/5",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-600/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("div",{className:"flex items-start justify-between mb-4 relative z-10",children:[e.jsx("div",{className:"p-2 bg-orange-500/10 border border-orange-500/20 rounded-lg",children:e.jsx(xr,{className:"w-5 h-5 text-orange-400"})}),e.jsx("button",{onClick:()=>j("alerts"),className:"text-[10px] bg-orange-500/10 border border-orange-500/30 hover:bg-orange-500 hover:text-white text-orange-400 px-2 py-1 rounded transition-all font-bold uppercase tracking-wider",children:"Manage"})]}),e.jsx("div",{className:"text-3xl font-bold text-white mb-1 font-mono relative z-10",children:u.length}),e.jsx("div",{className:"text-xs text-orange-400/60 font-bold uppercase tracking-wider relative z-10",children:"Custom Scenarios"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-[#111215] border border-blue-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-blue-500/50 transition-all",children:[e.jsx("div",{className:"flex items-start justify-between mb-4",children:e.jsx("div",{className:"p-2 bg-blue-500/10 border border-blue-500/20 rounded-lg",children:e.jsx(At,{className:"w-5 h-5 text-blue-400"})})}),e.jsx("div",{className:"text-3xl font-bold text-white mb-1 font-mono",children:(_t==null?void 0:_t.level)||1}),e.jsx("div",{className:"text-xs text-blue-400/60 font-bold uppercase tracking-wider",children:"My Level"})]}),e.jsxs("div",{className:"bg-[#111215] border border-yellow-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-yellow-500/50 transition-all",children:[e.jsx("div",{className:"flex items-start justify-between mb-4",children:e.jsx("div",{className:"p-2 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:e.jsx(ba,{className:"w-5 h-5 text-yellow-400"})})}),e.jsx("div",{className:"text-3xl font-bold text-white mb-1 font-mono",children:(_t==null?void 0:_t.total_xp)||0}),e.jsx("div",{className:"text-xs text-yellow-400/60 font-bold uppercase tracking-wider",children:"My XP Earnings"})]}),e.jsxs("div",{className:"bg-[#111215] border border-purple-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-purple-500/50 transition-all",children:[e.jsx("div",{className:"flex items-start justify-between mb-4",children:e.jsx("div",{className:"p-2 bg-purple-500/10 border border-purple-500/20 rounded-lg",children:e.jsx(Mt,{className:"w-5 h-5 text-purple-400"})})}),e.jsx("div",{className:"text-3xl font-bold text-white mb-1 font-mono",children:(_t==null?void 0:_t.investigations_completed)||0}),e.jsx("div",{className:"text-xs text-purple-400/60 font-bold uppercase tracking-wider",children:"My Investigations"})]}),e.jsxs("div",{className:"bg-[#111215] border border-green-900/30 rounded-xl p-5 relative overflow-hidden group hover:border-green-500/50 transition-all",children:[e.jsx("div",{className:"flex items-start justify-between mb-4",children:e.jsx("div",{className:"p-2 bg-green-500/10 border border-green-500/20 rounded-lg",children:e.jsx(ya,{className:"w-5 h-5 text-green-400"})})}),e.jsxs("div",{className:"text-3xl font-bold text-white mb-1 font-mono",children:[Math.round((_t==null?void 0:_t.avg_score)||0),"%"]}),e.jsx("div",{className:"text-xs text-green-400/60 font-bold uppercase tracking-wider",children:"My Avg Score"})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-[#111215] border border-gray-800 rounded-xl p-6 shadow-xl relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-5",children:e.jsx(ba,{className:"w-32 h-32 text-blue-500"})}),e.jsxs("h3",{className:"text-lg font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(ba,{className:"w-5 h-5 text-blue-500"}),"Weekly Activity"]}),e.jsx("div",{className:"h-64 w-full relative z-10",children:e.jsx(Ra,{width:"100%",height:"100%",children:e.jsxs(Xc,{data:We,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"barGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:1}),e.jsx("stop",{offset:"100%",stopColor:"#1d4ed8",stopOpacity:.6})]})}),e.jsx(ps,{strokeDasharray:"3 3",stroke:"#1f2937",vertical:!1}),e.jsx(bs,{dataKey:"name",stroke:"#6b7280",tick:{fill:"#6b7280",fontSize:12},axisLine:!1,tickLine:!1,dy:10}),e.jsx(vs,{stroke:"#6b7280",tick:{fill:"#6b7280",fontSize:12},axisLine:!1,tickLine:!1}),e.jsx(La,{cursor:{fill:"#1f2937",opacity:.4},content:({active:B,payload:oe,label:ne})=>B&&oe&&oe.length?e.jsxs("div",{className:"bg-[#1a1b1e] border border-blue-500/30 p-3 rounded-lg shadow-xl",children:[e.jsx("p",{className:"text-gray-400 text-xs mb-1 font-bold",children:ne}),e.jsxs("p",{className:"text-white font-bold text-base flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),oe[0].value," Missions"]})]}):null}),e.jsx(Lo,{dataKey:"completed",fill:"url(#barGradient)",radius:[4,4,0,0],barSize:40,animationDuration:1e3})]})})})]}),e.jsxs("div",{className:"bg-[#111215] border border-gray-800 rounded-xl p-0 flex flex-col shadow-xl overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 bg-[#1a1b1e]/50 backdrop-blur-sm",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:[e.jsx(ya,{className:"w-5 h-5 text-yellow-400"}),"Top Performers"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Highest earning operatives this month"})]}),e.jsx("div",{className:"divide-y divide-gray-800 flex-1",children:[...s].sort((B,oe)=>(oe.total_xp||0)-(B.total_xp||0)).slice(0,5).map((B,oe)=>e.jsxs("div",{className:"p-4 flex items-center gap-4 hover:bg-[#1a1b1e] transition-colors group",children:[e.jsxs("div",{className:`w-8 h-8 flex items-center justify-center font-black text-lg ${oe===0?"text-yellow-400 drop-shadow-[0_0_10px_rgba(250,204,21,0.5)]":oe===1?"text-gray-300 drop-shadow-[0_0_10px_rgba(209,213,219,0.5)]":oe===2?"text-orange-400 drop-shadow-[0_0_10px_rgba(251,146,60,0.5)]":"text-gray-600"}`,children:["#",oe+1]}),e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center text-sm font-bold text-white relative overflow-hidden ${oe===0?"bg-gradient-to-br from-yellow-500 to-yellow-700 ring-2 ring-yellow-500/20":oe===1?"bg-gradient-to-br from-gray-500 to-gray-700 ring-2 ring-gray-500/20":oe===2?"bg-gradient-to-br from-orange-500 to-orange-700 ring-2 ring-orange-500/20":"bg-gray-800"}`,children:B.name.charAt(0)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("div",{className:"text-sm font-bold text-white truncate group-hover:text-blue-400 transition-colors",children:B.name}),oe<3&&e.jsx(vu,{className:"w-3 h-3 text-white/50"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-1.5 bg-gray-800 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${oe===0?"bg-yellow-500":oe===1?"bg-gray-400":oe===2?"bg-orange-500":"bg-blue-600"}`,style:{width:`${Math.min(B.total_xp/1e3*100,100)}%`}})}),e.jsxs("div",{className:"text-xs font-mono text-gray-500 font-bold",children:[B.total_xp," XP"]})]})]})]},B.user_id))}),e.jsx("div",{className:"p-4 border-t border-gray-800 bg-[#1a1b1e]/30",children:e.jsxs("button",{onClick:()=>j("members"),className:"w-full py-2 text-xs font-bold uppercase tracking-wider text-gray-400 hover:text-white border border-gray-700 rounded-lg hover:bg-gray-700/50 transition-all flex items-center justify-center gap-2",children:["View Full Roster",e.jsx(Pr,{className:"w-3 h-3"})]})})]})]})]}),y==="members"&&e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Team Members"}),St&&e.jsxs("button",{onClick:()=>ee(!0),className:"bg-blue-600 hover:bg-blue-500 text-white px-4 py-2 rounded-lg font-bold text-sm flex items-center gap-2",children:[e.jsx(Pc,{className:"w-4 h-4"})," Invite Member"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#111215]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"User"}),e.jsx("th",{className:"px-6 py-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Role"}),e.jsx("th",{className:"px-6 py-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Progress"}),e.jsx("th",{className:"px-6 py-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Joined"}),e.jsx("th",{className:"px-6 py-4 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800",children:s.map(B=>e.jsxs("tr",{className:"hover:bg-gray-800/30 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 h-10 w-10 bg-gray-700 rounded-full flex items-center justify-center text-white font-bold",children:B.name.charAt(0)}),e.jsxs("div",{className:"ml-4",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:B.name}),e.jsx("div",{className:"text-sm text-gray-500",children:B.email})]})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${B.role==="owner"?"bg-yellow-100 text-yellow-800":B.role==="admin"?"bg-purple-100 text-purple-800":"bg-gray-100 text-gray-800"}`,children:B.role})}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[e.jsxs("div",{className:"text-sm text-white",children:[B.total_xp," XP"]}),e.jsxs("div",{className:"text-xs text-gray-500",children:["Level ",B.level||1]})]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:new Date(B.joined_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:St&&B.role!=="owner"&&e.jsx("button",{onClick:()=>ir(B),className:"text-red-400 hover:text-red-300",children:e.jsx(na,{className:"w-5 h-5"})})})]},B.user_id))})]})})]}),y==="assignments"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex gap-4 border-b border-gray-800 pb-4",children:[e.jsx("button",{onClick:()=>{k("paths"),je({difficulty:"",type:""}),I("")},className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${T==="paths"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"Learning Paths"}),e.jsx("button",{onClick:()=>{k("missions"),je({difficulty:"",type:""}),I("")},className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${T==="missions"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"Challenges"}),e.jsx("button",{onClick:()=>{k("ctf"),je({difficulty:"",type:""}),I("")},className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${T==="ctf"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"CTF Scenarios"})]}),T==="paths"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Learning Paths"}),e.jsxs("div",{className:"relative w-full md:w-64",children:[e.jsx(Jt,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",placeholder:"Search paths...",value:ie,onChange:B=>{I(B.target.value),ge({...ve,page:1})},className:"w-full bg-[#111215] border border-gray-800 rounded-lg pl-9 pr-4 py-2 text-sm text-white focus:border-blue-500 outline-none"})]})]}),(()=>{const B=h.filter(ne=>{var Ce,at;return((Ce=ne.title)==null?void 0:Ce.toLowerCase().includes(ie.toLowerCase()))||((at=ne.description)==null?void 0:at.toLowerCase().includes(ie.toLowerCase()))}),oe=B.slice((ve.page-1)*ve.limit,ve.page*ve.limit);return e.jsx(e.Fragment,{children:B.length===0?e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-8 text-center text-gray-500",children:[e.jsx(Cn,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),e.jsx("p",{children:"No learning paths found."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6",children:oe.map(ne=>e.jsxs("div",{className:"bg-gradient-to-br from-[#1a1b1e] to-[#25262b] border border-gray-800 rounded-xl p-5 hover:border-blue-500/50 hover:shadow-lg hover:shadow-blue-500/10 transition-all group flex flex-col relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-2 opacity-10 group-hover:opacity-20 transition-opacity",children:e.jsx(Cn,{className:"w-24 h-24 text-blue-500 transform rotate-12 translate-x-4 -translate-y-4"})}),e.jsxs("div",{className:"flex items-start justify-between mb-4 z-10",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-blue-500/10 flex items-center justify-center text-2xl border border-blue-500/20",children:ne.icon||"📚"}),St&&e.jsx("button",{onClick:()=>{le(ne),F([]),q([]),C(!0)},className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-500 text-white text-xs font-bold rounded-lg shadow-lg shadow-blue-900/20 opacity-0 group-hover:opacity-100 transition-all translate-y-2 group-hover:translate-y-0",children:"Assign"})]}),e.jsx("h3",{className:"font-bold text-white text-lg mb-2 z-10",children:ne.title}),e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2 mb-4 flex-1 z-10",children:ne.description}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-blue-400 font-bold mt-auto z-10",children:[e.jsx(Cn,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"View Path Details"})]})]},ne.id))}),e.jsx(ct,{totalItems:B.length,currentPage:ve.page,itemsPerPage:ve.limit,onPageChange:ne=>ge({...ve,page:ne})})]})})})()]}),T==="training_alerts"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex gap-4 border-b border-gray-800 pb-4",children:[e.jsx("button",{onClick:()=>_("library"),className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${w==="library"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"System Library"}),e.jsx("button",{onClick:()=>_("create"),className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${w==="create"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"My Custom Alerts"})]}),w==="library"&&e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-center justify-between gap-4 mb-6",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Alert Library"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1 md:w-64",children:[e.jsx(Jt,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",placeholder:"Search alerts...",value:ie,onChange:B=>{I(B.target.value),ge({...ve,page:1})},className:"w-full bg-[#111215] border border-gray-700 rounded-lg pl-9 pr-4 py-2 text-sm text-white focus:border-blue-500 outline-none"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-2 text-white outline-none focus:border-blue-500 text-sm",value:R.type,onChange:B=>{je({...R,type:B.target.value}),ge({...ve,page:1})},children:[e.jsx("option",{value:"",children:"All Types"}),e.jsx("option",{value:"Phishing",children:"Phishing"}),e.jsx("option",{value:"Malware",children:"Malware"}),e.jsx("option",{value:"Network",children:"Network Intrusion"}),e.jsx("option",{value:"Insider Threat",children:"Insider Threat"}),e.jsx("option",{value:"Web Attack",children:"Web Attack"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-2 text-white outline-none focus:border-blue-500 text-sm",value:R.difficulty,onChange:B=>{je({...R,difficulty:B.target.value}),ge({...ve,page:1})},children:[e.jsx("option",{value:"",children:"All Difficulties"}),e.jsx("option",{value:"Novice",children:"Novice"}),e.jsx("option",{value:"Beginner",children:"Beginner"}),e.jsx("option",{value:"Intermediate",children:"Intermediate"}),e.jsx("option",{value:"Advanced",children:"Advanced"}),e.jsx("option",{value:"Expert",children:"Expert"})]})]})]}),(()=>{const B=d.filter(ne=>{var Ce;return!(!ne||!ne.title||ie&&!((Ce=ne.title)!=null&&Ce.toLowerCase().includes(ie.toLowerCase()))||R.type&&ne.alert_type!==R.type||R.difficulty&&ne.difficulty!==R.difficulty)}),oe=B.slice((ve.page-1)*ve.limit,ve.page*ve.limit);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:oe.map(ne=>e.jsxs("div",{className:"bg-[#111215] p-4 rounded-lg border border-gray-800 flex flex-col justify-between hover:border-gray-700 transition-colors",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded uppercase ${ne.severity==="Critical"?"bg-red-500/20 text-red-500":ne.severity==="High"?"bg-orange-500/20 text-orange-500":"bg-blue-500/20 text-blue-500"}`,children:ne.severity}),e.jsx("span",{className:"text-[10px] text-gray-500 border border-gray-800 px-1.5 py-0.5 rounded",children:ne.difficulty})]}),e.jsx("h4",{className:"font-bold text-gray-200 text-sm mb-1 line-clamp-1",title:ne.title,children:ne.title}),e.jsx("p",{className:"text-gray-500 text-xs line-clamp-2 mb-3",children:ne.description||"No description"})]}),e.jsx("button",{onClick:()=>{F([ne.id]),E(!0)},className:"mt-auto text-xs font-bold text-gray-300 hover:text-white border border-gray-700 hover:border-gray-500 px-3 py-1.5 rounded-lg w-full transition-colors",children:"Assign"})]},ne.id))}),B.length===0&&e.jsx("div",{className:"text-center py-12 text-gray-500",children:"No alerts found matching your criteria."}),e.jsx(ct,{totalItems:B.length,currentPage:ve.page,itemsPerPage:ve.limit,onPageChange:ne=>ge({...ve,page:ne})})]})})()]}),w==="create"&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-6",children:"Create New Scenario"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-blue-500 outline-none",placeholder:"Scenario Title",value:Z.title,onChange:B=>xe({...Z,title:B.target.value})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white outline-none focus:border-blue-500 text-sm",value:Z.alert_type,onChange:B=>xe({...Z,alert_type:B.target.value}),children:[e.jsx("option",{value:"Phishing",children:"Phishing"}),e.jsx("option",{value:"Malware",children:"Malware"}),e.jsx("option",{value:"Network Intrusion",children:"Network Intrusion"}),e.jsx("option",{value:"Insider Threat",children:"Insider Threat"}),e.jsx("option",{value:"Web Attack",children:"Web Attack"}),e.jsx("option",{value:"Ransomware",children:"Ransomware"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white outline-none focus:border-blue-500 text-sm",value:Z.severity,onChange:B=>xe({...Z,severity:B.target.value}),children:[e.jsx("option",{children:"Low"}),e.jsx("option",{children:"Medium"}),e.jsx("option",{children:"High"}),e.jsx("option",{children:"Critical"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white outline-none focus:border-blue-500 text-sm",value:Z.difficulty,onChange:B=>xe({...Z,difficulty:B.target.value}),children:[e.jsx("option",{children:"Novice"}),e.jsx("option",{children:"Beginner"}),e.jsx("option",{children:"Intermediate"}),e.jsx("option",{children:"Advanced"}),e.jsx("option",{children:"Expert"})]})]}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx("textarea",{className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-blue-500 outline-none h-32 resize-none",placeholder:"Scenario Details (or describe a scenario for AI generation...)",value:Z.details,onChange:B=>xe({...Z,details:B.target.value})}),e.jsxs("button",{onClick:ke,disabled:pe,className:"absolute bottom-3 right-3 px-3 py-1.5 bg-purple-600 hover:bg-purple-700 text-white text-xs font-bold rounded-lg flex items-center gap-1.5 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Fill details above, then click to generate full scenario",children:[pe?e.jsx(Jr,{className:"w-3 h-3 animate-spin"}):e.jsx(yr,{className:"w-3 h-3"}),"Generate with AI"]})]}),e.jsx("textarea",{className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-blue-500 outline-none h-32 font-mono text-sm mb-4",placeholder:"Raw Logs (Syslog, Firewall, etc.) - Can be auto-generated...",value:Z.raw_log,onChange:B=>xe({...Z,raw_log:B.target.value})}),e.jsx("button",{onClick:ft,disabled:!Z.details,className:"w-full bg-blue-600 hover:bg-blue-500 text-white font-bold py-3 rounded-lg transition-colors disabled:opacity-50",children:"Create Scenario"})]})]}),e.jsx("div",{children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 h-full",children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:"Your Library"}),e.jsxs("div",{className:"space-y-3 h-[500px] overflow-y-auto pr-2 custom-scrollbar",children:[u.map(B=>e.jsxs("div",{className:"p-3 bg-[#111215] rounded-lg border border-gray-800 hover:border-gray-700 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-gray-200 text-sm mb-1",children:B.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded uppercase ${B.severity==="Critical"?"bg-red-500/20 text-red-500":B.severity==="High"?"bg-orange-500/20 text-orange-500":"bg-blue-500/20 text-blue-500"}`,children:B.severity}),e.jsx("span",{className:"text-[10px] text-gray-500 border border-gray-800 px-1.5 py-0.5 rounded",children:B.difficulty||"Intermediate"})]})]}),e.jsx("button",{onClick:()=>Xt(B.id),className:"text-gray-600 hover:text-red-400 p-1 rounded transition-colors",title:"Delete Scenario",children:e.jsx(na,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"mt-3 flex gap-2",children:e.jsx("button",{onClick:()=>{F([B.id]),le(null),q([]),E(!0)},className:"flex-1 py-1.5 bg-gray-800 hover:bg-gray-700 text-gray-300 hover:text-white rounded text-xs font-bold transition-all",children:"Assign"})})]},B.id)),u.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-600 text-sm",children:"No custom alerts yet. Create one to get started."})]})]})})]})]}),T==="missions"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Challenges"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative w-full md:w-64",children:[e.jsx(Jt,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",placeholder:"Search challenges...",value:ie,onChange:B=>{I(B.target.value),ge({...ve,page:1})},className:"w-full bg-[#111215] border border-gray-800 rounded-lg pl-9 pr-4 py-2 text-sm text-white focus:border-blue-500 outline-none"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-800 rounded-lg px-4 py-2 text-white outline-none focus:border-blue-500 text-sm",value:R.difficulty,onChange:B=>{je({...R,difficulty:B.target.value}),ge({...ve,page:1})},children:[e.jsx("option",{value:"",children:"All Difficulties"}),e.jsx("option",{value:"Novice",children:"Novice"}),e.jsx("option",{value:"Beginner",children:"Beginner"}),e.jsx("option",{value:"Intermediate",children:"Intermediate"}),e.jsx("option",{value:"Advanced",children:"Advanced"}),e.jsx("option",{value:"Expert",children:"Expert"})]})]})]}),(()=>{const B=g.filter(ne=>{var at,ze,Oe;return!(((at=ne.tags)==null?void 0:at.includes("CTF"))||((ze=ne.title)==null?void 0:ze.includes("CTF"))||ie&&!((Oe=ne.title)!=null&&Oe.toLowerCase().includes(ie.toLowerCase()))||R.difficulty&&ne.difficulty_level!==R.difficulty)}),oe=B.slice((ve.page-1)*ve.limit,ve.page*ve.limit);return e.jsxs(e.Fragment,{children:[B.length===0?e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-8 text-center text-gray-500",children:[e.jsx(Mt,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),e.jsx("p",{children:"No challenges found matching your criteria."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6",children:oe.map(ne=>e.jsxs("div",{className:"bg-[#1a1b1e] border-l-4 border-l-red-500 border-y border-r border-gray-800 rounded-r-xl p-5 hover:bg-[#202125] transition-all group flex flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg",children:e.jsx(Mt,{className:"w-5 h-5 text-red-500"})}),e.jsx("span",{className:"text-xs font-bold tracking-wider text-red-500 uppercase",children:"Mission"})]}),e.jsx("span",{className:`text-[10px] font-bold px-2 py-1 rounded border uppercase tracking-wider ${ne.difficulty_level==="Hard"?"border-red-500/30 text-red-400 bg-red-500/10":ne.difficulty_level==="Medium"?"border-yellow-500/30 text-yellow-400 bg-yellow-500/10":"border-green-500/30 text-green-400 bg-green-500/10"}`,children:ne.difficulty_level})]}),e.jsx("h3",{className:"font-bold text-white text-lg mb-2",children:ne.title}),e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2 mb-4 flex-1",children:ne.description}),St?e.jsxs("button",{onClick:()=>{le({...ne,isOperation:!0}),F([]),q([]),C(!0)},className:"w-full py-2 bg-red-900/20 hover:bg-red-500 border border-red-500/30 hover:border-red-500 text-red-400 hover:text-white rounded-lg text-sm font-bold transition-all flex items-center justify-center gap-2",children:[e.jsx(Mt,{className:"w-4 h-4"}),"Assign Operation"]}):e.jsx("div",{className:"text-xs text-gray-600 font-bold uppercase tracking-wider text-center py-2",children:"Restricted Access"})]},ne.id))}),e.jsx(ct,{totalItems:B.length,currentPage:ve.page,itemsPerPage:ve.limit,onPageChange:ne=>ge({...ve,page:ne})})]})})()]}),T==="ctf"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6",children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"CTF Scenarios"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative w-full md:w-64",children:[e.jsx(Jt,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",placeholder:"Search CTFs...",value:ie,onChange:B=>{I(B.target.value),ge({...ve,page:1})},className:"w-full bg-[#111215] border border-gray-800 rounded-lg pl-9 pr-4 py-2 text-sm text-white focus:border-blue-500 outline-none"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-800 rounded-lg px-4 py-2 text-white outline-none focus:border-blue-500 text-sm",value:R.difficulty,onChange:B=>{je({...R,difficulty:B.target.value}),ge({...ve,page:1})},children:[e.jsx("option",{value:"",children:"All Difficulties"}),e.jsx("option",{value:"Novice",children:"Novice"}),e.jsx("option",{value:"Beginner",children:"Beginner"}),e.jsx("option",{value:"Intermediate",children:"Intermediate"}),e.jsx("option",{value:"Advanced",children:"Advanced"}),e.jsx("option",{value:"Expert",children:"Expert"})]})]})]}),(()=>{const B=Vj.filter(ne=>!(ie&&!ne.title.toLowerCase().includes(ie.toLowerCase())||R.difficulty&&ne.difficulty!==R.difficulty)),oe=B.slice((ve.page-1)*ve.limit,ve.page*ve.limit);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6",children:oe.map(ne=>e.jsxs("div",{className:"bg-[#0f1115] border border-gray-800 rounded-xl overflow-hidden hover:border-purple-500/50 transition-all group flex flex-col font-mono text-sm",children:[e.jsxs("div",{className:"bg-[#1a1b1e] border-b border-gray-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500/20 border border-red-500/50"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500/20 border border-yellow-500/50"}),e.jsx("div",{className:"w-3 h-3 rounded-full bg-green-500/20 border border-green-500/50"})]}),e.jsx("span",{className:"text-xs text-purple-400 font-bold animate-pulse",children:"LIVE"})]}),e.jsxs("div",{className:"p-5 flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg border border-purple-500/20",children:e.jsx(kr,{className:"w-5 h-5 text-purple-400"})}),e.jsx("span",{className:"text-xs font-bold text-gray-400 border border-gray-700 px-2 py-1 rounded uppercase tracking-wider",children:ne.difficulty})]}),e.jsx("h3",{className:"font-bold text-white text-base mb-2 font-sans",children:ne.title}),e.jsx("div",{className:"mt-auto pt-4",children:St?e.jsx("button",{onClick:()=>{le({...ne,isCTF:!0}),F([]),q([]),C(!0)},className:"w-full py-2 bg-purple-600 hover:bg-purple-500 text-white rounded text-sm font-bold transition-all shadow-lg shadow-purple-900/20",children:"Initialize Scenario"}):e.jsx("div",{className:"text-center text-gray-600 text-xs py-2",children:"ACCESS DENIED"})})]})]},ne.id))}),B.length===0&&e.jsx("div",{className:"text-center py-12 text-gray-500",children:"No CTF scenarios found."}),e.jsx(ct,{totalItems:B.length,currentPage:ve.page,itemsPerPage:ve.limit,onPageChange:ne=>ge({...ve,page:ne})})]})})()]})]}),y==="activity"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6",children:e.jsx("h2",{className:"text-xl font-bold text-white",children:"Activity Monitor"})}),Ze?e.jsxs("div",{className:"animate-in fade-in slide-in-from-right-4 duration-300",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("button",{onClick:()=>yt(null),className:"p-2 hover:bg-[#1a1b1e] rounded-lg text-gray-400 hover:text-white transition-colors",children:e.jsx(Ec,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-blue-600 flex items-center justify-center text-lg font-bold text-white overflow-hidden",children:Ze.profile_picture?e.jsx("img",{src:Ze.profile_picture,alt:"",className:"w-full h-full object-cover"}):Ze.user_name.charAt(0)}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:Ze.user_name}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Assignment History"})]})]})]}),(()=>{const B=qe.filter(Ce=>Ce.user_name===Ze.user_name),oe=B.filter(Ce=>Ce.status==="completed"||Ce.status==="graded").length,ne=Math.round(B.reduce((Ce,at)=>Ce+(at.score||0),0)/(B.filter(Ce=>Ce.score!==null).length||1));return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-[#111215] border border-blue-900/30 rounded-xl p-4 flex items-center gap-4 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute inset-0 bg-blue-600/5 group-hover:bg-blue-600/10 transition-colors"}),e.jsx("div",{className:"absolute right-0 top-0 p-3 opacity-10",children:e.jsx(Mt,{className:"w-16 h-16 text-blue-500 transform -rotate-12 translate-x-4 -translate-y-4"})}),e.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg backdrop-blur-sm z-10",children:e.jsx(Mt,{className:"w-6 h-6 text-blue-400"})}),e.jsxs("div",{className:"z-10",children:[e.jsx("div",{className:"text-blue-400/60 text-xs font-bold uppercase tracking-wider mb-1",children:"Assigned"}),e.jsx("div",{className:"text-3xl font-bold text-white font-mono",children:B.length})]})]}),e.jsxs("div",{className:"bg-[#111215] border border-green-900/30 rounded-xl p-4 flex items-center gap-4 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute inset-0 bg-green-600/5 group-hover:bg-green-600/10 transition-colors"}),e.jsx("div",{className:"absolute right-0 top-0 p-3 opacity-10",children:e.jsx(Cr,{className:"w-16 h-16 text-green-500 transform -rotate-12 translate-x-4 -translate-y-4"})}),e.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg backdrop-blur-sm z-10",children:e.jsx(Cr,{className:"w-6 h-6 text-green-400"})}),e.jsxs("div",{className:"z-10",children:[e.jsx("div",{className:"text-green-400/60 text-xs font-bold uppercase tracking-wider mb-1",children:"Completed"}),e.jsx("div",{className:"text-3xl font-bold text-white font-mono",children:oe})]})]}),e.jsxs("div",{className:"bg-[#111215] border border-purple-900/30 rounded-xl p-4 flex items-center gap-4 relative overflow-hidden group",children:[e.jsx("div",{className:"absolute inset-0 bg-purple-600/5 group-hover:bg-purple-600/10 transition-colors"}),e.jsx("div",{className:"absolute right-0 top-0 p-3 opacity-10",children:e.jsx(ya,{className:"w-16 h-16 text-purple-500 transform -rotate-12 translate-x-4 -translate-y-4"})}),e.jsx("div",{className:"p-3 bg-purple-500/10 border border-purple-500/20 rounded-lg backdrop-blur-sm z-10",children:e.jsx(ya,{className:"w-6 h-6 text-purple-400"})}),e.jsxs("div",{className:"z-10",children:[e.jsx("div",{className:"text-purple-400/60 text-xs font-bold uppercase tracking-wider mb-1",children:"Avg Score"}),e.jsxs("div",{className:"text-3xl font-bold text-white font-mono",children:[ne,"%"]})]})]})]})})(),e.jsx("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#111215] text-xs uppercase font-bold text-gray-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3",children:"Assignment"}),e.jsx("th",{className:"px-6 py-3",children:"Type"}),e.jsx("th",{className:"px-6 py-3",children:"Status"}),e.jsx("th",{className:"px-6 py-3",children:"Assigned"}),e.jsx("th",{className:"px-6 py-3",children:"Due Date"}),e.jsx("th",{className:"px-6 py-3 text-right",children:"Score/Progress"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800",children:(()=>{const B=qe.filter(oe=>oe.user_name===Ze.user_name);return B.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:"6",className:"px-6 py-8 text-center text-gray-500",children:"No assignments found for this user."})}):B.map(oe=>e.jsxs("tr",{className:"hover:bg-[#111215] transition-colors",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"font-medium text-white",children:oe.title})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:`text-xs font-bold px-2 py-1 rounded border ${oe.type==="alert"?"border-red-500/30 text-red-400":oe.type==="ctf"?"border-purple-500/30 text-purple-400":"border-blue-500/30 text-blue-400"}`,children:oe.type==="path"?"Learning Path":oe.type==="ctf"?"CTF":"Alert"})}),e.jsx("td",{className:"px-6 py-4",children:oe.status==="completed"||oe.status==="graded"?e.jsxs("span",{className:"flex items-center gap-1.5 text-green-400 text-xs font-bold",children:[e.jsx(Cr,{className:"w-3.5 h-3.5"})," Completed"]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-yellow-400 text-xs font-bold",children:[e.jsx(va,{className:"w-3.5 h-3.5"})," Pending"]})}),e.jsx("td",{className:"px-6 py-4 text-xs",children:new Date(oe.assigned_date).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 text-xs",children:oe.due_date?new Date(oe.due_date).toLocaleDateString():"-"}),e.jsx("td",{className:"px-6 py-4 text-right",children:oe.score!==null?e.jsxs("span",{className:`font-bold ${oe.score>=80?"text-green-400":oe.score>=60?"text-yellow-400":"text-red-400"}`,children:[oe.score,"%"]}):e.jsxs("span",{className:"text-gray-500 text-xs",children:[Math.round(oe.progress),"%"]})})]},`${oe.type}-${oe.assignment_id}`))})()})]})})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-[#111215] border border-blue-900/30 rounded-xl p-5 flex items-center gap-4 relative overflow-hidden group hover:border-blue-500/50 transition-all",children:[e.jsx("div",{className:"absolute inset-0 bg-blue-600/5 group-hover:bg-blue-600/10 transition-colors"}),e.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg",children:e.jsx(Mt,{className:"w-6 h-6 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-blue-400/60 text-xs font-bold uppercase tracking-wider mb-1",children:"Total Assignments"}),e.jsx("div",{className:"text-3xl font-bold text-white font-mono",children:st.total})]})]}),e.jsxs("div",{className:"bg-[#111215] border border-yellow-900/30 rounded-xl p-5 flex items-center gap-4 relative overflow-hidden group hover:border-yellow-500/50 transition-all",children:[e.jsx("div",{className:"absolute inset-0 bg-yellow-600/5 group-hover:bg-yellow-600/10 transition-colors"}),e.jsx("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:e.jsx(va,{className:"w-6 h-6 text-yellow-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-yellow-400/60 text-xs font-bold uppercase tracking-wider mb-1",children:"Pending"}),e.jsx("div",{className:"text-3xl font-bold text-white font-mono",children:st.pending})]})]}),e.jsxs("div",{className:"bg-[#111215] border border-green-900/30 rounded-xl p-5 flex items-center gap-4 relative overflow-hidden group hover:border-green-500/50 transition-all",children:[e.jsx("div",{className:"absolute inset-0 bg-green-600/5 group-hover:bg-green-600/10 transition-colors"}),e.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:e.jsx(Cr,{className:"w-6 h-6 text-green-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-green-400/60 text-xs font-bold uppercase tracking-wider mb-1",children:"Completed"}),e.jsx("div",{className:"text-3xl font-bold text-white font-mono",children:st.completed})]})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 justify-between",children:[e.jsxs("div",{className:"relative w-full md:w-64",children:[e.jsx(Jt,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",placeholder:"Search assignments...",value:ie,onChange:B=>{I(B.target.value),ge({...ve,page:1})},className:"w-full bg-[#111215] border border-gray-800 rounded-lg pl-9 pr-4 py-2 text-sm text-white focus:border-blue-500 outline-none"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("select",{className:"bg-[#111215] border border-gray-800 text-gray-300 rounded-lg px-4 py-2 outline-none focus:border-blue-500 transition-colors text-sm hover:border-gray-700",value:R.type||"",onChange:B=>{je({...R,type:B.target.value}),ge({...ve,page:1})},children:[e.jsx("option",{value:"",children:"All Types"}),e.jsx("option",{value:"path",children:"Learning Paths"}),e.jsx("option",{value:"ctf",children:"CTF Scenarios"}),e.jsx("option",{value:"alert",children:"Alerts"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-800 text-gray-300 rounded-lg px-4 py-2 outline-none focus:border-blue-500 transition-colors text-sm hover:border-gray-700",value:R.difficulty||"",onChange:B=>{je({...R,difficulty:B.target.value}),ge({...ve,page:1})},children:[e.jsx("option",{value:"",children:"All Difficulties"}),e.jsx("option",{value:"Novice",children:"Novice"}),e.jsx("option",{value:"Beginner",children:"Beginner"}),e.jsx("option",{value:"Intermediate",children:"Intermediate"}),e.jsx("option",{value:"Advanced",children:"Advanced"}),e.jsx("option",{value:"Expert",children:"Expert"})]})]})]}),e.jsx("div",{className:"bg-[#111215] border border-gray-800 rounded-xl overflow-hidden shadow-xl",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm text-gray-400",children:[e.jsx("thead",{className:"bg-[#1a1b1e] text-xs uppercase font-bold text-gray-500 tracking-wider",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4",children:"User"}),e.jsx("th",{className:"px-6 py-4",children:"Assignment"}),e.jsx("th",{className:"px-6 py-4",children:"Type"}),e.jsx("th",{className:"px-6 py-4",children:"Status"}),e.jsx("th",{className:"px-6 py-4",children:"Assigned"}),e.jsx("th",{className:"px-6 py-4",children:"Due Date"}),e.jsx("th",{className:"px-6 py-4 text-right",children:"Score/Progress"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-800/50",children:(()=>{const oe=qe.filter(ne=>{if(ie&&!ne.user_name.toLowerCase().includes(ie.toLowerCase())&&!ne.title.toLowerCase().includes(ie.toLowerCase())||R.type&&ne.type!==R.type)return!1;if(R.status){const Ce=ne.status==="completed"||ne.status==="graded";if(R.status==="completed"&&!Ce||R.status==="pending"&&Ce)return!1}return!0}).slice((ve.page-1)*ve.limit,ve.page*ve.limit);return oe.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:"7",className:"px-6 py-12 text-center text-gray-500",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(Jt,{className:"w-8 h-8 opacity-20"}),e.jsx("span",{children:"No assignments found matching your criteria."})]})})}):oe.map(ne=>e.jsxs("tr",{className:"hover:bg-[#1a1b1e] transition-all group border-l-2 border-transparent hover:border-blue-500",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>yt(ne),children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-[#25262b] flex items-center justify-center text-xs font-bold text-white overflow-hidden group-hover:ring-1 ring-blue-500/50 transition-all",children:ne.profile_picture?e.jsx("img",{src:ne.profile_picture,alt:"",className:"w-full h-full object-cover"}):ne.user_name.charAt(0)}),e.jsx("span",{className:"text-white font-medium group-hover:text-blue-400 transition-colors",children:ne.user_name})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("div",{className:"font-medium text-white",children:ne.title})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx("span",{className:`text-[10px] font-bold px-2 py-1 rounded border uppercase tracking-wider ${ne.type==="alert"?"border-red-500/30 text-red-400 bg-red-500/10":ne.type==="ctf"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-blue-500/30 text-blue-400 bg-blue-500/10"}`,children:ne.type==="path"?"Learning Path":ne.type==="ctf"?"CTF":"Alert"})}),e.jsx("td",{className:"px-6 py-4",children:ne.status==="completed"||ne.status==="graded"?e.jsxs("span",{className:"flex items-center gap-1.5 text-green-400 text-xs font-bold",children:[e.jsx(Cr,{className:"w-3.5 h-3.5"})," Completed"]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-yellow-400 text-xs font-bold",children:[e.jsx(va,{className:"w-3.5 h-3.5"})," Pending"]})}),e.jsx("td",{className:"px-6 py-4 text-xs font-mono text-gray-500",children:new Date(ne.assigned_date).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 text-xs font-mono text-gray-500",children:ne.due_date?new Date(ne.due_date).toLocaleDateString():"-"}),e.jsx("td",{className:"px-6 py-4 text-right",children:ne.score!==null?e.jsxs("span",{className:`font-bold font-mono ${ne.score>=80?"text-green-400":ne.score>=60?"text-yellow-400":"text-red-400"}`,children:[ne.score,"%"]}):e.jsxs("span",{className:"text-gray-600 text-xs font-mono",children:[Math.round(ne.progress),"%"]})})]},`${ne.type}-${ne.assignment_id}`))})()})]})})}),e.jsx(ct,{totalItems:qe.length,currentPage:ve.page,itemsPerPage:ve.limit,onPageChange:B=>ge({...ve,page:B})})]})]}),y==="training_alerts"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex gap-4 border-b border-gray-800 pb-4",children:[e.jsx("button",{onClick:()=>_("library"),className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${w==="library"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"System Library"}),e.jsx("button",{onClick:()=>_("create"),className:`text-sm font-bold px-4 py-2 rounded-lg transition-colors ${w==="create"?"bg-white text-black":"text-gray-400 hover:text-white"}`,children:"My Custom Alerts"})]}),w==="library"&&e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:items-center justify-between gap-4 mb-6",children:[e.jsx("h3",{className:"text-lg font-bold text-white",children:"Alert Library"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1 md:w-64",children:[e.jsx(Jt,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",placeholder:"Search alerts...",value:ie,onChange:B=>I(B.target.value),className:"w-full bg-[#111215] border border-gray-700 rounded-lg pl-9 pr-4 py-2 text-sm text-white focus:border-blue-500 outline-none"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-2 text-white outline-none focus:border-blue-500 text-sm",value:R.type,onChange:B=>je({...R,type:B.target.value}),children:[e.jsx("option",{value:"",children:"All Types"}),e.jsx("option",{value:"Phishing",children:"Phishing"}),e.jsx("option",{value:"Malware",children:"Malware"}),e.jsx("option",{value:"Network",children:"Network Intrusion"})]}),e.jsxs("select",{className:"bg-[#111215] border border-gray-700 rounded-lg px-4 py-2 text-white outline-none focus:border-blue-500 text-sm",value:R.difficulty,onChange:B=>je({...R,difficulty:B.target.value}),children:[e.jsx("option",{value:"",children:"All Difficulties"}),e.jsx("option",{value:"Novice",children:"Novice"}),e.jsx("option",{value:"Beginner",children:"Beginner"}),e.jsx("option",{value:"Intermediate",children:"Intermediate"}),e.jsx("option",{value:"Advanced",children:"Advanced"}),e.jsx("option",{value:"Expert",children:"Expert"})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:(()=>{const B=d.filter(Ce=>!(!Ce.title||ie&&!Ce.title.toLowerCase().includes(ie.toLowerCase())||R.type&&Ce.alert_type!==R.type||R.difficulty&&Ce.difficulty!==R.difficulty));Math.ceil(B.length/P.limit);const oe=(P.page-1)*P.limit,ne=B.slice(oe,oe+P.limit);return e.jsxs(e.Fragment,{children:[ne.map(Ce=>e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-5 hover:border-purple-500/50 hover:shadow-[0_0_20px_rgba(168,85,247,0.1)] transition-all duration-300 group flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("div",{className:`px-2.5 py-1 rounded-md text-xs font-bold uppercase tracking-wider border ${Ce.severity==="Critical"?"bg-red-500/10 border-red-500/50 text-red-400 shadow-[0_0_10px_rgba(239,68,68,0.2)]":Ce.severity==="High"?"bg-orange-500/10 border-orange-500/50 text-orange-400":Ce.severity==="Medium"?"bg-amber-500/10 border-amber-500/50 text-amber-400":"bg-blue-500/10 border-blue-500/50 text-blue-400"}`,children:Ce.severity}),e.jsx("span",{className:"text-xs font-medium text-gray-500 border border-gray-800 bg-[#111215] px-2 py-1 rounded-md",children:Ce.difficulty})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("h4",{className:"text-white font-bold text-lg mb-2 leading-tight group-hover:text-purple-400 transition-colors line-clamp-1",title:Ce.title,children:Ce.title}),e.jsx("p",{className:"text-gray-400 text-sm line-clamp-2 min-h-[40px]",children:Ce.details?Ce.details.split("Timestamp:")[0]:"No details provided."})]}),e.jsxs("div",{className:"space-y-3 mt-auto",children:[e.jsx("div",{className:"border-t border-gray-800 pt-3"}),e.jsxs("button",{onClick:()=>{F([Ce.id]),q([]),E(!0)},className:"w-full py-2.5 bg-gradient-to-r from-gray-800 to-gray-800 hover:from-purple-600 hover:to-blue-600 hover:text-white border border-gray-700 hover:border-transparent text-gray-300 rounded-lg text-sm font-bold transition-all duration-300 flex items-center justify-center gap-2 group-hover:shadow-lg",children:["Assign to Team",e.jsx(Pr,{size:14,className:"opacity-0 group-hover:opacity-100 transition-opacity"})]})]})]},Ce.id)),B.length===0&&e.jsxs("div",{className:"col-span-full py-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-800/50 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Jt,{className:"w-8 h-8 text-gray-600"})}),e.jsx("h3",{className:"text-white font-bold mb-1",children:"No alerts found"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Try adjusting your filters or search terms."})]}),e.jsx("div",{className:"col-span-full mt-2",children:e.jsx(ct,{totalItems:B.length,currentPage:P.page,itemsPerPage:P.limit,onPageChange:Ce=>O({...P,page:Ce})})})]})})()})]}),w==="create"&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-5 pointer-events-none",children:e.jsx(yr,{size:120,className:"text-white"})}),e.jsxs("h3",{className:"text-xl font-bold text-white mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"p-1.5 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-lg",children:e.jsx(ju,{size:16,className:"text-white"})}),"Create Custom Scenario"]}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Design a new training scenario manually or let AI generate one for you."}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase mb-1.5 ml-1",children:"Scenario Title"}),e.jsx("input",{className:"w-full bg-[#111215] border border-gray-700 rounded-xl px-4 py-3 text-white focus:border-blue-500 outline-none transition-all focus:ring-1 focus:ring-blue-500",placeholder:"e.g. Suspicious Email from HR...",value:Z.title,onChange:B=>xe({...Z,title:B.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase mb-1.5 ml-1",children:"Alert Type"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:["Phishing","Malware","Network Intrusion","Insider Threat","Web Attack","Ransomware"].map(B=>e.jsx("button",{onClick:()=>xe({...Z,alert_type:B}),className:`px-3 py-2 rounded-lg text-xs font-bold border transition-all ${Z.alert_type===B?"bg-blue-500/20 border-blue-500 text-blue-400":"bg-[#111215] border-gray-700 text-gray-400 hover:border-gray-600"}`,children:B},B))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase mb-1.5 ml-1",children:"Difficulty Level"}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:[{name:"Novice",level:"1-2",color:"emerald"},{name:"Beginner",level:"3-4",color:"green"},{name:"Intermediate",level:"5-6",color:"amber"},{name:"Advanced",level:"7-8",color:"orange"},{name:"Expert",level:"9-10",color:"red"}].map(B=>e.jsxs("button",{onClick:()=>xe({...Z,difficulty:B.name}),className:`p-2 rounded-lg border text-center transition-all ${Z.difficulty===B.name?`bg-${B.color}-500/20 border-${B.color}-500 text-white ring-1 ring-${B.color}-500`:"bg-[#111215] border-gray-700 text-gray-400 hover:border-gray-600"}`,children:[e.jsx("div",{className:"text-xs font-bold",children:B.name}),e.jsxs("div",{className:"text-[10px] text-gray-500 hidden sm:block",children:["Lvl ",B.level]})]},B.name))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-xs font-bold uppercase mb-1.5 ml-1",children:"Severity"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:["Low","Medium","High","Critical"].map(B=>e.jsx("button",{onClick:()=>xe({...Z,severity:B}),className:`p-2 rounded-lg border text-center transition-all ${Z.severity===B?`bg-${B==="Critical"?"red":B==="High"?"orange":B==="Medium"?"yellow":"blue"}-500/20 border-${B==="Critical"?"red":B==="High"?"orange":B==="Medium"?"yellow":"blue"}-500 text-white`:"bg-[#111215] border-gray-700 text-gray-400 hover:border-gray-600"}`,children:e.jsx("div",{className:"text-xs font-bold",children:B})},B))})]}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{placeholder:"Describe your scenario in detail. The AI will generate a complete alert based on YOUR description...",className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-blue-500 outline-none h-32 resize-none",value:Z.details,onChange:B=>xe({...Z,details:B.target.value})}),e.jsxs("button",{onClick:ke,disabled:pe||!Z.details,className:"absolute bottom-2 right-2 px-3 py-1.5 bg-purple-600 hover:bg-purple-700 disabled:bg-gray-700 text-white text-xs rounded-md flex items-center gap-1.5 transition-colors",title:"AI will create raw logs and answer key based on your description",children:[pe?e.jsx(Jr,{className:"w-3 h-3 animate-spin"}):e.jsx(yr,{className:"w-3 h-3"}),pe?"Generating...":"Generate with AI"]})]}),e.jsx("textarea",{placeholder:"Raw Logs (Syslog, Firewall, etc.) - Can be auto-generated...",className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-blue-500 outline-none h-24 resize-none font-mono text-sm",value:Z.raw_log,onChange:B=>xe({...Z,raw_log:B.target.value})}),e.jsx("button",{onClick:ft,disabled:!Z.details,className:"w-full py-3 bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Create Scenario"})]})]})}),e.jsx("div",{children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6 h-full",children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:"Your Library"}),e.jsxs("div",{className:"space-y-3 max-h-[500px] overflow-y-auto pr-2 custom-scrollbar",children:[u.map(B=>e.jsxs("div",{className:"p-3 bg-[#111215] rounded-lg border border-gray-800 hover:border-gray-700 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-gray-200 text-sm mb-1",children:B.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded uppercase ${B.severity==="Critical"?"bg-red-500/20 text-red-500":B.severity==="High"?"bg-orange-500/20 text-orange-500":"bg-blue-500/20 text-blue-500"}`,children:B.severity}),e.jsx("span",{className:"text-[10px] text-gray-500 border border-gray-800 px-1.5 py-0.5 rounded",children:B.difficulty||"Intermediate"})]})]}),e.jsx("button",{onClick:()=>Xt(B.id),className:"text-gray-600 hover:text-red-400 p-1 rounded transition-colors",title:"Delete Scenario",children:e.jsx(na,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"mt-3 flex gap-2",children:e.jsx("button",{onClick:()=>{F([B.id]),le(null),q([]),E(!0)},className:"flex-1 py-1.5 bg-gray-800 hover:bg-gray-700 text-gray-300 hover:text-white rounded text-xs font-bold transition-all",children:"Assign"})})]},B.id)),u.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-600 text-sm",children:"No custom alerts yet. Create one to get started."})]})]})})]})]}),y==="assessments"&&e.jsx(b_,{organizationId:a.id,members:s}),y==="activity"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(Er,{className:"w-6 h-6 text-blue-400"}),"Organization Activity"]}),e.jsxs("div",{className:"bg-[#111215] border border-gray-800 rounded-xl p-6 shadow-xl relative overflow-hidden",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(ba,{className:"w-5 h-5 text-blue-500"}),"Weekly Mission Activity"]}),e.jsx("div",{className:"h-64 w-full relative z-10",children:e.jsx(Ra,{width:"100%",height:"100%",children:e.jsxs(Xc,{data:We,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"barGradientActivity",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:1}),e.jsx("stop",{offset:"100%",stopColor:"#1d4ed8",stopOpacity:.6})]})}),e.jsx(ps,{strokeDasharray:"3 3",stroke:"#1f2937",vertical:!1}),e.jsx(bs,{dataKey:"name",stroke:"#6b7280",tick:{fill:"#6b7280",fontSize:12},axisLine:!1,tickLine:!1,dy:10}),e.jsx(vs,{stroke:"#6b7280",tick:{fill:"#6b7280",fontSize:12},axisLine:!1,tickLine:!1}),e.jsx(La,{cursor:{fill:"#1f2937",opacity:.4},content:({active:B,payload:oe,label:ne})=>B&&oe&&oe.length?e.jsxs("div",{className:"bg-[#1a1b1e] border border-blue-500/30 p-3 rounded-lg shadow-xl",children:[e.jsx("p",{className:"text-gray-400 text-xs mb-1 font-bold",children:ne}),e.jsxs("p",{className:"text-white font-bold text-base flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),oe[0].value," Missions"]})]}):null}),e.jsx(Lo,{dataKey:"completed",fill:"url(#barGradientActivity)",radius:[4,4,0,0],barSize:40,animationDuration:1e3})]})})})]}),e.jsxs("div",{className:"bg-[#111215] border border-gray-800 rounded-xl p-6",children:[e.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:"Recent System Events"}),e.jsxs("div",{className:"space-y-4",children:[u.slice(0,10).map(B=>e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#1a1b1e] rounded-lg border border-gray-800/50",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(xr,{className:"w-4 h-4 text-blue-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-bold text-white",children:["Scenario Created: ",B.title]}),e.jsx("div",{className:"text-xs text-gray-500",children:"Created by Administrator"})]})]}),e.jsx("div",{className:"text-xs text-gray-400",children:new Date(B.created_at).toLocaleDateString()})]},B.id)),u.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No recent activity logged."})]})]})]}),y==="reports"&&e.jsx(BI,{analytics:o,onDownload:gt}),y==="settings"&&e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(ki,{className:"w-6 h-6 text-gray-400"}),"Organization Settings"]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"Organization Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:"flex-1 bg-[#111215] border border-gray-700 rounded-lg px-4 py-2 text-white focus:border-blue-500 outline-none",defaultValue:a.name,id:"orgNameInput"}),e.jsx("button",{onClick:async()=>{const B=document.getElementById("orgNameInput").value;if(B)try{const oe=localStorage.getItem("token");(await fetch(`${Y}/api/organizations/${a.id}/settings`,{method:"PUT",headers:{Authorization:`Bearer ${oe}`,"Content-Type":"application/json"},body:JSON.stringify({name:B})})).ok&&z.success("Organization name updated successfully")}catch(oe){console.error(oe),z.error("Update failed")}},className:"bg-blue-600 hover:bg-blue-500 text-white px-4 rounded-lg font-medium",children:"Update"})]})]}),e.jsxs("div",{className:"bg-[#111215] border border-gray-800 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-green-500/10 rounded-lg",children:e.jsx(ba,{className:"w-4 h-4 text-green-500"})}),"Subscription & Plan"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-gray-800",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Current Plan"}),e.jsxs("div",{className:"text-xl font-bold text-white capitalize",children:[a.plan_type," Plan"]})]}),a.plan_type!=="enterprise"&&e.jsx("button",{onClick:()=>re(!0),className:"px-4 py-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-bold rounded-lg shadow-lg shadow-blue-900/20 transition-all text-sm",children:"Upgrade Plan"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#1a1b1e] p-3 rounded-lg border border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase font-bold mb-1",children:"Billing Interval"}),e.jsxs("div",{className:"text-white font-medium capitalize flex items-center gap-2",children:[e.jsx($c,{className:"w-4 h-4 text-gray-400"}),a.billing_interval||"Monthly"]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] p-3 rounded-lg border border-gray-800",children:[e.jsx("div",{className:"text-xs text-gray-500 uppercase font-bold mb-1",children:"License Seats"}),e.jsxs("div",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(At,{className:"w-4 h-4 text-gray-400"}),s.length," / ",a.license_seats," Used"]})]})]}),a.trial_end_date&&new Date(a.trial_end_date)>new Date&&e.jsxs("div",{className:"bg-blue-500/5 border border-blue-500/20 rounded-lg p-3 text-sm flex items-start gap-3",children:[e.jsx(va,{className:"w-5 h-5 text-blue-400 shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-blue-200 font-bold block mb-0.5",children:"Trial Active"}),e.jsxs("span",{className:"text-gray-400",children:["Your free trial ends on ",new Date(a.trial_end_date).toLocaleDateString(),"."]})]})]})]})]})]}),e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"border border-red-500/30 bg-red-500/5 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-red-400 font-bold mb-2 flex items-center gap-2",children:[e.jsx(Sa,{className:"w-5 h-5"}),"Danger Zone"]}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Manage critical actions for your organization."}),e.jsxs("div",{className:"space-y-4",children:[a.plan_type!=="free"&&e.jsxs("div",{className:"flex items-center justify-between p-4 bg-red-500/5 border border-red-500/10 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-red-200 font-bold text-sm",children:"Cancel Subscription"}),e.jsx("div",{className:"text-red-400/60 text-xs",children:"Downgrade to Free plan immediately"})]}),e.jsx("button",{onClick:()=>Ie(!0),className:"px-3 py-1.5 border border-red-500/30 text-red-400 hover:bg-red-500/10 rounded transition-colors text-xs font-bold uppercase",children:"Cancel"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-red-500/5 border border-red-500/10 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-red-200 font-bold text-sm",children:"Delete Organization"}),e.jsx("div",{className:"text-red-400/60 text-xs",children:"Permanently remove all data"})]}),e.jsx("button",{onClick:()=>Ke(!0),className:"px-3 py-1.5 border border-red-500/30 text-red-400 hover:bg-red-500/10 rounded transition-colors text-xs font-bold uppercase",children:"Delete"})]})]})]})})]})]})]})]}),Te&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-[80] animate-in fade-in duration-200",children:e.jsx("div",{className:"bg-[#1a1b1e] rounded-xl w-full max-w-md border border-red-500/30 shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200",children:e.jsxs("div",{className:"p-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-red-500/10 rounded-full flex items-center justify-center mx-auto mb-4 border border-red-500/20",children:e.jsx(Sa,{className:"w-8 h-8 text-red-500"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Cancel Subscription?"}),e.jsxs("p",{className:"text-gray-400 text-sm mb-6",children:["Are you sure you want to cancel? Your organization will be downgraded to the ",e.jsx("strong",{children:"Free Plan"})," immediately, and you will lose access to premium features."]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>Ie(!1),className:"flex-1 bg-gray-800 hover:bg-gray-700 text-white py-3 rounded-lg font-bold transition-colors",children:"Keep Subscription"}),e.jsx("button",{onClick:Ae,className:"flex-1 bg-red-600 hover:bg-red-500 text-white py-3 rounded-lg font-bold shadow-lg shadow-red-900/20 transition-colors",children:"Yes, Cancel"})]})]})})}),tt&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-[80] animate-in fade-in duration-200",children:e.jsx("div",{className:"bg-[#1a1b1e] rounded-xl w-full max-w-md border border-red-500/50 shadow-[0_0_50px_rgba(239,68,68,0.2)] overflow-hidden animate-in zoom-in-95 duration-200",children:e.jsxs("div",{className:"p-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-red-500/10 rounded-full flex items-center justify-center mx-auto mb-4 border border-red-500/20",children:e.jsx(na,{className:"w-8 h-8 text-red-500"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Delete Organization?"}),e.jsxs("p",{className:"text-red-300 text-sm mb-6 bg-red-500/5 border border-red-500/10 p-3 rounded-lg",children:[e.jsx("strong",{children:"WARNING:"})," This action is permanent and cannot be undone. All data, members, and reports associated with this organization will be permanently erased."]}),e.jsxs("div",{className:"text-left mb-6",children:[e.jsx("label",{className:"block text-gray-500 text-xs font-bold uppercase mb-2",children:'Type "DELETE" to confirm'}),e.jsx("input",{type:"text",className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-3 text-white focus:border-red-500 outline-none transition-colors",placeholder:"DELETE",value:Be,onChange:B=>Ge(B.target.value)})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>{Ke(!1),Ge("")},className:"flex-1 bg-gray-800 hover:bg-gray-700 text-white py-3 rounded-lg font-bold transition-colors",children:"Cancel"}),e.jsx("button",{onClick:J,disabled:Be!=="DELETE",className:"flex-1 bg-red-600 hover:bg-red-500 text-white py-3 rounded-lg font-bold shadow-lg shadow-red-900/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Delete Forever"})]})]})})}),U&&e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-[60]",children:e.jsxs("div",{className:"bg-[#1a1b1e] p-6 rounded-xl w-full max-w-lg border border-gray-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h3",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx(Pc,{className:"w-5 h-5 text-blue-500"}),"Invite New Member"]}),e.jsx("button",{onClick:()=>ee(!1),className:"text-gray-400 hover:text-white",children:e.jsx(oa,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-1",children:"Email Address"}),e.jsx("input",{className:"w-full bg-[#111215] border border-gray-700 rounded-lg px-4 py-2 text-white focus:border-blue-500 outline-none transition-colors",placeholder:"colleague@company.com",value:ae.email,onChange:B=>ue({...ae,email:B.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm mb-1",children:"Role"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>ue({...ae,role:"member"}),className:`px-4 py-3 rounded-lg border text-left transition-colors ${ae.role==="member"?"bg-blue-600/10 border-blue-500 text-white":"bg-[#111215] border-gray-700 text-gray-400 hover:border-gray-500"}`,children:[e.jsx("div",{className:"font-bold text-sm mb-1",children:"Member"}),e.jsx("div",{className:"text-xs opacity-70",children:"Can view dashboard and complete assignments."})]}),e.jsxs("button",{onClick:()=>ue({...ae,role:"admin"}),className:`px-4 py-3 rounded-lg border text-left transition-colors ${ae.role==="admin"?"bg-blue-600/10 border-blue-500 text-white":"bg-[#111215] border-gray-700 text-gray-400 hover:border-gray-500"}`,children:[e.jsx("div",{className:"font-bold text-sm mb-1",children:"Admin"}),e.jsx("div",{className:"text-xs opacity-70",children:"Can manage team, assign tasks, and view reports."})]})]})]}),e.jsxs("div",{className:"bg-blue-500/10 border border-blue-500/20 rounded-lg p-3 flex gap-3",children:[e.jsx("div",{className:"p-1 bg-blue-500/20 rounded",children:e.jsx(kr,{className:"w-4 h-4 text-blue-400"})}),e.jsx("p",{className:"text-xs text-blue-200",children:"An invitation email will be sent to this address with a secure link to join your organization."})]})]}),e.jsxs("div",{className:"flex gap-3 mt-8",children:[e.jsx("button",{onClick:()=>ee(!1),className:"flex-1 bg-transparent hover:bg-gray-800 text-gray-300 py-2.5 rounded-lg border border-gray-700 font-medium transition-colors",children:"Cancel"}),e.jsx("button",{onClick:ut,disabled:!ae.email,className:"flex-1 bg-blue-600 hover:bg-blue-500 text-white py-2.5 rounded-lg font-bold shadow-lg shadow-blue-900/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:"Send Invitation"})]})]})}),($||A)&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-[60] animate-in fade-in duration-200",children:e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl w-full max-w-lg border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[e.jsx("div",{className:"p-6 border-b border-gray-800 bg-[#111215]",children:e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:e.jsx(At,{className:"w-6 h-6 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-bold text-white",children:"Task Assignment"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Allocate resources to personnel"})]})]})}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-4 border border-gray-700/50",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-1",children:"Assignment"}),e.jsxs("div",{className:"text-white font-medium flex items-center gap-2",children:[e.jsx(Mt,{className:"w-4 h-4 text-blue-400"}),(W==null?void 0:W.title)||`${L.length} Selected Alert(s)`]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Select Personnel"}),e.jsx("div",{className:"max-h-60 overflow-y-auto border border-gray-800 rounded-lg bg-[#111215] divide-y divide-gray-800 custom-scrollbar",children:s.length>0?s.map(B=>e.jsxs("label",{className:"flex items-center gap-4 p-3 hover:bg-gray-800 transition-colors cursor-pointer group",children:[e.jsx("div",{className:`w-5 h-5 rounded border flex items-center justify-center transition-all ${D.includes(B.user_id)?"bg-blue-600 border-blue-600":"border-gray-600 group-hover:border-gray-400 bg-transparent"}`,children:D.includes(B.user_id)&&e.jsx(Cr,{className:"w-3.5 h-3.5 text-white"})}),e.jsx("input",{type:"checkbox",className:"hidden",checked:D.includes(B.user_id),onChange:()=>{D.includes(B.user_id)?q(D.filter(oe=>oe!==B.user_id)):q([...D,B.user_id])}}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-gray-700 to-gray-800 flex items-center justify-center text-xs font-bold text-white ring-2 ring-gray-800",children:B.name.charAt(0)}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-white group-hover:text-blue-400 transition-colors",children:B.name}),e.jsx("div",{className:"text-xs text-gray-500",children:"Operative"})]})]})]},B.user_id)):e.jsx("div",{className:"p-8 text-center text-gray-500 text-sm",children:"No personnel found."})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Due Date"}),e.jsxs("div",{className:"relative",children:[e.jsx($c,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"date",value:Q,onChange:B=>de(B.target.value),className:"w-full bg-[#111215] border border-gray-800 rounded-lg py-2 pl-9 pr-3 text-sm text-white focus:border-blue-500 outline-none transition-colors"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Priority Level"}),e.jsxs("button",{onClick:()=>se(!H),className:`w-full py-2 px-3 rounded-lg border flex items-center justify-center gap-2 transition-all ${H?"bg-red-500/10 border-red-500 text-red-500 shadow-[0_0_10px_rgba(239,68,68,0.2)]":"bg-[#111215] border-gray-800 text-gray-500 hover:border-gray-600"}`,children:[e.jsx(kr,{className:`w-4 h-4 ${H?"fill-current":""}`}),e.jsx("span",{className:"text-sm font-bold",children:H?"CRITICAL":"STANDARD"})]})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-gray-800 bg-[#111215] flex gap-3",children:[e.jsx("button",{onClick:()=>{C(!1),E(!1),de(""),se(!1)},className:"flex-1 bg-transparent hover:bg-gray-800 text-gray-400 hover:text-white py-2.5 rounded-lg font-bold transition-all",children:"Cancel"}),e.jsxs("button",{onClick:async()=>{if(D.length!==0)try{const B=localStorage.getItem("token");let oe,ne;const Ce={due_date:Q||null,is_mandatory:H};$&&W?(W.isCTF?ne={operation_id:typeof W.id=="string"?parseInt(W.id.replace("ctf-",""),10):W.id,user_ids:D,...Ce}:W.isOperation?ne={operation_id:W.id,user_ids:D,...Ce}:ne={learning_path_id:W.id,user_ids:D,...Ce},console.log("Assigning Path Payload:",ne),oe=await fetch(`${Y}/api/organizations/${a.id}/assign-path`,{method:"POST",headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/json"},body:JSON.stringify(ne)})):A&&L.length>0&&(ne={alert_ids:L,user_ids:D},console.log("Assigning Alerts Payload:",ne),oe=await fetch(`${Y}/api/organizations/${a.id}/assign-alerts`,{method:"POST",headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/json"},body:JSON.stringify(ne)}));const at=await oe.json();if(oe&&oe.ok){const ze=$?W!=null&&W.isCTF?"CTF Mission":"Learning Path":"Alerts";C(!1),E(!1),F([]),le(null),Ee({title:"Assignment Successful",message:`${ze} successfully assigned to ${D.length} member(s).`,type:"success"}),te(!0)}else Ee({title:"Assignment Failed",message:at.message||"An unexpected error occurred.",type:"error"}),te(!0)}catch(B){console.error("Assignment error:",B),Ee({title:"Connection Error",message:"Failed to connect to the server. Please try again.",type:"error"}),te(!0)}},disabled:D.length===0,className:"flex-[2] bg-blue-600 hover:bg-blue-500 text-white py-2.5 rounded-lg font-bold shadow-lg shadow-blue-900/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[e.jsx(Cr,{className:"w-4 h-4"}),"Confirm Assignment"]})]})]})}),M&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[70]",children:e.jsxs("div",{className:`bg-[#25262b] border ${Ne.type==="error"?"border-red-500/50":"border-green-500/50"} rounded-xl p-8 w-full max-w-sm text-center transform transition-all scale-100 animate-fadeIn shadow-2xl`,children:[e.jsx("div",{className:`w-16 h-16 ${Ne.type==="error"?"bg-red-500/20":"bg-green-500/20"} rounded-full flex items-center justify-center mx-auto mb-6`,children:Ne.type==="error"?e.jsx(Sa,{className:`w-8 h-8 ${Ne.type==="error"?"text-red-400":"text-green-400"}`}):e.jsx(Cr,{className:"w-8 h-8 text-green-400"})}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:Ne.title}),e.jsx("p",{className:"text-gray-400 mb-8",children:Ne.message}),e.jsx("button",{onClick:()=>te(!1),className:`w-full py-3 ${Ne.type==="error"?"bg-red-600 hover:bg-red-500":"bg-blue-600 hover:bg-blue-500"} text-white rounded-xl font-bold transition-colors`,children:Ne.type==="error"?"Close":"Continue"})]})}),fe&&a&&e.jsx(HI,{onClose:()=>re(!1),organization:a,memberCount:s.length})]})},UI=({user:t})=>{const[r,a]=l.useState(null),[n,s]=l.useState(!0),[i,o]=l.useState("overview"),[c,d]=l.useState({primary_color:"#8b5cf6",secondary_color:"#ec4899",logo_url:"",allow_custom_alerts:!1}),[m,u]=l.useState(null);l.useEffect(()=>{x()},[]);const x=async()=>{try{const f=localStorage.getItem("token"),b=await(await fetch(`${Y}/api/organizations/my`,{headers:{Authorization:`Bearer ${f}`}})).json();if(b.organization&&(a(b.organization),b.organization.settings)){const p=typeof b.organization.settings=="string"?JSON.parse(b.organization.settings):b.organization.settings;d({...c,...p})}}catch(f){console.error("Error fetching org:",f)}finally{s(!1)}},h=async()=>{try{const f=localStorage.getItem("token"),g=new FormData;g.append("primary_color",c.primary_color),g.append("secondary_color",c.secondary_color),g.append("allow_custom_alerts",c.allow_custom_alerts),m&&g.append("logo",m);const b=await fetch(`${Y}/api/organizations/${r.id}/settings`,{method:"PUT",headers:{Authorization:`Bearer ${f}`,"Content-Type":"application/json"},body:JSON.stringify(c)});if(m){const p=new FormData;p.append("logo",m),await fetch(`${Y}/api/organizations/${r.id}/logo`,{method:"POST",headers:{Authorization:`Bearer ${f}`},body:p})}b.ok&&(z.success("Organization settings updated"),x())}catch(f){console.error("Error updating settings:",f),z.error("Failed to update settings")}};return n?e.jsx("div",{className:"p-8 text-center text-gray-500",children:"Loading organization profile..."}):r?e.jsxs("div",{className:"max-w-6xl mx-auto pb-12",children:[e.jsxs("div",{className:"bg-[#1a1b1e] rounded-2xl border border-gray-800 overflow-hidden mb-8",children:[e.jsx("div",{className:"h-32 bg-gradient-to-r from-blue-900/40 to-purple-900/40"}),e.jsxs("div",{className:"px-8 pb-8 flex items-end gap-6 -mt-12",children:[e.jsx("div",{className:"w-24 h-24 bg-[#1a1b1e] rounded-xl p-2 shadow-xl border border-gray-700 flex items-center justify-center",children:r.logo_url||c.logo_url?e.jsx("img",{src:r.logo_url||c.logo_url,alt:"Org Logo",className:"max-w-full max-h-full rounded"}):e.jsx(as,{className:"w-12 h-12 text-gray-500"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-white",children:r.name}),e.jsxs("p",{className:"text-gray-400",children:["Business Admin Portal • ",r.plan_type," Plan"]})]})]}),e.jsx("div",{className:"px-8 flex gap-8 border-t border-gray-800 mt-4",children:["overview","settings","billing"].map(f=>e.jsx("button",{onClick:()=>o(f),className:`py-4 text-sm font-bold border-b-2 transition-colors capitalize ${i===f?"border-purple-500 text-white":"border-transparent text-gray-500 hover:text-gray-300"}`,children:f},f))})]}),e.jsxs("div",{className:"space-y-6",children:[i==="overview"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(xr,{className:"w-5 h-5 text-purple-400"}),"Organization Status"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-800",children:[e.jsx("span",{className:"text-gray-400",children:"Plan Status"}),e.jsx("span",{className:"text-green-400 font-bold bg-green-500/10 px-2 py-0.5 rounded",children:"Active"})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-800",children:[e.jsx("span",{className:"text-gray-400",children:"Total Seats"}),e.jsx("span",{className:"text-white font-bold",children:r.license_seats})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-gray-800",children:[e.jsx("span",{className:"text-gray-400",children:"Used Seats"}),e.jsx("span",{className:"text-white font-bold",children:r.used_seats})]}),e.jsxs("div",{className:"flex justify-between items-center py-2",children:[e.jsx("span",{className:"text-gray-400",children:"Renewal Date"}),e.jsx("span",{className:"text-white font-bold",children:r.created_at?new Date(new Date(r.created_at).setFullYear(new Date().getFullYear()+1)).toLocaleDateString():"N/A"})]})]})]}),e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(At,{className:"w-5 h-5 text-blue-400"}),"Quick Actions"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("button",{className:"p-4 bg-gray-800/50 hover:bg-gray-800 rounded-lg text-left transition-colors group",children:[e.jsx("div",{className:"text-purple-400 mb-2 group-hover:scale-110 transition-transform",children:e.jsx(At,{className:"w-6 h-6"})}),e.jsx("div",{className:"font-bold text-white",children:"Manage Team"}),e.jsx("div",{className:"text-xs text-gray-400",children:"Add or remove members"})]}),e.jsxs("button",{className:"p-4 bg-gray-800/50 hover:bg-gray-800 rounded-lg text-left transition-colors group",children:[e.jsx("div",{className:"text-green-400 mb-2 group-hover:scale-110 transition-transform",children:e.jsx(jo,{className:"w-6 h-6"})}),e.jsx("div",{className:"font-bold text-white",children:"View Invoices"}),e.jsx("div",{className:"text-xs text-gray-400",children:"Download past invoices"})]})]})]})]}),i==="settings"&&e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-6 flex items-center gap-2",children:[e.jsx(ki,{className:"w-5 h-5 text-gray-400"}),"Organization Settings"]}),e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-4",children:"Branding Colors"}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs text-gray-500 mb-1",children:"Primary Color"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"color",value:c.primary_color,onChange:f=>d({...c,primary_color:f.target.value}),className:"h-10 w-10 rounded border-0 cursor-pointer bg-transparent"}),e.jsx("input",{type:"text",value:c.primary_color,onChange:f=>d({...c,primary_color:f.target.value}),className:"flex-1 bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm"})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs text-gray-500 mb-1",children:"Secondary Color"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"color",value:c.secondary_color,onChange:f=>d({...c,secondary_color:f.target.value}),className:"h-10 w-10 rounded border-0 cursor-pointer bg-transparent"}),e.jsx("input",{type:"text",value:c.secondary_color,onChange:f=>d({...c,secondary_color:f.target.value}),className:"flex-1 bg-gray-800 border border-gray-700 rounded px-3 py-2 text-white text-sm"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Organization Logo"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-800 rounded-lg flex items-center justify-center border border-gray-700 text-gray-500",children:m?e.jsx("img",{src:URL.createObjectURL(m),className:"w-full h-full object-cover rounded-lg"}):r.logo_url?e.jsx("img",{src:r.logo_url,className:"w-full h-full object-cover rounded-lg"}):e.jsx(Vf,{className:"w-6 h-6"})}),e.jsx("input",{type:"file",accept:"image/*",onChange:f=>u(f.target.files[0]),className:"text-sm text-gray-400 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-purple-500/10 file:text-purple-400 hover:file:bg-purple-500/20"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-400 text-sm font-bold mb-2",children:"Feature Settings"}),e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-gray-800/50 rounded-lg border border-gray-700",children:[e.jsx("input",{type:"checkbox",checked:c.allow_custom_alerts,onChange:f=>d({...c,allow_custom_alerts:f.target.checked}),className:"w-5 h-5 rounded border-gray-600 text-purple-600 focus:ring-purple-500 bg-gray-700"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-medium",children:"Enable Custom Alerts"}),e.jsx("div",{className:"text-xs text-gray-400",children:"Allow creating custom training scenarios for your team"})]})]})]}),e.jsx("div",{className:"pt-4",children:e.jsxs("button",{onClick:h,className:"px-6 py-2 bg-purple-600 hover:bg-purple-500 text-white rounded-lg font-bold flex items-center gap-2 transition-colors",children:[e.jsx(As,{className:"w-4 h-4"})," Save Changes"]})})]})]}),i==="billing"&&e.jsx("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl p-6",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-800 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(jo,{className:"w-8 h-8 text-gray-400"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Billing Portal"}),e.jsx("p",{className:"text-gray-400 max-w-md mx-auto mb-6",children:"Manage your subscription, payment methods, and view invoices via our secure billing portal."}),e.jsx("button",{className:"px-6 py-3 bg-white text-black font-bold rounded-lg hover:bg-gray-200 transition-colors",children:"Open Stripe Portal"})]})})]})]}):e.jsx("div",{className:"p-8 text-center text-gray-500",children:"Organization not found."})},VI=({user:t,onNavigate:r})=>{var S;const[a,n]=l.useState(!0),[s,i]=l.useState(null),[o,c]=l.useState([]),[d,m]=l.useState([]),[u,x]=l.useState([]),[h,f]=l.useState(null),[g,b]=l.useState({completed:0,pending:0,avgScore:0,streak:0,xp:0,level:1}),[p,v]=l.useState(null),y=Jo();l.useEffect(()=>{j()},[]);const j=async()=>{try{const w={Authorization:`Bearer ${localStorage.getItem("token")}`},P=await(await fetch(`${Y}/api/organizations/my`,{headers:w})).json();if(P.organization){i(P.organization);const[k,$,C]=await Promise.all([fetch(`${Y}/api/assignments/my`,{headers:w}).catch(()=>({json:()=>({assignments:[]})})),fetch(`${Y}/api/assessments/my-invites`,{headers:w}).catch(()=>({json:()=>({invites:[]})})),fetch(`${Y}/api/organizations/${P.organization.id}/leaderboard`,{headers:w}).catch(()=>({json:()=>({leaderboard:[]})}))]),A=await k.json();c(A.assignments||[]);const E=await $.json();m(E.invites||[]);const L=await C.json();x(L.leaderboard||[])}const T=await(await fetch(`${Y}/api/profile/me`,{headers:w})).json();v(T),f(T.stats||{}),T.academy_stats&&b(k=>{var $;return{...k,xp:T.academy_stats.xp||0,level:T.academy_stats.level||1,streak:T.academy_stats.streak_days||0,completed:(($=T.stats)==null?void 0:$.completed_investigations)||0}})}catch(N){console.error("Error fetching member data:",N)}finally{n(!1)}};return a?e.jsx("div",{className:"flex items-center justify-center min-h-screen bg-[#0e0f11]",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 border-4 border-blue-500/30 border-t-blue-500 rounded-full animate-spin"}),e.jsx("div",{className:"text-blue-500 font-mono text-sm animate-pulse",children:"ESTABLISHING SECURE CONNECTION..."})]})}):e.jsxs("div",{className:"max-w-[1600px] mx-auto py-8 px-4 sm:px-6 lg:px-8 space-y-8 animate-fadeIn bg-infosec-bg min-h-screen text-white",children:[e.jsx(Yc,{user:t,profile:p,onNavigate:r}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsx("div",{className:"lg:col-span-8 space-y-6",children:e.jsxs("div",{className:"bg-[#0e0f11] border border-blue-500/30 rounded-3xl overflow-hidden shadow-2xl relative",children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-30",children:e.jsx(Mt,{className:"w-24 h-24 text-blue-500/20"})}),e.jsxs("div",{className:"px-6 py-4 border-b border-blue-500/20 bg-blue-900/10 flex items-center justify-between relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Yv,{className:"w-5 h-5 text-blue-400"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:s!=null&&s.name?`${s.name} Directives`:"Mission Directives"})]}),o.length>0&&e.jsxs("span",{className:"px-2 py-0.5 bg-blue-500 text-white text-[10px] font-bold rounded uppercase animate-pulse",children:[o.length," Pending"]})]}),e.jsx("div",{className:"p-6",children:o.length===0&&d.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-500/10 rounded-full flex items-center justify-center mx-auto mb-4 border border-blue-500/20",children:e.jsx(Or,{className:"w-8 h-8 text-blue-400"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"All Clear, Agent."}),e.jsxs("p",{className:"text-gray-400 max-w-md mx-auto mb-6",children:["You have no pending mandatory assignments from your organization. Engage in ",e.jsx("span",{className:"text-purple-400 font-bold",children:"Field Training"})," below to improve your standing."]}),e.jsxs("button",{onClick:()=>window.scrollTo({top:500,behavior:"smooth"}),className:"text-sm font-bold text-blue-400 hover:text-blue-300 flex items-center gap-2 mx-auto",children:["Proceed to Training ",e.jsx(GI,{className:"w-4 h-4"})]})]}):e.jsxs("div",{className:"space-y-4",children:[d.map(N=>e.jsxs("div",{className:"flex items-center justify-between bg-blue-500/10 border border-blue-500/30 p-4 rounded-xl hover:bg-blue-500/20 transition-all cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 bg-blue-500/20 rounded-lg",children:e.jsx(dr,{className:"w-6 h-6 text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-white text-lg",children:N.assessment_title}),e.jsxs("p",{className:"text-blue-200 text-xs uppercase tracking-wider",children:["Assessment • Due: ",new Date(N.expires_at).toLocaleDateString()]})]})]}),e.jsx("button",{className:"bg-blue-600 hover:bg-blue-500 text-white px-6 py-2 rounded-lg font-bold text-sm shadow-lg shadow-blue-900/50",children:"Start Assessment"})]},N.id)),o.map(N=>{const w=N.status==="completed"||N.completed,_=N.alert_id||N.operation_id||N.learning_path_id,P=N.operation_id?"mission":N.alert_id?"alerts_page":"learning_path";return e.jsxs("button",{onClick:()=>{N.alert_id?y(`/alerts/${_}?return_to=dashboard`):P==="learning_path"?y(`/academy/path/${_}`):r(P,_)},className:`w-full flex items-center justify-between border p-4 rounded-xl transition-all text-left group
                                                    ${w?"bg-green-500/10 border-green-500/30 hover:bg-green-500/20":"bg-gray-800/40 border-gray-700 hover:border-blue-500/50 hover:bg-gray-800/60"}`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`p-3 rounded-lg ${w?"bg-green-500/20":"bg-gray-700/50 group-hover:bg-blue-500/20 transition-colors"}`,children:w?e.jsx(Or,{className:"w-6 h-6 text-green-400"}):e.jsx(Mt,{className:"w-6 h-6 text-gray-400 group-hover:text-blue-400 transition-colors"})}),e.jsxs("div",{children:[e.jsx("h4",{className:`font-bold ${w?"text-green-100 line-through opacity-70":"text-white group-hover:text-blue-100"}`,children:N.title||N.task_title||"Classified Task"}),e.jsx("p",{className:"text-gray-400 text-xs",children:w?"Mission Accomplished":N.type==="ctf"?"Operation Directive":"Assigned Investigation"})]})]}),e.jsx("span",{className:`text-xs font-bold uppercase border px-2 py-1 rounded
                                                    ${w?"text-green-400 border-green-500/30 bg-green-500/10":"text-yellow-500 border-yellow-500/30 bg-yellow-500/10 animate-pulse"}`,children:w?"Completed":"Pending"})]},N.id)})]})})]})}),e.jsx("div",{className:"lg:col-span-4 space-y-6",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-3xl p-6 relative overflow-hidden h-full flex flex-col",children:[e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 bg-purple-600/10 rounded-full blur-3xl -mr-12 -mt-12 pointer-events-none"}),e.jsxs("div",{className:"flex items-center gap-4 mb-6 relative z-10",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-indigo-500/20 to-purple-500/20 border border-indigo-500/30 flex items-center justify-center shadow-lg shadow-purple-900/20",children:e.jsx(At,{className:"w-7 h-7 text-indigo-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white leading-tight",children:(s==null?void 0:s.name)||"Organization"}),e.jsx("p",{className:"text-xs text-indigo-400 font-mono uppercase tracking-wider",children:"Top Agents"})]})]}),e.jsx("div",{className:"space-y-3 mb-6 flex-1 overflow-y-auto max-h-[250px] pr-2 custom-scrollbar",children:u.length>0?u.slice(0,5).map((N,w)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-white/5 rounded-xl border border-white/5 hover:bg-white/10 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`
                                                w-8 h-8 rounded-lg flex items-center justify-center font-bold text-xs
                                                ${w===0?"bg-yellow-500/20 text-yellow-400 border border-yellow-500/30":w===1?"bg-gray-400/20 text-gray-300 border border-gray-400/30":w===2?"bg-orange-500/20 text-orange-400 border border-orange-500/30":"bg-gray-800 text-gray-500"}
                                            `,children:w+1}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-white max-w-[120px] truncate",children:N.name||N.username||"Agent"}),e.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:N.role||"Member"})]})]}),e.jsxs("span",{className:"text-xs font-mono font-bold text-indigo-400",children:[N.exp||N.xp||0," XP"]})]},w)):e.jsx("div",{className:"text-center py-8 text-gray-500 text-sm",children:"No leaderboard data available"})}),e.jsxs("div",{className:"pt-4 border-t border-white/5 flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vu,{className:"w-4 h-4 text-yellow-500"}),e.jsxs("span",{className:"text-xs font-bold text-gray-300",children:["Your Rank: #",u.findIndex(N=>N.id===t.id)+1||"-"]})]}),e.jsxs("span",{className:"text-xs text-gray-500",children:[((S=s==null?void 0:s.total_xp)==null?void 0:S.toLocaleString())||0," Total XP"]})]})]})})]}),e.jsxs("div",{className:"border-t border-gray-800 pt-8 mt-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(kr,{className:"w-6 h-6 text-purple-500"}),e.jsx("h2",{className:"text-2xl font-bold text-white uppercase tracking-wide",children:"Field Training & Operations"})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-8 items-start",children:[e.jsxs("div",{className:"xl:col-span-8 flex flex-col gap-8",children:[e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-2xl",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(wo,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Self-Paced Practice"})]})}),e.jsx("div",{className:"p-6 bg-gradient-to-b from-[#0e0f11] to-[#0e0f11]/50 backdrop-blur-xl",children:e.jsx(ed,{onSelectAlert:N=>r("alerts_page"),onNavigate:r})})]}),e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-2xl",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Cn,{className:"w-5 h-5 text-emerald-500"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Academy Training"})]})}),e.jsx("div",{className:"p-0",children:e.jsx(Qc,{analytics:p,profile:p,onNavigate:r})})]})]}),e.jsxs("div",{className:"xl:col-span-4 flex flex-col gap-8",children:[e.jsx("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-3xl p-1 relative overflow-hidden",children:e.jsx(Zc,{})}),e.jsx("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-xl",children:e.jsx("div",{className:"p-1",children:e.jsx(Jc,{analytics:p})})}),e.jsxs("div",{className:"bg-[#0e0f11] border border-gray-800 rounded-3xl overflow-hidden shadow-xl",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-800 bg-[#131416] flex items-center gap-3",children:[e.jsx(ya,{className:"w-5 h-5 text-yellow-500"}),e.jsx("h3",{className:"text-sm font-bold text-white uppercase tracking-widest",children:"Achievements"})]}),e.jsx("div",{className:"p-4",children:e.jsx(cp,{profile:p,onNavigate:r})})]})]})]})]})]})};function GI(t){return e.jsx("svg",{...t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}const hM=()=>{const{user:t,logout:r,loading:a}=df(),n=Hv(),s=Jo(),[i,o]=l.useState([]),[c,d]=l.useState("all"),[m,u]=l.useState(null),[x,h]=l.useState(null),[f,g]=l.useState(!1),[b,p]=l.useState(!1),[v,y]=l.useState(!1),[j,S]=l.useState(""),N=(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin";if(a)return e.jsx("div",{className:"text-white text-center mt-20",children:"Loading user details..."});const[w,_]=l.useState([]),[P,O]=l.useState([]),[T,k]=l.useState([]),[$,C]=l.useState([]),[A,E]=l.useState([]),[L,F]=l.useState([]),[D,q]=l.useState(null),[Q,de]=l.useState(!1),[H,se]=l.useState(!1),[W,le]=l.useState(!0),[U,ee]=l.useState(null),[ae,ue]=l.useState(()=>{const ye=new URLSearchParams(window.location.search).get("view");return ye||(window.location.pathname==="/admin"||(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"?"overview":"soc_dashboard")}),fe=(be,ye=null)=>{s(be==="soc_dashboard"?"/dashboard":ye?`/dashboard?view=${be}&id=${ye}`:`/dashboard?view=${be}`)};l.useEffect(()=>{const be=new URLSearchParams(n.search),ye=be.get("view"),De=be.get("id");De&&Ie(De),ye&&ye!==ae?ue(ye):ye||(Q&&(t==null?void 0:t.username)!=="admin"?ue("team"):(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"?ue("overview"):ue("soc_dashboard"))},[n.search,t]),l.useEffect(()=>{const ye={soc_dashboard:"SOC Dashboard",overview:"Admin Overview",alerts_page:"Alerts",all:"Alerts",create_alert:"Create Alert",create_mission:"Create Mission",content_tagging:"Content Tagging",missions:"Missions",leaderboard:"Leaderboard",profile:"Profile",users:"User Management",payments:"Payments",feedbacks:"Feedbacks",settings:"Settings",closed:"Closed Cases",archived:"Archives",mine:"My Investigations","admin-review":"Review Queue"}[ae]||"Dashboard";document.title=`${ye} | InfoSecLabs`},[ae]);const[re,V]=l.useState("alerts"),[ce,Z]=l.useState((t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token")),[xe,pe]=l.useState("main"),[Se,ke]=l.useState(1),[$e,K]=l.useState(10),[ie,I]=l.useState(0),[R,je]=l.useState([]),[Te,Ie]=l.useState(null),tt=be=>{Ie(be),fe("alerts_page")},Ke=be=>{Ie(be),fe("closed")},Be=(be,ye)=>{Ie(be),fe(ye)},Ge=async()=>{try{const be=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token");Z(be),Z(be);const ye={Authorization:`Bearer ${be}`};try{console.log("Checking org status...");const Le=await fetch(`${Y}/api/organizations/my`,{headers:ye});if(console.log("Org status response:",Le.status),Le.ok){const Re=await Le.json();console.log("Org data received:",Re),Re.organization&&["owner","admin"].includes(Re.organization.user_role)?(console.log("User is Org Admin/Owner"),de(!0)):Re.organization&&Re.organization.user_role==="member"?(console.log("User is Org Member"),se(!0)):console.log("User is NOT in any Org")}}catch(Le){console.error("Error checking org status:",Le)}finally{le(!1)}let De=`${Y}/api/alerts?page=${Se}&limit=${$e}`;c==="ai"&&(De+="&generated=true");const M=await fetch(De,{headers:ye});if(M.ok){const Le=await M.json();if(Array.isArray(Le))o(Le),I(Le.length);else{let Re=Le.alerts;const ut=new URLSearchParams(window.location.search).get("id");if(ut&&!Re.find(gt=>gt.id===parseInt(ut)))try{const gt=await fetch(`${Y}/api/alerts/${ut}`,{headers:ye});gt.ok&&(Re=[await gt.json(),...Re])}catch(gt){console.error("Failed to fetch target alert:",gt)}o(Re),I(Le.total)}}const te=await fetch(`${Y}/api/alerts/my`,{headers:ye});if(te.ok){const Le=await te.json();_(Le.filter(Re=>Re.investigation_status!=="graded"))}if((t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"){const Le=await fetch(`${Y}/api/alerts/admin/investigations`,{headers:ye});Le.ok&&k(await Le.json());const Re=await fetch(`${Y}/api/alerts/admin/reported`,{headers:ye});Re.ok&&F(await Re.json());const ot=await fetch(`${Y}/api/alerts/admin/assigned`,{headers:ye});ot.ok&&O(await ot.json())}const Ne=await fetch(`${Y}/api/alerts/closed`,{headers:ye});if(Ne.ok){const Le=await Ne.json();E(Le);const Re=[...Le].sort((ot,ut)=>new Date(ut.updated_at)-new Date(ot.updated_at));je(Re)}if((t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"){const Le=await fetch(`${Y}/api/alerts/archived?page=1&limit=1`,{headers:ye});if(Le.ok){const Re=await Le.json();ge(Re.total||0)}}const Ee=await fetch(`${Y}/api/operations`,{headers:ye});if(Ee.ok){const Le=await Ee.json();C(Le.operations||[])}const Pe=await fetch(`${Y}/api/learning-paths/user/analytics`,{headers:ye});Pe.ok&&u(await Pe.json());const Me=await fetch(`${Y}/api/profile/me`,{headers:ye});Me.ok&&h(await Me.json());const Ue=await fetch(`${Y}/api/alerts/dashboard/stats`,{headers:ye});Ue.ok&&q(await Ue.json())}catch(be){console.error("Error fetching data:",be)}},[J,Ae]=l.useState([]),[ve,ge]=l.useState(0),qe=async be=>{try{const ye=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token");(await fetch(`${Y}/api/alerts/${be}/resubmit`,{method:"POST",headers:{Authorization:`Bearer ${ye}`}})).ok?(z.success("Alert resubmitted (bumped date) to active feed successfully."),Ge()):z.error("Failed to resubmit alert.")}catch(ye){console.error("Error resubmitting alert:",ye),z.error("Error resubmitting alert.")}};l.useEffect(()=>{Ge();const be=Wv(Y);return ee(be),be.on("connect",()=>{console.log("Connected to socket server");const ye=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token");ye&&be.emit("authenticate",ye,"web")}),be.on("new-alert",ye=>{Se===1&&o(De=>[ye,...De].slice(0,$e))}),be.on("alert-updated",ye=>{o(De=>De.map(M=>M.id===ye.id?ye:M))}),be.on("investigation-started",()=>{}),()=>be.disconnect()},[t,Se,$e,c]),l.useEffect(()=>{(async()=>{if(((t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin")&&ae==="archived")try{const De={Authorization:`Bearer ${(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token")}`},M=await fetch(`${Y}/api/alerts/archived?page=${Se}&limit=${$e}`,{headers:De});if(M.ok){const te=await M.json();Array.isArray(te)?(Ae(te),ge(te.length)):(Ae(te.alerts||[]),ge(te.total||0))}}catch(ye){console.error("Error fetching archived alerts:",ye)}})()},[ae,Se,$e,t]);const Xe=async be=>{try{const ye=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),De=await fetch(`${Y}/api/alerts/${be}/assign`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye}`},body:JSON.stringify({userId:t.id})});if(De.ok)Ge(),z.success("Alert assigned successfully!");else{const M=await De.json().catch(()=>({}));z.error(M.message||"Failed to assign alert")}}catch(ye){console.error("Error assigning alert:",ye),z.error("Error assigning alert. Please try again.")}},st=async be=>{try{const ye=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),De=await fetch(`${Y}/api/alerts/${be}/unassign`,{method:"POST",headers:{Authorization:`Bearer ${ye}`}});if(De.ok)z.success("Alert unassigned successfully"),Ge();else{const M=await De.json().catch(()=>({}));z.error(M.message||"Failed to unassign alert")}}catch(ye){console.error("Error unassigning alert:",ye),z.error("Error unassigning alert")}},ht=async(be,ye)=>{try{const De=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),M=await fetch(`${Y}/api/alerts/${be}/submit`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${De}`},body:JSON.stringify({summary:ye})});if(M.ok)Ge(),z.success("Executive Summary submitted successfully!");else{const te=await M.json().catch(()=>({}));z.error("Failed to submit summary: "+(te.message||"Server error"))}}catch(De){console.error("Error submitting summary:",De),z.error("Error submitting summary")}},Ze=async(be,ye,De)=>{try{const M=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token");(await fetch(`${Y}/api/alerts/investigation/${be}/grade`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${M}`},body:JSON.stringify({grade:ye,feedback:De})})).ok&&Ge()}catch(M){console.error("Error grading investigation:",M)}},yt=({totalItems:be,currentPage:ye,setCurrentPage:De,itemsPerPage:M,setItemsPerPage:te})=>{const Ne=Math.ceil(be/M);return be===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center mt-6 px-4 py-3 bg-[#1a1b1e] rounded-lg border border-gray-800",children:[e.jsxs("div",{className:"flex items-center text-sm text-gray-400 mb-4 sm:mb-0",children:[e.jsx("span",{className:"mr-3",children:"Show"}),e.jsxs("select",{value:M,onChange:Ee=>{te(Number(Ee.target.value)),De(1)},className:"bg-[#0e0f11] border border-gray-700 text-white text-sm rounded-lg focus:ring-infosec-accent focus:border-infosec-accent block p-1.5",children:[e.jsx("option",{value:10,children:"10"}),e.jsx("option",{value:25,children:"25"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]}),e.jsx("span",{className:"ml-3",children:"alerts per page"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>De(Ee=>Math.max(Ee-1,1)),disabled:ye===1,className:`px-3 py-1 rounded-md text-sm font-medium ${ye===1?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-white hover:bg-gray-700"}`,children:"Previous"}),e.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Page ",e.jsx("span",{className:"text-white font-bold",children:ye})," of ",e.jsx("span",{className:"text-white font-bold",children:Ne})]}),e.jsx("button",{onClick:()=>De(Ee=>Math.min(Ee+1,Ne)),disabled:ye===Ne,className:`px-3 py-1 rounded-md text-sm font-medium ${ye===Ne?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-white hover:bg-gray-700"}`,children:"Next"})]})]})},[We,tr]=l.useState(null);l.useEffect(()=>{(async()=>{try{const ye=await fetch(`${Y}/api/auth/config`);if(ye.ok){const De=await ye.json();tr(De)}}catch(ye){console.error("Failed to load config",ye)}})()},[]);const Vt=async be=>{if(!be){z.error("Invalid price configuration"),console.error("Price ID is missing from stripeConfig");return}try{const ye=(t==null?void 0:t.token)||localStorage.getItem("token")||sessionStorage.getItem("token"),De=await fetch(`${Y}/api/payments/create-checkout-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye}`},body:JSON.stringify({priceId:be})});if(De.ok){const M=await De.json();M.url?window.location.href=M.url:z.error("Failed to start checkout")}else{const M=await De.json();z.error(M.message||"Failed to start checkout")}}catch(ye){console.error("Upgrade error:",ye),z.error("Error starting checkout")}},ct=()=>{var be,ye,De,M,te,Ne,Ee,Pe;switch(console.log("Rendering view:",ae),ae){case"leaderboard":return e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-white mb-2",children:"Leaderboard"}),e.jsx("p",{className:"text-gray-400",children:"All-time rankings based on total XP earned."})]}),e.jsx(Om,{})]});case"team":return e.jsx(Nc,{user:t,onNavigate:fe});case"create":return(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"?e.jsx("div",{className:"max-w-7xl mx-auto pt-8 pb-6 sm:px-6 lg:px-8",children:e.jsx(Jl,{setView:fe})}):e.jsx("div",{className:"text-white text-center mt-10",children:"Access Denied"});case"mine":return(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"?e.jsx("div",{className:"text-white text-center mt-10",children:"Admins cannot have personal investigations."}):e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"My Investigations"})}),e.jsx(ta,{alerts:w,viewMode:"mine",onSubmitSummary:ht,onUnassign:st,userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,onNavigate:Be})]});case"assigned_users":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Assigned Investigations (Users)"})}),e.jsx(ta,{alerts:P,viewMode:"all",userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,onNavigate:Be,compact:!1})]});case"admin-review":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Review Queue"})}),e.jsx(ta,{alerts:T,viewMode:"admin-review",onGradeInvestigation:Ze,userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,onNavigate:Be})]});case"reported":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Reported / Appealed Alerts"})}),e.jsx(ta,{alerts:L,viewMode:"admin-review",onGradeInvestigation:Ze,userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,onNavigate:Be})]});case"case_history":return e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Case History"}),e.jsxs("div",{className:"bg-[#1a1b1e] p-1 rounded-lg flex space-x-1 border border-gray-800",children:[e.jsx("button",{onClick:()=>fe("closed"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${ae==="closed"||ae==="case_history"?"bg-infosec-accent text-black":"text-gray-400 hover:text-white hover:bg-white/5"}`,children:"Recent (Closed)"}),e.jsx("button",{onClick:()=>fe("archived"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${ae==="archived"?"bg-infosec-accent text-black":"text-gray-400 hover:text-white hover:bg-white/5"}`,children:"Cold Storage (Archived)"})]})]}),e.jsx(ta,{alerts:A,viewMode:"closed",userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,initialExpandedId:Te,onNavigate:Be})]});case"closed":return e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Case History"}),e.jsxs("div",{className:"bg-[#1a1b1e] p-1 rounded-lg flex space-x-1 border border-gray-800",children:[e.jsx("button",{onClick:()=>fe("closed"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${ae==="closed"?"bg-infosec-accent text-black":"text-gray-400 hover:text-white hover:bg-white/5"}`,children:"Recent (Closed)"}),e.jsx("button",{onClick:()=>fe("archived"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${ae==="archived"?"bg-infosec-accent text-black":"text-gray-400 hover:text-white hover:bg-white/5"}`,children:"Cold Storage (Archived)"})]})]}),e.jsx(ta,{alerts:A,viewMode:"closed",userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,initialExpandedId:Te,onNavigate:Be})]});case"learning_path":return e.jsx(PathDetail,{});case"users":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:e.jsx($C,{token:ce})});case"organizations":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(r_,{})});case"mentor_feedbacks":return e.jsx(s_,{feedbacks:R,setView:fe,setTargetAlertId:Ie});case"overview":return Q&&(t==null?void 0:t.username)!=="admin"?e.jsx(Nc,{user:t,onNavigate:fe}):(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"?e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(UC,{token:ce,setView:fe})}):e.jsx("div",{className:"text-white text-center mt-10",children:"Access Denied"});case"payments":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(EC,{token:ce})});case"feedbacks":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(e_,{token:ce})});case"create_alert":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto pt-8 pb-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(Jl,{setView:fe})});case"emails":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn h-[calc(100vh-80px)]",children:e.jsx(VC,{token:ce})});case"create_mission":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(Jl,{setView:fe,initialTab:"mission"})});case"content_tagging":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(l_,{})});case"archived":return(t==null?void 0:t.role)!=="admin"&&(t==null?void 0:t.role)!=="alert-admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 px-4 sm:px-0",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Case History"}),e.jsxs("div",{className:"bg-[#1a1b1e] p-1 rounded-lg flex space-x-1 border border-gray-800",children:[e.jsx("button",{onClick:()=>fe("closed"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${ae==="closed"?"bg-infosec-accent text-black":"text-gray-400 hover:text-white hover:bg-white/5"}`,children:"Recent (Closed)"}),e.jsx("button",{onClick:()=>fe("archived"),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${ae==="archived"?"bg-infosec-accent text-black":"text-gray-400 hover:text-white hover:bg-white/5"}`,children:"Cold Storage (Archived)"})]})]}),e.jsx(ta,{alerts:J,viewMode:"archived",userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,onNavigate:Be,onResubmit:qe}),e.jsx(yt,{totalItems:ve,currentPage:Se,setCurrentPage:ke,itemsPerPage:$e,setItemsPerPage:K})]});case"settings":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(YC,{token:ce,setView:fe,setAlertFilter:d})});case"marketing":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(AC,{token:ce})});case"newsletter":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(OC,{token:ce})});case"blog":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(o_,{token:ce})});case"admin_notifications":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:e.jsx(c_,{})});case"missions":return e.jsx("div",{className:"animate-fadeIn",children:e.jsx(mx,{token:ce,user:t,setView:fe,initialOperationId:Te,onClose:()=>fe("soc_dashboard")})});case"mission":return e.jsx("div",{className:"animate-fadeIn",children:e.jsx(mx,{token:ce,user:t,setView:fe,initialOperationId:Te,onClose:()=>fe("soc_dashboard")})});case"profile":return W?e.jsx("div",{className:"p-8 text-center text-gray-500",children:"Loading profile context..."}):Q?e.jsx(UI,{user:t}):e.jsx("div",{className:"profile-container animate-fade-in-up",children:e.jsx(kC,{user:t,myInvestigations:w,closedAlerts:A})});case"admin_missions":return(t==null?void 0:t.role)!=="admin"?e.jsx("div",{className:"text-white",children:"Access Denied"}):e.jsx("div",{className:"animate-fadeIn",children:e.jsx(t_,{token:ce})});case"live_map":return e.jsx("div",{className:"max-w-[95%] mx-auto py-6 animate-fadeIn h-[85vh]",children:e.jsx(ux,{})});case"academy":return e.jsx("div",{className:"animate-fadeIn",children:e.jsx(Lj,{hideNav:!0})});case"soc_dashboard":return W?e.jsx("div",{className:"p-8 text-center text-gray-500",children:"Loading dashboard context..."}):Q?e.jsx(Nc,{user:t,onNavigate:fe}):H?e.jsx(VI,{user:t,onNavigate:fe}):e.jsx(p_,{stats:D,user:t,profile:x,missions:$,analytics:m,assignedAlerts:w,onNavigate:fe,onSelectAlert:(gt,ir)=>Be(gt,ir||"mine")});case"all":case"alerts_page":return e.jsx(W1,{alerts:c==="ai"?i.filter(gt=>gt.is_ai_generated):i,myInvestigations:w,myMissions:$,assignedToUsers:P,closedAlerts:A,user:t,onAssign:Xe,onUnassign:st,onRefresh:Ge,onNavigate:Be,handleSubmitSummary:ht,handleGradeInvestigation:Ze,handleResubmitAlert:qe,initialExpandedId:Te,currentPage:Se,setCurrentPage:ke,itemsPerPage:$e,setItemsPerPage:K,totalItems:ie,activeTab:xe,onTabChange:pe});case"subscription":const Me=parseFloat(((We==null?void 0:We.stripe_price_original_monthly)||"0").toString().replace("$","")),Ue=parseFloat(((We==null?void 0:We.stripe_price_display_monthly)||"9.99").toString().replace("$","")),Le=Me>Ue?Math.round((Me-Ue)/Me*100):0,Re=parseFloat(((We==null?void 0:We.stripe_price_original_monthly)||"19.99").toString().replace("$",""))*12,ot=parseFloat(((We==null?void 0:We.stripe_price_display_yearly)||"98").toString().replace("$","")),ut=Re>ot?Math.round((Re-ot)/Re*100):0;return e.jsxs("div",{className:"max-w-7xl mx-auto py-6 sm:px-6 lg:px-8 animate-fadeIn",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-white mb-4",children:"Upgrade Your Arsenal"}),e.jsx("p",{className:"text-gray-400 max-w-2xl mx-auto",children:"Unlock unlimited investigations, advanced analytics, and premium learning paths."})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[e.jsxs("div",{className:"p-8 bg-[#1a1b1e] rounded-2xl border border-gray-800 flex flex-col opacity-75 grayscale hover:grayscale-0 hover:opacity-100 transition-all duration-300",children:[e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:(We==null?void 0:We.plan_free_name)||"Free Tier"}),e.jsxs("div",{className:"text-4xl font-extrabold text-white mb-6",children:["$0",e.jsx("span",{className:"text-xl text-gray-500 font-normal",children:"/mo"})]}),e.jsx("div",{className:"inline-block bg-gray-800 text-gray-300 text-xs px-2 py-1 rounded mb-6 self-start",children:"Current Plan"}),e.jsxs("ul",{className:"space-y-4 mb-8 flex-1",children:[e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-green-500 mr-2",children:"✓"})," Access to 1st Lesson Only"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-green-500 mr-2",children:"✓"})," ",(We==null?void 0:We.free_tier_limit)||3," Alerts / Month"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-green-500 mr-2",children:"✓"})," Community Leaderboard"]})]}),e.jsx("button",{disabled:!0,className:"block w-full py-3 text-center bg-gray-800 text-gray-500 rounded-xl font-bold cursor-not-allowed",children:"Active"})]}),e.jsxs("div",{className:"p-8 bg-[#1a1b1e] rounded-2xl border border-infosec-accent shadow-[0_0_30px_rgba(0,255,65,0.1)] flex flex-col transform hover:-translate-y-2 transition duration-300 relative",children:[e.jsx("div",{className:"absolute top-0 right-0 bg-infosec-accent text-black text-xs font-bold px-3 py-1 rounded-bl-xl rounded-tr-xl",children:"POPULAR"}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:(We==null?void 0:We.plan_monthly_name)||"Monthly Pro"}),e.jsxs("div",{className:"flex items-baseline gap-2 mb-6",children:[Le>0&&e.jsxs("span",{className:"text-xl text-gray-500 line-through font-bold",children:["$",Me]}),e.jsx("span",{className:"text-4xl font-extrabold text-white",children:(We==null?void 0:We.stripe_price_display_monthly)||"$9.99"}),e.jsx("span",{className:"text-xl text-gray-500 font-normal",children:"/mo"})]}),e.jsxs("ul",{className:"space-y-4 mb-8 flex-1",children:[e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-infosec-accent mr-2",children:"✓"})," Unlimited Academy Access"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-infosec-accent mr-2",children:"✓"})," Unlimited Investigations"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-infosec-accent mr-2",children:"✓"})," Advanced Analytics"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-infosec-accent mr-2",children:"✓"})," Pro Badge"]})]}),e.jsx("button",{onClick:()=>Vt(We==null?void 0:We.stripe_price_monthly),className:"block w-full py-3 text-center bg-infosec-accent hover:bg-infosec-accentHover text-black rounded-xl font-bold transition shadow-lg shadow-infosec-accent/20",children:"Upgrade Monthly"})]}),e.jsxs("div",{className:"p-8 bg-gradient-to-b from-[#1a1b1e] to-purple-500/10 rounded-2xl border border-purple-500 flex flex-col transform hover:-translate-y-2 transition duration-300 relative",children:[ut>0&&e.jsxs("div",{className:"absolute -top-3 right-8 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-xs font-bold px-3 py-1 rounded-full shadow-lg",children:["SAVE ",ut,"%"]}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:(We==null?void 0:We.plan_yearly_name)||"Yearly Pro"}),e.jsxs("div",{className:"flex items-baseline gap-2 mb-6",children:[ut>0&&e.jsxs("span",{className:"text-xl text-gray-500 line-through font-bold",children:["$",Re.toFixed(2)]}),e.jsx("span",{className:"text-4xl font-extrabold text-white",children:(We==null?void 0:We.stripe_price_display_yearly)||"$98"}),e.jsx("span",{className:"text-xl text-gray-500 font-normal",children:"/yr"})]}),e.jsxs("ul",{className:"space-y-4 mb-8 flex-1",children:[e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-purple-400 mr-2",children:"✓"})," All Monthly Benefits"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-purple-400 mr-2",children:"✓"})," Priority Support"]}),e.jsxs("li",{className:"flex items-center text-gray-300",children:[e.jsx("span",{className:"text-purple-400 mr-2",children:"✓"})," Early Access to New Features"]})]}),e.jsx("button",{onClick:()=>Vt(We==null?void 0:We.stripe_price_yearly),className:"block w-full py-3 text-center bg-purple-600 hover:bg-purple-500 text-white rounded-xl font-bold transition shadow-lg shadow-purple-500/20",children:"Upgrade Yearly"})]})]})]});case"stats_overview":const ft=ie;return e.jsx("div",{className:"max-w-[98%] mx-auto py-6 animate-fadeIn space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6 items-start",children:[e.jsxs("div",{className:"xl:col-span-2 space-y-6",children:[e.jsxs("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${t.role==="admin"||t.role==="alert-admin"?"lg:grid-cols-3 xl:grid-cols-5":"lg:grid-cols-4"} gap-6`,children:[e.jsxs("div",{onClick:()=>fe("alerts_page"),className:"bg-gradient-to-br from-[#0e0f11] to-[#1a1b1e] p-4 rounded-xl border border-gray-800 hover:border-red-500/30 shadow-lg relative overflow-hidden group min-h-[100px] cursor-pointer transition-all duration-300 hover:scale-[1.02] hover:shadow-red-500/10 hover:shadow-xl",children:[e.jsxs("div",{className:"flex justify-between items-start z-10 relative",children:[e.jsxs("div",{className:"flex flex-col items-start text-left",children:[e.jsx("h4",{className:"text-gray-400 text-[10px] font-bold uppercase mb-1 tracking-wider",children:"Total Alerts"}),e.jsx("div",{className:"text-4xl font-bold text-white group-hover:text-red-400 transition-colors",children:ft}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-1",children:"Available to Investigate"})]}),e.jsx("div",{className:"w-10 h-10 bg-red-500/10 rounded-lg flex items-center justify-center group-hover:bg-red-500/20 transition-colors",children:e.jsx("svg",{className:"w-5 h-5 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})})]}),e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-red-500/5 to-transparent rounded-full blur-2xl -mr-8 -mt-8"})]}),(t.role==="admin"||t.role==="alert-admin")&&e.jsxs("div",{onClick:()=>fe("archived"),className:"bg-gradient-to-br from-[#0e0f11] to-[#1a1b1e] p-4 rounded-xl border border-gray-800 hover:border-gray-600/50 shadow-lg relative overflow-hidden group min-h-[100px] cursor-pointer transition-all duration-300 hover:scale-[1.02]",children:[e.jsxs("div",{className:"flex justify-between items-start z-10 relative",children:[e.jsxs("div",{className:"flex flex-col items-start text-left",children:[e.jsx("h4",{className:"text-gray-400 text-[10px] font-bold uppercase mb-1 tracking-wider",children:"Archived"}),e.jsx("div",{className:"text-4xl font-bold text-gray-500 group-hover:text-gray-300 transition-colors",children:ve}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-1",children:"Archived Alerts"})]}),e.jsx("div",{className:"w-10 h-10 bg-gray-500/10 rounded-lg flex items-center justify-center group-hover:bg-gray-500/20 transition-colors",children:e.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"})})})]}),e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-gray-500/5 to-transparent rounded-full blur-2xl -mr-8 -mt-8"})]}),e.jsxs("div",{onClick:()=>fe("operations"),className:"bg-gradient-to-br from-[#0e0f11] to-[#1a1b1e] p-4 rounded-xl border border-gray-800 hover:border-purple-500/30 shadow-lg relative overflow-hidden group min-h-[100px] cursor-pointer transition-all duration-300 hover:scale-[1.02] hover:shadow-purple-500/10 hover:shadow-xl",children:[e.jsxs("div",{className:"flex justify-between items-start z-10 relative",children:[e.jsxs("div",{className:"flex flex-col items-start text-left",children:[e.jsx("h4",{className:"text-gray-400 text-[10px] font-bold uppercase mb-1 tracking-wider",children:"Missions"}),e.jsx("div",{className:"text-4xl font-bold text-white group-hover:text-purple-400 transition-colors",children:($==null?void 0:$.length)||0}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-1",children:"Active Operations"})]}),e.jsx("div",{className:"w-10 h-10 bg-purple-500/10 rounded-lg flex items-center justify-center group-hover:bg-purple-500/20 transition-colors",children:e.jsx(Mt,{className:"w-5 h-5 text-purple-400"})})]}),e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-purple-500/5 to-transparent rounded-full blur-2xl -mr-8 -mt-8"})]}),e.jsxs("div",{onClick:()=>fe(t.role==="admin"||t.role==="alert-admin"?"assigned_users":"mine"),className:"bg-gradient-to-br from-[#0e0f11] to-[#1a1b1e] p-4 rounded-xl border border-gray-800 hover:border-blue-500/30 shadow-lg relative overflow-hidden group min-h-[100px] cursor-pointer transition-all duration-300 hover:scale-[1.02] hover:shadow-blue-500/10 hover:shadow-xl",children:[e.jsxs("div",{className:"flex justify-between items-start z-10 relative",children:[e.jsxs("div",{className:"flex flex-col items-start text-left",children:[e.jsx("h4",{className:"text-gray-400 text-[10px] font-bold uppercase mb-1 tracking-wider",children:t.role==="admin"||t.role==="alert-admin"?"Assigned":"Assigned to You"}),e.jsx("div",{className:"text-4xl font-bold text-white group-hover:text-blue-400 transition-colors",children:t.role==="admin"||t.role==="alert-admin"?P.length:w.length}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-1",children:"Pending Investigations"})]}),e.jsx("div",{className:"w-10 h-10 bg-blue-500/10 rounded-lg flex items-center justify-center group-hover:bg-blue-500/20 transition-colors",children:e.jsx("svg",{className:"w-5 h-5 text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})})]}),e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-blue-500/5 to-transparent rounded-full blur-2xl -mr-8 -mt-8"})]}),e.jsxs("div",{onClick:()=>fe("closed"),className:"bg-gradient-to-br from-[#0e0f11] to-[#1a1b1e] p-4 rounded-xl border border-gray-800 hover:border-green-500/30 shadow-lg relative overflow-hidden group min-h-[100px] cursor-pointer transition-all duration-300 hover:scale-[1.02] hover:shadow-green-500/10 hover:shadow-xl",children:[e.jsxs("div",{className:"flex justify-between items-start z-10 relative",children:[e.jsxs("div",{className:"flex flex-col items-start text-left",children:[e.jsx("h4",{className:"text-gray-400 text-[10px] font-bold uppercase mb-1 tracking-wider",children:"Closed / Verified"}),e.jsx("div",{className:"text-4xl font-bold text-white group-hover:text-green-400 transition-colors",children:A.length}),e.jsx("div",{className:"text-[10px] text-gray-500 mt-1",children:"Successfully Resolved"})]}),e.jsx("div",{className:"w-10 h-10 bg-green-500/10 rounded-lg flex items-center justify-center group-hover:bg-green-500/20 transition-colors",children:e.jsx("svg",{className:"w-5 h-5 text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})})]}),e.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-green-500/5 to-transparent rounded-full blur-2xl -mr-8 -mt-8"})]})]}),e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 overflow-hidden flex flex-col shadow-lg relative h-[600px]",children:[e.jsx("div",{className:"p-3 border-b border-gray-800 bg-[#1a1b1e] flex justify-between items-center absolute top-0 left-0 right-0 z-10 opacity-90 hover:opacity-100 transition-opacity",children:e.jsxs("h3",{className:"font-bold text-white flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-infosec-accent animate-pulse",children:"🌍"})," Live Threat Map"]})}),e.jsx("div",{className:"flex-grow h-full pt-10 pb-2 px-2",children:e.jsx(ux,{})})]})]}),e.jsxs("div",{className:"xl:col-span-1 space-y-6",children:[(t==null?void 0:t.role)==="admin"||(t==null?void 0:t.role)==="alert-admin"?e.jsx("div",{children:e.jsx(Om,{limit:3,showControls:!1})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"p-4 border-b border-gray-800 bg-gray-900/30",children:e.jsx("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:"🔍 Investigation Stats"})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute inset-0 bg-green-500/5 blur-xl rounded-full opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsxs("svg",{width:"100",height:"100",className:"transform -rotate-90 relative z-10",children:[e.jsx("circle",{cx:"50",cy:"50",r:"40",stroke:"#2a2b30",strokeWidth:"8",fill:"none"}),e.jsx("circle",{cx:"50",cy:"50",r:"40",stroke:"#00ff41",strokeWidth:"8",fill:"none",strokeDasharray:2*Math.PI*40,strokeDashoffset:2*Math.PI*40-(((be=m==null?void 0:m.investigations)==null?void 0:be.avgGrade)||0)/100*2*Math.PI*40,strokeLinecap:"round",className:"transition-all duration-1000 drop-shadow-[0_0_10px_rgba(0,255,65,0.5)]"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-20",children:[e.jsxs("span",{className:"text-xl font-extrabold text-white",children:[Math.round(((ye=m==null?void 0:m.investigations)==null?void 0:ye.avgGrade)||((De=x==null?void 0:x.academy_stats)==null?void 0:De.grade)||((M=t==null?void 0:t.academy_stats)==null?void 0:M.grade)||0),"%"]}),e.jsx("span",{className:"text-[10px] text-gray-400 uppercase tracking-wider font-bold",children:"Avg Grade"})]})]}),e.jsxs("div",{className:"space-y-3 text-sm flex-1 pl-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-400",children:"Total Cases"}),e.jsx("span",{className:"text-white font-bold bg-gray-800 px-2 py-0.5 rounded",children:((te=m==null?void 0:m.investigations)==null?void 0:te.total)||(A==null?void 0:A.length)+(w==null?void 0:w.length)||0})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-400",children:"Solved"}),e.jsx("span",{className:"text-green-400 font-bold bg-green-500/10 px-2 py-0.5 rounded",children:((Ne=m==null?void 0:m.investigations)==null?void 0:Ne.completed)||(A==null?void 0:A.length)||0})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-gray-400",children:"Active"}),e.jsx("span",{className:"text-yellow-400 font-bold bg-yellow-500/10 px-2 py-0.5 rounded",children:((Ee=m==null?void 0:m.investigations)==null?void 0:Ee.inProgress)||(w==null?void 0:w.length)||0})]})]})]})})]}),((Pe=m==null?void 0:m.moduleScores)==null?void 0:Pe.length)>2&&e.jsxs("div",{className:"bg-[#1a1b1e] rounded-xl border border-gray-800 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"p-4 border-b border-gray-800 bg-gray-900/30",children:e.jsx("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:"📊 Skill Breakdown"})}),e.jsxs("div",{className:"p-4 relative",children:[e.jsx("div",{className:"absolute inset-0 bg-purple-500/5 pointer-events-none"}),e.jsx(Ra,{width:"100%",height:200,children:e.jsxs(fu,{cx:"50%",cy:"50%",outerRadius:"70%",data:m.moduleScores.slice(0,6).map(gt=>({subject:gt.title.length>15?gt.title.substring(0,15)+"...":gt.title,score:Number(gt.avg_score)||0,fullMark:100})),children:[e.jsx(gu,{stroke:"#333"}),e.jsx(pu,{dataKey:"subject",tick:{fill:"#9ca3af",fontSize:10,fontWeight:500}}),e.jsx(il,{angle:30,domain:[0,100],tick:!1,axisLine:!1}),e.jsx(bu,{name:"Score",dataKey:"score",stroke:"#b026ff",strokeWidth:2,fill:"#b026ff",fillOpacity:.3}),e.jsx(La,{contentStyle:{backgroundColor:"#111",border:"1px solid #333",borderRadius:"8px",fontSize:"12px"},itemStyle:{color:"#b026ff"}})]})})]})]})]}),e.jsxs("div",{className:"bg-[#0e0f11] rounded-xl border border-gray-800 flex flex-col shadow-lg overflow-hidden max-h-[600px]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1b1e] flex justify-between items-center",children:[e.jsxs("h3",{className:"font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"🔥"})," Recent"]}),e.jsx("button",{onClick:()=>fe("alerts_page"),className:"text-xs text-blue-400 hover:text-blue-300 transition-colors border border-blue-900 rounded px-2 py-1",children:"View All Alerts →"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-0 scrollbar-thin scrollbar-thumb-gray-700 scrollbar-track-transparent",children:e.jsx(ta,{alerts:i.slice(0,5),viewMode:"all",onAssign:Xe,onUnassign:st,userId:t==null?void 0:t.id,userRole:t==null?void 0:t.role,onRefresh:Ge,compact:!0,onAlertClick:tt,onNavigate:Be})})]})]})]})});default:return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[50vh] text-center p-8 animate-fadeIn",children:[e.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:"View Not Found"}),e.jsxs("p",{className:"text-gray-400 mb-6",children:['The requested view "',ae,'" does not exist.']}),e.jsx("button",{onClick:()=>fe(N?"overview":"all"),className:"bg-purple-600 hover:bg-purple-500 text-white px-6 py-2 rounded-lg font-medium transition-colors",children:"Return to Overview"})]})}};return N&&(!Q||(t==null?void 0:t.username)==="admin")?e.jsxs("div",{className:"flex min-h-screen bg-[#0e0f11]",children:[e.jsx(MC,{currentView:ae,setView:fe,user:t,logout:r,isOpen:b,setIsOpen:p}),e.jsxs("div",{className:"lg:hidden fixed top-0 left-0 right-0 h-16 bg-[#111215] border-b border-[#1a1b1e] z-40 flex items-center justify-between px-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/logo.png",alt:"Logo",className:"h-8 w-auto"}),e.jsxs("span",{className:"font-bold text-lg text-white",children:["Admin",e.jsx("span",{className:"text-infosec-accent",children:"Console"})]})]}),e.jsxs("button",{onClick:()=>p(!0),className:"p-2 text-gray-400 hover:text-white rounded-lg hover:bg-[#1a1b1e]",children:[e.jsx("span",{className:"sr-only",children:"Open menu"}),e.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 6h16M4 12h16M4 18h16"})})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-screen lg:ml-72 transition-all duration-300 pt-16 lg:pt-0",children:[e.jsx("main",{className:"flex-1 overflow-x-hidden pt-6 px-4 sm:px-6 lg:px-8 pb-12",children:ct()}),e.jsxs("div",{className:"border-t border-[#1a1b1e] p-6 text-center text-gray-600 text-sm",children:["InfoSecLabs Admin Console © ",new Date().getFullYear()]})]}),f&&e.jsx(Im,{onClose:()=>g(!1)}),e.jsx(Am,{user:t,token:ce}),v&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-4 text-left animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl w-full max-w-4xl max-h-[85vh] overflow-hidden flex flex-col shadow-2xl",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center bg-[#131416]",children:[e.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-400",children:"💬"})," All Mentor Feedback"]}),e.jsx("button",{onClick:()=>y(!1),className:"text-gray-400 hover:text-white transition-colors",children:"✕"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:R.map(be=>e.jsxs("div",{onClick:()=>{Ke(be.id),y(!1)},className:"bg-gray-950/50 border border-gray-800 rounded p-4 cursor-pointer hover:bg-gray-900 transition group",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 text-xs block mb-0.5",children:new Date(be.created_at||be.updated_at).toLocaleString()}),e.jsx("span",{className:"text-white font-bold text-sm",children:be.alert_title||"Alert Feedback"})]}),e.jsxs("span",{className:`text-lg font-bold ${be.grade>=70?"text-green-500":"text-yellow-500"}`,children:[be.grade,"/100"]})]}),e.jsx("div",{className:"bg-black/30 p-3 rounded border border-gray-800/50",children:e.jsxs("p",{className:"text-gray-300 text-sm italic whitespace-pre-wrap",children:['"',be.feedback,'"']})}),e.jsx("div",{className:"mt-3 text-right",children:e.jsx("span",{className:"text-xs text-blue-400 group-hover:text-blue-300 font-bold transition-colors",children:"View Alert Details →"})})]},be.id))})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-infosec-bg text-infosec-text",children:[e.jsx(QC,{user:t}),e.jsx(Qv,{currentView:ae,setView:fe,user:t,logout:r}),e.jsx("main",{children:ct()}),f&&e.jsx(Im,{onClose:()=>g(!1)}),e.jsx(Am,{user:t,token:ce}),v&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-4 text-left animate-fadeIn",children:e.jsxs("div",{className:"bg-[#1a1b1e] border border-gray-800 rounded-xl w-full max-w-4xl max-h-[85vh] overflow-hidden flex flex-col shadow-2xl",children:[e.jsxs("div",{className:"p-6 border-b border-gray-800 flex justify-between items-center bg-[#131416]",children:[e.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-400",children:"💬"})," All Mentor Feedback"]}),e.jsx("button",{onClick:()=>y(!1),className:"text-gray-400 hover:text-white transition-colors",children:"✕"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:R.map(be=>e.jsxs("div",{onClick:()=>{Ke(be.id),y(!1)},className:"bg-gray-950/50 border border-gray-800 rounded p-4 cursor-pointer hover:bg-gray-900 transition group",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 text-xs block mb-0.5",children:new Date(be.created_at||be.updated_at).toLocaleString()}),e.jsx("span",{className:"text-white font-bold text-sm",children:be.alert_title||"Alert Feedback"})]}),e.jsxs("span",{className:`text-lg font-bold ${be.grade>=70?"text-green-500":"text-yellow-500"}`,children:[be.grade,"/100"]})]}),e.jsx("div",{className:"bg-black/30 p-3 rounded border border-gray-800/50",children:e.jsxs("p",{className:"text-gray-300 text-sm italic whitespace-pre-wrap",children:['"',be.feedback,'"']})}),e.jsx("div",{className:"mt-3 text-right",children:e.jsx("span",{className:"text-xs text-blue-400 group-hover:text-blue-300 font-bold transition-colors",children:"View Alert Details →"})})]},be.id))})})]})})]})};export{hM as default};
