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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/{2SSKDMRQ-C4VFVd-q.cjs → 2SSKDMRQ-BnsZi3K3.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-DSnzF_1o.js → 2SSKDMRQ-CnSDkQcy.js} +2 -2
  3. package/dist/{AP7HFJJL-B7YYCY9q.cjs → AP7HFJJL-B31839PG.cjs} +1 -1
  4. package/dist/{AP7HFJJL-Cxwj01Aq.js → AP7HFJJL-CymCmW14.js} +1 -1
  5. package/dist/{IconPicker-RqVvq6G2.js → IconPicker-B1rWC-Ex.js} +1 -1
  6. package/dist/{IconPicker-C9-ieDWm.cjs → IconPicker-DREyo007.cjs} +1 -1
  7. package/dist/{WDYDFRGG-C7aSUcjs.js → WDYDFRGG-BUVnbAci.js} +2 -2
  8. package/dist/{WDYDFRGG-b3T2SQbz.cjs → WDYDFRGG-BxhOCHc3.cjs} +1 -1
  9. package/dist/{active-in-another-tab-Clng6zpY.cjs → active-in-another-tab-B47YjQGN.cjs} +1 -1
  10. package/dist/{active-in-another-tab-wb8qolB8.js → active-in-another-tab-CyjngVA6.js} +2 -2
  11. package/dist/{add-new-language-page-C4BuMTaN.cjs → add-new-language-page-88xzrUy8.cjs} +1 -1
  12. package/dist/{add-new-language-page-D7NDABl1.js → add-new-language-page-WmlCnytQ.js} +3 -3
  13. package/dist/{add-new-page-B4hc0B-g.js → add-new-page-VW2wAYZp.js} +2 -2
  14. package/dist/{add-new-page-BNfwKjRd.cjs → add-new-page-soZ8GAkN.cjs} +1 -1
  15. package/dist/{ai-panel-content-DPy2jgKw.cjs → ai-panel-content-7zCil042.cjs} +1 -1
  16. package/dist/{ai-panel-content-BnbURb7j.js → ai-panel-content-D_o7Q_A-.js} +3 -3
  17. package/dist/{ai-panel-default-lang-3tCHzab5.cjs → ai-panel-default-lang-COYaxNwn.cjs} +2 -2
  18. package/dist/{ai-panel-default-lang-oVk4TDeb.js → ai-panel-default-lang-DnElspF0.js} +3 -3
  19. package/dist/{ai-panel-other-lang-BBHCCSen.cjs → ai-panel-other-lang-CkynNlAU.cjs} +1 -1
  20. package/dist/{ai-panel-other-lang-DmQ3QMDD.js → ai-panel-other-lang-Dp0E9_Hx.js} +3 -3
  21. package/dist/{ai-prompt-input-DaTyfib-.js → ai-prompt-input-Bhc0ds7X.js} +1 -1
  22. package/dist/{ai-prompt-input-b5ty81RB.cjs → ai-prompt-input-CThbVp0_.cjs} +1 -1
  23. package/dist/{ai-translation-prompt-c0Q3zkT2.cjs → ai-translation-prompt-C2kJQFDX.cjs} +1 -1
  24. package/dist/{ai-translation-prompt-DJPe2O-n.js → ai-translation-prompt-CZ55HQmo.js} +2 -2
  25. package/dist/{code-display-Q3_sK_Ta.cjs → code-display-BnqzqzoP.cjs} +1 -1
  26. package/dist/{code-display-BzBq5xSn.js → code-display-DhD_RBcg.js} +1 -1
  27. package/dist/{code-editor-DWWnphW9.js → code-editor-DRIAnNbb.js} +1 -1
  28. package/dist/{code-editor-BQZi6-FB.cjs → code-editor-o3___nu2.cjs} +1 -1
  29. package/dist/{continue-editing-in-this-client-BllU94XG.js → continue-editing-in-this-client-CS2aQ7yY.js} +2 -2
  30. package/dist/{continue-editing-in-this-client-D9HyD4GP.cjs → continue-editing-in-this-client-CtMYsk-A.cjs} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.js +1 -1
  33. package/dist/{css-import-modal-D72a-16X.js → css-import-modal-Byg6wV0O.js} +3 -4
  34. package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
  35. package/dist/{delete-design-token-Cd1ZDtqT.js → delete-design-token-BRZZiWtQ.js} +1 -1
  36. package/dist/{delete-design-token-D_TLlO3I.cjs → delete-design-token-DkVs1oBf.cjs} +1 -1
  37. package/dist/{delete-page-DC8pzvWW.js → delete-page-BzyX9TN-.js} +2 -2
  38. package/dist/{delete-page-ByQwBupJ.cjs → delete-page-DxX7PFIE.cjs} +1 -1
  39. package/dist/{design-token-usage-BqZeR1sT.cjs → design-token-usage-CAHzEGgJ.cjs} +1 -1
  40. package/dist/{design-token-usage-DE4XCDdn.js → design-token-usage-xQs6SlaJ.js} +1 -1
  41. package/dist/{digital-asset-manager-BYLKFEYi.cjs → digital-asset-manager--uO8Agia.cjs} +1 -1
  42. package/dist/{digital-asset-manager-C_gL_0YY.js → digital-asset-manager-DbtwzxRz.js} +3 -3
  43. package/dist/{duplicate-page-BoVhko2q.js → duplicate-page-BR7Dlo9d.js} +3 -3
  44. package/dist/{duplicate-page-vdvwLQLo.cjs → duplicate-page-CaNAbXwV.cjs} +1 -1
  45. package/dist/{dynamic-page-selector-CSndg2-y.js → dynamic-page-selector-Cb5r_W8s.js} +2 -2
  46. package/dist/{dynamic-page-selector-DdnbCuQZ.cjs → dynamic-page-selector-Cxk_gjni.cjs} +1 -1
  47. package/dist/{image-editor-oypq8asR.js → image-editor-DV8kUKhl.js} +1 -1
  48. package/dist/{image-editor-DTspjj_c.cjs → image-editor-G-K28aTS.cjs} +1 -1
  49. package/dist/{index-S8ibZk9Q.js → index-Ct7ElCGK.js} +6 -6
  50. package/dist/{index-CnSjWE1P.cjs → index-DF5DEvqb.cjs} +2 -2
  51. package/dist/{index-CbwxUFy_.cjs → index-WQwzsC7A.cjs} +3 -3
  52. package/dist/{index-BDnwJqMw.js → index-ZuacEL1j.js} +122 -122
  53. package/dist/{json-diff-viewer-XX1pgabt.cjs → json-diff-viewer-D7z4zNvv.cjs} +1 -1
  54. package/dist/{json-diff-viewer-B5dr-Y_L.js → json-diff-viewer-krslPepD.js} +2 -2
  55. package/dist/{lang-panel-Cn83SRzd.js → lang-panel-BwIewMyw.js} +3 -3
  56. package/dist/{lang-panel-BPxex-M2.cjs → lang-panel-DT96k1xg.cjs} +1 -1
  57. package/dist/{manage-design-tokens-lP4HLS0P.js → manage-design-tokens-Caz_20VK.js} +2 -2
  58. package/dist/{manage-design-tokens-ConiyuPr.cjs → manage-design-tokens-CrmLe7UT.cjs} +1 -1
  59. package/dist/{mark-as-template-jncsjfHm.js → mark-as-template-D295ZQtU.js} +2 -2
  60. package/dist/{mark-as-template-DYRxre1f.cjs → mark-as-template-W3LmpiqN.cjs} +1 -1
  61. package/dist/{nested-path-selector-content-B-8LqhXI.js → nested-path-selector-content-CKYYK-C5.js} +1 -1
  62. package/dist/{nested-path-selector-content-BYtLi7mC.cjs → nested-path-selector-content-CoS_d3dc.cjs} +1 -1
  63. package/dist/{no-language-page-content-D_zd9Rb0.js → no-language-page-content-BvqRBP6y.js} +2 -2
  64. package/dist/{no-language-page-content-DAbLq0gX.cjs → no-language-page-content-DkfeMl90.cjs} +1 -1
  65. package/dist/{no-language-page-dialog-fXmbQO7L.cjs → no-language-page-dialog-BcEoqyQB.cjs} +1 -1
  66. package/dist/{no-language-page-dialog-C5Ps6YYL.js → no-language-page-dialog-PjNqTUpl.js} +2 -2
  67. package/dist/{page-creator-VWIB2VAs.cjs → page-creator-C4gc5NSC.cjs} +1 -1
  68. package/dist/{page-creator-wCMtlE6Z.js → page-creator-DiOITEMw.js} +3 -3
  69. package/dist/{page-lock-DweiYy1w.cjs → page-lock-BdYmCks0.cjs} +1 -1
  70. package/dist/{page-lock-BPCxfv9J.js → page-lock-Bfbs6RgL.js} +2 -2
  71. package/dist/{page-locked-dialog-BlbgvaG2.cjs → page-locked-dialog-B1FAtK92.cjs} +1 -1
  72. package/dist/{page-locked-dialog-ByGl18_m.js → page-locked-dialog-B6MKTRfY.js} +2 -2
  73. package/dist/{page-manager-new-D0lGfNnS.cjs → page-manager-new-CHDueBDk.cjs} +1 -1
  74. package/dist/{page-manager-new-BWFE-S-O.js → page-manager-new-CzX22g2n.js} +3 -3
  75. package/dist/{page-manager-search-and-filter-kNJFWJ86.js → page-manager-search-and-filter-CM0UMb6U.js} +2 -2
  76. package/dist/{page-manager-search-and-filter-DpGMoOII.cjs → page-manager-search-and-filter-DkkRIH86.cjs} +1 -1
  77. package/dist/{page-revisions-content-DYxXZqmh.cjs → page-revisions-content-ChY-4f2V.cjs} +1 -1
  78. package/dist/{page-revisions-content-Ulr8slUN.js → page-revisions-content-NH9JK4Ey.js} +3 -3
  79. package/dist/pages.cjs +1 -1
  80. package/dist/pages.d.ts +18 -19
  81. package/dist/pages.js +12 -12
  82. package/dist/{publish-pages-content-BTPzt_m4.js → publish-pages-content-D9aixMN5.js} +3 -3
  83. package/dist/{publish-pages-content-D6g8GAsd.cjs → publish-pages-content-x-JuSFJ9.cjs} +1 -1
  84. package/dist/{rte-widget-modal-DrMzWWjw.cjs → rte-widget-modal-BaHIuEjF.cjs} +1 -1
  85. package/dist/{rte-widget-modal-Rk_NW3KU.js → rte-widget-modal-DOJEXLIf.js} +1 -1
  86. package/dist/{save-to-lib-DHHUO12i.cjs → save-to-lib-Cgpxw8-g.cjs} +1 -1
  87. package/dist/{save-to-lib-BK3uTFss.js → save-to-lib-eiOc_SSN.js} +2 -2
  88. package/dist/{selected-block-display-DSFhddPj.cjs → selected-block-display-BgRY82CT.cjs} +1 -1
  89. package/dist/{selected-block-display-CU3TwIMA.js → selected-block-display-CBFePS19.js} +2 -2
  90. package/dist/{seo-panel-jbzxFioc.js → seo-panel-C1-iMOR1.js} +2 -2
  91. package/dist/{seo-panel-Dl0IDV09.cjs → seo-panel-DfAb8U7W.cjs} +1 -1
  92. package/dist/{shared-json-ld-BL_dv3_q.js → shared-json-ld-B4PxAM_0.js} +2 -2
  93. package/dist/{shared-json-ld-DPNkqDC1.cjs → shared-json-ld-DzG398hr.cjs} +1 -1
  94. package/dist/{slug-input-1qwKkXhA.js → slug-input-AwNJs9im.js} +1 -1
  95. package/dist/{slug-input-YVLjtTI3.cjs → slug-input-C_ijLQ_X.cjs} +1 -1
  96. package/dist/{take-over-request-DvMIg_cZ.cjs → take-over-request-BNxcjY2j.cjs} +1 -1
  97. package/dist/{take-over-request-DKvKi3mM.js → take-over-request-C4FeDtN_.js} +2 -2
  98. package/dist/{theme-panel-footer-BMOaPLWc.cjs → theme-panel-footer-Cq9pljro.cjs} +1 -1
  99. package/dist/{theme-panel-footer-DbMDLYGI.js → theme-panel-footer-uBQqSJXm.js} +2 -2
  100. package/dist/{translation-warning-modal-9wTwIy_9.js → translation-warning-modal-B64YqlbI.js} +1 -1
  101. package/dist/{translation-warning-modal-DjTwz75c.cjs → translation-warning-modal-BZAcwM2_.cjs} +1 -1
  102. package/dist/{unmark-as-template-Dulvf7Zw.js → unmark-as-template-CZ9sQp_P.js} +2 -2
  103. package/dist/{unmark-as-template-CdqIJJER.cjs → unmark-as-template-EVvk0vmp.cjs} +1 -1
  104. package/dist/{unpublish-page-Degu5Cy9.js → unpublish-page-D4VwOlxc.js} +2 -2
  105. package/dist/{unpublish-page-BwSVBf0_.cjs → unpublish-page-bdSmwAVQ.cjs} +1 -1
  106. package/dist/web-blocks.cjs +1 -1
  107. package/dist/web-blocks.js +42 -42
  108. package/dist/{web-preview-YzKxyXft.cjs → web-preview-Cio70gk5.cjs} +1 -1
  109. package/dist/{web-preview-DXE4Jnf5.js → web-preview-Djy6WIyj.js} +2 -2
  110. package/package.json +1 -1
  111. package/dist/css-import-modal-BSMGKA2T.cjs +0 -13
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./AP7HFJJL-Cxwj01Aq.js";
2
- import { w as d, x as f, y as e } from "./index-BDnwJqMw.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./AP7HFJJL-CymCmW14.js";
2
+ import { w as d, x as f, y as e } from "./index-ZuacEL1j.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AP7HFJJL-B7YYCY9q.cjs"),t=require("./index-CbwxUFy_.cjs");var s=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),a=t.getPreferredColorScheme(),l=t.createMemo(()=>{const c=o.theme||r.theme_preference||e.THEME_PREFERENCE;return c!=="system"?c:a()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:l,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:n})}})}})}})},u=s;exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AP7HFJJL-B31839PG.cjs"),t=require("./index-WQwzsC7A.cjs");var s=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),a=t.getPreferredColorScheme(),l=t.createMemo(()=>{const c=o.theme||r.theme_preference||e.THEME_PREFERENCE;return c!=="system"?c:a()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:l,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:n})}})}})}})},u=s;exports.default=u;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CnSjWE1P.cjs"),s=require("./index-CbwxUFy_.cjs"),a=require("lucide-react"),c=require("react-i18next"),l=()=>{const r=s.useSendRealtimeEvent(),{setPageStatus:i}=s.usePageLockStatus(),{t:n}=c.useTranslation();return e.jsx(s.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[e.jsx(a.TableIcon,{className:"h-6 w-6 text-green-500"}),e.jsx("span",{children:n("Active in Another Tab")})]})}),e.jsx(t.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:n("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e.jsx(t.CardFooter,{className:"flex justify-end gap-2",children:e.jsxs(t.Button,{variant:"default",onClick:()=>{r(s.EVENT.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),i(s.PAGE_STATUS.CHECKING)},className:"gap-2",children:[e.jsx(a.Edit,{className:"h-4 w-4"}),n("Continue Editing Here")]})})]})})};exports.default=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),s=require("./index-WQwzsC7A.cjs"),a=require("lucide-react"),c=require("react-i18next"),l=()=>{const r=s.useSendRealtimeEvent(),{setPageStatus:i}=s.usePageLockStatus(),{t:n}=c.useTranslation();return e.jsx(s.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[e.jsx(a.TableIcon,{className:"h-6 w-6 text-green-500"}),e.jsx("span",{children:n("Active in Another Tab")})]})}),e.jsx(t.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:n("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e.jsx(t.CardFooter,{className:"flex justify-end gap-2",children:e.jsxs(t.Button,{variant:"default",onClick:()=>{r(s.EVENT.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),i(s.PAGE_STATUS.CHECKING)},className:"gap-2",children:[e.jsx(a.Edit,{className:"h-4 w-4"}),n("Continue Editing Here")]})})]})})};exports.default=l;
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { W as r, X as i, Y as o, Z as l, _ as c, B as d } from "./index-S8ibZk9Q.js";
3
- import { ao as m, a as h, B as u, E as N, P as p } from "./index-BDnwJqMw.js";
2
+ import { W as r, X as i, Y as o, Z as l, _ as c, B as d } from "./index-Ct7ElCGK.js";
3
+ import { ao as m, a as h, B as u, E as N, P as p } from "./index-ZuacEL1j.js";
4
4
  import { TableIcon as T, Edit as f } from "lucide-react";
5
5
  import { useTranslation as E } from "react-i18next";
