@exulu/frontend 1.8.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 (146) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +129 -131
  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-paths-manifest.json +6 -6
  51. package/dist/.next/server/chunks/1025.js +1 -0
  52. package/dist/.next/server/chunks/2270.js +11 -48
  53. package/dist/.next/server/chunks/3434.js +1 -1
  54. package/dist/.next/server/chunks/3503.js +1 -0
  55. package/dist/.next/server/chunks/5084.js +1 -0
  56. package/dist/.next/server/chunks/5192.js +1 -1
  57. package/dist/.next/server/chunks/5485.js +1 -1
  58. package/dist/.next/server/chunks/5600.js +1 -1
  59. package/dist/.next/server/chunks/5974.js +1 -0
  60. package/dist/.next/server/chunks/6590.js +1 -1
  61. package/dist/.next/server/chunks/7471.js +1 -1
  62. package/dist/.next/server/chunks/8286.js +1 -1
  63. package/dist/.next/server/chunks/{3679.js → 9874.js} +5 -5
  64. package/dist/.next/server/middleware-manifest.json +5 -5
  65. package/dist/.next/server/pages/404.html +1 -1
  66. package/dist/.next/server/pages/500.html +1 -1
  67. package/dist/.next/server/server-reference-manifest.json +1 -1
  68. package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js +2 -0
  69. package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js.map +1 -0
  70. package/dist/.next/static/chunks/{4811-316807e25b634f9f.js → 192-72d6868cd891ccc6.js} +8 -8
  71. package/dist/.next/static/chunks/192-72d6868cd891ccc6.js.map +1 -0
  72. package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js +2 -0
  73. package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js.map +1 -0
  74. package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js +2 -0
  75. package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js.map +1 -0
  76. package/dist/.next/static/chunks/552-39155a93c527ec6d.js +2 -0
  77. package/dist/.next/static/chunks/552-39155a93c527ec6d.js.map +1 -0
  78. package/dist/.next/static/chunks/6367-59655a85d75e19be.js +2 -0
  79. package/dist/.next/static/chunks/6367-59655a85d75e19be.js.map +1 -0
  80. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js +2 -0
  81. package/dist/.next/static/chunks/6373-601400fab8a3bb55.js.map +1 -0
  82. package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js +2 -0
  83. package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js.map +1 -0
  84. package/dist/.next/static/chunks/{6805-792cc8008b165c07.js → 8293-0e69d89d2dac7111.js} +10 -10
  85. package/dist/.next/static/chunks/8293-0e69d89d2dac7111.js.map +1 -0
  86. package/dist/.next/static/chunks/9953-95900a236271a222.js +2 -0
  87. package/dist/.next/static/chunks/9953-95900a236271a222.js.map +1 -0
  88. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js +2 -0
  89. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js.map +1 -0
  90. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js +2 -0
  91. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js.map +1 -0
  92. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js +2 -0
  93. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js.map +1 -0
  94. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js +2 -0
  95. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js.map +1 -0
  96. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js → page-827f50c6d1f150d0.js} +2 -2
  97. package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js.map → page-827f50c6d1f150d0.js.map} +1 -1
  98. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js +2 -0
  99. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js.map +1 -0
  100. package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js +2 -0
  101. package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js.map +1 -0
  102. package/dist/.next/static/chunks/app/(application)/workflows/{page-47dedb88cec600d5.js → page-e38f9456120dab69.js} +2 -2
  103. package/dist/.next/static/chunks/app/(application)/workflows/page-e38f9456120dab69.js.map +1 -0
  104. package/dist/.next/static/css/6f8c5212af8ef284.css +4 -0
  105. package/dist/.next/static/css/6f8c5212af8ef284.css.map +1 -0
  106. package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
  107. package/package.json +1 -1
  108. package/dist/.next/server/chunks/2948.js +0 -1
  109. package/dist/.next/server/chunks/38.js +0 -1
  110. package/dist/.next/server/chunks/7958.js +0 -1
  111. package/dist/.next/server/chunks/8050.js +0 -1
  112. package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js +0 -2
  113. package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js.map +0 -1
  114. package/dist/.next/static/chunks/1957-39a01a3915f246ab.js +0 -2
  115. package/dist/.next/static/chunks/1957-39a01a3915f246ab.js.map +0 -1
  116. package/dist/.next/static/chunks/4811-316807e25b634f9f.js.map +0 -1
  117. package/dist/.next/static/chunks/5282-68f9880f1f951f44.js +0 -2
  118. package/dist/.next/static/chunks/5282-68f9880f1f951f44.js.map +0 -1
  119. package/dist/.next/static/chunks/6367-59cef3c74213925b.js +0 -2
  120. package/dist/.next/static/chunks/6367-59cef3c74213925b.js.map +0 -1
  121. package/dist/.next/static/chunks/6373-4c5dffaf4193621c.js +0 -2
  122. package/dist/.next/static/chunks/6373-4c5dffaf4193621c.js.map +0 -1
  123. package/dist/.next/static/chunks/6805-792cc8008b165c07.js.map +0 -1
  124. package/dist/.next/static/chunks/8030-c1b6be46253076cb.js +0 -2
  125. package/dist/.next/static/chunks/8030-c1b6be46253076cb.js.map +0 -1
  126. package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js +0 -2
  127. package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js.map +0 -1
  128. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js +0 -2
  129. package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js.map +0 -1
  130. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-4e7e02768ed1a72a.js +0 -2
  131. package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-4e7e02768ed1a72a.js.map +0 -1
  132. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js +0 -2
  133. package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js.map +0 -1
  134. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js +0 -2
  135. package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js.map +0 -1
  136. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js +0 -2
  137. package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js.map +0 -1
  138. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-bc859da58d8505f7.js +0 -2
  139. package/dist/.next/static/chunks/app/(application)/projects/[project]/page-bc859da58d8505f7.js.map +0 -1
  140. package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js +0 -2
  141. package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js.map +0 -1
  142. package/dist/.next/static/chunks/app/(application)/workflows/page-47dedb88cec600d5.js.map +0 -1
  143. package/dist/.next/static/css/c8c015815c72d053.css +0 -4
  144. package/dist/.next/static/css/c8c015815c72d053.css.map +0 -1
  145. /package/dist/.next/static/{GOwerAkBncYx0J8q1TqQb → ls-syPkq9-MWp-VWWDEZJ}/_buildManifest.js +0 -0
  146. /package/dist/.next/static/{GOwerAkBncYx0J8q1TqQb → ls-syPkq9-MWp-VWWDEZJ}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=2270,exports.ids=[2270],exports.modules={42270:(e,t,i)=>{i.d(t,{$6:()=>ed,$W:()=>eE,A1:()=>_,Ak:()=>ev,Au:()=>e_,Az:()=>Z,B4:()=>eH,BK:()=>es,B_:()=>en,C3:()=>I,CN:()=>eP,Dt:()=>F,E3:()=>W,Ep:()=>e0,Eq:()=>f,GJ:()=>m,Hk:()=>el,Iv:()=>e4,JL:()=>b,JM:()=>L,Jq:()=>eV,L5:()=>ea,Ll:()=>e5,MU:()=>C,Md:()=>s,Mh:()=>eO,Mp:()=>ei,N:()=>h,Nl:()=>tt,Nu:()=>eY,OP:()=>eX,P3:()=>l,Pe:()=>O,QW:()=>eZ,Qf:()=>H,RV:()=>ej,S9:()=>K,Tj:()=>em,Tp:()=>E,Ts:()=>eG,UK:()=>e8,Ul:()=>N,W6:()=>eu,W9:()=>j,Wc:()=>r,Wr:()=>eL,X0:()=>e7,YH:()=>ef,Yr:()=>eb,ZA:()=>ey,ZX:()=>w,Zy:()=>er,_J:()=>eo,as:()=>R,b2:()=>eh,bI:()=>B,c2:()=>X,ci:()=>Y,d5:()=>eC,dc:()=>c,eY:()=>V,fA:()=>e1,fB:()=>x,fG:()=>M,fM:()=>eS,fV:()=>p,fc:()=>eM,fo:()=>q,hx:()=>ek,i9:()=>eT,iA:()=>eN,iC:()=>eK,j9:()=>ec,jA:()=>e3,jL:()=>eA,jm:()=>ew,k9:()=>eW,kH:()=>J,kZ:()=>eg,kk:()=>e$,kp:()=>eB,l1:()=>D,lU:()=>et,lW:()=>eU,lk:()=>k,m8:()=>ti,mN:()=>v,oo:()=>eQ,ps:()=>P,qK:()=>T,r1:()=>A,rR:()=>G,re:()=>e6,s5:()=>eJ,s7:()=>z,tK:()=>ep,tO:()=>y,ty:()=>S,ui:()=>Q,uw:()=>g,vP:()=>eF,ve:()=>U,xR:()=>ee,xx:()=>e9,ym:()=>u});var a=i(74904);let s="_itemsPagination",r="_itemsCreateOne",n=`
1
+ "use strict";exports.id=2270,exports.ids=[2270],exports.modules={42270:(e,t,i)=>{i.d(t,{$6:()=>ed,$W:()=>eE,A1:()=>_,Ak:()=>ev,Au:()=>e_,Az:()=>Z,B4:()=>eH,BK:()=>es,B_:()=>en,C3:()=>I,CN:()=>eP,Dt:()=>F,E3:()=>W,Ep:()=>e0,Eq:()=>f,GJ:()=>m,Hk:()=>el,Iv:()=>e4,JL:()=>b,JM:()=>L,Jq:()=>eV,L5:()=>ea,Ll:()=>e5,MU:()=>C,Md:()=>s,Mh:()=>eO,Mp:()=>ei,N:()=>h,Nl:()=>tt,Nu:()=>eY,OP:()=>eX,P3:()=>l,Pe:()=>O,QW:()=>eZ,Qf:()=>H,RV:()=>ej,S9:()=>K,Tj:()=>em,Tp:()=>E,Ts:()=>eG,UK:()=>e8,Ul:()=>N,W6:()=>eu,W9:()=>j,Wc:()=>r,Wr:()=>eL,X0:()=>e7,YH:()=>ef,Yr:()=>eb,ZA:()=>ey,ZX:()=>w,Zy:()=>er,_J:()=>eo,as:()=>R,b2:()=>eh,bI:()=>B,c2:()=>X,ci:()=>Y,d5:()=>eC,dc:()=>c,eY:()=>V,fA:()=>e1,fB:()=>x,fG:()=>M,fM:()=>eS,fV:()=>g,fc:()=>eM,fo:()=>q,hx:()=>ek,i9:()=>eT,iA:()=>eN,iC:()=>eK,j9:()=>ec,jA:()=>e3,jL:()=>eA,jm:()=>ew,k9:()=>eW,kH:()=>J,kZ:()=>ep,kk:()=>e$,kp:()=>eB,l1:()=>D,lU:()=>et,lW:()=>eU,lk:()=>k,m8:()=>ti,mN:()=>v,oo:()=>eQ,ps:()=>P,qK:()=>T,r1:()=>A,rR:()=>G,re:()=>e6,s5:()=>eJ,s7:()=>z,tK:()=>eg,tO:()=>y,ty:()=>S,ui:()=>Q,uw:()=>p,vP:()=>eF,ve:()=>U,xR:()=>ee,xx:()=>e9,ym:()=>u});var a=i(74904);let s="_itemsPagination",r="_itemsCreateOne",n=`
2
2
  id
3
3
  name
4
4
  description
@@ -55,10 +55,6 @@ RBAC {
55
55
  id
56
56
  rights
57
57
  }
58
- projects {
59
- id
60
- rights
61
- }
62
58
  }
63
59
  ${e.join("\n")}
64
60
  `,d=`
@@ -117,10 +113,6 @@ RBAC {
117
113
  id
118
114
  rights
119
115
  }
120
- projects {
121
- id
122
- rights
123
- }
124
116
  }
125
117
  createdAt
126
118
  updatedAt
@@ -175,6 +167,7 @@ updatedAt
175
167
  user
176
168
  title
177
169
  agent
170
+ project
178
171
  rights_mode
179
172
  RBAC {
180
173
  type
@@ -186,16 +179,12 @@ updatedAt
186
179
  id
187
180
  rights
188
181
  }
189
- projects {
190
- id
191
- rights
192
- }
193
182
  }
194
183
  id
195
184
  }
196
185
  }
197
186
  }
198
- `,g=(0,a.Ps)`
187
+ `,p=(0,a.Ps)`
199
188
  query GetContexts {
200
189
  contexts {
201
190
  items {
@@ -203,7 +192,7 @@ updatedAt
203
192
  }
204
193
  }
205
194
  }
206
- `,p=(0,a.Ps)`
195
+ `,g=(0,a.Ps)`
207
196
  query GetContextById($id: ID!) {
208
197
  contextById(id: $id) {
209
198
  ${n}
@@ -469,8 +458,8 @@ updatedAt
469
458
  }
470
459
  }
471
460
  `;let R=(0,a.Ps)`
472
- query GetAgentById($id: ID!) {
473
- agentById(id: $id) {
461
+ query GetAgentById($id: ID!, $project: ID) {
462
+ agentById(id: $id, project: $project) {
474
463
  ${$}
475
464
  }
476
465
  }
@@ -490,6 +479,7 @@ updatedAt
490
479
  agent
491
480
  created_by
492
481
  rights_mode
482
+ project
493
483
  RBAC {
494
484
  type
495
485
  users {
@@ -500,10 +490,6 @@ updatedAt
500
490
  id
501
491
  rights
502
492
  }
503
- projects {
504
- id
505
- rights
506
- }
507
493
  }
508
494
  id
509
495
  }
@@ -512,6 +498,7 @@ updatedAt
512
498
  query GetAgentSession($filters: [FilterAgent_session]) {
513
499
  agent_sessionOne(filters: $filters) {
514
500
  createdAt
501
+ project
515
502
  updatedAt
516
503
  user
517
504
  title
@@ -612,7 +599,7 @@ updatedAt
612
599
  $RBAC: RBACInput
613
600
  ) {
614
601
  agent_sessionsCreateOne(
615
- input: { agent: $agent, user: $user, title: $title, project: $project, rights_mode: $rights_mode, RBAC: $RBAC }
602
+ input: { agent: $agent, user: $user, project: $project, title: $title, rights_mode: $rights_mode, RBAC: $RBAC }
616
603
  ) {
617
604
  item {
618
605
  id
@@ -653,10 +640,6 @@ updatedAt
653
640
  id
654
641
  rights
655
642
  }
656
- projects {
657
- id
658
- rights
659
- }
660
643
  }
661
644
  createdAt
662
645
  }
@@ -734,10 +717,6 @@ updatedAt
734
717
  id
735
718
  rights
736
719
  }
737
- projects {
738
- id
739
- rights
740
- }
741
720
  }
742
721
  }
743
722
  }
@@ -1023,10 +1002,6 @@ updatedAt
1023
1002
  id
1024
1003
  rights
1025
1004
  }
1026
- projects {
1027
- id
1028
- rights
1029
- }
1030
1005
  }
1031
1006
  }
1032
1007
  }
@@ -1135,10 +1110,6 @@ updatedAt
1135
1110
  id
1136
1111
  rights
1137
1112
  }
1138
- projects {
1139
- id
1140
- rights
1141
- }
1142
1113
  }
1143
1114
  variables
1144
1115
  steps_json
@@ -1192,7 +1163,7 @@ updatedAt
1192
1163
  count
1193
1164
  }
1194
1165
  }
