@exulu/frontend 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/app-build-manifest.json +124 -127
- 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.js +1 -1
- package/dist/.next/server/app/(application)/agents/edit/[id]/page.js.nft.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 +7 -7
- package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js.nft.json +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 +4 -4
- package/dist/.next/server/app/(application)/data/[[...query]]/page.js.nft.json +1 -1
- 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.js.nft.json +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.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.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.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/api/auth/[...nextauth]/route.js +2 -2
- package/dist/.next/server/app-paths-manifest.json +4 -4
- package/dist/.next/server/chunks/1025.js +1 -0
- package/dist/.next/server/chunks/1051.js +2 -2
- package/dist/.next/server/chunks/2270.js +12 -48
- package/dist/.next/server/chunks/3434.js +1 -1
- package/dist/.next/server/chunks/3503.js +1 -0
- package/dist/.next/server/chunks/3575.js +1 -1
- package/dist/.next/server/chunks/5084.js +1 -0
- package/dist/.next/server/chunks/5192.js +1 -1
- package/dist/.next/server/chunks/5485.js +1 -0
- package/dist/.next/server/chunks/5600.js +1 -1
- package/dist/.next/server/chunks/5974.js +1 -0
- package/dist/.next/server/chunks/6590.js +1 -1
- package/dist/.next/server/chunks/7471.js +1 -1
- package/dist/.next/server/chunks/8286.js +1 -1
- package/dist/.next/server/chunks/{3679.js → 9874.js} +5 -5
- 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/1685-939396dad2f8f1e0.js +2 -0
- package/dist/.next/static/chunks/1685-939396dad2f8f1e0.js.map +1 -0
- package/dist/.next/static/chunks/{4811-316807e25b634f9f.js → 192-72d6868cd891ccc6.js} +8 -8
- package/dist/.next/static/chunks/192-72d6868cd891ccc6.js.map +1 -0
- package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js +2 -0
- package/dist/.next/static/chunks/1957-cf44b1d31a9c7d5c.js.map +1 -0
- package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js +2 -0
- package/dist/.next/static/chunks/342-d9c2d6ae9f9435cb.js.map +1 -0
- package/dist/.next/static/chunks/{3750-90a213a3c7cceb29.js → 3750-f45c59ef1cc79417.js} +2 -2
- package/dist/.next/static/chunks/3750-f45c59ef1cc79417.js.map +1 -0
- package/dist/.next/static/chunks/552-39155a93c527ec6d.js +2 -0
- package/dist/.next/static/chunks/552-39155a93c527ec6d.js.map +1 -0
- package/dist/.next/static/chunks/{7856-9fa733bdd6429ba8.js → 6066-65606593516b2a3a.js} +18 -18
- package/dist/.next/static/chunks/6066-65606593516b2a3a.js.map +1 -0
- package/dist/.next/static/chunks/6367-59655a85d75e19be.js +2 -0
- package/dist/.next/static/chunks/6367-59655a85d75e19be.js.map +1 -0
- package/dist/.next/static/chunks/6373-601400fab8a3bb55.js +2 -0
- package/dist/.next/static/chunks/6373-601400fab8a3bb55.js.map +1 -0
- package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js +2 -0
- package/dist/.next/static/chunks/8030-9c926ea4dfd3a54e.js.map +1 -0
- package/dist/.next/static/chunks/{6805-792cc8008b165c07.js → 8293-0e69d89d2dac7111.js} +10 -10
- package/dist/.next/static/chunks/8293-0e69d89d2dac7111.js.map +1 -0
- package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js +2 -0
- package/dist/.next/static/chunks/9105-dfbce1bad8e3e8dd.js.map +1 -0
- package/dist/.next/static/chunks/9953-95900a236271a222.js +2 -0
- package/dist/.next/static/chunks/9953-95900a236271a222.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js +2 -0
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-e4a4693953329671.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js +2 -0
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-7edb1c7c850f982c.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/chat/layout-093baa26f89338bc.js +2 -0
- package/dist/.next/static/chunks/app/(application)/chat/layout-093baa26f89338bc.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js +2 -0
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-8d2b3995cacfd832.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js +2 -0
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-a7728cf9b0524489.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js → page-827f50c6d1f150d0.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/evals/cases/{page-a39fef7444581565.js.map → page-827f50c6d1f150d0.js.map} +1 -1
- package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js +2 -0
- package/dist/.next/static/chunks/app/(application)/projects/[project]/page-f04fd5291a1ef7b1.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js +2 -0
- package/dist/.next/static/chunks/app/(application)/prompts/page-2c500e9898447506.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/workflows/{page-47dedb88cec600d5.js → page-e38f9456120dab69.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/workflows/page-e38f9456120dab69.js.map +1 -0
- package/dist/.next/static/css/6f8c5212af8ef284.css +4 -0
- package/dist/.next/static/css/6f8c5212af8ef284.css.map +1 -0
- package/dist/.next/static/css/e3f2a16ab7676b05.css.map +1 -1
- package/dist/package.json +1 -0
- package/package.json +1 -1
- package/dist/.next/server/chunks/2948.js +0 -1
- package/dist/.next/server/chunks/38.js +0 -1
- package/dist/.next/server/chunks/6623.js +0 -1
- package/dist/.next/server/chunks/7958.js +0 -1
- package/dist/.next/server/chunks/8050.js +0 -1
- package/dist/.next/static/chunks/1685-39351b8a15bbecab.js +0 -2
- package/dist/.next/static/chunks/1685-39351b8a15bbecab.js.map +0 -1
- package/dist/.next/static/chunks/1957-899d0d6d0d9c11fd.js +0 -2
- package/dist/.next/static/chunks/1957-899d0d6d0d9c11fd.js.map +0 -1
- package/dist/.next/static/chunks/3750-90a213a3c7cceb29.js.map +0 -1
- package/dist/.next/static/chunks/4811-316807e25b634f9f.js.map +0 -1
- package/dist/.next/static/chunks/5282-68f9880f1f951f44.js +0 -2
- package/dist/.next/static/chunks/5282-68f9880f1f951f44.js.map +0 -1
- package/dist/.next/static/chunks/6367-59cef3c74213925b.js +0 -2
- package/dist/.next/static/chunks/6367-59cef3c74213925b.js.map +0 -1
- package/dist/.next/static/chunks/6373-7908bd5269f95aa3.js +0 -2
- package/dist/.next/static/chunks/6373-7908bd5269f95aa3.js.map +0 -1
- package/dist/.next/static/chunks/6805-792cc8008b165c07.js.map +0 -1
- package/dist/.next/static/chunks/7856-9fa733bdd6429ba8.js.map +0 -1
- package/dist/.next/static/chunks/8030-c1b6be46253076cb.js +0 -2
- package/dist/.next/static/chunks/8030-c1b6be46253076cb.js.map +0 -1
- package/dist/.next/static/chunks/8269-0e17dac508340ccf.js +0 -2
- package/dist/.next/static/chunks/8269-0e17dac508340ccf.js.map +0 -1
- package/dist/.next/static/chunks/9105-78d236e8399181e0.js +0 -2
- package/dist/.next/static/chunks/9105-78d236e8399181e0.js.map +0 -1
- package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js +0 -2
- package/dist/.next/static/chunks/9621-f81c4d7c0ecf5a67.js.map +0 -1
- package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js +0 -2
- package/dist/.next/static/chunks/9953-dfb5fc0e5b74ec09.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-29794b9c33d2bf7e.js +0 -2
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-29794b9c33d2bf7e.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-57021bb06089261a.js +0 -2
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-57021bb06089261a.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/chat/layout-42021d301fc609b6.js +0 -2
- package/dist/.next/static/chunks/app/(application)/chat/layout-42021d301fc609b6.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-841b2ed48010048e.js +0 -2
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-841b2ed48010048e.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c1e7e0c81ca508c3.js +0 -2
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-c1e7e0c81ca508c3.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/projects/[project]/page-0b2d9832e5a023e7.js +0 -2
- package/dist/.next/static/chunks/app/(application)/projects/[project]/page-0b2d9832e5a023e7.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js +0 -2
- package/dist/.next/static/chunks/app/(application)/prompts/page-d2f36ff149385efd.js.map +0 -1
- package/dist/.next/static/chunks/app/(application)/workflows/page-47dedb88cec600d5.js.map +0 -1
- package/dist/.next/static/css/a181dac3df0dc7a7.css +0 -4
- package/dist/.next/static/css/a181dac3df0dc7a7.css.map +0 -1
- /package/dist/.next/static/{J23NmkaMjAJYnE0jX_kO0 → ls-syPkq9-MWp-VWWDEZJ}/_buildManifest.js +0 -0
- /package/dist/.next/static/{J23NmkaMjAJYnE0jX_kO0 → ls-syPkq9-MWp-VWWDEZJ}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(()=>{var e={};e.id=6050,e.ids=[6050,8050],e.modules={57343:e=>{"use strict";e.exports=require("graphql")},72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},27790:e=>{"use strict";e.exports=require("assert")},78893:e=>{"use strict";e.exports=require("buffer")},61282:e=>{"use strict";e.exports=require("child_process")},84770:e=>{"use strict";e.exports=require("crypto")},80665:e=>{"use strict";e.exports=require("dns")},17702:e=>{"use strict";e.exports=require("events")},92048:e=>{"use strict";e.exports=require("fs")},32615:e=>{"use strict";e.exports=require("http")},35240:e=>{"use strict";e.exports=require("https")},98216:e=>{"use strict";e.exports=require("net")},19801:e=>{"use strict";e.exports=require("os")},55315:e=>{"use strict";e.exports=require("path")},86624:e=>{"use strict";e.exports=require("querystring")},76162:e=>{"use strict";e.exports=require("stream")},82452:e=>{"use strict";e.exports=require("tls")},17360:e=>{"use strict";e.exports=require("url")},21764:e=>{"use strict";e.exports=require("util")},71568:e=>{"use strict";e.exports=require("zlib")},8678:e=>{"use strict";e.exports=import("pg")},48644:e=>{"use strict";e.exports=import("prettier/plugins/babel")},93801:e=>{"use strict";e.exports=import("prettier/plugins/estree")},45747:e=>{"use strict";e.exports=import("prettier/standalone")},49411:e=>{"use strict";e.exports=require("node:path")},97742:e=>{"use strict";e.exports=require("node:process")},41041:e=>{"use strict";e.exports=require("node:url")},39701:(e,t,s)=>{"use strict";s.a(e,async(e,a)=>{try{s.r(t),s.d(t,{GlobalError:()=>d.a,__next_app__:()=>p,originalPathname:()=>h,pages:()=>m,routeModule:()=>g,tree:()=>x}),s(21114),s(76738);var l=s(71197);s(35866);var r=s(23191),n=s(88716),i=s(37922),d=s.n(i),o=s(95231),c={};for(let e in o)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(c[e]=()=>o[e]);s.d(t,c);var u=e([l]);l=(u.then?(await u)():u)[0];let x=["",{children:["(application)",{children:["data",{children:["[[...query]]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,21114)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"]}]},{layout:[()=>Promise.resolve().then(s.bind(s,76738)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(s.bind(s,71197)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}]},{"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}],m=["/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"],h="/(application)/data/[[...query]]/page",p={require:s,loadChunk:()=>Promise.resolve()},g=new r.AppPageRouteModule({definition:{kind:n.x.APP_PAGE,page:"/(application)/data/[[...query]]/page",pathname:"/data/[[...query]]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:x}});a()}catch(e){a(e)}})},71580:(e,t,s)=>{Promise.resolve().then(s.bind(s,3871))},82736:(e,t,s)=>{Promise.resolve().then(s.bind(s,26533))},3871:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eB});var a=s(10326),l=s(17577),r=s(76812),n=s(39167),i=s(18753),d=s(86508),o=s(11798),c=s(83855),u=s(23015),x=s(98091),m=s(40900),h=s(35047),p=s(15211),g=s(90772),f=s(53313),j=s(37859),v=s(65685),y=s(65304),b=s(15940),N=s(34789),w=s(77863),k=s(98181);let C=[{id:"select",header:({table:e})=>a.jsx(f.X,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all",className:"translate-y-[2px]"}),cell:({row:e})=>a.jsx(f.X,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row",className:"translate-y-[2px] max-w-[50px]"}),enableSorting:!1,enableHiding:!1},{accessorKey:"Description",cell:({row:e})=>(console.log("original",e.original),(0,a.jsxs)("div",{className:"flex flex-column grid grid-cols-1",children:[a.jsx("span",{className:"max-w-[500px] truncate font-medium w-full",children:e.original.name?e.original.name:e.original.text?.slice(0,200)||"Untitled"}),a.jsx("small",{className:"mt-1",children:(0,k.WU)(new Date(e.original.createdAt),"PP")})]}))}];var z=s(43273),S=s(88307),E=s(94019),_=s(54432);function R({onSearch:e=e=>console.log(`Search query: ${e}`),placeholder:t="Search...",className:s=""}){let[r,n]=(0,l.useState)("");return a.jsx("form",{onSubmit:t=>{t.preventDefault(),e(r)},className:`relative ${s}`,children:(0,a.jsxs)("div",{className:"relative flex items-center w-full",children:[a.jsx(S.Z,{className:"absolute left-3 h-4 w-4 text-muted-foreground"}),a.jsx(_.I,{type:"text",placeholder:t,value:r,onChange:e=>n(e.target.value),className:"pl-10 pr-10","aria-label":"Search input"}),r&&(0,a.jsxs)(a.Fragment,{children:[a.jsx("span",{className:"absolute right-10 text-xs text-muted-foreground",children:"Press Enter ↵"}),a.jsx(g.z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 h-full rounded-l-none",onClick:()=>{n(""),e("")},"aria-label":"Clear search",children:a.jsx(E.Z,{className:"h-4 w-4"})})]})]})})}var O=s(42270);function D({activeFolder:e,activeItem:t,archived:s}){let k=(0,h.usePathname)(),S=(0,h.useSearchParams)(),[E,_]=(0,l.useState)(S.get("page")?parseInt(S.get("page")):1),D=S.get("search"),{user:Z}=(0,l.useContext)(p.S),{toast:L}=(0,N.pm)(),[M,P]=(0,l.useState)({...Z.company}),q=(0,h.useRouter)(),[I,T]=l.useState({}),[A,F]=l.useState({}),[$,U]=l.useState([]),[G,W]=l.useState([]),{loading:V,data:B,refetch:J,previousData:K,error:X}=(0,n.aM)((0,O.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:E??1,limit:10,sort:{field:"updatedAt",direction:"DESC"},filters:{archived:{eq:s},...D?{name:{contains:`${D}`}}:{}}}}),H=B?.[e+O.Md],Y=K?.[e+O.Md],[Q,ee]=(0,i.D)((0,O.ty)(e),{onCompleted:()=>{J()}}),[et,es]=(0,i.D)((0,O.mN)(e,[]),{onCompleted:()=>{J()}}),ea=l.useMemo(()=>[],[]),{limit:el,onPaginationChange:er,skip:en,pagination:ei}=function(){let[e,t]=(0,l.useState)({pageSize:5,pageIndex:0}),{pageSize:s,pageIndex:a}=e;return{limit:s,onPaginationChange:t,pagination:e,skip:s*a}}(),ed=(0,d.b7)({data:V&&Y?.items?Y.items:H?.items??ea,pageCount:H?.pageInfo?.pageCount??-1,columns:C,state:{sorting:G,columnVisibility:A,rowSelection:I,columnFilters:$},enableRowSelection:!0,onRowSelectionChange:T,onSortingChange:W,onColumnFiltersChange:U,onColumnVisibilityChange:F,getCoreRowModel:(0,o.sC)(),getFilteredRowModel:(0,o.vL)(),getPaginationRowModel:(0,o.G_)(),getSortedRowModel:(0,o.tj)(),getFacetedRowModel:(0,o.o6)(),getFacetedUniqueValues:(0,o.JG)(),manualPagination:!0,onPaginationChange:er}),[eo,ec]=(0,i.D)((0,O.tO)(e),{onCompleted:t=>{console.log("data",t);let s=t?t[e+O.Wc]?.item?.id:void 0;s&&q.push(`/data/${e}/${s}`),J()}}),eu=({page:e,search:t})=>{_(e??1);let s=new URLSearchParams;e&&s.set("page",e.toString()),t&&s.set("search",t),q.push(`${k}?${s.toString()}`)},ex=t=>{s?q.push(`/data/${e}/archived/${t}?${S.toString()}`):q.push(`/data/${e}/${t}?${S.toString()}`)};return X?(0,a.jsxs)(z.bZ,{className:"p-4",variant:"destructive",children:[a.jsx(r.LPM,{className:"size-4"}),a.jsx(z.Cd,{children:"Error"}),a.jsx(z.X,{children:X?.message||": unknown"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-flow-col grid-cols-[auto_minmax(0,1fr)] grid-rows-1 bg-background/95 p-4 backdrop-blur gap-2 supports-[backdrop-filter]:bg-background/60",children:[a.jsx(f.X,{checked:ed.getIsAllPageRowsSelected()||ed.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:e=>ed.toggleAllPageRowsSelected(!!e),"aria-label":"Select all",className:"my-auto mr-3 translate-y-[2px]"}),a.jsx("div",{className:"relative",children:a.jsx(R,{onSearch:e=>{eu({page:1,search:e})}})}),a.jsx(g.z,{onClick:()=>{eo({variables:{input:{name:"New item",source:"manual",textlength:0,company:M.id}}})},disabled:ec.loading||s,className:"ml-2 ml-auto lg:flex",children:ec.loading?a.jsx(j.g,{}):a.jsx(c.Z,{size:18})})]}),ed.getIsSomeRowsSelected()||ed.getIsAllRowsSelected()?a.jsx("div",{className:"flex px-4 pb-4",children:s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(t=>{e.push(Q({variables:{id:t.original.id,input:{archived:!1}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),L({title:"Unarchived items",description:"We unarchived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?a.jsx(j.g,{}):a.jsx(u.Z,{className:"size-4"}),a.jsx("span",{className:"ml-2",children:"Unarchive selected"})]}),(0,a.jsxs)(g.z,{className:"ml-2",onClick:()=>{let t=[];ed.getSelectedRowModel().rows.forEach(s=>{t.push(et({variables:{context:e,id:s.original.id}}))}),Promise.all(t).then(()=>{ed.resetRowSelection(),L({title:"Deleted items",description:"We deleted "+t.length+" items."})})},variant:"secondary",disabled:es.loading,children:[es.loading?a.jsx(j.g,{}):a.jsx(x.Z,{className:"size-4"}),a.jsx("span",{className:"ml-2",children:"Delete selected"})]})]}):(0,a.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(t=>{e.push(Q({variables:{id:t.original?.id,input:{archived:!0}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),L({title:"Archived items",description:"We archived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?a.jsx(j.g,{}):a.jsx(m.Z,{className:"size-4"}),a.jsx("span",{className:"ml-2",children:"Archive selected"})]})}):null,V?a.jsx(v.x,{className:"h-screen",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2 p-4 pt-0",children:[a.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),a.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),a.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),a.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),a.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),a.jsx(y.O,{className:"h-[100px] w-full rounded-lg"})]})}):(0,a.jsxs)("div",{className:"flex max-h-[75vh] flex-col",children:[a.jsx(v.x,{className:"h-screen grow",children:a.jsx("div",{className:"space-y-4",children:a.jsx("div",{className:"border-y",children:a.jsx(b.iA,{children:a.jsx(b.RM,{children:ed.getRowModel().rows?.length?ed.getRowModel().rows.map(e=>a.jsx(b.SC,{className:(0,w.cn)(t===e.original.id?"bg-secondary dark:text-white":""),"data-state":e.getIsSelected()&&"selected",children:e.getVisibleCells().map((t,s)=>s>0?a.jsx(b.pj,{className:"cursor-pointer",onClick:()=>{ex(e.original.id)},children:(0,d.ie)(t.column.columnDef.cell,t.getContext())},t.id):a.jsx(b.pj,{children:(0,d.ie)(t.column.columnDef.cell,t.getContext())},t.id))},e.id)):a.jsx(b.SC,{children:a.jsx(b.pj,{colSpan:C.length,className:"h-24 text-center",children:"No results."})})})})})})}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,a.jsxs)("div",{className:"flex-1 text-sm text-muted-foreground",children:[ed.getFilteredSelectedRowModel().rows.length," of"," ",ed.getFilteredRowModel().rows.length," row(s) selected (total"," ",H?.pageInfo.itemCount," items)."]}),a.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)(g.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{eu({page:1,search:D??void 0})},disabled:!H?.pageInfo.hasPreviousPage,children:[a.jsx("span",{className:"sr-only",children:"Go to first page"}),a.jsx(r.kRt,{className:"size-4"})]}),(0,a.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{console.log("itemsData.data?.pageInfo.hasPreviousPage",H?.pageInfo.hasPreviousPage),eu({page:H?.pageInfo.hasPreviousPage?E-1:void 0,search:D??void 0})},disabled:!H?.pageInfo.hasPreviousPage||V,children:[a.jsx("span",{className:"sr-only",children:"Go to previous page"}),a.jsx(r.wyc,{className:"size-4"})]}),(0,a.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{eu({page:H?.pageInfo.hasNextPage?E+1:void 0,search:D??void 0})},disabled:!H?.pageInfo.hasNextPage||V,children:[a.jsx("span",{className:"sr-only",children:"Go to next page"}),a.jsx(r.XCv,{className:"size-4"})]})]})})]})]})]})}var Z=s(76557);let L=(0,Z.Z)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),{createElement:M,createContext:P,createRef:q,forwardRef:I,useCallback:T,useContext:A,useEffect:F,useImperativeHandle:$,useLayoutEffect:U,useMemo:G,useRef:W,useState:V}=l,B=l["useId".toString()],J=P(null);J.displayName="PanelGroupContext";let K="function"==typeof B?B:()=>null,X=0;function H(e=null){let t=K(),s=W(e||t||null);return null===s.current&&(s.current=""+X++),null!=e?e:s.current}function Y({children:e,className:t="",collapsedSize:s,collapsible:a,defaultSize:l,forwardedRef:r,id:n,maxSize:i,minSize:d,onCollapse:o,onExpand:c,onResize:u,order:x,style:m,tagName:h="div",...p}){let g=A(J);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:f,expandPanel:j,getPanelSize:v,getPanelStyle:y,groupId:b,isPanelCollapsed:N,reevaluatePanelConstraints:w,registerPanel:k,resizePanel:C,unregisterPanel:z}=g,S=H(n),E=W({callbacks:{onCollapse:o,onExpand:c,onResize:u},constraints:{collapsedSize:s,collapsible:a,defaultSize:l,maxSize:i,minSize:d},id:S,idIsFromProps:void 0!==n,order:x});W({didLogMissingDefaultSizeWarning:!1}),$(r,()=>({collapse:()=>{f(E.current)},expand:()=>{j(E.current)},getId:()=>S,getSize:()=>v(E.current),isCollapsed:()=>N(E.current),isExpanded:()=>!N(E.current),resize:e=>{C(E.current,e)}}),[f,j,v,N,S,C]);let _=y(E.current,l);return M(h,{...p,children:e,className:t,style:{..._,...m},"data-panel":"","data-panel-id":S,"data-panel-group-id":b,"data-panel-collapsible":void 0,"data-panel-size":void 0})}let Q=I((e,t)=>M(Y,{...e,forwardedRef:t}));function ee(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}function et(e,t,s=10){let a=(e=parseFloat(e.toFixed(s)))-(t=parseFloat(t.toFixed(s)));return 0===a?0:a>0?1:-1}function es(e,t,s){return 0===et(e,t,s)}function ea({panelConstraints:e,panelIndex:t,size:s}){let a=e[t];ee(null!=a);let{collapsedSize:l=0,collapsible:r,maxSize:n=100,minSize:i=0}=a;return 0>et(s,i)&&(s=r&&0>et(s,(l+i)/2)?l:i),s=parseFloat((s=Math.min(n,s)).toFixed(10))}function el({delta:e,layout:t,panelConstraints:s,pivotIndices:a,trigger:l}){if(es(e,0))return t;let r=[...t],[n,i]=a;ee(null!=n),ee(null!=i);let d=0;if("keyboard"===l){{let a=e<0?i:n,l=s[a];if(ee(l),l.collapsible){let l=t[a];ee(null!=l);let r=s[a];ee(r);let{collapsedSize:n=0,minSize:i=0}=r;if(es(l,n)){let t=i-l;et(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let a=e<0?n:i,l=s[a];ee(l);let{collapsible:r}=l;if(r){let l=t[a];ee(null!=l);let r=s[a];ee(r);let{collapsedSize:n=0,minSize:i=0}=r;if(es(l,i)){let t=l-n;et(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let a=e<0?1:-1,l=e<0?i:n,r=0;for(;;){let e=t[l];if(ee(null!=e),r+=ea({panelConstraints:s,panelIndex:l,size:100})-e,(l+=a)<0||l>=s.length)break}let d=Math.min(Math.abs(e),Math.abs(r));e=e<0?0-d:d}{let a=e<0?n:i;for(;a>=0&&a<s.length;){let l=Math.abs(e)-Math.abs(d),n=t[a];ee(null!=n);let i=ea({panelConstraints:s,panelIndex:a,size:n-l});if(!es(n,i)&&(d+=n-i,r[a]=i,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?a--:a++}}if(es(d,0))return t;{let a=e<0?i:n,l=t[a];ee(null!=l);let o=l+d,c=ea({panelConstraints:s,panelIndex:a,size:o});if(r[a]=c,!es(c,o)){let t=o-c,a=e<0?i:n;for(;a>=0&&a<s.length;){let l=r[a];ee(null!=l);let n=ea({panelConstraints:s,panelIndex:a,size:l+t});if(es(l,n)||(t-=n-l,r[a]=n),es(t,0))break;e>0?a--:a++}}}return es(r.reduce((e,t)=>t+e,0),100)?r:t}function er(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function en(e,t,s=document){let a=er(e,s).findIndex(e=>e.getAttribute("data-panel-resize-handle-id")===t);return null!=a?a:null}function ei(e,t,s){let a=en(e,t,s);return null!=a?[a,a+1]:[-1,-1]}function ed(e,t=document){var s;return t instanceof HTMLElement&&(null==t?void 0:null===(s=t.dataset)||void 0===s?void 0:s.panelGroupId)==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function eo(e,t=document){return t.querySelector(`[data-panel-resize-handle-id="${e}"]`)||null}function ec(e){return"keydown"===e.type}function eu(e){return e.type.startsWith("mouse")}function ex(e){return e.type.startsWith("touch")}function em(e,t){let s="horizontal"===e;if(eu(t))return s?t.clientX:t.clientY;if(ex(t)){let e=t.touches[0];return ee(e),s?e.screenX:e.screenY}throw Error(`Unsupported event type "${t.type}"`)}function eh(e,t,s){t.forEach((t,a)=>{let l=e[a];ee(l);let{callbacks:r,constraints:n,id:i}=l,{collapsedSize:d=0,collapsible:o}=n,c=s[i];if(null==c||t!==c){s[i]=t;let{onCollapse:e,onExpand:a,onResize:l}=r;l&&l(t,c),o&&(e||a)&&(a&&(null==c||c===d)&&t!==d&&a(),e&&(null==c||c!==d)&&t===d&&e())}})}function ep(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=t[s])return!1;return!0}Y.displayName="Panel",Q.displayName="forwardRef(Panel)";let eg=null,ef=null;function ej(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function ev(e){if(eg===e)return;eg=e;let t=ej(e);null===ef&&(ef=document.createElement("style"),document.head.appendChild(ef)),ef.innerHTML=`*{cursor: ${t}!important;}`}function ey(e){try{if("undefined"!=typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function eb(e){return`react-resizable-panels:${e}`}function eN(e,t,s,a,l){var r;let n=eb(e),i=t.map(e=>{let{constraints:t,id:s,idIsFromProps:a,order:l}=e;return a?s:l?`${l}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(","),d=null!==(r=function(e,t){try{let s=eb(e),a=t.getItem(s);if(a){let e=JSON.parse(a);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}(e,l))&&void 0!==r?r:{};d[i]={expandToSizes:Object.fromEntries(s.entries()),layout:a};try{l.setItem(n,JSON.stringify(d))}catch(e){console.error(e)}}let ew={getItem:e=>(ey(ew),ew.getItem(e)),setItem:(e,t)=>{ey(ew),ew.setItem(e,t)}},ek={};function eC({autoSaveId:e=null,children:t,className:s="",direction:a,forwardedRef:l,id:r=null,onLayout:n=null,keyboardResizeBy:i=null,storage:d=ew,style:o,tagName:c="div",...u}){let x=H(r),m=W(null),[h,p]=V(null),[g,f]=V([]),j=W({}),v=W(new Map),y=W(0),b=W({autoSaveId:e,direction:a,dragState:h,id:x,keyboardResizeBy:i,onLayout:n,storage:d}),N=W({layout:g,panelDataArray:[],panelDataArrayChanged:!1});W({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),$(l,()=>({getId:()=>b.current.id,getLayout:()=>{let{layout:e}=N.current;return e},setLayout:e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:a}=N.current,l=function({layout:e,panelConstraints:t}){let s=[...e],a=s.reduce((e,t)=>e+t,0);if(s.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${s.map(e=>`${e}%`).join(", ")}`);if(!es(a,100))for(let e=0;e<t.length;e++){let t=s[e];ee(null!=t);let l=100/a*t;s[e]=l}let l=0;for(let e=0;e<t.length;e++){let a=s[e];ee(null!=a);let r=ea({panelConstraints:t,panelIndex:e,size:a});a!=r&&(l+=a-r,s[e]=r)}if(!es(l,0))for(let e=0;e<t.length;e++){let a=s[e];ee(null!=a);let r=ea({panelConstraints:t,panelIndex:e,size:a+l});if(a!==r&&(l-=r-a,s[e]=r,es(l,0)))break}return s}({layout:e,panelConstraints:a.map(e=>e.constraints)});!function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}(s,l)&&(f(l),N.current.layout=l,t&&t(l),eh(a,l,j.current))}}),[]),function({committedValuesRef:e,eagerValuesRef:t,groupId:s,layout:a,panelDataArray:l,panelGroupElement:r,setLayout:n}){W({didWarnAboutMissingResizeHandle:!1}),F(()=>{if(!r)return;let e=t.current;ee(e);let{panelDataArray:l}=e;ee(null!=ed(s,r),`No group found for id "${s}"`);let i=er(s,r);ee(i);let d=i.map(e=>{let t=e.getAttribute("data-panel-resize-handle-id");ee(t);let[i,d]=function(e,t,s,a=document){var l,r,n,i;let d=eo(t,a),o=er(e,a),c=d?o.indexOf(d):-1;return[null!==(l=null===(r=s[c])||void 0===r?void 0:r.id)&&void 0!==l?l:null,null!==(n=null===(i=s[c+1])||void 0===i?void 0:i.id)&&void 0!==n?n:null]}(s,t,l,r);if(null==i||null==d)return()=>{};let o=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let d=l.findIndex(e=>e.id===i);if(d>=0){let e=l[d];ee(e);let i=a[d],{collapsedSize:o=0,collapsible:c,minSize:u=0}=e.constraints;if(null!=i&&c){let e=el({delta:es(i,o)?u-o:o-i,layout:a,panelConstraints:l.map(e=>e.constraints),pivotIndices:ei(s,t,r),trigger:"keyboard"});a!==e&&n(e)}}}};return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}});return()=>{d.forEach(e=>e())}},[r,e,t,s,a,l,n])}({committedValuesRef:b,eagerValuesRef:N,groupId:x,layout:g,panelDataArray:N.current.panelDataArray,setLayout:f,panelGroupElement:m.current}),F(()=>{let{panelDataArray:t}=N.current;if(e){if(0===g.length||g.length!==t.length)return;let s=ek[e];null==s&&(s=function(e,t=10){let s=null;return(...a)=>{null!==s&&clearTimeout(s),s=setTimeout(()=>{e(...a)},t)}}(eN,100),ek[e]=s),s(e,[...t],new Map(v.current),g,d)}},[e,g,d]),F(()=>{});let w=T(e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:a}=N.current;if(e.constraints.collapsible){let l=a.map(e=>e.constraints),{collapsedSize:r=0,panelSize:n,pivotIndices:i}=eE(a,e,s);if(ee(null!=n),n!==r){v.current.set(e.id,n);let d=el({delta:eS(a,e)===a.length-1?n-r:r-n,layout:s,panelConstraints:l,pivotIndices:i,trigger:"imperative-api"});ep(s,d)||(f(d),N.current.layout=d,t&&t(d),eh(a,d,j.current))}}},[]),k=T(e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:a}=N.current;if(e.constraints.collapsible){let l=a.map(e=>e.constraints),{collapsedSize:r=0,panelSize:n,minSize:i=0,pivotIndices:d}=eE(a,e,s);if(n===r){let r=v.current.get(e.id),o=null!=r&&r>=i?r:i,c=el({delta:eS(a,e)===a.length-1?n-o:o-n,layout:s,panelConstraints:l,pivotIndices:d,trigger:"imperative-api"});ep(s,c)||(f(c),N.current.layout=c,t&&t(c),eh(a,c,j.current))}}},[]),C=T(e=>{let{layout:t,panelDataArray:s}=N.current,{panelSize:a}=eE(s,e,t);return ee(null!=a),a},[]),z=T((e,t)=>{let{panelDataArray:s}=N.current,a=eS(s,e);return function({defaultSize:e,dragState:t,layout:s,panelData:a,panelIndex:l,precision:r=3}){let n=s[l];return{flexBasis:0,flexGrow:null==n?null!=e?e:"1":1===a.length?"1":n.toPrecision(r),flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:h,layout:g,panelData:s,panelIndex:a})},[h,g]),S=T(e=>{let{layout:t,panelDataArray:s}=N.current,{collapsedSize:a=0,collapsible:l,panelSize:r}=eE(s,e,t);return!0===l&&r===a},[]),E=T(e=>{let{layout:t,panelDataArray:s}=N.current,{collapsedSize:a=0,collapsible:l,panelSize:r}=eE(s,e,t);return ee(null!=r),!l||r>a},[]),_=T(e=>{let{panelDataArray:t}=N.current;t.push(e),t.sort((e,t)=>{let s=e.order,a=t.order;return null==s&&null==a?0:null==s?-1:null==a?1:s-a}),N.current.panelDataArrayChanged=!0},[]),R=T(e=>function(t){t.preventDefault();let s=m.current;if(!s)return()=>null;let{direction:a,dragState:l,id:r,keyboardResizeBy:n,onLayout:i}=b.current,{layout:d,panelDataArray:o}=N.current,{initialLayout:c}=null!=l?l:{},u=ei(r,e,s),x=function(e,t,s,a,l,r){if(ec(e)){let t="horizontal"===s,a=0;a=e.shiftKey?100:null!=l?l:10;let r=0;switch(e.key){case"ArrowDown":r=t?0:a;break;case"ArrowLeft":r=t?-a:0;break;case"ArrowRight":r=t?a:0;break;case"ArrowUp":r=t?0:-a;break;case"End":r=100;break;case"Home":r=-100}return r}return null==a?0:function(e,t,s,a,l){let r="horizontal"===s,n=eo(t,l);ee(n);let i=n.getAttribute("data-panel-group-id");ee(i);let{initialCursorPosition:d}=a,o=em(s,e),c=ed(i,l);ee(c);let u=c.getBoundingClientRect();return(o-d)/(r?u.width:u.height)*100}(e,t,s,a,r)}(t,e,a,l,n,s);if(0===x)return;let h="horizontal"===a;"rtl"===document.dir&&h&&(x=-x);let p=el({delta:x,layout:null!=c?c:d,panelConstraints:o.map(e=>e.constraints),pivotIndices:u,trigger:ec(t)?"keyboard":"mouse-or-touch"}),g=!ep(d,p);(eu(t)||ex(t))&&y.current!=x&&(y.current=x,g?ev(h?"horizontal":"vertical"):h?ev(x<0?"horizontal-min":"horizontal-max"):ev(x<0?"vertical-min":"vertical-max")),g&&(f(p),N.current.layout=p,i&&i(p),eh(o,p,j.current))},[]),O=T((e,t)=>{let{onLayout:s}=b.current,{layout:a,panelDataArray:l}=N.current,r=l.map(e=>e.constraints),{panelSize:n,pivotIndices:i}=eE(l,e,a);ee(null!=n);let d=el({delta:eS(l,e)===l.length-1?n-t:t-n,layout:a,panelConstraints:r,pivotIndices:i,trigger:"imperative-api"});ep(a,d)||(f(d),N.current.layout=d,s&&s(d),eh(l,d,j.current))},[]),D=T((e,t)=>{let{layout:s,panelDataArray:a}=N.current,{collapsedSize:l=0,collapsible:r}=t,{collapsedSize:n=0,collapsible:i,maxSize:d=100,minSize:o=0}=e.constraints,{panelSize:c}=eE(a,e,s);ee(null!=c),r&&i&&c===l?l!==n&&O(e,n):c<o?O(e,o):c>d&&O(e,d)},[O]),Z=T((e,t)=>{let{direction:s}=b.current,{layout:a}=N.current;if(!m.current)return;let l=eo(e,m.current);ee(l);let r=em(s,t);p({dragHandleId:e,dragHandleRect:l.getBoundingClientRect(),initialCursorPosition:r,initialLayout:a})},[]),L=T(()=>{null!==ef&&(document.head.removeChild(ef),eg=null,ef=null),p(null)},[]),P=T(e=>{let{panelDataArray:t}=N.current,s=eS(t,e);s>=0&&(t.splice(s,1),delete j.current[e.id],N.current.panelDataArrayChanged=!0)},[]),q=G(()=>({collapsePanel:w,direction:a,dragState:h,expandPanel:k,getPanelSize:C,getPanelStyle:z,groupId:x,isPanelCollapsed:S,isPanelExpanded:E,reevaluatePanelConstraints:D,registerPanel:_,registerResizeHandle:R,resizePanel:O,startDragging:Z,stopDragging:L,unregisterPanel:P,panelGroupElement:m.current}),[w,h,a,k,C,z,x,S,E,D,_,R,O,Z,L,P]);return M(J.Provider,{value:q},M(c,{...u,children:t,className:s,style:{display:"flex",flexDirection:"horizontal"===a?"row":"column",height:"100%",overflow:"hidden",width:"100%",...o},ref:m,"data-panel-group":"","data-panel-group-direction":a,"data-panel-group-id":x}))}let ez=I((e,t)=>M(eC,{...e,forwardedRef:t}));function eS(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function eE(e,t,s){let a=eS(e,t),l=a===e.length-1,r=s[a];return{...t.constraints,panelSize:r,pivotIndices:l?[a-1,a]:[a,a+1]}}function e_({children:e=null,className:t="",disabled:s=!1,id:a,onDragging:l,style:r={},tabIndex:n=0,tagName:i="div",...d}){let o=W(null),c=W({onDragging:l});F(()=>{c.current.onDragging=l});let u=A(J);if(null===u)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,dragState:m,groupId:h,registerResizeHandle:p,startDragging:g,stopDragging:f,panelGroupElement:j}=u,v=H(a),y=(null==m?void 0:m.dragHandleId)===v,[b,N]=V(!1),[w,k]=V(null),C=T(()=>{let e=o.current;ee(e),e.blur(),f();let{onDragging:t}=c.current;t&&t(!1)},[f]);F(()=>{if(s)k(null);else{let e=p(v);k(()=>e)}},[s,v,p]),F(()=>{if(s||null==w||!y)return;let e=e=>{w(e)},t=e=>{w(e)},a=o.current;ee(a);let l=a.ownerDocument;return l.body.addEventListener("contextmenu",C),l.body.addEventListener("mousemove",e),l.body.addEventListener("touchmove",e),l.body.addEventListener("mouseleave",t),window.addEventListener("mouseup",C),window.addEventListener("touchend",C),()=>{l.body.removeEventListener("contextmenu",C),l.body.removeEventListener("mousemove",e),l.body.removeEventListener("touchmove",e),l.body.removeEventListener("mouseleave",t),window.removeEventListener("mouseup",C),window.removeEventListener("touchend",C)}},[x,s,y,w,C]),function({disabled:e,handleId:t,resizeHandler:s,panelGroupElement:a}){F(()=>{if(e||null==s||null==a)return;let l=eo(t,a);if(null==l)return;let r=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),s(e);break;case"F6":{e.preventDefault();let s=l.getAttribute("data-panel-group-id");ee(s);let r=er(s,a),n=en(s,t,a);ee(null!==n);let i=e.shiftKey?n>0?n-1:r.length-1:n+1<r.length?n+1:0;r[i].focus()}}};return l.addEventListener("keydown",r),()=>{l.removeEventListener("keydown",r)}},[a,e,t,s])}({disabled:s,handleId:v,resizeHandler:w,panelGroupElement:j});let z={cursor:ej(x),touchAction:"none",userSelect:"none"};return M(i,{...d,children:e,className:t,onBlur:()=>N(!1),onFocus:()=>N(!0),onMouseDown:e=>{g(v,e.nativeEvent);let t=c.current;ee(t);let{onDragging:s}=t;s&&s(!0)},onMouseUp:C,onTouchCancel:C,onTouchEnd:C,onTouchStart:e=>{g(v,e.nativeEvent);let t=c.current;ee(t);let{onDragging:s}=t;s&&s(!0)},ref:o,role:"separator",style:{...z,...r},tabIndex:n,"data-panel-group-direction":x,"data-panel-group-id":h,"data-resize-handle":"","data-resize-handle-active":y?"pointer":b?"keyboard":void 0,"data-panel-resize-handle-enabled":!s,"data-panel-resize-handle-id":v})}eC.displayName="PanelGroup",ez.displayName="forwardRef(PanelGroup)",e_.displayName="PanelResizeHandle";let eR=({className:e,...t})=>a.jsx(ez,{className:(0,w.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),eO=({withHandle:e,className:t,...s})=>a.jsx(e_,{className:(0,w.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...s,children:e&&a.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:a.jsx(L,{className:"size-2.5"})})});var eD=s(8281),eZ=s(79210),eL=s(68232),eM=s(44389),eP=s(86333),eq=s(3240),eI=s(65983),eT=s(42924);let eA=(0,Z.Z)("ArchiveX",[["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:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);var eF=s(88319);let e$=(0,Z.Z)("FileStack",[["path",{d:"M16 2v5h5",key:"kt2in0"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17l4 4z",key:"1km23n"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);var eU=s(75909),eG=s(90434);let eW=({index:e,folder:t,edit:s,indented:l,children:r})=>(0,a.jsxs)("div",{className:"flex flex-col ",children:[(0,a.jsxs)("div",{className:(0,w.cn)((0,g.d)({variant:t.variant,size:"sm"}),l?"pl-5":null,t.active?"dark:bg-muted dark:text-white dark:hover:bg-muted dark:hover:text-white":null,"justify-start"),children:[(0,a.jsxs)(eG.default,{className:"flex",href:t.href||"",children:[a.jsx(t.icon,{className:"mr-2 size-4"}),!t.icon&&t.label,null!==t.icon&&a.jsx("span",{className:(0,w.cn)("ml-0 overflow-hidden text-ellipsis max-w-[170px]","default"===t.variant&&"text-background dark:text-white"),children:t.label})]},e),s&&a.jsx(eM.Z,{onClick:()=>{s()},className:"ml-auto size-4 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"})]}),a.jsx("div",{children:r})]}),eV=({activeFolder:e,activeArchived:t,activeSources:s,activeEmbeddings:l})=>{let{data:r,loading:n,error:i}=(0,eU.t)();return a.jsx(a.Fragment,{children:(0,a.jsxs)("div",{className:"group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2 pb-5",children:[e?a.jsx("div",{className:"flex items-center gap-2",children:a.jsx(g.z,{variant:"link",size:"sm",asChild:!0,children:(0,a.jsxs)(eG.default,{href:"/data",children:[a.jsx(eP.Z,{className:"size-4"}),a.jsx("span",{className:"ml-2",children:"Back to dashboard"})]})})}):a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-sm text-muted-foreground ml-5 pt-3",children:"Select a context:"})}),a.jsx("nav",{className:"grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:n?a.jsx(eW,{index:111,folder:{label:"Loading...",active:!1,icon:eq.Z,variant:"ghost"}}):r?.contexts?.items.map((r,n)=>a.jsx(eW,{index:n,folder:{label:`${r.name}`,icon:eI.Z,variant:"ghost",href:`/data/${r.id}`},children:e?.toLowerCase()===`${r.id}`.toLowerCase()&&a.jsxs(a.Fragment,{children:[a.jsx(eW,{index:n,indented:!0,folder:{label:"Active data",active:e?.toLowerCase()===`${r.id}`.toLowerCase()&&!t&&!s&&!l,icon:eT.Z,variant:e?.toLowerCase()!==`${r.id}`.toLowerCase()||t||s||l?"ghost":"default",href:`/data/${r.id}`}}),a.jsx(eW,{index:n+1e3,indented:!0,folder:{label:"Archived data",active:t,icon:eA,variant:t?"default":"ghost",href:`/data/${r.id}/archived`}}),a.jsx(eW,{index:n+1e3,indented:!0,folder:{label:"Sources",active:s,icon:eF.Z,variant:s?"default":"ghost",href:`/data/${r.id}/sources`}}),a.jsx(eW,{index:n+1e3,indented:!0,folder:{label:"Embeddings",active:l,icon:e$,variant:l?"default":"ghost",href:`/data/${r.id}/embeddings`}})]})},r.id))})]},e+t+s+l)})};function eB({children:e,params:t}){let s=t.query&&"archived"===t.query[1],l=t.query&&"sources"===t.query[1],r=t.query&&"embeddings"===t.query[1],n=t.query&&t.query[0],i=null;return t.query&&s?i=t.query[2]||null:!t.query||l||r||(i=t.query[1]||null),a.jsx(eL.pn,{delayDuration:0,children:(0,a.jsxs)(eR,{direction:"horizontal",onLayout:e=>{document.cookie=`react-resizable-panels:layout=${JSON.stringify(e)}`},className:"h-full items-stretch",children:[(0,a.jsxs)(Q,{defaultSize:15,collapsedSize:4,collapsible:!0,minSize:15,maxSize:20,children:[a.jsx(eD.Z,{}),a.jsx(eV,{activeFolder:n,activeArchived:s,activeSources:l,activeEmbeddings:r})]}),n&&!l&&!r&&(0,a.jsxs)(a.Fragment,{children:[a.jsx(eO,{withHandle:!0}),a.jsx(Q,{defaultSize:20,minSize:20,children:(0,a.jsxs)(eZ.mQ,{defaultValue:"all",children:[a.jsx("div",{className:"flex items-center px-4 py-2 h-full",children:a.jsx("h1",{className:"text-xl font-bold",children:"Items"})}),a.jsx(eD.Z,{}),a.jsx(D,{activeFolder:n,activeItem:i??void 0,archived:s})]})})]}),a.jsx(eO,{withHandle:!0}),a.jsx(Q,{defaultSize:65,children:a.jsx("div",{className:"max-h-full overflow-y-auto",children:e})})]})})}},26533:(e,t,s)=>{"use strict";s.a(e,async(e,a)=>{try{s.r(t),s.d(t,{default:()=>p});var l=s(10326),r=s(65063);s(17577);var n=s(69771),i=s(18440),d=s(39167),o=s(42270),c=s(43273),u=s(65304),x=s(76812),m=s(5096),h=e([r]);function p({params:e}){let{data:t,loading:s,error:a}=(0,d.aM)(o.fV,{skip:!e?.query?.[0],variables:{id:e?.query?.[0]}});if(!e.query)return l.jsx("div",{className:"grow flex flex-col",children:l.jsx(n.Z,{})});let h=e.query[0]||null,p="archived"===e.query[1],g="sources"===e.query[1],f="embeddings"===e.query[1];if(g)return l.jsx(m.L,{expand:!0,actions:!0,context:h});if(f)return l.jsx(i.U,{expand:!0,actions:!0,context:h});let j=null;return(p?j=e.query[2]||null:g||f||(j=e.query[1]||null),s||!t?.contextById)?(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[l.jsx(u.O,{className:"w-full h-[80px] rounded-md"}),l.jsx(u.O,{className:"w-full h-[50px] rounded-md mt-3"}),l.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),l.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),l.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),l.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):a?(0,l.jsxs)(c.bZ,{variant:"destructive",children:[l.jsx(x.LPM,{className:"size-4"}),l.jsx(c.Cd,{children:"Error"}),l.jsx(c.X,{children:a?.message||"Error loading item."})]}):l.jsx(r.H,{actions:!0,context:t?.contextById,itemId:j})}r=(h.then?(await h)():h)[0],a()}catch(e){a(e)}})},69771:(e,t,s)=>{"use strict";s.d(t,{Z:()=>c});var a=s(10326),l=s(33519),r=s(17577),n=s(31051),i=s(42193),d=s(16923),o=s(22746);function c(){let[e,t]=(0,r.useState)("count"),[s,c]=(0,r.useState)({from:(0,l.k)(new Date,7),to:new Date}),[u,x]=(0,r.useState)("CONTEXT_UPSERT"),[m,h]=(0,r.useState)("label");return(0,a.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[a.jsx("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),a.jsx("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsx(i.z,{dateRange:s,onDateRangeChange:c,maxDays:30})})]}),(0,a.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[a.jsx("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:a.jsx(d.q,{dateRange:s,selectedType:u,onTypeChange:x,unitOptions:[{value:"count",label:"Count"}],onUnitChange:t,unit:e,dataTypes:[n.h.CONTEXT_RETRIEVE,n.h.CONTEXT_UPSERT]})}),a.jsx("div",{className:"rounded-lg border p-6 flex flex-col",children:a.jsx(o.Y,{groupByOptions:[],dateRange:s,selectedType:u,unit:e,groupBy:m,onGroupByChange:h})})]})]})}},65063:(e,t,s)=>{"use strict";s.a(e,async(e,a)=>{try{s.d(t,{H:()=>K});var l=s(10326),r=s(39167),n=s(18753),i=s(74064),d=s(23015),o=s(98091),c=s(40900),u=s(35157),x=s(31215),m=s(69508),h=s(91470),p=s(24081),g=s(21986),f=s(47206),j=s(231),v=s(35047),y=s(17577),b=s(74723),N=s(770),w=s(57004),k=s(18615),C=s(567),z=s(90772),S=s(55632),E=s(54432),_=s(37859),R=s(8281),O=s(33261),D=s(15940),Z=s(87673),L=s(68232),M=s(62288),P=s(60097),q=s(99440),I=s(34789),T=s(77863),A=s(65304),F=s(43273),$=s(76812),U=s(42270),G=s(15286),W=s(24295),V=s(33071),B=s(77961),J=e([w]);function K(e){let[t,s]=(0,y.useState)(),{toast:a}=(0,I.pm)(),J=(0,v.useRouter)(),[K,X]=(0,y.useState)(),H=e.context,Y=e.context.fields.map(e=>e.name);console.log("fields",Y),console.log("context",H);let{loading:Q,error:ee,refetch:et}=(0,r.aM)((0,U.A1)(e.context.id,Y,!0),{skip:!e.itemId||!e.context?.id,variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:t=>{let a=t[e.context.id+"_itemsById"];s({...a,tags:a.tags?a.tags.split(","):[]}),X({rights_mode:a.rights_mode,users:a.RBAC?.users,roles:a.RBAC?.roles,projects:a.RBAC?.projects})}}),[es,ea]=(0,n.D)((0,U.ty)(e.context.id),{onCompleted:()=>{a({title:"Item updated",description:"Item updated successfully."})},onError:e=>{a({title:"Error updating item",description:e.message})}}),[el,er]=(0,n.D)((0,U.mN)(e.context.id,[]),{onCompleted:()=>{a({title:"Item deleted",description:"Item deleted successfully."})},onError:e=>{a({title:"Error deleting item",description:e.message})}}),[en,ei]=(0,n.D)((0,U.Eq)(e.context.id),{onCompleted:t=>{let s=t[e.context.id+"_itemsGenerateChunks"];if(s.jobs?.length>0){a({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}a({title:"Chunks generated",description:"Chunks generated successfully."})}}),[ed,eo]=(0,n.D)((0,U.ps)(e.context.id),{onCompleted:t=>{let s=t[e.context.id+"_itemsDeleteChunks"];if(s.jobs?.length>0){a({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}a({title:"Chunks deleted",description:"Chunks deleted successfully."})}}),[ec,eu]=(0,n.D)((0,U.dc)(e.context.id),{onCompleted:()=>{a({title:"Field processed",description:"Field processed successfully."})},onError:e=>{a({title:"Error processing field",description:e.message})}}),ex=N.Ry({name:N.Z_().nullable().optional(),tags:N.Z_().nullable().optional(),external_id:N.Z_().nullable().optional(),description:N.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...H?.fields?.reduce((e,t)=>({...e,[t.name]:N.Z_().nullable()}),{})??{}}),em=(0,b.cI)({resolver:(0,i.F)(ex),defaultValues:{description:t?.description},mode:"onChange"}),eh=e=>{if(e.target.value&&"Enter"===e.key){let a=t?.tags??[],l=[...Array.isArray(a)?[...a]:[]];l.push(e.target.value),console.log("tags",l),em.setValue("tags",l.join(",")),s({...t,tags:l}),e.target.value=""}},[ep,eg]=(0,y.useState)(!1),[ef,ej]=(0,y.useState)(null),[ev,ey]=(0,y.useState)(null);return Q?(0,l.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[l.jsx(A.O,{className:"w-full h-[80px] rounded-md"}),l.jsx(A.O,{className:"w-full h-[50px] rounded-md mt-3"}),l.jsx(A.O,{className:"w-full h-[80px] rounded-md mt-3"}),l.jsx(A.O,{className:"w-full h-[80px] rounded-md mt-3"}),l.jsx(A.O,{className:"w-full h-[80px] rounded-md mt-3"}),l.jsx(A.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):ee?(0,l.jsxs)(F.bZ,{variant:"destructive",children:[l.jsx($.LPM,{className:"size-4"}),l.jsx(F.Cd,{children:"Error"}),l.jsx(F.X,{children:ee?.message||"Error loading item."})]}):(0,l.jsxs)("div",{className:"flex h-full flex-col",children:[t?(0,l.jsxs)(l.Fragment,{children:[e.actions?(0,l.jsxs)(l.Fragment,{children:[l.jsx("div",{className:"flex items-center p-2",children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[t?.archived?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{onClick:async()=>{t.id&&(es({variables:{id:t.id,input:{archived:!1}}}),s({...t,archived:!1}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||ea.loading,children:[ea.loading?l.jsx(_.g,{}):l.jsx(d.Z,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Unarchive"})]})}),l.jsx(L._v,{children:"Unarchive"})]}),(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{onClick:async()=>{t.id&&(el({variables:{id:t.id}}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[er.loading?l.jsx(_.g,{}):l.jsx(o.Z,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})}),l.jsx(L._v,{children:"Delete"})]})]}):(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{onClick:async()=>{t?.id&&(es({variables:{id:t.id,input:{archived:!0}}}),s({...t,archived:!0}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||ea.loading,children:[ea.loading?l.jsx(_.g,{}):l.jsx(c.Z,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Archive"})]})}),l.jsx(L._v,{children:"Archive"})]}),ep?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{onClick:()=>{eg(!1)},variant:"ghost",size:"icon",children:[l.jsx(u.Z,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Cancel"})]})}),l.jsx(L._v,{children:"Cancel"})]}),(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{disabled:ea.loading,onClick:()=>{t?.id&&(es({variables:{id:t.id,input:{textlength:t?.text?.length,description:t?.description,name:t?.name,externalId:t?.externalId,tags:t?.tags?.join(","),source:t?.source,archived:t?.archived,rights_mode:K?.rights_mode,RBAC:{users:K?.users||[],roles:K?.roles||[],projects:K?.projects||[]},...H?.fields?.reduce((e,s)=>({...e,[s.name]:t?.[s.name]}),{})??{}}}}),eg(!1))},variant:"ghost",size:"icon",children:[l.jsx(x.Z,{className:"size-4"}),(0,l.jsxs)("span",{className:"sr-only",children:["Save ",ea.loading??l.jsx(_.g,{})]})]})}),l.jsx(L._v,{children:"Save"})]})]}):(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{onClick:()=>{eg(!0)},variant:"ghost",size:"icon",disabled:!t||ea.loading,children:[l.jsx(m.Z,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Edit"})]})}),l.jsx(L._v,{children:"Edit"})]})]})}),l.jsx(R.Z,{})]}):null,l.jsx("div",{className:"flex flex-1 flex-col",children:(0,l.jsxs)("div",{className:(0,T.cn)("space-y-2"),children:[l.jsx("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:l.jsx("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"})}),(0,l.jsxs)("div",{className:"p-5",children:[l.jsx(S.l0,{...em,children:l.jsx("form",{className:"space-y-8",children:(0,l.jsxs)("div",{children:[(0,l.jsxs)(D.iA,{children:[l.jsx(D.xD,{children:(0,l.jsxs)(D.SC,{children:[l.jsx(D.ss,{children:"Name"}),l.jsx(D.ss,{children:"Value"})]})}),(0,l.jsxs)(D.RM,{children:[(0,l.jsxs)(D.SC,{children:[l.jsx(D.pj,{className:"font-medium capitalize",children:"Name"}),l.jsx(D.pj,{children:l.jsx(S.Wi,{control:em.control,name:"name",render:({field:e})=>l.jsx(S.xJ,{children:ep?(0,l.jsxs)(l.Fragment,{children:[l.jsx(S.NI,{children:l.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{s({...t,name:e.target.value})},placeholder:"Item name",value:t.name??""})}),l.jsx(S.zG,{})]}):l.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.name??""),a({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:t.name&&t.name?.length>200?t.name?.slice(0,200)+"...":t.name})})})})]},"name"),(0,l.jsxs)(D.SC,{children:[l.jsx(D.pj,{className:"font-medium capitalize",children:"Tags"}),(0,l.jsxs)(D.pj,{children:[ep?l.jsx("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:l.jsx(S.Wi,{control:em.control,name:"tags",render:({field:e})=>(0,l.jsxs)(S.xJ,{children:[l.jsx(S.NI,{children:l.jsx(E.I,{id:"includes",type:"text",onKeyUp:e=>eh(e),placeholder:"Type and press enter to add"})}),l.jsx(S.zG,{})]})})}):null,t?.tags?.length?l.jsx("div",{className:"gap-2 pt-2",children:t?.tags?.map((e,a)=>l.jsx(C.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),ep?l.jsx("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{let e=[...t.tags??[]];e.splice(a,1),em.setValue("tags",e.join(",")),s({...t,tags:e})},children:l.jsx(h.Z,{className:"ml-1",size:15})}):null]})},`tag-${a}`))}):null]})]},"tags"),(0,l.jsxs)(D.SC,{children:[l.jsx(D.pj,{className:"font-medium capitalize",children:"Description"}),l.jsx(D.pj,{children:l.jsx(S.Wi,{control:em.control,name:"description",render:({field:e})=>l.jsx(S.xJ,{children:ep?(0,l.jsxs)(l.Fragment,{children:[l.jsx(S.NI,{children:(0,l.jsxs)("div",{className:"relative",children:[l.jsx(Z.g,{autoFocus:!0,disabled:!ep,onChange:e=>{s({...t,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:t.description??""}),(0,l.jsxs)(M.Vq,{children:[l.jsx(M.hg,{asChild:!0,children:(0,l.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:"description",value:t.description??"",disabled:!1}),children:[l.jsx(p.Z,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,l.jsxs)(M.cZ,{className:"max-w-4xl max-h-[80vh]",children:[l.jsx(M.fK,{children:l.jsx(M.$N,{children:"Edit Description"})}),l.jsx("div",{className:"mt-4",children:l.jsx(Z.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name==="description"?ef.value:t.description??"",onChange:e=>{let a=e.target.value;ej(e=>e?.name==="description"?{...e,value:a}:e),s({...t,description:a})}})})]})]})]})}),l.jsx(S.zG,{})]}):l.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.description??""),a({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:l.jsx(k.J,{text:t.description??""})})})})})]},19091),(0,l.jsxs)(D.SC,{children:[l.jsx(D.pj,{className:"font-medium capitalize",children:"External ID"}),l.jsx(D.pj,{children:l.jsx(S.Wi,{control:em.control,name:"external_id",render:({field:e})=>l.jsx(S.xJ,{children:ep?(0,l.jsxs)(l.Fragment,{children:[l.jsx(S.NI,{children:l.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{console.log("e",e),s({...t,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:t.external_id??""})}),l.jsx(S.zG,{})]}):l.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.external_id??""),a({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:t.external_id??""})})})})]},"externalId"),H?.fields?.length&&H.fields.map((e,r)=>(0,l.jsxs)(D.SC,{children:[(0,l.jsxs)(D.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&l.jsx("span",{className:"text-sm text-muted-foreground",children:"Calculated"}),e.processor&&(0,l.jsxs)(L.u,{children:[l.jsx(L.aJ,{asChild:!0,children:(0,l.jsxs)(z.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{ec({variables:{item:t?.id,field:e.name}})},disabled:eu.loading,children:[eu.loading?l.jsx(_.g,{}):l.jsx(g.Z,{className:"size-4"}),l.jsx("span",{className:"ml-2",children:"Process"})]})}),l.jsx(L._v,{className:"max-w-xs",children:e.processor.description})]})]}),ep?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?l.jsx(S.Wi,{control:em.control,name:e.name,render:({field:a})=>(0,l.jsxs)(S.xJ,{children:[l.jsx(S.NI,{children:(0,l.jsxs)("div",{className:"relative",children:[l.jsx(Z.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:a=>{s({...t,[e.name]:a.target.value})},value:t[e.name]??""}),(0,l.jsxs)(M.Vq,{children:[l.jsx(M.hg,{asChild:!0,children:(0,l.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:e.name,disabled:!1,value:t[e.name]??""}),children:[l.jsx(p.Z,{className:"h-3 w-3"}),l.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,l.jsxs)(M.cZ,{className:"max-w-4xl max-h-[80vh]",children:[l.jsx(M.fK,{children:(0,l.jsxs)(M.$N,{children:["Edit ",e.name]})}),l.jsx("div",{className:"mt-4",children:l.jsx(Z.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name===e.name?ef.value:t[e.name]??"",onChange:a=>{let l=a.target.value;ej(t=>t?.name===e.name?{...t,value:l}:t),s({...t,[e.name]:l})}})})]})]})]})}),l.jsx(S.zG,{})]})}):null,"number"===e.type?l.jsx(S.Wi,{control:em.control,name:e.name,render:({field:a})=>(0,l.jsxs)(S.xJ,{children:[l.jsx(S.NI,{children:l.jsx(E.I,{id:e.name,type:"number",onChange:a=>{s({...t,[e.name]:a.target.value})},value:t[e.name]??""})}),l.jsx(S.zG,{})]})}):null,"boolean"===e.type?l.jsx(S.Wi,{control:em.control,name:e.name,render:({field:a})=>(0,l.jsxs)(S.xJ,{children:[l.jsx(S.NI,{children:l.jsx(O.r,{checked:!!a.value,onCheckedChange:a=>{s({...t,[e.name]:a})}})}),l.jsx(S.zG,{})]})}):null,"file"===e.type&&l.jsx("div",{children:l.jsx(B.jF,{s3key:t[e.name],children:l.jsx(B.ZP,{id:`item-${t.id}`,buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:a=>{console.log("keys",a),s({...t,[e.name]:a[0]})}})})})]})}):l.jsx(D.pj,{children:(0,l.jsxs)("span",{children:["code"===e.type&&l.jsx(w.G,{code:t[e.name]}),"json"===e.type&&l.jsx(w.G,{code:t[e.name],language:"json"}),"shortText"===e.type&&l.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),a({title:"Copied to clipboard"})},children:t[e.name]}),"longText"===e.type&&l.jsx(k.J,{text:t[e.name]}),"file"===e.type&&l.jsx(B.jF,{s3key:t[e.name]}),"markdown"===e.type&&l.jsx(k.J,{text:t[e.name]}),!e.type&&l.jsx(k.J,{text:t[e.name]}),"text"===e.type&&l.jsx(k.J,{text:t[e.name]}),"number"===e.type&&l.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),a({title:"Copied to clipboard"})},children:t[e.name]}),"boolean"===e.type&&l.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),a({title:"Copied to clipboard"})},children:t[e.name]??""})]})})]},r))]})]}),l.jsx(R.Z,{className:"my-4"})]})})}),l.jsx(V.Zb,{className:"bg-transparent",children:(0,l.jsxs)(W.zF,{children:[l.jsx(V.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:[l.jsx("p",{className:"text-base",children:"Access Control"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),l.jsx(W.wy,{asChild:!0,children:(0,l.jsxs)(z.z,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(f.Z,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Toggle"})]})})]})}),l.jsx(W.Fw,{className:"mt-5",children:l.jsx(V.aY,{className:"space-y-4",children:l.jsx(G.P,{initialRightsMode:t.rights_mode,initialUsers:t.RBAC?.users,initialRoles:t.RBAC?.roles,initialProjects:t.RBAC?.projects,onChange:(e,t,s,a)=>{X({rights_mode:e,users:t,roles:s,projects:a})}})})})]})}),(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:[l.jsx("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,l.jsxs)(P.h_,{modal:!1,children:[l.jsx(P.$F,{asChild:!0,children:(0,l.jsxs)(z.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[l.jsx(j.Z,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,l.jsxs)(P.AW,{align:"end",children:[l.jsx(P.Xi,{onClick:()=>ey("generate"),children:"Generate embeddings"}),l.jsx(P.Xi,{onClick:()=>ey("delete"),children:"Delete embeddings"})]})]})]}),(0,l.jsxs)(D.iA,{children:[l.jsx(D.Rn,{children:t?.chunks?.length?"A list of all embeddings for this item.":"No embeddings found."}),l.jsx(D.xD,{children:(0,l.jsxs)(D.SC,{children:[l.jsx(D.ss,{children:"Index"}),l.jsx(D.ss,{children:"Content"}),l.jsx(D.ss,{children:"Dimensions"}),l.jsx(D.ss,{children:"Created At"}),l.jsx(D.ss,{children:"Updated At"})]})}),l.jsx(D.RM,{children:t?.chunks?.length?t?.chunks?.length&&t.chunks.map(e=>(0,l.jsxs)(D.SC,{children:[l.jsx(D.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),l.jsx(D.pj,{children:l.jsx(k.J,{text:e.content})}),l.jsx(D.pj,{children:e.embedding_size||0}),l.jsx(D.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),l.jsx(D.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.id)):null})]})]})]})]})})]}):(0,l.jsxs)(l.Fragment,{children:[" ",!t&&e.itemId?l.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):l.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),l.jsx(q.aR,{open:"generate"===ev,onOpenChange:e=>!e&&ey(null),children:(0,l.jsxs)(q._T,{children:[(0,l.jsxs)(q.fY,{children:[l.jsx(q.f$,{children:"Generate Embeddings"}),l.jsx(q.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)(q.xo,{children:[l.jsx(q.le,{children:"Cancel"}),l.jsx(q.OL,{disabled:ei.loading,onClick:()=>{t?.id&&(console.log("Generate embeddings for item:",t?.id),ey(null),en({variables:{where:{id:{eq:t?.id}}}}))},children:"Generate"})]})]})}),l.jsx(q.aR,{open:"delete"===ev,onOpenChange:e=>!e&&ey(null),children:(0,l.jsxs)(q._T,{children:[(0,l.jsxs)(q.fY,{children:[l.jsx(q.f$,{children:"Delete Embeddings"}),l.jsx(q.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,l.jsxs)(q.xo,{children:[l.jsx(q.le,{children:"Cancel"}),l.jsx(q.OL,{disabled:eo.loading,onClick:async()=>{t?.id&&(console.log("Delete embeddings for item:",t?.id),ey(null),ed({variables:{where:{id:{eq:t?.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}w=(J.then?(await J)():J)[0],a()}catch(e){a(e)}})},18440:(e,t,s)=>{"use strict";s.d(t,{U:()=>S});var a=s(10326),l=s(39167),r=s(18753),n=s(86333),i=s(35047),d=s(17577),o=s(567),c=s(90772),u=s(33071),x=s(8281),m=s(65685),h=s(32663),p=s(90434),g=s(29718),f=s(42270),j=s(15940),v=s(75290);function y({contextId:e}){let t=(0,d.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:s,data:r,refetch:n,previousData:i,error:c}=(0,l.aM)((0,f.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:1,limit:5,filters:[{embeddings_updated_at:{gte:t.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),x=r?.[e+f.Md];return s?a.jsx(u.Zb,{children:a.jsx(u.aY,{className:"pt-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(v.Z,{className:"h-6 w-6 animate-spin"})})})}):(0,a.jsxs)(u.Zb,{className:"border-0 rounded-none",children:[a.jsx(u.Ol,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{children:[a.jsx(u.ll,{children:"Recent Embeddings"}),a.jsx(u.SZ,{children:"Items with embeddings updated in the last 21 days"})]}),s&&a.jsx(v.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),(0,a.jsxs)(o.C,{variant:"outline",className:"gap-1.5",children:[a.jsx("span",{className:"text-xs",children:x?.items?.length||0}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"items"})]})]})}),a.jsx(u.aY,{children:a.jsx("div",{className:"border rounded-lg",children:x?.items?.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No recent embeddings"}):(0,a.jsxs)(j.iA,{children:[a.jsx(j.xD,{children:(0,a.jsxs)(j.SC,{children:[a.jsx(j.ss,{children:"Name"}),a.jsx(j.ss,{className:"text-right",children:"Updated"})]})}),a.jsx(j.RM,{children:x?.items?.map((t,s)=>a.jsxs(j.SC,{children:[a.jsx(j.pj,{className:"font-medium",children:a.jsx(p.default,{className:"hover:text-blue-500 hover:underline",href:`/data/${e}/${t.id}`,children:a.jsx(g.L,{text:t.name||t.id||"",length:50})})}),a.jsx(j.pj,{className:"text-right text-sm text-muted-foreground",children:t.embeddings_updated_at?h.Q(new Date(t.embeddings_updated_at),{addSuffix:!0}):"never"})]},s))})]})})})]})}var b=s(43273),N=s(65304),w=s(76812),k=s(99440),C=s(34789),z=s(18286);function S(e){let[t,s]=(0,d.useState)(null),[h,p]=(0,d.useState)(!0),[g,j]=(0,d.useState)(!0),{toast:v}=(0,C.pm)(),{data:S,loading:E,error:_}=(0,l.aM)(f.fV,{variables:{id:e.context}}),R=S?.contextById,O=(0,i.useRouter)(),[D,Z]=(0,r.D)(f.xR,{onCompleted:e=>{I(),v({title:"Embedder configs updated",description:"Embedder configs updated successfully."})},onError:e=>{I(),v({title:"Error updating embedder configs",description:e.message})}}),[L,M]=(0,r.D)(f.s7,{onCompleted:e=>{I(),v({title:"Embedder configs created",description:"Embedder configs created successfully."})},onError:e=>{I(),v({title:"Error creating embedder configs",description:e.message})}}),{data:P,loading:q,refetch:I}=(0,l.aM)(f.c2,{skip:!R?.embedder?.id,variables:{context:e.context,embedder:R?.embedder?.id}}),T=P?.embedder_settingsPagination?.items||[],{data:A}=(0,l.aM)(f.Az,{variables:{page:1,limit:100}}),F=A?.variablesPagination?.items||[],[$,U]=(0,r.D)((0,f.Eq)(e.context),{onCompleted:t=>{let s=t[e.context+"_itemsGenerateChunks"];if(s.jobs?.length>0){v({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}v({title:"Chunks generated",description:"Chunks generated successfully."})}}),[G,W]=(0,r.D)((0,f.ps)(e.context),{onCompleted:t=>{let s=t[e.context+"_itemsDeleteChunks"];if(s.jobs?.length>0){v({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}v({title:"Chunks deleted",description:"Chunks deleted successfully."})}});return E?(0,a.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[a.jsx(N.O,{className:"w-full h-[80px] rounded-md"}),a.jsx(N.O,{className:"w-full h-[50px] rounded-md mt-3"}),a.jsx(N.O,{className:"w-full h-[80px] rounded-md mt-3"}),a.jsx(N.O,{className:"w-full h-[80px] rounded-md mt-3"}),a.jsx(N.O,{className:"w-full h-[80px] rounded-md mt-3"}),a.jsx(N.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):_?(0,a.jsxs)(b.bZ,{variant:"destructive",children:[a.jsx(w.LPM,{className:"size-4"}),a.jsx(b.Cd,{children:"Error"}),a.jsx(b.X,{children:_?.message||"Error loading item."})]}):(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex p-2 justify-between",children:[a.jsx("div",{className:"flex items-center gap-2"}),(0,a.jsxs)(c.z,{onClick:()=>{O.push("/context")},variant:"ghost",size:"icon",children:[a.jsx(n.Z,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Back"})]})]}),a.jsx(x.Z,{})]}):null,R?(0,a.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,a.jsxs)(u.Zb,{className:"border-0 rounded-none",children:[a.jsx(u.Ol,{children:a.jsx(u.ll,{className:"text-lg",children:"Settings"})}),a.jsx(u.aY,{className:"grid gap-4",children:a.jsx(m.x,{className:"max-h-[600px]",children:(0,a.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,a.jsxs)("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:R.name}),a.jsx("p",{className:"text-muted-foreground mt-1",children:R.description}),(0,a.jsxs)("div",{className:"mt-3 flex items-center",children:[a.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,a.jsxs)(o.C,{variant:"outline",children:[R.embedder?.name||"None"," (",R.embedder?.id,")"]})]})]}),(0,a.jsxs)("div",{children:[a.jsx("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),a.jsx(o.C,{variant:"secondary",children:R.configuration?.calculateVectors?R.configuration.calculateVectors.charAt(0).toUpperCase()+R.configuration.calculateVectors.slice(1):"Manual"}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{className:"block",children:[a.jsx("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,a.jsxs)("span",{className:"block",children:[a.jsx("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,a.jsxs)("span",{className:"block",children:[a.jsx("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,a.jsxs)("span",{className:"block",children:[a.jsx("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,a.jsxs)("div",{children:[a.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder Configs:"}),a.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:F?.length&&R?.embedder?.config?.map(t=>{let s=T?.find(e=>e.name===t.name);return console.log("currentValue",s),console.log("embedderConfigs",T),console.log("config",t),a.jsxs("div",{className:"space-y-2",children:[a.jsx(z.f,{configItem:t,currentValue:s?.value||"",variables:F,onVariableSelect:a=>{console.log("variableName",a),s?D({variables:{id:s.id,name:t.name,value:a}}):L({variables:{name:t.name,value:a,context:e.context,embedder:R?.embedder?.id}})}}),a.jsx("span",{children:t.description})]},t.name)})})]})]})})})]}),a.jsx(y,{contextId:R.id})]}):a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),a.jsx(k.aR,{open:"generate"===t,onOpenChange:e=>!e&&s(null),children:(0,a.jsxs)(k._T,{children:[(0,a.jsxs)(k.fY,{children:[a.jsx(k.f$,{children:"Generate Embeddings"}),a.jsx(k.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,a.jsxs)(k.xo,{children:[a.jsx(k.le,{children:"Cancel"}),a.jsx(k.OL,{disabled:U.loading,onClick:()=>{s(null),$(),v({title:"Generating embeddings...",description:"Embeddings are being generated in the background, depending on the size of the item this may take a while."})},children:"Generate"})]})]})}),a.jsx(k.aR,{open:"delete"===t,onOpenChange:e=>!e&&s(null),children:(0,a.jsxs)(k._T,{children:[(0,a.jsxs)(k.fY,{children:[a.jsx(k.f$,{children:"Delete Embeddings"}),a.jsx(k.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,a.jsxs)(k.xo,{children:[a.jsx(k.le,{children:"Cancel"}),a.jsx(k.OL,{disabled:W.loading,onClick:async()=>{s(null),G(),v({title:"Embeddings deleted",description:"All embeddings for this item have been deleted."})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}},5096:(e,t,s)=>{"use strict";s.d(t,{L:()=>_});var a=s(10326),l=s(39167),r=s(18753),n=s(86333),i=s(94893),d=s(941),o=s(75290),c=s(35047),u=s(17577),x=s(90772),m=s(33071),h=s(8281),p=s(65685),g=s(54432),f=s(31048),j=s(24295),v=s(15940),y=s(567),b=s(68232),N=s(62288),w=s(42270),k=s(43273),C=s(65304),z=s(76812),S=s(19753),E=s(85999);function _(e){let[t,s]=(0,u.useState)(!0),[_,R]=(0,u.useState)(!1),[O,D]=(0,u.useState)(null),[Z,L]=(0,u.useState)({}),{data:M,loading:P,error:q}=(0,l.aM)(w.fV,{variables:{id:e.context}}),I=M?.contextById,T=(0,c.useRouter)(),[A,{loading:F}]=(0,r.D)((0,w.C3)(e.context),{onCompleted:t=>{let s=t[`${e.context}_itemsExecuteSource`];R(!1),D(null),L({}),E.Am.success(s.message||"Source executed successfully",{description:s.jobs?.length?`${s.jobs.length} job(s) scheduled`:s.items?.length?`${s.items.length} item(s) processed`:void 0})},onError:e=>{E.Am.error("Failed to execute source",{description:e.message})}}),$=(e,t,s,a)=>{if(D({id:e,name:t,queue:s,params:a}),a){let e={};a.forEach(t=>{e[t.name]=t.default||""}),L(e)}R(!0)};if(P)return(0,a.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[a.jsx(C.O,{className:"w-full h-[80px] rounded-md"}),a.jsx(C.O,{className:"w-full h-[50px] rounded-md mt-3"}),a.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),a.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),a.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),a.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"})]});if(q)return(0,a.jsxs)(k.bZ,{variant:"destructive",children:[a.jsx(z.LPM,{className:"size-4"}),a.jsx(k.Cd,{children:"Error"}),a.jsx(k.X,{children:q?.message||"Error loading item."})]});let U=[];return I&&(U=Array.from(new Set(I.sources.map(e=>e.config.queue).filter(e=>!!e)))),(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex p-2 justify-between",children:[a.jsx("div",{className:"flex items-center gap-2"}),(0,a.jsxs)(x.z,{onClick:()=>{T.push("/context")},variant:"ghost",size:"icon",children:[a.jsx(n.Z,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Back"})]})]}),a.jsx(h.Z,{})]}):null,I?(0,a.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,a.jsxs)(m.Zb,{className:"border-0 rounded-none",children:[a.jsx(m.Ol,{children:a.jsx(m.ll,{className:"text-lg",children:"Settings"})}),a.jsx(m.aY,{className:"grid gap-4",children:a.jsx(p.x,{className:"max-h-[600px]",children:a.jsx("div",{className:"space-y-6 pr-4",children:(0,a.jsxs)("div",{children:[a.jsx("h2",{className:"text-xl font-bold",children:I.name}),a.jsx("p",{className:"text-muted-foreground mt-1",children:I.description})]})})})})]}),(0,a.jsxs)(m.Zb,{className:"border-0 rounded-none",children:[(0,a.jsxs)(m.Ol,{children:[a.jsx(m.ll,{children:"Sources"}),a.jsx(m.SZ,{children:"Sources are used to fetch external data and ingest them into the context."})]}),a.jsx(m.aY,{children:I.sources&&I.sources.length>0?a.jsx(b.pn,{children:a.jsx("div",{className:"rounded-md border",children:(0,a.jsxs)(v.iA,{children:[a.jsx(v.xD,{children:(0,a.jsxs)(v.SC,{children:[a.jsx(v.ss,{children:"Name"}),a.jsx(v.ss,{children:"Description"}),a.jsx(v.ss,{children:"Queue Configuration"}),a.jsx(v.ss,{className:"text-right",children:"Actions"})]})}),a.jsx(v.RM,{children:I.sources.map(e=>{let t=e.config.queue||e.config.schedule||void 0!==e.config.retries||e.config.backoff;return(0,a.jsxs)(v.SC,{children:[a.jsx(v.pj,{className:"font-medium",children:e.name}),a.jsx(v.pj,{className:"max-w-[300px]",children:e.description||"-"}),a.jsx(v.pj,{children:t?(0,a.jsxs)(b.u,{children:[a.jsx(b.aJ,{asChild:!0,children:a.jsx("div",{className:"cursor-help",children:e.config.queue?a.jsx(y.C,{variant:"outline",className:"cursor-help",children:e.config.queue}):a.jsx("span",{className:"text-muted-foreground",children:"No queue configured"})})}),a.jsx(b._v,{className:"max-w-[300px]",children:(0,a.jsxs)("div",{className:"space-y-2",children:[e.config.queue&&(0,a.jsxs)("div",{children:[a.jsx("span",{className:"font-semibold text-xs",children:"Queue:"}),a.jsx("span",{className:"ml-2 text-xs",children:e.config.queue})]}),e.config.schedule&&(0,a.jsxs)("div",{children:[a.jsx("span",{className:"font-semibold text-xs",children:"Schedule:"}),a.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,a.jsxs)("div",{children:[a.jsx("span",{className:"font-semibold text-xs",children:"Retries:"}),a.jsx("span",{className:"ml-2 text-xs",children:e.config.retries||"Default (3)"})]}),e.config.backoff&&(0,a.jsxs)("div",{children:[a.jsx("span",{className:"font-semibold text-xs",children:"Backoff:"}),(0,a.jsxs)("span",{className:"ml-2 text-xs",children:[e.config.backoff.type||"Default (exponential)"," (",e.config.backoff.delay||"Default (2000)","ms)"]})]})]})})]}):a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(v.pj,{className:"text-right",children:a.jsx(x.z,{variant:"ghost",size:"sm",onClick:()=>$(e.id,e.name,e.config.queue,e.config.params),title:"Manually trigger source",children:a.jsx(i.Z,{className:"h-4 w-4"})})})]},e.id)})})]})})}):a.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No sources found."})})]}),a.jsx(j.zF,{open:t,onOpenChange:s,children:(0,a.jsxs)(m.Zb,{className:"bg-none border-0 rounded-none",children:[a.jsx(m.Ol,{children:a.jsx(j.wy,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[a.jsx(m.ll,{children:"Queues"}),(0,a.jsxs)(x.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[a.jsx(d.Z,{className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),a.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),a.jsx(j.Fw,{children:a.jsx(m.aY,{children:U.length>0?a.jsx("div",{className:"space-y-4",children:U.map(e=>a.jsx("div",{children:a.jsx(S.R,{queueName:e,nameGenerator:e=>"Source update",retryJob:e=>{if(!e.data?.source||!e.data?.context)return}})},e))}):a.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),a.jsx(N.Vq,{open:_,onOpenChange:e=>{R(e),e||(L({}),D(null))},children:(0,a.jsxs)(N.cZ,{children:[(0,a.jsxs)(N.fK,{children:[a.jsx(N.$N,{children:"Trigger Source"}),a.jsx(N.Be,{children:O?.queue?(0,a.jsxs)(a.Fragment,{children:["Are you sure you want to trigger ",a.jsx("strong",{children:O.name}),"?",a.jsx("br",{}),a.jsx("br",{}),"A job will be scheduled and visible in the ",a.jsx(y.C,{variant:"outline",className:"mx-1",children:O.queue})," queue."]}):(0,a.jsxs)(a.Fragment,{children:["Are you sure you want to trigger ",a.jsx("strong",{children:O?.name}),"?",a.jsx("br",{}),a.jsx("br",{}),"The source will be executed immediately without queuing."]})})]}),O?.params&&O.params.length>0&&(0,a.jsxs)("div",{className:"space-y-4 py-4",children:[a.jsx("div",{className:"text-sm font-medium",children:"Parameters"}),O.params.map(e=>(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(f._,{htmlFor:e.name,children:[e.name,e.description&&a.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:e.description})]}),a.jsx(g.I,{id:e.name,value:Z[e.name]||"",onChange:t=>{L(s=>({...s,[e.name]:t.target.value}))},placeholder:e.default||"",disabled:F})]},e.name))]}),(0,a.jsxs)(N.cN,{children:[a.jsx(x.z,{variant:"outline",onClick:()=>R(!1),disabled:F,children:"Cancel"}),a.jsx(x.z,{onClick:()=>{O&&A({variables:{source:O.id,inputs:Z}})},disabled:F,children:F?(0,a.jsxs)(a.Fragment,{children:[a.jsx(o.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Executing..."]}):(0,a.jsxs)(a.Fragment,{children:[a.jsx(i.Z,{className:"mr-2 h-4 w-4"}),"Trigger Source"]})})]})]})})]})}},42193:(e,t,s)=>{"use strict";s.d(t,{z:()=>f});var a=s(10326),l=s(17577),r=s(76812),n=s(57305),i=s(92977),d=s(98181),o=s(77863),c=s(90772),u=s(11890),x=s(39183),m=s(17757);function h({className:e,classNames:t,showOutsideDays:s=!0,...l}){return a.jsx(m._W,{showOutsideDays:s,className:(0,o.cn)("p-3",e),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,o.cn)((0,c.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,o.cn)((0,c.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",...t},components:{IconLeft:({...e})=>a.jsx(u.Z,{className:"size-4"}),IconRight:({...e})=>a.jsx(x.Z,{className:"size-4"})},...l})}h.displayName="Calendar";var p=s(34789),g=s(30811);function f({dateRange:e,onDateRangeChange:t,className:s,maxDays:u=30}){let{toast:x}=(0,p.pm)(),m=l.useMemo(()=>{if(!e?.from)return[];let t=e.from;return[{before:(0,i.E)(t,-u)},{after:(0,i.E)(t,u)}]},[e?.from,u]);return a.jsx("div",{className:(0,o.cn)("grid gap-2",s),children:(0,a.jsxs)(g.J2,{children:[a.jsx(g.xo,{asChild:!0,children:(0,a.jsxs)(c.z,{id:"date",variant:"outline",className:(0,o.cn)("w-[260px] justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[a.jsx(r.Que,{className:"mr-2 h-4 w-4"}),e?.from?e.to?(0,a.jsxs)(a.Fragment,{children:[(0,d.WU)(e.from,"LLL dd, y")," -"," ",(0,d.WU)(e.to,"LLL dd, y")]}):(0,d.WU)(e.from,"LLL dd, y"):a.jsx("span",{children:"Pick a date range"})]})}),(0,a.jsxs)(g.yk,{className:"w-auto p-0",align:"end",children:[a.jsx(h,{initialFocus:!0,mode:"range",defaultMonth:e?.from,selected:e,onSelect:e=>{if(e?.from&&e?.to&&(0,n.j)(e.to,e.from)>u){x({title:"Date range too large",description:`Please select a date range of ${u} days or less.`,variant:"destructive"});return}t(e)},disabled:m,numberOfMonths:2}),(0,a.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",u," days"]})]})]})})}},22746:(e,t,s)=>{"use strict";s.d(t,{Y:()=>h});var a=s(10326),l=s(17577),r=s(39167),n=s(34474),i=s(65304),d=s(42270),o=s(20751),c=s(78948),u=s(99630),x=s(90250);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({groupByOptions:e,dateRange:t,selectedType:s,groupBy:h,onGroupByChange:p,unit:g}){let{data:f,loading:j,error:v}=(0,r.aM)(d.YH,{variables:{type:s,groupBy:h,from:t?.from?.toISOString(),to:t?.to?.toISOString(),names:"tokens"===g?["inputTokens","outputTokens"]:["count"]},skip:!t?.from||!t?.to}),{chartData:y,chartConfig:b}=l.useMemo(()=>{if(!f?.trackingStatistics)return{chartData:[],chartConfig:{}};let e=f.trackingStatistics.map((e,t)=>{var s;return{name:(s=e?.group)&&"string"==typeof s?s.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:e?.count,fill:m[t%m.length]}}).sort((e,t)=>t.value-e.value),t=e.reduce((e,t,s)=>(e[t.name]={label:t.name,color:m[s%m.length]},e),{});return{chartData:e,chartConfig:t}},[f]);return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"Distribution"}),e.length>0&&a.jsx("div",{className:"w-full max-w-[150px]",children:(0,a.jsxs)(n.Ph,{value:h,onValueChange:p,children:[a.jsx(n.i4,{children:a.jsx(n.ki,{placeholder:"Group by"})}),a.jsx(n.Bw,{children:e.map(e=>a.jsx(n.Ql,{value:e.value,children:e.label},e.value))})]})})]}),a.jsx("div",{className:"flex-1 min-h-0",children:j?a.jsx("div",{className:"space-y-4 h-full",children:a.jsx(i.O,{className:"h-full w-full"})}):v?(0,a.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",v.message]}):0===y.length?a.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."}):a.jsx(x.BO,{config:b,className:"h-full w-full",children:(0,a.jsxs)(o.u,{children:[a.jsx("defs",{children:y.map((e,t)=>(0,a.jsxs)("radialGradient",{id:`gradient-${e.name.replace(/\s+/g,"-")}`,cx:"50%",cy:"50%",r:"50%",children:[a.jsx("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),a.jsx("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},`gradient-${t}`))}),a.jsx(c.b,{data:y,cx:"50%",cy:"50%",labelLine:!1,label:({cx:e,cy:t,midAngle:s,innerRadius:l,outerRadius:r,percent:n,index:i})=>{if(n<.05)return null;let d=Math.PI/180,o=l+(r-l)*.5,c=e+o*Math.cos(-s*d);return a.jsx("text",{x:c,y:t+o*Math.sin(-s*d),fill:"black",textAnchor:c>e?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:`${(100*n).toFixed(0)}%`})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:y.map((e,t)=>a.jsx(u.b,{fill:`url(#gradient-${e.name.replace(/\s+/g,"-")})`},`cell-${t}`))}),a.jsx(x.h7,{content:a.jsx(x.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})})]})})})]})}},16923:(e,t,s)=>{"use strict";s.d(t,{q:()=>y});var a=s(10326),l=s(17577),r=s(39167),n=s(34474),i=s(65304),d=s(42270),o=s(10669),c=s(18423),u=s(62637),x=s(9997),m=s(47445),h=s(90250),p=s(98181),g=s(99515),f=s(32067);function j(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let v={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function y({dataTypes:e,dateRange:t,selectedType:s,onTypeChange:y,onUnitChange:b,unit:N,unitOptions:w}){let{data:k,loading:C,error:z}=(0,r.aM)(d.j9,{variables:{type:s,name:N,from:t?.from?.toISOString(),to:t?.to?.toISOString(),names:[N]},skip:!t?.from||!t?.to}),S=l.useMemo(()=>{if(!k?.trackingStatistics||!t?.from||!t?.to)return[];let e=new Map;return k.trackingStatistics.forEach(t=>{let s=new Date("number"==typeof t.group?t.group:Number(t.group)),a=(0,p.WU)((0,g.b)(s),"yyyy-MM-dd");e.set(a,t.count)}),(0,f.D)({start:(0,g.b)(t.from),end:(0,g.b)(t.to)}).map(t=>{let s=(0,p.WU)(t,"yyyy-MM-dd"),a=e.get(s)||0;return{date:t.getTime(),count:a,formattedDate:(0,p.WU)(t,"MMM dd"),dateObj:t}})},[k,t]);return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-[150px]",children:(0,a.jsxs)(n.Ph,{value:s,onValueChange:e=>y(e),children:[a.jsx(n.i4,{children:a.jsx(n.ki,{placeholder:"Select data type"})}),a.jsx(n.Bw,{children:e?.map(e=>a.jsx(n.Ql,{value:e,children:j(e)+" "},e))})]})}),w?.length>1&&a.jsx("div",{className:"w-[150px]",children:(0,a.jsxs)(n.Ph,{value:N,onValueChange:e=>b(e),children:[a.jsx(n.i4,{children:a.jsx(n.ki,{placeholder:"Select unit"})}),a.jsx(n.Bw,{children:w?.map(e=>a.jsx(n.Ql,{value:e.value,children:e.label},e.value))})]})})]})]}),a.jsx("div",{className:"flex-1 min-h-0",children:C?a.jsx("div",{className:"space-y-4 h-full",children:a.jsx(i.O,{className:"h-full w-full"})}):z?(0,a.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===S.length?a.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):a.jsx(h.BO,{config:v,className:"h-full w-full",children:(0,a.jsxs)(o.T,{data:S,children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),a.jsx("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,a.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[a.jsx("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),a.jsx("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),a.jsx(c.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),a.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}}),a.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}}),a.jsx(h.h7,{labelFormatter:(e,t)=>t&&t[0]?(0,p.WU)(t[0].payload.dateObj,"PPP")+" ":e,content:a.jsx(h.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})}),a.jsx(h.Qk,{content:a.jsx(h.cD,{})}),a.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:j(s)})]})})})]})}},29718:(e,t,s)=>{"use strict";s.d(t,{L:()=>l});var a=s(10326);function l({text:e,length:t}){return e.length>t?(0,a.jsxs)(a.Fragment,{children:[e.slice(0,t),"..."]}):a.jsx(a.Fragment,{children:e})}},99440:(e,t,s)=>{"use strict";s.d(t,{OL:()=>g,_T:()=>u,aR:()=>d,f$:()=>h,fY:()=>x,le:()=>f,xo:()=>m,yT:()=>p});var a=s(10326),l=s(12194),r=s(17577),n=s(90772),i=s(77863);let d=l.fC;l.xz;let o=l.h_,c=r.forwardRef(({className:e,...t},s)=>a.jsx(l.aV,{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),...t,ref:s}));c.displayName=l.aV.displayName;let u=r.forwardRef(({className:e,...t},s)=>(0,a.jsxs)(o,{children:[a.jsx(c,{}),a.jsx(l.VY,{ref:s,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),...t})]}));u.displayName=l.VY.displayName;let x=({className:e,...t})=>a.jsx("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});x.displayName="AlertDialogHeader";let m=({className:e,...t})=>a.jsx("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});m.displayName="AlertDialogFooter";let h=r.forwardRef(({className:e,...t},s)=>a.jsx(l.Dx,{ref:s,className:(0,i.cn)("text-lg font-semibold",e),...t}));h.displayName=l.Dx.displayName;let p=r.forwardRef(({className:e,...t},s)=>a.jsx(l.dk,{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",e),...t}));p.displayName=l.dk.displayName;let g=r.forwardRef(({className:e,...t},s)=>a.jsx(l.aU,{ref:s,className:(0,i.cn)((0,n.d)(),e),...t}));g.displayName=l.aU.displayName;let f=r.forwardRef(({className:e,...t},s)=>a.jsx(l.$j,{ref:s,className:(0,i.cn)((0,n.d)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));f.displayName=l.$j.displayName},43273:(e,t,s)=>{"use strict";s.d(t,{Cd:()=>o,X:()=>c,bZ:()=>d});var a=s(10326),l=s(79360),r=s(17577),n=s(77863);let i=(0,l.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",info:"border-info/50 text-info dark:border-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}}),d=r.forwardRef(({className:e,variant:t,...s},l)=>a.jsx("div",{ref:l,role:"alert",className:(0,n.cn)(i({variant:t}),e),...s}));d.displayName="Alert";let o=r.forwardRef(({className:e,...t},s)=>a.jsx("h5",{ref:s,className:(0,n.cn)("mb-1 font-medium leading-none tracking-tight",e),...t}));o.displayName="AlertTitle";let c=r.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:(0,n.cn)("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription"},90250:(e,t,s)=>{"use strict";s.d(t,{BO:()=>x,Qk:()=>g,cD:()=>f,dg:()=>p,h7:()=>h});var a=s(10326),l=s(17577),r=s(30660),n=s(44675),i=s(69274),d=s(77863);let o={light:"",dark:".dark"},c=l.createContext(null);function u(){let e=l.useContext(c);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let x=l.forwardRef(({id:e,className:t,children:s,config:n,...i},o)=>{let u=l.useId(),x=`chart-${e||u.replace(/:/g,"")}`;return a.jsx(c.Provider,{value:{config:n},children:(0,a.jsxs)("div",{"data-chart":x,ref:o,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",t),...i,children:[a.jsx(m,{id:x,config:n}),a.jsx(r.h,{children:s})]})})});x.displayName="Chart";let m=({id:e,config:t})=>{let s=Object.entries(t).filter(([,e])=>e.theme||e.color);return s.length?a.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(o).map(([t,a])=>`
|
|
2
|
-
${
|
|
3
|
-
${s.map(([e,s])=>{let
|
|
1
|
+
(()=>{var e={};e.id=6050,e.ids=[6050],e.modules={57343:e=>{"use strict";e.exports=require("graphql")},72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},27790:e=>{"use strict";e.exports=require("assert")},78893:e=>{"use strict";e.exports=require("buffer")},61282:e=>{"use strict";e.exports=require("child_process")},84770:e=>{"use strict";e.exports=require("crypto")},80665:e=>{"use strict";e.exports=require("dns")},17702:e=>{"use strict";e.exports=require("events")},92048:e=>{"use strict";e.exports=require("fs")},32615:e=>{"use strict";e.exports=require("http")},35240:e=>{"use strict";e.exports=require("https")},98216:e=>{"use strict";e.exports=require("net")},19801:e=>{"use strict";e.exports=require("os")},55315:e=>{"use strict";e.exports=require("path")},86624:e=>{"use strict";e.exports=require("querystring")},76162:e=>{"use strict";e.exports=require("stream")},82452:e=>{"use strict";e.exports=require("tls")},17360:e=>{"use strict";e.exports=require("url")},21764:e=>{"use strict";e.exports=require("util")},71568:e=>{"use strict";e.exports=require("zlib")},8678:e=>{"use strict";e.exports=import("pg")},48644:e=>{"use strict";e.exports=import("prettier/plugins/babel")},93801:e=>{"use strict";e.exports=import("prettier/plugins/estree")},45747:e=>{"use strict";e.exports=import("prettier/standalone")},49411:e=>{"use strict";e.exports=require("node:path")},97742:e=>{"use strict";e.exports=require("node:process")},41041:e=>{"use strict";e.exports=require("node:url")},39701:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{GlobalError:()=>d.a,__next_app__:()=>p,originalPathname:()=>m,pages:()=>h,routeModule:()=>g,tree:()=>x}),s(21114),s(76738);var n=s(71197);s(35866);var a=s(23191),l=s(88716),i=s(37922),d=s.n(i),c=s(95231),o={};for(let e in c)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>c[e]);s.d(t,o);var u=e([n]);n=(u.then?(await u)():u)[0];let x=["",{children:["(application)",{children:["data",{children:["[[...query]]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,21114)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"]}]},{layout:[()=>Promise.resolve().then(s.bind(s,76738)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(s.bind(s,71197)),"/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}]},{"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}],h=["/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx"],m="/(application)/data/[[...query]]/page",p={require:s,loadChunk:()=>Promise.resolve()},g=new a.AppPageRouteModule({definition:{kind:l.x.APP_PAGE,page:"/(application)/data/[[...query]]/page",pathname:"/data/[[...query]]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:x}});r()}catch(e){r(e)}})},71580:(e,t,s)=>{Promise.resolve().then(s.bind(s,21318))},82736:(e,t,s)=>{Promise.resolve().then(s.bind(s,26533))},21318:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eB});var r=s(10326),n=s(17577),a=s(76812),l=s(39167),i=s(18753),d=s(86508),c=s(11798),o=s(83855),u=s(23015),x=s(98091),h=s(40900),m=s(35047),p=s(15211),g=s(90772),f=s(53313),j=s(37859),v=s(65685),y=s(65304),b=s(15940),N=s(34789),w=s(77863),k=s(98181);let C=[{id:"select",header:({table:e})=>r.jsx(f.X,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all",className:"translate-y-[2px]"}),cell:({row:e})=>r.jsx(f.X,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row",className:"translate-y-[2px] max-w-[50px]"}),enableSorting:!1,enableHiding:!1},{accessorKey:"Description",cell:({row:e})=>(console.log("original",e.original),(0,r.jsxs)("div",{className:"flex flex-column grid grid-cols-1",children:[r.jsx("span",{className:"max-w-[500px] truncate font-medium w-full",children:e.original.name?e.original.name:e.original.text?.slice(0,200)||"Untitled"}),r.jsx("small",{className:"mt-1",children:(0,k.WU)(new Date(e.original.createdAt),"PP")})]}))}];var z=s(43273),S=s(88307),E=s(94019),_=s(54432);function O({onSearch:e=e=>console.log(`Search query: ${e}`),placeholder:t="Search...",className:s=""}){let[a,l]=(0,n.useState)("");return r.jsx("form",{onSubmit:t=>{t.preventDefault(),e(a)},className:`relative ${s}`,children:(0,r.jsxs)("div",{className:"relative flex items-center w-full",children:[r.jsx(S.Z,{className:"absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx(_.I,{type:"text",placeholder:t,value:a,onChange:e=>l(e.target.value),className:"pl-10 pr-10","aria-label":"Search input"}),a&&(0,r.jsxs)(r.Fragment,{children:[r.jsx("span",{className:"absolute right-10 text-xs text-muted-foreground",children:"Press Enter ↵"}),r.jsx(g.z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 h-full rounded-l-none",onClick:()=>{l(""),e("")},"aria-label":"Clear search",children:r.jsx(E.Z,{className:"h-4 w-4"})})]})]})})}var M=s(42270);function P({activeFolder:e,activeItem:t,archived:s}){let k=(0,m.usePathname)(),S=(0,m.useSearchParams)(),[E,_]=(0,n.useState)(S.get("page")?parseInt(S.get("page")):1),P=S.get("search"),{user:R}=(0,n.useContext)(p.S),{toast:D}=(0,N.pm)(),[q,I]=(0,n.useState)({...R.company}),A=(0,m.useRouter)(),[L,T]=n.useState({}),[Z,F]=n.useState({}),[$,G]=n.useState([]),[U,V]=n.useState([]),{loading:W,data:B,refetch:J,previousData:X,error:H}=(0,l.aM)((0,M.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:E??1,limit:10,sort:{field:"updatedAt",direction:"DESC"},filters:{archived:{eq:s},...P?{name:{contains:`${P}`}}:{}}}}),K=B?.[e+M.Md],Y=X?.[e+M.Md],[Q,ee]=(0,i.D)((0,M.ty)(e),{onCompleted:()=>{J()}}),[et,es]=(0,i.D)((0,M.mN)(e,[]),{onCompleted:()=>{J()}}),er=n.useMemo(()=>[],[]),{limit:en,onPaginationChange:ea,skip:el,pagination:ei}=function(){let[e,t]=(0,n.useState)({pageSize:5,pageIndex:0}),{pageSize:s,pageIndex:r}=e;return{limit:s,onPaginationChange:t,pagination:e,skip:s*r}}(),ed=(0,d.b7)({data:W&&Y?.items?Y.items:K?.items??er,pageCount:K?.pageInfo?.pageCount??-1,columns:C,state:{sorting:U,columnVisibility:Z,rowSelection:L,columnFilters:$},enableRowSelection:!0,onRowSelectionChange:T,onSortingChange:V,onColumnFiltersChange:G,onColumnVisibilityChange:F,getCoreRowModel:(0,c.sC)(),getFilteredRowModel:(0,c.vL)(),getPaginationRowModel:(0,c.G_)(),getSortedRowModel:(0,c.tj)(),getFacetedRowModel:(0,c.o6)(),getFacetedUniqueValues:(0,c.JG)(),manualPagination:!0,onPaginationChange:ea}),[ec,eo]=(0,i.D)((0,M.tO)(e),{onCompleted:t=>{console.log("data",t);let s=t?t[e+M.Wc]?.item?.id:void 0;s&&A.push(`/data/${e}/${s}`),J()}}),eu=({page:e,search:t})=>{_(e??1);let s=new URLSearchParams;e&&s.set("page",e.toString()),t&&s.set("search",t),A.push(`${k}?${s.toString()}`)},ex=t=>{s?A.push(`/data/${e}/archived/${t}?${S.toString()}`):A.push(`/data/${e}/${t}?${S.toString()}`)};return H?(0,r.jsxs)(z.bZ,{className:"p-4",variant:"destructive",children:[r.jsx(a.LPM,{className:"size-4"}),r.jsx(z.Cd,{children:"Error"}),r.jsx(z.X,{children:H?.message||": unknown"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-flow-col grid-cols-[auto_minmax(0,1fr)] grid-rows-1 bg-background/95 p-4 backdrop-blur gap-2 supports-[backdrop-filter]:bg-background/60",children:[r.jsx(f.X,{checked:ed.getIsAllPageRowsSelected()||ed.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:e=>ed.toggleAllPageRowsSelected(!!e),"aria-label":"Select all",className:"my-auto mr-3 translate-y-[2px]"}),r.jsx("div",{className:"relative",children:r.jsx(O,{onSearch:e=>{eu({page:1,search:e})}})}),r.jsx(g.z,{onClick:()=>{ec({variables:{input:{name:"New item",source:"manual",textlength:0,company:q.id}}})},disabled:eo.loading||s,className:"ml-2 ml-auto lg:flex",children:eo.loading?r.jsx(j.g,{}):r.jsx(o.Z,{size:18})})]}),ed.getIsSomeRowsSelected()||ed.getIsAllRowsSelected()?r.jsx("div",{className:"flex px-4 pb-4",children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(t=>{e.push(Q({variables:{id:t.original.id,input:{archived:!1}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),D({title:"Unarchived items",description:"We unarchived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?r.jsx(j.g,{}):r.jsx(u.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Unarchive selected"})]}),(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let t=[];ed.getSelectedRowModel().rows.forEach(s=>{t.push(et({variables:{context:e,id:s.original.id}}))}),Promise.all(t).then(()=>{ed.resetRowSelection(),D({title:"Deleted items",description:"We deleted "+t.length+" items."})})},variant:"secondary",disabled:es.loading,children:[es.loading?r.jsx(j.g,{}):r.jsx(x.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Delete selected"})]})]}):(0,r.jsxs)(g.z,{className:"ml-2",onClick:()=>{let e=[];ed.getSelectedRowModel().rows.forEach(t=>{e.push(Q({variables:{id:t.original?.id,input:{archived:!0}}}))}),Promise.all(e).then(()=>{ed.resetRowSelection(),D({title:"Archived items",description:"We archived "+e.length+" items."})})},variant:"secondary",disabled:ee.loading,children:[ee.loading?r.jsx(j.g,{}):r.jsx(h.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Archive selected"})]})}):null,W?r.jsx(v.x,{className:"h-screen",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 p-4 pt-0",children:[r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"mb-2 h-[100px] w-full rounded-lg"}),r.jsx(y.O,{className:"h-[100px] w-full rounded-lg"})]})}):(0,r.jsxs)("div",{className:"flex max-h-[75vh] flex-col",children:[r.jsx(v.x,{className:"h-screen grow",children:r.jsx("div",{className:"space-y-4",children:r.jsx("div",{className:"border-y",children:r.jsx(b.iA,{children:r.jsx(b.RM,{children:ed.getRowModel().rows?.length?ed.getRowModel().rows.map(e=>r.jsx(b.SC,{className:(0,w.cn)(t===e.original.id?"bg-secondary dark:text-white":""),"data-state":e.getIsSelected()&&"selected",children:e.getVisibleCells().map((t,s)=>s>0?r.jsx(b.pj,{className:"cursor-pointer",onClick:()=>{ex(e.original.id)},children:(0,d.ie)(t.column.columnDef.cell,t.getContext())},t.id):r.jsx(b.pj,{children:(0,d.ie)(t.column.columnDef.cell,t.getContext())},t.id))},e.id)):r.jsx(b.SC,{children:r.jsx(b.pj,{colSpan:C.length,className:"h-24 text-center",children:"No results."})})})})})})}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,r.jsxs)("div",{className:"flex-1 text-sm text-muted-foreground",children:[ed.getFilteredSelectedRowModel().rows.length," of"," ",ed.getFilteredRowModel().rows.length," row(s) selected (total"," ",K?.pageInfo.itemCount," items)."]}),r.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsxs)(g.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{eu({page:1,search:P??void 0})},disabled:!K?.pageInfo.hasPreviousPage,children:[r.jsx("span",{className:"sr-only",children:"Go to first page"}),r.jsx(a.kRt,{className:"size-4"})]}),(0,r.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{console.log("itemsData.data?.pageInfo.hasPreviousPage",K?.pageInfo.hasPreviousPage),eu({page:K?.pageInfo.hasPreviousPage?E-1:void 0,search:P??void 0})},disabled:!K?.pageInfo.hasPreviousPage||W,children:[r.jsx("span",{className:"sr-only",children:"Go to previous page"}),r.jsx(a.wyc,{className:"size-4"})]}),(0,r.jsxs)(g.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{eu({page:K?.pageInfo.hasNextPage?E+1:void 0,search:P??void 0})},disabled:!K?.pageInfo.hasNextPage||W,children:[r.jsx("span",{className:"sr-only",children:"Go to next page"}),r.jsx(a.XCv,{className:"size-4"})]})]})})]})]})]})}var R=s(76557);let D=(0,R.Z)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),{createElement:q,createContext:I,createRef:A,forwardRef:L,useCallback:T,useContext:Z,useEffect:F,useImperativeHandle:$,useLayoutEffect:G,useMemo:U,useRef:V,useState:W}=n,B=n["useId".toString()],J=I(null);J.displayName="PanelGroupContext";let X="function"==typeof B?B:()=>null,H=0;function K(e=null){let t=X(),s=V(e||t||null);return null===s.current&&(s.current=""+H++),null!=e?e:s.current}function Y({children:e,className:t="",collapsedSize:s,collapsible:r,defaultSize:n,forwardedRef:a,id:l,maxSize:i,minSize:d,onCollapse:c,onExpand:o,onResize:u,order:x,style:h,tagName:m="div",...p}){let g=Z(J);if(null===g)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:f,expandPanel:j,getPanelSize:v,getPanelStyle:y,groupId:b,isPanelCollapsed:N,reevaluatePanelConstraints:w,registerPanel:k,resizePanel:C,unregisterPanel:z}=g,S=K(l),E=V({callbacks:{onCollapse:c,onExpand:o,onResize:u},constraints:{collapsedSize:s,collapsible:r,defaultSize:n,maxSize:i,minSize:d},id:S,idIsFromProps:void 0!==l,order:x});V({didLogMissingDefaultSizeWarning:!1}),$(a,()=>({collapse:()=>{f(E.current)},expand:()=>{j(E.current)},getId:()=>S,getSize:()=>v(E.current),isCollapsed:()=>N(E.current),isExpanded:()=>!N(E.current),resize:e=>{C(E.current,e)}}),[f,j,v,N,S,C]);let _=y(E.current,n);return q(m,{...p,children:e,className:t,style:{..._,...h},"data-panel":"","data-panel-id":S,"data-panel-group-id":b,"data-panel-collapsible":void 0,"data-panel-size":void 0})}let Q=L((e,t)=>q(Y,{...e,forwardedRef:t}));function ee(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}function et(e,t,s=10){let r=(e=parseFloat(e.toFixed(s)))-(t=parseFloat(t.toFixed(s)));return 0===r?0:r>0?1:-1}function es(e,t,s){return 0===et(e,t,s)}function er({panelConstraints:e,panelIndex:t,size:s}){let r=e[t];ee(null!=r);let{collapsedSize:n=0,collapsible:a,maxSize:l=100,minSize:i=0}=r;return 0>et(s,i)&&(s=a&&0>et(s,(n+i)/2)?n:i),s=parseFloat((s=Math.min(l,s)).toFixed(10))}function en({delta:e,layout:t,panelConstraints:s,pivotIndices:r,trigger:n}){if(es(e,0))return t;let a=[...t],[l,i]=r;ee(null!=l),ee(null!=i);let d=0;if("keyboard"===n){{let r=e<0?i:l,n=s[r];if(ee(n),n.collapsible){let n=t[r];ee(null!=n);let a=s[r];ee(a);let{collapsedSize:l=0,minSize:i=0}=a;if(es(n,l)){let t=i-n;et(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?l:i,n=s[r];ee(n);let{collapsible:a}=n;if(a){let n=t[r];ee(null!=n);let a=s[r];ee(a);let{collapsedSize:l=0,minSize:i=0}=a;if(es(n,i)){let t=n-l;et(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,n=e<0?i:l,a=0;for(;;){let e=t[n];if(ee(null!=e),a+=er({panelConstraints:s,panelIndex:n,size:100})-e,(n+=r)<0||n>=s.length)break}let d=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-d:d}{let r=e<0?l:i;for(;r>=0&&r<s.length;){let n=Math.abs(e)-Math.abs(d),l=t[r];ee(null!=l);let i=er({panelConstraints:s,panelIndex:r,size:l-n});if(!es(l,i)&&(d+=l-i,a[r]=i,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(es(d,0))return t;{let r=e<0?i:l,n=t[r];ee(null!=n);let c=n+d,o=er({panelConstraints:s,panelIndex:r,size:c});if(a[r]=o,!es(o,c)){let t=c-o,r=e<0?i:l;for(;r>=0&&r<s.length;){let n=a[r];ee(null!=n);let l=er({panelConstraints:s,panelIndex:r,size:n+t});if(es(n,l)||(t-=l-n,a[r]=l),es(t,0))break;e>0?r--:r++}}}return es(a.reduce((e,t)=>t+e,0),100)?a:t}function ea(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function el(e,t,s=document){let r=ea(e,s).findIndex(e=>e.getAttribute("data-panel-resize-handle-id")===t);return null!=r?r:null}function ei(e,t,s){let r=el(e,t,s);return null!=r?[r,r+1]:[-1,-1]}function ed(e,t=document){var s;return t instanceof HTMLElement&&(null==t?void 0:null===(s=t.dataset)||void 0===s?void 0:s.panelGroupId)==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function ec(e,t=document){return t.querySelector(`[data-panel-resize-handle-id="${e}"]`)||null}function eo(e){return"keydown"===e.type}function eu(e){return e.type.startsWith("mouse")}function ex(e){return e.type.startsWith("touch")}function eh(e,t){let s="horizontal"===e;if(eu(t))return s?t.clientX:t.clientY;if(ex(t)){let e=t.touches[0];return ee(e),s?e.screenX:e.screenY}throw Error(`Unsupported event type "${t.type}"`)}function em(e,t,s){t.forEach((t,r)=>{let n=e[r];ee(n);let{callbacks:a,constraints:l,id:i}=n,{collapsedSize:d=0,collapsible:c}=l,o=s[i];if(null==o||t!==o){s[i]=t;let{onCollapse:e,onExpand:r,onResize:n}=a;n&&n(t,o),c&&(e||r)&&(r&&(null==o||o===d)&&t!==d&&r(),e&&(null==o||o!==d)&&t===d&&e())}})}function ep(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=t[s])return!1;return!0}Y.displayName="Panel",Q.displayName="forwardRef(Panel)";let eg=null,ef=null;function ej(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function ev(e){if(eg===e)return;eg=e;let t=ej(e);null===ef&&(ef=document.createElement("style"),document.head.appendChild(ef)),ef.innerHTML=`*{cursor: ${t}!important;}`}function ey(e){try{if("undefined"!=typeof localStorage)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function eb(e){return`react-resizable-panels:${e}`}function eN(e,t,s,r,n){var a;let l=eb(e),i=t.map(e=>{let{constraints:t,id:s,idIsFromProps:r,order:n}=e;return r?s:n?`${n}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(","),d=null!==(a=function(e,t){try{let s=eb(e),r=t.getItem(s);if(r){let e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(e){}return null}(e,n))&&void 0!==a?a:{};d[i]={expandToSizes:Object.fromEntries(s.entries()),layout:r};try{n.setItem(l,JSON.stringify(d))}catch(e){console.error(e)}}let ew={getItem:e=>(ey(ew),ew.getItem(e)),setItem:(e,t)=>{ey(ew),ew.setItem(e,t)}},ek={};function eC({autoSaveId:e=null,children:t,className:s="",direction:r,forwardedRef:n,id:a=null,onLayout:l=null,keyboardResizeBy:i=null,storage:d=ew,style:c,tagName:o="div",...u}){let x=K(a),h=V(null),[m,p]=W(null),[g,f]=W([]),j=V({}),v=V(new Map),y=V(0),b=V({autoSaveId:e,direction:r,dragState:m,id:x,keyboardResizeBy:i,onLayout:l,storage:d}),N=V({layout:g,panelDataArray:[],panelDataArrayChanged:!1});V({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),$(n,()=>({getId:()=>b.current.id,getLayout:()=>{let{layout:e}=N.current;return e},setLayout:e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:r}=N.current,n=function({layout:e,panelConstraints:t}){let s=[...e],r=s.reduce((e,t)=>e+t,0);if(s.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${s.map(e=>`${e}%`).join(", ")}`);if(!es(r,100))for(let e=0;e<t.length;e++){let t=s[e];ee(null!=t);let n=100/r*t;s[e]=n}let n=0;for(let e=0;e<t.length;e++){let r=s[e];ee(null!=r);let a=er({panelConstraints:t,panelIndex:e,size:r});r!=a&&(n+=r-a,s[e]=a)}if(!es(n,0))for(let e=0;e<t.length;e++){let r=s[e];ee(null!=r);let a=er({panelConstraints:t,panelIndex:e,size:r+n});if(r!==a&&(n-=a-r,s[e]=a,es(n,0)))break}return s}({layout:e,panelConstraints:r.map(e=>e.constraints)});!function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}(s,n)&&(f(n),N.current.layout=n,t&&t(n),em(r,n,j.current))}}),[]),function({committedValuesRef:e,eagerValuesRef:t,groupId:s,layout:r,panelDataArray:n,panelGroupElement:a,setLayout:l}){V({didWarnAboutMissingResizeHandle:!1}),F(()=>{if(!a)return;let e=t.current;ee(e);let{panelDataArray:n}=e;ee(null!=ed(s,a),`No group found for id "${s}"`);let i=ea(s,a);ee(i);let d=i.map(e=>{let t=e.getAttribute("data-panel-resize-handle-id");ee(t);let[i,d]=function(e,t,s,r=document){var n,a,l,i;let d=ec(t,r),c=ea(e,r),o=d?c.indexOf(d):-1;return[null!==(n=null===(a=s[o])||void 0===a?void 0:a.id)&&void 0!==n?n:null,null!==(l=null===(i=s[o+1])||void 0===i?void 0:i.id)&&void 0!==l?l:null]}(s,t,n,a);if(null==i||null==d)return()=>{};let c=e=>{if(!e.defaultPrevented&&"Enter"===e.key){e.preventDefault();let d=n.findIndex(e=>e.id===i);if(d>=0){let e=n[d];ee(e);let i=r[d],{collapsedSize:c=0,collapsible:o,minSize:u=0}=e.constraints;if(null!=i&&o){let e=en({delta:es(i,c)?u-c:c-i,layout:r,panelConstraints:n.map(e=>e.constraints),pivotIndices:ei(s,t,a),trigger:"keyboard"});r!==e&&l(e)}}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}});return()=>{d.forEach(e=>e())}},[a,e,t,s,r,n,l])}({committedValuesRef:b,eagerValuesRef:N,groupId:x,layout:g,panelDataArray:N.current.panelDataArray,setLayout:f,panelGroupElement:h.current}),F(()=>{let{panelDataArray:t}=N.current;if(e){if(0===g.length||g.length!==t.length)return;let s=ek[e];null==s&&(s=function(e,t=10){let s=null;return(...r)=>{null!==s&&clearTimeout(s),s=setTimeout(()=>{e(...r)},t)}}(eN,100),ek[e]=s),s(e,[...t],new Map(v.current),g,d)}},[e,g,d]),F(()=>{});let w=T(e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:r}=N.current;if(e.constraints.collapsible){let n=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l,pivotIndices:i}=eE(r,e,s);if(ee(null!=l),l!==a){v.current.set(e.id,l);let d=en({delta:eS(r,e)===r.length-1?l-a:a-l,layout:s,panelConstraints:n,pivotIndices:i,trigger:"imperative-api"});ep(s,d)||(f(d),N.current.layout=d,t&&t(d),em(r,d,j.current))}}},[]),k=T(e=>{let{onLayout:t}=b.current,{layout:s,panelDataArray:r}=N.current;if(e.constraints.collapsible){let n=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:l,minSize:i=0,pivotIndices:d}=eE(r,e,s);if(l===a){let a=v.current.get(e.id),c=null!=a&&a>=i?a:i,o=en({delta:eS(r,e)===r.length-1?l-c:c-l,layout:s,panelConstraints:n,pivotIndices:d,trigger:"imperative-api"});ep(s,o)||(f(o),N.current.layout=o,t&&t(o),em(r,o,j.current))}}},[]),C=T(e=>{let{layout:t,panelDataArray:s}=N.current,{panelSize:r}=eE(s,e,t);return ee(null!=r),r},[]),z=T((e,t)=>{let{panelDataArray:s}=N.current,r=eS(s,e);return function({defaultSize:e,dragState:t,layout:s,panelData:r,panelIndex:n,precision:a=3}){let l=s[n];return{flexBasis:0,flexGrow:null==l?null!=e?e:"1":1===r.length?"1":l.toPrecision(a),flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:g,panelData:s,panelIndex:r})},[m,g]),S=T(e=>{let{layout:t,panelDataArray:s}=N.current,{collapsedSize:r=0,collapsible:n,panelSize:a}=eE(s,e,t);return!0===n&&a===r},[]),E=T(e=>{let{layout:t,panelDataArray:s}=N.current,{collapsedSize:r=0,collapsible:n,panelSize:a}=eE(s,e,t);return ee(null!=a),!n||a>r},[]),_=T(e=>{let{panelDataArray:t}=N.current;t.push(e),t.sort((e,t)=>{let s=e.order,r=t.order;return null==s&&null==r?0:null==s?-1:null==r?1:s-r}),N.current.panelDataArrayChanged=!0},[]),O=T(e=>function(t){t.preventDefault();let s=h.current;if(!s)return()=>null;let{direction:r,dragState:n,id:a,keyboardResizeBy:l,onLayout:i}=b.current,{layout:d,panelDataArray:c}=N.current,{initialLayout:o}=null!=n?n:{},u=ei(a,e,s),x=function(e,t,s,r,n,a){if(eo(e)){let t="horizontal"===s,r=0;r=e.shiftKey?100:null!=n?n:10;let a=0;switch(e.key){case"ArrowDown":a=t?0:r;break;case"ArrowLeft":a=t?-r:0;break;case"ArrowRight":a=t?r:0;break;case"ArrowUp":a=t?0:-r;break;case"End":a=100;break;case"Home":a=-100}return a}return null==r?0:function(e,t,s,r,n){let a="horizontal"===s,l=ec(t,n);ee(l);let i=l.getAttribute("data-panel-group-id");ee(i);let{initialCursorPosition:d}=r,c=eh(s,e),o=ed(i,n);ee(o);let u=o.getBoundingClientRect();return(c-d)/(a?u.width:u.height)*100}(e,t,s,r,a)}(t,e,r,n,l,s);if(0===x)return;let m="horizontal"===r;"rtl"===document.dir&&m&&(x=-x);let p=en({delta:x,layout:null!=o?o:d,panelConstraints:c.map(e=>e.constraints),pivotIndices:u,trigger:eo(t)?"keyboard":"mouse-or-touch"}),g=!ep(d,p);(eu(t)||ex(t))&&y.current!=x&&(y.current=x,g?ev(m?"horizontal":"vertical"):m?ev(x<0?"horizontal-min":"horizontal-max"):ev(x<0?"vertical-min":"vertical-max")),g&&(f(p),N.current.layout=p,i&&i(p),em(c,p,j.current))},[]),M=T((e,t)=>{let{onLayout:s}=b.current,{layout:r,panelDataArray:n}=N.current,a=n.map(e=>e.constraints),{panelSize:l,pivotIndices:i}=eE(n,e,r);ee(null!=l);let d=en({delta:eS(n,e)===n.length-1?l-t:t-l,layout:r,panelConstraints:a,pivotIndices:i,trigger:"imperative-api"});ep(r,d)||(f(d),N.current.layout=d,s&&s(d),em(n,d,j.current))},[]),P=T((e,t)=>{let{layout:s,panelDataArray:r}=N.current,{collapsedSize:n=0,collapsible:a}=t,{collapsedSize:l=0,collapsible:i,maxSize:d=100,minSize:c=0}=e.constraints,{panelSize:o}=eE(r,e,s);ee(null!=o),a&&i&&o===n?n!==l&&M(e,l):o<c?M(e,c):o>d&&M(e,d)},[M]),R=T((e,t)=>{let{direction:s}=b.current,{layout:r}=N.current;if(!h.current)return;let n=ec(e,h.current);ee(n);let a=eh(s,t);p({dragHandleId:e,dragHandleRect:n.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),D=T(()=>{null!==ef&&(document.head.removeChild(ef),eg=null,ef=null),p(null)},[]),I=T(e=>{let{panelDataArray:t}=N.current,s=eS(t,e);s>=0&&(t.splice(s,1),delete j.current[e.id],N.current.panelDataArrayChanged=!0)},[]),A=U(()=>({collapsePanel:w,direction:r,dragState:m,expandPanel:k,getPanelSize:C,getPanelStyle:z,groupId:x,isPanelCollapsed:S,isPanelExpanded:E,reevaluatePanelConstraints:P,registerPanel:_,registerResizeHandle:O,resizePanel:M,startDragging:R,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current}),[w,m,r,k,C,z,x,S,E,P,_,O,M,R,D,I]);return q(J.Provider,{value:A},q(o,{...u,children:t,className:s,style:{display:"flex",flexDirection:"horizontal"===r?"row":"column",height:"100%",overflow:"hidden",width:"100%",...c},ref:h,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":x}))}let ez=L((e,t)=>q(eC,{...e,forwardedRef:t}));function eS(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function eE(e,t,s){let r=eS(e,t),n=r===e.length-1,a=s[r];return{...t.constraints,panelSize:a,pivotIndices:n?[r-1,r]:[r,r+1]}}function e_({children:e=null,className:t="",disabled:s=!1,id:r,onDragging:n,style:a={},tabIndex:l=0,tagName:i="div",...d}){let c=V(null),o=V({onDragging:n});F(()=>{o.current.onDragging=n});let u=Z(J);if(null===u)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,dragState:h,groupId:m,registerResizeHandle:p,startDragging:g,stopDragging:f,panelGroupElement:j}=u,v=K(r),y=(null==h?void 0:h.dragHandleId)===v,[b,N]=W(!1),[w,k]=W(null),C=T(()=>{let e=c.current;ee(e),e.blur(),f();let{onDragging:t}=o.current;t&&t(!1)},[f]);F(()=>{if(s)k(null);else{let e=p(v);k(()=>e)}},[s,v,p]),F(()=>{if(s||null==w||!y)return;let e=e=>{w(e)},t=e=>{w(e)},r=c.current;ee(r);let n=r.ownerDocument;return n.body.addEventListener("contextmenu",C),n.body.addEventListener("mousemove",e),n.body.addEventListener("touchmove",e),n.body.addEventListener("mouseleave",t),window.addEventListener("mouseup",C),window.addEventListener("touchend",C),()=>{n.body.removeEventListener("contextmenu",C),n.body.removeEventListener("mousemove",e),n.body.removeEventListener("touchmove",e),n.body.removeEventListener("mouseleave",t),window.removeEventListener("mouseup",C),window.removeEventListener("touchend",C)}},[x,s,y,w,C]),function({disabled:e,handleId:t,resizeHandler:s,panelGroupElement:r}){F(()=>{if(e||null==s||null==r)return;let n=ec(t,r);if(null==n)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),s(e);break;case"F6":{e.preventDefault();let s=n.getAttribute("data-panel-group-id");ee(s);let a=ea(s,r),l=el(s,t,r);ee(null!==l);let i=e.shiftKey?l>0?l-1:a.length-1:l+1<a.length?l+1:0;a[i].focus()}}};return n.addEventListener("keydown",a),()=>{n.removeEventListener("keydown",a)}},[r,e,t,s])}({disabled:s,handleId:v,resizeHandler:w,panelGroupElement:j});let z={cursor:ej(x),touchAction:"none",userSelect:"none"};return q(i,{...d,children:e,className:t,onBlur:()=>N(!1),onFocus:()=>N(!0),onMouseDown:e=>{g(v,e.nativeEvent);let t=o.current;ee(t);let{onDragging:s}=t;s&&s(!0)},onMouseUp:C,onTouchCancel:C,onTouchEnd:C,onTouchStart:e=>{g(v,e.nativeEvent);let t=o.current;ee(t);let{onDragging:s}=t;s&&s(!0)},ref:c,role:"separator",style:{...z,...a},tabIndex:l,"data-panel-group-direction":x,"data-panel-group-id":m,"data-resize-handle":"","data-resize-handle-active":y?"pointer":b?"keyboard":void 0,"data-panel-resize-handle-enabled":!s,"data-panel-resize-handle-id":v})}eC.displayName="PanelGroup",ez.displayName="forwardRef(PanelGroup)",e_.displayName="PanelResizeHandle";let eO=({className:e,...t})=>r.jsx(ez,{className:(0,w.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),eM=({withHandle:e,className:t,...s})=>r.jsx(e_,{className:(0,w.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...s,children:e&&r.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:r.jsx(D,{className:"size-2.5"})})});var eP=s(8281),eR=s(79210),eD=s(68232),eq=s(44389),eI=s(86333),eA=s(3240);let eL=(0,R.Z)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var eT=s(42924);let eZ=(0,R.Z)("ArchiveX",[["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:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);var eF=s(88319);let e$=(0,R.Z)("FileStack",[["path",{d:"M16 2v5h5",key:"kt2in0"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17l4 4z",key:"1km23n"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);var eG=s(75909),eU=s(90434);let eV=({index:e,folder:t,edit:s,indented:n,children:a})=>(0,r.jsxs)("div",{className:"flex flex-col ",children:[(0,r.jsxs)("div",{className:(0,w.cn)((0,g.d)({variant:t.variant,size:"sm"}),n?"pl-5":null,t.active?"dark:bg-muted dark:text-white dark:hover:bg-muted dark:hover:text-white":null,"justify-start"),children:[(0,r.jsxs)(eU.default,{className:"flex",href:t.href||"",children:[r.jsx(t.icon,{className:"mr-2 size-4"}),!t.icon&&t.label,null!==t.icon&&r.jsx("span",{className:(0,w.cn)("ml-0 overflow-hidden text-ellipsis max-w-[170px]","default"===t.variant&&"text-background dark:text-white"),children:t.label})]},e),s&&r.jsx(eq.Z,{onClick:()=>{s()},className:"ml-auto size-4 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"})]}),r.jsx("div",{children:a})]}),eW=({activeFolder:e,activeArchived:t,activeSources:s,activeEmbeddings:n})=>{let{data:a,loading:l,error:i}=(0,eG.t)();return r.jsx(r.Fragment,{children:(0,r.jsxs)("div",{className:"group flex flex-col gap-4 py-2 data-[collapsed=true]:py-2 pb-5",children:[e?r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(g.z,{variant:"link",size:"sm",asChild:!0,children:(0,r.jsxs)(eU.default,{href:"/data",children:[r.jsx(eI.Z,{className:"size-4"}),r.jsx("span",{className:"ml-2",children:"Back to dashboard"})]})})}):r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"text-sm text-muted-foreground ml-5 pt-3",children:"Select a context:"})}),r.jsx("nav",{className:"grid gap-1 px-2 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:l?r.jsx(eV,{index:111,folder:{label:"Loading...",active:!1,icon:eA.Z,variant:"ghost"}}):a?.contexts?.items.map((a,l)=>r.jsx(eV,{index:l,folder:{label:`${a.name}`,icon:eL,variant:"ghost",href:`/data/${a.id}`},children:e?.toLowerCase()===`${a.id}`.toLowerCase()&&r.jsxs(r.Fragment,{children:[r.jsx(eV,{index:l,indented:!0,folder:{label:"Active data",active:e?.toLowerCase()===`${a.id}`.toLowerCase()&&!t&&!s&&!n,icon:eT.Z,variant:e?.toLowerCase()!==`${a.id}`.toLowerCase()||t||s||n?"ghost":"default",href:`/data/${a.id}`}}),r.jsx(eV,{index:l+1e3,indented:!0,folder:{label:"Archived data",active:t,icon:eZ,variant:t?"default":"ghost",href:`/data/${a.id}/archived`}}),r.jsx(eV,{index:l+1e3,indented:!0,folder:{label:"Sources",active:s,icon:eF.Z,variant:s?"default":"ghost",href:`/data/${a.id}/sources`}}),r.jsx(eV,{index:l+1e3,indented:!0,folder:{label:"Embeddings",active:n,icon:e$,variant:n?"default":"ghost",href:`/data/${a.id}/embeddings`}})]})},a.id))})]},e+t+s+n)})};function eB({children:e,params:t}){let s=t.query&&"archived"===t.query[1],n=t.query&&"sources"===t.query[1],a=t.query&&"embeddings"===t.query[1],l=t.query&&t.query[0],i=null;return t.query&&s?i=t.query[2]||null:!t.query||n||a||(i=t.query[1]||null),r.jsx(eD.pn,{delayDuration:0,children:(0,r.jsxs)(eO,{direction:"horizontal",onLayout:e=>{document.cookie=`react-resizable-panels:layout=${JSON.stringify(e)}`},className:"h-full items-stretch",children:[(0,r.jsxs)(Q,{defaultSize:15,collapsedSize:4,collapsible:!0,minSize:15,maxSize:20,children:[r.jsx(eP.Z,{}),r.jsx(eW,{activeFolder:l,activeArchived:s,activeSources:n,activeEmbeddings:a})]}),l&&!n&&!a&&(0,r.jsxs)(r.Fragment,{children:[r.jsx(eM,{withHandle:!0}),r.jsx(Q,{defaultSize:20,minSize:20,children:(0,r.jsxs)(eR.mQ,{defaultValue:"all",children:[r.jsx("div",{className:"flex items-center px-4 py-2 h-full",children:r.jsx("h1",{className:"text-xl font-bold",children:"Items"})}),r.jsx(eP.Z,{}),r.jsx(P,{activeFolder:l,activeItem:i??void 0,archived:s})]})})]}),r.jsx(eM,{withHandle:!0}),r.jsx(Q,{defaultSize:65,children:r.jsx("div",{className:"max-h-full overflow-y-auto",children:e})})]})})}},26533:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.r(t),s.d(t,{default:()=>p});var n=s(10326),a=s(65063);s(17577);var l=s(69771),i=s(18440),d=s(39167),c=s(42270),o=s(43273),u=s(65304),x=s(76812),h=s(5096),m=e([a]);function p({params:e}){let{data:t,loading:s,error:r}=(0,d.aM)(c.fV,{skip:!e?.query?.[0],variables:{id:e?.query?.[0]}});if(!e.query)return n.jsx("div",{className:"grow flex flex-col",children:n.jsx(l.Z,{})});let m=e.query[0]||null,p="archived"===e.query[1],g="sources"===e.query[1],f="embeddings"===e.query[1];if(g)return n.jsx(h.L,{expand:!0,actions:!0,context:m});if(f)return n.jsx(i.U,{expand:!0,actions:!0,context:m});let j=null;return(p?j=e.query[2]||null:g||f||(j=e.query[1]||null),s||!t?.contextById)?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[n.jsx(u.O,{className:"w-full h-[80px] rounded-md"}),n.jsx(u.O,{className:"w-full h-[50px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(u.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):r?(0,n.jsxs)(o.bZ,{variant:"destructive",children:[n.jsx(x.LPM,{className:"size-4"}),n.jsx(o.Cd,{children:"Error"}),n.jsx(o.X,{children:r?.message||"Error loading item."})]}):n.jsx(a.H,{actions:!0,context:t?.contextById,itemId:j})}a=(m.then?(await m)():m)[0],r()}catch(e){r(e)}})},69771:(e,t,s)=>{"use strict";s.d(t,{Z:()=>o});var r=s(10326),n=s(33519),a=s(17577),l=s(31051),i=s(42193),d=s(16923),c=s(22746);function o(){let[e,t]=(0,a.useState)("count"),[s,o]=(0,a.useState)({from:(0,n.k)(new Date,7),to:new Date}),[u,x]=(0,a.useState)("CONTEXT_UPSERT"),[h,m]=(0,a.useState)("label");return(0,r.jsxs)("div",{className:"flex-1 flex flex-col p-8 pt-6 h-screen",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-4xl font-bold tracking-tight bg-clip-text",children:"Contexts Dashboard"}),r.jsx("p",{className:"text-lg",children:"Monitor your contexts and their usage."})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx(i.z,{dateRange:s,onDateRangeChange:o,maxDays:30})})]}),(0,r.jsxs)("div",{className:"flex-1 grid gap-6 md:grid-cols-3 min-h-0",children:[r.jsx("div",{className:"rounded-lg border md:col-span-2 p-6 flex flex-col",children:r.jsx(d.q,{dateRange:s,selectedType:u,onTypeChange:x,unitOptions:[{value:"count",label:"Count"}],onUnitChange:t,unit:e,dataTypes:[l.h.CONTEXT_RETRIEVE,l.h.CONTEXT_UPSERT]})}),r.jsx("div",{className:"rounded-lg border p-6 flex flex-col",children:r.jsx(c.Y,{groupByOptions:[],dateRange:s,selectedType:u,unit:e,groupBy:h,onGroupByChange:m})})]})]})}},65063:(e,t,s)=>{"use strict";s.a(e,async(e,r)=>{try{s.d(t,{H:()=>X});var n=s(10326),a=s(39167),l=s(18753),i=s(74064),d=s(23015),c=s(98091),o=s(40900),u=s(35157),x=s(31215),h=s(69508),m=s(91470),p=s(24081),g=s(21986),f=s(47206),j=s(231),v=s(35047),y=s(17577),b=s(74723),N=s(770),w=s(57004),k=s(18615),C=s(567),z=s(90772),S=s(55632),E=s(54432),_=s(37859),O=s(8281),M=s(33261),P=s(15940),R=s(87673),D=s(68232),q=s(62288),I=s(60097),A=s(99440),L=s(34789),T=s(77863),Z=s(65304),F=s(43273),$=s(76812),G=s(42270),U=s(15286),V=s(24295),W=s(33071),B=s(77961),J=e([w]);function X(e){let[t,s]=(0,y.useState)(),{toast:r}=(0,L.pm)(),J=(0,v.useRouter)(),[X,H]=(0,y.useState)(),K=e.context,Y=e.context.fields.map(e=>e.name);console.log("fields",Y),console.log("context",K);let{loading:Q,error:ee,refetch:et}=(0,a.aM)((0,G.A1)(e.context.id,Y,!0),{skip:!e.itemId||!e.context?.id,variables:{context:e.context.id,id:e.itemId},fetchPolicy:"no-cache",nextFetchPolicy:"network-only",onCompleted:t=>{let r=t[e.context.id+"_itemsById"];s({...r,tags:r.tags?r.tags.split(","):[]}),H({rights_mode:r.rights_mode,users:r.RBAC?.users,roles:r.RBAC?.roles})}}),[es,er]=(0,l.D)((0,G.ty)(e.context.id),{onCompleted:()=>{r({title:"Item updated",description:"Item updated successfully."})},onError:e=>{r({title:"Error updating item",description:e.message})}}),[en,ea]=(0,l.D)((0,G.mN)(e.context.id,[]),{onCompleted:()=>{r({title:"Item deleted",description:"Item deleted successfully."})},onError:e=>{r({title:"Error deleting item",description:e.message})}}),[el,ei]=(0,l.D)((0,G.Eq)(e.context.id),{onCompleted:t=>{let s=t[e.context.id+"_itemsGenerateChunks"];if(s.jobs?.length>0){r({title:"Chunks generation started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}r({title:"Chunks generated",description:"Chunks generated successfully."})}}),[ed,ec]=(0,l.D)((0,G.ps)(e.context.id),{onCompleted:t=>{let s=t[e.context.id+"_itemsDeleteChunks"];if(s.jobs?.length>0){r({title:"Chunks deletion started",description:"Jobs have been started in the background, depending on the size of the item this may take a while."});return}r({title:"Chunks deleted",description:"Chunks deleted successfully."})}}),[eo,eu]=(0,l.D)((0,G.dc)(e.context.id),{onCompleted:()=>{r({title:"Field processed",description:"Field processed successfully."})},onError:e=>{r({title:"Error processing field",description:e.message})}}),ex=N.Ry({name:N.Z_().nullable().optional(),tags:N.Z_().nullable().optional(),external_id:N.Z_().nullable().optional(),description:N.Z_().min(2,{message:"Text must be at least 2 characters."}).max(1e4,{message:"Text must not be longer than 10.0000 characters."}),...K?.fields?.reduce((e,t)=>({...e,[t.name]:N.Z_().nullable()}),{})??{}}),eh=(0,b.cI)({resolver:(0,i.F)(ex),defaultValues:{description:t?.description},mode:"onChange"}),em=e=>{if(e.target.value&&"Enter"===e.key){let r=t?.tags??[],n=[...Array.isArray(r)?[...r]:[]];n.push(e.target.value),console.log("tags",n),eh.setValue("tags",n.join(",")),s({...t,tags:n}),e.target.value=""}},[ep,eg]=(0,y.useState)(!1),[ef,ej]=(0,y.useState)(null),[ev,ey]=(0,y.useState)(null);return Q?(0,n.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[n.jsx(Z.O,{className:"w-full h-[80px] rounded-md"}),n.jsx(Z.O,{className:"w-full h-[50px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"}),n.jsx(Z.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):ee?(0,n.jsxs)(F.bZ,{variant:"destructive",children:[n.jsx($.LPM,{className:"size-4"}),n.jsx(F.Cd,{children:"Error"}),n.jsx(F.X,{children:ee?.message||"Error loading item."})]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[t?(0,n.jsxs)(n.Fragment,{children:[e.actions?(0,n.jsxs)(n.Fragment,{children:[n.jsx("div",{className:"flex items-center p-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[t?.archived?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{t.id&&(es({variables:{id:t.id,input:{archived:!1}}}),s({...t,archived:!1}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[er.loading?n.jsx(_.g,{}):n.jsx(d.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Unarchive"})]})}),n.jsx(D._v,{children:"Unarchive"})]}),(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{t.id&&(en({variables:{id:t.id}}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||ea.loading,children:[ea.loading?n.jsx(_.g,{}):n.jsx(c.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Delete"})]})}),n.jsx(D._v,{children:"Delete"})]})]}):(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:async()=>{t?.id&&(es({variables:{id:t.id,input:{archived:!0}}}),s({...t,archived:!0}),J.push("./"))},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[er.loading?n.jsx(_.g,{}):n.jsx(o.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Archive"})]})}),n.jsx(D._v,{children:"Archive"})]}),ep?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:()=>{eg(!1)},variant:"ghost",size:"icon",children:[n.jsx(u.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Cancel"})]})}),n.jsx(D._v,{children:"Cancel"})]}),(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{disabled:er.loading,onClick:()=>{t?.id&&(es({variables:{id:t.id,input:{textlength:t?.text?.length,description:t?.description,name:t?.name,externalId:t?.externalId,tags:t?.tags?.join(","),source:t?.source,archived:t?.archived,rights_mode:X?.rights_mode,RBAC:{users:X?.users||[],roles:X?.roles||[]},...K?.fields?.reduce((e,s)=>({...e,[s.name]:t?.[s.name]}),{})??{}}}}),eg(!1))},variant:"ghost",size:"icon",children:[n.jsx(x.Z,{className:"size-4"}),(0,n.jsxs)("span",{className:"sr-only",children:["Save ",er.loading??n.jsx(_.g,{})]})]})}),n.jsx(D._v,{children:"Save"})]})]}):(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{onClick:()=>{eg(!0)},variant:"ghost",size:"icon",disabled:!t||er.loading,children:[n.jsx(h.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Edit"})]})}),n.jsx(D._v,{children:"Edit"})]})]})}),n.jsx(O.Z,{})]}):null,n.jsx("div",{className:"flex flex-1 flex-col",children:(0,n.jsxs)("div",{className:(0,T.cn)("space-y-2"),children:[n.jsx("div",{className:"flex items-center justify-between space-x-4 px-4 bg-muted rounded",children:n.jsx("h3",{className:"text-lg p-5 font-semibold tracking-tight text-lg",children:"Fields"})}),(0,n.jsxs)("div",{className:"p-5",children:[n.jsx(S.l0,{...eh,children:n.jsx("form",{className:"space-y-8",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)(P.iA,{children:[n.jsx(P.xD,{children:(0,n.jsxs)(P.SC,{children:[n.jsx(P.ss,{children:"Name"}),n.jsx(P.ss,{children:"Value"})]})}),(0,n.jsxs)(P.RM,{children:[(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"Name"}),n.jsx(P.pj,{children:n.jsx(S.Wi,{control:eh.control,name:"name",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{s({...t,name:e.target.value})},placeholder:"Item name",value:t.name??""})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.name??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:t.name&&t.name?.length>200?t.name?.slice(0,200)+"...":t.name})})})})]},"name"),(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"Tags"}),(0,n.jsxs)(P.pj,{children:[ep?n.jsx("div",{className:"grid-row grid grid-flow-col gap-4 pt-2",children:n.jsx(S.Wi,{control:eh.control,name:"tags",render:({field:e})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{id:"includes",type:"text",onKeyUp:e=>em(e),placeholder:"Type and press enter to add"})}),n.jsx(S.zG,{})]})})}):null,t?.tags?.length?n.jsx("div",{className:"gap-2 pt-2",children:t?.tags?.map((e,r)=>n.jsx(C.C,{variant:"secondary",className:"px-3 py-2 mr-2 mb-2",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"text-muted-foreground truncate max-w-[200px]",children:e}),ep?n.jsx("span",{className:"size-4 cursor-pointer text-muted-foreground",onClick:()=>{let e=[...t.tags??[]];e.splice(r,1),eh.setValue("tags",e.join(",")),s({...t,tags:e})},children:n.jsx(m.Z,{className:"ml-1",size:15})}):null]})},`tag-${r}`))}):null]})]},"tags"),(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"Description"}),n.jsx(P.pj,{children:n.jsx(S.Wi,{control:eh.control,name:"description",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[n.jsx(R.g,{autoFocus:!0,disabled:!ep,onChange:e=>{s({...t,description:e.target.value})},placeholder:"Item text content",className:"resize-none",value:t.description??""}),(0,n.jsxs)(q.Vq,{children:[n.jsx(q.hg,{asChild:!0,children:(0,n.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:"description",value:t.description??"",disabled:!1}),children:[n.jsx(p.Z,{className:"h-3 w-3"}),n.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(q.cZ,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(q.fK,{children:n.jsx(q.$N,{children:"Edit Description"})}),n.jsx("div",{className:"mt-4",children:n.jsx(R.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name==="description"?ef.value:t.description??"",onChange:e=>{let r=e.target.value;ej(e=>e?.name==="description"?{...e,value:r}:e),s({...t,description:r})}})})]})]})]})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.description??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:n.jsx(k.J,{text:t.description??""})})})})})]},19091),(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:"External ID"}),n.jsx(P.pj,{children:n.jsx(S.Wi,{control:eh.control,name:"external_id",render:({field:e})=>n.jsx(S.xJ,{children:ep?(0,n.jsxs)(n.Fragment,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{type:"text",disabled:!ep,onChange:e=>{console.log("e",e),s({...t,external_id:e.target.value})},placeholder:"xxxx-xxxx-xxxx-xxxx",value:t.external_id??""})}),n.jsx(S.zG,{})]}):n.jsx("div",{onClick:async()=>{await navigator.clipboard.writeText(t.external_id??""),r({title:"Copied to clipboard"})},className:"flex-1 whitespace-pre-wrap text-sm cursor-copy",children:t.external_id??""})})})})]},"externalId"),K?.fields?.length&&K.fields.map((e,a)=>(0,n.jsxs)(P.SC,{children:[(0,n.jsxs)(P.pj,{className:"font-medium capitalize flex flex-col",children:[e.label,e.calculated&&n.jsx("span",{className:"text-sm text-muted-foreground",children:"Calculated"}),e.processor&&(0,n.jsxs)(D.u,{children:[n.jsx(D.aJ,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"secondary",size:"sm",className:"w-auto mt-2",onClick:()=>{eo({variables:{item:t?.id,field:e.name}})},disabled:eu.loading,children:[eu.loading?n.jsx(_.g,{}):n.jsx(g.Z,{className:"size-4"}),n.jsx("span",{className:"ml-2",children:"Process"})]})}),n.jsx(D._v,{className:"max-w-xs",children:e.processor.description})]})]}),ep?n.jsx(n.Fragment,{children:(0,n.jsxs)(P.pj,{children:["code"===e.type||"json"===e.type||"text"===e.type||"longText"===e.type||"markdown"===e.type||"shortText"===e.type?n.jsx(S.Wi,{control:eh.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:(0,n.jsxs)("div",{className:"relative",children:[n.jsx(R.g,{id:e.name,rows:"shortText"===e.type?2:7,onChange:r=>{s({...t,[e.name]:r.target.value})},value:t[e.name]??""}),(0,n.jsxs)(q.Vq,{children:[n.jsx(q.hg,{asChild:!0,children:(0,n.jsxs)(z.z,{type:"button",variant:"ghost",size:"sm",className:"absolute top-2 right-2 h-6 w-6 p-0",onClick:()=>ej({name:e.name,disabled:!1,value:t[e.name]??""}),children:[n.jsx(p.Z,{className:"h-3 w-3"}),n.jsx("span",{className:"sr-only",children:"Expand"})]})}),(0,n.jsxs)(q.cZ,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(q.fK,{children:(0,n.jsxs)(q.$N,{children:["Edit ",e.name]})}),n.jsx("div",{className:"mt-4",children:n.jsx(R.g,{rows:20,className:"min-h-[400px] resize-none",value:ef?.name===e.name?ef.value:t[e.name]??"",onChange:r=>{let n=r.target.value;ej(t=>t?.name===e.name?{...t,value:n}:t),s({...t,[e.name]:n})}})})]})]})]})}),n.jsx(S.zG,{})]})}):null,"number"===e.type?n.jsx(S.Wi,{control:eh.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(E.I,{id:e.name,type:"number",onChange:r=>{s({...t,[e.name]:r.target.value})},value:t[e.name]??""})}),n.jsx(S.zG,{})]})}):null,"boolean"===e.type?n.jsx(S.Wi,{control:eh.control,name:e.name,render:({field:r})=>(0,n.jsxs)(S.xJ,{children:[n.jsx(S.NI,{children:n.jsx(M.r,{checked:!!r.value,onCheckedChange:r=>{s({...t,[e.name]:r})}})}),n.jsx(S.zG,{})]})}):null,"file"===e.type&&n.jsx("div",{children:n.jsx(B.jF,{s3key:t[e.name],children:n.jsx(B.ZP,{id:`item-${t.id}`,buttonText:"Select File",allowedFileTypes:e.allowedFileTypes,dependencies:[],selectionLimit:1,onConfirm:r=>{console.log("keys",r),s({...t,[e.name]:r[0]})}})})})]})}):n.jsx(P.pj,{children:(0,n.jsxs)("span",{children:["code"===e.type&&n.jsx(w.G,{code:t[e.name]}),"json"===e.type&&n.jsx(w.G,{code:t[e.name],language:"json"}),"shortText"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),r({title:"Copied to clipboard"})},children:t[e.name]}),"longText"===e.type&&n.jsx(k.J,{text:t[e.name]}),"file"===e.type&&n.jsx(B.jF,{s3key:t[e.name]}),"markdown"===e.type&&n.jsx(k.J,{text:t[e.name]}),!e.type&&n.jsx(k.J,{text:t[e.name]}),"text"===e.type&&n.jsx(k.J,{text:t[e.name]}),"number"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),r({title:"Copied to clipboard"})},children:t[e.name]}),"boolean"===e.type&&n.jsx("p",{className:"cursor-copy",onClick:async()=>{await navigator.clipboard.writeText(t[e.name]),r({title:"Copied to clipboard"})},children:t[e.name]??""})]})})]},a))]})]}),n.jsx(O.Z,{className:"my-4"})]})})}),n.jsx(W.Zb,{className:"bg-transparent",children:(0,n.jsxs)(V.zF,{children:[n.jsx(W.Ol,{className:"p-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-base",children:"Access Control"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-0",children:"Control access to this item."})]}),n.jsx(V.wy,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"ghost",size:"icon",className:"size-8",children:[n.jsx(f.Z,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Toggle"})]})})]})}),n.jsx(V.Fw,{className:"mt-5",children:n.jsx(W.aY,{className:"space-y-4",children:n.jsx(U.P,{initialRightsMode:t.rights_mode,initialUsers:t.RBAC?.users,initialRoles:t.RBAC?.roles,onChange:(e,t,s)=>{H({rights_mode:e,users:t,roles:s})}})})})]})}),(0,n.jsxs)("div",{className:"mt-4 border border p-3 pb-5 rounded",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between ml-4 mt-3 mr-4 mb-2",children:[n.jsx("h1",{className:"text-lg font-medium",children:"Embeddings"}),(0,n.jsxs)(I.h_,{modal:!1,children:[n.jsx(I.$F,{asChild:!0,children:(0,n.jsxs)(z.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[n.jsx(j.Z,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,n.jsxs)(I.AW,{align:"end",children:[n.jsx(I.Xi,{onClick:()=>ey("generate"),children:"Generate embeddings"}),n.jsx(I.Xi,{onClick:()=>ey("delete"),children:"Delete embeddings"})]})]})]}),(0,n.jsxs)(P.iA,{children:[n.jsx(P.Rn,{children:t?.chunks?.length?"A list of all embeddings for this item.":"No embeddings found."}),n.jsx(P.xD,{children:(0,n.jsxs)(P.SC,{children:[n.jsx(P.ss,{children:"Index"}),n.jsx(P.ss,{children:"Content"}),n.jsx(P.ss,{children:"Dimensions"}),n.jsx(P.ss,{children:"Created At"}),n.jsx(P.ss,{children:"Updated At"})]})}),n.jsx(P.RM,{children:t?.chunks?.length?t?.chunks?.length&&t.chunks.map(e=>(0,n.jsxs)(P.SC,{children:[n.jsx(P.pj,{className:"font-medium capitalize",children:e.chunk_index+1}),n.jsx(P.pj,{children:n.jsx(k.J,{text:e.content})}),n.jsx(P.pj,{children:e.embedding_size||0}),n.jsx(P.pj,{children:new Date(e.chunk_created_at).toLocaleString()}),n.jsx(P.pj,{children:new Date(e.chunk_updated_at).toLocaleString()})]},e.id)):null})]})]})]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[" ",!t&&e.itemId?n.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Item not found."}):n.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"No item selected."})]}),n.jsx(A.aR,{open:"generate"===ev,onOpenChange:e=>!e&&ey(null),children:(0,n.jsxs)(A._T,{children:[(0,n.jsxs)(A.fY,{children:[n.jsx(A.f$,{children:"Generate Embeddings"}),n.jsx(A.yT,{children:"Are you sure you want to generate embeddings for this item? This will create new embedding vectors for the content."})]}),(0,n.jsxs)(A.xo,{children:[n.jsx(A.le,{children:"Cancel"}),n.jsx(A.OL,{disabled:ei.loading,onClick:()=>{t?.id&&(console.log("Generate embeddings for item:",t?.id),ey(null),el({variables:{where:{id:{eq:t?.id}}}}))},children:"Generate"})]})]})}),n.jsx(A.aR,{open:"delete"===ev,onOpenChange:e=>!e&&ey(null),children:(0,n.jsxs)(A._T,{children:[(0,n.jsxs)(A.fY,{children:[n.jsx(A.f$,{children:"Delete Embeddings"}),n.jsx(A.yT,{children:"Are you sure you want to delete all embeddings for this item? This action cannot be undone."})]}),(0,n.jsxs)(A.xo,{children:[n.jsx(A.le,{children:"Cancel"}),n.jsx(A.OL,{disabled:ec.loading,onClick:async()=>{t?.id&&(console.log("Delete embeddings for item:",t?.id),ey(null),ed({variables:{where:{id:{eq:t?.id}}}}))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}w=(J.then?(await J)():J)[0],r()}catch(e){r(e)}})},18440:(e,t,s)=>{"use strict";s.d(t,{U:()=>P});var r=s(10326),n=s(39167),a=s(18753),l=s(35047),i=s(17577),d=s(567),c=s(90772),o=s(33071),u=s(8281),x=s(65685),h=s(32663),m=s(90434),p=s(99440),g=s(85999),f=s(42270),j=s(29718),v=s(15940),y=s(75290),b=s(60097),N=s(76812);function w({contextId:e}){let[t,s]=(0,i.useState)(null),[l,d]=(0,i.useState)(!0),u=(0,i.useRef)(new Date(Date.now()-18144e5).toISOString()),{loading:x,data:w,refetch:k,previousData:C,error:z}=(0,n.aM)((0,f.P3)(e,[]),{fetchPolicy:"no-cache",nextFetchPolicy:"network-only",variables:{context:e,page:1,limit:5,filters:[{embeddings_updated_at:{gte:u.current}}],sort:{field:"embeddings_updated_at",direction:"DESC"}}}),[S,E]=(0,a.D)((0,f.Eq)(e),{onCompleted:t=>{let s=t[e+"_itemsGenerateChunks"];if(s.jobs?.length>0){g.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}g.Am.success("Chunks generated",{description:"Chunks generated successfully."})}}),[_,O]=(0,a.D)((0,f.ps)(e),{onCompleted:t=>{let s=t[e+"_itemsDeleteChunks"];if(s.jobs?.length>0){g.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}g.Am.success("Chunks deleted",{description:"Chunks deleted successfully."})}}),M=w?.[e+f.Md];return x?r.jsx(o.Zb,{children:r.jsx(o.aY,{className:"pt-6",children:r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(y.Z,{className:"h-6 w-6 animate-spin"})})})}):(0,r.jsxs)(o.Zb,{className:"border-0 rounded-none",children:[r.jsx(o.Ol,{children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{children:[r.jsx(o.ll,{children:"Recent Embeddings"}),r.jsx(o.SZ,{children:"Items with embeddings updated in the last 21 days"})]}),x&&r.jsx(y.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),r.jsx("div",{children:(0,r.jsxs)(b.h_,{modal:!1,children:[r.jsx(b.$F,{asChild:!0,children:(0,r.jsxs)(c.z,{variant:"ghost",className:"flex size-8 p-0 data-[state=open]:bg-muted",children:[r.jsx(N.nWS,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Open menu"})]})}),(0,r.jsxs)(b.AW,{align:"end",children:[r.jsx(b.Xi,{onClick:()=>s("generate"),children:"Generate all embeddings"}),r.jsx(b.Xi,{onClick:()=>{s("delete")},children:"Delete all embeddings"})]})]})})]})}),r.jsx(o.aY,{children:r.jsx("div",{className:"border rounded-lg",children:M?.items?.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No recent embeddings"}):(0,r.jsxs)(v.iA,{children:[r.jsx(v.xD,{children:(0,r.jsxs)(v.SC,{children:[r.jsx(v.ss,{children:"Name"}),r.jsx(v.ss,{className:"text-right",children:"Updated"})]})}),r.jsx(v.RM,{children:M?.items?.map((t,s)=>r.jsxs(v.SC,{children:[r.jsx(v.pj,{className:"font-medium",children:r.jsx(m.default,{className:"hover:text-blue-500 hover:underline",href:`/data/${e}/${t.id}`,children:r.jsx(j.L,{text:t.name||t.id||"",length:100})})}),r.jsx(v.pj,{className:"text-right text-sm text-muted-foreground",children:t.embeddings_updated_at?h.Q(new Date(t.embeddings_updated_at),{addSuffix:!0}):"never"})]},s))})]})})}),r.jsx(p.aR,{open:"generate"===t,onOpenChange:e=>!e&&s(null),children:(0,r.jsxs)(p._T,{children:[(0,r.jsxs)(p.fY,{children:[r.jsx(p.f$,{children:"Generate Embeddings"}),r.jsx(p.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,r.jsxs)(p.xo,{children:[r.jsx(p.le,{children:"Cancel"}),r.jsx(p.OL,{disabled:E.loading,onClick:()=>{s(null),S(),g.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"})]})]})}),r.jsx(p.aR,{open:"delete"===t,onOpenChange:e=>!e&&s(null),children:(0,r.jsxs)(p._T,{children:[(0,r.jsxs)(p.fY,{children:[r.jsx(p.f$,{children:"Delete Embeddings"}),r.jsx(p.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,r.jsxs)(p.xo,{children:[r.jsx(p.le,{children:"Cancel"}),r.jsx(p.OL,{disabled:O.loading,onClick:async()=>{s(null),_(),g.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 k=s(43273),C=s(65304),z=s(34789),S=s(24295),E=s(18286),_=s(86333),O=s(941),M=s(19753);function P(e){let[t,s]=(0,i.useState)(!0),{toast:h}=(0,z.pm)(),{data:m,loading:p,error:g}=(0,n.aM)(f.fV,{variables:{id:e.context}}),j=m?.contextById,v=(0,l.useRouter)(),[y,b]=(0,a.D)(f.xR,{onCompleted:e=>{I(),h({title:"Embedder configs updated",description:"Embedder configs updated successfully."})},onError:e=>{I(),h({title:"Error updating embedder configs",description:e.message})}}),[P,R]=(0,a.D)(f.s7,{onCompleted:e=>{I(),h({title:"Embedder configs created",description:"Embedder configs created successfully."})},onError:e=>{I(),h({title:"Error creating embedder configs",description:e.message})}}),{data:D,loading:q,refetch:I}=(0,n.aM)(f.c2,{skip:!j?.embedder?.id,variables:{context:e.context,embedder:j?.embedder?.id}}),A=D?.embedder_settingsPagination?.items||[],{data:L}=(0,n.aM)(f.Az,{variables:{page:1,limit:100}}),T=L?.variablesPagination?.items||[];return p?(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(C.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(C.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"})]}):g?(0,r.jsxs)(k.bZ,{variant:"destructive",children:[r.jsx(N.LPM,{className:"size-4"}),r.jsx(k.Cd,{children:"Error"}),r.jsx(k.X,{children:g?.message||"Error loading item."})]}):(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(c.z,{onClick:()=>{v.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(_.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(u.Z,{})]}):null,j?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(o.Zb,{className:"border-0 rounded-none",children:[r.jsx(o.Ol,{children:r.jsx(o.ll,{className:"text-lg",children:"Settings"})}),r.jsx(o.aY,{className:"grid gap-4",children:r.jsx(x.x,{className:"max-h-[600px]",children:(0,r.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:j.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:j.description}),(0,r.jsxs)("div",{className:"mt-3 flex items-center",children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder:"}),(0,r.jsxs)(d.C,{variant:"outline",children:[j.embedder?.name||"None"," (",j.embedder?.id,")"]})]})]}),(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Calculate Vectors:"}),r.jsx(d.C,{variant:"secondary",children:j.configuration?.calculateVectors?j.configuration.calculateVectors.charAt(0).toUpperCase()+j.configuration.calculateVectors.slice(1):"Manual"}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:[(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"Manual"}),": Vectors are only calculated when triggered manually."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"On Update"}),": Vectors are recalculated whenever an item is updated."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"On Insert"}),": Vectors are calculated when a new item is inserted."]}),(0,r.jsxs)("span",{className:"block",children:[r.jsx("b",{children:"Always"}),": Vectors are calculated on both insert and update operations."]})]})]}),(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium mr-2",children:"Embedder Configs:"}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:T?.length&&j?.embedder?.config?.map(t=>{let s=A?.find(e=>e.name===t.name);return console.log("currentValue",s),console.log("embedderConfigs",A),console.log("config",t),r.jsxs("div",{className:"space-y-2",children:[r.jsx(E.f,{configItem:t,currentValue:s?.value||"",variables:T,onVariableSelect:r=>{console.log("variableName",r),s?y({variables:{id:s.id,name:t.name,value:r}}):P({variables:{name:t.name,value:r,context:e.context,embedder:j?.embedder?.id}})}}),r.jsx("span",{children:t.description})]},t.name)})})]})]})})})]}),r.jsx(w,{contextId:j.id}),r.jsx(S.zF,{open:t,onOpenChange:s,children:(0,r.jsxs)(o.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(o.Ol,{children:r.jsx(S.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(o.ll,{children:"Queues"}),(0,r.jsxs)(c.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(O.Z,{className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),r.jsx(S.Fw,{children:r.jsx(o.aY,{children:j.embedder?.queue?r.jsx("div",{className:"space-y-4",children:r.jsx("div",{children:r.jsx(M.R,{queueName:j.embedder?.queue,nameGenerator:e=>"Source update",retryJob:e=>{if(!e.data?.source||!e.data?.context)return}})},j.embedder?.queue)}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."})]})}},5096:(e,t,s)=>{"use strict";s.d(t,{L:()=>_});var r=s(10326),n=s(39167),a=s(18753),l=s(86333),i=s(94893),d=s(941),c=s(75290),o=s(35047),u=s(17577),x=s(90772),h=s(33071),m=s(8281),p=s(65685),g=s(54432),f=s(31048),j=s(24295),v=s(15940),y=s(567),b=s(68232),N=s(62288),w=s(42270),k=s(43273),C=s(65304),z=s(76812),S=s(19753),E=s(85999);function _(e){let[t,s]=(0,u.useState)(!0),[_,O]=(0,u.useState)(!1),[M,P]=(0,u.useState)(null),[R,D]=(0,u.useState)({}),{data:q,loading:I,error:A}=(0,n.aM)(w.fV,{variables:{id:e.context}}),L=q?.contextById,T=(0,o.useRouter)(),[Z,{loading:F}]=(0,a.D)((0,w.C3)(e.context),{onCompleted:t=>{let s=t[`${e.context}_itemsExecuteSource`];O(!1),P(null),D({}),E.Am.success(s.message||"Source executed successfully",{description:s.jobs?.length?`${s.jobs.length} job(s) scheduled`:s.items?.length?`${s.items.length} item(s) processed`:void 0})},onError:e=>{E.Am.error("Failed to execute source",{description:e.message})}}),$=(e,t,s,r)=>{if(P({id:e,name:t,queue:s,params:r}),r){let e={};r.forEach(t=>{e[t.name]=t.default||""}),D(e)}O(!0)};if(I)return(0,r.jsxs)("div",{className:"p-8 text-center text-muted-foreground",children:[r.jsx(C.O,{className:"w-full h-[80px] rounded-md"}),r.jsx(C.O,{className:"w-full h-[50px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"}),r.jsx(C.O,{className:"w-full h-[80px] rounded-md mt-3"})]});if(A)return(0,r.jsxs)(k.bZ,{variant:"destructive",children:[r.jsx(z.LPM,{className:"size-4"}),r.jsx(k.Cd,{children:"Error"}),r.jsx(k.X,{children:A?.message||"Error loading item."})]});let G=[];return L&&(G=Array.from(new Set(L.sources.map(e=>e.config.queue).filter(e=>!!e)))),(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[e.actions?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex p-2 justify-between",children:[r.jsx("div",{className:"flex items-center gap-2"}),(0,r.jsxs)(x.z,{onClick:()=>{T.push("/context")},variant:"ghost",size:"icon",children:[r.jsx(l.Z,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Back"})]})]}),r.jsx(m.Z,{})]}):null,L?(0,r.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,r.jsxs)(h.Zb,{className:"border-0 rounded-none",children:[r.jsx(h.Ol,{children:r.jsx(h.ll,{className:"text-lg",children:"Settings"})}),r.jsx(h.aY,{className:"grid gap-4",children:r.jsx(p.x,{className:"max-h-[600px]",children:r.jsx("div",{className:"space-y-6 pr-4",children:(0,r.jsxs)("div",{children:[r.jsx("h2",{className:"text-xl font-bold",children:L.name}),r.jsx("p",{className:"text-muted-foreground mt-1",children:L.description})]})})})})]}),(0,r.jsxs)(h.Zb,{className:"border-0 rounded-none",children:[(0,r.jsxs)(h.Ol,{children:[r.jsx(h.ll,{children:"Sources"}),r.jsx(h.SZ,{children:"Sources are used to fetch external data and ingest them into the context."})]}),r.jsx(h.aY,{children:L.sources&&L.sources.length>0?r.jsx(b.pn,{children:r.jsx("div",{className:"rounded-md border",children:(0,r.jsxs)(v.iA,{children:[r.jsx(v.xD,{children:(0,r.jsxs)(v.SC,{children:[r.jsx(v.ss,{children:"Name"}),r.jsx(v.ss,{children:"Description"}),r.jsx(v.ss,{children:"Queue Configuration"}),r.jsx(v.ss,{className:"text-right",children:"Actions"})]})}),r.jsx(v.RM,{children:L.sources.map(e=>{let t=e.config.queue||e.config.schedule||void 0!==e.config.retries||e.config.backoff;return(0,r.jsxs)(v.SC,{children:[r.jsx(v.pj,{className:"font-medium",children:e.name}),r.jsx(v.pj,{className:"max-w-[300px]",children:e.description||"-"}),r.jsx(v.pj,{children:t?(0,r.jsxs)(b.u,{children:[r.jsx(b.aJ,{asChild:!0,children:r.jsx("div",{className:"cursor-help",children:e.config.queue?r.jsx(y.C,{variant:"outline",className:"cursor-help",children:e.config.queue}):r.jsx("span",{className:"text-muted-foreground",children:"No queue configured"})})}),r.jsx(b._v,{className:"max-w-[300px]",children:(0,r.jsxs)("div",{className:"space-y-2",children:[e.config.queue&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Queue:"}),r.jsx("span",{className:"ml-2 text-xs",children:e.config.queue})]}),e.config.schedule&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Schedule:"}),r.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,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Retries:"}),r.jsx("span",{className:"ml-2 text-xs",children:e.config.retries||"Default (3)"})]}),e.config.backoff&&(0,r.jsxs)("div",{children:[r.jsx("span",{className:"font-semibold text-xs",children:"Backoff:"}),(0,r.jsxs)("span",{className:"ml-2 text-xs",children:[e.config.backoff.type||"Default (exponential)"," (",e.config.backoff.delay||"Default (2000)","ms)"]})]})]})})]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(v.pj,{className:"text-right",children:r.jsx(x.z,{variant:"ghost",size:"sm",onClick:()=>$(e.id,e.name,e.config.queue,e.config.params),title:"Manually trigger source",children:r.jsx(i.Z,{className:"h-4 w-4"})})})]},e.id)})})]})})}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No sources found."})})]}),r.jsx(j.zF,{open:t,onOpenChange:s,children:(0,r.jsxs)(h.Zb,{className:"bg-none border-0 rounded-none",children:[r.jsx(h.Ol,{children:r.jsx(j.wy,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",children:[r.jsx(h.ll,{children:"Queues"}),(0,r.jsxs)(x.z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:[r.jsx(d.Z,{className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),r.jsx("span",{className:"sr-only",children:"Toggle sources"})]})]})})}),r.jsx(j.Fw,{children:r.jsx(h.aY,{children:G.length>0?r.jsx("div",{className:"space-y-4",children:G.map(e=>r.jsx("div",{children:r.jsx(S.R,{queueName:e,nameGenerator:e=>"Source update",retryJob:e=>{if(console.log("[EXULU] Retrying job: ",e),!e.data?.source||!e.data?.context)return;let t=L?.sources.find(t=>t.id===e.data?.source);if(!t){E.Am.error("Source not found for job: "+e.data?.source,{description:"The source was not found for the job. This might mean the source no longer exists."});return}let s=t.config;$(t.id,t.name,t.config.queue,s.params)}})},e))}):r.jsx("div",{className:"text-center text-muted-foreground p-5 border rounded-md",children:"No queues found."})})})]})})]}):r.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Context not found."}),r.jsx(N.Vq,{modal:!1,open:_,onOpenChange:e=>{O(e),e||(D({}),P(null))},children:(0,r.jsxs)(N.cZ,{children:[(0,r.jsxs)(N.fK,{children:[r.jsx(N.$N,{children:"Trigger Source"}),r.jsx(N.Be,{children:M?.queue?(0,r.jsxs)(r.Fragment,{children:["Are you sure you want to trigger ",r.jsx("strong",{children:M.name}),"?",r.jsx("br",{}),r.jsx("br",{}),"A job will be scheduled and visible in the ",r.jsx("span",{className:"font-semibold",children:M.queue})," queue."]}):(0,r.jsxs)(r.Fragment,{children:["Are you sure you want to trigger ",r.jsx("strong",{children:M?.name}),"?",r.jsx("br",{}),r.jsx("br",{}),"The source will be executed immediately without queuing."]})})]}),M?.params&&M.params.length>0&&(0,r.jsxs)("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"text-sm font-medium",children:"Parameters"}),M.params.map(e=>(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)(f._,{htmlFor:e.name,children:[e.name,e.description&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:e.description})]}),r.jsx(g.I,{id:e.name,value:R[e.name]||"",onChange:t=>{D(s=>({...s,[e.name]:t.target.value}))},placeholder:e.default||"",disabled:F})]},e.name))]}),(0,r.jsxs)(N.cN,{children:[r.jsx(x.z,{variant:"outline",onClick:()=>O(!1),disabled:F,children:"Cancel"}),r.jsx(x.z,{onClick:()=>{M&&Z({variables:{source:M.id,inputs:R}})},disabled:F,children:F?(0,r.jsxs)(r.Fragment,{children:[r.jsx(c.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Executing..."]}):(0,r.jsxs)(r.Fragment,{children:[r.jsx(i.Z,{className:"mr-2 h-4 w-4"}),"Trigger Source"]})})]})]})})]})}},42193:(e,t,s)=>{"use strict";s.d(t,{z:()=>f});var r=s(10326),n=s(17577),a=s(76812),l=s(57305),i=s(92977),d=s(98181),c=s(77863),o=s(90772),u=s(11890),x=s(39183),h=s(17757);function m({className:e,classNames:t,showOutsideDays:s=!0,...n}){return r.jsx(h._W,{showOutsideDays:s,className:(0,c.cn)("p-3",e),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",...t},components:{IconLeft:({...e})=>r.jsx(u.Z,{className:"size-4"}),IconRight:({...e})=>r.jsx(x.Z,{className:"size-4"})},...n})}m.displayName="Calendar";var p=s(34789),g=s(30811);function f({dateRange:e,onDateRangeChange:t,className:s,maxDays:u=30}){let{toast:x}=(0,p.pm)(),h=n.useMemo(()=>{if(!e?.from)return[];let t=e.from;return[{before:(0,i.E)(t,-u)},{after:(0,i.E)(t,u)}]},[e?.from,u]);return r.jsx("div",{className:(0,c.cn)("grid gap-2",s),children:(0,r.jsxs)(g.J2,{children:[r.jsx(g.xo,{asChild:!0,children:(0,r.jsxs)(o.z,{id:"date",variant:"outline",className:(0,c.cn)("w-[260px] justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[r.jsx(a.Que,{className:"mr-2 h-4 w-4"}),e?.from?e.to?(0,r.jsxs)(r.Fragment,{children:[(0,d.WU)(e.from,"LLL dd, y")," -"," ",(0,d.WU)(e.to,"LLL dd, y")]}):(0,d.WU)(e.from,"LLL dd, y"):r.jsx("span",{children:"Pick a date range"})]})}),(0,r.jsxs)(g.yk,{className:"w-auto p-0",align:"end",children:[r.jsx(m,{initialFocus:!0,mode:"range",defaultMonth:e?.from,selected:e,onSelect:e=>{if(e?.from&&e?.to&&(0,l.j)(e.to,e.from)>u){x({title:"Date range too large",description:`Please select a date range of ${u} days or less.`,variant:"destructive"});return}t(e)},disabled:h,numberOfMonths:2}),(0,r.jsxs)("div",{className:"p-3 pt-0 text-xs text-muted-foreground border-t",children:["Maximum range: ",u," days"]})]})]})})}},22746:(e,t,s)=>{"use strict";s.d(t,{Y:()=>m});var r=s(10326),n=s(17577),a=s(39167),l=s(34474),i=s(65304),d=s(42270),c=s(20751),o=s(78948),u=s(99630),x=s(90250);let h=["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 m({groupByOptions:e,dateRange:t,selectedType:s,groupBy:m,onGroupByChange:p,unit:g}){let{data:f,loading:j,error:v}=(0,a.aM)(d.YH,{variables:{type:s,groupBy:m,from:t?.from?.toISOString(),to:t?.to?.toISOString(),names:"tokens"===g?["inputTokens","outputTokens"]:["count"]},skip:!t?.from||!t?.to}),{chartData:y,chartConfig:b}=n.useMemo(()=>{if(!f?.trackingStatistics)return{chartData:[],chartConfig:{}};let e=f.trackingStatistics.map((e,t)=>{var s;return{name:(s=e?.group)&&"string"==typeof s?s.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):"Unknown",value:e?.count,fill:h[t%h.length]}}).sort((e,t)=>t.value-e.value),t=e.reduce((e,t,s)=>(e[t.name]={label:t.name,color:h[s%h.length]},e),{});return{chartData:e,chartConfig:t}},[f]);return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"Distribution"}),e.length>0&&r.jsx("div",{className:"w-full max-w-[150px]",children:(0,r.jsxs)(l.Ph,{value:m,onValueChange:p,children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Group by"})}),r.jsx(l.Bw,{children:e.map(e=>r.jsx(l.Ql,{value:e.value,children:e.label},e.value))})]})})]}),r.jsx("div",{className:"flex-1 min-h-0",children:j?r.jsx("div",{className:"space-y-4 h-full",children:r.jsx(i.O,{className:"h-full w-full"})}):v?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading distribution data: ",v.message]}):0===y.length?r.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."}):r.jsx(x.BO,{config:b,className:"h-full w-full",children:(0,r.jsxs)(c.u,{children:[r.jsx("defs",{children:y.map((e,t)=>(0,r.jsxs)("radialGradient",{id:`gradient-${e.name.replace(/\s+/g,"-")}`,cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:e.fill,stopOpacity:1}),r.jsx("stop",{offset:"100%",stopColor:e.fill,stopOpacity:.8})]},`gradient-${t}`))}),r.jsx(o.b,{data:y,cx:"50%",cy:"50%",labelLine:!1,label:({cx:e,cy:t,midAngle:s,innerRadius:n,outerRadius:a,percent:l,index:i})=>{if(l<.05)return null;let d=Math.PI/180,c=n+(a-n)*.5,o=e+c*Math.cos(-s*d);return r.jsx("text",{x:o,y:t+c*Math.sin(-s*d),fill:"black",textAnchor:o>e?"start":"end",dominantBaseline:"central",fontSize:"12",fontWeight:"600",paintOrder:"stroke",children:`${(100*l).toFixed(0)}%`})},outerRadius:"75%",innerRadius:"45%",dataKey:"value",strokeWidth:3,children:y.map((e,t)=>r.jsx(u.b,{fill:`url(#gradient-${e.name.replace(/\s+/g,"-")})`},`cell-${t}`))}),r.jsx(x.h7,{content:r.jsx(x.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})})]})})})]})}},16923:(e,t,s)=>{"use strict";s.d(t,{q:()=>y});var r=s(10326),n=s(17577),a=s(39167),l=s(34474),i=s(65304),d=s(42270),c=s(10669),o=s(18423),u=s(62637),x=s(9997),h=s(47445),m=s(90250),p=s(98181),g=s(99515),f=s(32067);function j(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}let v={count:{label:"Count",color:"hsl(var(--muted-foreground))"}};function y({dataTypes:e,dateRange:t,selectedType:s,onTypeChange:y,onUnitChange:b,unit:N,unitOptions:w}){let{data:k,loading:C,error:z}=(0,a.aM)(d.j9,{variables:{type:s,name:N,from:t?.from?.toISOString(),to:t?.to?.toISOString(),names:[N]},skip:!t?.from||!t?.to}),S=n.useMemo(()=>{if(!k?.trackingStatistics||!t?.from||!t?.to)return[];let e=new Map;return k.trackingStatistics.forEach(t=>{let s=new Date("number"==typeof t.group?t.group:Number(t.group)),r=(0,p.WU)((0,g.b)(s),"yyyy-MM-dd");e.set(r,t.count)}),(0,f.D)({start:(0,g.b)(t.from),end:(0,g.b)(t.to)}).map(t=>{let s=(0,p.WU)(t,"yyyy-MM-dd"),r=e.get(s)||0;return{date:t.getTime(),count:r,formattedDate:(0,p.WU)(t,"MMM dd"),dateObj:t}})},[k,t]);return(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-xl font-semibold",children:"Time Series Analytics"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-[150px]",children:(0,r.jsxs)(l.Ph,{value:s,onValueChange:e=>y(e),children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Select data type"})}),r.jsx(l.Bw,{children:e?.map(e=>r.jsx(l.Ql,{value:e,children:j(e)+" "},e))})]})}),w?.length>1&&r.jsx("div",{className:"w-[150px]",children:(0,r.jsxs)(l.Ph,{value:N,onValueChange:e=>b(e),children:[r.jsx(l.i4,{children:r.jsx(l.ki,{placeholder:"Select unit"})}),r.jsx(l.Bw,{children:w?.map(e=>r.jsx(l.Ql,{value:e.value,children:e.label},e.value))})]})})]})]}),r.jsx("div",{className:"flex-1 min-h-0",children:C?r.jsx("div",{className:"space-y-4 h-full",children:r.jsx(i.O,{className:"h-full w-full"})}):z?(0,r.jsxs)("div",{className:"flex items-center justify-center h-full text-red-500",children:["Error loading time series data: ",z.message]}):0===S.length?r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No data available for the selected date range and type"}):r.jsx(m.BO,{config:v,className:"h-full w-full",children:(0,r.jsxs)(c.T,{data:S,children:[(0,r.jsxs)("defs",{children:[(0,r.jsxs)("linearGradient",{id:"fillCount",x1:"0",y1:"0",x2:"0",y2:"1",children:[r.jsx("stop",{offset:"5%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.3}),r.jsx("stop",{offset:"95%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.05})]}),(0,r.jsxs)("linearGradient",{id:"strokeCount",x1:"0",y1:"0",x2:"1",y2:"0",children:[r.jsx("stop",{offset:"0%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.8}),r.jsx("stop",{offset:"100%",stopColor:"hsl(var(--muted-foreground))",stopOpacity:.6})]})]}),r.jsx(o.q,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,vertical:!1}),r.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}}),r.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}}),r.jsx(m.h7,{labelFormatter:(e,t)=>t&&t[0]?(0,p.WU)(t[0].payload.dateObj,"PPP")+" ":e,content:r.jsx(m.dg,{nameKey:"name",hideLabel:!0,formatter:(e,t)=>["number"==typeof e?e.toLocaleString():e," "+String(t)]})}),r.jsx(m.Qk,{content:r.jsx(m.cD,{})}),r.jsx(h.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:j(s)})]})})})]})}},29718:(e,t,s)=>{"use strict";s.d(t,{L:()=>n});var r=s(10326);function n({text:e,length:t}){return e.length>t?(0,r.jsxs)(r.Fragment,{children:[e.slice(0,t),"..."]}):r.jsx(r.Fragment,{children:e})}},90250:(e,t,s)=>{"use strict";s.d(t,{BO:()=>x,Qk:()=>g,cD:()=>f,dg:()=>p,h7:()=>m});var r=s(10326),n=s(17577),a=s(30660),l=s(44675),i=s(69274),d=s(77863);let c={light:"",dark:".dark"},o=n.createContext(null);function u(){let e=n.useContext(o);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let x=n.forwardRef(({id:e,className:t,children:s,config:l,...i},c)=>{let u=n.useId(),x=`chart-${e||u.replace(/:/g,"")}`;return r.jsx(o.Provider,{value:{config:l},children:(0,r.jsxs)("div",{"data-chart":x,ref:c,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",t),...i,children:[r.jsx(h,{id:x,config:l}),r.jsx(a.h,{children:s})]})})});x.displayName="Chart";let h=({id:e,config:t})=>{let s=Object.entries(t).filter(([,e])=>e.theme||e.color);return s.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(c).map(([t,r])=>`
|
|
2
|
+
${r} [data-chart=${e}] {
|
|
3
|
+
${s.map(([e,s])=>{let r=s.theme?.[t]||s.color;return r?` --color-${e}: ${r};`:null}).join("\n")}
|
|
4
4
|
}
|
|
5
|
-
`).join("\n")}}):null},h=n.u,p=l.forwardRef(({active:e,payload:t,className:s,indicator:r="dot",hideLabel:n=!1,hideIndicator:i=!1,label:o,labelFormatter:c,labelClassName:x,formatter:m,color:h,nameKey:p,labelKey:g},f)=>{let{config:v}=u(),y=l.useMemo(()=>{if(n||!t?.length)return null;let[e]=t,s=`${g||e?.dataKey||e?.name||"value"}`,l=j(v,e,s),r=g||"string"!=typeof o?l?.label:v[o]?.label||o;return c?a.jsx("div",{className:(0,d.cn)("font-medium",x),children:c(r,t)}):r?a.jsx("div",{className:(0,d.cn)("font-medium",x),children:r}):null},[o,c,t,n,x,v,g]);if(!e||!t?.length)return null;let b=1===t.length&&"dot"!==r;return(0,a.jsxs)("div",{ref:f,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",s),children:[b?null:y,a.jsx("div",{className:"grid gap-1.5",children:t.map((e,t)=>{let s=`${p||e.name||e.dataKey||"value"}`,l=j(v,e,s),n=h||e.payload.fill||e.color;return a.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"===r&&"items-center"),children:m&&e?.value!==void 0&&e.name?m(e.value,e.name,e,t,e.payload):(0,a.jsxs)(a.Fragment,{children:[l?.icon?a.jsx(l.icon,{}):!i&&a.jsx("div",{className:(0,d.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===r,"w-1":"line"===r,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===r,"my-0.5":b&&"dashed"===r}),style:{"--color-bg":n,"--color-border":n}}),(0,a.jsxs)("div",{className:(0,d.cn)("flex flex-1 justify-between leading-none",b?"items-end":"items-center"),children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[b?y:null,a.jsx("span",{className:"text-muted-foreground",children:l?.label||e.name})]}),e.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});p.displayName="ChartTooltip";let g=i.D,f=l.forwardRef(({className:e,hideIcon:t=!1,payload:s,verticalAlign:l="bottom",nameKey:r},n)=>{let{config:i}=u();return s?.length?a.jsx("div",{ref:n,className:(0,d.cn)("flex items-center justify-center gap-4","top"===l?"pb-3":"pt-3",e),children:s.map(e=>{let s=`${r||e.dataKey||"value"}`,l=j(i,e,s);return(0,a.jsxs)("div",{className:(0,d.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[l?.icon&&!t?a.jsx(l.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),l?.label]},e.value)})}):null});function j(e,t,s){if("object"!=typeof t||null===t)return;let a="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,l=s;return s in t&&"string"==typeof t[s]?l=t[s]:a&&s in a&&"string"==typeof a[s]&&(l=a[s]),l in e?e[l]:e[s]}f.displayName="ChartLegend"},15940:(e,t,s)=>{"use strict";s.d(t,{RM:()=>d,Rn:()=>x,SC:()=>o,iA:()=>n,pj:()=>u,ss:()=>c,xD:()=>i});var a=s(10326),l=s(17577),r=s(77863);let n=l.forwardRef(({className:e,...t},s)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:s,className:(0,r.cn)("w-full caption-bottom text-sm",e),...t})}));n.displayName="Table";let i=l.forwardRef(({className:e,...t},s)=>a.jsx("thead",{ref:s,className:(0,r.cn)("[&_tr]:border-b",e),...t}));i.displayName="TableHeader";let d=l.forwardRef(({className:e,...t},s)=>a.jsx("tbody",{ref:s,className:(0,r.cn)("[&_tr:last-child]:border-0",e),...t}));d.displayName="TableBody",l.forwardRef(({className:e,...t},s)=>a.jsx("tfoot",{ref:s,className:(0,r.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let o=l.forwardRef(({className:e,...t},s)=>a.jsx("tr",{ref:s,className:(0,r.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));o.displayName="TableRow";let c=l.forwardRef(({className:e,...t},s)=>a.jsx("th",{ref:s,className:(0,r.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),...t}));c.displayName="TableHead";let u=l.forwardRef(({className:e,...t},s)=>a.jsx("td",{ref:s,className:(0,r.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:w-[40px]",e),...t}));u.displayName="TableCell";let x=l.forwardRef(({className:e,...t},s)=>a.jsx("caption",{ref:s,className:(0,r.cn)("mt-4 text-sm text-muted-foreground",e),...t}));x.displayName="TableCaption"},77961:(e,t,s)=>{"use strict";s.d(t,{jF:()=>R,jU:()=>Z,ZP:()=>O,NF:()=>M});var a=s(10326),l=s(17577);s(32964),s(59946),s(27221);var r=s(59161),n=s(30463);let i=function(e,t=[]){(0,l.useContext)(n.E);let[s,a]=(0,l.useState)(void 0);return s};var d=s(84714),o=s(31540),c=s(15557),u=s(61086),x=s(11890),m=s(39183),h=s(36283),p=s(71709),g=s(39572),f=s(83855),j=s(94019),v=s(3240),y=s(90772),b=s(62288),N=s(65685),w=s(3574),k=s(20108),C=s(10119),z=s(54432),S=s(76812),E=s(33071),_=s(65304);function R({s3key:e,children:t}){let{data:s,isLoading:l,error:n,refetch:i}=(0,k.a)({queryKey:["fileObject",e],queryFn:async()=>e?await r.QZ.object(e):null,enabled:null!=e});return e?(0,a.jsxs)(E.Zb,{children:[a.jsx(E.Ol,{className:"pb-3",children:a.jsx(E.ll,{className:"text-sm truncate",children:e.split("_EXULU_").pop()})}),(0,a.jsxs)(E.aY,{className:"pt-0",children:[l&&(0,a.jsxs)("div",{className:"space-y-2",children:[a.jsx(_.O,{className:"h-4 w-full"}),a.jsx(_.O,{className:"h-4 w-2/3"})]}),!l&&s&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsx("span",{className:"capitalize",children:s?.ContentType.split("/").pop()}),(0,a.jsxs)("span",{children:[(s?.ContentLength/1024/1024).toFixed(2)," MB"]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{children:["Last modified: ",new Date(s?.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,a.jsxs)(y.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{r.QZ.download(e).then(async e=>{console.log("res",e);let t=await e.json();console.log("res",t);let s=t.url;window.open(s,"_blank")})},children:[a.jsx("span",{className:"mr-1 text-xs",children:"View"}),a.jsx(o.Z,{className:"h-3 w-3"})]})]})]}),!l&&n&&a.jsx("p",{className:"text-xs text-muted-foreground",children:n.message}),t]})]}):a.jsx(E.Zb,{children:(0,a.jsxs)(E.aY,{className:"p-3 flex",children:[a.jsx("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),t]})})}function O({id:e,allowedFileTypes:t,dependencies:s,onConfirm:r,selectionLimit:n,buttonText:i}){let[d,o]=(0,l.useState)(!1);return(0,a.jsxs)(b.Vq,{open:d,onOpenChange:o,children:[a.jsx(b.hg,{asChild:!0,children:(0,a.jsxs)(y.z,{variant:"outline",children:[i&&a.jsx("span",{className:"mr-2",children:i}),a.jsx(c.Z,{className:"h-4 w-4"})]})}),(0,a.jsxs)(b.cZ,{className:"sm:max-w-[900px]",children:[(0,a.jsxs)(b.fK,{children:[a.jsx(b.$N,{children:"File Gallery"}),a.jsx(b.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),a.jsx(D,{id:e,allowedFileTypes:t,dependencies:s,selectionLimit:n,onConfirm:e=>{r(e),o(!1)}})]})]})}let D=({id:e,allowedFileTypes:t,dependencies:s,onConfirm:o,selectionLimit:c})=>{t||(t=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[h,p]=(0,l.useState)(void 0),[g,f]=(0,l.useState)(void 0),[j,v]=(0,l.useState)(void 0),b=(0,l.useContext)(n.E),[E,R]=(0,l.useState)([]),O=e=>{if(E.includes(e)){R(E.filter(t=>t!==e));return}if(1===c){R([e]);return}E.length>=c||R([...E,e])},D=(0,C.D)({mutationFn:async({key:e})=>{await r.QZ.delete(e),q()}}),{data:L,isLoading:M,error:P,refetch:q}=(0,k.a)({queryKey:["filesQuery",h,j],staleTime:3e4,queryFn:async()=>r.QZ.list({search:h,continuationToken:j})});console.log("!! data !!",L);let{theme:I}=(0,w.F)(),T=i({backend:b?.backend||"",uppyOptions:{id:e,allowedFileTypes:t},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},s);return((0,l.useEffect)(()=>{q()},[h,j]),T)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,a.jsxs)("div",{className:"border rounded-lg p-4",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),a.jsx(z.I,{placeholder:"Search files...",value:h,onChange:e=>p(e.target.value),className:"mb-3"}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,a.jsxs)("span",{children:[E.length," / ",c," files selected"]}),(0,a.jsxs)("span",{children:["Allowed file types: ",t?.map(e=>e).join(", ")]})]}),(0,a.jsxs)(N.x,{children:[M&&(0,a.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"}),a.jsx(_.O,{className:"h-[120px] w-full"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!M&&!L?.Contents?.length&&(0,a.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(u.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),a.jsx("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),L?.Contents?.map(e=>a.jsx(Z,{s3Key:e.Key,onSelect:O,active:E.some(t=>t===e.Key),onRemove:()=>{D.mutate({key:e.Key})},disabled:!!t&&!t?.some(t=>e.Key.endsWith(t))}))]}),a.jsx("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)(y.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{v(void 0)},disabled:!j||M,children:[a.jsx("span",{className:"sr-only",children:"Go to first page"}),a.jsx(S.kRt,{className:"size-4"})]}),(0,a.jsxs)(y.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{v(g)},disabled:!j||M,children:[a.jsx("span",{className:"sr-only",children:"Go to previous page"}),a.jsx(x.Z,{className:"size-4"})]}),(0,a.jsxs)(y.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{f(j),v(L?.NextContinuationToken)},disabled:!L?.NextContinuationToken||M,children:[a.jsx("span",{className:"sr-only",children:"Go to next page"}),a.jsx(m.Z,{className:"size-4"})]})]})})]})]}),(0,a.jsxs)("div",{className:"border rounded-lg p-4",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),a.jsx(d.A,{uppy:T,theme:"dark"===I?"dark":"light"})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(y.z,{variant:"outline",onClick:()=>{o(E),R([])},children:"Confirm"})})]}):null},Z=({s3Key:e,onSelect:t,onRemove:s,active:l,disabled:n,addToContext:i})=>{let d;return(0,a.jsxs)("div",{className:`${n?"opacity-50":""} group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ${l?"border border-purple-500":"border"}`,onClick:()=>{!n&&t&&t(e)},children:[a.jsx("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:e&&(e.toLowerCase().endsWith("jpg")||e.toLowerCase().endsWith("jpeg")||e.toLowerCase().endsWith("png")||e.toLowerCase().endsWith("svg"))?a.jsx(P,{fileKey:e}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[(d=e)?d.toLowerCase().endsWith("jpg")||d.toLowerCase().endsWith("jpeg")||d.toLowerCase().endsWith("png")||d.toLowerCase().endsWith("svg")?a.jsx(p.Z,{className:"h-6 w-6 text-blue-500"}):d.endsWith("pdf")?a.jsx(g.Z,{className:"h-6 w-6 text-red-500"}):d.endsWith("xls")||d.endsWith("xlsx")||d.endsWith("csv")?a.jsx(h.Z,{className:"h-6 w-6 text-green-500"}):d.endsWith("ppt")||d.endsWith("pptx")?a.jsx(h.Z,{className:"h-6 w-6 text-orange-500"}):a.jsx(h.Z,{className:"h-6 w-6 text-gray-500"}):a.jsx(h.Z,{className:"h-6 w-6 text-gray-500"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:e?e.split("_EXULU_").pop():e})]})}),a.jsx("p",{className:"text-xs truncate",children:e?e.split("_EXULU_").pop():e}),(0,a.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[i&&(0,a.jsxs)(y.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{i(e)},children:[a.jsx(f.Z,{className:"h-3 w-3"}),a.jsx("span",{className:"sr-only",children:"Add"})]}),(0,a.jsxs)(y.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{r.QZ.download(e).then(async e=>{console.log("res",e);let t=await e.json();console.log("res",t);let s=t.url;window.open(s,"_blank")})},children:[a.jsx(o.Z,{className:"h-3 w-3"}),a.jsx("span",{className:"sr-only",children:"View"})]}),s&&(0,a.jsxs)(y.z,{onClick:t=>{t.stopPropagation(),s(e)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[a.jsx(j.Z,{className:"h-3 w-3"}),a.jsx("span",{className:"sr-only",children:"Remove"})]})]})]},e)},L={},M=async e=>{if(L[e]){if(!(L[e].expiresAt<Date.now()))return L[e].url;delete L[e]}let t=await r.QZ.download(e),s=await t.json();return console.log("json",s),L[e]={url:s.url,expiresAt:Date.now()+6e4},s.url},P=({fileKey:e})=>{console.log("key",e);let t=(0,k.a)({queryKey:["imageQuery",e],staleTime:3e4,queryFn:async()=>M(e)});return t.isLoading?a.jsx("div",{children:a.jsx(v.Z,{})}):t.isLoading||t.data?a.jsx("img",{src:t.data,alt:e,className:"object-cover w-full h-full"}):a.jsx("div",{children:a.jsx(u.Z,{})})}},75909:(e,t,s)=>{"use strict";s.d(t,{t:()=>r});var a=s(42270),l=s(39167);let r=()=>(0,l.aM)(a.uw,{variables:{limit:20}})},40900:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).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"}]])},24081:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).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"}]])},21986:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).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"}]])},23015:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).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"}]])},44389:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},91468:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])},91470:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},35157:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});let a=(0,s(76557).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"}]])},31051:(e,t,s)=>{"use strict";s.d(t,{h:()=>a});let a={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"}},76738:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>a});let a=(0,s(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx#default`)},21114:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>a});let a=(0,s(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx#default`)}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[9276,3543,9049,590,814,931,6812,7344,1729,3738,5237,8212,108,4552,3679,6508,2194,8181,3702,5999,38,7471,5028,5483,1051,7944,2270,5600,6590,8286,6623],()=>s(39701));module.exports=a})();
|
|
5
|
+
`).join("\n")}}):null},m=l.u,p=n.forwardRef(({active:e,payload:t,className:s,indicator:a="dot",hideLabel:l=!1,hideIndicator:i=!1,label:c,labelFormatter:o,labelClassName:x,formatter:h,color:m,nameKey:p,labelKey:g},f)=>{let{config:v}=u(),y=n.useMemo(()=>{if(l||!t?.length)return null;let[e]=t,s=`${g||e?.dataKey||e?.name||"value"}`,n=j(v,e,s),a=g||"string"!=typeof c?n?.label:v[c]?.label||c;return o?r.jsx("div",{className:(0,d.cn)("font-medium",x),children:o(a,t)}):a?r.jsx("div",{className:(0,d.cn)("font-medium",x),children:a}):null},[c,o,t,l,x,v,g]);if(!e||!t?.length)return null;let b=1===t.length&&"dot"!==a;return(0,r.jsxs)("div",{ref:f,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",s),children:[b?null:y,r.jsx("div",{className:"grid gap-1.5",children:t.map((e,t)=>{let s=`${p||e.name||e.dataKey||"value"}`,n=j(v,e,s),l=m||e.payload.fill||e.color;return r.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"===a&&"items-center"),children:h&&e?.value!==void 0&&e.name?h(e.value,e.name,e,t,e.payload):(0,r.jsxs)(r.Fragment,{children:[n?.icon?r.jsx(n.icon,{}):!i&&r.jsx("div",{className:(0,d.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===a,"w-1":"line"===a,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===a,"my-0.5":b&&"dashed"===a}),style:{"--color-bg":l,"--color-border":l}}),(0,r.jsxs)("div",{className:(0,d.cn)("flex flex-1 justify-between leading-none",b?"items-end":"items-center"),children:[(0,r.jsxs)("div",{className:"grid gap-1.5",children:[b?y:null,r.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),e.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});p.displayName="ChartTooltip";let g=i.D,f=n.forwardRef(({className:e,hideIcon:t=!1,payload:s,verticalAlign:n="bottom",nameKey:a},l)=>{let{config:i}=u();return s?.length?r.jsx("div",{ref:l,className:(0,d.cn)("flex items-center justify-center gap-4","top"===n?"pb-3":"pt-3",e),children:s.map(e=>{let s=`${a||e.dataKey||"value"}`,n=j(i,e,s);return(0,r.jsxs)("div",{className:(0,d.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[n?.icon&&!t?r.jsx(n.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null});function j(e,t,s){if("object"!=typeof t||null===t)return;let r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,n=s;return s in t&&"string"==typeof t[s]?n=t[s]:r&&s in r&&"string"==typeof r[s]&&(n=r[s]),n in e?e[n]:e[s]}f.displayName="ChartLegend"},75909:(e,t,s)=>{"use strict";s.d(t,{t:()=>a});var r=s(42270),n=s(39167);let a=()=>(0,n.aM)(r.uw,{variables:{limit:20}})},40900:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).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"}]])},24081:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).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"}]])},21986:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).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"}]])},23015:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).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"}]])},44389:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},91468:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])},91470:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).Z)("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},35157:(e,t,s)=>{"use strict";s.d(t,{Z:()=>r});let r=(0,s(76557).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"}]])},31051:(e,t,s)=>{"use strict";s.d(t,{h:()=>r});let r={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"}},76738:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>r});let r=(0,s(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/layout.tsx#default`)},21114:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>r});let r=(0,s(68570).createProxy)(String.raw`/home/runner/work/exulu-frontend/exulu-frontend/app/(application)/data/[[...query]]/page.tsx#default`)}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[9276,3543,9049,590,814,931,6812,7344,1729,3738,5237,8212,4552,6508,108,2194,9874,8181,3702,5999,1025,7471,5028,5483,1051,7944,2270,5600,5974,6590,8286,5485],()=>s(39701));module.exports=r})();
|