6
6
  const S = () => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("./index-CnSjWE1P.cjs"),V=require("./slug-input-YVLjtTI3.cjs"),g=require("./index-CbwxUFy_.cjs"),Y=require("lodash-es"),is=require("lucide-react"),N=require("react"),T=require("react-i18next"),X=({edit:c,lang:h,languages:a,name:u,setLang:t,setName:i,primaryPageObject:o})=>{const{t:s}=T.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(f.Label,{htmlFor:"lang",children:s("Language")}),e.jsxs("select",{value:c?"":h,disabled:c||!a.length,onChange:l=>{const x=l.target.value;t(x),!c&&(Y.startsWith(u,o==null?void 0:o.name)||u.length===0)&&i(`${o==null?void 0:o.name} - ${g.LANGUAGES[x]}`)},className:"col-span-3 flex h-9 w-full rounded-md border border-border bg-background 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 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("option",{value:"",disabled:!0,children:c?g.LANGUAGES[h]||h:a.length?s("Choose language"):s("All available language page is created.")}),a.map(l=>e.jsx("option",{value:l,children:g.LANGUAGES[l]||l},l))]})]})},Z=({lang:c,name:h,setName:a,parentHasSelectedLanguagePage:u})=>{const{t}=T.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(f.Label,{htmlFor:"name",children:t("Page Name")}),e.jsx(f.Input,{id:"name",value:c?h:"",onChange:i=>a(i.target.value),required:!0,placeholder:t(c?"Enter page name":"Choose language to add slug"),disabled:!u||!c})]})},ds=({dynamic:c,isNonSlugPageType:h,isRootPage:a,lang:u,useLanguagePrefix:t,setUseLanguagePrefix:i,isHomePage:o,parentSlug:s,parentHasSelectedLanguagePage:l,slug:x,setSlug:d,setIsSlugValid:m,getSlug:S})=>{const{t:r}=T.useTranslation();return h?null:e.jsxs("div",{className:"space-y-1",children:[a&&u&&e.jsxs("div",{className:"flex items-center space-x-2 pb-1",children:[e.jsx("input",{type:"checkbox",id:"useLanguagePrefix",checked:t,onChange:A=>i(A.target.checked),className:"rounded border-gray-300"}),e.jsxs(f.Label,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",e.jsxs("span",{className:"font-mono text-gray-900",children:["/",u]}),") as slug prefix"]})]}),e.jsx(f.Label,{htmlFor:"slug",children:r("Slug")}),c?e.jsx(f.Alert,{variant:"default",className:"p-2 text-xs font-medium italic text-muted-foreground",children:r("This page will use dynamic slug as defined in primary page")}):e.jsx(V.SlugInput,{disabled:!u||!l,value:x,onChange:d,placeholder:r(u?o&&t?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:s,onValidationChange:m,fullSlug:S()})]})},_=({parentHasSelectedLanguagePage:c,name:h,lang:a,slug:u,edit:t,id:i,primaryPageObject:o,pages:s,isNonSlugPageType:l,isHomePage:x,useLanguagePrefix:d,isSlugValid:m,isPending:S})=>{const{t:r}=T.useTranslation(),A=S||!h||!a||s.some(v=>(t?v.id!==i:!0)&&v.parent===(o==null?void 0:o.id)&&v.lang===a)||!l&&!(x&&d)&&(!m||!u);return e.jsx(f.DialogFooter,{children:c?e.jsxs(e.Fragment,{children:[e.jsx(f.Button,{type:"submit",disabled:A&&!o.dynamic,children:S?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"loader mr-2"}),r(t?"Updating...":"Adding...")]}):r(t?"Update":"Add new language page")}),s.some(v=>(t?v.id!==i:!0)&&v.parent===(o==null?void 0:o.id)&&v.lang===a)&&e.jsx("p",{className:"mt-2 text-xs text-red-500",children:r("A page for this language already exists.")})]}):a&&e.jsx(f.Alert,{variant:"destructive",children:e.jsxs("p",{className:"mx-auto w-5/6 text-center",children:[r("You need to create the")," ",e.jsx("span",{className:"font-medium",children:g.LANGUAGES[a]})," ",r("page in the parent to add here.")]})})})},cs=({onSubmit:c,edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s,parentHasSelectedLanguagePage:l,id:x,pages:d,isNonSlugPageType:m,isHomePage:S,useLanguagePrefix:r,slug:A,isSlugValid:v,isPending:p})=>e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(X,{edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s}),e.jsx(Z,{lang:a,name:t,setName:o,parentHasSelectedLanguagePage:l})]}),e.jsx(_,{parentHasSelectedLanguagePage:l,name:t,lang:a,slug:A,edit:h,id:x,primaryPageObject:s,pages:d,isNonSlugPageType:m,isHomePage:S,useLanguagePrefix:r,isSlugValid:v,isPending:p})]}),rs=({loading:c,onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,isNonSlugPageType:d,isRootPage:m,useLanguagePrefix:S,setUseLanguagePrefix:r,isHomePage:A,parentSlug:v,slug:p,setSlug:C,isSlugValid:U,setIsSlugValid:k,getSlug:I,isPending:$,id:D,pages:L})=>c?e.jsx("div",{className:"flex h-80 items-center justify-center",children:e.jsx(is.Loader,{className:"animate-spin"})}):d?e.jsx(cs,{onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,id:D,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:S,slug:p,isSlugValid:U,isPending:$}):e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(X,{edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l}),e.jsx(Z,{lang:u,name:i,setName:s,parentHasSelectedLanguagePage:x}),e.jsx(ds,{dynamic:l==null?void 0:l.dynamic,isNonSlugPageType:d,isRootPage:m,lang:u,useLanguagePrefix:S,setUseLanguagePrefix:r,isHomePage:A,parentSlug:v,parentHasSelectedLanguagePage:x,slug:p,setSlug:C,isSlugValid:U,setIsSlugValid:k,getSlug:I})]}),e.jsx(_,{parentHasSelectedLanguagePage:x,name:i,lang:u,slug:p,edit:a,id:D,primaryPageObject:l,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:S,isSlugValid:U,isPending:$})]}),hs=({id:c,isOpen:h,onClose:a,primaryPage:u,edit:t=!1,preselectedLang:i})=>{const{data:o=[]}=g.useWebsitePages(),s=N.useMemo(()=>o.find(n=>n.id===u),[o,u]),[l,x]=N.useState(""),[d,m]=N.useState(""),[S,r]=N.useState(""),[A,v]=N.useState(!0),[p,C]=N.useState(!0),{mutate:U,isPending:k}=g.useCreatePage(),{mutate:I,isPending:$}=g.useUpdatePage(),D=k||$,{data:L,isFetching:H}=g.useWebsiteSetting(),j=g.useFallbackLang(),{data:w,isFetching:b}=g.useLanguagePages(u),{data:F=[],isFetching:y}=g.useLanguagePages(s==null?void 0:s.parent),{data:z=[],isFetching:P}=g.usePageTypes(),{setSelectedLang:O}=f.useLanguages(),{t:M}=T.useTranslation(),[,ss]=g.useSearchParams(),[,es]=f.useSidebarActivePanel(),ns=H||b||y||P,G=N.useMemo(()=>Y.filter(L==null?void 0:L.languages,n=>!Y.find(w,{lang:n})),[L,w]),W=N.useMemo(()=>z.find(n=>n.key===(s==null?void 0:s.pageType)),[z,s==null?void 0:s.pageType]),J=!(W!=null&&W.hasSlug),B=(s==null?void 0:s.slug)==="/";N.useEffect(()=>{if(!t&&s&&i&&(m(i),x(`${s.name} - ${g.LANGUAGES[i]}`)),!t||!s)return;const n=w==null?void 0:w.find(us=>us.id===c);if(!n)return;x(n.name),m(n.lang);const E=n.slug||"",{initSlug:R,prefix:as}=V.parseSlugForEdit(E,s);r(R),C(as)},[t,c,w,s,i]),N.useEffect(()=>{if(i)m(i);else if((G==null?void 0:G.length)===1&&!t){const n=G[0];if(!n||!g.LANGUAGES[n])return;m(n),(!l||l===(s==null?void 0:s.name))&&x(`${s==null?void 0:s.name} - ${g.LANGUAGES[n]}`)}},[i,G,t,l,s]);const{parentSlug:K,isRootPage:q}=N.useMemo(()=>{if(B||!d)return{parentSlug:void 0,isRootPage:!(s!=null&&s.parent)};if(!(s!=null&&s.parent))return{parentSlug:p?`/${d}`:void 0,isRootPage:!0};const n=F==null?void 0:F.find(E=>E.lang===d);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[s==null?void 0:s.parent,F,p,d,B]),ts=N.useMemo(()=>q?!0:!!(F!=null&&F.some(n=>(n==null?void 0:n.lang)===d)),[d,F,q]),Q=()=>{let n="";return q?n=`/${p?[d,S].filter(Boolean).join("/"):S}`:n=`${V.removeSlugExtension(K)}/${S}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},os=n=>{const E=new URLSearchParams(window.location.search);j&&n===j?E.delete("lang"):E.set("lang",n),ss(E),window.dispatchEvent(new PopStateEvent("popstate"))},ls=n=>{n.preventDefault();const E={name:l,lang:d,primaryPage:s==null?void 0:s.id,slug:J?"":Q(),pageType:s==null?void 0:s.pageType,...t&&{id:c}},R=()=>{!t&&d&&(O(d),os(d)),es("outline"),a()};t?I(E,{onSuccess:R}):U(E,{onSuccess:R})};return e.jsx(f.Dialog,{open:h,onOpenChange:a,children:h&&e.jsxs(f.DialogContent,{className:"text-slate-600 sm:max-w-[425px]",children:[e.jsxs(f.DialogHeader,{children:[e.jsx(f.DialogTitle,{children:M(t?"Edit language":"Add new language page")}),e.jsx(f.DialogDescription,{className:"font-light",children:M("Enter the details for the language")})]}),e.jsx(rs,{id:c,pages:o,loading:ns,onSubmit:ls,edit:t,lang:d,languages:G,name:l,setLang:m,setName:x,primaryPageObject:s,parentHasSelectedLanguagePage:ts,isNonSlugPageType:J,isRootPage:q,useLanguagePrefix:p,setUseLanguagePrefix:C,isHomePage:B,parentSlug:K,slug:S,setSlug:r,isSlugValid:A,setIsSlugValid:v,getSlug:Q,isPending:D})]})})};exports.default=hs;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("./index-DF5DEvqb.cjs"),V=require("./slug-input-C_ijLQ_X.cjs"),g=require("./index-WQwzsC7A.cjs"),Y=require("lodash-es"),is=require("lucide-react"),N=require("react"),T=require("react-i18next"),X=({edit:c,lang:h,languages:a,name:u,setLang:t,setName:i,primaryPageObject:o})=>{const{t:s}=T.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(f.Label,{htmlFor:"lang",children:s("Language")}),e.jsxs("select",{value:c?"":h,disabled:c||!a.length,onChange:l=>{const x=l.target.value;t(x),!c&&(Y.startsWith(u,o==null?void 0:o.name)||u.length===0)&&i(`${o==null?void 0:o.name} - ${g.LANGUAGES[x]}`)},className:"col-span-3 flex h-9 w-full rounded-md border border-border bg-background 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 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("option",{value:"",disabled:!0,children:c?g.LANGUAGES[h]||h:a.length?s("Choose language"):s("All available language page is created.")}),a.map(l=>e.jsx("option",{value:l,children:g.LANGUAGES[l]||l},l))]})]})},Z=({lang:c,name:h,setName:a,parentHasSelectedLanguagePage:u})=>{const{t}=T.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(f.Label,{htmlFor:"name",children:t("Page Name")}),e.jsx(f.Input,{id:"name",value:c?h:"",onChange:i=>a(i.target.value),required:!0,placeholder:t(c?"Enter page name":"Choose language to add slug"),disabled:!u||!c})]})},ds=({dynamic:c,isNonSlugPageType:h,isRootPage:a,lang:u,useLanguagePrefix:t,setUseLanguagePrefix:i,isHomePage:o,parentSlug:s,parentHasSelectedLanguagePage:l,slug:x,setSlug:d,setIsSlugValid:m,getSlug:S})=>{const{t:r}=T.useTranslation();return h?null:e.jsxs("div",{className:"space-y-1",children:[a&&u&&e.jsxs("div",{className:"flex items-center space-x-2 pb-1",children:[e.jsx("input",{type:"checkbox",id:"useLanguagePrefix",checked:t,onChange:A=>i(A.target.checked),className:"rounded border-gray-300"}),e.jsxs(f.Label,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",e.jsxs("span",{className:"font-mono text-gray-900",children:["/",u]}),") as slug prefix"]})]}),e.jsx(f.Label,{htmlFor:"slug",children:r("Slug")}),c?e.jsx(f.Alert,{variant:"default",className:"p-2 text-xs font-medium italic text-muted-foreground",children:r("This page will use dynamic slug as defined in primary page")}):e.jsx(V.SlugInput,{disabled:!u||!l,value:x,onChange:d,placeholder:r(u?o&&t?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:s,onValidationChange:m,fullSlug:S()})]})},_=({parentHasSelectedLanguagePage:c,name:h,lang:a,slug:u,edit:t,id:i,primaryPageObject:o,pages:s,isNonSlugPageType:l,isHomePage:x,useLanguagePrefix:d,isSlugValid:m,isPending:S})=>{const{t:r}=T.useTranslation(),A=S||!h||!a||s.some(v=>(t?v.id!==i:!0)&&v.parent===(o==null?void 0:o.id)&&v.lang===a)||!l&&!(x&&d)&&(!m||!u);return e.jsx(f.DialogFooter,{children:c?e.jsxs(e.Fragment,{children:[e.jsx(f.Button,{type:"submit",disabled:A&&!o.dynamic,children:S?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"loader mr-2"}),r(t?"Updating...":"Adding...")]}):r(t?"Update":"Add new language page")}),s.some(v=>(t?v.id!==i:!0)&&v.parent===(o==null?void 0:o.id)&&v.lang===a)&&e.jsx("p",{className:"mt-2 text-xs text-red-500",children:r("A page for this language already exists.")})]}):a&&e.jsx(f.Alert,{variant:"destructive",children:e.jsxs("p",{className:"mx-auto w-5/6 text-center",children:[r("You need to create the")," ",e.jsx("span",{className:"font-medium",children:g.LANGUAGES[a]})," ",r("page in the parent to add here.")]})})})},cs=({onSubmit:c,edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s,parentHasSelectedLanguagePage:l,id:x,pages:d,isNonSlugPageType:m,isHomePage:S,useLanguagePrefix:r,slug:A,isSlugValid:v,isPending:p})=>e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(X,{edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s}),e.jsx(Z,{lang:a,name:t,setName:o,parentHasSelectedLanguagePage:l})]}),e.jsx(_,{parentHasSelectedLanguagePage:l,name:t,lang:a,slug:A,edit:h,id:x,primaryPageObject:s,pages:d,isNonSlugPageType:m,isHomePage:S,useLanguagePrefix:r,isSlugValid:v,isPending:p})]}),rs=({loading:c,onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,isNonSlugPageType:d,isRootPage:m,useLanguagePrefix:S,setUseLanguagePrefix:r,isHomePage:A,parentSlug:v,slug:p,setSlug:C,isSlugValid:U,setIsSlugValid:k,getSlug:I,isPending:$,id:D,pages:L})=>c?e.jsx("div",{className:"flex h-80 items-center justify-center",children:e.jsx(is.Loader,{className:"animate-spin"})}):d?e.jsx(cs,{onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,id:D,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:S,slug:p,isSlugValid:U,isPending:$}):e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(X,{edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l}),e.jsx(Z,{lang:u,name:i,setName:s,parentHasSelectedLanguagePage:x}),e.jsx(ds,{dynamic:l==null?void 0:l.dynamic,isNonSlugPageType:d,isRootPage:m,lang:u,useLanguagePrefix:S,setUseLanguagePrefix:r,isHomePage:A,parentSlug:v,parentHasSelectedLanguagePage:x,slug:p,setSlug:C,isSlugValid:U,setIsSlugValid:k,getSlug:I})]}),e.jsx(_,{parentHasSelectedLanguagePage:x,name:i,lang:u,slug:p,edit:a,id:D,primaryPageObject:l,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:S,isSlugValid:U,isPending:$})]}),hs=({id:c,isOpen:h,onClose:a,primaryPage:u,edit:t=!1,preselectedLang:i})=>{const{data:o=[]}=g.useWebsitePages(),s=N.useMemo(()=>o.find(n=>n.id===u),[o,u]),[l,x]=N.useState(""),[d,m]=N.useState(""),[S,r]=N.useState(""),[A,v]=N.useState(!0),[p,C]=N.useState(!0),{mutate:U,isPending:k}=g.useCreatePage(),{mutate:I,isPending:$}=g.useUpdatePage(),D=k||$,{data:L,isFetching:H}=g.useWebsiteSetting(),j=g.useFallbackLang(),{data:w,isFetching:b}=g.useLanguagePages(u),{data:F=[],isFetching:y}=g.useLanguagePages(s==null?void 0:s.parent),{data:z=[],isFetching:P}=g.usePageTypes(),{setSelectedLang:O}=f.useLanguages(),{t:M}=T.useTranslation(),[,ss]=g.useSearchParams(),[,es]=f.useSidebarActivePanel(),ns=H||b||y||P,G=N.useMemo(()=>Y.filter(L==null?void 0:L.languages,n=>!Y.find(w,{lang:n})),[L,w]),W=N.useMemo(()=>z.find(n=>n.key===(s==null?void 0:s.pageType)),[z,s==null?void 0:s.pageType]),J=!(W!=null&&W.hasSlug),B=(s==null?void 0:s.slug)==="/";N.useEffect(()=>{if(!t&&s&&i&&(m(i),x(`${s.name} - ${g.LANGUAGES[i]}`)),!t||!s)return;const n=w==null?void 0:w.find(us=>us.id===c);if(!n)return;x(n.name),m(n.lang);const E=n.slug||"",{initSlug:R,prefix:as}=V.parseSlugForEdit(E,s);r(R),C(as)},[t,c,w,s,i]),N.useEffect(()=>{if(i)m(i);else if((G==null?void 0:G.length)===1&&!t){const n=G[0];if(!n||!g.LANGUAGES[n])return;m(n),(!l||l===(s==null?void 0:s.name))&&x(`${s==null?void 0:s.name} - ${g.LANGUAGES[n]}`)}},[i,G,t,l,s]);const{parentSlug:K,isRootPage:q}=N.useMemo(()=>{if(B||!d)return{parentSlug:void 0,isRootPage:!(s!=null&&s.parent)};if(!(s!=null&&s.parent))return{parentSlug:p?`/${d}`:void 0,isRootPage:!0};const n=F==null?void 0:F.find(E=>E.lang===d);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[s==null?void 0:s.parent,F,p,d,B]),ts=N.useMemo(()=>q?!0:!!(F!=null&&F.some(n=>(n==null?void 0:n.lang)===d)),[d,F,q]),Q=()=>{let n="";return q?n=`/${p?[d,S].filter(Boolean).join("/"):S}`:n=`${V.removeSlugExtension(K)}/${S}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},os=n=>{const E=new URLSearchParams(window.location.search);j&&n===j?E.delete("lang"):E.set("lang",n),ss(E),window.dispatchEvent(new PopStateEvent("popstate"))},ls=n=>{n.preventDefault();const E={name:l,lang:d,primaryPage:s==null?void 0:s.id,slug:J?"":Q(),pageType:s==null?void 0:s.pageType,...t&&{id:c}},R=()=>{!t&&d&&(O(d),os(d)),es("outline"),a()};t?I(E,{onSuccess:R}):U(E,{onSuccess:R})};return e.jsx(f.Dialog,{open:h,onOpenChange:a,children:h&&e.jsxs(f.DialogContent,{className:"text-slate-600 sm:max-w-[425px]",children:[e.jsxs(f.DialogHeader,{children:[e.jsx(f.DialogTitle,{children:M(t?"Edit language":"Add new language page")}),e.jsx(f.DialogDescription,{className:"font-light",children:M("Enter the details for the language")})]}),e.jsx(rs,{id:c,pages:o,loading:ns,onSubmit:ls,edit:t,lang:d,languages:G,name:l,setLang:m,setName:x,primaryPageObject:s,parentHasSelectedLanguagePage:ts,isNonSlugPageType:J,isRootPage:q,useLanguagePrefix:p,setUseLanguagePrefix:C,isHomePage:B,parentSlug:K,slug:S,setSlug:r,isSlugValid:A,setIsSlugValid:v,getSlug:Q,isPending:D})]})})};exports.default=hs;
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as g, Fragment as hn } from "react/jsx-runtime";
2
- import { n as fn, o as gn, D as mn, d as xn, e as vn, f as Sn, p as pn, L as W, I as Nn, A as H, q as Fn, B as wn } from "./index-S8ibZk9Q.js";
3
- import { p as An, r as Cn, S as Dn } from "./slug-input-1qwKkXhA.js";
4
- import { g as En, h as $n, i as Ln, j as kn, k as Tn, l as Z, m as Un, c as Bn, L as A } from "./index-BDnwJqMw.js";
2
+ import { n as fn, o as gn, D as mn, d as xn, e as vn, f as Sn, p as pn, L as W, I as Nn, A as H, q as Fn, B as wn } from "./index-Ct7ElCGK.js";
3
+ import { p as An, r as Cn, S as Dn } from "./slug-input-AwNJs9im.js";
4
+ import { g as En, h as $n, i as Ln, j as kn, k as Tn, l as Z, m as Un, c as Bn, L as A } from "./index-ZuacEL1j.js";
5
5
  import { filter as In, find as Rn, startsWith as Wn } from "lodash-es";
