@chaibuilder/pages 0.15.2 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{2AITGKQY-C2afI3G9.cjs → 2AITGKQY-D4uLyw6-.cjs} +1 -1
  2. package/dist/{2AITGKQY-CpTgZa1B.js → 2AITGKQY-DYwNjBFe.js} +2 -2
  3. package/dist/{NCMVHL6D-BdBKMEGN.cjs → NCMVHL6D-C-L7-X3f.cjs} +1 -1
  4. package/dist/{NCMVHL6D-fVqsZOVq.js → NCMVHL6D-DVB60g_2.js} +2 -2
  5. package/dist/{ZDWCUMSJ-DHGlUoWR.cjs → ZDWCUMSJ-BORULBXb.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-CTb4F48A.js → ZDWCUMSJ-Dp6ML_tn.js} +1 -1
  7. package/dist/{add-new-language-page-CY2hL7A-.cjs → add-new-language-page-D4VPifNs.cjs} +1 -1
  8. package/dist/{add-new-language-page-DY0789ha.js → add-new-language-page-DENCjC_f.js} +2 -2
  9. package/dist/{add-new-page-DnVeU4g6.cjs → add-new-page-BuK6We-q.cjs} +1 -1
  10. package/dist/{add-new-page-C6fGkJF9.js → add-new-page-CD-9ppdS.js} +1 -1
  11. package/dist/{delete-page-DZi2DCAb.cjs → delete-page-B-TP6nJ7.cjs} +1 -1
  12. package/dist/{delete-page-hLDHKzbl.js → delete-page-CatRlDfx.js} +1 -1
  13. package/dist/digital-asset-manager-DL2nAqUC.cjs +1 -0
  14. package/dist/digital-asset-manager-KakxBkBC.js +917 -0
  15. package/dist/{duplicate-page-CTH0REkv.cjs → duplicate-page-D4Oiy71Q.cjs} +1 -1
  16. package/dist/{duplicate-page-sdO4hRfo.js → duplicate-page-DEmh0df0.js} +2 -2
  17. package/dist/{dynamic-page-selector-EfxbLRp-.js → dynamic-page-selector-8g1-84iW.js} +1 -1
  18. package/dist/{dynamic-page-selector-Ki3lEtRJ.cjs → dynamic-page-selector-Cz6zWaKo.cjs} +1 -1
  19. package/dist/image-editor-D9MPdtxC.js +107 -0
  20. package/dist/image-editor-Da6lrqkL.cjs +1 -0
  21. package/dist/index-Blg1T7nL.cjs +5 -0
  22. package/dist/{index-CdUDr4JM.js → index-zaGKeGBW.js} +850 -765
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +6 -6
  25. package/dist/{json-diff-viewer-BQSgrzoZ.js → json-diff-viewer-BF0qFBif.js} +1 -1
  26. package/dist/{json-diff-viewer-DthVeQzc.cjs → json-diff-viewer-c3ft4c4A.cjs} +1 -1
  27. package/dist/{lang-panel-DJGvZmRK.js → lang-panel-D1FKTNui.js} +2 -2
  28. package/dist/{lang-panel-DTDqVZGv.cjs → lang-panel-ExS97Zgk.cjs} +1 -1
  29. package/dist/{mark-as-template-BNbkAkrD.cjs → mark-as-template-CcnkROAU.cjs} +1 -1
  30. package/dist/{mark-as-template-C3669ENB.js → mark-as-template-v-I05xcZ.js} +1 -1
  31. package/dist/{no-language-page-content-DMdFjwWT.js → no-language-page-content-Bm5CcsUo.js} +1 -1
  32. package/dist/{no-language-page-content-DY-A9YbI.cjs → no-language-page-content-Ddz2hnYs.cjs} +1 -1
  33. package/dist/{page-creator-B_X6PI1J.js → page-creator-Crc5BzeB.js} +2 -2
  34. package/dist/{page-creator-BcoyQ5mT.cjs → page-creator-CsZpQ7Gy.cjs} +1 -1
  35. package/dist/{page-lock-request-Cl0GyiJp.cjs → page-lock-request-Dx6OrOwM.cjs} +1 -1
  36. package/dist/{page-lock-request-DJVlDGsX.js → page-lock-request-WKfG7Sd3.js} +1 -1
  37. package/dist/{page-locked-by-dialog-CZvpeWVu.cjs → page-locked-by-dialog-BvdAXZPw.cjs} +1 -1
  38. package/dist/{page-locked-by-dialog-DY_jVajL.js → page-locked-by-dialog-jy3lYV3l.js} +1 -1
  39. package/dist/{page-manager-new-BKr1R3Yu.js → page-manager-new-CNHlSwfe.js} +66 -66
  40. package/dist/page-manager-new-CUlpwqpH.cjs +1 -0
  41. package/dist/{page-manager-search-and-filter-DLrJ5bRM.js → page-manager-search-and-filter-CuAn82Db.js} +1 -1
  42. package/dist/{page-manager-search-and-filter-CibEmd6Z.cjs → page-manager-search-and-filter-eFsGtm5W.cjs} +1 -1
  43. package/dist/{page-revisions-content-C4hAdUVX.js → page-revisions-content-PRgwV04S.js} +2 -2
  44. package/dist/{page-revisions-content-Bv1b1HsS.cjs → page-revisions-content-dSFvGFEO.cjs} +1 -1
  45. package/dist/{publish-pages-content-B-8X8FzF.js → publish-pages-content-C24iBibw.js} +2 -2
  46. package/dist/{publish-pages-content-Krawy2bg.cjs → publish-pages-content-akIgltlm.cjs} +1 -1
  47. package/dist/{save-to-lib-CiX1h4Po.cjs → save-to-lib-C3H1ZPb-.cjs} +1 -1
  48. package/dist/{save-to-lib-BV_uNHn3.js → save-to-lib-DSPvtFSd.js} +1 -1
  49. package/dist/{seo-panel-CpjeH5Yl.cjs → seo-panel-Ce6aTIyt.cjs} +1 -1
  50. package/dist/{seo-panel-BHqhAOiz.js → seo-panel-rZ8s88c0.js} +17 -17
  51. package/dist/server.cjs +1 -1
  52. package/dist/server.js +96 -96
  53. package/dist/shared-json-ld-DMYOwp6B.js +565 -0
  54. package/dist/shared-json-ld-hCiviuBf.cjs +1 -0
  55. package/dist/{slug-input-ssMiXYTG.cjs → slug-input-BN8eQgxP.cjs} +1 -1
  56. package/dist/{slug-input-Dz9A1ksl.js → slug-input-Dhzaobv6.js} +1 -1
  57. package/dist/{theme-panel-footer-Rmw520a9.cjs → theme-panel-footer-0GrdOHO_.cjs} +1 -1
  58. package/dist/{theme-panel-footer-DZSU9bNX.js → theme-panel-footer-BzEy5bsg.js} +1 -1
  59. package/dist/{unmark-as-template-D_Td5Aeb.cjs → unmark-as-template-DXEs6foh.cjs} +1 -1
  60. package/dist/{unmark-as-template-D8o31xMH.js → unmark-as-template-Dsiyocm9.js} +1 -1
  61. package/dist/{unpublish-page-Bca-dVic.cjs → unpublish-page-c1mqQEa_.cjs} +1 -1
  62. package/dist/{unpublish-page-D9XisIu8.js → unpublish-page-yGyz2jiw.js} +1 -1
  63. package/dist/{web-preview-Dn1aCs5v.js → web-preview-BEyjKFDL.js} +1 -1
  64. package/dist/{web-preview-BddtAY2w.cjs → web-preview-TTKtpSUi.cjs} +1 -1
  65. package/package.json +2 -3
  66. package/dist/digital-asset-manager-Cj5r9niq.cjs +0 -1
  67. package/dist/digital-asset-manager-CpoNKOFK.js +0 -1001
  68. package/dist/image-editor-CRJ0cNde.cjs +0 -1
  69. package/dist/image-editor-DR1FYokM.js +0 -111
  70. package/dist/index-vjYir4bk.cjs +0 -5
  71. package/dist/page-manager-new-v2nHss3Q.cjs +0 -1
  72. package/dist/shared-json-ld-BfkvfAZY.js +0 -650
  73. package/dist/shared-json-ld-C-fV8erH.cjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { o as c } from "./index-CdUDr4JM.js";
