@chaibuilder/sdk 4.0.0-beta.3 → 4.0.0-beta.6

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 (186) hide show
  1. package/dist/{2SSKDMRQ-BnsZi3K3.cjs → 2SSKDMRQ-BIryEtW-.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-CnSDkQcy.js → 2SSKDMRQ-trME0kvt.js} +2 -2
  3. package/dist/{AP7HFJJL-B31839PG.cjs → AP7HFJJL-5ZR38Hyh.cjs} +1 -1
  4. package/dist/{AP7HFJJL-CymCmW14.js → AP7HFJJL-CAGB9iMp.js} +1 -1
  5. package/dist/IconPicker-CQ-BgNNU.cjs +1 -0
  6. package/dist/{IconPicker-B1rWC-Ex.js → IconPicker-Mu75ni5T.js} +8 -7
  7. package/dist/{WDYDFRGG-BUVnbAci.js → WDYDFRGG-Cd4hRWj-.js} +2 -2
  8. package/dist/{WDYDFRGG-BxhOCHc3.cjs → WDYDFRGG-n8sBZVFG.cjs} +1 -1
  9. package/dist/{actions-registery-YnFmU21O.cjs → actions-registery-JdxhXhT6.cjs} +1 -1
  10. package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-y_ENc8zj.js} +2 -2
  11. package/dist/actions.cjs +1 -1
  12. package/dist/actions.js +2 -2
  13. package/dist/active-in-another-tab-CZLV-uAW.cjs +1 -0
  14. package/dist/active-in-another-tab-Cb6tnX9u.js +35 -0
  15. package/dist/{add-new-language-page-WmlCnytQ.js → add-new-language-page-BKcBaqZu.js} +54 -53
  16. package/dist/add-new-language-page-C3UzNV7W.cjs +1 -0
  17. package/dist/{add-new-page-soZ8GAkN.cjs → add-new-page-mULv9r3z.cjs} +1 -1
  18. package/dist/{add-new-page-VW2wAYZp.js → add-new-page-pH3PwqJe.js} +2 -2
  19. package/dist/ai-panel-content-BPgRdgye.cjs +1 -0
  20. package/dist/{ai-panel-content-D_o7Q_A-.js → ai-panel-content-CNxN84pv.js} +12 -11
  21. package/dist/{ai-panel-default-lang-DnElspF0.js → ai-panel-default-lang-CYcHjk8U.js} +40 -40
  22. package/dist/{ai-panel-default-lang-COYaxNwn.cjs → ai-panel-default-lang-DhTPtPgD.cjs} +2 -2
  23. package/dist/{ai-panel-other-lang-CkynNlAU.cjs → ai-panel-other-lang-CGNU3-FI.cjs} +1 -1
  24. package/dist/{ai-panel-other-lang-Dp0E9_Hx.js → ai-panel-other-lang-D8Ofvj8F.js} +8 -8
  25. package/dist/ai-prompt-input-CUutJjlf.cjs +1 -0
  26. package/dist/{ai-prompt-input-Bhc0ds7X.js → ai-prompt-input-Ceuy5bs3.js} +68 -67
  27. package/dist/{ai-translation-prompt-CZ55HQmo.js → ai-translation-prompt-BiepZRcN.js} +2 -2
  28. package/dist/ai-translation-prompt-CoCPLEed.cjs +1 -0
  29. package/dist/{apply-binding-6iwlED02.js → apply-binding-BvWfJCSZ.js} +204 -196
  30. package/dist/apply-binding-IsUf6UWJ.cjs +1 -0
  31. package/dist/{code-display-DhD_RBcg.js → code-display-Ck81Id9K.js} +1 -1
  32. package/dist/code-display-DloSPyPr.cjs +1 -0
  33. package/dist/code-editor-C1ewJzDJ.cjs +1 -0
  34. package/dist/{code-editor-DRIAnNbb.js → code-editor-Z14ByBIv.js} +11 -10
  35. package/dist/{continue-editing-in-this-client-CS2aQ7yY.js → continue-editing-in-this-client-Byi6ER3L.js} +10 -9
  36. package/dist/continue-editing-in-this-client-k9Ab5E63.cjs +1 -0
  37. package/dist/core-Dr7QYemB.js +56 -0
  38. package/dist/core-Y0lXLwkq.cjs +1 -0
  39. package/dist/core.cjs +1 -1
  40. package/dist/core.d.ts +3 -3
  41. package/dist/core.js +32 -31
  42. package/dist/css-import-modal--bSJR-_y.cjs +13 -0
  43. package/dist/{css-import-modal-Byg6wV0O.js → css-import-modal-De7Kvg5C.js} +4 -3
  44. package/dist/{delete-design-token-BRZZiWtQ.js → delete-design-token-B97CnFDU.js} +1 -1
  45. package/dist/{delete-design-token-DkVs1oBf.cjs → delete-design-token-C6s-ESB_.cjs} +1 -1
  46. package/dist/delete-page-Djn97HiP.cjs +1 -0
  47. package/dist/{delete-page-BzyX9TN-.js → delete-page-Dnf97ZHP.js} +11 -10
  48. package/dist/{design-token-usage-xQs6SlaJ.js → design-token-usage-B-SykAjD.js} +14 -13
  49. package/dist/design-token-usage-OTd93kS8.cjs +1 -0
  50. package/dist/digital-asset-manager-DHYRXaaq.cjs +1 -0
  51. package/dist/{digital-asset-manager-DbtwzxRz.js → digital-asset-manager-b8gDuLnI.js} +6 -5
  52. package/dist/{duplicate-page-BR7Dlo9d.js → duplicate-page-Bdtpl7_R.js} +19 -18
  53. package/dist/duplicate-page-C4Ovp8Ff.cjs +1 -0
  54. package/dist/dynamic-page-selector-B8DdnfrF.cjs +1 -0
  55. package/dist/{dynamic-page-selector-Cb5r_W8s.js → dynamic-page-selector-BVnIM1Rq.js} +15 -14
  56. package/dist/get-chai-builder-tailwind-config-DNp8Vhme.cjs +1 -0
  57. package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +5 -5
  58. package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-BApShjRz.cjs} +1 -1
  59. package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-DDVRJQ6Z.js} +1 -1
  60. package/dist/{image-editor-G-K28aTS.cjs → image-editor-C2zOHeKv.cjs} +1 -1
  61. package/dist/{image-editor-DV8kUKhl.js → image-editor-cckqPmk5.js} +1 -1
  62. package/dist/index-B0e71wJ1.cjs +160 -0
  63. package/dist/{index-ZuacEL1j.js → index-Bn0fFN58.js} +665 -663
  64. package/dist/{index-Ct7ElCGK.js → index-CAhEmHYP.js} +3744 -3920
  65. package/dist/index-DKuwxj1x.cjs +5 -0
  66. package/dist/{json-diff-viewer-D7z4zNvv.cjs → json-diff-viewer-D9DVIBz4.cjs} +3 -3
  67. package/dist/{json-diff-viewer-krslPepD.js → json-diff-viewer-DNizzMnu.js} +5 -4
  68. package/dist/lang-panel-C1dbn163.cjs +1 -0
  69. package/dist/{lang-panel-BwIewMyw.js → lang-panel-DL_BtSRD.js} +15 -14
  70. package/dist/manage-design-tokens-CXjYkarE.cjs +1 -0
  71. package/dist/{manage-design-tokens-Caz_20VK.js → manage-design-tokens-xxMO_RYg.js} +12 -11
  72. package/dist/{mark-as-template-D295ZQtU.js → mark-as-template-Ba2bmVd9.js} +17 -16
  73. package/dist/mark-as-template-DF1KIMr0.cjs +1 -0
  74. package/dist/{nested-path-selector-content-CKYYK-C5.js → nested-path-selector-content-Br1IWhK5.js} +24 -23
  75. package/dist/nested-path-selector-content-Cuk7NB-u.cjs +1 -0
  76. package/dist/{no-language-page-content-BvqRBP6y.js → no-language-page-content-9B2Fm-on.js} +10 -9
  77. package/dist/no-language-page-content-CxTp-LIM.cjs +1 -0
  78. package/dist/{no-language-page-dialog-PjNqTUpl.js → no-language-page-dialog-CPlKMyb8.js} +2 -2
  79. package/dist/{no-language-page-dialog-BcEoqyQB.cjs → no-language-page-dialog-DynACvgV.cjs} +1 -1
  80. package/dist/{page-creator-DiOITEMw.js → page-creator-BtyJz2sx.js} +115 -114
  81. package/dist/page-creator-Cbfv9N0P.cjs +1 -0
  82. package/dist/{page-lock-Bfbs6RgL.js → page-lock-CzsxrmN5.js} +2 -2
  83. package/dist/{page-lock-BdYmCks0.cjs → page-lock-fRos9wRU.cjs} +1 -1
  84. package/dist/{page-locked-dialog-B6MKTRfY.js → page-locked-dialog-D2q9qkPk.js} +18 -15
  85. package/dist/page-locked-dialog-D57d2gvn.cjs +1 -0
  86. package/dist/{page-manager-new-CzX22g2n.js → page-manager-new-D6DVIx2S.js} +30 -29
  87. package/dist/page-manager-new-aE198gKS.cjs +1 -0
  88. package/dist/{page-manager-search-and-filter-CM0UMb6U.js → page-manager-search-and-filter-CuZkQaZg.js} +13 -12
  89. package/dist/page-manager-search-and-filter-DGQEgKzy.cjs +1 -0
  90. package/dist/{page-revisions-content-NH9JK4Ey.js → page-revisions-content-5rbicFbD.js} +34 -31
  91. package/dist/page-revisions-content-CefqOvKX.cjs +1 -0
  92. package/dist/pages.cjs +1 -1
  93. package/dist/pages.d.ts +4 -4
  94. package/dist/pages.js +1 -1
  95. package/dist/{plugin-C6rgJDNQ.cjs → plugin-BGlQf0iy.cjs} +1 -1
  96. package/dist/{plugin-3ZKK6RXm.js → plugin-C-ht41UZ.js} +1 -1
  97. package/dist/publish-pages-content-DBb8M3TG.cjs +1 -0
  98. package/dist/{publish-pages-content-D9aixMN5.js → publish-pages-content-WeGk-YLC.js} +66 -65
  99. package/dist/register-chai-top-bar-BqwKw4uy.cjs +1 -0
  100. package/dist/register-chai-top-bar-ESJHs5s-.js +237 -0
  101. package/dist/render.cjs +2 -2
  102. package/dist/render.d.ts +2 -2
  103. package/dist/render.js +87 -80
  104. package/dist/rte-widget-modal-DBoPRXq-.cjs +1 -0
  105. package/dist/{rte-widget-modal-DOJEXLIf.js → rte-widget-modal-J-_AytmK.js} +15 -14
  106. package/dist/runtime.cjs +1 -1
  107. package/dist/runtime.d.ts +168 -4
  108. package/dist/runtime.js +68 -38
  109. package/dist/save-to-lib-0ysmXVbI.cjs +1 -0
  110. package/dist/{save-to-lib-eiOc_SSN.js → save-to-lib-CQQxoovF.js} +39 -38
  111. package/dist/sdk.css +1 -1
  112. package/dist/selected-block-display-BWupQFoQ.cjs +16 -0
  113. package/dist/{selected-block-display-CBFePS19.js → selected-block-display-CgoXS8Hr.js} +37 -36
  114. package/dist/{seo-panel-C1-iMOR1.js → seo-panel-B798Myp_.js} +12 -11
  115. package/dist/seo-panel-BkFbXIL0.cjs +2 -0
  116. package/dist/{shared-json-ld-B4PxAM_0.js → shared-json-ld-Clg_UEhd.js} +68 -67
  117. package/dist/shared-json-ld-Cn3MCW6I.cjs +1 -0
  118. package/dist/slug-input-BHyD8cxk.cjs +1 -0
  119. package/dist/{slug-input-AwNJs9im.js → slug-input-hX5VaZpj.js} +9 -8
  120. package/dist/supabase-actions.cjs +1 -1
  121. package/dist/supabase-actions.d.ts +1 -1
  122. package/dist/supabase-actions.js +1 -1
  123. package/dist/take-over-request-Dzczo20q.cjs +1 -0
  124. package/dist/{take-over-request-C4FeDtN_.js → take-over-request-s1L5Yofb.js} +17 -16
  125. package/dist/theme-panel-footer-NTNCL0SW.cjs +1 -0
  126. package/dist/{theme-panel-footer-uBQqSJXm.js → theme-panel-footer-sK6bYhEb.js} +11 -10
  127. package/dist/translation-warning-modal-BfM4HGck.cjs +1 -0
  128. package/dist/{translation-warning-modal-B64YqlbI.js → translation-warning-modal-Jadkcver.js} +9 -8
  129. package/dist/unmark-as-template-CqkHI3gR.cjs +1 -0
  130. package/dist/{unmark-as-template-CZ9sQp_P.js → unmark-as-template-D5b775eR.js} +11 -10
  131. package/dist/unpublish-page-BT5bCfs6.cjs +1 -0
  132. package/dist/unpublish-page-DLLLgY43.js +28 -0
  133. package/dist/utils.cjs +1 -1
  134. package/dist/utils.d.ts +3 -0
  135. package/dist/utils.js +2 -2
  136. package/dist/web-blocks.cjs +1 -1
  137. package/dist/web-blocks.js +5 -5
  138. package/dist/{web-preview-Djy6WIyj.js → web-preview-C_yFwxEe.js} +2 -2
  139. package/dist/web-preview-DU1MgppY.cjs +1 -0
  140. package/package.json +4 -2
  141. package/dist/IconPicker-DREyo007.cjs +0 -1
  142. package/dist/active-in-another-tab-B47YjQGN.cjs +0 -1
  143. package/dist/active-in-another-tab-CyjngVA6.js +0 -34
  144. package/dist/add-new-language-page-88xzrUy8.cjs +0 -1
  145. package/dist/ai-panel-content-7zCil042.cjs +0 -1
  146. package/dist/ai-prompt-input-CThbVp0_.cjs +0 -1
  147. package/dist/ai-translation-prompt-C2kJQFDX.cjs +0 -1
  148. package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
  149. package/dist/code-display-BnqzqzoP.cjs +0 -1
  150. package/dist/code-editor-o3___nu2.cjs +0 -1
  151. package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +0 -1
  152. package/dist/core-BoRDjj4h.cjs +0 -1
  153. package/dist/core-yvI6kCyw.js +0 -56
  154. package/dist/css-import-modal-CyqkXWCO.cjs +0 -13
  155. package/dist/delete-page-DxX7PFIE.cjs +0 -1
  156. package/dist/design-token-usage-CAHzEGgJ.cjs +0 -1
  157. package/dist/digital-asset-manager--uO8Agia.cjs +0 -1
  158. package/dist/duplicate-page-CaNAbXwV.cjs +0 -1
  159. package/dist/dynamic-page-selector-Cxk_gjni.cjs +0 -1
  160. package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
  161. package/dist/index-DF5DEvqb.cjs +0 -160
  162. package/dist/index-WQwzsC7A.cjs +0 -5
  163. package/dist/lang-panel-DT96k1xg.cjs +0 -1
  164. package/dist/manage-design-tokens-CrmLe7UT.cjs +0 -1
  165. package/dist/mark-as-template-W3LmpiqN.cjs +0 -1
  166. package/dist/nested-path-selector-content-CoS_d3dc.cjs +0 -1
  167. package/dist/no-language-page-content-DkfeMl90.cjs +0 -1
  168. package/dist/page-creator-C4gc5NSC.cjs +0 -1
  169. package/dist/page-locked-dialog-B1FAtK92.cjs +0 -1
  170. package/dist/page-manager-new-CHDueBDk.cjs +0 -1
  171. package/dist/page-manager-search-and-filter-DkkRIH86.cjs +0 -1
  172. package/dist/page-revisions-content-ChY-4f2V.cjs +0 -1
  173. package/dist/publish-pages-content-x-JuSFJ9.cjs +0 -1
  174. package/dist/rte-widget-modal-BaHIuEjF.cjs +0 -1
  175. package/dist/save-to-lib-Cgpxw8-g.cjs +0 -1
  176. package/dist/selected-block-display-BgRY82CT.cjs +0 -16
  177. package/dist/seo-panel-DfAb8U7W.cjs +0 -2
  178. package/dist/shared-json-ld-DzG398hr.cjs +0 -1
  179. package/dist/slug-input-C_ijLQ_X.cjs +0 -1
  180. package/dist/take-over-request-BNxcjY2j.cjs +0 -1
  181. package/dist/theme-panel-footer-Cq9pljro.cjs +0 -1
  182. package/dist/translation-warning-modal-BZAcwM2_.cjs +0 -1
  183. package/dist/unmark-as-template-EVvk0vmp.cjs +0 -1
  184. package/dist/unpublish-page-D4VwOlxc.js +0 -27
  185. package/dist/unpublish-page-bdSmwAVQ.cjs +0 -1
  186. package/dist/web-preview-Cio70gk5.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-BqwKw4uy.cjs"),d=require("./index-B0e71wJ1.cjs"),ee=require("./image-compression-DZ9WMmyn.cjs"),B=require("lodash-es"),f=require("lucide-react"),u=require("react"),ge=require("react-dropzone"),je=require("react-error-boundary"),R=require("react-i18next"),C=require("sonner"),D=require("@tanstack/react-query"),j=require("./index-DKuwxj1x.cjs"),te=require("./common-functions-B3a4xKt_.cjs"),ve=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>{const n=i.map(async l=>x(r,{action:j.ACTIONS.UPLOAD_ASSET,data:l}));return await Promise.all(n)},onSuccess:i=>{var n;if(i!=null&&i.some(s=>s.error))throw new Error(((n=i==null?void 0:i.find(s=>s.error))==null?void 0:n.error)||"Failed to upload asset");{a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]});const s=i==null?void 0:i.length;C.toast.success(`${s===1?"Asset":s+" Assets"} uploaded successfully`)}},onError:()=>{C.toast.error("Failed to upload asset")}})},ye=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>x(r,{action:j.ACTIONS.DELETE_ASSET,data:{id:i}}),onSuccess:i=>{if(i!=null&&i.error)throw new Error(i==null?void 0:i.error);a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]}),C.toast.success("Asset deleted successfully")},onError:()=>{C.toast.error("Failed to delete asset")}})},Ne=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>x(r,{action:j.ACTIONS.UPDATE_ASSET,data:i}),onSuccess:i=>{if(i!=null&&i.error)throw new Error(i==null?void 0:i.error);a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]}),i!=null&&i.id&&a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSET,i.id]}),C.toast.success("Asset updated successfully")},onError:()=>{C.toast.error("Failed to update asset")}})};function be({currentPage:r,totalPages:a,onPageChange:x,pageRangeDisplayed:i=3,showPageInput:n=!0,className:s=""}){const[l,I]=u.useState(String(r)),b=u.useMemo(()=>{const o=Math.floor(i/2);let m=Math.max(1,r-o),c=Math.min(a,r+o);c-m+1<i&&(m===1?c=Math.min(a,m+i-1):c===a&&(m=Math.max(1,c-i+1)));const p=[];m>1&&(p.push(1),m>2&&p.push("..."));for(let N=m;N<=c;N++)p.push(N);return c<a&&(c<a-1&&p.push("..."),p.push(a)),p},[r,a,i]),y=o=>{o!==r&&o>=1&&o<=a&&(x(o),I(String(o)))},v=()=>{r>1&&y(r-1)},w=()=>{r<a&&y(r+1)},A=()=>{const o=Number(l);!isNaN(o)&&o>=1&&o<=a&&y(o)},S=o=>{o.key==="Enter"&&A()};return a<=1?null:e.jsxs("div",{className:`flex flex-wrap items-center justify-center gap-3 ${s}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:v,disabled:r===1,className:"px-2 py-1 text-sm hover:bg-gray-50",children:[e.jsx(f.ChevronLeft,{className:"h-4 w-4"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-2",children:b.map((o,m)=>{if(o==="...")return e.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${m}`);const c=o,p=c===r;return e.jsx(g.Button,{variant:p?"default":"outline",size:"sm",onClick:()=>y(c),className:p?"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:c},c)})}),e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:w,disabled:r===a,className:"px-2 py-1 text-sm hover:bg-gray-50",children:["Next",e.jsx(f.ChevronRight,{className:"h-4 w-4"})]})]}),n&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Go to"}),e.jsx(g.Input,{type:"number",min:1,max:a,value:l,onChange:o=>{const m=o.target.value.replace(/[^\d]/g,"");I(m)},onKeyDown:S,className:"h-8 w-16 px-2 py-1"}),e.jsx(g.Button,{variant:"outline",size:"sm",onClick:A,disabled:l===""||Number(l)<1||Number(l)>a,children:"Go"})]})]})}const we=(r={})=>{const a=j.useApiUrl(),x=j.useFetch(),{search:i,page:n=1,limit:s=30}=r;return D.useQuery({queryKey:[j.ACTIONS.GET_ASSETS,i,n,s],queryFn:async()=>{const l=await x(a,{action:j.ACTIONS.GET_ASSETS,data:{search:i,page:n,limit:s}});return l.page=n,l.limit=s,l},staleTime:1/0,retry:1})},Ce=r=>{const a=j.useApiUrl(),x=j.useFetch();return D.useQuery({queryKey:[j.ACTIONS.GET_ASSET,r],queryFn:async()=>r?await x(a,{action:j.ACTIONS.GET_ASSET,data:{id:r}}):null,staleTime:1/0,retry:1})};function Ae(r){const a=isNaN(r)?0:typeof r=="number"?r:parseInt(r);return a?a<1024?`${a.toFixed(2)} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/(1024*1024)).toFixed(2)} MB`:"0 B"}function J(r){if(!r)return"N/A";const a=new Date(r);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(a)}function Y(r,a){let x=r,i=a==null?void 0:a.description;return(!i||typeof i!="string")&&(i=""),(!x||typeof x!="string")&&(x=""),x!==i}const Se=({assetId:r,onBack:a,onEdit:x,onSave:i,isSaving:n})=>{var o,m;const{t:s}=R.useTranslation(),{data:l,isLoading:I,isError:b}=Ce(r||""),[y,v]=u.useState(""),[w,A]=u.useState(!1);u.useEffect(()=>{const c=new Image;return c.src=(l==null?void 0:l.url)||"",c.onload=()=>A(!0),()=>{c.onload=null}},[l]);const S=async(c,p)=>{try{await navigator.clipboard.writeText(c),C.toast.success(s("{{type}} copied to clipboard",{type:p}))}catch(N){C.toast.error(s("Failed to copy {{type}}",{type:p}),{description:N==null?void 0:N.message})}};return u.useEffect(()=>{l!=null&&l.description&&v(l.description)},[l]),I||!w?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin"})}):b||!(l!=null&&l.id)?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"mx-auto max-w-md p-6 text-center",children:[e.jsx("div",{className:"mb-4 flex justify-center",children:e.jsx(f.AlertCircle,{className:"h-12 w-12 text-gray-400"})}),e.jsx("h3",{className:"mb-2 text-lg font-medium text-gray-900",children:s("No Asset Found")}),e.jsx("p",{className:"mb-6 text-sm text-gray-500",children:s(b?"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(g.Button,{variant:"outline",onClick:a,children:s("Back to Assets")}),b&&e.jsx(g.Button,{variant:"default",onClick:()=>window.location.reload(),children:s("Try Again")})]})]})}):e.jsxs("div",{className:"flex flex-1 flex-col gap-y-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:a,disabled:n,children:[e.jsx(f.ChevronLeft,{className:"h-4 w-4"}),s("Back to Assets")]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g.Button,{variant:"outline",onClick:a,disabled:n,children:s("Cancel")}),e.jsxs(g.Button,{variant:"outline",onClick:()=>S(l.url,s("Asset URL")),disabled:n,children:[e.jsx(f.Copy,{className:"mr-2 h-4 w-4"}),s("Copy URL")]}),e.jsxs(g.Button,{variant:"default",onClick:()=>x(l),disabled:n,children:[e.jsx(f.Pencil,{className:"h-4 w-4"}),s("Edit Image")]})]})]}),e.jsxs("div",{className:"grid flex-1 grid-cols-2 items-start gap-6 overflow-hidden",children:[e.jsx("div",{className:"relative flex h-[calc(80vh-200px)] w-full items-start justify-center",children:e.jsx("img",{src:l.url,alt:l.name,className:"h-full max-h-max w-full max-w-max rounded-lg object-contain"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-3 rounded-md border bg-gray-100 pt-2",children:[e.jsx(d.Label,{className:"w-full text-center",children:s("Details")}),e.jsx("div",{className:"grid grid-cols-1 gap-2 rounded-md border bg-white p-2 text-sm",children:[{label:s("File Name"),value:l.name},{label:s("Type"),value:l.type,capitalize:!0},{label:s("Format"),value:((o=l.metadata)==null?void 0:o.format)||l.type,capitalize:!0},{label:s("Size"),value:Ae(l.size)},{label:s("Dimensions"),value:`${l.width||0} × ${l.height||0}`},{label:s("Created"),value:J(l.createdAt)},{label:s("Updated"),value:J(((m=l.metadata)==null?void 0:m.updatedAt)||(l==null?void 0:l.updatedAt)||l.createdAt)},{label:s("URL"),value:l.url,copyable:!0}].map(c=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d.Label,{className:"w-1/4 w-max px-2 text-left font-normal text-gray-700",children:c.label}),":",e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900"+(c.capitalize?" capitalize":""),children:c.value}),c.copyable&&e.jsx(g.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>S(c.value,c.label),children:e.jsx(f.Link,{className:"h-3 w-3"})})]})]},c.label))})]}),l.usedOn&&l.usedOn.length>0&&e.jsxs("div",{className:"grid gap-3",children:[e.jsx(d.Label,{children:s("Used On")}),e.jsx("div",{className:"grid grid-cols-1 gap-2 rounded-md border p-2 text-sm",children:l.usedOn.map((c,p)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900",children:c.name}),e.jsxs("div",{className:"text-gray-500",children:["(",c.slug,")"]})]},p))})]}),e.jsxs("div",{className:"relative grid gap-3 rounded-md border bg-gray-100 pt-2",children:[e.jsx(d.Label,{className:"w-full text-center",children:s("Description")}),e.jsx(d.Textarea,{id:"description",value:y,placeholder:s("Enter a description for the asset"),onChange:c=>v(c.target.value),rows:3,disabled:n,className:"bg-white hover:border-black/40"}),e.jsx("div",{className:"absolute right-2 top-1.5 flex items-start justify-end",children:e.jsx("button",{type:"button",onClick:()=>i(y),disabled:n||!Y(y,l),className:`rounded-md bg-blue-500 px-3 py-0 py-0.5 text-sm text-white ${n||!Y(y,l)?"cursor-not-allowed opacity-50":""}`,children:n?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"mr-2 h-4 w-4 animate-spin"}),s("Saving...")]}):s("Save")})})]})]})]})]})},Te=u.lazy(()=>Promise.resolve().then(()=>require("./image-editor-C2zOHeKv.cjs"))),Ee=25*1024*1024,Ie=({isUpdatingAsset:r,allowedTypes:a,uploadAssets:x,isUploadingAsset:i,onUploaded:n})=>{const{t:s}=R.useTranslation(),[l,I]=u.useState(()=>{const o=localStorage.getItem("chai_optimize_images");return o!==null?o==="true":!0});u.useEffect(()=>{localStorage.setItem("chai_optimize_images",l.toString())},[l]);const b=r||i,y=u.useCallback(async o=>{try{const m=o;if(!m.every(T=>T.type.startsWith("image/")))return C.toast.error(s("Invalid file type. Please upload a valid file.")),Promise.reject(new Error("Invalid file type"));const c=m.map(async T=>{let U=T;return T.type.startsWith("image/")&&(U=await ee.compressImageIfNeeded(T)),new Promise((_,q)=>{const L=new FileReader;L.readAsDataURL(U),L.onload=async()=>{_({file:L.result,folderId:void 0,name:T.name,optimize:l})},L.onerror=()=>q(null)})}),p=await Promise.all(c),N=await x(p);return(N==null?void 0:N.length)===1&&n(N[0]),N}catch(m){return Promise.reject(m)}},[x,l,n,s]),v=o=>{const m=[];let c=0;return o.forEach(p=>{p.size>Ee?c++:m.push(p)}),c>0&&C.toast.error(`${c===1&&o.length===1?s("File"):c+s(c===1?" file":" files")} ${s("exceed the maximum size limit of 10MB.")}`),B.isEmpty(m)?[]:y(m)},{getRootProps:w,getInputProps:A,isDragActive:S}=ge.useDropzone({onDrop:v,accept:{"image/*":a.includes("image")?[]:[]},disabled:r||i,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 ${b?"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:te.cn("flex h-max w-full cursor-pointer flex-col justify-center rounded-lg text-center",b?"items-start":"items-center",S?"border-primary bg-primary/5":"border-muted-foreground/20"),children:[e.jsx("input",{...A()}),b?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(f.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:s(r?"Updating file...":"Uploading file...")}),e.jsxs("div",{className:"text-xs font-light text-muted-foreground",children:[s("Please wait while we")," ",s(r?"update":"upload")," ",s("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(f.Upload,{className:"h-4 w-4 text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"font-medium",children:[s("Drop your file here or")," ",e.jsx("span",{className:"cursor-pointer text-indigo-500 hover:underline",children:s("browse")})]}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:e.jsxs("span",{className:"",children:[s("Accepted file types:")," ",e.jsx("span",{className:"capitalize text-indigo-400",children:a.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:[s("Optimization:")," ",e.jsx("span",{className:l?"text-indigo-600":"text-gray-400",children:s(l?"On":"Off")})]}),e.jsx(d.Switch,{checked:l,onCheckedChange:o=>{I(o)},onClick:o=>{o.stopPropagation()},className:"data-[state=checked]:bg-indigo-500"})]}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("span",{className:`flex cursor-help items-center text-amber-500 ${l?"invisible":""}`,children:e.jsx(f.AlertTriangle,{className:"mr-1 h-4 w-4"})})}),e.jsx(d.TooltipContent,{side:"top",children:e.jsx("p",{className:"text-xs text-white",children:s("Warning: Unoptimized images may affect performance and page load times")})})]})})]})]})]})})};function ke({close:r,onSelect:a,mode:x="image",assetId:i}){const{t:n}=R.useTranslation(),s=!1,l=10,I=u.useMemo(()=>[x],[x]),[b,y]=u.useState(null),[v,w]=u.useState(null),[A,S]=u.useState(null),[o,m]=u.useState({show:!1,file:""}),[c,p]=u.useState(!1),[N,T]=u.useState(i?"details":"grid"),[U,_]=u.useState(""),[q,L]=u.useState(""),[P,Q]=u.useState(1),[K]=u.useState(30),[E,G]=u.useState([]);u.useEffect(()=>{i&&(y(i),T("details"))},[i]),u.useEffect(()=>{const t=setTimeout(()=>{_(q),Q(1)},300);return()=>clearTimeout(t)},[q]);const{data:O,isLoading:$,refetch:se}=we({search:U.toLowerCase().trim(),page:P,limit:K}),F=(O==null?void 0:O.assets)||[],ie=(O==null?void 0:O.total)||0,k=Math.ceil(ie/K);u.useEffect(()=>{$||k<=0||Q(t=>t>k?k:t<1?1:t)},[$,k]);const le=(F==null?void 0:F.length)>0,{mutate:ae}=ye(),{mutateAsync:W,isPending:re}=ve(),{mutateAsync:V,isPending:ne}=Ne(),H=u.useCallback(t=>{const h=Math.min(Math.max(1,t),Math.max(1,k));h!==P&&Q(h)},[k,P]),oe=t=>{L(t.target.value)},ce=u.useCallback(t=>{G(h=>B.find(h,{id:t.id})?[]:[t])},[s]),de=u.useCallback(()=>{G([])},[]),X=t=>{(t==null?void 0:t.length)!==0&&(a(B.pick(B.first(t||E),["id","url","width","height","description"])),r())},ue=async t=>{w(t)},me=async()=>{v&&(S(v==null?void 0:v.id),await ae(v.id,{onSuccess:()=>{S(null),w(null)},onError:()=>{S(null)}}),w(null))},he=t=>{y(t.id),T("details")},xe=async(t,h)=>{try{const M=localStorage.getItem("chai_optimize_images")!=="false";if(h){const z=await W([{file:t,folderId:void 0,name:o.name||"",optimize:M}]);if((z==null?void 0:z.length)>0){const Z=z[0];a({...B.pick(Z,["id","width","height","description"]),url:Z.url})}}else{const z=await V({id:o.id||"",file:t});z&&a({...B.pick(z,["id","width","height","description"]),url:z.url})}m({show:!1,file:""}),r()}catch(M){console.error(n("Error saving edited image:"),M)}},fe=u.useCallback(t=>{G([t])},[]),pe=u.useCallback(t=>{H(t)},[H]);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:n("Digital Asset Manager")}),N==="grid"?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{maxFileSize:l,allowedTypes:I,uploadAssets:W,isUpdatingAsset:ne,isUploadingAsset:re,onUploaded:fe}),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(f.Search,{strokeWidth:3,className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${q.length>0?"text-indigo-800":""}`}),e.jsx(g.Input,{placeholder:n("Search assets..."),onChange:oe,value:q,className:"pl-8"})]}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[E.length>0?e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.length>0&&e.jsx(e.Fragment,{children:e.jsx(g.Button,{variant:"outline",size:"sm",onClick:()=>de(),title:n("Clear selection"),children:n("Clear")})}),e.jsx(g.Button,{size:"sm",onClick:()=>X(E),disabled:E.length===0,children:n("Select Asset")})]})}):null,e.jsx(g.Button,{variant:"ghost",size:"icon",onClick:()=>se(),children:e.jsx(f.RefreshCwIcon,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto pb-[66px]",children:$?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"})]}):!$&&!le?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(f.Archive,{className:"h-9 w-9 text-indigo-500"})}),e.jsx("div",{className:"text-lg text-muted-foreground",children:n("No assets found")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:U.length>0?n("No assets found for your search: {{query}}",{query:U}):n("Start uploading assets to get started")}),e.jsx("br",{})]}):e.jsx("div",{className:"flex flex-wrap gap-3 p-1",children:F==null?void 0:F.map(t=>e.jsxs("div",{className:te.cn("group relative flex max-h-[180px] max-w-[180px] cursor-pointer flex-col justify-between overflow-hidden rounded-lg border-2 transition-all",E.some(h=>h.id===t.id)?"border-blue-500":"hover:border-black/90",A&&(v==null?void 0:v.id)===t.id?"pointer-events-none opacity-50":"",A===t.id?"pointer-events-none opacity-50":""),onClick:()=>ce(t),onDoubleClick:()=>X([t]),children:[e.jsxs("div",{className:"aspect-square relative overflow-hidden",children:[A===t.id?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin text-white"})}):null,t.type==="image"?e.jsx("img",{src:`${t.thumbnailUrl||"/placeholder.svg"}?v=${(t==null?void 0:t.updatedAt)||t.createdAt}`,alt:t.name,className:`h-full min-h-[80px] w-full object-contain ${E.some(h=>h.id===t.id)?"":"group-hover:blur group-hover:contrast-50"}`}):e.jsxs("div",{className:"flex h-full items-center justify-center",children:[e.jsx(f.Film,{className:"h-12 w-12 text-muted-foreground"}),t.thumbnailUrl&&e.jsx("img",{src:`${t.thumbnailUrl||"/placeholder.svg"}?v=${(t==null?void 0:t.updatedAt)||t.createdAt}`,alt:t.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:t.name,children:t.name}),e.jsx("div",{className:"flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground",children:e.jsx("span",{children:ee.formatFileSize((t==null?void 0:t.size)||0)})})]}),!E.some(h=>h.id===t.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(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),he(t)},children:e.jsx(f.ImageIcon,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("View Details")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),navigator.clipboard.writeText(t.url),C.toast.success(n("Asset URL copied to clipboard"))},children:e.jsx(f.Copy,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Copy URL")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),m({id:t.id,show:!0,file:t.url,name:t.name})},children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Edit Image")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"destructive",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),ue(t)},children:e.jsx(f.Trash2,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Delete Asset")})})]})})]})}),E.some(h=>h.id===t.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(f.Check,{className:"h-3 w-3 text-white",strokeWidth:5})})]},t.id))})}),k>1&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t bg-white p-4",children:e.jsx(je.ErrorBoundary,{fallback:e.jsx("div",{className:"text-red-500",children:n("Error loading pagination")}),children:e.jsx(be,{currentPage:P,totalPages:k,onPageChange:pe,pageRangeDisplayed:3,showPageInput:!0})})})]})]}):e.jsx(Se,{assetId:b||i||"",onBack:()=>{T("grid"),y(null)},onEdit:t=>{m({id:t.id,show:!0,file:t.url,name:t.name})},onSave:async t=>{if(b){p(!0);try{const h=F.find(M=>M.id===b);h&&await V(B.merge(h,{description:t}))}finally{p(!1)}}},isSaving:c})]}),o.show&&e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin"})}),children:e.jsx(Te,{imageUrl:o.file,onSave:xe,onClose:()=>m({show:!1,file:""}),defaultSavedImageName:o.name,isEditing:!!o.id})}),v&&e.jsx(d.Dialog,{open:!!v,onOpenChange:()=>w(null),children:e.jsxs(d.DialogContent,{children:[e.jsxs(d.DialogHeader,{children:[e.jsx(d.DialogTitle,{children:n("Delete Asset")}),e.jsx(d.DialogDescription,{children:n('Are you sure you want to delete "{{name}}"? This action cannot be undone.',{name:v.name})})]}),e.jsxs(d.DialogFooter,{className:"gap-2 sm:gap-0",children:[e.jsx(g.Button,{variant:"outline",onClick:()=>w(null),children:n("Cancel")}),e.jsx(g.Button,{variant:"destructive",onClick:me,children:n("Delete")})]})]})})]})}exports.default=ke;