6
6
  import { Loader as qn } from "lucide-react";
7
7
  import { useMemo as $, useState as L, useEffect as _ } from "react";
@@ -1,8 +1,8 @@
1
1
  import { jsx as o, jsxs as r } from "react/jsx-runtime";
2
- import { D as t, d as c, e as p, f as m, p as h } from "./index-S8ibZk9Q.js";
2
+ import { D as t, d as c, e as p, f as m, p as h } from "./index-Ct7ElCGK.js";
3
3
  import { Suspense as f, lazy as D } from "react";
4
4
  import { useTranslation as u } from "react-i18next";
5
- const x = D(() => import("./page-creator-wCMtlE6Z.js")), C = ({
5
+ const x = D(() => import("./page-creator-DiOITEMw.js")), C = ({
6
6
  addEditPage: e,
7
7
  setAddEditPage: s,
8
8
  closePanel: l
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-CnSjWE1P.cjs"),c=require("react"),a=require("react-i18next"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-VWIB2VAs.cjs"))),x=({addEditPage:n,setAddEditPage:r,closePanel:l})=>{const{t:o}=a.useTranslation(),t=!!(n!=null&&n.id),i=!!n;return e.jsx(s.Dialog,{open:i,onOpenChange:()=>r(void 0),children:i&&e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{children:[o(t?"Edit":"Add New")," "]}),e.jsx(s.DialogDescription,{children:o(t?"Update your page name":"Enter details to create a new page")})]}),e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"min-h-40"}),children:e.jsx(u,{closePanel:l,addEditPage:n,close:()=>r(void 0)})})]})})};exports.default=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DF5DEvqb.cjs"),c=require("react"),a=require("react-i18next"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-C4gc5NSC.cjs"))),x=({addEditPage:n,setAddEditPage:r,closePanel:l})=>{const{t:o}=a.useTranslation(),t=!!(n!=null&&n.id),i=!!n;return e.jsx(s.Dialog,{open:i,onOpenChange:()=>r(void 0),children:i&&e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{children:[o(t?"Edit":"Add New")," "]}),e.jsx(s.DialogDescription,{children:o(t?"Update your page name":"Enter details to create a new page")})]}),e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"min-h-40"}),children:e.jsx(u,{closePanel:l,addEditPage:n,close:()=>r(void 0)})})]})})};exports.default=x;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("./index-CnSjWE1P.cjs"),m=require("./index-CbwxUFy_.cjs"),N=require("lucide-react"),s=require("react"),M=require("react-i18next"),k=require("sonner"),A=require("./models-5gOsRC56.cjs"),R=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-default-lang-3tCHzab5.cjs"))),z=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-other-lang-BBHCCSen.cjs"))),B=()=>{const{t:r}=M.useTranslation(),[S,a]=s.useState(""),[t,l]=s.useState([]),[c,i]=s.useState(!1),[u,d]=s.useState(null),[p,f]=s.useState(null),[b,P]=s.useState(A.getDefaultModel().id),{selectedLang:h,fallbackLang:q}=j.useLanguages(),v=m.useBuilderFetch(),[w]=m.useSearchParams(),y=w.get("page"),C=(t==null?void 0:t.filter(n=>n.role==="user").length)>=4,L=(t==null?void 0:t.filter(n=>n.role==="user").length)>=10;s.useEffect(()=>{l([])},[h,y]);const g=()=>{l([]),a(""),f(null),d(null),i(!1)},x={t:r,fetch:v,input:S,messages:t,setInput:a,isLoading:c,handleStop:()=>{u&&(u.abort(),d(null)),i(!1),a(""),f(null),l(n=>{const o=n[n.length-1];return o&&o.role==="assistant"&&o.isReasoning&&o.isStreaming?n.slice(0,-1):n}),k.toast.info(r("Generation stopped"))},handleReset:g,setMessages:l,setIsLoading:i,currentBlock:p,fallbackLang:q,abortController:u,setCurrentBlock:f,setAbortController:d,forceNewConversation:L,suggestNewConversation:C,selectedModel:b,onModelChange:P};return e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent"}),e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-500",children:r("Your conversation will not be saved")}),(t==null?void 0:t.length)>0&&e.jsx(j.Button,{variant:"outline",size:"icon",onClick:g,className:"h-6 w-6",disabled:c,children:e.jsx(N.Plus,{})})]}),e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs",children:"Loading AI Panel"}),children:h?e.jsx(z,{...x,selectedLang:h}):e.jsx(R,{...x})})]})]})};exports.default=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("./index-DF5DEvqb.cjs"),m=require("./index-WQwzsC7A.cjs"),N=require("lucide-react"),s=require("react"),M=require("react-i18next"),k=require("sonner"),A=require("./models-5gOsRC56.cjs"),R=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-default-lang-COYaxNwn.cjs"))),z=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-other-lang-CkynNlAU.cjs"))),B=()=>{const{t:r}=M.useTranslation(),[S,a]=s.useState(""),[t,l]=s.useState([]),[c,i]=s.useState(!1),[u,d]=s.useState(null),[p,f]=s.useState(null),[b,P]=s.useState(A.getDefaultModel().id),{selectedLang:h,fallbackLang:q}=j.useLanguages(),v=m.useBuilderFetch(),[w]=m.useSearchParams(),y=w.get("page"),C=(t==null?void 0:t.filter(n=>n.role==="user").length)>=4,L=(t==null?void 0:t.filter(n=>n.role==="user").length)>=10;s.useEffect(()=>{l([])},[h,y]);const g=()=>{l([]),a(""),f(null),d(null),i(!1)},x={t:r,fetch:v,input:S,messages:t,setInput:a,isLoading:c,handleStop:()=>{u&&(u.abort(),d(null)),i(!1),a(""),f(null),l(n=>{const o=n[n.length-1];return o&&o.role==="assistant"&&o.isReasoning&&o.isStreaming?n.slice(0,-1):n}),k.toast.info(r("Generation stopped"))},handleReset:g,setMessages:l,setIsLoading:i,currentBlock:p,fallbackLang:q,abortController:u,setCurrentBlock:f,setAbortController:d,forceNewConversation:L,suggestNewConversation:C,selectedModel:b,onModelChange:P};return e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent"}),e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-500",children:r("Your conversation will not be saved")}),(t==null?void 0:t.length)>0&&e.jsx(j.Button,{variant:"outline",size:"icon",onClick:g,className:"h-6 w-6",disabled:c,children:e.jsx(N.Plus,{})})]}),e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs",children:"Loading AI Panel"}),children:h?e.jsx(z,{...x,selectedLang:h}):e.jsx(R,{...x})})]})]})};exports.default=B;
@@ -1,12 +1,12 @@
1
1
  import { jsxs as h, Fragment as k, jsx as n } from "react/jsx-runtime";
2
- import { n as y, B as A } from "./index-S8ibZk9Q.js";
3
- import { v as B, c as F } from "./index-BDnwJqMw.js";
2
+ import { n as y, B as A } from "./index-Ct7ElCGK.js";
3
+ import { v as B, c as F } from "./index-ZuacEL1j.js";
4
4
  import { Plus as z } from "lucide-react";
5
5
  import { useState as l, useEffect as I, Suspense as D, lazy as x } from "react";
6
6
  import { useTranslation as R } from "react-i18next";
7
7
  import { toast as E } from "sonner";
8
8
  import { g as G } from "./models-D95ZYr_x.js";