2
+ import { o as c } from "./index-zaGKeGBW.js";
3
3
  import { Dialog as m, DialogContent as p, DialogHeader as d, DialogTitle as u, DialogDescription as h, DialogFooter as g, Button as r } from "@chaibuilder/sdk/ui";
4
4
  import { useState as f } from "react";
5
5
  const T = ({ page: i, onClose: a }) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("./index-vjYir4bk.cjs"),e=require("@chaibuilder/sdk/ui"),o=({page:i,onClose:t})=>{const{mutate:r,isPending:l}=s.useUnpublishPage(),c=async()=>{r(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:"Confirm action"}),n.jsxs(e.DialogDescription,{children:[s.CONTENT.UNPUBLISH_MSG," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:"Cancel"}),n.jsx(e.Button,{variant:"destructive",disabled:l,onClick:c,children:l?s.CONTENT.UPDATING:s.CONTENT.UNPUBLISH})]})]})})};exports.default=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("./index-Blg1T7nL.cjs"),e=require("@chaibuilder/sdk/ui"),o=({page:i,onClose:t})=>{const{mutate:r,isPending:l}=s.useUnpublishPage(),c=async()=>{r(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:"Confirm action"}),n.jsxs(e.DialogDescription,{children:[s.CONTENT.UNPUBLISH_MSG," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:"Cancel"}),n.jsx(e.Button,{variant:"destructive",disabled:l,onClick:c,children:l?s.CONTENT.UPDATING:s.CONTENT.UNPUBLISH})]})]})})};exports.default=o;
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
- import { l as d, C as r } from "./index-CdUDr4JM.js";
2
+ import { l as d, C as r } from "./index-zaGKeGBW.js";
3
3
  import { Dialog as h, DialogContent as a, DialogHeader as u, DialogTitle as m, DialogDescription as U, DialogFooter as D, Button as e } from "@chaibuilder/sdk/ui";
