@chaibuilder/sdk 3.2.8 → 4.0.0-beta.2

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 (184) hide show
  1. package/README.md +25 -20
  2. package/dist/2SSKDMRQ-C4VFVd-q.cjs +1 -0
  3. package/dist/2SSKDMRQ-DSnzF_1o.js +42 -0
  4. package/dist/AP7HFJJL-B7YYCY9q.cjs +1228 -0
  5. package/dist/AP7HFJJL-Cxwj01Aq.js +9214 -0
  6. package/dist/IconPicker-C9-ieDWm.cjs +1 -0
  7. package/dist/IconPicker-RqVvq6G2.js +59 -0
  8. package/dist/WDYDFRGG-C7aSUcjs.js +33 -0
  9. package/dist/WDYDFRGG-b3T2SQbz.cjs +1 -0
  10. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  11. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  12. package/dist/actions-registery-CZ1w0NKa.js +15545 -0
  13. package/dist/actions-registery-YnFmU21O.cjs +418 -0
  14. package/dist/actions.cjs +1 -0
  15. package/dist/actions.d.ts +3202 -0
  16. package/dist/actions.js +216 -0
  17. package/dist/active-in-another-tab-Clng6zpY.cjs +1 -0
  18. package/dist/active-in-another-tab-wb8qolB8.js +34 -0
  19. package/dist/add-new-language-page-C4BuMTaN.cjs +1 -0
  20. package/dist/add-new-language-page-D7NDABl1.js +401 -0
  21. package/dist/add-new-page-B4hc0B-g.js +31 -0
  22. package/dist/add-new-page-BNfwKjRd.cjs +1 -0
  23. package/dist/ai-panel-content-BnbURb7j.js +61 -0
  24. package/dist/ai-panel-content-DPy2jgKw.cjs +1 -0
  25. package/dist/ai-panel-default-lang-3tCHzab5.cjs +3 -0
  26. package/dist/ai-panel-default-lang-oVk4TDeb.js +341 -0
  27. package/dist/ai-panel-other-lang-BBHCCSen.cjs +1 -0
  28. package/dist/ai-panel-other-lang-DmQ3QMDD.js +162 -0
  29. package/dist/ai-prompt-input-DaTyfib-.js +655 -0
  30. package/dist/ai-prompt-input-b5ty81RB.cjs +1 -0
  31. package/dist/ai-translation-prompt-DJPe2O-n.js +28 -0
  32. package/dist/ai-translation-prompt-c0Q3zkT2.cjs +1 -0
  33. package/dist/{apply-binding-DLaiD20q.js → apply-binding-6iwlED02.js} +156 -166
  34. package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
  35. package/dist/{code-display-DuH-UOhl.js → code-display-BzBq5xSn.js} +1 -1
  36. package/dist/code-display-Q3_sK_Ta.cjs +1 -0
  37. package/dist/code-editor-BQZi6-FB.cjs +1 -0
  38. package/dist/code-editor-DWWnphW9.js +50 -0
  39. package/dist/continue-editing-in-this-client-BllU94XG.js +24 -0
  40. package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +1 -0
  41. package/dist/core-BoRDjj4h.cjs +1 -0
  42. package/dist/core-yvI6kCyw.js +56 -0
  43. package/dist/core.cjs +1 -1
  44. package/dist/core.d.ts +2 -393
  45. package/dist/core.js +37 -105
  46. package/dist/css-import-modal-BSMGKA2T.cjs +13 -0
  47. package/dist/{css-import-modal-CFB2YjDT.js → css-import-modal-D72a-16X.js} +39 -38
  48. package/dist/{delete-design-token-BjMakV-b.js → delete-design-token-Cd1ZDtqT.js} +3 -3
  49. package/dist/delete-design-token-D_TLlO3I.cjs +1 -0
  50. package/dist/delete-page-ByQwBupJ.cjs +1 -0
  51. package/dist/delete-page-DC8pzvWW.js +70 -0
  52. package/dist/design-token-usage-BqZeR1sT.cjs +1 -0
  53. package/dist/design-token-usage-DE4XCDdn.js +113 -0
  54. package/dist/digital-asset-manager-BYLKFEYi.cjs +1 -0
  55. package/dist/digital-asset-manager-C_gL_0YY.js +876 -0
  56. package/dist/duplicate-page-BoVhko2q.js +133 -0
  57. package/dist/duplicate-page-vdvwLQLo.cjs +1 -0
  58. package/dist/dynamic-page-selector-CSndg2-y.js +85 -0
  59. package/dist/dynamic-page-selector-DdnbCuQZ.cjs +1 -0
  60. package/dist/fonts-B-Xt29pe.cjs +1 -0
  61. package/dist/fonts-DRly3Wzd.js +78 -0
  62. package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
  63. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
  64. package/dist/get-chai-builder-theme-BYtp20KD.js +24 -0
  65. package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
  66. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  67. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  68. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  69. package/dist/image-compression-DsZ1oqpb.js +37 -0
  70. package/dist/image-editor-DTspjj_c.cjs +1 -0
  71. package/dist/image-editor-oypq8asR.js +108 -0
  72. package/dist/index-B-rSiAp_.cjs +1 -0
  73. package/dist/index-BDnwJqMw.js +4732 -0
  74. package/dist/index-CbwxUFy_.cjs +5 -0
  75. package/dist/index-CnSjWE1P.cjs +160 -0
  76. package/dist/index-Dxfyt4d4.js +39 -0
  77. package/dist/index-S8ibZk9Q.js +19069 -0
  78. package/dist/json-diff-viewer-B5dr-Y_L.js +258 -0
  79. package/dist/json-diff-viewer-XX1pgabt.cjs +8 -0
  80. package/dist/lang-panel-BPxex-M2.cjs +1 -0
  81. package/dist/lang-panel-Cn83SRzd.js +215 -0
  82. package/dist/manage-design-tokens-ConiyuPr.cjs +1 -0
  83. package/dist/{manage-design-tokens-DUoMdCBl.js → manage-design-tokens-lP4HLS0P.js} +31 -32
  84. package/dist/mark-as-template-DYRxre1f.cjs +1 -0
  85. package/dist/mark-as-template-jncsjfHm.js +156 -0
  86. package/dist/models-5gOsRC56.cjs +1 -0
  87. package/dist/models-D95ZYr_x.js +70 -0
  88. package/dist/nested-path-selector-content-B-8LqhXI.js +87 -0
  89. package/dist/nested-path-selector-content-BYtLi7mC.cjs +1 -0
  90. package/dist/no-language-page-content-DAbLq0gX.cjs +1 -0
  91. package/dist/no-language-page-content-D_zd9Rb0.js +42 -0
  92. package/dist/no-language-page-dialog-C5Ps6YYL.js +10 -0
  93. package/dist/no-language-page-dialog-fXmbQO7L.cjs +1 -0
  94. package/dist/page-creator-VWIB2VAs.cjs +1 -0
  95. package/dist/page-creator-wCMtlE6Z.js +795 -0
  96. package/dist/page-lock-BPCxfv9J.js +30 -0
  97. package/dist/page-lock-DweiYy1w.cjs +1 -0
  98. package/dist/page-locked-dialog-BlbgvaG2.cjs +1 -0
  99. package/dist/page-locked-dialog-ByGl18_m.js +133 -0
  100. package/dist/page-manager-new-BWFE-S-O.js +394 -0
  101. package/dist/page-manager-new-D0lGfNnS.cjs +1 -0
  102. package/dist/page-manager-search-and-filter-DpGMoOII.cjs +1 -0
  103. package/dist/page-manager-search-and-filter-kNJFWJ86.js +201 -0
  104. package/dist/page-revisions-content-DYxXZqmh.cjs +1 -0
  105. package/dist/page-revisions-content-Ulr8slUN.js +445 -0
  106. package/dist/pages.cjs +1 -0
  107. package/dist/pages.d.ts +492 -0
  108. package/dist/pages.js +27 -0
  109. package/dist/{plugin-BOcGV_IY.js → plugin-3ZKK6RXm.js} +30 -44
  110. package/dist/plugin-C6rgJDNQ.cjs +22 -0
  111. package/dist/publish-pages-content-BTPzt_m4.js +178 -0
  112. package/dist/publish-pages-content-D6g8GAsd.cjs +1 -0
  113. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  114. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  115. package/dist/render.cjs +2 -2
  116. package/dist/render.d.ts +12 -9
  117. package/dist/render.js +97 -99
  118. package/dist/rte-widget-modal-DrMzWWjw.cjs +1 -0
  119. package/dist/rte-widget-modal-Rk_NW3KU.js +38 -0
  120. package/dist/runtime.cjs +1 -1
  121. package/dist/runtime.d.ts +306 -7
  122. package/dist/runtime.js +44 -1
  123. package/dist/save-to-lib-BK3uTFss.js +422 -0
  124. package/dist/save-to-lib-DHHUO12i.cjs +1 -0
  125. package/dist/sdk.css +1 -1
  126. package/dist/selected-block-display-CU3TwIMA.js +319 -0
  127. package/dist/selected-block-display-DSFhddPj.cjs +16 -0
  128. package/dist/seo-panel-Dl0IDV09.cjs +2 -0
  129. package/dist/seo-panel-jbzxFioc.js +798 -0
  130. package/dist/shared-json-ld-BL_dv3_q.js +565 -0
  131. package/dist/shared-json-ld-DPNkqDC1.cjs +1 -0
  132. package/dist/slug-input-1qwKkXhA.js +86 -0
  133. package/dist/slug-input-YVLjtTI3.cjs +1 -0
  134. package/dist/supabase-actions.cjs +1 -0
  135. package/dist/supabase-actions.d.ts +284 -0
  136. package/dist/supabase-actions.js +524 -0
  137. package/dist/take-over-request-DKvKi3mM.js +63 -0
  138. package/dist/take-over-request-DvMIg_cZ.cjs +1 -0
  139. package/dist/theme-panel-footer-BMOaPLWc.cjs +1 -0
  140. package/dist/theme-panel-footer-DbMDLYGI.js +25 -0
  141. package/dist/translation-warning-modal-9wTwIy_9.js +26 -0
  142. package/dist/translation-warning-modal-DjTwz75c.cjs +1 -0
  143. package/dist/unmark-as-template-CdqIJJER.cjs +1 -0
  144. package/dist/unmark-as-template-Dulvf7Zw.js +39 -0
  145. package/dist/unpublish-page-BwSVBf0_.cjs +1 -0
  146. package/dist/unpublish-page-Degu5Cy9.js +27 -0
  147. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  148. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  149. package/dist/utils.cjs +1 -0
  150. package/dist/{tailwind.d.ts → utils.d.ts} +4 -7
  151. package/dist/utils.js +7 -0
  152. package/dist/web-blocks.cjs +1 -1
  153. package/dist/web-blocks.d.ts +0 -6
  154. package/dist/web-blocks.js +48 -47
  155. package/dist/web-preview-DXE4Jnf5.js +73 -0
  156. package/dist/web-preview-YzKxyXft.cjs +1 -0
  157. package/package.json +159 -89
  158. package/dist/IconPicker-6JSublJp.js +0 -64
  159. package/dist/IconPicker-DpQQDK_Q.cjs +0 -1
  160. package/dist/apply-binding-Bn1KC8uC.cjs +0 -1
  161. package/dist/code-display-Dw1tAwiJ.cjs +0 -1
  162. package/dist/code-editor-cnBzYLxk.cjs +0 -1
  163. package/dist/code-editor-vpbOSO05.js +0 -59
  164. package/dist/css-import-modal-bGWZSlqv.cjs +0 -13
  165. package/dist/delete-design-token-Bzxspf8D.cjs +0 -1
  166. package/dist/design-token-usage-BDArZ38H.js +0 -120
  167. package/dist/design-token-usage-CCv4XltM.cjs +0 -1
  168. package/dist/get-chai-builder-theme-B1tr_NJB.cjs +0 -1
  169. package/dist/get-chai-builder-theme-BarMkcGH.js +0 -12
  170. package/dist/index-CuANr9iH.cjs +0 -160
  171. package/dist/index-DvdOXKUE.js +0 -18338
  172. package/dist/manage-design-tokens-DpC46NAy.cjs +0 -1
  173. package/dist/mockServiceWorker.js +0 -349
  174. package/dist/plugin-CSgw-f78.cjs +0 -22
  175. package/dist/rte-widget-modal-CXbmmhcb.js +0 -41
  176. package/dist/rte-widget-modal-DDjf0xui.cjs +0 -1
  177. package/dist/tailwind.cjs +0 -1
  178. package/dist/tailwind.js +0 -8
  179. package/dist/tooltip-Ba1-8jmj.cjs +0 -1
  180. package/dist/tooltip-DUosa-uC.js +0 -1067
  181. package/dist/ui.cjs +0 -1
  182. package/dist/ui.d.ts +0 -415
  183. package/dist/ui.js +0 -129
  184. package/dist/vite.svg +0 -1
