@exulu/frontend 1.7.0 → 1.9.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 (167) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +124 -127
  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.js +1 -1
  7. package/dist/.next/server/app/(application)/agents/edit/[id]/page.js.nft.json +1 -1
  8. package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
  9. package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
  10. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +7 -7
  11. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js.nft.json +1 -1
  12. package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
  13. package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
  14. package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
  15. package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
  16. package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
  17. package/dist/.next/server/app/(application)/data/[[...query]]/page.js +4 -4
  18. package/dist/.next/server/app/(application)/data/[[...query]]/page.js.nft.json +1 -1
  19. package/dist/.next/server/app/(application)/data/[[...query]]/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/(application)/evals/[id]/page.js +1 -1
  21. package/dist/.next/server/app/(application)/evals/[id]/page.js.nft.json +1 -1
  22. package/dist/.next/server/app/(application)/evals/[id]/page_client-reference-manifest.js +1 -1
  23. package/dist/.next/server/app/(application)/evals/cases/page.js +1 -1
  24. package/dist/.next/server/app/(application)/evals/cases/page.js.nft.json +1 -1
  25. package/dist/.next/server/app/(application)/evals/cases/page_client-reference-manifest.js +1 -1
  26. package/dist/.next/server/app/(application)/evals/page_client-reference-manifest.js +1 -1
  27. package/dist/.next/server/app/(application)/explorer/page_client-reference-manifest.js +1 -1
  28. package/dist/.next/server/app/(application)/keys/page_client-reference-manifest.js +1 -1
  29. package/dist/.next/server/app/(application)/page_client-reference-manifest.js +1 -1
  30. package/dist/.next/server/app/(application)/projects/[project]/page.js +1 -1
  31. package/dist/.next/server/app/(application)/projects/[project]/page.js.nft.json +1 -1
  32. package/dist/.next/server/app/(application)/projects/[project]/page_client-reference-manifest.js +1 -1
  33. package/dist/.next/server/app/(application)/projects/page.js +1 -1
  34. package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
  35. package/dist/.next/server/app/(application)/prompts/page.js +1 -1
  36. package/dist/.next/server/app/(application)/prompts/page_client-reference-manifest.js +1 -1
  37. package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
  38. package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
  39. package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
  40. package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
  41. package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
  42. package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
  43. package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
  44. package/dist/.next/server/app/(application)/workflows/page.js +1 -1
  45. package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
  46. package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
  47. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  48. package/dist/.next/server/app/_not-found.html +1 -1
  49. package/dist/.next/server/app/_not-found.rsc +1 -1
  50. package/dist/.next/server/app/api/auth/[...nextauth]/route.js +2 -2
  51. package/dist/.next/server/app-paths-manifest.json +4 -4
  52. package/dist/.next/server/chunks/1025.js +1 -0
  53. package/dist/.next/server/chunks/1051.js +2 -2
  54. package/dist/.next/server/chunks/2270.js +12 -48
  55. package/dist/.next/server/chunks/3434.js +1 -1
  56. package/dist/.next/server/chunks/3503.js +1 -0
  57. package/dist/.next/server/chunks/3575.js +1 -1
  58. package/dist/.next/server/chunks/5084.js +1 -0
  59. package/dist/.next/server/chunks/5192.js +1 -1
  60. package/dist/.next/server/chunks/5485.js +1 -0
  61. package/dist/.next/server/chunks/5600.js +1 -1
  62. package/dist/.next/server/chunks/5974.js +1 -0
  63. package/dist/.next/server/chunks/6590.js +1 -1
  64. package/dist/.next/server/chunks/7471.js +1 -1
  65. package/dist/.next/server/chunks/8286.js +1 -1
  66. package/dist/.next/server/chunks/{3679.js → 9874.js} +5 -5
  67. package/dist/.next/server/middleware-manifest.json +5 -5
  68. package/dist/.next/server/pages/404.html +1 -1
  69. package/dist/.next/server/pages/500.html +1 -1
  70. package/dist/.next/server/server-reference-manifest.json +1 -1
  71. package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js +2 -0
  72. package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js.map +1 -0
  73. package/dist/.next/static/chunks/{4811-316807e25b634f9f.js → 192-72d6868cd891ccc6.js} +8 -8
  74. package/dist/.next/static/chunks/192-72d6868cd891ccc6.js.map +1 -0
  75. package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js +2 -0
  76. package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js.map +1 -0
  77. package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js +2 -0
  78. package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js.map +1 -0
  79. package/dist/.next/static/chunks/{3750-90a213a3c7cceb29.js → 3750-f45c59ef1cc79417.js} +2 -2
  80. package/dist/.next/static/chunks/3750-f45c59ef1cc79417.js.map +1 -0
  81. package/dist/.next/static/chunks/552-39155a93c527ec6d.js +2 -0
  82. package/dist/.next/static/chunks/552-39155a93c527ec6d.js.map +1 -0
  83. package/dist/.next/static/chunks/{7856-9fa733bdd6429ba8.js → 6066-65606593516b2a3a.js} +18 -18
  84. package/dist/.next/static/chunks/6066-65606593516b2a3a.js.map +1 -0
  85. package/dist/.next/static/chunks/6367-59655a85d75e19be.js +2 -0
  86. package/dist/.next/static/chunks/6367-59655a85d75e19be.js.map +1 -0
  87. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js +2 -0
  88. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js.map +1 -0
  89. package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js +2 -0
  90. package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js.map +1 -0
  91. package/dist/.next/static/chunks/{6805-792cc8008b165c07.js → 8293-0e69d89d2dac7111.js} +10 -10
  92. package/dist/.next/static/chunks/8293-0e69d89d2dac7111.js.map +1 -0
  93. package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js +2 -0
  94. package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js.map +1 -0
  95. package/dist/.next/static/chunks/9953-95900a236271a222.js +2 -0
  96. package/dist/.next/static/chunks/9953-95900a236271a222.js.map +1 -0
  97. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js +2 -0
  98. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js.map +1 -0
  99. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js +2 -0
  100. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js.map +1 -0
  101. package/dist/.next/static/chunks/app/(application)/chat/layout-093baa26f89338bc.js +2 -0
  102. package/dist/.next/static/chunks/app/(application)/chat/layout-093baa26f89338bc.js.map +1 -0
  103. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js +2 -0
  104. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js.map +1 -0
  105. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js +2 -0
  106. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js.map +1 -0
  107. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js → page-827f50c6d1f150d0.js} +2 -2
  108. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js.map → page-827f50c6d1f150d0.js.map} +1 -1
  109. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js +2 -0
  110. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js.map +1 -0
  111. package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js +2 -0
  112. package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js.map +1 -0
  113. package/dist/.next/static/chunks/app/(application)/workflows/{page-47dedb88cec600d5.js → page-e38f9456120dab69.js} +2 -2
  114. package/dist/.next/static/chunks/app/(application)/workflows/page-e38f9456120dab69.js.map +1 -0
  115. package/dist/.next/static/css/6f8c5212af8ef284.css +4 -0
  116. package/dist/.next/static/css/6f8c5212af8ef284.css.map +1 -0
  117. package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
  118. package/dist/package.json +1 -0
  119. package/package.json +1 -1
  120. package/dist/.next/server/chunks/2948.js +0 -1
  121. package/dist/.next/server/chunks/38.js +0 -1
  122. package/dist/.next/server/chunks/6623.js +0 -1
  123. package/dist/.next/server/chunks/7958.js +0 -1
  124. package/dist/.next/server/chunks/8050.js +0 -1
  125. package/dist/.next/static/chunks/1685-39351b8a15bbecab.js +0 -2
  126. package/dist/.next/static/chunks/1685-39351b8a15bbecab.js.map +0 -1
  127. package/dist/.next/static/chunks/1957-899d0d6d0d9c11fd.js +0 -2
  128. package/dist/.next/static/chunks/1957-899d0d6d0d9c11fd.js.map +0 -1
  129. package/dist/.next/static/chunks/3750-90a213a3c7cceb29.js.map +0 -1
  130. package/dist/.next/static/chunks/4811-316807e25b634f9f.js.map +0 -1
  131. package/dist/.next/static/chunks/5282-68f9880f1f951f44.js +0 -2
  132. package/dist/.next/static/chunks/5282-68f9880f1f951f44.js.map +0 -1
  133. package/dist/.next/static/chunks/6367-59cef3c74213925b.js +0 -2
  134. package/dist/.next/static/chunks/6367-59cef3c74213925b.js.map +0 -1
  135. package/dist/.next/static/chunks/6373-7908bd5269f95aa3.js +0 -2
  136. package/dist/.next/static/chunks/6373-7908bd5269f95aa3.js.map +0 -1
  137. package/dist/.next/static/chunks/6805-792cc8008b165c07.js.map +0 -1
  138. package/dist/.next/static/chunks/7856-9fa733bdd6429ba8.js.map +0 -1
  139. package/dist/.next/static/chunks/8030-c1b6be46253076cb.js +0 -2
  140. package/dist/.next/static/chunks/8030-c1b6be46253076cb.js.map +0 -1
  141. package/dist/.next/static/chunks/8269-0e17dac508340ccf.js +0 -2
  142. package/dist/.next/static/chunks/8269-0e17dac508340ccf.js.map +0 -1
  143. package/dist/.next/static/chunks/9105-78d236e8399181e0.js +0 -2
  144. package/dist/.next/static/chunks/9105-78d236e8399181e0.js.map +0 -1
  145. package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js +0 -2
  146. package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js.map +0 -1
  147. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js +0 -2
  148. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js.map +0 -1
  149. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-29794b9c33d2bf7e.js +0 -2
  150. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-29794b9c33d2bf7e.js.map +0 -1
  151. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-57021bb06089261a.js +0 -2
  152. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-57021bb06089261a.js.map +0 -1
  153. package/dist/.next/static/chunks/app/(application)/chat/layout-42021d301fc609b6.js +0 -2
  154. package/dist/.next/static/chunks/app/(application)/chat/layout-42021d301fc609b6.js.map +0 -1
  155. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-841b2ed48010048e.js +0 -2
  156. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-841b2ed48010048e.js.map +0 -1
  157. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c1e7e0c81ca508c3.js +0 -2
  158. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c1e7e0c81ca508c3.js.map +0 -1
  159. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-0b2d9832e5a023e7.js +0 -2
  160. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-0b2d9832e5a023e7.js.map +0 -1
  161. package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js +0 -2
  162. package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js.map +0 -1
  163. package/dist/.next/static/chunks/app/(application)/workflows/page-47dedb88cec600d5.js.map +0 -1
  164. package/dist/.next/static/css/a181dac3df0dc7a7.css +0 -4
  165. package/dist/.next/static/css/a181dac3df0dc7a7.css.map +0 -1
  166. /package/dist/.next/static/{J23NmkaMjAJYnE0jX_kO0 → ls-syPkq9-MWp-VWWDEZJ}/_buildManifest.js +0 -0
  167. /package/dist/.next/static/{J23NmkaMjAJYnE0jX_kO0 → ls-syPkq9-MWp-VWWDEZJ}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";exports.id=5600,exports.ids=[5600],exports.modules={15286:(e,s,a)=>{a.d(s,{P:()=>C});var t=a(10326),r=a(42270),l=a(17577),i=a(88571),d=a(39167),n=a(34474),o=a(9015),c=a(24061),m=a(88378),x=a(54014),f=a(65983),p=a(47206),u=a(32933),h=a(75290),g=a(98091),N=a(54432),j=a(62288),y=a(65685),v=a(77863),b=a(30811),w=a(2454),k=a(90772),R=a(31048);let z=[{value:"private",label:"Private",description:"Only you can see this agent",icon:o.Z},{value:"users",label:"Shared with Users",description:"Share with specific users",icon:c.Z},{value:"roles",label:"Shared with Roles",description:"Share with specific roles",icon:m.Z},{value:"public",label:"Public",description:"Anyone can see this agent",icon:x.Z},{value:"projects",label:"Projects",description:"Share with specific projects",icon:f.Z}];function C({allowedModes:e,initialRightsMode:s,modalMode:a=!1,initialUsers:o,initialRoles:c,initialProjects:m,onChange:x}){let[f,C]=(0,l.useState)(s),[S,Z]=(0,l.useState)(o||[]),[Y,_]=(0,l.useState)(c||[]),[P,V]=(0,l.useState)([]),[B,O]=(0,l.useState)(!1),[Q,I]=(0,l.useState)([]),[L,q]=(0,l.useState)(""),[D,A]=(0,l.useState)(!1),[F,G]=(0,l.useState)(!1),U=(0,i.x)(),{data:W,loading:$,refetch:J}=(0,d.aM)(r.fo,{variables:{page:1,limit:5,filters:Q},skip:"users"!==f||!L}),T=(0,d.aM)(r.l1,{fetchPolicy:"cache-first",nextFetchPolicy:"network-only",variables:{page:1,limit:30,filters:[{type:{ne:"api"}}]}}),E=(0,l.useCallback)(e=>{q(e);let s=[...Q,{type:{ne:"api"}}],a=s.find(e=>e.email);a?.email?a.email.contains=e:s.push({email:{contains:e}}),I(s),J()},[Q,J]),H=async(e=5)=>{if(G(!0),!S||0===S.length){V([]),G(!1);return}let s=S?.slice(0,e).map(async({id:e,rights:s})=>({...(await U.query({query:r.L5,variables:{id:e}})).data.userById,rights:s}));V(await Promise.all(s)),G(!1)},K=P?.slice(0,5).filter(e=>!!e?.id),M=z;return e?.length&&(M=z.filter(s=>e.includes(s.value))),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(R._,{className:"text-sm font-medium",children:"Visibility & sharing"}),(0,t.jsxs)(b.J2,{modal:a||!1,open:B,onOpenChange:O,children:[t.jsx(b.xo,{asChild:!0,children:(0,t.jsxs)(k.z,{variant:"outline",role:"combobox","aria-expanded":B,className:"w-full justify-between text-sm capitalize",children:[M.find(e=>e.value===f)?.label||"Select visibility...",t.jsx(p.Z,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(b.yk,{className:"w-full p-0",children:(0,t.jsxs)(w.mY,{children:[t.jsx(w.sZ,{placeholder:"Search options..."}),(0,t.jsxs)(w.e8,{children:[t.jsx(w.rb,{children:"No options found."}),t.jsx(w.fu,{children:M.map(e=>(0,t.jsxs)(w.di,{onSelect:()=>{"users"!==e.value&&Z([]),"roles"!==e.value&&_([]),C(e.value),O(!1)},children:[t.jsx(u.Z,{className:(0,v.cn)("mr-2 h-4 w-4",f===e.value?"opacity-100":"opacity-0")}),(0,t.jsxs)("div",{className:"flex flex-col",children:[t.jsx("span",{children:e.label}),t.jsx("span",{className:"text-xs text-muted-foreground",children:e.description})]})]},e.value))})]})]})})]})]}),"users"===f&&t.jsx("div",{className:"space-y-3 pt-3",children:(0,t.jsxs)("div",{children:[t.jsx(R._,{className:"text-sm font-medium",children:"Share with users"}),t.jsx("div",{className:"mt-2",children:t.jsx(N.I,{placeholder:"Search users by email...",value:L,onChange:e=>E(e.target.value),className:"text-sm"})}),$&&(0,t.jsxs)("div",{className:"mt-2 flex items-center justify-center py-4",children:[t.jsx(h.Z,{className:"h-4 w-4 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading users..."})]}),!$&&W&&W.usersPagination?.items.length>0&&(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Search Results:"}),t.jsx("div",{className:"max-h-50 overflow-y-auto border rounded-lg",children:W.usersPagination.items.filter(e=>!S.some(s=>s.id===e.id)).map(e=>(0,t.jsxs)("label",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:S.some(s=>s.id===e.id),onChange:s=>{Z(s=>[...s,{id:e.id,rights:"read"}]),V(s=>[...s,{...e,rights:"read"}])}}),t.jsx("span",{className:"text-sm",children:e.email})]},e.id))}),(0,t.jsxs)("div",{className:"text-xs text-muted-foreground mt-2",children:[t.jsx("span",{className:"font-medium",children:"Note:"})," Only the first 5 users are shown, use the Search bar to find more users."]})]}),!$&&L&&W&&0===W.usersPagination.items.length&&t.jsx("div",{className:"mt-2 text-center py-4",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"No users found"})}),K?.length>0?(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Selected Users:"}),(0,t.jsxs)("div",{className:"space-y-1",children:[K.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 border p-2 rounded-lg text-sm",children:[t.jsx("span",{className:"flex-1 pl-2",children:e.email}),(0,t.jsxs)(n.Ph,{value:e.rights,onValueChange:s=>{Z(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a)),V(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a))},children:[t.jsx(n.i4,{className:"h-6 w-20 text-xs",children:t.jsx(n.ki,{})}),(0,t.jsxs)(n.Bw,{children:[t.jsx(n.Ql,{value:"read",children:"Read"}),t.jsx(n.Ql,{value:"write",children:"Write"})]})]}),t.jsx(k.z,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 hover:bg-blue-100",onClick:()=>{Z(s=>s.filter(s=>s.id!==e.id)),V(s=>s.filter(s=>s.id!==e.id))},children:t.jsx(g.Z,{className:"w-3 h-3"})})]},e.id)),S&&S.length>5&&(0,t.jsxs)(k.z,{variant:"link",type:"button",className:"h-auto p-0 text-blue-600 hover:text-blue-800 text-xs",onClick:()=>{H(50),A(!0)},children:["+ ",S.length-5," more users"]})]})]}):t.jsx("div",{className:"mt-2 text-center py-4",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"No users selected."})})]})}),"roles"===f&&t.jsx("div",{className:"space-y-3",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)(R._,{className:"text-sm font-medium",children:["Share with roles (",Y?.length||0,")"]}),(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Available Roles"}),T.loading&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-4 border rounded-lg",children:[t.jsx(h.Z,{className:"h-4 w-4 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading roles..."})]}),!T.loading&&T.data&&t.jsx("div",{className:"max-h-24 overflow-y-auto border rounded-lg",children:T.data.rolesPagination.items.map(e=>(0,t.jsxs)("label",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:Y.some(s=>s.id===e.id),onChange:s=>{s.target.checked?_(s=>[...s,{id:e.id,rights:"read"}]):_(s=>s.filter(s=>s.id!==e.id))}}),t.jsx("span",{className:"text-sm capitalize",children:e.name})]},e.id))})]}),Y.length>0&&T.data&&(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Selected Roles:"}),t.jsx("div",{className:"space-y-1",children:Y.map(e=>{let s=T.data.rolesPagination.items.find(s=>s.id===e.id);return(0,t.jsxs)("div",{className:"flex items-center gap-2 border p-2 rounded-lg text-sm",children:[t.jsx("span",{className:"flex-1 pl-2 capitalize",children:s?.name}),(0,t.jsxs)(n.Ph,{value:e.rights,onValueChange:s=>{_(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a))},children:[t.jsx(n.i4,{className:"h-6 text-xs w-20 border-none",children:t.jsx(n.ki,{})}),(0,t.jsxs)(n.Bw,{children:[t.jsx(n.Ql,{value:"read",children:t.jsx("span",{className:"pr-7",children:"Read"})}),t.jsx(n.Ql,{value:"write",children:t.jsx("span",{className:"pr-7",children:"Write"})})]})]}),t.jsx(k.z,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 hover:bg-blue-100",onClick:()=>{_(s=>s.filter(s=>s.id!==e.id))},children:t.jsx(g.Z,{className:"w-3 h-3"})})]},e.id)})})]})]})}),t.jsx(j.Vq,{open:D,onOpenChange:A,children:(0,t.jsxs)(j.cZ,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col",children:[(0,t.jsxs)(j.fK,{children:[(0,t.jsxs)(j.$N,{children:["All Selected Users (",S?.length||0,")"]}),t.jsx(j.Be,{children:"View and manage all selected users and their permissions"})]}),(0,t.jsxs)(y.x,{className:"flex-1 pr-4",children:[F&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[t.jsx(h.Z,{className:"h-6 w-6 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading users..."})]}),!F&&P.length>0&&t.jsx("div",{className:"space-y-2",children:P.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 border p-3 rounded-lg",children:[t.jsx("span",{className:"flex-1",children:e.email}),(0,t.jsxs)(n.Ph,{value:e.rights,onValueChange:s=>{Z(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a)),V(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a))},children:[t.jsx(n.i4,{className:"w-24",children:t.jsx(n.ki,{})}),(0,t.jsxs)(n.Bw,{children:[t.jsx(n.Ql,{value:"read",children:"Read"}),t.jsx(n.Ql,{value:"write",children:"Write"})]})]}),t.jsx(k.z,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 hover:bg-destructive/10",onClick:()=>{Z(s=>s.filter(s=>s.id!==e.id)),V(s=>s.filter(s=>s.id!==e.id))},children:t.jsx(g.Z,{className:"w-4 h-4"})})]},e.id))}),!F&&0===P.length&&t.jsx("div",{className:"text-center py-8",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"No users selected"})})]})]})})]})}},567:(e,s,a)=>{a.d(s,{C:()=>d});var t=a(10326),r=a(79360);a(17577);var l=a(77863);let i=(0,r.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function d({className:e,variant:s,...a}){return t.jsx("div",{className:(0,l.cn)(i({variant:s}),e),...a})}},33071:(e,s,a)=>{a.d(s,{Ol:()=>d,SZ:()=>o,Zb:()=>i,aY:()=>c,eW:()=>m,ll:()=>n});var t=a(10326),r=a(17577),l=a(77863);let i=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...s}));i.displayName="Card";let d=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",e),...s}));d.displayName="CardHeader";let n=r.forwardRef(({className:e,...s},a)=>t.jsx("h3",{ref:a,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",e),...s}));n.displayName="CardTitle";let o=r.forwardRef(({className:e,...s},a)=>t.jsx("p",{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",e),...s}));o.displayName="CardDescription";let c=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("p-6 pt-0",e),...s}));c.displayName="CardContent";let m=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("flex items-center p-6 pt-0",e),...s}));m.displayName="CardFooter"},2454:(e,s,a)=>{a.d(s,{di:()=>f,e8:()=>c,fu:()=>x,mY:()=>n,rb:()=>m,sZ:()=>o});var t=a(10326),r=a(17170),l=a(88307),i=a(17577);a(62288);var d=a(77863);let n=i.forwardRef(({className:e,...s},a)=>t.jsx(r.mY,{ref:a,className:(0,d.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...s}));n.displayName=r.mY.displayName;let o=i.forwardRef(({className:e,...s},a)=>(0,t.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[t.jsx(l.Z,{className:"mr-2 size-4 shrink-0 opacity-50"}),t.jsx(r.mY.Input,{ref:a,className:(0,d.cn)("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...s})]}));o.displayName=r.mY.Input.displayName;let c=i.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.List,{ref:a,className:(0,d.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...s}));c.displayName=r.mY.List.displayName;let m=i.forwardRef((e,s)=>t.jsx(r.mY.Empty,{ref:s,className:"py-6 text-center text-sm",...e}));m.displayName=r.mY.Empty.displayName;let x=i.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.Group,{ref:a,className:(0,d.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...s}));x.displayName=r.mY.Group.displayName,i.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.Separator,{ref:a,className:(0,d.cn)("-mx-1 h-px bg-border",e),...s})).displayName=r.mY.Separator.displayName;let f=i.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.Item,{ref:a,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s}));f.displayName=r.mY.Item.displayName},62288:(e,s,a)=>{a.d(s,{$N:()=>u,Be:()=>h,Vq:()=>n,cN:()=>p,cZ:()=>x,fK:()=>f,hg:()=>o});var t=a(10326),r=a(98986),l=a(94019),i=a(17577),d=a(77863);let n=r.fC,o=r.xz,c=r.h_;r.x8;let m=i.forwardRef(({className:e,...s},a)=>t.jsx(r.aV,{ref:a,className:(0,d.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...s}));m.displayName=r.aV.displayName;let x=i.forwardRef(({className:e,children:s,...a},i)=>(0,t.jsxs)(c,{children:[t.jsx(m,{}),(0,t.jsxs)(r.VY,{ref:i,className:(0,d.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[s,(0,t.jsxs)(r.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(l.Z,{className:"size-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));x.displayName=r.VY.displayName;let f=({className:e,...s})=>t.jsx("div",{className:(0,d.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...s});f.displayName="DialogHeader";let p=({className:e,...s})=>t.jsx("div",{className:(0,d.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});p.displayName="DialogFooter";let u=i.forwardRef(({className:e,...s},a)=>t.jsx(r.Dx,{ref:a,className:(0,d.cn)("text-lg font-semibold leading-none tracking-tight",e),...s}));u.displayName=r.Dx.displayName;let h=i.forwardRef(({className:e,...s},a)=>t.jsx(r.dk,{ref:a,className:(0,d.cn)("text-sm text-muted-foreground",e),...s}));h.displayName=r.dk.displayName},31048:(e,s,a)=>{a.d(s,{_:()=>o});var t=a(10326),r=a(34478),l=a(79360),i=a(17577),d=a(77863);let n=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=i.forwardRef(({className:e,...s},a)=>t.jsx(r.f,{ref:a,className:(0,d.cn)(n(),e),...s}));o.displayName=r.f.displayName},30811:(e,s,a)=>{a.d(s,{J2:()=>d,xo:()=>n,yk:()=>o});var t=a(10326),r=a(74964),l=a(17577),i=a(77863);let d=r.fC,n=r.xz,o=l.forwardRef(({className:e,align:s="center",sideOffset:a=4,...l},d)=>t.jsx(r.h_,{children:t.jsx(r.VY,{ref:d,align:s,sideOffset:a,className:(0,i.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...l})}));o.displayName=r.VY.displayName},65685:(e,s,a)=>{a.d(s,{B:()=>n,x:()=>d});var t=a(10326),r=a(9261),l=a(17577),i=a(77863);let d=l.forwardRef(({className:e,children:s,...a},l)=>(0,t.jsxs)(r.fC,{ref:l,className:(0,i.cn)("relative overflow-hidden",e),...a,children:[t.jsx(r.l_,{className:"size-full rounded-[inherit]",children:s}),t.jsx(n,{}),t.jsx(r.Ns,{})]}));d.displayName=r.fC.displayName;let n=l.forwardRef(({className:e,orientation:s="vertical",...a},l)=>t.jsx(r.gb,{ref:l,orientation:s,className:(0,i.cn)("flex touch-none select-none transition-colors","vertical"===s&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:t.jsx(r.q4,{className:"relative flex-1 rounded-full bg-border"})}));n.displayName=r.gb.displayName},34474:(e,s,a)=>{a.d(s,{Bw:()=>u,Ph:()=>c,Ql:()=>h,i4:()=>x,ki:()=>m});var t=a(10326),r=a(55423),l=a(941),i=a(96633),d=a(32933),n=a(17577),o=a(77863);let c=r.fC;r.ZA;let m=r.B4,x=n.forwardRef(({className:e,children:s,...a},i)=>(0,t.jsxs)(r.xz,{ref:i,className:(0,o.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...a,children:[s,t.jsx(r.JO,{asChild:!0,children:t.jsx(l.Z,{className:"size-4 opacity-50"})})]}));x.displayName=r.xz.displayName;let f=n.forwardRef(({className:e,...s},a)=>t.jsx(r.u_,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(i.Z,{className:"size-4"})}));f.displayName=r.u_.displayName;let p=n.forwardRef(({className:e,...s},a)=>t.jsx(r.$G,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(l.Z,{className:"size-4"})}));p.displayName=r.$G.displayName;let u=n.forwardRef(({className:e,children:s,position:a="popper",...l},i)=>t.jsx(r.h_,{children:(0,t.jsxs)(r.VY,{ref:i,className:(0,o.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...l,children:[t.jsx(f,{}),t.jsx(r.l_,{className:(0,o.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),t.jsx(p,{})]})}));u.displayName=r.VY.displayName,n.forwardRef(({className:e,...s},a)=>t.jsx(r.__,{ref:a,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=r.__.displayName;let h=n.forwardRef(({className:e,children:s,...a},l)=>(0,t.jsxs)(r.ck,{ref:l,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[t.jsx("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:t.jsx(r.wU,{children:t.jsx(d.Z,{className:"size-4"})})}),t.jsx(r.eT,{children:s})]}));h.displayName=r.ck.displayName,n.forwardRef(({className:e,...s},a)=>t.jsx(r.Z0,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=r.Z0.displayName},87673:(e,s,a)=>{a.d(s,{g:()=>i});var t=a(10326),r=a(17577),l=a(77863);let i=r.forwardRef(({className:e,...s},a)=>t.jsx("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...s}));i.displayName="Textarea"}};
1
+ "use strict";exports.id=5600,exports.ids=[5600],exports.modules={15286:(e,s,a)=>{a.d(s,{P:()=>z});var t=a(10326),r=a(42270),l=a(17577),d=a(88571),i=a(39167),n=a(34474),o=a(9015),c=a(24061),m=a(88378),x=a(54014),f=a(47206),p=a(32933),u=a(75290),h=a(98091),g=a(54432),N=a(62288),j=a(65685),y=a(77863),v=a(30811),b=a(2454),w=a(90772),k=a(31048);let R=[{value:"private",label:"Private",description:"Only you can see this agent",icon:o.Z},{value:"users",label:"Shared with Users",description:"Share with specific users",icon:c.Z},{value:"roles",label:"Shared with Roles",description:"Share with specific roles",icon:m.Z},{value:"public",label:"Public",description:"Anyone can see this agent",icon:x.Z}];function z({allowedModes:e,initialRightsMode:s,modalMode:a=!1,initialUsers:o,initialRoles:c,onChange:m}){let[x,z]=(0,l.useState)(s),[C,S]=(0,l.useState)(o||[]),[Z,Y]=(0,l.useState)(c||[]),[_,V]=(0,l.useState)([]),[P,B]=(0,l.useState)(!1),[O,Q]=(0,l.useState)([]),[I,L]=(0,l.useState)(""),[q,D]=(0,l.useState)(!1),[A,F]=(0,l.useState)(!1),G=(0,d.x)(),{data:U,loading:W,refetch:$}=(0,i.aM)(r.fo,{variables:{page:1,limit:5,filters:O},skip:"users"!==x||!I}),J=(0,i.aM)(r.l1,{fetchPolicy:"cache-first",nextFetchPolicy:"network-only",variables:{page:1,limit:30,filters:[{type:{ne:"api"}}]}}),T=(0,l.useCallback)(e=>{L(e);let s=[...O,{type:{ne:"api"}}],a=s.find(e=>e.email);a?.email?a.email.contains=e:s.push({email:{contains:e}}),Q(s),$()},[O,$]),E=async(e=5)=>{if(F(!0),!C||0===C.length){V([]),F(!1);return}let s=C?.slice(0,e).map(async({id:e,rights:s})=>({...(await G.query({query:r.L5,variables:{id:e}})).data.userById,rights:s}));V(await Promise.all(s)),F(!1)},H=_?.slice(0,5).filter(e=>!!e?.id),K=R;return e?.length&&(K=R.filter(s=>e.includes(s.value))),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(k._,{className:"text-sm font-medium",children:"Visibility & sharing"}),(0,t.jsxs)(v.J2,{modal:a||!1,open:P,onOpenChange:B,children:[t.jsx(v.xo,{asChild:!0,children:(0,t.jsxs)(w.z,{variant:"outline",role:"combobox","aria-expanded":P,className:"w-full justify-between text-sm capitalize",children:[K.find(e=>e.value===x)?.label||"Select visibility...",t.jsx(f.Z,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(v.yk,{className:"w-full p-0",children:(0,t.jsxs)(b.mY,{children:[t.jsx(b.sZ,{placeholder:"Search options..."}),(0,t.jsxs)(b.e8,{children:[t.jsx(b.rb,{children:"No options found."}),t.jsx(b.fu,{children:K.map(e=>(0,t.jsxs)(b.di,{onSelect:()=>{"users"!==e.value&&S([]),"roles"!==e.value&&Y([]),z(e.value),B(!1)},children:[t.jsx(p.Z,{className:(0,y.cn)("mr-2 h-4 w-4",x===e.value?"opacity-100":"opacity-0")}),(0,t.jsxs)("div",{className:"flex flex-col",children:[t.jsx("span",{children:e.label}),t.jsx("span",{className:"text-xs text-muted-foreground",children:e.description})]})]},e.value))})]})]})})]})]}),"users"===x&&t.jsx("div",{className:"space-y-3 pt-3",children:(0,t.jsxs)("div",{children:[t.jsx(k._,{className:"text-sm font-medium",children:"Share with users"}),t.jsx("div",{className:"mt-2",children:t.jsx(g.I,{placeholder:"Search users by email...",value:I,onChange:e=>T(e.target.value),className:"text-sm"})}),W&&(0,t.jsxs)("div",{className:"mt-2 flex items-center justify-center py-4",children:[t.jsx(u.Z,{className:"h-4 w-4 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading users..."})]}),!W&&U&&U.usersPagination?.items.length>0&&(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Search Results:"}),t.jsx("div",{className:"max-h-50 overflow-y-auto border rounded-lg",children:U.usersPagination.items.filter(e=>!C.some(s=>s.id===e.id)).map(e=>(0,t.jsxs)("label",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:C.some(s=>s.id===e.id),onChange:s=>{S(s=>[...s,{id:e.id,rights:"read"}]),V(s=>[...s,{...e,rights:"read"}])}}),t.jsx("span",{className:"text-sm",children:e.email})]},e.id))}),(0,t.jsxs)("div",{className:"text-xs text-muted-foreground mt-2",children:[t.jsx("span",{className:"font-medium",children:"Note:"})," Only the first 5 users are shown, use the Search bar to find more users."]})]}),!W&&I&&U&&0===U.usersPagination.items.length&&t.jsx("div",{className:"mt-2 text-center py-4",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"No users found"})}),H?.length>0?(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Selected Users:"}),(0,t.jsxs)("div",{className:"space-y-1",children:[H.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 border p-2 rounded-lg text-sm",children:[t.jsx("span",{className:"flex-1 pl-2",children:e.email}),(0,t.jsxs)(n.Ph,{value:e.rights,onValueChange:s=>{S(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a)),V(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a))},children:[t.jsx(n.i4,{className:"h-6 w-20 text-xs",children:t.jsx(n.ki,{})}),(0,t.jsxs)(n.Bw,{children:[t.jsx(n.Ql,{value:"read",children:"Read"}),t.jsx(n.Ql,{value:"write",children:"Write"})]})]}),t.jsx(w.z,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 hover:bg-blue-100",onClick:()=>{S(s=>s.filter(s=>s.id!==e.id)),V(s=>s.filter(s=>s.id!==e.id))},children:t.jsx(h.Z,{className:"w-3 h-3"})})]},e.id)),C&&C.length>5&&(0,t.jsxs)(w.z,{variant:"link",type:"button",className:"h-auto p-0 text-blue-600 hover:text-blue-800 text-xs",onClick:()=>{E(50),D(!0)},children:["+ ",C.length-5," more users"]})]})]}):t.jsx("div",{className:"mt-2 text-center py-4",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"No users selected."})})]})}),"roles"===x&&t.jsx("div",{className:"space-y-3",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)(k._,{className:"text-sm font-medium",children:["Share with roles (",Z?.length||0,")"]}),(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Available Roles"}),J.loading&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-4 border rounded-lg",children:[t.jsx(u.Z,{className:"h-4 w-4 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading roles..."})]}),!J.loading&&J.data&&t.jsx("div",{className:"max-h-24 overflow-y-auto border rounded-lg",children:J.data.rolesPagination.items.map(e=>(0,t.jsxs)("label",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:Z.some(s=>s.id===e.id),onChange:s=>{s.target.checked?Y(s=>[...s,{id:e.id,rights:"read"}]):Y(s=>s.filter(s=>s.id!==e.id))}}),t.jsx("span",{className:"text-sm capitalize",children:e.name})]},e.id))})]}),Z.length>0&&J.data&&(0,t.jsxs)("div",{className:"mt-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Selected Roles:"}),t.jsx("div",{className:"space-y-1",children:Z.map(e=>{let s=J.data.rolesPagination.items.find(s=>s.id===e.id);return(0,t.jsxs)("div",{className:"flex items-center gap-2 border p-2 rounded-lg text-sm",children:[t.jsx("span",{className:"flex-1 pl-2 capitalize",children:s?.name}),(0,t.jsxs)(n.Ph,{value:e.rights,onValueChange:s=>{Y(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a))},children:[t.jsx(n.i4,{className:"h-6 text-xs w-20 border-none",children:t.jsx(n.ki,{})}),(0,t.jsxs)(n.Bw,{children:[t.jsx(n.Ql,{value:"read",children:t.jsx("span",{className:"pr-7",children:"Read"})}),t.jsx(n.Ql,{value:"write",children:t.jsx("span",{className:"pr-7",children:"Write"})})]})]}),t.jsx(w.z,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 hover:bg-blue-100",onClick:()=>{Y(s=>s.filter(s=>s.id!==e.id))},children:t.jsx(h.Z,{className:"w-3 h-3"})})]},e.id)})})]})]})}),t.jsx(N.Vq,{open:q,onOpenChange:D,children:(0,t.jsxs)(N.cZ,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col",children:[(0,t.jsxs)(N.fK,{children:[(0,t.jsxs)(N.$N,{children:["All Selected Users (",C?.length||0,")"]}),t.jsx(N.Be,{children:"View and manage all selected users and their permissions"})]}),(0,t.jsxs)(j.x,{className:"flex-1 pr-4",children:[A&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[t.jsx(u.Z,{className:"h-6 w-6 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading users..."})]}),!A&&_.length>0&&t.jsx("div",{className:"space-y-2",children:_.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 border p-3 rounded-lg",children:[t.jsx("span",{className:"flex-1",children:e.email}),(0,t.jsxs)(n.Ph,{value:e.rights,onValueChange:s=>{S(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a)),V(a=>a.map(a=>a.id===e.id?{...a,rights:s}:a))},children:[t.jsx(n.i4,{className:"w-24",children:t.jsx(n.ki,{})}),(0,t.jsxs)(n.Bw,{children:[t.jsx(n.Ql,{value:"read",children:"Read"}),t.jsx(n.Ql,{value:"write",children:"Write"})]})]}),t.jsx(w.z,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 hover:bg-destructive/10",onClick:()=>{S(s=>s.filter(s=>s.id!==e.id)),V(s=>s.filter(s=>s.id!==e.id))},children:t.jsx(h.Z,{className:"w-4 h-4"})})]},e.id))}),!A&&0===_.length&&t.jsx("div",{className:"text-center py-8",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"No users selected"})})]})]})})]})}},567:(e,s,a)=>{a.d(s,{C:()=>i});var t=a(10326),r=a(79360);a(17577);var l=a(77863);let d=(0,r.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i({className:e,variant:s,...a}){return t.jsx("div",{className:(0,l.cn)(d({variant:s}),e),...a})}},33071:(e,s,a)=>{a.d(s,{Ol:()=>i,SZ:()=>o,Zb:()=>d,aY:()=>c,eW:()=>m,ll:()=>n});var t=a(10326),r=a(17577),l=a(77863);let d=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...s}));d.displayName="Card";let i=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",e),...s}));i.displayName="CardHeader";let n=r.forwardRef(({className:e,...s},a)=>t.jsx("h3",{ref:a,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",e),...s}));n.displayName="CardTitle";let o=r.forwardRef(({className:e,...s},a)=>t.jsx("p",{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",e),...s}));o.displayName="CardDescription";let c=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("p-6 pt-0",e),...s}));c.displayName="CardContent";let m=r.forwardRef(({className:e,...s},a)=>t.jsx("div",{ref:a,className:(0,l.cn)("flex items-center p-6 pt-0",e),...s}));m.displayName="CardFooter"},2454:(e,s,a)=>{a.d(s,{di:()=>f,e8:()=>c,fu:()=>x,mY:()=>n,rb:()=>m,sZ:()=>o});var t=a(10326),r=a(17170),l=a(88307),d=a(17577);a(62288);var i=a(77863);let n=d.forwardRef(({className:e,...s},a)=>t.jsx(r.mY,{ref:a,className:(0,i.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...s}));n.displayName=r.mY.displayName;let o=d.forwardRef(({className:e,...s},a)=>(0,t.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[t.jsx(l.Z,{className:"mr-2 size-4 shrink-0 opacity-50"}),t.jsx(r.mY.Input,{ref:a,className:(0,i.cn)("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...s})]}));o.displayName=r.mY.Input.displayName;let c=d.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.List,{ref:a,className:(0,i.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...s}));c.displayName=r.mY.List.displayName;let m=d.forwardRef((e,s)=>t.jsx(r.mY.Empty,{ref:s,className:"py-6 text-center text-sm",...e}));m.displayName=r.mY.Empty.displayName;let x=d.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.Group,{ref:a,className:(0,i.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...s}));x.displayName=r.mY.Group.displayName,d.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.Separator,{ref:a,className:(0,i.cn)("-mx-1 h-px bg-border",e),...s})).displayName=r.mY.Separator.displayName;let f=d.forwardRef(({className:e,...s},a)=>t.jsx(r.mY.Item,{ref:a,className:(0,i.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s}));f.displayName=r.mY.Item.displayName},62288:(e,s,a)=>{a.d(s,{$N:()=>u,Be:()=>h,Vq:()=>n,cN:()=>p,cZ:()=>x,fK:()=>f,hg:()=>o});var t=a(10326),r=a(98986),l=a(94019),d=a(17577),i=a(77863);let n=r.fC,o=r.xz,c=r.h_;r.x8;let m=d.forwardRef(({className:e,...s},a)=>t.jsx(r.aV,{ref:a,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...s}));m.displayName=r.aV.displayName;let x=d.forwardRef(({className:e,children:s,...a},d)=>(0,t.jsxs)(c,{children:[t.jsx(m,{}),(0,t.jsxs)(r.VY,{ref:d,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...a,children:[s,(0,t.jsxs)(r.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(l.Z,{className:"size-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));x.displayName=r.VY.displayName;let f=({className:e,...s})=>t.jsx("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...s});f.displayName="DialogHeader";let p=({className:e,...s})=>t.jsx("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});p.displayName="DialogFooter";let u=d.forwardRef(({className:e,...s},a)=>t.jsx(r.Dx,{ref:a,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",e),...s}));u.displayName=r.Dx.displayName;let h=d.forwardRef(({className:e,...s},a)=>t.jsx(r.dk,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",e),...s}));h.displayName=r.dk.displayName},31048:(e,s,a)=>{a.d(s,{_:()=>o});var t=a(10326),r=a(34478),l=a(79360),d=a(17577),i=a(77863);let n=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=d.forwardRef(({className:e,...s},a)=>t.jsx(r.f,{ref:a,className:(0,i.cn)(n(),e),...s}));o.displayName=r.f.displayName},30811:(e,s,a)=>{a.d(s,{J2:()=>i,xo:()=>n,yk:()=>o});var t=a(10326),r=a(74964),l=a(17577),d=a(77863);let i=r.fC,n=r.xz,o=l.forwardRef(({className:e,align:s="center",sideOffset:a=4,...l},i)=>t.jsx(r.h_,{children:t.jsx(r.VY,{ref:i,align:s,sideOffset:a,className:(0,d.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...l})}));o.displayName=r.VY.displayName},65685:(e,s,a)=>{a.d(s,{B:()=>n,x:()=>i});var t=a(10326),r=a(9261),l=a(17577),d=a(77863);let i=l.forwardRef(({className:e,children:s,...a},l)=>(0,t.jsxs)(r.fC,{ref:l,className:(0,d.cn)("relative overflow-hidden",e),...a,children:[t.jsx(r.l_,{className:"size-full rounded-[inherit]",children:s}),t.jsx(n,{}),t.jsx(r.Ns,{})]}));i.displayName=r.fC.displayName;let n=l.forwardRef(({className:e,orientation:s="vertical",...a},l)=>t.jsx(r.gb,{ref:l,orientation:s,className:(0,d.cn)("flex touch-none select-none transition-colors","vertical"===s&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:t.jsx(r.q4,{className:"relative flex-1 rounded-full bg-border"})}));n.displayName=r.gb.displayName},34474:(e,s,a)=>{a.d(s,{Bw:()=>u,Ph:()=>c,Ql:()=>h,i4:()=>x,ki:()=>m});var t=a(10326),r=a(55423),l=a(941),d=a(96633),i=a(32933),n=a(17577),o=a(77863);let c=r.fC;r.ZA;let m=r.B4,x=n.forwardRef(({className:e,children:s,...a},d)=>(0,t.jsxs)(r.xz,{ref:d,className:(0,o.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...a,children:[s,t.jsx(r.JO,{asChild:!0,children:t.jsx(l.Z,{className:"size-4 opacity-50"})})]}));x.displayName=r.xz.displayName;let f=n.forwardRef(({className:e,...s},a)=>t.jsx(r.u_,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(d.Z,{className:"size-4"})}));f.displayName=r.u_.displayName;let p=n.forwardRef(({className:e,...s},a)=>t.jsx(r.$G,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(l.Z,{className:"size-4"})}));p.displayName=r.$G.displayName;let u=n.forwardRef(({className:e,children:s,position:a="popper",...l},d)=>t.jsx(r.h_,{children:(0,t.jsxs)(r.VY,{ref:d,className:(0,o.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...l,children:[t.jsx(f,{}),t.jsx(r.l_,{className:(0,o.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),t.jsx(p,{})]})}));u.displayName=r.VY.displayName,n.forwardRef(({className:e,...s},a)=>t.jsx(r.__,{ref:a,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=r.__.displayName;let h=n.forwardRef(({className:e,children:s,...a},l)=>(0,t.jsxs)(r.ck,{ref:l,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[t.jsx("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:t.jsx(r.wU,{children:t.jsx(i.Z,{className:"size-4"})})}),t.jsx(r.eT,{children:s})]}));h.displayName=r.ck.displayName,n.forwardRef(({className:e,...s},a)=>t.jsx(r.Z0,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=r.Z0.displayName},87673:(e,s,a)=>{a.d(s,{g:()=>d});var t=a(10326),r=a(17577),l=a(77863);let d=r.forwardRef(({className:e,...s},a)=>t.jsx("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...s}));d.displayName="Textarea"}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=5974,exports.ids=[5974],exports.modules={51602:(e,s,t)=>{t.d(s,{d:()=>u,f:()=>h});var l=t(10326),a=t(90772),n=t(77863),r=t(32933),i=t(43810),o=t(17577),d=t(54390),c=t(35057),m=t(48818);let x=(0,o.createContext)({code:""}),u=({code:e,language:s,showLineNumbers:t=!1,className:a,children:r,...i})=>l.jsx(x.Provider,{value:{code:e},children:l.jsx("div",{className:(0,n.cn)("relative w-full overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,l.jsxs)("div",{className:"relative",children:[l.jsx(d.Z,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:s,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:t,style:c.Z,children:e}),l.jsx(d.Z,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:s,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:t,style:m.Z,children:e}),r&&l.jsx("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:r})]})})}),h=({onCopy:e,onError:s,timeout:t=2e3,children:d,className:c,...m})=>{let[u,h]=(0,o.useState)(!1),{code:p}=(0,o.useContext)(x),g=async()=>{s?.(Error("Clipboard API not available"))},f=u?r.Z:i.Z;return l.jsx(a.z,{className:(0,n.cn)("shrink-0",c),onClick:g,size:"icon",variant:"ghost",...m,children:d??l.jsx(f,{size:14})})}},36931:(e,s,t)=>{t.d(s,{H:()=>u});var l=t(10326),a=t(77863),n=t(17577),r=t(16476),i=t(79283),o=t(70285),d=t(7833),c=t(51602);t(32289);let m=(0,t(39499).Z)(r.UG),x={ol:({node:e,children:s,className:t,...n})=>l.jsx("ol",{className:(0,a.cn)("ml-4 list-outside list-decimal",t),...n,children:s}),li:({node:e,children:s,className:t,...n})=>l.jsx("li",{className:(0,a.cn)("py-1",t),...n,children:s}),ul:({node:e,children:s,className:t,...n})=>l.jsx("ul",{className:(0,a.cn)("ml-4 list-outside list-disc",t),...n,children:s}),hr:({node:e,className:s,...t})=>l.jsx("hr",{className:(0,a.cn)("my-6 border-border",s),...t}),strong:({node:e,children:s,className:t,...n})=>l.jsx("span",{className:(0,a.cn)("font-semibold",t),...n,children:s}),a:({node:e,children:s,className:t,...n})=>l.jsx("a",{className:(0,a.cn)("font-medium text-primary underline",t),rel:"noreferrer",target:"_blank",...n,children:s}),h1:({node:e,children:s,className:t,...n})=>l.jsx("h1",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-3xl",t),...n,children:s}),h2:({node:e,children:s,className:t,...n})=>l.jsx("h2",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-2xl",t),...n,children:s}),h3:({node:e,children:s,className:t,...n})=>l.jsx("h3",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-xl",t),...n,children:s}),h4:({node:e,children:s,className:t,...n})=>l.jsx("h4",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-lg",t),...n,children:s}),h5:({node:e,children:s,className:t,...n})=>l.jsx("h5",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-base",t),...n,children:s}),h6:({node:e,children:s,className:t,...n})=>l.jsx("h6",{className:(0,a.cn)("mt-6 mb-2 font-semibold text-sm",t),...n,children:s}),table:({node:e,children:s,className:t,...n})=>l.jsx("div",{className:"my-4 overflow-x-auto",children:l.jsx("table",{className:(0,a.cn)("w-full border-collapse border border-border",t),...n,children:s})}),thead:({node:e,children:s,className:t,...n})=>l.jsx("thead",{className:(0,a.cn)("bg-muted/50",t),...n,children:s}),tbody:({node:e,children:s,className:t,...n})=>l.jsx("tbody",{className:(0,a.cn)("divide-y divide-border",t),...n,children:s}),tr:({node:e,children:s,className:t,...n})=>l.jsx("tr",{className:(0,a.cn)("border-border border-b",t),...n,children:s}),th:({node:e,children:s,className:t,...n})=>l.jsx("th",{className:(0,a.cn)("px-4 py-2 text-left font-semibold text-sm",t),...n,children:s}),td:({node:e,children:s,className:t,...n})=>l.jsx("td",{className:(0,a.cn)("px-4 py-2 text-sm",t),...n,children:s}),blockquote:({node:e,children:s,className:t,...n})=>l.jsx("blockquote",{className:(0,a.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),...n,children:s}),code:({node:e,className:s,...t})=>e?.position?.start.line!==e?.position?.end.line?l.jsx("code",{className:s,...t}):l.jsx("code",{className:(0,a.cn)("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",s),...t}),pre:({node:e,className:s,children:t})=>{let r="javascript";"string"==typeof e?.properties?.className&&(r=e.properties.className.replace("language-",""));let i="";return(0,n.isValidElement)(t)&&t.props&&"string"==typeof t.props.children?i=t.props.children:"string"==typeof t&&(i=t),l.jsx(c.d,{className:(0,a.cn)("my-4 h-auto",s),code:i,language:r,children:l.jsx(c.f,{onCopy:()=>console.log("Copied code to clipboard"),onError:()=>console.error("Failed to copy code to clipboard")})})}},u=(0,n.memo)(({className:e,options:s,children:t,allowedImagePrefixes:n,allowedLinkPrefixes:r,defaultOrigin:c,parseIncompleteMarkdown:u=!0,...h})=>{let p="string"==typeof t&&u?function(e){if(!e||"string"!=typeof e)return e;let s=e,t=s.match(/(!?\[)([^\]]*?)$/);if(t){let e=s.lastIndexOf(t[1]);s=s.substring(0,e)}if(s.match(/(\*\*)([^*]*?)$/)&&(s.match(/\*\*/g)||[]).length%2==1&&(s=`${s}**`),s.match(/(__)([^_]*?)$/)&&(s.match(/__/g)||[]).length%2==1&&(s=`${s}__`),s.match(/(\*)([^*]*?)$/)&&s.split("").reduce((e,t,l)=>{if("*"===t){let t=s[l-1],a=s[l+1];if("*"!==t&&"*"!==a)return e+1}return e},0)%2==1&&(s=`${s}*`),s.match(/(_)([^_]*?)$/)&&s.split("").reduce((e,t,l)=>{if("_"===t){let t=s[l-1],a=s[l+1];if("_"!==t&&"_"!==a)return e+1}return e},0)%2==1&&(s=`${s}_`),s.match(/(`)([^`]*?)$/)&&(s.includes("```"),(s.match(/```[\s\S]*?```/g)||[]).length,(s.match(/```/g)||[]).length%2!=1)){let e=0;for(let t=0;t<s.length;t++)if("`"===s[t]){let l="```"===s.substring(t,t+3),a=t>0&&"```"===s.substring(t-1,t+2),n=t>1&&"```"===s.substring(t-2,t+1);!(l||a||n)&&e++}e%2==1&&(s=`${s}\``)}return s.match(/(~~)([^~]*?)$/)&&(s.match(/~~/g)||[]).length%2==1&&(s=`${s}~~`),s}(t):t;return l.jsx("div",{className:(0,a.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...h,children:l.jsx(m,{allowedImagePrefixes:n??["*"],allowedLinkPrefixes:r??["*"],components:x,defaultOrigin:c,rehypePlugins:[i.Z],remarkPlugins:[o.Z,d.Z],...s,children:p})})},(e,s)=>e.children===s.children);u.displayName="Response"},43273:(e,s,t)=>{t.d(s,{Cd:()=>d,X:()=>c,bZ:()=>o});var l=t(10326),a=t(79360),n=t(17577),r=t(77863);let i=(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"}}),o=n.forwardRef(({className:e,variant:s,...t},a)=>l.jsx("div",{ref:a,role:"alert",className:(0,r.cn)(i({variant:s}),e),...t}));o.displayName="Alert";let d=n.forwardRef(({className:e,...s},t)=>l.jsx("h5",{ref:t,className:(0,r.cn)("mb-1 font-medium leading-none tracking-tight",e),...s}));d.displayName="AlertTitle";let c=n.forwardRef(({className:e,...s},t)=>l.jsx("div",{ref:t,className:(0,r.cn)("text-sm [&_p]:leading-relaxed",e),...s}));c.displayName="AlertDescription"},24295:(e,s,t)=>{t.d(s,{Fw:()=>r,wy:()=>n,zF:()=>a});var l=t(35663);let a=l.fC,n=l.wy,r=l.Fw},79210:(e,s,t)=>{t.d(s,{SP:()=>d,dr:()=>o,mQ:()=>i,nU:()=>c});var l=t(10326),a=t(28407),n=t(17577),r=t(77863);let i=a.fC,o=n.forwardRef(({className:e,...s},t)=>l.jsx(a.aV,{ref:t,className:(0,r.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...s}));o.displayName=a.aV.displayName;let d=n.forwardRef(({className:e,...s},t)=>l.jsx(a.xz,{ref:t,className:(0,r.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...s}));d.displayName=a.xz.displayName;let c=n.forwardRef(({className:e,...s},t)=>l.jsx(a.VY,{ref:t,className:(0,r.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...s}));c.displayName=a.VY.displayName},77961:(e,s,t)=>{t.d(s,{jF:()=>S,jU:()=>W,ZP:()=>F,NF:()=>U});var l=t(10326),a=t(17577);t(32964),t(59946),t(27221);var n=t(59161),r=t(30463);let i=function(e,s=[]){(0,a.useContext)(r.E);let[t,l]=(0,a.useState)(void 0);return t};var o=t(84714),d=t(31540),c=t(15557),m=t(61086),x=t(11890),u=t(39183),h=t(36283),p=t(71709),g=t(39572),f=t(83855),j=t(94019),b=t(3240),N=t(90772),v=t(62288),y=t(65685),w=t(3574),k=t(20108),C=t(10119),Z=t(54432),z=t(76812),_=t(33071),L=t(65304);function S({s3key:e,children:s}){let{data:t,isLoading:a,error:r,refetch:i}=(0,k.a)({queryKey:["fileObject",e],queryFn:async()=>e?await n.QZ.object(e):null,enabled:null!=e});if(!e)return l.jsx(_.Zb,{children:(0,l.jsxs)(_.aY,{className:"p-3 flex",children:[l.jsx("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),s]})});let o=e,c="";return e.includes("[bucket:")&&(c=e.split("[bucket:")[1]?.split("]")[0]||"",o=e.split("[bucket:")[1]?.split("]")[0]||"",o?.length&&(o=e.split("]")[1]||"")),o=o.split("_EXULU_").pop()||"",(0,l.jsxs)(_.Zb,{children:[l.jsx(_.Ol,{className:"pb-3",children:l.jsx(_.ll,{className:"text-sm max-w-[500px] truncate",children:o})}),(0,l.jsxs)(_.aY,{className:"pt-0",children:[a&&(0,l.jsxs)("div",{className:"space-y-2",children:[l.jsx(L.O,{className:"h-4 w-full"}),l.jsx(L.O,{className:"h-4 w-2/3"})]}),!a&&t&&(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,l.jsxs)("span",{className:"capitalize",children:[t?.ContentType.split("/").pop(),c&&` [Bucket: ${c}]`]}),(0,l.jsxs)("span",{children:[(t?.ContentLength/1024/1024).toFixed(2)," MB"]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,l.jsxs)("span",{children:["Last modified: ",new Date(t?.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,l.jsxs)(N.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{n.QZ.download(e).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:[l.jsx("span",{className:"mr-1 text-xs",children:"View"}),l.jsx(d.Z,{className:"h-3 w-3"})]})]})]}),!a&&r&&l.jsx("p",{className:"text-xs text-muted-foreground",children:r.message}),s]})]})}function F({id:e,allowedFileTypes:s,dependencies:t,onConfirm:n,selectionLimit:r,buttonText:i}){let[o,d]=(0,a.useState)(!1);return(0,l.jsxs)(v.Vq,{open:o,onOpenChange:d,children:[l.jsx(v.hg,{asChild:!0,children:(0,l.jsxs)(N.z,{variant:"outline",children:[i&&l.jsx("span",{className:"mr-2",children:i}),l.jsx(c.Z,{className:"h-4 w-4"})]})}),(0,l.jsxs)(v.cZ,{className:"sm:max-w-[900px]",children:[(0,l.jsxs)(v.fK,{children:[l.jsx(v.$N,{children:"File Gallery"}),l.jsx(v.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),l.jsx(O,{id:e,allowedFileTypes:s,dependencies:t,selectionLimit:r,onConfirm:e=>{n(e),d(!1)}})]})]})}let O=({id:e,allowedFileTypes:s,dependencies:t,onConfirm:d,selectionLimit:c})=>{s||(s=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[h,p]=(0,a.useState)(void 0),[g,f]=(0,a.useState)(void 0),[j,b]=(0,a.useState)(void 0),v=(0,a.useContext)(r.E),[_,S]=(0,a.useState)([]),F=e=>{if(_.includes(e)){S(_.filter(s=>s!==e));return}if(1===c){S([e]);return}_.length>=c||S([..._,e])},O=(0,C.D)({mutationFn:async({key:e})=>{await n.QZ.delete(e),R()}}),{data:$,isLoading:U,error:P,refetch:R}=(0,k.a)({queryKey:["filesQuery",h,j],staleTime:3e4,queryFn:async()=>n.QZ.list({search:h,continuationToken:j})});console.log("!! data !!",$);let{theme:q}=(0,w.F)(),K=i({backend:v?.backend||"",uppyOptions:{id:e,allowedFileTypes:s},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},t);return((0,a.useEffect)(()=>{R()},[h,j]),K)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,l.jsxs)("div",{className:"border rounded-lg p-4",children:[l.jsx("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),l.jsx(Z.I,{placeholder:"Search files...",value:h,onChange:e=>p(e.target.value),className:"mb-3"}),(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,l.jsxs)("span",{children:[_.length," / ",c," files selected"]}),(0,l.jsxs)("span",{children:["Allowed file types: ",s?.map(e=>e).join(", ")]})]}),(0,l.jsxs)(y.x,{children:[U&&(0,l.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"}),l.jsx(L.O,{className:"h-[120px] w-full"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!U&&!$?.Contents?.length&&(0,l.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[l.jsx(m.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),l.jsx("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),$?.Contents?.map(e=>l.jsx(W,{s3Key:e.Key,onSelect:F,active:_.some(s=>s===e.Key),onRemove:()=>{O.mutate({key:e.Key})},disabled:!!s&&!s?.some(s=>e.Key.endsWith(s))}))]}),l.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsxs)(N.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{b(void 0)},disabled:!j||U,children:[l.jsx("span",{className:"sr-only",children:"Go to first page"}),l.jsx(z.kRt,{className:"size-4"})]}),(0,l.jsxs)(N.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{b(g)},disabled:!j||U,children:[l.jsx("span",{className:"sr-only",children:"Go to previous page"}),l.jsx(x.Z,{className:"size-4"})]}),(0,l.jsxs)(N.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{f(j),b($?.NextContinuationToken)},disabled:!$?.NextContinuationToken||U,children:[l.jsx("span",{className:"sr-only",children:"Go to next page"}),l.jsx(u.Z,{className:"size-4"})]})]})})]})]}),(0,l.jsxs)("div",{className:"border rounded-lg p-4",children:[l.jsx("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),l.jsx(o.A,{uppy:K,theme:"dark"===q?"dark":"light"})]})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx(N.z,{variant:"outline",onClick:()=>{d(_),S([])},children:"Confirm"})})]}):null},W=({s3Key:e,onSelect:s,onRemove:t,active:a,disabled:r,addToContext:i})=>{let o;return(0,l.jsxs)("div",{className:`${r?"opacity-50":""} group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ${a?"border border-purple-500":"border"}`,onClick:()=>{!r&&s&&s(e)},children:[l.jsx("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:e&&(e.toLowerCase().endsWith("jpg")||e.toLowerCase().endsWith("jpeg")||e.toLowerCase().endsWith("png")||e.toLowerCase().endsWith("svg"))?l.jsx(P,{fileKey:e}):(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[(o=e)?o.toLowerCase().endsWith("jpg")||o.toLowerCase().endsWith("jpeg")||o.toLowerCase().endsWith("png")||o.toLowerCase().endsWith("svg")?l.jsx(p.Z,{className:"h-6 w-6 text-blue-500"}):o.endsWith("pdf")?l.jsx(g.Z,{className:"h-6 w-6 text-red-500"}):o.endsWith("xls")||o.endsWith("xlsx")||o.endsWith("csv")?l.jsx(h.Z,{className:"h-6 w-6 text-green-500"}):o.endsWith("ppt")||o.endsWith("pptx")?l.jsx(h.Z,{className:"h-6 w-6 text-orange-500"}):l.jsx(h.Z,{className:"h-6 w-6 text-gray-500"}):l.jsx(h.Z,{className:"h-6 w-6 text-gray-500"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:e?e.split("_EXULU_").pop():e})]})}),l.jsx("p",{className:"text-xs truncate",children:e?e.split("_EXULU_").pop():e}),(0,l.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[i&&(0,l.jsxs)(N.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{i(e)},children:[l.jsx(f.Z,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"Add"})]}),(0,l.jsxs)(N.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{n.QZ.download(e).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:[l.jsx(d.Z,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"View"})]}),t&&(0,l.jsxs)(N.z,{onClick:s=>{s.stopPropagation(),t(e)},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:[l.jsx(j.Z,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"Remove"})]})]})]},e)},$={},U=async e=>{if($[e]){if(!($[e].expiresAt<Date.now()))return $[e].url;delete $[e]}let s=await n.QZ.download(e),t=await s.json();return console.log("json",t),$[e]={url:t.url,expiresAt:Date.now()+6e4},t.url},P=({fileKey:e})=>{console.log("key",e);let s=(0,k.a)({queryKey:["imageQuery",e],staleTime:3e4,queryFn:async()=>U(e)});return s.isLoading?l.jsx("div",{children:l.jsx(b.Z,{})}):s.isLoading||s.data?l.jsx("img",{src:s.data,alt:e,className:"object-cover w-full h-full"}):l.jsx("div",{children:l.jsx(m.Z,{})})}}};
@@ -1 +1 @@
1
- "use strict";exports.id=6590,exports.ids=[6590],exports.modules={86590:(e,s,a)=>{a.d(s,{$:()=>S});var t=a(10326),i=a(17577),r=a(33071),l=a(90772),n=a(567),c=a(60097),d=a(59593),o=a(231),m=a(43810),x=a(69508),h=a(98091),p=a(50732),u=a(66697),j=a(40617),f=a(79635),g=a(37358),v=a(48998),N=a(3151),w=a(52227),y=a(29429),b=a(85999),C=a(39167),A=a(42270),_=a(32663);function S({prompt:e,user:s,onUpdate:a}){let[S,D]=(0,i.useState)(!1),[Z,F]=(0,i.useState)(!1),[P]=(0,w.iJ)(),{toggleFavorite:$}=(0,w.Lq)(),k=function(e,s){let a="private"===e.rights_mode,t="public"===e.rights_mode,i="users"===e.rights_mode,r="roles"===e.rights_mode,l=s.super_admin,n=e.created_by===s.id.toString(),c=!1;if(n&&(c=!0),!a||n||l||(c=!1),t&&(c=!0),i){let a=e.RBAC?.users?.find(e=>e.id===s.id);c=a?.rights==="write"}if(r){let a=e.RBAC?.roles?.find(e=>e.id===s.role?.id);c=a?.rights==="write"}return l&&(c=!0),c}(e,s),z=(0,N.H)(e.content),E=e.is_favorited||!1,{data:B}=(0,C.aM)(A.W9,{variables:{ids:e.assigned_agents||[]},skip:!e.assigned_agents||0===e.assigned_agents.length}),I=B?.agentByIds?.map(e=>e.name)||[],{data:M}=(0,C.aM)(A.L5,{variables:{id:e.created_by},skip:!e.created_by}),R=M?.userById?.name||"Unknown",U=async()=>{if(confirm("Are you sure you want to delete this prompt?"))try{await P({variables:{id:e.id}}),b.Am.success("Prompt deleted successfully"),a()}catch(e){b.Am.error("Failed to delete prompt"),console.error(e)}},V=async()=>{if(!Z){F(!0);try{await $(e.id,s.id,E,e.favorite_count,void 0),b.Am.success(E?"Removed from favorites":"Added to favorites",{icon:E?"\uD83D\uDC4E":"\uD83D\uDC4D",duration:2e3}),a()}catch(e){b.Am.error("Failed to update favorite"),console.error(e)}finally{await new Promise(e=>setTimeout(e,200)),F(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r.Zb,{className:"flex flex-col hover:shadow-md transition-shadow",children:[t.jsx(r.Ol,{className:"pb-3",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"font-semibold text-lg truncate",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(l.z,{variant:"ghost",size:"icon",className:`h-8 w-8 transition-all ${Z?"scale-125":""} ${E?"text-yellow-500":""}`,onClick:V,disabled:Z,children:t.jsx(d.Z,{className:`h-4 w-4 transition-all ${Z?"animate-pulse":""} ${E?"fill-yellow-400 text-yellow-400":""}`})}),(0,t.jsxs)(c.h_,{modal:!1,children:[t.jsx(c.$F,{asChild:!0,children:t.jsx(l.z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:t.jsx(o.Z,{className:"h-4 w-4"})})}),(0,t.jsxs)(c.AW,{align:"end",children:[(0,t.jsxs)(c.Xi,{onClick:()=>{navigator.clipboard.writeText(e.content),b.Am.success("Prompt copied to clipboard")},children:[t.jsx(m.Z,{className:"mr-2 h-4 w-4"}),"Copy Content"]}),k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Xi,{onClick:()=>D(!0),children:[t.jsx(x.Z,{className:"mr-2 h-4 w-4"}),"Edit"]}),(0,t.jsxs)(c.Xi,{onClick:U,className:"text-destructive",children:[t.jsx(h.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})]})]})]})}),t.jsx(r.aY,{className:"flex-1 pb-3",children:(0,t.jsxs)("div",{className:"space-y-3",children:[t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:e.content}),z.length>0&&(0,t.jsxs)(n.C,{variant:"outline",className:"text-xs",children:[z.length," variable",1!==z.length?"s":""]}),I.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(p.Z,{className:"h-3 w-3"}),t.jsx("span",{className:"font-medium",children:"Works with:"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[I.slice(0,2).map((e,s)=>t.jsx(n.C,{variant:"default",className:"text-xs bg-primary/10 text-primary hover:bg-primary/20",children:e},s)),I.length>2&&(0,t.jsxs)(n.C,{variant:"default",className:"text-xs bg-primary/10 text-primary hover:bg-primary/20",children:["+",I.length-2," more"]})]})]})]})}),(0,t.jsxs)(r.eW,{className:"flex flex-col gap-3 pt-3 border-t",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,t.jsxs)("div",{className:`flex items-center gap-1 transition-all ${Z?"scale-125":""} ${E?"text-yellow-500":""}`,children:[t.jsx(d.Z,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:e.favorite_count||0})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",title:"Times used",children:[t.jsx(u.Z,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:e.usage_count||0})]})]}),(0,t.jsxs)(l.z,{variant:"secondary",size:"sm",type:"button",onClick:()=>D(!0),children:[t.jsx(j.Z,{className:"mr-2 h-3.5 w-3.5"}),"View"]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 text-xs text-muted-foreground w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(f.Z,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:["Created by ",R]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(g.Z,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:["Created ",(0,_.Q)(new Date(e.createdAt),{addSuffix:!0})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(v.Z,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:["Updated ",(0,_.Q)(new Date(e.updatedAt),{addSuffix:!0})]})]})]})]})]}),t.jsx(y.D,{open:S,onOpenChange:D,prompt:e,onSuccess:a,user:s})]})}},29429:(e,s,a)=>{a.d(s,{D:()=>A});var t=a(10326),i=a(17577),r=a(62288),l=a(90772),n=a(54432),c=a(31048),d=a(87673),o=a(567),m=a(82189),x=a(47206),h=a(32933),p=a(94019),u=a(52227),j=a(3151),f=a(15286),g=a(85999),v=a(24295),N=a(2454),w=a(30811),y=a(39167),b=a(42270),C=a(77863);function A({open:e,onOpenChange:s,prompt:a,onSuccess:A,user:_,defaultAssignedAgents:S=[]}){let D=!!a,[Z,{loading:F}]=(0,u.EE)(),[P,{loading:$}]=(0,u.er)(),[k,z]=(0,i.useState)(""),[E,B]=(0,i.useState)(""),[I,M]=(0,i.useState)(""),[R,U]=(0,i.useState)("private"),[V,q]=(0,i.useState)([]),[O,L]=(0,i.useState)([]),[Q,T]=(0,i.useState)([]),[W,H]=(0,i.useState)(!1),[J,X]=(0,i.useState)([]),[Y,K]=(0,i.useState)(!1),{data:G}=(0,y.aM)(b.ym,{variables:{page:1,limit:100}}),ee=G?.agentsPagination?.items||[],es=(0,j.H)(I),{isValid:ea,invalidVariables:et}=function(e){if(!e)return{isValid:!0,invalidVariables:[]};let s=e.matchAll(/\{\{([^}]+)\}\}/g),a=[];for(let e of Array.from(s)){let s=e[1];s&&/^[a-zA-Z0-9_]+$/.test(s)||a.push(s)}return{isValid:0===a.length,invalidVariables:a}}(I),ei=()=>{z(""),B(""),M(""),U("private"),q([]),L([]),T([]),H(!1),X([])},er=async()=>{if(!k.trim()){g.Am.error("Please enter a name for the prompt");return}if(!I.trim()){g.Am.error("Please enter prompt content");return}if(!ea){g.Am.error(`Invalid variable names: ${et.join(", ")}. Use only letters, numbers, and underscores.`);return}try{let e={name:k.trim(),description:E.trim()||void 0,content:I.trim(),rights_mode:R,RBAC:"private"!==R&&"public"!==R?{users:V.length>0?V:void 0,roles:O.length>0?O:void 0,projects:Q.length>0?Q:void 0}:void 0,assigned_agents:J.length>0?J:void 0};D?(await P({variables:{id:a.id,...e}}),g.Am.success("Prompt updated successfully")):(await Z({variables:e}),g.Am.success("Prompt created successfully")),A(),s(!1),ei()}catch(e){console.error(e),g.Am.error(D?"Failed to update prompt":"Failed to create prompt")}};return t.jsx(r.Vq,{open:e,onOpenChange:s,children:(0,t.jsxs)(r.cZ,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,t.jsxs)(r.fK,{children:[t.jsx(r.$N,{children:D?"Edit Prompt":"Create New Prompt"}),t.jsx(r.Be,{children:D?"Update your prompt template":"Create a reusable prompt template with variables"})]}),(0,t.jsxs)("div",{className:"space-y-6 py-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c._,{htmlFor:"name",children:["Name ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(n.I,{id:"name",placeholder:"Customer Support Template",value:k,onChange:e=>z(e.target.value)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(c._,{htmlFor:"description",children:"Description"}),t.jsx(n.I,{id:"description",placeholder:"Brief description of this prompt",value:E,onChange:e=>B(e.target.value)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c._,{htmlFor:"content",children:["Prompt Content ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(d.g,{id:"content",placeholder:"You are helping {{customer_name}} with their {{issue}}...",value:I,onChange:e=>M(e.target.value),rows:8,className:"font-mono text-sm"}),(0,t.jsxs)("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[t.jsx(m.Z,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),(0,t.jsxs)("span",{children:["Use"," ",(0,t.jsxs)("code",{className:"bg-muted px-1 py-0.5 rounded",children:["{","{","variable_name","}}"]})," ","format for dynamic content. Variable names can only contain letters, numbers, and underscores."]})]}),es.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 pt-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground mr-2",children:"Detected variables:"}),es.map(e=>t.jsx(o.C,{variant:"outline",className:"text-xs",children:e},e))]}),!ea&&(0,t.jsxs)("div",{className:"text-xs text-destructive",children:["Invalid variable names: ",et.join(", ")]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(c._,{children:"Assign to Agents"}),(0,t.jsxs)(w.J2,{modal:!0,open:Y,onOpenChange:K,children:[t.jsx(w.xo,{asChild:!0,children:(0,t.jsxs)(l.z,{variant:"outline",role:"combobox","aria-expanded":Y,className:"w-full justify-between",children:[0===J.length?"Select agents...":`${J.length} agent${1!==J.length?"s":""} selected`,t.jsx(x.Z,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(w.yk,{className:"w-full p-0",children:(0,t.jsxs)(N.mY,{children:[t.jsx(N.sZ,{placeholder:"Search agents..."}),(0,t.jsxs)(N.e8,{children:[t.jsx(N.rb,{children:"No agents found."}),t.jsx(N.fu,{children:ee.map(e=>(0,t.jsxs)(N.di,{value:e.id,onSelect:()=>{X(s=>s.includes(e.id)?s.filter(s=>s!==e.id):[...s,e.id])},children:[t.jsx(h.Z,{className:(0,C.cn)("mr-2 h-4 w-4",J.includes(e.id)?"opacity-100":"opacity-0")}),e.name]},e.id))})]})]})})]}),J.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:J.map(e=>{let s=ee.find(s=>s.id===e);return s?(0,t.jsxs)(o.C,{variant:"secondary",className:"text-sm",children:[s.name,t.jsx("button",{type:"button",onClick:()=>X(s=>s.filter(s=>s!==e)),className:"ml-1.5 hover:text-destructive",children:t.jsx(p.Z,{className:"h-3 w-3"})})]},e):null})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Assign this prompt to specific agents to show it as recommended in chat"})]}),t.jsx(v.zF,{open:W,onOpenChange:H,children:(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(v.wy,{asChild:!0,children:(0,t.jsxs)(l.z,{variant:"outline",className:"w-full justify-between",children:["Access Control",(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["private"===R&&"Private","public"===R&&"Public","users"===R&&`${V.length} users`,"roles"===R&&`${O.length} roles`,"projects"===R&&`${Q.length} projects`]})]})}),t.jsx(v.Fw,{className:"pt-2",children:t.jsx(f.P,{initialRightsMode:R,initialUsers:V,initialRoles:O,modalMode:!0,initialProjects:Q,onChange:(e,s,a,t)=>{U(e),q(s),L(a),T(t)}})})]})})]}),(0,t.jsxs)(r.cN,{children:[t.jsx(l.z,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),t.jsx(l.z,{onClick:er,disabled:F||$||!k.trim()||!I.trim()||!ea,children:F||$?"Saving...":D?"Save Changes":"Create Prompt"})]})]})})}},24295:(e,s,a)=>{a.d(s,{Fw:()=>l,wy:()=>r,zF:()=>i});var t=a(35663);let i=t.fC,r=t.wy,l=t.Fw},52227:(e,s,a)=>{a.d(s,{EE:()=>n,Lq:()=>h,Sh:()=>l,VR:()=>o,er:()=>c,iJ:()=>d});var t=a(39167),i=a(18753),r=a(42270);let l=e=>(0,t.aM)(r.xx,{variables:{page:e?.page??1,limit:e?.limit??20,filters:e?.filters??[],sort:e?.sort??{field:"updatedAt",direction:"DESC"}}}),n=()=>(0,i.D)(r.Iv,{refetchQueries:[{query:r.xx,variables:{page:1,limit:20}}]}),c=()=>(0,i.D)(r.jA),d=()=>(0,i.D)(r.Ll,{refetchQueries:[{query:r.xx,variables:{page:1,limit:20}}]}),o=()=>(0,i.D)(r.re),m=()=>(0,i.D)(r.Nl),x=()=>(0,i.D)(r.m8),h=()=>{let[e]=m(),[s]=x(),[a]=(0,i.D)(r.UK);return{toggleFavorite:async(t,i,r,l,n)=>{r&&n?(await s({variables:{id:n}}),await a({variables:{id:t,favorite_count:Math.max(0,l-1)}})):(await e({variables:{user_id:i,prompt_id:t}}),await a({variables:{id:t,favorite_count:l+1}}))}}}},3151:(e,s,a)=>{a.d(s,{H:()=>t});function t(e){if(!e)return[];let s=e.matchAll(/\{\{([a-zA-Z0-9_]+)\}\}/g),a=new Set;for(let e of Array.from(s))a.add(e[1]);return Array.from(a).sort()}}};
1
+ "use strict";exports.id=6590,exports.ids=[6590],exports.modules={86590:(e,s,a)=>{a.d(s,{$:()=>S});var t=a(10326),i=a(17577),r=a(33071),l=a(90772),n=a(567),c=a(60097),d=a(59593),o=a(231),m=a(43810),x=a(69508),h=a(98091),p=a(50732),u=a(66697),j=a(40617),f=a(79635),g=a(37358),v=a(48998),N=a(3151),w=a(52227),y=a(29429),b=a(85999),C=a(39167),A=a(42270),_=a(32663);function S({prompt:e,user:s,onUpdate:a}){let[S,D]=(0,i.useState)(!1),[Z,k]=(0,i.useState)(!1),[P]=(0,w.iJ)(),{toggleFavorite:$}=(0,w.Lq)(),z=function(e,s){let a="private"===e.rights_mode,t="public"===e.rights_mode,i="users"===e.rights_mode,r="roles"===e.rights_mode,l=s.super_admin,n=e.created_by===s.id.toString(),c=!1;if(n&&(c=!0),!a||n||l||(c=!1),t&&(c=!0),i){let a=e.RBAC?.users?.find(e=>e.id===s.id);c=a?.rights==="write"}if(r){let a=e.RBAC?.roles?.find(e=>e.id===s.role?.id);c=a?.rights==="write"}return l&&(c=!0),c}(e,s),F=(0,N.H)(e.content),E=e.is_favorited||!1,{data:B}=(0,C.aM)(A.W9,{variables:{ids:e.assigned_agents||[]},skip:!e.assigned_agents||0===e.assigned_agents.length}),I=B?.agentByIds?.map(e=>e.name)||[],{data:M}=(0,C.aM)(A.L5,{variables:{id:e.created_by},skip:!e.created_by}),R=M?.userById?.name||"Unknown",U=async()=>{if(confirm("Are you sure you want to delete this prompt?"))try{await P({variables:{id:e.id}}),b.Am.success("Prompt deleted successfully"),a()}catch(e){b.Am.error("Failed to delete prompt"),console.error(e)}},V=async()=>{if(!Z){k(!0);try{await $(e.id,s.id,E,e.favorite_count,void 0),b.Am.success(E?"Removed from favorites":"Added to favorites",{icon:E?"\uD83D\uDC4E":"\uD83D\uDC4D",duration:2e3}),a()}catch(e){b.Am.error("Failed to update favorite"),console.error(e)}finally{await new Promise(e=>setTimeout(e,200)),k(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r.Zb,{className:"flex flex-col hover:shadow-md transition-shadow",children:[t.jsx(r.Ol,{className:"pb-3",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"font-semibold text-lg truncate",children:e.name}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(l.z,{variant:"ghost",size:"icon",className:`h-8 w-8 transition-all ${Z?"scale-125":""} ${E?"text-yellow-500":""}`,onClick:V,disabled:Z,children:t.jsx(d.Z,{className:`h-4 w-4 transition-all ${Z?"animate-pulse":""} ${E?"fill-yellow-400 text-yellow-400":""}`})}),(0,t.jsxs)(c.h_,{modal:!1,children:[t.jsx(c.$F,{asChild:!0,children:t.jsx(l.z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:t.jsx(o.Z,{className:"h-4 w-4"})})}),(0,t.jsxs)(c.AW,{align:"end",children:[(0,t.jsxs)(c.Xi,{onClick:()=>{navigator.clipboard.writeText(e.content),b.Am.success("Prompt copied to clipboard")},children:[t.jsx(m.Z,{className:"mr-2 h-4 w-4"}),"Copy Content"]}),z&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Xi,{onClick:()=>D(!0),children:[t.jsx(x.Z,{className:"mr-2 h-4 w-4"}),"Edit"]}),(0,t.jsxs)(c.Xi,{onClick:U,className:"text-destructive",children:[t.jsx(h.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})]})]})]})}),t.jsx(r.aY,{className:"flex-1 pb-3",children:(0,t.jsxs)("div",{className:"space-y-3",children:[t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:e.content}),F.length>0&&(0,t.jsxs)(n.C,{variant:"outline",className:"text-xs",children:[F.length," variable",1!==F.length?"s":""]}),I.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(p.Z,{className:"h-3 w-3"}),t.jsx("span",{className:"font-medium",children:"Works with:"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[I.slice(0,2).map((e,s)=>t.jsx(n.C,{variant:"default",className:"text-xs bg-primary/10 text-primary hover:bg-primary/20",children:e},s)),I.length>2&&(0,t.jsxs)(n.C,{variant:"default",className:"text-xs bg-primary/10 text-primary hover:bg-primary/20",children:["+",I.length-2," more"]})]})]})]})}),(0,t.jsxs)(r.eW,{className:"flex flex-col gap-3 pt-3 border-t",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,t.jsxs)("div",{className:`flex items-center gap-1 transition-all ${Z?"scale-125":""} ${E?"text-yellow-500":""}`,children:[t.jsx(d.Z,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:e.favorite_count||0})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",title:"Times used",children:[t.jsx(u.Z,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:e.usage_count||0})]})]}),(0,t.jsxs)(l.z,{variant:"secondary",size:"sm",type:"button",onClick:()=>D(!0),children:[t.jsx(j.Z,{className:"mr-2 h-3.5 w-3.5"}),"View"]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 text-xs text-muted-foreground w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(f.Z,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:["Created by ",R]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(g.Z,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:["Created ",(0,_.Q)(new Date(e.createdAt),{addSuffix:!0})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[t.jsx(v.Z,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:["Updated ",(0,_.Q)(new Date(e.updatedAt),{addSuffix:!0})]})]})]})]})]}),t.jsx(y.D,{open:S,onOpenChange:D,prompt:e,onSuccess:a,user:s})]})}},29429:(e,s,a)=>{a.d(s,{D:()=>A});var t=a(10326),i=a(17577),r=a(62288),l=a(90772),n=a(54432),c=a(31048),d=a(87673),o=a(567),m=a(82189),x=a(47206),h=a(32933),p=a(94019),u=a(52227),j=a(3151),f=a(15286),g=a(85999),v=a(24295),N=a(2454),w=a(30811),y=a(39167),b=a(42270),C=a(77863);function A({open:e,onOpenChange:s,prompt:a,onSuccess:A,user:_,defaultAssignedAgents:S=[]}){let D=!!a,[Z,{loading:k}]=(0,u.EE)(),[P,{loading:$}]=(0,u.er)(),[z,F]=(0,i.useState)(""),[E,B]=(0,i.useState)(""),[I,M]=(0,i.useState)(""),[R,U]=(0,i.useState)("private"),[V,q]=(0,i.useState)([]),[O,L]=(0,i.useState)([]),[Q,T]=(0,i.useState)(!1),[W,H]=(0,i.useState)([]),[J,X]=(0,i.useState)(!1),{data:Y}=(0,y.aM)(b.ym,{variables:{page:1,limit:100}}),K=Y?.agentsPagination?.items||[],G=(0,j.H)(I),{isValid:ee,invalidVariables:es}=function(e){if(!e)return{isValid:!0,invalidVariables:[]};let s=e.matchAll(/\{\{([^}]+)\}\}/g),a=[];for(let e of Array.from(s)){let s=e[1];s&&/^[a-zA-Z0-9_]+$/.test(s)||a.push(s)}return{isValid:0===a.length,invalidVariables:a}}(I),ea=()=>{F(""),B(""),M(""),U("private"),q([]),L([]),T(!1),H([])},et=async()=>{if(!z.trim()){g.Am.error("Please enter a name for the prompt");return}if(!I.trim()){g.Am.error("Please enter prompt content");return}if(!ee){g.Am.error(`Invalid variable names: ${es.join(", ")}. Use only letters, numbers, and underscores.`);return}try{let e={name:z.trim(),description:E.trim()||void 0,content:I.trim(),rights_mode:R,RBAC:"private"!==R&&"public"!==R?{users:V.length>0?V:void 0,roles:O.length>0?O:void 0}:void 0,assigned_agents:W.length>0?W:void 0};D?(await P({variables:{id:a.id,...e}}),g.Am.success("Prompt updated successfully")):(await Z({variables:e}),g.Am.success("Prompt created successfully")),A(),s(!1),ea()}catch(e){console.error(e),g.Am.error(D?"Failed to update prompt":"Failed to create prompt")}};return t.jsx(r.Vq,{open:e,onOpenChange:s,children:(0,t.jsxs)(r.cZ,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,t.jsxs)(r.fK,{children:[t.jsx(r.$N,{children:D?"Edit Prompt":"Create New Prompt"}),t.jsx(r.Be,{children:D?"Update your prompt template":"Create a reusable prompt template with variables"})]}),(0,t.jsxs)("div",{className:"space-y-6 py-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c._,{htmlFor:"name",children:["Name ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(n.I,{id:"name",placeholder:"Customer Support Template",value:z,onChange:e=>F(e.target.value)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(c._,{htmlFor:"description",children:"Description"}),t.jsx(n.I,{id:"description",placeholder:"Brief description of this prompt",value:E,onChange:e=>B(e.target.value)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(c._,{htmlFor:"content",children:["Prompt Content ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(d.g,{id:"content",placeholder:"You are helping {{customer_name}} with their {{issue}}...",value:I,onChange:e=>M(e.target.value),rows:8,className:"font-mono text-sm"}),(0,t.jsxs)("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[t.jsx(m.Z,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),(0,t.jsxs)("span",{children:["Use"," ",(0,t.jsxs)("code",{className:"bg-muted px-1 py-0.5 rounded",children:["{","{","variable_name","}}"]})," ","format for dynamic content. Variable names can only contain letters, numbers, and underscores."]})]}),G.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 pt-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground mr-2",children:"Detected variables:"}),G.map(e=>t.jsx(o.C,{variant:"outline",className:"text-xs",children:e},e))]}),!ee&&(0,t.jsxs)("div",{className:"text-xs text-destructive",children:["Invalid variable names: ",es.join(", ")]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(c._,{children:"Assign to Agents"}),(0,t.jsxs)(w.J2,{modal:!0,open:J,onOpenChange:X,children:[t.jsx(w.xo,{asChild:!0,children:(0,t.jsxs)(l.z,{variant:"outline",role:"combobox","aria-expanded":J,className:"w-full justify-between",children:[0===W.length?"Select agents...":`${W.length} agent${1!==W.length?"s":""} selected`,t.jsx(x.Z,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(w.yk,{className:"w-full p-0",children:(0,t.jsxs)(N.mY,{children:[t.jsx(N.sZ,{placeholder:"Search agents..."}),(0,t.jsxs)(N.e8,{children:[t.jsx(N.rb,{children:"No agents found."}),t.jsx(N.fu,{children:K.map(e=>(0,t.jsxs)(N.di,{value:e.id,onSelect:()=>{H(s=>s.includes(e.id)?s.filter(s=>s!==e.id):[...s,e.id])},children:[t.jsx(h.Z,{className:(0,C.cn)("mr-2 h-4 w-4",W.includes(e.id)?"opacity-100":"opacity-0")}),e.name]},e.id))})]})]})})]}),W.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:W.map(e=>{let s=K.find(s=>s.id===e);return s?(0,t.jsxs)(o.C,{variant:"secondary",className:"text-sm",children:[s.name,t.jsx("button",{type:"button",onClick:()=>H(s=>s.filter(s=>s!==e)),className:"ml-1.5 hover:text-destructive",children:t.jsx(p.Z,{className:"h-3 w-3"})})]},e):null})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Assign this prompt to specific agents to show it as recommended in chat"})]}),t.jsx(v.zF,{open:Q,onOpenChange:T,children:(0,t.jsxs)("div",{className:"space-y-2",children:[t.jsx(v.wy,{asChild:!0,children:(0,t.jsxs)(l.z,{variant:"outline",className:"w-full justify-between",children:["Access Control",(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["private"===R&&"Private","public"===R&&"Public","users"===R&&`${V.length} users`,"roles"===R&&`${O.length} roles`]})]})}),t.jsx(v.Fw,{className:"pt-2",children:t.jsx(f.P,{initialRightsMode:R,initialUsers:V,initialRoles:O,modalMode:!0,onChange:(e,s,a)=>{U(e),q(s),L(a)}})})]})})]}),(0,t.jsxs)(r.cN,{children:[t.jsx(l.z,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),t.jsx(l.z,{onClick:et,disabled:k||$||!z.trim()||!I.trim()||!ee,children:k||$?"Saving...":D?"Save Changes":"Create Prompt"})]})]})})}},52227:(e,s,a)=>{a.d(s,{EE:()=>n,Lq:()=>h,Sh:()=>l,VR:()=>o,er:()=>c,iJ:()=>d});var t=a(39167),i=a(18753),r=a(42270);let l=e=>(0,t.aM)(r.xx,{variables:{page:e?.page??1,limit:e?.limit??20,filters:e?.filters??[],sort:e?.sort??{field:"updatedAt",direction:"DESC"}}}),n=()=>(0,i.D)(r.Iv,{refetchQueries:[{query:r.xx,variables:{page:1,limit:20}}]}),c=()=>(0,i.D)(r.jA),d=()=>(0,i.D)(r.Ll,{refetchQueries:[{query:r.xx,variables:{page:1,limit:20}}]}),o=()=>(0,i.D)(r.re),m=()=>(0,i.D)(r.Nl),x=()=>(0,i.D)(r.m8),h=()=>{let[e]=m(),[s]=x(),[a]=(0,i.D)(r.UK);return{toggleFavorite:async(t,i,r,l,n)=>{r&&n?(await s({variables:{id:n}}),await a({variables:{id:t,favorite_count:Math.max(0,l-1)}})):(await e({variables:{user_id:i,prompt_id:t}}),await a({variables:{id:t,favorite_count:l+1}}))}}}},3151:(e,s,a)=>{a.d(s,{H:()=>t});function t(e){if(!e)return[];let s=e.matchAll(/\{\{([a-zA-Z0-9_]+)\}\}/g),a=new Set;for(let e of Array.from(s))a.add(e[1]);return Array.from(a).sort()}}};