9
- const O = x(() => import("./ai-panel-default-lang-oVk4TDeb.js")), T = x(() => import("./ai-panel-other-lang-DmQ3QMDD.js")), X = () => {
9
+ const O = x(() => import("./ai-panel-default-lang-DnElspF0.js")), T = x(() => import("./ai-panel-other-lang-Dp0E9_Hx.js")), X = () => {
10
10
  const { t: r } = R(), [b, a] = l(""), [e, s] = l([]), [c, i] = l(!1), [f, u] = l(null), [w, d] = l(null), [C, L] = l(G().id), { selectedLang: m, fallbackLang: N } = y(), P = B(), [v] = F(), S = v.get("page"), M = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 4, j = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 10;
11
11
  I(() => {
12
12
  s([]);
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),v=require("./index-CnSjWE1P.cjs"),S=require("./selected-block-display-DSFhddPj.cjs"),P=require("lucide-react"),j=require("react"),O=require("sonner"),W=require("./models-5gOsRC56.cjs"),F=require("lodash-es"),q=require("./apply-binding-KKp5PnpZ.cjs"),$=require("@tanstack/react-query"),_=(a,k)=>{const h=a.filter(p=>p._parent===k),I=h.map(p=>p._id),A=h.flatMap(p=>_(a,p._id));return[...I,...A]},V=(a,k,h)=>{const I=F.find(a,{_id:k});if(!I)return a;const A=a.findIndex(g=>g._id===k),p=_(a,k),C=new Set([k,...p]),u=a.filter(g=>!C.has(g._id)),w=new Set(h.map(g=>g._id)),R=h.map(g=>!g._parent||!w.has(g._parent)?{...g,_parent:I._parent}:g);return[...u.slice(0,A),...R,...u.slice(A)]},K=()=>{const[,a]=v.useSelectedBlockIds(),{setNewBlocks:k}=v.useBlocksStoreUndoableActions(),{hasPermission:h}=v.usePermissions();return j.useCallback((I,A)=>{if(!h(v.PERMISSIONS.EDIT_BLOCK))return;const p=v.builderStore.get(v.presentBlocksAtom),C=I?V(p,I,A):A;k(C),A.length>0&&setTimeout(()=>a([A[0]._id]),200)},[a,k,h])},U=()=>{const{addPredefinedBlock:a}=v.useAddBlock(),k=K(),h=v.useRemoveBlocks(),I=$.useQueryClient(),A=async(s,e)=>{if(!e)return;const r=q.getBlocksFromHTML(e);await a(r,s.parentId,s.position)},p=async(s,e)=>{if(!s.blockId||!e)return;const r=q.getBlocksFromHTML(e);await k(s.blockId,r)},C=async s=>{!s.ids||s.ids.length===0||await h(s.ids)};let u=null;const w=(s,e)=>{const r=document.getElementById("canvas-iframe");if(!r)return null;const d=r==null?void 0:r.contentDocument;if(!d)return null;d.querySelectorAll("[data-stream-canvas]").forEach(m=>m.remove());let n=null;if(s&&s!=="undefined"&&(n=d.querySelector(`[data-block-id="${s}"]`)),n||(n=d.body),!n)return null;if(u=d.createElement("div"),u.setAttribute("data-stream-canvas","true"),e!==void 0&&e>=0&&n.children){const m=Math.min(e,n.children.length);m<n.children.length?n.insertBefore(u,n.children[m]):n.appendChild(u)}else n.appendChild(u);return u},R=s=>{var n;const e=document.getElementById("canvas-iframe");if(!e)return null;const r=e==null?void 0:e.contentDocument;if(!r)return null;r.querySelectorAll("[data-stream-canvas]").forEach(m=>m.remove());const f=r.querySelector(`[data-block-id="${s}"]`);return f?(u=r.createElement("div"),u.setAttribute("data-stream-canvas","true"),(n=f.parentNode)==null||n.insertBefore(u,f.nextSibling),f.style.display="none",u):null},M=(s,e,r)=>{const d=w(e,r);if(d){d.innerHTML=s;const f=d.getBoundingClientRect(),n=document.getElementById("canvas-iframe"),m=n==null?void 0:n.contentWindow;m&&(f.top>=0&&f.bottom<=m.innerHeight||d.scrollIntoView({behavior:"smooth",block:"nearest"}))}},g=(s,e)=>{const r=R(e);r&&(r.innerHTML=s)},D=s=>{const e=s.match(/^--ACTION=(.+)--$/);if(!e)return null;let d=e[1].replace(/--/g,"").split("|");const n={type:d[0]};return d.forEach(m=>{const t=m.trim();if(t.startsWith("PARENT=")){const T=t.substring(7);n.parentId=T==="undefined"?void 0:T}else t.startsWith("POS=")?n.position=parseInt(t.substring(4)):t.startsWith("ID=")?n.blockId=t.substring(3):t.startsWith("IDS=")&&(n.ids=t.substring(4).split(",").map(T=>T.trim()))}),n};return j.useCallback(async(s,e)=>{const r=new TextDecoder;let d="",f="",n=!1,m=null;const t={isInAction:!1,currentAction:null,htmlBuffer:"",isCapturingHtml:!1},T=async y=>{const o=y.trim();if(o==="--START--"){n=!0;return}if(n){if(o==="--END--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),u&&(u.remove(),u=null);return}if(o.startsWith("--THINKING=")){const i=o.substring(11);e(l=>{const B=[...l],x=B[B.length-1];if(x&&x.role==="assistant"&&x.isReasoning)x.content=i,x.isStreaming=!1;else{const b={id:Date.now().toString(),role:"assistant",content:i,isReasoning:!0,isStreaming:!1};B.push(b)}return B});return}if(o.startsWith("--TASK=")){const i=o.substring(7),l=`task-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,B={id:l,role:"assistant",content:i.replace(/--$/,""),isTask:!0,isTaskLoading:!0,isTaskCompleted:!1};m=l,e(x=>[...x,B]);return}if(o.startsWith("--MSG=")){const i=o.substring(6),l={id:Date.now().toString(),role:"assistant",content:i.replace(/--$/g,""),isReasoning:!1,isStreaming:!1};e(B=>[...B,l]);return}if(o.startsWith("--ACTION=")){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),t.currentAction=D(o),t.htmlBuffer="",t.isInAction=!0;return}if(o==="--ENDACTION--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),m&&(e(i=>i.map(l=>l.isTask?{...l,isTaskCompleted:!0}:l)),m=null),t.currentAction=null,t.htmlBuffer="",t.isInAction=!1;return}if(o==="--HTML--"){t.isCapturingHtml=!0;return}if(o==="--ENDHTML--"){t.isCapturingHtml=!1;return}if(o.startsWith("--HTML--")&&o.includes("--ENDHTML--")){const i=o.match(/^--HTML--(.+?)--ENDHTML--$/);if(i&&t.currentAction){const l=i[1];t.htmlBuffer+=l,t.currentAction.type==="ADD"?M(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&g(t.htmlBuffer,t.currentAction.blockId)}return}t.isCapturingHtml&&t.currentAction&&(t.htmlBuffer+=y+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),v=require("./index-DF5DEvqb.cjs"),S=require("./selected-block-display-BgRY82CT.cjs"),P=require("lucide-react"),j=require("react"),O=require("sonner"),W=require("./models-5gOsRC56.cjs"),F=require("lodash-es"),q=require("./apply-binding-KKp5PnpZ.cjs"),$=require("@tanstack/react-query"),_=(a,k)=>{const h=a.filter(p=>p._parent===k),I=h.map(p=>p._id),A=h.flatMap(p=>_(a,p._id));return[...I,...A]},V=(a,k,h)=>{const I=F.find(a,{_id:k});if(!I)return a;const A=a.findIndex(g=>g._id===k),p=_(a,k),C=new Set([k,...p]),u=a.filter(g=>!C.has(g._id)),w=new Set(h.map(g=>g._id)),R=h.map(g=>!g._parent||!w.has(g._parent)?{...g,_parent:I._parent}:g);return[...u.slice(0,A),...R,...u.slice(A)]},K=()=>{const[,a]=v.useSelectedBlockIds(),{setNewBlocks:k}=v.useBlocksStoreUndoableActions(),{hasPermission:h}=v.usePermissions();return j.useCallback((I,A)=>{if(!h(v.PERMISSIONS.EDIT_BLOCK))return;const p=v.builderStore.get(v.presentBlocksAtom),C=I?V(p,I,A):A;k(C),A.length>0&&setTimeout(()=>a([A[0]._id]),200)},[a,k,h])},U=()=>{const{addPredefinedBlock:a}=v.useAddBlock(),k=K(),h=v.useRemoveBlocks(),I=$.useQueryClient(),A=async(s,e)=>{if(!e)return;const r=q.getBlocksFromHTML(e);await a(r,s.parentId,s.position)},p=async(s,e)=>{if(!s.blockId||!e)return;const r=q.getBlocksFromHTML(e);await k(s.blockId,r)},C=async s=>{!s.ids||s.ids.length===0||await h(s.ids)};let u=null;const w=(s,e)=>{const r=document.getElementById("canvas-iframe");if(!r)return null;const d=r==null?void 0:r.contentDocument;if(!d)return null;d.querySelectorAll("[data-stream-canvas]").forEach(m=>m.remove());let n=null;if(s&&s!=="undefined"&&(n=d.querySelector(`[data-block-id="${s}"]`)),n||(n=d.body),!n)return null;if(u=d.createElement("div"),u.setAttribute("data-stream-canvas","true"),e!==void 0&&e>=0&&n.children){const m=Math.min(e,n.children.length);m<n.children.length?n.insertBefore(u,n.children[m]):n.appendChild(u)}else n.appendChild(u);return u},R=s=>{var n;const e=document.getElementById("canvas-iframe");if(!e)return null;const r=e==null?void 0:e.contentDocument;if(!r)return null;r.querySelectorAll("[data-stream-canvas]").forEach(m=>m.remove());const f=r.querySelector(`[data-block-id="${s}"]`);return f?(u=r.createElement("div"),u.setAttribute("data-stream-canvas","true"),(n=f.parentNode)==null||n.insertBefore(u,f.nextSibling),f.style.display="none",u):null},M=(s,e,r)=>{const d=w(e,r);if(d){d.innerHTML=s;const f=d.getBoundingClientRect(),n=document.getElementById("canvas-iframe"),m=n==null?void 0:n.contentWindow;m&&(f.top>=0&&f.bottom<=m.innerHeight||d.scrollIntoView({behavior:"smooth",block:"nearest"}))}},g=(s,e)=>{const r=R(e);r&&(r.innerHTML=s)},D=s=>{const e=s.match(/^--ACTION=(.+)--$/);if(!e)return null;let d=e[1].replace(/--/g,"").split("|");const n={type:d[0]};return d.forEach(m=>{const t=m.trim();if(t.startsWith("PARENT=")){const T=t.substring(7);n.parentId=T==="undefined"?void 0:T}else t.startsWith("POS=")?n.position=parseInt(t.substring(4)):t.startsWith("ID=")?n.blockId=t.substring(3):t.startsWith("IDS=")&&(n.ids=t.substring(4).split(",").map(T=>T.trim()))}),n};return j.useCallback(async(s,e)=>{const r=new TextDecoder;let d="",f="",n=!1,m=null;const t={isInAction:!1,currentAction:null,htmlBuffer:"",isCapturingHtml:!1},T=async y=>{const o=y.trim();if(o==="--START--"){n=!0;return}if(n){if(o==="--END--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),u&&(u.remove(),u=null);return}if(o.startsWith("--THINKING=")){const i=o.substring(11);e(l=>{const B=[...l],x=B[B.length-1];if(x&&x.role==="assistant"&&x.isReasoning)x.content=i,x.isStreaming=!1;else{const b={id:Date.now().toString(),role:"assistant",content:i,isReasoning:!0,isStreaming:!1};B.push(b)}return B});return}if(o.startsWith("--TASK=")){const i=o.substring(7),l=`task-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,B={id:l,role:"assistant",content:i.replace(/--$/,""),isTask:!0,isTaskLoading:!0,isTaskCompleted:!1};m=l,e(x=>[...x,B]);return}if(o.startsWith("--MSG=")){const i=o.substring(6),l={id:Date.now().toString(),role:"assistant",content:i.replace(/--$/g,""),isReasoning:!1,isStreaming:!1};e(B=>[...B,l]);return}if(o.startsWith("--ACTION=")){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),t.currentAction=D(o),t.htmlBuffer="",t.isInAction=!0;return}if(o==="--ENDACTION--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),m&&(e(i=>i.map(l=>l.isTask?{...l,isTaskCompleted:!0}:l)),m=null),t.currentAction=null,t.htmlBuffer="",t.isInAction=!1;return}if(o==="--HTML--"){t.isCapturingHtml=!0;return}if(o==="--ENDHTML--"){t.isCapturingHtml=!1;return}if(o.startsWith("--HTML--")&&o.includes("--ENDHTML--")){const i=o.match(/^--HTML--(.+?)--ENDHTML--$/);if(i&&t.currentAction){const l=i[1];t.htmlBuffer+=l,t.currentAction.type==="ADD"?M(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&g(t.htmlBuffer,t.currentAction.blockId)}return}t.isCapturingHtml&&t.currentAction&&(t.htmlBuffer+=y+`
2
2
  `,t.currentAction.type==="ADD"?M(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&g(t.htmlBuffer,t.currentAction.blockId))}},E=async(y,o)=>{try{switch(y.type){case"ADD":await A(y,o);break;case"EDIT":await p(y,o);break;case"REMOVE":await C(y);break}e(i=>i.filter(l=>!l.isTask))}catch(i){console.log(i)}};try{for(;;){const{done:y,value:o}=await s.read();if(y)break;const i=r.decode(o,{stream:!0});d+=i,f+=i;const l=f.split(`
3
- `);f=l.pop()||"";for(const B of l)await T(B)}f&&await T(f),I.invalidateQueries({queryKey:["AI_USAGE"]})}catch(y){console.log(y)}},[h])},G=j.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-b5ty81RB.cjs"))),Q=({t:a,fetch:k,input:h,messages:I,setInput:A,isLoading:p,setMessages:C,handleStop:u,setIsLoading:w,currentBlock:R,fallbackLang:M,setCurrentBlock:g,setAbortController:D,selectedModel:s=W.getDefaultModel().id,onModelChange:e})=>{const r=v.useSelectedBlock(),[,d]=v.useSelectedBlockIds(),f=v.useBlocksHtmlForAi(),n=U(),m=async(t,T,E,y)=>{var x;if(!t||p)return;g(r);const o=f(r?{blockId:r._id,additionalCoreBlocks:["Icon"]}:{additionalCoreBlocks:["Icon"]});if(r&&!o){O.toast.error(a("Something went wrong. Please try again."));return}const i={id:Date.now().toString(),role:"user",content:S.getUserPrompt({language:M,userInput:T||t,currentHtml:o}),userMessage:t},l={id:(Date.now()+1).toString(),role:"assistant",content:"",isReasoning:!0,isStreaming:!0};C(b=>[...b,i,l]),w(!0);const B=new AbortController;D(B);try{const b={messages:[i].map(L=>({role:L.role,content:L.content})),model:y||s};E&&(b.image=E);const N=await k({body:{action:"ASK_AI",data:b},streamResponse:!0});if(!N.ok)throw new Error(a("Failed to get AI response"));const H=(x=N.body)==null?void 0:x.getReader();if(!H)throw new Error(a("Response body is not readable"));await n(H,C)}catch(b){if(b.name!=="AbortError"){const N={id:(Date.now()+1).toString(),role:"assistant",content:a("Sorry, I encountered an error. Please try again.")};C(H=>[...H,N])}}finally{A(""),w(!1),g(null),D(null)}};return c.jsxs(c.Fragment,{children:[c.jsxs(S.Conversation,{className:"no-scrollbar",children:[c.jsxs(S.ConversationContent,{className:"gap-2 px-0",children:[I.length===0&&c.jsx(S.ConversationEmptyState,{icon:c.jsx(P.Bot,{size:48,className:"text-gray-300"}),title:"Start a conversation",description:a("Start a conversation with the AI assistant to add/edit current page")}),I.map(t=>t.role!=="system"&&c.jsx(j.Fragment,{children:t.isReasoning?c.jsxs(S.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[c.jsx(S.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),c.jsx(S.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask&&!t.isTaskCompleted?c.jsx(S.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):c.jsx(S.Message,{from:t.role,children:c.jsx(S.MessageContent,{className:"p-0",children:t.role==="assistant"?c.jsx(S.MessageResponse,{className:"p-0 text-xs",children:t.content}):c.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]}),c.jsx(S.ConversationScrollButton,{})]}),c.jsxs("div",{className:"border-gray-200 pb-2",children:[c.jsx(S.SelectedBlockDisplay,{onRemove:()=>d([]),isLoading:p}),c.jsx(j.Suspense,{fallback:c.jsx("div",{children:"Loading..."}),children:c.jsx(G,{input:h,setInput:A,onSend:m,onStop:u,isLoading:p,selectedLang:"",currentBlock:r||R,disabled:(h==null?void 0:h.length)===0,selectedModel:s,onModelChange:e})})]})]})};exports.default=Q;
3
+ `);f=l.pop()||"";for(const B of l)await T(B)}f&&await T(f),I.invalidateQueries({queryKey:["AI_USAGE"]})}catch(y){console.log(y)}},[h])},G=j.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-CThbVp0_.cjs"))),Q=({t:a,fetch:k,input:h,messages:I,setInput:A,isLoading:p,setMessages:C,handleStop:u,setIsLoading:w,currentBlock:R,fallbackLang:M,setCurrentBlock:g,setAbortController:D,selectedModel:s=W.getDefaultModel().id,onModelChange:e})=>{const r=v.useSelectedBlock(),[,d]=v.useSelectedBlockIds(),f=v.useBlocksHtmlForAi(),n=U(),m=async(t,T,E,y)=>{var x;if(!t||p)return;g(r);const o=f(r?{blockId:r._id,additionalCoreBlocks:["Icon"]}:{additionalCoreBlocks:["Icon"]});if(r&&!o){O.toast.error(a("Something went wrong. Please try again."));return}const i={id:Date.now().toString(),role:"user",content:S.getUserPrompt({language:M,userInput:T||t,currentHtml:o}),userMessage:t},l={id:(Date.now()+1).toString(),role:"assistant",content:"",isReasoning:!0,isStreaming:!0};C(b=>[...b,i,l]),w(!0);const B=new AbortController;D(B);try{const b={messages:[i].map(L=>({role:L.role,content:L.content})),model:y||s};E&&(b.image=E);const N=await k({body:{action:"ASK_AI",data:b},streamResponse:!0});if(!N.ok)throw new Error(a("Failed to get AI response"));const H=(x=N.body)==null?void 0:x.getReader();if(!H)throw new Error(a("Response body is not readable"));await n(H,C)}catch(b){if(b.name!=="AbortError"){const N={id:(Date.now()+1).toString(),role:"assistant",content:a("Sorry, I encountered an error. Please try again.")};C(H=>[...H,N])}}finally{A(""),w(!1),g(null),D(null)}};return c.jsxs(c.Fragment,{children:[c.jsxs(S.Conversation,{className:"no-scrollbar",children:[c.jsxs(S.ConversationContent,{className:"gap-2 px-0",children:[I.length===0&&c.jsx(S.ConversationEmptyState,{icon:c.jsx(P.Bot,{size:48,className:"text-gray-300"}),title:"Start a conversation",description:a("Start a conversation with the AI assistant to add/edit current page")}),I.map(t=>t.role!=="system"&&c.jsx(j.Fragment,{children:t.isReasoning?c.jsxs(S.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[c.jsx(S.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),c.jsx(S.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask&&!t.isTaskCompleted?c.jsx(S.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):c.jsx(S.Message,{from:t.role,children:c.jsx(S.MessageContent,{className:"p-0",children:t.role==="assistant"?c.jsx(S.MessageResponse,{className:"p-0 text-xs",children:t.content}):c.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]}),c.jsx(S.ConversationScrollButton,{})]}),c.jsxs("div",{className:"border-gray-200 pb-2",children:[c.jsx(S.SelectedBlockDisplay,{onRemove:()=>d([]),isLoading:p}),c.jsx(j.Suspense,{fallback:c.jsx("div",{children:"Loading..."}),children:c.jsx(G,{input:h,setInput:A,onSend:m,onStop:u,isLoading:p,selectedLang:"",currentBlock:r||R,disabled:(h==null?void 0:h.length)===0,selectedModel:s,onModelChange:e})})]})]})};exports.default=Q;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as D, Fragment as W, jsx as g } from "react/jsx-runtime";
2
- import { a as _, al as F, am as $, an as q, ao as V, ap as K, aq as U, ar as j, as as G, at as z } from "./index-S8ibZk9Q.js";
3
- import { C as Q, a as J, b as X, R as Y, c as Z, d as tt, T as et, M as nt, e as rt, f as st, g as ot, S as at, h as it } from "./selected-block-display-CU3TwIMA.js";
2
+ import { a as _, al as F, am as $, an as q, ao as V, ap as K, aq as U, ar as j, as as G, at as z } from "./index-Ct7ElCGK.js";
3
+ import { C as Q, a as J, b as X, R as Y, c as Z, d as tt, T as et, M as nt, e as rt, f as st, g as ot, S as at, h as it } from "./selected-block-display-CBFePS19.js";
4
4
  import { Bot as ct } from "lucide-react";
5
5
  import { useCallback as P, Fragment as lt, Suspense as ut, lazy as dt } from "react";
6
6
  import { toast as ft } from "sonner";
@@ -223,7 +223,7 @@ const O = (i, I) => {
223
223
  },
224
224
  [m]
225
225
  );
226
- }, St = dt(() => import("./ai-prompt-input-DaTyfib-.js")), Mt = ({
226
+ }, St = dt(() => import("./ai-prompt-input-Bhc0ds7X.js")), Mt = ({
227
227
  t: i,
228
228
  fetch: I,
229
229
  input: m,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./index-CnSjWE1P.cjs"),f=require("lodash-es"),l=require("react"),G=require("./core-BoRDjj4h.cjs"),c=require("./selected-block-display-DSFhddPj.cjs"),H=require("lucide-react"),Q=require("react-i18next"),X=require("./models-5gOsRC56.cjs"),C=(s,o)=>{const r=s.filter(n=>n._parent===o),i=r.flatMap(n=>C(s,n._id));return[...r,...i]},Y=(s,o)=>{const r=o.find(n=>n._id===s);if(!r)return[];const i=C(o,s);return[r,...i]},Z=()=>{const s=p.useSelectedBlock(),[o]=p.useBlocksStore();return l.useCallback((r="")=>{const i=s!=null&&s._id?Y(s._id,o):o;return i?f.compact(i.map(n=>{const h=G.getRegisteredChaiBlock(n._type);if(!h)return null;const x=(h==null?void 0:h.i18nProps)??[];if(x.length===0)return null;const g=r==="ALL"?Object.keys(n).filter(a=>x.find(S=>a.startsWith(S))):x.map(a=>r?`${a}-${r}`:a),d=f.pick(n,["_id"]);return f.each(g,a=>{d[a]=f.get(n,a,f.get(n,a.replace(`-${r}`,"")))}),d})):[]},[s==null?void 0:s._id,o])},ee=l.lazy(()=>Promise.resolve().then(()=>require("./ai-translation-prompt-c0Q3zkT2.cjs"))),te=l.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-b5ty81RB.cjs"))),ne=({fetch:s,input:o,messages:r,setInput:i,isLoading:n,handleStop:h,setMessages:x,setIsLoading:g,selectedLang:d,currentBlock:a,fallbackLang:S,abortController:k,setAbortController:E,setCurrentBlock:T,selectedModel:B=X.getDefaultModel().id,onModelChange:M})=>{const{t:u}=Q.useTranslation(),O=l.useRef(null),y=p.useSelectedBlock(),[,D]=p.useSelectedBlockIds(),R=Z(),I=p.useStreamMultipleBlocksProps(),F=()=>{var t;(t=O.current)==null||t.scrollIntoView({behavior:"smooth"})};l.useEffect(()=>{F()},[r,n]);const N=async(t,w,$)=>{var P;y&&T(y);const q=(t==null?void 0:t.toLowerCase())==="translate",v={id:Date.now().toString(),role:"user",content:c.getTranslationUserPrompt({fallbackLang:S,userInput:w||t,language:d,blocks:q?R():R(d)}),userMessage:w||t||u("Translate the content")},z={id:(Date.now()+1).toString(),role:"assistant",content:"Thinking...",isReasoning:!0,isStreaming:!0};g(!0);const W=new AbortController;E(W),x(b=>[...b,v,z]),g(!0);try{const A=await s({body:{action:"ASK_AI",data:{messages:[v],initiator:q?"TRANSLATE_CONTENT":"UPDATE_CONTENT",model:$||B}},streamResponse:!0});if(!A.ok)throw new Error(u("Failed to get AI response"));const _=(P=A.body)==null?void 0:P.getReader(),U=new TextDecoder;let j="";if(!_)throw new Error(u("Response body is not readable"));for(;;){const{done:K,value:L}=await _.read();if(K)break;const V=U.decode(L,{stream:!0});j+=V,x(m=>(m[m.length-1].content=j,[...m]))}const J=JSON.parse(j==null?void 0:j.replace("```json","").replace("```",""));I(J)}catch{k==null||k.abort()}finally{g(!1),i(""),T(null)}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(l.Suspense,{fallback:e.jsx("div",{children:u("Loading...")}),children:e.jsx(ee,{isLoading:n,selectedBlock:y,selectedLang:d,onClick:N})})}),e.jsx(c.Conversation,{children:e.jsxs(c.ConversationContent,{className:"gap-4 px-0",children:[r.length===0&&e.jsx(c.ConversationEmptyState,{icon:e.jsx(H.Bot,{size:48,className:"text-gray-300"}),title:u("Start a conversation with the AI assistant to translate/edit your content"),description:u("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")}),r.map(t=>t.role!=="system"&&e.jsx(l.Fragment,{children:t.isReasoning?e.jsxs(c.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[e.jsx(c.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),e.jsx(c.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask?e.jsx(c.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):e.jsx(c.Message,{from:t.role,children:e.jsx(c.MessageContent,{className:"p-0",children:t.role==="assistant"?e.jsx(c.MessageResponse,{className:"p-0 text-xs",children:t.content}):e.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]})}),e.jsxs("div",{className:"border-gray-200 pb-2",children:[e.jsx(c.SelectedBlockDisplay,{onRemove:()=>D([]),isLoading:n}),e.jsx(l.Suspense,{fallback:e.jsx("div",{children:u("Loading...")}),children:e.jsx(te,{input:o,setInput:i,onSend:N,onStop:h,isLoading:n,selectedLang:d,currentBlock:y||a,disabled:(o==null?void 0:o.length)===0,selectedModel:B,onModelChange:M})})]})]})};exports.default=ne;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./index-DF5DEvqb.cjs"),f=require("lodash-es"),l=require("react"),G=require("./core-BoRDjj4h.cjs"),c=require("./selected-block-display-BgRY82CT.cjs"),H=require("lucide-react"),Q=require("react-i18next"),X=require("./models-5gOsRC56.cjs"),C=(s,o)=>{const r=s.filter(n=>n._parent===o),i=r.flatMap(n=>C(s,n._id));return[...r,...i]},Y=(s,o)=>{const r=o.find(n=>n._id===s);if(!r)return[];const i=C(o,s);return[r,...i]},Z=()=>{const s=p.useSelectedBlock(),[o]=p.useBlocksStore();return l.useCallback((r="")=>{const i=s!=null&&s._id?Y(s._id,o):o;return i?f.compact(i.map(n=>{const h=G.getRegisteredChaiBlock(n._type);if(!h)return null;const x=(h==null?void 0:h.i18nProps)??[];if(x.length===0)return null;const g=r==="ALL"?Object.keys(n).filter(a=>x.find(S=>a.startsWith(S))):x.map(a=>r?`${a}-${r}`:a),d=f.pick(n,["_id"]);return f.each(g,a=>{d[a]=f.get(n,a,f.get(n,a.replace(`-${r}`,"")))}),d})):[]},[s==null?void 0:s._id,o])},ee=l.lazy(()=>Promise.resolve().then(()=>require("./ai-translation-prompt-C2kJQFDX.cjs"))),te=l.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-CThbVp0_.cjs"))),ne=({fetch:s,input:o,messages:r,setInput:i,isLoading:n,handleStop:h,setMessages:x,setIsLoading:g,selectedLang:d,currentBlock:a,fallbackLang:S,abortController:k,setAbortController:E,setCurrentBlock:T,selectedModel:B=X.getDefaultModel().id,onModelChange:M})=>{const{t:u}=Q.useTranslation(),O=l.useRef(null),y=p.useSelectedBlock(),[,D]=p.useSelectedBlockIds(),R=Z(),I=p.useStreamMultipleBlocksProps(),F=()=>{var t;(t=O.current)==null||t.scrollIntoView({behavior:"smooth"})};l.useEffect(()=>{F()},[r,n]);const N=async(t,w,$)=>{var P;y&&T(y);const q=(t==null?void 0:t.toLowerCase())==="translate",v={id:Date.now().toString(),role:"user",content:c.getTranslationUserPrompt({fallbackLang:S,userInput:w||t,language:d,blocks:q?R():R(d)}),userMessage:w||t||u("Translate the content")},z={id:(Date.now()+1).toString(),role:"assistant",content:"Thinking...",isReasoning:!0,isStreaming:!0};g(!0);const W=new AbortController;E(W),x(b=>[...b,v,z]),g(!0);try{const A=await s({body:{action:"ASK_AI",data:{messages:[v],initiator:q?"TRANSLATE_CONTENT":"UPDATE_CONTENT",model:$||B}},streamResponse:!0});if(!A.ok)throw new Error(u("Failed to get AI response"));const _=(P=A.body)==null?void 0:P.getReader(),U=new TextDecoder;let j="";if(!_)throw new Error(u("Response body is not readable"));for(;;){const{done:K,value:L}=await _.read();if(K)break;const V=U.decode(L,{stream:!0});j+=V,x(m=>(m[m.length-1].content=j,[...m]))}const J=JSON.parse(j==null?void 0:j.replace("```json","").replace("```",""));I(J)}catch{k==null||k.abort()}finally{g(!1),i(""),T(null)}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(l.Suspense,{fallback:e.jsx("div",{children:u("Loading...")}),children:e.jsx(ee,{isLoading:n,selectedBlock:y,selectedLang:d,onClick:N})})}),e.jsx(c.Conversation,{children:e.jsxs(c.ConversationContent,{className:"gap-4 px-0",children:[r.length===0&&e.jsx(c.ConversationEmptyState,{icon:e.jsx(H.Bot,{size:48,className:"text-gray-300"}),title:u("Start a conversation with the AI assistant to translate/edit your content"),description:u("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")}),r.map(t=>t.role!=="system"&&e.jsx(l.Fragment,{children:t.isReasoning?e.jsxs(c.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[e.jsx(c.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),e.jsx(c.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask?e.jsx(c.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):e.jsx(c.Message,{from:t.role,children:e.jsx(c.MessageContent,{className:"p-0",children:t.role==="assistant"?e.jsx(c.MessageResponse,{className:"p-0 text-xs",children:t.content}):e.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]})}),e.jsxs("div",{className:"border-gray-200 pb-2",children:[e.jsx(c.SelectedBlockDisplay,{onRemove:()=>D([]),isLoading:n}),e.jsx(l.Suspense,{fallback:e.jsx("div",{children:u("Loading...")}),children:e.jsx(te,{input:o,setInput:i,onSend:N,onStop:h,isLoading:n,selectedLang:d,currentBlock:y||a,disabled:(o==null?void 0:o.length)===0,selectedModel:B,onModelChange:M})})]})]})};exports.default=ne;
@@ -1,9 +1,9 @@
1
1
  import { jsxs as p, Fragment as H, jsx as t } from "react/jsx-runtime";
2
- import { as as P, ah as Q, a as X, au as Y } from "./index-S8ibZk9Q.js";
2
+ import { as as P, ah as Q, a as X, au as Y } from "./index-Ct7ElCGK.js";
3
3
  import { compact as Z, pick as ee, each as te, get as v } from "lodash-es";
4
4
  import { useCallback as ne, useRef as se, useEffect as oe, Suspense as M, lazy as E, Fragment as re } from "react";
5
5
  import { e as ae } from "./core-yvI6kCyw.js";
6
- import { C as ie, a as ce, b as le, R as de, c as ue, d as he, T as me, M as fe, e as pe, f as ge, S as ye, i as Se } from "./selected-block-display-CU3TwIMA.js";
6
+ import { C as ie, a as ce, b as le, R as de, c as ue, d as he, T as me, M as fe, e as pe, f as ge, S as ye, i as Se } from "./selected-block-display-CBFePS19.js";
7
7
  import { Bot as Te } from "lucide-react";
8
8
  import { useTranslation as ke } from "react-i18next";
9
9
  import { g as Ne } from "./models-D95ZYr_x.js";
@@ -35,7 +35,7 @@ const O = (s, r) => {
35
35
  },
36
36
  [s == null ? void 0 : s._id, r]
37
37
  );
38
- }, Re = E(() => import("./ai-translation-prompt-DJPe2O-n.js")), xe = E(() => import("./ai-prompt-input-DaTyfib-.js")), De = ({
38
+ }, Re = E(() => import("./ai-translation-prompt-CZ55HQmo.js")), xe = E(() => import("./ai-prompt-input-Bhc0ds7X.js")), De = ({
39
39
  fetch: s,
40
40
  input: r,
41
41
  messages: o,
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as w, Fragment as ie } from "react/jsx-runtime";
2
- import { ag as N, T as le, B as V, aA as ce, r as ue, s as de, t as pe, v as me, aB as fe, aC as he, D as ge, aD as ve, d as be, f as xe, C as we, i as Ne, j as Ie, l as ye, m as Se } from "./index-S8ibZk9Q.js";
2
+ import { ag as N, T as le, B as V, aA as ce, r as ue, s as de, t as pe, v as me, aB as fe, aC as he, D as ge, aD as ve, d as be, f as xe, C as we, i as Ne, j as Ie, l as ye, m as Se } from "./index-Ct7ElCGK.js";
3
3
  import { PaperclipIcon as ke, XIcon as Y, PlusIcon as De, ImageIcon as ze, MicIcon as Pe, CornerDownLeftIcon as Te, Loader2Icon as Ae, SquareIcon as Ce, Cpu as Le, Paperclip as Re, GlobeIcon as Me, Square as je, Send as Ue } from "lucide-react";
4
4
  import { nanoid as Oe } from "nanoid";
5
5
  import { useContext as W, useRef as M, useEffect as A, useState as P, useCallback as F, useMemo as Fe, createContext as E, Fragment as Ge, Children as Be } from "react";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./index-CnSjWE1P.cjs"),y=require("lucide-react"),ee=require("nanoid"),l=require("react"),_=require("class-variance-authority"),te=require("react-i18next"),L=require("./models-5gOsRC56.cjs");function se({className:t,...s}){return e.jsx("div",{"data-slot":"input-group",role:"group",className:o.cn("group/input-group shadow-xs relative flex w-full items-center rounded-md border border-input outline-none transition-[color,box-shadow] dark:bg-input/30","h-9 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",t),...s})}const ne=_.cva("text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]","block-start":"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5","block-end":"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function W({className:t,align:s="inline-start",...i}){return e.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":s,className:o.cn(ne({align:s}),t),onClick:u=>{var c,f;u.target.closest("button")||(f=(c=u.currentTarget.parentElement)==null?void 0:c.querySelector("input"))==null||f.focus()},...i})}const re=_.cva("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function H({className:t,type:s="button",variant:i="ghost",size:u="xs",...c}){return e.jsx(o.Button,{type:s,"data-size":u,variant:i,className:o.cn(re({size:u}),t),...c})}function ae({className:t,...s}){return e.jsx(o.Textarea,{"data-slot":"input-group-control",className:o.cn("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",t),...s})}const oe=l.createContext(null),ie=l.createContext(null),K=()=>l.useContext(oe),ce=()=>l.useContext(ie),X=l.createContext(null),O=()=>{const t=ce(),s=l.useContext(X),i=t??s;if(!i)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return i};function le({data:t,className:s,...i}){var x;const u=O(),c=t.filename||"",p=((x=t.mediaType)!=null&&x.startsWith("image/")&&t.url?"image":"file")==="image",v=c||(p?"Image":"Attachment");return e.jsxs(Ne,{children:[e.jsx(o.HoverCardTrigger,{asChild:!0,children:e.jsxs("div",{className:o.cn("group relative flex h-8 cursor-default select-none items-center gap-1.5 rounded-md border border-border px-1.5 text-sm font-medium transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",s),...i,children:[e.jsxs("div",{className:"relative size-5 shrink-0",children:[e.jsx("div",{className:"absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0",children:p?e.jsx("img",{alt:c||"attachment",className:"size-5 object-cover",height:20,src:t.url,width:20}):e.jsx("div",{className:"flex size-5 items-center justify-center text-muted-foreground",children:e.jsx(y.PaperclipIcon,{className:"size-3"})})}),e.jsxs(o.Button,{"aria-label":"Remove attachment",className:"absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",onClick:I=>{I.stopPropagation(),u.remove(t.id)},type:"button",variant:"ghost",children:[e.jsx(y.XIcon,{}),e.jsx("span",{className:"sr-only",children:"Remove"})]})]}),e.jsx("span",{className:"flex-1 truncate",children:v})]},t.id)}),e.jsx(Ie,{className:"w-auto p-2",children:e.jsxs("div",{className:"w-auto space-y-3",children:[p&&e.jsx("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:e.jsx("img",{alt:c||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:t.url,width:448})}),e.jsx("div",{className:"flex items-center gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[e.jsx("h4",{className:"truncate text-sm font-semibold leading-none",children:c||(p?"Image":"Attachment")}),t.mediaType&&e.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:t.mediaType})]})})]})})]})}function ue({children:t,className:s,...i}){const u=O();return u.files.length?e.jsx("div",{className:o.cn("flex flex-wrap items-center gap-2 p-3",s),...i,children:u.files.map(c=>e.jsx(l.Fragment,{children:t(c)},c.id))}):null}const de=({label:t="Add photos or files",...s})=>{const i=O();return e.jsxs(o.DropdownMenuItem,{...s,onSelect:u=>{u.preventDefault(),i.openFileDialog()},children:[e.jsx(y.ImageIcon,{className:"mr-2 size-4"})," ",t]})},pe=({className:t,accept:s,multiple:i,globalDrop:u,syncHiddenInput:c,maxFiles:f,maxFileSize:p,onError:v,onSubmit:x,children:I,...D})=>{const n=K(),a=!!n,m=l.useRef(null),k=l.useRef(null),N=l.useRef(null);l.useEffect(()=>{var j;const r=(j=k.current)==null?void 0:j.closest("form");r instanceof HTMLFormElement&&(N.current=r)},[]);const[S,z]=l.useState([]),g=a?n.attachments.files:S,T=l.useCallback(()=>{var r;(r=m.current)==null||r.click()},[]),R=l.useCallback(r=>!s||s.trim()===""?!0:s.includes("image/*")?r.type.startsWith("image/"):!0,[s]),M=l.useCallback(r=>{const j=Array.from(r),h=j.filter(w=>R(w));if(j.length&&h.length===0){v==null||v({code:"accept",message:"No files match the accepted types."});return}const d=w=>p?w.size<=p:!0,b=h.filter(d);if(h.length>0&&b.length===0){v==null||v({code:"max_file_size",message:"All files exceed the maximum size."});return}z(w=>{const C=typeof f=="number"?Math.max(0,f-w.length):void 0,Z=typeof C=="number"?b.slice(0,C):b;typeof C=="number"&&b.length>C&&(v==null||v({code:"max_files",message:"Too many files. Some were not added."}));const B=[];for(const q of Z)B.push({id:ee.nanoid(),type:"file",url:URL.createObjectURL(q),mediaType:q.type,filename:q.name});return w.concat(B)})},[R,f,p,v]),P=a?r=>n.attachments.add(r):M,A=a?r=>n.attachments.remove(r):r=>z(j=>{const h=j.find(d=>d.id===r);return h!=null&&h.url&&URL.revokeObjectURL(h.url),j.filter(d=>d.id!==r)}),U=a?()=>n.attachments.clear():()=>z(r=>{for(const j of r)j.url&&URL.revokeObjectURL(j.url);return[]}),F=a?()=>n.attachments.openFileDialog():T;l.useEffect(()=>{a&&n.__registerFileInput(m,()=>{var r;return(r=m.current)==null?void 0:r.click()})},[a,n]),l.useEffect(()=>{c&&m.current&&g.length===0&&(m.current.value="")},[g,c]),l.useEffect(()=>{const r=N.current;if(!r)return;const j=d=>{var b,w;(w=(b=d.dataTransfer)==null?void 0:b.types)!=null&&w.includes("Files")&&d.preventDefault()},h=d=>{var b,w,C;(w=(b=d.dataTransfer)==null?void 0:b.types)!=null&&w.includes("Files")&&d.preventDefault(),(C=d.dataTransfer)!=null&&C.files&&d.dataTransfer.files.length>0&&P(d.dataTransfer.files)};return r.addEventListener("dragover",j),r.addEventListener("drop",h),()=>{r.removeEventListener("dragover",j),r.removeEventListener("drop",h)}},[P]),l.useEffect(()=>{if(!u)return;const r=h=>{var d,b;(b=(d=h.dataTransfer)==null?void 0:d.types)!=null&&b.includes("Files")&&h.preventDefault()},j=h=>{var d,b,w;(b=(d=h.dataTransfer)==null?void 0:d.types)!=null&&b.includes("Files")&&h.preventDefault(),(w=h.dataTransfer)!=null&&w.files&&h.dataTransfer.files.length>0&&P(h.dataTransfer.files)};return document.addEventListener("dragover",r),document.addEventListener("drop",j),()=>{document.removeEventListener("dragover",r),document.removeEventListener("drop",j)}},[P,u]),l.useEffect(()=>()=>{if(!a)for(const r of g)r.url&&URL.revokeObjectURL(r.url)},[a,g]);const $=r=>{r.currentTarget.files&&P(r.currentTarget.files)},Y=async r=>{const h=await(await fetch(r)).blob();return new Promise((d,b)=>{const w=new FileReader;w.onloadend=()=>d(w.result),w.onerror=b,w.readAsDataURL(h)})},J=l.useMemo(()=>({files:g.map(r=>({...r,id:r.id})),add:P,remove:A,clear:U,openFileDialog:F,fileInputRef:m}),[g,P,A,U,F]),Q=r=>{r.preventDefault();const j=r.currentTarget,h=a?n.textInput.value:new FormData(j).get("message")||"";a||j.reset(),Promise.all(g.map(async({...d})=>d.url&&d.url.startsWith("blob:")?{...d,url:await Y(d.url)}:d)).then(d=>{try{const b=x({text:h,files:d},r);b instanceof Promise?b.then(()=>{U(),a&&n.textInput.clear()}).catch(()=>{}):(U(),a&&n.textInput.clear())}catch{}})},G=e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"hidden",ref:k}),e.jsx("input",{accept:s,"aria-label":"Upload files",className:"hidden",multiple:i,onChange:$,ref:m,title:"Upload files",type:"file"}),e.jsx("form",{className:o.cn("w-full",t),onSubmit:Q,...D,children:e.jsx(se,{className:"overflow-hidden",children:I})})]});return a?G:e.jsx(X.Provider,{value:J,children:G})},me=({onChange:t,className:s,placeholder:i="What would you like to know?",...u})=>{const c=K(),f=O(),[p,v]=l.useState(!1),x=n=>{if(n.key==="Enter"){if(p||n.nativeEvent.isComposing||n.shiftKey)return;n.preventDefault();const a=n.currentTarget.form,m=a==null?void 0:a.querySelector('button[type="submit"]');if(m!=null&&m.disabled)return;a==null||a.requestSubmit()}if(n.key==="Backspace"&&n.currentTarget.value===""&&f.files.length>0){n.preventDefault();const a=f.files.at(-1);a&&f.remove(a.id)}},I=n=>{var k;const a=(k=n.clipboardData)==null?void 0:k.items;if(!a)return;const m=[];for(const N of a)if(N.kind==="file"){const S=N.getAsFile();S&&m.push(S)}m.length>0&&(n.preventDefault(),f.add(m))},D=c?{value:c.textInput.value,onChange:n=>{c.textInput.setInput(n.currentTarget.value),t==null||t(n)}}:{onChange:t};return e.jsx(ae,{className:o.cn("field-sizing-content max-h-48 min-h-16",s),name:"message",onCompositionEnd:()=>v(!1),onCompositionStart:()=>v(!0),onKeyDown:x,onPaste:I,placeholder:i,...u,...D})},fe=({className:t,...s})=>e.jsx(W,{align:"block-end",className:o.cn("order-first flex-wrap gap-1",t),...s}),he=({className:t,...s})=>e.jsx(W,{align:"block-end",className:o.cn("justify-between gap-1",t),...s}),xe=({className:t,...s})=>e.jsx("div",{className:o.cn("flex items-center gap-1",t),...s}),E=({variant:t="ghost",className:s,size:i,...u})=>{const c=i??(l.Children.count(u.children)>1?"sm":"icon-sm");return e.jsx(H,{className:o.cn(s),size:c,type:"button",variant:t,...u})},ge=t=>e.jsx(o.DropdownMenu,{...t}),ve=({className:t,children:s,...i})=>e.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsx(E,{className:t,...i,children:s??e.jsx(y.PlusIcon,{className:"size-4"})})}),je=({className:t,...s})=>e.jsx(o.DropdownMenuContent,{align:"start",className:o.cn(t),...s}),be=({className:t,variant:s="default",size:i="icon-sm",status:u,children:c,...f})=>{let p=e.jsx(y.CornerDownLeftIcon,{className:"size-4"});return u==="submitted"?p=e.jsx(y.Loader2Icon,{className:"size-4 animate-spin"}):u==="streaming"?p=e.jsx(y.SquareIcon,{className:"size-4"}):u==="error"&&(p=e.jsx(y.XIcon,{className:"size-4"})),e.jsx(H,{"aria-label":"Submit",className:o.cn(t),size:i,type:"submit",variant:s,...f,children:c??p})},we=({className:t,textareaRef:s,onTranscriptionChange:i,...u})=>{const[c,f]=l.useState(!1),[p,v]=l.useState(null),x=l.useRef(null);l.useEffect(()=>{if(typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)){const D=window.SpeechRecognition||window.webkitSpeechRecognition,n=new D;n.continuous=!0,n.interimResults=!0,n.lang="en-US",n.onstart=()=>{f(!0)},n.onend=()=>{f(!1)},n.onresult=a=>{var k;let m="";for(let N=a.resultIndex;N<a.results.length;N++){const S=a.results[N];S.isFinal&&(m+=((k=S[0])==null?void 0:k.transcript)??"")}if(m&&(s!=null&&s.current)){const N=s.current,S=N.value,z=S+(S?" ":"")+m;N.value=z,N.dispatchEvent(new Event("input",{bubbles:!0})),i==null||i(z)}},n.onerror=a=>{console.error("Speech recognition error:",a.error),f(!1)},x.current=n,v(n)}return()=>{x.current&&x.current.stop()}},[s,i]);const I=l.useCallback(()=>{p&&(c?p.stop():p.start())},[p,c]);return e.jsx(E,{className:o.cn("relative transition-all duration-200",c&&"animate-pulse bg-accent text-accent-foreground",t),disabled:!p,onClick:I,...u,children:e.jsx(y.MicIcon,{className:"size-4"})})},Ne=({openDelay:t=0,closeDelay:s=0,...i})=>e.jsx(o.HoverCard,{closeDelay:s,openDelay:t,...i}),Ie=({align:t="start",...s})=>e.jsx(o.HoverCardContent,{align:t,...s}),ye=t=>e.jsx(o.Dialog,{...t}),Se=t=>e.jsx(o.DialogTrigger,{...t}),ke=({className:t,children:s,title:i="Model Selector",...u})=>e.jsxs(o.DialogContent,{className:o.cn("p-0",t),...u,children:[e.jsx(o.DialogTitle,{className:"sr-only",children:i}),e.jsx(o.Command,{className:"**:data-[slot=command-input-wrapper]:h-auto",children:s})]}),De=({className:t,...s})=>e.jsx(o.CommandInput,{className:o.cn("h-auto py-3.5",t),...s}),Pe=t=>e.jsx(o.CommandList,{...t}),ze=t=>e.jsx(o.CommandGroup,{...t}),Te=t=>e.jsx(o.CommandItem,{...t}),Ce=({provider:t,className:s,...i})=>e.jsx("img",{...i,alt:`${t} logo`,className:o.cn("size-3 dark:invert",s),height:12,src:`https://models.dev/logos/${t}.svg`,width:12}),Ae=({className:t,...s})=>e.jsx("span",{className:o.cn("flex-1 truncate text-left",t),...s}),Le=({selectedModel:t,onModelChange:s,disabled:i=!1})=>{const[u,c]=l.useState(!1),[f,p]=l.useState(""),v=L.getModelById(t)||L.getDefaultModel(),I=L.AI_MODELS.filter(n=>n.name.toLowerCase().includes(f.toLowerCase())||n.provider.toLowerCase().includes(f.toLowerCase())).reduce((n,a)=>(n[a.provider]||(n[a.provider]=[]),n[a.provider].push(a),n),{}),D=n=>{s(n),c(!1),p("")};return e.jsxs(ye,{open:u,onOpenChange:c,children:[e.jsx(Se,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"sm",disabled:i,className:"h-8 gap-1 px-2 text-xs",children:[e.jsx(y.Cpu,{size:14}),e.jsx("span",{className:"max-w-20 truncate",children:v.name})]})}),e.jsxs(ke,{className:"w-96 p-0",children:[e.jsx(De,{placeholder:"Search models...",value:f,onValueChange:p}),e.jsx(Pe,{children:Object.entries(I).map(([n,a])=>e.jsx(ze,{heading:n.charAt(0).toUpperCase()+n.slice(1),children:a.map(m=>e.jsxs(Te,{value:m.id,onSelect:()=>D(m.id),className:"flex cursor-pointer items-center gap-2 p-2",children:[e.jsx(Ce,{provider:m.provider}),e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsx(Ae,{children:m.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:m.description})]}),t===m.id&&e.jsx("div",{className:"h-2 w-2 rounded-full bg-blue-500"})]},m.id))},n))})]})]})},V="chai-ai-selected-model",Re=({input:t,setInput:s,onSend:i,onStop:u,isLoading:c,disabled:f,selectedLang:p,selectedModel:v=L.getDefaultModel().id,onModelChange:x})=>{const{t:I}=te.useTranslation(),[D,n]=l.useState(v),[a,m]=l.useState(null),k=l.useRef(null),[N,S]=l.useState(!1);l.useEffect(()=>{if(!p){const g=localStorage.getItem(V);if(g)n(g),x==null||x(g);else{const T=L.getDefaultModel().id;n(T),x==null||x(T)}}},[p,x]);const z=g=>{var M;const T=g.files.find(P=>{var A;return(A=P.mediaType)==null?void 0:A.startsWith("image/")}),R=(T==null?void 0:T.url)||a;i((M=g.text)==null?void 0:M.trim(),void 0,R,D),m(null)};return e.jsx("div",{className:"relative",children:e.jsx("div",{className:"border-gray-20 rounded-lg border",children:e.jsxs(pe,{onSubmit:z,accept:"image/*",className:"flex h-auto w-full flex-col",children:[e.jsx(fe,{className:"p-0",children:e.jsx(ue,{className:"pb-0",children:g=>e.jsx(le,{className:"text-xs",data:g})})}),e.jsx(me,{ref:k,value:t,onChange:g=>s(g.target.value),placeholder:I(p?"Ask to update content":"Ask me anything..."),disabled:c,className:"max-h-[200px] min-h-[60px] w-full",rows:3}),e.jsxs(he,{children:[p?e.jsx("div",{}):e.jsxs(xe,{children:[e.jsxs(ge,{children:[e.jsx(ve,{disabled:c,children:e.jsx(y.Paperclip,{size:16})}),e.jsx(je,{children:e.jsx(de,{})})]}),e.jsx(we,{textareaRef:k,onTranscriptionChange:s,disabled:c}),e.jsx(Le,{selectedModel:D,onModelChange:g=>{n(g),x==null||x(g),localStorage.setItem(V,g)},disabled:c}),e.jsxs(E,{className:"hidden",size:"sm",onClick:()=>S(!N),variant:N?"default":"ghost",children:[e.jsx(y.GlobeIcon,{size:16}),e.jsx("span",{children:"Search"})]})]}),c?e.jsxs("button",{onClick:u,className:"z-50 flex items-center gap-x-1 rounded-md bg-red-500 p-1.5 text-white transition-colors hover:bg-red-600",title:I("Stop generation"),children:[e.jsx(y.Square,{size:16})," ",e.jsx("span",{className:"text-xs",children:I("Stop")})]}):e.jsx(be,{disabled:!t.trim()||f,children:e.jsx(y.Send,{size:16})})]})]})})})};exports.default=Re;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./index-DF5DEvqb.cjs"),y=require("lucide-react"),ee=require("nanoid"),l=require("react"),_=require("class-variance-authority"),te=require("react-i18next"),L=require("./models-5gOsRC56.cjs");function se({className:t,...s}){return e.jsx("div",{"data-slot":"input-group",role:"group",className:o.cn("group/input-group shadow-xs relative flex w-full items-center rounded-md border border-input outline-none transition-[color,box-shadow] dark:bg-input/30","h-9 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",t),...s})}const ne=_.cva("text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]","block-start":"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5","block-end":"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function W({className:t,align:s="inline-start",...i}){return e.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":s,className:o.cn(ne({align:s}),t),onClick:u=>{var c,f;u.target.closest("button")||(f=(c=u.currentTarget.parentElement)==null?void 0:c.querySelector("input"))==null||f.focus()},...i})}const re=_.cva("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function H({className:t,type:s="button",variant:i="ghost",size:u="xs",...c}){return e.jsx(o.Button,{type:s,"data-size":u,variant:i,className:o.cn(re({size:u}),t),...c})}function ae({className:t,...s}){return e.jsx(o.Textarea,{"data-slot":"input-group-control",className:o.cn("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",t),...s})}const oe=l.createContext(null),ie=l.createContext(null),K=()=>l.useContext(oe),ce=()=>l.useContext(ie),X=l.createContext(null),O=()=>{const t=ce(),s=l.useContext(X),i=t??s;if(!i)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return i};function le({data:t,className:s,...i}){var x;const u=O(),c=t.filename||"",p=((x=t.mediaType)!=null&&x.startsWith("image/")&&t.url?"image":"file")==="image",v=c||(p?"Image":"Attachment");return e.jsxs(Ne,{children:[e.jsx(o.HoverCardTrigger,{asChild:!0,children:e.jsxs("div",{className:o.cn("group relative flex h-8 cursor-default select-none items-center gap-1.5 rounded-md border border-border px-1.5 text-sm font-medium transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",s),...i,children:[e.jsxs("div",{className:"relative size-5 shrink-0",children:[e.jsx("div",{className:"absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0",children:p?e.jsx("img",{alt:c||"attachment",className:"size-5 object-cover",height:20,src:t.url,width:20}):e.jsx("div",{className:"flex size-5 items-center justify-center text-muted-foreground",children:e.jsx(y.PaperclipIcon,{className:"size-3"})})}),e.jsxs(o.Button,{"aria-label":"Remove attachment",className:"absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5",onClick:I=>{I.stopPropagation(),u.remove(t.id)},type:"button",variant:"ghost",children:[e.jsx(y.XIcon,{}),e.jsx("span",{className:"sr-only",children:"Remove"})]})]}),e.jsx("span",{className:"flex-1 truncate",children:v})]},t.id)}),e.jsx(Ie,{className:"w-auto p-2",children:e.jsxs("div",{className:"w-auto space-y-3",children:[p&&e.jsx("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:e.jsx("img",{alt:c||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:t.url,width:448})}),e.jsx("div",{className:"flex items-center gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[e.jsx("h4",{className:"truncate text-sm font-semibold leading-none",children:c||(p?"Image":"Attachment")}),t.mediaType&&e.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:t.mediaType})]})})]})})]})}function ue({children:t,className:s,...i}){const u=O();return u.files.length?e.jsx("div",{className:o.cn("flex flex-wrap items-center gap-2 p-3",s),...i,children:u.files.map(c=>e.jsx(l.Fragment,{children:t(c)},c.id))}):null}const de=({label:t="Add photos or files",...s})=>{const i=O();return e.jsxs(o.DropdownMenuItem,{...s,onSelect:u=>{u.preventDefault(),i.openFileDialog()},children:[e.jsx(y.ImageIcon,{className:"mr-2 size-4"})," ",t]})},pe=({className:t,accept:s,multiple:i,globalDrop:u,syncHiddenInput:c,maxFiles:f,maxFileSize:p,onError:v,onSubmit:x,children:I,...D})=>{const n=K(),a=!!n,m=l.useRef(null),k=l.useRef(null),N=l.useRef(null);l.useEffect(()=>{var j;const r=(j=k.current)==null?void 0:j.closest("form");r instanceof HTMLFormElement&&(N.current=r)},[]);const[S,z]=l.useState([]),g=a?n.attachments.files:S,T=l.useCallback(()=>{var r;(r=m.current)==null||r.click()},[]),R=l.useCallback(r=>!s||s.trim()===""?!0:s.includes("image/*")?r.type.startsWith("image/"):!0,[s]),M=l.useCallback(r=>{const j=Array.from(r),h=j.filter(w=>R(w));if(j.length&&h.length===0){v==null||v({code:"accept",message:"No files match the accepted types."});return}const d=w=>p?w.size<=p:!0,b=h.filter(d);if(h.length>0&&b.length===0){v==null||v({code:"max_file_size",message:"All files exceed the maximum size."});return}z(w=>{const C=typeof f=="number"?Math.max(0,f-w.length):void 0,Z=typeof C=="number"?b.slice(0,C):b;typeof C=="number"&&b.length>C&&(v==null||v({code:"max_files",message:"Too many files. Some were not added."}));const B=[];for(const q of Z)B.push({id:ee.nanoid(),type:"file",url:URL.createObjectURL(q),mediaType:q.type,filename:q.name});return w.concat(B)})},[R,f,p,v]),P=a?r=>n.attachments.add(r):M,A=a?r=>n.attachments.remove(r):r=>z(j=>{const h=j.find(d=>d.id===r);return h!=null&&h.url&&URL.revokeObjectURL(h.url),j.filter(d=>d.id!==r)}),U=a?()=>n.attachments.clear():()=>z(r=>{for(const j of r)j.url&&URL.revokeObjectURL(j.url);return[]}),F=a?()=>n.attachments.openFileDialog():T;l.useEffect(()=>{a&&n.__registerFileInput(m,()=>{var r;return(r=m.current)==null?void 0:r.click()})},[a,n]),l.useEffect(()=>{c&&m.current&&g.length===0&&(m.current.value="")},[g,c]),l.useEffect(()=>{const r=N.current;if(!r)return;const j=d=>{var b,w;(w=(b=d.dataTransfer)==null?void 0:b.types)!=null&&w.includes("Files")&&d.preventDefault()},h=d=>{var b,w,C;(w=(b=d.dataTransfer)==null?void 0:b.types)!=null&&w.includes("Files")&&d.preventDefault(),(C=d.dataTransfer)!=null&&C.files&&d.dataTransfer.files.length>0&&P(d.dataTransfer.files)};return r.addEventListener("dragover",j),r.addEventListener("drop",h),()=>{r.removeEventListener("dragover",j),r.removeEventListener("drop",h)}},[P]),l.useEffect(()=>{if(!u)return;const r=h=>{var d,b;(b=(d=h.dataTransfer)==null?void 0:d.types)!=null&&b.includes("Files")&&h.preventDefault()},j=h=>{var d,b,w;(b=(d=h.dataTransfer)==null?void 0:d.types)!=null&&b.includes("Files")&&h.preventDefault(),(w=h.dataTransfer)!=null&&w.files&&h.dataTransfer.files.length>0&&P(h.dataTransfer.files)};return document.addEventListener("dragover",r),document.addEventListener("drop",j),()=>{document.removeEventListener("dragover",r),document.removeEventListener("drop",j)}},[P,u]),l.useEffect(()=>()=>{if(!a)for(const r of g)r.url&&URL.revokeObjectURL(r.url)},[a,g]);const $=r=>{r.currentTarget.files&&P(r.currentTarget.files)},Y=async r=>{const h=await(await fetch(r)).blob();return new Promise((d,b)=>{const w=new FileReader;w.onloadend=()=>d(w.result),w.onerror=b,w.readAsDataURL(h)})},J=l.useMemo(()=>({files:g.map(r=>({...r,id:r.id})),add:P,remove:A,clear:U,openFileDialog:F,fileInputRef:m}),[g,P,A,U,F]),Q=r=>{r.preventDefault();const j=r.currentTarget,h=a?n.textInput.value:new FormData(j).get("message")||"";a||j.reset(),Promise.all(g.map(async({...d})=>d.url&&d.url.startsWith("blob:")?{...d,url:await Y(d.url)}:d)).then(d=>{try{const b=x({text:h,files:d},r);b instanceof Promise?b.then(()=>{U(),a&&n.textInput.clear()}).catch(()=>{}):(U(),a&&n.textInput.clear())}catch{}})},G=e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"hidden",ref:k}),e.jsx("input",{accept:s,"aria-label":"Upload files",className:"hidden",multiple:i,onChange:$,ref:m,title:"Upload files",type:"file"}),e.jsx("form",{className:o.cn("w-full",t),onSubmit:Q,...D,children:e.jsx(se,{className:"overflow-hidden",children:I})})]});return a?G:e.jsx(X.Provider,{value:J,children:G})},me=({onChange:t,className:s,placeholder:i="What would you like to know?",...u})=>{const c=K(),f=O(),[p,v]=l.useState(!1),x=n=>{if(n.key==="Enter"){if(p||n.nativeEvent.isComposing||n.shiftKey)return;n.preventDefault();const a=n.currentTarget.form,m=a==null?void 0:a.querySelector('button[type="submit"]');if(m!=null&&m.disabled)return;a==null||a.requestSubmit()}if(n.key==="Backspace"&&n.currentTarget.value===""&&f.files.length>0){n.preventDefault();const a=f.files.at(-1);a&&f.remove(a.id)}},I=n=>{var k;const a=(k=n.clipboardData)==null?void 0:k.items;if(!a)return;const m=[];for(const N of a)if(N.kind==="file"){const S=N.getAsFile();S&&m.push(S)}m.length>0&&(n.preventDefault(),f.add(m))},D=c?{value:c.textInput.value,onChange:n=>{c.textInput.setInput(n.currentTarget.value),t==null||t(n)}}:{onChange:t};return e.jsx(ae,{className:o.cn("field-sizing-content max-h-48 min-h-16",s),name:"message",onCompositionEnd:()=>v(!1),onCompositionStart:()=>v(!0),onKeyDown:x,onPaste:I,placeholder:i,...u,...D})},fe=({className:t,...s})=>e.jsx(W,{align:"block-end",className:o.cn("order-first flex-wrap gap-1",t),...s}),he=({className:t,...s})=>e.jsx(W,{align:"block-end",className:o.cn("justify-between gap-1",t),...s}),xe=({className:t,...s})=>e.jsx("div",{className:o.cn("flex items-center gap-1",t),...s}),E=({variant:t="ghost",className:s,size:i,...u})=>{const c=i??(l.Children.count(u.children)>1?"sm":"icon-sm");return e.jsx(H,{className:o.cn(s),size:c,type:"button",variant:t,...u})},ge=t=>e.jsx(o.DropdownMenu,{...t}),ve=({className:t,children:s,...i})=>e.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsx(E,{className:t,...i,children:s??e.jsx(y.PlusIcon,{className:"size-4"})})}),je=({className:t,...s})=>e.jsx(o.DropdownMenuContent,{align:"start",className:o.cn(t),...s}),be=({className:t,variant:s="default",size:i="icon-sm",status:u,children:c,...f})=>{let p=e.jsx(y.CornerDownLeftIcon,{className:"size-4"});return u==="submitted"?p=e.jsx(y.Loader2Icon,{className:"size-4 animate-spin"}):u==="streaming"?p=e.jsx(y.SquareIcon,{className:"size-4"}):u==="error"&&(p=e.jsx(y.XIcon,{className:"size-4"})),e.jsx(H,{"aria-label":"Submit",className:o.cn(t),size:i,type:"submit",variant:s,...f,children:c??p})},we=({className:t,textareaRef:s,onTranscriptionChange:i,...u})=>{const[c,f]=l.useState(!1),[p,v]=l.useState(null),x=l.useRef(null);l.useEffect(()=>{if(typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)){const D=window.SpeechRecognition||window.webkitSpeechRecognition,n=new D;n.continuous=!0,n.interimResults=!0,n.lang="en-US",n.onstart=()=>{f(!0)},n.onend=()=>{f(!1)},n.onresult=a=>{var k;let m="";for(let N=a.resultIndex;N<a.results.length;N++){const S=a.results[N];S.isFinal&&(m+=((k=S[0])==null?void 0:k.transcript)??"")}if(m&&(s!=null&&s.current)){const N=s.current,S=N.value,z=S+(S?" ":"")+m;N.value=z,N.dispatchEvent(new Event("input",{bubbles:!0})),i==null||i(z)}},n.onerror=a=>{console.error("Speech recognition error:",a.error),f(!1)},x.current=n,v(n)}return()=>{x.current&&x.current.stop()}},[s,i]);const I=l.useCallback(()=>{p&&(c?p.stop():p.start())},[p,c]);return e.jsx(E,{className:o.cn("relative transition-all duration-200",c&&"animate-pulse bg-accent text-accent-foreground",t),disabled:!p,onClick:I,...u,children:e.jsx(y.MicIcon,{className:"size-4"})})},Ne=({openDelay:t=0,closeDelay:s=0,...i})=>e.jsx(o.HoverCard,{closeDelay:s,openDelay:t,...i}),Ie=({align:t="start",...s})=>e.jsx(o.HoverCardContent,{align:t,...s}),ye=t=>e.jsx(o.Dialog,{...t}),Se=t=>e.jsx(o.DialogTrigger,{...t}),ke=({className:t,children:s,title:i="Model Selector",...u})=>e.jsxs(o.DialogContent,{className:o.cn("p-0",t),...u,children:[e.jsx(o.DialogTitle,{className:"sr-only",children:i}),e.jsx(o.Command,{className:"**:data-[slot=command-input-wrapper]:h-auto",children:s})]}),De=({className:t,...s})=>e.jsx(o.CommandInput,{className:o.cn("h-auto py-3.5",t),...s}),Pe=t=>e.jsx(o.CommandList,{...t}),ze=t=>e.jsx(o.CommandGroup,{...t}),Te=t=>e.jsx(o.CommandItem,{...t}),Ce=({provider:t,className:s,...i})=>e.jsx("img",{...i,alt:`${t} logo`,className:o.cn("size-3 dark:invert",s),height:12,src:`https://models.dev/logos/${t}.svg`,width:12}),Ae=({className:t,...s})=>e.jsx("span",{className:o.cn("flex-1 truncate text-left",t),...s}),Le=({selectedModel:t,onModelChange:s,disabled:i=!1})=>{const[u,c]=l.useState(!1),[f,p]=l.useState(""),v=L.getModelById(t)||L.getDefaultModel(),I=L.AI_MODELS.filter(n=>n.name.toLowerCase().includes(f.toLowerCase())||n.provider.toLowerCase().includes(f.toLowerCase())).reduce((n,a)=>(n[a.provider]||(n[a.provider]=[]),n[a.provider].push(a),n),{}),D=n=>{s(n),c(!1),p("")};return e.jsxs(ye,{open:u,onOpenChange:c,children:[e.jsx(Se,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"sm",disabled:i,className:"h-8 gap-1 px-2 text-xs",children:[e.jsx(y.Cpu,{size:14}),e.jsx("span",{className:"max-w-20 truncate",children:v.name})]})}),e.jsxs(ke,{className:"w-96 p-0",children:[e.jsx(De,{placeholder:"Search models...",value:f,onValueChange:p}),e.jsx(Pe,{children:Object.entries(I).map(([n,a])=>e.jsx(ze,{heading:n.charAt(0).toUpperCase()+n.slice(1),children:a.map(m=>e.jsxs(Te,{value:m.id,onSelect:()=>D(m.id),className:"flex cursor-pointer items-center gap-2 p-2",children:[e.jsx(Ce,{provider:m.provider}),e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsx(Ae,{children:m.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:m.description})]}),t===m.id&&e.jsx("div",{className:"h-2 w-2 rounded-full bg-blue-500"})]},m.id))},n))})]})]})},V="chai-ai-selected-model",Re=({input:t,setInput:s,onSend:i,onStop:u,isLoading:c,disabled:f,selectedLang:p,selectedModel:v=L.getDefaultModel().id,onModelChange:x})=>{const{t:I}=te.useTranslation(),[D,n]=l.useState(v),[a,m]=l.useState(null),k=l.useRef(null),[N,S]=l.useState(!1);l.useEffect(()=>{if(!p){const g=localStorage.getItem(V);if(g)n(g),x==null||x(g);else{const T=L.getDefaultModel().id;n(T),x==null||x(T)}}},[p,x]);const z=g=>{var M;const T=g.files.find(P=>{var A;return(A=P.mediaType)==null?void 0:A.startsWith("image/")}),R=(T==null?void 0:T.url)||a;i((M=g.text)==null?void 0:M.trim(),void 0,R,D),m(null)};return e.jsx("div",{className:"relative",children:e.jsx("div",{className:"border-gray-20 rounded-lg border",children:e.jsxs(pe,{onSubmit:z,accept:"image/*",className:"flex h-auto w-full flex-col",children:[e.jsx(fe,{className:"p-0",children:e.jsx(ue,{className:"pb-0",children:g=>e.jsx(le,{className:"text-xs",data:g})})}),e.jsx(me,{ref:k,value:t,onChange:g=>s(g.target.value),placeholder:I(p?"Ask to update content":"Ask me anything..."),disabled:c,className:"max-h-[200px] min-h-[60px] w-full",rows:3}),e.jsxs(he,{children:[p?e.jsx("div",{}):e.jsxs(xe,{children:[e.jsxs(ge,{children:[e.jsx(ve,{disabled:c,children:e.jsx(y.Paperclip,{size:16})}),e.jsx(je,{children:e.jsx(de,{})})]}),e.jsx(we,{textareaRef:k,onTranscriptionChange:s,disabled:c}),e.jsx(Le,{selectedModel:D,onModelChange:g=>{n(g),x==null||x(g),localStorage.setItem(V,g)},disabled:c}),e.jsxs(E,{className:"hidden",size:"sm",onClick:()=>S(!N),variant:N?"default":"ghost",children:[e.jsx(y.GlobeIcon,{size:16}),e.jsx("span",{children:"Search"})]})]}),c?e.jsxs("button",{onClick:u,className:"z-50 flex items-center gap-x-1 rounded-md bg-red-500 p-1.5 text-white transition-colors hover:bg-red-600",title:I("Stop generation"),children:[e.jsx(y.Square,{size:16})," ",e.jsx("span",{className:"text-xs",children:I("Stop")})]}):e.jsx(be,{disabled:!t.trim()||f,children:e.jsx(y.Send,{size:16})})]})]})})})};exports.default=Re;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-CnSjWE1P.cjs"),r=require("./index-CbwxUFy_.cjs"),i=require("lucide-react"),o=require("react-i18next"),x=({selectedLang:s,isLoading:n,selectedBlock:l,onClick:a})=>{const{t}=o.useTranslation();return e.jsx("div",{className:"flex flex-col gap-2",children:e.jsx("div",{className:`flex flex-col gap-2 ${n?"pointer-events-none opacity-50":""}`,children:l?e.jsx(c.Button,{variant:"outline",className:"h-auto",onClick:()=>a("TRANSLATE"),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-left text-xs font-thin",children:t("Quick Action:")}),e.jsxs("span",{className:"flex items-center gap-x-2 text-sm font-medium",children:[t("Translate Content")," ",t("to")," ",r.LANGUAGES[s]," ",e.jsx(i.ArrowRight,{className:"h-4 w-4"})]})]})}):null})})};exports.default=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-DF5DEvqb.cjs"),r=require("./index-WQwzsC7A.cjs"),i=require("lucide-react"),o=require("react-i18next"),x=({selectedLang:s,isLoading:n,selectedBlock:l,onClick:a})=>{const{t}=o.useTranslation();return e.jsx("div",{className:"flex flex-col gap-2",children:e.jsx("div",{className:`flex flex-col gap-2 ${n?"pointer-events-none opacity-50":""}`,children:l?e.jsx(c.Button,{variant:"outline",className:"h-auto",onClick:()=>a("TRANSLATE"),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-left text-xs font-thin",children:t("Quick Action:")}),e.jsxs("span",{className:"flex items-center gap-x-2 text-sm font-medium",children:[t("Translate Content")," ",t("to")," ",r.LANGUAGES[s]," ",e.jsx(i.ArrowRight,{className:"h-4 w-4"})]})]})}):null})})};exports.default=x;
@@ -1,6 +1,6 @@
1
1
  import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
- import { B as r } from "./index-S8ibZk9Q.js";
3
- import { L as i } from "./index-BDnwJqMw.js";
2
+ import { B as r } from "./index-Ct7ElCGK.js";
3
+ import { L as i } from "./index-ZuacEL1j.js";
4
4
  import { ArrowRight as c } from "lucide-react";
5
5
  import { useTranslation as m } from "react-i18next";
6
6
  const u = ({
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-CnSjWE1P.cjs"),m=require("@monaco-editor/react"),t=require("@radix-ui/react-icons"),r=require("react");function j({code:l,onCopy:d,language:s="javascript",onDownload:c,downloadText:u="Download"}){const[n,a]=r.useState(!1),[o,p]=r.useState(l),f=()=>{d(o),a(!0),setTimeout(()=>{a(!1)},2e3)},h=()=>{c(o)};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:e.jsx(m,{height:"100%",defaultLanguage:s,language:s,value:o,onChange:x=>p(x||""),theme:"vs-light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(i.Button,{type:"button",variant:"outline",onClick:f,children:[n?e.jsx(t.CheckIcon,{className:"text-green-500"}):e.jsx(t.CopyIcon,{})," ",n?"Copied":"Copy"]}),e.jsxs(i.Button,{type:"button",onClick:h,children:[e.jsx(t.DownloadIcon,{})," ",u]})]})]})}exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./index-DF5DEvqb.cjs"),m=require("@monaco-editor/react"),t=require("@radix-ui/react-icons"),r=require("react");function j({code:l,onCopy:d,language:s="javascript",onDownload:c,downloadText:u="Download"}){const[n,a]=r.useState(!1),[o,p]=r.useState(l),f=()=>{d(o),a(!0),setTimeout(()=>{a(!1)},2e3)},h=()=>{c(o)};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:e.jsx(m,{height:"100%",defaultLanguage:s,language:s,value:o,onChange:x=>p(x||""),theme:"vs-light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(i.Button,{type:"button",variant:"outline",onClick:f,children:[n?e.jsx(t.CheckIcon,{className:"text-green-500"}):e.jsx(t.CopyIcon,{})," ",n?"Copied":"Copy"]}),e.jsxs(i.Button,{type:"button",onClick:h,children:[e.jsx(t.DownloadIcon,{})," ",u]})]})]})}exports.default=j;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import { B as l } from "./index-S8ibZk9Q.js";
2
+ import { B as l } from "./index-Ct7ElCGK.js";
3
3
  import m from "@monaco-editor/react";
