1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[70301],{39763:function(e,s,t){t.d(s,{Z:function(){return l}});var a=t(2265),r={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"};let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),l=(e,s)=>{let t=(0,a.forwardRef)((t,l)=>{let{color:i="currentColor",size:d=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:m="",children:x,...u}=t;return(0,a.createElement)("svg",{ref:l,...r,width:d,height:d,stroke:i,strokeWidth:o?24*Number(c)/Number(d):c,className:["lucide","lucide-".concat(n(e)),m].join(" "),...u},[...s.map(e=>{let[s,t]=e;return(0,a.createElement)(s,t)}),...Array.isArray(x)?x:[x]])});return t.displayName="".concat(e),t}},42488:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]])},33327:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]])},46221:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},66901:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},91723:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},95252:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("DollarSign",[["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"}]])},29202:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},15863:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},29090:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]])},47692:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},99897:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]])},13041:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]])},82431:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("RefreshCw",[["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"}]])},73247:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},33388:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]])},28553:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]])},58896:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]])},70525:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},95805:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},45131:function(e,s,t){t.d(s,{Z:function(){return a}});let a=(0,t(39763).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},99376:function(e,s,t){var a=t(35475);t.o(a,"useParams")&&t.d(s,{useParams:function(){return a.useParams}}),t.o(a,"usePathname")&&t.d(s,{usePathname:function(){return a.usePathname}}),t.o(a,"useRouter")&&t.d(s,{useRouter:function(){return a.useRouter}}),t.o(a,"useSearchParams")&&t.d(s,{useSearchParams:function(){return a.useSearchParams}})},88495:function(e,s,t){t.r(s),t.d(s,{default:function(){return Q}});var a=t(57437),r=t(2265),n=t(79820),l=t(12381),i=t(69174),d=t(17168),c=t(40279),o=t(15291),m=t(66901);let x=(0,t(39763).Z)("Coffee",[["path",{d:"M17 8h1a4 4 0 1 1 0 8h-1",key:"jx4kbh"}],["path",{d:"M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4Z",key:"1bxrl0"}],["line",{x1:"6",x2:"6",y1:"2",y2:"4",key:"1cr9l3"}],["line",{x1:"10",x2:"10",y1:"2",y2:"4",key:"170wym"}],["line",{x1:"14",x2:"14",y1:"2",y2:"4",key:"1c5f70"}]]);var u=t(13041),h=t(45131),f=t(29090),g=t(47692),p=t(42488),y=t(91723),v=t(99897),j=t(33388),b=t(28553),N=t(15863),w=t(95805),k=t(82431),Z=t(46221),_=t(73247),C=t(29202),M=t(33327),L=t(58896),T=t(70525),S=t(95252),R=t(69064),A=t(71837),P=t(84881
1),z=t(24746);let O={online:{color:"bg-green-500",textColor:"text-green-700",bgColor:"bg-green-100",label:"Online",icon:m.Z},away:{color:"bg-yellow-500",textColor:"text-yellow-700",bgColor:"bg-yellow-100",label:"Away",icon:x},busy:{color:"bg-red-500",textColor:"text-red-700",bgColor:"bg-red-100",label:"Busy",icon:u.Z},offline:{color:"bg-gray-400",textColor:"text-gray-700",bgColor:"bg-gray-100",label:"Offline",icon:h.Z}},V={login:{icon:f.Z,color:"text-green-600",label:"Logged In"},logout:{icon:g.Z,color:"text-red-600",label:"Logged Out"},status_change:{icon:p.Z,color:"text-blue-600",label:"Status Changed"},heartbeat:{icon:p.Z,color:"text-gray-400",label:"Heartbeat"},session_timeout:{icon:y.Z,color:"text-orange-600",label:"Session Timeout"}},Y={web:v.Z,mobile:j.Z,tablet:b.Z,desktop:v.Z};function Q(){let{user:e}=(0,P.a)(),{isAdmin:s,isManager:t,dashboardRole:f}=(0,z.DO)(),g=null==e?void 0:e.workspace_id,[j,b]=(0,r.useState)("live-status"),[Q,B]=(0,r.useState)([]),[I,q]=(0,r.useState)([]),[D,E]=(0,r.useState)([]),[F,H]=(0,r.useState)(null),[U,G]=(0,r.useState)(!0),[W,$]=(0,r.useState)(!1),[J,X]=(0,r.useState)(""),[K,ee]=(0,r.useState)("all"),[es,et]=(0,r.useState)("all"),[ea,er]=(0,r.useState)("7"),en={online:Q.filter(e=>"online"===e.status).length,away:Q.filter(e=>"away"===e.status).length,busy:Q.filter(e=>"busy"===e.status).length,offline:Q.filter(e=>"offline"===e.status).length},el=(0,r.useCallback)(async()=>{try{var e;let s=await A.api.get("/agent-status/team",{params:{workspace_id:g}});(null===(e=s.data)||void 0===e?void 0:e.agents)&&B(s.data.agents)}catch(e){console.error("Failed to fetch team status:",e)}},[g]),ei=(0,r.useCallback)(async()=>{try{var e;let s=await A.api.get("/agent-status/activity-logs",{params:{workspace_id:g,days:parseInt(ea),event_type:"all"!==es?es:void 0,limit:100}});(null===(e=s.data)||void 0===e?void 0:e.logs)&&q(s.data.logs)}catch(e){console.error("Failed to fetch activity logs:",e)}},[g,ea,es]),ed=(0,r.useCallback)(async()=>{try{let e=await A.api.get("/agent-status/stats/summary",{params:{workspace_id:g,days:parseInt(ea)}});e.data&&H(e.data)}catch(e){console.error("Failed to fetch team stats:",e)}},[g,ea]),ec=(0,r.useCallback)(async()=>{try{var e;let s=await A.api.get("/agent-status/performance/leaderboard",{params:{workspace_id:g,days:parseInt(ea),limit:20}});(null===(e=s.data)||void 0===e?void 0:e.leaderboard)&&E(s.data.leaderboard)}catch(e){console.error("Failed to fetch performance:",e)}},[g,ea]);(0,r.useEffect)(()=>{(async()=>{G(!0),await Promise.all([el(),ei(),ed(),ec()]),G(!1)})()},[el,ei,ed,ec]),(0,r.useEffect)(()=>{let e=setInterval(()=>{el()},3e4);return()=>clearInterval(e)},[el]);let eo=async()=>{$(!0),await Promise.all([el(),ei(),ed(),ec()]),$(!1),R.default.success("Data refreshed")},em=e=>{if(!e)return"0m";let s=Math.floor(e/3600),t=Math.floor(e%3600/60);return s>0?"".concat(s,"h ").concat(t,"m"):"".concat(t,"m")},ex=e=>{if(!e)return"Never";let s=new Date(e),t=Math.floor((new Date().getTime()-s.getTime())/6e4),a=Math.floor(t/60);return t<1?"Just now":t<60?"".concat(t,"m ago"):a<24?"".concat(a,"h ago"):"".concat(Math.floor(a/24),"d ago")},eu=Q.filter(e=>{var s,t;let a=!J||(null===(s=e.full_name)||void 0===s?void 0:s.toLowerCase().includes(J.toLowerCase()))||(null===(t=e.email)||void 0===t?void 0:t.toLowerCase().includes(J.toLowerCase())),r="all"===K||e.status===K;return a&&r}),eh=I.filter(e=>{var s;return!J||(null===(s=e.user_name)||void 0===s?void 0:s.toLowerCase().includes(J.toLowerCase()))});return U?(0,a.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,a.jsx)(N.Z,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,a.jsxs)("div",{className:"p-3 sm:p-4 md:p-6 space-y-4 sm:space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 sm:gap-4",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold flex items-center gap-2",children:[(0,a.jsx)(w.Z,{className:"h-6 w-6 sm:h-7 sm:w-7 md:h-8 md:w-8 text-blue-600 flex-shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:"Team Online"})]}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:"Real-time tracking of your sales team's activity and performance"})]}),(0,a.jsxs)(l.z,{onClick:eo,disabled:W,children:[(0,a.jsx)(k.Z,{className:"h-4 w-4 mr-2 ".concat(W?"animate-spin":"")}),"Refresh"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-3 md:gap-4",children:[(0,a.jsx)(n.Zb,{className:"border-green-200 bg-gradient-to-br from-green-50 to-green-100 dark:from-green-900/20 dark:to-green-800/20",children:(0,a.jsx)(n.aY,{className:"pt-3 sm:pt-4 md:pt-6",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-green-700 dark:text-green-300",children:en.online}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:"Online"})]}),(0,a.jsx)("div",{className:"h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 bg-green-200 dark:bg-green-800 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(m.Z,{className:"h-4 w-4 sm:h-5 sm:w-5 md:h-6 md:w-6 text-green-600 dark:text-green-400"})})]})})}),(0,a.jsx)(n.Zb,{className:"border-yellow-200 bg-gradient-to-br from-yellow-50 to-yellow-100 dark:from-yellow-900/20 dark:to-yellow-800/20",children:(0,a.jsx)(n.aY,{className:"pt-3 sm:pt-4 md:pt-6",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-yellow-700 dark:text-yellow-300",children:en.away}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-yellow-600 dark:text-yellow-400",children:"Away"})]}),(0,a.jsx)("div",{className:"h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 bg-yellow-200 dark:bg-yellow-800 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(x,{className:"h-4 w-4 sm:h-5 sm:w-5 md:h-6 md:w-6 text-yellow-600 dark:text-yellow-400"})})]})})}),(0,a.jsx)(n.Zb,{className:"border-red-200 bg-gradient-to-br from-red-50 to-red-100 dark:from-red-900/20 dark:to-red-800/20",children:(0,a.jsx)(n.aY,{className:"pt-3 sm:pt-4 md:pt-6",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-red-700 dark:text-red-300",children:en.busy}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-red-600 dark:text-red-400",children:"Busy"})]}),(0,a.jsx)("div",{className:"h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 bg-red-200 dark:bg-red-800 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(u.Z,{className:"h-4 w-4 sm:h-5 sm:w-5 md:h-6 md:w-6 text-red-600 dark:text-red-400"})})]})})}),(0,a.jsx)(n.Zb,{className:"border-gray-200 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900/20 dark:to-gray-800/20",children:(0,a.jsx)(n.aY,{className:"pt-3 sm:pt-4 md:pt-6",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl md:text-3xl font-bold text-gray-700 dark:text-gray-300",children:en.offline}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:"Offline"})]}),(0,a.jsx)("div",{className:"h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 bg-gray-200 dark:bg-gray-800 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(h.Z,{className:"h-4 w-4 sm:h-5 sm:w-5 md:h-6 md:w-6 text-gray-600 dark:text-gray-400"})})]})})})]}),(0,a.jsxs)(d.Tabs,{value:j,onValueChange:b,className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[(0,a.jsxs)(d.TabsList,{children:[(0,a.jsxs)(d.TabsTrigger,{value:"live-status",className:"gap-2",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4"}),"Live Status"]}),(0,a.jsxs)(d.TabsTrigger,{value:"activity-log",className:"gap-2",children:[(0,a.jsx)(y.Z,{className:"h-4 w-4"}
1),"Activity Log"]}),(0,a.jsxs)(d.TabsTrigger,{value:"performance",className:"gap-2",children:[(0,a.jsx)(Z.Z,{className:"h-4 w-4"}),"Performance"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(_.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,a.jsx)(c.I,{placeholder:"Search agents...",value:J,onChange:e=>X(e.target.value),className:"pl-9 w-[200px]"})]}),"live-status"===j&&(0,a.jsxs)(o.Ph,{value:K,onValueChange:ee,children:[(0,a.jsx)(o.i4,{className:"w-[130px]",children:(0,a.jsx)(o.ki,{placeholder:"Status"})}),(0,a.jsxs)(o.Bw,{children:[(0,a.jsx)(o.Ql,{value:"all",children:"All Status"}),(0,a.jsx)(o.Ql,{value:"online",children:"Online"}),(0,a.jsx)(o.Ql,{value:"away",children:"Away"}),(0,a.jsx)(o.Ql,{value:"busy",children:"Busy"}),(0,a.jsx)(o.Ql,{value:"offline",children:"Offline"})]})]}),("activity-log"===j||"performance"===j)&&(0,a.jsxs)(o.Ph,{value:ea,onValueChange:er,children:[(0,a.jsx)(o.i4,{className:"w-[130px]",children:(0,a.jsx)(o.ki,{placeholder:"Date Range"})}),(0,a.jsxs)(o.Bw,{children:[(0,a.jsx)(o.Ql,{value:"1",children:"Today"}),(0,a.jsx)(o.Ql,{value:"7",children:"Last 7 days"}),(0,a.jsx)(o.Ql,{value:"14",children:"Last 14 days"}),(0,a.jsx)(o.Ql,{value:"30",children:"Last 30 days"})]})]})]})]}),(0,a.jsxs)(d.TabsContent,{value:"live-status",className:"space-y-4",children:[(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{children:[(0,a.jsxs)(n.ll,{className:"flex items-center gap-2",children:[(0,a.jsx)(p.Z,{className:"h-5 w-5 text-blue-600"}),"Team Members (",eu.length,")"]}),(0,a.jsx)(n.SZ,{children:"Real-time status of your sales team"})]}),(0,a.jsx)(n.aY,{children:0===eu.length?(0,a.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,a.jsx)(w.Z,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,a.jsx)("p",{children:"No team members found"})]}):(0,a.jsx)("div",{className:"space-y-3",children:eu.map(e=>{var s,t;let r=O[e.status],n=r.icon,l=Y[e.current_device_type||"web"]||v.Z;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border ".concat(r.bgColor," transition-all hover:shadow-md"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"h-12 w-12 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full flex items-center justify-center text-white font-bold",children:(null===(s=e.full_name)||void 0===s?void 0:s.charAt(0))||(null===(t=e.email)||void 0===t?void 0:t.charAt(0))||"?"}),(0,a.jsx)("div",{className:"absolute -bottom-1 -right-1 h-4 w-4 ".concat(r.color," rounded-full border-2 border-white")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium",children:e.full_name||e.email}),(0,a.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,a.jsxs)(i.C,{variant:"outline",className:"".concat(r.textColor," ").concat(r.bgColor),children:[(0,a.jsx)(n,{className:"h-3 w-3 mr-1"}),r.label]}),e.status_message&&(0,a.jsxs)("span",{className:"italic",children:['"',e.status_message,'"']})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:"Last Active"}),(0,a.jsx)("div",{className:"font-medium",children:ex(e.last_activity)})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:"Online Today"}),(0,a.jsx)("div",{className:"font-medium",children:em(e.total_online_seconds_today||0)})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:"Logins"}),(0,a.jsx)("div",{className:"font-medium",children:e.login_count_today||0})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 text-muted-foreground",children:[(0,a.jsx)(l,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"capitalize",children:e.current_device_type||"web"})]})]})]},e.user_id)})})})]}),F&&(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{children:(0,a.jsx)(n.ll,{className:"text-sm font-medium",children:"Period Statistics"})}),(0,a.jsx)(n.aY,{children:(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:F.total_logins}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total Logins"})]}),(0,a.jsxs)("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:F.unique_users}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Unique Users"})]}),(0,a.jsxs)("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:em(F.avg_session_duration_seconds)}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Avg Session"})]}),(0,a.jsxs)("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:F.total_status_changes}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Status Changes"})]})]})})]})]}),(0,a.jsx)(d.TabsContent,{value:"activity-log",className:"space-y-4",children:(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)(n.Ol,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(n.ll,{className:"flex items-center gap-2",children:[(0,a.jsx)(y.Z,{className:"h-5 w-5 text-blue-600"}
1),"Activity Log"]}),(0,a.jsx)(n.SZ,{children:"Login, logout, and status change history"})]}),(0,a.jsxs)(o.Ph,{value:es,onValueChange:et,children:[(0,a.jsx)(o.i4,{className:"w-[150px]",children:(0,a.jsx)(o.ki,{placeholder:"Event Type"})}),(0,a.jsxs)(o.Bw,{children:[(0,a.jsx)(o.Ql,{value:"all",children:"All Events"}),(0,a.jsx)(o.Ql,{value:"login",children:"Logins"}),(0,a.jsx)(o.Ql,{value:"logout",children:"Logouts"}),(0,a.jsx)(o.Ql,{value:"status_change",children:"Status Changes"})]})]})]})}),(0,a.jsx)(n.aY,{children:0===eh.length?(0,a.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,a.jsx)(y.Z,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,a.jsx)("p",{children:"No activity logs found"})]}):(0,a.jsx)("div",{className:"space-y-2",children:eh.map(e=>{let s=V[e.event_type]||V.login,t=s.icon,r=Y[e.device_type||"web"]||v.Z;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted/50 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center ".concat(s.color),children:(0,a.jsx)(t,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium",children:e.user_name||"Unknown User"}),(0,a.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,a.jsx)("span",{children:s.label}),e.session_duration_seconds&&(0,a.jsxs)(i.C,{variant:"outline",className:"text-xs",children:["Session: ",em(e.session_duration_seconds)]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(r,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:e.browser||e.device_type||"Unknown"})]}),e.ip_address&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(C.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:e.ip_address})]}),(0,a.jsx)("div",{children:new Date(e.created_at).toLocaleString()})]})]},e.id)})})})]})}),(0,a.jsxs)(d.TabsContent,{value:"performance",className:"space-y-4",children:[(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)(n.Ol,{children:[(0,a.jsxs)(n.ll,{className:"flex items-center gap-2",children:[(0,a.jsx)(M.Z,{className:"h-5 w-5 text-yellow-600"}),"Performance Leaderboard"]}),(0,a.jsx)(n.SZ,{children:"Agent rankings based on leads, calls, and conversions"})]}),(0,a.jsx)(n.aY,{children:0===D.length?(0,a.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,a.jsx)(Z.Z,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,a.jsx)("p",{children:"No performance data available"})]}):(0,a.jsx)("div",{className:"space-y-3",children:D.map((e,s)=>{var t;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border transition-all hover:shadow-md ".concat(0===s?"bg-yellow-50 border-yellow-200 dark:bg-yellow-900/20":1===s?"bg-gray-50 border-gray-200 dark:bg-gray-900/20":2===s?"bg-orange-50 border-orange-200 dark:bg-orange-900/20":"bg-muted/30"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"h-10 w-10 rounded-full flex items-center justify-center font-bold text-lg ".concat(0===s?"bg-yellow-200 text-yellow-800":1===s?"bg-gray-200 text-gray-800":2===s?"bg-orange-200 text-orange-800":"bg-muted text-muted-foreground"),children:s+1}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium",children:e.user_name}),(0,a.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Quality Score: ",(null===(t=e.quality_score)||void 0===t?void 0:t.toFixed(1))||"N/A"]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-6",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(L.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)("span",{className:"font-bold",children:e.leads_converted||0})]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Conversions"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 text-green-600"}),(0,a.jsx)("span",{className:"font-bold",children:e.calls_connected||0})]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Calls"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(m.Z,{className:"h-4 w-4 text-purple-600"}),(0,a.jsx)("span",{className:"font-bold",children:e.tasks_completed||0})]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Tasks"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(T.Z,{className:"h-4 w-4 text-emerald-600"}),(0,a.jsxs)("span",{className:"font-bold",children:[(100*e.conversion_rate).toFixed(1),"%"]})]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Conv. Rate"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(y.Z,{className:"h-4 w-4 text-orange-600"}),(0,a.jsx)("span",{className:"font-bold",children:em(e.online_duration_seconds||0)})]}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Online"})]})]})]},e.user_id)})})})]}),D.length>0&&(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,a.jsx)(n.Zb,{children:(0,a.jsx)(n.aY,{className:"pt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(L.Z,{className:"h-5 w-5 text-blue-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:D.reduce((e,s)=>e+(s.leads_converted||0),0)}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total Conversions"})]})]})})}),(0,a.jsx)(n.Zb,{children:(0,a.jsx)(n.aY,{className:"pt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"h-5 w-5 text-green-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:D.reduce((e,s)=>e+(s.calls_made||0),0)}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Total Calls"})]})]})})}),(0,a.jsx)(n.Zb,{children:(0,a.jsx)(n.aY,{className:"pt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.Z,{className:"h-5 w-5 text-purple-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-2xl font-bold",children:D.reduce((e,s)=>e+(s.tasks_completed||0),0)}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Tasks Completed"})]})]})})}),(0,a.jsx)(n.Zb,{children:(0,a.jsx)(n.aY,{className:"pt-6",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(S.Z,{className:"h-5 w-5 text-emerald-600"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-2xl font-bold",children:["$",D.reduce((e,s)=>
1e+(s.revenue_generated||0),0).toLocaleString()]}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"Revenue Generated"})]})]})})})]})]})]})]})}},69174:function(e,s,t){t.d(s,{C:function(){return i}});var a=t(57437);t(2265);var r=t(90535),n=t(93448);let l=(0,r.j)("inline-flex items-center rounded-[4px] border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i(e){let{className:s,variant:t,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)(l({variant:t}),s),...r})}},12381:function(e,s,t){t.d(s,{d:function(){return d},z:function(){return c}});var a=t(57437),r=t(2265),n=t(37053),l=t(90535),i=t(93448);let d=(0,l.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[4px] text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-[4px] px-3 text-xs",lg:"h-10 rounded-[4px] px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),c=r.forwardRef((e,s)=>{let{className:t,variant:r,size:l,asChild:c=!1,...o}=e,m=c?n.g7:"button";return(0,a.jsx)(m,{className:(0,i.cn)(d({variant:r,size:l,className:t})),ref:s,...o})});c.displayName="Button"},79820:function(e,s,t){t.d(s,{Ol:function(){return i},SZ:function(){return c},Zb:function(){return l},aY:function(){return o},eW:function(){return m},ll:function(){return d}});var a=t(57437),r=t(2265),n=t(93448);let l=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("rounded-[4px] border bg-card text-card-foreground shadow",t),...r})});l.displayName="Card";let i=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",t),...r})});i.displayName="CardHeader";let d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("font-display font-semibold leading-none tracking-tight",t),...r})});d.displayName="CardTitle";let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("text-sm text-muted-foreground",t),...r})});c.displayName="CardDescription";let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("p-6 pt-0",t),...r})});o.displayName="CardContent";let m=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("flex items-center p-6 pt-0",t),...r})});m.displayName="CardFooter"},40279:function(e,s,t){t.d(s,{I:function(){return l}});var a=t(57437),r=t(2265),n=t(93448);let l=r.forwardRef((e,s)=>{let{className:t,type:r,error:l,...i}=e;return(0,a.jsx)("input",{type:r,"aria-invalid":l?"true":void 0,className:(0,n.cn)("flex h-9 w-full rounded-[4px] border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l&&"border-red-500 focus-visible:ring-red-500",t),ref:s,...i})});l.displayName="Input"},15291:function(e,s,t){t.d(s,{Bw:function(){return u},DI:function(){return o},Ph:function(){return c},Ql:function(){return f},i4:function(){return x},ki:function(){return m},n5:function(){return h}});var a=t(57437),r=t(2265),n=t(56873),l=t(40875),i=t(30401),d=t(93448);let c=n.fC,o=n.ZA,m=n.B4,x=r.forwardRef((e,s)=>{let{className:t,children:r,...i}=e;return(0,a.jsxs)(n.xz,{ref:s,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 dark:text-gray-100 px-3 py-2 text-sm r
1ing-offset-white dark:ring-offset-gray-950 placeholder:text-gray-500 dark:placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-950 dark:focus:ring-gray-300 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...i,children:[r,(0,a.jsx)(n.JO,{asChild:!0,children:(0,a.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});x.displayName=n.xz.displayName;let u=r.forwardRef((e,s)=>{let{className:t,children:r,position:l="popper",...i}=e;return(0,a.jsx)(n.h_,{children:(0,a.jsx)(n.VY,{ref:s,className:(0,d.cn)("relative z-50 min-w-[8rem] overflow-hidden rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-950 dark:text-gray-100 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...i,children:(0,a.jsx)(n.l_,{className:(0,d.cn)("p-1 max-h-[300px] overflow-y-auto","popper"===l&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});u.displayName=n.VY.displayName;let h=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(n.__,{ref:s,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r})});h.displayName=n.__.displayName;let f=r.forwardRef((e,s)=>{let{className:t,children:r,...l}=e;return(0,a.jsxs)(n.ck,{ref:s,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 dark:focus:bg-gray-700 focus:text-gray-900 dark:focus:text-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...l,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.wU,{children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(n.eT,{children:r})]})});f.displayName=n.ck.displayName,r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(n.Z0,{ref:s,className:(0,d.cn)("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-700",t),...r})}).displayName=n.Z0.displayName},17168:function(e,s,t){t.d(s,{Tabs:function(){return i},TabsContent:function(){return o},TabsList:function(){return d},TabsTrigger:function(){return c}});var a=t(57437),r=t(2265),n=t(20271),l=t(93448);let i=n.fC,d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(n.aV,{ref:s,className:(0,l.cn)("inline-flex h-10 items-center justify-center rounded-[4px] bg-gray-100 dark:bg-gray-800 p-1 text-gray-500 dark:text-gray-400",t),...r})});d.displayName=n.aV.displayName;let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(n.xz,{ref:s,className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white dark:ring-offset-gray-950 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 dark:focus-visible:ring-gray-300 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white dark:data-[state=active]:bg-gray-900 data-[state=active]:text-gray-950 dark:data-[state=active]:text-gray-100 data-[state=active]:shadow-sm",t),...r})});c.displayName=n.xz.displayName;let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(n.VY,{ref:s,className:(0,l.cn)("mt-2 ring-offset-white dark:ring-offset-gray-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 dark:focus-visible:ring-gray-300 focus-visible:ring-offset-2",t),...r})});o.displayName=n.VY.displayName},24746:function(e,s,t){t.d(s,{DO:function(){return l}});var a=t(2265),r=t(71837);let n={dashboardRole:"viewer",systemRole:"Customer",enterpriseRole:"staff",enterpriseTier:4,agentGroups:[],permissions:[],dashboardPermissions:[],canAssignLeads:!1,canMoveLeads:!1,canConvertLeads:!1,canDeleteLeads:!1,canManageTeam:!1,canViewReports:!1,canManageCampaigns:!1,canManageBilling:!1,canManageAgentGroups:!1,isAdmin:!1,isManager:!1,isSuperAdmin:!1,loading:!0,error:null,hasPermission:()=>!1,hasAnyPermission:()=>!1,hasAllPermissions:()=>!1,hasMinimumTier:()=>!1,refresh:async()=>{}};function l(){let[e,s]=(0,a.useState)({...n,loading:!1}),t=(0,a.useCallback)(async()=>{let e=localStorage.getItem("access_token");if(console.log("[useRolePermissions] Token found:",!!e),!e){console.log("[useRolePermissions] No token, using default permissions"),s(e=>({...e,loading:!1}));return}try{s(e=>({...e,loading:!0,error:null}));let e=(await r.api.get("/auth/me/dashboard-role")).data;console.log("[useRolePermissions] API response:",e);let a=e.permissions||[],n=e.enterprise_tier||4,l={dashboardRole:e.dashboard_role||"viewer",systemRole:e.system_role||"Customer",enterpriseRole:e.enterprise_role||"staff",enterpriseTier:n,agentGroups:e.agent_groups||[],permissions:a,dashboardPermissions:e.dashboard_permissions||[],canAssignLeads:e.can_assign_leads||!1,canMoveLeads:e.can_move_leads||!1,canConvertLeads:e.can_convert_leads||!1,canDeleteLeads:e.can_delete_leads||!1,canManageTeam:e.can_manage_team||!1,canViewReports:e.can_view_reports||!1,canManageCampaigns:e.can_manage_campaigns||!1,canManageBilling:e.can_manage_billing||!1,canManageAgentGroups:e.can_manage_agent_groups||!1,isAdmin:e.is_admin||!1,isManager:e.is_manager||!1,isSuperAdmin:e.is_super_admin||!1,loading:!1,error:null,hasPermission:e=>a.includes(e),hasAnyPermission:function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return s.some(e=>a.includes(e))},hasAllPermissions:function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return s.every(e=>a.includes(e))},hasMinimumTier:e=>n<=e,refresh:t};s(l)}catch(e){console.error("Failed to fetch role permissions:",e),s(s=>({...s,loading:!1,error:e.message||"Failed to fetch permissions"}))}},[]);return(0,a.useEffect)(()=>{t()},[t]),e}},93448:function(e,s,t){t.d(s,{cn:function(){return n}});var a=t(61994),r=t(53335);function n(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return(0,r.m6)((0,a.W)(s))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.