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.
- package/README.md +36 -0
- package/dist/IconPicker-I7VNLYZ4.js +5 -0
- package/dist/actions-DM00SIUk.d.cts +899 -0
- package/dist/actions-DM00SIUk.d.ts +899 -0
- package/dist/actions-registery-SEJTZE5Q.js +1 -0
- package/dist/active-in-another-tab-SONDAONP.js +1 -0
- package/dist/add-new-language-page-TI6DUYYX.js +1 -0
- package/dist/add-new-page-LBHXICXO.js +1 -0
- package/dist/ai-block-floating-prompt-input-ESY5GQLZ.js +1 -0
- package/dist/ai-panel-content-62I6FDQF.css +1 -0
- package/dist/ai-panel-content-UZJZ463W.js +1 -0
- package/dist/ai-panel-default-lang-2ZXZYQRT.js +6 -0
- package/dist/ai-panel-default-lang-ETFOFFEF.css +1 -0
- package/dist/ai-panel-for-image-LADQP6VY.js +1 -0
- package/dist/ai-panel-other-lang-WDLC3M2M.js +1 -0
- package/dist/ai-panel-page-chat-7ZISZWY4.js +4 -0
- package/dist/ai-panel-page-chat-N4YFJGAM.css +1 -0
- package/dist/ai-prompt-input-CPT5ETQ4.js +1 -0
- package/dist/ai-theme-generator-7PS4BX52.js +1 -0
- package/dist/ai-translation-prompt-3VE2ECGR.js +1 -0
- package/dist/blocks-CMvgDlxw.d.ts +72 -0
- package/dist/blocks-CP-Pngaz.d.cts +72 -0
- package/dist/build-config-CCERdThN.d.ts +80 -0
- package/dist/build-config-DrerOPd9.d.cts +80 -0
- package/dist/builder.cjs +243 -0
- package/dist/builder.css +1 -0
- package/dist/builder.d.cts +352 -0
- package/dist/builder.d.ts +352 -0
- package/dist/builder.js +1 -0
- package/dist/chaibuilder-instance-DNz3Q-dY.d.cts +579 -0
- package/dist/chaibuilder-instance-qroszVwI.d.ts +579 -0
- package/dist/change-password-modal-NJL7ZLTY.js +1 -0
- package/dist/chunk-2AFM6557.js +3 -0
- package/dist/chunk-2N4IJZOR.js +1 -0
- package/dist/chunk-2NYUIXUX.js +1 -0
- package/dist/chunk-2PJZUYIZ.js +1 -0
- package/dist/chunk-32HH35VD.js +1 -0
- package/dist/chunk-346H4FEX.js +1 -0
- package/dist/chunk-34HIOUTE.js +1 -0
- package/dist/chunk-374QEK4F.js +1 -0
- package/dist/chunk-3E72DJSP.js +1 -0
- package/dist/chunk-3IT7IIAV.js +1 -0
- package/dist/chunk-3UEPBBE4.js +11 -0
- package/dist/chunk-3XSKJBPH.js +1 -0
- package/dist/chunk-45ELAD2J.js +1 -0
- package/dist/chunk-4JBHWPMO.js +1 -0
- package/dist/chunk-4P25MV5E.js +1 -0
- package/dist/chunk-4PQNBY3V.js +1 -0
- package/dist/chunk-4VNLL2IA.js +1 -0
- package/dist/chunk-55SU3QPU.js +1 -0
- package/dist/chunk-5ZC65NB6.js +1 -0
- package/dist/chunk-6M7V7BOM.js +1 -0
- package/dist/chunk-6TXCHU4K.js +1 -0
- package/dist/chunk-777N6WHB.js +1 -0
- package/dist/chunk-7C4EQOAR.js +12 -0
- package/dist/chunk-7EXZXKW2.js +1 -0
- package/dist/chunk-7QWMLDCG.js +1 -0
- package/dist/chunk-AOJE5WI3.js +1 -0
- package/dist/chunk-ATLMLDBS.js +1 -0
- package/dist/chunk-AVGF3YLU.js +17 -0
- package/dist/chunk-BQSLQHLD.js +1 -0
- package/dist/chunk-BWORNCTE.js +1 -0
- package/dist/chunk-BYGD5CDT.js +1 -0
- package/dist/chunk-CA5PVX24.js +1 -0
- package/dist/chunk-CFNOB42V.js +1 -0
- package/dist/chunk-CJP3BQH2.js +1 -0
- package/dist/chunk-CRJENCPR.js +1 -0
- package/dist/chunk-D5SKCKSB.js +1 -0
- package/dist/chunk-DZ72OHTD.js +1 -0
- package/dist/chunk-EPGOG22Q.js +0 -0
- package/dist/chunk-ERCY63ZW.js +1 -0
- package/dist/chunk-ESCX7KEH.js +1 -0
- package/dist/chunk-F2V4N3LT.js +156 -0
- package/dist/chunk-F7YMHPEA.js +1 -0
- package/dist/chunk-FERH2TPR.js +1 -0
- package/dist/chunk-FLSV2QGU.js +1 -0
- package/dist/chunk-FOKGOT6B.js +1 -0
- package/dist/chunk-GJOOCKUE.js +1 -0
- package/dist/chunk-HA7LF3RV.js +1 -0
- package/dist/chunk-HAKJOMCL.js +1 -0
- package/dist/chunk-HEKCKC7N.js +1 -0
- package/dist/chunk-HELRVKD2.js +3 -0
- package/dist/chunk-I7ODKVVX.js +1 -0
- package/dist/chunk-IAKCX2WB.js +1 -0
- package/dist/chunk-IB2C3TWH.js +1 -0
- package/dist/chunk-IH562KSP.js +1 -0
- package/dist/chunk-IP4JBQOX.js +1 -0
- package/dist/chunk-ITX7QWN6.js +1 -0
- package/dist/chunk-IUACZ3E6.js +6 -0
- package/dist/chunk-J7Q62EP7.js +1 -0
- package/dist/chunk-JBB5IJFA.js +1 -0
- package/dist/chunk-JPJRO4NU.js +1 -0
- package/dist/chunk-JUIS55JT.js +1 -0
- package/dist/chunk-JYBTQ3YX.js +5 -0
- package/dist/chunk-K5YWQY4U.js +1 -0
- package/dist/chunk-K6RHR4HT.js +1 -0
- package/dist/chunk-LNV5MRGV.js +1 -0
- package/dist/chunk-LRJREWRD.js +1 -0
- package/dist/chunk-LWYDGDPW.js +1 -0
- package/dist/chunk-MDMGXS5B.js +1 -0
- package/dist/chunk-MEROMQQX.js +1 -0
- package/dist/chunk-N7Z4RFFI.js +1 -0
- package/dist/chunk-NSQEQYEM.js +1 -0
- package/dist/chunk-OD3K76M6.js +1 -0
- package/dist/chunk-ODSL3KXG.js +1 -0
- package/dist/chunk-OJJDRACB.js +1 -0
- package/dist/chunk-ONSZ462E.js +1 -0
- package/dist/chunk-OQZ4EPOM.js +1 -0
- package/dist/chunk-OR7KKUYT.js +1 -0
- package/dist/chunk-OSGXFZTA.js +1 -0
- package/dist/chunk-PM3JNOZH.js +1 -0
- package/dist/chunk-PQHFT4TE.js +1 -0
- package/dist/chunk-QGVCH2NI.js +1 -0
- package/dist/chunk-QIGSSVEY.js +1 -0
- package/dist/chunk-R5ZTCDFD.js +1 -0
- package/dist/chunk-RBDZDQZR.js +1 -0
- package/dist/chunk-ROQRBSK6.js +1 -0
- package/dist/chunk-SSENH35Y.js +1 -0
- package/dist/chunk-SYPALJAE.js +1 -0
- package/dist/chunk-T2YYNX6Z.js +1 -0
- package/dist/chunk-T32TW3XV.js +1 -0
- package/dist/chunk-T56KQBE2.js +1 -0
- package/dist/chunk-TEL5ACJE.js +1 -0
- package/dist/chunk-TGJQC6VC.js +1 -0
- package/dist/chunk-TQ34DGOT.js +1 -0
- package/dist/chunk-TVF77C53.js +1 -0
- package/dist/chunk-UIDBBTCZ.js +3 -0
- package/dist/chunk-VKSRWZCO.js +1 -0
- package/dist/chunk-VL5WBPVV.js +1 -0
- package/dist/chunk-VUWHFLT7.js +22 -0
- package/dist/chunk-WEVKAJMV.js +1 -0
- package/dist/chunk-WHPIYGCY.js +1 -0
- package/dist/chunk-WNESLH23.js +1 -0
- package/dist/chunk-WOT6VMZA.js +1 -0
- package/dist/chunk-WSQ5SQBD.js +1 -0
- package/dist/chunk-XY4UJKHE.js +1 -0
- package/dist/chunk-Y2BHO7OO.js +1 -0
- package/dist/chunk-YDOQEFOK.js +1 -0
- package/dist/chunk-YEFMD4DS.js +1 -0
- package/dist/chunk-YQ5QQCRD.js +1 -0
- package/dist/chunk-YQPOFRXU.js +1 -0
- package/dist/chunk-YTPQSO7V.js +801 -0
- package/dist/chunk-ZAU65LBG.js +1 -0
- package/dist/chunk-ZRFCEMYU.js +1 -0
- package/dist/chunk-ZU2B5YT6.js +1 -0
- package/dist/chunk-ZXKKBKGV.js +1 -0
- package/dist/code-display-7346IUCO.js +1 -0
- package/dist/code-editor-UBGTTX2L.js +1 -0
- package/dist/components/ui/accordion.cjs +1 -0
- package/dist/components/ui/accordion.d.cts +9 -0
- package/dist/components/ui/accordion.d.ts +9 -0
- package/dist/components/ui/accordion.js +1 -0
- package/dist/components/ui/alert-dialog.cjs +1 -0
- package/dist/components/ui/alert-dialog.d.cts +23 -0
- package/dist/components/ui/alert-dialog.d.ts +23 -0
- package/dist/components/ui/alert-dialog.js +1 -0
- package/dist/components/ui/alert.cjs +1 -0
- package/dist/components/ui/alert.d.cts +11 -0
- package/dist/components/ui/alert.d.ts +11 -0
- package/dist/components/ui/alert.js +1 -0
- package/dist/components/ui/avatar.cjs +1 -0
- package/dist/components/ui/avatar.d.cts +8 -0
- package/dist/components/ui/avatar.d.ts +8 -0
- package/dist/components/ui/avatar.js +1 -0
- package/dist/components/ui/badge.cjs +1 -0
- package/dist/components/ui/badge.d.cts +13 -0
- package/dist/components/ui/badge.d.ts +13 -0
- package/dist/components/ui/badge.js +1 -0
- package/dist/components/ui/button.cjs +1 -0
- package/dist/components/ui/button.d.cts +15 -0
- package/dist/components/ui/button.d.ts +15 -0
- package/dist/components/ui/button.js +1 -0
- package/dist/components/ui/card.cjs +1 -0
- package/dist/components/ui/card.d.cts +10 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/checkbox.cjs +1 -0
- package/dist/components/ui/checkbox.d.cts +6 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.js +1 -0
- package/dist/components/ui/command.cjs +1 -0
- package/dist/components/ui/command.d.cts +83 -0
- package/dist/components/ui/command.d.ts +83 -0
- package/dist/components/ui/command.js +1 -0
- package/dist/components/ui/context-menu.cjs +1 -0
- package/dist/components/ui/context-menu.d.cts +30 -0
- package/dist/components/ui/context-menu.d.ts +30 -0
- package/dist/components/ui/context-menu.js +1 -0
- package/dist/components/ui/dialog.cjs +1 -0
- package/dist/components/ui/dialog.d.cts +22 -0
- package/dist/components/ui/dialog.d.ts +22 -0
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/dropdown-menu.cjs +1 -0
- package/dist/components/ui/dropdown-menu.d.cts +30 -0
- package/dist/components/ui/dropdown-menu.d.ts +30 -0
- package/dist/components/ui/dropdown-menu.js +1 -0
- package/dist/components/ui/hover-card.cjs +1 -0
- package/dist/components/ui/hover-card.d.cts +8 -0
- package/dist/components/ui/hover-card.d.ts +8 -0
- package/dist/components/ui/hover-card.js +1 -0
- package/dist/components/ui/input.cjs +1 -0
- package/dist/components/ui/input.d.cts +5 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +1 -0
- package/dist/components/ui/label.cjs +1 -0
- package/dist/components/ui/label.d.cts +8 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +1 -0
- package/dist/components/ui/loader.cjs +1 -0
- package/dist/components/ui/loader.d.cts +12 -0
- package/dist/components/ui/loader.d.ts +12 -0
- package/dist/components/ui/loader.js +1 -0
- package/dist/components/ui/navigation-menu.cjs +1 -0
- package/dist/components/ui/navigation-menu.d.cts +15 -0
- package/dist/components/ui/navigation-menu.d.ts +15 -0
- package/dist/components/ui/navigation-menu.js +1 -0
- package/dist/components/ui/popover.cjs +1 -0
- package/dist/components/ui/popover.d.cts +9 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/progress.cjs +1 -0
- package/dist/components/ui/progress.d.cts +8 -0
- package/dist/components/ui/progress.d.ts +8 -0
- package/dist/components/ui/progress.js +1 -0
- package/dist/components/ui/scroll-area.cjs +1 -0
- package/dist/components/ui/scroll-area.d.cts +7 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.js +1 -0
- package/dist/components/ui/select.cjs +1 -0
- package/dist/components/ui/select.d.cts +15 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +1 -0
- package/dist/components/ui/separator.cjs +1 -0
- package/dist/components/ui/separator.d.cts +6 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/separator.js +1 -0
- package/dist/components/ui/sheet.cjs +1 -0
- package/dist/components/ui/sheet.d.cts +29 -0
- package/dist/components/ui/sheet.d.ts +29 -0
- package/dist/components/ui/sheet.js +1 -0
- package/dist/components/ui/skeleton.cjs +1 -0
- package/dist/components/ui/skeleton.d.cts +5 -0
- package/dist/components/ui/skeleton.d.ts +5 -0
- package/dist/components/ui/skeleton.js +1 -0
- package/dist/components/ui/slider.cjs +1 -0
- package/dist/components/ui/slider.d.cts +6 -0
- package/dist/components/ui/slider.d.ts +6 -0
- package/dist/components/ui/slider.js +1 -0
- package/dist/components/ui/switch.cjs +1 -0
- package/dist/components/ui/switch.d.cts +9 -0
- package/dist/components/ui/switch.d.ts +9 -0
- package/dist/components/ui/switch.js +1 -0
- package/dist/components/ui/tabs.cjs +1 -0
- package/dist/components/ui/tabs.d.cts +9 -0
- package/dist/components/ui/tabs.d.ts +9 -0
- package/dist/components/ui/tabs.js +1 -0
- package/dist/components/ui/textarea.cjs +1 -0
- package/dist/components/ui/textarea.d.cts +5 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.js +1 -0
- package/dist/components/ui/toggle.cjs +1 -0
- package/dist/components/ui/toggle.d.cts +15 -0
- package/dist/components/ui/toggle.d.ts +15 -0
- package/dist/components/ui/toggle.js +1 -0
- package/dist/components/ui/tooltip.cjs +1 -0
- package/dist/components/ui/tooltip.d.cts +9 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.js +1 -0
- package/dist/config-registry-RSJCAKY5.js +1 -0
- package/dist/continue-editing-in-this-client-QBMOFRLL.js +1 -0
- package/dist/core-BNe4bA6z.d.cts +5455 -0
- package/dist/core-BNe4bA6z.d.ts +5455 -0
- package/dist/css-import-modal-NMFRQGCY.js +13 -0
- package/dist/db/better-sqlite3.cjs +1 -0
- package/dist/db/better-sqlite3.d.cts +16 -0
- package/dist/db/better-sqlite3.d.ts +16 -0
- package/dist/db/better-sqlite3.js +1 -0
- package/dist/db/d1.cjs +1 -0
- package/dist/db/d1.d.cts +17 -0
- package/dist/db/d1.d.ts +17 -0
- package/dist/db/d1.js +1 -0
- package/dist/db/libsql.cjs +1 -0
- package/dist/db/libsql.d.cts +23 -0
- package/dist/db/libsql.d.ts +23 -0
- package/dist/db/libsql.js +1 -0
- package/dist/db/node-pg.cjs +1 -0
- package/dist/db/node-pg.d.cts +21 -0
- package/dist/db/node-pg.d.ts +21 -0
- package/dist/db/node-pg.js +1 -0
- package/dist/db/postgres.cjs +1 -0
- package/dist/db/postgres.d.cts +28 -0
- package/dist/db/postgres.d.ts +28 -0
- package/dist/db/postgres.js +1 -0
- package/dist/delete-page-CGR6VXZC.css +1 -0
- package/dist/delete-page-FQYTEMBN.js +1 -0
- package/dist/digital-asset-manager-PIZMJEMX.js +1 -0
- package/dist/digital-asset-manager-PSTDGMY2.css +1 -0
- package/dist/dispatch-action-3IV56BNY.js +1 -0
- package/dist/duplicate-page-HPPMQRL3.js +1 -0
- package/dist/dynamic-page-selector-LFHJQLYY.js +1 -0
- package/dist/dynamic-page-selector-SXJQAIGL.css +1 -0
- package/dist/edit-url-panel-Q3NJCV55.js +1 -0
- package/dist/get-blocks-styles-SLZ5NDUF.js +1 -0
- package/dist/get-page-styles-Q4FWW5LX.js +1 -0
- package/dist/image-editor-PLXDYVKE.css +1 -0
- package/dist/image-editor-RSEHWRGV.js +1 -0
- package/dist/json-diff-viewer-FQYK2FUX.js +8 -0
- package/dist/lang-panel-57UGEL6B.css +1 -0
- package/dist/lang-panel-HH5LEOF4.js +1 -0
- package/dist/license-overlay-4Q525E53.js +1 -0
- package/dist/log-ai-request-LHPKU2C5.js +1 -0
- package/dist/manage-design-tokens-264H25A2.js +1 -0
- package/dist/manage-design-tokens-modal-OIWIZ53K.js +1 -0
- package/dist/mark-as-template-7TCCEMGC.js +1 -0
- package/dist/nested-path-selector-content-N4XN7QUS.js +1 -0
- package/dist/nextjs/render-client.cjs +1 -0
- package/dist/nextjs/render-client.css +1 -0
- package/dist/nextjs/render-client.d.cts +14 -0
- package/dist/nextjs/render-client.d.ts +14 -0
- package/dist/nextjs/render-client.js +1 -0
- package/dist/nextjs/render.cjs +829 -0
- package/dist/nextjs/render.d.cts +78 -0
- package/dist/nextjs/render.d.ts +78 -0
- package/dist/nextjs/render.js +1 -0
- package/dist/nextjs/server.cjs +807 -0
- package/dist/nextjs/server.d.cts +329 -0
- package/dist/nextjs/server.d.ts +329 -0
- package/dist/nextjs/server.js +1 -0
- package/dist/nextjs.cjs +1 -0
- package/dist/nextjs.d.cts +17 -0
- package/dist/nextjs.d.ts +17 -0
- package/dist/nextjs.js +1 -0
- package/dist/no-language-page-content-NQIROTIL.js +1 -0
- package/dist/no-language-page-dialog-CWG5PI7N.js +1 -0
- package/dist/page-creator-2L6L6EFV.js +1 -0
- package/dist/page-lock-7HMG34UJ.js +1 -0
- package/dist/page-locked-dialog-ACMWVAZX.js +1 -0
- package/dist/page-manager-new-SCZFNGKO.js +1 -0
- package/dist/page-manager-new-VWRASZTI.css +1 -0
- package/dist/page-manager-search-and-filter-7CHPYAPV.js +1 -0
- package/dist/page-manager-sheet-KZZBKQ6M.js +1 -0
- package/dist/page-manager-sheet-U5YEB5CS.css +1 -0
- package/dist/page-revisions-content-DHPEQ4CA.js +1 -0
- package/dist/page-revisions-trigger-XGC4HOTL.js +1 -0
- package/dist/pages-DlMX1Lj2.d.cts +21 -0
- package/dist/pages-Dol4CXrN.d.ts +21 -0
- package/dist/payload/builder.cjs +243 -0
- package/dist/payload/builder.css +1 -0
- package/dist/payload/builder.d.cts +13 -0
- package/dist/payload/builder.d.ts +13 -0
- package/dist/payload/builder.js +1 -0
- package/dist/payload.cjs +807 -0
- package/dist/payload.d.cts +603 -0
- package/dist/payload.d.ts +603 -0
- package/dist/payload.js +1 -0
- package/dist/preview-banner-SDDZGGRW.js +1 -0
- package/dist/publish-pages-content-3AZ45DYH.js +1 -0
- package/dist/registry.cjs +11 -0
- package/dist/registry.d.cts +74 -0
- package/dist/registry.d.ts +74 -0
- package/dist/registry.js +1 -0
- package/dist/relations-DDBTFCMR.js +1 -0
- package/dist/revalidate-G2DEOH4Z.js +1 -0
- package/dist/rte-widget-modal-7RXFEYHK.js +1 -0
- package/dist/save-to-lib-65EGTZE5.js +1 -0
- package/dist/schema-IVNMPI4V.js +1 -0
- package/dist/schema.sqlite-CYBLikNv.d.cts +5852 -0
- package/dist/schema.sqlite-CYBLikNv.d.ts +5852 -0
- package/dist/seo-panel-WQ47FNP4.css +1 -0
- package/dist/seo-panel-Z6OBXHQ4.js +2 -0
- package/dist/server-config-b29G6_aQ.d.cts +116 -0
- package/dist/server-config-oPlt3V1X.d.ts +116 -0
- package/dist/state-RAP56WXS.js +1 -0
- package/dist/take-over-request-EB464ZGU.js +1 -0
- package/dist/translation-warning-modal-EES6I2QV.js +1 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +38 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.js +1 -0
- package/dist/unmark-as-template-6STMTBP5.js +1 -0
- package/dist/unpublish-page-CE3CJK5C.js +1 -0
- package/dist/unpublished-partials-modal-OZBWBCLN.js +1 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.cts +168 -0
- package/dist/utils.d.ts +168 -0
- package/dist/utils.js +1 -0
- package/dist/web-blocks.cjs +1 -0
- package/dist/web-blocks.d.cts +3 -0
- package/dist/web-blocks.d.ts +3 -0
- package/dist/web-blocks.js +1 -0
- package/dist/web-preview-EIWOXGPY.js +1 -0
- package/package.json +322 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./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{b as BuilderActionsRegistry,a as ChaiActionsRegistry,d as default,c as getChaiAction};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,b as d,c as f,e as p,f as T}from"./chunk-ERCY63ZW.js";import{d as m,k as l,m as c}from"./chunk-GJOOCKUE.js";import"./chunk-CJP3BQH2.js";import"./chunk-PQHFT4TE.js";import"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-2NYUIXUX.js";import"./chunk-WEVKAJMV.js";import"./chunk-ZAU65LBG.js";import{b as s}from"./chunk-3IT7IIAV.js";import{a as i}from"./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{Edit as h,TableIcon as g,Loader2 as E}from"lucide-react";import{useTranslation as x}from"react-i18next";import{useState as I,useRef as b,useEffect as v}from"react";import{jsx as e,jsxs as r}from"react/jsx-runtime";var w=()=>{let C=l(),N=c(),{t:a}=x(),[n,o]=I(!1),t=b(null);return v(()=>()=>{t.current&&clearTimeout(t.current)},[]),e(i,{children:r(u,{className:"mx-auto h-fit w-full max-w-md",children:[e(d,{className:"space-y-1",children:r(f,{className:"flex items-center gap-2 text-xl font-medium",children:[e(g,{className:"h-6 w-6 text-green-500"}),e("span",{children:a("Active in Another Tab")})]})}),e(p,{className:"space-y-4",children:e("p",{className:"text-sm text-muted-foreground",children:a("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e(T,{className:"flex justify-end gap-2",children:r(s,{variant:"default",disabled:n,onClick:()=>{o(!0),C(m.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{N(),o(!1)},5e3)},className:"gap-2",children:[n?e(E,{className:"h-4 w-4 animate-spin"}):e(h,{className:"h-4 w-4"}),a("Continue Editing Here")]})})]})})},F=w;export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as le,b as ue,d as re}from"./chunk-HEKCKC7N.js";import{a as ie}from"./chunk-JBB5IJFA.js";import{b as de,c as me}from"./chunk-VL5WBPVV.js";import"./chunk-GJOOCKUE.js";import"./chunk-CJP3BQH2.js";import{c as W}from"./chunk-PQHFT4TE.js";import{a as ne,b as ae,c as oe,e as te}from"./chunk-YEFMD4DS.js";import{a as se}from"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import{xa as ee}from"./chunk-2NYUIXUX.js";import{a as x}from"./chunk-HA7LF3RV.js";import"./chunk-WEVKAJMV.js";import"./chunk-ZAU65LBG.js";import{a as Q,f as X,g as Z,h as _,i as j,j as O}from"./chunk-RBDZDQZR.js";import{a as ge}from"./chunk-2N4IJZOR.js";import{a as A}from"./chunk-4JBHWPMO.js";import{a as G}from"./chunk-SSENH35Y.js";import{b as J}from"./chunk-3IT7IIAV.js";import{b as Y}from"./chunk-IP4JBQOX.js";import"./chunk-T32TW3XV.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{filter as Re,find as Ve,startsWith as $e}from"lodash-es";import{useMemo as C,useState as y}from"react";import{useTranslation as D}from"react-i18next";import{Fragment as Be,jsx as o,jsxs as c}from"react/jsx-runtime";var ce=({edit:i,lang:d,languages:l,name:s,setLang:a,setName:r,primaryPageObject:t})=>{let{t:e}=D();return c("div",{className:"space-y-1",children:[o(A,{htmlFor:"lang",children:e("Language")}),c("select",{value:i?"":d,disabled:i||!l.length,onChange:g=>{let m=g.target.value;a(m),!i&&($e(s,t==null?void 0:t.name)||s.length===0)&&r(`${t==null?void 0:t.name} - ${x[m]}`)},className:"col-span-3 flex h-9 w-full rounded-md border border-border bg-surface px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[o("option",{value:"",disabled:!0,children:i?x[d]||d:l.length?e("Choose language"):e("All available language page is created.")}),l.map(g=>o("option",{value:g,children:x[g]||g},g))]})]})},fe=({lang:i,name:d,setName:l,parentHasSelectedLanguagePage:s})=>{let{t:a}=D();return c("div",{className:"space-y-1",children:[o(A,{htmlFor:"name",children:a("Page Name")}),o(ge,{id:"name",value:i?d:"",onChange:r=>l(r.target.value),required:!0,placeholder:a(i?"Enter page name":"Choose language to add slug"),disabled:!s||!i})]})},Ee=({dynamic:i,isNonSlugPageType:d,isRootPage:l,lang:s,useLanguagePrefix:a,setUseLanguagePrefix:r,isHomePage:t,parentSlug:e,parentHasSelectedLanguagePage:g,slug:m,setSlug:p,setIsSlugValid:S,getSlug:P})=>{let{t:u}=D();return d?null:c("div",{className:"space-y-1",children:[l&&s&&c("div",{className:"flex items-center space-x-2 pb-1",children:[o("input",{type:"checkbox",id:"useLanguagePrefix",checked:a,onChange:h=>r(h.target.checked),className:"rounded border-gray-300"}),c(A,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",c("span",{className:"font-mono text-foreground",children:["/",s]}),") as slug prefix"]})]}),o(A,{htmlFor:"slug",children:u("Slug")}),i?o(G,{variant:"default",className:"p-2 text-xs font-medium italic text-muted-foreground",children:u("This page will use dynamic slug as defined in primary page")}):o(re,{disabled:!s||!g,value:m,onChange:p,placeholder:u(s?t&&a?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:e,onValidationChange:S,fullSlug:P()})]})},pe=({parentHasSelectedLanguagePage:i,name:d,lang:l,slug:s,edit:a,id:r,primaryPageObject:t,pages:e,isNonSlugPageType:g,isHomePage:m,useLanguagePrefix:p,isSlugValid:S,isPending:P})=>{let{t:u}=D(),h=P||!d||!l||e.some(f=>(a?f.id!==r:!0)&&f.parent===(t==null?void 0:t.id)&&f.lang===l)||!g&&!(m&&p)&&(!S||!s);return o(_,{children:i?c(Be,{children:[o(J,{loading:P,type:"submit",size:"sm",disabled:h&&!t.dynamic,children:u(a?"Update":"Add new language page")}),e.some(f=>(a?f.id!==r:!0)&&f.parent===(t==null?void 0:t.id)&&f.lang===l)&&o("p",{className:"mt-2 text-xs text-red-500",children:u("A page for this language already exists.")})]}):l&&o(G,{variant:"destructive",children:c("p",{className:"mx-auto w-5/6 text-center",children:[u("You need to create the")," ",o("span",{className:"font-medium",children:x[l]})," ",u("page in the parent to add here.")]})})})},Ue=({onSubmit:i,edit:d,lang:l,languages:s,name:a,setLang:r,setName:t,primaryPageObject:e,parentHasSelectedLanguagePage:g,id:m,pages:p,isNonSlugPageType:S,isHomePage:P,useLanguagePrefix:u,slug:h,isSlugValid:f,isPending:b})=>c("form",{onSubmit:i,children:[c("div",{className:"grid gap-4 py-4",children:[o(ce,{edit:d,lang:l,languages:s,name:a,setLang:r,setName:t,primaryPageObject:e}),o(fe,{lang:l,name:a,setName:t,parentHasSelectedLanguagePage:g})]}),o(pe,{parentHasSelectedLanguagePage:g,name:a,lang:l,slug:h,edit:d,id:m,primaryPageObject:e,pages:p,isNonSlugPageType:S,isHomePage:P,useLanguagePrefix:u,isSlugValid:f,isPending:b})]}),Ie=({loading:i,onSubmit:d,edit:l,lang:s,languages:a,name:r,setLang:t,setName:e,primaryPageObject:g,parentHasSelectedLanguagePage:m,isNonSlugPageType:p,isRootPage:S,useLanguagePrefix:P,setUseLanguagePrefix:u,isHomePage:h,parentSlug:f,slug:b,setSlug:E,isSlugValid:F,setIsSlugValid:U,getSlug:I,isPending:H,id:N,pages:w})=>i?o("div",{className:"flex h-80 items-center justify-center",children:o(Y,{})}):p?o(Ue,{onSubmit:d,edit:l,lang:s,languages:a,name:r,setLang:t,setName:e,primaryPageObject:g,parentHasSelectedLanguagePage:m,id:N,pages:w,isNonSlugPageType:p,isHomePage:h,useLanguagePrefix:P,slug:b,isSlugValid:F,isPending:H}):c("form",{onSubmit:d,children:[c("div",{className:"grid gap-4 py-4",children:[o(ce,{edit:l,lang:s,languages:a,name:r,setLang:t,setName:e,primaryPageObject:g}),o(fe,{lang:s,name:r,setName:e,parentHasSelectedLanguagePage:m}),o(Ee,{dynamic:g==null?void 0:g.dynamic,isNonSlugPageType:p,isRootPage:S,lang:s,useLanguagePrefix:P,setUseLanguagePrefix:u,isHomePage:h,parentSlug:f,parentHasSelectedLanguagePage:m,slug:b,setSlug:E,isSlugValid:F,setIsSlugValid:U,getSlug:I})]}),o(pe,{parentHasSelectedLanguagePage:m,name:r,lang:s,slug:b,edit:l,id:N,primaryPageObject:g,pages:w,isNonSlugPageType:p,isHomePage:h,useLanguagePrefix:P,isSlugValid:F,isPending:H})]}),ke=({id:i,isOpen:d,onClose:l,primaryPage:s,edit:a=!1,preselectedLang:r})=>{let{data:t=[]}=oe(),e=C(()=>t.find(n=>n.id===s),[t,s]),{data:g,isFetching:m}=ne(),p=ae(),{data:S,isFetching:P}=W(s),{data:u=[],isFetching:h}=W(e==null?void 0:e.parent),{data:f=[],isFetching:b}=te(),{setSelectedLang:E}=ee(),{t:F}=D(),[,U]=se(),[,I]=ie(),H=m||P||h||b,N=C(()=>Re(g==null?void 0:g.languages,n=>!Ve(S,{lang:n})),[g,S]),w=C(()=>{if(a&&S&&i){let n=S.find(L=>L.id===i);if(n&&e){let L=n.slug||"",{initSlug:$,prefix:Te}=ue(L,e);return{name:n.name,lang:n.lang,slug:$,useLanguagePrefix:Te}}}if(!a&&e){if(r)return{name:`${e.name} - ${x[r]}`,lang:r,slug:"",useLanguagePrefix:!0};if((N==null?void 0:N.length)===1){let n=N[0];if(n&&x[n])return{name:`${e.name} - ${x[n]}`,lang:n,slug:"",useLanguagePrefix:!0}}}return{name:"",lang:"",slug:"",useLanguagePrefix:!0}},[a,S,i,e,r,N]),[q,Se]=y(()=>w.name),[v,Pe]=y(()=>w.lang),[T,ve]=y(()=>w.slug),[Le,he]=y(!0),[R,Ne]=y(()=>w.useLanguagePrefix),{mutate:xe,isPending:be}=de(),{mutate:Fe,isPending:we}=me(),Ce=be||we,k=C(()=>f.find(n=>n.key===(e==null?void 0:e.pageType)),[f,e==null?void 0:e.pageType]),z=!(k!=null&&k.hasSlug),B=(e==null?void 0:e.slug)==="/",Ae=C(()=>`${a?"edit":"new"}-${i||s}-${r||""}-${d}`,[a,i,s,r,d]),{parentSlug:K,isRootPage:V}=C(()=>{if(B||!v)return{parentSlug:void 0,isRootPage:!(e!=null&&e.parent)};if(!(e!=null&&e.parent))return{parentSlug:R?`/${v}`:void 0,isRootPage:!0};let n=u==null?void 0:u.find(L=>L.lang===v);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[e==null?void 0:e.parent,u,R,v,B]),ye=C(()=>V?!0:!!(u!=null&&u.some(n=>(n==null?void 0:n.lang)===v)),[v,u,V]),M=()=>{let n="";return V?n=`/${R?[v,T].filter(Boolean).join("/"):T}`:n=`${le(K)}/${T}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},De=n=>{let L=new URLSearchParams(window.location.search);p&&n===p?L.delete("lang"):L.set("lang",n),U(L),window.dispatchEvent(new PopStateEvent("popstate"))},He=n=>{n.preventDefault();let L={name:q,lang:v,primaryPage:e==null?void 0:e.id,slug:z?"":M(),pageType:e==null?void 0:e.pageType,...a&&{id:i}},$=()=>{!a&&v&&(E(v),De(v)),I("outline"),l()};a?Fe(L,{onSuccess:$}):xe(L,{onSuccess:$})};return o(Q,{open:d,onOpenChange:l,children:d&&c(X,{className:"text-foreground sm:max-w-[425px]",children:[c(Z,{children:[o(j,{children:F(a?"Edit language":"Add new language page")}),o(O,{className:"font-light",children:F("Enter the details for the language")})]}),o(Ie,{id:i,pages:t,loading:H,onSubmit:He,edit:a,lang:v,languages:N,name:q,setLang:Pe,setName:Se,primaryPageObject:e,parentHasSelectedLanguagePage:ye,isNonSlugPageType:z,isRootPage:V,useLanguagePrefix:R,setUseLanguagePrefix:Ne,isHomePage:B,parentSlug:K,slug:T,setSlug:ve,isSlugValid:Le,setIsSlugValid:he,getSlug:M,isPending:Ce},Ae)]})})},rn=ke;export{rn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s,f as r,g as p,i as g,j as c}from"./chunk-RBDZDQZR.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{lazy as D,Suspense as d}from"react";import{useTranslation as f}from"react-i18next";import{jsx as o,jsxs as n}from"react/jsx-runtime";var u=D(()=>import("./page-creator-2L6L6EFV.js")),y=({addEditPage:e,setAddEditPage:i,closePanel:m})=>{let{t:a}=f(),l=!!(e!=null&&e.id),t=!!e;return o(s,{open:t,onOpenChange:()=>i(void 0),children:t&&n(r,{className:"sm:max-w-[425px]",children:[n(p,{children:[n(g,{children:[a(l?"Edit":"Add New")," "]}),o(c,{children:a(l?"Update your page name":"Enter details to create a new page")})]}),o(d,{fallback:o("div",{className:"min-h-40"}),children:o(u,{closePanel:m,addEditPage:e,close:()=>i(void 0)})})]})})},v=y;export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as s}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import{c as u}from"./chunk-6M7V7BOM.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{ArrowRight as f,Sparkles as c}from"lucide-react";import{useState as p}from"react";import{useTranslation as g}from"react-i18next";import{jsx as t,jsxs as i}from"react/jsx-runtime";var h=({selectedLang:r,isLoading:d,onSend:n})=>{let a=u(),{t:l}=g(),[o,m]=p("");return i("div",{className:"overflow-hidden",children:[i("div",{className:"flex items-center justify-between border-b pr-1",children:[t("input",{value:o,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&o.trim()&&(e.preventDefault(),n(o.trim(),void 0,[],a.id))},placeholder:l(r?"Ask to update content":"Ask anything..."),disabled:d,autoFocus:!0,className:"w-full resize-none rounded-none border-none p-2 text-xs text-black outline-none focus:outline-none focus:ring-0"}),t(s,{onClick:()=>n(o.trim(),void 0,[],a.id),size:"xs",children:t(f,{className:"!h-3 !w-3"})})]}),t("div",{className:"max-h-24 overflow-y-auto",children:[...r?["Translate"]:[],"Make longer","Make shorter","Fix grammar"].map(e=>i("button",{"aria-label":e,onClick:()=>n(e,void 0,[],a.id),className:"h-6 w-full cursor-pointer overflow-hidden truncate px-2 py-1 text-left text-xs font-medium leading-none text-black hover:bg-gray-200 hover:text-blue-500",children:[t(c,{className:"mr-1 inline h-3 w-3"})," ",e]},e))})]})},y=h;export{y 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{g as a,h as b}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"./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"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import"./chunk-PQHFT4TE.js";import"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-LRJREWRD.js";import"./chunk-HAKJOMCL.js";import"./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"./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"./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";export{a as AiPanelContent,b as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";import{a as Z,b as Kt,c as zt}from"./chunk-HELRVKD2.js";import{a as Jt}from"./chunk-AVGF3YLU.js";import{a as Ft,b as Ut,c as $t}from"./chunk-2AFM6557.js";import{a as Vt}from"./chunk-7QWMLDCG.js";import{a as Nt,b as _t,c as Ht,d as Ot,e as it,f as lt,g as Wt}from"./chunk-32HH35VD.js";import{f as Lt}from"./chunk-ZRFCEMYU.js";import"./chunk-34HIOUTE.js";import"./chunk-CA5PVX24.js";import"./chunk-MEROMQQX.js";import"./chunk-SYPALJAE.js";import{b as Tt,h as Y,k as Qt}from"./chunk-F2V4N3LT.js";import"./chunk-R5ZTCDFD.js";import"./chunk-ZU2B5YT6.js";import"./chunk-IUACZ3E6.js";import"./chunk-QGVCH2NI.js";import{a as xt}from"./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"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import{f as Bt}from"./chunk-PQHFT4TE.js";import"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-LRJREWRD.js";import"./chunk-HAKJOMCL.js";import{F as Mt,R as St,Z as It,ba as vt,da as wt,ra as Et,sa as Dt,wa as st}from"./chunk-2NYUIXUX.js";import"./chunk-WHPIYGCY.js";import"./chunk-HA7LF3RV.js";import{b as qt,d as Gt}from"./chunk-PM3JNOZH.js";import{a as ot}from"./chunk-WEVKAJMV.js";import{b as Rt,c as Pt}from"./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"./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"./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{a as L}from"./chunk-346H4FEX.js";import"./chunk-ESCX7KEH.js";import"./chunk-CRJENCPR.js";import{c as at}from"./chunk-6M7V7BOM.js";import{c as ct}from"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import{a as bt}from"./chunk-VKSRWZCO.js";import{f as Ct}from"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{useAtomValue as ce}from"jotai";import{BrainCog as ue}from"lucide-react";import{Fragment as de,lazy as re,startTransition as te,Suspense as ee,useEffect as me,useState as ne}from"react";import{useQueryClient as ie}from"@tanstack/react-query";import{useCallback as ae}from"react";var Yt=()=>{let{addPredefinedBlock:f}=Y();return ae(async(u,p,C,d)=>{if(!Ct(u)){console.warn(`[useAddCustomBlock] Unknown block type: "${u}". Skipping.`);return}let I={_id:bt(),_type:u,...d};await f([I],p,C)},[f])};import{useCallback as N}from"react";function Zt(f){let u=f.indexOf(":");if(u===-1)throw new Error("Invalid data stream part: no colon separator");let p=f.substring(0,u),C=f.substring(u+1),d;try{d=JSON.parse(C)}catch(S){d=C}switch(p){case"0":return{type:"text",value:d};case"9":return{type:"tool_call",toolCallId:d.toolCallId,toolName:d.toolName,args:d.args};case"a":return{type:"tool_result",toolCallId:d.toolCallId,value:d.result};case"d":return{type:"finish_message",value:d};case"3":return{type:"error",value:d};default:return{type:"other",value:d}}}function Xt(f){let u=f.trim();if(!u.startsWith("data:"))return null;let p=u.slice(u.indexOf(":")+1).trim();if(!p||p==="[DONE]")return{type:"done"};try{return JSON.parse(p)}catch(C){return null}}function le(f){let u=f.trim();if(Xt(u))return"ui-message-sse";try{return Zt(u),"legacy-data"}catch(p){return"legacy-text"}}var jt=()=>{let{addPredefinedBlock:f}=Y(),u=Qt(),p=wt(),C=ie(),d=Yt(),S=zt(),I=N(async(c,e)=>{if(!e)return;let s=await ct(e);await f(s,c.parentId,c.position)},[f]),B=N(async(c,e)=>{if(!c.blockId||!e)return;let s=await ct(e);await u(c.blockId,s)},[u]),U=N(async c=>{!c.ids||c.ids.length===0||await p(c.ids)},[p]),X=(c,e)=>{let s=document.getElementById("canvas-iframe");if(!s)return null;let m=s==null?void 0:s.contentDocument;if(!m)return null;m.querySelectorAll("[data-stream-canvas]").forEach(g=>g.remove());let l=null;if(c&&c!=="undefined"&&(l=m.querySelector(`[data-block-id="${c}"]`)),l||(l=m.querySelector('[data-block-id="canvas"]')),!l)return null;let b=m.createElement("div");if(b.setAttribute("data-stream-canvas","true"),e!==void 0&&e>=0&&l.children){let g=Math.min(e,l.children.length);g<l.children.length?l.insertBefore(b,l.children[g]):l.appendChild(b)}else l.appendChild(b);return b},j=c=>{var b;let e=document.getElementById("canvas-iframe");if(!e)return null;let s=e==null?void 0:e.contentDocument;if(!s)return null;s.querySelectorAll("[data-stream-canvas]").forEach(g=>g.remove());let k=s.querySelector(`[data-block-id="${c}"]`);if(!k)return null;let l=s.createElement("div");return l.setAttribute("data-stream-canvas","true"),(b=k.parentNode)==null||b.insertBefore(l,k.nextSibling),k.style.display="none",l},$=c=>{let e=document.getElementById("canvas-iframe");e!=null&&e.contentWindow&&c.scrollIntoView({behavior:"smooth",block:"end"})},_=N((c,e,s)=>{let m=X(e,s);m&&(m.innerHTML=c,$(m))},[]),V=N((c,e)=>{let s=j(e);s&&(s.innerHTML=c,$(s))},[]),tt=c=>{let e=c.match(/^--ACTION=(.+)--$/);if(!e)return null;let m=e[1].replace(/--/g,"").split("|"),l={type:m[0]};return m.forEach(b=>{let g=b.trim();if(g.startsWith("PARENT=")){let w=L(g.substring(7));l.parentId=w==="undefined"?void 0:w}else g.startsWith("POS=")?l.position=parseInt(L(g.substring(4))):g.startsWith("ID=")?l.blockId=L(g.substring(3)):g.startsWith("IDS=")&&(l.ids=L(g.substring(4)).split(",").map(w=>w.trim()))}),l},H=N(async(c,e,s)=>{var m;switch(c){case"remove_blocks":e.ids&&e.ids.length>0&&(await p(e.ids),e.reason&&s(k=>[...k,{id:Date.now().toString(),role:"assistant",content:e.reason}]));break;case"add_custom_block":await d(e.type,e.parentId,e.position,(m=e.props)!=null?m:{}),e.reason&&s(k=>[...k,{id:Date.now().toString(),role:"assistant",content:e.reason}]);break;case"bind_prop":S(e.blockId,e.propName,e.bindingPath),e.reason&&s(k=>[...k,{id:Date.now().toString(),role:"assistant",content:e.reason}]);break;case"get_partial_blocks":break;default:console.warn(`[useProcessAiStream] Unknown tool call: ${c}`)}},[p,d,S]);return N(async(c,e)=>{var z;let s=new TextDecoder,m="",k=!1,l=null,b="",g=null,w=[],O=async()=>{for(let a of w.splice(0)){let n;try{n=JSON.parse(a.args)}catch(h){n={}}await H(a.name,n,e)}},K=async a=>{var h;if(!a)return;m+=a;let n=m.split(`
|
|
2
|
+
`);m=(h=n.pop())!=null?h:"";for(let t of n)await R(t)},o={isInAction:!1,currentAction:null,htmlBuffer:"",isCapturingHtml:!1},R=async a=>{var h;let n=a.trim();if(n==="--START--"){k=!0;return}if(k){if(n==="--END--"){o.currentAction&&(o.htmlBuffer||o.currentAction.type==="REMOVE")&&await q(o.currentAction,o.htmlBuffer);let t=document.getElementById("canvas-iframe"),r=(h=t==null?void 0:t.contentDocument)==null?void 0:h.querySelectorAll("[data-stream-canvas]");r==null||r.forEach(i=>i.remove());return}if(n.startsWith("--THINKING=")){let t=L(n.substring(11));e(r=>{let i=[...r],y=i[i.length-1];if(y&&y.role==="assistant"&&y.isReasoning)y.content=t,y.isStreaming=!1;else{let E={id:Date.now().toString(),role:"assistant",content:t,isReasoning:!0,isStreaming:!1};i.push(E)}return i});return}if(n.startsWith("--TASK=")){let t=n.substring(7),r=`task-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,i={id:r,role:"assistant",content:L(t.replace(/--$/,"")),isTask:!0,isTaskLoading:!0,isTaskCompleted:!1};l=r,e(y=>[...y,i]);return}if(n.startsWith("--MSG=")){let t=n.substring(6),r={id:Date.now().toString(),role:"assistant",content:L(t.replace(/--$/g,"")),isReasoning:!1,isStreaming:!1};e(i=>[...i.filter(E=>!(E.isReasoning&&E.isStreaming)),r]);return}if(n.startsWith("--ACTION=")){o.currentAction&&(o.htmlBuffer||o.currentAction.type==="REMOVE")&&await q(o.currentAction,o.htmlBuffer),o.currentAction=tt(n),o.htmlBuffer="",o.isInAction=!0;return}if(n==="--ENDACTION--"){o.currentAction&&(o.htmlBuffer||o.currentAction.type==="REMOVE")&&await q(o.currentAction,o.htmlBuffer),l&&(e(t=>t.map(r=>r.isTask?{...r,isTaskCompleted:!0}:r)),l=null),o.currentAction=null,o.htmlBuffer="",o.isInAction=!1;return}if(n==="--HTML--"){o.isCapturingHtml=!0;return}if(n==="--ENDHTML--"){o.isCapturingHtml=!1;return}if(n.startsWith("--HTML--")&&n.includes("--ENDHTML--")){let t=n.match(/^--HTML--(.+?)--ENDHTML--$/);if(t&&o.currentAction){let r=t[1];o.htmlBuffer+=r,o.currentAction.type==="ADD"?_(o.htmlBuffer,o.currentAction.parentId,o.currentAction.position):o.currentAction.type==="EDIT"&&o.currentAction.blockId&&V(o.htmlBuffer,o.currentAction.blockId)}return}if(o.isCapturingHtml&&o.currentAction){o.htmlBuffer+=a+`
|
|
3
|
+
`,o.currentAction.type==="ADD"?_(o.htmlBuffer,o.currentAction.parentId,o.currentAction.position):o.currentAction.type==="EDIT"&&o.currentAction.blockId&&V(o.htmlBuffer,o.currentAction.blockId);return}if(!n.startsWith("--")&&n.length>0){if(/^<\/?[a-zA-Z]/.test(n))return;b+=a+`
|
|
4
|
+
`,e(t=>{let r=[...t],i=r[r.length-1];return i&&i.role==="assistant"&&i.isReasoning&&i.isStreaming&&(i.content=b),r})}}},q=async(a,n)=>{try{switch(a.type){case"ADD":await I(a,n);break;case"EDIT":await B(a,n);break;case"REMOVE":await U(a);break}e(h=>h.filter(t=>!t.isTask))}catch(h){console.log(h)}},W=async a=>{var h,t;if(!a.trim())return;let n;try{n=Zt(a)}catch(r){return}switch(n.type){case"text":await K((h=n.value)!=null?h:"");break;case"tool_call":w.push({id:n.toolCallId,name:n.toolName,args:JSON.stringify((t=n.args)!=null?t:{})});break;case"tool_result":break;case"finish_message":await O();break;case"error":{let r={id:Date.now().toString(),role:"assistant",content:String(n.value)};e(i=>[...i,r]);break}}},J=async a=>{var h,t,r,i,y;let n=Xt(a);if(n)switch(n.type){case"text-delta":await K((h=n.delta)!=null?h:"");break;case"tool-input-available":w.push({id:(t=n.toolCallId)!=null?t:"",name:(r=n.toolName)!=null?r:"",args:JSON.stringify((i=n.input)!=null?i:{})});break;case"tool-result":case"tool-output-available":break;case"finish":case"finish-step":await O();break;case"error":{let E={id:Date.now().toString(),role:"assistant",content:(y=n.errorText)!=null?y:"An error occurred while streaming the AI response."};e(et=>[...et,E]);break}case"done":case"start-step":case"start":case"text-start":case"text-end":case"finish_message":break}};try{let a="";for(;;){let{done:n,value:h}=await c.read();if(n)break;if(a+=s.decode(h,{stream:!0}),g===null){let r=a.indexOf(`
|
|
5
|
+
`);if(r===-1)continue;let i=a.slice(0,r).trim();if(!i){a=a.slice(r+1);continue}g=le(i)}let t=a.split(`
|
|
6
|
+
`);if(a=(z=t.pop())!=null?z:"",g==="ui-message-sse")for(let r of t)await J(r);else if(g==="legacy-data")for(let r of t)await W(r);else for(let r of t){let i=r.trim();i.startsWith("9:")||i.startsWith("d:")||i.startsWith("3:")?await W(r):await R(r)}}if(a.trim())if(g==="ui-message-sse")await J(a);else if(g==="legacy-data")await W(a);else{let n=a.trim();n.startsWith("9:")||n.startsWith("d:")||n.startsWith("3:")?await W(a):await R(a)}m.trim()&&(await R(m),m=""),await O(),C.invalidateQueries({queryKey:[xt]})}catch(a){console.log(a)}},[I,B,U,H,C,_,V])};import{Fragment as ye,jsx as A,jsxs as G}from"react/jsx-runtime";var fe=re(()=>import("./ai-prompt-input-CPT5ETQ4.js")),ge=re(()=>import("./ai-block-floating-prompt-input-ESY5GQLZ.js"));function ut(f,u="",p=0,C=3){if(p>=C)return u?[u]:[];let d=[];for(let S of Object.keys(f!=null?f:{})){let I=u?`${u}.${S}`:S,B=f[S];Array.isArray(B)?d.push(I):B&&typeof B=="object"?d.push(...ut(B,I,p+1,C)):d.push(I)}return d}function pe(f){let{global:u,...p}=f;return{global:ut(u!=null?u:{},"global"),page:ut(p,"")}}var he=({t:f,fetch:u,input:p,messages:C,setInput:d,isLoading:S,setMessages:I,handleStop:B,setIsLoading:U,currentBlock:X,fallbackLang:j,setCurrentBlock:$,setAbortController:_,selectedModel:V,onModelChange:tt,isFloatingPanel:H})=>{let c=st("flags.animation",!1),{models:e}=Pt(),s=Rt(),m=e.find(t=>{var r;return t.id===((r=at())==null?void 0:r.id)})||e[0],k=V||m.id,l=It(),[,b]=vt(),g=Tt(),[w,O]=ne(!1),[K,o]=ne("page"),R=st("loading",!1),{savePageAsync:q}=St(),W=Mt(),J=ce(Et),z=Dt(),{data:a}=Bt(),n=jt(),h=async(t,r,i,y,E,et)=>{var ft,gt,pt;if(!t||S)return;$(l);let se=g({blockId:H?l==null?void 0:l._id:void 0}),dt={id:Date.now().toString(),role:"user",content:Jt({language:j,userInput:r||t,currentHtml:se}),userMessage:t},oe={id:(Date.now()+1).toString(),role:"assistant",content:"",isReasoning:!0,isStreaming:!0};I(v=>[...v,dt,oe]),U(!0);let mt=new AbortController;_(mt);let P=y||k;(ft=s.onAIEvent)==null||ft.call(s,{type:"stream_start",model:P,timestamp:Date.now()});try{let v={messages:[dt].map(M=>({role:M.role,content:M.content})),model:y||k,context:s.context,designTokens:J,options:{animation:c,dataBindingPaths:pe(z),pageType:(gt=a==null?void 0:a.pageType)!=null?gt:void 0}};i&&i.length>0&&(v.images=i.map(({url:M})=>M)),E&&E.length>0&&(v.attachments=E.map(({url:M,mediaType:D,filename:x})=>({url:M,mediaType:D,filename:x})));let nt=H||!!(l!=null&&l._id),Q=await u({body:{action:nt?ot.AI_EDIT_BLOCK:ot.AI_EDIT_PAGE,data:v},streamResponse:!0,options:{signal:mt.signal}});if(!Q.ok)throw new Error(f("Failed to get AI response"));let T=(pt=Q.body)==null?void 0:pt.getReader();if(!T)throw new Error(f("Response body is not readable"));await n(T,I),I(M=>(te(()=>{var ht,yt,At,kt;let D=M.filter(rt=>rt.role==="assistant"&&!rt.isReasoning&&!rt.isTask),x=((ht=D[D.length-1])==null?void 0:ht.content)||"",F=Date.now();(yt=s.onSuccess)==null||yt.call(s,{content:x,model:P,timestamp:F}),(At=s.onComplete)==null||At.call(s,{success:!0,content:x,model:P,timestamp:F}),(kt=s.onAIEvent)==null||kt.call(s,{type:"completion",content:x,model:P,timestamp:F})}),M)),et&&await q(!0)}catch(v){if(v.name!=="AbortError"){let nt=qt(v),Q={id:(Date.now()+1).toString(),role:"assistant",content:nt};I(T=>[...T.filter(D=>!(D.isReasoning&&D.isStreaming)),Q]),te(()=>{var D,x,F;let T=v instanceof Error?v.message:String(v),M=Date.now();(D=s.onError)==null||D.call(s,{error:T,model:P,timestamp:M}),(x=s.onComplete)==null||x.call(s,{success:!1,error:T,model:P,timestamp:M}),(F=s.onAIEvent)==null||F.call(s,{type:"error",error:T,model:P,timestamp:M})})}}finally{d(""),U(!1),$(null),_(null)}};return me(()=>{if(R)return;let{blocks:t}=W();if(t&&(t==null?void 0:t.filter(y=>y._type!=="GlobalBlock").length)>0)return;let r=Gt({clean:!0});if(!r)return;let i=r==null?void 0:r.homePagePrompt;d(i||""),i&&setTimeout(()=>{var y;h(i,void 0,void 0,(y=at())==null?void 0:y.id,void 0,!0)},1e3)},[R]),H?A(ee,{children:A(ge,{selectedLang:"",isLoading:S,onSend:h})}):G(ye,{children:[G(Nt,{className:"no-scrollbar !-mx-2 px-0",children:[G(_t,{className:"no-scrollbar gap-4 px-0",children:[C.length===0&&A(Ht,{icon:A(ue,{size:30,className:"text-foreground/50"}),title:"Start a conversation",description:f("Start a conversation with the AI assistant to add/edit current page")}),C.map(t=>{var r,i,y;return t.role!=="system"&&A(de,{children:t.isReasoning?G(Ft,{isStreaming:t.isStreaming,defaultOpen:!0,className:"gap-0 space-y-0",children:[A(Ut,{className:"text-xs [&_p]:text-muted-foreground"}),A($t,{className:"p-0 text-xs",showLastLinesOnly:2,children:Z((r=t.content)!=null?r:"")})]}):t.isTask&&!t.isTaskCompleted?A(Vt,{content:t.content,isLoading:t.isTaskLoading}):t.role==="assistant"?Z((i=t.content)!=null?i:"")?A(it,{from:t.role,children:A(lt,{className:"!p-0",children:A(Wt,{className:"p-0 text-xs",children:Z((y=t.content)!=null?y:"")})})}):null:A(it,{from:t.role,children:A(lt,{className:"!p-0",children:A("div",{className:"rounded-sm bg-accent p-2 text-xs",children:t.userMessage||t.content})})})},t.id)})]}),A(Ot,{})]}),G("div",{className:"border-border pb-2",children:[A(Kt,{onRemove:()=>b([]),onManageContext:t=>{t&&o(t),O(!0)},isLoading:S}),A(Lt,{open:w,onOpenChange:O,defaultTab:K}),A(ee,{fallback:A("div",{children:"Loading..."}),children:A(fe,{input:p,setInput:d,onSend:h,onStop:B,isLoading:S,selectedLang:"",currentBlock:l||X,disabled:(p==null?void 0:p.length)===0,selectedModel:k,onModelChange:tt})})]})]})},an=he;export{an 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 Z}from"./chunk-7QWMLDCG.js";import{c as K,e as X,f as Y}from"./chunk-32HH35VD.js";import{b as I,c as $}from"./chunk-PM3JNOZH.js";import{a as O}from"./chunk-WEVKAJMV.js";import{b as W,c as J}from"./chunk-YQPOFRXU.js";import"./chunk-55SU3QPU.js";import{c as q}from"./chunk-ZAU65LBG.js";import{a as z,b as H,d as Q}from"./chunk-777N6WHB.js";import{a as C,c as N,d as E,g as k,i}from"./chunk-WSQ5SQBD.js";import"./chunk-4P25MV5E.js";import{a as T}from"./chunk-4JBHWPMO.js";import{b as A}from"./chunk-3IT7IIAV.js";import{b as j}from"./chunk-IP4JBQOX.js";import{c as U}from"./chunk-6M7V7BOM.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{ArrowRight as fe,BrainCog as be,Settings as he}from"lucide-react";import{Fragment as ye,lazy as Ie,startTransition as ee,Suspense as xe,useEffect as Me,useRef as Se,useState as te}from"react";import{useTranslation as we}from"react-i18next";import{jsx as e,jsxs as r}from"react/jsx-runtime";var Ae=Ie(()=>import("./ai-prompt-input-CPT5ETQ4.js")),Ce=({fetch:oe,input:v,messages:f,setInput:P,isLoading:x,handleStop:ae,setMessages:M,setIsLoading:R,selectedLang:re,setAbortController:ne,setCurrentBlock:se,selectedModel:le,onModelChange:ie,onImageGenerate:b=o=>{},isGenerateImagePanel:ce=!1})=>{let{t:o}=we(),{models:B}=J(),a=W(),de=B.find(t=>{var p;return t.id===((p=U())==null?void 0:p.id)})||B[0],me=le||de.id,L=Se(null),[S,ue]=te("16:9"),[h,ge]=te(80),pe=()=>{var t;(t=L.current)==null||t.scrollIntoView({behavior:"smooth"})};Me(()=>{pe()},[f,x]);let c=q("AI_GENERATE_IMAGE","google/gemini-2.5-flash-image"),ve=async(t,p,Ne,Ee)=>{var F,_;let w=[...f].reverse().find(s=>{var d;return s.role==="assistant"&&((d=s.content)==null?void 0:d.startsWith("data:image"))}),D={id:Date.now().toString(),role:"user",content:p||t||o("Generate image"),userMessage:p||t||o("Generate image")};R(!0);let G=new AbortController;ne(G),M(s=>[...s,D]),(F=a.onAIEvent)==null||F.call(a,{type:"stream_start",model:c,timestamp:Date.now()});try{let s={messages:[D],initiator:"GENERATE_IMAGE",model:c,context:a.context,image:{lastImage:w==null?void 0:w.content,aspectRatio:S,quality:h}},d=await oe({body:{action:O.AI_GENERATE_IMAGE,data:s},streamResponse:!0,options:{signal:G.signal}});if(!d.ok)throw new Error(o("Failed to get AI response"));let y=(_=d.body)==null?void 0:_.getReader(),m=new TextDecoder,l="";if(!y)throw new Error(o("Response body is not readable"));for(;;){let{done:n,value:u}=await y.read();if(n)break;let g=m.decode(u,{stream:!0});l+=g}M(n=>[...n,{id:(Date.now()+2).toString(),role:"assistant",content:l}]),b&&b(l),ee(()=>{var u,g,V;let n=Date.now();(u=a.onSuccess)==null||u.call(a,{content:l,model:c,timestamp:n}),(g=a.onComplete)==null||g.call(a,{success:!0,content:l,model:c,timestamp:n}),(V=a.onAIEvent)==null||V.call(a,{type:"completion",content:l,model:c,timestamp:n})})}catch(s){if(s.name!=="AbortError"){let d=I(s),y={id:(Date.now()+1).toString(),role:"assistant",content:d};M(m=>[...m.filter(n=>!(n.isReasoning&&n.isStreaming)),y]),ee(()=>{var n,u,g;let m=s instanceof Error?s.message:String(s),l=Date.now();(n=a.onError)==null||n.call(a,{error:m,model:c,timestamp:l}),(u=a.onComplete)==null||u.call(a,{success:!1,error:m,model:c,timestamp:l}),(g=a.onAIEvent)==null||g.call(a,{type:"error",error:m,model:c,timestamp:l})})}}finally{R(!1),P(""),se(null)}};return r("div",{className:"relative flex h-full w-full flex-col",children:[f.length===0?e("div",{className:"flex h-full items-center justify-center p-3",children:e(K,{icon:e(be,{size:24,className:"text-foreground/50"}),title:o("Generate images with AI"),description:o("Describe the image you want to generate.")})}):r("div",{className:"flex-1 space-y-2 overflow-y-auto py-2",children:[f.map(t=>t.role!=="system"&&e(ye,{children:t.isTask&&!t.isTaskCompleted?e(Z,{content:t.content,isLoading:t.isTaskLoading}):e(X,{from:t.role,children:e(Y,{className:"!p-0",children:t.role==="assistant"?$(t.content)?r("div",{className:"group relative",children:[e("img",{src:t.content,alt:"AI generated image",className:"max-h-32 w-full cursor-pointer rounded object-contain object-left hover:opacity-70",onClick:()=>b(t.content)}),r(A,{variant:"default",size:"xs",onClick:()=>b(t.content),className:"absolute bottom-1 left-1 font-light opacity-0 group-hover:opacity-100",children:[e(fe,{className:"h-3 w-3"})," ",o("View")]})]}):e("div",{className:"rounded-sm bg-destructive/10 px-2 py-1 text-xs text-destructive/80",children:I(t.content).includes("--")?o("Image generation failed. Try again"):I(t.content)}):e("div",{className:"rounded-sm bg-accent px-2 py-1 text-xs",children:t.userMessage||t.content})})})},t.id)),x&&e("div",{className:"mt-2 flex h-32 w-32 animate-pulse items-center justify-center gap-1 rounded-md bg-primary/10 p-2 text-xs text-primary",children:e(j,{className:"h-3 w-3 text-primary"})}),e("div",{ref:L})]}),r("div",{className:"flex-shrink-0 space-y-0",children:[r("div",{className:"mx-auto flex w-[96%] items-center justify-between gap-x-1 rounded-t-md border border-b-0 bg-accent/50 pl-2 text-center text-[11px] font-light text-foreground dark:bg-accent",children:[r("div",{children:[r("span",{children:[o("Aspect ratio"),": ",S]})," ",e("span",{className:"px-2 text-muted-foreground",children:"|"})," ",r("span",{children:[o("Quality"),": ",h>80?o("High"):h>60?o("Medium"):o("Low")]})," "]}),r(z,{children:[e(H,{asChild:!0,children:e(A,{size:"icon-xs",variant:"ghost",children:e(he,{className:"!h-3 !w-3"})})}),r(Q,{className:"w-44",align:"start",side:"right",children:[e("div",{className:"text-xs font-medium",children:o("Image configuration")}),r("div",{children:[e(T,{children:o("Aspect ratio")}),r(C,{value:S,onValueChange:t=>ue(t),children:[e(E,{children:e(N,{placeholder:o("Ratio")})}),r(k,{children:[e(i,{value:"1:1",children:"1:1"}),e(i,{value:"3:4",children:"3:4"}),e(i,{value:"4:3",children:"4:3"}),e(i,{value:"9:16",children:"9:16"}),e(i,{value:"16:9",children:"16:9"})]})]})]}),r("div",{children:[e(T,{children:o("Quality")}),r(C,{value:String(h),onValueChange:t=>ge(Number(t)),children:[e(E,{children:e(N,{placeholder:o("Quality")})}),r(k,{children:[e(i,{value:"60",children:o("Low")}),e(i,{value:"80",children:o("Medium")}),e(i,{value:"100",children:o("High")})]})]})]})]})]})]}),e(xe,{fallback:e("div",{className:"w-full animate-pulse rounded-md bg-accent"}),children:e(Ae,{input:v,setInput:P,onSend:ve,onStop:ae,isLoading:x,selectedLang:re,currentBlock:void 0,disabled:(v==null?void 0:v.length)===0,selectedModel:me,onModelChange:ie,isGenerateImagePanel:ce})})]})]})},We=Ce;export{We as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{b as le}from"./chunk-AVGF3YLU.js";import{a as te,b as oe,c as ne}from"./chunk-2AFM6557.js";import{a as se}from"./chunk-7QWMLDCG.js";import{a as K,b as Q,c as Y,e as Z,f as $,g as ee}from"./chunk-32HH35VD.js";import{a as ce}from"./chunk-HAKJOMCL.js";import{Z as M,ba as j,la as q}from"./chunk-2NYUIXUX.js";import{a as ie}from"./chunk-WHPIYGCY.js";import"./chunk-HA7LF3RV.js";import{a as re,b as ae}from"./chunk-PM3JNOZH.js";import{a as J}from"./chunk-WEVKAJMV.js";import{b as W,c as X}from"./chunk-YQPOFRXU.js";import"./chunk-55SU3QPU.js";import"./chunk-ZAU65LBG.js";import"./chunk-TVF77C53.js";import"./chunk-4P25MV5E.js";import{b as H}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-CRJENCPR.js";import{c as V}from"./chunk-6M7V7BOM.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{BrainCog as Ae}from"lucide-react";import{Fragment as Ne,lazy as R,startTransition as pe,Suspense as B,useEffect as Be,useRef as Re}from"react";import{useTranslation as Ie}from"react-i18next";import{X as Te}from"lucide-react";import{useTranslation as we}from"react-i18next";import{jsx as u,jsxs as de}from"react/jsx-runtime";var me=({onRemove:S,isLoading:g=!1})=>{let{t:f}=we(),n=M(),d=(n==null?void 0:n._type)||"Unknown",T=(n==null?void 0:n._name)||d;return u("div",{className:"relative mx-auto w-[95%]",children:u("div",{className:"relative transition-all duration-300 ease-out",style:{zIndex:3},children:de("div",{className:"bg-surface flex items-center justify-between rounded-t-lg border border-b-0 border-border px-3 py-1",children:[de("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-primary text-[10px] font-semibold text-primary-foreground",children:"@"}),u("span",{className:"truncate text-[11px] text-foreground",children:n?T:f("Entire Page")})]}),n&&u(ie,{content:f("Remove block from context"),side:"right",children:u(H,{variant:"ghost",size:"icon-xs",onClick:S,disabled:g,title:"Remove block from context",children:u(Te,{className:"!h-3 !w-3"})})})]})})})};import{Fragment as Fe,jsx as o,jsxs as x}from"react/jsx-runtime";var Ee=R(()=>import("./ai-translation-prompt-3VE2ECGR.js")),Pe=R(()=>import("./ai-prompt-input-CPT5ETQ4.js")),De=R(()=>import("./ai-block-floating-prompt-input-ESY5GQLZ.js")),Le=({fetch:S,input:g,messages:f,setInput:n,isLoading:d,handleStop:T,setMessages:w,setIsLoading:A,selectedLang:b,currentBlock:ue,fallbackLang:ge,setAbortController:fe,setCurrentBlock:I,selectedModel:ve,onModelChange:be,isFloatingPanel:ke=!1})=>{let{t:i}=Ie(),{models:E}=X(),t=W(),ye=E.find(e=>{var k;return e.id===((k=V())==null?void 0:k.id)})||E[0],P=ve||ye.id,he=Re(null),y=M(),[,Ce]=j(),D=ce(),Me=q(),xe=()=>{var e;(e=he.current)==null||e.scrollIntoView({behavior:"smooth"})};Be(()=>{xe()},[f,d]);let N=async(e,k,Oe,Se)=>{var U,z;y&&I(y);let L=(e==null?void 0:e.toLowerCase())==="translate",F={id:Date.now().toString(),role:"user",content:le({fallbackLang:ge,userInput:k||e,language:b,blocks:L?D():D(b)}),userMessage:k||e||i("Translate the content")},O={id:(Date.now()+1).toString(),role:"assistant",content:"Thinking...",isReasoning:!0,isStreaming:!0};A(!0);let _=new AbortController;fe(_),w(a=>[...a,F,O]),A(!0);let l=Se||P;(U=t.onAIEvent)==null||U.call(t,{type:"stream_start",model:l,timestamp:Date.now()});try{let a={messages:[F],initiator:L?"TRANSLATE_CONTENT":"UPDATE_CONTENT",model:l,context:t.context},h=await S({body:{action:J.AI_EDIT_LANG_PAGE,data:a},streamResponse:!0,options:{signal:_.signal}});if(!h.ok)throw new Error(i("Failed to get AI response"));let C=(z=h.body)==null?void 0:z.getReader(),m=new TextDecoder,s="";if(!C)throw new Error(i("Response body is not readable"));for(;;){let{done:r,value:c}=await C.read();if(r)break;let v=m.decode(c,{stream:!0});s+=v}let p=re(s);Me(p),w(r=>[...r.filter(v=>v.id!==O.id),{id:Date.now().toString(),role:"assistant",content:i("Content updated successfully.")}]),pe(()=>{var c,v,G;let r=Date.now();(c=t.onSuccess)==null||c.call(t,{content:s,model:l,timestamp:r}),(v=t.onComplete)==null||v.call(t,{success:!0,content:s,model:l,timestamp:r}),(G=t.onAIEvent)==null||G.call(t,{type:"completion",content:s,model:l,timestamp:r})})}catch(a){if(a.name!=="AbortError"){let h=ae(a),C={id:(Date.now()+1).toString(),role:"assistant",content:h};w(m=>[...m.filter(p=>!(p.isReasoning&&p.isStreaming)),C]),pe(()=>{var p,r,c;let m=a instanceof Error?a.message:String(a),s=Date.now();(p=t.onError)==null||p.call(t,{error:m,model:l,timestamp:s}),(r=t.onComplete)==null||r.call(t,{success:!1,error:m,model:l,timestamp:s}),(c=t.onAIEvent)==null||c.call(t,{type:"error",error:m,model:l,timestamp:s})})}}finally{A(!1),n(""),I(null)}};return ke?o(B,{children:o(De,{selectedLang:b,isLoading:d,onSend:N})}):x(Fe,{children:[o("div",{className:"py-2",children:o(B,{fallback:o("div",{children:i("Loading...")}),children:o(Ee,{isLoading:d,selectedBlock:y,selectedLang:b,onClick:N})})}),o(K,{className:"no-scrollbar !-mx-2 px-0",children:x(Q,{className:"gap-4 px-0",children:[f.length===0&&o(Y,{icon:o(Ae,{size:30,className:"text-foreground/50"}),title:i("Start a conversation with the AI assistant to translate/edit your content"),description:i("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")}),f.map(e=>e.role!=="system"&&o(Ne,{children:e.isReasoning?x(te,{isStreaming:e.isStreaming,defaultOpen:!0,className:"gap-0 space-y-0",children:[o(oe,{className:"text-xs [&_p]:text-muted-foreground"}),o(ne,{className:"p-0 text-xs",showLastLinesOnly:2,children:e.content})]}):e.isTask&&!e.isTaskCompleted?o(se,{content:e.content,isLoading:e.isTaskLoading}):o(Z,{from:e.role,children:o($,{className:"!p-0",children:e.role==="assistant"?o(ee,{className:"p-0 text-xs",children:e.content}):o("div",{className:"rounded-sm bg-accent p-2 text-xs",children:e.userMessage||e.content})})})},e.id))]})}),x("div",{className:"border-border pb-2",children:[o(me,{onRemove:()=>Ce([]),isLoading:d}),o(B,{fallback:o("div",{children:i("Loading...")}),children:o(Pe,{input:g,setInput:n,onSend:N,onStop:T,isLoading:d,selectedLang:b,currentBlock:y||ue,disabled:(g==null?void 0:g.length)===0,selectedModel:P,onModelChange:be})})]})]})},ct=Le;export{ct as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";import{a as ue,b as Xe,c as Ve}from"./chunk-HELRVKD2.js";import{a as $e,b as qe,c as Ge}from"./chunk-2AFM6557.js";import{a as De,b as Ue,c as Oe,d as He,e as Z,f as ee,g as de,h as Fe}from"./chunk-32HH35VD.js";import{f as Ne}from"./chunk-ZRFCEMYU.js";import"./chunk-34HIOUTE.js";import"./chunk-CA5PVX24.js";import"./chunk-MEROMQQX.js";import"./chunk-SYPALJAE.js";import{b as Se,k as We}from"./chunk-F2V4N3LT.js";import"./chunk-R5ZTCDFD.js";import"./chunk-ZU2B5YT6.js";import"./chunk-IUACZ3E6.js";import"./chunk-QGVCH2NI.js";import{a as Re}from"./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"./chunk-FOKGOT6B.js";import"./chunk-CJP3BQH2.js";import{f as Be}from"./chunk-PQHFT4TE.js";import"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import"./chunk-LRJREWRD.js";import"./chunk-HAKJOMCL.js";import{F as xe,R as Ae,Z as Pe,ba as Te,da as Me,ja as Ie,q as F,ra as _e,sa as we,wa as Y}from"./chunk-2NYUIXUX.js";import"./chunk-WHPIYGCY.js";import"./chunk-HA7LF3RV.js";import{b as ze,d as Ke}from"./chunk-PM3JNOZH.js";import{a as j}from"./chunk-WEVKAJMV.js";import{b as J,c as Le}from"./chunk-YQPOFRXU.js";import"./chunk-55SU3QPU.js";import{b as Q,d as Ee}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"./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"./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{c as ce}from"./chunk-6M7V7BOM.js";import{c as me}from"./chunk-VUWHFLT7.js";import"./chunk-OR7KKUYT.js";import"./chunk-T56KQBE2.js";import"./chunk-YDOQEFOK.js";import"./chunk-ITX7QWN6.js";import{a as ve}from"./chunk-LWYDGDPW.js";import{a as W}from"./chunk-VKSRWZCO.js";import{f as Ce}from"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{BrainCog as Mt}from"lucide-react";import{Fragment as It,lazy as _t,startTransition as at,Suspense as wt,useEffect as ye,useRef as Et,useState as be}from"react";import{toast as Bt}from"sonner";import{AlertCircle as it,Check as lt}from"lucide-react";import{Fragment as Ye,jsx as I,jsxs as te}from"react/jsx-runtime";var ct={edit_block:{active:"Updating section\u2026",done:"Updated section"},add_blocks:{active:"Adding new content\u2026",done:"Added new content"},remove_blocks:{active:"Removing content\u2026",done:"Removed content"},add_custom_block:{active:"Adding block\u2026",done:"Added block"},bind_prop:{active:"Connecting data\u2026",done:"Connected data"},read_block_html:{active:"Reviewing the page\u2026",done:"Reviewed the page"},get_partial_blocks:{active:"Checking shared sections\u2026",done:"Checked shared sections"}},dt=e=>e.replace(/^tool-/,""),ut=e=>{var l;let t=dt(e.type),o=(l=e.input)!=null?l:{},s=e.state==="output-available"||e.state==="output-error",c=typeof o.task=="string"&&o.task.trim().length>0?o.task:null;if(c)return s?c:`${c}\u2026`;let p=ct[t];return p?s?p.done:p.active:s?"Done":"Working\u2026"},Qe=({part:e,className:t})=>{var P;let o=e.output,s=e.state==="output-error"||(o==null?void 0:o.ok)===!1,c=e.state==="output-available"&&!s,p=!c&&!s,l=ut(e),y=(P=e.errorText)!=null?P:o==null?void 0:o.error;return I("div",{className:ve("is-assistant flex w-full max-w-[80%] flex-col gap-2",t),children:I("div",{className:"flex w-fit flex-col gap-2 overflow-hidden text-sm",children:I("div",{className:"flex items-center gap-2 rounded-lg border border-muted-foreground/20 bg-muted/50 p-2.5",children:te("div",{className:"flex flex-1 items-center gap-2",children:[p&&I(Fe,{duration:1.5,children:l}),c&&te(Ye,{children:[I(lt,{className:"h-3 w-3 shrink-0 text-green-600"}),I("div",{className:"text-xs text-muted-foreground/80",children:l})]}),s&&te(Ye,{children:[I(it,{className:"h-3 w-3 shrink-0 text-destructive"}),te("div",{className:"flex flex-col",children:[I("div",{className:"text-xs text-muted-foreground/80",children:l}),y&&I("div",{className:"text-[11px] text-destructive/80",children:y})]})]})]})})})})};import{useChat as kt}from"@ai-sdk/react";import{useQueryClient as ht}from"@tanstack/react-query";import{DefaultChatTransport as yt,isToolUIPart as bt,lastAssistantMessageIsCompleteWithToolCalls as vt}from"ai";import{useAtomValue as Ct}from"jotai";import{noop as $}from"lodash-es";import{useCallback as se,useEffect as xt,useMemo as At,useRef as _}from"react";var ne=()=>{var t;let e=document.getElementById("canvas-iframe");return(t=e==null?void 0:e.contentDocument)!=null?t:null},oe=new Set,re=null,pe=e=>{e.querySelectorAll("[data-stream-canvas]").forEach(t=>t.remove())},je=e=>{e.scrollIntoView({behavior:"smooth",block:"end"})},mt=(e,t)=>{let o=ne();if(!o)return null;pe(o);let s=null;if(e&&e!=="undefined"&&(s=o.querySelector(`[data-block-id="${e}"]`)),s||(s=o.querySelector('[data-block-id="canvas"]')),!s)return null;let c=o.createElement("div");if(c.setAttribute("data-stream-canvas","true"),t!==void 0&&t>=0&&s.children){let p=Math.min(t,s.children.length);p<s.children.length?s.insertBefore(c,s.children[p]):s.appendChild(c)}else s.appendChild(c);return c},pt=e=>{var c;let t=ne();if(!t)return null;pe(t);let o=t.querySelector(`[data-block-id="${e}"]`);if(!o)return null;let s=t.createElement("div");return s.setAttribute("data-stream-canvas","true"),(c=o.parentNode)==null||c.insertBefore(s,o.nextSibling),o.style.display="none",oe.add(e),s},Je=e=>{if(re!==e)return null;let t=ne(),o=t==null?void 0:t.querySelector("[data-stream-canvas]");return o&&o.isConnected?o:null},Ze=(e,t,o,s="add")=>{var p;let c=(p=Je(s))!=null?p:mt(t,o);c&&(re=s,c.innerHTML=e,je(c))},et=(e,t,o="edit")=>{var c;let s=(c=Je(o))!=null?c:pt(t);s&&(re=o,s.innerHTML=e,je(s))},R=()=>{re=null;let e=ne();if(!e){oe.clear();return}pe(e),oe.forEach(t=>{let o=e.querySelector(`[data-block-id="${t}"]`);o&&(o.style.display="")}),oe.clear()};var gt=["content","text","title","label","heading"],tt=60,ft=e=>{for(let t of gt){let o=e[t];if(typeof o=="string"&&o.trim().length>0){let s=o.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();if(s)return s.length>tt?`${s.slice(0,tt)}\u2026`:s}}return""},ot=e=>{var c;if(!e||e.length===0)return"";let t=new Map;for(let p of e){let l=(c=p._parent)!=null?c:null,y=t.get(l);y?y.push(p):t.set(l,[p])}let o=[],s=(p,l)=>{var P;let y=(P=t.get(p))!=null?P:[];for(let h of y){let x=[h._id,h._type],M=h._name&&h._name!==h._type?h._name:"",S=ft(h);M&&x.push(M),S&&x.push(`"${S}"`),h._type==="PartialBlock"&&h.partialBlockId&&x.push(`partial-id=${h.partialBlockId} (edit on its own page)`),o.push(`${" ".repeat(l)}${x.join(" | ")}`),s(h._id,l+1)}};return s(null,0),o.join(`
|
|
2
|
+
`)};function ge(e,t="",o=0,s=3){if(o>=s)return t?[t]:[];let c=[];for(let p of Object.keys(e!=null?e:{})){let l=t?`${t}.${p}`:p,y=e[p];Array.isArray(y)?c.push(l):y&&typeof y=="object"?c.push(...ge(y,l,o+1,s)):c.push(l)}return c}function nt(e){let{global:t,...o}=e!=null?e:{};return{global:ge(t!=null?t:{},"global"),page:ge(o,"")}}var Pt=5,Tt=120,rt=e=>e&&typeof e=="object"?e:{},fe=e=>typeof e=="string"&&e.length>0&&e!=="undefined"?e:void 0,ke=e=>typeof e=="number"?e:void 0,he=e=>{if(!e)return null;try{let t=JSON.parse(e.message);if(t&&t.ok===!1&&t.error)return{message:t.error.message,code:t.error.code,status:t.error.status,metadata:t.error.metadata}}catch(t){}return{message:e.message}},st=({onFinish:e,onError:t}={})=>{let o=Ee(),s=Q("getAccessToken",$),c=Q("beforeRequest",$),p=Q("onLogout",$),l=J(),y=Y("flags.animation",!1),P=Ct(_e),h=we(),{data:x}=Be(),M=Se(),S=ht(),{savePageAsync:ae}=Ae(),{addBlocks:N,setNewBlocks:G}=Ie(),z=We(),L=Me(),K=Ve(),w=se((n,r,i)=>{n.forEach(a=>{a._parent||(a._parent=r)}),N(n,r,i)},[N]),A=_({model:"",isAutoMode:!1,buildData:()=>({})});A.current.buildData=()=>{var n;return{model:A.current.model||void 0,context:l.context,designTokens:P,pageHtml:M({}),pageOutline:ot(F()),options:{animation:y,dataBindingPaths:nt(h),pageType:(n=x==null?void 0:x.pageType)!=null?n:void 0}}};let D=_(0),U=_(null),E=_(!1),T=_(null),ie=At(()=>new yt({api:o,prepareSendMessagesRequest:async({messages:n,api:r})=>{await new Promise(m=>setTimeout(m,Tt));let i={messages:n,...A.current.buildData()};if(c)try{let m=await c({action:j.AI_EDIT_PAGE,data:i});m&&typeof m=="object"&&"data"in m&&(i=m.data)}catch(m){console.error("Error in beforeRequest hook:",m)}let a=await s();return{api:`${r}?action=${j.AI_EDIT_PAGE.toLowerCase()}`,headers:{Authorization:`Bearer ${a}`},body:{action:j.AI_EDIT_PAGE,data:i}}}}),[o]),X=_($),O=se(async(n,r)=>{var i;switch(n){case"edit_block":{let{blockId:a,html:m}=r;if(!a||!m)return{ok:!1,error:"edit_block requires blockId and html"};if(!F().some(le=>le._id===a))return{ok:!1,error:`No block with bid "${a}" \u2014 check the page outline for valid bids.`};let H=await me(m);return await z(a,H),R(),{ok:!0,newBlockIds:H.map(le=>le._id)}}case"add_blocks":{let{html:a}=r;if(!a)return{ok:!1,error:"add_blocks requires html"};let m=await me(a);return m.length===0?{ok:!1,error:"html produced no blocks"}:(w(m,fe(r.parentId),ke(r.position)),R(),{ok:!0,newBlockIds:m.map(v=>v._id)})}case"remove_blocks":{let a=(i=r.ids)!=null?i:[];return a.length===0?{ok:!1,error:"remove_blocks requires at least one id"}:(await L(a),{ok:!0})}case"add_custom_block":{let{type:a,props:m}=r;if(!a)return{ok:!1,error:"add_custom_block requires a type"};if(!Ce(a))return{ok:!1,error:`Unknown block type "${a}" \u2014 use a type from the custom block catalog.`};let v={_id:W(),_type:a,...m!=null?m:{}};return w([v],fe(r.parentId),ke(r.position)),{ok:!0,newBlockIds:[v._id]}}case"bind_prop":{let{blockId:a,propName:m,bindingPath:v}=r;return!a||!m||!v?{ok:!1,error:"bind_prop requires blockId, propName and bindingPath"}:(K(a,m,v),{ok:!0})}default:return{ok:!1,error:`Unknown client tool: ${n}`}}},[z,w,L,K]),V=_(O);V.current=O;let B=_(e);B.current=e;let u=_(t);u.current=t;let d=kt({transport:ie,experimental_throttle:50,sendAutomaticallyWhen:n=>E.current||!vt(n)||D.current>=Pt?!1:(D.current+=1,!0),onToolCall:async({toolCall:n})=>{if(E.current)return;let r=(async()=>{let i=n.toolName,a=rt(n.input),m;try{m=await V.current(i,a)}catch(v){m={ok:!1,error:v instanceof Error?v.message:String(v)}}E.current||X.current({tool:i,toolCallId:n.toolCallId,output:m})})();T.current=r;try{await r}finally{T.current===r&&(T.current=null)}},onFinish:({message:n,isAbort:r,isError:i})=>{var a;R(),S.invalidateQueries({queryKey:[Re]}),!r&&!i&&A.current.isAutoMode&&(A.current.isAutoMode=!1,ae(!0).catch($)),(a=B.current)==null||a.call(B,{message:n,isAbort:r,isError:i})},onError:n=>{var i;R();let r=he(n);(r==null?void 0:r.status)===401&&p("SESSION_EXPIRED"),(i=u.current)==null||i.call(u,n)}});X.current=({tool:n,toolCallId:r,output:i})=>d.addToolOutput({state:"output-available",tool:n,toolCallId:r,output:i});let{messages:f,status:g}=d;xt(()=>{if(g!=="streaming"&&g!=="submitted")return;let n=f[f.length-1];if(!(!n||n.role!=="assistant"))for(let r=n.parts.length-1;r>=0;r--){let i=n.parts[r];if(!bt(i))continue;if(i.state!=="input-streaming")return;let a=rt(i.input);if(typeof a.html!="string")return;i.type==="tool-edit_block"&&a.blockId?et(a.html,a.blockId,i.toolCallId):i.type==="tool-add_blocks"&&Ze(a.html,fe(a.parentId),ke(a.position),i.toolCallId);return}},[f,g]);let b=se(async(n,{model:r,files:i,isAutoMode:a,selectedBlockId:m,displayText:v})=>{A.current.model=r,A.current.isAutoMode=!!a,D.current=0,E.current=!1,U.current=F();let H=m||v?{selectedBlockId:m,displayText:v}:void 0;await d.sendMessage({text:n,...i&&i.length>0?{files:i}:{},...H?{metadata:H}:{}})},[d.sendMessage]),C=se(async()=>{E.current=!0,await d.stop();try{await T.current}catch(i){}R();let n=U.current;U.current=null;let r=n!==null&&F()!==n;return r&&G(n),{reverted:r}},[d.stop,G]);return{...d,sendPrompt:b,stop:C,isLoading:d.status==="submitted"||d.status==="streaming"}};import{Fragment as Lt,jsx as k,jsxs as q}from"react/jsx-runtime";var St=_t(()=>import("./ai-prompt-input-CPT5ETQ4.js")),Rt=e=>{let t=e.metadata;return t!=null&&t.displayText?t.displayText:e.parts.filter(o=>o.type==="text").map(o=>o.text).join(`
|
|
3
|
+
`)},Nt=({t:e,setIsLoading:t,selectedModel:o,onModelChange:s,onMessagesCountChange:c})=>{let{models:p}=Le(),l=J(),y=p.find(u=>{var d;return u.id===((d=ce())==null?void 0:d.id)})||p[0],P=o||y.id,[h,x]=be(""),M=Pe(),[,S]=Te(),[ae,N]=be(!1),[G,z]=be("page"),L=Y("loading",!1),K=xe(),w=Et(P),{messages:A,setMessages:D,sendPrompt:U,stop:E,isLoading:T,error:ie,clearError:X}=st({onFinish:({message:u,isAbort:d,isError:f})=>{d||f||at(()=>{var n,r,i;let g=u.parts.filter(a=>a.type==="text").map(a=>a.text).join(`
|
|
4
|
+
`),b=Date.now(),C=w.current;(n=l.onSuccess)==null||n.call(l,{content:g,model:C,timestamp:b}),(r=l.onComplete)==null||r.call(l,{success:!0,content:g,model:C,timestamp:b}),(i=l.onAIEvent)==null||i.call(l,{type:"completion",content:g,model:C,timestamp:b})})},onError:u=>{at(()=>{var b,C,n;let d=u instanceof Error?u.message:String(u),f=Date.now(),g=w.current;(b=l.onError)==null||b.call(l,{error:d,model:g,timestamp:f}),(C=l.onComplete)==null||C.call(l,{success:!1,error:d,model:g,timestamp:f}),(n=l.onAIEvent)==null||n.call(l,{type:"error",error:d,model:g,timestamp:f})})}});ye(()=>{t(T)},[T,t]),ye(()=>{c==null||c(A.length)},[A.length,c]);let O=async(u,d,f,g,b,C)=>{var a;if(!u||T)return;X(),x("");let n=g||P;w.current=n,(a=l.onAIEvent)==null||a.call(l,{type:"stream_start",model:n,timestamp:Date.now()});let r=[...f!=null?f:[],...b!=null?b:[]],i=p.find(m=>m.id===n);r.length>0&&(i!=null&&i.allowedFileTypes)&&i.allowedFileTypes.length===0&&(r=[],Bt.warning(e("{{model}} can't read images or files. Attachments were not sent \u2014 switch models to use them.",{model:i.name}))),await U(d||u,{model:n,files:r,isAutoMode:C,selectedBlockId:M==null?void 0:M._id,displayText:d&&d!==u?u:void 0})},V=async()=>{let{reverted:u}=await E(),d=e(u?"Generation stopped. The page was restored to how it was before this prompt.":"Generation stopped.");D(f=>[...f,{id:W(),role:"assistant",parts:[{type:"text",text:d}]}])};ye(()=>{if(L)return;let{blocks:u}=K();if(u&&(u==null?void 0:u.filter(g=>g._type!=="GlobalBlock").length)>0)return;let d=Ke({clean:!0});if(!d)return;let f=d==null?void 0:d.homePagePrompt;x(f||""),f&&setTimeout(()=>{var g;O(f,void 0,void 0,(g=ce())==null?void 0:g.id,void 0,!0)},1e3)},[L]);let B=he(ie);return q(Lt,{children:[q(De,{className:"no-scrollbar !-mx-2 px-0",children:[q(Ue,{className:"no-scrollbar gap-4 px-0",children:[A.length===0&&k(Oe,{icon:k(Mt,{size:30,className:"text-foreground/50"}),title:"Start a conversation",description:e("Start a conversation with the AI assistant to add/edit current page")}),A.map(u=>k(It,{children:u.role==="user"?k(Z,{from:"user",children:k(ee,{className:"!p-0",children:k("div",{className:"rounded-sm bg-accent p-2 text-xs",children:Rt(u)})})}):u.parts.map((d,f)=>{var b,C,n;let g=`${u.id}-${f}`;if(d.type==="reasoning")return q($e,{isStreaming:d.state==="streaming",defaultOpen:!0,className:"gap-0 space-y-0",children:[k(qe,{className:"text-xs [&_p]:text-muted-foreground"}),k(Ge,{className:"p-0 text-xs",showLastLinesOnly:2,children:ue((b=d.text)!=null?b:"")})]},g);if(d.type==="text"){let r=ue((C=d.text)!=null?C:"");return r?k(Z,{from:"assistant",children:k(ee,{className:"!p-0",children:k(de,{className:"p-0 text-xs",children:r})})},g):null}return(n=d.type)!=null&&n.startsWith("tool-")?k(Qe,{part:d},g):null})},u.id)),B&&k(Z,{from:"assistant",children:k(ee,{className:"!p-0",children:k(de,{className:"p-0 text-xs",children:ze(new Error(B.message))})})})]}),k(He,{})]}),q("div",{className:`border-border pb-2 ${T?"relative z-50":""}`,children:[k(Xe,{onRemove:()=>S([]),onManageContext:u=>{u&&z(u),N(!0)},isLoading:T}),k(Ne,{open:ae,onOpenChange:N,defaultTab:G}),k(wt,{fallback:k("div",{children:"Loading..."}),children:k(St,{input:h,setInput:x,onSend:O,onStop:V,isLoading:T,selectedLang:"",currentBlock:M,disabled:(h==null?void 0:h.length)===0,selectedModel:P,onModelChange:s})})]})]})},Do=Nt;export{Do 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 $,b as _,c as w,d as j,e as K,f as Y,g as J,h as Q,i as V,j as X,k as Z,l as ee,m as oe,n as te}from"./chunk-LRJREWRD.js";import{a as T}from"./chunk-WHPIYGCY.js";import{c as b}from"./chunk-YQPOFRXU.js";import{a as H}from"./chunk-55SU3QPU.js";import"./chunk-ZAU65LBG.js";import"./chunk-ODSL3KXG.js";import"./chunk-TVF77C53.js";import{a as B,b as L,d as R}from"./chunk-777N6WHB.js";import"./chunk-WSQ5SQBD.js";import{a as U,d as O,f as q,h as W}from"./chunk-YQ5QQCRD.js";import"./chunk-RBDZDQZR.js";import"./chunk-4VNLL2IA.js";import"./chunk-FLSV2QGU.js";import"./chunk-2N4IJZOR.js";import{b as v}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import{c as re}from"./chunk-6M7V7BOM.js";import{a as I}from"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{ArrowUp as Ne,GlobeIcon as Ce,ImageIcon as Ae,Paperclip as ue,Square as we}from"lucide-react";import{startTransition as fe,useEffect as Te,useRef as ke,useState as ge}from"react";import{useTranslation as ze}from"react-i18next";import{toast as Fe}from"sonner";import{Check as Ie,Cpu as ve}from"lucide-react";import{useState as be}from"react";import{jsx as c,jsxs as he}from"react/jsx-runtime";var pe=o=>c(B,{...o}),le=o=>c(L,{...o}),ae=({className:o,children:n,title:u="Model Selector",...P})=>c(R,{"aria-labelledby":"model-selector-title",className:I("w-[400px] p-0",o),...P,children:he(U,{className:"**:data-[slot=command-input-wrapper]:h-auto relative",children:[c("div",{id:"model-selector-title",className:"sr-only",children:u}),n]})});var se=o=>c(O,{...o});var ne=o=>c(q,{...o}),ie=o=>c(W,{...o});var ce=({provider:o,className:n,...u})=>c(H,{...u,alt:`${o} logo`,className:I("size-5 rounded-full bg-background p-0.5 dark:bg-gray-500",n),height:20,src:`https://models.dev/logos/${o}.svg`,width:20});var me=({className:o,...n})=>c("span",{className:I("line-clamp-1 flex-1 text-left",o),...n});import{Fragment as ye,jsx as a,jsxs as d}from"react/jsx-runtime";var de=({selectedModel:o,onModelChange:n,disabled:u=!1})=>{let[P,m]=be(!1),{models:M}=b(),i=M.find(p=>p.id===o)||M[0],y=M.reduce((p,l)=>(p[l.provider]||(p[l.provider]=[]),p[l.provider].push(l),p),{}),s=p=>{n(p),m(!1)};return d(pe,{open:P,onOpenChange:m,children:[a(T,{content:i.name,side:"top",children:a(le,{asChild:!0,className:"bg-transparent",children:d(v,{variant:"outline",size:"xs",disabled:u,className:"h-[22px] max-w-[120px] gap-1 px-2 font-light",children:[a(ve,{className:"!h-3 !w-3"}),a("span",{className:"max-w-20 truncate text-[11px]",children:i.name})]})})}),d(ae,{className:"max-w-72 p-0",align:"start",children:[a("h3",{className:"px-3 pb-0 pt-2 text-xs font-medium text-foreground",children:"Models"}),a(se,{className:"no-scrollbar",children:Object.entries(y).map(([p,l])=>a(ne,{heading:p.charAt(0).toUpperCase()+p.slice(1),children:l.map(t=>d(ie,{value:t.id,onSelect:()=>s(t.id),className:`relative flex cursor-pointer items-start pb-1 pt-1.5 ${o===t.id?"bg-accent":"hover:bg-accent/50"}`,children:[o===t.id?a(Ie,{className:"mt-0.5 size-5 rounded-full bg-primary stroke-[4px] p-0.5 text-primary-foreground"}):a(ce,{provider:t.provider}),a(T,{content:d(ye,{children:[a("b",{children:t.name}),": ",t.description]}),side:"top",align:"start",className:"w-44",children:d("div",{className:"flex w-full flex-col",children:[d("div",{className:"flex w-full items-center justify-between",children:[a(me,{className:"text-xs leading-none",children:t.name}),(t==null?void 0:t.multiplier)>0?d("div",{className:"text-[10px] italic text-muted-foreground",children:[t==null?void 0:t.multiplier,"x Credits"]}):null]}),a("div",{className:"line-clamp-1 text-[10px] italic leading-4 text-muted-foreground",children:t.description})]})})]},t.id))},p))})]})]})};import{jsx as r,jsxs as S}from"react/jsx-runtime";var k="chai-ai-selected-model",De=({input:o,setInput:n,onSend:u,onStop:P,isLoading:m,disabled:M,selectedLang:i,selectedModel:y,onModelChange:s,isGenerateImagePanel:p=!1})=>{var E;let{t:l}=ze(),{models:t}=b(),f=t.find(e=>{var x;return e.id===((x=re())==null?void 0:x.id)})||t[0],[N,C]=ge(y||f.id),z=ke(null),[F,xe]=ge(!1),g=t.find(e=>e.id===N)||f,Se=["image/*","application/pdf","text/plain","text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],D=g!=null&&g.allowedFileTypes?(E=g==null?void 0:g.allowedFileTypes)==null?void 0:E.join(","):Se.join(","),Pe=D.length>0;return Te(()=>{if(!i){let e=localStorage.getItem(k);e&&t.find(x=>x.id===e)?fe(()=>{C(e),s==null||s(e)}):(e&&localStorage.removeItem(k),fe(()=>{C(f.id),s==null||s(f.id)}))}},[i,s,f.id,t]),r("div",{className:"relative",children:r("div",{className:"rounded-lg",children:S(j,{onSubmit:e=>{var G;let x=e.files.filter(A=>{var h;return(h=A.mediaType)==null?void 0:h.startsWith("image/")}),Me=e.files.filter(A=>{var h;return!((h=A.mediaType)!=null&&h.startsWith("image/"))});u((G=e.text)==null?void 0:G.trim(),void 0,x,i?f.id:N,Me)},accept:D,onError:e=>Fe.error(l(e.message)),className:"flex h-auto w-full flex-col rounded-lg",children:[r(Y,{className:"p-0",children:r(_,{className:"gap-0.5 px-1 pb-0 pt-1",children:e=>r($,{className:"max-w-sm text-xs",data:e})})}),r(K,{ref:z,value:o,onChange:e=>n(e.target.value),placeholder:l(p?"Describe the image you want to generate":i?"Ask to update content":"Ask anything..."),disabled:m,autoFocus:!0,className:"max-h-[200px] min-h-[60px] w-full p-2",rows:3}),S(J,{className:"p-2",children:[S(Q,{children:[!i&&!p&&Pe&&S(X,{children:[r(Z,{disabled:m,className:"h-6 w-6",children:r(ue,{className:"!h-3 !w-3"})}),S(ee,{children:[r(w,{label:l("Add image"),accept:"image/*",className:"text-xs",onClick:e=>e.stopPropagation(),children:r(Ae,{className:"mr-2 size-4"})}),r(w,{label:l("Add file"),accept:"application/pdf,text/plain,text/csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",className:"text-xs",onClick:e=>e.stopPropagation(),children:r(ue,{className:"mr-2 size-4"})})]})]}),r(te,{textareaRef:z,onTranscriptionChange:n,disabled:m,"aria-label":l("Start voice input"),title:l("Start voice input")}),!i&&!p&&r(de,{selectedModel:N,onModelChange:e=>{C(e),s==null||s(e),localStorage.setItem(k,e)},disabled:m}),r(V,{className:"hidden h-6 w-6",size:"sm",onClick:()=>xe(!F),variant:F?"default":"ghost",children:r(Ce,{className:"!h-3 !w-3"})})]}),m?S(v,{onClick:P,size:"xs",variant:"destructive",title:l("Stop generation"),children:[r(we,{className:"!h-3 !w-3"})," Stop"]}):r(oe,{disabled:!o.trim()||M,className:"h-6 w-6",children:r(Ne,{className:"!h-3 !w-3 stroke-[3]"})})]})]})})})},mo=De;export{mo as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K,b as V,c as _}from"./chunk-JPJRO4NU.js";import{b as R}from"./chunk-2PJZUYIZ.js";import"./chunk-PQHFT4TE.js";import"./chunk-YEFMD4DS.js";import"./chunk-T2YYNX6Z.js";import{d as C}from"./chunk-AOJE5WI3.js";import"./chunk-ONSZ462E.js";import{d as M,e as S,g as D,m as H}from"./chunk-LRJREWRD.js";import"./chunk-2NYUIXUX.js";import{a as F}from"./chunk-WEVKAJMV.js";import"./chunk-55SU3QPU.js";import{c as k}from"./chunk-ZAU65LBG.js";import"./chunk-ODSL3KXG.js";import"./chunk-WSQ5SQBD.js";import"./chunk-YQ5QQCRD.js";import"./chunk-RBDZDQZR.js";import"./chunk-4VNLL2IA.js";import"./chunk-FLSV2QGU.js";import"./chunk-2N4IJZOR.js";import{b as G}from"./chunk-3IT7IIAV.js";import{b as N}from"./chunk-IP4JBQOX.js";import"./chunk-CRJENCPR.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import{s as x}from"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{ArrowRight as q,Wand2Icon as W}from"lucide-react";import{useCallback as u,useEffect as j,useRef as J,useState as p}from"react";import{useTranslation as Q}from"react-i18next";import{jsx as a,jsxs as g}from"react/jsx-runtime";var le=({onThemeGenerated:T})=>{let{t:o}=Q(),b=C(),{data:r}=R(),z=k("AI_GENERATE_THEME"),A=J(null),[s,f]=p(!1),[c,d]=p(""),[t,I]=p(!1),[v,i]=p(null);j(()=>{s&&setTimeout(()=>{var e;return(e=A.current)==null?void 0:e.focus()},100)},[s]);let l=u(e=>{i(e),setTimeout(()=>i(null),8e3)},[]),h=u(async()=>{var y,E;let e=c.trim();if(!(!e||t)){I(!0),i(null);try{let n=x().map(O=>O.family),m=await b({body:{action:F.AI_GENERATE_THEME,data:{prompt:e,availableFonts:n,branding:(y=r==null?void 0:r.site)!=null&&y.look||(E=r==null?void 0:r.site)!=null&&E.tone?{look:r.site.look,tone:r.site.tone}:void 0,model:z}}});if(!(m!=null&&m.css)){l(o("Failed to generate theme. Please try again."));return}let w=_(m.css);if(!w.isValid){l(w.error||o("AI generated invalid CSS. Please try a different description."));return}let P=K(m.css);if(!V(P)){l(o("AI generated an incomplete theme. Missing required colors. Please try a different description."));return}T(P),d(""),f(!1)}catch(n){console.error("AI Theme Generation Error:",n),l((n==null?void 0:n.message)||o("Failed to generate theme with AI. Please try again."))}finally{I(!1)}}},[c,t,b,o,T,l,r]),B=u(e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),h()),e.key==="Escape"&&(e.preventDefault(),t||(f(!1),d(""),i(null)))},[h,t]),L=u(()=>{t||(f(e=>!e),s&&(d(""),i(null)))},[s,t]);return g("div",{className:"relative",children:[a(G,{variant:"ghost",size:"icon-sm",onClick:L,disabled:t,"aria-label":o("Generate theme with AI"),title:o("Generate theme with AI"),children:a(W,{className:"text-orange h-3 w-3"})}),s&&g("div",{className:"absolute right-0 top-full z-50 w-[256px] overflow-hidden rounded-md border bg-background shadow-lg",children:[g(M,{onSubmit:h,className:"flex flex-col",children:[a(S,{ref:A,placeholder:o("Describe the look you want"),value:c,onChange:e=>d(e.target.value),onKeyDown:B,disabled:t,className:"w-full resize-none border-0 text-xs",rows:5}),a(D,{className:"absolute bottom-0 right-0 justify-end",children:a(H,{disabled:!c.trim()||t,className:"h-7 w-7 shrink-0",children:t?a(N,{className:"!h-3 !w-3"}):a(q,{className:"!h-3 !w-3"})})})]}),v&&a("p",{className:"border-t p-2 text-[10px] leading-tight text-destructive",children:v})]})]})};export{le as AiThemeGenerator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as n}from"./chunk-HA7LF3RV.js";import{b as o}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import{ArrowRight as r}from"lucide-react";import{useTranslation as p}from"react-i18next";import{jsx as t,jsxs as s}from"react/jsx-runtime";var m=({selectedLang:a,isLoading:i,selectedBlock:l,onClick:c})=>{let{t:e}=p();return t("div",{className:"flex flex-col gap-2",children:t("div",{className:`flex flex-col gap-2 ${i?"pointer-events-none opacity-50":""}`,children:l?t(o,{variant:"outline",className:"h-auto justify-start px-3 py-2",size:"sm",onClick:()=>c("TRANSLATE"),children:s("div",{className:"flex flex-col",children:[t("p",{className:"text-left text-xs font-thin italic",children:e("Quick Action:")}),s("span",{className:"flex items-center gap-x-2 text-xs font-light",children:[e("Translate Content")," ",e("to")," ",n[a]," ",t(r,{className:"!h-3 !w-3"})]})]})}):null})})},u=m;export{u as default};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { k as ChaiBlock, S as ChaiPageProps, o as ChaiBlockSchema, r as ChaiBlockUiSchema } from './actions-DM00SIUk.js';
|
|
3
|
+
|
|
4
|
+
type ChaiBlockComponentProps<BlockProps = unknown, PageData = Record<string, unknown>> = ChaiBlock<BlockProps> & {
|
|
5
|
+
$loading?: boolean;
|
|
6
|
+
blockProps: Record<string, string>;
|
|
7
|
+
inBuilder: boolean;
|
|
8
|
+
lang: string;
|
|
9
|
+
draft: boolean;
|
|
10
|
+
pageProps?: ChaiPageProps;
|
|
11
|
+
pageData?: PageData;
|
|
12
|
+
children?: React__default.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type ChaiStyles = {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
17
|
+
type ChaiAsyncProp<T> = T | undefined;
|
|
18
|
+
type ChaiClosestBlockProp<T> = T | undefined;
|
|
19
|
+
type ChaiDataProviderArgs<T = Record<string, any>, K = Record<string, any>> = {
|
|
20
|
+
block: ChaiBlock<T>;
|
|
21
|
+
} & K;
|
|
22
|
+
interface ChaiBlockConfig {
|
|
23
|
+
type: string;
|
|
24
|
+
label: string;
|
|
25
|
+
group: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
wrapper?: boolean;
|
|
28
|
+
blocks?: ChaiBlock[] | (() => ChaiBlock[]);
|
|
29
|
+
category?: string;
|
|
30
|
+
hidden?: boolean | ((parentType?: string) => boolean);
|
|
31
|
+
icon?: React__default.ReactNode | React__default.ComponentType;
|
|
32
|
+
/**
|
|
33
|
+
* Restricts this block to specific page types (matched against `ChaiPage.pageType`).
|
|
34
|
+
* Omit to make the block available on every page type.
|
|
35
|
+
*/
|
|
36
|
+
pageTypes?: string[];
|
|
37
|
+
dataProviderMode?: "live" | "mock";
|
|
38
|
+
dataProviderDependencies?: string[];
|
|
39
|
+
dataProvider?: (args: {
|
|
40
|
+
lang: string;
|
|
41
|
+
draft: boolean;
|
|
42
|
+
inBuilder: boolean;
|
|
43
|
+
block: ChaiBlock;
|
|
44
|
+
pageProps: ChaiPageProps;
|
|
45
|
+
}) => Record<string, unknown>;
|
|
46
|
+
props?: {
|
|
47
|
+
schema: ChaiBlockSchema;
|
|
48
|
+
uiSchema: ChaiBlockUiSchema;
|
|
49
|
+
};
|
|
50
|
+
i18nProps?: string[];
|
|
51
|
+
aiProps?: string[];
|
|
52
|
+
inlineEditProps?: string[];
|
|
53
|
+
canAcceptBlock?: (type: string) => boolean;
|
|
54
|
+
canDelete?: () => boolean;
|
|
55
|
+
canMove?: () => boolean;
|
|
56
|
+
canDuplicate?: () => boolean;
|
|
57
|
+
canBeNested?: (type: string) => boolean;
|
|
58
|
+
}
|
|
59
|
+
interface ChaiServerBlockConfig {
|
|
60
|
+
component: React__default.ComponentType<ChaiBlockComponentProps>;
|
|
61
|
+
type: string;
|
|
62
|
+
dataProvider?: (args: {
|
|
63
|
+
draft: boolean;
|
|
64
|
+
inBuilder: boolean;
|
|
65
|
+
lang: string;
|
|
66
|
+
block: ChaiBlock;
|
|
67
|
+
pageProps: ChaiPageProps;
|
|
68
|
+
}) => Promise<Record<string, unknown>>;
|
|
69
|
+
suspenseFallback?: React__default.ComponentType<any>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type { ChaiAsyncProp as C, ChaiBlockComponentProps as a, ChaiBlockConfig as b, ChaiClosestBlockProp as c, ChaiDataProviderArgs as d, ChaiServerBlockConfig as e, ChaiStyles as f };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { k as ChaiBlock, S as ChaiPageProps, o as ChaiBlockSchema, r as ChaiBlockUiSchema } from './actions-DM00SIUk.cjs';
|
|
3
|
+
|
|
4
|
+
type ChaiBlockComponentProps<BlockProps = unknown, PageData = Record<string, unknown>> = ChaiBlock<BlockProps> & {
|
|
5
|
+
$loading?: boolean;
|
|
6
|
+
blockProps: Record<string, string>;
|
|
7
|
+
inBuilder: boolean;
|
|
8
|
+
lang: string;
|
|
9
|
+
draft: boolean;
|
|
10
|
+
pageProps?: ChaiPageProps;
|
|
11
|
+
pageData?: PageData;
|
|
12
|
+
children?: React__default.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type ChaiStyles = {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
17
|
+
type ChaiAsyncProp<T> = T | undefined;
|
|
18
|
+
type ChaiClosestBlockProp<T> = T | undefined;
|
|
19
|
+
type ChaiDataProviderArgs<T = Record<string, any>, K = Record<string, any>> = {
|
|
20
|
+
block: ChaiBlock<T>;
|
|
21
|
+
} & K;
|
|
22
|
+
interface ChaiBlockConfig {
|
|
23
|
+
type: string;
|
|
24
|
+
label: string;
|
|
25
|
+
group: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
wrapper?: boolean;
|
|
28
|
+
blocks?: ChaiBlock[] | (() => ChaiBlock[]);
|
|
29
|
+
category?: string;
|
|
30
|
+
hidden?: boolean | ((parentType?: string) => boolean);
|
|
31
|
+
icon?: React__default.ReactNode | React__default.ComponentType;
|
|
32
|
+
/**
|
|
33
|
+
* Restricts this block to specific page types (matched against `ChaiPage.pageType`).
|
|
34
|
+
* Omit to make the block available on every page type.
|
|
35
|
+
*/
|
|
36
|
+
pageTypes?: string[];
|
|
37
|
+
dataProviderMode?: "live" | "mock";
|
|
38
|
+
dataProviderDependencies?: string[];
|
|
39
|
+
dataProvider?: (args: {
|
|
40
|
+
lang: string;
|
|
41
|
+
draft: boolean;
|
|
42
|
+
inBuilder: boolean;
|
|
43
|
+
block: ChaiBlock;
|
|
44
|
+
pageProps: ChaiPageProps;
|
|
45
|
+
}) => Record<string, unknown>;
|
|
46
|
+
props?: {
|
|
47
|
+
schema: ChaiBlockSchema;
|
|
48
|
+
uiSchema: ChaiBlockUiSchema;
|
|
49
|
+
};
|
|
50
|
+
i18nProps?: string[];
|
|
51
|
+
aiProps?: string[];
|
|
52
|
+
inlineEditProps?: string[];
|
|
53
|
+
canAcceptBlock?: (type: string) => boolean;
|
|
54
|
+
canDelete?: () => boolean;
|
|
55
|
+
canMove?: () => boolean;
|
|
56
|
+
canDuplicate?: () => boolean;
|
|
57
|
+
canBeNested?: (type: string) => boolean;
|
|
58
|
+
}
|
|
59
|
+
interface ChaiServerBlockConfig {
|
|
60
|
+
component: React__default.ComponentType<ChaiBlockComponentProps>;
|
|
61
|
+
type: string;
|
|
62
|
+
dataProvider?: (args: {
|
|
63
|
+
draft: boolean;
|
|
64
|
+
inBuilder: boolean;
|
|
65
|
+
lang: string;
|
|
66
|
+
block: ChaiBlock;
|
|
67
|
+
pageProps: ChaiPageProps;
|
|
68
|
+
}) => Promise<Record<string, unknown>>;
|
|
69
|
+
suspenseFallback?: React__default.ComponentType<any>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type { ChaiAsyncProp as C, ChaiBlockComponentProps as a, ChaiBlockConfig as b, ChaiClosestBlockProp as c, ChaiDataProviderArgs as d, ChaiServerBlockConfig as e, ChaiStyles as f };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { C as ChaiAction, h as ChaiActionContext, _ as ChaiRequiredPermission } from './actions-DM00SIUk.js';
|
|
3
|
+
import { h as ResolvedChaiBuilderServerConfig, C as ChaiBuilderServerConfigInput } from './server-config-oPlt3V1X.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base Action Class
|
|
7
|
+
* Provides common functionality for all action handlers
|
|
8
|
+
*/
|
|
9
|
+
declare abstract class ChaiBaseAction<T = any, K = any> implements ChaiAction<T, K> {
|
|
10
|
+
protected context: ChaiActionContext | null;
|
|
11
|
+
/**
|
|
12
|
+
* Permission required to run this action. Enforced by `dispatchChaiAction`.
|
|
13
|
+
* Override in subclasses. Undefined = authenticated-only (no specific permission).
|
|
14
|
+
*/
|
|
15
|
+
requiredPermission?: ChaiRequiredPermission<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Method to get the validation schema for the action data
|
|
18
|
+
* Each action can override this to define its own validation rules
|
|
19
|
+
*/
|
|
20
|
+
protected getValidationSchema(): z.ZodType<any> | any;
|
|
21
|
+
/**
|
|
22
|
+
* Validate the action data using the schema provided by getValidationSchema
|
|
23
|
+
* @param data The data to validate
|
|
24
|
+
* @returns true if the data is valid, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
validate(data: T): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get validation errors for the action data
|
|
29
|
+
* This can be useful for debugging or providing more detailed error messages
|
|
30
|
+
* @param data The data to validate
|
|
31
|
+
* @returns An array of validation errors or null if the data is valid
|
|
32
|
+
*/
|
|
33
|
+
getValidationErrors(data: T): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Set the action context
|
|
36
|
+
* @param context The context to set
|
|
37
|
+
*/
|
|
38
|
+
setContext(context: ChaiActionContext): void;
|
|
39
|
+
/**
|
|
40
|
+
* Abstract method to execute the action
|
|
41
|
+
* Each action must implement this to define its own business logic
|
|
42
|
+
*/
|
|
43
|
+
abstract execute(data: T): Promise<any>;
|
|
44
|
+
run(data: T): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Helper method to handle common errors in actions
|
|
47
|
+
* @param error The error to handle
|
|
48
|
+
* @throws ActionError with appropriate message and code
|
|
49
|
+
*/
|
|
50
|
+
protected handleError(error: unknown): never;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare global {
|
|
54
|
+
interface D1Database {
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type ChaiBuilderConfigOnInit = (config: Readonly<ResolvedChaiBuilderServerConfig>) => void | Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the `onInit` callback registered via {@link buildChaiBuilderConfig}, if any.
|
|
61
|
+
* For ChaiBuilder SDK internal use.
|
|
62
|
+
*/
|
|
63
|
+
declare function getChaiBuilderConfigOnInit(config: ResolvedChaiBuilderServerConfig): ChaiBuilderConfigOnInit | undefined;
|
|
64
|
+
type BuildChaiBuilderConfigOptions<TExtra extends Record<string, unknown> = Record<never, never>> = {
|
|
65
|
+
/**
|
|
66
|
+
* Runs once on the first `getChaiBuilder` call for this process.
|
|
67
|
+
*/
|
|
68
|
+
onInit?: (config: Readonly<ResolvedChaiBuilderServerConfig>) => void | Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Arbitrary user-defined config merged into the returned config object.
|
|
71
|
+
* Access via `cb.getConfig(key)` on the ChaiBuilder instance.
|
|
72
|
+
*/
|
|
73
|
+
extend?: TExtra;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Build ChaiBuilder server configuration with SDK defaults merged in.
|
|
77
|
+
*/
|
|
78
|
+
declare function buildChaiBuilderConfig<TExtra extends Record<string, unknown> = Record<never, never>>(config: ChaiBuilderServerConfigInput, options?: BuildChaiBuilderConfigOptions<TExtra>): Readonly<ResolvedChaiBuilderServerConfig & TExtra>;
|
|
79
|
+
|
|
80
|
+
export { type BuildChaiBuilderConfigOptions as B, ChaiBaseAction as C, buildChaiBuilderConfig as b, getChaiBuilderConfigOnInit as g };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { C as ChaiAction, h as ChaiActionContext, _ as ChaiRequiredPermission } from './actions-DM00SIUk.cjs';
|
|
3
|
+
import { h as ResolvedChaiBuilderServerConfig, C as ChaiBuilderServerConfigInput } from './server-config-b29G6_aQ.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base Action Class
|
|
7
|
+
* Provides common functionality for all action handlers
|
|
8
|
+
*/
|
|
9
|
+
declare abstract class ChaiBaseAction<T = any, K = any> implements ChaiAction<T, K> {
|
|
10
|
+
protected context: ChaiActionContext | null;
|
|
11
|
+
/**
|
|
12
|
+
* Permission required to run this action. Enforced by `dispatchChaiAction`.
|
|
13
|
+
* Override in subclasses. Undefined = authenticated-only (no specific permission).
|
|
14
|
+
*/
|
|
15
|
+
requiredPermission?: ChaiRequiredPermission<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Method to get the validation schema for the action data
|
|
18
|
+
* Each action can override this to define its own validation rules
|
|
19
|
+
*/
|
|
20
|
+
protected getValidationSchema(): z.ZodType<any> | any;
|
|
21
|
+
/**
|
|
22
|
+
* Validate the action data using the schema provided by getValidationSchema
|
|
23
|
+
* @param data The data to validate
|
|
24
|
+
* @returns true if the data is valid, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
validate(data: T): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get validation errors for the action data
|
|
29
|
+
* This can be useful for debugging or providing more detailed error messages
|
|
30
|
+
* @param data The data to validate
|
|
31
|
+
* @returns An array of validation errors or null if the data is valid
|
|
32
|
+
*/
|
|
33
|
+
getValidationErrors(data: T): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Set the action context
|
|
36
|
+
* @param context The context to set
|
|
37
|
+
*/
|
|
38
|
+
setContext(context: ChaiActionContext): void;
|
|
39
|
+
/**
|
|
40
|
+
* Abstract method to execute the action
|
|
41
|
+
* Each action must implement this to define its own business logic
|
|
42
|
+
*/
|
|
43
|
+
abstract execute(data: T): Promise<any>;
|
|
44
|
+
run(data: T): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Helper method to handle common errors in actions
|
|
47
|
+
* @param error The error to handle
|
|
48
|
+
* @throws ActionError with appropriate message and code
|
|
49
|
+
*/
|
|
50
|
+
protected handleError(error: unknown): never;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare global {
|
|
54
|
+
interface D1Database {
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type ChaiBuilderConfigOnInit = (config: Readonly<ResolvedChaiBuilderServerConfig>) => void | Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the `onInit` callback registered via {@link buildChaiBuilderConfig}, if any.
|
|
61
|
+
* For ChaiBuilder SDK internal use.
|
|
62
|
+
*/
|
|
63
|
+
declare function getChaiBuilderConfigOnInit(config: ResolvedChaiBuilderServerConfig): ChaiBuilderConfigOnInit | undefined;
|
|
64
|
+
type BuildChaiBuilderConfigOptions<TExtra extends Record<string, unknown> = Record<never, never>> = {
|
|
65
|
+
/**
|
|
66
|
+
* Runs once on the first `getChaiBuilder` call for this process.
|
|
67
|
+
*/
|
|
68
|
+
onInit?: (config: Readonly<ResolvedChaiBuilderServerConfig>) => void | Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Arbitrary user-defined config merged into the returned config object.
|
|
71
|
+
* Access via `cb.getConfig(key)` on the ChaiBuilder instance.
|
|
72
|
+
*/
|
|
73
|
+
extend?: TExtra;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Build ChaiBuilder server configuration with SDK defaults merged in.
|
|
77
|
+
*/
|
|
78
|
+
declare function buildChaiBuilderConfig<TExtra extends Record<string, unknown> = Record<never, never>>(config: ChaiBuilderServerConfigInput, options?: BuildChaiBuilderConfigOptions<TExtra>): Readonly<ResolvedChaiBuilderServerConfig & TExtra>;
|
|
79
|
+
|
|
80
|
+
export { type BuildChaiBuilderConfigOptions as B, ChaiBaseAction as C, buildChaiBuilderConfig as b, getChaiBuilderConfigOnInit as g };
|