4
4
  import { CheckIcon as h, CopyIcon as C, DownloadIcon as y } from "@radix-ui/react-icons";
5
5
  import { useState as s } from "react";
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as d } from "react/jsx-runtime";
2
- import { u as C, a as k, b as v, c as T, D as g, d as y, e as w, f as N, T as D } from "./index-S8ibZk9Q.js";
2
+ import { u as C, a as k, b as v, c as T, D as g, d as y, e as w, f as N, T as D } from "./index-Ct7ElCGK.js";
3
3
  import { useThrottledCallback as E } from "@react-hookz/web";
4
4
  import { useState as m, useCallback as H, useEffect as P } from "react";
5
5
  import { useTranslation as B } from "react-i18next";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CnSjWE1P.cjs"),k=require("@react-hookz/web"),c=require("react"),g=require("react-i18next"),x=l=>{const o=document.createElement("div");return o.innerHTML=l,o.innerHTML};function j(){const{t:l}=g.useTranslation(),[o,m]=c.useState(!1),[a,h]=c.useState(""),[s,i]=t.useCodeEditor(),[d]=t.useSelectedBlockIds(),p=t.useUpdateBlocksProps(),b=t.useUpdateBlocksPropsRealtime(),f=k.useThrottledCallback(n=>{const r=x(n);b([s.blockId],{[s.blockProp]:r})},[],300),u=c.useCallback(()=>{if(o){const n=x(a);p([s.blockId],{[s.blockProp]:n})}},[o,a]);c.useEffect(()=>{d.includes(s==null?void 0:s.blockId)||(u(),i(null))},[d]);const C=()=>{u(),i(null)};return e.jsx(t.Dialog,{open:!0,onOpenChange:C,children:e.jsxs(t.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(t.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(t.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:l("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:l("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(t.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||s.initialCode,onChange:n=>{const r=n.target.value;m(!0),h(r),f(r)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),k=require("@react-hookz/web"),c=require("react"),g=require("react-i18next"),x=l=>{const o=document.createElement("div");return o.innerHTML=l,o.innerHTML};function j(){const{t:l}=g.useTranslation(),[o,m]=c.useState(!1),[a,h]=c.useState(""),[s,i]=t.useCodeEditor(),[d]=t.useSelectedBlockIds(),p=t.useUpdateBlocksProps(),b=t.useUpdateBlocksPropsRealtime(),f=k.useThrottledCallback(n=>{const r=x(n);b([s.blockId],{[s.blockProp]:r})},[],300),u=c.useCallback(()=>{if(o){const n=x(a);p([s.blockId],{[s.blockProp]:n})}},[o,a]);c.useEffect(()=>{d.includes(s==null?void 0:s.blockId)||(u(),i(null))},[d]);const C=()=>{u(),i(null)};return e.jsx(t.Dialog,{open:!0,onOpenChange:C,children:e.jsxs(t.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(t.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(t.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:l("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:l("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(t.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||s.initialCode,onChange:n=>{const r=n.target.value;m(!0),h(r),f(r)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { W as r, X as c, Y as o, Z as i, _ as l, B as d } from "./index-S8ibZk9Q.js";
3
- import { b as m, B as h } from "./index-BDnwJqMw.js";
2
+ import { W as r, X as c, Y as o, Z as i, _ as l, B as d } from "./index-Ct7ElCGK.js";
3
+ import { b as m, B as h } from "./index-ZuacEL1j.js";
4
4
  import { CheckCircle as u, Check as p } from "lucide-react";
5
5
  import { useTranslation as C } from "react-i18next";
6
6
  const k = () => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-CnSjWE1P.cjs"),a=require("./index-CbwxUFy_.cjs"),n=require("lucide-react"),i=require("react-i18next"),l=()=>{const{setPageLockMeta:c}=a.usePageLockMeta(),{t}=i.useTranslation(),r=async()=>{c({})};return e.jsx(a.BlurContainer,{children:e.jsxs(s.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(s.CardHeader,{className:"space-y-1",children:e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(n.CheckCircle,{className:"h-6 w-6 text-green-500"}),t("You can edit the page now")]})}),e.jsx(s.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:t("This page is released by other user you can continue editing now")})}),e.jsx(s.CardFooter,{className:"flex gap-2",children:e.jsxs(s.Button,{variant:"default",onClick:r,className:"flex-1 gap-2",children:[e.jsx(n.Check,{className:"h-4 w-4"}),t("Continue Editing")]})})]})})};exports.default=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DF5DEvqb.cjs"),a=require("./index-WQwzsC7A.cjs"),n=require("lucide-react"),i=require("react-i18next"),l=()=>{const{setPageLockMeta:c}=a.usePageLockMeta(),{t}=i.useTranslation(),r=async()=>{c({})};return e.jsx(a.BlurContainer,{children:e.jsxs(s.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(s.CardHeader,{className:"space-y-1",children:e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(n.CheckCircle,{className:"h-6 w-6 text-green-500"}),t("You can edit the page now")]})}),e.jsx(s.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:t("This page is released by other user you can continue editing now")})}),e.jsx(s.CardFooter,{className:"flex gap-2",children:e.jsxs(s.Button,{variant:"default",onClick:r,className:"flex-1 gap-2",children:[e.jsx(n.Check,{className:"h-4 w-4"}),t("Continue Editing")]})})]})})};exports.default=l;
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CnSjWE1P.cjs"),i=require("./common-functions-B3a4xKt_.cjs"),r=require("./apply-binding-KKp5PnpZ.cjs"),a=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.PERMISSIONS=e.PERMISSIONS;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.generateBlockId=i.generateUUID;exports.mergeClasses=i.cn;exports.convertHTMLToChaiBlocks=r.getBlocksFromHTML;exports.getBlocksFromHTML=r.getBlocksFromHTML;exports.i18n=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DF5DEvqb.cjs"),i=require("./common-functions-B3a4xKt_.cjs"),r=require("./apply-binding-KKp5PnpZ.cjs"),a=require("i18next");exports.ChaiAddBlocksDialog=e.AddBlocksDialog;exports.ChaiAddBlocksPanel=e.AddBlocksPanel;exports.ChaiAskAiUserPrompt=e.AIUserPrompt;exports.ChaiBlockAttributesEditor=e.BlockAttributesEditor;exports.ChaiBlockPropsEditor=e.BlockSettings;exports.ChaiBlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.ChaiDarkModeSwitcher=e.DarkMode;exports.ChaiDefaultBlocks=e.DefaultChaiBlocks;exports.ChaiDraggableBlock=e.ChaiDraggableBlock;exports.ChaiExportCodeModal=e.ExportCodeModal;exports.ChaiImportHTML=e.ImportHTML;exports.ChaiOutline=e.ListTree;exports.ChaiScreenSizes=e.Breakpoints;exports.ChaiThemeConfigPanel=e.ThemeConfigPanel;exports.ChaiUILibrariesPanel=e.UILibrariesPanel;exports.ChaiUndoRedo=e.UndoRedo;exports.PERMISSIONS=e.PERMISSIONS;exports.getClassValueAndUnit=e.getClassValueAndUnit;exports.registerBlockSettingField=e.registerBlockSettingField;exports.registerBlockSettingTemplate=e.registerBlockSettingTemplate;exports.registerBlockSettingWidget=e.registerBlockSettingWidget;exports.registerChaiAddBlockTab=e.registerChaiAddBlockTab;exports.registerChaiLibrary=e.registerChaiLibrary;exports.registerChaiMediaManager=e.registerChaiMediaManager;exports.registerChaiPreImportHTMLHook=e.registerChaiPreImportHTMLHook;exports.registerChaiSaveToLibrary=e.registerChaiSaveToLibrary;exports.registerChaiSidebarPanel=e.registerChaiSidebarPanel;exports.registerChaiTopBar=e.registerChaiTopBar;exports.useMediaManagerComponent=e.useMediaManagerComponent;exports.generateBlockId=i.generateUUID;exports.mergeClasses=i.cn;exports.convertHTMLToChaiBlocks=r.getBlocksFromHTML;exports.getBlocksFromHTML=r.getBlocksFromHTML;exports.i18n=a;
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b6 as s, aW as i, b2 as r, b7 as o, aX as t, aY as l, aZ as C, aT as h, b4 as g, b8 as b, b9 as d, ba as n, a_ as c, a$ as k, b3 as B, b0 as S, b1 as m, b5 as p, an as M, bb as T, bd as P, be as f, bf as u, bc as A, aO as L, aR as E, bg as I, aS as x, aP as H, aU as U, bh as D } from "./index-S8ibZk9Q.js";
1
+ import { b6 as s, aW as i, b2 as r, b7 as o, aX as t, aY as l, aZ as C, aT as h, b4 as g, b8 as b, b9 as d, ba as n, a_ as c, a$ as k, b3 as B, b0 as S, b1 as m, b5 as p, an as M, bb as T, bd as P, be as f, bf as u, bc as A, aO as L, aR as E, bg as I, aS as x, aP as H, aU as U, bh as D } from "./index-Ct7ElCGK.js";
2
2
  import { g as y, c as O } from "./common-functions-D2lMFR6K.js";