1195
- `;let eg=(0,a.Ps)`
1166
+ `;let ep=(0,a.Ps)`
1196
1167
  query FunctionCallsStatistics($from: Date!, $to: Date!) {
1197
1168
  trackingStatistics(filters: {
1198
1169
  type: { eq: TOOL_CALL }
@@ -1202,7 +1173,7 @@ updatedAt
1202
1173
  count
1203
1174
  }
1204
1175
  }
1205
- `,ep=(0,a.Ps)`
1176
+ `,eg=(0,a.Ps)`
1206
1177
  query AgentCallsStatistics($from: Date!, $to: Date!) {
1207
1178
  trackingStatistics(filters: {
1208
1179
  type: { eq: AGENT_RUN }
@@ -1437,10 +1408,6 @@ query AgentStatistics($from: Date!, $to: Date!, $names: [String!]) {
1437
1408
  id
1438
1409
  rights
1439
1410
  }
1440
- projects {
1441
- id
1442
- rights
1443
- }
1444
1411
  }
1445
1412
  `,ej=(0,a.Ps)`
1446
1413
  query GetTestCases(
@@ -1755,10 +1722,6 @@ query AgentStatistics($from: Date!, $to: Date!, $names: [String!]) {
1755
1722
  id
1756
1723
  rights
1757
1724
  }
1758
- projects {
1759
- id
1760
- rights
1761
- }
1762
1725
  }
1763
1726
  `,e9=(0,a.Ps)`
1764
1727
  query GetPrompts(
@@ -1 +1 @@
1
- "use strict";exports.id=3434,exports.ids=[3434],exports.modules={360:(e,s,a)=>{a.d(s,{x:()=>w});var t=a(10326),r=a(17577),l=a(18753),i=a(15211),n=a(42270),d=a(62288),o=a(90772),c=a(54432),m=a(87673),x=a(31048),u=a(941),h=a(85206),p=a(98091),v=a(34789),g=a(77863),b=a(15286),j=a(79210),f=a(36931);function w({isOpen:e,onClose:s,messages:a,sessionTitle:w,existingWorkflow:N,isReadOnly:y=!1}){let{user:C}=(0,r.useContext)(i.S),{toast:k}=(0,v.pm)(),[_,Z]=(0,r.useState)({rights_mode:N?.rights_mode||"private",users:N?.RBAC?.users||[],roles:N?.RBAC?.roles||[],projects:N?.RBAC?.projects||[]}),A=!!N,[S,z]=(0,r.useState)(N?.name||""),[E,D]=(0,r.useState)(N?.description||""),[U,B]=(0,r.useState)(N?.variables||[]),[R,W]=(0,r.useState)(N?.steps_json||[]),[$,M]=(0,r.useState)(!1),[P,V]=(0,r.useState)("setup"),[q,F]=(0,r.useState)(!1),[I,O]=(0,r.useState)(null),[H,K]=(0,r.useState)(""),[L]=(0,l.D)(n.B_),[T]=(0,l.D)(n._J),J=(0,r.useCallback)((e,s)=>{if(!e.match(/^[A-Za-z_][A-Za-z0-9_]{1,63}$/))return k({title:"Invalid variable name",description:"Variable name must start with a letter or underscore, contain only letters, numbers, and underscores, and be 2-64 characters long.",variant:"destructive"}),!1;if(U.some(s=>s.name===e))return!0;let a={name:e,type:"string",required:!0,description:s||"Auto-detected variable"};return B(e=>[...e,a]),!0},[U,k]),Q=(0,r.useCallback)((e,s)=>{let a=(s.match(/\{([A-Za-z_][A-Za-z0-9_]{1,63})\}/g)||[]).map(e=>e.slice(1,-1));a.forEach(e=>{J(e)}),W(t=>t.map(t=>t.id===e?{...t,content:s,variablesUsed:a}:t));let t=new Set;R.forEach(a=>{a.id===e?(s.match(/\{([A-Za-z_][A-Za-z0-9_]{1,63})\}/g)||[]).forEach(e=>t.add(e.slice(1,-1))):a.variablesUsed&&a.variablesUsed.forEach(e=>t.add(e))}),B(e=>e.filter(e=>t.has(e.name)))},[R,J]),G=(0,r.useCallback)(e=>{B(s=>s.filter(s=>s.name!==e)),W(s=>s.map(s=>({...s,content:s.content?.replace(RegExp(`\\{${e}\\}`,"g"),""),variablesUsed:s.variablesUsed?.filter(s=>s!==e)||[]})))},[]),X=(0,r.useCallback)((e,s)=>s.match(/^[A-Za-z_][A-Za-z0-9_]{1,63}$/)?U.some(a=>a.name===s&&a.name!==e)?(k({title:"Variable name already exists",description:"A variable with this name already exists.",variant:"destructive"}),!1):(B(a=>a.map(a=>a.name===e?{...a,name:s}:a)),W(a=>a.map(a=>({...a,content:a.content?.replace(RegExp(`\\{${e}\\}`,"g"),`{${s}}`),variablesUsed:a.variablesUsed?.map(a=>a===e?s:a)||[]}))),!0):(k({title:"Invalid variable name",description:"Variable name must start with a letter or underscore and contain only letters, numbers, and underscores.",variant:"destructive"}),!1),[U,k]),Y=(0,r.useMemo)(()=>!!S.trim()&&0!==R.length&&("users"!==_.rights_mode||_.users?.length!==0)&&("roles"!==_.rights_mode||_.roles?.length!==0)&&("projects"!==_.rights_mode||_.projects?.length!==0)&&R.filter(e=>"user"===e.type).every(e=>{let s=e.content||"";return(s?.replace(/\{[^}]+\}/g,"")).trim().length>0}),[S,R,_]),ee=(0,r.useCallback)(async()=>{if(Y&&C?.id){M(!0);try{let e=R.map(e=>({id:e.id,type:e.type,..."user"===e.type&&{content:e.content},..."assistant"===e.type&&{contentExample:e.contentExample},..."tool"===e.type&&{toolName:e.toolName}}));A&&N?(await T({variables:{id:N.id,name:S.trim(),description:E.trim()||null,rights_mode:_.rights_mode,RBAC:{users:_.users,roles:_.roles,projects:_.projects},variables:U,steps_json:e}}),k({title:"Workflow updated!",description:`"${S}" has been updated successfully.`})):(await L({variables:{name:S.trim(),description:E.trim()||null,owner:C.id,rights_mode:_.rights_mode,RBAC:{users:_.users,roles:_.roles,projects:_.projects},variables:U,steps_json:e}}),k({title:"Workflow created!",description:`"${S}" has been saved as a workflow template.`})),s()}catch(e){console.error("Error saving workflow:",e),k({title:"Error saving workflow",description:"There was an error saving your workflow. Please try again.",variant:"destructive"})}finally{M(!1)}}},[Y,C?.id,S,E,_,U,R,L,T,k,s,A,N]);return e?t.jsx(d.Vq,{open:e,onOpenChange:s,children:(0,t.jsxs)(d.cZ,{className:"max-w-4xl max-h-[92vh] flex flex-col",children:[(0,t.jsxs)(d.fK,{className:"pb-4",children:[t.jsx(d.$N,{className:"text-lg",children:A?y?"View Workflow":"Edit Workflow":"Save as Workflow"}),t.jsx(d.Be,{className:"text-sm",children:A?y?"View workflow details and configuration.":"Modify this workflow template. Edit your messages and use {variable_name} syntax to create variables.":"Convert this conversation into a reusable workflow template. Edit your messages and use {variable_name} syntax to create variables."})]}),t.jsx("div",{className:"flex-1 mt-6",children:(0,t.jsxs)(j.mQ,{value:P,onValueChange:V,className:"h-full flex flex-col",children:[(0,t.jsxs)(j.dr,{className:"grid w-full grid-cols-2 mb-6",children:[t.jsx(j.SP,{value:"setup",className:"data-[state=active]:bg-background",children:"Setup & Permissions"}),t.jsx(j.SP,{value:"workflow",className:"data-[state=active]:bg-background",children:"Workflow Steps & Variables"})]}),(0,t.jsxs)("div",{className:"flex-1 pb-6",children:[t.jsx(j.nU,{value:"setup",className:"mt-0 h-full",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[t.jsx(x._,{htmlFor:"workflow-name",className:"text-base font-semibold",children:"Workflow Name *"}),t.jsx(c.I,{id:"workflow-name",value:S,onChange:e=>z(e.target.value),placeholder:"My Workflow",className:"mt-2 h-11",readOnly:y}),!S.trim()&&(0,t.jsxs)("p",{className:"text-sm text-destructive mt-1 flex items-center",children:[t.jsx("span",{className:"mr-1",children:"⚠️"}),"Workflow name is required"]})]}),(0,t.jsxs)("div",{children:[t.jsx(x._,{htmlFor:"workflow-description",className:"text-base font-semibold",children:"Description"}),t.jsx(m.g,{id:"workflow-description",value:E,onChange:e=>D(e.target.value),placeholder:"Describe what this workflow does and when to use it...",rows:3,className:"mt-2 resize-none",readOnly:y})]})]}),(0,t.jsxs)("div",{className:"border-t pt-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[t.jsx("h3",{className:"text-base font-semibold mb-1",children:"Sharing & Permissions"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Control who can view and edit this workflow"})]}),(0,t.jsxs)(o.z,{type:"button",variant:"outline",size:"sm",onClick:()=>F(!q),className:"ml-4",children:[q?"Hide Advanced":"Show Advanced",t.jsx(u.Z,{className:(0,g.cn)("w-4 h-4 ml-1 transition-transform",q&&"rotate-180")})]})]}),q&&t.jsx(b.P,{initialRightsMode:N?.rights_mode,initialUsers:N?.RBAC?.users,initialRoles:N?.RBAC?.roles,initialProjects:N?.RBAC?.projects,onChange:(e,s,a,t)=>{Z({rights_mode:e,users:s,roles:a,projects:t})}}),!q&&t.jsx("div",{className:"text-sm text-muted-foreground bg-muted/30 p-3 rounded-md",children:"Using default permissions (private to you)"})]})]})}),t.jsx(j.nU,{value:"workflow",className:"mt-0 h-full",children:(0,t.jsxs)("div",{className:"h-full flex gap-6",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-base font-semibold mb-2",children:"Conversation Steps"}),t.jsx("div",{className:"border rounded-lg p-3 mb-4",children:(0,t.jsxs)("p",{className:"text-sm",children:["\uD83D\uDCA1 ",t.jsx("strong",{children:"Pro tip:"})," Use ","{variable_name}"," syntax in your messages to create reusable variables. For example you can use ","{company_name}"," to create a variable for the company name so you can reuse this flow template with different companies."]})})]}),t.jsx("div",{className:"space-y-4 max-h-[500px] overflow-y-auto pr-2",children:R.map((e,s)=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-card",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[t.jsx("span",{className:(0,g.cn)("text-sm font-medium px-3 py-1 rounded-full","user"===e.type?"bg-blue-100 text-blue-700":"assistant"===e.type?"bg-green-100 text-green-700":"bg-purple-100 text-purple-700"),children:"user"===e.type?"\uD83D\uDC64 User":"assistant"===e.type?"\uD83E\uDD16 Assistant":`🔧 ${e.toolName}`}),e.variablesUsed&&e.variablesUsed.length>0&&t.jsx("div",{className:"flex gap-1 flex-wrap",children:e.variablesUsed.map(e=>t.jsx("span",{className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded font-mono border border-blue-200",children:`{${e}}`},e))})]}),"user"===e.type?t.jsx("div",{children:t.jsx(m.g,{value:e.content||"",onChange:s=>Q(e.id,s.target.value),placeholder:"Enter your message...",className:"min-h-[80px] resize-none",rows:3,readOnly:y})}):t.jsx("div",{className:"bg-muted/50 p-3 rounded-md",children:"assistant"===e.type?(0,t.jsxs)("div",{children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Example response (will be regenerated):"}),t.jsx(f.H,{children:e.contentExample})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:["Tool: ",e.toolName]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Parameters will be generated dynamically"})]})})]}),s<R.length-1&&t.jsx("div",{className:"flex justify-center my-3",children:t.jsx(u.Z,{className:"w-5 h-5 text-muted-foreground/50"})})]},e.id))})]}),(0,t.jsxs)("div",{className:"w-80",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("h3",{className:"text-base font-semibold mb-2",children:["Variables (",U.length,")"]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Auto-detected from your messages"})]}),U.length>0?t.jsx("div",{className:"space-y-3 max-h-[500px] overflow-y-auto",children:U.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 bg-card",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[t.jsx("div",{className:"font-mono text-blue-600 font-medium text-sm",children:`{${e.name}}`}),!y&&t.jsx("div",{className:"flex gap-1",children:I===e.name?t.jsx(c.I,{value:H,onChange:e=>K(e.target.value),className:"h-6 text-xs font-mono w-20",placeholder:"variable_name",autoFocus:!0,onKeyDown:s=>{"Enter"===s.key?(H&&H!==e.name&&X(e.name,H),O(null),K("")):"Escape"===s.key&&(O(null),K(""))},onBlur:()=>{H&&H!==e.name&&X(e.name,H),O(null),K("")}}):(0,t.jsxs)(t.Fragment,{children:[t.jsx(o.z,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{O(e.name),K(e.name)},children:t.jsx(h.Z,{className:"w-3 h-3"})}),t.jsx(o.z,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-destructive hover:bg-destructive/10",onClick:()=>G(e.name),children:t.jsx(p.Z,{className:"w-3 h-3"})})]})})]}),t.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:e.description}),(0,t.jsxs)("div",{className:"flex gap-1",children:[t.jsx("span",{className:"text-xs bg-gray-100 text-gray-700 px-1.5 py-0.5 rounded",children:e.type}),e.required&&t.jsx("span",{className:"text-xs bg-orange-100 text-orange-700 px-1.5 py-0.5 rounded",children:"required"})]})]},e.name))}):(0,t.jsxs)("div",{className:"text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",children:[t.jsx("div",{className:"mb-3",children:t.jsx("span",{className:"text-3xl",children:"\uD83D\uDCDD"})}),t.jsx("div",{className:"text-sm mb-1 font-medium",children:"No variables yet"}),(0,t.jsxs)("div",{className:"text-xs",children:["Use ","{variable_name}"," syntax in your messages"]})]})]})]})})]})]})}),t.jsx("div",{className:"border-t p-4 bg-background",children:(0,t.jsxs)(d.cN,{children:[t.jsx(o.z,{variant:"outline",onClick:s,children:y?"Close":"Cancel"}),!y&&t.jsx(t.Fragment,{children:t.jsx(o.z,{onClick:ee,disabled:!Y||$,className:(0,g.cn)("min-w-[140px]",!Y&&"opacity-50 cursor-not-allowed"),children:$?(0,t.jsxs)(t.Fragment,{children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),A?"Updating...":"Saving..."]}):A?"Update Workflow":"Save Workflow"})})]})})]})}):null}},37859:(e,s,a)=>{a.d(s,{g:()=>l});var t=a(10326),r=a(77863);let l=({className:e})=>(0,t.jsxs)("svg",{"aria-hidden":"true",role:"status",className:(0,r.cn)("inline w-4 h-4 text-white animate-spin fill-inherit",e),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",className:"fill-inherit opacity-20"}),t.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",className:"fill-inherit"})]})},54659:(e,s,a)=>{a.d(s,{Z:()=>t});let t=(0,a(76557).Z)("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},12714:(e,s,a)=>{a.d(s,{Z:()=>t});let t=(0,a(76557).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},85206:(e,s,a)=>{a.d(s,{Z:()=>t});let t=(0,a(76557).Z)("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]])}};
1
+ "use strict";exports.id=3434,exports.ids=[3434],exports.modules={360:(e,s,a)=>{a.d(s,{x:()=>w});var t=a(10326),r=a(17577),l=a(18753),n=a(15211),i=a(42270),d=a(62288),o=a(90772),c=a(54432),m=a(87673),x=a(31048),u=a(941),h=a(85206),p=a(98091),v=a(34789),b=a(77863),g=a(15286),f=a(79210),j=a(36931);function w({isOpen:e,onClose:s,messages:a,sessionTitle:w,existingWorkflow:N,isReadOnly:y=!1}){let{user:C}=(0,r.useContext)(n.S),{toast:k}=(0,v.pm)(),[_,Z]=(0,r.useState)({rights_mode:N?.rights_mode||"private",users:N?.RBAC?.users||[],roles:N?.RBAC?.roles||[]}),S=!!N,[z,A]=(0,r.useState)(N?.name||""),[E,D]=(0,r.useState)(N?.description||""),[U,W]=(0,r.useState)(N?.variables||[]),[$,B]=(0,r.useState)(N?.steps_json||[]),[M,R]=(0,r.useState)(!1),[V,P]=(0,r.useState)("setup"),[q,F]=(0,r.useState)(!1),[I,O]=(0,r.useState)(null),[H,K]=(0,r.useState)(""),[L]=(0,l.D)(i.B_),[T]=(0,l.D)(i._J),J=(0,r.useCallback)((e,s)=>{if(!e.match(/^[A-Za-z_][A-Za-z0-9_]{1,63}$/))return k({title:"Invalid variable name",description:"Variable name must start with a letter or underscore, contain only letters, numbers, and underscores, and be 2-64 characters long.",variant:"destructive"}),!1;if(U.some(s=>s.name===e))return!0;let a={name:e,type:"string",required:!0,description:s||"Auto-detected variable"};return W(e=>[...e,a]),!0},[U,k]),Q=(0,r.useCallback)((e,s)=>{let a=(s.match(/\{([A-Za-z_][A-Za-z0-9_]{1,63})\}/g)||[]).map(e=>e.slice(1,-1));a.forEach(e=>{J(e)}),B(t=>t.map(t=>t.id===e?{...t,content:s,variablesUsed:a}:t));let t=new Set;$.forEach(a=>{a.id===e?(s.match(/\{([A-Za-z_][A-Za-z0-9_]{1,63})\}/g)||[]).forEach(e=>t.add(e.slice(1,-1))):a.variablesUsed&&a.variablesUsed.forEach(e=>t.add(e))}),W(e=>e.filter(e=>t.has(e.name)))},[$,J]),G=(0,r.useCallback)(e=>{W(s=>s.filter(s=>s.name!==e)),B(s=>s.map(s=>({...s,content:s.content?.replace(RegExp(`\\{${e}\\}`,"g"),""),variablesUsed:s.variablesUsed?.filter(s=>s!==e)||[]})))},[]),X=(0,r.useCallback)((e,s)=>s.match(/^[A-Za-z_][A-Za-z0-9_]{1,63}$/)?U.some(a=>a.name===s&&a.name!==e)?(k({title:"Variable name already exists",description:"A variable with this name already exists.",variant:"destructive"}),!1):(W(a=>a.map(a=>a.name===e?{...a,name:s}:a)),B(a=>a.map(a=>({...a,content:a.content?.replace(RegExp(`\\{${e}\\}`,"g"),`{${s}}`),variablesUsed:a.variablesUsed?.map(a=>a===e?s:a)||[]}))),!0):(k({title:"Invalid variable name",description:"Variable name must start with a letter or underscore and contain only letters, numbers, and underscores.",variant:"destructive"}),!1),[U,k]),Y=(0,r.useMemo)(()=>!!z.trim()&&0!==$.length&&("users"!==_.rights_mode||_.users?.length!==0)&&("roles"!==_.rights_mode||_.roles?.length!==0)&&$.filter(e=>"user"===e.type).every(e=>{let s=e.content||"";return(s?.replace(/\{[^}]+\}/g,"")).trim().length>0}),[z,$,_]),ee=(0,r.useCallback)(async()=>{if(Y&&C?.id){R(!0);try{let e=$.map(e=>({id:e.id,type:e.type,..."user"===e.type&&{content:e.content},..."assistant"===e.type&&{contentExample:e.contentExample},..."tool"===e.type&&{toolName:e.toolName}}));S&&N?(await T({variables:{id:N.id,name:z.trim(),description:E.trim()||null,rights_mode:_.rights_mode,RBAC:{users:_.users,roles:_.roles},variables:U,steps_json:e}}),k({title:"Workflow updated!",description:`"${z}" has been updated successfully.`})):(await L({variables:{name:z.trim(),description:E.trim()||null,owner:C.id,rights_mode:_.rights_mode,RBAC:{users:_.users,roles:_.roles},variables:U,steps_json:e}}),k({title:"Workflow created!",description:`"${z}" has been saved as a workflow template.`})),s()}catch(e){console.error("Error saving workflow:",e),k({title:"Error saving workflow",description:"There was an error saving your workflow. Please try again.",variant:"destructive"})}finally{R(!1)}}},[Y,C?.id,z,E,_,U,$,L,T,k,s,S,N]);return e?t.jsx(d.Vq,{open:e,onOpenChange:s,children:(0,t.jsxs)(d.cZ,{className:"max-w-4xl max-h-[92vh] flex flex-col",children:[(0,t.jsxs)(d.fK,{className:"pb-4",children:[t.jsx(d.$N,{className:"text-lg",children:S?y?"View Workflow":"Edit Workflow":"Save as Workflow"}),t.jsx(d.Be,{className:"text-sm",children:S?y?"View workflow details and configuration.":"Modify this workflow template. Edit your messages and use {variable_name} syntax to create variables.":"Convert this conversation into a reusable workflow template. Edit your messages and use {variable_name} syntax to create variables."})]}),t.jsx("div",{className:"flex-1 mt-6",children:(0,t.jsxs)(f.mQ,{value:V,onValueChange:P,className:"h-full flex flex-col",children:[(0,t.jsxs)(f.dr,{className:"grid w-full grid-cols-2 mb-6",children:[t.jsx(f.SP,{value:"setup",className:"data-[state=active]:bg-background",children:"Setup & Permissions"}),t.jsx(f.SP,{value:"workflow",className:"data-[state=active]:bg-background",children:"Workflow Steps & Variables"})]}),(0,t.jsxs)("div",{className:"flex-1 pb-6",children:[t.jsx(f.nU,{value:"setup",className:"mt-0 h-full",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[t.jsx(x._,{htmlFor:"workflow-name",className:"text-base font-semibold",children:"Workflow Name *"}),t.jsx(c.I,{id:"workflow-name",value:z,onChange:e=>A(e.target.value),placeholder:"My Workflow",className:"mt-2 h-11",readOnly:y}),!z.trim()&&(0,t.jsxs)("p",{className:"text-sm text-destructive mt-1 flex items-center",children:[t.jsx("span",{className:"mr-1",children:"⚠️"}),"Workflow name is required"]})]}),(0,t.jsxs)("div",{children:[t.jsx(x._,{htmlFor:"workflow-description",className:"text-base font-semibold",children:"Description"}),t.jsx(m.g,{id:"workflow-description",value:E,onChange:e=>D(e.target.value),placeholder:"Describe what this workflow does and when to use it...",rows:3,className:"mt-2 resize-none",readOnly:y})]})]}),(0,t.jsxs)("div",{className:"border-t pt-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[t.jsx("h3",{className:"text-base font-semibold mb-1",children:"Sharing & Permissions"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Control who can view and edit this workflow"})]}),(0,t.jsxs)(o.z,{type:"button",variant:"outline",size:"sm",onClick:()=>F(!q),className:"ml-4",children:[q?"Hide Advanced":"Show Advanced",t.jsx(u.Z,{className:(0,b.cn)("w-4 h-4 ml-1 transition-transform",q&&"rotate-180")})]})]}),q&&t.jsx(g.P,{initialRightsMode:N?.rights_mode,initialUsers:N?.RBAC?.users,initialRoles:N?.RBAC?.roles,onChange:(e,s,a)=>{Z({rights_mode:e,users:s,roles:a})}}),!q&&t.jsx("div",{className:"text-sm text-muted-foreground bg-muted/30 p-3 rounded-md",children:"Using default permissions (private to you)"})]})]})}),t.jsx(f.nU,{value:"workflow",className:"mt-0 h-full",children:(0,t.jsxs)("div",{className:"h-full flex gap-6",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-base font-semibold mb-2",children:"Conversation Steps"}),t.jsx("div",{className:"border rounded-lg p-3 mb-4",children:(0,t.jsxs)("p",{className:"text-sm",children:["\uD83D\uDCA1 ",t.jsx("strong",{children:"Pro tip:"})," Use ","{variable_name}"," syntax in your messages to create reusable variables. For example you can use ","{company_name}"," to create a variable for the company name so you can reuse this flow template with different companies."]})})]}),t.jsx("div",{className:"space-y-4 max-h-[500px] overflow-y-auto pr-2",children:$.map((e,s)=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-card",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[t.jsx("span",{className:(0,b.cn)("text-sm font-medium px-3 py-1 rounded-full","user"===e.type?"bg-blue-100 text-blue-700":"assistant"===e.type?"bg-green-100 text-green-700":"bg-purple-100 text-purple-700"),children:"user"===e.type?"\uD83D\uDC64 User":"assistant"===e.type?"\uD83E\uDD16 Assistant":`🔧 ${e.toolName}`}),e.variablesUsed&&e.variablesUsed.length>0&&t.jsx("div",{className:"flex gap-1 flex-wrap",children:e.variablesUsed.map(e=>t.jsx("span",{className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded font-mono border border-blue-200",children:`{${e}}`},e))})]}),"user"===e.type?t.jsx("div",{children:t.jsx(m.g,{value:e.content||"",onChange:s=>Q(e.id,s.target.value),placeholder:"Enter your message...",className:"min-h-[80px] resize-none",rows:3,readOnly:y})}):t.jsx("div",{className:"bg-muted/50 p-3 rounded-md",children:"assistant"===e.type?(0,t.jsxs)("div",{children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Example response (will be regenerated):"}),t.jsx(j.H,{children:e.contentExample})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:["Tool: ",e.toolName]}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Parameters will be generated dynamically"})]})})]}),s<$.length-1&&t.jsx("div",{className:"flex justify-center my-3",children:t.jsx(u.Z,{className:"w-5 h-5 text-muted-foreground/50"})})]},e.id))})]}),(0,t.jsxs)("div",{className:"w-80",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("h3",{className:"text-base font-semibold mb-2",children:["Variables (",U.length,")"]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Auto-detected from your messages"})]}),U.length>0?t.jsx("div",{className:"space-y-3 max-h-[500px] overflow-y-auto",children:U.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 bg-card",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[t.jsx("div",{className:"font-mono text-blue-600 font-medium text-sm",children:`{${e.name}}`}),!y&&t.jsx("div",{className:"flex gap-1",children:I===e.name?t.jsx(c.I,{value:H,onChange:e=>K(e.target.value),className:"h-6 text-xs font-mono w-20",placeholder:"variable_name",autoFocus:!0,onKeyDown:s=>{"Enter"===s.key?(H&&H!==e.name&&X(e.name,H),O(null),K("")):"Escape"===s.key&&(O(null),K(""))},onBlur:()=>{H&&H!==e.name&&X(e.name,H),O(null),K("")}}):(0,t.jsxs)(t.Fragment,{children:[t.jsx(o.z,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{O(e.name),K(e.name)},children:t.jsx(h.Z,{className:"w-3 h-3"})}),t.jsx(o.z,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-destructive hover:bg-destructive/10",onClick:()=>G(e.name),children:t.jsx(p.Z,{className:"w-3 h-3"})})]})})]}),t.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:e.description}),(0,t.jsxs)("div",{className:"flex gap-1",children:[t.jsx("span",{className:"text-xs bg-gray-100 text-gray-700 px-1.5 py-0.5 rounded",children:e.type}),e.required&&t.jsx("span",{className:"text-xs bg-orange-100 text-orange-700 px-1.5 py-0.5 rounded",children:"required"})]})]},e.name))}):(0,t.jsxs)("div",{className:"text-center py-8 text-muted-foreground border-2 border-dashed rounded-lg",children:[t.jsx("div",{className:"mb-3",children:t.jsx("span",{className:"text-3xl",children:"\uD83D\uDCDD"})}),t.jsx("div",{className:"text-sm mb-1 font-medium",children:"No variables yet"}),(0,t.jsxs)("div",{className:"text-xs",children:["Use ","{variable_name}"," syntax in your messages"]})]})]})]})})]})]})}),t.jsx("div",{className:"border-t p-4 bg-background",children:(0,t.jsxs)(d.cN,{children:[t.jsx(o.z,{variant:"outline",onClick:s,children:y?"Close":"Cancel"}),!y&&t.jsx(t.Fragment,{children:t.jsx(o.z,{onClick:ee,disabled:!Y||M,className:(0,b.cn)("min-w-[140px]",!Y&&"opacity-50 cursor-not-allowed"),children:M?(0,t.jsxs)(t.Fragment,{children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),S?"Updating...":"Saving..."]}):S?"Update Workflow":"Save Workflow"})})]})})]})}):null}},37859:(e,s,a)=>{a.d(s,{g:()=>l});var t=a(10326),r=a(77863);let l=({className:e})=>(0,t.jsxs)("svg",{"aria-hidden":"true",role:"status",className:(0,r.cn)("inline w-4 h-4 text-white animate-spin fill-inherit",e),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",className:"fill-inherit opacity-20"}),t.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",className:"fill-inherit"})]})},54659:(e,s,a)=>{a.d(s,{Z:()=>t});let t=(0,a(76557).Z)("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},12714:(e,s,a)=>{a.d(s,{Z:()=>t});let t=(0,a(76557).Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},85206:(e,s,a)=>{a.d(s,{Z:()=>t});let t=(0,a(76557).Z)("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]])}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=3503,exports.ids=[3503],exports.modules={5354:(e,t,s)=>{s.d(t,{iG:()=>i,ri:()=>n});var a=s(10326);s(90772);var r=s(77863);s(17577);var l=s(30778);let n=({className:e,...t})=>a.jsx(l.h,{className:(0,r.cn)("relative flex-1 overflow-y-auto",e),initial:"smooth",resize:"smooth",role:"log",...t}),i=({className:e,...t})=>a.jsx(l.h.Content,{className:(0,r.cn)("p-4",e),...t})},87599:(e,t,s)=>{s.d(t,{K:()=>M});var a=s(10326);s(28758);var r=s(77863);let l=({className:e,from:t,...s})=>a.jsx("div",{className:(0,r.cn)("group flex w-full items-end justify-end gap-2 py-4","user"===t?"is-user flex-row-reverse justify-end":"is-assistant flex-row-reverse justify-end","[&>div]:max-w-[80%]",e),...s}),n=({children:e,className:t,...s})=>a.jsx("div",{className:(0,r.cn)("flex flex-col gap-2 overflow-hidden rounded-lg py-3 text-foreground text-sm","group-[.is-user]:bg-secondary group-[.is-user]:text-primary-foreground group-[.is-user]:px-4","group-[.is-assistant]:bg-transparent group-[.is-assistant]:text-foreground",t),...s,children:a.jsx("div",{className:"is-user:dark",children:e})});var i=s(90772),o=s(68232);let d=({className:e,children:t,...s})=>a.jsx("div",{className:(0,r.cn)("flex items-center gap-1",e),...s,children:t}),c=({tooltip:e,children:t,label:s,className:l,variant:n="ghost",size:d="sm",...c})=>{let m=(0,a.jsxs)(i.z,{className:(0,r.cn)("size-9 p-1.5 text-muted-foreground hover:text-foreground",l),size:d,type:"button",variant:n,...c,children:[t,a.jsx("span",{className:"sr-only",children:s||e})]});return e?a.jsx(o.pn,{children:(0,a.jsxs)(o.u,{children:[a.jsx(o.aJ,{asChild:!0,children:m}),a.jsx(o._v,{children:a.jsx("p",{children:e})})]})}):m};var m=s(36931),u=s(52067),p=s(24295),x=s(98360),h=s(941),g=s(17577);let f=(0,g.createContext)(null),j=()=>{let e=(0,g.useContext)(f);if(!e)throw Error("Reasoning components must be used within Reasoning");return e},N=(0,g.memo)(({className:e,isStreaming:t=!1,open:s,defaultOpen:l=!1,onOpenChange:n,duration:i,children:o,...d})=>{let[c,m]=(0,u.T)({prop:s,defaultProp:l,onChange:n}),[x,h]=(0,u.T)({prop:i,defaultProp:0}),[j,N]=(0,g.useState)(!1),[y,v]=(0,g.useState)(null);return(0,g.useEffect)(()=>{t?null===y&&v(Date.now()):null!==y&&(h(Math.round((Date.now()-y)/1e3)),v(null))},[t,y,h]),(0,g.useEffect)(()=>{if(t&&!c)m(!0);else if(!t&&c&&!l&&!j){let e=setTimeout(()=>{m(!1),N(!0)},1e3);return()=>clearTimeout(e)}},[t,c,l,m,j]),a.jsx(f.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:x},children:a.jsx(p.zF,{className:(0,r.cn)("not-prose mb-4",e),onOpenChange:e=>{m(e)},open:c,...d,children:o})})}),y=(0,g.memo)(({className:e,title:t="Reasoning",children:s,...l})=>{let{isStreaming:n,isOpen:i,duration:o}=j();return a.jsx(p.wy,{className:(0,r.cn)("flex items-center gap-2 text-muted-foreground text-sm",e),...l,children:s??(0,a.jsxs)(a.Fragment,{children:[a.jsx(x.Z,{className:"size-4"}),n||0===o?a.jsx("p",{children:"Thinking..."}):(0,a.jsxs)("p",{children:["Thought for ",o," seconds"]}),a.jsx(h.Z,{className:(0,r.cn)("size-4 text-muted-foreground transition-transform",i?"rotate-180":"rotate-0")})]})})}),v=(0,g.memo)(({className:e,children:t,...s})=>a.jsx(p.Fw,{className:(0,r.cn)("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...s,children:a.jsx(m.H,{className:"grid gap-2",children:t})}));N.displayName="Reasoning",y.displayName="ReasoningTrigger",v.displayName="ReasoningContent";var w=s(71876);let b=({className:e,...t})=>a.jsx(p.zF,{className:(0,r.cn)("not-prose mb-4 text-primary text-xs",e),...t}),C=({className:e,count:t,children:s,...r})=>a.jsx(p.wy,{className:"flex items-center gap-2",...r,children:s??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{className:"font-medium",children:["Used ",t," sources"]}),a.jsx(h.Z,{className:"h-4 w-4"})]})}),T=({className:e,...t})=>a.jsx(p.Fw,{className:(0,r.cn)("mt-3 flex w-fit flex-col gap-2","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),_=({href:e,title:t,children:s,...r})=>a.jsx("a",{className:"flex items-center gap-2",href:e,rel:"noreferrer",target:"_blank",...r,children:s??(0,a.jsxs)(a.Fragment,{children:[a.jsx(w.Z,{className:"h-4 w-4"}),a.jsx("span",{className:"block font-medium",children:t})]})});var k=s(91468),F=s(43810),$=s(46226),z=s(34789),Z=s(53982),P=s(75290),R=s(2179),I=s(91470);let L={pending:{icon:Z.Z,label:"Pending",className:"text-muted-foreground"},in_progress:{icon:P.Z,label:"In Progress",className:"text-blue-500 animate-spin"},completed:{icon:R.Z,label:"Completed",className:"text-green-500"},cancelled:{icon:I.Z,label:"Cancelled",className:"text-red-500"}},S={high:{label:"High",className:"bg-red-500/10 text-red-500 border-red-500/20"},medium:{label:"Medium",className:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20"},low:{label:"Low",className:"bg-blue-500/10 text-blue-500 border-blue-500/20"}},E=({todos:e,showPriority:t=!1,state:s,className:l,...n})=>{if("string"==typeof e&&(e=JSON.parse(e)),!e||0===e.length)return null;let i=e.filter(e=>"completed"===e.status).length,o=e.length;return(0,a.jsxs)("div",{className:(0,r.cn)("my-2 space-y-1","input-streaming"===s&&"opacity-70",l),...n,children:[e.map((s,l)=>{let n=L[s.status]?L[s.status].icon:L.pending.icon,i=L[s.status]?L[s.status].className:L.pending.className;S[s.priority]?S[s.priority].className:S.medium.className;let o="in_progress"===s.status&&l===e.findIndex(e=>"in_progress"===e.status);return(0,a.jsxs)("div",{className:(0,r.cn)("flex items-start gap-2 py-0.5","cancelled"===s.status&&"opacity-50"),children:[a.jsx("div",{className:"flex-shrink-0 pt-0.5",children:a.jsx(n,{className:(0,r.cn)("size-3.5",i)})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:(0,r.cn)("text-sm","completed"===s.status&&"text-muted-foreground line-through","cancelled"===s.status&&"text-muted-foreground line-through","in_progress"===s.status&&o&&"font-medium"),children:s.content}),t&&"high"===s.priority&&a.jsx("span",{className:"ml-2 text-red-500 text-xs",children:"(!)"})]})]},s.id)}),o>1&&(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-1 text-muted-foreground text-xs",children:[a.jsx("div",{className:"h-1 flex-1 overflow-hidden rounded-full bg-secondary",children:a.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${i/o*100}%`}})}),(0,a.jsxs)("span",{className:"whitespace-nowrap",children:[i,"/",o]})]}),"output-error"===s&&(0,a.jsxs)("div",{className:"flex items-center gap-1 pt-1 text-red-500 text-xs",children:[a.jsx(I.Z,{className:"size-3"}),a.jsx("span",{children:"Error updating tasks"})]})]})};var K=s(77961);function M({messages:e,status:t="idle",className:s,showActions:i=!0,onRegenerate:o,onAddToolResult:u,UntypedToolPartComponent:p,addToContext:x,writeAccess:h=!0,config:g}){let{toast:f}=(0,z.pm)();return a.jsx(a.Fragment,{children:e?.map((e,j)=>{let w=e.metadata,z=e.parts.filter(e=>"text"===e.type&&e.text?.includes('<file name="'))?.flatMap(e=>{let t=e.text.match(/<file name="([^"]+)">([^<]+)<\/file>/g);return t?.map(e=>{console.log("filePart",e);let t=e.match(/<file name="([^"]+)">/)?.[1]??"";return console.log("s3Key",t),{s3Key:t,content:e.match(/<file name="([^"]+)">([^<]+)<\/file>/)?.[2]??""}})??[]})??[];return console.log("files",z),a.jsx(l,{className:r.cn("assistant"===e.role&&(g?.customAssistantClassnames?g?.customAssistantClassnames:""),0===j&&(g?.marginTopFirstMessage?g?.marginTopFirstMessage:"mt-12"),s),from:e.role,children:a.jsxs(n,{children:[e.parts.map((s,r)=>{if("step-start"===s.type)return null;if("text"===s.type){let t=s.text.replace(/<file name="([^"]+)">([^<]+)<\/file>/g,"");return a.jsx(m.H,{className:"chat-response-container",children:t},`${e.id}-${r}_response`)}if("tool-askForConfirmation"===s.type&&u){let e=s.toolCallId;switch(s.state){case"input-streaming":return a.jsx("div",{children:"Loading confirmation request..."},e);case"input-available":return a.jsxs("div",{children:[s.input.message,a.jsxs("div",{children:[a.jsx("button",{onClick:()=>u({tool:"askForConfirmation",toolCallId:e,output:"Yes, confirmed"}),children:"Yes"}),a.jsx("button",{onClick:()=>u({tool:"askForConfirmation",toolCallId:e,output:"No, denied"}),children:"No"})]})]},e);case"output-available":return a.jsxs("div",{children:["Tool call allowed: ",s.output]},e);case"output-error":return a.jsxs("div",{children:["Error: ",s.errorText]},e)}}if(s.type?.toLowerCase().includes("preview_pdf")||s.type?.toLowerCase().includes("pdf_file_in_a_web_view")){let e=JSON.parse(s.output?.result??"{}");if(!e?.url)return a.jsxs("div",{children:["No URL provided for PDF preview ",JSON.stringify(e)]});let t=`${e.url}#page=${e.page??1}`;return a.jsx("iframe",{src:t,style:{width:"100%",height:"100vh"},title:"PDF viewer"})}if(s.type?.toLowerCase()==="tool-todo_write"||s.type?.toLowerCase()==="tool-todo_read"){let e=s.output;if(!e?.result)return null;let t=s.state;return a.jsx(E,{todos:e.result,showPriority:!0,state:t})}if((s.type.startsWith("tool-")||"dynamic-tool"===s.type)&&p&&x){let e=s.toolCallId;return a.jsx(p,{untypedToolPart:s,callId:e,addToContext:x},e)}return"file"===s.type&&s.mediaType?.startsWith("image/")?a.jsx($.default,{src:s.url,width:300,height:300,alt:"Generated image"},`${e.id}-${r}`):"source-url"===s.type?a.jsxs(b,{children:[a.jsx(C,{count:e.parts.filter(e=>"source-url"===e.type).length}),a.jsx(T,{children:e.parts.map((t,s)=>{if("source-url"===t.type)return a.jsx(_,{href:t.url,title:t.title},`${e.id}-${s}`)})},`${e.id}`)]},`${e.id}-${r}`):"reasoning"===s.type?a.jsxs(N,{className:"w-full",isStreaming:"streaming"===t,children:[a.jsx(y,{}),a.jsx(v,{children:s.text})]},`${e.id}-${r}`):null}),z.length>0&&a.jsx("div",{className:"grid grid-cols-6 min-w-[500px] gap-2 mt-3 mb-3",children:z.map(t=>a.jsx(K.jU,{s3Key:t.s3Key,onRemove:()=>{},active:!1,disabled:!1},t.s3Key+"_file_item_"+e.id))}),i&&"assistant"===e.role&&a.jsxs(d,{className:"mt-2",children:[o&&a.jsx(c,{onClick:()=>o(),label:"Retry",disabled:!h,children:a.jsx(k.Z,{className:"size-3"})}),a.jsx(c,{onClick:()=>{navigator.clipboard.writeText(e.parts.map(e=>e?.text||"").join("\n")),f({title:"Copied message",description:"The message was copied to your clipboard."})},label:"Copy",children:a.jsx(F.Z,{className:"size-3"})}),w?.totalTokens&&a.jsxs("small",{className:"text-muted-foreground",children:[Intl.NumberFormat("en-US").format(w?.totalTokens)," tokens"]})]})]})},e.id)})})}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=5084,exports.ids=[5084],exports.modules={85060:(e,s,t)=>{t.d(s,{F:()=>T});var a=t(10326),r=t(17577),l=t(39167),d=t(18753),n=t(18019),i=t(40617),o=t(1572),c=t(83855),m=t(87888),x=t(75290),u=t(62288),p=t(90772),f=t(54432),h=t(31048),g=t(87673),b=t(42270),v=t(34789),j=t(79210),N=t(33071),y=t(567),w=t(65685),C=t(77961),k=t(87599),S=t(5354);function T({open:e,onClose:s,evalSetId:t,onSuccess:T,testCase:Z}){let{toast:D}=(0,v.pm)(),R=!!Z,{data:_}=(0,l.aM)(b.Ul,{variables:{page:1,limit:100}}),{regularTools:z,agentTools:F,knowledgeSourceTools:V}=(0,r.useMemo)(()=>{let e=_?.tools?.items||[];return console.log("tools",e),{regularTools:e.filter(e=>"function"===e.type),agentTools:e.filter(e=>"agent"===e.type),knowledgeSourceTools:e.filter(e=>"context"===e.type)}},[_]),[M,A]=(0,r.useState)(""),[E,q]=(0,r.useState)(""),[O,U]=(0,r.useState)(""),[K,P]=(0,r.useState)([]),[Y,$]=(0,r.useState)(""),[B,I]=(0,r.useState)(null),[H,L]=(0,r.useState)([]),[W,G]=(0,r.useState)([]),[J,Q]=(0,r.useState)([]),[X,ee]=(0,r.useState)([]),[es,et]=(0,r.useState)(""),[ea,er]=(0,r.useState)(""),[el,ed]=(0,r.useState)(""),[en,{loading:ei}]=(0,d.D)(b.hx,{onCompleted:()=>{D({title:"Test case created",description:"The test case has been successfully created."}),T()},onError:e=>{D({title:"Failed to create test case",description:e.message,variant:"destructive"})}}),[eo,{loading:ec}]=(0,d.D)(b.Mh,{onCompleted:()=>{D({title:"Test case updated",description:"The test case has been successfully updated."}),T()},onError:e=>{D({title:"Failed to update test case",description:e.message,variant:"destructive"})}}),em=()=>{if(!Y.trim()&&0===H.length)return;let e=[];Y.trim()&&e.push({type:"text",text:Y.trim()}),H.length>0&&e.push(...H),P([...K,{id:`msg-${Date.now()}`,role:"user",parts:e},{id:`msg-${Date.now()}`,role:"assistant",metadata:{type:"placeholder"},parts:[{type:"text",text:"\uD83D\uDCAC Placeholder, generated agent response will be added here when the test case is run..."}]}]),$(""),I(null),L([])},ex=ei||ec;return a.jsx(u.Vq,{open:e,onOpenChange:s,children:(0,a.jsxs)(u.cZ,{className:"max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[(0,a.jsxs)(u.fK,{children:[(0,a.jsxs)(u.$N,{children:[R?"Edit Test Case":"Create Test Case"," ",t?`for Eval Set: ${t}`:""]}),a.jsx(u.Be,{children:R?"Update the test case details.":"Create a new test case with conversation inputs and expected outputs."})]}),(0,a.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!M.trim()||!O.trim()||0===K.length){D({title:"Validation error",description:"Name, at least one input message, and expected output are required.",variant:"destructive"});return}let s={name:M.trim(),description:E.trim()||null,inputs:K,expected_output:O.trim(),expected_tools:W.length>0?W:null,expected_knowledge_sources:J.length>0?J:null,expected_agent_tools:X.length>0?X:null,...t?{eval_set_id:t}:{}};R?eo({variables:{id:Z.id,data:s}}):en({variables:{data:s}})},className:"flex-1 overflow-hidden flex flex-col",children:[(0,a.jsxs)(j.mQ,{defaultValue:"basic",className:"flex-1 overflow-hidden flex flex-col",children:[(0,a.jsxs)(j.dr,{className:"grid w-full grid-cols-2",children:[(0,a.jsxs)(j.SP,{value:"basic",className:"gap-2",children:[a.jsx(n.Z,{className:"h-4 w-4"}),"Basic Info"]}),(0,a.jsxs)(j.SP,{value:"conversation",className:"gap-2",children:[a.jsx(i.Z,{className:"h-4 w-4"}),"Conversation"]})]}),(0,a.jsxs)(w.x,{className:"flex-1",children:[a.jsx(j.nU,{value:"basic",className:"space-y-4 p-1 mt-4",children:(0,a.jsxs)("div",{className:"grid gap-5",children:[(0,a.jsxs)("div",{className:"grid gap-2",children:[a.jsx(h._,{htmlFor:"name",children:"Name *"}),a.jsx(f.I,{id:"name",placeholder:"e.g., Customer Support - Refund Request",value:M,onChange:e=>A(e.target.value),disabled:ex,required:!0})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[a.jsx(h._,{htmlFor:"description",children:"Description"}),a.jsx(g.g,{id:"description",placeholder:"Describe what this test case evaluates...",value:E,onChange:e=>q(e.target.value),disabled:ex,rows:3})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[a.jsx(h._,{htmlFor:"expectedOutput",children:"Expected Output *"}),a.jsx(g.g,{id:"expectedOutput",placeholder:"Describe the expected final output (e.g., 'A JSON object containing refund details', 'An empathetic response offering alternatives')",value:O,onChange:e=>U(e.target.value),disabled:ex,rows:4,required:!0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"This can be an exact expected response or a description of what the output should contain."})]})]})}),a.jsx(j.nU,{value:"conversation",className:"space-y-4 p-1 mt-4",children:(0,a.jsxs)(N.Zb,{children:[a.jsx(N.Ol,{className:"pb-3",children:a.jsx("div",{className:"flex items-start justify-between",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)(N.ll,{className:"text-sm flex items-center gap-2",children:[a.jsx(i.Z,{className:"h-4 w-4"}),"Conversation Flow",K.length>0&&(0,a.jsxs)(y.C,{variant:"secondary",className:"ml-2",children:[K.length," ",1===K.length?"message":"messages"]})]}),a.jsx(N.SZ,{className:"mt-1.5",children:"Add user messages in order. The agent will run through this conversation flow and respond between each message automatically."})]})})}),(0,a.jsxs)(N.aY,{className:"space-y-6",children:[K?.length===0?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center border-2 border-dashed border-muted rounded-lg",children:[a.jsx(o.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No messages yet"}),a.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:"Start building your test conversation by adding user messages below."})]}):a.jsx(S.ri,{className:"max-h-[350px] overflow-y-auto border rounded-lg bg-muted/30 transition-all duration-300 ease-in-out",children:a.jsx(S.iG,{className:"px-6 py-4",children:a.jsx("div",{className:"animate-in fade-in duration-500",children:a.jsx(k.K,{messages:K,config:{marginTopFirstMessage:"mt-0",customAssistantClassnames:"bg-secondary/50 rounded-lg px-3 py-1 border-l-2 border-primary/30"},status:"ready",showActions:!1,writeAccess:!1})})})}),(0,a.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[a.jsx(h._,{htmlFor:"currentInput",className:"text-sm font-semibold",children:"Add User Message"}),(0,a.jsxs)("div",{className:"space-y-3",children:[a.jsx(g.g,{id:"currentInput",placeholder:"Type the user's message...",value:Y,onChange:e=>$(e.target.value),disabled:ex,rows:2,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),em())}}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[a.jsx(C.ZP,{id:"test-case-files",selectionLimit:10,allowedFileTypes:[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg"],dependencies:[],onConfirm:e=>{I(e)}}),(0,a.jsxs)(p.z,{type:"button",variant:"outline",onClick:em,disabled:ex||!Y.trim()&&0===H.length,className:"ml-auto",size:"default",children:[a.jsx(c.Z,{className:"h-4 w-4 mr-2"}),"Add Message"]})]}),B&&B.length>0&&(0,a.jsxs)(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-3 gap-2",children:B.map(e=>a.jsx(C.jU,{s3Key:e,disabled:!0,active:!1,onRemove:()=>{I(B?.filter(s=>s!==e))}}))}),(0,a.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg",children:[a.jsx(m.Z,{className:"h-4 w-4 text-amber-600 dark:text-amber-500 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("p",{className:"text-xs text-amber-900 dark:text-amber-200",children:[a.jsx("strong",{children:"Note:"})," When running this test case, ensure the selected agent supports the file types you've attached here (images, documents, audio, etc.)."]})]})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Press Enter to add, Shift+Enter for new line. You can attach files to messages."})]})]})]})})]})]}),(0,a.jsxs)(u.cN,{className:"mt-4 gap-2",children:[a.jsx(p.z,{type:"button",variant:"outline",onClick:s,disabled:ex,children:"Cancel"}),(0,a.jsxs)(p.z,{type:"submit",disabled:ex||!M.trim()||!O.trim()||0===K.length,className:"shadow-sm hover:shadow-md transition-all",children:[ex&&a.jsx(x.Z,{className:"mr-2 h-4 w-4 animate-spin"}),R?"Update Test Case":"Create Test Case"]})]})]})]})})}},567:(e,s,t)=>{t.d(s,{C:()=>n});var a=t(10326),r=t(79360);t(17577);var l=t(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 n({className:e,variant:s,...t}){return a.jsx("div",{className:(0,l.cn)(d({variant:s}),e),...t})}},33071:(e,s,t)=>{t.d(s,{Ol:()=>n,SZ:()=>o,Zb:()=>d,aY:()=>c,eW:()=>m,ll:()=>i});var a=t(10326),r=t(17577),l=t(77863);let d=r.forwardRef(({className:e,...s},t)=>a.jsx("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...s}));d.displayName="Card";let n=r.forwardRef(({className:e,...s},t)=>a.jsx("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",e),...s}));n.displayName="CardHeader";let i=r.forwardRef(({className:e,...s},t)=>a.jsx("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",e),...s}));i.displayName="CardTitle";let o=r.forwardRef(({className:e,...s},t)=>a.jsx("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",e),...s}));o.displayName="CardDescription";let c=r.forwardRef(({className:e,...s},t)=>a.jsx("div",{ref:t,className:(0,l.cn)("p-6 pt-0",e),...s}));c.displayName="CardContent";let m=r.forwardRef(({className:e,...s},t)=>a.jsx("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",e),...s}));m.displayName="CardFooter"},62288:(e,s,t)=>{t.d(s,{$N:()=>f,Be:()=>h,Vq:()=>i,cN:()=>p,cZ:()=>x,fK:()=>u,hg:()=>o});var a=t(10326),r=t(98986),l=t(94019),d=t(17577),n=t(77863);let i=r.fC,o=r.xz,c=r.h_;r.x8;let m=d.forwardRef(({className:e,...s},t)=>a.jsx(r.aV,{ref:t,className:(0,n.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,...t},d)=>(0,a.jsxs)(c,{children:[a.jsx(m,{}),(0,a.jsxs)(r.VY,{ref:d,className:(0,n.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),...t,children:[s,(0,a.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:[a.jsx(l.Z,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));x.displayName=r.VY.displayName;let u=({className:e,...s})=>a.jsx("div",{className:(0,n.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...s});u.displayName="DialogHeader";let p=({className:e,...s})=>a.jsx("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});p.displayName="DialogFooter";let f=d.forwardRef(({className:e,...s},t)=>a.jsx(r.Dx,{ref:t,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",e),...s}));f.displayName=r.Dx.displayName;let h=d.forwardRef(({className:e,...s},t)=>a.jsx(r.dk,{ref:t,className:(0,n.cn)("text-sm text-muted-foreground",e),...s}));h.displayName=r.dk.displayName},31048:(e,s,t)=>{t.d(s,{_:()=>o});var a=t(10326),r=t(34478),l=t(79360),d=t(17577),n=t(77863);let i=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=d.forwardRef(({className:e,...s},t)=>a.jsx(r.f,{ref:t,className:(0,n.cn)(i(),e),...s}));o.displayName=r.f.displayName},65685:(e,s,t)=>{t.d(s,{B:()=>i,x:()=>n});var a=t(10326),r=t(9261),l=t(17577),d=t(77863);let n=l.forwardRef(({className:e,children:s,...t},l)=>(0,a.jsxs)(r.fC,{ref:l,className:(0,d.cn)("relative overflow-hidden",e),...t,children:[a.jsx(r.l_,{className:"size-full rounded-[inherit]",children:s}),a.jsx(i,{}),a.jsx(r.Ns,{})]}));n.displayName=r.fC.displayName;let i=l.forwardRef(({className:e,orientation:s="vertical",...t},l)=>a.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),...t,children:a.jsx(r.q4,{className:"relative flex-1 rounded-full bg-border"})}));i.displayName=r.gb.displayName},87673:(e,s,t)=>{t.d(s,{g:()=>d});var a=t(10326),r=t(17577),l=t(77863);let d=r.forwardRef(({className:e,...s},t)=>a.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:t,...s}));d.displayName="Textarea"},75290:(e,s,t)=>{t.d(s,{Z:()=>a});let a=(0,t(76557).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},98091:(e,s,t)=>{t.d(s,{Z:()=>a});let a=(0,t(76557).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}};
@@ -1 +1 @@
1
- exports.id=5192,exports.ids=[5192],exports.modules={73022:(e,t,r)=>{Promise.resolve().then(r.bind(r,8078))},8078:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>_});var s=r(10326),n=r(90434),i=r(88307),a=r(83855),l=r(33734),o=r(90772),c=r(54432),d=r(39167),u=r(18753),m=r(42270),p=r(17577),h=r(29718),x=r(35047),j=r(65304),f=r(15211),v=r(31048),g=r(87673),N=r(62288),y=r(75290),w=r(34789);function b({open:e,onOpenChange:t,refetchProjects:r}){let[n,i]=(0,p.useState)({name:"",description:"",custom_instructions:""}),[a,l]=(0,p.useState)(!1),{toast:d}=(0,w.pm)(),h=(0,x.useRouter)(),[j]=(0,u.D)(m.kp,{refetchQueries:[{query:m.fM,variables:{page:1,limit:200}}]}),f=async e=>{if(e.preventDefault(),!n.name.trim()){d({title:"Validation Error",description:"Project name is required.",variant:"destructive"});return}l(!0);try{let e=await j({variables:{input:{name:n.name.trim(),description:n.description.trim()||null,custom_instructions:n.custom_instructions.trim()||null,rights_mode:"private"}}});console.log(e);let s=e.data?.projectsCreateOne?.item;s&&(d({title:"Success",description:"Project created successfully!"}),i({name:"",description:"",custom_instructions:""}),t(!1),h.push(`/projects/${s.id}`),r())}catch(e){console.error("Error creating project:",e),d({title:"Error",description:e.message||"Failed to create project. Please try again.",variant:"destructive"})}finally{l(!1)}};return s.jsx(N.Vq,{open:e,onOpenChange:t,children:(0,s.jsxs)(N.cZ,{className:"sm:max-w-[500px]",children:[(0,s.jsxs)(N.fK,{children:[s.jsx(N.$N,{children:"Create New Project"}),s.jsx(N.Be,{children:"Create a new project to organize your chat sessions and documents."})]}),(0,s.jsxs)("form",{onSubmit:f,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[s.jsx(v._,{htmlFor:"project-name",children:"Project Name *"}),s.jsx(c.I,{id:"project-name",value:n.name,onChange:e=>i({...n,name:e.target.value}),placeholder:"Enter project name",required:!0,disabled:a})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[s.jsx(v._,{htmlFor:"project-description",children:"Description"}),s.jsx(g.g,{id:"project-description",value:n.description,onChange:e=>i({...n,description:e.target.value}),placeholder:"Describe what this project is about...",rows:3,disabled:a})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[s.jsx(v._,{htmlFor:"custom-instructions",children:"Custom Instructions"}),s.jsx(g.g,{id:"custom-instructions",value:n.custom_instructions,onChange:e=>i({...n,custom_instructions:e.target.value}),placeholder:"Enter custom instructions for chat sessions in this project...",rows:3,disabled:a})]}),(0,s.jsxs)(N.cN,{children:[s.jsx(o.z,{type:"button",variant:"outline",onClick:()=>{i({name:"",description:"",custom_instructions:""}),t(!1)},disabled:a,children:"Cancel"}),s.jsx(o.z,{type:"submit",disabled:a,children:a?(0,s.jsxs)(s.Fragment,{children:[s.jsx(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Project"})]})]})]})})}function C(){let[e,t]=(0,p.useState)(""),[r,v]=(0,p.useState)(!1),g=(0,x.usePathname)(),{user:N}=(0,p.useContext)(f.S),[y,w]=(0,p.useState)(N),C=(0,d.aM)(m.Ak,{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{ids:y?.favourite_projects||[]},skip:!y?.favourite_projects?.length}),_=(0,d.aM)(m.fM,{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{page:1,limit:200,filters:e?[{name:{contains:e}}]:void 0}}),[P]=(0,u.D)(m.d5),k=e=>e.image?s.jsx("img",{src:e.image,alt:`${e.name} thumbnail`,className:"h-4 w-4 rounded-full object-cover"}):s.jsx("div",{className:"h-4 w-4 rounded-full bg-gradient-to-br from-green-500 to-blue-600 flex items-center justify-center text-white text-xs font-medium",children:e.name?.charAt(0).toUpperCase()||"P"}),F=async(e,t)=>{t.preventDefault(),t.stopPropagation();try{let t;let r=y?.favourite_projects||[];t=r.includes(e)?r.filter(t=>t!==e):[...r,e],await P({variables:{id:y?.id,favourite_projects:t}}),w(e=>({...e,favourite_projects:t}))}catch(e){console.error("Error updating favourite projects:",e)}},E=_?.data?.projectsPagination?.items||_?.previousData?.projectsPagination?.items||[],M=C?.data?.projectByIds||C?.previousData?.projectByIds||[];return(0,s.jsxs)("div",{className:"h-full w-[250px] flex-col gap-2 p-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[s.jsx(i.Z,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(c.I,{type:"search",placeholder:"Search projects...",className:"pl-8",value:e,onChange:e=>t(e.target.value)})]}),s.jsx(o.z,{variant:"outline",size:"lg",className:"h-10 w-10 p-0",onClick:()=>{v(!0)},title:"Create new project",children:s.jsx(a.Z,{className:"h-3 w-3"})})]}),s.jsx("div",{className:"flex-1 overflow-auto space-y-1",children:(0,s.jsxs)(s.Fragment,{children:[y?.favourite_projects&&M.length>0&&!e&&(0,s.jsxs)(s.Fragment,{children:[s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2 py-1",children:"Favorites"}),C.loading&&(0,s.jsxs)(s.Fragment,{children:[s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"}),s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"})]}),!C.loading&&s.jsx(s.Fragment,{children:M.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[s.jsx(n.default,{href:`/projects/${e.id}`,className:"flex-1",children:(0,s.jsxs)(o.z,{variant:g.includes(e.id)?"secondary":"ghost",className:"w-full justify-start gap-2 pr-1",children:[k(e),s.jsx("span",{className:"flex-1 text-left",children:s.jsx(h.L,{text:e.name,length:10})})]})}),s.jsx(o.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 flex-shrink-0",onClick:t=>F(e.id,t),children:s.jsx(l.Z,{className:"h-3 w-3 fill-yellow-400 text-yellow-400"})})]},e.id))})]}),s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2 py-1 mt-2",children:"All projects:"}),_.loading&&(0,s.jsxs)(s.Fragment,{children:[s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"}),s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"}),s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"})]}),!_.loading&&E.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[s.jsx(n.default,{href:`/projects/${e.id}`,className:"flex-1",children:(0,s.jsxs)(o.z,{variant:g.includes(e.id)?"secondary":"ghost",className:"w-full justify-start gap-2 pr-1",children:[k(e),s.jsx("span",{className:"flex-1 text-left",children:s.jsx(h.L,{text:e.name,length:14})})]})}),s.jsx(o.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 flex-shrink-0",onClick:t=>F(e.id,t),children:s.jsx(l.Z,{className:`h-3 w-3 ${y?.favourite_projects?.includes(e.id)?"fill-yellow-400 text-yellow-400":""}`})})]},e.id))]})}),s.jsx(b,{open:r,onOpenChange:v,refetchProjects:_.refetch})]})}function _({children:e}){return(0,s.jsxs)("div",{className:"flex h-full",children:[s.jsx("div",{className:"border-r bg-muted/10",children:s.jsx(C,{})}),e]})}},29718:(e,t,r)=>{"use strict";r.d(t,{L:()=>n});var s=r(10326);function n({text:e,length:t}){return e.length>t?(0,s.jsxs)(s.Fragment,{children:[e.slice(0,t),"..."]}):s.jsx(s.Fragment,{children:e})}},33734:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});let s=(0,r(76557).Z)("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]])},98637:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});let s=(0,r(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/projects/layout.tsx#default`)},18753:(e,t,r)=>{"use strict";r.d(t,{D:()=>u});var s=r(65826),n=r(66126),i=r(34837),a=r(20208),l=r(76049),o=r(17267),c=r(88571),d=r(51047).Nq?n.useLayoutEffect:n.useEffect;function u(e,t){var r=(0,c.x)(null==t?void 0:t.client);(0,l.Vp)(e,l.n_.Mutation);var u=n.useState({called:!1,loading:!1,client:r}),m=u[0],p=u[1],h=n.useRef({result:m,mutationId:0,isMounted:!0,client:r,mutation:e,options:t});d(function(){Object.assign(h.current,{client:r,options:t,mutation:e})});var x=n.useCallback(function(e){void 0===e&&(e={});var t=h.current,r=t.options,n=t.mutation,l=(0,s.pi)((0,s.pi)({},r),{mutation:n}),c=e.client||h.current.client;h.current.result.loading||l.ignoreResults||!h.current.isMounted||p(h.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:c});var d=++h.current.mutationId,u=(0,i.J)(l,e);return c.mutate(u).then(function(t){var r,s,n=t.data,i=t.errors,l=i&&i.length>0?new o.cA({graphQLErrors:i}):void 0,m=e.onError||(null===(r=h.current.options)||void 0===r?void 0:r.onError);if(l&&m&&m(l,u),d===h.current.mutationId&&!u.ignoreResults){var x={called:!0,loading:!1,data:n,error:l,client:c};h.current.isMounted&&!(0,a.D)(h.current.result,x)&&p(h.current.result=x)}var j=e.onCompleted||(null===(s=h.current.options)||void 0===s?void 0:s.onCompleted);return l||null==j||j(t.data,u),t},function(t){if(d===h.current.mutationId&&h.current.isMounted){var r,s={loading:!1,error:t,data:void 0,called:!0,client:c};(0,a.D)(h.current.result,s)||p(h.current.result=s)}var n=e.onError||(null===(r=h.current.options)||void 0===r?void 0:r.onError);if(n)return n(t,u),{data:void 0,errors:t};throw t})},[]),j=n.useCallback(function(){if(h.current.isMounted){var e={called:!1,loading:!1,client:h.current.client};Object.assign(h.current,{mutationId:0,result:e}),p(e)}},[]);return n.useEffect(function(){var e=h.current;return e.isMounted=!0,function(){e.isMounted=!1}},[]),[x,(0,s.pi)({reset:j},m)]}}};
1
+ exports.id=5192,exports.ids=[5192],exports.modules={73022:(e,t,r)=>{Promise.resolve().then(r.bind(r,8078))},8078:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>P});var s=r(10326),n=r(90434),a=r(88307),i=r(83855),l=r(33734),o=r(90772),c=r(54432),d=r(39167),u=r(18753),m=r(42270),p=r(17577),h=r(29718),x=r(35047),j=r(65304),f=r(15211),v=r(31048),g=r(87673),y=r(62288),N=r(75290),w=r(34789);function b({open:e,onOpenChange:t,refetchProjects:r}){let[n,a]=(0,p.useState)({name:"",description:"",custom_instructions:""}),[i,l]=(0,p.useState)(!1),{toast:d}=(0,w.pm)(),h=(0,x.useRouter)(),[j]=(0,u.D)(m.kp,{refetchQueries:[{query:m.fM,variables:{page:1,limit:200}}]}),f=async e=>{if(e.preventDefault(),!n.name.trim()){d({title:"Validation Error",description:"Project name is required.",variant:"destructive"});return}l(!0);try{let e=await j({variables:{input:{name:n.name.trim(),description:n.description.trim()||null,custom_instructions:n.custom_instructions.trim()||null,rights_mode:"private"}}});console.log(e);let s=e.data?.projectsCreateOne?.item;s&&(d({title:"Success",description:"Project created successfully!"}),a({name:"",description:"",custom_instructions:""}),t(!1),h.push(`/projects/${s.id}`),r())}catch(e){console.error("Error creating project:",e),d({title:"Error",description:e.message||"Failed to create project. Please try again.",variant:"destructive"})}finally{l(!1)}};return s.jsx(y.Vq,{open:e,onOpenChange:t,children:(0,s.jsxs)(y.cZ,{className:"sm:max-w-[500px]",children:[(0,s.jsxs)(y.fK,{children:[s.jsx(y.$N,{children:"Create New Project"}),s.jsx(y.Be,{children:"Create a new project to organize your chat sessions and documents."})]}),(0,s.jsxs)("form",{onSubmit:f,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[s.jsx(v._,{htmlFor:"project-name",children:"Project Name *"}),s.jsx(c.I,{id:"project-name",value:n.name,onChange:e=>a({...n,name:e.target.value}),placeholder:"Enter project name",required:!0,disabled:i})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[s.jsx(v._,{htmlFor:"project-description",children:"Description"}),s.jsx(g.g,{id:"project-description",value:n.description,onChange:e=>a({...n,description:e.target.value}),placeholder:"Describe what this project is about...",rows:3,disabled:i})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[s.jsx(v._,{htmlFor:"custom-instructions",children:"Custom Instructions"}),s.jsx(g.g,{id:"custom-instructions",value:n.custom_instructions,onChange:e=>a({...n,custom_instructions:e.target.value}),placeholder:"Enter custom instructions for chat sessions in this project...",rows:3,disabled:i})]}),(0,s.jsxs)(y.cN,{children:[s.jsx(o.z,{type:"button",variant:"outline",onClick:()=>{a({name:"",description:"",custom_instructions:""}),t(!1)},disabled:i,children:"Cancel"}),s.jsx(o.z,{type:"submit",disabled:i,children:i?(0,s.jsxs)(s.Fragment,{children:[s.jsx(N.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Project"})]})]})]})})}function C(){let[e,t]=(0,p.useState)(""),[r,v]=(0,p.useState)(!1),g=(0,x.usePathname)(),{user:y}=(0,p.useContext)(f.S),[N,w]=(0,p.useState)(y),C=(0,d.aM)(m.Ak,{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{ids:N?.favourite_projects||[]},skip:!N?.favourite_projects?.length}),P=(0,d.aM)(m.fM,{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{page:1,limit:200,filters:e?[{name:{contains:e}}]:void 0}}),[_]=(0,u.D)(m.d5),k=e=>e.image?s.jsx("img",{src:e.image,alt:`${e.name} thumbnail`,className:"h-4 w-4 rounded-full object-cover"}):s.jsx("div",{className:"h-4 w-4 rounded-full bg-gradient-to-br from-green-500 to-blue-600 flex items-center justify-center text-white text-xs font-medium",children:e.name?.charAt(0).toUpperCase()||"P"}),F=async(e,t)=>{t.preventDefault(),t.stopPropagation();try{let t;let r=N?.favourite_projects||[];t=r.includes(e)?r.filter(t=>t!==e):[...r,e],await _({variables:{id:N?.id,favourite_projects:t}}),w(e=>({...e,favourite_projects:t}))}catch(e){console.error("Error updating favourite projects:",e)}},E=P?.data?.projectsPagination?.items||P?.previousData?.projectsPagination?.items||[],M=C?.data?.projectByIds||C?.previousData?.projectByIds||[];return(0,s.jsxs)("div",{className:"h-full w-[250px] flex-col gap-2 p-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[s.jsx(a.Z,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(c.I,{type:"search",placeholder:"Search projects...",className:"pl-8",value:e,onChange:e=>t(e.target.value)})]}),s.jsx(o.z,{variant:"outline",size:"lg",className:"h-10 w-10 p-0",onClick:()=>{v(!0)},title:"Create new project",children:s.jsx(i.Z,{className:"h-3 w-3"})})]}),s.jsx("div",{className:"flex-1 overflow-auto space-y-1",children:(0,s.jsxs)(s.Fragment,{children:[N?.favourite_projects&&M.length>0&&!e&&(0,s.jsxs)(s.Fragment,{children:[s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2 py-1",children:"Favorites"}),C.loading&&(0,s.jsxs)(s.Fragment,{children:[s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"}),s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"})]}),!C.loading&&s.jsx(s.Fragment,{children:M.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[s.jsx(n.default,{href:`/projects/${e.id}`,className:"flex-1",children:(0,s.jsxs)(o.z,{variant:g.includes(e.id)?"secondary":"ghost",className:"w-full justify-start gap-2 pr-1",children:[k(e),s.jsx("span",{className:"flex-1 text-left",children:s.jsx(h.L,{text:e.name,length:10})})]})}),s.jsx(o.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 flex-shrink-0",onClick:t=>F(e.id,t),children:s.jsx(l.Z,{className:"h-3 w-3 fill-yellow-400 text-yellow-400"})})]},e.id))})]}),s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2 py-1 mt-2",children:"All projects:"}),P.loading&&(0,s.jsxs)(s.Fragment,{children:[s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"}),s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"}),s.jsx(j.O,{className:"w-[100%] h-[32px] rounded-lg"})]}),!P.loading&&E.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[s.jsx(n.default,{href:`/projects/${e.id}`,className:"flex-1",children:(0,s.jsxs)(o.z,{variant:g.includes(e.id)?"secondary":"ghost",className:"w-full justify-start gap-2 pr-1",children:[k(e),s.jsx("span",{className:"flex-1 text-left",children:s.jsx(h.L,{text:e.name,length:14})})]})}),s.jsx(o.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 flex-shrink-0",onClick:t=>F(e.id,t),children:s.jsx(l.Z,{className:`h-3 w-3 ${N?.favourite_projects?.includes(e.id)?"fill-yellow-400 text-yellow-400":""}`})})]},e.id))]})}),s.jsx(b,{open:r,onOpenChange:v,refetchProjects:P.refetch})]})}function P({children:e}){return(0,s.jsxs)("div",{className:"flex h-full",children:[s.jsx("div",{className:"border-r bg-muted/10",children:s.jsx(C,{})}),e]})}},29718:(e,t,r)=>{"use strict";r.d(t,{L:()=>n});var s=r(10326);function n({text:e,length:t}){return e.length>t?(0,s.jsxs)(s.Fragment,{children:[e.slice(0,t),"..."]}):s.jsx(s.Fragment,{children:e})}},83855:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});let s=(0,r(76557).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},33734:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});let s=(0,r(76557).Z)("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]])},98637:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});let s=(0,r(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/projects/layout.tsx#default`)},18753:(e,t,r)=>{"use strict";r.d(t,{D:()=>u});var s=r(65826),n=r(66126),a=r(34837),i=r(20208),l=r(76049),o=r(17267),c=r(88571),d=r(51047).Nq?n.useLayoutEffect:n.useEffect;function u(e,t){var r=(0,c.x)(null==t?void 0:t.client);(0,l.Vp)(e,l.n_.Mutation);var u=n.useState({called:!1,loading:!1,client:r}),m=u[0],p=u[1],h=n.useRef({result:m,mutationId:0,isMounted:!0,client:r,mutation:e,options:t});d(function(){Object.assign(h.current,{client:r,options:t,mutation:e})});var x=n.useCallback(function(e){void 0===e&&(e={});var t=h.current,r=t.options,n=t.mutation,l=(0,s.pi)((0,s.pi)({},r),{mutation:n}),c=e.client||h.current.client;h.current.result.loading||l.ignoreResults||!h.current.isMounted||p(h.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:c});var d=++h.current.mutationId,u=(0,a.J)(l,e);return c.mutate(u).then(function(t){var r,s,n=t.data,a=t.errors,l=a&&a.length>0?new o.cA({graphQLErrors:a}):void 0,m=e.onError||(null===(r=h.current.options)||void 0===r?void 0:r.onError);if(l&&m&&m(l,u),d===h.current.mutationId&&!u.ignoreResults){var x={called:!0,loading:!1,data:n,error:l,client:c};h.current.isMounted&&!(0,i.D)(h.current.result,x)&&p(h.current.result=x)}var j=e.onCompleted||(null===(s=h.current.options)||void 0===s?void 0:s.onCompleted);return l||null==j||j(t.data,u),t},function(t){if(d===h.current.mutationId&&h.current.isMounted){var r,s={loading:!1,error:t,data:void 0,called:!0,client:c};(0,i.D)(h.current.result,s)||p(h.current.result=s)}var n=e.onError||(null===(r=h.current.options)||void 0===r?void 0:r.onError);if(n)return n(t,u),{data:void 0,errors:t};throw t})},[]),j=n.useCallback(function(){if(h.current.isMounted){var e={called:!1,loading:!1,client:h.current.client};Object.assign(h.current,{mutationId:0,result:e}),p(e)}},[]);return n.useEffect(function(){var e=h.current;return e.isMounted=!0,function(){e.isMounted=!1}},[]),[x,(0,s.pi)({reset:j},m)]}}};
@@ -1 +1 @@
1
- "use strict";exports.id=5485,exports.ids=[5485],exports.modules={19753:(e,s,a)=>{a.d(s,{R:()=>k});var i=a(10326),t=a(17577),l=a(39167),n=a(18753),r=a(42270),d=a(90772),c=a(33071),o=a(53313),x=a(15940),u=a(79210),h=a(99440),m=a(567),j=a(75290),g=a(94893),p=a(71059),b=a(56762),v=a(98091),f=a(91468),N=a(11890),y=a(39183),w=a(34789),C=a(98181),P=a(18615),S=a(76812);function k({queueName:e,nameGenerator:s,retryJob:a}){let{toast:k}=(0,w.pm)(),[Z,z]=(0,t.useState)(!1),[q,R]=(0,t.useState)(!1),[T,$]=(0,t.useState)(!1),[D,I]=(0,t.useState)([]),[A,O]=(0,t.useState)(null),[Q,J]=(0,t.useState)("completed"),[L,M]=(0,t.useState)(1),[F,Y]=(0,t.useState)(20),[E,_]=(0,t.useState)(new Set),{data:G,loading:W,refetch:X}=(0,l.aM)(r.k9,{variables:{queue:e},pollInterval:5e3}),{data:B,loading:H,refetch:V,networkStatus:K}=(0,l.aM)(r.Jq,{variables:{queue:e,statusses:Q,page:L,limit:F},pollInterval:5e3}),[U,{loading:ee}]=(0,n.D)(r.Wr,{onError:e=>{k({title:"Failed to delete job",description:e.message,variant:"destructive"})}}),[es,{loading:ea}]=(0,n.D)(r.fc,{onCompleted:()=>{k({title:"Queue paused",description:`The ${e} queue has been paused.`}),X(),z(!1)},onError:e=>{k({title:"Failed to pause queue",description:e.message,variant:"destructive"})}}),[ei,{loading:et}]=(0,n.D)(r.iC,{onCompleted:()=>{k({title:"Queue resumed",description:`The ${e} queue has been resumed.`}),X(),$(!1)},onError:e=>{k({title:"Failed to resume queue",description:e.message,variant:"destructive"})}}),[el,{loading:en}]=(0,n.D)(r.QW,{onCompleted:()=>{k({title:"Queue drained",description:"All waiting and delayed jobs have been removed from the queue."}),X(),V(),R(!1)},onError:e=>{k({title:"Failed to drain queue",description:e.message,variant:"destructive"})}}),er=e=>{I([e])},ed=e=>{O(e)},ec=e=>{let s=new Set(E);s.has(e)?s.delete(e):s.add(e),_(s)},eo=async()=>{if(D.filter(e=>!e.id).length>0){k({title:"Failed to delete jobs",description:"Some jobs have no ID.",variant:"destructive"});return}try{await Promise.all(D.map(s=>U({variables:{queue:e,id:s.id}}))),k({title:1===D.length?"Job deleted":"Jobs deleted",description:`Successfully deleted ${D.length} job${1===D.length?"":"s"}.`}),V(),X(),I([]),_(new Set)}catch(e){}},ex=G?.queue,eu=B?.jobs||{items:[],pageInfo:{pageCount:0,itemCount:0,currentPage:1,hasPreviousPage:!1,hasNextPage:!1}},eh=e=>i.jsx(m.C,{variant:"outline",className:{active:"bg-blue-100 text-blue-800 border-blue-200",waiting:"bg-yellow-100 text-yellow-800 border-yellow-200",completed:"bg-green-100 text-green-800 border-green-200",failed:"bg-red-100 text-red-800 border-red-200",delayed:"bg-orange-100 text-orange-800 border-orange-200",paused:"bg-gray-100 text-gray-800 border-gray-200"}[e]||"bg-gray-100 text-gray-800",children:e});return W&&H?i.jsx("div",{className:"space-y-4",children:i.jsx(c.Zb,{children:i.jsx(c.aY,{className:"pt-6",children:i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(j.Z,{className:"h-6 w-6 animate-spin"})})})})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.Zb,{children:[i.jsx(c.Ol,{children:(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"flex items-center gap-3",children:(0,i.jsxs)("div",{children:[(0,i.jsxs)(c.ll,{children:["Queue: ",e]}),(0,i.jsxs)(c.SZ,{children:["Manage the ",e," job queue and view all jobs."]})]})}),ex&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>ex?.isPaused?$(!0):z(!0),disabled:ea||et,children:[ex?.isPaused?i.jsx(g.Z,{className:"mr-2 h-4 w-4"}):i.jsx(p.Z,{className:"mr-2 h-4 w-4"}),ex?.isPaused?"Resume queue":"Pause queue"]}),(0,i.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>R(!0),disabled:en,children:[i.jsx(b.Z,{className:"mr-2 h-4 w-4"}),"Drain queue"]})]})]})}),(0,i.jsxs)(c.aY,{className:"space-y-6",children:[ex&&(0,i.jsxs)("div",{className:"flex items-center gap-8 p-4 bg-muted/50 rounded-lg",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"Status:"}),i.jsx("div",{children:ex.isPaused?i.jsx(m.C,{variant:"outline",className:"bg-gray-100 text-gray-800",children:"Paused"}):ex.isMaxed?i.jsx(m.C,{variant:"outline",className:"bg-red-100 text-red-800",children:"Maxed"}):i.jsx(m.C,{variant:"outline",className:"bg-green-100 text-green-800",children:"Active"})})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"Concurrency:"}),i.jsx("div",{className:"font-semibold",children:ex.concurrency})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"text-sm text-muted-foreground",children:"Rate Limit:"}),i.jsx("div",{className:"font-semibold",children:ex.ratelimit||"None"})]}),i.jsx(u.mQ,{value:Q,onValueChange:e=>J(e),className:"w-auto",children:(0,i.jsxs)(u.dr,{children:[(0,i.jsxs)(u.SP,{value:"active",className:"gap-1.5",children:[i.jsx("span",{children:"Active"}),i.jsx(m.C,{variant:"secondary",className:"ml-1 bg-blue-100 text-blue-600 border-blue-200",children:ex.jobs?.active||0})]}),(0,i.jsxs)(u.SP,{value:"waiting",className:"gap-1.5",children:[i.jsx("span",{children:"Waiting"}),i.jsx(m.C,{variant:"secondary",className:"ml-1 bg-yellow-100 text-yellow-600 border-yellow-200",children:ex.jobs?.waiting||0})]}),(0,i.jsxs)(u.SP,{value:"failed",className:"gap-1.5",children:[i.jsx("span",{children:"Failed"}),i.jsx(m.C,{variant:"secondary",className:"ml-1 bg-red-100 text-red-600 border-red-200",children:ex.jobs?.failed||0})]}),(0,i.jsxs)(u.SP,{value:"completed",className:"gap-1.5",children:[i.jsx("span",{children:"Completed"}),i.jsx(m.C,{variant:"secondary",className:"ml-1 bg-green-100 text-green-600 border-green-200",children:ex.jobs?.completed||0})]})]})})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,i.jsxs)("div",{children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Queue Jobs"}),(0,i.jsxs)("p",{className:"text-xs text-muted-foreground",children:["All jobs currently in the ",e," queue"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[E.size>0&&(0,i.jsxs)(d.z,{variant:"destructive",size:"sm",onClick:()=>{I(eu.items.filter(e=>E.has(e.id)))},disabled:ee,children:[i.jsx(v.Z,{className:"mr-2 h-4 w-4"}),"Delete ",E.size," job",1===E.size?"":"s"]}),(0,i.jsxs)(m.C,{variant:"outline",children:["Auto Refresh: ",i.jsx(j.Z,{className:"h-4 w-4 animate-spin text-muted-foreground ml-1"})]})]})]}),(0,i.jsxs)("div",{className:"border rounded-lg",children:[H?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(j.Z,{className:"h-6 w-6 animate-spin"})}):eu.items?.length===0?i.jsx("div",{className:"text-center pt-8 text-muted-foreground",children:"No jobs in queue"}):(0,i.jsxs)(x.iA,{children:[i.jsx(x.xD,{children:(0,i.jsxs)(x.SC,{children:[i.jsx(x.ss,{className:"w-12",children:i.jsx(o.X,{checked:eu.items.filter(e=>"active"!==e.state).length>0&&E.size===eu.items.filter(e=>"active"!==e.state).length,onCheckedChange:()=>{let e=eu.items.filter(e=>"active"!==e.state);E.size===e.length&&e.length>0?_(new Set):_(new Set(e.map(e=>e.id)))},"aria-label":"Select all jobs"})}),i.jsx(x.ss,{children:"Name"}),i.jsx(x.ss,{children:"State"}),i.jsx(x.ss,{children:"Timestamp"}),i.jsx(x.ss,{children:"Inputs"}),i.jsx(x.ss,{children:"Outputs"}),i.jsx(x.ss,{className:"text-right",children:"Actions"})]})}),i.jsx(x.RM,{children:eu.items?.map((e,a)=>i.jsxs(x.SC,{children:[i.jsx(x.pj,{children:i.jsx(o.X,{checked:E.has(e.id),onCheckedChange:()=>ec(e.id),disabled:"active"===e.state,"aria-label":`Select job ${s(e)}`})}),i.jsx(x.pj,{className:"font-medium max-w-[200px] truncate",children:s(e)}),i.jsx(x.pj,{children:eh(e.state)}),i.jsx(x.pj,{children:e.timestamp?C.WU(new Date(e.timestamp),"MMM d, yyyy HH:mm:ss"):"N/A"}),i.jsx(x.pj,{children:e.data?i.jsx("div",{className:"text-xs max-w-[200px] truncate",children:i.jsx(P.J,{text:JSON.stringify(e.data)})}):null}),i.jsx(x.pj,{children:e.failedReason?i.jsx("div",{className:"text-xs text-red-600 max-w-[200px] truncate",children:i.jsx(P.J,{text:"Error: "+e.failedReason})}):i.jsx("div",{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:i.jsx(P.J,{text:JSON.stringify(e.returnvalue)})})}),i.jsxs(x.pj,{className:"text-right",children:["active"!==e.state&&i.jsx(d.z,{variant:"ghost",size:"sm",onClick:()=>er(e),disabled:ee,children:i.jsx(v.Z,{className:"h-4 w-4 text-red-600"})}),"failed"===e.state&&i.jsxs(d.z,{variant:"ghost",size:"sm",onClick:()=>ed(e),children:[i.jsx(f.Z,{className:"h-4 w-4 text-blue-600"}),"Retry"]})]})]},a))})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,i.jsxs)("div",{className:"flex-1 text-sm text-muted-foreground",children:["(",eu?.pageInfo?.itemCount||0," total"," ","items)."]}),i.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8",children:(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsxs)(d.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{M(1),V()},disabled:!eu?.pageInfo?.hasPreviousPage,children:[i.jsx("span",{className:"sr-only",children:"Go to first page"}),i.jsx(S.kRt,{className:"size-4"})]}),(0,i.jsxs)(d.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{console.log("itemsData.data?.pageInfo.hasPreviousPage",eu?.pageInfo?.hasPreviousPage),M(eu?.pageInfo?.hasPreviousPage?eu?.pageInfo?.currentPage-1:1),V()},disabled:!eu?.pageInfo?.hasPreviousPage,children:[i.jsx("span",{className:"sr-only",children:"Go to previous page"}),i.jsx(N.Z,{className:"size-4"})]}),(0,i.jsxs)(d.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{M(eu?.pageInfo?.hasNextPage?eu?.pageInfo?.currentPage+1:1),V()},disabled:!eu?.pageInfo.hasNextPage,children:[i.jsx("span",{className:"sr-only",children:"Go to next page"}),i.jsx(y.Z,{className:"size-4"})]})]})})]})]})]})]})]}),i.jsx(h.aR,{open:D.length>0,onOpenChange:e=>!e&&I([]),children:(0,i.jsxs)(h._T,{children:[(0,i.jsxs)(h.fY,{children:[i.jsx(h.f$,{children:1===D.length?"Delete Job?":`Delete ${D.length} Jobs?`}),i.jsx(h.yT,{children:1===D.length?`Are you sure you want to delete the job "${D[0]?.name}"? This action cannot be undone.`:`Are you sure you want to delete ${D.length} jobs? This action cannot be undone.`})]}),(0,i.jsxs)(h.xo,{children:[i.jsx(h.le,{children:"Cancel"}),(0,i.jsxs)(h.OL,{onClick:eo,disabled:ee,children:[ee&&i.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Delete"]})]})]})}),i.jsx(h.aR,{open:!!A,onOpenChange:e=>!e&&O(null),children:(0,i.jsxs)(h._T,{children:[(0,i.jsxs)(h.fY,{children:[i.jsx(h.f$,{children:"Retry Job?"}),(0,i.jsxs)(h.yT,{children:['Are you sure you want to retry the job "',A?.name,'"? This will schedule a new job with the same data.']})]}),(0,i.jsxs)(h.xo,{children:[i.jsx(h.le,{children:"Cancel"}),i.jsx(h.OL,{onClick:()=>{A&&a(A)},disabled:ee,children:"Retry"})]})]})}),i.jsx(h.aR,{open:Z,onOpenChange:z,children:(0,i.jsxs)(h._T,{children:[(0,i.jsxs)(h.fY,{children:[i.jsx(h.f$,{children:"Pause Queue?"}),(0,i.jsxs)(h.yT,{children:["Are you sure you want to pause the ",e," queue? No jobs will be processed until the queue is resumed."]})]}),(0,i.jsxs)(h.xo,{children:[i.jsx(h.le,{children:"Cancel"}),(0,i.jsxs)(h.OL,{onClick:()=>{es({variables:{queue:e}})},disabled:ea,children:[ea&&i.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Pause Queue"]})]})]})}),i.jsx(h.aR,{open:T,onOpenChange:$,children:(0,i.jsxs)(h._T,{children:[(0,i.jsxs)(h.fY,{children:[i.jsx(h.f$,{children:"Resume Queue?"}),(0,i.jsxs)(h.yT,{children:["Are you sure you want to resume the ",e," queue?."]})]}),(0,i.jsxs)(h.xo,{children:[i.jsx(h.le,{children:"Cancel"}),(0,i.jsxs)(h.OL,{onClick:()=>{ei({variables:{queue:e}})},disabled:et,children:[et&&i.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Resume Queue"]})]})]})}),i.jsx(h.aR,{open:q,onOpenChange:R,children:(0,i.jsxs)(h._T,{children:[(0,i.jsxs)(h.fY,{children:[i.jsx(h.f$,{children:"Drain Queue?"}),(0,i.jsxs)(h.yT,{children:["Are you sure you want to drain the ",e," queue? This will remove all jobs that are waiting or delayed, but not active, waiting-children, completed or failed. This action cannot be undone."]})]}),(0,i.jsxs)(h.xo,{children:[i.jsx(h.le,{children:"Cancel"}),(0,i.jsxs)(h.OL,{onClick:()=>{el({variables:{queue:e}})},disabled:en,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[en&&i.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Drain Queue"]})]})]})})]})}},57004:(e,s,a)=>{a.a(e,async(e,i)=>{try{a.d(s,{G:()=>p});var t=a(10326),l=a(48644),n=a(93801),r=a(45747),d=a(17577),c=a(94966),o=a(12533),x=a(12428),u=a(47355),h=a(62288),m=a(34789),j=a(77863),g=e([l,n,r]);function p({className:e=null,code:s,language:a,slice:i=200}){let{toast:l}=(0,m.pm)(),[n,r]=(0,d.useState)(null);return(0,t.jsxs)(h.Vq,{children:[t.jsx(h.hg,{asChild:!0,children:n?.length&&t.jsx(c.Z,{className:(0,j.cn)("cursor-pointer",e),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:a||"plaintext",style:u.Z,children:`${n?.slice(0,i||200)} ${n?.length>(i||200)?"...":""}`})}),t.jsx(h.cZ,{className:"sm:max-w-[800px] overflow-hidden max-h-[500px] overflow-y-scroll",children:(0,t.jsxs)(h.fK,{children:[t.jsx(h.$N,{children:"Code"}),t.jsx("div",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(n??""),l({title:"Copied to clipboard"})},children:t.jsx(c.Z,{className:(0,j.cn)(e),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:a||"plaintext",style:u.Z,children:n??""})})]})})]})}[l,n,r]=g.then?(await g)():g,c.Z.registerLanguage("json",x.Z),c.Z.registerLanguage("javascript",o.Z),i()}catch(e){i(e)}})},53313:(e,s,a)=>{a.d(s,{X:()=>d});var i=a(10326),t=a(13635),l=a(32933),n=a(17577),r=a(77863);let d=n.forwardRef(({className:e,...s},a)=>i.jsx(t.fC,{ref:a,className:(0,r.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...s,children:i.jsx(t.z$,{className:(0,r.cn)("flex items-center justify-center text-current"),children:i.jsx(l.Z,{className:"size-4"})})}));d.displayName=t.fC.displayName}};
1
+ "use strict";exports.id=5485,exports.ids=[5485],exports.modules={19753:(e,s,a)=>{a.d(s,{R:()=>S});var t=a(10326),l=a(17577),i=a(39167),r=a(18753),n=a(42270),d=a(90772),c=a(33071),o=a(53313),x=a(15940),m=a(79210),u=a(99440),h=a(567),j=a(75290),p=a(94893),g=a(71059),f=a(56762),b=a(98091),N=a(91468),v=a(11890),y=a(39183),w=a(34789),C=a(98181),k=a(18615),R=a(76812);function S({queueName:e,nameGenerator:s,retryJob:a}){let{toast:S}=(0,w.pm)(),[P,z]=(0,l.useState)(!1),[T,Z]=(0,l.useState)(!1),[q,D]=(0,l.useState)(!1),[$,A]=(0,l.useState)([]),[I,O]=(0,l.useState)(null),[L,Q]=(0,l.useState)("completed"),[J,M]=(0,l.useState)(1),[Y,F]=(0,l.useState)(20),[_,V]=(0,l.useState)(new Set),{data:E,loading:H,refetch:G}=(0,i.aM)(n.k9,{variables:{queue:e},pollInterval:5e3}),{data:W,loading:B,refetch:U,networkStatus:X}=(0,i.aM)(n.Jq,{variables:{queue:e,statusses:L,page:J,limit:Y},pollInterval:5e3}),[K,{loading:ee}]=(0,r.D)(n.Wr,{onError:e=>{S({title:"Failed to delete job",description:e.message,variant:"destructive"})}}),[es,{loading:ea}]=(0,r.D)(n.fc,{onCompleted:()=>{S({title:"Queue paused",description:`The ${e} queue has been paused.`}),G(),z(!1)},onError:e=>{S({title:"Failed to pause queue",description:e.message,variant:"destructive"})}}),[et,{loading:el}]=(0,r.D)(n.iC,{onCompleted:()=>{S({title:"Queue resumed",description:`The ${e} queue has been resumed.`}),G(),D(!1)},onError:e=>{S({title:"Failed to resume queue",description:e.message,variant:"destructive"})}}),[ei,{loading:er}]=(0,r.D)(n.QW,{onCompleted:()=>{S({title:"Queue drained",description:"All waiting and delayed jobs have been removed from the queue."}),G(),U(),Z(!1)},onError:e=>{S({title:"Failed to drain queue",description:e.message,variant:"destructive"})}}),en=e=>{A([e])},ed=e=>{O(e)},ec=e=>{let s=new Set(_);s.has(e)?s.delete(e):s.add(e),V(s)},eo=async()=>{if($.filter(e=>!e.id).length>0){S({title:"Failed to delete jobs",description:"Some jobs have no ID.",variant:"destructive"});return}try{await Promise.all($.map(s=>K({variables:{queue:e,id:s.id}}))),S({title:1===$.length?"Job deleted":"Jobs deleted",description:`Successfully deleted ${$.length} job${1===$.length?"":"s"}.`}),U(),G(),A([]),V(new Set)}catch(e){}},ex=E?.queue,em=W?.jobs||{items:[],pageInfo:{pageCount:0,itemCount:0,currentPage:1,hasPreviousPage:!1,hasNextPage:!1}},eu=e=>t.jsx(h.C,{variant:"outline",className:{active:"bg-blue-100 text-blue-800 border-blue-200",waiting:"bg-yellow-100 text-yellow-800 border-yellow-200",completed:"bg-green-100 text-green-800 border-green-200",failed:"bg-red-100 text-red-800 border-red-200",delayed:"bg-orange-100 text-orange-800 border-orange-200",paused:"bg-gray-100 text-gray-800 border-gray-200"}[e]||"bg-gray-100 text-gray-800",children:e});return H&&B?t.jsx("div",{className:"space-y-4",children:t.jsx(c.Zb,{children:t.jsx(c.aY,{className:"pt-6",children:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(j.Z,{className:"h-6 w-6 animate-spin"})})})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Zb,{children:[t.jsx(c.Ol,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex items-center gap-3",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)(c.ll,{children:["Queue: ",e]}),(0,t.jsxs)(c.SZ,{children:["Manage the ",e," job queue and view all jobs."]})]})}),ex&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>ex?.isPaused?D(!0):z(!0),disabled:ea||el,children:[ex?.isPaused?t.jsx(p.Z,{className:"mr-2 h-4 w-4"}):t.jsx(g.Z,{className:"mr-2 h-4 w-4"}),ex?.isPaused?"Resume queue":"Pause queue"]}),(0,t.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>Z(!0),disabled:er,children:[t.jsx(f.Z,{className:"mr-2 h-4 w-4"}),"Drain queue"]})]})]})}),(0,t.jsxs)(c.aY,{className:"space-y-6",children:[ex&&(0,t.jsxs)("div",{className:"flex items-center gap-8 p-4 bg-muted/50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:"Status:"}),t.jsx("div",{children:ex.isPaused?t.jsx(h.C,{variant:"outline",className:"bg-gray-100 text-gray-800",children:"Paused"}):ex.isMaxed?t.jsx(h.C,{variant:"outline",className:"bg-red-100 text-red-800",children:"Maxed"}):t.jsx(h.C,{variant:"outline",className:"bg-green-100 text-green-800",children:"Active"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:"Concurrency:"}),t.jsx("div",{className:"font-semibold",children:ex.concurrency})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:"Rate Limit:"}),t.jsx("div",{className:"font-semibold",children:ex.ratelimit||"None"})]}),t.jsx(m.mQ,{value:L,onValueChange:e=>Q(e),className:"w-auto",children:(0,t.jsxs)(m.dr,{children:[(0,t.jsxs)(m.SP,{value:"active",className:"gap-1.5",children:[t.jsx("span",{children:"Active"}),t.jsx(h.C,{variant:"secondary",className:"ml-1 bg-blue-100 text-blue-600 border-blue-200",children:ex.jobs?.active||0})]}),(0,t.jsxs)(m.SP,{value:"waiting",className:"gap-1.5",children:[t.jsx("span",{children:"Waiting"}),t.jsx(h.C,{variant:"secondary",className:"ml-1 bg-yellow-100 text-yellow-600 border-yellow-200",children:ex.jobs?.waiting||0})]}),(0,t.jsxs)(m.SP,{value:"failed",className:"gap-1.5",children:[t.jsx("span",{children:"Failed"}),t.jsx(h.C,{variant:"secondary",className:"ml-1 bg-red-100 text-red-600 border-red-200",children:ex.jobs?.failed||0})]}),(0,t.jsxs)(m.SP,{value:"completed",className:"gap-1.5",children:[t.jsx("span",{children:"Completed"}),t.jsx(h.C,{variant:"secondary",className:"ml-1 bg-green-100 text-green-600 border-green-200",children:ex.jobs?.completed||0})]})]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Queue Jobs"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["All jobs currently in the ",e," queue"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[_.size>0&&(0,t.jsxs)(d.z,{variant:"destructive",size:"sm",onClick:()=>{A(em.items.filter(e=>_.has(e.id)))},disabled:ee,children:[t.jsx(b.Z,{className:"mr-2 h-4 w-4"}),"Delete ",_.size," job",1===_.size?"":"s"]}),(0,t.jsxs)(h.C,{variant:"outline",children:["Auto Refresh: ",t.jsx(j.Z,{className:"h-4 w-4 animate-spin text-muted-foreground ml-1"})]})]})]}),(0,t.jsxs)("div",{className:"border rounded-lg",children:[B?t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(j.Z,{className:"h-6 w-6 animate-spin"})}):em.items?.length===0?t.jsx("div",{className:"text-center pt-8 text-muted-foreground",children:"No jobs in queue"}):(0,t.jsxs)(x.iA,{children:[t.jsx(x.xD,{children:(0,t.jsxs)(x.SC,{children:[t.jsx(x.ss,{className:"w-12",children:t.jsx(o.X,{checked:em.items.filter(e=>"active"!==e.state).length>0&&_.size===em.items.filter(e=>"active"!==e.state).length,onCheckedChange:()=>{let e=em.items.filter(e=>"active"!==e.state);_.size===e.length&&e.length>0?V(new Set):V(new Set(e.map(e=>e.id)))},"aria-label":"Select all jobs"})}),t.jsx(x.ss,{children:"Name"}),t.jsx(x.ss,{children:"State"}),t.jsx(x.ss,{children:"Timestamp"}),t.jsx(x.ss,{children:"Inputs"}),t.jsx(x.ss,{children:"Outputs"}),t.jsx(x.ss,{className:"text-right",children:"Actions"})]})}),t.jsx(x.RM,{children:em.items?.map((e,a)=>t.jsxs(x.SC,{children:[t.jsx(x.pj,{children:t.jsx(o.X,{checked:_.has(e.id),onCheckedChange:()=>ec(e.id),disabled:"active"===e.state,"aria-label":`Select job ${s(e)}`})}),t.jsx(x.pj,{className:"font-medium max-w-[200px] truncate",children:s(e)}),t.jsx(x.pj,{children:eu(e.state)}),t.jsx(x.pj,{children:e.timestamp?C.WU(new Date(e.timestamp),"MMM d, yyyy HH:mm:ss"):"N/A"}),t.jsx(x.pj,{children:e.data?t.jsx("div",{className:"text-xs max-w-[200px] truncate",children:t.jsx(k.J,{text:JSON.stringify(e.data)})}):null}),t.jsx(x.pj,{children:e.failedReason?t.jsx("div",{className:"text-xs text-red-600 max-w-[200px] truncate",children:t.jsx(k.J,{text:"Error: "+e.failedReason})}):t.jsx("div",{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:t.jsx(k.J,{text:JSON.stringify(e.returnvalue)})})}),t.jsxs(x.pj,{className:"text-right",children:["active"!==e.state&&t.jsx(d.z,{variant:"ghost",size:"sm",onClick:()=>en(e),disabled:ee,children:t.jsx(b.Z,{className:"h-4 w-4 text-red-600"})}),"failed"===e.state&&t.jsxs(d.z,{variant:"ghost",size:"sm",onClick:()=>ed(e),children:[t.jsx(N.Z,{className:"h-4 w-4 text-blue-600"}),"Retry"]})]})]},a))})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,t.jsxs)("div",{className:"flex-1 text-sm text-muted-foreground",children:["(",em?.pageInfo?.itemCount||0," total"," ","items)."]}),t.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)(d.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{M(1),U()},disabled:!em?.pageInfo?.hasPreviousPage,children:[t.jsx("span",{className:"sr-only",children:"Go to first page"}),t.jsx(R.kRt,{className:"size-4"})]}),(0,t.jsxs)(d.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{console.log("itemsData.data?.pageInfo.hasPreviousPage",em?.pageInfo?.hasPreviousPage),M(em?.pageInfo?.hasPreviousPage?em?.pageInfo?.currentPage-1:1),U()},disabled:!em?.pageInfo?.hasPreviousPage,children:[t.jsx("span",{className:"sr-only",children:"Go to previous page"}),t.jsx(v.Z,{className:"size-4"})]}),(0,t.jsxs)(d.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{M(em?.pageInfo?.hasNextPage?em?.pageInfo?.currentPage+1:1),U()},disabled:!em?.pageInfo.hasNextPage,children:[t.jsx("span",{className:"sr-only",children:"Go to next page"}),t.jsx(y.Z,{className:"size-4"})]})]})})]})]})]})]})]}),t.jsx(u.aR,{open:$.length>0,onOpenChange:e=>!e&&A([]),children:(0,t.jsxs)(u._T,{children:[(0,t.jsxs)(u.fY,{children:[t.jsx(u.f$,{children:1===$.length?"Delete Job?":`Delete ${$.length} Jobs?`}),t.jsx(u.yT,{children:1===$.length?`Are you sure you want to delete the job "${$[0]?.name}"? This action cannot be undone.`:`Are you sure you want to delete ${$.length} jobs? This action cannot be undone.`})]}),(0,t.jsxs)(u.xo,{children:[t.jsx(u.le,{children:"Cancel"}),(0,t.jsxs)(u.OL,{onClick:eo,disabled:ee,children:[ee&&t.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Delete"]})]})]})}),t.jsx(u.aR,{open:!!I,onOpenChange:e=>!e&&O(null),children:(0,t.jsxs)(u._T,{children:[(0,t.jsxs)(u.fY,{children:[t.jsx(u.f$,{children:"Retry Job?"}),(0,t.jsxs)(u.yT,{children:['Are you sure you want to retry the job "',I?.name,'"? This will schedule a new job with the same data.']})]}),(0,t.jsxs)(u.xo,{children:[t.jsx(u.le,{children:"Cancel"}),t.jsx(u.OL,{onClick:()=>{I&&a(I)},disabled:ee,children:"Retry"})]})]})}),t.jsx(u.aR,{open:P,onOpenChange:z,children:(0,t.jsxs)(u._T,{children:[(0,t.jsxs)(u.fY,{children:[t.jsx(u.f$,{children:"Pause Queue?"}),(0,t.jsxs)(u.yT,{children:["Are you sure you want to pause the ",e," queue? No jobs will be processed until the queue is resumed."]})]}),(0,t.jsxs)(u.xo,{children:[t.jsx(u.le,{children:"Cancel"}),(0,t.jsxs)(u.OL,{onClick:()=>{es({variables:{queue:e}})},disabled:ea,children:[ea&&t.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Pause Queue"]})]})]})}),t.jsx(u.aR,{open:q,onOpenChange:D,children:(0,t.jsxs)(u._T,{children:[(0,t.jsxs)(u.fY,{children:[t.jsx(u.f$,{children:"Resume Queue?"}),(0,t.jsxs)(u.yT,{children:["Are you sure you want to resume the ",e," queue?."]})]}),(0,t.jsxs)(u.xo,{children:[t.jsx(u.le,{children:"Cancel"}),(0,t.jsxs)(u.OL,{onClick:()=>{et({variables:{queue:e}})},disabled:el,children:[el&&t.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Resume Queue"]})]})]})}),t.jsx(u.aR,{open:T,onOpenChange:Z,children:(0,t.jsxs)(u._T,{children:[(0,t.jsxs)(u.fY,{children:[t.jsx(u.f$,{children:"Drain Queue?"}),(0,t.jsxs)(u.yT,{children:["Are you sure you want to drain the ",e," queue? This will remove all jobs that are waiting or delayed, but not active, waiting-children, completed or failed. This action cannot be undone."]})]}),(0,t.jsxs)(u.xo,{children:[t.jsx(u.le,{children:"Cancel"}),(0,t.jsxs)(u.OL,{onClick:()=>{ei({variables:{queue:e}})},disabled:er,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[er&&t.jsx(j.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Drain Queue"]})]})]})})]})}},57004:(e,s,a)=>{a.a(e,async(e,t)=>{try{a.d(s,{G:()=>g});var l=a(10326),i=a(48644),r=a(93801),n=a(45747),d=a(17577),c=a(94966),o=a(12533),x=a(12428),m=a(47355),u=a(62288),h=a(34789),j=a(77863),p=e([i,r,n]);function g({className:e=null,code:s,language:a,slice:t=200}){let{toast:i}=(0,h.pm)(),[r,n]=(0,d.useState)(null);return(0,l.jsxs)(u.Vq,{children:[l.jsx(u.hg,{asChild:!0,children:r?.length&&l.jsx(c.Z,{className:(0,j.cn)("cursor-pointer",e),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:a||"plaintext",style:m.Z,children:`${r?.slice(0,t||200)} ${r?.length>(t||200)?"...":""}`})}),l.jsx(u.cZ,{className:"sm:max-w-[800px] overflow-hidden max-h-[500px] overflow-y-scroll",children:(0,l.jsxs)(u.fK,{children:[l.jsx(u.$N,{children:"Code"}),l.jsx("div",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(r??""),i({title:"Copied to clipboard"})},children:l.jsx(c.Z,{className:(0,j.cn)(e),showLineNumbers:!0,wrapLines:!0,lineProps:{style:{wordBreak:"break-all",whiteSpace:"pre-wrap"}},language:a||"plaintext",style:m.Z,children:r??""})})]})})]})}[i,r,n]=p.then?(await p)():p,c.Z.registerLanguage("json",x.Z),c.Z.registerLanguage("javascript",o.Z),t()}catch(e){t(e)}})},99440:(e,s,a)=>{a.d(s,{OL:()=>p,_T:()=>x,aR:()=>d,f$:()=>h,fY:()=>m,le:()=>g,xo:()=>u,yT:()=>j});var t=a(10326),l=a(12194),i=a(17577),r=a(90772),n=a(77863);let d=l.fC;l.xz;let c=l.h_,o=i.forwardRef(({className:e,...s},a)=>t.jsx(l.aV,{className:(0,n.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,ref:a}));o.displayName=l.aV.displayName;let x=i.forwardRef(({className:e,...s},a)=>(0,t.jsxs)(c,{children:[t.jsx(o,{}),t.jsx(l.VY,{ref:a,className:(0,n.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),...s})]}));x.displayName=l.VY.displayName;let m=({className:e,...s})=>t.jsx("div",{className:(0,n.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...s});m.displayName="AlertDialogHeader";let u=({className:e,...s})=>t.jsx("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});u.displayName="AlertDialogFooter";let h=i.forwardRef(({className:e,...s},a)=>t.jsx(l.Dx,{ref:a,className:(0,n.cn)("text-lg font-semibold",e),...s}));h.displayName=l.Dx.displayName;let j=i.forwardRef(({className:e,...s},a)=>t.jsx(l.dk,{ref:a,className:(0,n.cn)("text-sm text-muted-foreground",e),...s}));j.displayName=l.dk.displayName;let p=i.forwardRef(({className:e,...s},a)=>t.jsx(l.aU,{ref:a,className:(0,n.cn)((0,r.d)(),e),...s}));p.displayName=l.aU.displayName;let g=i.forwardRef(({className:e,...s},a)=>t.jsx(l.$j,{ref:a,className:(0,n.cn)((0,r.d)({variant:"outline"}),"mt-2 sm:mt-0",e),...s}));g.displayName=l.$j.displayName},53313:(e,s,a)=>{a.d(s,{X:()=>d});var t=a(10326),l=a(13635),i=a(32933),r=a(17577),n=a(77863);let d=r.forwardRef(({className:e,...s},a)=>t.jsx(l.fC,{ref:a,className:(0,n.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...s,children:t.jsx(l.z$,{className:(0,n.cn)("flex items-center justify-center text-current"),children:t.jsx(i.Z,{className:"size-4"})})}));d.displayName=l.fC.displayName},15940:(e,s,a)=>{a.d(s,{RM:()=>d,Rn:()=>m,SC:()=>c,iA:()=>r,pj:()=>x,ss:()=>o,xD:()=>n});var t=a(10326),l=a(17577),i=a(77863);let r=l.forwardRef(({className:e,...s},a)=>t.jsx("div",{className:"relative w-full overflow-auto",children:t.jsx("table",{ref:a,className:(0,i.cn)("w-full caption-bottom text-sm",e),...s})}));r.displayName="Table";let n=l.forwardRef(({className:e,...s},a)=>t.jsx("thead",{ref:a,className:(0,i.cn)("[&_tr]:border-b",e),...s}));n.displayName="TableHeader";let d=l.forwardRef(({className:e,...s},a)=>t.jsx("tbody",{ref:a,className:(0,i.cn)("[&_tr:last-child]:border-0",e),...s}));d.displayName="TableBody",l.forwardRef(({className:e,...s},a)=>t.jsx("tfoot",{ref:a,className:(0,i.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...s})).displayName="TableFooter";let c=l.forwardRef(({className:e,...s},a)=>t.jsx("tr",{ref:a,className:(0,i.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...s}));c.displayName="TableRow";let o=l.forwardRef(({className:e,...s},a)=>t.jsx("th",{ref:a,className:(0,i.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",e),...s}));o.displayName="TableHead";let x=l.forwardRef(({className:e,...s},a)=>t.jsx("td",{ref:a,className:(0,i.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",e),...s}));x.displayName="TableCell";let m=l.forwardRef(({className:e,...s},a)=>t.jsx("caption",{ref:a,className:(0,i.cn)("mt-4 text-sm text-muted-foreground",e),...s}));m.displayName="TableCaption"}};
@@ -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"}};