@exulu/frontend 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +138 -139
  3. package/dist/.next/app-path-routes-manifest.json +1 -1
  4. package/dist/.next/build-manifest.json +2 -2
  5. package/dist/.next/prerender-manifest.json +1 -1
  6. package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
  7. package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
  8. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +2 -2
  9. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
  10. package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
  11. package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
  12. package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
  13. package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
  14. package/dist/.next/server/app/(application)/data/[[...query]]/page.js +3 -3
  15. package/dist/.next/server/app/(application)/data/[[...query]]/page.js.nft.json +1 -1
  16. package/dist/.next/server/app/(application)/data/[[...query]]/page_client-reference-manifest.js +1 -1
  17. package/dist/.next/server/app/(application)/evals/[id]/page.js +1 -1
  18. package/dist/.next/server/app/(application)/evals/[id]/page.js.nft.json +1 -1
  19. package/dist/.next/server/app/(application)/evals/[id]/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/(application)/evals/cases/page_client-reference-manifest.js +1 -1
  21. package/dist/.next/server/app/(application)/evals/page_client-reference-manifest.js +1 -1
  22. package/dist/.next/server/app/(application)/explorer/page_client-reference-manifest.js +1 -1
  23. package/dist/.next/server/app/(application)/keys/page_client-reference-manifest.js +1 -1
  24. package/dist/.next/server/app/(application)/page_client-reference-manifest.js +1 -1
  25. package/dist/.next/server/app/(application)/projects/[project]/page_client-reference-manifest.js +1 -1
  26. package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
  27. package/dist/.next/server/app/(application)/prompts/page_client-reference-manifest.js +1 -1
  28. package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
  29. package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
  30. package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
  31. package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
  32. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
  33. package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
  34. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
  35. package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
  36. package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
  37. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  38. package/dist/.next/server/app/_not-found.html +1 -1
  39. package/dist/.next/server/app/_not-found.rsc +1 -1
  40. package/dist/.next/server/app/api/auth/[...nextauth]/route.js +2 -2
  41. package/dist/.next/server/app-paths-manifest.json +7 -7
  42. package/dist/.next/server/chunks/1051.js +2 -2
  43. package/dist/.next/server/chunks/2270.js +6 -0
  44. package/dist/.next/server/chunks/2948.js +1 -1
  45. package/dist/.next/server/chunks/3434.js +1 -1
  46. package/dist/.next/server/chunks/3575.js +1 -1
  47. package/dist/.next/server/chunks/5485.js +1 -0
  48. package/dist/.next/server/chunks/7471.js +1 -1
  49. package/dist/.next/server/chunks/7958.js +1 -1
  50. package/dist/.next/server/chunks/8050.js +1 -1
  51. package/dist/.next/server/chunks/8286.js +1 -1
  52. package/dist/.next/server/middleware-manifest.json +5 -5
  53. package/dist/.next/server/pages/404.html +1 -1
  54. package/dist/.next/server/pages/500.html +1 -1
  55. package/dist/.next/server/server-reference-manifest.json +1 -1
  56. package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js +2 -0
  57. package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js.map +1 -0
  58. package/dist/.next/static/chunks/1957-39a01a3915f246ab.js +2 -0
  59. package/dist/.next/static/chunks/1957-39a01a3915f246ab.js.map +1 -0
  60. package/dist/.next/static/chunks/{3750-90a213a3c7cceb29.js → 3750-f45c59ef1cc79417.js} +2 -2
  61. package/dist/.next/static/chunks/3750-f45c59ef1cc79417.js.map +1 -0
  62. package/dist/.next/static/chunks/{7856-9fa733bdd6429ba8.js → 6066-65606593516b2a3a.js} +18 -18
  63. package/dist/.next/static/chunks/6066-65606593516b2a3a.js.map +1 -0
  64. package/dist/.next/static/chunks/{6373-1e2ef7e1f5217052.js → 6373-4c5dffaf4193621c.js} +2 -2
  65. package/dist/.next/static/chunks/6373-4c5dffaf4193621c.js.map +1 -0
  66. package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js +2 -0
  67. package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js.map +1 -0
  68. package/dist/.next/static/chunks/{9953-abcb3d5ff5512285.js → 9953-dfb5fc0e5b74ec09.js} +2 -2
  69. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js.map +1 -0
  70. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/{page-29794b9c33d2bf7e.js → page-4e7e02768ed1a72a.js} +2 -2
  71. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-4e7e02768ed1a72a.js.map +1 -0
  72. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js +2 -0
  73. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js.map +1 -0
  74. package/dist/.next/static/chunks/app/(application)/chat/layout-093baa26f89338bc.js +2 -0
  75. package/dist/.next/static/chunks/app/(application)/chat/layout-093baa26f89338bc.js.map +1 -0
  76. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js +2 -0
  77. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js.map +1 -0
  78. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js +2 -0
  79. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js.map +1 -0
  80. package/dist/.next/static/chunks/app/(application)/projects/[project]/{page-0b2d9832e5a023e7.js → page-bc859da58d8505f7.js} +2 -2
  81. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-bc859da58d8505f7.js.map +1 -0
  82. package/dist/.next/static/css/c8c015815c72d053.css +4 -0
  83. package/dist/.next/static/css/c8c015815c72d053.css.map +1 -0
  84. package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
  85. package/dist/package.json +1 -0
  86. package/package.json +1 -1
  87. package/dist/.next/server/chunks/6623.js +0 -1
  88. package/dist/.next/static/chunks/1685-39351b8a15bbecab.js +0 -2
  89. package/dist/.next/static/chunks/1685-39351b8a15bbecab.js.map +0 -1
  90. package/dist/.next/static/chunks/1957-899d0d6d0d9c11fd.js +0 -2
  91. package/dist/.next/static/chunks/1957-899d0d6d0d9c11fd.js.map +0 -1
  92. package/dist/.next/static/chunks/3750-90a213a3c7cceb29.js.map +0 -1
  93. package/dist/.next/static/chunks/6373-1e2ef7e1f5217052.js.map +0 -1
  94. package/dist/.next/static/chunks/7856-9fa733bdd6429ba8.js.map +0 -1
  95. package/dist/.next/static/chunks/8269-0e17dac508340ccf.js +0 -2
  96. package/dist/.next/static/chunks/8269-0e17dac508340ccf.js.map +0 -1
  97. package/dist/.next/static/chunks/9105-78d236e8399181e0.js +0 -2
  98. package/dist/.next/static/chunks/9105-78d236e8399181e0.js.map +0 -1
  99. package/dist/.next/static/chunks/9953-abcb3d5ff5512285.js.map +0 -1
  100. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-29794b9c33d2bf7e.js.map +0 -1
  101. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-f1f7f053f0aec4f9.js +0 -2
  102. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-f1f7f053f0aec4f9.js.map +0 -1
  103. package/dist/.next/static/chunks/app/(application)/chat/layout-42021d301fc609b6.js +0 -2
  104. package/dist/.next/static/chunks/app/(application)/chat/layout-42021d301fc609b6.js.map +0 -1
  105. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-640f50c121655487.js +0 -2
  106. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-640f50c121655487.js.map +0 -1
  107. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c1e7e0c81ca508c3.js +0 -2
  108. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c1e7e0c81ca508c3.js.map +0 -1
  109. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-0b2d9832e5a023e7.js.map +0 -1
  110. package/dist/.next/static/css/a181dac3df0dc7a7.css +0 -4
  111. package/dist/.next/static/css/a181dac3df0dc7a7.css.map +0 -1
  112. /package/dist/.next/static/{2bzL2j5_MmcbjxQ21egBB → GOwerAkBncYx0J8q1TqQb}/_buildManifest.js +0 -0
  113. /package/dist/.next/static/{2bzL2j5_MmcbjxQ21egBB → GOwerAkBncYx0J8q1TqQb}/_ssgManifest.js +0 -0