@@ -0,0 +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;
@@ -0,0 +1,28 @@
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";
4
+ import { ArrowRight as c } from "lucide-react";
5
+ import { useTranslation as m } from "react-i18next";
6
+ const u = ({
7
+ selectedLang: l,
8
+ isLoading: o,
9
+ selectedBlock: s,
10
+ onClick: n
11
+ }) => {
12
+ const { t: e } = m();
13
+ return /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ t("div", { className: `flex flex-col gap-2 ${o ? "pointer-events-none opacity-50" : ""}`, children: s ? /* @__PURE__ */ t(r, { variant: "outline", className: "h-auto", onClick: () => n("TRANSLATE"), children: /* @__PURE__ */ a("div", { className: "flex flex-col", children: [
14
+ /* @__PURE__ */ t("p", { className: "text-left text-xs font-thin", children: e("Quick Action:") }),
15
+ /* @__PURE__ */ a("span", { className: "flex items-center gap-x-2 text-sm font-medium", children: [
16
+ e("Translate Content"),
17
+ " ",
18
+ e("to"),
19
+ " ",
20
+ i[l],
21
+ " ",
22
+ /* @__PURE__ */ t(c, { className: "h-4 w-4" })
23
+ ] })
24
+ ] }) }) : null }) });
25
+ };
26
+ export {
27
+ u as default
28
+ };
@@ -0,0 +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,10 +1,10 @@
1
- import { g as ct, c as P } from "./common-functions-D2lMFR6K.js";
2
- import { isEmpty as x, flatten as pt, flatMapDeep as ut, get as y, set as w, startsWith as k, find as m, startCase as dt, forEach as N, camelCase as yt, includes as T, has as A, filter as Q, some as ht, unset as H, map as st, compact as mt, trim as gt, capitalize as bt, memoize as xt, cloneDeep as M, keys as R, isString as $, isArray as I, each as ft, last as _t } from "lodash-es";
3
- import { syncBlocksWithDefaults as kt, getRegisteredChaiBlock as vt } from "@chaibuilder/runtime";
4
- import { parse as wt, stringify as C } from "himalaya";
5
- import { twMerge as Tt } from "tailwind-merge";
6
- const f = "#styles:", Mt = "__ADD_BLOCK_INTERNAL_ROOT", Ot = "@", Bt = "#", tt = "dt#", at = (e) => {
7
- if (e = e.replace(f, ""), !e) return { baseClasses: "", classes: "" };
1
+ import { g as lt, c as P } from "./common-functions-D2lMFR6K.js";
2
+ import { memoize as rt, get as y, cloneDeep as q, forEach as N, keys as R, isString as $, startsWith as k, isArray as I, isEmpty as _, includes as B, flatten as ct, flatMapDeep as pt, set as w, find as m, startCase as ut, camelCase as dt, has as A, filter as G, some as yt, capitalize as ht, compact as mt, map as gt, trim as bt, each as xt, last as ft } from "lodash-es";
3
+ import { parse as _t, stringify as C } from "himalaya";
4
+ import { e as kt, i as vt } from "./core-yvI6kCyw.js";
5
+ import { twMerge as wt } from "tailwind-merge";
6
+ const x = "#styles:", jt = "__ADD_BLOCK_INTERNAL_ROOT", qt = "@", Bt = "#", Q = "dt#", et = (e) => {
7
+ if (e = e.replace(x, ""), !e) return { baseClasses: "", classes: "" };
8
8
  const n = e.split(/,(?![^\[]*\])/);
9
9
  if (n.length === 1)
10
10
  return { baseClasses: "", classes: n[0].trim() };
@@ -41,19 +41,78 @@ import.meta.vitest && describe("getSplitChaiClasses", () => {
41
41
  }
42
42
  };
43
43
  for (let n in e) {
44
- const t = at(`${f}${n}`);
44
+ const t = et(`${x}${n}`);
45
45
  expect(t).toEqual(e[n]);
46
46
  }
47
47
  });
