@chaibuilder/pages 0.4.5 → 0.4.6-beta.2

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.
@@ -1,7 +1,7 @@
1
1
  var ps = Object.defineProperty;
2
2
  var xs = (e, t, n) => t in e ? ps(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var qe = (e, t, n) => xs(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { s as Vn, m as Gn, b as R, d as rr, e as U, a as m, f as W, h as oe, S as B, c as D, i as we, u as $e, j as V, k as A, l as Ne, o as ut, P as zo, n as j, D as ws, t as q, p as Ft, q as ln, r as k, v as F, w as $s, x as Rt, y as Cs, z as Ss, A as wn, F as ks, B as Es, C as Ds, E as Kt, G as Ms, H as As, I as Fs, J as or, K as Kr, L as Ts, M as qt, $ as Ro, N as Br, O as Is, Q as Ps, R as zn, T as Ls, U as Os, V as qs } from "./index-xGrIPO1U.js";
4
+ import { s as Vn, m as Gn, b as R, d as rr, e as U, a as m, f as W, h as oe, S as B, c as D, i as we, u as $e, j as V, k as A, l as Ne, o as ut, P as zo, n as j, D as ws, t as q, p as Ft, q as ln, r as k, v as F, w as $s, x as Rt, y as Cs, z as Ss, A as wn, F as ks, B as Es, C as Ds, E as Kt, G as Ms, H as As, I as Fs, J as or, K as Kr, L as Ts, M as qt, $ as Ro, N as Br, O as Is, Q as Ps, R as zn, T as Ls, U as Os, V as qs } from "./index-Ci9oNrDB.js";
5
5
  var _s = (e) => e != null, zs = (e) => e.filter(_s);
6
6
  function Rs(e) {
7
7
  return (...t) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-Eeaqj2pE.cjs"),t=require("./index-BH25LDvP.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-CgKmoZhy.cjs"),t=require("./index-sSI8ulEa.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-BpF1oV0W.js";
2
- import { g as d, c as f, a as e } from "./index-xGrIPO1U.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-Doi8QlXL.js";
2
+ import { g as d, c as f, a as e } from "./index-Ci9oNrDB.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-BpF1oV0W.js";
2
- import { g as v, c as C, a as e } from "./index-xGrIPO1U.js";
1
+ import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-Doi8QlXL.js";
2
+ import { g as v, c as C, a as e } from "./index-Ci9oNrDB.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-Eeaqj2pE.cjs"),t=require("./index-BH25LDvP.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-CgKmoZhy.cjs"),t=require("./index-sSI8ulEa.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),O=require("@chaibuilder/sdk"),i=require("@chaibuilder/sdk/ui"),D=require("lodash-es"),g=require("lucide-react"),Z=require("react-dropzone"),v=require("@tanstack/react-query"),S=require("sonner"),n=require("./index-sSI8ulEa.cjs"),$=()=>{const a=n.useAssetsApiUrl(),c=v.useQueryClient(),d=n.useFetch();return v.useMutation({mutationFn:async({file:o,folderId:u,name:t})=>d(a,{action:n.ACTIONS.UPLOAD_ASSET,data:{file:o,folderId:u,name:t}}),onSuccess:()=>{c.invalidateQueries({queryKey:[n.ACTIONS.GET_ASSETS]}),S.toast.success("Asset uploaded successfully")},onError:()=>{S.toast.error("Failed to upload asset")}})},ee=()=>{const a=n.useAssetsApiUrl(),c=v.useQueryClient(),d=n.useFetch();return v.useMutation({mutationFn:async o=>d(a,{action:n.ACTIONS.DELETE_ASSET,data:{id:o}}),onSuccess:()=>{c.invalidateQueries({queryKey:[n.ACTIONS.GET_ASSETS]}),S.toast.success("Asset deleted successfully")},onError:()=>{S.toast.error("Failed to delete asset")}})},se=()=>{const a=n.useAssetsApiUrl(),c=v.useQueryClient(),d=n.useFetch();return v.useMutation({mutationFn:async o=>d(a,{action:n.ACTIONS.UPDATE_ASSET,data:o}),onSuccess:()=>{c.invalidateQueries({queryKey:[n.ACTIONS.GET_ASSETS]}),S.toast.success("Asset updated successfully")},onError:()=>{S.toast.error("Failed to update asset")}})},te=(a={})=>{const c=n.useAssetsApiUrl(),d=n.useFetch(),{search:o,limit:u=10}=a;return v.useInfiniteQuery({queryKey:[n.QUERY_KEY_BASE,n.ACTIONS.GET_ASSETS,{search:o,limit:u}],queryFn:async({pageParam:t=1})=>(await d(c,{action:n.ACTIONS.GET_ASSETS,data:{search:o,page:t,limit:u}})).data,initialPageParam:1,getNextPageParam:t=>((t==null?void 0:t.page)??0)*((t==null?void 0:t.pageSize)??0)<((t==null?void 0:t.total)??0)?(t.page??0)+1:void 0,getPreviousPageParam:t=>(t.page??0)>1?(t.page??0)-1:void 0,retry:1})};function ae(){const[c,d]=l.useState([]),[o,u]=l.useState({query:"",pageSize:10}),t=D.debounce(()=>o.query,300)(),{data:m,isLoading:A,fetchNextPage:b,hasNextPage:h,isFetchingNextPage:j}=te({search:(t==null?void 0:t.toLowerCase().trim())||"",limit:o.pageSize}),F=(m==null?void 0:m.pages.flatMap(f=>f.assets))||[],{mutate:y,isPaused:p}=se(),{mutate:w,isPending:N}=$(),{mutate:C,isPending:E}=ee(),U=l.useCallback(()=>{h&&!j&&b()},[b,h,j]),T=l.useCallback(f=>{u(x=>({...x,query:f}))},[]),I=l.useCallback(f=>{d(x=>D.find(x,{id:f.id})?[]:[f])},[!1]),M=l.useCallback(()=>{d([])},[]);return{query:(o==null?void 0:o.query)||"",selectedAssets:c,assets:F,hasNextPage:h,isFetchingNextPage:j,uploadAsset:w,updateAsset:y,deleteAsset:C,loadMoreAssets:U,updateSearchQuery:T,clearSelectedAssets:M,updateSelectedAssets:I,isLoadingAssets:A,isUploadingAsset:N,isUpdatingAsset:p,isDeletingAsset:E}}const re=l.lazy(()=>Promise.resolve().then(()=>require("./asset-metadata-editor-YXDey62L.cjs"))),le=l.lazy(()=>Promise.resolve().then(()=>require("./image-editor-BKUmqgv0.cjs")));function ne({close:a,onSelect:c,mode:d="image"}){const u=l.useMemo(()=>[d],[d]),[t,m]=l.useState("browse"),[A,b]=l.useState(null),[h,j]=l.useState({show:!1,file:"",name:""}),{query:F,assets:y,selectedAssets:p,hasNextPage:w,isFetchingNextPage:N,uploadAsset:C,updateAsset:E,deleteAsset:U,loadMoreAssets:T,updateSearchQuery:I,clearSelectedAssets:M,updateSelectedAssets:f,isLoadingAssets:x,isUploadingAsset:P,isUpdatingAsset:Q}=ae(),L=l.useRef(null);l.useEffect(()=>{const s=L.current;if(!s)return;const r=()=>{s.scrollHeight-s.scrollTop<=s.clientHeight*1.5&&!x&&w&&!N&&T()};return s.addEventListener("scroll",r),()=>s.removeEventListener("scroll",r)},[x,T,w,N]);const _=l.useCallback(async s=>new Promise((r,k)=>{const B=s[0],q=new FileReader;q.readAsDataURL(B),q.onload=async()=>{const z=await C({file:q.result,folderId:null,name:B.name});m("browse"),r(z)},q.onerror=z=>k(z)}),[C]),{getRootProps:R,getInputProps:G,isDragActive:K}=Z.useDropzone({onDrop:_,accept:{"image/*":u.includes("image")?[]:[],"video/*":u.includes("video")?[]:[]},maxSize:10*1024*1024}),Y=()=>{c([p[0].url]),a()},H=async s=>{await U(s.id)},V=s=>{b(s)},J=async(s,r)=>{await E(D.merge(s,r)),a()},W=s=>{I(s.target.value)},X=async(s,r)=>{try{r?await C({file:s,folderId:null,name:h.name}):await E({id:h.id,file:s}),j({show:!1,file:"",name:""}),m("browse")}catch(k){console.error("Error saving edited image:",k)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]",children:[e.jsx("h1",{className:"text-lg font-medium pb-4",children:"Digital Asset Manager"}),e.jsxs(i.Tabs,{value:t,onValueChange:s=>m(s),className:"flex-1 flex flex-col h-full",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs(i.TabsList,{children:[e.jsx(i.TabsTrigger,{value:"browse",children:"Browse Assets"}),e.jsx(i.TabsTrigger,{value:"upload",children:"Upload"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p.length>0&&e.jsx(e.Fragment,{children:e.jsx(i.Button,{variant:"outline",size:"sm",onClick:()=>M(),title:"Clear selection",children:"Clear"})}),e.jsx(i.Button,{size:"sm",onClick:Y,disabled:p.length===0,children:"Select Asset"})]})]}),e.jsxs(i.TabsContent,{value:"browse",className:"flex-1 flex flex-col",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs("div",{className:"relative w-full",children:[e.jsx(g.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(i.Input,{placeholder:"Search assets...",value:F,onChange:W,className:"pl-8"})]})}),x&&y.length===0?e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",children:[e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"}),e.jsx("div",{className:"bg-gray-200 h-64 w-full animate-pulse rounded"})]}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-12 h-[380px]",children:[e.jsxs("div",{className:"text-muted-foreground mb-2",children:[e.jsx("h3",{className:"text-gray-800 font-medium",children:"No assets to display"}),e.jsx("p",{className:"text-sm",children:"You haven't uploaded any assets yet. Start by uploading your first asset."})]}),e.jsx("div",{className:"flex gap-2 pt-4",children:e.jsx(i.Button,{size:"lg",onClick:()=>m("upload"),children:"Upload Assets"})})]}):e.jsxs("div",{ref:L,className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",children:[y.map(s=>e.jsx(i.Card,{className:O.mergeClasses("cursor-pointer overflow-hidden transition-all",p.some(r=>r.id===s.id)?"ring-2 ring-primary":"hover:ring-2 hover:ring-primary/20"),onClick:()=>f(s),children:e.jsxs(i.CardContent,{className:"p-0 relative group",children:[e.jsxs("div",{className:"aspect-square relative overflow-hidden bg-muted",children:[s.type==="image"?e.jsx("img",{src:s.url||"/placeholder.svg",alt:s.name,className:"object-cover w-full h-full"}):e.jsxs("div",{className:"flex items-center justify-center h-full",children:[e.jsx(g.Film,{className:"h-12 w-12 text-muted-foreground"}),s.thumbnailUrl&&e.jsx("img",{src:s.thumbnailUrl||"/placeholder.svg",alt:s.name,className:"absolute inset-0 object-cover w-full h-full"})]}),e.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[e.jsx(i.Button,{variant:"secondary",size:"icon",className:"h-8 w-8",onClick:r=>{r.stopPropagation(),V(s)},children:e.jsx(g.ImageIcon,{className:"h-4 w-4"})}),e.jsx(i.Button,{variant:"secondary",size:"icon",className:"h-8 w-8",onClick:r=>{r.stopPropagation(),j({id:s.id,show:!0,file:s.url,name:s.name})},children:e.jsx(g.Edit,{className:"h-4 w-4"})}),e.jsx(i.Button,{variant:"destructive",size:"icon",className:"h-8 w-8",onClick:r=>{r.stopPropagation(),H(s)},children:e.jsx(g.Trash2,{className:"h-4 w-4"})})]}),p.some(r=>r.id===s.id)&&e.jsx("div",{className:"absolute top-2 left-2",children:e.jsx("input",{type:"checkbox",checked:p.some(r=>r.id===s.id),readOnly:!0,className:"rounded-full"})})]}),e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-sm font-medium truncate",title:s.name,children:s.name}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:ie((s==null?void 0:s.size)||0)}),e.jsx("span",{children:oe(s.createdAt)})]})]})]})},s.id)),x&&y.length>0&&e.jsx("div",{className:"col-span-full flex justify-center py-4",children:e.jsx(g.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!x&&w&&e.jsx("div",{className:"col-span-full flex justify-center py-4",children:e.jsxs(i.Button,{variant:"outline",onClick:()=>T(),disabled:N,className:"flex items-center gap-2",children:[N?e.jsx(g.Loader2,{className:"h-4 w-4 animate-spin"}):null,"Load More"]})})]})]}),e.jsx(i.TabsContent,{value:"upload",className:"flex-1 ",children:e.jsxs("div",{...R(),className:O.mergeClasses("border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",K?"border-primary bg-primary/5":"border-muted-foreground/20"),children:[e.jsx("input",{...G()}),Q||P?e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(g.Loader2,{className:"h-12 w-12 text-primary animate-spin mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-1",children:"Uploading files..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait while your files are being processed."})]}):e.jsxs(e.Fragment,{children:[e.jsx(g.Upload,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-1",children:"Drag & drop files here"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"or click to browse your files"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Accepted file types: ",u.join(", ")]}),e.jsxs("p",{children:["Maximum file size: ",10,"MB"]})]})]})]})})]})]}),A&&e.jsx(l.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsx(re,{asset:A,onSave:s=>J(A,s),onCancel:()=>{b(null)}})}),h.show&&e.jsx(l.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsx(le,{imageUrl:h.file,onSave:X,onClose:()=>j({show:!1,file:"",name:""}),defaultSavedImageName:h.name,isEditing:!!h.id})})]})}function ie(a){return a<1024?a+" B":a<1024*1024?(a/1024).toFixed(1)+" KB":a<1024*1024*1024?(a/(1024*1024)).toFixed(1)+" MB":(a/(1024*1024*1024)).toFixed(1)+" GB"}function oe(a){const c=new Date(a);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(c)}exports.default=ne;
@@ -0,0 +1,471 @@
1
+ import { jsxs as a, Fragment as j, jsx as e } from "react/jsx-runtime";
2
+ import W, { useState as T, useCallback as C, useMemo as ne, useRef as oe, useEffect as ce, Suspense as Y } from "react";
3
+ import { mergeClasses as O } from "@chaibuilder/sdk";
4
+ import { Tabs as de, TabsList as ue, TabsTrigger as H, Button as v, TabsContent as V, Input as me, Card as he, CardContent as pe } from "@chaibuilder/sdk/ui";
5
+ import { debounce as fe, find as ge, merge as ve } from "lodash-es";
6
+ import { Search as xe, Film as ye, ImageIcon as Ne, Edit as Se, Trash2 as we, Loader2 as _, Upload as Ae } from "lucide-react";
7
+ import { useDropzone as be } from "react-dropzone";
8
+ import { useQueryClient as B, useMutation as Q, useInfiniteQuery as Ee } from "@tanstack/react-query";
9
+ import { toast as N } from "sonner";
10
+ import { W as z, X as M, Y as f, Z as Ce } from "./index-Ci9oNrDB.js";
11
+ const Te = () => {
12
+ const l = z(), n = B(), o = M();
13
+ return Q({
14
+ mutationFn: async ({
15
+ file: r,
16
+ folderId: c,
17
+ name: t
18
+ }) => o(l, {
19
+ action: f.UPLOAD_ASSET,
20
+ data: { file: r, folderId: c, name: t }
21
+ }),
22
+ onSuccess: () => {
23
+ n.invalidateQueries({
24
+ queryKey: [f.GET_ASSETS]
25
+ }), N.success("Asset uploaded successfully");
26
+ },
27
+ onError: () => {
28
+ N.error("Failed to upload asset");
29
+ }
30
+ });
31
+ }, Ue = () => {
32
+ const l = z(), n = B(), o = M();
33
+ return Q({
34
+ mutationFn: async (r) => o(l, {
35
+ action: f.DELETE_ASSET,
36
+ data: { id: r }
37
+ }),
38
+ onSuccess: () => {
39
+ n.invalidateQueries({
40
+ queryKey: [f.GET_ASSETS]
41
+ }), N.success("Asset deleted successfully");
42
+ },
43
+ onError: () => {
44
+ N.error("Failed to delete asset");
45
+ }
46
+ });
47
+ }, Fe = () => {
48
+ const l = z(), n = B(), o = M();
49
+ return Q({
50
+ mutationFn: async (r) => o(l, {
51
+ action: f.UPDATE_ASSET,
52
+ data: r
53
+ }),
54
+ onSuccess: () => {
55
+ n.invalidateQueries({
56
+ queryKey: [f.GET_ASSETS]
57
+ }), N.success("Asset updated successfully");
58
+ },
59
+ onError: () => {
60
+ N.error("Failed to update asset");
61
+ }
62
+ });
63
+ }, ze = (l = {}) => {
64
+ const n = z(), o = M(), { search: r, limit: c = 10 } = l;
65
+ return Ee({
66
+ queryKey: [Ce, f.GET_ASSETS, { search: r, limit: c }],
67
+ queryFn: async ({ pageParam: t = 1 }) => (await o(n, {
68
+ action: f.GET_ASSETS,
69
+ data: {
70
+ search: r,
71
+ page: t,
72
+ limit: c
73
+ }
74
+ })).data,
75
+ initialPageParam: 1,
76
+ getNextPageParam: (t) => ((t == null ? void 0 : t.page) ?? 0) * ((t == null ? void 0 : t.pageSize) ?? 0) < ((t == null ? void 0 : t.total) ?? 0) ? (t.page ?? 0) + 1 : void 0,
77
+ getPreviousPageParam: (t) => (t.page ?? 0) > 1 ? (t.page ?? 0) - 1 : void 0,
78
+ retry: 1
79
+ });
80
+ };
81
+ function Me() {
82
+ const [n, o] = T([]), [r, c] = T({
83
+ query: "",
84
+ pageSize: 10
85
+ }), t = fe(() => r.query, 300)(), {
86
+ data: d,
87
+ isLoading: S,
88
+ fetchNextPage: w,
89
+ hasNextPage: u,
90
+ isFetchingNextPage: g
91
+ } = ze({
92
+ search: (t == null ? void 0 : t.toLowerCase().trim()) || "",
93
+ limit: r.pageSize
94
+ }), D = (d == null ? void 0 : d.pages.flatMap((p) => p.assets)) || [], { mutate: x, isPaused: h } = Fe(), { mutate: A, isPending: y } = Te(), { mutate: b, isPending: U } = Ue(), I = C(() => {
95
+ u && !g && w();
96
+ }, [w, u, g]), E = C((p) => {
97
+ c((m) => ({
98
+ ...m,
99
+ query: p
100
+ }));
101
+ }, []), k = C(
102
+ (p) => {
103
+ o((m) => ge(m, { id: p.id }) ? [] : [p]);
104
+ },
105
+ [!1]
106
+ ), q = C(() => {
107
+ o([]);
108
+ }, []);
109
+ return {
110
+ // Data
111
+ query: (r == null ? void 0 : r.query) || "",
112
+ selectedAssets: n,
113
+ assets: D,
114
+ hasNextPage: u,
115
+ isFetchingNextPage: g,
116
+ // Mutations
117
+ uploadAsset: A,
118
+ updateAsset: x,
119
+ deleteAsset: b,
120
+ loadMoreAssets: I,
121
+ updateSearchQuery: E,
122
+ clearSelectedAssets: q,
123
+ updateSelectedAssets: k,
124
+ // Loading
125
+ isLoadingAssets: S,
126
+ isUploadingAsset: y,
127
+ isUpdatingAsset: h,
128
+ isDeletingAsset: U
129
+ };
130
+ }
131
+ const De = W.lazy(() => import("./asset-metadata-editor-CEFwXx62.js")), Ie = W.lazy(() => import("./image-editor-BQ6_F-iv.js"));
132
+ function Oe({
133
+ close: l,
134
+ onSelect: n,
135
+ mode: o = "image"
136
+ }) {
137
+ const c = ne(() => [o], [o]), [t, d] = T("browse"), [S, w] = T(null), [u, g] = T({ show: !1, file: "", name: "" }), {
138
+ // Data
139
+ query: D,
140
+ assets: x,
141
+ selectedAssets: h,
142
+ hasNextPage: A,
143
+ isFetchingNextPage: y,
144
+ // Mutations
145
+ uploadAsset: b,
146
+ updateAsset: U,
147
+ deleteAsset: I,
148
+ loadMoreAssets: E,
149
+ updateSearchQuery: k,
150
+ clearSelectedAssets: q,
151
+ updateSelectedAssets: p,
152
+ // Loading
153
+ isLoadingAssets: m,
154
+ isUploadingAsset: R,
155
+ isUpdatingAsset: X
156
+ // isDeletingAsset,
157
+ } = Me(), G = oe(null);
158
+ ce(() => {
159
+ const s = G.current;
160
+ if (!s) return;
161
+ const i = () => {
162
+ s.scrollHeight - s.scrollTop <= s.clientHeight * 1.5 && !m && A && !y && E();
163
+ };
164
+ return s.addEventListener("scroll", i), () => s.removeEventListener("scroll", i);
165
+ }, [m, E, A, y]);
166
+ const Z = C(
167
+ async (s) => new Promise((i, L) => {
168
+ const K = s[0], F = new FileReader();
169
+ F.readAsDataURL(K), F.onload = async () => {
170
+ const P = await b({
171
+ file: F.result,
172
+ folderId: null,
173
+ name: K.name
174
+ });
175
+ d("browse"), i(P);
176
+ }, F.onerror = (P) => L(P);
177
+ }),
178
+ [b]
179
+ ), { getRootProps: J, getInputProps: $, isDragActive: ee } = be({
180
+ onDrop: Z,
181
+ accept: {
182
+ "image/*": c.includes("image") ? [] : [],
183
+ "video/*": c.includes("video") ? [] : []
184
+ },
185
+ maxSize: 10 * 1024 * 1024
186
+ }), se = () => {
187
+ n([h[0].url]), l();
188
+ }, ae = async (s) => {
189
+ await I(s.id);
190
+ }, te = (s) => {
191
+ w(s);
192
+ }, le = async (s, i) => {
193
+ await U(ve(s, i)), l();
194
+ }, ie = (s) => {
195
+ k(s.target.value);
196
+ }, re = async (s, i) => {
197
+ try {
198
+ i ? await b({
199
+ file: s,
200
+ folderId: null,
201
+ name: u.name
202
+ }) : await U({ id: u.id, file: s }), g({ show: !1, file: "", name: "" }), d("browse");
203
+ } catch (L) {
204
+ console.error("Error saving edited image:", L);
205
+ }
206
+ };
207
+ return /* @__PURE__ */ a(j, { children: [
208
+ /* @__PURE__ */ a("div", { className: "min-w-[700px] min-h-[600px] w-[900px] max-w-[900px]", children: [
209
+ /* @__PURE__ */ e("h1", { className: "text-lg font-medium pb-4", children: "Digital Asset Manager" }),
210
+ /* @__PURE__ */ a(
211
+ de,
212
+ {
213
+ value: t,
214
+ onValueChange: (s) => d(s),
215
+ className: "flex-1 flex flex-col h-full",
216
+ children: [
217
+ /* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-2", children: [
218
+ /* @__PURE__ */ a(ue, { children: [
219
+ /* @__PURE__ */ e(H, { value: "browse", children: "Browse Assets" }),
220
+ /* @__PURE__ */ e(H, { value: "upload", children: "Upload" })
221
+ ] }),
222
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
223
+ h.length > 0 && /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
224
+ v,
225
+ {
226
+ variant: "outline",
227
+ size: "sm",
228
+ onClick: () => q(),
229
+ title: "Clear selection",
230
+ children: "Clear"
231
+ }
232
+ ) }),
233
+ /* @__PURE__ */ e(
234
+ v,
235
+ {
236
+ size: "sm",
237
+ onClick: se,
238
+ disabled: h.length === 0,
239
+ children: "Select Asset"
240
+ }
241
+ )
242
+ ] })
243
+ ] }),
244
+ /* @__PURE__ */ a(V, { value: "browse", className: "flex-1 flex flex-col", children: [
245
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ a("div", { className: "relative w-full", children: [
246
+ /* @__PURE__ */ e(xe, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
247
+ /* @__PURE__ */ e(
248
+ me,
249
+ {
250
+ placeholder: "Search assets...",
251
+ value: D,
252
+ onChange: ie,
253
+ className: "pl-8"
254
+ }
255
+ )
256
+ ] }) }),
257
+ m && x.length === 0 ? /* @__PURE__ */ a("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1", children: [
258
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
259
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
260
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
261
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
262
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
263
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
264
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
265
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
266
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" }),
267
+ /* @__PURE__ */ e("div", { className: "bg-gray-200 h-64 w-full animate-pulse rounded" })
268
+ ] }) : x.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center h-full text-center p-12 h-[380px]", children: [
269
+ /* @__PURE__ */ a("div", { className: "text-muted-foreground mb-2", children: [
270
+ /* @__PURE__ */ e("h3", { className: "text-gray-800 font-medium", children: "No assets to display" }),
271
+ /* @__PURE__ */ e("p", { className: "text-sm", children: "You haven't uploaded any assets yet. Start by uploading your first asset." })
272
+ ] }),
273
+ /* @__PURE__ */ e("div", { className: "flex gap-2 pt-4", children: /* @__PURE__ */ e(v, { size: "lg", onClick: () => d("upload"), children: "Upload Assets" }) })
274
+ ] }) : /* @__PURE__ */ a(
275
+ "div",
276
+ {
277
+ ref: G,
278
+ className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 overflow-y-auto max-h-[550px] p-1",
279
+ children: [
280
+ x.map((s) => /* @__PURE__ */ e(
281
+ he,
282
+ {
283
+ className: O(
284
+ "cursor-pointer overflow-hidden transition-all",
285
+ h.some((i) => i.id === s.id) ? "ring-2 ring-primary" : "hover:ring-2 hover:ring-primary/20"
286
+ ),
287
+ onClick: () => p(s),
288
+ children: /* @__PURE__ */ a(pe, { className: "p-0 relative group", children: [
289
+ /* @__PURE__ */ a("div", { className: "aspect-square relative overflow-hidden bg-muted", children: [
290
+ s.type === "image" ? /* @__PURE__ */ e(
291
+ "img",
292
+ {
293
+ src: s.url || "/placeholder.svg",
294
+ alt: s.name,
295
+ className: "object-cover w-full h-full"
296
+ }
297
+ ) : /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-full", children: [
298
+ /* @__PURE__ */ e(ye, { className: "h-12 w-12 text-muted-foreground" }),
299
+ s.thumbnailUrl && /* @__PURE__ */ e(
300
+ "img",
301
+ {
302
+ src: s.thumbnailUrl || "/placeholder.svg",
303
+ alt: s.name,
304
+ className: "absolute inset-0 object-cover w-full h-full"
305
+ }
306
+ )
307
+ ] }),
308
+ /* @__PURE__ */ a("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
309
+ /* @__PURE__ */ e(
310
+ v,
311
+ {
312
+ variant: "secondary",
313
+ size: "icon",
314
+ className: "h-8 w-8",
315
+ onClick: (i) => {
316
+ i.stopPropagation(), te(s);
317
+ },
318
+ children: /* @__PURE__ */ e(Ne, { className: "h-4 w-4" })
319
+ }
320
+ ),
321
+ /* @__PURE__ */ e(
322
+ v,
323
+ {
324
+ variant: "secondary",
325
+ size: "icon",
326
+ className: "h-8 w-8",
327
+ onClick: (i) => {
328
+ i.stopPropagation(), g({
329
+ id: s.id,
330
+ show: !0,
331
+ file: s.url,
332
+ name: s.name
333
+ });
334
+ },
335
+ children: /* @__PURE__ */ e(Se, { className: "h-4 w-4" })
336
+ }
337
+ ),
338
+ /* @__PURE__ */ e(
339
+ v,
340
+ {
341
+ variant: "destructive",
342
+ size: "icon",
343
+ className: "h-8 w-8",
344
+ onClick: (i) => {
345
+ i.stopPropagation(), ae(s);
346
+ },
347
+ children: /* @__PURE__ */ e(we, { className: "h-4 w-4" })
348
+ }
349
+ )
350
+ ] }),
351
+ h.some((i) => i.id === s.id) && /* @__PURE__ */ e("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ e(
352
+ "input",
353
+ {
354
+ type: "checkbox",
355
+ checked: h.some(
356
+ (i) => i.id === s.id
357
+ ),
358
+ readOnly: !0,
359
+ className: "rounded-full"
360
+ }
361
+ ) })
362
+ ] }),
363
+ /* @__PURE__ */ a("div", { className: "p-2", children: [
364
+ /* @__PURE__ */ e(
365
+ "div",
366
+ {
367
+ className: "text-sm font-medium truncate",
368
+ title: s.name,
369
+ children: s.name
370
+ }
371
+ ),
372
+ /* @__PURE__ */ a("div", { className: "text-xs text-muted-foreground flex items-center justify-between", children: [
373
+ /* @__PURE__ */ e("span", { children: ke((s == null ? void 0 : s.size) || 0) }),
374
+ /* @__PURE__ */ e("span", { children: qe(s.createdAt) })
375
+ ] })
376
+ ] })
377
+ ] })
378
+ },
379
+ s.id
380
+ )),
381
+ m && x.length > 0 && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ e(_, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }),
382
+ !m && A && /* @__PURE__ */ e("div", { className: "col-span-full flex justify-center py-4", children: /* @__PURE__ */ a(
383
+ v,
384
+ {
385
+ variant: "outline",
386
+ onClick: () => E(),
387
+ disabled: y,
388
+ className: "flex items-center gap-2",
389
+ children: [
390
+ y ? /* @__PURE__ */ e(_, { className: "h-4 w-4 animate-spin" }) : null,
391
+ "Load More"
392
+ ]
393
+ }
394
+ ) })
395
+ ]
396
+ }
397
+ )
398
+ ] }),
399
+ /* @__PURE__ */ e(V, { value: "upload", className: "flex-1 ", children: /* @__PURE__ */ a(
400
+ "div",
401
+ {
402
+ ...J(),
403
+ className: O(
404
+ "border-2 border-dashed rounded-lg h-[380px] flex flex-col items-center justify-center text-center cursor-pointer hover:bg-gray-50",
405
+ ee ? "border-primary bg-primary/5" : "border-muted-foreground/20"
406
+ ),
407
+ children: [
408
+ /* @__PURE__ */ e("input", { ...$() }),
409
+ X || R ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center", children: [
410
+ /* @__PURE__ */ e(_, { className: "h-12 w-12 text-primary animate-spin mb-4" }),
411
+ /* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Uploading files..." }),
412
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Please wait while your files are being processed." })
413
+ ] }) : /* @__PURE__ */ a(j, { children: [
414
+ /* @__PURE__ */ e(Ae, { className: "h-12 w-12 text-muted-foreground mb-4" }),
415
+ /* @__PURE__ */ e("h3", { className: "text-lg font-medium mb-1", children: "Drag & drop files here" }),
416
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "or click to browse your files" }),
417
+ /* @__PURE__ */ a("div", { className: "text-xs text-muted-foreground", children: [
418
+ /* @__PURE__ */ a("p", { children: [
419
+ "Accepted file types: ",
420
+ c.join(", ")
421
+ ] }),
422
+ /* @__PURE__ */ a("p", { children: [
423
+ "Maximum file size: ",
424
+ 10,
425
+ "MB"
426
+ ] })
427
+ ] })
428
+ ] })
429
+ ]
430
+ }
431
+ ) })
432
+ ]
433
+ }
434
+ )
435
+ ] }),
436
+ S && /* @__PURE__ */ e(Y, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
437
+ De,
438
+ {
439
+ asset: S,
440
+ onSave: (s) => le(S, s),
441
+ onCancel: () => {
442
+ w(null);
443
+ }
444
+ }
445
+ ) }),
446
+ u.show && /* @__PURE__ */ e(Y, { fallback: /* @__PURE__ */ e("div", { children: "Loading..." }), children: /* @__PURE__ */ e(
447
+ Ie,
448
+ {
449
+ imageUrl: u.file,
450
+ onSave: re,
451
+ onClose: () => g({ show: !1, file: "", name: "" }),
452
+ defaultSavedImageName: u.name,
453
+ isEditing: !!u.id
454
+ }
455
+ ) })
456
+ ] });
457
+ }
458
+ function ke(l) {
459
+ return l < 1024 ? l + " B" : l < 1024 * 1024 ? (l / 1024).toFixed(1) + " KB" : l < 1024 * 1024 * 1024 ? (l / (1024 * 1024)).toFixed(1) + " MB" : (l / (1024 * 1024 * 1024)).toFixed(1) + " GB";
460
+ }
461
+ function qe(l) {
462
+ const n = new Date(l);
463
+ return new Intl.DateTimeFormat("en-US", {
464
+ month: "short",
465
+ day: "numeric",
466
+ year: "numeric"
467
+ }).format(n);
468
+ }
469
+ export {
470
+ Oe as default
471
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),t=require("react"),T=require("react-filerobot-image-editor"),I=require("@chaibuilder/sdk/ui"),y=require("lodash-es"),p=require("lucide-react"),b=t.memo(({imageUrl:n,onSave:r,onClose:d,defaultSavedImageName:g,isEditing:u=!1})=>{const[h,c]=t.useState(!0),[x,C]=t.useState(!1);t.useEffect(()=>{const e=new Image;return e.src=n,e.onload=()=>C(!0),()=>{e.onload=null}},[n]);const m=t.useMemo(()=>y.debounce((e,o=!1)=>{const a=e.imageBase64;r(a,o),c(!1)},300),[r]),s=t.useCallback((e,o=!1)=>{m(e,o)},[m]),f=t.useCallback(()=>{c(!1),d()},[d]),l=t.useMemo(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],defaultTabId:"Adjust",defaultToolId:"Crop"}),[]),v=t.useMemo(()=>({colors:{primary:"#000000",secondary:"#000000",tertiary:"#000000"}}),[]),S=t.useMemo(()=>u?[{label:"Update this file",onClick:(e,o)=>o((...a)=>{s(a[0],!1)}),icon:p.Save},{label:"Save as new file",onClick:(e,o)=>o((...a)=>{s(a[0],!0)}),icon:p.Copy}]:[],[u,s]);return i.jsx(I.Dialog,{open:!0,onOpenChange:e=>!e&&f(),children:i.jsx(I.DialogContent,{id:"chai-image-editor-container",className:"flex-1 overflow-hidden p-4 min-w-[1280px]",children:h&&x&&i.jsx(T,{theme:v,source:n,onSave:s,onClose:f,Text:{text:"Add text here"},Rotate:{angle:90,componentType:"slider"},tabsIds:l.tabsIds,defaultTabId:l.defaultTabId,defaultToolId:l.defaultToolId,savingPixelRatio:2,previewPixelRatio:1,defaultSavedImageName:g,moreSaveOptions:S,useZoomPresetsMenu:!0})})})});b.displayName="ImageEditor";exports.default=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),I=require("@chaibuilder/sdk/ui"),T=require("lodash-es"),p=require("lucide-react"),t=require("react"),y=require("react-filerobot-image-editor"),b=t.memo(({imageUrl:n,onSave:r,onClose:d,defaultSavedImageName:g,isEditing:u=!1})=>{const[h,c]=t.useState(!0),[x,C]=t.useState(!1);t.useEffect(()=>{const e=new Image;return e.src=n,e.onload=()=>C(!0),()=>{e.onload=null}},[n]);const m=t.useMemo(()=>T.debounce((e,o=!1)=>{const a=e.imageBase64;r(a,o),c(!1)},300),[r]),s=t.useCallback((e,o=!1)=>{m(e,o)},[m]),f=t.useCallback(()=>{c(!1),d()},[d]),l=t.useMemo(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],defaultTabId:"Adjust",defaultToolId:"Crop"}),[]),v=t.useMemo(()=>({colors:{primary:"#000000",secondary:"#000000",tertiary:"#000000"}}),[]),S=t.useMemo(()=>u?[{label:"Update this file",onClick:(e,o)=>o((...a)=>{s(a[0],!1)}),icon:p.Save},{label:"Save as new file",onClick:(e,o)=>o((...a)=>{s(a[0],!0)}),icon:p.Copy}]:[],[u,s]);return i.jsx(I.Dialog,{open:!0,onOpenChange:e=>!e&&f(),children:i.jsx(I.DialogContent,{id:"chai-image-editor-container",className:"flex-1 overflow-hidden p-4 min-w-[1280px]",children:h&&x&&i.jsx(y,{theme:v,source:n,onSave:s,onClose:f,Text:{text:"Add text here"},Rotate:{angle:90,componentType:"slider"},tabsIds:l.tabsIds,defaultTabId:l.defaultTabId,defaultToolId:l.defaultToolId,savingPixelRatio:2,previewPixelRatio:1,defaultSavedImageName:g,moreSaveOptions:S,useZoomPresetsMenu:!0})})})});b.displayName="ImageEditor";exports.default=b;
@@ -1,20 +1,20 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { memo as T, useState as p, useEffect as y, useMemo as s, useCallback as I } from "react";
3
- import S from "react-filerobot-image-editor";
4
- import { Dialog as w, DialogContent as E } from "@chaibuilder/sdk/ui";
5
- import { debounce as O } from "lodash-es";
6
- import { Save as k, Copy as A } from "lucide-react";
7
- const R = T(
2
+ import { Dialog as T, DialogContent as y } from "@chaibuilder/sdk/ui";
3
+ import { debounce as S } from "lodash-es";
4
+ import { Save as w, Copy as E } from "lucide-react";
5
+ import { memo as O, useState as p, useEffect as k, useMemo as s, useCallback as I } from "react";
6
+ import A from "react-filerobot-image-editor";
7
+ const R = O(
8
8
  ({ imageUrl: n, onSave: d, onClose: i, defaultSavedImageName: g, isEditing: m = !1 }) => {
9
9
  const [b, c] = p(!0), [h, C] = p(!1);
10
- y(() => {
10
+ k(() => {
11
11
  const e = new Image();
12
12
  return e.src = n, e.onload = () => C(!0), () => {
13
13
  e.onload = null;
14
14
  };
15
15
  }, [n]);
16
16
  const f = s(
17
- () => O((e, o = !1) => {
17
+ () => S((e, o = !1) => {
18
18
  const t = e.imageBase64;
19
19
  d(t, o), c(!1);
20
20
  }, 300),
@@ -56,25 +56,25 @@ const R = T(
56
56
  onClick: (e, o) => o((...t) => {
57
57
  a(t[0], !1);
58
58
  }),
59
- icon: k
59
+ icon: w
60
60
  },
61
61
  {
62
62
  label: "Save as new file",
63
63
  onClick: (e, o) => o((...t) => {
64
64
  a(t[0], !0);
65
65
  }),
66
- icon: A
66
+ icon: E
67
67
  }
68
68
  ] : [],
69
69
  [m, a]
70
70
  );
71
- return /* @__PURE__ */ l(w, { open: !0, onOpenChange: (e) => !e && u(), children: /* @__PURE__ */ l(
72
- E,
71
+ return /* @__PURE__ */ l(T, { open: !0, onOpenChange: (e) => !e && u(), children: /* @__PURE__ */ l(
72
+ y,
73
73
  {
74
74
  id: "chai-image-editor-container",
75
75
  className: "flex-1 overflow-hidden p-4 min-w-[1280px]",
76
76
  children: b && h && /* @__PURE__ */ l(
77
- S,
77
+ A,
78
78
  {
79
79
  theme: v,
80
80
  source: n,