@exulu/frontend 1.10.0 → 1.11.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.
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/app-build-manifest.json +163 -160
- package/dist/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/build-manifest.json +2 -2
- package/dist/.next/prerender-manifest.json +1 -1
- package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +1 -1
- package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/data/[[...query]]/page.js +2 -2
- package/dist/.next/server/app/(application)/data/[[...query]]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/evals/[id]/page.js +1 -1
- package/dist/.next/server/app/(application)/evals/[id]/page.js.nft.json +1 -1
- package/dist/.next/server/app/(application)/evals/[id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/evals/cases/page.js +1 -1
- package/dist/.next/server/app/(application)/evals/cases/page.js.nft.json +1 -1
- package/dist/.next/server/app/(application)/evals/cases/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/evals/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/explorer/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/keys/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/projects/[project]/page.js +1 -1
- package/dist/.next/server/app/(application)/projects/[project]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/prompts/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/_not-found.html +1 -1
- package/dist/.next/server/app/_not-found.rsc +1 -1
- package/dist/.next/server/app-paths-manifest.json +5 -5
- package/dist/.next/server/chunks/2270.js +145 -132
- package/dist/.next/server/chunks/{5084.js → 2587.js} +1 -1
- package/dist/.next/server/chunks/3503.js +1 -1
- package/dist/.next/server/chunks/5485.js +1 -1
- package/dist/.next/server/chunks/5974.js +1 -1
- package/dist/.next/server/chunks/7944.js +1 -1
- package/dist/.next/server/chunks/8286.js +1 -1
- package/dist/.next/server/middleware-manifest.json +5 -5
- package/dist/.next/server/pages/404.html +1 -1
- package/dist/.next/server/pages/500.html +1 -1
- package/dist/.next/server/server-reference-manifest.json +1 -1
- package/dist/.next/static/chunks/1707-06e693c4a709c147.js +2 -0
- package/dist/.next/static/chunks/1707-06e693c4a709c147.js.map +1 -0
- package/dist/.next/static/chunks/{1957-cf44b1d31a9c7d5c.js → 1957-34f17de1e14e45de.js} +1 -1
- package/dist/.next/static/chunks/{1957-cf44b1d31a9c7d5c.js.map → 1957-34f17de1e14e45de.js.map} +1 -1
- package/dist/.next/static/chunks/{2293-48a95904b834eccc.js → 2293-592e22dde70d632b.js} +1 -1
- package/dist/.next/static/chunks/{2293-48a95904b834eccc.js.map → 2293-592e22dde70d632b.js.map} +1 -1
- package/dist/.next/static/chunks/2534-3dd7a9fabfbdb9d8.js +2 -0
- package/dist/.next/static/chunks/2534-3dd7a9fabfbdb9d8.js.map +1 -0
- package/dist/.next/static/chunks/2823-324b1cd8f15ff9c5.js +2 -0
- package/dist/.next/static/chunks/2823-324b1cd8f15ff9c5.js.map +1 -0
- package/dist/.next/static/chunks/3246-1812de142455a0ac.js +2 -0
- package/dist/.next/static/chunks/3246-1812de142455a0ac.js.map +1 -0
- package/dist/.next/static/chunks/{3750-e3d1b2cccd265190.js → 3750-d0ae5d73288be8de.js} +2 -2
- package/dist/.next/static/chunks/3750-d0ae5d73288be8de.js.map +1 -0
- package/dist/.next/static/chunks/{3832-d7782d6a2771ae6c.js → 3832-0b8edbcc671f4cc0.js} +2 -2
- package/dist/.next/static/chunks/3832-0b8edbcc671f4cc0.js.map +1 -0
- package/dist/.next/static/chunks/{4386-45b79e656a244d8a.js → 4386-21ac377a719ebdfa.js} +1 -1
- package/dist/.next/static/chunks/{4386-45b79e656a244d8a.js.map → 4386-21ac377a719ebdfa.js.map} +1 -1
- package/dist/.next/static/chunks/4612-da512770f949561a.js +2 -0
- package/dist/.next/static/chunks/4612-da512770f949561a.js.map +1 -0
- package/dist/.next/static/chunks/{5825-efd4db1da512bd7f.js → 4760-d5ceb992b68e35ca.js} +2 -2
- package/dist/.next/static/chunks/4760-d5ceb992b68e35ca.js.map +1 -0
- package/dist/.next/static/chunks/{6367-59655a85d75e19be.js → 6367-aa5020cbea5354e2.js} +1 -1
- package/dist/.next/static/chunks/{6367-59655a85d75e19be.js.map → 6367-aa5020cbea5354e2.js.map} +1 -1
- package/dist/.next/static/chunks/6373-3eee0b6c8b8fd459.js +2 -0
- package/dist/.next/static/chunks/6373-3eee0b6c8b8fd459.js.map +1 -0
- package/dist/.next/static/chunks/{8030-9c926ea4dfd3a54e.js → 8030-5d38a3f1a4ad44cb.js} +1 -1
- package/dist/.next/static/chunks/{8030-9c926ea4dfd3a54e.js.map → 8030-5d38a3f1a4ad44cb.js.map} +1 -1
- package/dist/.next/static/chunks/9105-143f12397a76a332.js +2 -0
- package/dist/.next/static/chunks/9105-143f12397a76a332.js.map +1 -0
- package/dist/.next/static/chunks/9877-378934ae38c6760c.js +2 -0
- package/dist/.next/static/chunks/9877-378934ae38c6760c.js.map +1 -0
- package/dist/.next/static/chunks/{9953-95900a236271a222.js → 9953-02d5b52553a5c573.js} +2 -2
- package/dist/.next/static/chunks/{9953-95900a236271a222.js.map → 9953-02d5b52553a5c573.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/{page-e4a4693953329671.js → page-37918149a8e909b0.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/{page-e4a4693953329671.js.map → page-37918149a8e909b0.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/agents/{page-b77c21a993c55901.js → page-9cff3b35b042d46a.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/agents/{page-b77c21a993c55901.js.map → page-9cff3b35b042d46a.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-53a99d8df53380c7.js +2 -0
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-53a99d8df53380c7.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/chat/{layout-093baa26f89338bc.js → layout-ba702af6bb56baa2.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/chat/{layout-093baa26f89338bc.js.map → layout-ba702af6bb56baa2.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/chat/{page-8a1fcfb68cf9c8c0.js → page-8b00a98d285829b1.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/chat/{page-8a1fcfb68cf9c8c0.js.map → page-8b00a98d285829b1.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/configuration/{page-f315ede6d66922e6.js → page-1e978e117d5086a1.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/configuration/{page-f315ede6d66922e6.js.map → page-1e978e117d5086a1.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/dashboard/{page-4a1956febf5235b6.js → page-c54b4bc8d0ac4ac8.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/dashboard/{page-4a1956febf5235b6.js.map → page-c54b4bc8d0ac4ac8.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/{layout-0c7c1b0e1713bf60.js → layout-dfdb5c1cdc7ddefc.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/{layout-0c7c1b0e1713bf60.js.map → layout-dfdb5c1cdc7ddefc.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-faaee5fe82b45966.js +2 -0
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-faaee5fe82b45966.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/evals/[id]/{page-a7728cf9b0524489.js → page-c956d9892676aa4f.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c956d9892676aa4f.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/evals/cases/page-6b4dde82376e9aac.js +2 -0
- package/dist/.next/static/chunks/app/(application)/evals/cases/page-6b4dde82376e9aac.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/evals/{page-8b38d8d29f275704.js → page-944bfc4f0a001e4c.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/evals/page-944bfc4f0a001e4c.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/explorer/page-07d67145bb176711.js +2 -0
- package/dist/.next/static/chunks/app/(application)/explorer/page-07d67145bb176711.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/keys/{page-afe59c91cc347208.js → page-6c0cd9ef20cd1461.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/keys/{page-afe59c91cc347208.js.map → page-6c0cd9ef20cd1461.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/projects/[project]/{page-f04fd5291a1ef7b1.js → page-5e2be54e76b8509c.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/projects/[project]/{page-f04fd5291a1ef7b1.js.map → page-5e2be54e76b8509c.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/projects/{layout-a8e1830ef3faafb9.js → layout-f2e0f42a08c96bb8.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/projects/{layout-a8e1830ef3faafb9.js.map → layout-f2e0f42a08c96bb8.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/prompts/{page-2c500e9898447506.js → page-2c03bbe32800acc3.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/prompts/{page-2c500e9898447506.js.map → page-2c03bbe32800acc3.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/roles/{page-873911198c17d9a7.js → page-b977b5c658004717.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/roles/{page-873911198c17d9a7.js.map → page-b977b5c658004717.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/token/{page-3acc39cb8a718331.js → page-08596ece49a811b9.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/token/page-08596ece49a811b9.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/users/{page-0d7f0d7e80cd1436.js → page-49212081be40aeca.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/users/{page-0d7f0d7e80cd1436.js.map → page-49212081be40aeca.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/create/{page-8ebf4e3d4d17443b.js → page-9ce762918374f616.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/create/{page-8ebf4e3d4d17443b.js.map → page-9ce762918374f616.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/edit/[variable_id]/{page-006145e82e054e72.js → page-0e2b7038546d9f7a.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/edit/[variable_id]/{page-006145e82e054e72.js.map → page-0e2b7038546d9f7a.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/{page-51a8aeece444d388.js → page-141d5d3f735454fe.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/{page-51a8aeece444d388.js.map → page-141d5d3f735454fe.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/usage/[variable_id]/{page-8f5cfc9565fd919a.js → page-fb1bb3ea6f7cae47.js} +1 -1
- package/dist/.next/static/chunks/app/(application)/variables/usage/[variable_id]/{page-8f5cfc9565fd919a.js.map → page-fb1bb3ea6f7cae47.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/workflows/{page-e38f9456120dab69.js → page-2b839fdbc55c297b.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/workflows/page-2b839fdbc55c297b.js.map +1 -0
- package/dist/.next/static/css/0f539b50cca35462.css +4 -0
- package/dist/.next/static/css/0f539b50cca35462.css.map +1 -0
- package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
- package/package.json +1 -1
- package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js +0 -2
- package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js.map +0 -1
- package/dist/.next/static/chunks/3171-6996819b8863d41f.js +0 -2
- package/dist/.next/static/chunks/3171-6996819b8863d41f.js.map +0 -1
- package/dist/.next/static/chunks/3750-e3d1b2cccd265190.js.map +0 -1
- package/dist/.next/static/chunks/3832-d7782d6a2771ae6c.js.map +0 -1
- package/dist/.next/static/chunks/4419-b9be79d8cd46a97d.js +0 -2
- package/dist/.next/static/chunks/4419-b9be79d8cd46a97d.js.map +0 -1
- package/dist/.next/static/chunks/5110-098aa924c3108fa4.js +0 -2
- package/dist/.next/static/chunks/5110-098aa924c3108fa4.js.map +0 -1
- package/dist/.next/static/chunks/5825-efd4db1da512bd7f.js.map +0 -1
- package/dist/.next/static/chunks/6280-50b751f993f2fe4f.js +0 -2
- package/dist/.next/static/chunks/6280-50b751f993f2fe4f.js.map +0 -1
- package/dist/.next/static/chunks/6373-aef582adc575d3ca.js +0 -2
- package/dist/.next/static/chunks/6373-aef582adc575d3ca.js.map +0 -1
- package/dist/.next/static/chunks/9105-d8ff41060f7ffc85.js +0 -2
- package/dist/.next/static/chunks/9105-d8ff41060f7ffc85.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-d59534ca19eee51f.js +0 -2
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-d59534ca19eee51f.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-7db6bfbf02606136.js +0 -2
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-7db6bfbf02606136.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/evals/cases/page-827f50c6d1f150d0.js +0 -2
- package/dist/.next/static/chunks/app/(application)/evals/cases/page-827f50c6d1f150d0.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/evals/page-8b38d8d29f275704.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/explorer/page-e6b1c034c07776e2.js +0 -2
- package/dist/.next/static/chunks/app/(application)/explorer/page-e6b1c034c07776e2.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/token/page-3acc39cb8a718331.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/workflows/page-e38f9456120dab69.js.map +0 -1
- package/dist/.next/static/css/9c08ae5d990a6b14.css +0 -4
- package/dist/.next/static/css/9c08ae5d990a6b14.css.map +0 -1
- /package/dist/.next/static/{3j63p6b3zZZB_v1Hn8Mxp → exslB-IPXi_veOKFA4L1Z}/_buildManifest.js +0 -0
- /package/dist/.next/static/{3j63p6b3zZZB_v1Hn8Mxp → exslB-IPXi_veOKFA4L1Z}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6050],{72252:function(e,s,n){Promise.resolve().then(n.bind(n,40272))},40272:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return ev}});var l=n(57437),t=n(7211),r=n(12199),a=n(13590),i=n(21563),d=n(18930),c=n(9334),o=n(39763);let u=(0,o.Z)("XSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var x=n(83229),m=n(15868);let h=(0,o.Z)("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var j=n(45131);let p=(0,o.Z)("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);var v=n(24156),g=n(17684),f=n(99376),b=n(2265),N=n(29501),y=n(67119),C=n(62910),w=n(68656),k=n(35974),E=n(62869),_=n(15681),O=n(95186),z=n(10492),S=n(6512),T=n(1828),D=n(73578),A=n(76818),Z=n(81103),R=n(26110),M=n(84190),I=n(37099),q=n(14438),L=n(94508),F=n(93022),P=n(65613),U=n(20653),B=n(27689),V=n(8014),G=n(74928),J=n(66070),W=n(78361);function X(e){var s,n,o,X,Y,K,Q,$,H,ee,es,en;let[el,et]=(0,b.useState)(),er=(0,f.useRouter)(),[ea,ei]=(0,b.useState)(),ed=e.context,ec=e.context.fields.map(e=>e.name);console.log("fields",ec),console.log("context",ed);let{loading:eo,error:eu,refetch:ex}=(0,t.aM)((0,B.A1)(e.context.id,ec,!0),{skip:!e.itemId||!(null===(s=e.context)||void 0===s?void 0:s.id),variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:s=>{var n,l;let t=s[e.context.id+"_itemsById"];et({...t,tags:t.tags?t.tags.split(","):[]}),ei({rights_mode:t.rights_mode,users:null===(n=t.RBAC)||void 0===n?void 0:n.users,roles:null===(l=t.RBAC)||void 0===l?void 0:l.roles})}});(0,b.useEffect)(()=>{ex()},[e.itemId]);let[em,eh]=(0,r.D)((0,B.ty)(e.context.id),{onCompleted:()=>{q.Am.success("Item updated",{description:"Item updated successfully."})},onError:e=>{q.Am.error("Error updating item",{description:e.message})}}),[ej,ep]=(0,r.D)((0,B.mN)(e.context.id,[]),{onCompleted:()=>{q.Am.success("Item deleted successfully.",{description:"Item deleted successfully."})},onError:e=>{q.Am.error("Error deleting item",{description:e.message})}}),[ev,eg]=(0,r.D)((0,B.Eq)(e.context.id),{onCompleted:s=>{var n;if((null===(n=s[e.context.id+"_itemsGenerateChunks"].jobs)||void 0===n?void 0:n.length)>0){q.Am.success("Chunks generation started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}q.Am.success("Chunks generated",{description:"Chunks generated successfully."})}}),[ef,eb]=(0,r.D)((0,B.ps)(e.context.id),{onCompleted:s=>{var n;if((null===(n=s[e.context.id+"_itemsDeleteChunks"].jobs)||void 0===n?void 0:n.length)>0){q.Am.success("Chunks deletion started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}q.Am.success("Chunks deleted",{description:"Chunks deleted successfully."})}}),[eN,ey]=(0,r.D)((0,B.DC)(e.context.id),{onCompleted:s=>{var n,l;console.log("data",s);let t=s["".concat(e.context.id,"_itemsProcessItem")];q.Am.success(t.message||"Items processed successfully",{description:(null===(n=t.jobs)||void 0===n?void 0:n.length)?"".concat(t.jobs.length," job(s) scheduled"):(null===(l=t.results)||void 0===l?void 0:l.length)?"".concat(t.results.length," item(s) processed"):void 0})},onError:e=>{q.Am.error("Error processing item",{description:e.message})}}),eC=y.Ry({name:y.Z_().nullable().optional(),tags:y.Z_().nullable().optional(),external_id:y.Z_().nullable().optional(),description:y.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...null!==(es=null==ed?void 0:null===(n=ed.fields)||void 0===n?void 0:n.reduce((e,s)=>({...e,[s.name]:y.Z_().nullable()}),{}))&&void 0!==es?es:{}}),ew=(0,N.cI)({resolver:(0,a.F)(eC),defaultValues:{description:null==el?void 0:el.description},mode:"onChange"}),ek=e=>{if(e.target.value&&"Enter"===e.key){var s;let n=null!==(s=null==el?void 0:el.tags)&&void 0!==s?s:[],l=[...Array.isArray(n)?[...n]:[]];l.push(e.target.value),console.log("tags",l),ew.setValue("tags",l.join(",")),et({...el,tags:l}),e.target.value=""}},[eE,e_]=(0,b.useState)(!1),[eO,ez]=(0,b.useState)(null),[eS,eT]=(0,b.useState)(null);return((0,b.useEffect)(()=>{(null==el?void 0:el.text)==="New item"?e_(!0):e_(!1)},[null==el?void 0:el.id]),eo)?(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md"}),(0,l.jsx)(F.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):eu?(0,l.jsxs)(P.bZ,{variant:"destructive",children:[(0,l.jsx)(U.LPM,{className:"size-4"}),(0,l.jsx)(P.Cd,{children:"Error"}),(0,l.jsx)(P.X,{children:(null==eu?void 0:eu.message)||"Error loading item."})]}):(0,l.jsxs)("div",{className:"flex h-full flex-col",children:[el?(0,l.jsxs)(l.Fragment,{children:[e.actions?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"flex items-center p-2",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(null==el?void 0:el.archived)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{onClick:async()=>{el.id&&(em({variables:{id:el.id,input:{archived:!1}}}),et({...el,archived:!1}),er.push("./"))},variant:"ghost",size:"icon",disabled:!el||eh.loading,children:[eh.loading?(0,l.jsx)(z.g,{}):(0,l.jsx)(i.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Unarchive"})]})}),(0,l.jsx)(Z._v,{children:"Unarchive"})]}),(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{onClick:async()=>{el.id&&(ej({variables:{id:el.id}}),er.push("./"))},variant:"ghost",size:"icon",disabled:!el||ep.loading,children:[ep.loading?(0,l.jsx)(z.g,{}):(0,l.jsx)(d.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Delete"})]})}),(0,l.jsx)(Z._v,{children:"Delete"})]})]}):(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{onClick:async()=>{(null==el?void 0:el.id)&&(em({variables:{id:el.id,input:{archived:!0}}}),et({...el,archived:!0}),er.push("./"))},variant:"ghost",size:"icon",disabled:!el||eh.loading,children:[eh.loading?(0,l.jsx)(z.g,{}):(0,l.jsx)(c.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Archive"})]})}),(0,l.jsx)(Z._v,{children:"Archive"})]}),eE?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{onClick:()=>{e_(!1)},variant:"ghost",size:"icon",children:[(0,l.jsx)(u,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Cancel"})]})}),(0,l.jsx)(Z._v,{children:"Cancel"})]}),(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{disabled:eh.loading,onClick:()=>{var e,s,n,l;(null==el?void 0:el.id)&&(em({variables:{id:el.id,input:{textlength:null==el?void 0:null===(e=el.text)||void 0===e?void 0:e.length,description:null==el?void 0:el.description,name:null==el?void 0:el.name,externalId:null==el?void 0:el.externalId,tags:null==el?void 0:null===(s=el.tags)||void 0===s?void 0:s.join(","),source:null==el?void 0:el.source,archived:null==el?void 0:el.archived,rights_mode:null==ea?void 0:ea.rights_mode,RBAC:{users:(null==ea?void 0:ea.users)||[],roles:(null==ea?void 0:ea.roles)||[]},...null!==(l=null==ed?void 0:null===(n=ed.fields)||void 0===n?void 0:n.reduce((e,s)=>({...e,[s.name]:null==el?void 0:el[s.name]}),{}))&&void 0!==l?l:{}}}}),e_(!1))},variant:"ghost",size:"icon",children:[(0,l.jsx)(x.Z,{className:"size-4"}),(0,l.jsxs)("span",{className:"sr-only",children:["Save ",null!==(en=eh.loading)&&void 0!==en?en:(0,l.jsx)(z.g,{})]})]})}),(0,l.jsx)(Z._v,{children:"Save"})]})]}):(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{onClick:()=>{e_(!0)},variant:"ghost",size:"icon",disabled:!el||eh.loading,children:[(0,l.jsx)(m.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Edit"})]})}),(0,l.jsx)(Z._v,{children:"Edit"})]})]})}),(0,l.jsx)(S.Z,{})]}):null,(0,l.jsx)("div",{className:"flex flex-1 flex-col",children:(0,l.jsxs)("div",{className:(0,L.cn)("space-y-2"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:[(0,l.jsx)("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"}),ed.processor&&(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsxs)(E.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{eN({variables:{item:null==el?void 0:el.id}})},disabled:ey.loading,children:[ey.loading?(0,l.jsx)(z.g,{}):(0,l.jsx)(h,{className:"size-4"}),(0,l.jsx)("span",{className:"ml-2",children:"Process"})]})}),(0,l.jsxs)(Z._v,{className:"max-w-xs",children:[ed.processor.name+"\n"+ed.processor.description,(0,l.jsx)("span",{className:"text-sm text-muted-foreground",children:ed.processor.queue})]})]})]}),(0,l.jsxs)("div",{className:"p-5",children:[(0,l.jsx)(_.l0,{...ew,children:(0,l.jsx)("form",{className:"space-y-8",children:(0,l.jsxs)("div",{children:[(0,l.jsxs)(D.iA,{children:[(0,l.jsx)(D.xD,{children:(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.ss,{children:"Name"}),(0,l.jsx)(D.ss,{children:"Value"})]})}),(0,l.jsxs)(D.RM,{children:[(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium capitalize",children:"Name"}),(0,l.jsx)(D.pj,{children:(0,l.jsx)(_.Wi,{control:ew.control,name:"name",render:e=>{var s,n,t;let{field:r}=e;return(0,l.jsx)(_.xJ,{children:eE?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsx)(O.I,{type:"text",disabled:!eE,onChange:e=>{et({...el,name:e.target.value})},placeholder:"Item name",value:null!==(t=el.name)&&void 0!==t?t:""})}),(0,l.jsx)(_.zG,{})]}):(0,l.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=el.name)&&void 0!==e?e:""),q.Am.success("Copied to clipboard")},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:el.name&&(null===(s=el.name)||void 0===s?void 0:s.length)>200?(null===(n=el.name)||void 0===n?void 0:n.slice(0,200))+"...":el.name})})}})})]},"name"),(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium capitalize",children:"Tags"}),(0,l.jsxs)(D.pj,{children:[eE?(0,l.jsx)("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:(0,l.jsx)(_.Wi,{control:ew.control,name:"tags",render:e=>{let{field:s}=e;return(0,l.jsxs)(_.xJ,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsx)(O.I,{id:"includes",type:"text",onKeyUp:e=>ek(e),placeholder:"Type and press enter to add"})}),(0,l.jsx)(_.zG,{})]})}})}):null,(null==el?void 0:null===(o=el.tags)||void 0===o?void 0:o.length)?(0,l.jsx)("div",{className:"gap-2 pt-2",children:null==el?void 0:null===(X=el.tags)||void 0===X?void 0:X.map((e,s)=>(0,l.jsx)(k.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),eE?(0,l.jsx)("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{var e;let n=[...null!==(e=el.tags)&&void 0!==e?e:[]];n.splice(s,1),ew.setValue("tags",n.join(",")),et({...el,tags:n})},children:(0,l.jsx)(j.Z,{className:"ml-1",size:15})}):null]})},"tag-".concat(s)))}):null]})]},"tags"),(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium capitalize",children:"Description"}),(0,l.jsx)(D.pj,{children:(0,l.jsx)(_.Wi,{control:ew.control,name:"description",render:e=>{var s,n,t;let{field:r}=e;return(0,l.jsx)(_.xJ,{children:eE?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(A.g,{autoFocus:!0,disabled:!eE,onChange:e=>{et({...el,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:null!==(n=el.description)&&void 0!==n?n:""}),(0,l.jsxs)(R.Vq,{children:[(0,l.jsx)(R.hg,{asChild:!0,children:(0,l.jsxs)(E.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>{var e;return ez({name:"description",value:null!==(e=el.description)&&void 0!==e?e:"",disabled:!1})},children:[(0,l.jsx)(p,{className:"h-3 w-3"}),(0,l.jsx)("span",{className:"sr-only",children:"Expand"})]})}),(0,l.jsxs)(R.cZ,{className:"max-w-4xl max-h-[80vh]",children:[(0,l.jsx)(R.fK,{children:(0,l.jsx)(R.$N,{children:"Edit Description"})}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(A.g,{rows:20,className:"min-h-[400px] resize-none",value:(null==eO?void 0:eO.name)==="description"?eO.value:null!==(t=el.description)&&void 0!==t?t:"",onChange:e=>{let s=e.target.value;ez(e=>(null==e?void 0:e.name)==="description"?{...e,value:s}:e),et({...el,description:s})}})})]})]})]})}),(0,l.jsx)(_.zG,{})]}):(0,l.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=el.description)&&void 0!==e?e:""),q.Am.success("Copied to clipboard")},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:(0,l.jsx)(w.J,{text:null!==(s=el.description)&&void 0!==s?s:""})})})}})})]},19091),(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium capitalize",children:"External ID"}),(0,l.jsx)(D.pj,{children:(0,l.jsx)(_.Wi,{control:ew.control,name:"external_id",render:e=>{var s,n;let{field:t}=e;return(0,l.jsx)(_.xJ,{children:eE?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsx)(O.I,{type:"text",disabled:!eE,onChange:e=>{console.log("e",e),et({...el,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:null!==(n=el.external_id)&&void 0!==n?n:""})}),(0,l.jsx)(_.zG,{})]}):(0,l.jsx)("div",{onClick:async()=>{var e;await navigator.clipboard.writeText(null!==(e=el.external_id)&&void 0!==e?e:""),q.Am.success("Copied to clipboard")},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:null!==(s=el.external_id)&&void 0!==s?s:""})})}})})]},"externalId"),ed.processor&&(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium capitalize",children:"Last processed at"}),(0,l.jsx)(D.pj,{children:el.last_processed_at})]},"processor"),(null==ed?void 0:null===(Y=ed.fields)||void 0===Y?void 0:Y.length)&&ed.fields.map((e,s)=>{var n;return(0,l.jsxs)(D.SC,{children:[(0,l.jsxs)(D.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&(0,l.jsx)("span",{className:"text-sm text-muted-foreground",children:"Calculated"})]}),eE?(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)(D.pj,{children:["code"===e.type||"json"===e.type||"text"===e.type||"longText"===e.type||"markdown"===e.type||"shortText"===e.type?(0,l.jsx)(_.Wi,{control:ew.control,name:e.name,render:s=>{var n,t;let{field:r}=s;return(0,l.jsxs)(_.xJ,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)(A.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:s=>{et({...el,[e.name]:s.target.value})},value:null!==(n=el[e.name])&&void 0!==n?n:""}),(0,l.jsxs)(R.Vq,{children:[(0,l.jsx)(R.hg,{asChild:!0,children:(0,l.jsxs)(E.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>{var s;return ez({name:e.name,disabled:!1,value:null!==(s=el[e.name])&&void 0!==s?s:""})},children:[(0,l.jsx)(p,{className:"h-3 w-3"}),(0,l.jsx)("span",{className:"sr-only",children:"Expand"})]})}),(0,l.jsxs)(R.cZ,{className:"max-w-4xl max-h-[80vh]",children:[(0,l.jsx)(R.fK,{children:(0,l.jsxs)(R.$N,{children:["Edit ",e.name]})}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(A.g,{rows:20,className:"min-h-[400px] resize-none",value:(null==eO?void 0:eO.name)===e.name?eO.value:null!==(t=el[e.name])&&void 0!==t?t:"",onChange:s=>{let n=s.target.value;ez(s=>(null==s?void 0:s.name)===e.name?{...s,value:n}:s),et({...el,[e.name]:n})}})})]})]})]})}),(0,l.jsx)(_.zG,{})]})}}):null,"number"===e.type?(0,l.jsx)(_.Wi,{control:ew.control,name:e.name,render:s=>{var n;let{field:t}=s;return(0,l.jsxs)(_.xJ,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsx)(O.I,{id:e.name,type:"number",onChange:s=>{et({...el,[e.name]:s.target.value})},value:null!==(n=el[e.name])&&void 0!==n?n:""})}),(0,l.jsx)(_.zG,{})]})}}):null,"boolean"===e.type?(0,l.jsx)(_.Wi,{control:ew.control,name:e.name,render:s=>{let{field:n}=s;return(0,l.jsxs)(_.xJ,{children:[(0,l.jsx)(_.NI,{children:(0,l.jsx)(T.r,{checked:!!n.value,onCheckedChange:s=>{et({...el,[e.name]:s})}})}),(0,l.jsx)(_.zG,{})]})}}):null,"file"===e.type&&(0,l.jsx)("div",{children:(0,l.jsx)(W.jF,{s3key:el[e.name],children:(0,l.jsx)(W.ZP,{id:"item-".concat(el.id),buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:s=>{console.log("keys",s),et({...el,[e.name]:s[0]})}})})})]})}):(0,l.jsx)(D.pj,{children:(0,l.jsxs)("span",{children:["code"===e.type&&(0,l.jsx)(C.G,{code:el[e.name]}),"json"===e.type&&(0,l.jsx)(C.G,{code:el[e.name],language:"json"}),"shortText"===e.type&&(0,l.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(el[e.name]),q.Am.success("Copied to clipboard")},children:el[e.name]}),"longText"===e.type&&(0,l.jsx)(w.J,{text:el[e.name]}),"file"===e.type&&(0,l.jsx)(W.jF,{s3key:el[e.name]}),"markdown"===e.type&&(0,l.jsx)(w.J,{text:el[e.name]}),!e.type&&(0,l.jsx)(w.J,{text:el[e.name]}),"text"===e.type&&(0,l.jsx)(w.J,{text:el[e.name]}),"number"===e.type&&(0,l.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(el[e.name]),q.Am.success("Copied to clipboard")},children:el[e.name]}),"boolean"===e.type&&(0,l.jsx)("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(el[e.name]),q.Am.success("Copied to clipboard")},children:null!==(n=el[e.name])&&void 0!==n?n:""})]})})]},s)})]})]}),(0,l.jsx)(S.Z,{className:"my-4"})]})})}),(0,l.jsx)(J.Zb,{className:"bg-transparent",children:(0,l.jsxs)(G.zF,{children:[(0,l.jsx)(J.Ol,{className:"p-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)("p",{className:"text-base",children:"Access Control"}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),(0,l.jsx)(G.wy,{asChild:!0,children:(0,l.jsxs)(E.z,{variant:"ghost",size:"icon",className:"size-8",children:[(0,l.jsx)(v.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Toggle"})]})})]})}),(0,l.jsx)(G.Fw,{className:"mt-5",children:(0,l.jsx)(J.aY,{className:"space-y-4",children:(0,l.jsx)(V.P,{initialRightsMode:el.rights_mode,initialUsers:null===(K=el.RBAC)||void 0===K?void 0:K.users,initialRoles:null===(Q=el.RBAC)||void 0===Q?void 0:Q.roles,onChange:(e,s,n)=>{ei({rights_mode:e,users:s,roles:n})}})})})]})}),(0,l.jsxs)("div",{className:"mt-4 border border p-3 pb-5 rounded",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[(0,l.jsx)("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,l.jsxs)(M.h_,{modal:!1,children:[(0,l.jsx)(M.$F,{asChild:!0,children:(0,l.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,l.jsx)(g.Z,{className:"h-4 w-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,l.jsxs)(M.AW,{align:"end",children:[(0,l.jsx)(M.Xi,{onClick:()=>eT("generate"),children:"Generate embeddings"}),(0,l.jsx)(M.Xi,{onClick:()=>eT("delete"),children:"Delete embeddings"})]})]})]}),(0,l.jsxs)(D.iA,{children:[(0,l.jsx)(D.Rn,{children:(null==el?void 0:null===($=el.chunks)||void 0===$?void 0:$.length)?"A list of all embeddings for this item.":"No embeddings found."}),(0,l.jsx)(D.xD,{children:(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.ss,{children:"Index"}),(0,l.jsx)(D.ss,{children:"Content"}),(0,l.jsx)(D.ss,{children:"Dimensions"}),(0,l.jsx)(D.ss,{children:"Created At"}),(0,l.jsx)(D.ss,{children:"Updated At"})]})}),(0,l.jsx)(D.RM,{children:(null==el?void 0:null===(H=el.chunks)||void 0===H?void 0:H.length)?(null==el?void 0:null===(ee=el.chunks)||void 0===ee?void 0:ee.length)&&el.chunks.map(e=>(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),(0,l.jsx)(D.pj,{children:(0,l.jsx)(w.J,{text:e.chunk_content})}),(0,l.jsx)(D.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),(0,l.jsx)(D.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.chunk_id)):null})]})]})]})]})})]}):(0,l.jsxs)(l.Fragment,{children:[" ",!el&&e.itemId?(0,l.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):(0,l.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),(0,l.jsx)(I.aR,{open:"generate"===eS,onOpenChange:e=>!e&&eT(null),children:(0,l.jsxs)(I._T,{children:[(0,l.jsxs)(I.fY,{children:[(0,l.jsx)(I.f$,{children:"Generate Embeddings"}),(0,l.jsx)(I.yT,{children:"Are you sure you want to generate embeddings for this item? This will create new embedding vectors for the content."})]}),(0,l.jsxs)(I.xo,{children:[(0,l.jsx)(I.le,{children:"Cancel"}),(0,l.jsx)(I.OL,{disabled:eg.loading,onClick:()=>{(null==el?void 0:el.id)&&(console.log("Generate embeddings for item:",null==el?void 0:el.id),eT(null),ev({variables:{where:{id:{eq:null==el?void 0:el.id}}}}))},children:"Generate"})]})]})}),(0,l.jsx)(I.aR,{open:"delete"===eS,onOpenChange:e=>!e&&eT(null),children:(0,l.jsxs)(I._T,{children:[(0,l.jsxs)(I.fY,{children:[(0,l.jsx)(I.f$,{children:"Delete Embeddings"}),(0,l.jsx)(I.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,l.jsxs)(I.xo,{children:[(0,l.jsx)(I.le,{children:"Cancel"}),(0,l.jsx)(I.OL,{disabled:eb.loading,onClick:async()=>{(null==el?void 0:el.id)&&(console.log("Delete embeddings for item:",null==el?void 0:el.id),eT(null),ef({variables:{where:{id:{eq:null==el?void 0:el.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}var Y=n(5341),K=n(91048),Q=n(21409),$=n(52896),H=n(73450);function ee(){let[e,s]=(0,b.useState)("count"),[n,t]=(0,b.useState)({from:(0,Y.k)(new Date,7),to:new Date}),[r,a]=(0,b.useState)("CONTEXT_UPSERT"),[i,d]=(0,b.useState)("label");return(0,l.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),(0,l.jsx)("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),(0,l.jsx)("div",{className:"flex items-center space-x-2",children:(0,l.jsx)(Q.z,{dateRange:n,onDateRangeChange:t,maxDays:30})})]}),(0,l.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[(0,l.jsx)("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:(0,l.jsx)($.q,{dateRange:n,selectedType:r,onTypeChange:a,unitOptions:[{value:"count",label:"Count"}],onUnitChange:s,unit:e,dataTypes:[K.h.CONTEXT_RETRIEVE,K.h.CONTEXT_UPSERT]})}),(0,l.jsx)("div",{className:"rounded-lg border p-6 flex flex-col",children:(0,l.jsx)(H.Y,{groupByOptions:[],dateRange:n,selectedType:r,unit:e,groupBy:i,onGroupByChange:d})})]})]})}var es=n(19378),en=n(7598),el=n(27648),et=n(37091),er=n(15863);function ea(e){var s,n;let{contextId:a}=e,[i,d]=(0,b.useState)(null),[c,o]=(0,b.useState)(!0),u=(0,b.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:x,data:m,refetch:h,previousData:j,error:p}=(0,t.aM)((0,B.P3)(a,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:a,page:1,limit:5,filters:[{embeddings_updated_at:{gte:u.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),[v,g]=(0,r.D)((0,B.Eq)(a),{onCompleted:e=>{var s;if((null===(s=e[a+"_itemsGenerateChunks"].jobs)||void 0===s?void 0:s.length)>0){q.Am.success("Chunks generation started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}q.Am.success("Chunks generated",{description:"Chunks generated successfully."})}}),[f,N]=(0,r.D)((0,B.ps)(a),{onCompleted:e=>{var s;if((null===(s=e[a+"_itemsDeleteChunks"].jobs)||void 0===s?void 0:s.length)>0){q.Am.success("Chunks deletion started",{description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}q.Am.success("Chunks deleted",{description:"Chunks deleted successfully."})}}),y=null==m?void 0:m[a+B.Md];return x?(0,l.jsx)(J.Zb,{children:(0,l.jsx)(J.aY,{className:"pt-6",children:(0,l.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,l.jsx)(er.Z,{className:"h-6 w-6 animate-spin"})})})}):(0,l.jsxs)(J.Zb,{className:"border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(J.ll,{children:"Recent Embeddings"}),(0,l.jsx)(J.SZ,{children:"Items with embeddings updated in the last 21 days"})]}),x&&(0,l.jsx)(er.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),(0,l.jsx)("div",{children:(0,l.jsxs)(M.h_,{modal:!1,children:[(0,l.jsx)(M.$F,{asChild:!0,children:(0,l.jsxs)(E.z,{variant:"ghost",className:"flex size-8 p-0 data-[state=open]:bg-muted",children:[(0,l.jsx)(U.nWS,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,l.jsxs)(M.AW,{align:"end",children:[(0,l.jsx)(M.Xi,{onClick:()=>d("generate"),children:"Generate all embeddings"}),(0,l.jsx)(M.Xi,{onClick:()=>{d("delete")},children:"Delete all embeddings"})]})]})})]})}),(0,l.jsx)(J.aY,{children:(0,l.jsx)("div",{className:"border rounded-lg",children:(null==y?void 0:null===(s=y.items)||void 0===s?void 0:s.length)===0?(0,l.jsx)("div",{className:"text-center py-8 text-muted-foreground",children:"No recent embeddings"}):(0,l.jsxs)(D.iA,{children:[(0,l.jsx)(D.xD,{children:(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.ss,{children:"Name"}),(0,l.jsx)(D.ss,{className:"text-right",children:"Updated"})]})}),(0,l.jsx)(D.RM,{children:null==y?void 0:null===(n=y.items)||void 0===n?void 0:n.map((e,s)=>(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium",children:(0,l.jsx)(el.default,{className:"hover:text-blue-500 hover:underline",href:"/data/".concat(a,"/").concat(e.id),children:(0,l.jsx)(et.L,{text:e.name||e.id||"",length:100})})}),(0,l.jsx)(D.pj,{className:"text-right text-sm text-muted-foreground",children:e.embeddings_updated_at?(0,en.Q)(new Date(e.embeddings_updated_at),{addSuffix:!0}):"never"})]},s))})]})})}),(0,l.jsx)(I.aR,{open:"generate"===i,onOpenChange:e=>!e&&d(null),children:(0,l.jsxs)(I._T,{children:[(0,l.jsxs)(I.fY,{children:[(0,l.jsx)(I.f$,{children:"Generate Embeddings"}),(0,l.jsx)(I.yT,{children:"Are you sure you want to generate embeddings for this context? This will create new embedding vectors for every item in the context, this can take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,l.jsxs)(I.xo,{children:[(0,l.jsx)(I.le,{children:"Cancel"}),(0,l.jsx)(I.OL,{disabled:g.loading,onClick:()=>{d(null),v(),q.Am.info("Generating embeddings...",{description:"Embeddings are being generated in the background, depending on the size of the item this may take a while."})},children:"Generate"})]})]})}),(0,l.jsx)(I.aR,{open:"delete"===i,onOpenChange:e=>!e&&d(null),children:(0,l.jsxs)(I._T,{children:[(0,l.jsxs)(I.fY,{children:[(0,l.jsx)(I.f$,{children:"Delete Embeddings"}),(0,l.jsx)(I.yT,{children:"Are you sure you want to delete all embeddings for this context? This action cannot be undone. Embeddings are used to search and filter items, deleting them will remove this functionality from the context, regenerating embeddings might take a long time, might cost money if you are using a paid service as your embedder, or require a lot of computational resources if your embedder is self hosted."})]}),(0,l.jsxs)(I.xo,{children:[(0,l.jsx)(I.le,{children:"Cancel"}),(0,l.jsx)(I.OL,{disabled:N.loading,onClick:async()=>{d(null),f(),q.Am.success("Embeddings deleted",{description:"All embeddings for this item have been deleted."})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}var ei=n(77992),ed=n(69953),ec=n(32660),eo=n(40875),eu=n(8864);function ex(e){var s,n,a,i,d,c,o,u,x,m,h,j;let[p,v]=(0,b.useState)(!0),{toast:g}=(0,ei.pm)(),{data:N,loading:y,error:C}=(0,t.aM)(B.fV,{variables:{id:e.context}}),w=null==N?void 0:N.contextById,_=(0,f.useRouter)(),[O,z]=(0,r.D)(B.xR,{onCompleted:e=>{R(),g({title:"Embedder configs updated",description:"Embedder configs updated successfully."})},onError:e=>{R(),g({title:"Error updating embedder configs",description:e.message})}}),[T,D]=(0,r.D)(B.s7,{onCompleted:e=>{R(),g({title:"Embedder configs created",description:"Embedder configs created successfully."})},onError:e=>{R(),g({title:"Error creating embedder configs",description:e.message})}}),{data:A,loading:Z,refetch:R}=(0,t.aM)(B.c2,{skip:!(null==w?void 0:null===(s=w.embedder)||void 0===s?void 0:s.id),variables:{context:e.context,embedder:null==w?void 0:null===(n=w.embedder)||void 0===n?void 0:n.id}}),M=(null==A?void 0:null===(a=A.embedder_settingsPagination)||void 0===a?void 0:a.items)||[],{data:I}=(0,t.aM)(B.Az,{variables:{page:1,limit:100}}),q=(null==I?void 0:null===(i=I.variablesPagination)||void 0===i?void 0:i.items)||[];return y?(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md"}),(0,l.jsx)(F.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):C?(0,l.jsxs)(P.bZ,{variant:"destructive",children:[(0,l.jsx)(U.LPM,{className:"size-4"}),(0,l.jsx)(P.Cd,{children:"Error"}),(0,l.jsx)(P.X,{children:(null==C?void 0:C.message)||"Error loading item."})]}):(0,l.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex p-2 justify-between",children:[(0,l.jsx)("div",{className:"flex items-center gap-2"}),(0,l.jsxs)(E.z,{onClick:()=>{_.push("/context")},variant:"ghost",size:"icon",children:[(0,l.jsx)(ec.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Back"})]})]}),(0,l.jsx)(S.Z,{})]}):null,w?(0,l.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,l.jsxs)(J.Zb,{className:"border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsx)(J.ll,{className:"text-lg",children:"Settings"})}),(0,l.jsx)(J.aY,{className:"grid gap-4",children:(0,l.jsx)(es.x,{className:"max-h-[600px]",children:(0,l.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-xl font-bold",children:w.name}),(0,l.jsx)("p",{className:"text-muted-foreground mt-1",children:w.description}),(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,l.jsxs)(k.C,{variant:"outline",children:[(null===(d=w.embedder)||void 0===d?void 0:d.name)||"None"," (",null===(c=w.embedder)||void 0===c?void 0:c.id,")"]})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),(0,l.jsx)(k.C,{variant:"secondary",children:(null===(o=w.configuration)||void 0===o?void 0:o.calculateVectors)?w.configuration.calculateVectors.charAt(0).toUpperCase()+w.configuration.calculateVectors.slice(1):"Manual"}),(0,l.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,l.jsxs)("span",{className:"block",children:[(0,l.jsx)("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,l.jsxs)("span",{className:"block",children:[(0,l.jsx)("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,l.jsxs)("span",{className:"block",children:[(0,l.jsx)("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,l.jsxs)("span",{className:"block",children:[(0,l.jsx)("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"text-sm font-medium mr-2",children:"Embedder Configs:"}),(0,l.jsx)("div",{className:"mt-2 text-xs text-muted-foreground",children:(null==q?void 0:q.length)&&(null==w?void 0:null===(x=w.embedder)||void 0===x?void 0:null===(u=x.config)||void 0===u?void 0:u.map(s=>{let n=null==M?void 0:M.find(e=>e.name===s.name);return console.log("currentValue",n),console.log("embedderConfigs",M),console.log("config",s),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)(ed.f,{configItem:s,currentValue:(null==n?void 0:n.value)||"",variables:q,onVariableSelect:l=>{if(console.log("variableName",l),n)O({variables:{id:n.id,name:s.name,value:l}});else{var t;T({variables:{name:s.name,value:l,context:e.context,embedder:null==w?void 0:null===(t=w.embedder)||void 0===t?void 0:t.id}})}}}),(0,l.jsx)("span",{children:s.description})]},s.name)}))})]})]})})})]}),(0,l.jsx)(ea,{contextId:w.id}),(0,l.jsx)(G.zF,{open:p,onOpenChange:v,children:(0,l.jsxs)(J.Zb,{className:"bg-none border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsx)(G.wy,{asChild:!0,children:(0,l.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[(0,l.jsx)(J.ll,{children:"Queues"}),(0,l.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,l.jsx)(eo.Z,{className:"h-4 w-4 transition-transform ".concat(p?"":"-rotate-90")}),(0,l.jsx)("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),(0,l.jsx)(G.Fw,{children:(0,l.jsx)(J.aY,{children:(null===(m=w.embedder)||void 0===m?void 0:m.queue)?(0,l.jsx)("div",{className:"space-y-4",children:(0,l.jsx)("div",{children:(0,l.jsx)(eu.R,{queueName:null===(h=w.embedder)||void 0===h?void 0:h.queue,nameGenerator:e=>"Source update",retryJob:e=>{var s,n;if(!(null===(s=e.data)||void 0===s?void 0:s.source)||!(null===(n=e.data)||void 0===n?void 0:n.context))return}})},null===(j=w.embedder)||void 0===j?void 0:j.queue)}):(0,l.jsx)("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):(0,l.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."})]})}var em=n(33276),eh=n(26815);function ej(e){let[s,n]=(0,b.useState)(!0),[a,i]=(0,b.useState)(!1),[d,c]=(0,b.useState)(null),[o,u]=(0,b.useState)({}),{data:x,loading:m,error:h}=(0,t.aM)(B.fV,{variables:{id:e.context}}),j=null==x?void 0:x.contextById,p=(0,f.useRouter)(),[v,{loading:g}]=(0,r.D)((0,B.C3)(e.context),{onCompleted:s=>{var n,l;let t=s["".concat(e.context,"_itemsExecuteSource")];i(!1),c(null),u({}),q.Am.success(t.message||"Source executed successfully",{description:(null===(n=t.jobs)||void 0===n?void 0:n.length)?"".concat(t.jobs.length," job(s) scheduled"):(null===(l=t.items)||void 0===l?void 0:l.length)?"".concat(t.items.length," item(s) processed"):void 0})},onError:e=>{q.Am.error("Failed to execute source",{description:e.message})}}),N=(e,s,n,l)=>{if(c({id:e,name:s,queue:n,params:l}),l){let e={};l.forEach(s=>{e[s.name]=s.default||""}),u(e)}i(!0)};if(m)return(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md"}),(0,l.jsx)(F.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"})]});if(h)return(0,l.jsxs)(P.bZ,{variant:"destructive",children:[(0,l.jsx)(U.LPM,{className:"size-4"}),(0,l.jsx)(P.Cd,{children:"Error"}),(0,l.jsx)(P.X,{children:(null==h?void 0:h.message)||"Error loading item."})]});let y=[];return j&&(y=Array.from(new Set(j.sources.map(e=>e.config.queue).filter(e=>!!e)))),(0,l.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex p-2 justify-between",children:[(0,l.jsx)("div",{className:"flex items-center gap-2"}),(0,l.jsxs)(E.z,{onClick:()=>{p.push("/context")},variant:"ghost",size:"icon",children:[(0,l.jsx)(ec.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Back"})]})]}),(0,l.jsx)(S.Z,{})]}):null,j?(0,l.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,l.jsxs)(J.Zb,{className:"border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsx)(J.ll,{className:"text-lg",children:"Settings"})}),(0,l.jsx)(J.aY,{className:"grid gap-4",children:(0,l.jsx)(es.x,{className:"max-h-[600px]",children:(0,l.jsx)("div",{className:"space-y-6 pr-4",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-xl font-bold",children:j.name}),(0,l.jsx)("p",{className:"text-muted-foreground mt-1",children:j.description})]})})})})]}),(0,l.jsxs)(J.Zb,{className:"border-0 rounded-none",children:[(0,l.jsxs)(J.Ol,{children:[(0,l.jsx)(J.ll,{children:"Sources"}),(0,l.jsx)(J.SZ,{children:"Sources are used to fetch external data and ingest them into the context."})]}),(0,l.jsx)(J.aY,{children:j.sources&&j.sources.length>0?(0,l.jsx)(Z.pn,{children:(0,l.jsx)("div",{className:"rounded-md border",children:(0,l.jsxs)(D.iA,{children:[(0,l.jsx)(D.xD,{children:(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.ss,{children:"Name"}),(0,l.jsx)(D.ss,{children:"Description"}),(0,l.jsx)(D.ss,{children:"Queue Configuration"}),(0,l.jsx)(D.ss,{className:"text-right",children:"Actions"})]})}),(0,l.jsx)(D.RM,{children:j.sources.map(e=>{let s=e.config.queue||e.config.schedule||void 0!==e.config.retries||e.config.backoff;return(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium",children:e.name}),(0,l.jsx)(D.pj,{className:"max-w-[300px]",children:e.description||"-"}),(0,l.jsx)(D.pj,{children:s?(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsx)("div",{className:"cursor-help",children:e.config.queue?(0,l.jsx)(k.C,{variant:"outline",className:"cursor-help",children:e.config.queue}):(0,l.jsx)("span",{className:"text-muted-foreground",children:"No queue configured"})})}),(0,l.jsx)(Z._v,{className:"max-w-[300px]",children:(0,l.jsxs)("div",{className:"space-y-2",children:[e.config.queue&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Queue:"}),(0,l.jsx)("span",{className:"ml-2 text-xs",children:e.config.queue})]}),e.config.schedule&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Schedule:"}),(0,l.jsx)("code",{className:"ml-2 text-xs bg-muted px-1 py-0.5 rounded",children:e.config.schedule})]}),void 0!==e.config.retries&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Retries:"}),(0,l.jsx)("span",{className:"ml-2 text-xs",children:e.config.retries||"Default (3)"})]}),e.config.backoff&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Backoff:"}),(0,l.jsxs)("span",{className:"ml-2 text-xs",children:[e.config.backoff.type||"Default (exponential)"," (",e.config.backoff.delay||"Default (2000)","ms)"]})]})]})})]}):(0,l.jsx)("span",{className:"text-muted-foreground",children:"-"})}),(0,l.jsx)(D.pj,{className:"text-right",children:(0,l.jsx)(E.z,{variant:"ghost",size:"sm",onClick:()=>N(e.id,e.name,e.config.queue,e.config.params),title:"Manually trigger source",children:(0,l.jsx)(em.Z,{className:"h-4 w-4"})})})]},e.id)})})]})})}):(0,l.jsx)("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No sources found."})})]}),(0,l.jsx)(G.zF,{open:s,onOpenChange:n,children:(0,l.jsxs)(J.Zb,{className:"bg-none border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsx)(G.wy,{asChild:!0,children:(0,l.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[(0,l.jsx)(J.ll,{children:"Queues"}),(0,l.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,l.jsx)(eo.Z,{className:"h-4 w-4 transition-transform ".concat(s?"":"-rotate-90")}),(0,l.jsx)("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),(0,l.jsx)(G.Fw,{children:(0,l.jsx)(J.aY,{children:y.length>0?(0,l.jsx)("div",{className:"space-y-4",children:y.map(e=>(0,l.jsx)("div",{children:(0,l.jsx)(eu.R,{queueName:e,nameGenerator:e=>"Source update",retryJob:e=>{var s,n,l;if(console.log("[EXULU] Retrying job: ",e),!(null===(s=e.data)||void 0===s?void 0:s.source)||!(null===(n=e.data)||void 0===n?void 0:n.context))return;let t=null==j?void 0:j.sources.find(s=>{var n;return s.id===(null===(n=e.data)||void 0===n?void 0:n.source)});if(!t){q.Am.error("Source not found for job: "+(null===(l=e.data)||void 0===l?void 0:l.source),{description:"The source was not found for the job. This might mean the source no longer exists."});return}let r=t.config;N(t.id,t.name,t.config.queue,r.params)}})},e))}):(0,l.jsx)("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):(0,l.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),(0,l.jsx)(R.Vq,{modal:!1,open:a,onOpenChange:e=>{i(e),e||(u({}),c(null))},children:(0,l.jsxs)(R.cZ,{children:[(0,l.jsxs)(R.fK,{children:[(0,l.jsx)(R.$N,{children:"Trigger Source"}),(0,l.jsx)(R.Be,{children:(null==d?void 0:d.queue)?(0,l.jsxs)(l.Fragment,{children:["Are you sure you want to trigger ",(0,l.jsx)("strong",{children:d.name}),"?",(0,l.jsx)("br",{}),(0,l.jsx)("br",{}),"A job will be scheduled and visible in the ",(0,l.jsx)("span",{className:"font-semibold",children:d.queue})," queue."]}):(0,l.jsxs)(l.Fragment,{children:["Are you sure you want to trigger ",(0,l.jsx)("strong",{children:null==d?void 0:d.name}),"?",(0,l.jsx)("br",{}),(0,l.jsx)("br",{}),"The source will be executed immediately without queuing."]})})]}),(null==d?void 0:d.params)&&d.params.length>0&&(0,l.jsxs)("div",{className:"space-y-4 py-4",children:[(0,l.jsx)("div",{className:"text-sm font-medium",children:"Parameters"}),d.params.map(e=>(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)(eh._,{htmlFor:e.name,children:[e.name,e.description&&(0,l.jsx)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:e.description})]}),(0,l.jsx)(O.I,{id:e.name,value:o[e.name]||"",onChange:s=>{u(n=>({...n,[e.name]:s.target.value}))},placeholder:e.default||"",disabled:g})]},e.name))]}),(0,l.jsxs)(R.cN,{children:[(0,l.jsx)(E.z,{variant:"outline",onClick:()=>i(!1),disabled:g,children:"Cancel"}),(0,l.jsx)(E.z,{onClick:()=>{d&&v({variables:{source:d.id,inputs:o}})},disabled:g,children:g?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(er.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Executing..."]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(em.Z,{className:"mr-2 h-4 w-4"}),"Trigger Source"]})})]})]})})]})}function ep(e){var s,n,a;let[i,d]=(0,b.useState)(!0),c=(0,f.useRouter)(),[o,u]=(0,b.useState)(!1),[x,m]=(0,b.useState)({}),[h,j]=(0,b.useState)(10),{data:p,loading:v,error:g}=(0,t.aM)(B.fV,{variables:{id:e.context}}),N=null==p?void 0:p.contextById,[y,{loading:C}]=(0,r.D)((0,B.fG)(e.context),{onCompleted:s=>{var n,l;console.log("[EXULU] Processor result",s);let t=s["".concat(e.context,"_itemsProcessItems")];u(!1),m({}),q.Am.success(t.message||"Items processed successfully",{description:(null===(n=t.jobs)||void 0===n?void 0:n.length)?"".concat(t.jobs.length," job(s) scheduled"):(null===(l=t.items)||void 0===l?void 0:l.length)?"".concat(t.items.length," item(s) processed"):void 0})},onError:e=>{q.Am.error("Failed to execute source",{description:e.message})}}),w=e=>{if(e){let s={};e.forEach(e=>{s[e.name]=e.default||""}),m(s)}u(!0)};return v?(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md"}),(0,l.jsx)(F.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):g?(0,l.jsxs)(P.bZ,{variant:"destructive",children:[(0,l.jsx)(U.LPM,{className:"size-4"}),(0,l.jsx)(P.Cd,{children:"Error"}),(0,l.jsx)(P.X,{children:(null==g?void 0:g.message)||"Error loading item."})]}):(0,l.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex p-2 justify-between",children:[(0,l.jsx)("div",{className:"flex items-center gap-2"}),(0,l.jsxs)(E.z,{onClick:()=>{c.push("/context")},variant:"ghost",size:"icon",children:[(0,l.jsx)(ec.Z,{className:"size-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Back"})]})]}),(0,l.jsx)(S.Z,{})]}):null,N?(0,l.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,l.jsxs)(J.Zb,{className:"border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsx)(J.ll,{className:"text-lg",children:"Settings"})}),(0,l.jsx)(J.aY,{className:"grid gap-4",children:(0,l.jsx)("div",{className:"space-y-6 pr-4",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-xl font-bold",children:N.name}),(0,l.jsx)("p",{className:"text-muted-foreground mt-1",children:N.description}),(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,l.jsxs)(k.C,{variant:"outline",children:[(null===(s=N.embedder)||void 0===s?void 0:s.name)||"None"," (",null===(n=N.embedder)||void 0===n?void 0:n.id,")"]})]})]})})})]}),(0,l.jsxs)(J.Zb,{className:"border-0 rounded-none",children:[(0,l.jsxs)(J.Ol,{children:[(0,l.jsx)(J.ll,{children:"Sources"}),(0,l.jsx)(J.SZ,{children:"Sources are used to fetch external data and ingest them into the context."})]}),(0,l.jsx)(J.aY,{children:N.processor?(0,l.jsx)(Z.pn,{children:(0,l.jsx)("div",{className:"rounded-md border",children:(0,l.jsxs)(D.iA,{children:[(0,l.jsx)(D.xD,{children:(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.ss,{children:"Name"}),(0,l.jsx)(D.ss,{children:"Description"}),(0,l.jsx)(D.ss,{children:"Queue Configuration"}),(0,l.jsx)(D.ss,{className:"text-right",children:"Actions"})]})}),(0,l.jsx)(D.RM,{children:(0,l.jsxs)(D.SC,{children:[(0,l.jsx)(D.pj,{className:"font-medium",children:N.processor.name}),(0,l.jsx)(D.pj,{className:"max-w-[300px]",children:N.processor.description||"-"}),(0,l.jsx)(D.pj,{children:N.processor.queue?(0,l.jsxs)(Z.u,{children:[(0,l.jsx)(Z.aJ,{asChild:!0,children:(0,l.jsx)("div",{className:"cursor-help",children:(0,l.jsx)(k.C,{variant:"outline",className:"cursor-help",children:N.processor.queue})})}),(0,l.jsx)(Z._v,{className:"max-w-[300px]",children:(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Queue:"}),(0,l.jsx)("span",{className:"ml-2 text-xs",children:N.processor.queue})]}),N.processor.trigger&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Trigger:"}),(0,l.jsx)("code",{className:"ml-2 text-xs bg-muted px-1 py-0.5 rounded",children:N.processor.trigger})]}),void 0!==N.processor.timeoutInSeconds&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Timeout (seconds):"}),(0,l.jsx)("span",{className:"ml-2 text-xs",children:N.processor.timeoutInSeconds||"Default (600)"})]}),void 0!==N.processor.generateEmbeddings&&(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold text-xs",children:"Generate Embeddings:"}),(0,l.jsx)("span",{className:"ml-2 text-xs",children:N.processor.generateEmbeddings?"Enabled":"Disabled"})]})]})})]}):(0,l.jsx)("span",{className:"text-muted-foreground",children:"-"})}),(0,l.jsx)(D.pj,{className:"text-right",children:(0,l.jsx)(E.z,{variant:"ghost",size:"sm",onClick:()=>w(),title:"Manually trigger source",children:(0,l.jsx)(em.Z,{className:"h-4 w-4"})})})]},N.processor.name)})]})})}):(0,l.jsx)("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No sources found."})})]}),(0,l.jsx)(G.zF,{open:i,onOpenChange:d,children:(0,l.jsxs)(J.Zb,{className:"bg-none border-0 rounded-none",children:[(0,l.jsx)(J.Ol,{children:(0,l.jsx)(G.wy,{asChild:!0,children:(0,l.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[(0,l.jsx)(J.ll,{children:"Processors"}),(0,l.jsxs)(E.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[(0,l.jsx)(eo.Z,{className:"h-4 w-4 transition-transform ".concat(i?"":"-rotate-90")}),(0,l.jsx)("span",{className:"sr-only",children:"Toggle processors"})]})]})})}),(0,l.jsx)(G.Fw,{children:(0,l.jsx)(J.aY,{children:N.processor?(0,l.jsx)("div",{className:"space-y-4 mb-6",children:(0,l.jsxs)(J.Zb,{className:"border-l-4 border-l-primary",children:[(0,l.jsxs)(J.Ol,{children:[(0,l.jsx)(J.ll,{className:"text-base flex items-center justify-between",children:(0,l.jsx)(k.C,{variant:"outline",children:N.processor.queue})}),N.processor.description&&(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:N.processor.description})]}),(0,l.jsxs)(J.aY,{children:[(0,l.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Trigger"}),(0,l.jsx)(k.C,{variant:"secondary",className:"font-mono text-xs",children:N.processor.trigger})]}),(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Timeout"}),(0,l.jsxs)(k.C,{variant:"secondary",className:"font-mono text-xs",children:[N.processor.timeoutInSeconds,"s"]})]}),(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:"Embeddings"}),(0,l.jsx)(k.C,{variant:N.processor.generateEmbeddings?"default":"secondary",className:"text-xs",children:N.processor.generateEmbeddings?"Enabled, this means embeddings will be generated after the processor finishes executing":"Disabled, this means embeddings will not be generated after the processor finishes executing"})]})]}),(0,l.jsx)(S.Z,{className:"my-4"}),(0,l.jsx)(eu.R,{queueName:N.processor.queue,nameGenerator:e=>"Processor update",retryJob:e=>{var s,n;if(!(null===(s=e.data)||void 0===s?void 0:s.source)||!(null===(n=e.data)||void 0===n?void 0:n.context))return}})]})]})},N.processor.queue):(0,l.jsx)("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No processor found."})})})]})})]}):(0,l.jsx)("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),(0,l.jsx)(R.Vq,{modal:!1,open:o,onOpenChange:e=>{u(e),e||m({})},children:(0,l.jsxs)(R.cZ,{children:[(0,l.jsxs)(R.fK,{children:[(0,l.jsx)(R.$N,{children:"Trigger Source"}),(0,l.jsx)(R.Be,{children:(null==N?void 0:null===(a=N.processor)||void 0===a?void 0:a.queue)?(0,l.jsxs)(l.Fragment,{children:["Are you sure you want to trigger ",(0,l.jsx)("strong",{children:N.processor.name}),"?",(0,l.jsx)("br",{}),(0,l.jsx)("br",{}),"A job will be scheduled and visible in the ",(0,l.jsx)("span",{className:"font-semibold",children:N.processor.queue})," queue."]}):(0,l.jsxs)(l.Fragment,{children:["Are you sure you want to trigger ",(0,l.jsx)("strong",{children:null==N?void 0:N.name}),"?",(0,l.jsx)("br",{}),(0,l.jsx)("br",{}),"The processor will be executed immediately without queuing."]})})]}),(0,l.jsxs)(eh._,{htmlFor:"limit",children:["Limit",(0,l.jsx)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:"Maximum number of items to process."})]}),(0,l.jsx)(O.I,{id:"limit",value:h||"",onChange:e=>{j(parseInt(e.target.value))},placeholder:"10",type:"number",min:1,max:500,disabled:C}),(0,l.jsxs)(R.cN,{children:[(0,l.jsx)(E.z,{variant:"outline",onClick:()=>u(!1),disabled:C,children:"Cancel"}),(0,l.jsx)(E.z,{onClick:()=>{y({variables:{limit:h||10,filters:x,sort:{field:"updatedAt",direction:"DESC"}}})},disabled:C,children:C?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(er.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Executing..."]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(em.Z,{className:"mr-2 h-4 w-4"}),"Trigger Processor"]})})]})]})})]})}function ev(e){var s,n;let{params:r}=e,{data:a,loading:i,error:d}=(0,t.aM)(B.fV,{skip:!(null==r?void 0:null===(s=r.query)||void 0===s?void 0:s[0]),variables:{id:null==r?void 0:null===(n=r.query)||void 0===n?void 0:n[0]}});if(!r.query)return(0,l.jsx)("div",{className:"grow flex flex-col",children:(0,l.jsx)(ee,{})});let c=r.query[0]||null,o="archived"===r.query[1],u="sources"===r.query[1],x="embeddings"===r.query[1],m="processors"===r.query[1];if(u)return(0,l.jsx)(ej,{expand:!0,actions:!0,context:c});if(x)return(0,l.jsx)(ex,{expand:!0,actions:!0,context:c});if(m)return(0,l.jsx)(ep,{expand:!0,actions:!0,context:c});let h=null;return(o?h=r.query[2]||null:u||x||(h=r.query[1]||null),!i&&(null==a?void 0:a.contextById))?d?(0,l.jsxs)(P.bZ,{variant:"destructive",children:[(0,l.jsx)(U.LPM,{className:"size-4"}),(0,l.jsx)(P.Cd,{children:"Error"}),(0,l.jsx)(P.X,{children:(null==d?void 0:d.message)||"Error loading item."})]}):(0,l.jsx)(X,{actions:!0,context:null==a?void 0:a.contextById,itemId:h}):(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md"}),(0,l.jsx)(F.O,{className:"w-full h-[50px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"}),(0,l.jsx)(F.O,{className:"w-full h-[80px] rounded-md mt-3"})]})}},21409:function(e,s,n){"use strict";n.d(s,{z:function(){return v}});var l=n(57437),t=n(2265),r=n(20653),a=n(31303),i=n(59121),d=n(27107),c=n(94508),o=n(62869),u=n(92451),x=n(10407),m=n(98235);function h(e){let{className:s,classNames:n,showOutsideDays:t=!0,...r}=e;return(0,l.jsx)(m._W,{showOutsideDays:t,className:(0,c.cn)("p-3",s),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,c.cn)((0,o.d)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:(0,c.cn)((0,o.d)({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:e=>{let{...s}=e;return(0,l.jsx)(u.Z,{className:"size-4"})},IconRight:e=>{let{...s}=e;return(0,l.jsx)(x.Z,{className:"size-4"})}},...r})}h.displayName="Calendar";var j=n(77992),p=n(57054);function v(e){let{dateRange:s,onDateRangeChange:n,className:u,maxDays:x=30}=e,{toast:m}=(0,j.pm)(),v=t.useMemo(()=>{if(!(null==s?void 0:s.from))return[];let e=s.from;return[{before:(0,i.E)(e,-x)},{after:(0,i.E)(e,x)}]},[null==s?void 0:s.from,x]);return(0,l.jsx)("div",{className:(0,c.cn)("grid gap-2",u),children:(0,l.jsxs)(p.J2,{children:[(0,l.jsx)(p.xo,{asChild:!0,children:(0,l.jsxs)(o.z,{id:"date",variant:"outline",className:(0,c.cn)("w-[260px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[(0,l.jsx)(r.Que,{className:"mr-2 h-4 w-4"}),(null==s?void 0:s.from)?s.to?(0,l.jsxs)(l.Fragment,{children:[(0,d.WU)(s.from,"LLL dd, y")," -"," ",(0,d.WU)(s.to,"LLL dd, y")]}):(0,d.WU)(s.from,"LLL dd, y"):(0,l.jsx)("span",{children:"Pick a date range"})]})}),(0,l.jsxs)(p.yk,{className:"w-auto p-0",align:"end",children:[(0,l.jsx)(h,{initialFocus:!0,mode:"range",defaultMonth:null==s?void 0:s.from,selected:s,onSelect:e=>{if((null==e?void 0:e.from)&&(null==e?void 0:e.to)&&(0,a.j)(e.to,e.from)>x){m({title:"Date range too large",description:"Please select a date range of ".concat(x," days or less."),variant:"destructive"});return}n(e)},disabled:v,numberOfMonths:2}),(0,l.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",x," days"]})]})]})})}},73450:function(e,s,n){"use strict";n.d(s,{Y:function(){return h}});var l=n(57437),t=n(2265),r=n(7211),a=n(53647),i=n(93022),d=n(27689),c=n(75169),o=n(3574),u=n(20407),x=n(57969);let m=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))","hsl(var(--chart-6))","hsl(var(--chart-7))","hsl(var(--chart-8))","hsl(var(--chart-9))","hsl(var(--chart-10))"];function h(e){var s,n;let{groupByOptions:h,dateRange:j,selectedType:p,groupBy:v,onGroupByChange:g,unit:f}=e,{data:b,loading:N,error:y}=(0,r.aM)(d.YH,{variables:{type:p,groupBy:v,from:null==j?void 0:null===(s=j.from)||void 0===s?void 0:s.toISOString(),to:null==j?void 0:null===(n=j.to)||void 0===n?void 0:n.toISOString(),names:"tokens"===f?["inputTokens","outputTokens"]:["count"]},skip:!(null==j?void 0:j.from)||!(null==j?void 0:j.to)}),{chartData:C,chartConfig:w}=t.useMemo(()=>{if(!(null==b?void 0:b.trackingStatistics))return{chartData:[],chartConfig:{}};let e=b.trackingStatistics.map((e,s)=>{var n;return{name:(n=null==e?void 0:e.group)&&"string"==typeof n?n.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:null==e?void 0:e.count,fill:m[s%m.length]}}).sort((e,s)=>s.value-e.value),s=e.reduce((e,s,n)=>(e[s.name]={label:s.name,color:m[n%m.length]},e),{});return{chartData:e,chartConfig:s}},[b]);return(0,l.jsxs)("div",{className:"flex flex-col h-full",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h3",{className:"text-xl font-semibold",children:"Distribution"}),h.length>0&&(0,l.jsx)("div",{className:"w-full max-w-[150px]",children:(0,l.jsxs)(a.Ph,{value:v,onValueChange:g,children:[(0,l.jsx)(a.i4,{children:(0,l.jsx)(a.ki,{placeholder:"Group by"})}),(0,l.jsx)(a.Bw,{children:h.map(e=>(0,l.jsx)(a.Ql,{value:e.value,children:e.label},e.value))})]})})]}),(0,l.jsx)("div",{className:"flex-1 min-h-0",children:N?(0,l.jsx)("div",{className:"space-y-4 h-full",children:(0,l.jsx)(i.O,{className:"h-full w-full"})}):y?(0,l.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",y.message]}):0===C.length?(0,l.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-center",children:"No data available for the selected date range, type, and grouping."}):(0,l.jsx)(x.BO,{config:w,className:"h-full w-full",children:(0,l.jsxs)(c.u,{children:[(0,l.jsx)("defs",{children:C.map((e,s)=>(0,l.jsxs)("radialGradient",{id:"gradient-".concat(e.name.replace(/\s+/g,"-")),cx:"50%",cy:"50%",r:"50%",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),(0,l.jsx)("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},"gradient-".concat(s)))}),(0,l.jsx)(o.b,{data:C,cx:"50%",cy:"50%",labelLine:!1,label:e=>{let{cx:s,cy:n,midAngle:t,innerRadius:r,outerRadius:a,percent:i,index:d}=e;if(i<.05)return null;let c=Math.PI/180,o=r+(a-r)*.5,u=s+o*Math.cos(-t*c);return(0,l.jsx)("text",{x:u,y:n+o*Math.sin(-t*c),fill:"black",textAnchor:u>s?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:"".concat((100*i).toFixed(0),"%")})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:C.map((e,s)=>(0,l.jsx)(u.b,{fill:"url(#gradient-".concat(e.name.replace(/\s+/g,"-"),")")},"cell-".concat(s)))}),(0,l.jsx)(x.h7,{content:(0,l.jsx)(x.dg,{nameKey:"name",hideLabel:!0,formatter:(e,s)=>["number"==typeof e?e.toLocaleString():e," "+String(s)]})})]})})})]})}},52896:function(e,s,n){"use strict";n.d(s,{q:function(){return b}});var l=n(57437),t=n(2265),r=n(7211),a=n(53647),i=n(93022),d=n(27689),c=n(5481),o=n(56940),u=n(97059),x=n(62994),m=n(23263),h=n(57969),j=n(27107),p=n(56942),v=n(54886);function g(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let f={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function b(e){var s,n;let{dataTypes:b,dateRange:N,selectedType:y,onTypeChange:C,onUnitChange:w,unit:k,unitOptions:E}=e,{data:_,loading:O,error:z}=(0,r.aM)(d.j9,{variables:{type:y,name:k,from:null==N?void 0:null===(s=N.from)||void 0===s?void 0:s.toISOString(),to:null==N?void 0:null===(n=N.to)||void 0===n?void 0:n.toISOString(),names:[k]},skip:!(null==N?void 0:N.from)||!(null==N?void 0:N.to)}),S=t.useMemo(()=>{if(!(null==_?void 0:_.trackingStatistics)||!(null==N?void 0:N.from)||!(null==N?void 0:N.to))return[];let e=new Map;return _.trackingStatistics.forEach(s=>{let n=new Date("number"==typeof s.group?s.group:Number(s.group)),l=(0,j.WU)((0,p.b)(n),"yyyy-MM-dd");e.set(l,s.count)}),(0,v.D)({start:(0,p.b)(N.from),end:(0,p.b)(N.to)}).map(s=>{let n=(0,j.WU)(s,"yyyy-MM-dd"),l=e.get(n)||0;return{date:s.getTime(),count:l,formattedDate:(0,j.WU)(s,"MMM dd"),dateObj:s}})},[_,N]);return(0,l.jsxs)("div",{className:"flex flex-col h-full",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("div",{className:"w-[150px]",children:(0,l.jsxs)(a.Ph,{value:y,onValueChange:e=>C(e),children:[(0,l.jsx)(a.i4,{children:(0,l.jsx)(a.ki,{placeholder:"Select data type"})}),(0,l.jsx)(a.Bw,{children:null==b?void 0:b.map(e=>(0,l.jsx)(a.Ql,{value:e,children:g(e)+" "},e))})]})}),(null==E?void 0:E.length)>1&&(0,l.jsx)("div",{className:"w-[150px]",children:(0,l.jsxs)(a.Ph,{value:k,onValueChange:e=>w(e),children:[(0,l.jsx)(a.i4,{children:(0,l.jsx)(a.ki,{placeholder:"Select unit"})}),(0,l.jsx)(a.Bw,{children:null==E?void 0:E.map(e=>(0,l.jsx)(a.Ql,{value:e.value,children:e.label},e.value))})]})})]})]}),(0,l.jsx)("div",{className:"flex-1 min-h-0",children:O?(0,l.jsx)("div",{className:"space-y-4 h-full",children:(0,l.jsx)(i.O,{className:"h-full w-full"})}):z?(0,l.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===S.length?(0,l.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):(0,l.jsx)(h.BO,{config:f,className:"h-full w-full",children:(0,l.jsxs)(c.T,{data:S,children:[(0,l.jsxs)("defs",{children:[(0,l.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),(0,l.jsx)("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,l.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),(0,l.jsx)("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),(0,l.jsx)(o.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),(0,l.jsx)(u.K,{dataKey:"formattedDate",tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),(0,l.jsx)(x.B,{tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"},tickLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5},axisLine:{stroke:"hsl(var(--muted-foreground))",strokeOpacity:.5}}),(0,l.jsx)(h.h7,{labelFormatter:(e,s)=>s&&s[0]?(0,j.WU)(s[0].payload.dateObj,"PPP")+" ":e,content:(0,l.jsx)(h.dg,{nameKey:"name",hideLabel:!0,formatter:(e,s)=>["number"==typeof e?e.toLocaleString():e," "+String(s)]})}),(0,l.jsx)(h.Qk,{content:(0,l.jsx)(h.cD,{})}),(0,l.jsx)(m.u,{type:"monotone",dataKey:"count",stroke:"url(#strokeCount)",strokeWidth:3,fill:"url(#fillCount)",fillOpacity:.6,dot:{fill:"hsl(var(--muted-foreground))",strokeWidth:2,r:4,strokeOpacity:.8},activeDot:{r:6,strokeWidth:2,fill:"hsl(var(--background))",stroke:"hsl(var(--muted-foreground))",strokeOpacity:1},name:g(y)})]})})})]})}},37091:function(e,s,n){"use strict";n.d(s,{L:function(){return t}});var l=n(57437);function t(e){let{text:s,length:n}=e;return s.length>n?(0,l.jsxs)(l.Fragment,{children:[s.slice(0,n),"..."]}):(0,l.jsx)(l.Fragment,{children:s})}},57969:function(e,s,n){"use strict";n.d(s,{BO:function(){return x},Qk:function(){return p},cD:function(){return v},dg:function(){return j},h7:function(){return h}});var l=n(57437),t=n(2265),r=n(47625),a=n(8147),i=n(22190),d=n(94508);let c={light:"",dark:".dark"},o=t.createContext(null);function u(){let e=t.useContext(o);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let x=t.forwardRef((e,s)=>{let{id:n,className:a,children:i,config:c,...u}=e,x=t.useId(),h="chart-".concat(n||x.replace(/:/g,""));return(0,l.jsx)(o.Provider,{value:{config:c},children:(0,l.jsxs)("div",{"data-chart":h,ref:s,className:(0,d.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",a),...u,children:[(0,l.jsx)(m,{id:h,config:c}),(0,l.jsx)(r.h,{children:i})]})})});x.displayName="Chart";let m=e=>{let{id:s,config:n}=e,t=Object.entries(n).filter(e=>{let[,s]=e;return s.theme||s.color});return t.length?(0,l.jsx)("style",{dangerouslySetInnerHTML:{__html:Object.entries(c).map(e=>{let[n,l]=e;return"\n".concat(l," [data-chart=").concat(s,"] {\n").concat(t.map(e=>{var s;let[l,t]=e,r=(null===(s=t.theme)||void 0===s?void 0:s[n])||t.color;return r?" --color-".concat(l,": ").concat(r,";"):null}).join("\n"),"\n}\n")}).join("\n")}}):null},h=a.u,j=t.forwardRef((e,s)=>{let{active:n,payload:r,className:a,indicator:i="dot",hideLabel:c=!1,hideIndicator:o=!1,label:x,labelFormatter:m,labelClassName:h,formatter:j,color:p,nameKey:v,labelKey:f}=e,{config:b}=u(),N=t.useMemo(()=>{var e;if(c||!(null==r?void 0:r.length))return null;let[s]=r,n="".concat(f||(null==s?void 0:s.dataKey)||(null==s?void 0:s.name)||"value"),t=g(b,s,n),a=f||"string"!=typeof x?null==t?void 0:t.label:(null===(e=b[x])||void 0===e?void 0:e.label)||x;return m?(0,l.jsx)("div",{className:(0,d.cn)("font-medium",h),children:m(a,r)}):a?(0,l.jsx)("div",{className:(0,d.cn)("font-medium",h),children:a}):null},[x,m,r,c,h,b,f]);if(!n||!(null==r?void 0:r.length))return null;let y=1===r.length&&"dot"!==i;return(0,l.jsxs)("div",{ref:s,className:(0,d.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",a),children:[y?null:N,(0,l.jsx)("div",{className:"grid gap-1.5",children:r.map((e,s)=>{let n="".concat(v||e.name||e.dataKey||"value"),t=g(b,e,n),r=p||e.payload.fill||e.color;return(0,l.jsx)("div",{className:(0,d.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===i&&"items-center"),children:j&&(null==e?void 0:e.value)!==void 0&&e.name?j(e.value,e.name,e,s,e.payload):(0,l.jsxs)(l.Fragment,{children:[(null==t?void 0:t.icon)?(0,l.jsx)(t.icon,{}):!o&&(0,l.jsx)("div",{className:(0,d.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===i,"w-1":"line"===i,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===i,"my-0.5":y&&"dashed"===i}),style:{"--color-bg":r,"--color-border":r}}),(0,l.jsxs)("div",{className:(0,d.cn)("flex flex-1 justify-between leading-none",y?"items-end":"items-center"),children:[(0,l.jsxs)("div",{className:"grid gap-1.5",children:[y?N:null,(0,l.jsx)("span",{className:"text-muted-foreground",children:(null==t?void 0:t.label)||e.name})]}),e.value&&(0,l.jsx)("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});j.displayName="ChartTooltip";let p=i.D,v=t.forwardRef((e,s)=>{let{className:n,hideIcon:t=!1,payload:r,verticalAlign:a="bottom",nameKey:i}=e,{config:c}=u();return(null==r?void 0:r.length)?(0,l.jsx)("div",{ref:s,className:(0,d.cn)("flex items-center justify-center gap-4","top"===a?"pb-3":"pt-3",n),children:r.map(e=>{let s="".concat(i||e.dataKey||"value"),n=g(c,e,s);return(0,l.jsxs)("div",{className:(0,d.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[(null==n?void 0:n.icon)&&!t?(0,l.jsx)(n.icon,{}):(0,l.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==n?void 0:n.label]},e.value)})}):null});function g(e,s,n){if("object"!=typeof s||null===s)return;let l="payload"in s&&"object"==typeof s.payload&&null!==s.payload?s.payload:void 0,t=n;return n in s&&"string"==typeof s[n]?t=s[n]:l&&n in l&&"string"==typeof l[n]&&(t=l[n]),t in e?e[t]:e[n]}v.displayName="ChartLegend"},9334:function(e,s,n){"use strict";n.d(s,{Z:function(){return l}});let l=(0,n(39763).Z)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},21563:function(e,s,n){"use strict";n.d(s,{Z:function(){return l}});let l=(0,n(39763).Z)("PackageOpen",[["path",{d:"M20.91 8.84 8.56 2.23a1.93 1.93 0 0 0-1.81 0L3.1 4.13a2.12 2.12 0 0 0-.05 3.69l12.22 6.93a2 2 0 0 0 1.94 0L21 12.51a2.12 2.12 0 0 0-.09-3.67Z",key:"1vy178"}],["path",{d:"m3.09 8.84 12.35-6.61a1.93 1.93 0 0 1 1.81 0l3.65 1.9a2.12 2.12 0 0 1 .1 3.69L8.73 14.75a2 2 0 0 1-1.94 0L3 12.51a2.12 2.12 0 0 1 .09-3.67Z",key:"s3bv25"}],["line",{x1:"12",x2:"12",y1:"22",y2:"13",key:"1o4xyi"}],["path",{d:"M20 13.5v3.37a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13.5",key:"1na2nq"}]])},91048:function(e,s,n){"use strict";n.d(s,{h:function(){return l}});let l={CONTEXT_RETRIEVE:"CONTEXT_RETRIEVE",SOURCE_UPDATE:"SOURCE_UPDATE",EMBEDDER_UPSERT:"EMBEDDER_UPSERT",EMBEDDER_GENERATE:"EMBEDDER_GENERATE",EMBEDDER_DELETE:"EMBEDDER_DELETE",WORKFLOW_RUN:"WORKFLOW_RUN",CONTEXT_UPSERT:"CONTEXT_UPSERT",TOOL_CALL:"TOOL_CALL",AGENT_RUN:"AGENT_RUN"}}},function(e){e.O(0,[329,6840,8310,3954,4705,5874,7690,9851,7629,7093,6148,847,1942,7648,7823,8068,5799,605,4567,1206,5338,3825,1785,3246,9877,1425,7107,1713,192,7086,342,6488,6066,7301,6373,3832,8030,3750,6367,9953,9105,2971,2117,1744],function(){return e(e.s=72252)}),_N_E=e.O()}]);
|
|
2
|
+
//# sourceMappingURL=page-faaee5fe82b45966.js.map
|