chaipro 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (392) hide show
  1. package/README.md +36 -0
  2. package/dist/IconPicker-I7VNLYZ4.js +5 -0
  3. package/dist/actions-DM00SIUk.d.cts +899 -0
  4. package/dist/actions-DM00SIUk.d.ts +899 -0
  5. package/dist/actions-registery-SEJTZE5Q.js +1 -0
  6. package/dist/active-in-another-tab-SONDAONP.js +1 -0
  7. package/dist/add-new-language-page-TI6DUYYX.js +1 -0
  8. package/dist/add-new-page-LBHXICXO.js +1 -0
  9. package/dist/ai-block-floating-prompt-input-ESY5GQLZ.js +1 -0
  10. package/dist/ai-panel-content-62I6FDQF.css +1 -0
  11. package/dist/ai-panel-content-UZJZ463W.js +1 -0
  12. package/dist/ai-panel-default-lang-2ZXZYQRT.js +6 -0
  13. package/dist/ai-panel-default-lang-ETFOFFEF.css +1 -0
  14. package/dist/ai-panel-for-image-LADQP6VY.js +1 -0
  15. package/dist/ai-panel-other-lang-WDLC3M2M.js +1 -0
  16. package/dist/ai-panel-page-chat-7ZISZWY4.js +4 -0
  17. package/dist/ai-panel-page-chat-N4YFJGAM.css +1 -0
  18. package/dist/ai-prompt-input-CPT5ETQ4.js +1 -0
  19. package/dist/ai-theme-generator-7PS4BX52.js +1 -0
  20. package/dist/ai-translation-prompt-3VE2ECGR.js +1 -0
  21. package/dist/blocks-CMvgDlxw.d.ts +72 -0
  22. package/dist/blocks-CP-Pngaz.d.cts +72 -0
  23. package/dist/build-config-CCERdThN.d.ts +80 -0
  24. package/dist/build-config-DrerOPd9.d.cts +80 -0
  25. package/dist/builder.cjs +243 -0
  26. package/dist/builder.css +1 -0
  27. package/dist/builder.d.cts +352 -0
  28. package/dist/builder.d.ts +352 -0
  29. package/dist/builder.js +1 -0
  30. package/dist/chaibuilder-instance-DNz3Q-dY.d.cts +579 -0
  31. package/dist/chaibuilder-instance-qroszVwI.d.ts +579 -0
  32. package/dist/change-password-modal-NJL7ZLTY.js +1 -0
  33. package/dist/chunk-2AFM6557.js +3 -0
  34. package/dist/chunk-2N4IJZOR.js +1 -0
  35. package/dist/chunk-2NYUIXUX.js +1 -0
  36. package/dist/chunk-2PJZUYIZ.js +1 -0
  37. package/dist/chunk-32HH35VD.js +1 -0
  38. package/dist/chunk-346H4FEX.js +1 -0
  39. package/dist/chunk-34HIOUTE.js +1 -0
  40. package/dist/chunk-374QEK4F.js +1 -0
  41. package/dist/chunk-3E72DJSP.js +1 -0
  42. package/dist/chunk-3IT7IIAV.js +1 -0
  43. package/dist/chunk-3UEPBBE4.js +11 -0
  44. package/dist/chunk-3XSKJBPH.js +1 -0
  45. package/dist/chunk-45ELAD2J.js +1 -0
  46. package/dist/chunk-4JBHWPMO.js +1 -0
  47. package/dist/chunk-4P25MV5E.js +1 -0
  48. package/dist/chunk-4PQNBY3V.js +1 -0
  49. package/dist/chunk-4VNLL2IA.js +1 -0
  50. package/dist/chunk-55SU3QPU.js +1 -0
  51. package/dist/chunk-5ZC65NB6.js +1 -0
  52. package/dist/chunk-6M7V7BOM.js +1 -0
  53. package/dist/chunk-6TXCHU4K.js +1 -0
  54. package/dist/chunk-777N6WHB.js +1 -0
  55. package/dist/chunk-7C4EQOAR.js +12 -0
  56. package/dist/chunk-7EXZXKW2.js +1 -0
  57. package/dist/chunk-7QWMLDCG.js +1 -0
  58. package/dist/chunk-AOJE5WI3.js +1 -0
  59. package/dist/chunk-ATLMLDBS.js +1 -0
  60. package/dist/chunk-AVGF3YLU.js +17 -0
  61. package/dist/chunk-BQSLQHLD.js +1 -0
  62. package/dist/chunk-BWORNCTE.js +1 -0
  63. package/dist/chunk-BYGD5CDT.js +1 -0
  64. package/dist/chunk-CA5PVX24.js +1 -0
  65. package/dist/chunk-CFNOB42V.js +1 -0
  66. package/dist/chunk-CJP3BQH2.js +1 -0
  67. package/dist/chunk-CRJENCPR.js +1 -0
  68. package/dist/chunk-D5SKCKSB.js +1 -0
  69. package/dist/chunk-DZ72OHTD.js +1 -0
  70. package/dist/chunk-EPGOG22Q.js +0 -0
  71. package/dist/chunk-ERCY63ZW.js +1 -0
  72. package/dist/chunk-ESCX7KEH.js +1 -0
  73. package/dist/chunk-F2V4N3LT.js +156 -0
  74. package/dist/chunk-F7YMHPEA.js +1 -0
  75. package/dist/chunk-FERH2TPR.js +1 -0
  76. package/dist/chunk-FLSV2QGU.js +1 -0
  77. package/dist/chunk-FOKGOT6B.js +1 -0
  78. package/dist/chunk-GJOOCKUE.js +1 -0
  79. package/dist/chunk-HA7LF3RV.js +1 -0
  80. package/dist/chunk-HAKJOMCL.js +1 -0
  81. package/dist/chunk-HEKCKC7N.js +1 -0
  82. package/dist/chunk-HELRVKD2.js +3 -0
  83. package/dist/chunk-I7ODKVVX.js +1 -0
  84. package/dist/chunk-IAKCX2WB.js +1 -0
  85. package/dist/chunk-IB2C3TWH.js +1 -0
  86. package/dist/chunk-IH562KSP.js +1 -0
  87. package/dist/chunk-IP4JBQOX.js +1 -0
  88. package/dist/chunk-ITX7QWN6.js +1 -0
  89. package/dist/chunk-IUACZ3E6.js +6 -0
  90. package/dist/chunk-J7Q62EP7.js +1 -0
  91. package/dist/chunk-JBB5IJFA.js +1 -0
  92. package/dist/chunk-JPJRO4NU.js +1 -0
  93. package/dist/chunk-JUIS55JT.js +1 -0
  94. package/dist/chunk-JYBTQ3YX.js +5 -0
  95. package/dist/chunk-K5YWQY4U.js +1 -0
  96. package/dist/chunk-K6RHR4HT.js +1 -0
  97. package/dist/chunk-LNV5MRGV.js +1 -0
  98. package/dist/chunk-LRJREWRD.js +1 -0
  99. package/dist/chunk-LWYDGDPW.js +1 -0
  100. package/dist/chunk-MDMGXS5B.js +1 -0
  101. package/dist/chunk-MEROMQQX.js +1 -0
  102. package/dist/chunk-N7Z4RFFI.js +1 -0
  103. package/dist/chunk-NSQEQYEM.js +1 -0
  104. package/dist/chunk-OD3K76M6.js +1 -0
  105. package/dist/chunk-ODSL3KXG.js +1 -0
  106. package/dist/chunk-OJJDRACB.js +1 -0
  107. package/dist/chunk-ONSZ462E.js +1 -0
  108. package/dist/chunk-OQZ4EPOM.js +1 -0
  109. package/dist/chunk-OR7KKUYT.js +1 -0
  110. package/dist/chunk-OSGXFZTA.js +1 -0
  111. package/dist/chunk-PM3JNOZH.js +1 -0
  112. package/dist/chunk-PQHFT4TE.js +1 -0
  113. package/dist/chunk-QGVCH2NI.js +1 -0
  114. package/dist/chunk-QIGSSVEY.js +1 -0
  115. package/dist/chunk-R5ZTCDFD.js +1 -0
  116. package/dist/chunk-RBDZDQZR.js +1 -0
  117. package/dist/chunk-ROQRBSK6.js +1 -0
  118. package/dist/chunk-SSENH35Y.js +1 -0
  119. package/dist/chunk-SYPALJAE.js +1 -0
  120. package/dist/chunk-T2YYNX6Z.js +1 -0
  121. package/dist/chunk-T32TW3XV.js +1 -0
  122. package/dist/chunk-T56KQBE2.js +1 -0
  123. package/dist/chunk-TEL5ACJE.js +1 -0
  124. package/dist/chunk-TGJQC6VC.js +1 -0
  125. package/dist/chunk-TQ34DGOT.js +1 -0
  126. package/dist/chunk-TVF77C53.js +1 -0
  127. package/dist/chunk-UIDBBTCZ.js +3 -0
  128. package/dist/chunk-VKSRWZCO.js +1 -0
  129. package/dist/chunk-VL5WBPVV.js +1 -0
  130. package/dist/chunk-VUWHFLT7.js +22 -0
  131. package/dist/chunk-WEVKAJMV.js +1 -0
  132. package/dist/chunk-WHPIYGCY.js +1 -0
  133. package/dist/chunk-WNESLH23.js +1 -0
  134. package/dist/chunk-WOT6VMZA.js +1 -0
  135. package/dist/chunk-WSQ5SQBD.js +1 -0
  136. package/dist/chunk-XY4UJKHE.js +1 -0
  137. package/dist/chunk-Y2BHO7OO.js +1 -0
  138. package/dist/chunk-YDOQEFOK.js +1 -0
  139. package/dist/chunk-YEFMD4DS.js +1 -0
  140. package/dist/chunk-YQ5QQCRD.js +1 -0
  141. package/dist/chunk-YQPOFRXU.js +1 -0
  142. package/dist/chunk-YTPQSO7V.js +801 -0
  143. package/dist/chunk-ZAU65LBG.js +1 -0
  144. package/dist/chunk-ZRFCEMYU.js +1 -0
  145. package/dist/chunk-ZU2B5YT6.js +1 -0
  146. package/dist/chunk-ZXKKBKGV.js +1 -0
  147. package/dist/code-display-7346IUCO.js +1 -0
  148. package/dist/code-editor-UBGTTX2L.js +1 -0
  149. package/dist/components/ui/accordion.cjs +1 -0
  150. package/dist/components/ui/accordion.d.cts +9 -0
  151. package/dist/components/ui/accordion.d.ts +9 -0
  152. package/dist/components/ui/accordion.js +1 -0
  153. package/dist/components/ui/alert-dialog.cjs +1 -0
  154. package/dist/components/ui/alert-dialog.d.cts +23 -0
  155. package/dist/components/ui/alert-dialog.d.ts +23 -0
  156. package/dist/components/ui/alert-dialog.js +1 -0
  157. package/dist/components/ui/alert.cjs +1 -0
  158. package/dist/components/ui/alert.d.cts +11 -0
  159. package/dist/components/ui/alert.d.ts +11 -0
  160. package/dist/components/ui/alert.js +1 -0
  161. package/dist/components/ui/avatar.cjs +1 -0
  162. package/dist/components/ui/avatar.d.cts +8 -0
  163. package/dist/components/ui/avatar.d.ts +8 -0
  164. package/dist/components/ui/avatar.js +1 -0
  165. package/dist/components/ui/badge.cjs +1 -0
  166. package/dist/components/ui/badge.d.cts +13 -0
  167. package/dist/components/ui/badge.d.ts +13 -0
  168. package/dist/components/ui/badge.js +1 -0
  169. package/dist/components/ui/button.cjs +1 -0
  170. package/dist/components/ui/button.d.cts +15 -0
  171. package/dist/components/ui/button.d.ts +15 -0
  172. package/dist/components/ui/button.js +1 -0
  173. package/dist/components/ui/card.cjs +1 -0
  174. package/dist/components/ui/card.d.cts +10 -0
  175. package/dist/components/ui/card.d.ts +10 -0
  176. package/dist/components/ui/card.js +1 -0
  177. package/dist/components/ui/checkbox.cjs +1 -0
  178. package/dist/components/ui/checkbox.d.cts +6 -0
  179. package/dist/components/ui/checkbox.d.ts +6 -0
  180. package/dist/components/ui/checkbox.js +1 -0
  181. package/dist/components/ui/command.cjs +1 -0
  182. package/dist/components/ui/command.d.cts +83 -0
  183. package/dist/components/ui/command.d.ts +83 -0
  184. package/dist/components/ui/command.js +1 -0
  185. package/dist/components/ui/context-menu.cjs +1 -0
  186. package/dist/components/ui/context-menu.d.cts +30 -0
  187. package/dist/components/ui/context-menu.d.ts +30 -0
  188. package/dist/components/ui/context-menu.js +1 -0
  189. package/dist/components/ui/dialog.cjs +1 -0
  190. package/dist/components/ui/dialog.d.cts +22 -0
  191. package/dist/components/ui/dialog.d.ts +22 -0
  192. package/dist/components/ui/dialog.js +1 -0
  193. package/dist/components/ui/dropdown-menu.cjs +1 -0
  194. package/dist/components/ui/dropdown-menu.d.cts +30 -0
  195. package/dist/components/ui/dropdown-menu.d.ts +30 -0
  196. package/dist/components/ui/dropdown-menu.js +1 -0
  197. package/dist/components/ui/hover-card.cjs +1 -0
  198. package/dist/components/ui/hover-card.d.cts +8 -0
  199. package/dist/components/ui/hover-card.d.ts +8 -0
  200. package/dist/components/ui/hover-card.js +1 -0
  201. package/dist/components/ui/input.cjs +1 -0
  202. package/dist/components/ui/input.d.cts +5 -0
  203. package/dist/components/ui/input.d.ts +5 -0
  204. package/dist/components/ui/input.js +1 -0
  205. package/dist/components/ui/label.cjs +1 -0
  206. package/dist/components/ui/label.d.cts +8 -0
  207. package/dist/components/ui/label.d.ts +8 -0
  208. package/dist/components/ui/label.js +1 -0
  209. package/dist/components/ui/loader.cjs +1 -0
  210. package/dist/components/ui/loader.d.cts +12 -0
  211. package/dist/components/ui/loader.d.ts +12 -0
  212. package/dist/components/ui/loader.js +1 -0
  213. package/dist/components/ui/navigation-menu.cjs +1 -0
  214. package/dist/components/ui/navigation-menu.d.cts +15 -0
  215. package/dist/components/ui/navigation-menu.d.ts +15 -0
  216. package/dist/components/ui/navigation-menu.js +1 -0
  217. package/dist/components/ui/popover.cjs +1 -0
  218. package/dist/components/ui/popover.d.cts +9 -0
  219. package/dist/components/ui/popover.d.ts +9 -0
  220. package/dist/components/ui/popover.js +1 -0
  221. package/dist/components/ui/progress.cjs +1 -0
  222. package/dist/components/ui/progress.d.cts +8 -0
  223. package/dist/components/ui/progress.d.ts +8 -0
  224. package/dist/components/ui/progress.js +1 -0
  225. package/dist/components/ui/scroll-area.cjs +1 -0
  226. package/dist/components/ui/scroll-area.d.cts +7 -0
  227. package/dist/components/ui/scroll-area.d.ts +7 -0
  228. package/dist/components/ui/scroll-area.js +1 -0
  229. package/dist/components/ui/select.cjs +1 -0
  230. package/dist/components/ui/select.d.cts +15 -0
  231. package/dist/components/ui/select.d.ts +15 -0
  232. package/dist/components/ui/select.js +1 -0
  233. package/dist/components/ui/separator.cjs +1 -0
  234. package/dist/components/ui/separator.d.cts +6 -0
  235. package/dist/components/ui/separator.d.ts +6 -0
  236. package/dist/components/ui/separator.js +1 -0
  237. package/dist/components/ui/sheet.cjs +1 -0
  238. package/dist/components/ui/sheet.d.cts +29 -0
  239. package/dist/components/ui/sheet.d.ts +29 -0
  240. package/dist/components/ui/sheet.js +1 -0
  241. package/dist/components/ui/skeleton.cjs +1 -0
  242. package/dist/components/ui/skeleton.d.cts +5 -0
  243. package/dist/components/ui/skeleton.d.ts +5 -0
  244. package/dist/components/ui/skeleton.js +1 -0
  245. package/dist/components/ui/slider.cjs +1 -0
  246. package/dist/components/ui/slider.d.cts +6 -0
  247. package/dist/components/ui/slider.d.ts +6 -0
  248. package/dist/components/ui/slider.js +1 -0
  249. package/dist/components/ui/switch.cjs +1 -0
  250. package/dist/components/ui/switch.d.cts +9 -0
  251. package/dist/components/ui/switch.d.ts +9 -0
  252. package/dist/components/ui/switch.js +1 -0
  253. package/dist/components/ui/tabs.cjs +1 -0
  254. package/dist/components/ui/tabs.d.cts +9 -0
  255. package/dist/components/ui/tabs.d.ts +9 -0
  256. package/dist/components/ui/tabs.js +1 -0
  257. package/dist/components/ui/textarea.cjs +1 -0
  258. package/dist/components/ui/textarea.d.cts +5 -0
  259. package/dist/components/ui/textarea.d.ts +5 -0
  260. package/dist/components/ui/textarea.js +1 -0
  261. package/dist/components/ui/toggle.cjs +1 -0
  262. package/dist/components/ui/toggle.d.cts +15 -0
  263. package/dist/components/ui/toggle.d.ts +15 -0
  264. package/dist/components/ui/toggle.js +1 -0
  265. package/dist/components/ui/tooltip.cjs +1 -0
  266. package/dist/components/ui/tooltip.d.cts +9 -0
  267. package/dist/components/ui/tooltip.d.ts +9 -0
  268. package/dist/components/ui/tooltip.js +1 -0
  269. package/dist/config-registry-RSJCAKY5.js +1 -0
  270. package/dist/continue-editing-in-this-client-QBMOFRLL.js +1 -0
  271. package/dist/core-BNe4bA6z.d.cts +5455 -0
  272. package/dist/core-BNe4bA6z.d.ts +5455 -0
  273. package/dist/css-import-modal-NMFRQGCY.js +13 -0
  274. package/dist/db/better-sqlite3.cjs +1 -0
  275. package/dist/db/better-sqlite3.d.cts +16 -0
  276. package/dist/db/better-sqlite3.d.ts +16 -0
  277. package/dist/db/better-sqlite3.js +1 -0
  278. package/dist/db/d1.cjs +1 -0
  279. package/dist/db/d1.d.cts +17 -0
  280. package/dist/db/d1.d.ts +17 -0
  281. package/dist/db/d1.js +1 -0
  282. package/dist/db/libsql.cjs +1 -0
  283. package/dist/db/libsql.d.cts +23 -0
  284. package/dist/db/libsql.d.ts +23 -0
  285. package/dist/db/libsql.js +1 -0
  286. package/dist/db/node-pg.cjs +1 -0
  287. package/dist/db/node-pg.d.cts +21 -0
  288. package/dist/db/node-pg.d.ts +21 -0
  289. package/dist/db/node-pg.js +1 -0
  290. package/dist/db/postgres.cjs +1 -0
  291. package/dist/db/postgres.d.cts +28 -0
  292. package/dist/db/postgres.d.ts +28 -0
  293. package/dist/db/postgres.js +1 -0
  294. package/dist/delete-page-CGR6VXZC.css +1 -0
  295. package/dist/delete-page-FQYTEMBN.js +1 -0
  296. package/dist/digital-asset-manager-PIZMJEMX.js +1 -0
  297. package/dist/digital-asset-manager-PSTDGMY2.css +1 -0
  298. package/dist/dispatch-action-3IV56BNY.js +1 -0
  299. package/dist/duplicate-page-HPPMQRL3.js +1 -0
  300. package/dist/dynamic-page-selector-LFHJQLYY.js +1 -0
  301. package/dist/dynamic-page-selector-SXJQAIGL.css +1 -0
  302. package/dist/edit-url-panel-Q3NJCV55.js +1 -0
  303. package/dist/get-blocks-styles-SLZ5NDUF.js +1 -0
  304. package/dist/get-page-styles-Q4FWW5LX.js +1 -0
  305. package/dist/image-editor-PLXDYVKE.css +1 -0
  306. package/dist/image-editor-RSEHWRGV.js +1 -0
  307. package/dist/json-diff-viewer-FQYK2FUX.js +8 -0
  308. package/dist/lang-panel-57UGEL6B.css +1 -0
  309. package/dist/lang-panel-HH5LEOF4.js +1 -0
  310. package/dist/license-overlay-4Q525E53.js +1 -0
  311. package/dist/log-ai-request-LHPKU2C5.js +1 -0
  312. package/dist/manage-design-tokens-264H25A2.js +1 -0
  313. package/dist/manage-design-tokens-modal-OIWIZ53K.js +1 -0
  314. package/dist/mark-as-template-7TCCEMGC.js +1 -0
  315. package/dist/nested-path-selector-content-N4XN7QUS.js +1 -0
  316. package/dist/nextjs/render-client.cjs +1 -0
  317. package/dist/nextjs/render-client.css +1 -0
  318. package/dist/nextjs/render-client.d.cts +14 -0
  319. package/dist/nextjs/render-client.d.ts +14 -0
  320. package/dist/nextjs/render-client.js +1 -0
  321. package/dist/nextjs/render.cjs +829 -0
  322. package/dist/nextjs/render.d.cts +78 -0
  323. package/dist/nextjs/render.d.ts +78 -0
  324. package/dist/nextjs/render.js +1 -0
  325. package/dist/nextjs/server.cjs +807 -0
  326. package/dist/nextjs/server.d.cts +329 -0
  327. package/dist/nextjs/server.d.ts +329 -0
  328. package/dist/nextjs/server.js +1 -0
  329. package/dist/nextjs.cjs +1 -0
  330. package/dist/nextjs.d.cts +17 -0
  331. package/dist/nextjs.d.ts +17 -0
  332. package/dist/nextjs.js +1 -0
  333. package/dist/no-language-page-content-NQIROTIL.js +1 -0
  334. package/dist/no-language-page-dialog-CWG5PI7N.js +1 -0
  335. package/dist/page-creator-2L6L6EFV.js +1 -0
  336. package/dist/page-lock-7HMG34UJ.js +1 -0
  337. package/dist/page-locked-dialog-ACMWVAZX.js +1 -0
  338. package/dist/page-manager-new-SCZFNGKO.js +1 -0
  339. package/dist/page-manager-new-VWRASZTI.css +1 -0
  340. package/dist/page-manager-search-and-filter-7CHPYAPV.js +1 -0
  341. package/dist/page-manager-sheet-KZZBKQ6M.js +1 -0
  342. package/dist/page-manager-sheet-U5YEB5CS.css +1 -0
  343. package/dist/page-revisions-content-DHPEQ4CA.js +1 -0
  344. package/dist/page-revisions-trigger-XGC4HOTL.js +1 -0
  345. package/dist/pages-DlMX1Lj2.d.cts +21 -0
  346. package/dist/pages-Dol4CXrN.d.ts +21 -0
  347. package/dist/payload/builder.cjs +243 -0
  348. package/dist/payload/builder.css +1 -0
  349. package/dist/payload/builder.d.cts +13 -0
  350. package/dist/payload/builder.d.ts +13 -0
  351. package/dist/payload/builder.js +1 -0
  352. package/dist/payload.cjs +807 -0
  353. package/dist/payload.d.cts +603 -0
  354. package/dist/payload.d.ts +603 -0
  355. package/dist/payload.js +1 -0
  356. package/dist/preview-banner-SDDZGGRW.js +1 -0
  357. package/dist/publish-pages-content-3AZ45DYH.js +1 -0
  358. package/dist/registry.cjs +11 -0
  359. package/dist/registry.d.cts +74 -0
  360. package/dist/registry.d.ts +74 -0
  361. package/dist/registry.js +1 -0
  362. package/dist/relations-DDBTFCMR.js +1 -0
  363. package/dist/revalidate-G2DEOH4Z.js +1 -0
  364. package/dist/rte-widget-modal-7RXFEYHK.js +1 -0
  365. package/dist/save-to-lib-65EGTZE5.js +1 -0
  366. package/dist/schema-IVNMPI4V.js +1 -0
  367. package/dist/schema.sqlite-CYBLikNv.d.cts +5852 -0
  368. package/dist/schema.sqlite-CYBLikNv.d.ts +5852 -0
  369. package/dist/seo-panel-WQ47FNP4.css +1 -0
  370. package/dist/seo-panel-Z6OBXHQ4.js +2 -0
  371. package/dist/server-config-b29G6_aQ.d.cts +116 -0
  372. package/dist/server-config-oPlt3V1X.d.ts +116 -0
  373. package/dist/state-RAP56WXS.js +1 -0
  374. package/dist/take-over-request-EB464ZGU.js +1 -0
  375. package/dist/translation-warning-modal-EES6I2QV.js +1 -0
  376. package/dist/types.cjs +1 -0
  377. package/dist/types.d.cts +38 -0
  378. package/dist/types.d.ts +38 -0
  379. package/dist/types.js +1 -0
  380. package/dist/unmark-as-template-6STMTBP5.js +1 -0
  381. package/dist/unpublish-page-CE3CJK5C.js +1 -0
  382. package/dist/unpublished-partials-modal-OZBWBCLN.js +1 -0
  383. package/dist/utils.cjs +1 -0
  384. package/dist/utils.d.cts +168 -0
  385. package/dist/utils.d.ts +168 -0
  386. package/dist/utils.js +1 -0
  387. package/dist/web-blocks.cjs +1 -0
  388. package/dist/web-blocks.d.cts +3 -0
  389. package/dist/web-blocks.d.ts +3 -0
  390. package/dist/web-blocks.js +1 -0
  391. package/dist/web-preview-EIWOXGPY.js +1 -0
  392. package/package.json +322 -0