3
3
  import { g as F, g as W } from "./apply-binding-6iwlED02.js";
4
4
  import { default as z } from "i18next";
@@ -1,6 +1,5 @@
1
1
  import { jsx as i, jsxs as u } from "react/jsx-runtime";
2
- import { D as T, d as V, e as N, f as R, p as E, B as y, L as D, T as I, q as A } from "./index-S8ibZk9Q.js";
3
- import "lodash-es";
2
+ import { D as T, d as V, e as N, f as R, p as E, B as y, L as D, T as I, q as A } from "./index-Ct7ElCGK.js";
4
3
  import * as b from "culori";
5
4
  import { a as L } from "./fonts-DRly3Wzd.js";
6
5
  import * as x from "react";
@@ -214,7 +213,7 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", H = (o) => `hsl(${d(o
214
213
  --foreground: hsl(37.50 36.36% 95.69%);
215
214
  --primary: rgb(46, 125, 50);
216
215
  --primary-foreground: #ffffff;
217
- }`, J = ({ open: o, onOpenChange: e, onImport: s }) => {
216
+ }`, Z = ({ open: o, onOpenChange: e, onImport: s }) => {
218
217
  const [r, t] = x.useState(""), [l, n] = x.useState(null), [m, h] = x.useState(!1), { t: a } = P(), p = async () => {
219
218
  h(!0), n(null);
220
219
  try {
@@ -302,5 +301,5 @@ const d = (o) => o ? o % 1 === 0 ? o : o.toFixed(4) : "0", H = (o) => `hsl(${d(o
302
301
  ] }) });
303
302
  };
304
303
  export {
305
- J as CssImportModal
304
+ Z as CssImportModal
306
305
  };
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("./index-DF5DEvqb.cjs"),w=require("culori"),T=require("./fonts-B-Xt29pe.cjs"),V=require("react"),N=require("react-i18next");function $(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const y=$(w),S=$(V),f=e=>e?e%1===0?e:e.toFixed(4):"0",R=e=>`hsl(${f(e.h)} ${f(e.s*100)}% ${f(e.l*100)}%)`,E=(e,o="hsl",t="4")=>{try{const r=y.parse(e);if(!r)throw new Error("Invalid color input");switch(o){case"hsl":{const s=y.converter("hsl")(r);return t==="4"?R(s):`${f(s.h)} ${f(s.s*100)}% ${f(s.l*100)}%`}case"rgb":return y.formatRgb(r);case"oklch":{const s=y.converter("oklch")(r);return`oklch(${f(s.l)} ${f(s.c)} ${f(s.h)})`}case"hex":return y.formatHex(r);default:return e}}catch(r){return console.error(`Failed to convert color: ${e}`,r),e}},b=e=>E(e,"hex"),I=e=>{const o={fontFamily:{heading:"",body:""},borderRadius:"",colors:{}};try{const t=F(e);if(!t.isValid)return console.warn("CSS validation failed:",t.error),k();const r=C(e,":root"),s=C(e,".dark"),l=u(r,"--font-sans")||u(r,"--font-family")||u(r,"--font-heading")||u(r,"--font-body"),a=D(l);o.fontFamily={heading:a,body:a};const m=u(r,"--radius")||u(r,"--border-radius")||"0.5rem";o.borderRadius=P(m),["background","foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","destructive","destructive-foreground","border","input","ring","card","card-foreground","popover","popover-foreground"].forEach(i=>{const p=u(r,`--${i}`),g=u(s,`--${i}`);if(p||g){const d=p?v(p):"#000000",x=g?v(g):d;o.colors[i]=[d,x]}})}catch(t){return console.error("Error parsing CSS to ChaiThemeValues:",t),k()}return o},C=(e,o)=>{var r,s;const t=new RegExp(`${j(o)}\\s*{([^}]+)}`);return((s=(r=e.match(t))==null?void 0:r[1])==null?void 0:s.trim())||null},u=(e,o)=>{var s;if(!e)return null;const t=new RegExp(`${j(o)}\\s*:\\s*([^;]+)`),r=e.match(t);return((s=r==null?void 0:r[1])==null?void 0:s.trim())||null},v=e=>{if(!e||typeof e!="string")return"#000000";try{const o=e.replace(/var\([^)]+\)/g,"").trim();if(!o)return"#000000";if(/^[a-z]+$/i.test(o))return b(o)||"#000000";if(/^#?([0-9A-F]{3,4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(o.replace(/#/g,""))){const r=o.startsWith("#")?o:`#${o}`;return r.length<=5?`#${r.slice(1).split("").map(s=>s+s).join("")}`.slice(0,7):r.length>7?r.slice(0,7):r}if(/^(rgb|hsl|oklch)a?\(/i.test(o))return b(o)||"#000000";const t=o.match(/^(\d+\.?\d*)\s+(\d+\.?\d*)%\s+(\d+\.?\d*)%$/);if(t){const[,r,s,l]=t,a=`hsl(${r} ${s}% ${l}%)`;return b(a)||"#000000"}if(/^[\d.]+[\s,]+[\d.]+[\s,]+[\d.]+(?:[\s,/]+[\d.]+)?$/.test(o)){const r=o.split(/[\s,]+/).filter(Boolean);if(r.length>=3){const l=r.some(a=>a.includes("%"))?`hsl(${r[0]} ${r[1]} ${r[2]})`:`rgb(${r[0]}, ${r[1]}, ${r[2]})`;return b(l)||"#000000"}}return b(o)||"#000000"}catch(o){return console.warn("Failed to process color:",e,o),"#000000"}},D=e=>{const o=T.getAllRegisteredFonts();if(!e)return"ui-sans-serif, system-ui, sans-serif";try{const r=e.replace(/["']/g,"").trim().split(",")[0].trim(),s=o.find(l=>l.family.toLowerCase()===r.toLowerCase());return(s==null?void 0:s.family)||"ui-sans-serif, system-ui, sans-serif"}catch(t){return console.warn("Error processing font family:",e,t),"ui-sans-serif, system-ui, sans-serif"}},P=e=>{try{const o=e.trim();if(o.endsWith("px"))return o;if(o.endsWith("rem")){const r=parseFloat(o.replace("rem",""));if(!isNaN(r))return`${Math.round(r*16)}px`}if(o.endsWith("em")){const r=parseFloat(o.replace("em",""));if(!isNaN(r))return`${Math.round(r*16)}px`}const t=parseFloat(o);return isNaN(t)?"8px":`${Math.round(t)}px`}catch(o){return console.warn("Error converting border radius to px:",e,o),"8px"}},k=()=>({fontFamily:{heading:"ui-sans-serif, system-ui, sans-serif",body:"ui-sans-serif, system-ui, sans-serif"},borderRadius:"8px",colors:{background:["#ffffff","#000000"],foreground:["#000000","#ffffff"],primary:["#3b82f6","#60a5fa"],"primary-foreground":["#ffffff","#1e293b"],secondary:["#f1f5f9","#334155"],"secondary-foreground":["#0f172a","#f8fafc"],muted:["#f8fafc","#1e293b"],"muted-foreground":["#64748b","#94a3b8"],accent:["#f1f5f9","#334155"],"accent-foreground":["#0f172a","#f8fafc"],destructive:["#ef4444","#f87171"],"destructive-foreground":["#ffffff","#1e293b"],border:["#e2e8f0","#475569"],input:["#e2e8f0","#475569"],ring:["#3b82f6","#60a5fa"],card:["#ffffff","#0f172a"],"card-foreground":["#000000","#f8fafc"],popover:["#ffffff","#0f172a"],"popover-foreground":["#000000","#f8fafc"]}}),j=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=e=>["background","foreground","primary","primary-foreground"].every(r=>e.colors[r]&&Array.isArray(e.colors[r])&&e.colors[r].length>=2)&&!!e.fontFamily.heading&&!!e.fontFamily.body&&!!e.borderRadius,F=e=>{if(!e||typeof e!="string")return{isValid:!1,error:"Please enter valid CSS content"};const o=e.trim();if(!o)return{isValid:!1,error:"Please enter CSS content"};try{if(!o.includes("{")||!o.includes("}"))return{isValid:!1,error:"Invalid CSS format. CSS should contain proper block structure with { }"};const t=(o.match(/{/g)||[]).length,r=(o.match(/}/g)||[]).length;return t!==r?{isValid:!1,error:"Invalid CSS format. Unmatched braces detected"}:!o.includes("--")||!o.includes(":")?{isValid:!1,error:"Invalid CSS format. CSS should contain variable definitions like --primary: #color"}:!o.includes(":root")&&!o.includes(".dark")?{isValid:!1,error:"CSS should contain at least :root or .dark selector with theme variables"}:{isValid:!0}}catch(t){return console.error("CSS validation error:",t),{isValid:!1,error:"Failed to parse CSS. Please check your syntax."}}},M=`:root {
2
+ --background: 0 0% 100%;
3
+ --foreground: oklch(0.52 0.13 144.17);
4
+ --primary: #3e2723;
5
+ --primary-foreground: #ffffff;
6
+ }
7
+
8
+ .dark {
9
+ --background: 222.2 84% 4.9%;
10
+ --foreground: hsl(37.50 36.36% 95.69%);
11
+ --primary: rgb(46, 125, 50);
12
+ --primary-foreground: #ffffff;
13
+ }`,B=({open:e,onOpenChange:o,onImport:t})=>{const[r,s]=S.useState(""),[l,a]=S.useState(null),[m,h]=S.useState(!1),{t:i}=N.useTranslation(),p=async()=>{h(!0),a(null);try{const d=F(r);if(!d.isValid){a(d.error||i("Invalid CSS format")),setTimeout(()=>{a(null)},5e3),h(!1);return}const x=I(r);if(!q(x)){a(i("The CSS doesn't contain enough theme information. Please ensure it includes at least background, foreground, primary, and primary-foreground colors.")),setTimeout(()=>{a(null)},5e3),h(!1);return}t(x),s(""),a(null),o(!1)}catch(d){console.error("Error importing CSS:",d),a(i("Failed to parse CSS. Please check your syntax and try again.")),setTimeout(()=>{a(null)},5e3)}finally{h(!1)}},g=()=>{s(""),a(null),o(!1)};return n.jsx(c.Dialog,{open:e,onOpenChange:o,children:n.jsxs(c.DialogContent,{className:"flex max-h-[80vh] max-w-2xl flex-col",children:[n.jsxs(c.DialogHeader,{children:[n.jsx(c.DialogTitle,{children:i("Import CSS Theme")}),n.jsxs(c.DialogDescription,{className:"space-y-2",children:[n.jsx("p",{children:i("Paste your CSS variables to import a custom theme. The CSS should contain :root and .dark blocks with CSS custom properties.")}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("p",{className:"font-bold",children:"Get theme resources:"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://tweakcn.com/","_blank"),children:"TweakCN"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://ui.shadcn.com/themes#themes","_blank"),children:"shadcn/ui Themes"}),n.jsx(c.Button,{variant:"link",size:"sm",onClick:()=>window.open("https://zippystarter.com/tools/shadcn-ui-theme-generator","_blank"),children:"ZippyStarter"})]})]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-hidden",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(c.Label,{htmlFor:"css-input",children:i("CSS Variables")}),n.jsx(c.Textarea,{id:"css-input",placeholder:M,value:r,onChange:d=>s(d.target.value),className:"min-h-[300px] resize-none font-mono text-sm",disabled:m})]}),l&&n.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3",children:n.jsx("p",{className:"text-sm text-red-600",children:l})})]}),n.jsxs(c.DialogFooter,{className:"gap-2",children:[n.jsx(c.Button,{variant:"outline",onClick:g,disabled:m,children:i("Cancel")}),n.jsx(c.Button,{onClick:p,disabled:!r.trim()||m,children:i(m?"Importing...":"Import Theme")})]})]})})};exports.CssImportModal=B;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
- import { G as i, H as n, J as c, K as d, M as m, O as h, Q as g, R as u, U as x } from "./index-S8ibZk9Q.js";
2
+ import { G as i, H as n, J as c, K as d, M as m, O as h, Q as g, R as u, U as x } from "./index-Ct7ElCGK.js";
3
3
  import { useTranslation as D } from "react-i18next";
4
4
  const N = ({ tokenName: l, tokenValue: s, onDelete: a, children: o }) => {
5
5
  const { t: r } = D();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CnSjWE1P.cjs"),i=require("react-i18next"),a=({tokenName:r,tokenValue:l,onDelete:n,children:o})=>{const{t:s}=i.useTranslation();return e.jsxs(t.AlertDialog,{children:[e.jsx(t.AlertDialogTrigger,{asChild:!0,children:o}),e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs(t.AlertDialogTitle,{className:"text-base",children:[s("Delete"),' "',r,'"?']}),e.jsx(t.AlertDialogDescription,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 pt-1 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("This action cannot be undone. This will permanently remove the design token from your project.")}),e.jsxs("div",{className:"rounded-md border bg-muted/50 p-3",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:s("Token classes")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:l})]})]})})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{className:"h-7 text-xs",children:s("Cancel")}),e.jsx(t.AlertDialogAction,{onClick:n,className:"h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",children:s("Delete")})]})]})]})};exports.default=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),i=require("react-i18next"),a=({tokenName:r,tokenValue:l,onDelete:n,children:o})=>{const{t:s}=i.useTranslation();return e.jsxs(t.AlertDialog,{children:[e.jsx(t.AlertDialogTrigger,{asChild:!0,children:o}),e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs(t.AlertDialogTitle,{className:"text-base",children:[s("Delete"),' "',r,'"?']}),e.jsx(t.AlertDialogDescription,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 pt-1 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("This action cannot be undone. This will permanently remove the design token from your project.")}),e.jsxs("div",{className:"rounded-md border bg-muted/50 p-3",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:s("Token classes")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:l})]})]})})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{className:"h-7 text-xs",children:s("Cancel")}),e.jsx(t.AlertDialogAction,{onClick:n,className:"h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",children:s("Delete")})]})]})]})};exports.default=a;
@@ -1,6 +1,6 @@
1
1
  import { jsx as i, jsxs as n } from "react/jsx-runtime";
2
- import { n as N, o as A, D as E, d as b, e as k, f as U, p as B, q as G, B as v } from "./index-S8ibZk9Q.js";
3
- import { c as R, o as W, m as q, g as F, l as H, L as M } from "./index-BDnwJqMw.js";
2
+ import { n as N, o as A, D as E, d as b, e as k, f as U, p as B, q as G, B as v } from "./index-Ct7ElCGK.js";
3
+ import { c as R, o as W, m as q, g as F, l as H, L as M } from "./index-ZuacEL1j.js";
4
4
  import { get as Q } from "lodash-es";
5
5
  import { useMemo as w } from "react";
6
6
  import { useTranslation as $ } from "react-i18next";