4
4
  const f = ({ page: i, onClose: o }) => {
5
5
  const { mutate: s, isPending: t } = d(), c = async () => {
@@ -4,7 +4,7 @@ import { Button as s } from "@chaibuilder/sdk/ui";
4
4
  import { useAtom as h } from "jotai";
5
5
  import { map as p } from "lodash-es";
6
6
  import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
7
- import { p as v, T as _ } from "./index-CdUDr4JM.js";
7
+ import { p as v, T as _ } from "./index-zaGKeGBW.js";
8
8
  const b = [
9
9
  {
10
10
  title: "mobile_xs_title",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-vjYir4bk.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:l,setIframeWidth:i})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>i(s),variant:s===t?"default":"ghost",children:l}),p=()=>{const[t,s]=o.useState(1200),l=r=>s(r),[i,d]=h.useAtom(c.previewUrlAtom);if(!i)return null;const u=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,r=>o.createElement(w,{...r,setIframeWidth:l,key:r.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:u,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:i})]})};exports.default=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-Blg1T7nL.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:l,setIframeWidth:i})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>i(s),variant:s===t?"default":"ghost",children:l}),p=()=>{const[t,s]=o.useState(1200),l=r=>s(r),[i,d]=h.useAtom(c.previewUrlAtom);if(!i)return null;const u=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,r=>o.createElement(w,{...r,setIframeWidth:l,key:r.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:u,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:i})]})};exports.default=p;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Suraj Air",
4
4
  "license": "Private",
5
5
  "homepage": "https://chaibuilder.com",
6
- "version": "0.15.2",
6
+ "version": "0.15.5",
7
7
  "type": "module",