@@ -0,0 +1,28 @@
1
+ import { Logger } from 'drizzle-orm/logger';
2
+ import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
+ export { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
4
+ import { Sql } from 'postgres';
5
+ export { Sql } from 'postgres';
6
+ import { i as schema, a as ChaiDbSetup } from '../core-BNe4bA6z.cjs';
7
+ import 'drizzle-orm/pg-core';
8
+
9
+ type ChaiDbPoolOptions = {
10
+ max?: number;
11
+ idle_timeout?: number;
12
+ connect_timeout?: number;
13
+ };
14
+ type PostgresDbInput = {
15
+ url: string;
16
+ pool?: ChaiDbPoolOptions;
17
+ schema?: string;
18
+ } | {
19
+ sql: Sql;
20
+ } | {
21
+ drizzle: PostgresJsDatabase<typeof schema>;
22
+ };
23
+ declare function createPostgresInstance(sql: Sql, schemaRecord: Record<string, unknown>, logger: Logger): PostgresJsDatabase<typeof schema>;
24
+ declare function createPostgresConnection(url: string, pool?: ChaiDbPoolOptions, schema?: string): Sql;
25
+ /** Creates a postgres-js Drizzle setup for `buildChaiBuilderConfig({ db: ... })`. */
26
+ declare function createPostgresDB(input: PostgresDbInput): ChaiDbSetup;
27
+
28
+ export { type ChaiDbPoolOptions, type PostgresDbInput, createPostgresConnection, createPostgresDB, createPostgresInstance };
@@ -0,0 +1,28 @@
1
+ import { Logger } from 'drizzle-orm/logger';
2
+ import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
3
+ export { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
4
+ import { Sql } from 'postgres';
5
+ export { Sql } from 'postgres';
6
+ import { i as schema, a as ChaiDbSetup } from '../core-BNe4bA6z.js';
7
+ import 'drizzle-orm/pg-core';
8
+
9
+ type ChaiDbPoolOptions = {
10
+ max?: number;
11
+ idle_timeout?: number;
12
+ connect_timeout?: number;
13
+ };
14
+ type PostgresDbInput = {
15
+ url: string;
16
+ pool?: ChaiDbPoolOptions;
17
+ schema?: string;
18
+ } | {
19
+ sql: Sql;
20
+ } | {
21
+ drizzle: PostgresJsDatabase<typeof schema>;
22
+ };
23
+ declare function createPostgresInstance(sql: Sql, schemaRecord: Record<string, unknown>, logger: Logger): PostgresJsDatabase<typeof schema>;
24
+ declare function createPostgresConnection(url: string, pool?: ChaiDbPoolOptions, schema?: string): Sql;
25
+ /** Creates a postgres-js Drizzle setup for `buildChaiBuilderConfig({ db: ... })`. */
26
+ declare function createPostgresDB(input: PostgresDbInput): ChaiDbSetup;
27
+
28
+ export { type ChaiDbPoolOptions, type PostgresDbInput, createPostgresConnection, createPostgresDB, createPostgresInstance };
@@ -0,0 +1 @@
1
+ import{a,b,c}from"../chunk-QIGSSVEY.js";import"../chunk-45ELAD2J.js";import"../chunk-DZ72OHTD.js";import"../chunk-OSGXFZTA.js";import"../chunk-OQZ4EPOM.js";import"../chunk-WOT6VMZA.js";export{b as createPostgresConnection,c as createPostgresDB,a as createPostgresInstance};
@@ -0,0 +1 @@
1
+ .FIE_topbar-save-menu{display:flex;flex-direction:column;gap:0;border-width:1px;padding-top:.5rem;padding-bottom:.5rem;font-size:.75rem;line-height:1rem;box-shadow:0 25px 50px -12px #00000040}.FIE_topbar-save-menu-item{font-size:.75rem;line-height:1rem}.FIE_topbar-save-menu-item:hover{background-color:#e5e7eb}.FIE_topbar-save-menu-item>span:first-child{height:1rem;width:1rem}#chai-image-editor-container>button{opacity:0}body{pointer-events:auto!important}
@@ -0,0 +1 @@
1
+ import{i as M}from"./chunk-ZRFCEMYU.js";import"./chunk-34HIOUTE.js";import"./chunk-CA5PVX24.js";import"./chunk-MEROMQQX.js";import"./chunk-SYPALJAE.js";import"./chunk-F2V4N3LT.js";import"./chunk-R5ZTCDFD.js";import{a as f}from"./chunk-ZU2B5YT6.js";import"./chunk-IUACZ3E6.js";import"./chunk-QGVCH2NI.js";import"./chunk-5ZC65NB6.js";import{a as F}from"./chunk-JBB5IJFA.js";import"./chunk-IAKCX2WB.js";import"./chunk-ZXKKBKGV.js";import"./chunk-K5YWQY4U.js";import"./chunk-ATLMLDBS.js";import"./chunk-ROQRBSK6.js";import"./chunk-7C4EQOAR.js";import"./chunk-F7YMHPEA.js";import"./chunk-D5SKCKSB.js";import"./chunk-2PJZUYIZ.js";import"./chunk-LNV5MRGV.js";import"./chunk-7EXZXKW2.js";import{d as H}from"./chunk-VL5WBPVV.js";import"./chunk-GJOOCKUE.js";import"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import{c as R}from"./chunk-PQHFT4TE.js";import{c as W}from"./chunk-YEFMD4DS.js";import{a as B}from"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-LRJREWRD.js";import"./chunk-HAKJOMCL.js";import{xa as U}from"./chunk-2NYUIXUX.js";import"./chunk-WHPIYGCY.js";import{a as G}from"./chunk-HA7LF3RV.js";import"./chunk-PM3JNOZH.js";import"./chunk-WEVKAJMV.js";import"./chunk-YQPOFRXU.js";import"./chunk-55SU3QPU.js";import{b as k}from"./chunk-ZAU65LBG.js";import"./chunk-BQSLQHLD.js";import"./chunk-IH562KSP.js";import"./chunk-FERH2TPR.js";import"./chunk-ODSL3KXG.js";import"./chunk-TVF77C53.js";import"./chunk-777N6WHB.js";import"./chunk-OJJDRACB.js";import"./chunk-N7Z4RFFI.js";import"./chunk-WSQ5SQBD.js";import"./chunk-4P25MV5E.js";import"./chunk-6TXCHU4K.js";import"./chunk-J7Q62EP7.js";import"./chunk-YQ5QQCRD.js";import"./chunk-I7ODKVVX.js";import{a as x,f as A,g as L,h as T,i as E}from"./chunk-RBDZDQZR.js";import"./chunk-4VNLL2IA.js";import"./chunk-FLSV2QGU.js";import"./chunk-2N4IJZOR.js";import"./chunk-4JBHWPMO.js";import"./chunk-3E72DJSP.js";import"./chunk-BWORNCTE.js";import"./chunk-SSENH35Y.js";import"./chunk-TEL5ACJE.js";import{b as g}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-NSQEQYEM.js";import"./chunk-BYGD5CDT.js";import"./chunk-EPGOG22Q.js";import"./chunk-T32TW3XV.js";import"./chunk-TGJQC6VC.js";import"./chunk-ESCX7KEH.js";import"./chunk-CRJENCPR.js";import"./chunk-6M7V7BOM.js";import"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{get as p,isEmpty as q}from"lodash-es";import{useMemo as v}from"react";import{useTranslation as z}from"react-i18next";import{jsx as n,jsxs as o}from"react/jsx-runtime";var w=(t,a)=>{let e=a.filter(c=>c.parent===t);if(e.length===0)return 0;let m=e.length;return e.forEach(c=>{m+=w(c.id,a)}),m};function I({page:t,onClose:a}){var S;let{t:e}=z(),[,m]=B(),{mutate:c,isPending:P}=H(),{data:u=[]}=W(),{setSelectedLang:O,fallbackLang:$}=U(),[,Q]=F(),l=!(t!=null&&t.primaryPage),{data:s=[]}=R(l?t==null?void 0:t.id:void 0),{data:y}=M(),i=k("flags",{}),D=v(()=>q(t==null?void 0:t.slug),[t==null?void 0:t.slug]),N=v(()=>{if(!D||!(t!=null&&t.id)||!y)return[];let r=[];return Object.entries(y).forEach(([d,b])=>{b.partialBlocks.includes(t.id)&&!b.isPartial&&r.push({id:d,name:b.name})}),r},[D,t.id,y]),C=v(()=>!l||!s?0:s.filter(r=>r.id!==t.id).length,[l,s,t.id]),h=v(()=>{if(!(t!=null&&t.id)||!u.length)return 0;let r=w(t.id,u);return l&&s&&s.length>0&&s.forEach(d=>{d.id!==t.id&&(r+=w(d.id,u))}),r},[t.id,u,l,s]),j=()=>{P||c(t,{onSuccess:()=>{t!=null&&t.primaryPage?(window.history.replaceState({},"",`/?page=${t.primaryPage}`),m(new URLSearchParams({page:t.primaryPage}))):(window.history.replaceState({},"",window.location.pathname),m(new URLSearchParams)),window.dispatchEvent(new PopStateEvent("popstate")),O($),Q("outline"),a()}})};return n(x,{open:!!t,onOpenChange:a,children:o(A,{children:[n(L,{children:n(E,{children:i!=null&&i.trash?e(f().confirmMoveTitle):e("Delete Page")})}),o("div",{className:"rounded-md",children:[o("div",{className:"mb-2 text-sm font-light text-foreground/90",children:[i!=null&&i.trash?e("Are you sure you want to move"):e("Are you sure you want to delete")," ",n("b",{children:(S=t==null?void 0:t.name)!=null?S:t==null?void 0:t.slug})," ",i!=null&&i.trash?e("to archive?"):e("? This action cannot be undone.")]}),l&&(C>0||h>0)&&o("div",{className:"mt-3 rounded-md border p-3 text-sm",children:[o("div",{className:"font-semibold text-destructive",children:[e(`Warning: ${i!=null&&i.trash?f().warning:"Deleting"} this primary page will also remove`),":"]}),o("ul",{className:"mt-2 list-inside list-disc space-y-1 text-destructive",children:[h>0&&o("li",{children:[n("span",{className:"font-medium",children:h})," ",e(h===1?"nested child page":"nested child pages")]}),C>0&&n("li",{children:e("All associated language pages")})]})]}),D&&N.length>0&&o("div",{className:"mt-3 rounded-md bg-destructive/10 p-3 text-sm",children:[o("div",{className:"font-semibold text-destructive",children:[e("Warning: This partial is currently used in the following pages"),":"]}),n("ul",{className:"mt-2 list-inside list-disc space-y-1 text-destructive",children:N.map(({id:r,name:d})=>n("li",{children:n("span",{className:"font-medium",children:d})},r))})]}),t.lang&&o("div",{className:"py-2 text-sm font-light text-foreground",children:[e("Language"),": ",n("span",{className:"font-medium",children:p(G,t.lang,t.lang)})]})]}),o(T,{children:[n(g,{variant:"outline",onClick:a,disabled:P,children:e("Cancel")}),n(g,{loading:P,variant:"destructive",onClick:j,children:i!=null&&i.trash?e(f().moveToAction):e("Delete")})]})]})})}var lt=I;export{lt as default};
@@ -0,0 +1 @@
1
+ "use client";import{t as Te,u as gt,v as ft,w as ht,x as vt}from"./chunk-F2V4N3LT.js";import{c as ut,d as pt}from"./chunk-R5ZTCDFD.js";import{a as De}from"./chunk-ZU2B5YT6.js";import"./chunk-5ZC65NB6.js";import"./chunk-JBB5IJFA.js";import"./chunk-7C4EQOAR.js";import"./chunk-F7YMHPEA.js";import"./chunk-D5SKCKSB.js";import"./chunk-LNV5MRGV.js";import{a as ke}from"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import"./chunk-PQHFT4TE.js";import"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import{d as at,e as Re}from"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-HAKJOMCL.js";import{wa as ne,xa as tt}from"./chunk-2NYUIXUX.js";import{a as pe}from"./chunk-WHPIYGCY.js";import{a as mt}from"./chunk-HA7LF3RV.js";import"./chunk-PM3JNOZH.js";import{a as ie}from"./chunk-WEVKAJMV.js";import{a as ee}from"./chunk-55SU3QPU.js";import{b as Se,d as je}from"./chunk-ZAU65LBG.js";import"./chunk-BQSLQHLD.js";import{a as rt}from"./chunk-IH562KSP.js";import{a as it,b as ot,c as Ie}from"./chunk-FERH2TPR.js";import{a as dt}from"./chunk-ODSL3KXG.js";import"./chunk-TVF77C53.js";import"./chunk-777N6WHB.js";import"./chunk-N7Z4RFFI.js";import{a as le,c as ce,d as de,g as me,i as ue}from"./chunk-WSQ5SQBD.js";import"./chunk-4P25MV5E.js";import"./chunk-6TXCHU4K.js";import"./chunk-J7Q62EP7.js";import"./chunk-YQ5QQCRD.js";import{a as be,f as ye,g as Ne,h as Ye,i as we,j as et}from"./chunk-RBDZDQZR.js";import{a as st,b as nt,i as lt,j as Ce,m as ct}from"./chunk-4VNLL2IA.js";import"./chunk-FLSV2QGU.js";import{a as Ae}from"./chunk-2N4IJZOR.js";import{a as J}from"./chunk-4JBHWPMO.js";import"./chunk-3E72DJSP.js";import"./chunk-BWORNCTE.js";import"./chunk-SSENH35Y.js";import"./chunk-TEL5ACJE.js";import{b as x}from"./chunk-3IT7IIAV.js";import{a as Je,b as re}from"./chunk-IP4JBQOX.js";import"./chunk-NSQEQYEM.js";import"./chunk-T32TW3XV.js";import"./chunk-TGJQC6VC.js";import"./chunk-ESCX7KEH.js";import"./chunk-CRJENCPR.js";import"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import{c as oe}from"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{find as ja,first as Ra,map as _a,merge as Va,pick as Be}from"lodash-es";import{Archive as Oa,BrainCog as qa,Check as Ga,Film as $a,ImageIcon as Wa,Images as Ka,MoreVertical as Ha,RefreshCwIcon as Qa,Search as Xa}from"lucide-react";import Za,{Suspense as Ja,useCallback as xe,useEffect as Ge,useMemo as $e,useState as Q}from"react";import{ErrorBoundary as Ya}from"react-error-boundary";import{useTranslation as er}from"react-i18next";import{toast as tr}from"sonner";import{first as Wt}from"lodash-es";import{ImageIcon as Kt}from"lucide-react";import{lazy as Ht,Suspense as Qt,useState as Xt}from"react";import{useTranslation as Zt}from"react-i18next";import{toast as Jt}from"sonner";import{jsx as H,jsxs as ge}from"react/jsx-runtime";var Yt=Ht(()=>import("./ai-panel-content-UZJZ463W.js")),ea=s=>{let{t:r}=Zt(),[b,c]=Xt(null),{mutateAsync:d,isPending:e}=Te(),t=async()=>{let p={name:"ai-generated-image-"+Date.now()+".webp",description:"AI generated image"},A=await d([{file:b,name:p.name,description:{en:p.description},optimize:!0}]);return{...Wt(A)||{},description:p.description}},w=async()=>{try{if(b){let p=await t();s.onSelect(s!=null&&s.multiple?[p]:p),s.close()}}catch(p){Jt.error("Error in adding image to website assets")}};return ge("div",{className:"flex h-full w-full gap-1 overflow-hidden",children:[H("div",{className:`h-full w-[300px] overflow-hidden rounded-md border border-border p-1 ${b?"pb-7":""}`,children:H(Qt,{fallback:H("div",{className:"h-full w-full animate-pulse bg-accent"}),children:H(Yt,{type:"generate-image",onSuccess:console.log,onError:console.log,onComplete:console.log,onImageGenerate:p=>c(p)})})}),ge("div",{className:"flex flex-1 flex-col overflow-hidden rounded-md border border-dashed",children:[H("div",{className:"flex-1 overflow-hidden p-2",children:b?H("img",{src:b,alt:"Generated",className:"h-full w-full object-contain"}):ge("div",{className:"flex h-full flex-1 flex-col items-center justify-center gap-4 rounded-md bg-accent/10",children:[H("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted/30",children:H(Kt,{className:"h-8 w-8 text-muted-foreground"})}),ge("div",{className:"space-y-1 text-center",children:[H("p",{className:"text-sm font-medium text-foreground",children:r("No image generated yet")}),H("p",{className:"text-xs text-muted-foreground",children:r("Use the AI panel on the left to generate an image")})]})]})}),b&&ge("div",{className:"flex flex-shrink-0 items-center justify-center gap-3 border-t border-dashed px-4 py-3",children:[H(x,{disabled:e,loading:e,variant:"outline",size:"sm",onClick:async()=>{var p;await t(),(p=s==null?void 0:s.setActiveTab)==null||p.call(s,"site")},children:"Add to website assets"}),H(x,{disabled:e,loading:e,variant:"default",size:"sm",onClick:w,children:"Use image"})]})]})]})},xt=ea;import{ChevronLeft as ta,ChevronRight as aa}from"lucide-react";import{useMemo as ra,useState as ia}from"react";import{jsx as te,jsxs as fe}from"react/jsx-runtime";function Ue({currentPage:s,totalPages:r,onPageChange:b,pageRangeDisplayed:c=3,showPageInput:d=!0,className:e=""}){let[t,w]=ia(String(s)),p=ra(()=>{let g=Math.floor(c/2),N=Math.max(1,s-g),k=Math.min(r,s+g);k-N+1<c&&(N===1?k=Math.min(r,N+c-1):k===r&&(N=Math.max(1,k-c+1)));let D=[];N>1&&(D.push(1),N>2&&D.push("..."));for(let m=N;m<=k;m++)D.push(m);return k<r&&(k<r-1&&D.push("..."),D.push(r)),D},[s,r,c]),A=g=>{g!==s&&g>=1&&g<=r&&(b(g),w(String(g)))},h=()=>{s>1&&A(s-1)},M=()=>{s<r&&A(s+1)},F=()=>{let g=Number(t);!isNaN(g)&&g>=1&&g<=r&&A(g)},E=g=>{g.key==="Enter"&&F()};return r<=1?null:fe("div",{className:`flex flex-wrap items-center justify-center gap-3 ${e}`,children:[fe("div",{className:"flex items-center gap-2",children:[fe(x,{variant:"outline",size:"sm",onClick:h,disabled:s===1,className:"px-2 py-1 text-sm hover:bg-muted",children:[te(ta,{className:"h-4 w-4"}),"Previous"]}),te("div",{className:"flex items-center gap-2",children:p.map((g,N)=>{if(g==="...")return te("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${N}`);let k=g,D=k===s;return te(x,{variant:D?"default":"outline",size:"sm",onClick:()=>A(k),className:D?"border-blue-600 bg-blue-600 px-3 py-1 text-sm text-white":"border px-3 py-1 text-sm hover:bg-muted hover:text-foreground",children:k},k)})}),fe(x,{variant:"outline",size:"sm",onClick:M,disabled:s===r,className:"px-2 py-1 text-sm hover:bg-muted",children:["Next",te(aa,{className:"h-4 w-4"})]})]}),d&&fe("div",{className:"flex items-center gap-2",children:[te("span",{className:"text-sm text-muted-foreground",children:"Go to"}),te(Ae,{type:"number",min:1,max:r,value:t,onChange:g=>{let N=g.target.value.replace(/[^\d]/g,"");w(N)},onKeyDown:E,className:"h-8 w-16 px-2 py-1"}),te(x,{variant:"outline",size:"sm",onClick:F,disabled:t===""||Number(t)<1||Number(t)>r,children:"Go"})]})]})}import{pick as ca,startCase as he}from"lodash-es";import{Eye as da,FileImage as ma,FileSearch as ua,Info as pa}from"lucide-react";import{useCallback as At,useEffect as Ve,useMemo as Oe,useState as qe}from"react";import{useTranslation as ga}from"react-i18next";import{toast as It}from"sonner";import{keepPreviousData as oa,useMutation as sa,useQuery as yt,useQueryClient as Nt}from"@tanstack/react-query";import{useCallback as na}from"react";import{toast as la}from"sonner";var wt=s=>{let r=je(),b=Re(),{query:c,provider:d,filters:e={},page:t=1,limit:w=20}=s,p=Object.fromEntries(Object.entries(e).filter(([A,h])=>h!=="default"&&h!=="all"));return yt({queryKey:[ie.SEARCH_IMAGES,c,d,p,t,w],queryFn:async()=>await b(r,{action:ie.SEARCH_IMAGES,data:{query:c,provider:d,filters:p,page:t,limit:w}}),enabled:!!c,staleTime:1/0,placeholderData:oa})},bt={query:"",provider:"",filters:{},page:1},_e=["DAM_SEARCH_STATE"],St=()=>{let s=Nt(),{data:r}=yt({queryKey:_e,queryFn:()=>{var c;return(c=s.getQueryData(_e))!=null?c:bt},staleTime:1/0,gcTime:1/0,initialData:bt}),b=na(c=>{s.setQueryData(_e,d=>({...d,...c}))},[s]);return{searchState:r,updateSearchState:b}},Pe=()=>{let s=je(),r=Re(),b=Nt();return sa({mutationFn:async c=>r(s,{action:ie.DOWNLOAD_SEARCH_IMAGE,data:{url:c.url,name:c.name,description:c.description||{en:c.name}}}),onSuccess:()=>{b.invalidateQueries({queryKey:[ie.GET_ASSETS]})},onError:c=>{la.error(c.message||"Something went wrong. Please try again")}})};import{Fragment as xa,jsx as f,jsxs as P}from"react/jsx-runtime";var fa=["id","url","thumbnailUrl","width","height","description","provider","authorName","authorUrl","authorThumbnailUrl","providerUrl","providerLogoUrl"],ha={orientation:["default","landscape","portrait","squarish"]},va=({onSelect:s,multiple:r,close:b})=>{var R;let{t:c}=ga(),d=Se("dam"),e=Oe(()=>{var v;return((v=d==null?void 0:d.searchImages)==null?void 0:v.providers)||[]},[d]),{searchState:t,updateSearchState:w}=St(),[p,A]=qe(t.query||""),[h,M]=qe(null),[F,E]=qe(null);Ve(()=>{A(t.query)},[t.query]);let{query:g,provider:N,page:k,filters:D}=t,m=N||((R=e[0])==null?void 0:R.id),j=Oe(()=>e.find(v=>v.id===m),[e,m]),O=Oe(()=>(j==null?void 0:j.filters)||ha,[j]),{data:G,isLoading:$,isFetching:S,isError:U}=wt({query:g,provider:m,filters:D,page:k}),I=(G==null?void 0:G.total)||0,n=Math.ceil(I/20),{mutateAsync:u}=Pe();Ve(()=>{U&&It.error(c("Something went wrong. Please try again"))},[U,c]),Ve(()=>{let v={...D},W=!1;Object.entries(O).forEach(([_,Z])=>{let se=Z;!v[_]&&!se.includes("default")&&se.length>0&&(v[_]=se[0],W=!0)}),W&&w({filters:v})},[O,D,w]);let i=At(()=>{p.trim()&&w({query:p,page:1})},[p,w]),L=At(async v=>{M(v.id);try{let W=v.description||v.alt||v.name,_=await u({...v,name:v.name||W,description:{en:W}}),Z={...ca(_,fa),description:v.description||v.alt||v.name};s(r?[Z]:Z),b()}catch(W){console.error(W),It.error(c("Something went wrong. Please try again"))}finally{M(null)}},[b,u,r,s,c]);return{state:{providers:e,selectedProvider:m,searchInputValue:p,dbSearchQuery:g,currentPage:k,filters:D,isProcessing:h,availableFilters:O,data:G,isLoading:$||S,totalPages:n,previewImage:F},setters:{setSelectedProvider:v=>w({provider:v,page:1}),setSearchInputValue:A,setFilters:v=>{let W=typeof v=="function"?v(D):v;w({filters:W,page:1})},setCurrentPage:v=>w({page:v}),setPreviewImage:E},handlers:{handleSearch:i,handleUseImage:L},t:c}},Ct=({onSelect:s,multiple:r,close:b})=>{var n,u;let{state:c,setters:d,handlers:e,t}=va({onSelect:s,multiple:r,close:b}),{providers:w,selectedProvider:p,searchInputValue:A,dbSearchQuery:h,currentPage:M,filters:F,isProcessing:E,availableFilters:g,data:N,isLoading:k,totalPages:D,previewImage:m}=c,{setSelectedProvider:j,setSearchInputValue:O,setFilters:G,setCurrentPage:$,setPreviewImage:S}=d,{handleSearch:U,handleUseImage:I}=e;return P("div",{className:"flex flex-1 flex-col gap-4 overflow-hidden",children:[f("div",{className:"flex flex-col gap-3 p-1",children:P("div",{className:"flex items-end gap-2",children:[w.length>1&&P("div",{className:"flex min-w-40 flex-col gap-1",children:[f(J,{className:"text-[8px] font-medium uppercase text-muted-foreground",children:t("Provider")}),P(le,{value:p,onValueChange:j,children:[f(de,{className:"h-8",children:f(ce,{placeholder:t("Provider")})}),f(me,{children:w.map(i=>f(ue,{value:i.id,children:he(i.id)},i.id))})]})]}),P("div",{className:"relative flex-1",children:[f(J,{className:"text-[8px] font-medium uppercase text-muted-foreground",children:t("Search")}),f(ke,{value:A,setValue:O,placeholder:t("eg. bakery shop"),autoFocus:!0,onKeyDown:i=>{i.key==="Enter"&&U()}})]}),f("div",{className:"flex flex-wrap gap-2",children:Object.entries(g).map(([i,L])=>P("div",{className:"flex min-w-32 flex-col gap-1",children:[f(J,{className:"text-[8px] font-medium uppercase text-muted-foreground",children:t(he(i))}),P(le,{value:F[i]||"default",onValueChange:R=>G(v=>({...v,[i]:R})),children:[f(de,{className:"h-8 text-xs",children:f(ce,{placeholder:t(he(i))})}),f(me,{children:L.map(R=>f(ue,{value:R,children:R==="default"||R==="all"?`${t("All")} ${t(he(i))}`:he(R)},R))})]})]},i))}),f(x,{onClick:U,disabled:!A.trim(),children:t("Search")})]})}),f("div",{className:"min-h-0 flex-1 overflow-y-auto",children:h?k?f("div",{className:"grid grid-cols-2 gap-3 p-1 md:grid-cols-4 lg:grid-cols-5",children:[...Array(10)].map((i,L)=>f("div",{className:"aspect-square h-52 w-full animate-pulse rounded-lg bg-accent"},L))}):P(xa,{children:[f("div",{className:"grid grid-cols-2 gap-3 p-1 pb-16 md:grid-cols-4 lg:grid-cols-5",children:(n=N==null?void 0:N.assets)==null?void 0:n.map(i=>f("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border hover:border-primary/50",children:P("div",{className:"aspect-square relative flex-1 cursor-pointer overflow-hidden",onClick:()=>S(i),children:[f(ee,{src:i.thumbnailUrl,alt:i.name,className:"h-full w-full object-cover transition-transform group-hover:scale-105"}),P("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex items-start justify-between p-2",children:[i.authorName&&P("a",{href:i.authorUrl,target:"_blank",rel:"noopener noreferrer",className:"pointer-events-auto cursor-pointer rounded-md bg-black/40 px-1.5 py-0.5 text-[9px] font-medium text-white backdrop-blur-sm hover:bg-black/60",onClick:L=>L.stopPropagation(),children:["@",i.authorName]}),i.providerUrl&&f("a",{href:i.providerUrl,target:"_blank",rel:"noopener noreferrer",className:"pointer-events-auto cursor-pointer rounded-md bg-black/40 px-1.5 py-0.5 text-[9px] text-white",onClick:L=>L.stopPropagation(),children:i.providerLogoUrl?f("img",{src:i.providerLogoUrl,className:"h-3.5 object-contain",alt:i.provider}):i.provider.toUpperCase()})]}),f("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100",children:P("div",{className:"flex items-center gap-2",children:[f(x,{size:"sm",onClick:L=>{L.stopPropagation(),I(i)},disabled:!!E,loading:E===i.id,children:t("Use Image")}),f(x,{size:"sm",variant:"outline",onClick:L=>{L.stopPropagation(),S(i)},children:f(da,{className:"h-4 w-4"})})]})})]})},i.id))}),(!(N!=null&&N.assets)||((u=N==null?void 0:N.assets)==null?void 0:u.length)===0)&&P("div",{className:"flex h-[60%] flex-col items-center justify-center gap-2 text-muted-foreground",children:[f(ma,{className:"h-6 w-6"}),f("p",{className:"text-sm",children:t("No images found for your search")})]})]}):P("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-muted-foreground",children:[f(ua,{className:"h-6 w-6"}),f("p",{className:"text-sm",children:t("Search for images to get started")})]})}),!!h&&D>1&&f("div",{className:"bg-surface border-t p-4",children:f(Ue,{currentPage:M,totalPages:D,onPageChange:$,pageRangeDisplayed:3,showPageInput:!0})}),f(be,{open:!!m,onOpenChange:i=>!i&&S(null),children:P(ye,{className:"max-w-3xl overflow-hidden p-3",children:[f(we,{children:t("Preview Image")}),P("div",{className:"flex flex-col",children:[P("div",{className:"relative bg-black/5",children:[f(ee,{src:(m==null?void 0:m.url)||(m==null?void 0:m.thumbnailUrl),alt:m==null?void 0:m.name,className:"h-full max-h-[70vh] w-full object-contain"}),P("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex items-start justify-between p-4",children:[(m==null?void 0:m.authorName)&&P("a",{href:m.authorUrl,target:"_blank",rel:"noopener noreferrer",className:"pointer-events-auto cursor-pointer rounded-md bg-black/40 px-2 py-1 text-xs font-medium text-white backdrop-blur-sm hover:bg-black/60",children:[t("@"),m.authorName]}),(m==null?void 0:m.providerUrl)&&f("a",{href:m.providerUrl,target:"_blank",rel:"noopener noreferrer",className:"pointer-events-auto cursor-pointer rounded-md bg-black/40 px-2 py-1 text-[10px] text-white",children:m.providerLogoUrl?f("img",{src:m.providerLogoUrl,className:"h-5 object-contain",alt:m.provider}):t((m==null?void 0:m.provider)||"")})]})]}),P("div",{className:"flex p-2",children:[f(Ne,{className:"flex-1"}),P("div",{className:"flex w-full items-center justify-end gap-2",children:[P("div",{className:"flex items-start gap-2 rounded-lg bg-primary/5 p-2 text-sm text-primary",children:[f(pa,{className:"mt-0.5 h-4 w-4 shrink-0"}),f("p",{className:"text-xs leading-relaxed",children:t("This image will be added to your website assets")})]}),f(x,{variant:"default",onClick:()=>{I(m)},disabled:!!E,loading:E===(m==null?void 0:m.id),children:t("Use Image")})]})]})]})]})})]})};import{AlertCircle as ba,ChevronLeft as ya,Copy as kt,Pencil as Na,Wand2Icon as wa}from"lucide-react";import Sa,{useEffect as Aa,useState as Ee}from"react";import{useTranslation as Ia}from"react-i18next";import{toast as ve}from"sonner";import{jsx as y,jsxs as z}from"react/jsx-runtime";function Ca(s){let r=isNaN(s)?0:typeof s=="number"?s:parseInt(s);return r?r<1024?`${r.toFixed(2)} B`:r<1024*1024?`${(r/1024).toFixed(2)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`:"0 B"}function Dt(s){if(!s)return"N/A";let r=new Date(s);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function ka(s,r,b="en"){let c=s||{},d=typeof(r==null?void 0:r.description)=="string"?{[b]:r.description}:(r==null?void 0:r.description)||{},e=Object.keys(c),t=Object.keys(d),w=new Set([...e,...t]);for(let p of w){let A=c[p]||"",h=d[p]||"";if(A!==h)return!0}return!1}var Tt=({assetId:s,onBack:r,onEdit:b,onSave:c,isSaving:d})=>{var I;let{t:e}=Ia(),{data:t,isLoading:w,isError:p}=vt(s||""),[A,h]=Ee({}),[M,F]=Ee(!1),{languages:E,fallbackLang:g,selectedLang:N}=tt(),[k,D]=Ee(N||g),[m,j]=Ee(!1),O=ne("flags.ai",!1),G=at(),$=[g,...E||[]];Aa(()=>{let n=new Image;return n.src=(t==null?void 0:t.url)||"",n.onload=()=>F(!0),()=>{n.onload=null}},[t]);let S=async(n,u)=>{try{await navigator.clipboard.writeText(n),ve.success(e("{{type}} copied to clipboard",{type:u}))}catch(i){ve.error(e("Failed to copy {{type}}",{type:u}),{description:i==null?void 0:i.message})}},U=async()=>{if(t!=null&&t.url){j(!0);try{let n=await G({body:{action:ie.AI_GENERATE_IMAGE_DESCRIPTION,data:{url:t.url,languages:$}}});n!=null&&n.translations?(h(n.translations),ve.success(e("Image description generated successfully. Please save to apply."))):ve.error(e("Failed to generate image description"))}catch(n){ve.error(e("Failed to generate image description"),{description:n==null?void 0:n.message})}finally{j(!1)}}};return Sa.useEffect(()=>{if(t!=null&&t.description)if(typeof t.description=="string")try{let n=JSON.parse(t.description);h(typeof n=="object"&&n!==null?n:{[g]:t.description})}catch(n){h({[g]:t.description})}else h(t.description);else h({})},[t,g]),w||!M?y("div",{className:"flex flex-1 items-center justify-center",children:y(re,{})}):p||!(t!=null&&t.id)?y("div",{className:"flex flex-1 items-center justify-center",children:z("div",{className:"mx-auto max-w-md p-6 text-center",children:[y("div",{className:"mb-4 flex justify-center",children:y(ba,{className:"h-12 w-12 text-gray-400"})}),y("h3",{className:"mb-2 text-lg font-medium text-foreground",children:e("No Asset Found")}),y("p",{className:"mb-6 text-sm text-muted-foreground",children:e(p?"There was an error loading the asset. Please try again later.":"The asset you're looking for doesn't exist or has been removed.")}),z("div",{className:"flex justify-center gap-4",children:[y(x,{variant:"outline",onClick:r,children:e("Back to Assets")}),p&&y(x,{variant:"default",onClick:()=>window.location.reload(),children:e("Try Again")})]})]})}):z("div",{className:"flex flex-1 flex-col gap-y-4 overflow-hidden",children:[z("div",{className:"flex items-center justify-between",children:[z(x,{variant:"outline",size:"sm",onClick:r,disabled:d||m,children:[y(ya,{className:"h-4 w-4"}),e("Back to Assets")]}),z("div",{className:"flex gap-2",children:[y(x,{variant:"outline",onClick:r,disabled:d||m,children:e("Cancel")}),z(x,{variant:"outline",onClick:()=>S(t.url,e("Asset URL")),disabled:d||m,children:[y(kt,{className:"mr-2 h-4 w-4"}),e("Copy URL")]}),z(x,{variant:"default",onClick:()=>b(t),disabled:d||m,children:[y(Na,{className:"h-4 w-4"}),e("Edit Image")]})]})]}),z("div",{className:"grid flex-1 grid-cols-2 items-start gap-6 overflow-hidden",children:[y("div",{className:"relative flex h-[calc(80vh-200px)] w-full items-start justify-center",children:y(ee,{src:t.url,alt:t.name,className:"h-full max-h-max w-full max-w-max rounded-lg object-contain"})}),z("div",{className:"space-y-2 overflow-y-auto",children:[z("div",{className:"grid gap-4 rounded-xl border bg-accent p-3",children:[y(J,{className:"text-sm font-medium text-foreground/80",children:e("Details")}),y("div",{className:"space-y-4",children:[{label:e("Name"),value:t.name,fullWidth:!0},{label:e("Type"),value:t.type,capitalize:!0},{label:e("Format"),value:(t==null?void 0:t.format)||t.type,capitalize:!0},{label:e("Size"),value:Ca(t.size)},{label:e("Dimensions"),value:`${t.width||0} \xD7 ${t.height||0}`},{label:e("Created"),value:Dt(t.createdAt)},{label:e("Updated"),value:Dt(((I=t.metadata)==null?void 0:I.updatedAt)||(t==null?void 0:t.updatedAt)||t.createdAt)},{label:e("URL"),value:(()=>{try{let n=new URL(t.url),u=n.pathname.split("/"),i=u.indexOf("dam-assets");return i!==-1?`${u.slice(i+1).join("/")}`:n.pathname}catch(n){return t.url}})(),copyable:!0,fullValue:t.url,fullWidth:!0}].reduce((n,u)=>{if(u.fullWidth)n.push([u]);else{let i=n[n.length-1];i&&i.length===1&&!i[0].fullWidth?i.push(u):n.push([u])}return n},[]).map((n,u)=>y("div",{className:"grid grid-cols-2 gap-4",children:n.map(i=>z("div",{className:i.fullWidth?"col-span-2":"col-span-1",children:[y(J,{className:"mb-1 block text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70",children:i.label}),z("div",{className:"flex items-start gap-2",children:[y("div",{className:"text-sm font-light leading-relaxed text-foreground "+(i.capitalize?" capitalize ":" ")+(i.fullWidth?" line-clamp-2 break-all":" truncate"),title:i.fullValue||i.value,children:i.value}),i.copyable&&y(x,{variant:"ghost",size:"icon-xs",onClick:()=>S(i.fullValue||i.value,i.label),children:y(kt,{className:"h-3 w-3"})})]})]},i.label))},u))})]}),t.usedOn&&t.usedOn.length>0&&z("div",{className:"grid gap-3",children:[y(J,{className:"text-base font-semibold text-foreground/80",children:e("Used On")}),y("div",{className:"grid grid-cols-1 gap-2 rounded-xl border bg-muted/20 p-3 text-sm",children:t.usedOn.map((n,u)=>z("div",{className:"flex items-center gap-2",children:[y("div",{className:"w-max text-left font-medium text-foreground",children:n.name}),z("div",{className:"text-muted-foreground/70",children:["(",n.slug,")"]})]},u))})]}),z("div",{className:"relative grid gap-1 rounded-xl border bg-accent p-3",children:[z("div",{className:"flex items-center justify-between gap-x-3",children:[y(J,{className:"flex items-center gap-1 text-sm font-medium text-foreground/80",children:e("Description")}),(E==null?void 0:E.length)>0&&z(le,{value:k,onValueChange:D,children:[y(de,{className:"bg-surface h-6 w-max gap-x-2 pr-1 text-xs ring-offset-background focus:ring-1 focus:ring-ring",children:y(ce,{})}),y(me,{children:$.map(n=>y(ue,{value:n,className:"text-xs",children:mt[n]||n},n))})]}),O&&y(x,{size:"xs",variant:"outline",className:"ml-auto h-6",onClick:U,disabled:m||d,"aria-label":e("Generate description with AI"),title:e("Generate description with AI"),children:m?y(re,{className:"!h-3 !w-3"}):y(wa,{className:"text-orange h-3 w-3"})}),y(x,{size:"xs",className:"h-6 px-3",loading:d,onClick:()=>c(A),disabled:d||!ka(A,t,g),children:e("Save")})]}),y(dt,{id:"description",value:A[k]||"",placeholder:e("Enter a description for the asset"),onChange:n=>h(u=>({...u,[k]:n.target.value})),rows:2,disabled:d||m,className:"bg-surface mt-1 resize-none text-sm transition-all focus-visible:ring-1"})]})]})]})]})};import{isEmpty as Da}from"lodash-es";import{AlertTriangle as Ta,Link as Ua,Upload as Pa}from"lucide-react";import{useCallback as Ut,useEffect as Ea,useState as Le}from"react";import{useDropzone as La}from"react-dropzone";import{useTranslation as Me}from"react-i18next";import{toast as ze}from"sonner";import{jsx as C,jsxs as q}from"react/jsx-runtime";var za=25*1024*1024;var Ma=({isUpdatingAsset:s})=>{let{t:r}=Me();return C("div",{className:"flex flex-col items-center px-6",children:q("div",{className:"flex items-center justify-center gap-2 leading-tight",children:[C("div",{className:"flex items-center justify-center rounded-full border border-muted-foreground/30 bg-muted/30 p-2",children:C(re,{})}),q("div",{className:"text-left",children:[C("div",{className:"text-sm font-medium text-foreground",children:r(s?"Updating file...":"Uploading file...")}),q("div",{className:"text-xs font-light text-muted-foreground",children:[r("Please wait while we")," ",r(s?"update":"upload")," ",r("your file...")]})]})]})})},Ba=({allowedTypes:s,optimizeImages:r,setOptimizeImages:b,onSwitchToUrl:c})=>{let{t:d}=Me();return q("div",{className:"flex w-full items-center justify-between px-6",children:[q("div",{className:"flex items-center gap-2",children:[C("div",{className:"flex items-center justify-center rounded-full border border-muted-foreground/30 bg-muted/30 p-2",children:C(Pa,{className:"h-4 w-4 text-muted-foreground"})}),q("div",{className:"text-left",children:[q("div",{className:"flex items-center gap-1.5 text-sm",children:[C("span",{className:"text-muted-foreground",children:d("Drop your file here or")}),C("span",{className:"cursor-pointer font-medium text-primary underline-offset-4 transition-colors hover:text-primary/80 hover:underline",children:d("Browse")}),C("span",{className:"mx-0.5 h-3.5 w-[1px] bg-border","aria-hidden":"true"}),C("span",{role:"button",tabIndex:0,className:"cursor-pointer font-medium text-primary underline-offset-4 transition-colors hover:text-primary/80 hover:underline",onClick:e=>{e.stopPropagation(),c()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.stopPropagation(),c())},children:d("Upload via URL")})]}),q("div",{className:"text-xs font-light text-muted-foreground",children:[d("Accepted file types:")," ",C("span",{className:"capitalize text-foreground/80",children:s.join(", ")})]})]})]}),q("div",{className:"flex items-center gap-3",children:[q("div",{className:"flex items-center gap-2",children:[C("span",{className:"text-xs text-foreground",children:d("Image Optimization")}),C(rt,{checked:r,onCheckedChange:e=>b(e),onClick:e=>e.stopPropagation()})]}),C(pe,{content:d("Warning: Unoptimized images may affect performance and page load times"),side:"top",showTooltip:!r,children:C("span",{className:oe("text-warning cursor-help items-center transition-opacity",r?"hidden":"flex"),children:C(Ta,{className:"h-4 w-4"})})})]})]})},Fa=({urlInputValue:s,setUrlInputValue:r,isUploading:b,onUpload:c,onSwitchToFile:d})=>{let{t:e}=Me();return q("div",{className:"flex w-full items-center gap-4 px-6",children:[C("div",{className:"flex shrink-0 items-center justify-center rounded-full border border-muted-foreground/30 bg-muted/30 p-2",children:C(Ua,{className:"h-4 w-4 text-muted-foreground"})}),q("div",{className:"flex flex-1 items-center gap-2",children:[C(Ae,{type:"url",placeholder:e("Paste direct image URL here (jpg, png, webp, etc.)..."),value:s,onChange:t=>r(t.target.value),onKeyDown:t=>{t.key==="Enter"&&c()},className:"h-8 flex-1 text-xs",disabled:b}),C(x,{size:"sm",onClick:c,disabled:!s.trim()||b,loading:b,children:e("Upload")}),C(x,{variant:"outline",size:"sm",onClick:d,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&d()},children:e("Cancel")})]})]})},Pt=({isUpdatingAsset:s,allowedTypes:r,uploadAssets:b,isUploadingAsset:c,onUploaded:d})=>{let{t:e}=Me(),[t,w]=Le("file"),[p,A]=Le(()=>{let S=localStorage.getItem("chai_optimize_images");return S!==null?S==="true":!0}),[h,M]=Le(""),[F,E]=Le(!1),{mutateAsync:g}=Pe();Ea(()=>{localStorage.setItem("chai_optimize_images",p.toString())},[p]);let N=s||c,k=Ut(async S=>{try{if(!S.every(u=>u.type.startsWith("image/")))return ze.error(e("Invalid file type. Please upload a valid file.")),Promise.reject(new Error("Invalid file type"));let U=S.map(async u=>{let i=u;return u.type.startsWith("image/")&&p&&(i=await pt(u)),new Promise((L,R)=>{let v=new FileReader;v.readAsDataURL(i),v.onload=()=>L({file:v.result,folderId:void 0,name:u.name,optimize:p}),v.onerror=()=>R(null)})}),I=await Promise.all(U),n=await b(I);return(n==null?void 0:n.length)===1&&d(n[0]),n}catch(U){return Promise.reject(U)}},[b,p,d,e]),D=S=>{let U=[],I=0;return S.forEach(n=>{n.size>za?I++:U.push(n)}),I>0&&ze.error(`${I===1&&S.length===1?e("File"):I+e(I===1?" file":" files")} ${e("exceed the maximum size limit of 25MB.")}`),Da(U)?[]:k(U)};async function m(S){return new Promise(U=>{let I=new Image;I.onload=()=>U(!0),I.onerror=()=>U(!1),I.src=S})}let j=Ut(async()=>{var I;let S=h.trim();if(!S)return;if(!await m(h)){ze.error(e("Please enter a valid image URL (http or https)."));return}E(!0);try{let n=(I=S.split("/").pop())==null?void 0:I.split("?")[0],u=n&&n.length>0?n:"untitled-image.jpg",i=await g({id:S,url:S,name:u,thumbnailUrl:S,type:"image",provider:"url",description:{en:u}});d(i),M("")}catch(n){ze.error(e("Failed to upload image from URL. Please check that the URL points to a valid image."))}finally{E(!1)}},[h,g,d,e]),{getRootProps:O,getInputProps:G,isDragActive:$}=La({onDrop:D,accept:{"image/*":r.includes("image")?[]:[]},disabled:s||c,multiple:!0});return C("div",{className:oe("flex h-[60px] w-full flex-col items-center justify-center rounded-lg border p-0 py-2 transition-colors",N||F?"pointer-events-none border-border bg-muted/50 opacity-90":$?"border-muted-foreground/50":"border-border bg-muted/10 hover:bg-background/50",t==="url"&&"bg-background/50"),children:t==="file"?q("div",{...O(),className:oe("flex h-max w-full cursor-pointer flex-col justify-center rounded-lg text-center",N?"items-start":"items-center"),children:[C("input",{...G()}),N?C(Ma,{isUpdatingAsset:s}):C(Ba,{allowedTypes:r,optimizeImages:p,setOptimizeImages:A,onSwitchToUrl:()=>w("url")})]}):C(Fa,{urlInputValue:h,setUrlInputValue:M,isUploading:F,onUpload:j,onSwitchToFile:()=>w("file")})})};import{Fragment as We,jsx as o,jsxs as T}from"react/jsx-runtime";var ar=Za.lazy(()=>import("./image-editor-RSEHWRGV.js")),Et=["id","url","width","height","description"];function rr({close:s,onSelect:r,mode:b="image",assetId:c,multiple:d=!1}){let{t:e}=er(),t=10,w=$e(()=>[b],[b]),[p,A]=Q(null),[h,M]=Q(null),[F,E]=Q([]),[g,N]=Q({show:!1,file:""}),[k,D]=Q(!1),[m,j]=Q(c?"details":"grid"),[O,G]=Q(""),[$,S]=Q(""),[U,I]=Q(1),[n]=Q(30),[u,i]=Q([]),[L,R]=Q("site"),v=ne("flags.dam.searchImages",!1),W=ne("flags.dam.genAI",!1);Ge(()=>{c&&(A(c),j("details"))},[c]),Ge(()=>{let a=setTimeout(()=>{G($),I(1)},300);return()=>clearTimeout(a)},[$]);let{data:_,isLoading:Z,refetch:se}=ht({search:O.toLowerCase().trim(),page:U,limit:n}),X=$e(()=>(_==null?void 0:_.assets)||[],[_==null?void 0:_.assets]),Lt=(_==null?void 0:_.total)||0,Y=Math.ceil(Lt/n);Ge(()=>{Z||Y<=0||I(a=>a>Y?Y:a<1?1:a)},[Z,Y]);let Fe=(X==null?void 0:X.length)>0,{mutateAsync:zt}=gt(),{mutateAsync:Ke,isPending:Mt}=Te(),{mutateAsync:He,isPending:Bt}=ft(),K=Se("flags",{}),Qe=xe(a=>{let l=Math.min(Math.max(1,a),Math.max(1,Y));l!==U&&I(l)},[Y,U]),Ft=xe((a,l=!1)=>{i(B=>{let V=ja(B,{id:a.id});return d||l?V?B.filter(ae=>ae.id!==a.id):[...B,a]:V?[]:[a]})},[d]),jt=xe(()=>{i([])},[]),Xe=a=>{let l=a!=null?a:u;(l==null?void 0:l.length)!==0&&r(d?_a(l,B=>Be(B,Et)):Be(Ra(l),Et))},Rt=async a=>{M([a])},_t=async()=>{if(!h||h.length===0)return;let a=h.map(l=>l.id);E(a),await zt(a,{onSuccess:()=>{E([]),M(null),i(l=>l.filter(B=>!a.includes(B.id)))},onError:()=>{E([])}}),M(null)},Ze=$e(()=>{if(!Fe)return!1;let a=new Set(u.map(l=>l.id));return X.every(l=>a.has(l.id))},[X,u,Fe]),Vt=()=>{if(Ze){let a=new Set(X.map(l=>l.id));i(l=>l.filter(B=>!a.has(B.id)))}else i(a=>{let l=new Set(a.map(V=>V.id)),B=X.filter(V=>!l.has(V.id));return[...a,...B]})},Ot=a=>{A(a.id),j("details")},qt=async(a,l)=>{try{let B=localStorage.getItem("chai_optimize_images")!=="false";if(l){let V=await Ke([{file:a,folderId:void 0,name:g.name||"",optimize:B}]);if((V==null?void 0:V.length)>0){let ae=V[0];r({...Be(ae,["id","width","height","description"]),url:ae.url})}}else{let V=await He({id:g.id||"",file:a});if(V){let ae=V;r({...Be(ae,["id","width","height","description"]),url:ae.url})}}N({show:!1,file:""}),s()}catch(B){console.error(e("Error saving edited image:"),B)}},Gt=xe(a=>{i([a])},[]),$t=xe(a=>{Qe(a)},[Qe]);return T(We,{children:[T("div",{className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4",children:[T("div",{className:"flex flex-col gap-2",children:[o("div",{children:o("h1",{className:"text-lg font-medium text-foreground",children:e("Digital Asset Manager")})}),(v||W)&&m==="grid"&&o(it,{value:L,onValueChange:a=>R(a),children:T(ot,{children:[T(Ie,{value:"site",className:"px-3",children:[o(Ka,{className:"h-3 w-3"})," ",e("Website Assets")]}),W&&T(Ie,{value:"ai",className:"px-3",children:[o(qa,{className:"h-3 w-3"})," ",e("Generate with AI")]}),v&&T(Ie,{value:"search",className:"px-3",children:[o(Xa,{className:"h-3 w-3"})," ",e("Search Images")]})]})})]}),m==="grid"?L==="site"?T(We,{children:[o(Pt,{maxFileSize:t,allowedTypes:w,uploadAssets:Ke,isUpdatingAsset:Bt,isUploadingAsset:Mt,onUploaded:Gt}),T("div",{className:"relative flex flex-1 flex-col gap-y-3 overflow-hidden rounded-lg border p-2",children:[T("div",{className:"flex items-center justify-between gap-3",children:[o("div",{className:"relative w-80",children:o(ke,{setValue:S,value:$,placeholder:e("Search assets...")})}),T("div",{className:"flex items-center gap-x-2",children:[u.length>0?o("div",{className:"flex items-center justify-between",children:T("div",{className:"flex items-center gap-2",children:[u.length>1&&o(x,{variant:"outline",size:"sm",onClick:Vt,children:e(Ze?"Deselect all":"Select all")}),u.length>0&&o(We,{children:o(x,{variant:"outline",size:"sm",onClick:()=>jt(),title:e("Clear selection"),children:e("Clear")})}),u.length>1&&o(x,{variant:"destructive",size:"sm",onClick:()=>M(u),children:e("Delete selected")}),!d&&u.length<=1||d?o(x,{size:"sm",onClick:()=>Xe(u),disabled:u.length===0,children:d?e("Select {{count}} Assets",{count:u.length}):e("Select Asset")}):null]})}):null,o(x,{variant:"outline",size:"icon-sm",onClick:()=>se(),children:o(Qa,{className:"h-4 w-4"})})]})]}),o("div",{className:"flex-1 overflow-y-auto pb-[66px]",children:Z?T("div",{className:"flex flex-wrap gap-3 p-1",children:[o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"}),o("div",{className:"h-[180px] w-[180px] animate-pulse rounded bg-accent"})]}):!Z&&!Fe?T("div",{className:"flex h-full flex-col items-center justify-center rounded-lg border",children:[o("div",{className:"text-muted-foreground",children:o(Oa,{className:"h-9 w-9 text-muted-foreground"})}),o("div",{className:"text-lg text-muted-foreground",children:e("No assets found")}),o("div",{className:"text-sm text-muted-foreground",children:O.length>0?e("No assets found for your search: {{query}}",{query:O}):e("Start uploading assets to get started")}),o("br",{})]}):o("div",{className:"flex flex-wrap gap-3 p-1",children:X==null?void 0:X.map(a=>T("div",{className:oe("group relative flex max-h-[180px] min-h-[180px] max-w-[180px] cursor-pointer flex-col items-center justify-between overflow-hidden rounded-lg border transition-all",u.some(l=>l.id===a.id)?"border-primary":"hover:border-foreground/20",F.includes(a.id)?"pointer-events-none opacity-50":""),onClick:l=>Ft(a,l.ctrlKey||l.metaKey),onDoubleClick:()=>Xe([a]),children:[T("div",{className:"aspect-square flex-1 overflow-hidden",children:[F.includes(a.id)?o("div",{className:"bg-surface/80 absolute inset-0 flex items-center justify-center",children:o(re,{})}):null,a.type==="image"?o(ee,{src:`${a.thumbnailUrl}`,alt:a.name,className:`h-full min-h-full w-full object-contain duration-300 group-hover:scale-105 ${u.some(l=>l.id===a.id)?"":"group-hover:contrast-50"}`}):T("div",{className:"flex h-full items-center justify-center",children:[o($a,{className:"h-12 w-12 text-muted-foreground"}),a.thumbnailUrl&&o(ee,{src:`${a.thumbnailUrl}`,alt:a.name,className:"absolute inset-0 h-full w-full object-cover"})]})]}),T("div",{className:"bg-surface flex w-full flex-shrink-0 items-center justify-between gap-1.5 border-t border-border px-2 py-1.5 text-foreground",children:[o(pe,{content:a.name,children:o("p",{className:"z-50 flex-1 truncate text-[11px] font-medium leading-tight",children:a.name})}),o("div",{className:"shrink-0 whitespace-nowrap text-[9px] font-medium text-muted-foreground/80",children:ut((a==null?void 0:a.size)||0)})]}),!u.some(l=>l.id===a.id)&&T("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden rounded-md bg-background/20 opacity-0 transition-opacity group-hover:opacity-100 has-[[data-state=open]]:opacity-100",children:[o(pe,{content:e("View Details"),children:T(x,{variant:"secondary",size:"sm",onClick:l=>{l.stopPropagation(),Ot(a)},children:[o(Wa,{className:"h-4 w-4"}),e("View")]})}),o("div",{className:"absolute right-1.5 top-1.5",children:T(st,{children:[o(nt,{asChild:!0,children:o(x,{variant:"secondary",size:"icon-sm",className:"h-7 w-7 rounded-sm opacity-80 focus-within:opacity-100 hover:opacity-100 focus:opacity-100 focus-visible:bg-muted",onClick:l=>l.stopPropagation(),children:o(Ha,{className:"h-4 w-4"})})}),T(lt,{align:"end",side:"bottom",className:"w-36",onClick:l=>l.stopPropagation(),children:[o(ct,{children:e("ACTIONS")}),o(Ce,{onClick:l=>{l.stopPropagation(),navigator.clipboard.writeText(a.url),tr.success(e("Asset URL copied to clipboard"))},children:e("Copy URL")}),o(Ce,{onClick:l=>{l.stopPropagation(),N({id:a.id,show:!0,file:a.url,name:a.name})},children:e("Edit Image")}),o(Ce,{onClick:l=>{l.stopPropagation(),Rt(a)},children:K!=null&&K.trash?e(De().sidebarButton):e("Delete")})]})]})})]}),u.some(l=>l.id===a.id)&&o("div",{className:"absolute left-0 top-0 h-max rounded-br-lg bg-primary p-1",children:o(Ga,{className:"h-3 w-3 text-foreground",strokeWidth:5})})]},a.id))})}),Y>1&&o("div",{className:"bg-surface absolute bottom-0 left-0 right-0 z-50 border-t p-4",children:o(Ya,{fallback:o("div",{className:"text-destructive",children:e("Error loading pagination")}),children:o(Ue,{currentPage:U,totalPages:Y,onPageChange:$t,pageRangeDisplayed:3,showPageInput:!0})})})]})]}):L==="search"?o(Ct,{onSelect:r,multiple:d,close:s}):o(xt,{onSelect:r,multiple:d,close:s,setActiveTab:R}):o(Tt,{assetId:p||c||"",onBack:()=>{j("grid"),A(null)},onEdit:a=>{N({id:a.id,show:!0,file:a.url,name:a.name})},onSave:async a=>{if(p){D(!0);try{let l=X.find(B=>B.id===p);l&&await He(Va(l,{description:a}))}finally{D(!1)}}},isSaving:k})]}),g.show&&o(Ja,{fallback:o(Je,{className:"top-0"}),children:o(ar,{imageUrl:g.file,onSave:qt,onClose:()=>N({show:!1,file:""}),defaultSavedImageName:g.name,isEditing:!!g.id})}),h&&h.length>0&&o(be,{open:!!h,onOpenChange:()=>M(null),children:T(ye,{children:[T(Ne,{children:[o(we,{children:K!=null&&K.trash?e(De().confirmMoveTitle):e("Delete Asset(s)")}),o(et,{children:K!=null&&K.trash?h.length===1?e('Are you sure you want to move "{{name}}" to archive?',{name:h[0].name}):e("Are you sure you want to move {{count}} assets to archive?",{count:h.length}):h.length===1?e('Are you sure you want to delete "{{name}}"? This action cannot be undone.',{name:h[0].name}):e("Are you sure you want to delete {{count}} assets? This action cannot be undone.",{count:h.length})})]}),T(Ye,{className:"gap-2 sm:gap-0",children:[o(x,{variant:"outline",onClick:()=>M(null),disabled:F.length>0,children:e("Cancel")}),o(x,{variant:"destructive",onClick:_t,loading:F.length>0,children:K!=null&&K.trash?e(De().moveToAction):e("Delete")})]})]})})]})}export{rr as default};
@@ -0,0 +1 @@
1
+ .FIE_topbar-save-menu{display:flex;flex-direction:column;gap:0;border-width:1px;padding-top:.5rem;padding-bottom:.5rem;font-size:.75rem;line-height:1rem;box-shadow:0 25px 50px -12px #00000040}.FIE_topbar-save-menu-item{font-size:.75rem;line-height:1rem}.FIE_topbar-save-menu-item:hover{background-color:#e5e7eb}.FIE_topbar-save-menu-item>span:first-child{height:1rem;width:1rem}#chai-image-editor-container>button{opacity:0}body{pointer-events:auto!important}
@@ -0,0 +1 @@
1
+ import{d as a,e as b}from"./chunk-IB2C3TWH.js";import"./chunk-MDMGXS5B.js";import"./chunk-YTPQSO7V.js";import"./chunk-346H4FEX.js";import"./chunk-CFNOB42V.js";import"./chunk-DZ72OHTD.js";import"./chunk-OSGXFZTA.js";import"./chunk-OQZ4EPOM.js";import"./chunk-CRJENCPR.js";import"./chunk-6M7V7BOM.js";import"./chunk-OR7KKUYT.js";import"./chunk-YDOQEFOK.js";import"./chunk-LWYDGDPW.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";export{a as dispatchChaiAction,b as tryChaiAction};
@@ -0,0 +1 @@
1
+ import{d as F}from"./chunk-HEKCKC7N.js";import{a as T}from"./chunk-7EXZXKW2.js";import"./chunk-T2YYNX6Z.js";import{e as w}from"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import{a as y}from"./chunk-WEVKAJMV.js";import{d as C}from"./chunk-ZAU65LBG.js";import{a as D,f as P,g as b,i as I,j as E}from"./chunk-RBDZDQZR.js";import{a as A}from"./chunk-2N4IJZOR.js";import{a as N}from"./chunk-4JBHWPMO.js";import{b as v}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-T32TW3XV.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{initial as Q,isEmpty as j}from"lodash-es";import{File as K}from"lucide-react";import{useState as p}from"react";import{useTranslation as M}from"react-i18next";import{useMutation as H,useQueryClient as O}from"@tanstack/react-query";import{toast as G}from"sonner";var L=()=>{let s=C(),r=O(),g=w();return H({mutationFn:async({pageId:e,name:f,slug:m})=>{let u={pageId:e,name:f};return m&&(u.slug=m),await g(s,{action:"DUPLICATE_PAGE",data:u})},onSuccess:()=>{r.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),r.invalidateQueries({queryKey:[y.GET_CHANGES],refetchType:"all"}),G.success("Page duplicated successfully")},onError:e=>{G.error("Failed to duplicate page",{description:e.message||"An error occurred while duplicating the page"})}})};import{jsx as t,jsxs as a}from"react/jsx-runtime";var R=({page:s,onClose:r,closePanel:g=()=>{}})=>{let{t:e}=M(),{mutate:f,isPending:m}=L(),[u,i]=p(null),[d,_]=p(`${s.name} (Copy)`),q=T(),n=j(s.slug),[c,U]=p(n?"":`${s.slug.split("/").pop()}-copy`),h=n?"":Q(s.slug.split("/")).join("/"),[B,x]=p(!1),$=o=>{if(o.preventDefault(),!d.trim()){i(e("Name is required"));return}if(!n&&!c.trim()){i(e("Slug is required"));return}i(null),x(!0);let S={pageId:s.id,name:d};n||(S.slug=`${h}/${c}`),f(S,{onSuccess:l=>{x(!1),r(),q(l.id,g)},onError:l=>{x(!1),l.code==="SLUG_EXISTS"?i(e("A page with this slug already exists. Please choose a different slug.")):l.code==="INVALID_SLUG"?i(e("The slug format is invalid. Please use only lowercase letters, numbers, and hyphens.")):l.code==="PERMISSION_DENIED"?i(e("You don't have permission to duplicate this page.")):i(l.message||e("Failed to duplicate page. Please try again later."))}})};return t(D,{open:!!s,onOpenChange:r,children:a(P,{className:"sm:max-w-[425px]",children:[a(b,{children:[t(I,{children:e("Duplicate Page")}),t(E,{children:e("Create a copy of the page with a new name and slug")})]}),a("div",{className:"space-y-3 rounded-lg border bg-gradient-to-br from-accent/50 to-accent/30 px-3 py-2 shadow-sm",children:[a("div",{className:"flex items-center gap-2",children:[t("div",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/10",children:t(K,{className:"h-3 w-3 text-primary"})}),t("div",{className:"text-xs text-foreground",children:e("Current Page Details")})]}),a("div",{className:"space-y-2",children:[a("div",{className:"flex items-start gap-2",children:[a("span",{className:"min-w-[45px] text-xs font-medium text-muted-foreground",children:[e("Name"),":"]}),t("span",{className:"flex-1 text-xs font-medium text-foreground",children:s.name})]}),!n&&a("div",{className:"flex items-start gap-2",children:[a("span",{className:"min-w-[45px] text-xs font-medium text-muted-foreground",children:[e("Slug"),":"]}),t("code",{className:"flex-1 font-mono text-xs text-foreground",children:s.slug})]}),a("div",{className:"flex items-start gap-2",children:[a("span",{className:"min-w-[45px] text-xs font-medium text-muted-foreground",children:[e("Type"),":"]}),t("span",{className:"inline-flex items-center rounded-full text-xs text-foreground",children:s.pageType})]})]})]}),a("form",{onSubmit:$,className:"space-y-4",children:[a("div",{className:"space-y-1",children:[t(N,{htmlFor:"name",children:e("Name")}),t(A,{id:"name",value:d,onChange:o=>_(o.target.value),required:!0})]}),!n&&a("div",{className:"space-y-`",children:[t(N,{htmlFor:"slug",children:e("Slug")}),t(F,{value:c,onChange:o=>U(o),parentSlug:h,onValidationChange:o=>{i(o?null:e("Invalid slug"))}})]}),u&&t("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}),a("div",{className:"flex justify-end gap-2",children:[t(v,{type:"button",variant:"outline",onClick:r,disabled:m,children:e("Cancel")}),t(v,{loading:m||B,type:"submit",disabled:!d.trim()||!n&&!c.trim(),children:e("Duplicate")})]})]})]})})},me=R;export{me as default};
@@ -0,0 +1 @@
1
+ import"./chunk-ZRFCEMYU.js";import"./chunk-34HIOUTE.js";import"./chunk-CA5PVX24.js";import"./chunk-MEROMQQX.js";import"./chunk-SYPALJAE.js";import{s as z}from"./chunk-F2V4N3LT.js";import"./chunk-R5ZTCDFD.js";import"./chunk-ZU2B5YT6.js";import"./chunk-IUACZ3E6.js";import"./chunk-QGVCH2NI.js";import"./chunk-5ZC65NB6.js";import"./chunk-JBB5IJFA.js";import"./chunk-IAKCX2WB.js";import"./chunk-ZXKKBKGV.js";import"./chunk-K5YWQY4U.js";import"./chunk-ATLMLDBS.js";import"./chunk-ROQRBSK6.js";import"./chunk-7C4EQOAR.js";import"./chunk-F7YMHPEA.js";import"./chunk-D5SKCKSB.js";import"./chunk-2PJZUYIZ.js";import"./chunk-LNV5MRGV.js";import"./chunk-7EXZXKW2.js";import"./chunk-VL5WBPVV.js";import"./chunk-GJOOCKUE.js";import{a as $}from"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import{b as M,c as U,f as L,g as I}from"./chunk-PQHFT4TE.js";import{f as k}from"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-LRJREWRD.js";import"./chunk-HAKJOMCL.js";import{xa as b}from"./chunk-2NYUIXUX.js";import"./chunk-WHPIYGCY.js";import"./chunk-HA7LF3RV.js";import"./chunk-PM3JNOZH.js";import"./chunk-WEVKAJMV.js";import"./chunk-YQPOFRXU.js";import"./chunk-55SU3QPU.js";import"./chunk-ZAU65LBG.js";import"./chunk-BQSLQHLD.js";import"./chunk-IH562KSP.js";import"./chunk-FERH2TPR.js";import"./chunk-ODSL3KXG.js";import"./chunk-TVF77C53.js";import"./chunk-777N6WHB.js";import"./chunk-OJJDRACB.js";import"./chunk-N7Z4RFFI.js";import"./chunk-WSQ5SQBD.js";import"./chunk-4P25MV5E.js";import"./chunk-6TXCHU4K.js";import"./chunk-J7Q62EP7.js";import"./chunk-YQ5QQCRD.js";import"./chunk-I7ODKVVX.js";import"./chunk-RBDZDQZR.js";import{a as P,b as y,i as E,j as Q}from"./chunk-4VNLL2IA.js";import"./chunk-FLSV2QGU.js";import"./chunk-2N4IJZOR.js";import"./chunk-4JBHWPMO.js";import"./chunk-3E72DJSP.js";import"./chunk-BWORNCTE.js";import"./chunk-SSENH35Y.js";import"./chunk-TEL5ACJE.js";import{b as h}from"./chunk-3IT7IIAV.js";import{b as N}from"./chunk-IP4JBQOX.js";import"./chunk-NSQEQYEM.js";import"./chunk-BYGD5CDT.js";import"./chunk-EPGOG22Q.js";import"./chunk-T32TW3XV.js";import"./chunk-TGJQC6VC.js";import"./chunk-ESCX7KEH.js";import"./chunk-CRJENCPR.js";import"./chunk-6M7V7BOM.js";import"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{get as v}from"lodash-es";import{ChevronDown as F,Pencil as H,Plus as q}from"lucide-react";import{lazy as K,Suspense as A,useState as B}from"react";import{Fragment as _,jsx as t,jsxs as r}from"react/jsx-runtime";var V=({page:n,isSelected:o,icon:i,onClick:u})=>t(Q,{onClick:u,className:`no-scrollbar flex cursor-pointer flex-col justify-start overflow-x-auto whitespace-nowrap ${o?"bg-muted-foreground/20":"hover:bg-muted/20"}`,children:t("div",{className:"w-full whitespace-nowrap px-1 text-xs",children:r("div",{className:"flex items-center gap-x-2",children:[i&&t("div",{className:"h-3 w-3 flex-shrink-0 opacity-60 [&>svg]:h-full [&>svg]:w-full",dangerouslySetInnerHTML:{__html:i}}),t("span",{title:n.name,className:"truncate text-xs font-medium",children:n.name})]})})},n.id),G=({dynamicPage:n,setDynamicPage:o,searchQuery:i,setSearchQuery:u,dynamicPages:a,icon:c,pageTypeName:m,isLoadingPages:e,createUrl:w,onCreateClick:g})=>{var D,C;let{selectedLang:l}=b(),d=(l==null?void 0:l.length)===0,{data:f,isFetching:x}=I(),{data:p}=U(),{t:j}=z(),S=p==null?void 0:p.find(s=>s.lang===l);return r(P,{children:[t(y,{asChild:!0,children:x?t(N,{className:"h-4 w-4 text-muted-foreground"}):r(h,{variant:"outline",size:"sm",className:"flex max-w-[150px] items-center justify-between gap-x-2 truncate rounded px-1 text-xs font-medium",children:[r("div",{className:"flex items-center gap-2 truncate",children:[c&&t("div",{dangerouslySetInnerHTML:{__html:c}}),t("span",{title:n?v(n,"name"):(D=v(S||f,"name"))!=null?D:"Select Page",className:"max-w-[145px] truncate text-start",children:n?v(n,"name"):(C=v(S||f,"name"))!=null?C:"Select Page"})]}),t(F,{className:"!h-3 !w-3"})]})}),r(E,{className:"ml-10 max-h-[350px] w-80 divide-y p-0.5 pb-3 shadow-xl",children:[r("div",{className:"flex items-center gap-x-1 overflow-hidden whitespace-nowrap p-2 text-xs font-light text-muted-foreground",children:[t("span",{className:"flex-shrink-0",children:j("Current Page")}),n&&r(_,{children:[t("span",{className:"flex-shrink-0",children:">"}),t("span",{title:n.name,className:"mr-2 truncate font-medium text-foreground",children:n.name})]})]}),r("div",{className:"mb-2 flex items-center gap-1 border-none px-1",children:[t($,{value:d?i:"",setValue:u,placeholder:d?`Search ${m}`:"To search select default language",disabled:!d,onKeyDown:s=>s.stopPropagation(),autoFocus:!0}),w&&g&&r(h,{variant:"ghost",size:"sm",className:"flex-shrink-0 text-primary",title:`Add new ${m}`,onClick:s=>{s.stopPropagation(),g()},children:[t(q,{className:"h-3.5 w-3.5"})," Add"]})]}),t("div",{className:"no-scrollbar max-h-[200px] overflow-y-auto pb-1",children:e?t("div",{className:"flex h-24 items-center justify-center",children:t(N,{className:"h-4 w-4"})}):(a==null?void 0:a.length)===0?t("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"No pages found"}):a==null?void 0:a.map(s=>t(V,{page:s,isSelected:s.id===(n==null?void 0:n.id),icon:c,onClick:()=>o(s)},s.id))})]})]})},O=K(()=>import("./edit-url-panel-Q3NJCV55.js").then(n=>({default:n.EditUrlPanel}))),J=()=>{let{dynamicPage:n,allLangPages:o,searchQuery:i,updateDynamicPage:u,updateSearchQuery:a,isFetching:c}=M(),{data:m}=L(),e=k(m==null?void 0:m.pageType),w=e==null?void 0:e.icon,[g,l]=B(!1),[d,f]=B(!1),x=e!=null&&e.editUrl&&(n!=null&&n.id)?e==null?void 0:e.editUrl.replace("{{ID}}",n.id):null,p=typeof(e==null?void 0:e.pluralName)=="string"?e.pluralName:typeof(e==null?void 0:e.name)=="string"?e.name:"Pages";return r("div",{className:"relative flex items-center gap-1",children:[t(G,{dynamicPage:n,setDynamicPage:u,searchQuery:i,setSearchQuery:a,dynamicPages:o!=null?o:[],icon:w,pageTypeName:p,isLoadingPages:c,createUrl:e==null?void 0:e.createUrl,onCreateClick:()=>f(!0)}),x&&n&&r(_,{children:[t(h,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 text-muted-foreground hover:text-foreground",title:`Edit ${n.name}`,onClick:()=>l(!0),children:t(H,{className:"!h-3 !w-3"})}),g&&t(A,{children:t(O,{url:x,label:`Edit: ${n.name}`,onClose:()=>l(!1)})})]}),d&&(e==null?void 0:e.createUrl)&&t(A,{children:t(O,{url:e.createUrl,label:`Add new ${(e==null?void 0:e.name)||""}`,onClose:()=>f(!1)})})]})},oe=J;export{oe as default};
@@ -0,0 +1 @@
1
+ .FIE_topbar-save-menu{display:flex;flex-direction:column;gap:0;border-width:1px;padding-top:.5rem;padding-bottom:.5rem;font-size:.75rem;line-height:1rem;box-shadow:0 25px 50px -12px #00000040}.FIE_topbar-save-menu-item{font-size:.75rem;line-height:1rem}.FIE_topbar-save-menu-item:hover{background-color:#e5e7eb}.FIE_topbar-save-menu-item>span:first-child{height:1rem;width:1rem}#chai-image-editor-container>button{opacity:0}body{pointer-events:auto!important}
@@ -0,0 +1 @@
1
+ "use client";import{a as x}from"./chunk-JUIS55JT.js";import{a as m,f as u,g as p,i as g}from"./chunk-RBDZDQZR.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{useCallback as C,useMemo as y,useRef as w,useState as N}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";function P(t,e){return t.replace(/\{\{ID\}\}/g,e)}function O(t){try{return new URL(t,window.location.href).origin===window.location.origin}catch(e){return!1}}function R({url:t,label:e,onClose:i}){let o=y(()=>O(t),[t]),[h,a]=N(!0),c=w(null),s=w(!1),v=C(async r=>{var d,f;if(r){a(!0);return}if(s.current)return;if(!o){a(!1),i();return}s.current=!0;let D=(f=await((d=c.current)==null?void 0:d.requestClose()))!=null?f:!0;s.current=!1,D&&(a(!1),i())},[o,i]);return n(m,{open:h,onOpenChange:v,children:l(u,{className:"flex max-h-[80vh] min-h-[70vh] min-w-[80%] flex-col gap-0 overflow-hidden p-0",onInteractOutside:r=>r.preventDefault(),onPointerDownOutside:r=>r.preventDefault(),children:[n(p,{className:"flex flex-row items-center justify-between border-b px-4 py-2.5 pr-10",children:n(g,{className:"text-xs font-medium",children:e!=null?e:"Edit"})}),n("div",{className:"relative flex-1 overflow-hidden",style:{height:"calc(80vh - 48px)"},children:o?n(x,{ref:c,src:t,deferInvalidation:!0,className:"absolute inset-0 h-full w-full border-0",title:e!=null?e:"Edit",sandbox:"allow-same-origin allow-scripts allow-forms"}):l("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground",children:[n("p",{className:"font-medium text-destructive",children:"Cross-origin URL blocked"}),l("p",{className:"max-w-xs text-xs",children:["Only same-domain URLs are allowed in the edit panel.",n("br",{}),n("span",{className:"mt-1 block break-all font-mono text-[10px] opacity-70",children:t})]})]})})]})})}export{R as EditUrlPanel,P as resolveEditUrl};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-JYBTQ3YX.js";import"./chunk-K6RHR4HT.js";import"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";export{a as getBlocksStyles};
@@ -0,0 +1 @@
1
+ import{f as a,g as b}from"./chunk-4PQNBY3V.js";import"./chunk-JYBTQ3YX.js";import"./chunk-DZ72OHTD.js";import"./chunk-OQZ4EPOM.js";import"./chunk-K6RHR4HT.js";import"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";export{a as fetchPageStylesUncached,b as getPageStyles};
@@ -0,0 +1 @@
1
+ .FIE_topbar-save-menu{display:flex;flex-direction:column;gap:0;border-width:1px;padding-top:.5rem;padding-bottom:.5rem;font-size:.75rem;line-height:1rem;box-shadow:0 25px 50px -12px #00000040}.FIE_topbar-save-menu-item{font-size:.75rem;line-height:1rem}.FIE_topbar-save-menu-item:hover{background-color:#e5e7eb}.FIE_topbar-save-menu-item>span:first-child{height:1rem;width:1rem}#chai-image-editor-container>button{opacity:0}body{pointer-events:auto!important}
@@ -0,0 +1 @@
1
+ import{a as v,f as h}from"./chunk-RBDZDQZR.js";import{c as I}from"./chunk-IP4JBQOX.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{debounce as A}from"lodash-es";import{Copy as L,Save as P}from"lucide-react";import D,{memo as _,useCallback as x,useEffect as w,useMemo as i,useState as m}from"react";import O from"react-filerobot-image-editor";import{useTranslation as z}from"react-i18next";import{jsx as p,jsxs as B}from"react/jsx-runtime";typeof window!="undefined"&&(window.React=D);var E=_(({imageUrl:r,onSave:u,onClose:c,defaultSavedImageName:C,isEditing:f=!1})=>{let{t:o}=z(),[T,n]=m(!1),[d,g]=m(!0),[F,R]=m(!1);w(()=>{let e=new Image;return e.src=r,e.onload=()=>R(!0),()=>{e.onload=null}},[r]),w(()=>{let e=a=>{a.key==="Escape"&&d&&(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation())};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[d]);let b=i(()=>A(async(e,a=!1)=>{n(!0);let t=e.imageBase64;await u(t,a),g(!1),n(!1)},300),[u]),s=x((e,a=!1)=>{b(e,a)},[b]),y=x(()=>{g(!1),c()},[c]),l=i(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],toolsIds:["Rotate"],defaultTabId:"Adjust",defaultToolId:"Rotate"}),[]),S=i(()=>({colors:{primary:"#1f8fff",secondary:"#212121",tertiary:"#000000"}}),[]),k=i(()=>f?[{label:o("Update this file"),onClick:(e,a)=>a((...t)=>{n(!0),s(t[0],!1)}),icon:P},{label:o("Save as new file"),onClick:(e,a)=>a((...t)=>{n(!0),s(t[0],!0)}),icon:L}]:[],[f,s,o]);return p(v,{open:!0,onOpenChange:e=>!e&&y(),children:B(h,{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:[T&&p(I,{}),d&&F&&p(O,{theme:S,source:r,onSave:s,onClose:y,Text:{text:o("Add text here")},Rotate:{angle:90,componentType:"slider"},tabsIds:l.tabsIds,defaultTabId:l.defaultTabId,defaultToolId:l.defaultToolId,savingPixelRatio:20,previewPixelRatio:6,defaultSavedImageName:C,moreSaveOptions:k,useZoomPresetsMenu:!0})]})})});E.displayName="ImageEditor";var J=E;export{J as default};
@@ -0,0 +1,8 @@
1
+ "use client";import{a as Q}from"./chunk-ROQRBSK6.js";import{e as W}from"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import{a as U}from"./chunk-WEVKAJMV.js";import{d as K}from"./chunk-ZAU65LBG.js";import{a as J}from"./chunk-IH562KSP.js";import{a as P,b as _,c as q}from"./chunk-FERH2TPR.js";import{a as j}from"./chunk-N7Z4RFFI.js";import{a as V,f as z,g as F,i as H}from"./chunk-RBDZDQZR.js";import{b as G}from"./chunk-TEL5ACJE.js";import{b as E}from"./chunk-3IT7IIAV.js";import{b as B}from"./chunk-IP4JBQOX.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{formatDate as oe}from"date-fns";import{isArray as le,isPlainObject as ce,isString as de,map as fe,mapValues as me,startsWith as Z,trim as ue}from"lodash-es";import{Check as ee,Copy as te,FileJson as pe}from"lucide-react";import{useMemo as L,useState as A}from"react";import{Diff as ge,Hunk as he,parseDiff as ye}from"react-diff-view";import{useQuery as re}from"@tanstack/react-query";import{replace as ie,startsWith as X}from"lodash-es";function Y(e,n){var c,p,i,g;let d=K(),a=W(),f=[e.uid,n.uid].some(y=>X(y,"draft:")||X(y,"live:")),r=(p=(c=e==null?void 0:e.item)==null?void 0:c.createdAt)!=null?p:null,s=(g=(i=n==null?void 0:n.item)==null?void 0:i.createdAt)!=null?g:null;return re({queryKey:["revision-comparison",e.uid,r,n.uid,s],queryFn:async()=>{if(!e.uid||!n.uid)throw new Error("Both revision IDs are required for comparison");let y=h=>h==="draft"||h==="live"?h:"revision",C=h=>ie(h.uid,`${h.label}:`,"");return await a(d,{action:U.GET_COMPARE_DATA,data:{versions:{version1:{type:y(e.label),id:C(e)},version2:{type:y(n.label),id:C(n)}}}})},enabled:!!e.uid&&!!n.uid,staleTime:f?0:1/0,refetchOnMount:f?"always":!1,gcTime:f?0:void 0})}import{jsx as t,jsxs as u}from"react/jsx-runtime";var be=({version:e})=>{let n=e==null?void 0:e.item,{data:d}=Q(n==null?void 0:n.currentEditor),a=e.label==="live",f=e.label==="draft";return u("span",{className:"flex min-h-8 items-center gap-x-2 rounded border bg-surface px-2 text-xs text-foreground shadow-lg",children:[t("div",{className:"h-full items-center rounded px-1.5 py-0.5 capitalize"+(a?" bg-success":f?" bg-warning":" bg-purple"),children:e.label}),u("div",{className:"py-1 text-xs font-light leading-none",children:[u("div",{children:[t("span",{className:"font-light",children:f?"Currently editing":"Published by"}),!f&&t("span",{className:"pl-1 font-medium",children:(d==null?void 0:d.name)||"Unknown"})]}),(n==null?void 0:n.createdAt)&&t("div",{className:"pt-0.5 text-[10px] font-light leading-tight text-muted",children:oe(n.createdAt,"dd MMM yyyy, h:mm a")})]})]})},ne=({version:e})=>t(be,{version:e});function xe(e,n,d="data.json"){let a=JSON.stringify(e,null,2),f=JSON.stringify(n,null,2),r=a.split(`
2
+ `),s=f.split(`
3
+ `),c=`--- a/${d}
4
+ `;c+=`+++ b/${d}
5
+ `;let p=[],i=0,g=0;for(;i<r.length||g<s.length;){let b=r[i]||"",h=s[g]||"";if(b===h)p.push(` ${b}`),i++,g++;else{let m=-1,v=-1;for(let o=i+1;o<r.length;o++)if(s[g]===r[o]){m=o;break}for(let o=g+1;o<s.length;o++)if(r[i]===s[o]){v=o;break}if(m!==-1&&(v===-1||m-i<=v-g)){for(let o=i;o<m;o++)p.push(`-${r[o]}`);i=m}else if(v!==-1){for(let o=g;o<v;o++)p.push(`+${s[o]}`);g=v}else b&&p.push(`-${b}`),h&&p.push(`+${h}`),i++,g++}}let y=r.length,C=s.length;return c+=`@@ -1,${y} +1,${C} @@
6
+ `,c+=p.join(`
7
+ `)+`
8
+ `,c}function O(e,n=!0,d=!1){if(de(e)){let a=ue(e);if(Z(a,"{")||Z(a,"[")||n&&(a==="true"||a==="false"||a==="null"||/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(a)))try{let r=JSON.parse(a);return O(r,n,d)}catch(r){if(d)throw new Error(`Invalid JSON string: ${a}`);return{}}return e}return le(e)?fe(e,a=>O(a,n,d)):ce(e)?me(e,a=>O(a,n,d)):e}var ve=e=>{switch(e){case"blocks":return"Blocks";case"seo":return"SEO";case"tracking":return"Tracking";default:return e}},Ne=(e,n)=>{if(!e||!n)return[{key:"blocks",label:"Blocks"}];let d=Object.keys(e),a=Object.keys(n);return d.filter(s=>a.includes(s)).map(s=>({key:s,label:ve(s)})).filter(s=>s.key.length>0)},we=(e,n=3)=>{let d=new Set;e.map((s,c)=>({change:s,index:c})).filter(({change:s})=>s.type!=="normal").map(({index:s})=>s).forEach(s=>{let c=Math.max(0,s-n),p=Math.min(e.length-1,s+n);for(let i=c;i<=p;i++)d.add(i)});let f=[],r=-1;return e.forEach((s,c)=>{if(d.has(c)){if(r!==-1&&c-r>1){let p=e[r].lineNumber!=null?e[r].lineNumber+1:r+2,i=e[c].lineNumber!=null?e[c].lineNumber-1:c;f.push({lineNumber:-(f.length+1),content:t(G,{className:"pointer-events-none w-60 -translate-x-1/2 cursor-default border-none bg-transparent py-1 shadow-none",children:u("span",{className:"rounded border border-border bg-surface px-3 py-1 text-[11px] font-light leading-none text-muted-foreground",children:["No changes from ",t("span",{className:"font-mono",children:p})," to"," ",t("span",{className:"font-mono",children:i})]})})})}f.push(s),r=c}}),f};function ke({open:e,compare:n,onOpenChange:d}){let a=n[0],f=n[1],[r,s]=A(null),[c,p]=A("split"),[i,g]=A(!1),[y,C]=A(!0),[b,h]=A("blocks"),{data:m,isLoading:v}=Y(a,f),{leftData:o,rightData:D,options:se}=L(()=>{var k,M;let l=(k=m==null?void 0:m.version1)==null?void 0:k[b],N=(M=m==null?void 0:m.version2)==null?void 0:M[b],w=O(l),x=O(N),S=Ne(m==null?void 0:m.version1,m==null?void 0:m.version2);return{leftData:w,rightData:x,options:S}},[m,b]),$=L(()=>!o||!D?"":xe(o,D),[o,D]),T=L(()=>{if(!$)return[];try{return ye($)}catch(l){return console.error("Failed to parse diff:",l),[]}},[$]),ae=L(()=>T.some(l=>{var N;return(N=l.hunks)==null?void 0:N.some(w=>{var x;return(x=w.changes)==null?void 0:x.some(S=>S.type!=="normal")})}),[T]),R=async(l,N)=>{try{await navigator.clipboard.writeText(JSON.stringify(l,null,2)),s(N),setTimeout(()=>s(null),2e3)}catch(w){console.error("Failed to copy:",w)}},I=l=>JSON.stringify(l,null,2);return t(V,{open:e,onOpenChange:d,children:u(z,{className:"flex h-[90vh] w-[95vw] max-w-[1900px] flex-col p-0",children:[t(F,{className:"border-b px-3 py-2",children:u(H,{className:"flex items-center justify-between gap-2 leading-none",children:[u("div",{className:"flex items-center gap-2",children:["Compare","",t(P,{value:b,onValueChange:h,children:t(_,{children:se.map(l=>t(q,{value:l.key,className:"px-3 text-xs",children:l.label},l.key))})})]}),t("div",{className:"flex flex-1 items-center justify-end pr-8",children:u("div",{className:"flex w-max items-center justify-end gap-2 divide-x-2 rounded-md border p-1.5",children:[u("div",{className:"flex items-center gap-2 px-2",children:[t(J,{disabled:i,checked:i?!0:c==="split",onCheckedChange:l=>p(l?"split":"unified")}),t("label",{className:"text-xs font-normal",children:"Split View"})]}),u("div",{className:"flex items-center gap-2 px-2",children:[t(J,{checked:i,onCheckedChange:l=>g(l)}),t("label",{className:"text-xs font-normal",children:"Show Raw Data"})]}),u("div",{className:"flex items-center gap-2 px-2",children:[t(J,{checked:y,onCheckedChange:l=>C(l)}),t("label",{className:"text-xs font-normal",children:"Hide Common Data"})]})]})})]})}),v?t("div",{className:"flex h-full w-full items-center justify-center",children:t(B,{className:"h-4 w-4"})}):t("div",{className:"flex min-h-0 flex-1 flex-col p-3",children:u("div",{className:"relative min-h-0 flex-1",children:[u("div",{className:"absolute -top-5 z-50 mt-0.5 flex w-full items-center justify-between gap-2",children:[t("div",{className:"flex w-1/2 items-center justify-center gap-2",children:t(ne,{version:a})}),t("div",{className:"flex w-1/2 items-center justify-center gap-2",children:t(ne,{version:f})})]}),i?u("div",{className:"grid h-full grid-cols-2 gap-3 rounded-lg border",children:[u("div",{className:"relative flex min-h-0 flex-col border-r",children:[t("div",{className:"absolute -top-4 right-4 z-50",children:u(E,{variant:"outline",size:"sm",onClick:()=>R(o,"left"),children:[r==="left"?t(ee,{className:"text-green-500"}):t(te,{}),"Copy"]})}),t(j,{className:"flex-1 rounded-lg bg-surface p-2 text-foreground",children:t("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:I(o)})})]}),u("div",{className:"relative flex min-h-0 flex-col",children:[t("div",{className:"absolute -top-4 right-4 z-50",children:u(E,{variant:"outline",size:"sm",onClick:()=>R(D,"right"),children:[r==="right"?t(ee,{className:"text-green-500"}):t(te,{}),"Copy"]})}),t(j,{className:"flex-1 rounded-lg bg-surface p-2 text-foreground",children:t("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:I(D)})})]})]}):t(j,{className:"h-full overflow-y-auto rounded-lg border bg-white",children:T.length===0||!ae?t("div",{className:"flex h-full min-h-80 items-center justify-center p-6",children:u("div",{className:"text-center text-muted-foreground",children:[t(pe,{className:"mx-auto mb-2 h-8 w-8 opacity-50"}),t("p",{children:T.length===0?"No differences found or unable to parse diff":"These versions are identical \u2014 no differences found"})]})}):t("div",{children:T.map((l,N)=>t("div",{className:"relative mb-4",children:t(ge,{viewType:c,diffType:l.type,hunks:l.hunks,className:"rounded-lg text-xs",children:w=>w.map((x,S)=>{let k=y?we(x.changes):x.changes;return(k==null?void 0:k.length)===0?null:t(he,{hunk:{...x,changes:k}},S)}).filter(x=>x!==null)},y?"hide-common-data":"show-common-data")},N))})})]})})]})})}export{ke as default};
@@ -0,0 +1 @@
1
+ .FIE_topbar-save-menu{display:flex;flex-direction:column;gap:0;border-width:1px;padding-top:.5rem;padding-bottom:.5rem;font-size:.75rem;line-height:1rem;box-shadow:0 25px 50px -12px #00000040}.FIE_topbar-save-menu-item{font-size:.75rem;line-height:1rem}.FIE_topbar-save-menu-item:hover{background-color:#e5e7eb}.FIE_topbar-save-menu-item>span:first-child{height:1rem;width:1rem}#chai-image-editor-container>button{opacity:0}body{pointer-events:auto!important}
@@ -0,0 +1 @@
1
+ import{a as X}from"./chunk-IAKCX2WB.js";import{b as h}from"./chunk-ATLMLDBS.js";import{i as Y}from"./chunk-VL5WBPVV.js";import"./chunk-GJOOCKUE.js";import"./chunk-CJP3BQH2.js";import{c as q,f as j}from"./chunk-PQHFT4TE.js";import{a as W,e as b}from"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import{xa as O}from"./chunk-2NYUIXUX.js";import{a as D}from"./chunk-HA7LF3RV.js";import"./chunk-WEVKAJMV.js";import"./chunk-ZAU65LBG.js";import{a as $,f as F,g as B,h as U,i as G,j as H}from"./chunk-RBDZDQZR.js";import{a as _,b as J,i as K,j as w}from"./chunk-4VNLL2IA.js";import{a as R}from"./chunk-2N4IJZOR.js";import{a as Q}from"./chunk-4JBHWPMO.js";import{a as V}from"./chunk-SSENH35Y.js";import{b as N}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import{a as m}from"./chunk-CRJENCPR.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{useSetAtom as pe}from"jotai";import{filter as de,find as ee,get as A,isEmpty as ge,map as fe}from"lodash-es";import{MoreHorizontal as he,PencilIcon as ye,Plus as ve,Power as Ne,StarIcon as Se,TrashIcon as Ce}from"lucide-react";import{lazy as te,Suspense as P,useMemo as se,useState as E}from"react";import{useTranslation as xe}from"react-i18next";import{find as ne,isEqual as re,startsWith as M}from"lodash-es";import{AlertCircle as le}from"lucide-react";import{useState as me}from"react";import{useTranslation as ue}from"react-i18next";import{toast as ce}from"sonner";import{jsx as c,jsxs as i}from"react/jsx-runtime";var Z=({page:s,onClose:y})=>{let{t:n}=ue(),[l,k]=me(s.slug||""),{mutate:S,isPending:C}=Y(),{data:o}=b(),r=ne(o,{key:s==null?void 0:s.pageType}),x=d=>{if(d.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(D).some(v=>l===`/${v}`||M(l,`/${v}/`))){ce.error(n("Error"),{description:n("Slugs cannot start with a language code for primary page")});return}S({...s,slug:l},{onSuccess:y})},p=(s==null?void 0:s.lang)||"";return c($,{open:!!s,onOpenChange:y,children:i(F,{children:[i(B,{children:[c(G,{children:n("Change Slug")}),c(H,{className:"text-xs",children:i(V,{variant:"destructive",className:"mt-2",children:[c(le,{className:"h-4 w-4"}),n("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),i("form",{onSubmit:x,children:[i("div",{className:"space-y-4 py-4 text-sm",children:[i("div",{className:"space-y-1",children:[i("div",{children:[i("span",{children:[n("Type"),":"]}),i("span",{className:"font-medium text-gray-600",children:[" ",(r==null?void 0:r.name)||(s==null?void 0:s.pageType)]})]}),i("div",{children:[i("span",{children:[n("Name"),":"]}),i("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),i("div",{className:"space-y-1",children:[i(Q,{htmlFor:"slug",className:"text-right",children:[n("Slug")," ",i("small",{className:"font-light text-gray-500",children:[n("Slug should start with")," /",p]})]}),c(R,{id:"slug",value:l,onChange:d=>{let g=d.target.value;M(g,`/${p}`)&&k(g)},className:"col-span-3",required:!0,pattern:"^/.*",title:n("Slug must start with /"),placeholder:n("Enter page slug")})]})]}),c(U,{children:c(N,{type:"submit",disabled:C||!M(l,`/${p}`)||re(s==null?void 0:s.slug,l),children:n(C?"Changing...":"Change Slug")})})]})]})})};import{jsx as e,jsxs as a}from"react/jsx-runtime";var be=te(()=>import("./delete-page-FQYTEMBN.js")),we=te(()=>import("./unpublish-page-CE3CJK5C.js")),De=()=>{let{t:s}=xe(),y=pe(X),{selectedLang:n,fallbackLang:l,setSelectedLang:k}=O(),{data:S,isFetching:C}=q(),{data:o}=j(),{data:r}=b(),x=se(()=>{let t=r==null?void 0:r.find(f=>f.key===(o==null?void 0:o.pageType));return o!=null&&o.dynamic?t==null?void 0:t.dynamicSlug:""},[r,o==null?void 0:o.pageType,o==null?void 0:o.dynamic]),[p,d]=E(null),[g,L]=E(null),[v,oe]=E(null),ae=se(()=>{let t=ee(r,{key:o==null?void 0:o.pageType});return(t==null?void 0:t.hasSlug)===!1},[o==null?void 0:o.pageType,r]),{data:I}=W(),ie=de(A(I,"languages")||["en"],t=>!ee(S,{lang:t})&&t!==A(I,"fallbackLang"));return a("div",{className:"space-y-1",children:[e("ul",{className:"space-y-1",children:C?a("div",{className:"w-full space-y-3 py-4",children:[e("div",{className:"h-8 w-full animate-pulse rounded bg-accent"}),e("div",{className:"h-8 w-full animate-pulse rounded bg-accent"}),e("div",{className:"h-8 w-full animate-pulse rounded bg-accent"})]}):fe(S,t=>{let f=t.lang,T=t.slug,z=!t.primaryPage;return a("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-muted-foreground ${f===n?"bg-primary/10":"border hover:bg-accent"}`,onClick:()=>k(f),children:[a("div",{className:"flex-1 gap-x-3",children:[a("div",{className:"flex items-center gap-x-2 text-[13px] text-foreground",children:[e("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-success":"bg-muted"}`}),A(D,z?l:f,f)]}),a("div",{children:[a("div",{className:"text-[11px] font-light text-muted-foreground",children:["Name:",a("b",{children:[" ",t.name," "]})]}),T&&a("div",{className:"text-[11px] font-light text-muted-foreground",children:["Slug: ",e("b",{className:"font-mono",children:x?`${T}/${x}`:T})]})]})]}),z?a("div",{className:"flex items-center gap-x-1 text-[11px] text-primary",children:[e(Se,{className:"h-3 w-3 fill-primary"}),"Default"]}):e("div",{className:"flex items-center gap-x-3",children:e(h,{permissions:[m["pages:update"],m["pages:delete"],m["pages:unpublish"]],children:a(_,{children:[e(J,{asChild:!0,onClick:u=>u.stopPropagation(),children:e(N,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e(he,{className:"h-4 w-4"})})}),a(K,{align:"end",className:"z-[9999] text-sm",children:[e(h,{permissions:[m["pages:update"]],children:a(w,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),y({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e(ye,{className:"size-3"}),s("Edit")]})}),e(h,{permissions:[m["pages:unpublish"]],children:(t==null?void 0:t.online)&&a(w,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),L(t)},children:[e(Ne,{className:"size-3"}),s("Unpublish")]})}),e(h,{permissions:[m["pages:delete"]],children:a(w,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),d(t)},children:[e(Ce,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id)})}),!ae&&e(h,{permissions:[m["pages:create"]],children:e("div",{className:"flex w-full justify-center pt-2",children:a(N,{variant:"outline",size:"sm",disabled:ge(ie),onClick:()=>{y({primaryPage:o==null?void 0:o.id,edit:!1})},children:[e(ve,{}),s("Add new language page")]})})}),p&&e(P,{children:e(be,{page:p,onClose:()=>d(null)})}),g&&e(P,{children:e(we,{page:g,onClose:()=>L(null)})}),v&&e(P,{children:e(Z,{page:v,onClose:()=>oe(null)})})]})},ns=De;export{ns as default};
@@ -0,0 +1 @@
1
+ import{a as b}from"./chunk-ONSZ462E.js";import{b as p}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{useAtomValue as y}from"jotai";import{ChevronUp as v,Minus as N,X as w}from"lucide-react";import{useEffect as E,useMemo as k,useRef as L,useState as h}from"react";import{jsx as r,jsxs as u}from"react/jsx-runtime";var C="https://chaibuilder.com/redirect/pro-license",g="https://chaibuilder.com/pro/license-overlay";function U(e){if(!e)return null;let t=Date.parse(e)-Date.now();return Number.isNaN(t)?null:Math.max(0,Math.floor(t/(1440*60*1e3)))}function P(e){try{return new URL(e).origin}catch(t){return null}}function S(e){if(!P(g))return null;try{let t=new URL(g),c=typeof document!="undefined"&&document.documentElement.classList.contains("dark")?"dark":"light";return t.searchParams.set("state",e.state),e.status&&t.searchParams.set("status",e.status),e.trialEndsAt&&t.searchParams.set("trialEndsAt",e.trialEndsAt),e.updatesUntil&&t.searchParams.set("updatesUntil",e.updatesUntil),t.searchParams.set("version",e.version),t.searchParams.set("licenseUrl",C),t.searchParams.set("theme",c),t.toString()}catch(t){return null}}var O=()=>{let e=y(b),t=L(null),[c,m]=h(!1),[x,l]=h(!1),i=(e==null?void 0:e.state)==="expired"||(e==null?void 0:e.state)==="version_blocked"||(e==null?void 0:e.state)==="limit_reached"||(e==null?void 0:e.state)==="invalid",a=i||x,d=k(()=>e&&a?S(e):null,[e,a]);if(E(()=>{var n;a&&((n=t.current)==null||n.focus())},[a,d]),!e)return null;if(a&&d){let n=e.state==="version_blocked"?"Update not covered by your license":e.state==="limit_reached"?"Domain limit reached":e.state==="invalid"?"Invalid license key":"ChaiBuilder Pro license required";return r("div",{ref:t,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,onClick:i?void 0:s=>s.target===s.currentTarget&&l(!1),onKeyDown:i?void 0:s=>s.key==="Escape"&&l(!1),className:"fixed inset-0 z-[999999] flex items-center justify-center bg-background/80 p-6 outline-none backdrop-blur-sm",children:u("div",{className:"relative h-[80%] w-[70%]",children:[!i&&r("button",{type:"button","aria-label":"Close",onClick:()=>l(!1),className:"absolute -right-3 -top-3 z-10 flex h-7 w-7 items-center justify-center rounded-full border border-border bg-surface text-foreground/70 shadow-md hover:text-foreground",children:r(w,{className:"h-4 w-4"})}),r("iframe",{title:"ChaiBuilder Pro license",src:d,sandbox:"allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-forms",className:"h-full w-full rounded-lg border border-border bg-surface shadow-xl"})]})})}let o=U(e.trialEndsAt);if(e.status==="trial"&&o!==null){let n=o<=3,s=o===0?"Ends today":`${o} ${o===1?"day":"days"} left`,f=r("span",{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${n?"bg-amber-500":"bg-emerald-500"}`,"aria-hidden":"true"});return c?u("div",{className:"fixed bottom-4 right-4 z-[999998] flex items-center gap-2 rounded-full border border-border bg-surface px-3 py-1.5 text-xs shadow-lg",children:[f,r("span",{className:"text-foreground/80",children:s}),r("button",{type:"button",onClick:()=>l(!0),className:"font-medium text-primary underline underline-offset-2",children:"Buy"}),r("button",{type:"button","aria-label":"Expand trial status",onClick:()=>m(!1),className:"text-foreground/50 hover:text-foreground",children:r(v,{className:"h-3.5 w-3.5"})})]}):u("div",{className:"fixed bottom-4 right-4 z-[999998] flex w-64 flex-col gap-2 rounded-lg border border-border bg-surface p-3 text-sm shadow-lg",children:[u("div",{className:"flex items-center gap-2",children:[f,r("span",{className:"font-medium text-foreground",children:"ChaiBuilder Pro trial"}),r("button",{type:"button","aria-label":"Minimize trial status",onClick:()=>m(!0),className:"ml-auto text-foreground/50 hover:text-foreground",children:r(N,{className:"h-3.5 w-3.5"})})]}),r("span",{className:"text-foreground/70",children:s}),r(p,{size:"sm",className:"w-full",onClick:()=>l(!0),children:"Buy License Key"})]})}return null},A=O;export{O as LicenseOverlay,A as default};
@@ -0,0 +1 @@
1
+ import{L as M,c as x,d as L}from"./chunk-YTPQSO7V.js";import"./chunk-346H4FEX.js";import{f as g,g as f,h as m}from"./chunk-CFNOB42V.js";import"./chunk-DZ72OHTD.js";import"./chunk-OSGXFZTA.js";import"./chunk-OQZ4EPOM.js";import"./chunk-CRJENCPR.js";import{a as k}from"./chunk-6M7V7BOM.js";import"./chunk-OR7KKUYT.js";import"./chunk-YDOQEFOK.js";import"./chunk-LWYDGDPW.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";var T=n=>{var r;return((r=k.find(e=>e.id===n))==null?void 0:r.multiplier)||1};async function p({userId:n,startTime:r,model:e,appId:S,creditStatus:y,response:t,prompt:o,error:d}){var I,q,U;let E=M().logging.clientId,R=r>0?Math.floor(new Date().getTime()-r):0;if(d){let l=o.indexOf("USER REQUEST"),c=o.substring(l).trim(),D={model:e,totalDuration:String(R),error:d,totalTokens:"0",tokenUsage:null,cost:null,prompt:c,user:n,client:E,app:S,creditSource:"monthly",addonId:null},{error:h}=await f(()=>g.insert(m.aiLogs).values(D));h&&console.error("Error logging AI request:",h);return}let i=t==null?void 0:t.totalUsage,b=(q=(I=t==null?void 0:t.providerMetadata)==null?void 0:I.gateway)==null?void 0:q.cost,v=o.indexOf("USER REQUEST");o=o.substring(v).trim();let a=Math.round(((U=i==null?void 0:i.totalTokens)!=null?U:0)*T(e)),u="monthly",s=null;if(y&&a>0){let l=x(y,a);if(u=l.creditSource,s=l.addonId,u==="addon"&&s){let c=await L(s,a);c.success||console.error("Failed to deduct addon credits:",c.error)}}let w={model:e,totalDuration:String(R),error:d||null,totalTokens:String(a),tokenUsage:i,cost:b,prompt:o,user:n,client:E,app:S,creditSource:u,addonId:s},{error:A}=await f(()=>g.insert(m.aiLogs).values(w));A&&console.error("Error logging AI request:",A)}export{p as logAiRequest};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-3XSKJBPH.js";import"./chunk-D5SKCKSB.js";import"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import"./chunk-2NYUIXUX.js";import"./chunk-WHPIYGCY.js";import"./chunk-FERH2TPR.js";import"./chunk-TVF77C53.js";import"./chunk-2N4IJZOR.js";import"./chunk-4JBHWPMO.js";import"./chunk-3E72DJSP.js";import"./chunk-BWORNCTE.js";import"./chunk-TEL5ACJE.js";import"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-CRJENCPR.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";export{a as default};
@@ -0,0 +1 @@
1
+ import{a as te}from"./chunk-3XSKJBPH.js";import{g as K,l as ee}from"./chunk-D5SKCKSB.js";import"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import{R as z,ba as F,ia as E,wa as T,xa as H}from"./chunk-2NYUIXUX.js";import"./chunk-WHPIYGCY.js";import{a as $,b as q,c as D,d as C}from"./chunk-FERH2TPR.js";import"./chunk-TVF77C53.js";import{a as R,f as M,g as _,i as j}from"./chunk-RBDZDQZR.js";import"./chunk-2N4IJZOR.js";import"./chunk-4JBHWPMO.js";import"./chunk-3E72DJSP.js";import{a as W,e as Y,f as V,g as X,h as G,i as J,j as Q,k as Z}from"./chunk-BWORNCTE.js";import"./chunk-TEL5ACJE.js";import{b as O}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-CRJENCPR.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import{a as L}from"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{EyeOpenIcon as Pe}from"@radix-ui/react-icons";import{Suspense as Ne,useCallback as de,useState as S}from"react";import{useTranslation as we}from"react-i18next";import{useTranslation as he}from"react-i18next";import{filter as ue,find as se,isEmpty as be,map as ne}from"lodash-es";var b=["xs","sm","md","lg","xl","2xl"],oe=t=>{if(t=t.trim().replace(/ +(?= )/g,""),be(t))return"";let r=ne(t.split(" "),K),s=[];for(let e of r){let o=e.mq;if(!s.includes(e.fullCls))for(let i=b.indexOf(o)+1;i<b.length;i++){let d=se(r,{property:e.property,mq:b[i]});if(d&&d.cls!==e.cls)break;se(r,{cls:e.cls,mq:b[i]})&&s.push(`${b[i]}:${e.cls}`)}}return ue(ne(r,e=>s.includes(e.fullCls)?null:e.fullCls),e=>e!==null).join(" ")};import{jsx as ae}from"react/jsx-runtime";var A=({activeToken:t})=>{let{t:r}=he(),s=t!=null&&t.value?oe(t.value):"";return ae("div",{className:"max-h-2/5 flex h-2/5 w-full items-start justify-center overflow-auto rounded-md border-transparent bg-background/80 p-2",children:ae("div",{className:s||void 0,children:r("Sample text with token styles applied")})})};import{ArrowRightIcon as ke,FileIcon as ie}from"@radix-ui/react-icons";import{noop as ve}from"lodash-es";import{useCallback as xe,useMemo as k}from"react";import{useTranslation as Te}from"react-i18next";import{jsx as h,jsxs as re}from"react/jsx-runtime";var y=({title:t,items:r,emptyLabel:s,onSelect:e,icon:o})=>re("div",{className:"space-y-1",children:[h("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:t}),r.length>0?h("div",{className:"space-y-1 overflow-y-auto",children:r.map(i=>h("button",{type:"button",onClick:()=>e(i.id),className:L("group flex w-full items-center justify-between rounded-md border px-3 py-1 text-left text-xs transition","text-foreground hover:border-muted-foreground/20 hover:bg-muted/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",i.isSelected&&"border-primary/40 bg-primary/10 text-primary"),children:re("span",{className:"flex items-center space-x-2",children:[o&&o,h("span",{className:"truncate",children:i.label})]})},i.id))}):h("div",{className:"rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground",children:s})]});import{jsx as l,jsxs as le}from"react/jsx-runtime";var De="#styles:",Ce=t=>{let s=[typeof t._name=="string"?t._name:void 0,typeof t._type=="string"?t._type:void 0].filter(Boolean).find(e=>e.trim().length>0);return s?s.length>40?`${s.slice(0,37)}...`:s:t._id},ye=(t,r)=>{let s=`${r}`;return t.filter(e=>Object.values(e).some(o=>typeof o!="string"||!o.startsWith(De)?!1:o.includes(s))).map(e=>({id:e._id,label:Ce(e)}))},Se=({tokenId:t,tokenName:r,children:s})=>{let{t:e}=Te(),[o]=E(),[i,d]=F(),p=T("pageId",""),u=T("siteWideUsage",{}),g=k(()=>ye(o,t),[o,t]),v=k(()=>g.map(n=>({id:n.id,label:n.label,isSelected:i.includes(n.id)})),[g,i]),m=k(()=>u?Object.entries(u).reduce((n,[w,f])=>(w===p||!(f!=null&&f.designTokens)||!Object.keys(f.designTokens).some(I=>typeof I!="string"?!1:I===t)||n.push({id:w,name:f.name||w,isPartial:!!f.isPartial}),n),[]):[],[u,t,p]),P=k(()=>m.filter(n=>!n.isPartial).map(n=>({id:n.id,label:n.name})),[m]),N=k(()=>m.filter(n=>n.isPartial).map(n=>({id:n.id,label:n.name})),[m]),x=xe(n=>{d([n])},[d]),ge=T("gotoPage",ve),{selectedLang:me,fallbackLang:fe}=H(),{savePageAsync:pe}=z(),U=async n=>{n&&(await pe(!0),ge({pageId:n,lang:me||fe}))};return le($,{defaultValue:"this-page",children:[le(q,{children:[l(D,{value:"this-page",className:"px-2 text-[11px]",children:e("Affected on this page")}),l(D,{value:"other-pages",className:"px-2 text-[11px]",children:e("Affected on other pages")}),l(D,{value:"partial-pages",className:"px-2 text-[11px]",children:e("Affected on partial blocks")})]}),l(C,{value:"this-page",children:l(y,{title:e("Blocks affected on this page"),items:v,emptyLabel:e("None"),onSelect:x,icon:l(ke,{fontSize:4})})}),l(C,{value:"other-pages",children:l(y,{title:e("Blocks affected on other pages"),items:P,emptyLabel:e("None"),onSelect:U,icon:l(ie,{fontSize:8})})}),l(C,{value:"partial-pages",children:l(y,{title:e("Blocks affected on partial blocks"),items:N,emptyLabel:e("None"),onSelect:U,icon:l(ie,{fontSize:8})})})]})},ce=Se;import{Fragment as B,jsx as a,jsxs as c}from"react/jsx-runtime";var Ae=({open:t,onOpenChange:r})=>{let{t:s}=we(),e=ee("designTokens"),[o,i]=S(null),[d,p]=S(!1),[u,g]=S(!1),[v,m]=S(null),P=de(x=>{if(!x&&d){g(!0);return}r(x)},[d,r]),N=de(()=>{g(!1),p(!1),r(!1)},[r]);return c(B,{children:[a(R,{open:t,onOpenChange:P,children:c(M,{className:"min-w-[900px] gap-0 space-y-0 p-0",children:[a(_,{className:"border-b p-3",children:c(j,{children:[a("h2",{className:"text-sm font-semibold",children:e}),c("p",{className:"text-xs font-light text-muted-foreground",children:[s("Create and manage reusable")," ",e.toLowerCase()]})]})}),c("div",{className:"flex max-h-[70vh] min-h-[450px] flex-1 overflow-hidden",children:[a("div",{className:"flex w-1/2 flex-col border-r p-3",children:a(te,{onActiveTokenChange:i,onDirtyStateChange:p,setCreatePreview:m})}),a("div",{className:"flex w-1/2 flex-col gap-2 p-3",children:o!=null&&o.id?c(B,{children:[a("div",{className:"text-xs text-foreground/80",children:s("Preview")}),a(A,{activeToken:o}),a(Ne,{fallback:null,children:a(ce,{tokenId:o==null?void 0:o.id,tokenName:o==null?void 0:o.name,children:a(O,{variant:"ghost",size:"icon-xs",children:a(Pe,{className:"!h-3 !w-3"})})})})]}):v?c(B,{children:[a("div",{className:"text-xs text-foreground/80",children:s("Preview")}),a(A,{activeToken:v})]}):a("div",{className:"flex h-full w-full items-center justify-center text-xs text-muted",children:s("Select a token to preview")})})]})]})}),a(W,{open:u,onOpenChange:g,children:c(Y,{children:[c(V,{children:[a(G,{children:s("Unsaved Changes")}),a(J,{children:s("You have unsaved changes. Are you sure you want to close? Your changes will be lost.")})]}),c(X,{children:[a(Z,{children:s("Continue Editing")}),a(Q,{onClick:N,children:s("Discard Changes")})]})]})})]})},pt=Ae;export{pt as default};
@@ -0,0 +1 @@
1
+ import{g as E}from"./chunk-VL5WBPVV.js";import"./chunk-GJOOCKUE.js";import"./chunk-CJP3BQH2.js";import"./chunk-PQHFT4TE.js";import{e as F}from"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-2NYUIXUX.js";import"./chunk-WEVKAJMV.js";import{a as L}from"./chunk-55SU3QPU.js";import"./chunk-ZAU65LBG.js";import{a as B}from"./chunk-ODSL3KXG.js";import{a as w,f as D,g as C,h as I,i as T,j as k}from"./chunk-RBDZDQZR.js";import{a as M}from"./chunk-2N4IJZOR.js";import{a as h}from"./chunk-4JBHWPMO.js";import{b as l}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-CRJENCPR.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{startCase as z}from"lodash-es";import{File as _,ImageIcon as $,Tag as K,X as Z}from"lucide-react";import{useCallback as j,useRef as q,useState as c}from"react";import{useTranslation as G}from"react-i18next";import{toast as A}from"sonner";import{jsx as e,jsxs as t}from"react/jsx-runtime";var J=1*1024*1024,Q=({page:n,onClose:d})=>{let{t:a}=G(),[p,u]=c(!1),[N,P]=c(""),[i,x]=c(""),[b,f]=c(!1),r=q(null),R=E(),{data:g}=F(),v=g==null?void 0:g.find(s=>s.key===n.pageType),S=(v==null?void 0:v.name)||z(n.pageType),U=j(s=>{var y;let m=(y=s.target.files)==null?void 0:y[0];if(m){if(m.size>J){A.error(a("File too large"),{description:`${a("Maximum file size is 1MB. Selected file is")} ${(m.size/1024).toFixed(2)}KB.`}),r.current&&(r.current.value="");return}try{f(!0);let o=new FileReader;o.onloadend=()=>{x(o.result),f(!1)},o.readAsDataURL(m)}catch(o){console.error("Error reading file:",o),f(!1),A.error(a("Failed to process image"),{description:o instanceof Error?o.message:a("Unknown error")})}}},[a]),H=()=>{x(""),r.current&&(r.current.value="")},O=()=>{var s;(s=r.current)==null||s.click()},X=()=>{u(!0),R.mutate({page:n,name:n.name,description:N.trim()||void 0,pageType:n.pageType,...i?{previewImage:i}:{}},{onSuccess:()=>{u(!1),d()},onError:()=>{u(!1)}})};return e(w,{open:!0,onOpenChange:d,children:t(D,{children:[t(C,{children:[e(T,{children:a("Mark as template")}),t(k,{className:"space-y-1 py-1 text-xs text-muted-foreground",children:[a("Are you sure you want to mark this page as a template?"),e("br",{}),a("Templates can be used to create new pages with the same content.")]})]}),t("div",{className:"mb-4 space-y-4 text-xs",children:[t("div",{className:"space-y-3 rounded border bg-muted/50 p-4",children:[t("div",{className:"flex items-center gap-2",children:[e(K,{className:"h-4 w-4 text-muted-foreground"}),t("span",{className:"font-medium text-muted-foreground",children:[a("Page Name"),":"]}),e("span",{className:"font-semibold",children:z(n.name)})]}),t("div",{className:"flex items-center gap-2",children:[e(_,{className:"h-4 w-4 text-muted-foreground"}),t("span",{className:"font-medium text-muted-foreground",children:[a("Type"),":"]}),e("span",{className:"font-semibold",children:S})]})]}),t("div",{children:[e(h,{htmlFor:"description",children:a("Description (Optional)")}),e(B,{id:"description",placeholder:a("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:N,onChange:s=>P(s.target.value)})]}),t("div",{className:"space-y-2",children:[e(h,{htmlFor:"previewImage",children:a("Preview Image (Optional)")}),t("div",{className:"space-y-2",children:[t("div",{className:"flex items-center gap-2",children:[e(M,{type:"file",id:"previewImage",ref:r,onChange:U,accept:"image/*",className:"hidden"}),e(l,{type:"button",variant:"outline",onClick:O,disabled:b,className:"w-full",children:b?t("span",{className:"flex items-center gap-2",children:[e("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),a("Uploading...")]}):t("span",{className:"flex items-center gap-2",children:[e($,{className:"h-4 w-4"}),a("Select image")]})}),i&&e(l,{type:"button",variant:"outline",size:"icon",onClick:H,children:e(Z,{className:"h-4 w-4"})})]}),i&&e("div",{className:"aspect-video overflow-hidden rounded-md border",children:e(L,{src:i,alt:a("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e("p",{className:"text-xs text-muted-foreground",children:a("max 1mb")})]})]})]}),t(I,{className:p?"pointer-events-none":"",children:[e(l,{variant:"outline",size:"sm",disabled:p,onClick:s=>{s.stopPropagation(),d()},children:a("Cancel")}),e(l,{variant:"default",size:"sm",disabled:p,onClick:X,children:a("Mark as template")})]})]})})},ce=Q;export{ce as default};
@@ -0,0 +1 @@
1
+ "use client";import{d as C}from"./chunk-777N6WHB.js";import{a as v,c as g,d as j,e as x,f as N,h as y}from"./chunk-YQ5QQCRD.js";import"./chunk-RBDZDQZR.js";import{b as h}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{ChevronLeftIcon as w,ChevronRight as I}from"lucide-react";import*as r from"react";import{useTranslation as B}from"react-i18next";import{jsx as c,jsxs as s}from"react/jsx-runtime";function D({data:l,onSelect:m,dataType:a="value",open:p,setOpen:u}){let{t:b}=B(),[o,i]=r.useState([]),[d,f]=r.useState(l);r.useEffect(()=>{p||i([]),f(l)},[l,p]);let k=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":"value",P=r.useCallback(e=>{let t=n=>a==="value"?n==="value"||n==="object":a==="array"?n==="array":n===a;e.type==="object"?(i(n=>[...n,e.key]),f(e.value)):t(e.type)&&(m([...o,e.key].join(".")),u(!1))},[a,m,o,u]),R=r.useCallback(()=>{if(o.length>0){let e=o.slice(0,-1);i(e),f(e.reduce((t,n)=>t[n],l))}},[o,l]),S=r.useMemo(()=>Object.entries(d).map(([e,t])=>({key:e,value:t,type:k(t)})).filter(e=>a==="value"?e.type==="value"||e.type==="object":a==="array"?e.type==="array"||e.type==="object":a==="object"?e.type==="object":!0),[d,a]);return c(C,{className:"z-[9999] w-[200px] p-0",children:s(v,{children:[c(g,{className:"border-none",placeholder:"Search..."}),s(j,{onWheel:e=>{try{e.preventDefault();let t=e.currentTarget;t.scrollTop+=e.deltaY}catch(t){e.preventDefault()}},children:[c(x,{className:"flex h-24 items-center justify-center text-xs text-muted",children:b("No option found.")}),s(N,{children:[o.length>0&&s(y,{onSelect:R,className:"flex items-center gap-2 text-xs text-muted",children:[c(w,{className:"!h-3 !w-3"}),b("Back")]}),S.map(e=>s(y,{onSelect:()=>P(e),className:"flex items-center justify-between text-xs",children:[s("span",{className:"flex items-center gap-2",children:[c("div",{className:"h-px w-3 rounded-full border-b border-b-foreground bg-transparent font-light opacity-10"}),e.key]}),s("div",{className:"flex items-center gap-2",children:[a==="object"&&e.type==="object"&&c(h,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:t=>{t.stopPropagation(),m([...o,e.key].join(".")),u(!1)},children:"Select"}),(e.type==="object"||e.type==="array")&&c(I,{className:"h-3 w-3 opacity-50"})]})]},e.key))]})]})]})})}export{D as default};
@@ -0,0 +1 @@
1
+ "use strict";"use client";var z=Object.create;var d=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var C=(e,t)=>()=>(e&&(t=e(e=0)),t);var g=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of O(t))!L.call(e,m)&&m!==n&&d(e,m,{get:()=>t[m],enumerable:!(p=I(t,m))||p.enumerable});return e};var D=(e,t,n)=>(n=e!=null?z(R(e)):{},x(t||!e||!e.__esModule?d(n,"default",{value:e,enumerable:!0}):n,e)),F=e=>x(d({},"__esModule",{value:!0}),e);var E={};g(E,{PreviewBanner:()=>T});function T({show:e,disableUrl:t}){let n=async()=>{await fetch(t!=null?t:"/next/exit-preview"),window.location.reload()};return e?(0,c.jsx)("div",{className:"group fixed bottom-4 left-4 z-50 duration-300 animate-in slide-in-from-bottom-4",children:(0,c.jsxs)("div",{className:"flex items-center gap-0 rounded-full border border-amber-400/30 bg-gradient-to-r from-amber-500 to-amber-600 py-2 pl-3.5 pr-3.5 text-white shadow-2xl backdrop-blur-sm transition-all duration-300 group-hover:gap-3 group-hover:pr-3.5",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,c.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),(0,c.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-white"})]}),(0,c.jsx)("span",{className:"text-xs font-medium",children:"Draft Mode is active"})]}),(0,c.jsx)("button",{onClick:n,className:"-ml-3 max-w-0 overflow-hidden whitespace-nowrap rounded-full bg-white px-3 py-1 text-[11px] font-semibold text-amber-600 opacity-0 shadow-sm transition-all duration-300 ease-in-out hover:bg-amber-50 hover:shadow-md group-hover:ml-0 group-hover:max-w-[100px] group-hover:opacity-100",children:"Disable"})]})}):null}var c,k=C(()=>{"use strict";"use client";c=require("react/jsx-runtime")});var Y={};g(Y,{ChaiAnimationProvider:()=>A,PreviewBanner:()=>X});module.exports=F(Y);var N=D(require("next/dynamic"),1);var h=require("react"),r="data-animation",P="|";function S(e){if(!e||typeof e!="string")return null;let t=e.split(P);return t.length!==5?null:{animation:t[0],easing:t[1],duration:t[2],delay:t[3],time:t[4]}}var w=()=>{let e=(0,h.useRef)(null);(0,h.useEffect)(()=>{let t=l=>{l.forEach(o=>{var u;let a=o.target,i=a.getAttribute(r);if(!i)return;let s=S(i);if(!s){a.removeAttribute(r);return}let f=`chai-animate-${s.animation}`;o.isIntersecting?(a.style.animationDuration=`${s.duration}ms`,a.style.animationDelay=`${s.delay}ms`,a.style.animationTimingFunction=s.easing,a.style.animationIterationCount="1",a.classList.add("chai-animate",f),s.time==="once"&&((u=e.current)==null||u.unobserve(a),a.removeAttribute(r))):s.time!=="once"&&(a.classList.remove("chai-animate",f),a.style.animationDuration="",a.style.animationDelay="",a.style.animationTimingFunction="",a.style.animationIterationCount="")})};typeof window!="undefined"&&"IntersectionObserver"in window&&(e.current=new IntersectionObserver(t,{root:null,rootMargin:"0px",threshold:.2}));let n=l=>{e.current?e.current.observe(l):l.removeAttribute(r)},p=()=>{document.querySelectorAll(`[${r}]`).forEach(o=>{o.classList.contains("chai-animate")||n(o)})},m=requestAnimationFrame(()=>{p()}),b=new MutationObserver(l=>{l.forEach(o=>{var a;if(o.type==="childList")o.addedNodes.forEach(i=>{i instanceof Element&&(i.hasAttribute(r)&&!i.classList.contains("chai-animate")&&n(i),i.querySelectorAll(`[${r}]`).forEach(f=>{f.classList.contains("chai-animate")||n(f)}))}),o.removedNodes.forEach(i=>{var s;i instanceof Element&&(i.hasAttribute(r)&&((s=e.current)==null||s.unobserve(i)),i.querySelectorAll(`[${r}]`).forEach(u=>{var v;(v=e.current)==null||v.unobserve(u)}))});else if(o.type==="attributes"&&o.attributeName===r){let i=o.target;i.hasAttribute(r)?i.classList.contains("chai-animate")||n(i):(a=e.current)==null||a.unobserve(i)}})});return b.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[r]}),()=>{cancelAnimationFrame(m),b.disconnect(),e.current&&e.current.disconnect()}},[])};var y=require("react/jsx-runtime"),A=({children:e})=>(w(),(0,y.jsx)(y.Fragment,{children:e}));var X=(0,N.default)(()=>Promise.resolve().then(()=>(k(),E)).then(e=>e.PreviewBanner),{ssr:!1,loading:()=>null});0&&(module.exports={ChaiAnimationProvider,PreviewBanner});
@@ -0,0 +1 @@
1
+ [data-animation]:not(.chai-animate){opacity:0;visibility:hidden}.chai-animate{animation-fill-mode:both;visibility:visible}@keyframes chai-fade-in{0%{opacity:0}to{opacity:1}}.chai-animate-fade-in{animation-name:chai-fade-in}@keyframes chai-slide-up{0%{opacity:0;transform:translateY(30px)}to{opacity:1;transform:translateY(0)}}.chai-animate-slide-up{animation-name:chai-slide-up}@keyframes chai-slide-down{0%{opacity:0;transform:translateY(-30px)}to{opacity:1;transform:translateY(0)}}.chai-animate-slide-down{animation-name:chai-slide-down}@keyframes chai-slide-left{0%{opacity:0;transform:translate(30px)}to{opacity:1;transform:translate(0)}}.chai-animate-slide-left{animation-name:chai-slide-left}@keyframes chai-slide-right{0%{opacity:0;transform:translate(-30px)}to{opacity:1;transform:translate(0)}}.chai-animate-slide-right{animation-name:chai-slide-right}@keyframes chai-zoom-in{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}.chai-animate-zoom-in{animation-name:chai-zoom-in}@keyframes chai-zoom-out{0%{opacity:0;transform:scale(1.1)}to{opacity:1;transform:scale(1)}}.chai-animate-zoom-out{animation-name:chai-zoom-out}@keyframes chai-flip-x{0%{opacity:0;transform:perspective(400px) rotateX(90deg)}to{opacity:1;transform:perspective(400px) rotateX(0)}}.chai-animate-flip-x{animation-name:chai-flip-x;backface-visibility:visible!important}@keyframes chai-flip-y{0%{opacity:0;transform:perspective(400px) rotateY(90deg)}to{opacity:1;transform:perspective(400px) rotateY(0)}}.chai-animate-flip-y{animation-name:chai-flip-y;backface-visibility:visible!important}@keyframes chai-rotate-in{0%{opacity:0;transform:rotate(-90deg)}to{opacity:1;transform:rotate(0)}}.chai-animate-rotate-in{animation-name:chai-rotate-in}
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import React__default from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ declare const ChaiAnimationProvider: ({ children }: {
6
+ children: React__default.ReactNode;
7
+ }) => react_jsx_runtime.JSX.Element;
8
+
9
+ declare const PreviewBanner: React.ComponentType<{
10
+ show: boolean;
11
+ disableUrl?: string;
12
+ }>;
13
+
14
+ export { ChaiAnimationProvider, PreviewBanner };
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import React__default from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ declare const ChaiAnimationProvider: ({ children }: {
6
+ children: React__default.ReactNode;
7
+ }) => react_jsx_runtime.JSX.Element;
8
+
9
+ declare const PreviewBanner: React.ComponentType<{
10
+ show: boolean;
11
+ disableUrl?: string;
12
+ }>;
13
+
14
+ export { ChaiAnimationProvider, PreviewBanner };
@@ -0,0 +1 @@
1
+ "use client";import"../chunk-WOT6VMZA.js";import w from"next/dynamic";import{useEffect as y,useRef as b}from"react";var n="data-animation",v="|";function g(i){if(!i||typeof i!="string")return null;let r=i.split(v);return r.length!==5?null:{animation:r[0],easing:r[1],duration:r[2],delay:r[3],time:r[4]}}var u=()=>{let i=b(null);y(()=>{let r=s=>{s.forEach(a=>{var l;let e=a.target,t=e.getAttribute(n);if(!t)return;let o=g(t);if(!o){e.removeAttribute(n);return}let c=`chai-animate-${o.animation}`;a.isIntersecting?(e.style.animationDuration=`${o.duration}ms`,e.style.animationDelay=`${o.delay}ms`,e.style.animationTimingFunction=o.easing,e.style.animationIterationCount="1",e.classList.add("chai-animate",c),o.time==="once"&&((l=i.current)==null||l.unobserve(e),e.removeAttribute(n))):o.time!=="once"&&(e.classList.remove("chai-animate",c),e.style.animationDuration="",e.style.animationDelay="",e.style.animationTimingFunction="",e.style.animationIterationCount="")})};typeof window!="undefined"&&"IntersectionObserver"in window&&(i.current=new IntersectionObserver(r,{root:null,rootMargin:"0px",threshold:.2}));let m=s=>{i.current?i.current.observe(s):s.removeAttribute(n)},p=()=>{document.querySelectorAll(`[${n}]`).forEach(a=>{a.classList.contains("chai-animate")||m(a)})},d=requestAnimationFrame(()=>{p()}),f=new MutationObserver(s=>{s.forEach(a=>{var e;if(a.type==="childList")a.addedNodes.forEach(t=>{t instanceof Element&&(t.hasAttribute(n)&&!t.classList.contains("chai-animate")&&m(t),t.querySelectorAll(`[${n}]`).forEach(c=>{c.classList.contains("chai-animate")||m(c)}))}),a.removedNodes.forEach(t=>{var o;t instanceof Element&&(t.hasAttribute(n)&&((o=i.current)==null||o.unobserve(t)),t.querySelectorAll(`[${n}]`).forEach(l=>{var h;(h=i.current)==null||h.unobserve(l)}))});else if(a.type==="attributes"&&a.attributeName===n){let t=a.target;t.hasAttribute(n)?t.classList.contains("chai-animate")||m(t):(e=i.current)==null||e.unobserve(t)}})});return f.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[n]}),()=>{cancelAnimationFrame(d),f.disconnect(),i.current&&i.current.disconnect()}},[])};import{Fragment as E,jsx as x}from"react/jsx-runtime";var A=({children:i})=>(u(),x(E,{children:i}));var T=w(()=>import("../preview-banner-SDDZGGRW.js").then(i=>i.PreviewBanner),{ssr:!1,loading:()=>null});export{A as ChaiAnimationProvider,T as PreviewBanner};