@@ -1,5 +1,6 @@
1
1
  import { jsxs as r, jsx as e, Fragment as H } from "react/jsx-runtime";
2
- import { B as p, I as me, L as V, T as Fe, aw as _, w as q, x as P, y as G, D as Ue, d as Le, e as $e, f as Me, p as _e, q as qe, aj as Pe } from "./index-Ct7ElCGK.js";
2
+ import { B as p, z as me } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { L as V, T as Fe, ar as _, w as q, x as P, y as G, D as Ue, d as Le, e as $e, f as Me, p as _e, q as qe, af as Pe } from "./index-CAhEmHYP.js";
3
4
  import { f as Ge, c as Oe } from "./image-compression-DsZ1oqpb.js";
4
5
  import { find as Be, merge as Ke, pick as Y, first as Qe, isEmpty as Re } from "lodash-es";
5
6
  import { ChevronLeft as ue, ChevronRight as We, Loader as B, AlertCircle as Ve, Copy as he, Pencil as He, Link as Xe, Search as Ze, RefreshCwIcon as Je, Archive as Ye, Film as et, ImageIcon as tt, Edit as it, Trash2 as at, Check as lt, Upload as rt, AlertTriangle as nt } from "lucide-react";
@@ -9,7 +10,7 @@ import { ErrorBoundary as ot } from "react-error-boundary";
9
10
  import { useTranslation as ee } from "react-i18next";
