@exulu/frontend 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/app-build-manifest.json +98 -99
- package/dist/.next/app-path-routes-manifest.json +1 -1
- package/dist/.next/build-manifest.json +2 -2
- package/dist/.next/prerender-manifest.json +1 -1
- package/dist/.next/server/app/(application)/agents/edit/[id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/agents/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/chat/[agent]/[session]/page.js +1 -1
- package/dist/.next/server/app/(application)/chat/[agent]/[session]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/chat/[agent]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/chat/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/configuration/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/dashboard/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/data/[[...query]]/page.js +3 -3
- 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_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_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/projects/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/prompts/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/roles/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/token/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/users/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/create/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/edit/[variable_id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/variables/usage/[variable_id]/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(application)/workflows/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/(authentication)/login/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/.next/server/app/_not-found.html +1 -1
- package/dist/.next/server/app/_not-found.rsc +1 -1
- package/dist/.next/server/app/api/auth/[...nextauth]/route.js +2 -2
- package/dist/.next/server/app-paths-manifest.json +4 -4
- package/dist/.next/server/chunks/1051.js +2 -2
- package/dist/.next/server/chunks/2270.js +1 -0
- package/dist/.next/server/chunks/2948.js +1 -1
- package/dist/.next/server/chunks/3434.js +1 -1
- package/dist/.next/server/chunks/3575.js +1 -1
- package/dist/.next/server/chunks/5485.js +1 -0
- package/dist/.next/server/chunks/8050.js +1 -1
- package/dist/.next/server/middleware-manifest.json +5 -5
- package/dist/.next/server/pages/404.html +1 -1
- package/dist/.next/server/pages/500.html +1 -1
- package/dist/.next/server/server-reference-manifest.json +1 -1
- package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js +2 -0
- package/dist/.next/static/chunks/1685-9cacdee7e3f0942f.js.map +1 -0
- package/dist/.next/static/chunks/1957-39a01a3915f246ab.js +2 -0
- package/dist/.next/static/chunks/1957-39a01a3915f246ab.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/{7856-9fa733bdd6429ba8.js → 6066-65606593516b2a3a.js} +18 -18
- package/dist/.next/static/chunks/6066-65606593516b2a3a.js.map +1 -0
- package/dist/.next/static/chunks/{6373-7908bd5269f95aa3.js → 6373-4c5dffaf4193621c.js} +2 -2
- package/dist/.next/static/chunks/6373-4c5dffaf4193621c.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/app/(application)/agents/edit/[id]/{page-29794b9c33d2bf7e.js → page-4e7e02768ed1a72a.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/agents/edit/[id]/page-4e7e02768ed1a72a.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.js +2 -0
- package/dist/.next/static/chunks/app/(application)/chat/[agent]/[session]/page-38f845d5ccdad76b.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-a391b8407f74e9b4.js +2 -0
- package/dist/.next/static/chunks/app/(application)/data/[[...query]]/page-a391b8407f74e9b4.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js +2 -0
- package/dist/.next/static/chunks/app/(application)/evals/[id]/page-cf6f8d2bd4e9c819.js.map +1 -0
- package/dist/.next/static/chunks/app/(application)/projects/[project]/{page-0b2d9832e5a023e7.js → page-bc859da58d8505f7.js} +2 -2
- package/dist/.next/static/chunks/app/(application)/projects/[project]/page-bc859da58d8505f7.js.map +1 -0
- package/dist/.next/static/css/c8c015815c72d053.css +4 -0
- package/dist/.next/static/css/c8c015815c72d053.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/6623.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/6373-7908bd5269f95aa3.js.map +0 -1
- package/dist/.next/static/chunks/7856-9fa733bdd6429ba8.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/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.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 → GOwerAkBncYx0J8q1TqQb}/_buildManifest.js +0 -0
- /package/dist/.next/static/{J23NmkaMjAJYnE0jX_kO0 → GOwerAkBncYx0J8q1TqQb}/_ssgManifest.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3750],{53245:function(e,s,t){t.d(s,{d:function(){return x},f:function(){return h}});var n=t(57437),l=t(62869),r=t(94508),a=t(30401),i=t(78867),o=t(2265),d=t(34996),c=t(1479),u=t(9880);let m=(0,o.createContext)({code:""}),x=e=>{let{code:s,language:t,showLineNumbers:l=!1,className:a,children:i,...o}=e;return(0,n.jsx)(m.Provider,{value:{code:s},children:(0,n.jsx)("div",{className:(0,r.cn)("relative w-full overflow-hidden rounded-md border bg-background text-foreground",a),...o,children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(d.Z,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:l,style:c.Z,children:s}),(0,n.jsx)(d.Z,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:l,style:u.Z,children:s}),i&&(0,n.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:i})]})})})},h=e=>{let{onCopy:s,onError:t,timeout:d=2e3,children:c,className:u,...x}=e,[h,p]=(0,o.useState)(!1),{code:f}=(0,o.useContext)(m),g=async()=>{if(!navigator.clipboard.writeText){null==t||t(Error("Clipboard API not available"));return}try{await navigator.clipboard.writeText(f),p(!0),null==s||s(),setTimeout(()=>p(!1),d)}catch(e){null==t||t(e)}},j=h?a.Z:i.Z;return(0,n.jsx)(l.z,{className:(0,r.cn)("shrink-0",u),onClick:g,size:"icon",variant:"ghost",...x,children:null!=c?c:(0,n.jsx)(j,{size:14})})}},35629:function(e,s,t){t.d(s,{H:function(){return x}});var n=t(57437),l=t(94508),r=t(2265),a=t(86816),i=t(67245),o=t(58146),d=t(85020),c=t(53245);t(2446);let u=(0,t(86589).Z)(a.UG),m={ol:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("ol",{className:(0,l.cn)("ml-4 list-outside list-decimal",r),...a,children:t})},li:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("li",{className:(0,l.cn)("py-1",r),...a,children:t})},ul:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("ul",{className:(0,l.cn)("ml-4 list-outside list-disc",r),...a,children:t})},hr:e=>{let{node:s,className:t,...r}=e;return(0,n.jsx)("hr",{className:(0,l.cn)("my-6 border-border",t),...r})},strong:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("span",{className:(0,l.cn)("font-semibold",r),...a,children:t})},a:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("a",{className:(0,l.cn)("font-medium text-primary underline",r),rel:"noreferrer",target:"_blank",...a,children:t})},h1:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h1",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-3xl",r),...a,children:t})},h2:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h2",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-2xl",r),...a,children:t})},h3:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h3",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-xl",r),...a,children:t})},h4:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h4",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-lg",r),...a,children:t})},h5:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h5",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-base",r),...a,children:t})},h6:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h6",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-sm",r),...a,children:t})},table:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,n.jsx)("table",{className:(0,l.cn)("w-full border-collapse border border-border",r),...a,children:t})})},thead:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("thead",{className:(0,l.cn)("bg-muted/50",r),...a,children:t})},tbody:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("tbody",{className:(0,l.cn)("divide-y divide-border",r),...a,children:t})},tr:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("tr",{className:(0,l.cn)("border-border border-b",r),...a,children:t})},th:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("th",{className:(0,l.cn)("px-4 py-2 text-left font-semibold text-sm",r),...a,children:t})},td:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("td",{className:(0,l.cn)("px-4 py-2 text-sm",r),...a,children:t})},blockquote:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("blockquote",{className:(0,l.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",r),...a,children:t})},code:e=>{var s,t;let{node:r,className:a,...i}=e;return(null==r?void 0:null===(s=r.position)||void 0===s?void 0:s.start.line)!==(null==r?void 0:null===(t=r.position)||void 0===t?void 0:t.end.line)?(0,n.jsx)("code",{className:a,...i}):(0,n.jsx)("code",{className:(0,l.cn)("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",a),...i})},pre:e=>{var s;let{node:t,className:a,children:i}=e,o="javascript";"string"==typeof(null==t?void 0:null===(s=t.properties)||void 0===s?void 0:s.className)&&(o=t.properties.className.replace("language-",""));let d="";return(0,r.isValidElement)(i)&&i.props&&"string"==typeof i.props.children?d=i.props.children:"string"==typeof i&&(d=i),(0,n.jsx)(c.d,{className:(0,l.cn)("my-4 h-auto",a),code:d,language:o,children:(0,n.jsx)(c.f,{onCopy:()=>console.log("Copied code to clipboard"),onError:()=>console.error("Failed to copy code to clipboard")})})}},x=(0,r.memo)(e=>{let{className:s,options:t,children:r,allowedImagePrefixes:a,allowedLinkPrefixes:c,defaultOrigin:x,parseIncompleteMarkdown:h=!0,...p}=e,f="string"==typeof r&&h?function(e){if(!e||"string"!=typeof e)return e;let s=e,t=s.match(/(!?\[)([^\]]*?)$/);if(t){let e=s.lastIndexOf(t[1]);s=s.substring(0,e)}if(s.match(/(\*\*)([^*]*?)$/)&&(s.match(/\*\*/g)||[]).length%2==1&&(s="".concat(s,"**")),s.match(/(__)([^_]*?)$/)&&(s.match(/__/g)||[]).length%2==1&&(s="".concat(s,"__")),s.match(/(\*)([^*]*?)$/)&&s.split("").reduce((e,t,n)=>{if("*"===t){let t=s[n-1],l=s[n+1];if("*"!==t&&"*"!==l)return e+1}return e},0)%2==1&&(s="".concat(s,"*")),s.match(/(_)([^_]*?)$/)&&s.split("").reduce((e,t,n)=>{if("_"===t){let t=s[n-1],l=s[n+1];if("_"!==t&&"_"!==l)return e+1}return e},0)%2==1&&(s="".concat(s,"_")),s.match(/(`)([^`]*?)$/)&&(s.includes("```"),(s.match(/```[\s\S]*?```/g)||[]).length,(s.match(/```/g)||[]).length%2!=1)){let e=0;for(let t=0;t<s.length;t++)if("`"===s[t]){let n="```"===s.substring(t,t+3),l=t>0&&"```"===s.substring(t-1,t+2),r=t>1&&"```"===s.substring(t-2,t+1);!(n||l||r)&&e++}e%2==1&&(s="".concat(s,"`"))}return s.match(/(~~)([^~]*?)$/)&&(s.match(/~~/g)||[]).length%2==1&&(s="".concat(s,"~~")),s}(r):r;return(0,n.jsx)("div",{className:(0,l.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",s),...p,children:(0,n.jsx)(u,{allowedImagePrefixes:null!=a?a:["*"],allowedLinkPrefixes:null!=c?c:["*"],components:m,defaultOrigin:x,rehypePlugins:[i.Z],remarkPlugins:[o.Z,d.Z],...t,children:f})})},(e,s)=>e.children===s.children);x.displayName="Response"},65613:function(e,s,t){t.d(s,{Cd:function(){return d},X:function(){return c},bZ:function(){return o}});var n=t(57437),l=t(90535),r=t(2265),a=t(94508);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"}}),o=r.forwardRef((e,s)=>{let{className:t,variant:l,...r}=e;return(0,n.jsx)("div",{ref:s,role:"alert",className:(0,a.cn)(i({variant:l}),t),...r})});o.displayName="Alert";let d=r.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,n.jsx)("h5",{ref:s,className:(0,a.cn)("mb-1 font-medium leading-none tracking-tight",t),...l})});d.displayName="AlertTitle";let c=r.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,n.jsx)("div",{ref:s,className:(0,a.cn)("text-sm [&_p]:leading-relaxed",t),...l})});c.displayName="AlertDescription"},74928:function(e,s,t){t.d(s,{Fw:function(){return a},wy:function(){return r},zF:function(){return l}});var n=t(88985);let l=n.fC,r=n.wy,a=n.Fw},12339:function(e,s,t){t.d(s,{SP:function(){return d},dr:function(){return o},mQ:function(){return i},nU:function(){return c}});var n=t(57437),l=t(20271),r=t(2265),a=t(94508);let i=l.fC,o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,n.jsx)(l.aV,{ref:s,className:(0,a.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r})});o.displayName=l.aV.displayName;let d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,n.jsx)(l.xz,{ref:s,className:(0,a.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...r})});d.displayName=l.xz.displayName;let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,n.jsx)(l.VY,{ref:s,className:(0,a.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r})});c.displayName=l.VY.displayName},77992:function(e,s,t){t.d(s,{Am:function(){return u},pm:function(){return m}});var n=t(2265);let l=0,r=new Map,a=e=>{if(r.has(e))return;let s=setTimeout(()=>{r.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,s)},i=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?a(t):e.toasts.forEach(e=>{a(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},o=[],d={toasts:[]};function c(e){d=i(d,e),o.forEach(e=>{e(d)})}function u(e){let{...s}=e,t=(l=(l+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>c({type:"DISMISS_TOAST",toastId:t});return c({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||n()}}}),{id:t,dismiss:n,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function m(){let[e,s]=n.useState(d);return n.useEffect(()=>(o.push(s),()=>{let e=o.indexOf(s);e>-1&&o.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},78361:function(e,s,t){t.d(s,{jF:function(){return A},jU:function(){return R},ZP:function(){return L},NF:function(){return I}});var n=t(57437),l=t(2265),r=t(47632),a=t(1109);t(46693),t(51832);var i=t(6374),o=t(44045);let d=async e=>{var s;if(!e.backend)throw Error("No backend set.");let{callbacks:t,maxNumberOfFiles:n,uppyOptions:l}=e||{},{uploadSuccess:o}=t||{},{allowedFileTypes:d,id:c}=l||{},u=await (0,i.LP)(),m=new r.Z({autoProceed:!0,debug:!1,id:c||"uppy",restrictions:{maxNumberOfFiles:n||5,allowedFileTypes:d||[".heic",".jpg",".jpeg",".png",".webp",".svg"]}}).use(a.Z,{id:"Exulu",endpoint:e.backend,headers:{Authorization:"Bearer ".concat(u),Session:null!==(s=localStorage.getItem("session"))&&void 0!==s?s:""}}).on("file-added",async e=>{console.debug("added",e)}).on("upload-error",(e,s)=>{(null==e?void 0:e.id)&&(m.removeFile(null==e?void 0:e.id),console.error("error",s))}).on("upload-success",(e,s)=>{s.uploadURL&&o&&(console.log("response",s),o({file:e,key:s.uploadURL.split("/").pop()||"",url:s.uploadURL}))});return m};var c=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(0,l.useContext)(o.E),[n,r]=(0,l.useState)(void 0);return(0,l.useEffect)(()=>((async()=>{r(await d({...e,backend:(null==t?void 0:t.backend)||""}))})(),()=>{n&&(n.destroy(),r(void 0))}),[...s]),n},u=t(80007),m=t(92735),x=t(88964),h=t(30044),p=t(92451),f=t(10407),g=t(48736),j=t(53113),v=t(69658),b=t(99397),N=t(32489),y=t(15001),w=t(62869),k=t(26110),S=t(19378),C=t(78298),Z=t(11713),_=t(21770),T=t(95186),O=t(20653),z=t(66070),E=t(93022);function A(e){let{s3key:s,children:t}=e,{data:r,isLoading:a,error:o,refetch:d}=(0,Z.a)({queryKey:["fileObject",s],queryFn:async()=>s?await i.QZ.object(s):null,enabled:null!=s});return((0,l.useEffect)(()=>{s&&d()},[s]),s)?(0,n.jsxs)(z.Zb,{children:[(0,n.jsx)(z.Ol,{className:"pb-3",children:(0,n.jsx)(z.ll,{className:"text-sm truncate",children:s.split("_EXULU_").pop()})}),(0,n.jsxs)(z.aY,{className:"pt-0",children:[a&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(E.O,{className:"h-4 w-full"}),(0,n.jsx)(E.O,{className:"h-4 w-2/3"})]}),!a&&r&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsx)("span",{className:"capitalize",children:null==r?void 0:r.ContentType.split("/").pop()}),(0,n.jsxs)("span",{children:[((null==r?void 0:r.ContentLength)/1024/1024).toFixed(2)," MB"]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{children:["Last modified: ",new Date(null==r?void 0:r.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,n.jsxs)(w.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{i.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,n.jsx)("span",{className:"mr-1 text-xs",children:"View"}),(0,n.jsx)(m.Z,{className:"h-3 w-3"})]})]})]}),!a&&o&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:o.message}),t]})]}):(0,n.jsx)(z.Zb,{children:(0,n.jsxs)(z.aY,{className:"p-3 flex",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),t]})})}function L(e){let{id:s,allowedFileTypes:t,dependencies:r,onConfirm:a,selectionLimit:i,buttonText:o}=e,[d,c]=(0,l.useState)(!1);return(0,n.jsxs)(k.Vq,{open:d,onOpenChange:c,children:[(0,n.jsx)(k.hg,{asChild:!0,children:(0,n.jsxs)(w.z,{variant:"outline",children:[o&&(0,n.jsx)("span",{className:"mr-2",children:o}),(0,n.jsx)(x.Z,{className:"h-4 w-4"})]})}),(0,n.jsxs)(k.cZ,{className:"sm:max-w-[900px]",children:[(0,n.jsxs)(k.fK,{children:[(0,n.jsx)(k.$N,{children:"File Gallery"}),(0,n.jsx)(k.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),(0,n.jsx)(F,{id:s,allowedFileTypes:t,dependencies:r,selectionLimit:i,onConfirm:e=>{a(e),c(!1)}})]})]})}let F=e=>{var s,t;let{id:r,allowedFileTypes:a,dependencies:d,onConfirm:m,selectionLimit:x}=e;a||(a=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[g,j]=(0,l.useState)(void 0),[v,b]=(0,l.useState)(void 0),[N,y]=(0,l.useState)(void 0),k=(0,l.useContext)(o.E),[z,A]=(0,l.useState)([]),L=e=>{if(z.includes(e)){A(z.filter(s=>s!==e));return}if(1===x){A([e]);return}z.length>=x||A([...z,e])},F=(0,_.D)({mutationFn:async e=>{let{key:s}=e;await i.QZ.delete(s),P()}}),{data:U,isLoading:I,error:W,refetch:P}=(0,Z.a)({queryKey:["filesQuery",g,N],staleTime:3e4,queryFn:async()=>i.QZ.list({search:g,continuationToken:N})});console.log("!! data !!",U);let{theme:D}=(0,C.F)(),V=c({backend:(null==k?void 0:k.backend)||"",uppyOptions:{id:r,allowedFileTypes:a},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},d);return((0,l.useEffect)(()=>{P()},[g,N]),V)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),(0,n.jsx)(T.I,{placeholder:"Search files...",value:g,onChange:e=>j(e.target.value),className:"mb-3"}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,n.jsxs)("span",{children:[z.length," / ",x," files selected"]}),(0,n.jsxs)("span",{children:["Allowed file types: ",null==a?void 0:a.map(e=>e).join(", ")]})]}),(0,n.jsxs)(S.x,{children:[I&&(0,n.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!I&&!(null==U?void 0:null===(s=U.Contents)||void 0===s?void 0:s.length)&&(0,n.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[(0,n.jsx)(h.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),(0,n.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),null==U?void 0:null===(t=U.Contents)||void 0===t?void 0:t.map(e=>(0,n.jsx)(R,{s3Key:e.Key,onSelect:L,active:z.some(s=>s===e.Key),onRemove:()=>{F.mutate({key:e.Key})},disabled:!!a&&!(null==a?void 0:a.some(s=>e.Key.endsWith(s)))}))]}),(0,n.jsx)("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)(w.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{y(void 0)},disabled:!N||I,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to first page"}),(0,n.jsx)(O.kRt,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{y(v)},disabled:!N||I,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to previous page"}),(0,n.jsx)(p.Z,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{b(N),y(null==U?void 0:U.NextContinuationToken)},disabled:!(null==U?void 0:U.NextContinuationToken)||I,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to next page"}),(0,n.jsx)(f.Z,{className:"size-4"})]})]})})]})]}),(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),(0,n.jsx)(u.A,{uppy:V,theme:"dark"===D?"dark":"light"})]})]}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(w.z,{variant:"outline",onClick:()=>{m(z),A([])},children:"Confirm"})})]}):null},R=e=>{let{s3Key:s,onSelect:t,onRemove:l,active:r,disabled:a,addToContext:o}=e;return(0,n.jsxs)("div",{className:"".concat(a?"opacity-50":""," group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ").concat(r?"border border-purple-500":"border"),onClick:()=>{!a&&t&&t(s)},children:[(0,n.jsx)("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:s&&(s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg"))?(0,n.jsx)(W,{fileKey:s}):(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[s?s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg")?(0,n.jsx)(j.Z,{className:"h-6 w-6 text-blue-500"}):s.endsWith("pdf")?(0,n.jsx)(v.Z,{className:"h-6 w-6 text-red-500"}):s.endsWith("xls")||s.endsWith("xlsx")||s.endsWith("csv")?(0,n.jsx)(g.Z,{className:"h-6 w-6 text-green-500"}):s.endsWith("ppt")||s.endsWith("pptx")?(0,n.jsx)(g.Z,{className:"h-6 w-6 text-orange-500"}):(0,n.jsx)(g.Z,{className:"h-6 w-6 text-gray-500"}):(0,n.jsx)(g.Z,{className:"h-6 w-6 text-gray-500"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:s?s.split("_EXULU_").pop():s})]})}),(0,n.jsx)("p",{className:"text-xs truncate",children:s?s.split("_EXULU_").pop():s}),(0,n.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[o&&(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{o(s)},children:[(0,n.jsx)(b.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Add"})]}),(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{i.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,n.jsx)(m.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"View"})]}),l&&(0,n.jsxs)(w.z,{onClick:e=>{e.stopPropagation(),l(s)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[(0,n.jsx)(N.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Remove"})]})]})]},s)},U={},I=async e=>{if(U[e]){if(!(U[e].expiresAt<Date.now()))return U[e].url;delete U[e]}let s=await i.QZ.download(e),t=await s.json();return console.log("json",t),U[e]={url:t.url,expiresAt:Date.now()+6e4},t.url},W=e=>{let{fileKey:s}=e;console.log("key",s);let t=(0,Z.a)({queryKey:["imageQuery",s],staleTime:3e4,queryFn:async()=>I(s)});return t.isLoading?(0,n.jsx)("div",{children:(0,n.jsx)(y.Z,{})}):t.isLoading||t.data?(0,n.jsx)("img",{src:t.data,alt:s,className:"object-cover w-full h-full"}):(0,n.jsx)("div",{children:(0,n.jsx)(h.Z,{})})}}}]);
|
|
2
|
-
//# sourceMappingURL=3750-
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3750],{53245:function(e,s,t){t.d(s,{d:function(){return x},f:function(){return p}});var n=t(57437),l=t(62869),r=t(94508),a=t(30401),i=t(78867),o=t(2265),d=t(34996),c=t(1479),u=t(9880);let m=(0,o.createContext)({code:""}),x=e=>{let{code:s,language:t,showLineNumbers:l=!1,className:a,children:i,...o}=e;return(0,n.jsx)(m.Provider,{value:{code:s},children:(0,n.jsx)("div",{className:(0,r.cn)("relative w-full overflow-hidden rounded-md border bg-background text-foreground",a),...o,children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(d.Z,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:l,style:c.Z,children:s}),(0,n.jsx)(d.Z,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:l,style:u.Z,children:s}),i&&(0,n.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:i})]})})})},p=e=>{let{onCopy:s,onError:t,timeout:d=2e3,children:c,className:u,...x}=e,[p,h]=(0,o.useState)(!1),{code:f}=(0,o.useContext)(m),g=async()=>{if(!navigator.clipboard.writeText){null==t||t(Error("Clipboard API not available"));return}try{await navigator.clipboard.writeText(f),h(!0),null==s||s(),setTimeout(()=>h(!1),d)}catch(e){null==t||t(e)}},j=p?a.Z:i.Z;return(0,n.jsx)(l.z,{className:(0,r.cn)("shrink-0",u),onClick:g,size:"icon",variant:"ghost",...x,children:null!=c?c:(0,n.jsx)(j,{size:14})})}},35629:function(e,s,t){t.d(s,{H:function(){return x}});var n=t(57437),l=t(94508),r=t(2265),a=t(86816),i=t(67245),o=t(58146),d=t(85020),c=t(53245);t(2446);let u=(0,t(86589).Z)(a.UG),m={ol:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("ol",{className:(0,l.cn)("ml-4 list-outside list-decimal",r),...a,children:t})},li:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("li",{className:(0,l.cn)("py-1",r),...a,children:t})},ul:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("ul",{className:(0,l.cn)("ml-4 list-outside list-disc",r),...a,children:t})},hr:e=>{let{node:s,className:t,...r}=e;return(0,n.jsx)("hr",{className:(0,l.cn)("my-6 border-border",t),...r})},strong:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("span",{className:(0,l.cn)("font-semibold",r),...a,children:t})},a:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("a",{className:(0,l.cn)("font-medium text-primary underline",r),rel:"noreferrer",target:"_blank",...a,children:t})},h1:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h1",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-3xl",r),...a,children:t})},h2:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h2",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-2xl",r),...a,children:t})},h3:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h3",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-xl",r),...a,children:t})},h4:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h4",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-lg",r),...a,children:t})},h5:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h5",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-base",r),...a,children:t})},h6:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("h6",{className:(0,l.cn)("mt-6 mb-2 font-semibold text-sm",r),...a,children:t})},table:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("div",{className:"my-4 overflow-x-auto",children:(0,n.jsx)("table",{className:(0,l.cn)("w-full border-collapse border border-border",r),...a,children:t})})},thead:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("thead",{className:(0,l.cn)("bg-muted/50",r),...a,children:t})},tbody:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("tbody",{className:(0,l.cn)("divide-y divide-border",r),...a,children:t})},tr:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("tr",{className:(0,l.cn)("border-border border-b",r),...a,children:t})},th:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("th",{className:(0,l.cn)("px-4 py-2 text-left font-semibold text-sm",r),...a,children:t})},td:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("td",{className:(0,l.cn)("px-4 py-2 text-sm",r),...a,children:t})},blockquote:e=>{let{node:s,children:t,className:r,...a}=e;return(0,n.jsx)("blockquote",{className:(0,l.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",r),...a,children:t})},code:e=>{var s,t;let{node:r,className:a,...i}=e;return(null==r?void 0:null===(s=r.position)||void 0===s?void 0:s.start.line)!==(null==r?void 0:null===(t=r.position)||void 0===t?void 0:t.end.line)?(0,n.jsx)("code",{className:a,...i}):(0,n.jsx)("code",{className:(0,l.cn)("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",a),...i})},pre:e=>{var s;let{node:t,className:a,children:i}=e,o="javascript";"string"==typeof(null==t?void 0:null===(s=t.properties)||void 0===s?void 0:s.className)&&(o=t.properties.className.replace("language-",""));let d="";return(0,r.isValidElement)(i)&&i.props&&"string"==typeof i.props.children?d=i.props.children:"string"==typeof i&&(d=i),(0,n.jsx)(c.d,{className:(0,l.cn)("my-4 h-auto",a),code:d,language:o,children:(0,n.jsx)(c.f,{onCopy:()=>console.log("Copied code to clipboard"),onError:()=>console.error("Failed to copy code to clipboard")})})}},x=(0,r.memo)(e=>{let{className:s,options:t,children:r,allowedImagePrefixes:a,allowedLinkPrefixes:c,defaultOrigin:x,parseIncompleteMarkdown:p=!0,...h}=e,f="string"==typeof r&&p?function(e){if(!e||"string"!=typeof e)return e;let s=e,t=s.match(/(!?\[)([^\]]*?)$/);if(t){let e=s.lastIndexOf(t[1]);s=s.substring(0,e)}if(s.match(/(\*\*)([^*]*?)$/)&&(s.match(/\*\*/g)||[]).length%2==1&&(s="".concat(s,"**")),s.match(/(__)([^_]*?)$/)&&(s.match(/__/g)||[]).length%2==1&&(s="".concat(s,"__")),s.match(/(\*)([^*]*?)$/)&&s.split("").reduce((e,t,n)=>{if("*"===t){let t=s[n-1],l=s[n+1];if("*"!==t&&"*"!==l)return e+1}return e},0)%2==1&&(s="".concat(s,"*")),s.match(/(_)([^_]*?)$/)&&s.split("").reduce((e,t,n)=>{if("_"===t){let t=s[n-1],l=s[n+1];if("_"!==t&&"_"!==l)return e+1}return e},0)%2==1&&(s="".concat(s,"_")),s.match(/(`)([^`]*?)$/)&&(s.includes("```"),(s.match(/```[\s\S]*?```/g)||[]).length,(s.match(/```/g)||[]).length%2!=1)){let e=0;for(let t=0;t<s.length;t++)if("`"===s[t]){let n="```"===s.substring(t,t+3),l=t>0&&"```"===s.substring(t-1,t+2),r=t>1&&"```"===s.substring(t-2,t+1);!(n||l||r)&&e++}e%2==1&&(s="".concat(s,"`"))}return s.match(/(~~)([^~]*?)$/)&&(s.match(/~~/g)||[]).length%2==1&&(s="".concat(s,"~~")),s}(r):r;return(0,n.jsx)("div",{className:(0,l.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",s),...h,children:(0,n.jsx)(u,{allowedImagePrefixes:null!=a?a:["*"],allowedLinkPrefixes:null!=c?c:["*"],components:m,defaultOrigin:x,rehypePlugins:[i.Z],remarkPlugins:[o.Z,d.Z],...t,children:f})})},(e,s)=>e.children===s.children);x.displayName="Response"},65613:function(e,s,t){t.d(s,{Cd:function(){return d},X:function(){return c},bZ:function(){return o}});var n=t(57437),l=t(90535),r=t(2265),a=t(94508);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"}}),o=r.forwardRef((e,s)=>{let{className:t,variant:l,...r}=e;return(0,n.jsx)("div",{ref:s,role:"alert",className:(0,a.cn)(i({variant:l}),t),...r})});o.displayName="Alert";let d=r.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,n.jsx)("h5",{ref:s,className:(0,a.cn)("mb-1 font-medium leading-none tracking-tight",t),...l})});d.displayName="AlertTitle";let c=r.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,n.jsx)("div",{ref:s,className:(0,a.cn)("text-sm [&_p]:leading-relaxed",t),...l})});c.displayName="AlertDescription"},74928:function(e,s,t){t.d(s,{Fw:function(){return a},wy:function(){return r},zF:function(){return l}});var n=t(88985);let l=n.fC,r=n.wy,a=n.Fw},12339:function(e,s,t){t.d(s,{SP:function(){return d},dr:function(){return o},mQ:function(){return i},nU:function(){return c}});var n=t(57437),l=t(20271),r=t(2265),a=t(94508);let i=l.fC,o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,n.jsx)(l.aV,{ref:s,className:(0,a.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r})});o.displayName=l.aV.displayName;let d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,n.jsx)(l.xz,{ref:s,className:(0,a.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...r})});d.displayName=l.xz.displayName;let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,n.jsx)(l.VY,{ref:s,className:(0,a.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r})});c.displayName=l.VY.displayName},77992:function(e,s,t){t.d(s,{Am:function(){return u},pm:function(){return m}});var n=t(2265);let l=0,r=new Map,a=e=>{if(r.has(e))return;let s=setTimeout(()=>{r.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,s)},i=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?a(t):e.toasts.forEach(e=>{a(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},o=[],d={toasts:[]};function c(e){d=i(d,e),o.forEach(e=>{e(d)})}function u(e){let{...s}=e,t=(l=(l+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>c({type:"DISMISS_TOAST",toastId:t});return c({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||n()}}}),{id:t,dismiss:n,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function m(){let[e,s]=n.useState(d);return n.useEffect(()=>(o.push(s),()=>{let e=o.indexOf(s);e>-1&&o.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},78361:function(e,s,t){t.d(s,{jF:function(){return A},jU:function(){return R},ZP:function(){return L},NF:function(){return I}});var n=t(57437),l=t(2265),r=t(47632),a=t(1109);t(46693),t(51832);var i=t(6374),o=t(44045);let d=async e=>{var s;if(!e.backend)throw Error("No backend set.");let{callbacks:t,maxNumberOfFiles:n,uppyOptions:l}=e||{},{uploadSuccess:o}=t||{},{allowedFileTypes:d,id:c}=l||{},u=await (0,i.LP)(),m=new r.Z({autoProceed:!0,debug:!1,id:c||"uppy",restrictions:{maxNumberOfFiles:n||5,allowedFileTypes:d||[".heic",".jpg",".jpeg",".png",".webp",".svg"]}}).use(a.Z,{id:"Exulu",endpoint:e.backend,headers:{Authorization:"Bearer ".concat(u),Session:null!==(s=localStorage.getItem("session"))&&void 0!==s?s:""}}).on("file-added",async e=>{console.debug("added",e)}).on("upload-error",(e,s)=>{(null==e?void 0:e.id)&&(m.removeFile(null==e?void 0:e.id),console.error("error",s))}).on("upload-success",(e,s)=>{s.uploadURL&&o&&(console.log("response",s),o({file:e,key:s.uploadURL.split("/").pop()||"",url:s.uploadURL}))});return m};var c=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(0,l.useContext)(o.E),[n,r]=(0,l.useState)(void 0);return(0,l.useEffect)(()=>((async()=>{r(await d({...e,backend:(null==t?void 0:t.backend)||""}))})(),()=>{n&&(n.destroy(),r(void 0))}),[...s]),n},u=t(80007),m=t(92735),x=t(88964),p=t(30044),h=t(92451),f=t(10407),g=t(48736),j=t(53113),v=t(69658),b=t(99397),N=t(32489),y=t(15001),w=t(62869),k=t(26110),S=t(19378),C=t(78298),Z=t(11713),_=t(21770),T=t(95186),O=t(20653),z=t(66070),E=t(93022);function A(e){let{s3key:s,children:t}=e,{data:r,isLoading:a,error:o,refetch:d}=(0,Z.a)({queryKey:["fileObject",s],queryFn:async()=>s?await i.QZ.object(s):null,enabled:null!=s});if((0,l.useEffect)(()=>{s&&d()},[s]),!s)return(0,n.jsx)(z.Zb,{children:(0,n.jsxs)(z.aY,{className:"p-3 flex",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground m-auto",children:"No file selected"}),t]})});let c=s,u="";if(s.includes("[bucket:")){var x,p;u=(null===(x=s.split("[bucket:")[1])||void 0===x?void 0:x.split("]")[0])||"",(null==(c=(null===(p=s.split("[bucket:")[1])||void 0===p?void 0:p.split("]")[0])||"")?void 0:c.length)&&(c=s.split("]")[1]||"")}return c=c.split("_EXULU_").pop()||"",(0,n.jsxs)(z.Zb,{children:[(0,n.jsx)(z.Ol,{className:"pb-3",children:(0,n.jsx)(z.ll,{className:"text-sm max-w-[500px] truncate",children:c})}),(0,n.jsxs)(z.aY,{className:"pt-0",children:[a&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(E.O,{className:"h-4 w-full"}),(0,n.jsx)(E.O,{className:"h-4 w-2/3"})]}),!a&&r&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{className:"capitalize",children:[null==r?void 0:r.ContentType.split("/").pop(),u&&" [Bucket: ".concat(u,"]")]}),(0,n.jsxs)("span",{children:[((null==r?void 0:r.ContentLength)/1024/1024).toFixed(2)," MB"]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,n.jsxs)("span",{children:["Last modified: ",new Date(null==r?void 0:r.LastModified).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),(0,n.jsxs)(w.z,{variant:"secondary",size:"sm",type:"button",className:"h-7 px-2",onClick:()=>{i.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,n.jsx)("span",{className:"mr-1 text-xs",children:"View"}),(0,n.jsx)(m.Z,{className:"h-3 w-3"})]})]})]}),!a&&o&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:o.message}),t]})]})}function L(e){let{id:s,allowedFileTypes:t,dependencies:r,onConfirm:a,selectionLimit:i,buttonText:o}=e,[d,c]=(0,l.useState)(!1);return(0,n.jsxs)(k.Vq,{open:d,onOpenChange:c,children:[(0,n.jsx)(k.hg,{asChild:!0,children:(0,n.jsxs)(w.z,{variant:"outline",children:[o&&(0,n.jsx)("span",{className:"mr-2",children:o}),(0,n.jsx)(x.Z,{className:"h-4 w-4"})]})}),(0,n.jsxs)(k.cZ,{className:"sm:max-w-[900px]",children:[(0,n.jsxs)(k.fK,{children:[(0,n.jsx)(k.$N,{children:"File Gallery"}),(0,n.jsx)(k.Be,{children:"Browse your previously uploaded files or upload new ones."})]}),(0,n.jsx)(F,{id:s,allowedFileTypes:t,dependencies:r,selectionLimit:i,onConfirm:e=>{a(e),c(!1)}})]})]})}let F=e=>{var s,t;let{id:r,allowedFileTypes:a,dependencies:d,onConfirm:m,selectionLimit:x}=e;a||(a=[".png",".jpg",".jpeg",".gif",".webp",".pdf",".docx",".xlsx",".xls",".csv",".pptx",".ppt",".mp3",".wav",".m4a",".mp4",".mpeg",".mp4",".m4a",".mp3",".mpeg",".wav"]);let[g,j]=(0,l.useState)(void 0),[v,b]=(0,l.useState)(void 0),[N,y]=(0,l.useState)(void 0),k=(0,l.useContext)(o.E),[z,A]=(0,l.useState)([]),L=e=>{if(z.includes(e)){A(z.filter(s=>s!==e));return}if(1===x){A([e]);return}z.length>=x||A([...z,e])},F=(0,_.D)({mutationFn:async e=>{let{key:s}=e;await i.QZ.delete(s),P()}}),{data:U,isLoading:I,error:W,refetch:P}=(0,Z.a)({queryKey:["filesQuery",g,N],staleTime:3e4,queryFn:async()=>i.QZ.list({search:g,continuationToken:N})});console.log("!! data !!",U);let{theme:D}=(0,C.F)(),V=c({backend:(null==k?void 0:k.backend)||"",uppyOptions:{id:r,allowedFileTypes:a},callbacks:{uploadSuccess:async e=>{console.log("data",e)}},maxNumberOfFiles:10},d);return((0,l.useEffect)(()=>{P()},[g,N]),V)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Previously Uploaded Files"}),(0,n.jsx)(T.I,{placeholder:"Search files...",value:g,onChange:e=>j(e.target.value),className:"mb-3"}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground pb-2",children:[(0,n.jsxs)("span",{children:[z.length," / ",x," files selected"]}),(0,n.jsxs)("span",{children:["Allowed file types: ",null==a?void 0:a.map(e=>e).join(", ")]})]}),(0,n.jsxs)(S.x,{children:[I&&(0,n.jsxs)("div",{className:"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3",children:[(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"}),(0,n.jsx)(E.O,{className:"h-[120px] w-full"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[!I&&!(null==U?void 0:null===(s=U.Contents)||void 0===s?void 0:s.length)&&(0,n.jsxs)("div",{className:"col-span-full flex flex-col items-center justify-center py-12 text-center",children:[(0,n.jsx)(p.Z,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),(0,n.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Nothing to see here... yet!"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground/75 mt-1",children:"Upload some files to get started"})]}),null==U?void 0:null===(t=U.Contents)||void 0===t?void 0:t.map(e=>(0,n.jsx)(R,{s3Key:e.Key,onSelect:L,active:z.some(s=>s===e.Key),onRemove:()=>{F.mutate({key:e.Key})},disabled:!!a&&!(null==a?void 0:a.some(s=>e.Key.endsWith(s)))}))]}),(0,n.jsx)("div",{className:"flex items-center space-x-6 lg:space-x-8 pt-3",children:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)(w.z,{variant:"outline",className:"hidden size-8 p-0 lg:flex",onClick:()=>{y(void 0)},disabled:!N||I,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to first page"}),(0,n.jsx)(O.kRt,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{y(v)},disabled:!N||I,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to previous page"}),(0,n.jsx)(h.Z,{className:"size-4"})]}),(0,n.jsxs)(w.z,{variant:"outline",className:"size-8 p-0",onClick:()=>{b(N),y(null==U?void 0:U.NextContinuationToken)},disabled:!(null==U?void 0:U.NextContinuationToken)||I,children:[(0,n.jsx)("span",{className:"sr-only",children:"Go to next page"}),(0,n.jsx)(f.Z,{className:"size-4"})]})]})})]})]}),(0,n.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-3",children:"Upload New Files"}),(0,n.jsx)(u.A,{uppy:V,theme:"dark"===D?"dark":"light"})]})]}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(w.z,{variant:"outline",onClick:()=>{m(z),A([])},children:"Confirm"})})]}):null},R=e=>{let{s3Key:s,onSelect:t,onRemove:l,active:r,disabled:a,addToContext:o}=e;return(0,n.jsxs)("div",{className:"".concat(a?"opacity-50":""," group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ").concat(r?"border border-purple-500":"border"),onClick:()=>{!a&&t&&t(s)},children:[(0,n.jsx)("div",{className:"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center",children:s&&(s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg"))?(0,n.jsx)(W,{fileKey:s}):(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center h-full",children:[s?s.toLowerCase().endsWith("jpg")||s.toLowerCase().endsWith("jpeg")||s.toLowerCase().endsWith("png")||s.toLowerCase().endsWith("svg")?(0,n.jsx)(j.Z,{className:"h-6 w-6 text-blue-500"}):s.endsWith("pdf")?(0,n.jsx)(v.Z,{className:"h-6 w-6 text-red-500"}):s.endsWith("xls")||s.endsWith("xlsx")||s.endsWith("csv")?(0,n.jsx)(g.Z,{className:"h-6 w-6 text-green-500"}):s.endsWith("ppt")||s.endsWith("pptx")?(0,n.jsx)(g.Z,{className:"h-6 w-6 text-orange-500"}):(0,n.jsx)(g.Z,{className:"h-6 w-6 text-gray-500"}):(0,n.jsx)(g.Z,{className:"h-6 w-6 text-gray-500"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 text-center",children:s?s.split("_EXULU_").pop():s})]})}),(0,n.jsx)("p",{className:"text-xs truncate",children:s?s.split("_EXULU_").pop():s}),(0,n.jsxs)("div",{className:"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1",children:[o&&(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{o(s)},children:[(0,n.jsx)(b.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Add"})]}),(0,n.jsxs)(w.z,{variant:"ghost",size:"icon",type:"button",className:"h-6 w-6 bg-background/80 hover:bg-background",onClick:()=>{i.QZ.download(s).then(async e=>{console.log("res",e);let s=await e.json();console.log("res",s);let t=s.url;window.open(t,"_blank")})},children:[(0,n.jsx)(m.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"View"})]}),l&&(0,n.jsxs)(w.z,{onClick:e=>{e.stopPropagation(),l(s)},variant:"ghost",type:"button",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1",children:[(0,n.jsx)(N.Z,{className:"h-3 w-3"}),(0,n.jsx)("span",{className:"sr-only",children:"Remove"})]})]})]},s)},U={},I=async e=>{if(U[e]){if(!(U[e].expiresAt<Date.now()))return U[e].url;delete U[e]}let s=await i.QZ.download(e),t=await s.json();return console.log("json",t),U[e]={url:t.url,expiresAt:Date.now()+6e4},t.url},W=e=>{let{fileKey:s}=e;console.log("key",s);let t=(0,Z.a)({queryKey:["imageQuery",s],staleTime:3e4,queryFn:async()=>I(s)});return t.isLoading?(0,n.jsx)("div",{children:(0,n.jsx)(y.Z,{})}):t.isLoading||t.data?(0,n.jsx)("img",{src:t.data,alt:s,className:"object-cover w-full h-full"}):(0,n.jsx)("div",{children:(0,n.jsx)(p.Z,{})})}}}]);
|
|
2
|
+
//# sourceMappingURL=3750-f45c59ef1cc79417.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/chunks/3750-f45c59ef1cc79417.js","mappings":"8PAiBA,IAAMA,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GAAG,IAG9C,OAAOH,CAAc,CAACP,EAAQ,CAAC/G,GAAG,QAF3BsH,CAAc,CAACP,EAAQ,CAKlC,IAAMnH,EAAW,MAAMqB,EAAAA,EAAKA,CAACuB,QAAQ,CAACuE,GAChCpE,EAAO,MAAM/C,EAAS+C,IAAI,GAMhC,OALAjL,QAAQC,GAAG,CAAC,OAAQgL,GACpB2E,CAAc,CAACP,EAAQ,CAAG,CACxB/G,IAAK2C,EAAK3C,GAAG,CACbwH,UAAWxF,KAAKyF,GAAG,GAAK,GAC1B,EACO9E,EAAK3C,GAAG,EAGX8G,EAA6B,OAAC,CAAEC,QAAAA,CAAO,CAAuB,CAAAnU,EAElE8E,QAAQC,GAAG,CAAC,MAAOoP,GACnB,IAAMW,EAAQ5G,CAAAA,EAAAA,EAAAA,CAAAA,EAAiB,CAC7BC,SAAU,CAAC,aAAcgG,EAAQ,CACjClC,UAAW,IACX7D,QAAS,SACAuG,EAAgBR,EAE3B,UAEA,EAAUnG,SAAS,CACV,GAAAQ,EAAAtO,GAAA,EAACG,MAAAA,UAAI,GAAAmO,EAAAtO,GAAA,EAAC6U,EAAAA,CAAUA,CAAAA,CAAAA,KAGrB,EAAO/G,SAAS,EAAK8G,EAAM/G,IAAI,CAI3B,GAAAS,EAAAtO,GAAA,EAAC8U,MAAAA,CACPC,IAAKH,EAAM/G,IAAI,CACfmH,IAAKf,EACLtU,UAAU,+BANH,GAAA2O,EAAAtO,GAAA,EAACG,MAAAA,UAAI,GAAAmO,EAAAtO,GAAA,EAAC6S,EAAAA,CAAWA,CAAAA,CAAAA,IAS5B","sources":["webpack://_N_E/./components/ai-elements/code-block.tsx","webpack://_N_E/./components/ai-elements/response.tsx","webpack://_N_E/./components/ui/alert.tsx","webpack://_N_E/./components/ui/collapsible.tsx","webpack://_N_E/./components/ui/tabs.tsx","webpack://_N_E/./components/ui/use-toast.ts","webpack://_N_E/./hooks/use-uppy.tsx","webpack://_N_E/./components/uppy-dashboard.tsx"],"sourcesContent":["'use client';\n\nimport { Button } from '@/components/ui/button';\nimport { cn } from '@/lib/utils';\nimport { CheckIcon, CopyIcon } from 'lucide-react';\nimport type { ComponentProps, HTMLAttributes, ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport {\n oneDark,\n oneLight,\n} from 'react-syntax-highlighter/dist/esm/styles/prism';\n\ntype CodeBlockContextType = {\n code: string;\n};\n\nconst CodeBlockContext = createContext<CodeBlockContextType>({\n code: '',\n});\n\nexport type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {\n code: string;\n language: string;\n showLineNumbers?: boolean;\n children?: ReactNode;\n};\n\nexport const CodeBlock = ({\n code,\n language,\n showLineNumbers = false,\n className,\n children,\n ...props\n}: CodeBlockProps) => (\n <CodeBlockContext.Provider value={{ code }}>\n <div\n className={cn(\n 'relative w-full overflow-hidden rounded-md border bg-background text-foreground',\n className\n )}\n {...props}\n >\n <div className=\"relative\">\n <SyntaxHighlighter\n className=\"overflow-hidden dark:hidden\"\n codeTagProps={{\n className: 'font-mono text-sm',\n }}\n customStyle={{\n margin: 0,\n padding: '1rem',\n fontSize: '0.875rem',\n background: 'hsl(var(--background))',\n color: 'hsl(var(--foreground))',\n }}\n language={language}\n lineNumberStyle={{\n color: 'hsl(var(--muted-foreground))',\n paddingRight: '1rem',\n minWidth: '2.5rem',\n }}\n showLineNumbers={showLineNumbers}\n style={oneLight}\n >\n {code}\n </SyntaxHighlighter>\n <SyntaxHighlighter\n className=\"hidden overflow-hidden dark:block\"\n codeTagProps={{\n className: 'font-mono text-sm',\n }}\n customStyle={{\n margin: 0,\n padding: '1rem',\n fontSize: '0.875rem',\n background: 'hsl(var(--background))',\n color: 'hsl(var(--foreground))',\n }}\n language={language}\n lineNumberStyle={{\n color: 'hsl(var(--muted-foreground))',\n paddingRight: '1rem',\n minWidth: '2.5rem',\n }}\n showLineNumbers={showLineNumbers}\n style={oneDark}\n >\n {code}\n </SyntaxHighlighter>\n {children && (\n <div className=\"absolute top-2 right-2 flex items-center gap-2\">\n {children}\n </div>\n )}\n </div>\n </div>\n </CodeBlockContext.Provider>\n);\n\nexport type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {\n onCopy?: () => void;\n onError?: (error: Error) => void;\n timeout?: number;\n};\n\nexport const CodeBlockCopyButton = ({\n onCopy,\n onError,\n timeout = 2000,\n children,\n className,\n ...props\n}: CodeBlockCopyButtonProps) => {\n const [isCopied, setIsCopied] = useState(false);\n const { code } = useContext(CodeBlockContext);\n\n const copyToClipboard = async () => {\n if (typeof window === 'undefined' || !navigator.clipboard.writeText) {\n onError?.(new Error('Clipboard API not available'));\n return;\n }\n\n try {\n await navigator.clipboard.writeText(code);\n setIsCopied(true);\n onCopy?.();\n setTimeout(() => setIsCopied(false), timeout);\n } catch (error) {\n onError?.(error as Error);\n }\n };\n\n const Icon = isCopied ? CheckIcon : CopyIcon;\n\n return (\n <Button\n className={cn('shrink-0', className)}\n onClick={copyToClipboard}\n size=\"icon\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <Icon size={14} />}\n </Button>\n );\n};\n","'use client';\n\nimport { cn } from '@/lib/utils';\nimport type { ComponentProps, HTMLAttributes } from 'react';\nimport { isValidElement, memo } from 'react';\nimport ReactMarkdown, { type Options } from 'react-markdown';\nimport rehypeKatex from 'rehype-katex';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport { CodeBlock, CodeBlockCopyButton } from './code-block';\nimport 'katex/dist/katex.min.css';\nimport hardenReactMarkdown from 'harden-react-markdown';\n\n/**\n * Parses markdown text and removes incomplete tokens to prevent partial rendering\n * of links, images, bold, and italic formatting during streaming.\n */\nfunction parseIncompleteMarkdown(text: string): string {\n if (!text || typeof text !== 'string') {\n return text;\n }\n\n let result = text;\n\n // Handle incomplete links and images\n // Pattern: [...] or ![...] where the closing ] is missing\n const linkImagePattern = /(!?\\[)([^\\]]*?)$/;\n const linkMatch = result.match(linkImagePattern);\n if (linkMatch) {\n // If we have an unterminated [ or ![, remove it and everything after\n const startIndex = result.lastIndexOf(linkMatch[1]);\n result = result.substring(0, startIndex);\n }\n\n // Handle incomplete bold formatting (**)\n const boldPattern = /(\\*\\*)([^*]*?)$/;\n const boldMatch = result.match(boldPattern);\n if (boldMatch) {\n // Count the number of ** in the entire string\n const asteriskPairs = (result.match(/\\*\\*/g) || []).length;\n // If odd number of **, we have an incomplete bold - complete it\n if (asteriskPairs % 2 === 1) {\n result = `${result}**`;\n }\n }\n\n // Handle incomplete italic formatting (__)\n const italicPattern = /(__)([^_]*?)$/;\n const italicMatch = result.match(italicPattern);\n if (italicMatch) {\n // Count the number of __ in the entire string\n const underscorePairs = (result.match(/__/g) || []).length;\n // If odd number of __, we have an incomplete italic - complete it\n if (underscorePairs % 2 === 1) {\n result = `${result}__`;\n }\n }\n\n // Handle incomplete single asterisk italic (*)\n const singleAsteriskPattern = /(\\*)([^*]*?)$/;\n const singleAsteriskMatch = result.match(singleAsteriskPattern);\n if (singleAsteriskMatch) {\n // Count single asterisks that aren't part of **\n const singleAsterisks = result.split('').reduce((acc, char, index) => {\n if (char === '*') {\n // Check if it's part of a ** pair\n const prevChar = result[index - 1];\n const nextChar = result[index + 1];\n if (prevChar !== '*' && nextChar !== '*') {\n return acc + 1;\n }\n }\n return acc;\n }, 0);\n\n // If odd number of single *, we have an incomplete italic - complete it\n if (singleAsterisks % 2 === 1) {\n result = `${result}*`;\n }\n }\n\n // Handle incomplete single underscore italic (_)\n const singleUnderscorePattern = /(_)([^_]*?)$/;\n const singleUnderscoreMatch = result.match(singleUnderscorePattern);\n if (singleUnderscoreMatch) {\n // Count single underscores that aren't part of __\n const singleUnderscores = result.split('').reduce((acc, char, index) => {\n if (char === '_') {\n // Check if it's part of a __ pair\n const prevChar = result[index - 1];\n const nextChar = result[index + 1];\n if (prevChar !== '_' && nextChar !== '_') {\n return acc + 1;\n }\n }\n return acc;\n }, 0);\n\n // If odd number of single _, we have an incomplete italic - complete it\n if (singleUnderscores % 2 === 1) {\n result = `${result}_`;\n }\n }\n\n // Handle incomplete inline code blocks (`) - but avoid code blocks (```)\n const inlineCodePattern = /(`)([^`]*?)$/;\n const inlineCodeMatch = result.match(inlineCodePattern);\n if (inlineCodeMatch) {\n // Check if we're dealing with a code block (triple backticks)\n const hasCodeBlockStart = result.includes('```');\n const codeBlockPattern = /```[\\s\\S]*?```/g;\n const completeCodeBlocks = (result.match(codeBlockPattern) || []).length;\n const allTripleBackticks = (result.match(/```/g) || []).length;\n\n // If we have an odd number of ``` sequences, we're inside an incomplete code block\n // In this case, don't complete inline code\n const insideIncompleteCodeBlock = allTripleBackticks % 2 === 1;\n\n if (!insideIncompleteCodeBlock) {\n // Count the number of single backticks that are NOT part of triple backticks\n let singleBacktickCount = 0;\n for (let i = 0; i < result.length; i++) {\n if (result[i] === '`') {\n // Check if this backtick is part of a triple backtick sequence\n const isTripleStart = result.substring(i, i + 3) === '```';\n const isTripleMiddle =\n i > 0 && result.substring(i - 1, i + 2) === '```';\n const isTripleEnd = i > 1 && result.substring(i - 2, i + 1) === '```';\n\n if (!(isTripleStart || isTripleMiddle || isTripleEnd)) {\n singleBacktickCount++;\n }\n }\n }\n\n // If odd number of single backticks, we have an incomplete inline code - complete it\n if (singleBacktickCount % 2 === 1) {\n result = `${result}\\``;\n }\n }\n }\n\n // Handle incomplete strikethrough formatting (~~)\n const strikethroughPattern = /(~~)([^~]*?)$/;\n const strikethroughMatch = result.match(strikethroughPattern);\n if (strikethroughMatch) {\n // Count the number of ~~ in the entire string\n const tildePairs = (result.match(/~~/g) || []).length;\n // If odd number of ~~, we have an incomplete strikethrough - complete it\n if (tildePairs % 2 === 1) {\n result = `${result}~~`;\n }\n }\n\n return result;\n}\n\n// Create a hardened version of ReactMarkdown\nconst HardenedMarkdown = hardenReactMarkdown(ReactMarkdown);\n\nexport type ResponseProps = HTMLAttributes<HTMLDivElement> & {\n options?: Options;\n children: Options['children'];\n allowedImagePrefixes?: ComponentProps<\n ReturnType<typeof hardenReactMarkdown>\n >['allowedImagePrefixes'];\n allowedLinkPrefixes?: ComponentProps<\n ReturnType<typeof hardenReactMarkdown>\n >['allowedLinkPrefixes'];\n defaultOrigin?: ComponentProps<\n ReturnType<typeof hardenReactMarkdown>\n >['defaultOrigin'];\n parseIncompleteMarkdown?: boolean;\n};\n\nconst components: Options['components'] = {\n ol: ({ node, children, className, ...props }) => (\n <ol className={cn('ml-4 list-outside list-decimal', className)} {...props}>\n {children}\n </ol>\n ),\n li: ({ node, children, className, ...props }) => (\n <li className={cn('py-1', className)} {...props}>\n {children}\n </li>\n ),\n ul: ({ node, children, className, ...props }) => (\n <ul className={cn('ml-4 list-outside list-disc', className)} {...props}>\n {children}\n </ul>\n ),\n hr: ({ node, className, ...props }) => (\n <hr className={cn('my-6 border-border', className)} {...props} />\n ),\n strong: ({ node, children, className, ...props }) => (\n <span className={cn('font-semibold', className)} {...props}>\n {children}\n </span>\n ),\n a: ({ node, children, className, ...props }) => (\n <a\n className={cn('font-medium text-primary underline', className)}\n rel=\"noreferrer\"\n target=\"_blank\"\n {...props}\n >\n {children}\n </a>\n ),\n h1: ({ node, children, className, ...props }) => (\n <h1\n className={cn('mt-6 mb-2 font-semibold text-3xl', className)}\n {...props}\n >\n {children}\n </h1>\n ),\n h2: ({ node, children, className, ...props }) => (\n <h2\n className={cn('mt-6 mb-2 font-semibold text-2xl', className)}\n {...props}\n >\n {children}\n </h2>\n ),\n h3: ({ node, children, className, ...props }) => (\n <h3 className={cn('mt-6 mb-2 font-semibold text-xl', className)} {...props}>\n {children}\n </h3>\n ),\n h4: ({ node, children, className, ...props }) => (\n <h4 className={cn('mt-6 mb-2 font-semibold text-lg', className)} {...props}>\n {children}\n </h4>\n ),\n h5: ({ node, children, className, ...props }) => (\n <h5\n className={cn('mt-6 mb-2 font-semibold text-base', className)}\n {...props}\n >\n {children}\n </h5>\n ),\n h6: ({ node, children, className, ...props }) => (\n <h6 className={cn('mt-6 mb-2 font-semibold text-sm', className)} {...props}>\n {children}\n </h6>\n ),\n table: ({ node, children, className, ...props }) => (\n <div className=\"my-4 overflow-x-auto\">\n <table\n className={cn('w-full border-collapse border border-border', className)}\n {...props}\n >\n {children}\n </table>\n </div>\n ),\n thead: ({ node, children, className, ...props }) => (\n <thead className={cn('bg-muted/50', className)} {...props}>\n {children}\n </thead>\n ),\n tbody: ({ node, children, className, ...props }) => (\n <tbody className={cn('divide-y divide-border', className)} {...props}>\n {children}\n </tbody>\n ),\n tr: ({ node, children, className, ...props }) => (\n <tr className={cn('border-border border-b', className)} {...props}>\n {children}\n </tr>\n ),\n th: ({ node, children, className, ...props }) => (\n <th\n className={cn('px-4 py-2 text-left font-semibold text-sm', className)}\n {...props}\n >\n {children}\n </th>\n ),\n td: ({ node, children, className, ...props }) => (\n <td className={cn('px-4 py-2 text-sm', className)} {...props}>\n {children}\n </td>\n ),\n blockquote: ({ node, children, className, ...props }) => (\n <blockquote\n className={cn(\n 'my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic',\n className\n )}\n {...props}\n >\n {children}\n </blockquote>\n ),\n code: ({ node, className, ...props }) => {\n const inline = node?.position?.start.line === node?.position?.end.line;\n\n if (!inline) {\n return <code className={className} {...props} />;\n }\n\n return (\n <code\n className={cn(\n 'rounded bg-muted px-1.5 py-0.5 font-mono text-sm',\n className\n )}\n {...props}\n />\n );\n },\n pre: ({ node, className, children }) => {\n let language = 'javascript';\n\n if (typeof node?.properties?.className === 'string') {\n language = node.properties.className.replace('language-', '');\n }\n\n // Extract code content from children safely\n let code = '';\n if (\n isValidElement(children) &&\n children.props &&\n typeof children.props.children === 'string'\n ) {\n code = children.props.children;\n } else if (typeof children === 'string') {\n code = children;\n }\n\n return (\n <CodeBlock\n className={cn('my-4 h-auto', className)}\n code={code}\n language={language}\n >\n <CodeBlockCopyButton\n onCopy={() => console.log('Copied code to clipboard')}\n onError={() => console.error('Failed to copy code to clipboard')}\n />\n </CodeBlock>\n );\n },\n};\n\nexport const Response = memo(\n ({\n className,\n options,\n children,\n allowedImagePrefixes,\n allowedLinkPrefixes,\n defaultOrigin,\n parseIncompleteMarkdown: shouldParseIncompleteMarkdown = true,\n ...props\n }: ResponseProps) => {\n // Parse the children to remove incomplete markdown tokens if enabled\n const parsedChildren =\n typeof children === 'string' && shouldParseIncompleteMarkdown\n ? parseIncompleteMarkdown(children)\n : children;\n\n return (\n <div\n className={cn(\n 'size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0',\n className\n )}\n {...props}\n >\n <HardenedMarkdown\n allowedImagePrefixes={allowedImagePrefixes ?? ['*']}\n allowedLinkPrefixes={allowedLinkPrefixes ?? ['*']}\n components={components}\n defaultOrigin={defaultOrigin}\n rehypePlugins={[rehypeKatex]}\n remarkPlugins={[remarkGfm, remarkMath]}\n {...options}\n >\n {parsedChildren}\n </HardenedMarkdown>\n </div>\n );\n },\n (prevProps, nextProps) => prevProps.children === nextProps.children\n);\n\nResponse.displayName = 'Response';\n","import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst alertVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground\",\n destructive:\n \"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n info: \"border-info/50 text-info dark:border-info [&>svg]:text-info\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nconst Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n));\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n));\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n));\nAlertDescription.displayName = \"AlertDescription\";\n\nexport { Alert, AlertTitle, AlertDescription };\n","\"use client\";\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\n\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n","\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n className,\n )}\n {...props}\n />\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n className,\n )}\n {...props}\n />\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent };\n","\"use client\";\n\n// Inspired by react-hot-toast library\nimport * as React from \"react\";\n\nimport type { ToastActionElement, ToastProps } from \"@/components/ui/toast\";\n\nconst TOAST_LIMIT = 1;\nconst TOAST_REMOVE_DELAY = 1000000;\n\ntype ToasterToast = ToastProps & {\n id: string;\n title?: React.ReactNode;\n description?: React.ReactNode;\n action?: ToastActionElement;\n};\n\nconst actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const;\n\nlet count = 0;\n\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\n return count.toString();\n}\n\ntype ActionType = typeof actionTypes;\n\ntype Action =\n | {\n type: ActionType[\"ADD_TOAST\"];\n toast: ToasterToast;\n }\n | {\n type: ActionType[\"UPDATE_TOAST\"];\n toast: Partial<ToasterToast>;\n }\n | {\n type: ActionType[\"DISMISS_TOAST\"];\n toastId?: ToasterToast[\"id\"];\n }\n | {\n type: ActionType[\"REMOVE_TOAST\"];\n toastId?: ToasterToast[\"id\"];\n };\n\ninterface State {\n toasts: ToasterToast[];\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId,\n });\n }, TOAST_REMOVE_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t,\n ),\n };\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action;\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t,\n ),\n };\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [] };\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n}\n\ntype Toast = Omit<ToasterToast, \"id\">;\n\nfunction toast({ ...props }: Toast) {\n const id = genId();\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id },\n });\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id });\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open) => {\n if (!open) dismiss();\n },\n },\n });\n\n return {\n id: id,\n dismiss,\n update,\n };\n}\n\nfunction useToast() {\n const [state, setState] = React.useState<State>(memoryState);\n\n React.useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n };\n}\n\nexport { useToast, toast };\n","import { useEffect, useState, useContext } from \"react\";\nimport Uppy from \"@uppy/core\";\nimport AwsS3 from \"@uppy/aws-s3\";\nimport \"@uppy/core/dist/style.min.css\";\nimport \"@uppy/dashboard/dist/style.min.css\";\nimport '@uppy/core/dist/style.min.css';\nimport '@uppy/dashboard/dist/style.min.css';\nimport { getToken } from \"@/util/api\";\nimport { ConfigContext } from \"@/components/config-context\";\n\ninterface InitializeOptions {\n backend: string;\n callbacks?: {\n uploadSuccess?: (response: {\n file: any | null;\n url: string\n key: string\n }) => void;\n };\n fileKey?: string;\n fileKeyPrefix?: string;\n maxNumberOfFiles?: number;\n uppyOptions?: {\n id?: string;\n allowedFileTypes: string[];\n };\n useName?: boolean;\n}\n\nexport const initializeUppy = async (options: InitializeOptions): Promise<Uppy> => {\n if (!options.backend) {\n throw new Error(\"No backend set.\")\n }\n const { callbacks, maxNumberOfFiles, uppyOptions } = options || {};\n const { uploadSuccess } = callbacks || {};\n const { allowedFileTypes, id } = uppyOptions || {};\n const token = await getToken()\n\n const uppy = new Uppy({\n autoProceed: true,\n debug: false,\n id: id || \"uppy\",\n restrictions: {\n maxNumberOfFiles: maxNumberOfFiles || 5,\n allowedFileTypes: allowedFileTypes || [\".heic\", \".jpg\", \".jpeg\", \".png\", \".webp\", \".svg\"],\n }\n })\n .use(AwsS3, {\n id: \"Exulu\",\n endpoint: options.backend,\n headers: { \n Authorization: `Bearer ${token}`,\n Session: localStorage.getItem(\"session\") ?? \"\",\n }\n })\n .on(\"file-added\", async (file) => {\n console.debug(\"added\", file);\n })\n .on(\"upload-error\", (file, error) => {\n if (!file?.id) {\n return;\n }\n uppy.removeFile(file?.id);\n console.error(\"error\", error);\n })\n .on(\"upload-success\", (file, response) => {\n if (!response.uploadURL) {\n return;\n }\n if (uploadSuccess) {\n console.log(\"response\", response)\n uploadSuccess({\n file: file,\n key: response.uploadURL.split(\"/\").pop() || \"\",\n url: response.uploadURL,\n });\n }\n });\n\n return uppy;\n};\n\nfunction useUppy(options: InitializeOptions, deps: any[] = []) {\n const configContext = useContext(ConfigContext);\n const [uppy, setUppy] = useState<Uppy | undefined>(undefined);\n useEffect(() => {\n const initUppy = async () => {\n const uppyInstance = await initializeUppy({\n ...options,\n backend: configContext?.backend || \"\",\n });\n setUppy(uppyInstance);\n };\n initUppy()\n return () => {\n if (uppy) {\n uppy.destroy();\n setUppy(undefined);\n }\n };\n }, [...deps]);\n\n return uppy;\n}\n\nexport default useUppy;\n","import useUppy from \"@/hooks/use-uppy\";\nimport { Dashboard } from '@uppy/react';\nimport { useContext, useEffect, useState } from \"react\"\nimport { X, File, ImageIcon, FileText, FilePlus, Download, LoaderIcon, FileWarning, Upload, PlusSquareIcon, EyeIcon, PlusIcon, ChevronRightIcon, ChevronLeftIcon } from \"lucide-react\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog\"\nimport { ScrollArea } from \"@/components/ui/scroll-area\"\nimport '@uppy/core/dist/style.min.css';\nimport '@uppy/dashboard/dist/style.min.css';\nimport { files, S3FileListOutput } from \"@/util/api\"\nimport { useTheme } from \"next-themes\";\nimport { ConfigContext } from \"./config-context\";\nimport { useQuery as useTanstackQuery, useMutation as useTanstackMutation } from \"@tanstack/react-query\";\nimport { Loading } from \"./ui/loading\";\nimport { allFileTypes } from \"@/types/models/agent\";\nimport { Input } from \"./ui/input\";\nimport { DoubleArrowLeftIcon } from \"@radix-ui/react-icons\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"./ui/card\";\nimport { Skeleton } from \"./ui/skeleton\";\n\nexport function FileDataCard({ s3key, children }: { s3key: string, children?: React.ReactNode }) {\n const { data, isLoading, error, refetch } = useTanstackQuery({\n queryKey: ['fileObject', s3key],\n queryFn: async () => {\n if (!s3key) {\n return null;\n }\n const result = await files.object(s3key);\n return result;\n },\n enabled: s3key !== undefined && s3key !== null,\n })\n\n useEffect(() => {\n if (s3key) {\n refetch();\n }\n }, [s3key]);\n\n if (!s3key) {\n return <Card>\n <CardContent className=\"p-3 flex\">\n <p className=\"text-sm text-muted-foreground m-auto\">No file selected</p>\n {children}\n </CardContent>\n </Card>;\n }\n\n // also filter out [bucket:name] from the key if [bucket:name] is present\n let name = s3key;\n let bucket = \"\";\n if (s3key.includes(\"[bucket:\")) {\n bucket = s3key.split(\"[bucket:\")[1]?.split(\"]\")[0] || \"\";\n name = s3key.split(\"[bucket:\")[1]?.split(\"]\")[0] || \"\";\n if (name?.length) {\n name = s3key.split(\"]\")[1] || \"\";\n }\n }\n // Get the part after _EXULU_\n name = name.split(\"_EXULU_\").pop() || \"\";\n\n return <Card>\n <CardHeader className=\"pb-3\">\n <CardTitle className=\"text-sm max-w-[500px] truncate\">\n {name}\n </CardTitle>\n </CardHeader>\n <CardContent className=\"pt-0\">\n {\n isLoading && (\n <div className=\"space-y-2\">\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-2/3\" />\n </div>\n )\n }\n {!isLoading && data && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span className=\"capitalize\">\n {data?.ContentType.split(\"/\").pop()}\n {bucket && ` [Bucket: ${bucket}]`}\n </span>\n <span>{(data?.ContentLength / 1024 / 1024).toFixed(2)} MB</span>\n </div>\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span>Last modified: {new Date(data?.LastModified).toLocaleDateString(\"en-US\", { year: \"numeric\", month: \"long\", day: \"numeric\", hour: \"2-digit\", minute: \"2-digit\" })}</span>\n <Button\n variant=\"secondary\"\n size=\"sm\"\n type=\"button\"\n className=\"h-7 px-2\"\n onClick={() => {\n files.download(s3key).then(async res => {\n console.log(\"res\", res);\n const json = await res.json()\n console.log(\"res\", json);\n const downloadUrl = json.url;\n window.open(downloadUrl, '_blank');\n return;\n })\n }}>\n <span className=\"mr-1 text-xs\">View</span>\n <Download className=\"h-3 w-3\" />\n </Button>\n </div>\n </div>\n )}\n {\n !isLoading && error && (\n <p className=\"text-xs text-muted-foreground\">{error.message}</p>\n )\n }\n {children}\n </CardContent>\n </Card>\n}\n\nexport default function UppyDashboard({ id, allowedFileTypes, dependencies, onConfirm, selectionLimit, buttonText }: {\n id: string,\n buttonText?: string,\n allowedFileTypes?: allFileTypes[],\n selectionLimit: number,\n dependencies: any[],\n onConfirm: (keys: string[]) => void\n}) {\n const [open, setOpen] = useState(false)\n return <Dialog open={open} onOpenChange={setOpen}>\n <DialogTrigger asChild>\n <Button variant=\"outline\">\n {buttonText && (\n <span className=\"mr-2\">{buttonText}</span>\n )\n }\n <FilePlus className=\"h-4 w-4\" />\n </Button>\n </DialogTrigger>\n <DialogContent className=\"sm:max-w-[900px]\">\n <DialogHeader>\n <DialogTitle>File Gallery</DialogTitle>\n <DialogDescription>Browse your previously uploaded files or upload new ones.</DialogDescription>\n </DialogHeader>\n <FileGalleryAndUpload\n id={id}\n allowedFileTypes={allowedFileTypes}\n dependencies={dependencies}\n selectionLimit={selectionLimit}\n onConfirm={(data) => {\n onConfirm(data)\n setOpen(false)\n }}\n />\n </DialogContent>\n </Dialog>;\n}\n\nexport const FileGalleryAndUpload = ({ id, allowedFileTypes, dependencies, onConfirm, selectionLimit }: {\n id: string,\n allowedFileTypes?: allFileTypes[],\n dependencies: any[],\n selectionLimit: number,\n onConfirm: (keys: string[]) => void\n}) => {\n\n if (!allowedFileTypes) {\n allowedFileTypes = [\n '.png',\n '.jpg',\n '.jpeg',\n '.gif',\n '.webp',\n '.pdf',\n '.docx',\n '.xlsx',\n '.xls',\n '.csv',\n '.pptx',\n '.ppt',\n '.mp3',\n '.wav',\n '.m4a',\n '.mp4',\n '.mpeg',\n '.mp4',\n '.m4a',\n '.mp3',\n '.mpeg',\n '.wav'\n ]\n }\n\n const [search, setSearch] = useState<string | undefined>(undefined)\n const [previousContinuationToken, setPreviousContinuationToken] = useState<string | undefined>(undefined)\n const [currentContinuationToken, setCurrentContinuationToken] = useState<string | undefined>(undefined)\n const configContext = useContext(ConfigContext);\n const [selected, setSelected] = useState<string[]>([])\n\n const addSelected = (key: string) => {\n if (selected.includes(key)) {\n setSelected(selected.filter((s) => s !== key))\n return;\n }\n if (selectionLimit === 1) {\n setSelected([key])\n return;\n }\n if (selected.length >= selectionLimit) {\n return;\n }\n setSelected([...selected, key])\n }\n\n const deleteFile = useTanstackMutation({\n mutationFn: async ({ key }: { key: string }) => {\n await files.delete(key)\n refetch();\n return;\n }\n })\n\n const { data, isLoading: loading, error, refetch } = useTanstackQuery({\n queryKey: ['filesQuery', search, currentContinuationToken],\n staleTime: 30000,\n queryFn: async (): Promise<S3FileListOutput> => {\n return files.list({\n search,\n continuationToken: currentContinuationToken\n })\n },\n })\n\n console.log(\"!! data !!\", data)\n\n const { theme } = useTheme()\n const uppy = useUppy(\n {\n backend: configContext?.backend || \"\",\n uppyOptions: {\n id,\n allowedFileTypes\n },\n callbacks: {\n uploadSuccess: async (data) => {\n console.log(\"data\", data)\n /* \n We no longer create items automatically for files uploaded via uppy.\n const item = {\n name: data.file.name,\n type: data.file.type,\n rights_mode: \"private\",\n s3key: `${user?.id}/${data.key}`\n }\n await createItemMutation({ variables: { input: item } }) */\n },\n },\n maxNumberOfFiles: 10,\n },\n dependencies,\n );\n\n useEffect(() => {\n refetch();\n }, [search, currentContinuationToken]);\n\n // Loading state\n if (!uppy) {\n return null;\n }\n\n return <>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4\">\n {/* Left side - Gallery of previously uploaded files */}\n <div className=\"border rounded-lg p-4\">\n <h3 className=\"text-sm font-medium mb-3\">Previously Uploaded Files</h3>\n\n {/* search */}\n <Input\n placeholder=\"Search files...\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n className=\"mb-3\"\n />\n <div className=\"flex items-center justify-between text-xs text-muted-foreground pb-2\">\n <span>{selected.length} / {selectionLimit} files selected</span>\n <span>Allowed file types: {allowedFileTypes?.map((type) => type).join(\", \")}</span>\n </div>\n <ScrollArea>\n {loading && (\n <div className=\"flex items-center justify-center h-full w-full grid grid-cols-2 sm:grid-cols-3 gap-3\">\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n <Skeleton className=\"h-[120px] w-full\" />\n </div>\n )}\n <div className=\"grid grid-cols-2 sm:grid-cols-3 gap-3\">\n {\n !loading && !data?.Contents?.length && (\n <div className=\"col-span-full flex flex-col items-center justify-center py-12 text-center\">\n <FileWarning className=\"h-12 w-12 text-muted-foreground/50 mb-3\" />\n <p className=\"text-sm font-medium text-muted-foreground\">Nothing to see here... yet!</p>\n <p className=\"text-xs text-muted-foreground/75 mt-1\">Upload some files to get started</p>\n </div>\n )\n }\n {data?.Contents?.map((item: S3FileListOutput[\"Contents\"][0]) => {\n return (\n <FileItem s3Key={item.Key} onSelect={addSelected} active={selected.some((s) => s === item.Key)} onRemove={() => {\n deleteFile.mutate({\n key: item.Key\n })\n }} disabled={!allowedFileTypes ? false : !allowedFileTypes?.some((type) => item.Key.endsWith(type))} />\n )\n })}\n </div>\n\n <div className=\"flex items-center space-x-6 lg:space-x-8 pt-3\">\n <div className=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n className=\"hidden size-8 p-0 lg:flex\"\n onClick={() => {\n setCurrentContinuationToken(undefined)\n }}\n disabled={\n !currentContinuationToken ||\n loading\n }\n >\n <span className=\"sr-only\">Go to first page</span>\n <DoubleArrowLeftIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n className=\"size-8 p-0\"\n onClick={() => {\n setCurrentContinuationToken(previousContinuationToken)\n }}\n disabled={\n !currentContinuationToken ||\n loading\n }\n >\n <span className=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon className=\"size-4\" />\n </Button>\n <Button\n variant=\"outline\"\n className=\"size-8 p-0\"\n onClick={() => {\n setPreviousContinuationToken(currentContinuationToken)\n setCurrentContinuationToken(data?.NextContinuationToken)\n }}\n disabled={\n !data?.NextContinuationToken ||\n loading\n }>\n <span className=\"sr-only\">Go to next page</span>\n <ChevronRightIcon className=\"size-4\" />\n </Button>\n </div>\n </div>\n </ScrollArea>\n </div>\n {/* Right side - Upload area */}\n <div className=\"border rounded-lg p-4\">\n <h3 className=\"text-sm font-medium mb-3\">Upload New Files</h3>\n <Dashboard uppy={uppy} theme={theme === \"dark\" ? \"dark\" : \"light\"} />\n </div>\n </div>\n <div className=\"flex justify-end\">\n <Button variant=\"outline\" onClick={() => {\n onConfirm(selected)\n setSelected([])\n }}>\n Confirm\n </Button>\n </div>\n </>\n}\n\nexport const FileItem = ({ s3Key, onSelect, onRemove, active, disabled, addToContext }: {\n s3Key: string,\n onSelect?: (key: string) => void,\n onRemove?: (key: string) => void,\n active: boolean,\n disabled: boolean,\n addToContext?: (key: string) => void\n}) => {\n const getFileIcon = (s3Key: string) => {\n if (!s3Key) {\n return <FileText className=\"h-6 w-6 text-gray-500\" />\n }\n if (\n s3Key.toLowerCase().endsWith(\"jpg\") ||\n s3Key.toLowerCase().endsWith(\"jpeg\") ||\n s3Key.toLowerCase().endsWith(\"png\") ||\n s3Key.toLowerCase().endsWith(\"svg\")\n ) {\n return <ImageIcon className=\"h-6 w-6 text-blue-500\" />\n } else if (s3Key.endsWith(\"pdf\")) {\n return <File className=\"h-6 w-6 text-red-500\" />\n } else if (s3Key.endsWith(\"xls\") || s3Key.endsWith(\"xlsx\") || s3Key.endsWith(\"csv\")) {\n return <FileText className=\"h-6 w-6 text-green-500\" />\n } else if (s3Key.endsWith(\"ppt\") || s3Key.endsWith(\"pptx\")) {\n return <FileText className=\"h-6 w-6 text-orange-500\" />\n } else {\n return <FileText className=\"h-6 w-6 text-gray-500\" />\n }\n }\n\n return (\n <div\n key={s3Key}\n className={`${disabled ? 'opacity-50' : ''} group relative rounded-lg p-2 hover:bg-muted transition-colors cursor-pointer ${active ? 'border border-purple-500' : 'border'}`}\n onClick={() => {\n if (!disabled && onSelect) {\n onSelect(s3Key)\n }\n }}>\n <div className=\"aspect-square relative mb-2 bg-muted/50 rounded-md overflow-hidden flex items-center justify-center\">\n {(\n s3Key && (\n s3Key.toLowerCase().endsWith(\"jpg\") ||\n s3Key.toLowerCase().endsWith(\"jpeg\") ||\n s3Key.toLowerCase().endsWith(\"png\") ||\n s3Key.toLowerCase().endsWith(\"svg\")\n )\n ) ? (\n <SecureImageRenderComponent fileKey={s3Key} />\n ) : (\n <div className=\"flex flex-col items-center justify-center h-full\">\n {getFileIcon(s3Key)}\n <span className=\"text-xs text-muted-foreground mt-1 text-center\">{s3Key ? s3Key.split(\"_EXULU_\").pop() : s3Key}</span>\n </div>\n )}\n </div>\n <p className=\"text-xs truncate\">{s3Key ? s3Key.split(\"_EXULU_\").pop() : s3Key}</p>\n <div className=\"opacity-0 group-hover:opacity-100 flex absolute top-1 right-1\">\n\n {addToContext && (\n <Button variant=\"ghost\" size=\"icon\" type=\"button\" className=\"h-6 w-6 bg-background/80 hover:bg-background\" onClick={() => {\n addToContext(s3Key)\n }}>\n <PlusIcon className=\"h-3 w-3\" />\n <span className=\"sr-only\">Add</span>\n </Button>\n )}\n\n <Button\n variant=\"ghost\"\n size=\"icon\"\n type=\"button\"\n className=\"h-6 w-6 bg-background/80 hover:bg-background\"\n onClick={() => {\n files.download(s3Key).then(async res => {\n console.log(\"res\", res);\n const json = await res.json()\n console.log(\"res\", json);\n const downloadUrl = json.url;\n window.open(downloadUrl, '_blank');\n return;\n })\n }}>\n <Download className=\"h-3 w-3\" />\n <span className=\"sr-only\">View</span>\n </Button>\n\n {onRemove && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onRemove(s3Key)\n }}\n variant=\"ghost\"\n type=\"button\"\n size=\"icon\"\n className=\"h-6 w-6 opacity-0 group-hover:opacity-100 bg-background/80 hover:bg-background ml-1\">\n <X className=\"h-3 w-3\" />\n <span className=\"sr-only\">Remove</span>\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nlet signedUrlCache: {\n [key: string]: {\n url: string;\n expiresAt: number;\n }\n} = {};\n\nexport const getPresignedUrl = async (fileKey: string) => {\n if (signedUrlCache[fileKey]) {\n if (signedUrlCache[fileKey].expiresAt < Date.now()) {\n delete signedUrlCache[fileKey];\n } else {\n return signedUrlCache[fileKey].url;\n }\n }\n const response = await files.download(fileKey)\n const json = await response.json();\n console.log(\"json\", json)\n signedUrlCache[fileKey] = {\n url: json.url,\n expiresAt: Date.now() + 60 * 1000, // 1 minute\n }\n return json.url;\n}\n\nconst SecureImageRenderComponent = ({ fileKey }: { fileKey: string }) => {\n // Gets a signed key to show the image\n console.log(\"key\", fileKey)\n const query = useTanstackQuery({\n queryKey: ['imageQuery', fileKey],\n staleTime: 30000,\n queryFn: async () => {\n return getPresignedUrl(fileKey)\n },\n })\n\n if (query.isLoading) {\n return <div><LoaderIcon /></div>\n }\n\n if (!query.isLoading && !query.data) {\n return <div><FileWarning /></div>\n }\n\n return (<img\n src={query.data}\n alt={fileKey}\n className=\"object-cover w-full h-full\"\n />)\n\n}"],"names":["CodeBlockContext","createContext","code","CodeBlock","language","showLineNumbers","className","children","props","param","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","Provider","value","div","cn","jsxs","SyntaxHighlighter","codeTagProps","customStyle","margin","padding","fontSize","background","color","lineNumberStyle","paddingRight","minWidth","style","oneLight","oneDark","CodeBlockCopyButton","onCopy","onError","timeout","isCopied","setIsCopied","useState","useContext","copyToClipboard","navigator","clipboard","writeText","setTimeout","error","Icon","CheckIcon","CopyIcon","Button","onClick","size","variant","HardenedMarkdown","hardenReactMarkdown","ReactMarkdown","components","ol","node","li","ul","hr","strong","span","a","rel","target","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","th","td","blockquote","position","start","line","end","pre","properties","replace","isValidElement","console","log","Response","memo","options","allowedImagePrefixes","allowedLinkPrefixes","defaultOrigin","parseIncompleteMarkdown","shouldParseIncompleteMarkdown","parsedChildren","text","result","linkMatch","match","startIndex","lastIndexOf","substring","asteriskPairs","length","concat","underscorePairs","singleAsterisks","split","reduce","acc","char","index","prevChar","nextChar","singleUnderscores","includes","singleBacktickCount","i","isTripleStart","isTripleMiddle","isTripleEnd","tildePairs","rehypePlugins","rehypeKatex","remarkPlugins","remarkGfm","remarkMath","prevProps","nextProps","displayName","alertVariants","cva","variants","default","destructive","info","defaultVariants","Alert","React","ref","role","AlertTitle","AlertDescription","Collapsible","CollapsiblePrimitive","CollapsibleTrigger","CollapsibleContent","Tabs","TabsPrimitive","TabsList","TabsTrigger","TabsContent","count","toastTimeouts","Map","addToRemoveQueue","has","toastId","delete","dispatch","type","set","reducer","state","action","toasts","toast","slice","map","t","id","forEach","undefined","open","filter","listeners","memoryState","listener","Number","MAX_SAFE_INTEGER","toString","dismiss","onOpenChange","update","useToast","setState","push","indexOf","splice","initializeUppy","localStorage","backend","callbacks","maxNumberOfFiles","uppyOptions","uploadSuccess","allowedFileTypes","token","getToken","uppy","Uppy","autoProceed","debug","restrictions","use","AwsS3","endpoint","headers","Authorization","Session","getItem","on","file","removeFile","response","uploadURL","key","pop","url","use_uppy","deps","configContext","ConfigContext","setUppy","useEffect","initUppy","destroy","FileDataCard","s3key","data","isLoading","refetch","useTanstackQuery","queryKey","queryFn","files","object","enabled","jsx_runtime","Card","CardContent","p","name","bucket","CardHeader","CardTitle","Skeleton","ContentType","ContentLength","toFixed","Date","LastModified","toLocaleDateString","year","month","day","hour","minute","download","then","res","json","downloadUrl","window","Download","message","UppyDashboard","dependencies","onConfirm","selectionLimit","buttonText","setOpen","Dialog","DialogTrigger","asChild","FilePlus","DialogContent","DialogHeader","DialogTitle","DialogDescription","FileGalleryAndUpload","search","setSearch","previousContinuationToken","setPreviousContinuationToken","currentContinuationToken","setCurrentContinuationToken","selected","setSelected","addSelected","s","deleteFile","useTanstackMutation","mutationFn","loading","staleTime","list","continuationToken","theme","useTheme","useUppy","Fragment","Input","placeholder","onChange","e","join","ScrollArea","Contents","FileWarning","FileItem","s3Key","item","Key","onSelect","active","some","onRemove","mutate","disabled","endsWith","DoubleArrowLeftIcon","ChevronLeftIcon","NextContinuationToken","ChevronRightIcon","Dashboard","addToContext","toLowerCase","SecureImageRenderComponent","fileKey","ImageIcon","File","FileText","PlusIcon","stopPropagation","X","signedUrlCache","getPresignedUrl","expiresAt","now","query","LoaderIcon","img","src","alt"],"sourceRoot":""}
|