1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[27453],{27453:function(e,a,r){r.r(a),r.d(a,{default:function(){return E}});var t=r(57437),n=r(2265),s=r(24746),i=r(71837),o=r(5442),l=r(12381),d=r(79820),c=r(40279),u=r(75060),m=r(23675),f=r(74291),p=r(15291),g=r(33804),h=r(69174),x=r(22252),y=r(99397),v=r(15863),b=r(95805),j=r(45675),w=r(18930),N=r(14438);let P=[{value:"blue",label:"Blue",className:"bg-blue-500"},{value:"green",label:"Green",className:"bg-green-500"},{value:"orange",label:"Orange",className:"bg-orange-500"},{value:"purple",label:"Purple",className:"bg-purple-500"},{value:"teal",label:"Teal",className:"bg-teal-500"},{value:"red",label:"Red",className:"bg-red-500"}];function E(){let{canManageAgentGroups:e,enterpriseTier:a,loading:r}=(0,s.DO)(),[E,k]=(0,n.useState)([]),[C,A]=(0,n.useState)(!0),[_,T]=(0,n.useState)(null),[R,S]=(0,n.useState)(!1),[z,q]=(0,n.useState)({name:"",description:"",color:"blue"}),[I,Y]=(0,n.useState)(!1),[M,V]=(0,n.useState)(!1),[Z,D]=(0,n.useState)(null),[F,B]=(0,n.useState)({name:"",description:"",color:"blue"}),[G,U]=(0,n.useState)(!1),[L,O]=(0,n.useState)(null),W=async()=>{try{A(!0),T(null);let e=await i.api.get("/agent-groups");k(e.data)}catch(e){T((0,o._V)(e,"Failed to load agent groups")),console.error("Failed to fetch agent groups:",e)}finally{A(!1)}};(0,n.useEffect)(()=>{W()},[]);let H=async()=>{if(!z.name.trim()){N.A.error("Please enter a group name");return}try{Y(!0),await i.api.post("/agent-groups",z),N.A.success("Agent group created successfully"),S(!1),q({name:"",description:"",color:"blue"}),await W()}catch(e){N.A.error((0,o._V)(e,"Failed to create agent group"))}finally{Y(!1)}},$=e=>{D(e),B({name:e.name,description:e.description||"",color:e.color||"blue"}),V(!0)},K=async()=>{if(!Z||!F.name.trim()){N.A.error("Please enter a group name");return}U(!0);try{await i.api.put("/agent-groups/".concat(Z.id),F),N.A.success("Agent group updated successfully"),V(!1),D(null)}catch(e){console.error("Update agent group error:",e),N.A.error((0,o._V)(e,"Failed to update agent group")),U(!1);return}try{await W()}catch(e){console.error("Failed to refresh groups:",e)}finally{U(!1)}},Q=async e=>{if(e.is_default){N.A.error("Cannot delete default agent groups");return}if(confirm('Are you sure you want to delete "'.concat(e.name,'"?')))try{O(e.id),await i.api.delete("/agent-groups/".concat(e.id)),N.A.success("Agent group deleted successfully"),await W()}catch(e){N.A.error((0,o._V)(e,"Failed to delete agent group"))}finally{O(null)}},J=async()=>{try{let e=await i.api.post("/agent-groups/initialize-defaults");N.A.success(e.data.message),await W()}catch(e){N.A.error((0,o._V)(e,"Failed to initialize default groups"))}},X=e=>{var a;let r=(null===(a=P.find(a=>a.value===e))||void 0===a?void 0:a.className)||"bg-gray-500";return(0,t.jsx)("div",{className:"w-4 h-4 rounded-full ".concat(r)})};return r||e?(0,t.jsxs)("div",{className:"space-y-6 p-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Agent Groups"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"Organize your team members into groups for work assignment and reporting."})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[1===a&&0===E.length&&(0,t.jsx)(l.z,{variant:"outline",onClick:J,children:"Initialize Defaults"}),(0,t.jsxs)(f.Vq,{open:R,onOpenChange:S,children:[(0,t.jsx)(f.hg,{asChild:!0,children:(0,t.jsxs)(l.z,{children:[(0,t.jsx)(y.Z,{className:"h-4 w-4 mr-2"}),"Create Group"]})}),(0,t.jsxs)(f.cZ,{children:[(0,t.jsxs)(f.fK,{children:[(0,t.jsx)(f.$N,{children:"Create Agent Group"}),(0,t.jsx)(f.Be,{children:"Create a new group to organize your team members."})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u._,{htmlFor:"name",children:"Group Name"}),(0,t.jsx)(c.I,{id:"name",placeholder:"e.g., Sales Team",value:z.name,onChange:e=>q({...z,name:e.target.value})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u._,{htmlFor:"description",children:"Description"}),(0,t.jsx)(m.g,{id:"description",placeholder:"Describe the purpose of this group...",value:z.description,onChange:e=>q({...z,description:e.target.value})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u._,{htmlFor:"color",children:"Color"}),(0,t.jsxs)(p.Ph,{value:z.color,onValueChange:e=>q({...z,color:e}),children:[(0,t.jsx)(p.i4,{children:(0,t.jsx)(p.ki,{})}),(0,t.jsx)(p.Bw,{children:P.map(e=>(0,t.jsx)(p.Ql,{value:e.value,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-4 h-4 rounded-full ".concat(e.className)}),e.label]})},e.value))})]})]})]}),(0,t.jsxs)(f.cN,{children:[(0,t.jsx)(l.z,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),(0,t.jsxs)(l.z,{onClick:H,disabled:I,children:[I&&(0,t.jsx)(v.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Create"]})]})]})]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.Ol,{className:"pb-3",children:(0,t.jsx)(d.ll,{className:"text-base",children:"About Agent Groups"})}),(0,t.jsx)(d.aY,{className:"text-sm text-muted-foreground",children:(0,t.jsxs)("p",{children:["Agent groups help organize your team for work assignment and reporting purposes.",(0,t.jsx)("strong",{children:" Groups do not control permissions"})," - access is determined by enterprise roles (Super Admin, Admin, Manager, Agent)."]})})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsxs)(d.Ol,{children:[(0,t.jsx)(d.ll,{children:"All Groups"}),(0,t.jsxs)(d.SZ,{children:[E.length," group",1!==E.length?"s":""," configured"]})]}),(0,t.jsx)(d.aY,{children:C?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(v.Z,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):_?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 space-y-2",children:[(0,t.jsx)(x.Z,{className:"h-8 w-8 text-destructive"}),(0,t.jsx)("p",{className:"text-destructive",children:_}),(0,t.jsx)(l.z,{variant:"outline",size:"sm",onClick:W,children:"Try Again"})]}):0===E.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[(0,t.jsx)(b.Z,{className:"h-12 w-12 text-muted-foreground"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"No agent groups configured yet."}),1===a&&(0,t.jsx)(l.z,{variant:"outline",onClick:J,children:"Initialize Default Groups"})]}):(0,t.jsxs)(g.iA,{children:[(0,t.jsx)(g.xD,{children:(0,t.jsxs)(g.SC,{children:[(0,t.jsx)(g.ss,{children:"Color"}),(0,t.jsx)(g.ss,{children:"Name"}),(0,t.jsx)(g.ss,{children:"Description"}),(0,t.jsx)(g.ss,{className:"text-center",children:"Members"}),(0,t.jsx)(g.ss,{children:"Type"}),(0,t.jsx)(g.ss,{className:"text-right",children:"Actions"})]})}),(0,t.jsx)(g.RM,{children:E.map(e=>(0,t.jsxs)(g.SC,{children:[(0,t.jsx)(g.pj,{children:X(e.color)}),(0,t.jsx)(g.pj,{className:"font-medium",children:e.name}),(0,t.jsx)(g.pj,{className:"text-muted-foreground max-w-xs truncate",children:e.description||"-"}),(0,t.jsx)(g.pj,{className:"text-center",children:(0,t.jsx)(h.C,{variant:"secondary",children:e.member_count})}),(0,t.jsx)(g.pj,{children:e.is_default?(0,t.jsx)(h.C,{variant:"outline",children:"Default"}):(0,t.jsx)(h.C,{variant:"secondary",children:"Custom"})}),(0,t.jsx)(g.pj,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,t.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>$(e),children:(0,t.jsx)(j.Z,{className:"h-4 w-4"})}),(0,t.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>Q(e),disabled:e.is_default||L===e.id,children:L===e.id?(0,t.jsx)(v.Z,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(w.Z,{className:"h-4 w-4"})})]})})]},e.id))})]})})]}),(0,t.jsx)(f.Vq,{open:M,onOpenChange:V,children:(0,t.jsxs)(f.cZ,{children:[(0,t.jsxs)(f.fK,{children:[(0,t.jsx)(f.$N,{children:"Edit Agent Group"}),(0,t.jsx)(f.Be,{children:"Update the group details."})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u._,{htmlFor:"edit-name",children:"Group Name"}),(0,t.jsx)(c.I,{id:"edit-name",value:F.name,onChange:e=>B({...F,name:e.target.value})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u._,{htmlFor:"edit-description",children:"Description"}),(0,t.jsx)(m.g,{id:"edit-description",value:F.description,onChange:e=>B({...F,description:e.target.value})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(u._,{htmlFor:"edit-color",children:"Color"}),(0,t.jsxs)(p.Ph,{value:F.color,onValueChange:e=>B({...F,color:e}),children:[(0,t.jsx)(p.i4,{children:(0,t.jsx)(p.ki,{})}),(0,t.jsx)(p.Bw,{children:P.map(e=>(0,t.jsx)(p.Ql,{value:e.value,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-4 h-4 rounded-full ".concat(e.className)}),e.label]})},e.value))})]})]})]}),(0,t.jsxs)(f.cN,{children:[(0,t.jsx)(l.z,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),(0,t.jsxs)(l.z,{onClick:K,disabled:G,children:[G&&(0,t.jsx)(v.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Changes"]})]})]})})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:[(0,t.jsx)(x.Z,{className:"h-12 w-12 text-muted-foreground"}),(0,t.jsx)("h2",{className:"text-xl font-semibold",children:"Access Denied"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"You don't have permission to manage agent groups."}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Only Super Admin and Admin roles can access this page."})]})}},69174:function(e,a,r){r.d(a,{C:function(){return o}});var t=r(57437);r(2265);var n=r(90535),s=r(93448);let i=(0,n.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 o(e){let{className:a,variant:r,...n}=e;return(0,t.jsx)("div",{className:(0,s.cn)(i({variant:r}),a),...n})}},12381:function(e,a,r){r.d(a,{d:function(){return l},z:function(){return d}});var t=r(57437),n=r(2265),s=r(37053),i=r(90535),o=r(93448);let l=(0,i.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"}}),d=n.forwardRef((e,a)=>{let{className:r,variant:n,size:i,asChild:d=!1,...c}=e,u=d?s.g7:"button";return(0,t.jsx)(u,{className:(0,o.cn)(l({variant:n,size:i,className:r})),ref:a,...c})});d.displayName="Button"},79820:function(e,a,r){r.d(a,{Ol:function(){return o},SZ:function(){return d},Zb:function(){return i},aY:function(){return c},eW:function(){return u},ll:function(){return l}});var t=r(57437),n=r(2265),s=r(93448);let i=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{ref:a,className:(0,s.cn)("rounded-[4px] border bg-card text-card-foreground shadow",r),...n})});
1i.displayName="Card";let o=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{ref:a,className:(0,s.cn)("flex flex-col space-y-1.5 p-6",r),...n})});o.displayName="CardHeader";let l=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{ref:a,className:(0,s.cn)("font-display font-semibold leading-none tracking-tight",r),...n})});l.displayName="CardTitle";let d=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{ref:a,className:(0,s.cn)("text-sm text-muted-foreground",r),...n})});d.displayName="CardDescription";let c=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{ref:a,className:(0,s.cn)("p-6 pt-0",r),...n})});c.displayName="CardContent";let u=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{ref:a,className:(0,s.cn)("flex items-center p-6 pt-0",r),...n})});u.displayName="CardFooter"},74291:function(e,a,r){r.d(a,{$N:function(){return g},Be:function(){return h},Vq:function(){return l},cN:function(){return p},cZ:function(){return m},fK:function(){return f},hg:function(){return d}});var t=r(57437),n=r(2265),s=r(49027),i=r(93448),o=r(20653);let l=s.fC,d=s.xz,c=s.h_;s.x8;let u=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)(s.aV,{ref:a,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...n})});u.displayName=s.aV.displayName;let m=n.forwardRef((e,a)=>{let{className:r,children:n,overlayClassName:l,...d}=e;return(0,t.jsxs)(c,{children:[(0,t.jsx)(u,{className:l}),(0,t.jsxs)(s.VY,{ref:a,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200","w-[calc(100%-1rem)] xs:w-[calc(100%-2rem)] sm:w-full max-w-lg","p-4 sm:p-6","max-h-[90vh] sm:max-h-[85vh]","rounded-lg sm:rounded-lg","flex flex-col","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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",r),...d,children:[n,(0,t.jsxs)(s.x8,{className:"absolute right-3 top-3 sm:right-4 sm:top-4 z-50 rounded-full opacity-70 ring-offset-background transition-all hover:opacity-100 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground bg-white dark:bg-gray-900 shadow-md border border-gray-200 dark:border-gray-700 p-1.5",children:[(0,t.jsx)(o.Pxu,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=s.VY.displayName;let f=e=>{let{className:a,...r}=e;return(0,t.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left flex-shrink-0",a),...r})};f.displayName="DialogHeader";let p=e=>{let{className:a,...r}=e;return(0,t.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 flex-shrink-0 mt-4",a),...r})};p.displayName="DialogFooter";let g=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)(s.Dx,{ref:a,className:(0,i.cn)("font-display text-lg font-semibold leading-none tracking-tight",r),...n})});g.displayName=s.Dx.displayName;let h=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)(s.dk,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",r),...n})});h.displayName=s.dk.displayName},40279:function(e,a,r){r.d(a,{I:function(){return i}});var t=r(57437),n=r(2265),s=r(93448);let i=n.forwardRef((e,a)=>{let{className:r,type:n,error:i,...o}=e;return(0,t.jsx)("input",{type:n,"aria-invalid":i?"true":void 0,className:(0,s.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",i&&"border-red-500 focus-visible:ring-red-500",r),ref:a,...o})});i.displayName="Input"},75060:function(e,a,r){r.d(a,{_:function(){return d}});var t=r(57437),n=r(2265),s=r(6394),i=r(90535),o=r(93448);let l=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)(s.f,{ref:a,className:(0,o.cn)(l(),r),...n})});d.displayName=s.f.displayName},15291:function(e,a,r){r.d(a,{Bw:function(){return f},DI:function(){return c},Ph:function(){return d},Ql:function(){return g},i4:function(){return m},ki:function(){return u},n5:function(){return p}});var t=r(57437),n=r(2265),s=r(56873),i=r(40875),o=r(30401),l=r(93448);let d=s.fC,c=s.ZA,u=s.B4,m=n.forwardRef((e,a)=>{let{className:r,children:n,...o}=e;return(0,t.jsxs)(s.xz,{ref:a,className:(0,l.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",r),...o,children:[n,(0,t.jsx)(s.JO,{asChild:!0,children:(0,t.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=s.xz.displayName;let f=n.forwardRef((e,a)=>{let{className:r,children:n,position:i="popper",...o}=e;return(0,t.jsx)(s.h_,{children:(0,t.jsx)(s.VY,{ref:a,className:(0,l.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"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",r),position:i,...o,children:(0,t.jsx)(s.l_,{className:(0,l.cn)("p-1 max-h-[300px] overflow-y-auto","popper"===i&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:n})})})});f.displayName=s.VY.displayName;let p=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)(s.__,{ref:a,className:(0,l.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",r),...n})});p.displayName=s.__.displayName;let g=n.forwardRef((e,a)=>{let{className:r,children:n,...i}=e;return(0,t.jsxs)(s.ck,{ref:a,className:(0,l.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",r),...i,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(s.wU,{children:(0,t.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,t.jsx)(s.eT,{children:n})]})});g.displayName=s.ck.displayName,n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)(s.Z0,{ref:a,className:(0,l.cn)("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-700",r),...n})}).displayName=s.Z0.displayName},33804:function(e,a,r){r.d(a,{RM:function(){return l},SC:function(){return d},iA:function(){return i},pj:function(){return u},ss:function(){return c},xD:function(){return o}});var t=r(57437),n=r(2265),s=r(93448);let i=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{className:"relative w-full overflow-auto",children:(0,t.jsx)("table",{ref:a,className:(0,s.cn)("w-full caption-bottom text-sm",r),...n})})});i.displayName="Table";let o=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("thead",{ref:a,className:(0,s.cn)("[&_tr]:border-b",r),...n})});o.displayName="TableHeader";let l=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("tbody",{ref:a,className:(0,s.cn)("[&_tr:last-child]:border-0",r),...n})});l.displayName="TableBody",n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("tfoot",{ref:a,className:(0,s.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...n})}).displayName="TableFooter";let d=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("tr",{ref:a,className:(0,s.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...n})});d.displayName="TableRow";let c=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("th",{ref:a,className:(0,s.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...n})});c.displayName="TableHead";let u=n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("td",{ref:a,className:(0,s.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...n})});u.displayName="TableCell",n.forwardRef((e,a)=>{let{className:r,...n}=e;return(0,t.jsx)("caption",{ref:a,className:(0,s.cn)("mt-4 text-sm text-muted-foreground",r),...n})}).displayName="TableCaption"},23675:function(e,a,r){r.d(a,{g:function(){return i}});var t=r(57437),n=r(2265),s=r(93448);let i=n.forwardRef((e,a)=>{let{className:r,error:n,...i}=e;return(0,t.jsx)("textarea",{"aria-invalid":n?"true":void 0,className:(0,s.cn)("flex min-h-[80px] w-full rounded-[4px] border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n&&"border-red-500 focus-visible:ring-red-500",r),ref:a,...i})});i.displayName="Textarea"},24746:function(e,a,r){r.d(a,{DO:function(){return i}});var t=r(2265),n=r(71837);let s={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 i(){let[e,a]=(0,t.useState)({...s,loading:!1}),r=(0,t.useCallback)(async()=>{let e=localStorage.getItem("access_token");if(console.log("[useRolePermissions] Token found:",!!e),!e){console.log("[useRolePermissions] No token, using default permissions"),a(e=>({...e,loading:!1}));return}try{a(e=>({...e,loading:!0,error:null}));let e=(await n.api.get("/auth/me/dashboard-role")).data;console.log("[useRolePermissions] API response:",e);let t=e.permissions||[],s=e.enterprise_tier||4,i={dashboardRole:e.dashboard_role||"viewer",systemRole:e.system_role||"Customer",enterpriseRole:e.enterprise_role||"staff",enterpriseTier:s,agentGroups:e.agent_groups||[],permissions:t,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=>t.includes(e),hasAnyPermission:function(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++)a[r]=arguments[r];return a.some(e=>t.includes(e))},hasAllPermissions:function(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++)a[r]=arguments[r];return a.every(e=>t.includes(e))},hasMinimumTier:e=>s<=e,refresh:r};a(i)}catch(e){console.error("Failed to fetch role permissions:",e),a(a=>({...a,loading:!1,error:e.message||"Failed to fetch permissions"}))}},[]);return(0,t.useEffect)(()=>{r()},[r]),e}},5442:function(e,a,r){r.d(a,{Yo:function(){return i},_V:function(){return s}});let t={E1001:"Your session has expired. Please log in again.",E1002:"Invalid authentication. Please log in again.",E1003:"Please log in to continue.",E1004:"You do not have permission to perform this action.",E1005:"Your account has been suspended. Please contact support.",E1006:"Your session has expired. Please log in again.",E1007:"Two-factor authentication is required.",E1008:"Invalid password.",E2001:"Please check your input and try again.",E2002:"This field is required.",E2003:"Invalid value provided.",E2004:"Invalid format. Please check your input.",E2005:"This value already exists.",E2006:"Value length is invalid.",E3001:"The requested item was not found.",E3002:"This item already exists.",E3003:"This item has been deleted.",E3004:"This item is currently locked. Please try again later.",E3005:"A conflict occurred. This item may already exist.",E3006:"Workspace not found.",E3007:"Lead not found.",E3008:"Campaign not found.",E3009:"Contact not found.",E3010:"Template not found.",E4001:"You don't have enough credits for this action.",E4002:"Credit service is temporarily unavailable. Please try again.",E4003:"Credit limit exceeded.",E4004:"You've reached your plan limit. Please upgrade to continue.",E4005:"This feature is not available on your current plan.",E4006:"Your subscription has expired. Please renew to continue.",E4007:"Payment failed. Please try again or use a different payment method.",E4008:"Payment is required to continue.",E4009:"Your trial has expired. Please upgrade to continue.",E4010:"You've exceeded your quota.",E5001:"Unable to connect to external service. Please try again.",E5003:"Unable to connect to Meta. Please try again later.",E5004:"Rate limit reached. Please wait a moment and try again.",E5007:"WhatsApp service error. Please try again.",E5008:"Email service error. Please try again.",E5009:"SMS service error. Please try again.",E5010:"AI service error. Please try again.",E5013:"External service timed out. Please try again.",E5014:"External service is unavailable. Please try again later.",E6001:"Too many requests. Please wait a moment.",E6002:"Hourly limit reached. Please try again later.",E6003:"Daily limit reached. Please try again tomorrow.",E6004:"Too many requests. Please slow down.",E6005:"API rate limit reached.",E6006:"Too many concurrent requests.",E7001:"Database error occurred. Please try again.",E7002:"Sync conflict detected. Please refresh and try again.",E7003:"Sync failed. Please try again.",E7004:"Transaction failed. Please try again.",E7005:"Connection error. Please try again.",E8001:"Failed to create payment order. Please try again.",E8002:"Payment verification failed. Please contact support if you were charged.",E8003:"A similar payment was recently completed. Please wait before retrying.",E8004:"Another payment operation is in progress. Please wait.",E8005:"Payment order has expired. Please create a new order.",E8006:"Payment amount does not match the order.",E8007:"This payment has already been processed.",E8008:"Payment gateway error. Please try again.",E8009:"Payment signature verification failed.",E8010:"Payment order not found.",E8011:"Refund processing failed. Please contact support.",E8012:"Insufficient balance for this operation.",E8013:"A payment request is already being processed. Please wait.",E9001:"Something went wrong. Please try again later.",E9002:"Service temporarily unavailable. Please try again later.",E9003:"Configuration error. Please contact support.",E9004:"System is under maintenance. Please try again later.",E9999:"Network error. Please check your internet connection."},n={sqlalchemy:"Service temporarily unavailable. Please try again later.",database:"Service temporarily unavailable. Please try again later.",psycopg:"Service temporarily unavailable. Please try again later.",mysql:"Service temporarily unavailable. Please try again later.",mongodb:"Service temporarily unavailable. Please try again later.",redis:"Service temporarily unavailable. Please try again later.","connection refused":"Service temporarily unavailable. Please try again later.","connection error":"Unable to connect to server. Please check your internet connection.","connection reset":"Connection interrupted. Please try again.",timeout:"Request timed out. Please try again.","timed out":"Request timed out. Please try again.",unauthorized:"Your session has expired. Please log in again.","invali
1d credentials":"Invalid email or password. Please try again.","invalid token":"Your session has expired. Please log in again.","token expired":"Your session has expired. Please log in again.",forbidden:"You do not have permission to perform this action.","access denied":"You do not have permission to perform this action.","already exists":"This email is already registered. Please sign in or use a different email.","already registered":"This email is already registered. Please sign in or use a different email.","email already":"This email is already registered. Please sign in or use a different email.",duplicate_email:"This email is already registered. Please sign in or use a different email.",duplicate_username:"This email is already registered. Please sign in or use a different email.","email does not match":"The email does not match the invitation. Please use the invited email address.","invalid invitation":"This invitation link is invalid or has expired.","invitation has expired":"This invitation link has expired. Please request a new one.","invitation has already been used":"This invitation has already been used.","invitation has been cancelled":"This invitation has been cancelled.","whatsapp not connected":"WhatsApp is not connected. Please connect your WhatsApp Business account first.","whatsapp business account id not configured":"WhatsApp Business Account is not configured. Please set up WhatsApp in settings.","template not found":"Template not found. It may have been deleted.","failed to delete template":"Failed to delete template. Please try again.","meta api error":"WhatsApp API error. Please check your template format and try again.","whatsapp api error":"WhatsApp API error. Please try again later.","template name already exists":"A template with this name already exists. Please use a different name.","invalid template name":"Invalid template name. Use only lowercase letters, numbers, and underscores.","template body too long":"Template body is too long. Please shorten your message.","invalid parameter format":"Invalid parameter format. Use {{1}}, {{2}}, etc. for variables.","too many buttons":"Too many buttons. Maximum 3 buttons allowed.","invalid button type":"Invalid button type. Use URL, PHONE_NUMBER, or QUICK_REPLY.","missing required field":"Missing required field. Please fill in all required fields.","network error":"Unable to connect. Please check your internet connection.","fetch failed":"Unable to connect. Please check your internet connection.","failed to fetch":"Unable to connect. Please check your internet connection.",econnrefused:"Service temporarily unavailable. Please try again later.",enotfound:"Service temporarily unavailable. Please try again later.","socket hang up":"Connection interrupted. Please try again.","internal server error":"Something went wrong on our end. Please try again later.","server error":"Something went wrong on our end. Please try again later.","rate limit":"Too many requests. Please wait a moment and try again.","too many requests":"Too many requests. Please wait a moment and try again.","not found":"The requested resource was not found."};function s(e){var a,r;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Something went wrong. Please try again.",o=(null==e?void 0:null===(a=e.response)||void 0===a?void 0:a.data)||e;if(o&&!1===o.success&&o.error){let e=o.error;if(t[e])return t[e];if(o.message&&!/^E\d+$/.test(o.message)&&o.message.length>3){let e=o.message.replace(/\bE\d{4}\b/g,"").trim();if(e&&e.length>3)return e}}let l=i(e),d=l.toLowerCase();if(/^E\d+$/.test(l))return t[l]||s;let c=l.match(/^(E\d+)[:\s]*/);if(c){let e=c[1];if(t[e])return t[e];let a=l.replace(/^E\d+[:\s]*/,"").trim();if(a&&a.length>3&&!/^E\d+$/.test(a))return a}for(let[e,a]of Object.entries(n))if(d.includes(e.toLowerCase()))return a;let u=(null==e?void 0:null===(r=e.response)||void 0===r?void 0:r.status)||(null==e?void 0:e.status);if(u){if(401===u)return n.unauthorized;if(403===u)return n.forbidden;if(404===u)return n["not found"];if(429===u)return n["rate limit"];if(u>=500)return n["internal server error"]}return[/traceback/i,/exception/i,/error\s+at\s+line/i,/stack\s*trace/i,/file\s+"[^"]+",\s+line\s+\d+/i,/\w+Error:/,/\w+Exception:/,/at\s+\w+\.\w+\s*\(/,/sqlalchemy\./i,/psycopg2?\./i,/mysql\./i,/mongodb\./i,/redis\./i,/operationalerror/i,/programmingerror/i,/integrityerror/i].some(e=>e.test(l))||l.length>
1150?s:l.replace(/\bE\d{4}\b/g,"").trim()||s}function i(e){var a;return(null==e?void 0:e.detail)&&Array.isArray(e.detail)?e.detail.map(e=>"string"==typeof e?e:(null==e?void 0:e.msg)?e.msg:(null==e?void 0:e.message)?e.message:"Validation error").join(", "):"string"==typeof(null==e?void 0:e.detail)?e.detail:"string"==typeof(null==e?void 0:e.message)||e instanceof Error?e.message:"string"==typeof e?e:(null==e?void 0:null===(a=e.response)||void 0===a?void 0:a.data)?i(e.response.data):"An unexpected error occurred"}},93448:function(e,a,r){r.d(a,{cn:function(){return s}});var t=r(61994),n=r(53335);function s(){for(var e=arguments.length,a=Array(e),r=0;r<e;r++)a[r]=arguments[r];return(0,n.m6)((0,t.W)(a))}}}]);
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.