@chaibuilder/sdk 4.0.0-beta.4 → 4.0.0-beta.41

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 (266) hide show
  1. package/README.md +72 -50
  2. package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-CdpXONNF.js} +3 -3
  3. package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-Dq_oq6gn.cjs} +1 -1
  4. package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-CZb0rAxI.js} +1 -1
  5. package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-Do14BULM.cjs} +1 -1
  6. package/dist/{IconPicker-B2-oriq2.js → IconPicker-CvZSjXc6.js} +2 -2
  7. package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-DUN9bxmQ.cjs} +1 -1
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-DfczfcZ8.cjs} +1 -1
  11. package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Dxa2zFdt.js} +4 -4
  12. package/dist/{actions-registery-y_ENc8zj.js → actions-registery-CMKfEXxX.js} +3397 -3202
  13. package/dist/actions-registery-CqhNZFV3.cjs +481 -0
  14. package/dist/actions.cjs +1 -1
  15. package/dist/actions.d.ts +0 -158
  16. package/dist/actions.js +3 -3
  17. package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-BREv3Xj8.js} +5 -5
  18. package/dist/{active-in-another-tab-Cu_ASKtx.cjs → active-in-another-tab-C9o276yY.cjs} +1 -1
  19. package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-C4PSVDV5.js} +4 -4
  20. package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-jHLJjrl1.cjs} +1 -1
  21. package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPPMxBYi.cjs} +1 -1
  22. package/dist/add-new-page-DomZuT16.js +31 -0
  23. package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-CsmUoTCg.js} +6 -6
  24. package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-DlS51Qef.cjs} +1 -1
  25. package/dist/ai-panel-default-lang-BRVlAMMU.js +317 -0
  26. package/dist/ai-panel-default-lang-DVKDEnbe.cjs +3 -0
  27. package/dist/ai-panel-other-lang-B-2xJz2W.cjs +1 -0
  28. package/dist/ai-panel-other-lang-BPVS6lO_.js +132 -0
  29. package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-B0FMhaLB.js} +30 -34
  30. package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-CY2pBPzO.cjs} +1 -1
  31. package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-6LlaU9LO.js} +2 -2
  32. package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-BwhKmgC3.cjs} +1 -1
  33. package/dist/apply-binding-BuwI_Uf5.cjs +41 -0
  34. package/dist/apply-binding-RQRSIe56.js +942 -0
  35. package/dist/change-password-modal-BlSTfit6.js +137 -0
  36. package/dist/change-password-modal-wbCcGfDM.cjs +1 -0
  37. package/dist/{code-display-DloSPyPr.cjs → code-display-BR-gij5j.cjs} +1 -1
  38. package/dist/{code-display-Ck81Id9K.js → code-display-DdWcOQ_i.js} +1 -1
  39. package/dist/code-editor-BC_saYAw.cjs +1 -0
  40. package/dist/code-editor-Be5VT6om.js +57 -0
  41. package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-Bs_3q1hH.cjs} +1 -1
  42. package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Z1rBUPU8.js} +3 -3
  43. package/dist/core-czmLeR0h.cjs +1 -0
  44. package/dist/core-nSRy3D7z.js +54 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +285 -103
  47. package/dist/core.js +71 -42
  48. package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-DMZRgpy0.js} +8 -8
  49. package/dist/{css-import-modal-Rh1QAVxo.cjs → css-import-modal-QaTHJ7CT.cjs} +1 -1
  50. package/dist/delete-page-BoP3I06P.js +84 -0
  51. package/dist/delete-page-CjXYHAsS.cjs +1 -0
  52. package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-DFanW2r-.js} +26 -26
  53. package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-kEPgi-3C.cjs} +1 -1
  54. package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbI7Ye34.js} +6 -6
  55. package/dist/digital-asset-manager-N8tcW28y.cjs +1 -0
  56. package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-B-4nFU4j.cjs} +1 -1
  57. package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-C6y7FdRQ.js} +7 -7
  58. package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-Cq4U-49i.cjs} +1 -1
  59. package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-DQCWphi0.js} +16 -16
  60. package/dist/fonts/bungee/Bungee-Regular.woff2 +0 -0
  61. package/dist/fonts/dm_sans/dm-sans-variable.woff2 +0 -0
  62. package/dist/fonts/geist/Geist-VariableFont_wght.ttf +0 -0
  63. package/dist/fonts/geist/Geist-VariableFont_wght.woff2 +0 -0
  64. package/dist/fonts/geist/geist-variable.woff2 +0 -0
  65. package/dist/fonts/geist-mono/GeistMono-VariableFont_wght.woff2 +0 -0
  66. package/dist/fonts/inter/inter-latin.woff2 +0 -0
  67. package/dist/fonts/inter/inter-variable.woff2 +1449 -0
  68. package/dist/fonts/lato/lato-variable.woff2 +0 -0
  69. package/dist/fonts/lavishly_yours/lavishly-yours.woff2 +11 -0
  70. package/dist/fonts/merriweather/merriweather-variable.woff2 +11 -0
  71. package/dist/fonts/montserrat/montserrat-variable.woff2 +0 -0
  72. package/dist/fonts/nunito_sans/nunito-sans-variable.woff2 +11 -0
  73. package/dist/fonts/open_sans/open-sans-variable.woff2 +0 -0
  74. package/dist/fonts/oswald/oswald-variable.woff2 +0 -0
  75. package/dist/fonts/playfair_display/playfair-display-variable.woff2 +11 -0
  76. package/dist/fonts/poppins/poppins-variable.woff2 +0 -0
  77. package/dist/fonts/raleway/raleway-variable.woff2 +0 -0
  78. package/dist/fonts/roboto/roboto-variable.woff2 +11 -0
  79. package/dist/fonts/source_sans_3/source-sans-3-variable.woff2 +11 -0
  80. package/dist/fonts/ubuntu/ubuntu-variable.woff2 +0 -0
  81. package/dist/fonts-B3UYxuJI.js +25 -0
  82. package/dist/fonts-D5fTqvSS.cjs +1 -0
  83. package/dist/{get-chai-builder-tailwind-config-BFePCEIS.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
  84. package/dist/{get-chai-builder-tailwind-config-BXf_xLHk.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +5 -5
  85. package/dist/{get-chai-builder-theme-BApShjRz.cjs → get-chai-builder-theme-B5RkBTsB.cjs} +1 -1
  86. package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
  87. package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
  88. package/dist/image-compression-UaU7Bwqe.cjs +1 -0
  89. package/dist/{image-editor-CqwaVxO2.cjs → image-editor-565A0NpE.cjs} +1 -1
  90. package/dist/{image-editor-CQnNtak2.js → image-editor-Dz_HQ0I8.js} +1 -1
  91. package/dist/index-3pEi7VzS.cjs +5 -0
  92. package/dist/index-C3CV1lXL.cjs +160 -0
  93. package/dist/index-CDVuf3C1.js +5118 -0
  94. package/dist/{index-rAcNbjk_.js → index-wBr2Ml98.js} +6152 -6102
  95. package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-CMYFM6D6.cjs} +7 -7
  96. package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-DG7a5-2B.js} +87 -85
  97. package/dist/{lang-panel-CnwTb05j.js → lang-panel-BvGiJJ8s.js} +26 -26
  98. package/dist/lang-panel-D97iJH-l.cjs +1 -0
  99. package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
  100. package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
  101. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
  102. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
  103. package/dist/library-blocks/bento/product-features/product-features.html +159 -0
  104. package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
  105. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
  106. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
  107. package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
  108. package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
  109. package/dist/library-blocks/blocks-list.json +149 -0
  110. package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
  111. package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
  112. package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
  113. package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
  114. package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
  115. package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
  116. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
  117. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
  118. package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
  119. package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
  120. package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
  121. package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
  122. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
  123. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
  124. package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
  125. package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
  126. package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
  127. package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
  128. package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
  129. package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
  130. package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
  131. package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
  132. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
  133. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
  134. package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
  135. package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
  136. package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
  137. package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
  138. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
  139. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
  140. package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
  141. package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
  142. package/dist/manage-design-tokens-4Gu6TMKZ.js +446 -0
  143. package/dist/manage-design-tokens-Do9Kptp3.cjs +1 -0
  144. package/dist/manage-design-tokens-modal-Btbdgoun.cjs +1 -0
  145. package/dist/manage-design-tokens-modal-CkyFE8NW.js +161 -0
  146. package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Djhnj93U.js} +11 -11
  147. package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-QPJ0DqxL.cjs} +1 -1
  148. package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BcmSxXxL.cjs} +1 -1
  149. package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-DkPIHcVj.js} +2 -2
  150. package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-DTq-5StU.js} +9 -9
  151. package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-ZQz4Kr0-.cjs} +1 -1
  152. package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-2rA-YBbC.js} +2 -2
  153. package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-BsLkwJID.cjs} +1 -1
  154. package/dist/{page-creator-Cc83uQqw.js → page-creator-Dzpc0_dN.js} +143 -143
  155. package/dist/page-creator-lcDUpPjh.cjs +1 -0
  156. package/dist/{page-lock-CT7SmQqp.cjs → page-lock-B2GU-1YM.cjs} +1 -1
  157. package/dist/{page-lock-BJUkyxdh.js → page-lock-ulFtdOkt.js} +2 -2
  158. package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-B9VpkvhN.js} +22 -22
  159. package/dist/page-locked-dialog-CJ53Z6sQ.cjs +1 -0
  160. package/dist/page-manager-new-CkoS0B1i.cjs +1 -0
  161. package/dist/page-manager-new-OoC8W7Yn.js +408 -0
  162. package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-BosoN3wg.cjs} +1 -1
  163. package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-JfSTGlvp.js} +30 -29
  164. package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-DsFh5itr.js} +133 -122
  165. package/dist/page-revisions-content-Dtd-t1N3.cjs +1 -0
  166. package/dist/pages.cjs +1 -1
  167. package/dist/pages.d.ts +330 -96
  168. package/dist/pages.js +23 -19
  169. package/dist/plugin-BSjgGgwo.js +248 -0
  170. package/dist/plugin-DHpuZZXz.cjs +22 -0
  171. package/dist/publish-pages-content-C7oS7pkz.cjs +1 -0
  172. package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-DJc7iu8d.js} +39 -39
  173. package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-D6GjnauV.js} +87 -87
  174. package/dist/register-chai-top-bar-DyW9GPzV.cjs +1 -0
  175. package/dist/render.cjs +2 -2
  176. package/dist/render.d.ts +20 -18
  177. package/dist/render.js +133 -132
  178. package/dist/{rte-widget-modal-BKNx2wln.cjs → rte-widget-modal-BKQaoxh9.cjs} +1 -1
  179. package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-BdBYmqgs.js} +10 -10
  180. package/dist/runtime-client.cjs +1 -0
  181. package/dist/runtime-client.d.ts +158 -0
  182. package/dist/runtime-client.js +32 -0
  183. package/dist/runtime.cjs +11 -1
  184. package/dist/runtime.d.ts +153 -270
  185. package/dist/runtime.js +107 -71
  186. package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-5nwSdZ9R.js} +153 -147
  187. package/dist/save-to-lib-D0WdH4lq.cjs +1 -0
  188. package/dist/sdk.css +1 -1
  189. package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-D8ROZHHv.js} +12 -12
  190. package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-DjYeUPdU.cjs} +1 -1
  191. package/dist/{seo-panel-BkOgRoWd.js → seo-panel-BbyRNAEo.js} +27 -27
  192. package/dist/seo-panel-DRjSxmk5.cjs +2 -0
  193. package/dist/shared-json-ld-BbNLdzCO.cjs +1 -0
  194. package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-EPbpTI9V.js} +88 -88
  195. package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-CIzxXknM.cjs} +1 -1
  196. package/dist/{slug-input-DHLmUNrH.js → slug-input-DSbJecNr.js} +8 -8
  197. package/dist/supabase-actions.cjs +1 -1
  198. package/dist/supabase-actions.d.ts +45 -0
  199. package/dist/supabase-actions.js +380 -275
  200. package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-BOGDk0H4.js} +13 -13
  201. package/dist/take-over-request-BXntCMdj.cjs +1 -0
  202. package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-DhJaOyLo.cjs} +1 -1
  203. package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-reVr0L9e.js} +9 -9
  204. package/dist/types.cjs +1 -0
  205. package/dist/types.d.ts +756 -0
  206. package/dist/types.js +1 -0
  207. package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-BM85Y7WK.js} +11 -11
  208. package/dist/{unmark-as-template-DF1Ms4VN.cjs → unmark-as-template-DOPyeU7R.cjs} +1 -1
  209. package/dist/unpublish-page-DHfds-1-.js +28 -0
  210. package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-Dz028Bzp.cjs} +1 -1
  211. package/dist/unpublished-partials-modal-BO5ZZdTw.js +52 -0
  212. package/dist/unpublished-partials-modal-CMqQa9-m.cjs +1 -0
  213. package/dist/utils.cjs +1 -1
  214. package/dist/utils.d.ts +6 -6
  215. package/dist/utils.js +2 -2
  216. package/dist/web-blocks.cjs +1 -1
  217. package/dist/web-blocks.js +360 -351
  218. package/dist/{web-preview-kres0aG7.cjs → web-preview-5MzixBt5.cjs} +1 -1
  219. package/dist/{web-preview-D6h1L2nV.js → web-preview-BNjG8s8A.js} +2 -2
  220. package/package.json +34 -35
  221. package/dist/actions-registery-JdxhXhT6.cjs +0 -418
  222. package/dist/add-new-page-DJLJFLAd.js +0 -31
  223. package/dist/ai-panel-default-lang-BZl0tPYo.js +0 -341
  224. package/dist/ai-panel-default-lang-D2zhXvKP.cjs +0 -3
  225. package/dist/ai-panel-other-lang-Bfjk2CYZ.js +0 -162
  226. package/dist/ai-panel-other-lang-Y4bEKHoG.cjs +0 -1
  227. package/dist/apply-binding-BvWfJCSZ.js +0 -841
  228. package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
  229. package/dist/code-editor-Bb7JumZy.js +0 -51
  230. package/dist/code-editor-DQB8lAOk.cjs +0 -1
  231. package/dist/core-Dr7QYemB.js +0 -56
  232. package/dist/core-Y0lXLwkq.cjs +0 -1
  233. package/dist/delete-design-token-BG8yHcS5.cjs +0 -1
  234. package/dist/delete-design-token-COvR4G1S.js +0 -40
  235. package/dist/delete-page-CNucxe4P.js +0 -71
  236. package/dist/delete-page-DAvEjHwF.cjs +0 -1
  237. package/dist/digital-asset-manager-CB5MRBcW.cjs +0 -1
  238. package/dist/fonts/GeistMonoVF.woff +0 -0
  239. package/dist/fonts/GeistVF.woff +0 -0
  240. package/dist/fonts-B-Xt29pe.cjs +0 -1
  241. package/dist/fonts-DRly3Wzd.js +0 -78
  242. package/dist/image-compression-DZ9WMmyn.cjs +0 -1
  243. package/dist/index-B-rSiAp_.cjs +0 -1
  244. package/dist/index-C0-pgg_p.cjs +0 -5
  245. package/dist/index-C99FhuF1.cjs +0 -160
  246. package/dist/index-Dno42B0a.js +0 -4734
  247. package/dist/index-Dxfyt4d4.js +0 -39
  248. package/dist/lang-panel-fDCYm5Jm.cjs +0 -1
  249. package/dist/manage-design-tokens-BsSZE9Vs.js +0 -241
  250. package/dist/manage-design-tokens-BvH5KTJX.cjs +0 -1
  251. package/dist/page-creator-g8GqgcKH.cjs +0 -1
  252. package/dist/page-locked-dialog-Co5b9XIZ.cjs +0 -1
  253. package/dist/page-manager-new-5rFP5DyQ.js +0 -395
  254. package/dist/page-manager-new-BOkJImo2.cjs +0 -1
  255. package/dist/page-revisions-content-ag-MHBGr.cjs +0 -1
  256. package/dist/plugin-BGlQf0iy.cjs +0 -22
  257. package/dist/plugin-C-ht41UZ.js +0 -245
  258. package/dist/publish-pages-content-BiX-GMLw.cjs +0 -1
  259. package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
  260. package/dist/save-to-lib-ffjCZYJ5.cjs +0 -1
  261. package/dist/seo-panel-FjS1UF_y.cjs +0 -2
  262. package/dist/shared-json-ld-yJkXjENy.cjs +0 -1
  263. package/dist/take-over-request-CmpJVe9T.cjs +0 -1
  264. package/dist/theme-panel-footer-BUXIu252.js +0 -26
  265. package/dist/theme-panel-footer-CKO9YYwZ.cjs +0 -1
  266. package/dist/unpublish-page-BJ0Bsvt2.js +0 -28