@@ -1,2 +1,2 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[806],{62839:function(e,s,t){Promise.resolve().then(t.bind(t,32538))},32538:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return Q}});var i=t(57437),a=t(2265),l=t(99376),n=t(12199),r=t(7211),c=t(63251),d=t(27689),o=t(62869),u=t(95186),m=t(26815),h=t(76818),x=t(66070),p=t(35974),j=t(26110),v=t(19060),f=t(39763);let g=(0,f.Z)("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),y=(0,f.Z)("Files",[["path",{d:"M15.5 2H8.6c-.4 0-.8.2-1.1.5-.3.3-.5.7-.5 1.1v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8c.4 0 .8-.2 1.1-.5.3-.3.5-.7.5-1.1V6.5L15.5 2z",key:"cennsq"}],["path",{d:"M3 7.6v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8",key:"ms809a"}],["path",{d:"M15 2v5h5",key:"qq6kwv"}]]);var N=t(53417),w=t(88906),b=t(45675),k=t(99397);let C=(0,f.Z)("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);var Z=t(18930),S=t(63639),_=t(73247),z=t(82222),A=t(8014),E=t(93022),M=t(77992),O=t(10492),P=t(87393),T=t(13832),I=t(27648),R=t(81103),D=t(78361),L=t(36399);let F=(0,f.Z)("PlusSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var B=t(23518);let U=e=>{var s;let{onConfirm:t}=e,{data:l,loading:n,error:r}=(0,L.t)(),[c,d]=(0,a.useState)(void 0),[u,m]=(0,a.useState)(!1);return(0,i.jsxs)(j.Vq,{open:u,onOpenChange:e=>{m(e),d(void 0)},children:[(0,i.jsx)(j.hg,{asChild:!0,children:(0,i.jsxs)(o.z,{className:"w-full",variant:"outline",children:[(0,i.jsx)(F,{className:"h-4 w-4 mr-2"}),"Select items from knowledge sources to add to the project, or upload files."]})}),(0,i.jsxs)(j.cZ,{className:"sm:max-w-[900px]",children:[(0,i.jsxs)(j.fK,{children:[(0,i.jsx)(j.$N,{children:"Item selection"}),(0,i.jsx)(j.Be,{children:"Browse through contexts and select items."})]}),!c&&(0,i.jsxs)(B.mY,{className:"rounded-lg border shadow-md md:min-w-[450px]",children:[(0,i.jsx)(B.sZ,{placeholder:"Type a command or search..."}),(0,i.jsxs)(B.e8,{children:[(0,i.jsx)(B.rb,{children:"No results found."}),(0,i.jsx)(B.fu,{heading:"Contexts",children:null==l?void 0:null===(s=l.contexts)||void 0===s?void 0:s.items.map(e=>(0,i.jsx)(B.di,{onSelect:()=>{d(e)},children:e.name},e.id))})]})]}),c&&(0,i.jsx)(V,{context:c,onConfirm:e=>{console.log("item",e),t([{item:e,context:c}]),m(!1)}})]})]})},V=e=>{var s,t,l,n,c;let{context:o,onConfirm:u}=e,[m,h]=(0,a.useState)(void 0),{loading:x,data:p,refetch:j,previousData:v,error:f}=(0,r.aM)((0,d.P3)(o.id,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",skip:!o.id,variables:{context:o.id,page:1,limit:10,sort:{field:"updatedAt",direction:"DESC"},filters:{archived:{ne:!0},...m?{name:{contains:"".concat(m)}}:{}}}});return(0,i.jsxs)(B.mY,{className:"rounded-lg border shadow-md md:min-w-[450px]",children:[(0,i.jsx)(B.sZ,{onValueChange:e=>h(e),placeholder:"Type a command or search..."}),(0,i.jsx)(B.e8,{children:(0,i.jsxs)(B.fu,{heading:"Items",children:[!v&&x&&(0,i.jsx)(B.di,{children:(0,i.jsx)(O.g,{})},"loading"),!x&&!(null==p?void 0:null===(t=p[o.id+d.Md])||void 0===t?void 0:null===(s=t.items)||void 0===s?void 0:s.length)&&(0,i.jsx)(B.rb,{children:"No items found."}),null===(c=p||v)||void 0===c?void 0:null===(n=c[o.id+d.Md])||void 0===n?void 0:null===(l=n.items)||void 0===l?void 0:l.map(e=>(0,i.jsx)(B.di,{onSelect:()=>{u(e)},children:e.name},e.id))]})})]})};var W=t(6374);function q(e){var s,t,f,D,L,F,B,V;let{project:q}=e,[X,Y]=(0,a.useState)(!1),[Q,G]=(0,a.useState)(!1),[$,H]=(0,a.useState)(!1),[J,ee]=(0,a.useState)(""),[es,et]=(0,a.useState)("overview"),{user:ei}=(0,a.useContext)(T.S),ea=(0,l.useRouter)(),[el,en]=(0,a.useState)({deleteItems:!1,deleteSessions:!1}),[er,ec]=(0,a.useState)({name:q.name||"",description:q.description||"",custom_instructions:q.custom_instructions||""}),{toast:ed}=(0,M.pm)(),[eo,eu]=(0,a.useState)({rights_mode:q.rights_mode,users:null===(s=q.RBAC)||void 0===s?void 0:s.users,roles:null===(t=q.RBAC)||void 0===t?void 0:t.roles,projects:null===(f=q.RBAC)||void 0===f?void 0:f.projects}),[em,eh]=(0,a.useState)(q.project_items||[]),[ex,{loading:ep}]=(0,n.D)(d.b2),[ej]=(0,n.D)(d.Yr),[ev,ef]=(0,a.useState)(!1),{data:eg,loading:ey,refetch:eN}=(0,r.aM)(d.GJ,{variables:{page:1,limit:50,filters:[{project:{eq:q.id}}]}}),{data:ew,loading:eb}=(0,r.aM)(d.ym,{variables:{page:1,limit:100,filters:[],sort:{field:"updatedAt",direction:"DESC"}}}),ek=(0,c.x)(),[eC,{loading:eZ}]=(0,n.D)(d.fB),[eS,{loading:e_}]=(0,n.D)(d.MU),[ez,{loading:eA}]=(0,n.D)(d.S9),eE=(null==eg?void 0:null===(D=eg.agent_sessionsPagination)||void 0===D?void 0:D.items)||[],eM=(null==ew?void 0:null===(L=ew.agentsPagination)||void 0===L?void 0:L.items)||[],eO=a.useMemo(()=>J?eM.filter(e=>e.name.toLowerCase().includes(J.toLowerCase())):eM,[eM,J]),eP=async()=>{if(!er.name.trim()){ed({title:"Validation Error",description:"Project name is required.",variant:"destructive"});return}try{await ex({variables:{id:q.id,input:{name:er.name.trim(),description:er.description.trim()||null,custom_instructions:er.custom_instructions.trim()||null}}}),ed({title:"Success",description:"Project updated successfully!"}),Y(!1)}catch(e){console.error("Error updating project:",e),ed({title:"Error",description:e.message||"Failed to update project. Please try again.",variant:"destructive"})}},eT=async e=>{try{var s,t,i;let a=await eC({variables:{title:"New session with ".concat(e.name),agent:e.id,project:q.id,rights_mode:"projects",RBAC:{projects:[{id:q.id,rights:"read"}]}}}),l=null===(i=a.data)||void 0===i?void 0:null===(t=i.agent_sessionsCreateOne)||void 0===t?void 0:null===(s=t.item)||void 0===s?void 0:s.id;l&&(ed({title:"Success",description:"Session created successfully! Sessions started in a project are accessible for viewing by project members."}),H(!1),ee(""),ea.push("/chat/".concat(e.id,"/").concat(l)))}catch(e){console.error("Error creating session:",e),ed({title:"Error",description:e.message||"Failed to create session. Please try again.",variant:"destructive"})}},eI=async()=>{try{ef(!0),el.deleteItems&&await Promise.all(em.map(async e=>{var s,t;let i=e.split("/")[0],a=e.split("/")[1];if(!i||!a)return;let{data:l}=await ek.mutate({mutation:(0,d.mN)(i,"files_default_context"===i?["s3key"]:[]),variables:{id:a}});if(null===(s=l["".concat(i,"_itemsRemoveOneById")])||void 0===s?void 0:s.s3key)try{await W.QZ.delete(null===(t=l["".concat(i,"_itemsRemoveOneById")])||void 0===t?void 0:t.s3key)}catch(e){console.error("[EXULU] Error deleting file from s3 storage:",e)}})),await Promise.all(eE.map(async e=>{el.deleteSessions?await ez({variables:{id:e.id}}):await eS({variables:{id:e.id,project:null}})})),await ej({variables:{id:q.id}}),ed({title:"Success",description:'Project "'.concat(q.name,'" has been deleted successfully.')}),G(!1),ef(!1),ea.push("/projects")}catch(e){ef(!1),console.error("Error deleting project:",e),ed({title:"Error",description:e.message||"Failed to delete project. Please try again.",variant:"destructive"})}};return(0,i.jsxs)("div",{className:"flex-1 p-6 mt-20",children:[(0,i.jsx)("div",{className:"max-w-5xl mx-auto space-y-6",children:(0,i.jsxs)("div",{className:"flex gap-6 h-full",children:[(0,i.jsxs)("div",{className:"w-80 space-y-4",children:[(0,i.jsx)(x.Zb,{children:(0,i.jsx)(x.aY,{className:"p-4",children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)("h3",{className:"font-semibold text-lg",children:q.name}),(0,i.jsx)("p",{className:"text-muted-foreground text-sm leading-relaxed",children:q.description||"No description provided."})]})})}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)(o.z,{variant:"overview"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("overview"),children:[(0,i.jsx)(g,{className:"h-4 w-4 mr-2"}),"Project information"]}),(0,i.jsxs)(o.z,{variant:"context"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("context"),children:[(0,i.jsx)(y,{className:"h-4 w-4 mr-2"}),"Project files"]}),(0,i.jsxs)(o.z,{variant:"sessions"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("sessions"),children:[(0,i.jsx)(N.Z,{className:"h-4 w-4 mr-2"}),"Project sessions"]}),(0,i.jsxs)(o.z,{variant:"access"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("access"),children:[(0,i.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"Access control"]}),(0,i.jsxs)(o.z,{variant:"settings"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("settings"),children:[(0,i.jsx)(g,{className:"h-4 w-4 mr-2"}),"Project settings"]})]})]}),(0,i.jsxs)("div",{className:"flex-1",children:["overview"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(x.Zb,{children:[(0,i.jsxs)(x.Ol,{children:[(0,i.jsx)(x.ll,{children:"Project Information"}),(0,i.jsx)(x.SZ,{children:"Basic information about this project"})]}),(0,i.jsxs)(x.aY,{className:"space-y-4",children:[(0,i.jsx)("div",{className:"grid gap-4",children:(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(m._,{htmlFor:"name",children:"Project Name"}),X?(0,i.jsx)(u.I,{id:"name",value:er.name,onChange:e=>ec({...er,name:e.target.value})}):(0,i.jsx)("p",{className:"text-sm",children:q.name})]})}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(m._,{htmlFor:"description",children:"Description"}),X?(0,i.jsx)(h.g,{id:"description",value:er.description,onChange:e=>ec({...er,description:e.target.value}),rows:3}):(0,i.jsx)("p",{className:"text-sm",children:q.description||"No description provided"})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(m._,{htmlFor:"instructions",children:"Custom Instructions"}),X?(0,i.jsx)(h.g,{id:"instructions",value:er.custom_instructions,onChange:e=>ec({...er,custom_instructions:e.target.value}),rows:4,placeholder:"Enter custom instructions for sessions in this project..."}):(0,i.jsx)("p",{className:"text-sm",children:q.custom_instructions||"No custom instructions set"})]})]}),(0,i.jsx)(x.eW,{children:(0,i.jsx)("div",{className:"flex items-center justify-between",children:(0,i.jsx)("div",{className:"flex gap-2",children:X?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.z,{variant:"outline",onClick:()=>{q&&ec({name:q.name||"",description:q.description||"",custom_instructions:q.custom_instructions||""}),Y(!1)},children:"Cancel"}),(0,i.jsxs)(o.z,{onClick:eP,children:[(0,i.jsx)("span",{children:"Save changes"}),ep&&(0,i.jsx)(O.g,{className:"mr-2"})]})]}):(0,i.jsxs)(o.z,{variant:"outline",onClick:()=>Y(!0),children:[(0,i.jsx)(b.Z,{className:"h-4 w-4 mr-2"}),"Edit"]})})})})]})}),"context"===es&&(0,i.jsx)("div",{className:"space-y-6 w-full",children:(0,i.jsxs)(x.Zb,{children:[(0,i.jsxs)(x.Ol,{children:[(0,i.jsx)(x.ll,{children:"Project context items"}),(0,i.jsx)(x.SZ,{children:"Items that provide context for sessions in this project (max 15 items). Note that different agents may have different file types supported."})]}),(0,i.jsx)(x.aY,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(U,{onConfirm:e=>{let s=[...em,...e.map(e=>"".concat(e.context.id,"/").concat(e.item.id))];console.log("update",s),eh(s),ex({variables:{id:q.id,input:{project_items:s}}})}}),(0,i.jsx)("div",{className:"space-y-2",children:(0,i.jsxs)("div",{className:"space-y-2",children:[(null==em?void 0:em.length)===0&&(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(y,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:"No items added to the project context yet."})]}),(0,i.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-3",children:null==em?void 0:em.map(e=>(0,i.jsx)(K,{gid:e,onRemove:e=>{let s=em.filter(s=>s!==e);eh(s),ex({variables:{id:q.id,input:{project_items:s}}})}},e))})]})})]})})]})}),"sessions"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(x.Zb,{children:[(0,i.jsxs)(x.Ol,{children:[(0,i.jsx)(x.ll,{children:"Project sessions"}),(0,i.jsx)(x.SZ,{children:"Sessions associated with this project"})]}),(0,i.jsx)(x.aY,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)(o.z,{onClick:()=>{H(!0)},className:"w-full",variant:"outline",children:[(0,i.jsx)(k.Z,{className:"h-4 w-4 mr-2"}),"Start new session"]}),(0,i.jsx)("div",{className:"space-y-2",children:eE.map(e=>{let s=(0,P.I)(e,ei);return(0,i.jsxs)("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)(N.Z,{className:"h-4 w-4"}),(0,i.jsx)("div",{children:(0,i.jsx)(I.default,{href:"/chat/".concat(e.agent,"/").concat(e.id),children:(0,i.jsx)("p",{className:"font-medium max-w-[80%] truncate",children:e.title})})})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)(R.u,{children:[(0,i.jsx)(R.aJ,{asChild:!0,children:(0,i.jsx)(o.z,{disabled:!s||e_,variant:"ghost",size:"sm",onClick:()=>{e_||(eS({variables:{id:e.id,project:null}}),eN())},children:(0,i.jsx)(C,{className:"h-4 w-4"})})}),(0,i.jsx)(R._v,{children:(0,i.jsx)("p",{children:"Remove session from project."})})]}),(0,i.jsxs)(R.u,{children:[(0,i.jsx)(R.aJ,{asChild:!0,children:(0,i.jsx)(o.z,{disabled:!s||eA,variant:"ghost",size:"sm",onClick:()=>{eA||(ez({variables:{id:e.id}}),eN())},children:(0,i.jsx)(Z.Z,{className:"h-4 w-4"})})}),(0,i.jsx)(R._v,{children:(0,i.jsx)("p",{children:"Delete session completely."})})]})]})]},e.id)})}),0===eE.length&&!ey&&(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(N.Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:"No sessions found"})]}),ey&&(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(N.Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:"Loading sessions..."})]})]})})]})}),"access"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(x.Zb,{children:[(0,i.jsxs)(x.Ol,{children:[(0,i.jsx)(x.ll,{children:"Access Control"}),(0,i.jsx)(x.SZ,{children:"Control who can access this project"})]}),(0,i.jsx)(x.aY,{children:(0,i.jsx)(A.P,{allowedModes:["private","users","roles"],initialRightsMode:q.rights_mode||"private",initialUsers:null===(F=q.RBAC)||void 0===F?void 0:F.users,initialRoles:null===(B=q.RBAC)||void 0===B?void 0:B.roles,initialProjects:null===(V=q.RBAC)||void 0===V?void 0:V.projects,onChange:(e,s,t,i)=>{eu({rights_mode:e,users:s,roles:t,projects:i})}})}),(0,i.jsx)(x.eW,{children:(0,i.jsxs)(o.z,{onClick:()=>{ex({variables:{id:q.id,input:{rights_mode:eo.rights_mode,RBAC:{users:eo.users,roles:eo.roles,projects:eo.projects}}}})},children:[(0,i.jsx)("span",{children:"Save access rights"}),ep&&(0,i.jsx)(O.g,{className:"ml-2"})]})})]})}),"settings"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(x.Zb,{children:[(0,i.jsxs)(x.Ol,{children:[(0,i.jsx)(x.ll,{children:"Danger Zone"}),(0,i.jsx)(x.SZ,{children:"Permanently delete this project and all associated data"})]}),(0,i.jsx)(x.aY,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"flex items-start gap-3 p-4 border border-destructive/20 rounded-lg bg-destructive/5",children:[(0,i.jsx)(S.Z,{className:"h-5 w-5 text-destructive mt-0.5"}),(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsx)("h4",{className:"font-medium text-destructive",children:"Delete Project"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"This action cannot be undone. This will permanently delete the project and optionally remove all associated context files and sessions."})]})]}),(0,i.jsxs)(j.Vq,{open:Q,onOpenChange:G,children:[(0,i.jsx)(j.hg,{asChild:!0,children:(0,i.jsxs)(o.z,{variant:"destructive",children:[(0,i.jsx)(Z.Z,{className:"h-4 w-4 mr-2"}),"Delete Project"]})}),(0,i.jsxs)(j.cZ,{className:"sm:max-w-md",children:[(0,i.jsxs)(j.fK,{children:[(0,i.jsx)(j.$N,{children:"Delete Project"}),(0,i.jsxs)(j.Be,{children:['Are you sure you want to delete "',q.name,'"? This action cannot be undone.']})]}),(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsx)(v.X,{id:"delete-items",checked:el.deleteItems,onCheckedChange:e=>en(s=>({...s,deleteItems:e}))}),(0,i.jsxs)("label",{htmlFor:"delete-items",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Also delete all context items (",null==em?void 0:em.length," items)"]})]}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsx)(v.X,{id:"delete-sessions",checked:el.deleteSessions,onCheckedChange:e=>en(s=>({...s,deleteSessions:e}))}),(0,i.jsxs)("label",{htmlFor:"delete-sessions",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Also delete all sessions (",eE.length," sessions)"]})]}),(el.deleteItems||el.deleteSessions)&&(0,i.jsxs)("div",{className:"flex items-start gap-2 p-3 border border-amber-200 rounded-lg bg-amber-50",children:[(0,i.jsx)(S.Z,{className:"h-4 w-4 text-amber-600 mt-0.5"}),(0,i.jsx)("p",{className:"text-sm text-amber-800",children:el.deleteItems&&el.deleteSessions?"All context items and sessions will be permanently deleted.":el.deleteItems?"All context items will be permanently deleted.":"All sessions will be permanently deleted."})]})]}),(0,i.jsxs)(j.cN,{className:"sm:justify-start",children:[(0,i.jsx)(o.z,{variant:"outline",onClick:()=>G(!1),children:"Cancel"}),(0,i.jsxs)(o.z,{disabled:ev,variant:"destructive",onClick:eI,children:[ev?(0,i.jsx)(O.g,{className:"mr-2 w-4 h-4"}):(0,i.jsx)(Z.Z,{className:"h-4 w-4 mr-2"}),"Delete Project"]})]})]})]})]})})]})})]})]})}),(0,i.jsx)(j.Vq,{open:$,onOpenChange:H,children:(0,i.jsxs)(j.cZ,{className:"sm:max-w-4xl",children:[(0,i.jsxs)(j.fK,{children:[(0,i.jsx)(j.$N,{children:"Select an Agent"}),(0,i.jsx)(j.Be,{children:"Choose an agent to start a new chat session. Sessions started in a project are accessible for viewing by project members."})]}),(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)(_.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,i.jsx)(u.I,{placeholder:"Search agents...",value:J,onChange:e=>ee(e.target.value),className:"pl-10"})]}),(0,i.jsx)("div",{className:"max-h-96 overflow-y-auto",children:eb?(0,i.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[...Array(6)].map((e,s)=>(0,i.jsx)("div",{className:"p-4 border rounded-lg",children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)(E.O,{className:"h-12 w-12 rounded-full"}),(0,i.jsxs)("div",{className:"space-y-2 flex-1",children:[(0,i.jsx)(E.O,{className:"h-4 w-3/4"}),(0,i.jsx)(E.O,{className:"h-3 w-1/2"})]})]})},s))}):eO.length>0?(0,i.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:eO.map(e=>(0,i.jsx)("div",{className:"p-4 border rounded-lg hover:border-primary cursor-pointer transition-colors",onClick:()=>eT(e),children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.image?(0,i.jsx)("img",{src:e.image,alt:e.name,className:"h-12 w-12 rounded-full object-cover"}):(0,i.jsx)(z.Z,{className:"h-6 w-6"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"font-medium truncate",children:e.name}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground truncate",children:e.description||"".concat(e.type," agent")}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)(p.C,{variant:e.active?"default":"secondary",className:"text-xs",children:e.active?"Active":"Inactive"}),(0,i.jsx)(p.C,{variant:"outline",className:"text-xs",children:e.type})]})]})]})},e.id))}):(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(z.Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:J?"No agents found matching your search":"No agents available"})]})})]}),(0,i.jsx)(j.cN,{children:(0,i.jsx)(o.z,{variant:"outline",onClick:()=>H(!1),children:"Cancel"})})]})})]})}function K(e){let{gid:s,onRemove:t}=e,a=s.split("/")[0],l=s.split("/")[1];if(!a||!l)return null;let{data:n,loading:c}=(0,r.aM)((0,d.A1)(a,"files_default_context"===a?["s3key"]:[]),{variables:{id:l}});if(console.log("data",n),c)return null;let o=null==n?void 0:n[a+"_itemsById"];if(!o)return null;let u=Object.values(o||{}).filter(e=>"_s3key"===e);return u.length?(0,i.jsx)(i.Fragment,{children:u.map(e=>(0,i.jsx)(D.jU,{s3Key:e,onRemove:()=>{t(s)},active:!1,disabled:!1}))}):null}var X=t(65613),Y=t(20653);function Q(){let e=(0,l.useParams)(),s=null==e?void 0:e.project,{data:t,loading:a,error:n}=(0,r.aM)(d.jL,{variables:{id:s}});return a?(0,i.jsx)("div",{children:(0,i.jsx)(E.O,{className:"w-full h-full"})}):n?(0,i.jsxs)(X.bZ,{variant:"destructive",children:[(0,i.jsx)(Y.LPM,{className:"size-4"}),(0,i.jsx)(X.Cd,{children:"Error"}),(0,i.jsx)(X.X,{children:"Error loading project."})]}):(null==t?void 0:t.projectById)?(0,i.jsx)(q,{project:t.projectById}):(0,i.jsxs)(X.bZ,{variant:"destructive",children:[(0,i.jsx)(Y.LPM,{className:"size-4"}),(0,i.jsx)(X.Cd,{children:"Error"}),(0,i.jsx)(X.X,{children:"Project not found."})]})}},65613:function(e,s,t){"use strict";t.d(s,{Cd:function(){return d},X:function(){return o},bZ:function(){return c}});var i=t(57437),a=t(90535),l=t(2265),n=t(94508);let r=(0,a.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",info:"border-info/50 text-info dark:border-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}}),c=l.forwardRef((e,s)=>{let{className:t,variant:a,...l}=e;return(0,i.jsx)("div",{ref:s,role:"alert",className:(0,n.cn)(r({variant:a}),t),...l})});c.displayName="Alert";let d=l.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)("h5",{ref:s,className:(0,n.cn)("mb-1 font-medium leading-none tracking-tight",t),...a})});d.displayName="AlertTitle";let o=l.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)("div",{ref:s,className:(0,n.cn)("text-sm [&_p]:leading-relaxed",t),...a})});o.displayName="AlertDescription"},19060:function(e,s,t){"use strict";t.d(s,{X:function(){return c}});var i=t(57437),a=t(9270),l=t(30401),n=t(2265),r=t(94508);let c=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,i.jsx)(a.fC,{ref:s,className:(0,r.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...n,children:(0,i.jsx)(a.z$,{className:(0,r.cn)("flex items-center justify-center text-current"),children:(0,i.jsx)(l.Z,{className:"size-4"})})})});c.displayName=a.fC.displayName},10492:function(e,s,t){"use strict";t.d(s,{g:function(){return l}});var i=t(57437),a=t(94508);let l=e=>{let{className:s}=e;return(0,i.jsxs)("svg",{"aria-hidden":"true",role:"status",className:(0,a.cn)("inline w-4 h-4 text-white animate-spin fill-inherit",s),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",className:"fill-inherit opacity-20"}),(0,i.jsx)("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",className:"fill-inherit"})]})}},77992:function(e,s,t){"use strict";t.d(s,{Am:function(){return u},pm:function(){return m}});var i=t(2265);let a=0,l=new Map,n=e=>{if(l.has(e))return;let s=setTimeout(()=>{l.delete(e),o({type:"REMOVE_TOAST",toastId:e})},1e6);l.set(e,s)},r=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?n(t):e.toasts.forEach(e=>{n(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},c=[],d={toasts:[]};function o(e){d=r(d,e),c.forEach(e=>{e(d)})}function u(e){let{...s}=e,t=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),i=()=>o({type:"DISMISS_TOAST",toastId:t});return o({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||i()}}}),{id:t,dismiss:i,update:e=>o({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function m(){let[e,s]=i.useState(d);return i.useEffect(()=>(c.push(s),()=>{let e=c.indexOf(s);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>o({type:"DISMISS_TOAST",toastId:e})}}},78361:function(e,s,t){"use strict";t.d(s,{jF:function(){return O},jU:function(){return I},ZP:function(){return P},NF:function(){return D}});var i=t(57437),a=t(2265),l=t(47632),n=t(1109);t(46693),t(51832);var r=t(6374),c=t(44045);let d=async e=>{var s;if(!e.backend)throw Error("No backend set.");let{callbacks:t,maxNumberOfFiles:i,uppyOptions:a}=e||{},{uploadSuccess:c}=t||{},{allowedFileTypes:d,id:o}=a||{},u=await (0,r.LP)(),m=new l.Z({autoProceed:!0,debug:!1,id:o||"uppy",restrictions:{maxNumberOfFiles:i||5,allowedFileTypes:d||[".heic",".jpg",".jpeg",".png",".webp",".svg"]}}).use(n.Z,{id:"Exulu",endpoint:e.backend,headers:{Authorization:"Bearer ".concat(u),Session:null!==(s=localStorage.getItem("session"))&&void 0!==s?s:""}}).on("file-added",async e=>{console.debug("added",e)}).on("upload-error",(e,s)=>{(null==e?void 0:e.id)&&(m.removeFile(null==e?void 0:e.id),console.error("error",s))}).on("upload-success",(e,s)=>{s.uploadURL&&c&&(console.log("response",s),c({file:e,key:s.uploadURL.split("/").pop()||"",url:s.uploadURL}))});return m};var o=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(0,a.useContext)(c.E),[i,l]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>((async()=>{l(await d({...e,backend:(null==t?void 0:t.backend)||""}))})(),()=>{i&&(i.destroy(),l(void 0))}),[...s]),i},u=t(80007),m=t(92735),h=t(88964),x=t(30044),p=t(92451),j=t(10407),v=t(48736),f=t(53113),g=t(69658),y=t(99397),N=t(32489),w=t(15001),b=t(62869),k=t(26110),C=t(19378),Z=t(78298),S=t(11713),_=t(21770),z=t(95186),A=t(20653),E=t(66070),M=t(93022);function O(e){let{s3key:s,children:t}=e,{data:l,isLoading:n,error:c,refetch:d}=(0,S.a)({queryKey:["fileObject",s],queryFn:async()=>s?await r.QZ.object(s):null,enabled:null!=s});return((0,a.useEffect)(()=>{s&&d()},[s]),s)?(0,i.jsxs)(E.Zb,{children:[(0,i.jsx)(E.Ol,{className:"pb-3",children:(0,i.jsx)(E.ll,{className:"text-sm truncate",children:s.split("_EXULU_").pop()})}),(0,i.jsxs)(E.aY,{className:"pt-0",children:[n&&(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(M.O,{className:"h-4 w-full"}),(0,i.jsx)(M.O,{className:"h-4 w-2/3"})]}),!n&&l&&(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,i.jsx)("span",{className:"capitalize",children:null==l?void 0:l.ContentType.split("/").pop()}),(0,i.jsxs)("span",{children:[((null==l?void 0:l.ContentLength)/1024/1024).toFixed(2)," MB"]})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,i.jsxs)("span",{children:["Last modified: ",new Date(null==l?void 0:l.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,i.jsxs)(b.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{r.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,i.jsx)("span",{className:"mr-1 text-xs",children:"View"}),(0,i.jsx)(m.Z,{className:"h-3 w-3"})]})]})]}),!n&&c&&(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:c.message}),t]})]}):(0,i.jsx)(E.Zb,{children:(0,i.jsxs)(E.aY,{className:"p-3 flex",children:[(0,i.jsx)("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),t]})})}function P(e){let{id:s,allowedFileTypes:t,dependencies:l,onConfirm:n,selectionLimit:r,buttonText:c}=e,[d,o]=(0,a.useState)(!1);return(0,i.jsxs)(k.Vq,{open:d,onOpenChange:o,children:[(0,i.jsx)(k.hg,{asChild:!0,children:(0,i.jsxs)(b.z,{variant:"outline",children:[c&&(0,i.jsx)("span",{className:"mr-2",children:c}),(0,i.jsx)(h.Z,{className:"h-4 w-4"})]})}),(0,i.jsxs)(k.cZ,{className:"sm:max-w-[900px]",children:[(0,i.jsxs)(k.fK,{children:[(0,i.jsx)(k.$N,{children:"File Gallery"}),(0,i.jsx)(k.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),(0,i.jsx)(T,{id:s,allowedFileTypes:t,dependencies:l,selectionLimit:r,onConfirm:e=>{n(e),o(!1)}})]})]})}let T=e=>{var s,t;let{id:l,allowedFileTypes:n,dependencies:d,onConfirm:m,selectionLimit:h}=e;n||(n=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[v,f]=(0,a.useState)(void 0),[g,y]=(0,a.useState)(void 0),[N,w]=(0,a.useState)(void 0),k=(0,a.useContext)(c.E),[E,O]=(0,a.useState)([]),P=e=>{if(E.includes(e)){O(E.filter(s=>s!==e));return}if(1===h){O([e]);return}E.length>=h||O([...E,e])},T=(0,_.D)({mutationFn:async e=>{let{key:s}=e;await r.QZ.delete(s),F()}}),{data:R,isLoading:D,error:L,refetch:F}=(0,S.a)({queryKey:["filesQuery",v,N],staleTime:3e4,queryFn:async()=>r.QZ.list({search:v,continuationToken:N})});console.log("!! data !!",R);let{theme:B}=(0,Z.F)(),U=o({backend:(null==k?void 0:k.backend)||"",uppyOptions:{id:l,allowedFileTypes:n},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},d);return((0,a.useEffect)(()=>{F()},[v,N]),U)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,i.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,i.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),(0,i.jsx)(z.I,{placeholder:"Search files...",value:v,onChange:e=>f(e.target.value),className:"mb-3"}),(0,i.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,i.jsxs)("span",{children:[E.length," / ",h," files selected"]}),(0,i.jsxs)("span",{children:["Allowed file types: ",null==n?void 0:n.map(e=>e).join(", ")]})]}),(0,i.jsxs)(C.x,{children:[D&&(0,i.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"})]}),(0,i.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!D&&!(null==R?void 0:null===(s=R.Contents)||void 0===s?void 0:s.length)&&(0,i.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[(0,i.jsx)(x.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),(0,i.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),null==R?void 0:null===(t=R.Contents)||void 0===t?void 0:t.map(e=>(0,i.jsx)(I,{s3Key:e.Key,onSelect:P,active:E.some(s=>s===e.Key),onRemove:()=>{T.mutate({key:e.Key})},disabled:!!n&&!(null==n?void 0:n.some(s=>e.Key.endsWith(s)))}))]}),(0,i.jsx)("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsxs)(b.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{w(void 0)},disabled:!N||D,children:[(0,i.jsx)("span",{className:"sr-only",children:"Go to first page"}),(0,i.jsx)(A.kRt,{className:"size-4"})]}),(0,i.jsxs)(b.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{w(g)},disabled:!N||D,children:[(0,i.jsx)("span",{className:"sr-only",children:"Go to previous page"}),(0,i.jsx)(p.Z,{className:"size-4"})]}),(0,i.jsxs)(b.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{y(N),w(null==R?void 0:R.NextContinuationToken)},disabled:!(null==R?void 0:R.NextContinuationToken)||D,children:[(0,i.jsx)("span",{className:"sr-only",children:"Go to next page"}),(0,i.jsx)(j.Z,{className:"size-4"})]})]})})]})]}),(0,i.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,i.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),(0,i.jsx)(u.A,{uppy:U,theme:"dark"===B?"dark":"light"})]})]}),(0,i.jsx)("div",{className:"flex justify-end",children:(0,i.jsx)(b.z,{variant:"outline",onClick:()=>{m(E),O([])},children:"Confirm"})})]}):null},I=e=>{let{s3Key:s,onSelect:t,onRemove:a,active:l,disabled:n,addToContext:c}=e;return(0,i.jsxs)("div",{className:"".concat(n?"opacity-50":""," group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ").concat(l?"border border-purple-500":"border"),onClick:()=>{!n&&t&&t(s)},children:[(0,i.jsx)("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:s&&(s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg"))?(0,i.jsx)(L,{fileKey:s}):(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[s?s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg")?(0,i.jsx)(f.Z,{className:"h-6 w-6 text-blue-500"}):s.endsWith("pdf")?(0,i.jsx)(g.Z,{className:"h-6 w-6 text-red-500"}):s.endsWith("xls")||s.endsWith("xlsx")||s.endsWith("csv")?(0,i.jsx)(v.Z,{className:"h-6 w-6 text-green-500"}):s.endsWith("ppt")||s.endsWith("pptx")?(0,i.jsx)(v.Z,{className:"h-6 w-6 text-orange-500"}):(0,i.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}):(0,i.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:s?s.split("_EXULU_").pop():s})]})}),(0,i.jsx)("p",{className:"text-xs truncate",children:s?s.split("_EXULU_").pop():s}),(0,i.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[c&&(0,i.jsxs)(b.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{c(s)},children:[(0,i.jsx)(y.Z,{className:"h-3 w-3"}),(0,i.jsx)("span",{className:"sr-only",children:"Add"})]}),(0,i.jsxs)(b.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{r.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,i.jsx)(m.Z,{className:"h-3 w-3"}),(0,i.jsx)("span",{className:"sr-only",children:"View"})]}),a&&(0,i.jsxs)(b.z,{onClick:e=>{e.stopPropagation(),a(s)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[(0,i.jsx)(N.Z,{className:"h-3 w-3"}),(0,i.jsx)("span",{className:"sr-only",children:"Remove"})]})]})]},s)},R={},D=async e=>{if(R[e]){if(!(R[e].expiresAt<Date.now()))return R[e].url;delete R[e]}let s=await r.QZ.download(e),t=await s.json();return console.log("json",t),R[e]={url:t.url,expiresAt:Date.now()+6e4},t.url},L=e=>{let{fileKey:s}=e;console.log("key",s);let t=(0,S.a)({queryKey:["imageQuery",s],staleTime:3e4,queryFn:async()=>D(s)});return t.isLoading?(0,i.jsx)("div",{children:(0,i.jsx)(w.Z,{})}):t.isLoading||t.data?(0,i.jsx)("img",{src:t.data,alt:s,className:"object-cover w-full h-full"}):(0,i.jsx)("div",{children:(0,i.jsx)(x.Z,{})})}},36399:function(e,s,t){"use strict";t.d(s,{t:function(){return l}});var i=t(27689),a=t(7211);let l=()=>(0,a.aM)(i.uw,{variables:{limit:20}})},87393:function(e,s,t){"use strict";t.d(s,{I:function(){return i}});let i=(e,s)=>{var t,i,a,l,n,r;let c="private"===e.rights_mode,d="public"===e.rights_mode,o="users"===e.rights_mode,u="roles"===e.rights_mode,m=s.super_admin,h=e.created_by===s.id.toString(),x=!1;return c&&h&&(x=!0),d&&(x=!0),o&&(x=(null===(a=e.RBAC)||void 0===a?void 0:null===(i=a.users)||void 0===i?void 0:null===(t=i.find(e=>e.id===s.id))||void 0===t?void 0:t.rights)==="write"),u&&(x=(null===(r=e.RBAC)||void 0===r?void 0:null===(n=r.roles)||void 0===n?void 0:null===(l=n.find(e=>{var t;return e.id===(null===(t=s.role)||void 0===t?void 0:t.id)}))||void 0===l?void 0:l.rights)==="write"),m&&(x=!0),x}},63639:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},24156:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},14924:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},29202:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(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"}]])},66337:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},53417:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},45675:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},88906:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}]])},9270:function(e,s,t){"use strict";t.d(s,{fC:function(){return N},z$:function(){return b}});var i=t(2265),a=t(98575),l=t(73966),n=t(6741),r=t(80886),c=t(6718),d=t(90420),o=t(71599),u=t(66840),m=t(57437),h="Checkbox",[x,p]=(0,l.b)(h),[j,v]=x(h);function f(e){let{__scopeCheckbox:s,checked:t,children:a,defaultChecked:l,disabled:n,form:c,name:d,onCheckedChange:o,required:u,value:x="on",internal_do_not_use_render:p}=e,[v,f]=(0,r.T)({prop:t,defaultProp:null!=l&&l,onChange:o,caller:h}),[g,y]=i.useState(null),[N,w]=i.useState(null),b=i.useRef(!1),k=!g||!!c||!!g.closest("form"),C={checked:v,disabled:n,setChecked:f,control:g,setControl:y,name:d,form:c,value:x,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:!Z(l)&&l,isFormControl:k,bubbleInput:N,setBubbleInput:w};return(0,m.jsx)(j,{scope:s,...C,children:"function"==typeof p?p(C):a})}var g="CheckboxTrigger",y=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,onKeyDown:l,onClick:r,...c}=e,{control:d,value:o,disabled:h,checked:x,required:p,setControl:j,setChecked:f,hasConsumerStoppedPropagationRef:y,isFormControl:N,bubbleInput:w}=v(g,t),b=(0,a.e)(s,j),k=i.useRef(x);return i.useEffect(()=>{let e=null==d?void 0:d.form;if(e){let s=()=>f(k.current);return e.addEventListener("reset",s),()=>e.removeEventListener("reset",s)}},[d,f]),(0,m.jsx)(u.WV.button,{type:"button",role:"checkbox","aria-checked":Z(x)?"mixed":x,"aria-required":p,"data-state":S(x),"data-disabled":h?"":void 0,disabled:h,value:o,...c,ref:b,onKeyDown:(0,n.M)(l,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,n.M)(r,e=>{f(e=>!!Z(e)||!e),w&&N&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})})});y.displayName=g;var N=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,name:i,checked:a,defaultChecked:l,required:n,disabled:r,value:c,onCheckedChange:d,form:o,...u}=e;return(0,m.jsx)(f,{__scopeCheckbox:t,checked:a,defaultChecked:l,disabled:r,required:n,onCheckedChange:d,name:i,form:o,value:c,internal_do_not_use_render:e=>{let{isFormControl:i}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(y,{...u,ref:s,__scopeCheckbox:t}),i&&(0,m.jsx)(C,{__scopeCheckbox:t})]})}})});N.displayName=h;var w="CheckboxIndicator",b=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,forceMount:i,...a}=e,l=v(w,t);return(0,m.jsx)(o.z,{present:i||Z(l.checked)||!0===l.checked,children:(0,m.jsx)(u.WV.span,{"data-state":S(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...e.style}})})});b.displayName=w;var k="CheckboxBubbleInput",C=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,...l}=e,{control:n,hasConsumerStoppedPropagationRef:r,checked:o,defaultChecked:h,required:x,disabled:p,name:j,value:f,form:g,bubbleInput:y,setBubbleInput:N}=v(k,t),w=(0,a.e)(s,N),b=(0,c.D)(o),C=(0,d.t)(n);i.useEffect(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,s=!r.current;if(b!==o&&e){let t=new Event("click",{bubbles:s});y.indeterminate=Z(o),e.call(y,!Z(o)&&o),y.dispatchEvent(t)}},[y,b,o,r]);let S=i.useRef(!Z(o)&&o);return(0,m.jsx)(u.WV.input,{type:"checkbox","aria-hidden":!0,defaultChecked:null!=h?h:S.current,required:x,disabled:p,name:j,value:f,form:g,...l,tabIndex:-1,ref:w,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function Z(e){return"indeterminate"===e}function S(e){return Z(e)?"indeterminate":e?"checked":"unchecked"}C.displayName=k},6394:function(e,s,t){"use strict";t.d(s,{f:function(){return r}});var i=t(2265),a=t(66840),l=t(57437),n=i.forwardRef((e,s)=>(0,l.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{var t;s.target.closest("button, input, select, textarea")||(null===(t=e.onMouseDown)||void 0===t||t.call(e,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));n.displayName="Label";var r=n}},function(e){e.O(0,[6840,8310,9851,7629,7093,6148,847,1942,7648,7823,8068,5799,605,4567,1206,5338,1785,5110,3171,1713,4811,6373,3832,8030,2971,2117,1744],function(){return e(e.s=62839)}),_N_E=e.O()}]);
2
- //# sourceMappingURL=page-0b2d9832e5a023e7.js.map
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[806],{62839:function(e,s,t){Promise.resolve().then(t.bind(t,32538))},32538:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return Q}});var i=t(57437),a=t(2265),l=t(99376),n=t(12199),r=t(7211),c=t(63251),d=t(27689),o=t(62869),u=t(95186),m=t(26815),x=t(76818),h=t(66070),p=t(35974),j=t(26110),v=t(19060),f=t(39763);let g=(0,f.Z)("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),y=(0,f.Z)("Files",[["path",{d:"M15.5 2H8.6c-.4 0-.8.2-1.1.5-.3.3-.5.7-.5 1.1v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8c.4 0 .8-.2 1.1-.5.3-.3.5-.7.5-1.1V6.5L15.5 2z",key:"cennsq"}],["path",{d:"M3 7.6v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8",key:"ms809a"}],["path",{d:"M15 2v5h5",key:"qq6kwv"}]]);var N=t(53417),w=t(88906),b=t(45675),k=t(99397);let C=(0,f.Z)("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);var Z=t(18930),S=t(63639),_=t(73247),z=t(82222),A=t(8014),E=t(93022),M=t(77992),O=t(10492),P=t(87393),T=t(13832),I=t(27648),R=t(81103),D=t(78361),L=t(36399);let F=(0,f.Z)("PlusSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var B=t(23518);let U=e=>{var s;let{onConfirm:t}=e,{data:l,loading:n,error:r}=(0,L.t)(),[c,d]=(0,a.useState)(void 0),[u,m]=(0,a.useState)(!1);return(0,i.jsxs)(j.Vq,{open:u,onOpenChange:e=>{m(e),d(void 0)},children:[(0,i.jsx)(j.hg,{asChild:!0,children:(0,i.jsxs)(o.z,{className:"w-full",variant:"outline",children:[(0,i.jsx)(F,{className:"h-4 w-4 mr-2"}),"Select items from knowledge sources to add to the project, or upload files."]})}),(0,i.jsxs)(j.cZ,{className:"sm:max-w-[900px]",children:[(0,i.jsxs)(j.fK,{children:[(0,i.jsx)(j.$N,{children:"Item selection"}),(0,i.jsx)(j.Be,{children:"Browse through contexts and select items."})]}),!c&&(0,i.jsxs)(B.mY,{className:"rounded-lg border shadow-md md:min-w-[450px]",children:[(0,i.jsx)(B.sZ,{placeholder:"Type a command or search..."}),(0,i.jsxs)(B.e8,{children:[(0,i.jsx)(B.rb,{children:"No results found."}),(0,i.jsx)(B.fu,{heading:"Contexts",children:null==l?void 0:null===(s=l.contexts)||void 0===s?void 0:s.items.map(e=>(0,i.jsx)(B.di,{onSelect:()=>{d(e)},children:e.name},e.id))})]})]}),c&&(0,i.jsx)(V,{context:c,onConfirm:e=>{console.log("item",e),t([{item:e,context:c}]),m(!1)}})]})]})},V=e=>{var s,t,l,n,c;let{context:o,onConfirm:u}=e,[m,x]=(0,a.useState)(void 0),{loading:h,data:p,refetch:j,previousData:v,error:f}=(0,r.aM)((0,d.P3)(o.id,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",skip:!o.id,variables:{context:o.id,page:1,limit:10,sort:{field:"updatedAt",direction:"DESC"},filters:{archived:{ne:!0},...m?{name:{contains:"".concat(m)}}:{}}}});return(0,i.jsxs)(B.mY,{className:"rounded-lg border shadow-md md:min-w-[450px]",children:[(0,i.jsx)(B.sZ,{onValueChange:e=>x(e),placeholder:"Type a command or search..."}),(0,i.jsx)(B.e8,{children:(0,i.jsxs)(B.fu,{heading:"Items",children:[!v&&h&&(0,i.jsx)(B.di,{children:(0,i.jsx)(O.g,{})},"loading"),!h&&!(null==p?void 0:null===(t=p[o.id+d.Md])||void 0===t?void 0:null===(s=t.items)||void 0===s?void 0:s.length)&&(0,i.jsx)(B.rb,{children:"No items found."}),null===(c=p||v)||void 0===c?void 0:null===(n=c[o.id+d.Md])||void 0===n?void 0:null===(l=n.items)||void 0===l?void 0:l.map(e=>(0,i.jsx)(B.di,{onSelect:()=>{u(e)},children:e.name},e.id))]})})]})};var W=t(6374);function q(e){var s,t,f,D,L,F,B,V;let{project:q}=e,[X,Y]=(0,a.useState)(!1),[Q,G]=(0,a.useState)(!1),[$,H]=(0,a.useState)(!1),[J,ee]=(0,a.useState)(""),[es,et]=(0,a.useState)("overview"),{user:ei}=(0,a.useContext)(T.S),ea=(0,l.useRouter)(),[el,en]=(0,a.useState)({deleteItems:!1,deleteSessions:!1}),[er,ec]=(0,a.useState)({name:q.name||"",description:q.description||"",custom_instructions:q.custom_instructions||""}),{toast:ed}=(0,M.pm)(),[eo,eu]=(0,a.useState)({rights_mode:q.rights_mode,users:null===(s=q.RBAC)||void 0===s?void 0:s.users,roles:null===(t=q.RBAC)||void 0===t?void 0:t.roles,projects:null===(f=q.RBAC)||void 0===f?void 0:f.projects}),[em,ex]=(0,a.useState)(q.project_items||[]),[eh,{loading:ep}]=(0,n.D)(d.b2),[ej]=(0,n.D)(d.Yr),[ev,ef]=(0,a.useState)(!1),{data:eg,loading:ey,refetch:eN}=(0,r.aM)(d.GJ,{variables:{page:1,limit:50,filters:[{project:{eq:q.id}}]}}),{data:ew,loading:eb}=(0,r.aM)(d.ym,{variables:{page:1,limit:100,filters:[],sort:{field:"updatedAt",direction:"DESC"}}}),ek=(0,c.x)(),[eC,{loading:eZ}]=(0,n.D)(d.fB),[eS,{loading:e_}]=(0,n.D)(d.MU),[ez,{loading:eA}]=(0,n.D)(d.S9),eE=(null==eg?void 0:null===(D=eg.agent_sessionsPagination)||void 0===D?void 0:D.items)||[],eM=(null==ew?void 0:null===(L=ew.agentsPagination)||void 0===L?void 0:L.items)||[],eO=a.useMemo(()=>J?eM.filter(e=>e.name.toLowerCase().includes(J.toLowerCase())):eM,[eM,J]),eP=async()=>{if(!er.name.trim()){ed({title:"Validation Error",description:"Project name is required.",variant:"destructive"});return}try{await eh({variables:{id:q.id,input:{name:er.name.trim(),description:er.description.trim()||null,custom_instructions:er.custom_instructions.trim()||null}}}),ed({title:"Success",description:"Project updated successfully!"}),Y(!1)}catch(e){console.error("Error updating project:",e),ed({title:"Error",description:e.message||"Failed to update project. Please try again.",variant:"destructive"})}},eT=async e=>{try{var s,t,i;let a=await eC({variables:{title:"New session with ".concat(e.name),agent:e.id,project:q.id,rights_mode:"projects",RBAC:{projects:[{id:q.id,rights:"read"}]}}}),l=null===(i=a.data)||void 0===i?void 0:null===(t=i.agent_sessionsCreateOne)||void 0===t?void 0:null===(s=t.item)||void 0===s?void 0:s.id;l&&(ed({title:"Success",description:"Session created successfully! Sessions started in a project are accessible for viewing by project members."}),H(!1),ee(""),ea.push("/chat/".concat(e.id,"/").concat(l)))}catch(e){console.error("Error creating session:",e),ed({title:"Error",description:e.message||"Failed to create session. Please try again.",variant:"destructive"})}},eI=async()=>{try{ef(!0),el.deleteItems&&await Promise.all(em.map(async e=>{var s,t;let i=e.split("/")[0],a=e.split("/")[1];if(!i||!a)return;let{data:l}=await ek.mutate({mutation:(0,d.mN)(i,"files_default_context"===i?["s3key"]:[]),variables:{id:a}});if(null===(s=l["".concat(i,"_itemsRemoveOneById")])||void 0===s?void 0:s.s3key)try{await W.QZ.delete(null===(t=l["".concat(i,"_itemsRemoveOneById")])||void 0===t?void 0:t.s3key)}catch(e){console.error("[EXULU] Error deleting file from s3 storage:",e)}})),await Promise.all(eE.map(async e=>{el.deleteSessions?await ez({variables:{id:e.id}}):await eS({variables:{id:e.id,project:null}})})),await ej({variables:{id:q.id}}),ed({title:"Success",description:'Project "'.concat(q.name,'" has been deleted successfully.')}),G(!1),ef(!1),ea.push("/projects")}catch(e){ef(!1),console.error("Error deleting project:",e),ed({title:"Error",description:e.message||"Failed to delete project. Please try again.",variant:"destructive"})}};return(0,i.jsxs)("div",{className:"flex-1 p-6 mt-20",children:[(0,i.jsx)("div",{className:"max-w-5xl mx-auto space-y-6",children:(0,i.jsxs)("div",{className:"flex gap-6 h-full",children:[(0,i.jsxs)("div",{className:"w-80 space-y-4",children:[(0,i.jsx)(h.Zb,{children:(0,i.jsx)(h.aY,{className:"p-4",children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)("h3",{className:"font-semibold text-lg",children:q.name}),(0,i.jsx)("p",{className:"text-muted-foreground text-sm leading-relaxed",children:q.description||"No description provided."})]})})}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)(o.z,{variant:"overview"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("overview"),children:[(0,i.jsx)(g,{className:"h-4 w-4 mr-2"}),"Project information"]}),(0,i.jsxs)(o.z,{variant:"context"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("context"),children:[(0,i.jsx)(y,{className:"h-4 w-4 mr-2"}),"Project files"]}),(0,i.jsxs)(o.z,{variant:"sessions"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("sessions"),children:[(0,i.jsx)(N.Z,{className:"h-4 w-4 mr-2"}),"Project sessions"]}),(0,i.jsxs)(o.z,{variant:"access"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("access"),children:[(0,i.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"Access control"]}),(0,i.jsxs)(o.z,{variant:"settings"===es?"default":"ghost",className:"w-full justify-start",onClick:()=>et("settings"),children:[(0,i.jsx)(g,{className:"h-4 w-4 mr-2"}),"Project settings"]})]})]}),(0,i.jsxs)("div",{className:"flex-1",children:["overview"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(h.Zb,{children:[(0,i.jsxs)(h.Ol,{children:[(0,i.jsx)(h.ll,{children:"Project Information"}),(0,i.jsx)(h.SZ,{children:"Basic information about this project"})]}),(0,i.jsxs)(h.aY,{className:"space-y-4",children:[(0,i.jsx)("div",{className:"grid gap-4",children:(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(m._,{htmlFor:"name",children:"Project Name"}),X?(0,i.jsx)(u.I,{id:"name",value:er.name,onChange:e=>ec({...er,name:e.target.value})}):(0,i.jsx)("p",{className:"text-sm",children:q.name})]})}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(m._,{htmlFor:"description",children:"Description"}),X?(0,i.jsx)(x.g,{id:"description",value:er.description,onChange:e=>ec({...er,description:e.target.value}),rows:3}):(0,i.jsx)("p",{className:"text-sm",children:q.description||"No description provided"})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(m._,{htmlFor:"instructions",children:"Custom Instructions"}),X?(0,i.jsx)(x.g,{id:"instructions",value:er.custom_instructions,onChange:e=>ec({...er,custom_instructions:e.target.value}),rows:4,placeholder:"Enter custom instructions for sessions in this project..."}):(0,i.jsx)("p",{className:"text-sm",children:q.custom_instructions||"No custom instructions set"})]})]}),(0,i.jsx)(h.eW,{children:(0,i.jsx)("div",{className:"flex items-center justify-between",children:(0,i.jsx)("div",{className:"flex gap-2",children:X?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.z,{variant:"outline",onClick:()=>{q&&ec({name:q.name||"",description:q.description||"",custom_instructions:q.custom_instructions||""}),Y(!1)},children:"Cancel"}),(0,i.jsxs)(o.z,{onClick:eP,children:[(0,i.jsx)("span",{children:"Save changes"}),ep&&(0,i.jsx)(O.g,{className:"mr-2"})]})]}):(0,i.jsxs)(o.z,{variant:"outline",onClick:()=>Y(!0),children:[(0,i.jsx)(b.Z,{className:"h-4 w-4 mr-2"}),"Edit"]})})})})]})}),"context"===es&&(0,i.jsx)("div",{className:"space-y-6 w-full",children:(0,i.jsxs)(h.Zb,{children:[(0,i.jsxs)(h.Ol,{children:[(0,i.jsx)(h.ll,{children:"Project context items"}),(0,i.jsx)(h.SZ,{children:"Items that provide context for sessions in this project (max 15 items). Note that different agents may have different file types supported."})]}),(0,i.jsx)(h.aY,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(U,{onConfirm:e=>{let s=[...em,...e.map(e=>"".concat(e.context.id,"/").concat(e.item.id))];console.log("update",s),ex(s),eh({variables:{id:q.id,input:{project_items:s}}})}}),(0,i.jsx)("div",{className:"space-y-2",children:(0,i.jsxs)("div",{className:"space-y-2",children:[(null==em?void 0:em.length)===0&&(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(y,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:"No items added to the project context yet."})]}),(0,i.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-3",children:null==em?void 0:em.map(e=>(0,i.jsx)(K,{gid:e,onRemove:e=>{let s=em.filter(s=>s!==e);ex(s),eh({variables:{id:q.id,input:{project_items:s}}})}},e))})]})})]})})]})}),"sessions"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(h.Zb,{children:[(0,i.jsxs)(h.Ol,{children:[(0,i.jsx)(h.ll,{children:"Project sessions"}),(0,i.jsx)(h.SZ,{children:"Sessions associated with this project"})]}),(0,i.jsx)(h.aY,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)(o.z,{onClick:()=>{H(!0)},className:"w-full",variant:"outline",children:[(0,i.jsx)(k.Z,{className:"h-4 w-4 mr-2"}),"Start new session"]}),(0,i.jsx)("div",{className:"space-y-2",children:eE.map(e=>{let s=(0,P.I)(e,ei);return(0,i.jsxs)("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)(N.Z,{className:"h-4 w-4"}),(0,i.jsx)("div",{children:(0,i.jsx)(I.default,{href:"/chat/".concat(e.agent,"/").concat(e.id),children:(0,i.jsx)("p",{className:"font-medium max-w-[80%] truncate",children:e.title})})})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)(R.u,{children:[(0,i.jsx)(R.aJ,{asChild:!0,children:(0,i.jsx)(o.z,{disabled:!s||e_,variant:"ghost",size:"sm",onClick:()=>{e_||(eS({variables:{id:e.id,project:null}}),eN())},children:(0,i.jsx)(C,{className:"h-4 w-4"})})}),(0,i.jsx)(R._v,{children:(0,i.jsx)("p",{children:"Remove session from project."})})]}),(0,i.jsxs)(R.u,{children:[(0,i.jsx)(R.aJ,{asChild:!0,children:(0,i.jsx)(o.z,{disabled:!s||eA,variant:"ghost",size:"sm",onClick:()=>{eA||(ez({variables:{id:e.id}}),eN())},children:(0,i.jsx)(Z.Z,{className:"h-4 w-4"})})}),(0,i.jsx)(R._v,{children:(0,i.jsx)("p",{children:"Delete session completely."})})]})]})]},e.id)})}),0===eE.length&&!ey&&(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(N.Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:"No sessions found"})]}),ey&&(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(N.Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:"Loading sessions..."})]})]})})]})}),"access"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(h.Zb,{children:[(0,i.jsxs)(h.Ol,{children:[(0,i.jsx)(h.ll,{children:"Access Control"}),(0,i.jsx)(h.SZ,{children:"Control who can access this project"})]}),(0,i.jsx)(h.aY,{children:(0,i.jsx)(A.P,{allowedModes:["private","users","roles"],initialRightsMode:q.rights_mode||"private",initialUsers:null===(F=q.RBAC)||void 0===F?void 0:F.users,initialRoles:null===(B=q.RBAC)||void 0===B?void 0:B.roles,initialProjects:null===(V=q.RBAC)||void 0===V?void 0:V.projects,onChange:(e,s,t,i)=>{eu({rights_mode:e,users:s,roles:t,projects:i})}})}),(0,i.jsx)(h.eW,{children:(0,i.jsxs)(o.z,{onClick:()=>{eh({variables:{id:q.id,input:{rights_mode:eo.rights_mode,RBAC:{users:eo.users,roles:eo.roles,projects:eo.projects}}}})},children:[(0,i.jsx)("span",{children:"Save access rights"}),ep&&(0,i.jsx)(O.g,{className:"ml-2"})]})})]})}),"settings"===es&&(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)(h.Zb,{children:[(0,i.jsxs)(h.Ol,{children:[(0,i.jsx)(h.ll,{children:"Danger Zone"}),(0,i.jsx)(h.SZ,{children:"Permanently delete this project and all associated data"})]}),(0,i.jsx)(h.aY,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"flex items-start gap-3 p-4 border border-destructive/20 rounded-lg bg-destructive/5",children:[(0,i.jsx)(S.Z,{className:"h-5 w-5 text-destructive mt-0.5"}),(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsx)("h4",{className:"font-medium text-destructive",children:"Delete Project"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"This action cannot be undone. This will permanently delete the project and optionally remove all associated context files and sessions."})]})]}),(0,i.jsxs)(j.Vq,{open:Q,onOpenChange:G,children:[(0,i.jsx)(j.hg,{asChild:!0,children:(0,i.jsxs)(o.z,{variant:"destructive",children:[(0,i.jsx)(Z.Z,{className:"h-4 w-4 mr-2"}),"Delete Project"]})}),(0,i.jsxs)(j.cZ,{className:"sm:max-w-md",children:[(0,i.jsxs)(j.fK,{children:[(0,i.jsx)(j.$N,{children:"Delete Project"}),(0,i.jsxs)(j.Be,{children:['Are you sure you want to delete "',q.name,'"? This action cannot be undone.']})]}),(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsx)(v.X,{id:"delete-items",checked:el.deleteItems,onCheckedChange:e=>en(s=>({...s,deleteItems:e}))}),(0,i.jsxs)("label",{htmlFor:"delete-items",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Also delete all context items (",null==em?void 0:em.length," items)"]})]}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsx)(v.X,{id:"delete-sessions",checked:el.deleteSessions,onCheckedChange:e=>en(s=>({...s,deleteSessions:e}))}),(0,i.jsxs)("label",{htmlFor:"delete-sessions",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Also delete all sessions (",eE.length," sessions)"]})]}),(el.deleteItems||el.deleteSessions)&&(0,i.jsxs)("div",{className:"flex items-start gap-2 p-3 border border-amber-200 rounded-lg bg-amber-50",children:[(0,i.jsx)(S.Z,{className:"h-4 w-4 text-amber-600 mt-0.5"}),(0,i.jsx)("p",{className:"text-sm text-amber-800",children:el.deleteItems&&el.deleteSessions?"All context items and sessions will be permanently deleted.":el.deleteItems?"All context items will be permanently deleted.":"All sessions will be permanently deleted."})]})]}),(0,i.jsxs)(j.cN,{className:"sm:justify-start",children:[(0,i.jsx)(o.z,{variant:"outline",onClick:()=>G(!1),children:"Cancel"}),(0,i.jsxs)(o.z,{disabled:ev,variant:"destructive",onClick:eI,children:[ev?(0,i.jsx)(O.g,{className:"mr-2 w-4 h-4"}):(0,i.jsx)(Z.Z,{className:"h-4 w-4 mr-2"}),"Delete Project"]})]})]})]})]})})]})})]})]})}),(0,i.jsx)(j.Vq,{open:$,onOpenChange:H,children:(0,i.jsxs)(j.cZ,{className:"sm:max-w-4xl",children:[(0,i.jsxs)(j.fK,{children:[(0,i.jsx)(j.$N,{children:"Select an Agent"}),(0,i.jsx)(j.Be,{children:"Choose an agent to start a new chat session. Sessions started in a project are accessible for viewing by project members."})]}),(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)(_.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,i.jsx)(u.I,{placeholder:"Search agents...",value:J,onChange:e=>ee(e.target.value),className:"pl-10"})]}),(0,i.jsx)("div",{className:"max-h-96 overflow-y-auto",children:eb?(0,i.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[...Array(6)].map((e,s)=>(0,i.jsx)("div",{className:"p-4 border rounded-lg",children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)(E.O,{className:"h-12 w-12 rounded-full"}),(0,i.jsxs)("div",{className:"space-y-2 flex-1",children:[(0,i.jsx)(E.O,{className:"h-4 w-3/4"}),(0,i.jsx)(E.O,{className:"h-3 w-1/2"})]})]})},s))}):eO.length>0?(0,i.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:eO.map(e=>(0,i.jsx)("div",{className:"p-4 border rounded-lg hover:border-primary cursor-pointer transition-colors",onClick:()=>eT(e),children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.image?(0,i.jsx)("img",{src:e.image,alt:e.name,className:"h-12 w-12 rounded-full object-cover"}):(0,i.jsx)(z.Z,{className:"h-6 w-6"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"font-medium truncate",children:e.name}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground truncate",children:e.description||"".concat(e.type," agent")}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)(p.C,{variant:e.active?"default":"secondary",className:"text-xs",children:e.active?"Active":"Inactive"}),(0,i.jsx)(p.C,{variant:"outline",className:"text-xs",children:e.type})]})]})]})},e.id))}):(0,i.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,i.jsx)(z.Z,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),(0,i.jsx)("p",{children:J?"No agents found matching your search":"No agents available"})]})})]}),(0,i.jsx)(j.cN,{children:(0,i.jsx)(o.z,{variant:"outline",onClick:()=>H(!1),children:"Cancel"})})]})})]})}function K(e){let{gid:s,onRemove:t}=e,a=s.split("/")[0],l=s.split("/")[1];if(!a||!l)return null;let{data:n,loading:c}=(0,r.aM)((0,d.A1)(a,"files_default_context"===a?["s3key"]:[]),{variables:{id:l}});if(console.log("data",n),c)return null;let o=null==n?void 0:n[a+"_itemsById"];if(!o)return null;let u=Object.values(o||{}).filter(e=>"_s3key"===e);return u.length?(0,i.jsx)(i.Fragment,{children:u.map(e=>(0,i.jsx)(D.jU,{s3Key:e,onRemove:()=>{t(s)},active:!1,disabled:!1}))}):null}var X=t(65613),Y=t(20653);function Q(){let e=(0,l.useParams)(),s=null==e?void 0:e.project,{data:t,loading:a,error:n}=(0,r.aM)(d.jL,{variables:{id:s}});return a?(0,i.jsx)("div",{children:(0,i.jsx)(E.O,{className:"w-full h-full"})}):n?(0,i.jsxs)(X.bZ,{variant:"destructive",children:[(0,i.jsx)(Y.LPM,{className:"size-4"}),(0,i.jsx)(X.Cd,{children:"Error"}),(0,i.jsx)(X.X,{children:"Error loading project."})]}):(null==t?void 0:t.projectById)?(0,i.jsx)(q,{project:t.projectById}):(0,i.jsxs)(X.bZ,{variant:"destructive",children:[(0,i.jsx)(Y.LPM,{className:"size-4"}),(0,i.jsx)(X.Cd,{children:"Error"}),(0,i.jsx)(X.X,{children:"Project not found."})]})}},65613:function(e,s,t){"use strict";t.d(s,{Cd:function(){return d},X:function(){return o},bZ:function(){return c}});var i=t(57437),a=t(90535),l=t(2265),n=t(94508);let r=(0,a.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",info:"border-info/50 text-info dark:border-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}}),c=l.forwardRef((e,s)=>{let{className:t,variant:a,...l}=e;return(0,i.jsx)("div",{ref:s,role:"alert",className:(0,n.cn)(r({variant:a}),t),...l})});c.displayName="Alert";let d=l.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)("h5",{ref:s,className:(0,n.cn)("mb-1 font-medium leading-none tracking-tight",t),...a})});d.displayName="AlertTitle";let o=l.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,i.jsx)("div",{ref:s,className:(0,n.cn)("text-sm [&_p]:leading-relaxed",t),...a})});o.displayName="AlertDescription"},19060:function(e,s,t){"use strict";t.d(s,{X:function(){return c}});var i=t(57437),a=t(9270),l=t(30401),n=t(2265),r=t(94508);let c=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,i.jsx)(a.fC,{ref:s,className:(0,r.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...n,children:(0,i.jsx)(a.z$,{className:(0,r.cn)("flex items-center justify-center text-current"),children:(0,i.jsx)(l.Z,{className:"size-4"})})})});c.displayName=a.fC.displayName},10492:function(e,s,t){"use strict";t.d(s,{g:function(){return l}});var i=t(57437),a=t(94508);let l=e=>{let{className:s}=e;return(0,i.jsxs)("svg",{"aria-hidden":"true",role:"status",className:(0,a.cn)("inline w-4 h-4 text-white animate-spin fill-inherit",s),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",className:"fill-inherit opacity-20"}),(0,i.jsx)("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",className:"fill-inherit"})]})}},77992:function(e,s,t){"use strict";t.d(s,{Am:function(){return u},pm:function(){return m}});var i=t(2265);let a=0,l=new Map,n=e=>{if(l.has(e))return;let s=setTimeout(()=>{l.delete(e),o({type:"REMOVE_TOAST",toastId:e})},1e6);l.set(e,s)},r=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?n(t):e.toasts.forEach(e=>{n(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},c=[],d={toasts:[]};function o(e){d=r(d,e),c.forEach(e=>{e(d)})}function u(e){let{...s}=e,t=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),i=()=>o({type:"DISMISS_TOAST",toastId:t});return o({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||i()}}}),{id:t,dismiss:i,update:e=>o({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function m(){let[e,s]=i.useState(d);return i.useEffect(()=>(c.push(s),()=>{let e=c.indexOf(s);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>o({type:"DISMISS_TOAST",toastId:e})}}},78361:function(e,s,t){"use strict";t.d(s,{jF:function(){return O},jU:function(){return I},ZP:function(){return P},NF:function(){return D}});var i=t(57437),a=t(2265),l=t(47632),n=t(1109);t(46693),t(51832);var r=t(6374),c=t(44045);let d=async e=>{var s;if(!e.backend)throw Error("No backend set.");let{callbacks:t,maxNumberOfFiles:i,uppyOptions:a}=e||{},{uploadSuccess:c}=t||{},{allowedFileTypes:d,id:o}=a||{},u=await (0,r.LP)(),m=new l.Z({autoProceed:!0,debug:!1,id:o||"uppy",restrictions:{maxNumberOfFiles:i||5,allowedFileTypes:d||[".heic",".jpg",".jpeg",".png",".webp",".svg"]}}).use(n.Z,{id:"Exulu",endpoint:e.backend,headers:{Authorization:"Bearer ".concat(u),Session:null!==(s=localStorage.getItem("session"))&&void 0!==s?s:""}}).on("file-added",async e=>{console.debug("added",e)}).on("upload-error",(e,s)=>{(null==e?void 0:e.id)&&(m.removeFile(null==e?void 0:e.id),console.error("error",s))}).on("upload-success",(e,s)=>{s.uploadURL&&c&&(console.log("response",s),c({file:e,key:s.uploadURL.split("/").pop()||"",url:s.uploadURL}))});return m};var o=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(0,a.useContext)(c.E),[i,l]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>((async()=>{l(await d({...e,backend:(null==t?void 0:t.backend)||""}))})(),()=>{i&&(i.destroy(),l(void 0))}),[...s]),i},u=t(80007),m=t(92735),x=t(88964),h=t(30044),p=t(92451),j=t(10407),v=t(48736),f=t(53113),g=t(69658),y=t(99397),N=t(32489),w=t(15001),b=t(62869),k=t(26110),C=t(19378),Z=t(78298),S=t(11713),_=t(21770),z=t(95186),A=t(20653),E=t(66070),M=t(93022);function O(e){let{s3key:s,children:t}=e,{data:l,isLoading:n,error:c,refetch:d}=(0,S.a)({queryKey:["fileObject",s],queryFn:async()=>s?await r.QZ.object(s):null,enabled:null!=s});if((0,a.useEffect)(()=>{s&&d()},[s]),!s)return(0,i.jsx)(E.Zb,{children:(0,i.jsxs)(E.aY,{className:"p-3 flex",children:[(0,i.jsx)("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),t]})});let o=s,u="";if(s.includes("[bucket:")){var x,h;u=(null===(x=s.split("[bucket:")[1])||void 0===x?void 0:x.split("]")[0])||"",(null==(o=(null===(h=s.split("[bucket:")[1])||void 0===h?void 0:h.split("]")[0])||"")?void 0:o.length)&&(o=s.split("]")[1]||"")}return o=o.split("_EXULU_").pop()||"",(0,i.jsxs)(E.Zb,{children:[(0,i.jsx)(E.Ol,{className:"pb-3",children:(0,i.jsx)(E.ll,{className:"text-sm max-w-[500px] truncate",children:o})}),(0,i.jsxs)(E.aY,{className:"pt-0",children:[n&&(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(M.O,{className:"h-4 w-full"}),(0,i.jsx)(M.O,{className:"h-4 w-2/3"})]}),!n&&l&&(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,i.jsxs)("span",{className:"capitalize",children:[null==l?void 0:l.ContentType.split("/").pop(),u&&" [Bucket: ".concat(u,"]")]}),(0,i.jsxs)("span",{children:[((null==l?void 0:l.ContentLength)/1024/1024).toFixed(2)," MB"]})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,i.jsxs)("span",{children:["Last modified: ",new Date(null==l?void 0:l.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,i.jsxs)(b.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{r.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,i.jsx)("span",{className:"mr-1 text-xs",children:"View"}),(0,i.jsx)(m.Z,{className:"h-3 w-3"})]})]})]}),!n&&c&&(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:c.message}),t]})]})}function P(e){let{id:s,allowedFileTypes:t,dependencies:l,onConfirm:n,selectionLimit:r,buttonText:c}=e,[d,o]=(0,a.useState)(!1);return(0,i.jsxs)(k.Vq,{open:d,onOpenChange:o,children:[(0,i.jsx)(k.hg,{asChild:!0,children:(0,i.jsxs)(b.z,{variant:"outline",children:[c&&(0,i.jsx)("span",{className:"mr-2",children:c}),(0,i.jsx)(x.Z,{className:"h-4 w-4"})]})}),(0,i.jsxs)(k.cZ,{className:"sm:max-w-[900px]",children:[(0,i.jsxs)(k.fK,{children:[(0,i.jsx)(k.$N,{children:"File Gallery"}),(0,i.jsx)(k.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),(0,i.jsx)(T,{id:s,allowedFileTypes:t,dependencies:l,selectionLimit:r,onConfirm:e=>{n(e),o(!1)}})]})]})}let T=e=>{var s,t;let{id:l,allowedFileTypes:n,dependencies:d,onConfirm:m,selectionLimit:x}=e;n||(n=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[v,f]=(0,a.useState)(void 0),[g,y]=(0,a.useState)(void 0),[N,w]=(0,a.useState)(void 0),k=(0,a.useContext)(c.E),[E,O]=(0,a.useState)([]),P=e=>{if(E.includes(e)){O(E.filter(s=>s!==e));return}if(1===x){O([e]);return}E.length>=x||O([...E,e])},T=(0,_.D)({mutationFn:async e=>{let{key:s}=e;await r.QZ.delete(s),F()}}),{data:R,isLoading:D,error:L,refetch:F}=(0,S.a)({queryKey:["filesQuery",v,N],staleTime:3e4,queryFn:async()=>r.QZ.list({search:v,continuationToken:N})});console.log("!! data !!",R);let{theme:B}=(0,Z.F)(),U=o({backend:(null==k?void 0:k.backend)||"",uppyOptions:{id:l,allowedFileTypes:n},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},d);return((0,a.useEffect)(()=>{F()},[v,N]),U)?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,i.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,i.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),(0,i.jsx)(z.I,{placeholder:"Search files...",value:v,onChange:e=>f(e.target.value),className:"mb-3"}),(0,i.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,i.jsxs)("span",{children:[E.length," / ",x," files selected"]}),(0,i.jsxs)("span",{children:["Allowed file types: ",null==n?void 0:n.map(e=>e).join(", ")]})]}),(0,i.jsxs)(C.x,{children:[D&&(0,i.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"}),(0,i.jsx)(M.O,{className:"h-[120px] w-full"})]}),(0,i.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!D&&!(null==R?void 0:null===(s=R.Contents)||void 0===s?void 0:s.length)&&(0,i.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[(0,i.jsx)(h.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),(0,i.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),null==R?void 0:null===(t=R.Contents)||void 0===t?void 0:t.map(e=>(0,i.jsx)(I,{s3Key:e.Key,onSelect:P,active:E.some(s=>s===e.Key),onRemove:()=>{T.mutate({key:e.Key})},disabled:!!n&&!(null==n?void 0:n.some(s=>e.Key.endsWith(s)))}))]}),(0,i.jsx)("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsxs)(b.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{w(void 0)},disabled:!N||D,children:[(0,i.jsx)("span",{className:"sr-only",children:"Go to first page"}),(0,i.jsx)(A.kRt,{className:"size-4"})]}),(0,i.jsxs)(b.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{w(g)},disabled:!N||D,children:[(0,i.jsx)("span",{className:"sr-only",children:"Go to previous page"}),(0,i.jsx)(p.Z,{className:"size-4"})]}),(0,i.jsxs)(b.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{y(N),w(null==R?void 0:R.NextContinuationToken)},disabled:!(null==R?void 0:R.NextContinuationToken)||D,children:[(0,i.jsx)("span",{className:"sr-only",children:"Go to next page"}),(0,i.jsx)(j.Z,{className:"size-4"})]})]})})]})]}),(0,i.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,i.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),(0,i.jsx)(u.A,{uppy:U,theme:"dark"===B?"dark":"light"})]})]}),(0,i.jsx)("div",{className:"flex justify-end",children:(0,i.jsx)(b.z,{variant:"outline",onClick:()=>{m(E),O([])},children:"Confirm"})})]}):null},I=e=>{let{s3Key:s,onSelect:t,onRemove:a,active:l,disabled:n,addToContext:c}=e;return(0,i.jsxs)("div",{className:"".concat(n?"opacity-50":""," group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ").concat(l?"border border-purple-500":"border"),onClick:()=>{!n&&t&&t(s)},children:[(0,i.jsx)("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:s&&(s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg"))?(0,i.jsx)(L,{fileKey:s}):(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[s?s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg")?(0,i.jsx)(f.Z,{className:"h-6 w-6 text-blue-500"}):s.endsWith("pdf")?(0,i.jsx)(g.Z,{className:"h-6 w-6 text-red-500"}):s.endsWith("xls")||s.endsWith("xlsx")||s.endsWith("csv")?(0,i.jsx)(v.Z,{className:"h-6 w-6 text-green-500"}):s.endsWith("ppt")||s.endsWith("pptx")?(0,i.jsx)(v.Z,{className:"h-6 w-6 text-orange-500"}):(0,i.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}):(0,i.jsx)(v.Z,{className:"h-6 w-6 text-gray-500"}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:s?s.split("_EXULU_").pop():s})]})}),(0,i.jsx)("p",{className:"text-xs truncate",children:s?s.split("_EXULU_").pop():s}),(0,i.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[c&&(0,i.jsxs)(b.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{c(s)},children:[(0,i.jsx)(y.Z,{className:"h-3 w-3"}),(0,i.jsx)("span",{className:"sr-only",children:"Add"})]}),(0,i.jsxs)(b.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{r.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,i.jsx)(m.Z,{className:"h-3 w-3"}),(0,i.jsx)("span",{className:"sr-only",children:"View"})]}),a&&(0,i.jsxs)(b.z,{onClick:e=>{e.stopPropagation(),a(s)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[(0,i.jsx)(N.Z,{className:"h-3 w-3"}),(0,i.jsx)("span",{className:"sr-only",children:"Remove"})]})]})]},s)},R={},D=async e=>{if(R[e]){if(!(R[e].expiresAt<Date.now()))return R[e].url;delete R[e]}let s=await r.QZ.download(e),t=await s.json();return console.log("json",t),R[e]={url:t.url,expiresAt:Date.now()+6e4},t.url},L=e=>{let{fileKey:s}=e;console.log("key",s);let t=(0,S.a)({queryKey:["imageQuery",s],staleTime:3e4,queryFn:async()=>D(s)});return t.isLoading?(0,i.jsx)("div",{children:(0,i.jsx)(w.Z,{})}):t.isLoading||t.data?(0,i.jsx)("img",{src:t.data,alt:s,className:"object-cover w-full h-full"}):(0,i.jsx)("div",{children:(0,i.jsx)(h.Z,{})})}},36399:function(e,s,t){"use strict";t.d(s,{t:function(){return l}});var i=t(27689),a=t(7211);let l=()=>(0,a.aM)(i.uw,{variables:{limit:20}})},87393:function(e,s,t){"use strict";t.d(s,{I:function(){return i}});let i=(e,s)=>{var t,i,a,l,n,r;let c="private"===e.rights_mode,d="public"===e.rights_mode,o="users"===e.rights_mode,u="roles"===e.rights_mode,m=s.super_admin,x=e.created_by===s.id.toString(),h=!1;return c&&x&&(h=!0),d&&(h=!0),o&&(h=(null===(a=e.RBAC)||void 0===a?void 0:null===(i=a.users)||void 0===i?void 0:null===(t=i.find(e=>e.id===s.id))||void 0===t?void 0:t.rights)==="write"),u&&(h=(null===(r=e.RBAC)||void 0===r?void 0:null===(n=r.roles)||void 0===n?void 0:null===(l=n.find(e=>{var t;return e.id===(null===(t=s.role)||void 0===t?void 0:t.id)}))||void 0===l?void 0:l.rights)==="write"),m&&(h=!0),h}},63639:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},24156:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},14924:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},29202:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(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"}]])},66337:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},53417:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},45675:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},88906:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});let i=(0,t(39763).Z)("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}]])},9270:function(e,s,t){"use strict";t.d(s,{fC:function(){return N},z$:function(){return b}});var i=t(2265),a=t(98575),l=t(73966),n=t(6741),r=t(80886),c=t(6718),d=t(90420),o=t(71599),u=t(66840),m=t(57437),x="Checkbox",[h,p]=(0,l.b)(x),[j,v]=h(x);function f(e){let{__scopeCheckbox:s,checked:t,children:a,defaultChecked:l,disabled:n,form:c,name:d,onCheckedChange:o,required:u,value:h="on",internal_do_not_use_render:p}=e,[v,f]=(0,r.T)({prop:t,defaultProp:null!=l&&l,onChange:o,caller:x}),[g,y]=i.useState(null),[N,w]=i.useState(null),b=i.useRef(!1),k=!g||!!c||!!g.closest("form"),C={checked:v,disabled:n,setChecked:f,control:g,setControl:y,name:d,form:c,value:h,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:!Z(l)&&l,isFormControl:k,bubbleInput:N,setBubbleInput:w};return(0,m.jsx)(j,{scope:s,...C,children:"function"==typeof p?p(C):a})}var g="CheckboxTrigger",y=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,onKeyDown:l,onClick:r,...c}=e,{control:d,value:o,disabled:x,checked:h,required:p,setControl:j,setChecked:f,hasConsumerStoppedPropagationRef:y,isFormControl:N,bubbleInput:w}=v(g,t),b=(0,a.e)(s,j),k=i.useRef(h);return i.useEffect(()=>{let e=null==d?void 0:d.form;if(e){let s=()=>f(k.current);return e.addEventListener("reset",s),()=>e.removeEventListener("reset",s)}},[d,f]),(0,m.jsx)(u.WV.button,{type:"button",role:"checkbox","aria-checked":Z(h)?"mixed":h,"aria-required":p,"data-state":S(h),"data-disabled":x?"":void 0,disabled:x,value:o,...c,ref:b,onKeyDown:(0,n.M)(l,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,n.M)(r,e=>{f(e=>!!Z(e)||!e),w&&N&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})})});y.displayName=g;var N=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,name:i,checked:a,defaultChecked:l,required:n,disabled:r,value:c,onCheckedChange:d,form:o,...u}=e;return(0,m.jsx)(f,{__scopeCheckbox:t,checked:a,defaultChecked:l,disabled:r,required:n,onCheckedChange:d,name:i,form:o,value:c,internal_do_not_use_render:e=>{let{isFormControl:i}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(y,{...u,ref:s,__scopeCheckbox:t}),i&&(0,m.jsx)(C,{__scopeCheckbox:t})]})}})});N.displayName=x;var w="CheckboxIndicator",b=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,forceMount:i,...a}=e,l=v(w,t);return(0,m.jsx)(o.z,{present:i||Z(l.checked)||!0===l.checked,children:(0,m.jsx)(u.WV.span,{"data-state":S(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...e.style}})})});b.displayName=w;var k="CheckboxBubbleInput",C=i.forwardRef((e,s)=>{let{__scopeCheckbox:t,...l}=e,{control:n,hasConsumerStoppedPropagationRef:r,checked:o,defaultChecked:x,required:h,disabled:p,name:j,value:f,form:g,bubbleInput:y,setBubbleInput:N}=v(k,t),w=(0,a.e)(s,N),b=(0,c.D)(o),C=(0,d.t)(n);i.useEffect(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,s=!r.current;if(b!==o&&e){let t=new Event("click",{bubbles:s});y.indeterminate=Z(o),e.call(y,!Z(o)&&o),y.dispatchEvent(t)}},[y,b,o,r]);let S=i.useRef(!Z(o)&&o);return(0,m.jsx)(u.WV.input,{type:"checkbox","aria-hidden":!0,defaultChecked:null!=x?x:S.current,required:h,disabled:p,name:j,value:f,form:g,...l,tabIndex:-1,ref:w,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function Z(e){return"indeterminate"===e}function S(e){return Z(e)?"indeterminate":e?"checked":"unchecked"}C.displayName=k},6394:function(e,s,t){"use strict";t.d(s,{f:function(){return r}});var i=t(2265),a=t(66840),l=t(57437),n=i.forwardRef((e,s)=>(0,l.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{var t;s.target.closest("button, input, select, textarea")||(null===(t=e.onMouseDown)||void 0===t||t.call(e,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));n.displayName="Label";var r=n}},function(e){e.O(0,[6840,8310,9851,7629,7093,6148,847,1942,7648,7823,8068,5799,605,4567,1206,5338,1785,5110,3171,1713,4811,6373,3832,8030,2971,2117,1744],function(){return e(e.s=62839)}),_N_E=e.O()}]);
2
+ //# sourceMappingURL=page-bc859da58d8505f7.js.map