8
8
  "files": [
9
9
  "dist"
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@chaibuilder/runtime": "2.2.0",
68
- "@chaibuilder/sdk": "3.0.8",
68
+ "@chaibuilder/sdk": "3.0.9",
69
69
  "@types/react": "*",
70
70
  "@types/react-dom": "*",
71
71
  "jotai": "2.14.0",
@@ -137,7 +137,6 @@
137
137
  "fs": "0.0.1-security",
138
138
  "global-jsdom": "^26.0.0",
139
139
  "globals": "^15.14.0",
140
- "jotai-devtools": "^0.12.0",
141
140
  "jsdom": "^26.0.0",
142
141
  "msw": "^2.7.0",
143
142
  "nodemon": "^3.1.9",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),J=require("@chaibuilder/sdk"),l=require("@chaibuilder/sdk/ui"),D=require("lodash-es"),p=require("lucide-react"),u=require("react"),fe=require("react-dropzone"),A=require("sonner"),Y=require("./image-compression-DZ9WMmyn.cjs"),k=require("@tanstack/react-query"),v=require("./index-vjYir4bk.cjs"),pe=u.createContext(null),Q={didCatch:!1,error:null};class ge extends u.Component{constructor(r){super(r),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Q}static getDerivedStateFromError(r){return{didCatch:!0,error:r}}resetErrorBoundary(){const{error:r}=this.state;if(r!==null){for(var o,t,d=arguments.length,i=new Array(d),m=0;m<d;m++)i[m]=arguments[m];(o=(t=this.props).onReset)===null||o===void 0||o.call(t,{args:i,reason:"imperative-api"}),this.setState(Q)}}componentDidCatch(r,o){var t,d;(t=(d=this.props).onError)===null||t===void 0||t.call(d,r,o)}componentDidUpdate(r,o){const{didCatch:t}=this.state,{resetKeys:d}=this.props;if(t&&o.error!==null&&je(r.resetKeys,d)){var i,m;(i=(m=this.props).onReset)===null||i===void 0||i.call(m,{next:d,prev:r.resetKeys,reason:"keys"}),this.setState(Q)}}render(){const{children:r,fallbackRender:o,FallbackComponent:t,fallback:d}=this.props,{didCatch:i,error:m}=this.state;let y=r;if(i){const N={error:m,resetErrorBoundary:this.resetErrorBoundary};if(typeof o=="function")y=o(N);else if(t)y=u.createElement(t,N);else if(d!==void 0)y=d;else throw m}return u.createElement(pe.Provider,{value:{didCatch:i,error:m,resetErrorBoundary:this.resetErrorBoundary}},y)}}function je(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return a.length!==r.length||a.some((o,t)=>!Object.is(o,r[t]))}const ve=()=>{const a=v.useAssetsApiUrl(),r=k.useQueryClient(),o=v.useFetch();return k.useMutation({mutationFn:async t=>{const d=t.map(async m=>o(a,{action:v.ACTIONS.UPLOAD_ASSET,data:m}));return await Promise.all(d)},onSuccess:t=>{var d;if(t!=null&&t.some(i=>i.error))throw new Error(((d=t==null?void 0:t.find(i=>i.error))==null?void 0:d.error)||"Failed to upload asset");{r.invalidateQueries({queryKey:[v.ACTIONS.GET_ASSETS]});const i=t==null?void 0:t.length;A.toast.success(`${i===1?"Asset":i+" Assets"} uploaded successfully`)}},onError:()=>{A.toast.error("Failed to upload asset")}})},ye=()=>{const a=v.useAssetsApiUrl(),r=k.useQueryClient(),o=v.useFetch();return k.useMutation({mutationFn:async t=>o(a,{action:v.ACTIONS.DELETE_ASSET,data:{id:t}}),onSuccess:t=>{if(t!=null&&t.error)throw new Error(t==null?void 0:t.error);r.invalidateQueries({queryKey:[v.ACTIONS.GET_ASSETS]}),A.toast.success("Asset deleted successfully")},onError:()=>{A.toast.error("Failed to delete asset")}})},Ne=()=>{const a=v.useAssetsApiUrl(),r=k.useQueryClient(),o=v.useFetch();return k.useMutation({mutationFn:async t=>o(a,{action:v.ACTIONS.UPDATE_ASSET,data:t}),onSuccess:t=>{if(t!=null&&t.error)throw new Error(t==null?void 0:t.error);r.invalidateQueries({queryKey:[v.ACTIONS.GET_ASSETS]}),t!=null&&t.id&&r.invalidateQueries({queryKey:[v.ACTIONS.GET_ASSET,t.id]}),A.toast.success("Asset updated successfully")},onError:()=>{A.toast.error("Failed to update asset")}})};function be({currentPage:a,totalPages:r,onPageChange:o,pageRangeDisplayed:t=3,showPageInput:d=!0,className:i=""}){const[m,y]=u.useState(String(a)),N=u.useMemo(()=>{const c=Math.floor(t/2);let n=Math.max(1,a-c),h=Math.min(r,a+c);h-n+1<t&&(n===1?h=Math.min(r,n+t-1):h===r&&(n=Math.max(1,h-t+1)));const j=[];n>1&&(j.push(1),n>2&&j.push("..."));for(let b=n;b<=h;b++)j.push(b);return h<r&&(h<r-1&&j.push("..."),j.push(r)),j},[a,r,t]),g=c=>{c!==a&&c>=1&&c<=r&&(o(c),y(String(c)))},w=()=>{a>1&&g(a-1)},S=()=>{a<r&&g(a+1)},C=()=>{const c=Number(m);!isNaN(c)&&c>=1&&c<=r&&g(c)},f=c=>{c.key==="Enter"&&C()};return r<=1?null:e.jsxs("div",{className:`flex flex-wrap items-center justify-center gap-3 ${i}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l.Button,{variant:"outline",size:"sm",onClick:w,disabled:a===1,className:"px-2 py-1 text-sm hover:bg-gray-50",children:[e.jsx(p.ChevronLeft,{className:" h-4 w-4"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-2",children:N.map((c,n)=>{if(c==="...")return e.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${n}`);const h=c,j=h===a;return e.jsx(l.Button,{variant:j?"default":"outline",size:"sm",onClick:()=>g(h),className:j?"border-blue-600 bg-blue-600 px-3 py-1 text-sm text-white":"border px-3 py-1 text-sm hover:bg-gray-50 hover:text-black",children:h},h)})}),e.jsxs(l.Button,{variant:"outline",size:"sm",onClick:S,disabled:a===r,className:"px-2 py-1 text-sm hover:bg-gray-50",children:["Next",e.jsx(p.ChevronRight,{className:" h-4 w-4"})]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Go to"}),e.jsx(l.Input,{type:"number",min:1,max:r,value:m,onChange:c=>{const n=c.target.value.replace(/[^\d]/g,"");y(n)},onKeyDown:f,className:"h-8 w-16 px-2 py-1"}),e.jsx(l.Button,{variant:"outline",size:"sm",onClick:C,disabled:m===""||Number(m)<1||Number(m)>r,children:"Go"})]})]})}const we=(a={})=>{const r=v.useAssetsApiUrl(),o=v.useFetch(),{search:t,page:d=1,limit:i=30}=a;return k.useQuery({queryKey:[v.ACTIONS.GET_ASSETS,t,d,i],queryFn:async()=>{const m=await o(r,{action:v.ACTIONS.GET_ASSETS,data:{search:t,page:d,limit:i}});return m.page=d,m.limit=i,m},staleTime:1/0,retry:1})},Ce=a=>{const r=v.useAssetsApiUrl(),o=v.useFetch();return k.useQuery({queryKey:[v.ACTIONS.GET_ASSET,a],queryFn:async()=>a?await o(r,{action:v.ACTIONS.GET_ASSET,data:{id:a}}):null,staleTime:1/0,retry:1})};function Ae(a){const r=isNaN(a)?0:typeof a=="number"?a:parseInt(a);return r?r<1024?`${r.toFixed(2)} B`:r<1024*1024?`${(r/1024).toFixed(2)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`:"0 B"}function X(a){if(!a)return"N/A";const r=new Date(a);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function Z(a,r){let o=a,t=r==null?void 0:r.description;return(!t||typeof t!="string")&&(t=""),(!o||typeof o!="string")&&(o=""),o!==t}const Se=({assetId:a,onBack:r,onEdit:o,onSave:t,isSaving:d})=>{var f,c;const{data:i,isLoading:m,isError:y}=Ce(a||""),[N,g]=u.useState(""),[w,S]=u.useState(!1);u.useEffect(()=>{const n=new Image;return n.src=(i==null?void 0:i.url)||"",n.onload=()=>S(!0),()=>{n.onload=null}},[i]);const C=async(n,h)=>{try{await navigator.clipboard.writeText(n),A.toast.success(`${h} copied to clipboard`)}catch(j){A.toast.error(`Failed to copy ${h}`,{description:j==null?void 0:j.message})}};return u.useEffect(()=>{i!=null&&i.description&&g(i.description)},[i]),m||!w?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(p.Loader,{className:"h-8 w-8 animate-spin"})}):y||!(i!=null&&i.id)?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md mx-auto p-6",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(p.AlertCircle,{className:"h-12 w-12 text-gray-400"})}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No Asset Found"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:y?"There was an error loading the asset. Please try again later.":"The asset you're looking for doesn't exist or has been removed."}),e.jsxs("div",{className:"flex justify-center gap-4",children:[e.jsx(l.Button,{variant:"outline",onClick:r,children:"Back to Assets"}),y&&e.jsx(l.Button,{variant:"default",onClick:()=>window.location.reload(),children:"Try Again"})]})]})}):e.jsxs("div",{className:"flex-1 flex flex-col gap-y-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(l.Button,{variant:"outline",size:"sm",onClick:r,disabled:d,children:[e.jsx(p.ChevronLeft,{className:"h-4 w-4"}),"Back to Assets"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(l.Button,{variant:"outline",onClick:r,disabled:d,children:"Cancel"}),e.jsxs(l.Button,{variant:"outline",onClick:()=>C(i.url,"Asset URL"),disabled:d,children:[e.jsx(p.Copy,{className:"h-4 w-4 mr-2"}),"Copy URL"]}),e.jsxs(l.Button,{variant:"default",onClick:()=>o(i),disabled:d,children:[e.jsx(p.Pencil,{className:"h-4 w-4"}),"Edit Image"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 items-start gap-6 flex-1 overflow-hidden",children:[e.jsx("div",{className:"relative h-[calc(80vh-200px)] w-full flex items-start justify-center",children:e.jsx("img",{src:i.url,alt:i.name,className:"w-full h-full object-contain rounded-lg max-h-max max-w-max"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-3 border rounded-md pt-2 bg-gray-100",children:[e.jsx(l.Label,{className:"w-full text-center",children:"Details"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 text-sm border rounded-md p-2 bg-white",children:[{label:"File Name",value:i.name},{label:"Type",value:i.type,capitalize:!0},{label:"Format",value:((f=i.metadata)==null?void 0:f.format)||i.type,capitalize:!0},{label:"Size",value:Ae(i.size)},{label:"Dimensions",value:`${i.width||0} × ${i.height||0}`},{label:"Created",value:X(i.createdAt)},{label:"Updated",value:X(((c=i.metadata)==null?void 0:c.updatedAt)||(i==null?void 0:i.updatedAt)||i.createdAt)},{label:"URL",value:i.url,copyable:!0}].map(n=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Label,{className:"w-max text-left px-2 w-1/4 font-normal text-gray-700",children:n.label}),":",e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900"+(n.capitalize?" capitalize":""),children:n.value}),n.copyable&&e.jsx(l.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>C(n.value,n.label),children:e.jsx(p.Link,{className:"h-3 w-3"})})]})]},n.label))})]}),i.usedOn&&i.usedOn.length>0&&e.jsxs("div",{className:"grid gap-3",children:[e.jsx(l.Label,{children:"Used On"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 text-sm border rounded-md p-2",children:i.usedOn.map((n,h)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900",children:n.name}),e.jsxs("div",{className:"text-gray-500",children:["(",n.slug,")"]})]},h))})]}),e.jsxs("div",{className:"grid gap-3 border rounded-md pt-2 bg-gray-100 relative",children:[e.jsx(l.Label,{className:"w-full text-center",children:"Description"}),e.jsx(l.Textarea,{id:"description",value:N,placeholder:"Enter a description for the asset",onChange:n=>g(n.target.value),rows:3,disabled:d,className:"hover:border-black/40 bg-white"}),e.jsx("div",{className:"flex justify-end items-start absolute top-1.5 right-2",children:e.jsx("button",{type:"button",onClick:()=>t(N),disabled:d||!Z(N,i),className:`py-0 bg-blue-500 text-white px-3 py-0.5 rounded-md text-sm ${d||!Z(N,i)?"opacity-50 cursor-not-allowed":""}`,children:d?e.jsxs(e.Fragment,{children:[e.jsx(p.Loader,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save"})})]})]})]})]})},Te=u.lazy(()=>Promise.resolve().then(()=>require("./image-editor-CRJ0cNde.cjs"))),Ee=25*1024*1024,Ie=({isUpdatingAsset:a,allowedTypes:r,uploadAssets:o,isUploadingAsset:t,onUploaded:d})=>{const[i,m]=u.useState(()=>{const f=localStorage.getItem("chai_optimize_images");return f!==null?f==="true":!0});u.useEffect(()=>{localStorage.setItem("chai_optimize_images",i.toString())},[i]);const y=a||t,N=u.useCallback(async f=>{try{const c=f;if(!c.every(b=>b.type.startsWith("image/")))return A.toast.error("Invalid file type. Please upload a valid file."),Promise.reject(new Error("Invalid file type"));const n=c.map(async b=>{let F=b;return b.type.startsWith("image/")&&(F=await Y.compressImageIfNeeded(b)),new Promise((P,B)=>{const U=new FileReader;U.readAsDataURL(F),U.onload=async()=>{P({file:U.result,folderId:void 0,name:b.name,optimize:i})},U.onerror=()=>B(null)})}),h=await Promise.all(n),j=await o(h);return(j==null?void 0:j.length)===1&&d(j[0]),j}catch(c){return Promise.reject(c)}},[o,i,d]),g=f=>{const c=[];let n=0;return f.forEach(h=>{h.size>Ee?n++:c.push(h)}),n>0&&A.toast.error(`${n===1&&f.length===1?"File":n+(n===1?" file":" files")} exceed the maximum size limit of 10MB.`),D.isEmpty(c)?[]:N(c)},{getRootProps:w,getInputProps:S,isDragActive:C}=fe.useDropzone({onDrop:g,accept:{"image/*":r.includes("image")?[]:[]},disabled:a||t,multiple:!0});return e.jsx("div",{className:`flex h-[60px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed border-slate-300 p-0 py-2 hover:border-black/50 ${y?"pointer-events-none bg-gray-100 opacity-90":"bg-gray-100 hover:border-black/50 hover:bg-gray-100"}`,children:e.jsxs("div",{...w(),className:J.mergeClasses("flex h-max w-full cursor-pointer flex-col justify-center rounded-lg text-center",y?"items-start":"items-center",C?"border-primary bg-primary/5":"border-muted-foreground/20"),children:[e.jsx("input",{...S()}),y?e.jsx("div",{className:"flex flex-col items-center px-6",children:e.jsxs("div",{className:"flex items-center justify-center gap-2 leading-tight",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full bg-indigo-100 p-2",children:e.jsx(p.Loader,{className:"h-4 w-4 animate-spin text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-medium",children:a?"Updating file...":"Uploading file..."}),e.jsxs("div",{className:"text-xs font-light text-muted-foreground",children:["Please wait while we ",a?"update":"upload"," your file..."]})]})]})}):e.jsxs("div",{className:"flex w-full items-center justify-between px-6",children:[e.jsx("div",{className:"flex flex-col items-center",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 leading-tight",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full border border-indigo-500 bg-indigo-100 p-2",children:e.jsx(p.Upload,{className:"h-4 w-4 text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"font-medium",children:["Drop your file here or"," ",e.jsx("span",{className:"cursor-pointer text-indigo-500 hover:underline",children:"browse"})]}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:e.jsxs("span",{className:"",children:["Accepted file types: ",e.jsx("span",{className:"capitalize text-indigo-400",children:r.join(", ")})]})})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs",children:["Optimization:"," ",e.jsx("span",{className:i?"text-indigo-600":"text-gray-400",children:i?"On":"Off"})]}),e.jsx(l.Switch,{checked:i,onCheckedChange:f=>{m(f)},onClick:f=>{f.stopPropagation()},className:"data-[state=checked]:bg-indigo-500"})]}),e.jsx(l.TooltipProvider,{children:e.jsxs(l.Tooltip,{children:[e.jsx(l.TooltipTrigger,{asChild:!0,children:e.jsx("span",{className:`flex cursor-help items-center text-amber-500 ${i?"invisible":""}`,children:e.jsx(p.AlertTriangle,{className:"mr-1 h-4 w-4"})})}),e.jsx(l.TooltipContent,{side:"top",children:e.jsxs("p",{className:"text-xs text-white",children:["Warning: Unoptimized images may affect ",e.jsx("br",{})," performance and page load times"]})})]})})]})]})]})})};function ke({close:a,onSelect:r,mode:o="image",assetId:t}){const m=u.useMemo(()=>[o],[o]),[y,N]=u.useState(null),[g,w]=u.useState(null),[S,C]=u.useState(null),[f,c]=u.useState({show:!1,file:""}),[n,h]=u.useState(!1),[j,b]=u.useState(t?"details":"grid"),[F,P]=u.useState(""),[B,U]=u.useState(""),[O,$]=u.useState(1),[G]=u.useState(30),[T,K]=u.useState([]);u.useEffect(()=>{t&&(N(t),b("details"))},[t]),u.useEffect(()=>{const s=setTimeout(()=>{P(B),$(1)},300);return()=>clearTimeout(s)},[B]);const{data:L,isLoading:M,refetch:ee}=we({search:F.toLowerCase().trim(),page:O,limit:G}),z=(L==null?void 0:L.assets)||[],te=(L==null?void 0:L.total)||0,E=Math.ceil(te/G);u.useEffect(()=>{M||E<=0||$(s=>s>E?E:s<1?1:s)},[M,E]);const se=(z==null?void 0:z.length)>0,{mutate:ie}=ye(),{mutateAsync:R,isPending:re}=ve(),{mutateAsync:_,isPending:le}=Ne(),W=u.useCallback(s=>{const x=Math.min(Math.max(1,s),Math.max(1,E));x!==O&&$(x)},[E,O]),ae=s=>{U(s.target.value)},ne=u.useCallback(s=>{K(x=>D.find(x,{id:s.id})?[]:[s])},[!1]),oe=u.useCallback(()=>{K([])},[]),V=s=>{(s==null?void 0:s.length)!==0&&(r(D.pick(D.first(s||T),["id","url","width","height","description"])),a())},ce=async s=>{w(s)},de=async()=>{g&&(C(g==null?void 0:g.id),await ie(g.id,{onSuccess:()=>{C(null),w(null)},onError:()=>{C(null)}}),w(null))},ue=s=>{N(s.id),b("details")},me=async(s,x)=>{try{const q=localStorage.getItem("chai_optimize_images")!=="false";if(x){const I=await R([{file:s,folderId:void 0,name:f.name||"",optimize:q}]);if((I==null?void 0:I.length)>0){const H=I[0];r({...D.pick(H,["id","width","height","description"]),url:H.url})}}else{const I=await _({id:f.id||"",file:s});I&&r({...D.pick(I,["id","width","height","description"]),url:I.url})}c({show:!1,file:""}),a()}catch(q){console.error("Error saving edited image:",q)}},he=u.useCallback(s=>{K([s])},[]),xe=u.useCallback(s=>{W(s)},[W]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4",children:[e.jsx("h1",{className:"text-lg font-medium",children:"Digital Asset Manager"}),j==="grid"?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{maxFileSize:10,allowedTypes:m,uploadAssets:R,isUpdatingAsset:le,isUploadingAsset:re,onUploaded:he}),e.jsxs("div",{className:"relative flex flex-1 flex-col gap-y-3 overflow-hidden rounded-lg border p-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"relative w-1/2",children:[e.jsx(p.Search,{strokeWidth:3,className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${B.length>0?"text-indigo-800":""}`}),e.jsx(l.Input,{placeholder:"Search assets...",onChange:ae,value:B,className:"pl-8"})]}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[T.length>0?e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&e.jsx(e.Fragment,{children:e.jsx(l.Button,{variant:"outline",size:"sm",onClick:()=>oe(),title:"Clear selection",children:"Clear"})}),e.jsx(l.Button,{size:"sm",onClick:()=>V(T),disabled:T.length===0,children:"Select Asset"})]})}):null,e.jsx(l.Button,{variant:"ghost",size:"icon",onClick:()=>ee(),children:e.jsx(p.RefreshCwIcon,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto pb-[66px]",children:M?e.jsxs("div",{className:"columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5",children:[e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"})]}):!M&&!se?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center rounded-lg border",children:[e.jsx("div",{className:"text-muted-foreground",children:e.jsx(p.Archive,{className:"h-9 w-9 text-indigo-500"})}),e.jsx("div",{className:"text-lg text-muted-foreground",children:"No assets found"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:F.length>0?"No assets found for your search: "+F:"Start uploading assets to get started"}),e.jsx("br",{})]}):e.jsx("div",{className:"flex flex-wrap gap-3 p-1",children:z==null?void 0:z.map(s=>e.jsxs("div",{className:J.mergeClasses("group relative flex max-h-[180px] max-w-[180px] cursor-pointer flex-col justify-between overflow-hidden rounded-lg border-2 transition-all",T.some(x=>x.id===s.id)?"border-blue-500":"hover:border-black/90",S&&(g==null?void 0:g.id)===s.id?"pointer-events-none opacity-50":"",S===s.id?"pointer-events-none opacity-50":""),onClick:()=>ne(s),onDoubleClick:()=>V([s]),children:[e.jsxs("div",{className:"aspect-square relative overflow-hidden",children:[S===s.id?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(p.Loader,{className:"h-8 w-8 animate-spin text-white"})}):null,s.type==="image"?e.jsx("img",{src:`${s.thumbnailUrl||"/placeholder.svg"}?v=${(s==null?void 0:s.updatedAt)||s.createdAt}`,alt:s.name,className:`h-full min-h-[80px] w-full object-contain ${T.some(x=>x.id===s.id)?"":"group-hover:blur group-hover:contrast-50"}`}):e.jsxs("div",{className:"flex h-full items-center justify-center",children:[e.jsx(p.Film,{className:"h-12 w-12 text-muted-foreground"}),s.thumbnailUrl&&e.jsx("img",{src:`${s.thumbnailUrl||"/placeholder.svg"}?v=${(s==null?void 0:s.updatedAt)||s.createdAt}`,alt:s.name,className:"absolute inset-0 h-full w-full object-cover"})]})]}),e.jsxs("div",{className:"flex items-end justify-between border-t-[1px] border-black/10 bg-white px-2 py-1",children:[e.jsx("div",{className:"truncate text-xs leading-tight",title:s.name,children:s.name}),e.jsx("div",{className:"flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground",children:e.jsx("span",{children:Y.formatFileSize((s==null?void 0:s.size)||0)})})]}),!T.some(x=>x.id===s.id)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:e.jsxs("div",{className:"grid grid-cols-4 gap-2 p-2",children:[e.jsx(l.TooltipProvider,{children:e.jsxs(l.Tooltip,{children:[e.jsx(l.TooltipTrigger,{asChild:!0,children:e.jsx(l.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:x=>{x.stopPropagation(),ue(s)},children:e.jsx(p.ImageIcon,{className:"h-4 w-4"})})}),e.jsx(l.TooltipContent,{children:e.jsx("p",{children:"View Details"})})]})}),e.jsx(l.TooltipProvider,{children:e.jsxs(l.Tooltip,{children:[e.jsx(l.TooltipTrigger,{asChild:!0,children:e.jsx(l.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:x=>{x.stopPropagation(),navigator.clipboard.writeText(s.url),A.toast.success("Asset URL copied to clipboard")},children:e.jsx(p.Copy,{className:"h-4 w-4"})})}),e.jsx(l.TooltipContent,{children:e.jsx("p",{children:"Copy URL"})})]})}),e.jsx(l.TooltipProvider,{children:e.jsxs(l.Tooltip,{children:[e.jsx(l.TooltipTrigger,{asChild:!0,children:e.jsx(l.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:x=>{x.stopPropagation(),c({id:s.id,show:!0,file:s.url,name:s.name})},children:e.jsx(p.Edit,{className:"h-4 w-4"})})}),e.jsx(l.TooltipContent,{children:e.jsx("p",{children:"Edit Image"})})]})}),e.jsx(l.TooltipProvider,{children:e.jsxs(l.Tooltip,{children:[e.jsx(l.TooltipTrigger,{asChild:!0,children:e.jsx(l.Button,{variant:"destructive",size:"icon",className:"h-8 w-8 rounded-full",onClick:x=>{x.stopPropagation(),ce(s)},children:e.jsx(p.Trash2,{className:"h-4 w-4"})})}),e.jsx(l.TooltipContent,{children:e.jsx("p",{children:"Delete Asset"})})]})})]})}),T.some(x=>x.id===s.id)&&e.jsx("div",{className:"absolute right-1 top-1 h-max rounded-full border border-white bg-blue-500 p-1",children:e.jsx(p.Check,{className:"h-3 w-3 text-white",strokeWidth:5})})]},s.id))})}),E>1&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t bg-white p-4",children:e.jsx(ge,{fallback:e.jsx("div",{className:"text-red-500",children:"Error loading pagination"}),children:e.jsx(be,{currentPage:O,totalPages:E,onPageChange:xe,pageRangeDisplayed:3,showPageInput:!0})})})]})]}):e.jsx(Se,{assetId:y||t||"",onBack:()=>{b("grid"),N(null)},onEdit:s=>{c({id:s.id,show:!0,file:s.url,name:s.name})},onSave:async s=>{if(y){h(!0);try{const x=z.find(q=>q.id===y);x&&await _(D.merge(x,{description:s}))}finally{h(!1)}}},isSaving:n})]}),f.show&&e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(p.Loader,{className:"h-8 w-8 animate-spin"})}),children:e.jsx(Te,{imageUrl:f.file,onSave:me,onClose:()=>c({show:!1,file:""}),defaultSavedImageName:f.name,isEditing:!!f.id})}),g&&e.jsx(l.Dialog,{open:!!g,onOpenChange:()=>w(null),children:e.jsxs(l.DialogContent,{children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{children:"Delete Asset"}),e.jsxs(l.DialogDescription,{children:['Are you sure you want to delete "',g.name,'"? This action cannot be undone.']})]}),e.jsxs(l.DialogFooter,{className:"gap-2 sm:gap-0",children:[e.jsx(l.Button,{variant:"outline",onClick:()=>w(null),children:"Cancel"}),e.jsx(l.Button,{variant:"destructive",onClick:de,children:"Delete"})]})]})})]})}exports.default=ke;