@@ -1,16 +1,17 @@
1
1
  import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import { B as b, z as L } from "./register-chai-top-bar-ESJHs5s-.js";
3
- import { c as j, a6 as se, a7 as ie, P as oe, az as le, ai as ce, aA as de, L as P } from "./index-rAcNbjk_.js";
4
- import { ar as D, as as G, A as _, ay as ue } from "./index-Dno42B0a.js";
5
- import { useQuery as K, useMutation as U, useQueryClient as me } from "@tanstack/react-query";
2
+ import { B as b, z as L } from "./register-chai-top-bar-D6GjnauV.js";
3
+ import { aF as ne, c as M, X as ie, Y as oe, P as le, aG as ce, ax as de, aH as ue, p as P } from "./index-wBr2Ml98.js";
4
+ import { ap as D, aq as G, A as _, aw as me } from "./index-CDVuf3C1.js";
5
+ import { useQuery as K, useMutation as A, useQueryClient as pe } from "@tanstack/react-query";
6
+ import { useSetAtom as fe } from "jotai";
6
7
  import { toast as N } from "sonner";
7
- import { Trash2 as Y, Plus as pe, ImageIcon as fe, X as he, AlertCircle as ge } from "lucide-react";
8
- import { useState as h, useRef as V, useMemo as S, useEffect as w, useCallback as be } from "react";
9
- import { c as ve } from "./image-compression-DsZ1oqpb.js";
10
- import { isEmpty as ye, set as ke, has as Ne } from "lodash-es";
11
- const Be = (r) => {
8
+ import { Trash2 as Y, Plus as he, ImageIcon as ge, X as be, AlertCircle as ye } from "lucide-react";
9
+ import { useState as h, useRef as V, useMemo as S, useEffect as I, useCallback as ke } from "react";
10
+ import { c as ve } from "./image-compression-DPFITwOL.js";
11
+ import { isEmpty as Ne, set as Be, has as Ce } from "lodash-es";
12
+ const we = (r) => {
12
13
  const a = D(), o = G();
13
- return U({
14
+ return A({
14
15
  mutationFn: async (t) => o(a, {
15
16
  action: _.UPSERT_LIBRARY_ITEM,
16
17
  data: t
@@ -24,7 +25,7 @@ const Be = (r) => {
24
25
  });
25
26
  }
26
27
  });
27
- }, Ce = (r) => {
28
+ }, Ie = (r) => {
28
29
  const a = D(), o = G();
29
30
  return K({
30
31
  staleTime: "static",
@@ -44,40 +45,45 @@ const Be = (r) => {
44
45
  },
45
46
  retry: !1
46
47
  });
47
- }, Ie = (r) => {
48
- const a = D(), o = G();
49
- return U({
50
- mutationFn: async (t) => o(a, {
48
+ }, Ee = (r) => {
49
+ const a = D(), o = G(), t = fe(ne);
50
+ return A({
51
+ mutationFn: async (l) => o(a, {
51
52
  action: _.DELETE_LIBRARY_ITEM,
52
- data: { id: t }
53
+ data: { id: l }
53
54
  }),
54
55
  onSuccess: () => {
55
- r ? r() : N.success("Block deleted successfully");
56
+ t((l) => {
57
+ const m = { ...l };
58
+ return Object.keys(m).forEach((u) => {
59
+ m[u] = { loading: "idle", blocks: [], error: !1 };
60
+ }), m;
61
+ }), r ? r() : N.success("Block deleted successfully");
56
62
  },
57
- onError: (t) => {
58
- console.error("Error deleting block:", t), N.error("Failed to delete block", {
59
- description: t instanceof Error ? t.message : "Unknown error"
63
+ onError: (l) => {
64
+ console.error("Error deleting block:", l), N.error("Failed to delete block", {
65
+ description: l instanceof Error ? l.message : "Unknown error"
60
66
  });
61
67
  }
62
68
  });
63
- }, we = ({
69
+ }, xe = ({
64
70
  blockId: r,
65
71
  libBlockId: a,
66
72
  isOpen: o,
67
73
  onClose: t,
68
- blockName: u,
69
- trigger: p
74
+ blockName: l,
75
+ trigger: m
70
76
  }) => {
71
- const [d, l] = h(!1), c = j(), v = Ie(() => {
72
- c([r], { _libBlockId: void 0 }), N.success("Block deleted successfully"), l(!1), t();
77
+ const [u, c] = h(!1), d = M(), y = Ee(() => {
78
+ d([r], { _libBlockId: void 0 }), N.success("Block deleted successfully"), c(!1), t();
73
79
  });
74
- return /* @__PURE__ */ i(se, { open: o, onOpenChange: (m) => !m && t(), children: [
75
- /* @__PURE__ */ e(ie, { asChild: !0, children: p || /* @__PURE__ */ i(b, { type: "button", variant: "destructive", size: "sm", onClick: (m) => m.preventDefault(), disabled: d, children: [
80
+ return /* @__PURE__ */ i(ie, { open: o, onOpenChange: (p) => !p && t(), children: [
81
+ /* @__PURE__ */ e(oe, { asChild: !0, children: m || /* @__PURE__ */ i(b, { type: "button", variant: "destructive", size: "sm", onClick: (p) => p.preventDefault(), disabled: u, children: [
76
82
  /* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4" }),
77
83
  "Delete"
78
84
  ] }) }),
79
85
  /* @__PURE__ */ e(
80
- oe,
86
+ le,
81
87
  {
82
88
  className: "z-[9999] w-72 p-4",
83
89
  sideOffset: 5,
@@ -88,39 +94,39 @@ const Be = (r) => {
88
94
  "Are you sure you want to delete the block",
89
95
  /* @__PURE__ */ i("span", { className: "font-medium", children: [
90
96
  ' "',
91
- u,
97
+ l,
92
98
  '"'
93
99
  ] }),
94
100
  "?"
95
101
  ] }),
96
102
  /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "This block will be permanently removed from the library. This action cannot be undone." }),
97
103
  /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-2", children: [
98
- /* @__PURE__ */ e(b, { type: "button", variant: "outline", size: "sm", onClick: t, disabled: d, children: "Cancel" }),
104
+ /* @__PURE__ */ e(b, { type: "button", variant: "outline", size: "sm", onClick: t, disabled: u, children: "Cancel" }),
99
105
  /* @__PURE__ */ e(b, { type: "button", variant: "destructive", size: "sm", onClick: () => {
100
- l(!0), v.mutate(a);
101
- }, disabled: d, children: d ? "Deleting..." : "Delete" })
106
+ c(!0), y.mutate(a);
107
+ }, disabled: u, children: u ? "Deleting..." : "Delete" })
102
108
  ] })
103
109
  ] })
104
110
  }
105
111
  )
106
112
  ] });
107
- }, Ee = ({
113
+ }, Pe = ({
108
114
  blockId: r,
109
115
  libBlockId: a,
110
116
  blockName: o,
111
117
  size: t = "sm",
112
- className: u = "",
113
- close: p
118
+ className: l = "",
119
+ close: m
114
120
  }) => {
115
- const [d, l] = h(!1);
121
+ const [u, c] = h(!1);
116
122
  return /* @__PURE__ */ e(
117
- we,
123
+ xe,
118
124
  {
119
125
  blockId: r,
120
126
  libBlockId: a,
121
- isOpen: d,
127
+ isOpen: u,
122
128
  onClose: () => {
123
- l(!1), p();
129
+ c(!1), m();
124
130
  },
125
131
  blockName: o,
126
132
  trigger: /* @__PURE__ */ i(
@@ -129,8 +135,8 @@ const Be = (r) => {
129
135
  type: "button",
130
136
  variant: "destructive",
131
137
  size: t,
132
- className: u,
133
- onClick: () => l(!0),
138
+ className: l,
139
+ onClick: () => c(!0),
134
140
  children: [
135
141
  /* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4" }),
136
142
  "Delete"
@@ -139,11 +145,11 @@ const Be = (r) => {
139
145
  )
140
146
  }
141
147
  );
142
- }, xe = () => {
143
- const r = D(), a = G(), o = me(), {
148
+ }, Le = () => {
149
+ const r = D(), a = G(), o = pe(), {
144
150
  data: t = [],
145
- isLoading: u,
146
- error: p
151
+ isLoading: l,
152
+ error: m
147
153
  } = K({
148
154
  queryKey: ["library-groups"],
149
155
  staleTime: "static",
@@ -153,17 +159,17 @@ const Be = (r) => {
153
159
  return await a(r, {
154
160
  action: "GET_LIBRARY_GROUPS"
155
161
  }) || [];
156
- } catch (c) {
157
- return console.error("Error fetching library groups:", c), [];
162
+ } catch (d) {
163
+ return console.error("Error fetching library groups:", d), [];
158
164
  }
159
165
  }
160
- }), { mutateAsync: d, isPending: l } = U({
161
- mutationFn: async (c) => {
162
- if (!c.trim())
166
+ }), { mutateAsync: u, isPending: c } = A({
167
+ mutationFn: async (d) => {
168
+ if (!d.trim())
163
169
  throw new Error("Group name is required");
164
170
  return a(r, {
165
171
  action: "CREATE_BLOCK_GROUP",
166
- data: { name: c }
172
+ data: { name: d }
167
173
  });
168
174
  },
169
175
  onSuccess: () => {
@@ -171,21 +177,21 @@ const Be = (r) => {
171
177
  queryKey: ["library-groups"]
172
178
  }), N.success("Group created successfully");
173
179
  },
174
- onError: (c) => {
175
- console.error("Error creating group:", c), N.error("Failed to create group", {
176
- description: c instanceof Error ? c.message : "Unknown error"
180
+ onError: (d) => {
181
+ console.error("Error creating group:", d), N.error("Failed to create group", {
182
+ description: d instanceof Error ? d.message : "Unknown error"
177
183
  });
178
184
  }
179
185
  });
180
186
  return {
181
187
  groups: t,
182
- isLoading: u,
183
- error: p,
184
- createGroup: d,
185
- isCreating: l
188
+ isLoading: l,
189
+ error: m,
190
+ createGroup: u,
191
+ isCreating: c
186
192
  };
187
- }, Pe = ({ value: r, onChange: a }) => {
188
- const [o, t] = h(!1), [u, p] = h(""), d = V(null), { groups: l } = xe(), [c, v] = h([
193
+ }, _e = ({ value: r, onChange: a }) => {
194
+ const [o, t] = h(!1), [l, m] = h(""), u = V(null), { groups: c } = Le(), [d, y] = h([
189
195
  { id: "hero", name: "Hero" },
190
196
  { id: "feature", name: "Feature" },
191
197
  { id: "footer", name: "Footer" },
@@ -215,33 +221,33 @@ const Be = (r) => {
215
221
  { id: "timeline", name: "Timeline" }
216
222
  ]), f = S(
217
223
  () => [
218
- ...l,
219
- ...c.filter((n) => !l.some((B) => B.id === n.id))
224
+ ...c,
225
+ ...d.filter((s) => !c.some((B) => B.id === s.id))
220
226
  ],
221
- [l, c]
227
+ [c, d]
222
228
  ), g = () => {
223
- const n = u.trim();
224
- if (!n) return;
225
- const B = { id: n, name: n };
226
- v((E) => [...E, B]), a(B.id), p(""), t(!1);
229
+ const s = l.trim();
230
+ if (!s) return;
231
+ const B = { id: s, name: s };
232
+ y((E) => [...E, B]), a(B.id), m(""), t(!1);
227
233
  };
228
- w(() => {
229
- o && d.current && d.current.focus();
234
+ I(() => {
235
+ o && u.current && u.current.focus();
230
236
  }, [o]);
231
- const m = (n) => {
232
- n.key === "Enter" && (n.preventDefault(), g());
237
+ const p = (s) => {
238
+ s.key === "Enter" && (s.preventDefault(), g());
233
239
  };
234
- return w(() => {
235
- r && !f.some((n) => n.id === r) && a("");
240
+ return I(() => {
241
+ r && !f.some((s) => s.id === r) && a("");
236
242
  }, [r, f, a]), o ? /* @__PURE__ */ i("div", { className: "space-y-2", children: [
237
243
  /* @__PURE__ */ e(
238
244
  L,
239
245
  {
240
- ref: d,
246
+ ref: u,
241
247
  placeholder: "Enter new group name",
242
- value: u,
243
- onChange: (n) => p(n.target.value),
244
- onKeyDown: m
248
+ value: l,
249
+ onChange: (s) => m(s.target.value),
250
+ onKeyDown: p
245
251
  }
246
252
  ),
247
253
  /* @__PURE__ */ i("div", { className: "flex justify-end gap-2", children: [
@@ -254,30 +260,30 @@ const Be = (r) => {
254
260
  {
255
261
  className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
256
262
  value: r,
257
- onChange: (n) => a(n.target.value),
263
+ onChange: (s) => a(s.target.value),
258
264
  children: [
259
265
  /* @__PURE__ */ e("option", { value: "", children: "Select a group" }),
260
- l.length > 0 && /* @__PURE__ */ e("optgroup", { label: "Library Groups", children: l.map((n) => /* @__PURE__ */ e("option", { value: n.id, children: n.name }, `lib-${n.id}`)) }),
261
- c.length > 0 && /* @__PURE__ */ e("optgroup", { label: "Predefined Groups", children: c.filter((n) => !l.some((B) => B.id === n.id)).map((n) => /* @__PURE__ */ e("option", { value: n.id, children: n.name }, `local-${n.id}`)) })
266
+ c.length > 0 && /* @__PURE__ */ e("optgroup", { label: "Library Groups", children: c.map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.name }, `lib-${s.id}`)) }),
267
+ d.length > 0 && /* @__PURE__ */ e("optgroup", { label: "Predefined Groups", children: d.filter((s) => !c.some((B) => B.id === s.id)).map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.name }, `local-${s.id}`)) })
262
268
  ]
263
269
  }
264
270
  ),
265
- /* @__PURE__ */ e(b, { type: "button", size: "icon", variant: "outline", onClick: () => t(!0), children: /* @__PURE__ */ e(pe, { className: "h-4 w-4" }) })
271
+ /* @__PURE__ */ e(b, { type: "button", size: "icon", variant: "outline", onClick: () => t(!0), children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) })
266
272
  ] });
267
- }, Le = ({ value: r, onChange: a }) => {
268
- const [o, t] = h(!1), u = V(null), p = be(
269
- async (c) => {
273
+ }, De = ({ value: r, onChange: a }) => {
274
+ const [o, t] = h(!1), l = V(null), m = ke(
275
+ async (d) => {
270
276
  var f;
271
- const v = (f = c.target.files) == null ? void 0 : f[0];
272
- if (v)
277
+ const y = (f = d.target.files) == null ? void 0 : f[0];
278
+ if (y)
273
279
  try {
274
280
  t(!0);
275
- let g = v;
276
- v.type.startsWith("image/") && (g = await ve(v));
277
- const m = new FileReader();
278
- m.onloadend = () => {
279
- a(m.result), t(!1);
280
- }, m.readAsDataURL(g);
281
+ let g = y;
282
+ y.type.startsWith("image/") && (g = await ve(y));
283
+ const p = new FileReader();
284
+ p.onloadend = () => {
285
+ a(p.result), t(!1);
286
+ }, p.readAsDataURL(g);
281
287
  } catch (g) {
282
288
  console.error("Error reading file:", g), t(!1), N.error("Failed to process image", {
283
289
  description: g instanceof Error ? g.message : "Unknown error"
@@ -288,68 +294,68 @@ const Be = (r) => {
288
294
  );
289
295
  return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
290
296
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
291
- /* @__PURE__ */ e(L, { type: "file", ref: u, onChange: p, accept: "image/*", className: "hidden" }),
297
+ /* @__PURE__ */ e(L, { type: "file", ref: l, onChange: m, accept: "image/*", className: "hidden" }),
292
298
  /* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: () => {
293
- var c;
294
- (c = u.current) == null || c.click();
299
+ var d;
300
+ (d = l.current) == null || d.click();
295
301
  }, disabled: o, className: "w-full", children: o ? /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
296
302
  /* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
297
303
  "Uploading..."
298
304
  ] }) : /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
299
- /* @__PURE__ */ e(fe, { className: "h-4 w-4" }),
305
+ /* @__PURE__ */ e(ge, { className: "h-4 w-4" }),
300
306
  "Select image"
301
307
  ] }) }),
302
308
  r && /* @__PURE__ */ e(b, { type: "button", variant: "outline", size: "icon", onClick: () => {
303
- a(""), u.current && (u.current.value = "");
304
- }, children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) })
309
+ a(""), l.current && (l.current.value = "");
310
+ }, children: /* @__PURE__ */ e(be, { className: "h-4 w-4" }) })
305
311
  ] }),
306
312
  r && /* @__PURE__ */ e("div", { className: "aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border", children: /* @__PURE__ */ e("img", { src: r, alt: "Preview", className: "h-full w-full object-contain" }) })
307
313
  ] });
308
- }, ze = (r) => {
309
- const { blocks: a, close: o, blockId: t } = r, { getPartailBlocks: u } = le(), p = a.find((s) => s._id === t), d = p == null ? void 0 : p._libBlockId, l = !!d, c = S(() => a.some((s) => s._type === "PartialBlock" || s._type === "GlobalBlock"), [a]), v = S(() => {
310
- let s = [];
311
- for (const y of a)
312
- if (y._type === "PartialBlock" || y._type === "GlobalBlock") {
313
- let k = u(y.partialBlockId);
314
- y._parent && (k == null ? void 0 : k.length) > 0 && (k = k.map((R) => (ye(R._parent) && ke(R, "_parent", y._parent), R))), s = [...s, ...k];
314
+ }, Me = (r) => {
315
+ const { blocks: a, close: o, blockId: t } = r, { getPartialBlocks: l } = ce(), m = a.find((n) => n._id === t), u = m == null ? void 0 : m._libBlockId, c = !!u, d = S(() => a.some((n) => n._type === "PartialBlock" || n._type === "GlobalBlock"), [a]), y = S(() => {
316
+ let n = [];
317
+ for (const k of a)
318
+ if (k._type === "PartialBlock" || k._type === "GlobalBlock") {
319
+ let v = l(k.partialBlockId);
320
+ k._parent && (v == null ? void 0 : v.length) > 0 && (v = v.map((R) => (Ne(R._parent) && Be(R, "_parent", k._parent), R))), n = [...n, ...v];
315
321
  } else
316
- s.push(y);
317
- return s;
318
- }, [a, u]), [f, g] = h(""), [m, n] = h(""), [B, E] = h(""), [x, A] = h(""), [C, W] = h({}), [Q, $] = h(!1), [H, q] = h(l), [X, J] = h(!1), { hasPermission: Z } = ce(), ee = Z(ue.DELETE_LIBRARY_BLOCK), z = j(), te = () => {
319
- z([t], { _libBlockId: void 0 }), N.success("Block delinked from library"), o();
322
+ n.push(k);
323
+ return n;
324
+ }, [a, l]), [f, g] = h(""), [p, s] = h(""), [B, E] = h(""), [x, U] = h(""), [C, W] = h({}), [Q, $] = h(!1), [H, q] = h(c), [X, J] = h(!1), { hasPermission: Z } = de(), ee = Z(me.DELETE_LIBRARY_BLOCK), O = M(), te = () => {
325
+ O([t], { _libBlockId: void 0 }), N.success("Block delinked from library"), o();
320
326
  }, {
321
- data: I,
322
- isLoading: T,
323
- isError: M
324
- } = Ce(d);
325
- w(() => {
326
- M && l && (J(!0), q(!1));
327
- }, [M, l]), w(() => {
328
- I && !T && (g(I.name || ""), n(I.group || ""), E(I.description || ""), A(I.preview || ""), q(!1));
329
- }, [I, T]), w(() => {
330
- const s = f.trim().length >= 2, y = m.trim() !== "";
331
- $(s && y);
332
- }, [f, m]);
327
+ data: w,
328
+ isLoading: F,
329
+ isError: j
330
+ } = Ie(u);
331
+ I(() => {
332
+ j && c && (J(!0), q(!1));
333
+ }, [j, c]), I(() => {
334
+ w && !F && (g(w.name || ""), s(w.group || ""), E(w.description || ""), U(w.preview || ""), q(!1));
335
+ }, [w, F]), I(() => {
336
+ const n = f.trim().length >= 2, k = p.trim() !== "";
337
+ $(n && k);
338
+ }, [f, p]);
333
339
  const re = () => {
334
- const s = {};
335
- return f.trim() ? f.length < 2 && (s.name = "Name must be at least 2 characters") : s.name = "Name is required", m || (s.group = "Group is required"), W(s), Object.keys(s).length === 0;
336
- }, { resetLibrary: ae } = de({ id: "" }), O = Be((s) => {
337
- l || z([t], { _libBlockId: s.id }), N.success(`Block ${l ? "updated" : "saved"} successfully`), ae(s.library), o();
338
- }), ne = async (s) => {
339
- if (s.preventDefault(), !re()) return;
340
- const y = v.map((k) => (Ne(k, "_libBlockId") && delete k._libBlockId, k));
341
- O.mutate({
340
+ const n = {};
341
+ return f.trim() ? f.length < 2 && (n.name = "Name must be at least 2 characters") : n.name = "Name is required", p || (n.group = "Group is required"), W(n), Object.keys(n).length === 0;
342
+ }, { resetLibrary: ae } = ue({ id: "" }), z = we((n) => {
343
+ c || O([t], { _libBlockId: n.id }), N.success(`Block ${c ? "updated" : "saved"} successfully`), ae(n.library), o();
344
+ }), se = async (n) => {
345
+ if (n.preventDefault(), !re()) return;
346
+ const k = y.map((v) => (Ce(v, "_libBlockId") && delete v._libBlockId, v));
347
+ z.mutate({
342
348
  name: f.trim(),
343
- group: m,
344
- blocks: y,
349
+ group: p,
350
+ blocks: k,
345
351
  description: B.trim(),
346
352
  // Only include previewImage if it exists and is a base64 image
347
353
  ...x && x.startsWith("data:") ? { previewImage: x } : {},
348
354
  // Include id if in edit mode
349
- ...l ? { id: d } : {}
355
+ ...c ? { id: u } : {}
350
356
  });
351
- }, F = O.isPending;
352
- return H || T ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }) }) : X ? /* @__PURE__ */ i("div", { className: "space-y-4 p-6", children: [
357
+ }, T = z.isPending;
358
+ return H || F ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }) }) : X ? /* @__PURE__ */ i("div", { className: "space-y-4 p-6", children: [
353
359
  /* @__PURE__ */ e("div", { className: "font-medium text-destructive", children: "Block Not Found" }),
354
360
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This block could not be found on the server. It may have been deleted." }),
355
361
  /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-4", children: [
@@ -357,14 +363,14 @@ const Be = (r) => {
357
363
  /* @__PURE__ */ e(b, { onClick: te, variant: "destructive", children: "Delink Block" })
358
364
  ] })
359
365
  ] }) : /* @__PURE__ */ i("div", { children: [
360
- c && /* @__PURE__ */ i("div", { className: "mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive", children: [
361
- /* @__PURE__ */ e(ge, { className: "mt-0.5 h-5 w-5 flex-shrink-0" }),
366
+ d && /* @__PURE__ */ i("div", { className: "mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive", children: [
367
+ /* @__PURE__ */ e(ye, { className: "mt-0.5 h-5 w-5 flex-shrink-0" }),
362
368
  /* @__PURE__ */ i("div", { children: [
363
369
  /* @__PURE__ */ e("p", { className: "font-medium", children: "Partial Blocks Detected" }),
364
370
  /* @__PURE__ */ e("p", { className: "mt-1 text-xs", children: "This block contains one or more Partial Blocks. Partial blocks will be merged into the library block" })
365
371
  ] })
366
372
  ] }),
367
- /* @__PURE__ */ i("form", { onSubmit: ne, className: "space-y-4", children: [
373
+ /* @__PURE__ */ i("form", { onSubmit: se, className: "space-y-4", children: [
368
374
  /* @__PURE__ */ i("div", { className: "space-y-2", children: [
369
375
  /* @__PURE__ */ e(P, { htmlFor: "name", className: C.name ? "text-destructive" : "", children: "Name" }),
370
376
  /* @__PURE__ */ e(
@@ -373,7 +379,7 @@ const Be = (r) => {
373
379
  id: "name",
374
380
  placeholder: "Enter block name",
375
381
  value: f,
376
- onChange: (s) => g(s.target.value),
382
+ onChange: (n) => g(n.target.value),
377
383
  className: C.name ? "border-destructive" : ""
378
384
  }
379
385
  ),
@@ -381,7 +387,7 @@ const Be = (r) => {
381
387
  ] }),
382
388
  /* @__PURE__ */ i("div", { className: "space-y-2", children: [
383
389
  /* @__PURE__ */ e(P, { htmlFor: "group", className: C.group ? "text-destructive" : "", children: "Group" }),
384
- /* @__PURE__ */ e(Pe, { value: m, onChange: n }),
390
+ /* @__PURE__ */ e(_e, { value: p, onChange: s }),
385
391
  C.group && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: C.group })
386
392
  ] }),
387
393
  /* @__PURE__ */ i("div", { className: "space-y-2", children: [
@@ -393,31 +399,31 @@ const Be = (r) => {
393
399
  placeholder: "Enter a brief description",
394
400
  className: "resize-none",
395
401
  value: B,
396
- onChange: (s) => E(s.target.value)
402
+ onChange: (n) => E(n.target.value)
397
403
  }
398
404
  )
399
405
  ] }),
400
406
  /* @__PURE__ */ i("div", { className: "space-y-2", children: [
401
407
  /* @__PURE__ */ e(P, { htmlFor: "previewImage", children: "Preview Image (optional)" }),
402
- /* @__PURE__ */ e(Le, { value: x, onChange: A })
408
+ /* @__PURE__ */ e(De, { value: x, onChange: U })
403
409
  ] }),
404
410
  /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-2", children: [
405
- l && ee && /* @__PURE__ */ e(
406
- Ee,
411
+ c && ee && /* @__PURE__ */ e(
412
+ Pe,
407
413
  {
408
414
  blockId: t,
409
- libBlockId: d,
415
+ libBlockId: u,
410
416
  blockName: f,
411
417
  className: "mr-auto",
412
418
  close: o
413
419
  }
414
420
  ),
415
- /* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: o, disabled: F, children: "Cancel" }),
416
- /* @__PURE__ */ e(b, { type: "submit", disabled: F || !Q, children: F ? "Saving..." : l ? "Update Block" : "Save Block" })
421
+ /* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: o, disabled: T, children: "Cancel" }),
422
+ /* @__PURE__ */ e(b, { type: "submit", disabled: T || !Q, children: T ? "Saving..." : c ? "Update Block" : "Save Block" })
417
423
  ] })
418
424
  ] })
419
425
  ] });
420
426
  };
421
427
  export {
422
- ze as default
428
+ Me as default
423
429
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./register-chai-top-bar-DyW9GPzV.cjs"),x=require("./index-C3CV1lXL.cjs"),b=require("./index-3pEi7VzS.cjs"),C=require("@tanstack/react-query"),X=require("jotai"),j=require("sonner"),E=require("lucide-react"),i=require("react"),J=require("./image-compression-UaU7Bwqe.cjs"),R=require("lodash-es"),Z=s=>{const r=b.useApiUrl(),l=b.useFetch();return C.useMutation({mutationFn:async t=>l(r,{action:b.ACTIONS.UPSERT_LIBRARY_ITEM,data:t}),onSuccess:t=>{s?s(t):j.toast.success("Block saved successfully")},onError:t=>{console.error("Error saving block:",t),j.toast.error("Failed to save block",{description:t instanceof Error?t.message:"Unknown error"})}})},ee=s=>{const r=b.useApiUrl(),l=b.useFetch();return C.useQuery({staleTime:"static",queryKey:[b.ACTIONS.GET_LIBRARY_ITEM,s],enabled:!!s,queryFn:async()=>{if(!s)return null;try{return await l(r,{action:b.ACTIONS.GET_LIBRARY_ITEM,data:{id:s}})}catch(t){throw console.error(t),new Error("The block could not be found on the server. It may have been deleted.")}},retry:!1})},te=s=>{const r=b.useApiUrl(),l=b.useFetch(),t=X.useSetAtom(x.libraryBlocksAtom);return C.useMutation({mutationFn:async c=>l(r,{action:b.ACTIONS.DELETE_LIBRARY_ITEM,data:{id:c}}),onSuccess:()=>{t(c=>{const m={...c};return Object.keys(m).forEach(u=>{m[u]={loading:"idle",blocks:[],error:!1}}),m}),s?s():j.toast.success("Block deleted successfully")},onError:c=>{console.error("Error deleting block:",c),j.toast.error("Failed to delete block",{description:c instanceof Error?c.message:"Unknown error"})}})},se=({blockId:s,libBlockId:r,isOpen:l,onClose:t,blockName:c,trigger:m})=>{const[u,o]=i.useState(!1),d=x.useUpdateBlocksPropsRealtime(),y=te(()=>{d([s],{_libBlockId:void 0}),j.toast.success("Block deleted successfully"),o(!1),t()}),h=()=>{o(!0),y.mutate(r)},g=e.jsxs(p.Button,{type:"button",variant:"destructive",size:"sm",onClick:f=>f.preventDefault(),disabled:u,children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]});return e.jsxs(x.Popover,{open:l,onOpenChange:f=>!f&&t(),children:[e.jsx(x.PopoverTrigger,{asChild:!0,children:m||g}),e.jsx(x.PopoverContent,{className:"z-[9999] w-72 p-4",sideOffset:5,align:"center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Delete Block"}),e.jsxs("p",{className:"text-sm",children:["Are you sure you want to delete the block",e.jsxs("span",{className:"font-medium",children:[' "',c,'"']}),"?"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This block will be permanently removed from the library. This action cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(p.Button,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:u,children:"Cancel"}),e.jsx(p.Button,{type:"button",variant:"destructive",size:"sm",onClick:h,disabled:u,children:u?"Deleting...":"Delete"})]})]})})]})},re=({blockId:s,libBlockId:r,blockName:l,size:t="sm",className:c="",close:m})=>{const[u,o]=i.useState(!1);return e.jsx(se,{blockId:s,libBlockId:r,isOpen:u,onClose:()=>{o(!1),m()},blockName:l,trigger:e.jsxs(p.Button,{type:"button",variant:"destructive",size:t,className:c,onClick:()=>o(!0),children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]})})},ne=()=>{const s=b.useApiUrl(),r=b.useFetch(),l=C.useQueryClient(),{data:t=[],isLoading:c,error:m}=C.useQuery({queryKey:["library-groups"],staleTime:"static",placeholderData:[],queryFn:async()=>{try{return await r(s,{action:"GET_LIBRARY_GROUPS"})||[]}catch(d){return console.error("Error fetching library groups:",d),[]}}}),{mutateAsync:u,isPending:o}=C.useMutation({mutationFn:async d=>{if(!d.trim())throw new Error("Group name is required");return r(s,{action:"CREATE_BLOCK_GROUP",data:{name:d}})},onSuccess:()=>{l.invalidateQueries({queryKey:["library-groups"]}),j.toast.success("Group created successfully")},onError:d=>{console.error("Error creating group:",d),j.toast.error("Failed to create group",{description:d instanceof Error?d.message:"Unknown error"})}});return{groups:t,isLoading:c,error:m,createGroup:u,isCreating:o}},ae=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),[c,m]=i.useState(""),u=i.useRef(null),{groups:o}=ne(),[d,y]=i.useState([{id:"hero",name:"Hero"},{id:"feature",name:"Feature"},{id:"footer",name:"Footer"},{id:"content",name:"Content"},{id:"testimonial",name:"Testimonial"},{id:"pricing",name:"Pricing"},{id:"login",name:"Login"},{id:"logos",name:"Logos"},{id:"about",name:"About"},{id:"banner",name:"Banner"},{id:"blog",name:"Blog"},{id:"careers",name:"Careers"},{id:"casestudy",name:"Casestudy"},{id:"changelog",name:"Changelog"},{id:"compare",name:"Compare"},{id:"contact",name:"Contact"},{id:"cta",name:"Cta"},{id:"faq",name:"Faq"},{id:"gallery",name:"Gallery"},{id:"integration",name:"Integration"},{id:"list",name:"List"},{id:"navbar",name:"Navbar"},{id:"product",name:"Product"},{id:"signup",name:"Signup"},{id:"stats",name:"Stats"},{id:"team",name:"Team"},{id:"timeline",name:"Timeline"}]),h=i.useMemo(()=>[...o,...d.filter(n=>!o.some(B=>B.id===n.id))],[o,d]),g=()=>{const n=c.trim();if(!n)return;const B={id:n,name:n};y(w=>[...w,B]),r(B.id),m(""),t(!1)};i.useEffect(()=>{l&&u.current&&u.current.focus()},[l]);const f=n=>{n.key==="Enter"&&(n.preventDefault(),g())};return i.useEffect(()=>{s&&!h.some(n=>n.id===s)&&r("")},[s,h,r]),l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(p.Input,{ref:u,placeholder:"Enter new group name",value:c,onChange:n=>m(n.target.value),onKeyDown:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(p.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),e.jsx(p.Button,{size:"sm",onClick:g,children:"Create"})]})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:s,onChange:n=>r(n.target.value),children:[e.jsx("option",{value:"",children:"Select a group"}),o.length>0&&e.jsx("optgroup",{label:"Library Groups",children:o.map(n=>e.jsx("option",{value:n.id,children:n.name},`lib-${n.id}`))}),d.length>0&&e.jsx("optgroup",{label:"Predefined Groups",children:d.filter(n=>!o.some(B=>B.id===n.id)).map(n=>e.jsx("option",{value:n.id,children:n.name},`local-${n.id}`))})]}),e.jsx(p.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>t(!0),children:e.jsx(E.Plus,{className:"h-4 w-4"})})]})},oe=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),c=i.useRef(null),m=i.useCallback(async d=>{var h;const y=(h=d.target.files)==null?void 0:h[0];if(y)try{t(!0);let g=y;y.type.startsWith("image/")&&(g=await J.compressImageIfNeeded(y));const f=new FileReader;f.onloadend=()=>{r(f.result),t(!1)},f.readAsDataURL(g)}catch(g){console.error("Error reading file:",g),t(!1),j.toast.error("Failed to process image",{description:g instanceof Error?g.message:"Unknown error"})}},[r]),u=()=>{r(""),c.current&&(c.current.value="")},o=()=>{var d;(d=c.current)==null||d.click()};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p.Input,{type:"file",ref:c,onChange:m,accept:"image/*",className:"hidden"}),e.jsx(p.Button,{type:"button",variant:"outline",onClick:o,disabled:l,className:"w-full",children:l?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(E.ImageIcon,{className:"h-4 w-4"}),"Select image"]})}),s&&e.jsx(p.Button,{type:"button",variant:"outline",size:"icon",onClick:u,children:e.jsx(E.X,{className:"h-4 w-4"})})]}),s&&e.jsx("div",{className:"aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border",children:e.jsx("img",{src:s,alt:"Preview",className:"h-full w-full object-contain"})})]})},ie=s=>{const{blocks:r,close:l,blockId:t}=s,{getPartialBlocks:c}=x.usePartialBlocksStore(),m=r.find(a=>a._id===t),u=m==null?void 0:m._libBlockId,o=!!u,d=i.useMemo(()=>r.some(a=>a._type==="PartialBlock"||a._type==="GlobalBlock"),[r]),y=i.useMemo(()=>{let a=[];for(const k of r)if(k._type==="PartialBlock"||k._type==="GlobalBlock"){let v=c(k.partialBlockId);k._parent&&(v==null?void 0:v.length)>0&&(v=v.map(T=>(R.isEmpty(T._parent)&&R.set(T,"_parent",k._parent),T))),a=[...a,...v]}else a.push(k);return a},[r,c]),[h,g]=i.useState(""),[f,n]=i.useState(""),[B,w]=i.useState(""),[S,_]=i.useState(""),[N,U]=i.useState({}),[q,M]=i.useState(!1),[O,F]=i.useState(o),[z,K]=i.useState(!1),{hasPermission:Y}=x.usePermissions(),Q=Y(b.PAGES_PERMISSIONS.DELETE_LIBRARY_BLOCK),D=x.useUpdateBlocksPropsRealtime(),V=()=>{D([t],{_libBlockId:void 0}),j.toast.success("Block delinked from library"),l()},{data:I,isLoading:P,isError:G}=ee(u);i.useEffect(()=>{G&&o&&(K(!0),F(!1))},[G,o]),i.useEffect(()=>{I&&!P&&(g(I.name||""),n(I.group||""),w(I.description||""),_(I.preview||""),F(!1))},[I,P]),i.useEffect(()=>{const a=h.trim().length>=2,k=f.trim()!=="";M(a&&k)},[h,f]);const W=()=>{const a={};return h.trim()?h.length<2&&(a.name="Name must be at least 2 characters"):a.name="Name is required",f||(a.group="Group is required"),U(a),Object.keys(a).length===0},{resetLibrary:$}=x.useLibraryBlocks({id:""}),A=Z(a=>{o||D([t],{_libBlockId:a.id}),j.toast.success(`Block ${o?"updated":"saved"} successfully`),$(a.library),l()}),H=async a=>{if(a.preventDefault(),!W())return;const k=y.map(v=>(R.has(v,"_libBlockId")&&delete v._libBlockId,v));A.mutate({name:h.trim(),group:f,blocks:k,description:B.trim(),...S&&S.startsWith("data:")?{previewImage:S}:{},...o?{id:u}:{}})},L=A.isPending;return O||P?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):z?e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"font-medium text-destructive",children:"Block Not Found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This block could not be found on the server. It may have been deleted."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(p.Button,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),e.jsx(p.Button,{onClick:V,variant:"destructive",children:"Delink Block"})]})]}):e.jsxs("div",{children:[d&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive",children:[e.jsx(E.AlertCircle,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Partial Blocks Detected"}),e.jsx("p",{className:"mt-1 text-xs",children:"This block contains one or more Partial Blocks. Partial blocks will be merged into the library block"})]})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"name",className:N.name?"text-destructive":"",children:"Name"}),e.jsx(p.Input,{id:"name",placeholder:"Enter block name",value:h,onChange:a=>g(a.target.value),className:N.name?"border-destructive":""}),N.name&&e.jsx("p",{className:"text-xs text-destructive",children:N.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"group",className:N.group?"text-destructive":"",children:"Group"}),e.jsx(ae,{value:f,onChange:n}),N.group&&e.jsx("p",{className:"text-xs text-destructive",children:N.group})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(p.Input,{id:"description",placeholder:"Enter a brief description",className:"resize-none",value:B,onChange:a=>w(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"previewImage",children:"Preview Image (optional)"}),e.jsx(oe,{value:S,onChange:_})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o&&Q&&e.jsx(re,{blockId:t,libBlockId:u,blockName:h,className:"mr-auto",close:l}),e.jsx(p.Button,{type:"button",variant:"outline",onClick:l,disabled:L,children:"Cancel"}),e.jsx(p.Button,{type:"submit",disabled:L||!q,children:L?"Saving...":o?"Update Block":"Save Block"})]})]})]})};exports.default=ie;