48
48
  });
49
- const Et = (e) => {
49
+ function Mt(e, n, t) {
50
+ const s = y(t, "i18nProps", []);
51
+ if (_(n) || _(s)) return e;
52
+ const a = q(e);
53
+ return N(R(a), (o) => {
54
+ if (B(s, o) && !_(n)) {
55
+ const i = y(a, o), l = y(a, `${o}-${n}`, "");
56
+ $(i) ? a[o] = $(l) && !_(l.trim()) && l.trimStart() || i : a[o] = _(l) ? i : l;
57
+ }
58
+ }), a;
59
+ }
60
+ const st = (e, n) => {
61
+ const { baseClasses: t, classes: s } = et(e), o = s.split(" ").filter((l) => l.startsWith(Q)).map((l) => {
62
+ var u;
63
+ return (u = n[l]) == null ? void 0 : u.value;
64
+ }), i = s.split(" ").filter((l) => !l.startsWith(Q)).join(" ");
65
+ return wt.apply(null, [t, ...o, i]);
66
+ };
67
+ function Tt(e, n) {
68
+ return y(e, `${n}_attrs`, {});
69
+ }
70
+ function Ot(e, n = !0, t = {}) {
71
+ const s = {};
72
+ return Object.keys(e).forEach((a) => {
73
+ if ($(e[a]) && e[a].startsWith(x)) {
74
+ const o = st(e[a], t), i = Tt(e, a);
75
+ s[a] = {
76
+ ...!_(o) && { className: o },
77
+ ...i,
78
+ ...n ? {
79
+ "data-style-prop": a,
80
+ "data-block-parent": e._id,
81
+ "data-style-id": `${a}-${e._id}`
82
+ } : {}
83
+ };
84
+ }
85
+ }), s;
86
+ }
87
+ const Vt = rt((e) => {
88
+ const n = kt(e), t = y(n, "schema.properties", {});
89
+ return Object.fromEntries(Object.entries(t).filter(([, s]) => y(s, "runtime", !1)));
90
+ }), Jt = (e, n) => {
91
+ if (!I(e)) return e;
92
+ let t = e, s;
93
+ return typeof n.limit == "number" && n.limit > 0 && (s = n.limit), s !== void 0 && (t = t.slice(0, s)), t;
94
+ }, zt = (e, n) => {
95
+ const t = q(e);
96
+ return N(R(t), (s) => {
97
+ if ($(t[s]) && !k(s, "_")) {
98
+ let a = t[s];
99
+ s === "repeaterItems" && (t.repeaterItemsBinding = a);
100
+ const o = /\{\{(.*?)\}\}/g, i = a.match(o);
101
+ i && i.forEach((l) => {
102
+ let u = l.slice(2, -2);
103
+ const r = y(n, u, l);
104
+ a = I(r) ? r : a.replace(l, r);
105
+ }), t[s] = a;
106
+ }
107
+ }), t;
108
+ }, Et = (e) => {
50
109
  const n = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, t = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
51
110
  return n.test(e) || t.test(e);
52
111
  }, $t = (e) => {
53
- if (x(e)) return e;
112
+ if (_(e)) return e;
54
113
  const n = /<video[^>]+src=['"]([^'">]+)['"]/, t = /<iframe[^>]+src=['"]([^'">]+)['"]/, s = e.match(n), a = e.match(t), o = s ? s[1] : a ? a[1] : null, i = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, l = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
55
114
  return o && (i.test(o) || l.test(o)) ? o : e;
56
- }, nt = ["chai-name", "data-chai-name"], Nt = {
115
+ }, at = ["chai-name", "data-chai-name"], Nt = {
57
116
  img: { alt: "alt", width: "width", height: "height", src: "image" },
58
117
  video: {
59
118
  src: "url",
@@ -89,11 +148,11 @@ const Et = (e) => {
89
148
  form: {
90
149
  action: "action"
91
150
  }
92
- }, St = (e, n) => e.children.length === 1 && T(
151
+ }, St = (e, n) => e.children.length === 1 && B(
93
152
  ["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
94
153
  n._type
95
- ), j = (e) => e.map((n) => n.type === "text" ? y(n, "content", "") : x(n.children) ? "" : j(n.children)).join(""), W = (e) => e === null ? "" : e, ot = (e) => {
96
- const n = mt(st(e.split(/\s+/), gt)), t = m(n, (l) => /^w-/.test(l)), s = m(n, (l) => /^h-/.test(l));
154
+ ), H = (e) => e.map((n) => n.type === "text" ? y(n, "content", "") : _(n.children) ? "" : H(n.children)).join(""), W = (e) => e === null ? "" : e, nt = (e) => {
155
+ const n = mt(gt(e.split(/\s+/), bt)), t = m(n, (l) => /^w-/.test(l)), s = m(n, (l) => /^h-/.test(l));
97
156
  if (!s || !t) return { height: "", width: "" };
98
157
  const a = (l) => {
99
158
  if (!l) return;
@@ -101,18 +160,18 @@ const Et = (e) => {
101
160
  if (!u) return;
102
161
  if (u[1]) return u[1];
103
162
  const r = u[2];
104
- return /^\d+(\.\d+)?$/.test(r) ? `${Number(r) * 4}px` : r === "auto" || T(r, "%") ? r : "16px";
163
+ return /^\d+(\.\d+)?$/.test(r) ? `${Number(r) * 4}px` : r === "auto" || B(r, "%") ? r : "16px";
105
164
  }, o = a(t), i = a(s);
106
165
  return {
107
- width: T(o, "px") ? o : "16px",
108
- height: T(i, "px") ? i : "16px"
166
+ width: B(o, "px") ? o : "16px",
167
+ height: B(i, "px") ? i : "16px"
109
168
  };
110
- }, et = (e) => {
169
+ }, tt = (e) => {
111
170
  if (e.tagName === "svg") return {};
112
171
  const n = {}, t = Nt[e.tagName] || {}, s = e.attributes;
113
172
  return N(s, ({ key: a, value: o }) => {
114
173
  var i;
115
- if (!T(nt, a))
174
+ if (!B(at, a))
116
175
  if (a === "bid" && (n._bid = W(o)), t[a]) {
117
176
  if (e.tagName === "img" && a === "src" && !o.startsWith("http")) {
118
177
  const l = m(e.attributes, { key: "width" }), u = m(e.attributes, { key: "height" });
@@ -122,16 +181,16 @@ const Et = (e) => {
122
181
  l && typeof (l == null ? void 0 : l.value) == "string" && ((i = l == null ? void 0 : l.value) != null && i.startsWith("pageType:")) && w(n, "link.type", "pageType");
123
182
  }
124
183
  w(n, t[a], W(o));
125
- } else T(["style", "class", "srcset", "bid"], a) || (A(n, "styles_attrs") || (n.styles_attrs = {}), k(a, "@") && (a = a.replace("@", "x-on:")), n.styles_attrs[`${a}`] = W(o));
184
+ } else B(["style", "class", "srcset", "bid"], a) || (A(n, "styles_attrs") || (n.styles_attrs = {}), k(a, "@") && (a = a.replace("@", "x-on:")), n.styles_attrs[`${a}`] = W(o));
126
185
  }), delete n.class, n;
127
186
  }, It = (e, n = "styles") => {
128
- if (!e.attributes) return { [n]: `${f},` };
187
+ if (!e.attributes) return { [n]: `${x},` };
129
188
  const t = m(e.attributes, { key: "class" });
130
189
  if (t) {
131
190
  const s = t.value;
132
- return { [n]: `${f},${s}` };
191
+ return { [n]: `${x},${s}` };
133
192
  }
134
- return { [n]: `${f},` };
193
+ return { [n]: `${x},` };
135
194
  }, Dt = (e) => {
136
195
  const n = y(e, "attributes", []), t = n.find((r) => r.key === "data-chai-richtext" || r.key === "chai-richtext"), s = n.find((r) => r.key === "data-chai-lightbox" || r.key === "chai-lightbox"), a = n.find((r) => r.key === "data-chai-dropdown" || r.key === "chai-dropdown"), o = n.find(
137
196
  (r) => r.key === "data-chai-dropdown-button" || r.key === "chai-dropdown-button"
@@ -230,36 +289,36 @@ const Et = (e) => {
230
289
  return {
231
290
  _type: r,
232
291
  tag: e.tagName,
233
- _name: r == "EmptyBox" || e.tagName === "div" ? r : bt(e.tagName)
292
+ _name: r == "EmptyBox" || e.tagName === "div" ? r : ht(e.tagName)
234
293
  };
235
294
  }
236
295
  }
237
- }, q = (e, n = null) => ut(e, (t) => {
238
- var O, V, J, z, F, U, Y, K, X, Z;
296
+ }, j = (e, n = null) => pt(e, (t) => {
297
+ var M, O, V, J, z, F, U, Y, K, X;
239
298
  if (t.type === "comment") return [];
240
- let s = { _id: ct() };
299
+ let s = { _id: lt() };
241
300
  if (n && (s._parent = n.block._id), t.type === "text")
242
- return x(y(t, "content", "")) ? [] : n && St(n.node, n.block) ? (w(n, "block.content", y(t, "content", "")), []) : { ...s, _type: "Text", content: y(t, "content", "") };
301
+ return _(y(t, "content", "")) ? [] : n && St(n.node, n.block) ? (w(n, "block.content", y(t, "content", "")), []) : { ...s, _type: "Text", content: y(t, "content", "") };
243
302
  if (k(t.tagName, "chai-")) {
244
- const c = t.attributes, p = m(c, { key: "chai-type" }), d = (p == null ? void 0 : p.value) || dt(t.tagName.replace("chai-", "")).replace(/\s+/g, "");
245
- s._type = d, N(c, ({ key: g, value: G }) => {
303
+ const c = t.attributes, p = m(c, { key: "chai-type" }), d = (p == null ? void 0 : p.value) || ut(t.tagName.replace("chai-", "")).replace(/\s+/g, "");
304
+ s._type = d, N(c, ({ key: g, value: Z }) => {
246
305
  if (g === "about-this-component" || g === "chai-type" || g === "can-move" || g === "can-delete") return;
247
306
  if (g === "id") {
248
- s._id = G;
307
+ s._id = Z;
249
308
  return;
250
309
  }
251
- const rt = k(g, "_") ? g : yt(g);
252
- let S = W(G);
253
- typeof S == "string" && k(S, "#styles:") && (S = S.replace("#styles:", "#styles:,")), s[rt] = S;
310
+ const ot = k(g, "_") ? g : dt(g);
311
+ let S = W(Z);
312
+ typeof S == "string" && k(S, "#styles:") && (S = S.replace("#styles:", "#styles:,")), s[ot] = S;
254
313
  });
255
- const h = q(t.children, { block: s, node: t });
314
+ const h = j(t.children, { block: s, node: t });
256
315
  return [s, ...h];
257
316
  }
258
317
  const a = y(t, "attributes", []), o = t.tagName === "p" || a.find((c) => c.key === "data-chai-richtext" || c.key === "chai-richtext"), i = a.find((c) => c.key === "class"), l = i && i.value.split(/\s+/).includes("rte"), u = a.find(
259
318
  (c) => c.key === "data-chai-lightbox" || c.key === "chai-lightbox"
260
319
  ), r = a.find(
261
320
  (c) => c.key === "data-chai-dropdown" || c.key === "chai-dropdown"
262
- ), B = a.find(
321
+ ), T = a.find(
263
322
  (c) => c.key === "data-chai-dropdown-button" || c.key === "chai-dropdown-button"
264
323
  ), D = a.find(
265
324
  (c) => c.key === "data-chai-dropdown-content" || c.key === "chai-dropdown-content"
@@ -267,10 +326,10 @@ const Et = (e) => {
267
326
  if (s = {
268
327
  ...s,
269
328
  ...Dt(t),
270
- ...et(t),
329
+ ...tt(t),
271
330
  ...It(t)
272
331
  }, t.attributes) {
273
- const c = t.attributes.find((p) => T(nt, p.key));
332
+ const c = t.attributes.find((p) => B(at, p.key));
274
333
  c && (s._name = c.value);
275
334
  }
276
335
  if (o || l)
@@ -288,23 +347,23 @@ const Et = (e) => {
288
347
  ];
289
348
  s = {
290
349
  ...s,
291
- href: ((O = a.find((p) => p.key === "href")) == null ? void 0 : O.value) || "",
292
- hrefType: ((V = a.find((p) => p.key === "data-vbtype")) == null ? void 0 : V.value) || "video",
293
- autoplay: ((J = a.find((p) => p.key === "data-autoplay")) == null ? void 0 : J.value) === "true" ? "true" : "false",
294
- maxWidth: ((F = (z = a.find((p) => p.key === "data-maxwidth")) == null ? void 0 : z.value) == null ? void 0 : F.replace("px", "")) || "",
295
- backdropColor: ((U = a.find((p) => p.key === "data-overlay")) == null ? void 0 : U.value) || "",
296
- galleryName: ((Y = a.find((p) => p.key === "data-gall")) == null ? void 0 : Y.value) || ""
350
+ href: ((M = a.find((p) => p.key === "href")) == null ? void 0 : M.value) || "",
351
+ hrefType: ((O = a.find((p) => p.key === "data-vbtype")) == null ? void 0 : O.value) || "video",
352
+ autoplay: ((V = a.find((p) => p.key === "data-autoplay")) == null ? void 0 : V.value) === "true" ? "true" : "false",
353
+ maxWidth: ((z = (J = a.find((p) => p.key === "data-maxwidth")) == null ? void 0 : J.value) == null ? void 0 : z.replace("px", "")) || "",
354
+ backdropColor: ((F = a.find((p) => p.key === "data-overlay")) == null ? void 0 : F.value) || "",
355
+ galleryName: ((U = a.find((p) => p.key === "data-gall")) == null ? void 0 : U.value) || ""
297
356
  }, N(c, (p) => {
298
357
  A(s, `styles_attrs.${p}`) && delete s.styles_attrs[p];
299
358
  });
300
359
  }
301
- if (r && (delete s.styles_attrs, s.showDropdown = !1), D && delete s.styles_attrs, B) {
360
+ if (r && (delete s.styles_attrs, s.showDropdown = !1), D && delete s.styles_attrs, T) {
302
361
  delete s.styles_attrs;
303
- const c = Q(t.children || [], (d) => (d == null ? void 0 : d.tagName) !== "span");
304
- s.content = j(c);
362
+ const c = G(t.children || [], (d) => (d == null ? void 0 : d.tagName) !== "span");
363
+ s.content = H(c);
305
364
  const p = m(
306
365
  t.children || [],
307
- (d) => (d == null ? void 0 : d.tagName) === "span" && ht(d.children || [], (h) => (h == null ? void 0 : h.tagName) === "svg")
366
+ (d) => (d == null ? void 0 : d.tagName) === "span" && yt(d.children || [], (h) => (h == null ? void 0 : h.tagName) === "svg")
308
367
  );
309
368
  if (p) {
310
369
  const d = m(p.children || [], (h) => (h == null ? void 0 : h.tagName) === "svg");
@@ -321,26 +380,26 @@ const Et = (e) => {
321
380
  c === "checkbox" ? w(s, "_type", "Checkbox") : c === "radio" && w(s, "_type", "Radio");
322
381
  } else if (t.tagName === "video" || t.tagName === "iframe") {
323
382
  const c = C([t]);
324
- return Et(c) && (w(s, "_type", "Video"), w(s, "url", $t(c)), w(s, "styles", `${f},`), w(s, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), s.content = c, [s];
383
+ return Et(c) && (w(s, "_type", "Video"), w(s, "url", $t(c)), w(s, "styles", `${x},`), w(s, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), s.content = c, [s];
325
384
  } else if (t.tagName === "svg") {
326
- const c = y(m(t.attributes, { key: "class" }), "value", ""), { height: p, width: d } = ot(c);
385
+ const c = y(m(t.attributes, { key: "class" }), "value", ""), { height: p, width: d } = nt(c);
327
386
  if (p && d)
328
- s.styles = `${f}, ${P(`w-${d} h-${p}`, c)}`.trim(), s.height = p == null ? void 0 : p.replace("px", ""), s.width = d == null ? void 0 : d.replace("px", "");
387
+ s.styles = `${x}, ${P(`w-${d} h-${p}`, c)}`.trim(), s.height = p == null ? void 0 : p.replace("px", ""), s.width = d == null ? void 0 : d.replace("px", "");
329
388
  else {
330
- const h = (K = m(t.attributes, { key: "height" })) == null ? void 0 : K.value, g = (X = m(t.attributes, { key: "width" })) == null ? void 0 : X.value;
331
- h && g ? (s.styles = `${f}, ${P(`w-[${g}px] h-[${h}px]`, c)}`.trim(), s.height = h, s.width = g) : s.styles = `${f}, ${P("w-full h-full", c)}`.trim();
389
+ const h = (Y = m(t.attributes, { key: "height" })) == null ? void 0 : Y.value, g = (K = m(t.attributes, { key: "width" })) == null ? void 0 : K.value;
390
+ h && g ? (s.styles = `${x}, ${P(`w-[${g}px] h-[${h}px]`, c)}`.trim(), s.height = h, s.width = g) : s.styles = `${x}, ${P("w-full h-full", c)}`.trim();
332
391
  }
333
- return t.attributes = Q(t.attributes, (h) => !T(["style", "width", "height", "class"], h.key)), s.icon = C([t]), [s];
334
- } else if (t.tagName == "option" && n && ((Z = n.block) == null ? void 0 : Z._type) === "Select")
392
+ return t.attributes = G(t.attributes, (h) => !B(["style", "width", "height", "class"], h.key)), s.icon = C([t]), [s];
393
+ } else if (t.tagName == "option" && n && ((X = n.block) == null ? void 0 : X._type) === "Select")
335
394
  return n.block.options.push({
336
- label: j(t.children),
337
- ...et(t)
395
+ label: H(t.children),
396
+ ...tt(t)
338
397
  }), [];
339
- const E = q(t.children, { block: s, node: t });
398
+ const E = j(t.children, { block: s, node: t });
340
399
  return [s, ...E];
341
400
  }), Ct = (e, n, t) => {
342
401
  var u, r;
343
- const s = y(e, "attributes", []), { height: a, width: o } = ot(
402
+ const s = y(e, "attributes", []), { height: a, width: o } = nt(
344
403
  y(m(s, { key: "class" }), "value", "")
345
404
  );
346
405
  if (a && o)
@@ -360,83 +419,15 @@ const Et = (e) => {
360
419
  }), e = e.replace(/\\n/g, "").replace(/\\\\/g, "").replace(/\\([/<>])/g, "$1").replace(/\\./g, "").replace(/[\n\r\t\f\v]/g, ""), e = e.replace(/\$name="[^"]*"/g, "");
361
420
  const n = e.match(/<body[^>]*>[\s\S]*?<\/body>/);
362
421
  return (n && n.length > 0 ? n[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : e).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
363
- }, At = (e, n) => m(e, { _id: n }), Vt = (e, n) => x(n) ? e.map((t) => (H(t, "_bid"), t)) : st(e, (t) => {
364
- const s = x(t._bid) ? void 0 : At(n, t._bid);
365
- if (s) {
366
- s._type === "Icon" && y(t, "icon", "").match(/chai-default-svg/) && delete t.icon;
367
- const a = { ...s, ...t };
368
- return H(a, "_bid"), a;
369
- }
370
- return H(t, "_bid"), t;
371
- }), Jt = (e) => {
372
- const n = wt(Lt(e));
373
- if (x(e)) return [];
374
- const t = pt(q(n));
375
- return kt(t);
376
- };
377
- function zt(e, n, t) {
378
- const s = y(t, "i18nProps", []);
379
- if (x(n) || x(s)) return e;
380
- const a = M(e);
381
- return N(R(a), (o) => {
382
- if (T(s, o) && !x(n)) {
383
- const i = y(a, o), l = y(a, `${o}-${n}`, "");
384
- $(i) ? a[o] = $(l) && !x(l.trim()) && l.trimStart() || i : a[o] = x(l) ? i : l;
385
- }
386
- }), a;
387
- }
388
- const lt = (e, n) => {
389
- const { baseClasses: t, classes: s } = at(e), o = s.split(" ").filter((l) => l.startsWith(tt)).map((l) => {
390
- var u;
391
- return (u = n[l]) == null ? void 0 : u.value;
392
- }), i = s.split(" ").filter((l) => !l.startsWith(tt)).join(" ");
393
- return Tt.apply(null, [t, ...o, i]);
394
- };
395
- function Wt(e, n) {
396
- return y(e, `${n}_attrs`, {});
397
- }
398
- function Ft(e, n = !0, t = {}) {
399
- const s = {};
400
- return Object.keys(e).forEach((a) => {
401
- if ($(e[a]) && e[a].startsWith(f)) {
402
- const o = lt(e[a], t), i = Wt(e, a);
403
- s[a] = {
404
- ...!x(o) && { className: o },
405
- ...i,
406
- ...n ? {
407
- "data-style-prop": a,
408
- "data-block-parent": e._id,
409
- "data-style-id": `${a}-${e._id}`
410
- } : {}
411
- };
412
- }
413
- }), s;
414
- }
415
- const Ut = xt((e) => {
416
- const n = vt(e), t = y(n, "schema.properties", {});
417
- return Object.fromEntries(Object.entries(t).filter(([, s]) => y(s, "runtime", !1)));
418
- }), Yt = (e, n) => {
419
- if (!I(e)) return e;
420
- let t = e, s;
421
- return typeof n.limit == "number" && n.limit > 0 && (s = n.limit), s !== void 0 && (t = t.slice(0, s)), t;
422
- }, Kt = (e, n) => {
423
- const t = M(e);
424
- return N(R(t), (s) => {
425
- if ($(t[s]) && !k(s, "_")) {
426
- let a = t[s];
427
- s === "repeaterItems" && (t.repeaterItemsBinding = a);
428
- const o = /\{\{(.*?)\}\}/g, i = a.match(o);
429
- i && i.forEach((l) => {
430
- let u = l.slice(2, -2);
431
- const r = y(n, u, l);
432
- a = I(r) ? r : a.replace(l, r);
433
- }), t[s] = a;
434
- }
435
- }), t;
436
- }, _ = (e, n) => e.map((t) => {
437
- const s = R(t).filter((a) => $(t[a]) && t[a].startsWith(f));
438
- return ft(s, (a) => {
439
- t[a] = `${f},${lt(t[a], n)}`;
422
+ }, Ft = (e) => {
423
+ const n = _t(Lt(e));
424
+ if (_(e)) return [];
425
+ const t = ct(j(n));
426
+ return vt(t);
427
+ }, f = (e, n) => e.map((t) => {
428
+ const s = R(t).filter((a) => $(t[a]) && t[a].startsWith(x));
429
+ return xt(s, (a) => {
430
+ t[a] = `${x},${st(t[a], n)}`;
440
431
  }), t;
441
432
  });
442
433
  import.meta.vitest && describe("applyDesignTokens", () => {
@@ -468,19 +459,19 @@ import.meta.vitest && describe("applyDesignTokens", () => {
468
459
  }
469
460
  ];
470
461
  it("should process blocks and replace style properties with generated class names", () => {
471
- const t = _(n, e);
462
+ const t = f(n, e);
472
463
  expect(t).toHaveLength(3), expect(t[0].styles).toBe("#styles:,bg-white text-sm"), expect(t[0].className).toBe("#styles:,text-lg p-4"), expect(t[0].otherProp).toBe("not-a-style"), expect(t[0]._id).toBe("block1"), expect(t[0]._type).toBe("div");
473
464
  }), it("should handle blocks with no style properties", () => {
474
- const t = _(n, e);
465
+ const t = f(n, e);
475
466
  expect(t[2].noStyles).toBe("regular-string"), expect(t[2]._id).toBe("block3");
476
467
  }), it("should handle empty blocks array", () => {
477
- const t = _([], e);
468
+ const t = f([], e);
478
469
  expect(t).toEqual([]);
479
470
  }), it("should handle empty design tokens", () => {
480
- const t = _(n, {});
471
+ const t = f(n, {});
481
472
  expect(t[0].styles).toBe("#styles:,bg-white text-sm");
482
473
  }), it("should handle blocks with only style prefix", () => {
483
- const s = _([
474
+ const s = f([
484
475
  {
485
476
  _id: "block1",
486
477
  _type: "div",
@@ -490,7 +481,7 @@ import.meta.vitest && describe("applyDesignTokens", () => {
490
481
  ], e);
491
482
  expect(s[0].styles).toBe("#styles:,");
492
483
  }), it("should handle blocks with multiple style properties", () => {
493
- const s = _([
484
+ const s = f([
494
485
  {
495
486
  _id: "block1",
496
487
  _type: "div",
@@ -502,7 +493,7 @@ import.meta.vitest && describe("applyDesignTokens", () => {
502
493
  ], e);
503
494
  expect(s[0].styles).toBe("#styles:,bg-white"), expect(s[0].hoverStyles).toBe("#styles:,text-lg bg-gray-100"), expect(s[0].focusStyles).toBe("#styles:,p-4 outline-none");
504
495
  }), it("should not modify non-string properties that start with #styles:", () => {
505
- const s = _([
496
+ const s = f([
506
497
  {
507
498
  _id: "block1",
508
499
  _type: "div",
@@ -514,7 +505,7 @@ import.meta.vitest && describe("applyDesignTokens", () => {
514
505
  ], e);
515
506
  expect(s[0].styles).toBe("#styles:,bg-white"), expect(s[0].objectStyles).toEqual({ startsWith: "#styles:" }), expect(s[0].arrayStyles).toEqual(["#styles:bg-red-500"]);
516
507
  }), it("should handle undefined and null values", () => {
517
- const s = _([
508
+ const s = f([
518
509
  {
519
510
  _id: "block1",
520
511
  _type: "div",
@@ -526,11 +517,11 @@ import.meta.vitest && describe("applyDesignTokens", () => {
526
517
  ], e);
527
518
  expect(s[0].styles).toBe("#styles:,bg-white"), expect(s[0].nullStyles).toBeNull(), expect(s[0].undefinedStyles).toBeUndefined();
528
519
  }), it("should preserve block structure and non-style properties", () => {
529
- _(n, e).forEach((s, a) => {
520
+ f(n, e).forEach((s, a) => {
530
521
  expect(s._id).toBe(n[a]._id), expect(s._type).toBe(n[a]._type), expect(s._name).toBe(n[a]._name);
531
522
  });
532
523
  }), it("should handle complex design token values", () => {
533
- const a = _([
524
+ const a = f([
534
525
  {
535
526
  _id: "block1",
536
527
  _type: "div",
@@ -543,7 +534,7 @@ import.meta.vitest && describe("applyDesignTokens", () => {
543
534
  });
544
535
  expect(a[0].styles).toBe("#styles:,hover:bg-blue-600 focus:outline-none transition-colors bg-white");
545
536
  }), it("should handle tokens with empty values", () => {
546
- const a = _([
537
+ const a = f([
547
538
  {
548
539
  _id: "block1",
549
540
  _type: "div",
@@ -558,7 +549,7 @@ import.meta.vitest && describe("applyDesignTokens", () => {
558
549
  });
559
550
  });
560
551
  const v = (e) => {
561
- const n = _t(e);
552
+ const n = ft(e);
562
553
  return e.map((t) => {
563
554
  const s = Object.keys(t);
564
555
  for (let a = 0; a < s.length; a++)
@@ -631,9 +622,9 @@ const b = (e, n, { index: t, key: s }, a) => {
631
622
  if (l) {
632
623
  const u = a === "image" || a === "mobileImage";
633
624
  l.forEach((r) => {
634
- let B = r.slice(2, -2).trim(), D = s.slice(2, -2).trim();
635
- t !== -1 && k(B, "$index.") ? B = `${D}.${t}.${B.slice(7)}` : t !== -1 && k(B, "$index") && (B = `${D}.${t}`);
636
- const E = y(n, B);
625
+ let T = r.slice(2, -2).trim(), D = s.slice(2, -2).trim();
626
+ t !== -1 && k(T, "$index.") ? T = `${D}.${t}.${T.slice(7)}` : t !== -1 && k(T, "$index") && (T = `${D}.${t}`);
627
+ const E = y(n, T);
637
628
  E === void 0 ? o = o.replace(r, "") : u && !I(E) ? o = E : o = I(E) ? E : o.replace(r, E);
638
629
  });
639
630
  }
@@ -649,8 +640,8 @@ const b = (e, n, { index: t, key: s }, a) => {
649
640
  }
650
641
  return e;
651
642
  }, L = (e, n, { index: t, key: s }) => {
652
- let a = M(e);
653
- return a.repeaterItems && (a.$repeaterItemsKey = a.repeaterItems, k(a.repeaterItems, `{{${Bt}`) && (a.$repeaterItemsKey = a.repeaterItems = `${a.repeaterItems.replace("}}", `/${a._id}}}`)}`), !x(a.repeaterItems) && a.pagination && (a.repeaterTotalItems = `${a.repeaterItems.replace("}}", `/${a._id}/totalItems}}`)}`)), b(a, n, { index: t, key: s });
643
+ let a = q(e);
644
+ return a.repeaterItems && (a.$repeaterItemsKey = a.repeaterItems, k(a.repeaterItems, `{{${Bt}`) && (a.$repeaterItemsKey = a.repeaterItems = `${a.repeaterItems.replace("}}", `/${a._id}}}`)}`), !_(a.repeaterItems) && a.pagination && (a.repeaterTotalItems = `${a.repeaterItems.replace("}}", `/${a._id}/totalItems}}`)}`)), b(a, n, { index: t, key: s });
654
645
  };
655
646
  import.meta.vitest && (describe("applyBindingToValue", () => {
656
647
  it("should handle string values with bindings", () => {
@@ -825,19 +816,18 @@ import.meta.vitest && (describe("applyBindingToValue", () => {
825
816
  }));
826
817
  export {
827
818
  Bt as C,
828
- tt as D,
829
- Ot as R,
830
- f as S,
819
+ Q as D,
820
+ qt as R,
821
+ x as S,
831
822
  L as a,
832
- zt as b,
833
- Ut as c,
834
- Yt as d,
835
- v as e,
836
- Kt as f,
823
+ Mt as b,
824
+ Ot as c,
825
+ Vt as d,
826
+ Jt as e,
827
+ v as f,
837
828
  Ft as g,
838
- Jt as h,
839
- _ as i,
840
- at as j,
841
- Mt as k,
842
- Vt as m
829
+ zt as h,
830
+ f as i,
831
+ et as j,
832
+ jt as k
843
833
  };