10
11
  import { toast as A } from "sonner";
11
12
  import { useQueryClient as te, useMutation as ie, useQuery as ge } from "@tanstack/react-query";
12
- import { ar as K, as as Q, A as b } from "./index-ZuacEL1j.js";
13
+ import { ar as K, as as Q, A as b } from "./index-Bn0fFN58.js";
13
14
  import { c as xe } from "./common-functions-D2lMFR6K.js";
14
15
  const dt = () => {
15
16
  const s = K(), n = te(), h = Q();
@@ -384,7 +385,7 @@ const xt = ({ assetId: s, onBack: n, onEdit: h, onSave: a, isSaving: c }) => {
384
385
  ] })
385
386
  ] })
386
387
  ] });
387
- }, vt = fe.lazy(() => import("./image-editor-DV8kUKhl.js")), yt = 25 * 1024 * 1024, Nt = ({ isUpdatingAsset: s, allowedTypes: n, uploadAssets: h, isUploadingAsset: a, onUploaded: c }) => {
388
+ }, vt = fe.lazy(() => import("./image-editor-cckqPmk5.js")), yt = 25 * 1024 * 1024, Nt = ({ isUpdatingAsset: s, allowedTypes: n, uploadAssets: h, isUploadingAsset: a, onUploaded: c }) => {
388
389
  const { t: i } = ee(), [l, I] = y(() => {
389
390
  const o = localStorage.getItem("chai_optimize_images");
390
391
  return o !== null ? o === "true" : !0;
@@ -522,7 +523,7 @@ const xt = ({ assetId: s, onBack: n, onEdit: h, onSave: a, isSaving: c }) => {
522
523
  }
523
524
  );
524
525
  };
525
- function Ut({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
526
+ function Lt({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
526
527
  const { t: c } = ee(), i = !1, l = 10, I = pe(() => [h], [h]), [N, x] = y(null), [g, w] = y(null), [C, S] = y(null), [o, m] = y({ show: !1, file: "" }), [d, f] = y(!1), [v, E] = y(a ? "details" : "grid"), [j, X] = y(""), [F, U] = y(""), [R, Z] = y(1), [ae] = y(30), [k, J] = y([]);
527
528
  O(() => {
528
529
  a && (x(a), E("details"));
@@ -872,5 +873,5 @@ function Ut({ close: s, onSelect: n, mode: h = "image", assetId: a }) {
872
873
  ] });
873
874
  }
874
875
  export {
875
- Ut as default
876
+ Lt as default
876
877
  };
@@ -1,14 +1,15 @@
1
1
  import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
- import { D as A, d as C, e as T, f as w, p as F, L as v, I as L, A as _, B as D } from "./index-Ct7ElCGK.js";
3
- import { ar as q, as as G, A as U, at as j } from "./index-ZuacEL1j.js";
2
+ import { z as C, D as A, B as v } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { D as T, d as w, e as F, f as L, p as _, L as D } from "./index-CAhEmHYP.js";
4
+ import { ar as q, as as G, A as U, at as j } from "./index-Bn0fFN58.js";
4
5
  import { useQueryClient as $, useMutation as B } from "@tanstack/react-query";
5
6
  import { toast as P } from "sonner";
6
7
  import { isEmpty as O, initial as M } from "lodash-es";
7
8
  import { AlertCircle as Q } from "lucide-react";
8
9
  import { useState as p } from "react";
9
10
  import { useTranslation as V } from "react-i18next";
10
- import { S as k } from "./slug-input-AwNJs9im.js";
11
- const H = () => {
11
+ import { S as k } from "./slug-input-hX5VaZpj.js";
12
+ const z = () => {
12
13
  const s = q(), o = $(), g = G();
13
14
  return B({
14
15
  mutationFn: async ({ pageId: e, name: h, slug: r }) => {
@@ -32,13 +33,13 @@ const H = () => {
32
33
  });
33
34
  }
34
35
  });
35
- }, se = ({
36
+ }, te = ({
36
37
  page: s,
37
38
  onClose: o,
38
39
  closePanel: g = () => {
39
40
  }
40
41
  }) => {
41
- const { t: e } = V(), { mutate: h, isPending: r } = H(), [u, i] = p(null), [m, I] = p(`${s.name} (Copy)`), x = j(), l = O(s.slug), [d, E] = p(l ? "" : `${s.slug.split("/").pop()}-copy`), y = l ? "" : M(s.slug.split("/")).join("/"), [N, f] = p(!1), b = (n) => {
42
+ const { t: e } = V(), { mutate: h, isPending: r } = z(), [u, i] = p(null), [m, x] = p(`${s.name} (Copy)`), I = j(), l = O(s.slug), [d, E] = p(l ? "" : `${s.slug.split("/").pop()}-copy`), y = l ? "" : M(s.slug.split("/")).join("/"), [N, f] = p(!1), b = (n) => {
42
43
  if (n.preventDefault(), !m.trim()) {
43
44
  i(e("Name is required"));
44
45
  return;
@@ -54,17 +55,17 @@ const H = () => {
54
55
  };
55
56
  l || (S.slug = `${y}/${d}`), h(S, {
56
57
  onSuccess: (c) => {
57
- f(!1), o(), x(c.id, g);
58
+ f(!1), o(), I(c.id, g);
58
59
  },
59
60
  onError: (c) => {
60
61
  f(!1), c.code === "SLUG_EXISTS" ? i(e("A page with this slug already exists. Please choose a different slug.")) : c.code === "INVALID_SLUG" ? i(e("The slug format is invalid. Please use only lowercase letters, numbers, and hyphens.")) : c.code === "PERMISSION_DENIED" ? i(e("You don't have permission to duplicate this page.")) : i(c.message || e("Failed to duplicate page. Please try again later."));
61
62
  }
62
63
  });
63
64
  };
64
- return /* @__PURE__ */ t(A, { open: !!s, onOpenChange: o, children: /* @__PURE__ */ a(C, { className: "sm:max-w-[425px]", children: [
65
- /* @__PURE__ */ a(T, { children: [
66
- /* @__PURE__ */ t(w, { children: e("Duplicate Page") }),
67
- /* @__PURE__ */ t(F, { children: e("Create a copy of the page with a new name and slug") })
65
+ return /* @__PURE__ */ t(T, { open: !!s, onOpenChange: o, children: /* @__PURE__ */ a(w, { className: "sm:max-w-[425px]", children: [
66
+ /* @__PURE__ */ a(F, { children: [
67
+ /* @__PURE__ */ t(L, { children: e("Duplicate Page") }),
68
+ /* @__PURE__ */ t(_, { children: e("Create a copy of the page with a new name and slug") })
68
69
  ] }),
69
70
  /* @__PURE__ */ a("div", { className: "mb-4 rounded-md bg-gray-50 p-3", children: [
70
71
  /* @__PURE__ */ a("h3", { className: "mb-1 text-sm font-medium", children: [
@@ -100,11 +101,11 @@ const H = () => {
100
101
  ] }),
101
102
  /* @__PURE__ */ a("form", { onSubmit: b, className: "space-y-4", children: [
102
103
  /* @__PURE__ */ a("div", { className: "space-y-2", children: [
103
- /* @__PURE__ */ t(v, { htmlFor: "name", className: "text-sm", children: e("Name") }),
104
- /* @__PURE__ */ t(L, { id: "name", value: m, onChange: (n) => I(n.target.value), required: !0 })
104
+ /* @__PURE__ */ t(D, { htmlFor: "name", className: "text-sm", children: e("Name") }),
105
+ /* @__PURE__ */ t(C, { id: "name", value: m, onChange: (n) => x(n.target.value), required: !0 })
105
106
  ] }),
106
107
  !l && /* @__PURE__ */ a("div", { className: "space-y-2", children: [
107
- /* @__PURE__ */ t(v, { htmlFor: "slug", className: "text-sm", children: e("Slug") }),
108
+ /* @__PURE__ */ t(D, { htmlFor: "slug", className: "text-sm", children: e("Slug") }),
108
109
  /* @__PURE__ */ t(
109
110
  k,
110
111
  {
@@ -117,17 +118,17 @@ const H = () => {
117
118
  }
118
119
  )
119
120
  ] }),
120
- u && /* @__PURE__ */ a(_, { variant: "destructive", className: "py-2", children: [
121
+ u && /* @__PURE__ */ a(A, { variant: "destructive", className: "py-2", children: [
121
122
  /* @__PURE__ */ t(Q, { className: "h-4 w-4" }),
122
123
  /* @__PURE__ */ t("span", { className: "text-sm", children: u })
123
124
  ] }),
124
125
  /* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
125
- /* @__PURE__ */ t(D, { type: "button", variant: "outline", onClick: o, disabled: r, children: e("Cancel") }),
126
- /* @__PURE__ */ t(D, { type: "submit", disabled: !m.trim() || !l && !d.trim() || r || N, children: e(r || N ? "Duplicating..." : "Duplicate") })
126
+ /* @__PURE__ */ t(v, { type: "button", variant: "outline", onClick: o, disabled: r, children: e("Cancel") }),
127
+ /* @__PURE__ */ t(v, { type: "submit", disabled: !m.trim() || !l && !d.trim() || r || N, children: e(r || N ? "Duplicating..." : "Duplicate") })
127
128
  ] })
128
129
  ] })
129
130
  ] }) });
130
131
  };
131
132
  export {
132
- se as default
133
+ te as default
133
134
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-BqwKw4uy.cjs"),l=require("./index-B0e71wJ1.cjs"),h=require("./index-DKuwxj1x.cjs"),v=require("@tanstack/react-query"),P=require("sonner"),D=require("lodash-es"),C=require("lucide-react"),p=require("react"),T=require("react-i18next"),A=require("./slug-input-BHyD8cxk.cjs"),w=()=>{const t=h.useApiUrl(),u=v.useQueryClient(),x=h.useFetch();return v.useMutation({mutationFn:async({pageId:s,name:j,slug:r})=>{const o={pageId:s,name:j};return r&&(o.slug=r),await x(t,{action:"DUPLICATE_PAGE",data:o})},onSuccess:()=>{u.invalidateQueries({queryKey:[h.ACTIONS.GET_WEBSITE_PAGES]}),P.toast.success("Page duplicated successfully")},onError:s=>{P.toast.error("Failed to duplicate page",{description:s.message||"An error occurred while duplicating the page"})}})},F=({page:t,onClose:u,closePanel:x=()=>{}})=>{const{t:s}=T.useTranslation(),{mutate:j,isPending:r}=w(),[o,a]=p.useState(null),[d,I]=p.useState(`${t.name} (Copy)`),b=h.useChangePage(),i=D.isEmpty(t.slug),[m,q]=p.useState(i?"":`${t.slug.split("/").pop()}-copy`),y=i?"":D.initial(t.slug.split("/")).join("/"),[S,f]=p.useState(!1),E=n=>{if(n.preventDefault(),!d.trim()){a(s("Name is required"));return}if(!i&&!m.trim()){a(s("Slug is required"));return}a(null),f(!0);const N={pageId:t.id,name:d};i||(N.slug=`${y}/${m}`),j(N,{onSuccess:c=>{f(!1),u(),b(c.id,x)},onError:c=>{f(!1),c.code==="SLUG_EXISTS"?a(s("A page with this slug already exists. Please choose a different slug.")):c.code==="INVALID_SLUG"?a(s("The slug format is invalid. Please use only lowercase letters, numbers, and hyphens.")):c.code==="PERMISSION_DENIED"?a(s("You don't have permission to duplicate this page.")):a(c.message||s("Failed to duplicate page. Please try again later."))}})};return e.jsx(l.Dialog,{open:!!t,onOpenChange:u,children:e.jsxs(l.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{children:s("Duplicate Page")}),e.jsx(l.DialogDescription,{children:s("Create a copy of the page with a new name and slug")})]}),e.jsxs("div",{className:"mb-4 rounded-md bg-gray-50 p-3",children:[e.jsxs("h3",{className:"mb-1 text-sm font-medium",children:[s("Duplicating:"),":"]}),e.jsxs("div",{className:"flex flex-col gap-1 text-sm text-gray-700",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Name"),":"]})," ",t.name]}),!i&&e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Slug"),":"]})," ",t.slug]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Type"),":"]})," ",t.pageType]})]})]}),e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l.Label,{htmlFor:"name",className:"text-sm",children:s("Name")}),e.jsx(g.Input,{id:"name",value:d,onChange:n=>I(n.target.value),required:!0})]}),!i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(l.Label,{htmlFor:"slug",className:"text-sm",children:s("Slug")}),e.jsx(A.SlugInput,{value:m,onChange:n=>q(n),parentSlug:y,onValidationChange:n=>{a(n?null:s("Invalid slug"))}})]}),o&&e.jsxs(g.Alert,{variant:"destructive",className:"py-2",children:[e.jsx(C.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:o})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(g.Button,{type:"button",variant:"outline",onClick:u,disabled:r,children:s("Cancel")}),e.jsx(g.Button,{type:"submit",disabled:!d.trim()||!i&&!m.trim()||r||S,children:s(r||S?"Duplicating...":"Duplicate")})]})]})]})})};exports.default=F;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("./register-chai-top-bar-BqwKw4uy.cjs"),c=require("./index-B0e71wJ1.cjs"),h=require("./index-DKuwxj1x.cjs"),p=require("lodash-es"),g=require("lucide-react"),d=require("react"),f=({isDefaultLang:r,searchQuery:a,setSearchQuery:l})=>e.jsx(x.Input,{type:"text",autoFocus:!0,value:r?a:"",onChange:t=>l(t.target.value),placeholder:r?"Search pages...":"To search select default language",disabled:!r,onKeyDown:t=>t.stopPropagation()}),m=({dynamicPage:r,setDynamicPage:a,searchQuery:l,setSearchQuery:t,dynamicPages:n})=>{const{selectedLang:o,fallbackLang:i}=c.useLanguages(),u=(o==null?void 0:o.length)===0;return e.jsxs(c.DropdownMenu,{children:[e.jsx(c.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(x.Button,{variant:"ghost",className:"h-max w-max rounded-md border border-[0px] border-gray-200 py-1 pl-4 text-sm hover:bg-gray-100 focus:outline-none focus:ring-0",children:[r?p.get(r,"name"):"Select Page",e.jsx(g.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),e.jsxs(c.DropdownMenuContent,{className:"max-h-[75vh] w-96 divide-y p-0 shadow-xl",children:[e.jsx("div",{className:"bg-gray-50/30 p-1.5",children:e.jsx(f,{isDefaultLang:u,searchQuery:l,setSearchQuery:t})}),(n==null?void 0:n.length)===0?e.jsx("div",{className:"flex h-24 items-center justify-center text-xs",children:"No pages found"}):n==null?void 0:n.map(s=>e.jsx(c.DropdownMenuItem,{onClick:()=>a(s),disabled:u?i!==s.lang:o!==s.lang,className:`no-scrollbar flex cursor-pointer flex-col justify-start overflow-x-auto whitespace-nowrap ${s.id===(r==null?void 0:r.id)?"bg-blue-50":"hover:bg-gray-50"}`,children:e.jsx("div",{className:"w-full whitespace-nowrap px-2 py-[2px] text-xs",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx("span",{className:"font-medium",children:s.name}),e.jsx("span",{className:"truncate rounded-full border border-gray-300 px-2 py-[1px] font-mono text-xs font-medium text-gray-500",children:s.slug})]})})},s.id))]})]})},j=()=>{const{dynamicPage:r,dynamicPages:a,allLangPages:l,selectedLang:t,searchQuery:n,updateDynamicPage:o,updateSearchQuery:i,onChangeLanguage:u}=h.useDynamicPageSelector(),s=d.useRef(void 0);return d.useEffect(()=>{s.current!==t&&r&&(u(),s.current=t)},[t,a]),e.jsx("div",{className:"relative",children:e.jsx(m,{dynamicPage:r,setDynamicPage:o,searchQuery:n,setSearchQuery:i,dynamicPages:l})})};exports.default=j;
@@ -1,6 +1,7 @@
1
1
  import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
- import { n as i, r as h, s as p, B as m, t as f, v as x, I as g } from "./index-Ct7ElCGK.js";
3
- import { n as v } from "./index-ZuacEL1j.js";
2
+ import { B as d, z as h } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { n as p, r as m, s as f, t as x, v as g } from "./index-CAhEmHYP.js";
4
+ import { n as v } from "./index-Bn0fFN58.js";
4
5
  import { get as w } from "lodash-es";
5
6
  import { ChevronDown as b } from "lucide-react";
6
7
  import { useRef as N, useEffect as y } from "react";
@@ -9,7 +10,7 @@ const D = ({
9
10
  searchQuery: s,
10
11
  setSearchQuery: l
11
12
  }) => /* @__PURE__ */ r(
12
- g,
13
+ h,
13
14
  {
14
15
  type: "text",
15
16
  autoFocus: !0,
@@ -26,10 +27,10 @@ const D = ({
26
27
  setSearchQuery: o,
27
28
  dynamicPages: a
28
29
  }) => {
29
- const { selectedLang: n, fallbackLang: d } = i(), c = (n == null ? void 0 : n.length) === 0;
30
- return /* @__PURE__ */ u(h, { children: [
31
- /* @__PURE__ */ r(p, { asChild: !0, children: /* @__PURE__ */ u(
32
- m,
30
+ const { selectedLang: n, fallbackLang: i } = p(), c = (n == null ? void 0 : n.length) === 0;
31
+ return /* @__PURE__ */ u(m, { children: [
32
+ /* @__PURE__ */ r(f, { asChild: !0, children: /* @__PURE__ */ u(
33
+ d,
33
34
  {
34
35
  variant: "ghost",
35
36
  className: "h-max w-max rounded-md border border-[0px] border-gray-200 py-1 pl-4 text-sm hover:bg-gray-100 focus:outline-none focus:ring-0",
@@ -39,13 +40,13 @@ const D = ({
39
40
  ]
40
41
  }
41
42
  ) }),
42
- /* @__PURE__ */ u(f, { className: "max-h-[75vh] w-96 divide-y p-0 shadow-xl", children: [
43
+ /* @__PURE__ */ u(x, { className: "max-h-[75vh] w-96 divide-y p-0 shadow-xl", children: [
43
44
  /* @__PURE__ */ r("div", { className: "bg-gray-50/30 p-1.5", children: /* @__PURE__ */ r(D, { isDefaultLang: c, searchQuery: l, setSearchQuery: o }) }),
44
45
  (a == null ? void 0 : a.length) === 0 ? /* @__PURE__ */ r("div", { className: "flex h-24 items-center justify-center text-xs", children: "No pages found" }) : a == null ? void 0 : a.map((t) => /* @__PURE__ */ r(
45
- x,
46
+ g,
46
47
  {
47
48
  onClick: () => s(t),
48
- disabled: c ? d !== t.lang : n !== t.lang,
49
+ disabled: c ? i !== t.lang : n !== t.lang,
49
50
  className: `no-scrollbar flex cursor-pointer flex-col justify-start overflow-x-auto whitespace-nowrap ${t.id === (e == null ? void 0 : e.id) ? "bg-blue-50" : "hover:bg-gray-50"}`,
50
51
  children: /* @__PURE__ */ r("div", { className: "w-full whitespace-nowrap px-2 py-[2px] text-xs", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-x-2", children: [
51
52
  /* @__PURE__ */ r("span", { className: "font-medium", children: t.name }),
@@ -56,7 +57,7 @@ const D = ({
56
57
  ))
57
58
  ] })
58
59
  ] });
59
- }, k = () => {
60
+ }, B = () => {
60
61
  const {
61
62
  dynamicPage: e,
62
63
  dynamicPages: s,
@@ -64,7 +65,7 @@ const D = ({
64
65
  selectedLang: o,
65
66
  searchQuery: a,
66
67
  updateDynamicPage: n,
67
- updateSearchQuery: d,
68
+ updateSearchQuery: i,
68
69
  onChangeLanguage: c
69
70
  } = v(), t = N(void 0);
70
71
  return y(() => {
@@ -75,11 +76,11 @@ const D = ({
75
76
  dynamicPage: e,
76
77
  setDynamicPage: n,
77
78
  searchQuery: a,
78
- setSearchQuery: d,
79
+ setSearchQuery: i,
79
80
  dynamicPages: l
80
81
  }
81
82
  ) });
82
83
  };
83
84
  export {
84
- k as default
85
+ B as default
85
86
  };
@@ -0,0 +1 @@
1
+ "use strict";const a=require("@tailwindcss/aspect-ratio"),n=require("@tailwindcss/container-queries"),d=require("@tailwindcss/forms"),i=require("@tailwindcss/typography");function r(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}}const c=({content:o,theme:e})=>({darkMode:"class",content:[...o],theme:{extend:{...r(),...e??{}}},plugins:[i,d,a,n]});exports.getChaiBuilderTailwindConfig=c;exports.shadcnTheme=r;
@@ -1,7 +1,7 @@
1
1
  import a from "@tailwindcss/aspect-ratio";
2
- import e from "@tailwindcss/forms";
2
+ import e from "@tailwindcss/container-queries";
3
+ import n from "@tailwindcss/forms";
3
4
  import d from "@tailwindcss/typography";
4
- import n from "tailwindcss-animate";
5
5
  function i() {
6
6
  return {
7
7
  colors: {
@@ -62,14 +62,14 @@ function i() {
62
62
  }
63
63
  const h = ({ content: r, theme: o }) => ({
64
64
  darkMode: "class",
65
- content: [...r, "node_modules/@chaibuilder/sdk/dist/*.{js,cjs}"],
65
+ content: [...r],
66
66
  theme: {
67
67
  extend: {
68
68
  ...i(),
69
- ...o
69
+ ...o ?? {}
70
70
  }
71
71
  },
72
- plugins: [n, d, e, a]
72
+ plugins: [d, n, a, e]
73
73
  });
74
74
  export {
75
75
  h as g,
@@ -1 +1 @@
1
- "use strict";const o=require("./plugin-C6rgJDNQ.cjs"),e=o.plugin(function({addBase:n,theme:i}){n({"h1,h2,h3,h4,h5,h6":{fontFamily:i("fontFamily.heading")},body:{fontFamily:i("fontFamily.body"),color:i("colors.foreground"),backgroundColor:i("colors.background")}})}),r=(n=o.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...o.getChaiThemeOptions(n)});exports.chaiBuilderPlugin=e;exports.getChaiBuilderTheme=r;
1
+ "use strict";const o=require("./plugin-BGlQf0iy.cjs"),e=o.plugin(function({addBase:n,theme:i}){n({"h1,h2,h3,h4,h5,h6":{fontFamily:i("fontFamily.heading")},body:{fontFamily:i("fontFamily.body"),color:i("colors.foreground"),backgroundColor:i("colors.background")}})}),r=(n=o.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...o.getChaiThemeOptions(n)});exports.chaiBuilderPlugin=e;exports.getChaiBuilderTheme=r;
@@ -1,4 +1,4 @@
1
- import { p as r, d as a, g as i } from "./plugin-3ZKK6RXm.js";
1
+ import { p as r, d as a, g as i } from "./plugin-C-ht41UZ.js";
2
2
  const t = r(function({ addBase: n, theme: o }) {
3
3
  n({
4
4
  "h1,h2,h3,h4,h5,h6": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("./index-DF5DEvqb.cjs"),S=require("lodash-es"),c=require("lucide-react"),a=require("react"),T=require("react-filerobot-image-editor"),k=require("react-i18next"),h=a.memo(({imageUrl:l,onSave:u,onClose:m,defaultSavedImageName:y,isEditing:f=!1})=>{const{t:n}=k.useTranslation(),[v,i]=a.useState(!1),[p,I]=a.useState(!0),[w,j]=a.useState(!1);a.useEffect(()=>{const e=new Image;return e.src=l,e.onload=()=>j(!0),()=>{e.onload=null}},[l]),a.useEffect(()=>{const e=t=>{t.key==="Escape"&&p&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[]);const g=a.useMemo(()=>S.debounce(async(e,t=!1)=>{i(!0);const s=e.imageBase64;await u(s,t),I(!1),i(!1)},300),[u]),r=a.useCallback((e,t=!1)=>{g(e,t)},[g]),x=a.useCallback(()=>{I(!1),m()},[m]),d=a.useMemo(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],toolsIds:["Rotate"],defaultTabId:"Adjust",defaultToolId:"Rotate"}),[]),C=a.useMemo(()=>({colors:{primary:"#000000",secondary:"#000000",tertiary:"#000000"}}),[]),E=a.useMemo(()=>f?[{label:n("Update this file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!1)}),icon:c.Save},{label:n("Save as new file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!0)}),icon:c.Copy}]:[],[f,r,n]);return o.jsx(b.Dialog,{open:!0,onOpenChange:e=>!e&&x(),children:o.jsxs(b.DialogContent,{id:"chai-image-editor-container",className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4 p-0",children:[v&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 text-white",children:o.jsx(c.Loader,{className:"h-4 w-4 animate-spin"})}),p&&w&&o.jsx(T,{theme:C,source:l,onSave:r,onClose:x,Text:{text:n("Add text here")},Rotate:{angle:90,componentType:"slider"},tabsIds:d.tabsIds,defaultTabId:d.defaultTabId,defaultToolId:d.defaultToolId,savingPixelRatio:20,previewPixelRatio:6,defaultSavedImageName:y,moreSaveOptions:E,useZoomPresetsMenu:!0})]})})});h.displayName="ImageEditor";exports.default=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("./index-B0e71wJ1.cjs"),S=require("lodash-es"),c=require("lucide-react"),a=require("react"),T=require("react-filerobot-image-editor"),k=require("react-i18next"),h=a.memo(({imageUrl:l,onSave:u,onClose:m,defaultSavedImageName:y,isEditing:f=!1})=>{const{t:n}=k.useTranslation(),[v,i]=a.useState(!1),[p,I]=a.useState(!0),[w,j]=a.useState(!1);a.useEffect(()=>{const e=new Image;return e.src=l,e.onload=()=>j(!0),()=>{e.onload=null}},[l]),a.useEffect(()=>{const e=t=>{t.key==="Escape"&&p&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[]);const g=a.useMemo(()=>S.debounce(async(e,t=!1)=>{i(!0);const s=e.imageBase64;await u(s,t),I(!1),i(!1)},300),[u]),r=a.useCallback((e,t=!1)=>{g(e,t)},[g]),x=a.useCallback(()=>{I(!1),m()},[m]),d=a.useMemo(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],toolsIds:["Rotate"],defaultTabId:"Adjust",defaultToolId:"Rotate"}),[]),C=a.useMemo(()=>({colors:{primary:"#000000",secondary:"#000000",tertiary:"#000000"}}),[]),E=a.useMemo(()=>f?[{label:n("Update this file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!1)}),icon:c.Save},{label:n("Save as new file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!0)}),icon:c.Copy}]:[],[f,r,n]);return o.jsx(b.Dialog,{open:!0,onOpenChange:e=>!e&&x(),children:o.jsxs(b.DialogContent,{id:"chai-image-editor-container",className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4 p-0",children:[v&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 text-white",children:o.jsx(c.Loader,{className:"h-4 w-4 animate-spin"})}),p&&w&&o.jsx(T,{theme:C,source:l,onSave:r,onClose:x,Text:{text:n("Add text here")},Rotate:{angle:90,componentType:"slider"},tabsIds:d.tabsIds,defaultTabId:d.defaultTabId,defaultToolId:d.defaultToolId,savingPixelRatio:20,previewPixelRatio:6,defaultSavedImageName:y,moreSaveOptions:E,useZoomPresetsMenu:!0})]})})});h.displayName="ImageEditor";exports.default=h;
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as E } from "react/jsx-runtime";
2
- import { D as L, d as R } from "./index-Ct7ElCGK.js";
2
+ import { D as L, d as R } from "./index-CAhEmHYP.js";
3
3
  import { debounce as S } from "lodash-es";
4
4
  import { Save as j, Copy as D, Loader as O } from "lucide-react";
5
5
  import { memo as P, useState as m, useEffect as x, useMemo as r, useCallback as b } from "react";