@bikdotai/bik-component-library 0.0.839 → 0.0.840-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/cjs/components/SearchFilter/index.js +1 -1
  2. package/dist/cjs/components/SearchFilter/index.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  4. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +51 -39
  6. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
  8. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
  10. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
  12. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  18. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  20. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/components/MentionPicker.js +22 -22
  22. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
  24. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
  26. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
  28. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  30. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  32. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +3 -1
  34. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  36. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  38. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  39. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +5 -3
  40. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  41. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  42. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  43. package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
  44. package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
  45. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  46. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  47. package/dist/cjs/components/agent-listing/AgentTableShimmer.js +2 -0
  48. package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +1 -0
  49. package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
  50. package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
  51. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  52. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
  53. package/dist/cjs/components/button/Button.styled.js +1 -0
  54. package/dist/cjs/components/button/Button.styled.js.map +1 -1
  55. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js +1 -1
  56. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
  57. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  58. package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
  59. package/dist/cjs/components/input/Input.js +1 -1
  60. package/dist/cjs/components/input/Input.js.map +1 -1
  61. package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
  62. package/dist/cjs/components/multi-level-dropdown/MenuItem.js.map +1 -1
  63. package/dist/cjs/components/radioButton/RadioButton.js +1 -1
  64. package/dist/cjs/components/radioButton/RadioButton.js.map +1 -1
  65. package/dist/cjs/components/radioList/RadioList.js +1 -1
  66. package/dist/cjs/components/radioList/RadioList.js.map +1 -1
  67. package/dist/cjs/components/searchBar/searchBar.js +1 -1
  68. package/dist/cjs/components/searchBar/searchBar.js.map +1 -1
  69. package/dist/cjs/components/side-modal/SideModal.js +1 -1
  70. package/dist/cjs/components/side-modal/SideModal.js.map +1 -1
  71. package/dist/cjs/components/star-rating/Star.js +1 -1
  72. package/dist/cjs/components/star-rating/Star.js.map +1 -1
  73. package/dist/cjs/components/star-rating/StarRating.js +2 -2
  74. package/dist/cjs/components/star-rating/StarRating.js.map +1 -1
  75. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  76. package/dist/cjs/components/template-preview/TemplatePreview.js.map +1 -1
  77. package/dist/cjs/components/thumbnail/Thumbnail.js +1 -1
  78. package/dist/cjs/components/thumbnail/Thumbnail.js.map +1 -1
  79. package/dist/cjs/components/zeroState/ZeroState.js +3 -3
  80. package/dist/cjs/components/zeroState/ZeroState.js.map +1 -1
  81. package/dist/cjs/editor/BikEditor.js +1 -1
  82. package/dist/cjs/editor/BikEditor.js.map +1 -1
  83. package/dist/cjs/editor/BikEditor.styles.js +97 -54
  84. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  85. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
  86. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  87. package/dist/esm/components/SearchFilter/index.js +11 -10
  88. package/dist/esm/components/SearchFilter/index.js.map +1 -1
  89. package/dist/esm/components/agent-builder/AgentBuilder.js +106 -102
  90. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  91. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -6
  92. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +118 -106
  93. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  94. package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +11 -0
  95. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -21
  96. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  97. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +27 -26
  98. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  99. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
  100. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  101. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +24 -23
  102. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  103. package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +3 -1
  104. package/dist/esm/components/agent-builder/components/DiscardModal.js +33 -24
  105. package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
  106. package/dist/esm/components/agent-builder/components/GoLiveModal.js +23 -21
  107. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  108. package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
  109. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  110. package/dist/esm/components/agent-builder/components/MentionPicker.js +177 -147
  111. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  112. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +2 -0
  113. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +111 -105
  114. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  115. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +13 -4
  116. package/dist/esm/components/agent-builder/components/SelectableListSection.js +173 -148
  117. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  118. package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
  119. package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  120. package/dist/esm/components/agent-builder/constants/tools.js +1 -1
  121. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  122. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +104 -103
  123. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  124. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +101 -102
  125. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  126. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +144 -142
  127. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  128. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +23 -79
  129. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  130. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +35 -23
  131. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  132. package/dist/esm/components/agent-listing/AgentListing.js +70 -65
  133. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  134. package/dist/esm/components/agent-listing/AgentTable.d.ts +2 -0
  135. package/dist/esm/components/agent-listing/AgentTable.js +16 -15
  136. package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
  137. package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
  138. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  139. package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +12 -0
  140. package/dist/esm/components/agent-listing/AgentTableShimmer.js +20 -0
  141. package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +1 -0
  142. package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
  143. package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
  144. package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +3 -0
  145. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js +11 -10
  146. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
  147. package/dist/esm/components/button/Button.styled.js +25 -19
  148. package/dist/esm/components/button/Button.styled.js.map +1 -1
  149. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js +28 -21
  150. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
  151. package/dist/esm/components/dropdown/Dropdown.js +18 -13
  152. package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
  153. package/dist/esm/components/input/Input.js +35 -34
  154. package/dist/esm/components/input/Input.js.map +1 -1
  155. package/dist/esm/components/input/Input.model.d.ts +1 -0
  156. package/dist/esm/components/multi-level-dropdown/MenuItem.js +28 -27
  157. package/dist/esm/components/multi-level-dropdown/MenuItem.js.map +1 -1
  158. package/dist/esm/components/radioButton/RadioButton.js +10 -9
  159. package/dist/esm/components/radioButton/RadioButton.js.map +1 -1
  160. package/dist/esm/components/radioList/RadioList.js +28 -19
  161. package/dist/esm/components/radioList/RadioList.js.map +1 -1
  162. package/dist/esm/components/searchBar/searchBar.js +11 -10
  163. package/dist/esm/components/searchBar/searchBar.js.map +1 -1
  164. package/dist/esm/components/side-modal/SideModal.js +13 -5
  165. package/dist/esm/components/side-modal/SideModal.js.map +1 -1
  166. package/dist/esm/components/star-rating/Star.d.ts +1 -0
  167. package/dist/esm/components/star-rating/Star.js +32 -27
  168. package/dist/esm/components/star-rating/Star.js.map +1 -1
  169. package/dist/esm/components/star-rating/StarRating.js +17 -16
  170. package/dist/esm/components/star-rating/StarRating.js.map +1 -1
  171. package/dist/esm/components/template-preview/TemplatePreview.js +41 -40
  172. package/dist/esm/components/template-preview/TemplatePreview.js.map +1 -1
  173. package/dist/esm/components/thumbnail/Thumbnail.js +3 -3
  174. package/dist/esm/components/thumbnail/Thumbnail.js.map +1 -1
  175. package/dist/esm/components/zeroState/ZeroState.js +20 -13
  176. package/dist/esm/components/zeroState/ZeroState.js.map +1 -1
  177. package/dist/esm/editor/BikEditor.js +173 -160
  178. package/dist/esm/editor/BikEditor.js.map +1 -1
  179. package/dist/esm/editor/BikEditor.styles.d.ts +20 -3
  180. package/dist/esm/editor/BikEditor.styles.js +102 -57
  181. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  182. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +5 -8
  183. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +87 -68
  184. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  185. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("styled-components"),i=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),f=require("../../assets/icons/alert.svg.js"),p=require("../spinner/Spinner.js"),h=require("../button/Button.js"),g=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},a=g(x),S=a.default.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("styled-components"),i=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),f=require("../../assets/icons/alert.svg.js"),p=require("../spinner/Spinner.js"),h=require("../button/Button.js"),g=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},s=g(x),S=s.default.div`
2
2
  background: ${n.COLORS.surface.standard};
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -6,7 +6,7 @@
6
6
  justify-content: center;
7
7
  flex: 1;
8
8
  gap: 6px;
9
- `,j=a.default.div`
9
+ `,j=s.default.div`
10
10
  background: ${n.COLORS.background.base};
11
11
  width: 48px;
12
12
  height: 48px;
@@ -15,5 +15,5 @@
15
15
  align-items: center;
16
16
  justify-content: center;
17
17
  border-radius: 24px;
18
- `,O=({subTitle:t,title:d,IconHolderStyle:u,style:y,isLoading:r,containerWidth:c,...o})=>{let s=i.TitleRegular;const l=c?parseFloat(c):0;return l&&!isNaN(l)&&l<=150&&(s=i.TitleSmall),e.jsxs(S,{style:y??{},children:[r?e.jsx(p.Spinner,{size:"large",color:n.COLORS.stroke.brand}):e.jsx(j,{style:u??{},children:o?.Icon||e.jsx(f.default,{color:n.COLORS.content.placeholder,height:24,width:24})}),e.jsx(s,{style:{color:n.COLORS.content.primary},children:r?"Loading...":d||"No results found"}),!!t&&!r&&e.jsx(i.BodyCaption,{style:{color:n.COLORS.content.secondary,textAlign:"center",maxWidth:184},children:t}),!!o?.actionButton&&e.jsx("div",{style:o?.buttonWidth?{width:o?.buttonWidth,display:"flex"}:{},children:e.jsx(h.Button,{...o?.actionButton})})]})};exports.ZeroState=O;
18
+ `,O=({subTitle:t,title:d,IconHolderStyle:u,style:y,isLoading:r,containerWidth:c,...o})=>{let a=i.TitleRegular;const l=c?parseFloat(c):0;return l&&!isNaN(l)&&l<=150&&(a=i.TitleSmall),e.jsxs(S,{style:y??{},children:[r?e.jsx(p.Spinner,{size:"large",color:n.COLORS.stroke.brand}):e.jsx(j,{"data-test":"zero-state-icon-holder",style:u??{},children:o?.Icon||e.jsx(f.default,{color:n.COLORS.content.placeholder,height:24,width:24})}),e.jsx(a,{style:{color:n.COLORS.content.primary},children:r?"Loading...":d||"No results found"}),!!t&&!r&&e.jsx(i.BodyCaption,{style:{color:n.COLORS.content.secondary,textAlign:"center",maxWidth:184},children:t}),!!o?.actionButton&&e.jsx("div",{style:o?.buttonWidth?{width:o?.buttonWidth,display:"flex"}:{},children:e.jsx(h.Button,{...o?.actionButton})})]})};exports.ZeroState=O;
19
19
  //# sourceMappingURL=ZeroState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZeroState.js","sources":["../../../../src/components/zeroState/ZeroState.tsx"],"sourcesContent":["// import SearchIcon from '@bik-icons/search.svg';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { Spinner } from '@src/components/spinner';\nimport {\n\tBodyCaption,\n\tTitleRegular,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport AlertIcon from '../../assets/icons/alert.svg';\nimport { Button } from '../button';\nimport { ButtonProps } from '../button/model';\n\nconst Container = styled.div`\n\tbackground: ${COLORS.surface.standard};\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tflex: 1;\n\tgap: 6px;\n`;\n\nconst IconHolder = styled.div`\n\tbackground: ${COLORS.background.base};\n\twidth: 48px;\n\theight: 48px;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tborder-radius: 24px;\n`;\n\nexport const ZeroState: React.FC<{\n\tisLoading?: boolean;\n\ttitle: string;\n\tsubTitle?: string;\n\tIconHolderStyle?: React.CSSProperties;\n\tstyle?: React.CSSProperties /** now this component is extendable through styled-component */;\n\tactionButton?: ButtonProps;\n\tbuttonWidth?: number;\n\tIcon?: React.ReactNode;\n\tcontainerWidth?: string;\n}> = ({\n\tsubTitle,\n\ttitle,\n\tIconHolderStyle,\n\tstyle,\n\tisLoading,\n\tcontainerWidth,\n\t...otherProps\n}) => {\n\tlet TitleTypography = TitleRegular;\n\tconst numericWidth = containerWidth ? parseFloat(containerWidth) : 0;\n\n\tif (numericWidth && !isNaN(numericWidth) && numericWidth <= 150) {\n\t\tTitleTypography = TitleSmall;\n\t}\n\treturn (\n\t\t<Container style={style ?? {}}>\n\t\t\t{isLoading ? (\n\t\t\t\t<Spinner size={'large'} color={COLORS.stroke.brand} />\n\t\t\t) : (\n\t\t\t\t<IconHolder style={IconHolderStyle ?? {}}>\n\t\t\t\t\t{otherProps?.Icon || (\n\t\t\t\t\t\t<AlertIcon\n\t\t\t\t\t\t\tcolor={COLORS.content.placeholder}\n\t\t\t\t\t\t\theight={24}\n\t\t\t\t\t\t\twidth={24}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</IconHolder>\n\t\t\t)}\n\n\t\t\t<TitleTypography\n\t\t\t\tstyle={{\n\t\t\t\t\tcolor: COLORS.content.primary,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isLoading ? 'Loading...' : title || 'No results found'}\n\t\t\t</TitleTypography>\n\t\t\t{!!subTitle && !isLoading && (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\tmaxWidth: 184,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{subTitle}\n\t\t\t\t</BodyCaption>\n\t\t\t)}\n\t\t\t{!!otherProps?.actionButton && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={\n\t\t\t\t\t\totherProps?.buttonWidth\n\t\t\t\t\t\t\t? { width: otherProps?.buttonWidth, display: 'flex' }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Button {...otherProps?.actionButton} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["Container","styled","COLORS","IconHolder","ZeroState","subTitle","title","IconHolderStyle","style","isLoading","containerWidth","otherProps","TitleTypography","TitleRegular","numericWidth","TitleSmall","jsxs","Spinner","jsx","AlertIcon","BodyCaption","Button"],"mappings":"6YAcMA,EAAYC,EAAAA,QAAO;AAAA,eACV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,YAAA,CAAc,CAAA,CAAA,CACvC,EAEF,CAEF"}
1
+ {"version":3,"file":"ZeroState.js","sources":["../../../../src/components/zeroState/ZeroState.tsx"],"sourcesContent":["// import SearchIcon from '@bik-icons/search.svg';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { Spinner } from '@src/components/spinner';\nimport {\n\tBodyCaption,\n\tTitleRegular,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport AlertIcon from '../../assets/icons/alert.svg';\nimport { Button } from '../button';\nimport { ButtonProps } from '../button/model';\n\nconst Container = styled.div`\n\tbackground: ${COLORS.surface.standard};\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tflex: 1;\n\tgap: 6px;\n`;\n\nconst IconHolder = styled.div`\n\tbackground: ${COLORS.background.base};\n\twidth: 48px;\n\theight: 48px;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tborder-radius: 24px;\n`;\n\nexport const ZeroState: React.FC<{\n\tisLoading?: boolean;\n\ttitle: string;\n\tsubTitle?: string;\n\tIconHolderStyle?: React.CSSProperties;\n\tstyle?: React.CSSProperties /** now this component is extendable through styled-component */;\n\tactionButton?: ButtonProps;\n\tbuttonWidth?: number;\n\tIcon?: React.ReactNode;\n\tcontainerWidth?: string;\n}> = ({\n\tsubTitle,\n\ttitle,\n\tIconHolderStyle,\n\tstyle,\n\tisLoading,\n\tcontainerWidth,\n\t...otherProps\n}) => {\n\tlet TitleTypography = TitleRegular;\n\tconst numericWidth = containerWidth ? parseFloat(containerWidth) : 0;\n\n\tif (numericWidth && !isNaN(numericWidth) && numericWidth <= 150) {\n\t\tTitleTypography = TitleSmall;\n\t}\n\treturn (\n\t\t<Container style={style ?? {}}>\n\t\t\t{isLoading ? (\n\t\t\t\t<Spinner size={'large'} color={COLORS.stroke.brand} />\n\t\t\t) : (\n\t\t\t\t<IconHolder\n\t\t\t\t\tdata-test=\"zero-state-icon-holder\"\n\t\t\t\t\tstyle={IconHolderStyle ?? {}}\n\t\t\t\t>\n\t\t\t\t\t{otherProps?.Icon || (\n\t\t\t\t\t\t<AlertIcon\n\t\t\t\t\t\t\tcolor={COLORS.content.placeholder}\n\t\t\t\t\t\t\theight={24}\n\t\t\t\t\t\t\twidth={24}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</IconHolder>\n\t\t\t)}\n\n\t\t\t<TitleTypography\n\t\t\t\tstyle={{\n\t\t\t\t\tcolor: COLORS.content.primary,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isLoading ? 'Loading...' : title || 'No results found'}\n\t\t\t</TitleTypography>\n\t\t\t{!!subTitle && !isLoading && (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\tmaxWidth: 184,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{subTitle}\n\t\t\t\t</BodyCaption>\n\t\t\t)}\n\t\t\t{!!otherProps?.actionButton && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={\n\t\t\t\t\t\totherProps?.buttonWidth\n\t\t\t\t\t\t\t? { width: otherProps?.buttonWidth, display: 'flex' }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Button {...otherProps?.actionButton} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["Container","styled","COLORS","IconHolder","ZeroState","subTitle","title","IconHolderStyle","style","isLoading","containerWidth","otherProps","TitleTypography","TitleRegular","numericWidth","TitleSmall","jsxs","jsx","Spinner","AlertIcon","BodyCaption","Button"],"mappings":"6YAcMA,EAAYC,EAAAA,QAAO;AAAA,eACVC,EAAAA,OAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShCC,E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1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),me=require("../node_modules/@tiptap/core/dist/index.js"),$=require("@tiptap/react"),c=require("react"),V=require("../components/TypographyStyle.js"),B=require("./BikEditor.styles.js"),Q=require("./BikEditor.types.js"),s=require("./BikEditor.utils.js"),ge=require("./extensions/buildExtensions.js"),fe=require("./floating/LinkBubbleMenu.js"),he=require("../icons/BIK AI specific/WandSparkles.js"),pe=require("../icons/Actions/Formatting/Copy.js");function Ce(C){return Object.entries(C).map(([S,h])=>`${S.replace(/([A-Z])/g,p=>`-${p.toLowerCase()}`)}:${h}`).join(";")}const ke=(C,S)=>{const{initialContent:h,sections:p,features:k,disabled:G,maxCharacters:T,characterLimit:K,shortcuts:X,sendShortcut:Y,mentions:u,slashCommands:f,link:ee,onPaste:te,onReady:b,onChange:R,onSend:x,onFocus:v,onBlur:E,onSelectionChange:A,minHeight:ne,maxHeight:oe,style:se,className:re,editorClassName:z,editorStyle:H,renderJsonError:j}=C,m=!!k?.jsonMode,[d,J]=c.useState(null),[ie,I]=c.useState(!1),ce=m?s.buildJsonCodeBlockHtml(h??""):p?.length?s.buildSectionedContent(s.normalizeHtml(h??""),p.map(e=>({...e,content:s.normalizeHtml(e.content)}))):s.normalizeHtml(h??""),y=c.useRef([]),M=c.useRef(!1),L=c.useRef(b);L.current=b;const O=c.useRef(R);O.current=R;const F=c.useRef(A);F.current=A;const q=c.useRef(Q.DEFAULT_FORMAT_STATE),N=c.useRef(v);N.current=v;const P=c.useRef(E);P.current=E;const w=c.useRef(x);w.current=x;const D=c.useRef(u?.agents??[]);D.current=u?.agents??[];const U=c.useRef(u?.teams??[]);U.current=u?.teams??[];const _=c.useRef(f?.items??[]);_.current=f?.items??[];const n=$.useEditor({extensions:ge.buildExtensions({features:k,placeholder:C.placeholder,maxCharacters:T,characterLimit:K,hasSections:(p?.length??0)>0,mentions:{agents:u?D:void 0,teams:u?U:void 0},slashCommands:f?_:void 0,onPaste:te,onSend:x?e=>w.current?.(e):void 0,sendShortcut:Y,shortcuts:X,onMentionSelected:u?.onSelect,onSlashCommandSelected:f?.onSelect,renderMentionItem:u?.renderItem,renderMentionDropdown:u?.renderDropdown,removeMentionTriggerOnDismiss:u?.removeTriggerOnDismiss,renderSlashCommandItem:f?.renderItem,renderSlashCommandDropdown:f?.renderDropdown}),content:ce,editable:!G,immediatelyRender:!1,editorProps:{attributes:{...z?{class:z}:{},...H?{style:Ce(H)}:{}}},onUpdate:({editor:e})=>{if(O.current?.(s.extractContent(e)),m){const t=s.parseJson(s.getCodeBlockText(e));J(t.valid?null:t)}},onTransaction:({editor:e})=>{const t=s.extractActiveFormats(e),o=q.current;(o.bold!==t.bold||o.italic!==t.italic||o.underline!==t.underline||o.strike!==t.strike||o.bulletList!==t.bulletList||o.orderedList!==t.orderedList||o.blockquote!==t.blockquote||o.codeBlock!==t.codeBlock||o.superscript!==t.superscript||o.subscript!==t.subscript||o.textAlign!==t.textAlign||o.fontFamily!==t.fontFamily||o.fontSize!==t.fontSize||o.color!==t.color||o.highlight!==t.highlight||o.link?.href!==t.link?.href)&&(q.current=t,F.current?.(t))},onFocus:()=>N.current?.(),onBlur:()=>P.current?.()});function i(e){n?e(n):y.current.push(e)}c.useEffect(()=>{if(n&&(y.current.length>0&&y.current.splice(0).forEach(t=>t(n)),M.current||(M.current=!0,L.current?.()),m)){const e=s.parseJson(s.getCodeBlockText(n));J(e.valid?null:e)}},[n,m]),c.useImperativeHandle(S,()=>({focus:e=>i(t=>t.commands.focus(e)),blur:()=>i(e=>e.commands.blur()),clearContent:()=>i(e=>e.commands.clearContent(!0)),setContent:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.setContent(t,{emitUpdate:!0}))},insertContent:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContent(t))},insertInlineContent:e=>{i(t=>s.insertInlineHtml(t,e))},insertAtStart:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(1,t))},insertBlock:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(o.state.doc.content.size,t))},appendInline:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(o.state.doc.content.size-1,t))},insertAtEnd(e){this.insertBlock(e)},appendContent(e){this.appendInline(e)},getContent:()=>n?s.extractContent(n):{html:"",text:"",isEmpty:!0,characterCount:0},getJSON:()=>n?.getJSON()??null,getMentions:()=>{const e=new Set,t=new Set;return n?(n.state.doc.descendants(o=>{o.type.name==="mentionAgent"&&o.attrs.id!=null?e.add(String(o.attrs.id)):o.type.name==="mentionTeam"&&o.attrs.id!=null&&t.add(String(o.attrs.id))}),{agentIds:Array.from(e),teamIds:Array.from(t)}):{agentIds:[],teamIds:[]}},getCursorPosition:()=>{if(!n)return{from:0,to:0};const{from:e,to:t}=n.state.selection;return{from:e,to:t}},insertAtPosition:(e,t)=>{const o=s.normalizeHtml(t);i(r=>r.commands.insertContentAt(e,o))},getSelectedText:()=>{if(!n)return"";const{state:e}=n,{from:t,to:o,empty:r}=e.selection;if(!r)return e.doc.textBetween(t,o," ");const l=e.schema.marks.link;if(l){const g=me.getMarkRange(e.doc.resolve(t),l);if(g)return e.doc.textBetween(g.from,g.to," ")}return""},getCharacterCount:()=>({count:n?.storage.characterCount?.characters?.()??n?.getText().length??0,limit:T??null}),getSectionContent:e=>n?s.extractSectionContent(n,e):{html:"",text:"",isEmpty:!0,characterCount:0},setSectionContent:(e,t)=>{const o=s.normalizeHtml(t);i(r=>s.setSectionContentInEditor(r,e,o))},focusSection:e=>{i(t=>{if(e==="body"){let r=t.state.doc.content.size-1;t.state.doc.descendants((l,g)=>(l.type.name==="sectionDivider"&&r===t.state.doc.content.size-1&&(r=g-1),r===t.state.doc.content.size-1)),r<1&&(r=1),t.chain().focus().setTextSelection(r).run();return}let o=-1;t.state.doc.descendants((r,l)=>{if(o!==-1)return!1;r.type.name==="sectionDivider"&&r.attrs.sectionId===e&&(o=l+r.nodeSize+1)}),o!==-1&&t.chain().focus().setTextSelection(o).run()})},clearSection:e=>{i(t=>s.setSectionContentInEditor(t,e,"<p></p>"))},getBodyContent:()=>n?s.extractBodyContent(n):{html:"",text:"",isEmpty:!0,characterCount:0},setBodyContent:e=>{const t=s.normalizeHtml(e);i(o=>s.setSectionContentInEditor(o,"body",t))},setBodyAndSections:(e,t)=>{const o=s.buildSectionedContent(s.normalizeHtml(e),t.map(r=>({id:r.id,content:s.normalizeHtml(r.content)})));i(r=>r.commands.setContent(o,{emitUpdate:!0}))},appendBodyContent:e=>{const t=s.normalizeHtml(e);i(o=>{const r=s.findSectionEndPos(o,"body");o.commands.insertContentAt(r-1,t,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionStart:(e,t)=>{const o=s.normalizeHtml(t);i(r=>{const l=s.findSectionStartPos(r,e);l!==-1&&r.commands.insertContentAt(l,o,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionEnd:(e,t)=>{const o=s.normalizeHtml(t);i(r=>{const l=s.findSectionEndPos(r,e);r.commands.insertContentAt(l,o,{parseOptions:{preserveWhitespace:!0}})})},getActiveFormats:()=>n?s.extractActiveFormats(n):Q.DEFAULT_FORMAT_STATE,actions:{toggleBold:()=>n?.chain().focus().toggleBold().run(),toggleItalic:()=>n?.chain().focus().toggleItalic().run(),toggleUnderline:()=>n?.chain().focus().toggleUnderline().run(),toggleStrike:()=>n?.chain().focus().toggleStrike().run(),toggleBulletList:()=>n?.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>n?.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>n?.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>n?.chain().focus().toggleCodeBlock().run(),setTextAlign:e=>n?.chain().focus().setTextAlign(e).run(),setFontFamily:e=>n?.chain().focus().setFontFamily(e).run(),setFontSize:e=>n?.chain().focus().setFontSize(e).run(),setColor:e=>n?.chain().focus().setColor(e).run(),setHighlight:e=>n?.chain().focus().toggleHighlight({color:e}).run(),unsetColor:()=>n?.chain().focus().unsetColor().run(),unsetHighlight:()=>n?.chain().focus().unsetHighlight().run(),setLink:(e,t)=>{n&&(t!==void 0?n.chain().focus().extendMarkRange("link").command(({tr:o,state:r})=>{const{from:l,to:g}=o.selection,W=r.schema.marks.link;if(!W)return!1;const ue=r.schema.text(t,[W.create({href:e})]),de=r.schema.text(" ");return o.replaceWith(l,g,[ue,de]),!0}).run():n.chain().focus().extendMarkRange("link").setLink({href:e}).insertContent(" ").run())},updateLink:e=>n?.chain().focus().extendMarkRange("link").setLink({href:e}).run(),removeLink:()=>n?.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:e=>n?.chain().focus().insertContent(e).run(),insertVariable:e=>n?.chain().focus().insertContent(`{{${e}}}`).run(),insertHtml:e=>n?.commands.insertContent(s.normalizeHtml(e)),undo:()=>n?.chain().focus().undo().run(),redo:()=>n?.chain().focus().redo().run(),canUndo:()=>n?.can().undo()??!1,canRedo:()=>n?.can().redo()??!1,toggleSuperscript:()=>n?.chain().focus().toggleSuperscript().run(),toggleSubscript:()=>n?.chain().focus().toggleSubscript().run(),insertImage:e=>n?.chain().focus().setImage({src:e}).run()},json:k?.jsonMode?{getText:()=>n?s.getCodeBlockText(n):"",setText:e=>i(t=>s.setCodeBlockText(t,e)),parse:()=>s.parseJson(n?s.getCodeBlockText(n):""),isValid:()=>s.parseJson(n?s.getCodeBlockText(n):"").valid,format:(e=2)=>i(t=>{const{valid:o,value:r}=s.parseJson(s.getCodeBlockText(t));!o||r===null||s.setCodeBlockText(t,JSON.stringify(r,null,e))}),minify:()=>i(e=>{const{valid:t,value:o}=s.parseJson(s.getCodeBlockText(e));!t||o===null||s.setCodeBlockText(e,JSON.stringify(o))})}:void 0}),[n]);const ae=()=>{if(!n)return;const{valid:e,value:t}=s.parseJson(s.getCodeBlockText(n));!e||t===null||s.setCodeBlockText(n,JSON.stringify(t,null,2))},le=()=>{n&&(navigator.clipboard?.writeText(s.getCodeBlockText(n)),I(!0),setTimeout(()=>I(!1),1500))};return n?a.jsxs(B.BikEditorShell,{minHeight:ne,maxHeight:oe,tightParagraphs:!k?.richPaste,jsonMode:m,style:se,className:re,children:[m&&a.jsxs(B.BikJsonHeader,{children:[a.jsx("span",{className:"bik-json-header-label",children:"JSON"}),a.jsxs("div",{className:"bik-json-header-actions",children:[a.jsxs("button",{type:"button",onClick:ae,disabled:!!d,title:"Format JSON",children:[a.jsx(he.default,{size:16}),a.jsx(V.BodyCaption,{children:"Beautify"})]}),a.jsxs("button",{type:"button",onClick:le,title:"Copy JSON",children:[a.jsx(pe.default,{size:16}),ie&&a.jsx(V.BodyCaption,{children:"Copied"})]})]})]}),a.jsx($.EditorContent,{editor:n}),a.jsx(fe.LinkBubbleMenu,{editor:n,renderLinkTooltip:ee?.renderTooltip}),m&&d?j?j(d):a.jsxs(B.BikJsonError,{children:[d.line!=null&&a.jsxs("strong",{children:["Line ",d.line,d.column!=null?`, column ${d.column}`:"",":"," "]}),d.error]}):null]}):null},Z=c.forwardRef(ke);Z.displayName="BikEditor";exports.BikEditor=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),ge=require("../node_modules/@tiptap/core/dist/index.js"),T=require("@tiptap/react"),a=require("react"),Q=require("../components/TypographyStyle.js"),k=require("./BikEditor.styles.js"),Z=require("./BikEditor.types.js"),s=require("./BikEditor.utils.js"),he=require("./extensions/buildExtensions.js"),pe=require("./floating/LinkBubbleMenu.js"),Ce=require("../icons/BIK AI specific/WandSparkles.js"),ke=require("../icons/Actions/Formatting/Copy.js"),Se=require("../icons/Actions/Common actions/Code.js"),xe=require("../icons/Informational/General/Info.js");function ye(p){return Object.entries(p).map(([x,g])=>`${x.replace(/([A-Z])/g,C=>`-${C.toLowerCase()}`)}:${g}`).join(";")}const Be=(p,x)=>{const{initialContent:g,sections:C,features:S,disabled:K,maxCharacters:b,characterLimit:X,shortcuts:Y,sendShortcut:ee,mentions:d,slashCommands:h,link:te,onPaste:ne,onReady:E,onChange:R,onSend:y,onFocus:j,onBlur:v,onSelectionChange:z,minHeight:oe,maxHeight:se,style:re,className:ie,editorClassName:A,editorStyle:H,renderJsonError:J}=p,u=!!S?.jsonMode,[m,I]=a.useState(null),[ce,M]=a.useState(!1),[ae,L]=a.useState(u&&!(g??"").trim()),le=u?s.buildJsonCodeBlockHtml(g??""):C?.length?s.buildSectionedContent(s.normalizeHtml(g??""),C.map(e=>({...e,content:s.normalizeHtml(e.content)}))):s.normalizeHtml(g??""),B=a.useRef([]),O=a.useRef(!1),q=a.useRef(E);q.current=E;const F=a.useRef(R);F.current=R;const N=a.useRef(z);N.current=z;const P=a.useRef(Z.DEFAULT_FORMAT_STATE),w=a.useRef(j);w.current=j;const D=a.useRef(v);D.current=v;const U=a.useRef(y);U.current=y;const _=a.useRef(d?.agents??[]);_.current=d?.agents??[];const $=a.useRef(d?.teams??[]);$.current=d?.teams??[];const W=a.useRef(h?.items??[]);W.current=h?.items??[];const n=T.useEditor({extensions:he.buildExtensions({features:S,placeholder:p.placeholder,maxCharacters:b,characterLimit:X,hasSections:(C?.length??0)>0,mentions:{agents:d?_:void 0,teams:d?$:void 0},slashCommands:h?W:void 0,onPaste:ne,onSend:y?e=>U.current?.(e):void 0,sendShortcut:ee,shortcuts:Y,onMentionSelected:d?.onSelect,onSlashCommandSelected:h?.onSelect,renderMentionItem:d?.renderItem,renderMentionDropdown:d?.renderDropdown,removeMentionTriggerOnDismiss:d?.removeTriggerOnDismiss,renderSlashCommandItem:h?.renderItem,renderSlashCommandDropdown:h?.renderDropdown}),content:le,editable:!K,immediatelyRender:!1,editorProps:{attributes:{...A?{class:A}:{},...H?{style:ye(H)}:{}}},onUpdate:({editor:e})=>{if(F.current?.(s.extractContent(e)),u){const t=s.getCodeBlockText(e),o=s.parseJson(t);I(o.valid?null:o),L(!t.trim())}},onTransaction:({editor:e})=>{const t=s.extractActiveFormats(e),o=P.current;(o.bold!==t.bold||o.italic!==t.italic||o.underline!==t.underline||o.strike!==t.strike||o.bulletList!==t.bulletList||o.orderedList!==t.orderedList||o.blockquote!==t.blockquote||o.codeBlock!==t.codeBlock||o.superscript!==t.superscript||o.subscript!==t.subscript||o.textAlign!==t.textAlign||o.fontFamily!==t.fontFamily||o.fontSize!==t.fontSize||o.color!==t.color||o.highlight!==t.highlight||o.link?.href!==t.link?.href)&&(P.current=t,N.current?.(t))},onFocus:()=>w.current?.(),onBlur:()=>D.current?.()});function i(e){n?e(n):B.current.push(e)}a.useEffect(()=>{if(n&&(B.current.length>0&&B.current.splice(0).forEach(t=>t(n)),O.current||(O.current=!0,q.current?.()),u)){const e=s.getCodeBlockText(n),t=s.parseJson(e);I(t.valid?null:t),L(!e.trim())}},[n,u]),a.useImperativeHandle(x,()=>({focus:e=>i(t=>t.commands.focus(e)),blur:()=>i(e=>e.commands.blur()),clearContent:()=>i(e=>e.commands.clearContent(!0)),setContent:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.setContent(t,{emitUpdate:!0}))},insertContent:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContent(t))},insertInlineContent:e=>{i(t=>s.insertInlineHtml(t,e))},insertAtStart:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(1,t))},insertBlock:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(o.state.doc.content.size,t))},appendInline:e=>{const t=s.normalizeHtml(e);i(o=>o.commands.insertContentAt(o.state.doc.content.size-1,t))},insertAtEnd(e){this.insertBlock(e)},appendContent(e){this.appendInline(e)},getContent:()=>n?s.extractContent(n):{html:"",text:"",isEmpty:!0,characterCount:0},getJSON:()=>n?.getJSON()??null,getMentions:()=>{const e=new Set,t=new Set;return n?(n.state.doc.descendants(o=>{o.type.name==="mentionAgent"&&o.attrs.id!=null?e.add(String(o.attrs.id)):o.type.name==="mentionTeam"&&o.attrs.id!=null&&t.add(String(o.attrs.id))}),{agentIds:Array.from(e),teamIds:Array.from(t)}):{agentIds:[],teamIds:[]}},getCursorPosition:()=>{if(!n)return{from:0,to:0};const{from:e,to:t}=n.state.selection;return{from:e,to:t}},insertAtPosition:(e,t)=>{const o=s.normalizeHtml(t);i(r=>r.commands.insertContentAt(e,o))},getSelectedText:()=>{if(!n)return"";const{state:e}=n,{from:t,to:o,empty:r}=e.selection;if(!r)return e.doc.textBetween(t,o," ");const l=e.schema.marks.link;if(l){const f=ge.getMarkRange(e.doc.resolve(t),l);if(f)return e.doc.textBetween(f.from,f.to," ")}return""},getCharacterCount:()=>({count:n?.storage.characterCount?.characters?.()??n?.getText().length??0,limit:b??null}),getSectionContent:e=>n?s.extractSectionContent(n,e):{html:"",text:"",isEmpty:!0,characterCount:0},setSectionContent:(e,t)=>{const o=s.normalizeHtml(t);i(r=>s.setSectionContentInEditor(r,e,o))},focusSection:e=>{i(t=>{if(e==="body"){let r=t.state.doc.content.size-1;t.state.doc.descendants((l,f)=>(l.type.name==="sectionDivider"&&r===t.state.doc.content.size-1&&(r=f-1),r===t.state.doc.content.size-1)),r<1&&(r=1),t.chain().focus().setTextSelection(r).run();return}let o=-1;t.state.doc.descendants((r,l)=>{if(o!==-1)return!1;r.type.name==="sectionDivider"&&r.attrs.sectionId===e&&(o=l+r.nodeSize+1)}),o!==-1&&t.chain().focus().setTextSelection(o).run()})},clearSection:e=>{i(t=>s.setSectionContentInEditor(t,e,"<p></p>"))},getBodyContent:()=>n?s.extractBodyContent(n):{html:"",text:"",isEmpty:!0,characterCount:0},setBodyContent:e=>{const t=s.normalizeHtml(e);i(o=>s.setSectionContentInEditor(o,"body",t))},setBodyAndSections:(e,t)=>{const o=s.buildSectionedContent(s.normalizeHtml(e),t.map(r=>({id:r.id,content:s.normalizeHtml(r.content)})));i(r=>r.commands.setContent(o,{emitUpdate:!0}))},appendBodyContent:e=>{const t=s.normalizeHtml(e);i(o=>{const r=s.findSectionEndPos(o,"body");o.commands.insertContentAt(r-1,t,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionStart:(e,t)=>{const o=s.normalizeHtml(t);i(r=>{const l=s.findSectionStartPos(r,e);l!==-1&&r.commands.insertContentAt(l,o,{parseOptions:{preserveWhitespace:!0}})})},insertAtSectionEnd:(e,t)=>{const o=s.normalizeHtml(t);i(r=>{const l=s.findSectionEndPos(r,e);r.commands.insertContentAt(l,o,{parseOptions:{preserveWhitespace:!0}})})},getActiveFormats:()=>n?s.extractActiveFormats(n):Z.DEFAULT_FORMAT_STATE,actions:{toggleBold:()=>n?.chain().focus().toggleBold().run(),toggleItalic:()=>n?.chain().focus().toggleItalic().run(),toggleUnderline:()=>n?.chain().focus().toggleUnderline().run(),toggleStrike:()=>n?.chain().focus().toggleStrike().run(),toggleBulletList:()=>n?.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>n?.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>n?.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>n?.chain().focus().toggleCodeBlock().run(),setTextAlign:e=>n?.chain().focus().setTextAlign(e).run(),setFontFamily:e=>n?.chain().focus().setFontFamily(e).run(),setFontSize:e=>n?.chain().focus().setFontSize(e).run(),setColor:e=>n?.chain().focus().setColor(e).run(),setHighlight:e=>n?.chain().focus().toggleHighlight({color:e}).run(),unsetColor:()=>n?.chain().focus().unsetColor().run(),unsetHighlight:()=>n?.chain().focus().unsetHighlight().run(),setLink:(e,t)=>{n&&(t!==void 0?n.chain().focus().extendMarkRange("link").command(({tr:o,state:r})=>{const{from:l,to:f}=o.selection,V=r.schema.marks.link;if(!V)return!1;const me=r.schema.text(t,[V.create({href:e})]),fe=r.schema.text(" ");return o.replaceWith(l,f,[me,fe]),!0}).run():n.chain().focus().extendMarkRange("link").setLink({href:e}).insertContent(" ").run())},updateLink:e=>n?.chain().focus().extendMarkRange("link").setLink({href:e}).run(),removeLink:()=>n?.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:e=>n?.chain().focus().insertContent(e).run(),insertVariable:e=>n?.chain().focus().insertContent(`{{${e}}}`).run(),insertHtml:e=>n?.commands.insertContent(s.normalizeHtml(e)),undo:()=>n?.chain().focus().undo().run(),redo:()=>n?.chain().focus().redo().run(),canUndo:()=>n?.can().undo()??!1,canRedo:()=>n?.can().redo()??!1,toggleSuperscript:()=>n?.chain().focus().toggleSuperscript().run(),toggleSubscript:()=>n?.chain().focus().toggleSubscript().run(),insertImage:e=>n?.chain().focus().setImage({src:e}).run()},json:S?.jsonMode?{getText:()=>n?s.getCodeBlockText(n):"",setText:e=>i(t=>s.setCodeBlockText(t,e)),parse:()=>s.parseJson(n?s.getCodeBlockText(n):""),isValid:()=>s.parseJson(n?s.getCodeBlockText(n):"").valid,format:(e=2)=>i(t=>{const{valid:o,value:r}=s.parseJson(s.getCodeBlockText(t));!o||r===null||s.setCodeBlockText(t,JSON.stringify(r,null,e))}),minify:()=>i(e=>{const{valid:t,value:o}=s.parseJson(s.getCodeBlockText(e));!t||o===null||s.setCodeBlockText(e,JSON.stringify(o))})}:void 0}),[n]);const de=()=>{if(!n)return;const{valid:e,value:t}=s.parseJson(s.getCodeBlockText(n));!e||t===null||s.setCodeBlockText(n,JSON.stringify(t,null,2))},ue=()=>{n&&(navigator.clipboard?.writeText(s.getCodeBlockText(n)),M(!0),setTimeout(()=>M(!1),1500))};return n?c.jsxs(k.BikEditorShell,{minHeight:oe,maxHeight:se,tightParagraphs:!S?.richPaste,jsonMode:u,style:re,className:ie,children:[u&&c.jsxs(k.BikJsonHeader,{children:[c.jsx("span",{className:"bik-json-header-label",children:"JSON"}),c.jsxs("div",{className:"bik-json-header-actions",children:[c.jsxs("button",{type:"button",onClick:de,disabled:!!m,title:"Format JSON",children:[c.jsx(Ce.default,{size:16}),c.jsx(Q.BodyCaption,{children:"Beautify"})]}),c.jsxs("button",{type:"button",onClick:ue,title:"Copy JSON",children:[c.jsx(ke.default,{size:16}),ce&&c.jsx(Q.BodyCaption,{children:"Copied"})]})]})]}),u?c.jsxs(k.BikJsonBody,{$error:!!m,children:[c.jsx(T.EditorContent,{editor:n}),ae&&c.jsxs(k.BikJsonEmptyState,{"aria-hidden":!0,children:[c.jsx(Se.default,{size:20}),c.jsx("span",{children:p.placeholder??"Type or paste JSON here"})]})]}):c.jsx(T.EditorContent,{editor:n}),c.jsx(pe.LinkBubbleMenu,{editor:n,renderLinkTooltip:te?.renderTooltip}),u&&m?J?J(m):c.jsxs(k.BikJsonError,{children:[c.jsx(xe.default,{size:16}),c.jsxs("span",{children:[m.line!=null&&c.jsxs("strong",{children:["Line ",m.line,m.column!=null?`, column ${m.column}`:"",":"," "]}),m.error]})]}):null]}):null},G=a.forwardRef(Be);G.displayName="BikEditor";exports.BikEditor=G;
2
2
  //# sourceMappingURL=BikEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BikEditor.js","sources":["../../../src/editor/BikEditor.tsx"],"sourcesContent":["'use client';\n\n/**\n * IMPLEMENTATION LAYER — TipTap-specific.\n * If the underlying editor is swapped, this file changes; BikEditor.types.ts and\n * src/editor/index.ts (the consumer contract) do NOT change.\n */\nimport { Editor, getMarkRange } from '@tiptap/core';\nimport { EditorContent, useEditor } from '@tiptap/react';\nimport React, {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { Copy, WandSparkles } from '../icons';\nimport {\n\tBikEditorShell,\n\tBikJsonError,\n\tBikJsonHeader,\n} from './BikEditor.styles';\nimport {\n\tBikEditorProps,\n\tBikEditorRef,\n\tDEFAULT_FORMAT_STATE,\n\tFormatState,\n\tJsonParseResult,\n} from './BikEditor.types';\nimport {\n\tbuildJsonCodeBlockHtml,\n\tbuildSectionedContent,\n\textractActiveFormats,\n\textractBodyContent,\n\textractContent,\n\textractSectionContent,\n\tfindSectionEndPos,\n\tfindSectionStartPos,\n\tgetCodeBlockText,\n\tinsertInlineHtml,\n\tnormalizeHtml,\n\tparseJson,\n\tsetCodeBlockText,\n\tsetSectionContentInEditor,\n} from './BikEditor.utils';\nimport { buildExtensions } from './extensions/buildExtensions';\nimport { LinkBubbleMenu } from './floating/LinkBubbleMenu';\n\n/** Convert React.CSSProperties to an inline CSS string for editorProps.attributes. */\nfunction cssToString(style: React.CSSProperties): string {\n\treturn Object.entries(style)\n\t\t.map(\n\t\t\t([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${v}`,\n\t\t)\n\t\t.join(';');\n}\n\nconst BikEditorInner = (\n\tprops: BikEditorProps,\n\tref: React.Ref<BikEditorRef>,\n) => {\n\tconst {\n\t\tinitialContent,\n\t\tsections,\n\t\tfeatures,\n\t\tdisabled,\n\t\tmaxCharacters,\n\t\tcharacterLimit,\n\t\tshortcuts,\n\t\tsendShortcut,\n\t\tmentions,\n\t\tslashCommands,\n\t\tlink,\n\t\tonPaste,\n\t\tonReady,\n\t\tonChange,\n\t\tonSend,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonSelectionChange,\n\t\tminHeight,\n\t\tmaxHeight,\n\t\tstyle,\n\t\tclassName,\n\t\teditorClassName,\n\t\teditorStyle,\n\t\trenderJsonError,\n\t} = props;\n\n\tconst isJsonMode = !!features?.jsonMode;\n\n\t// Live JSON parse error, shown inside the editor when jsonMode is on.\n\t// null = valid (or not applicable) → nothing rendered.\n\tconst [jsonError, setJsonError] = useState<JsonParseResult | null>(null);\n\t// Transient \"Copied\" state for the jsonMode copy button.\n\tconst [jsonCopied, setJsonCopied] = useState(false);\n\n\t// JSON body mode: treat initialContent as raw JSON text and wrap it in a code\n\t// block. Skips section/HTML normalisation entirely.\n\tconst initialEditorContent = isJsonMode\n\t\t? buildJsonCodeBlockHtml(initialContent ?? '')\n\t\t: sections?.length\n\t\t? buildSectionedContent(\n\t\t\t\tnormalizeHtml(initialContent ?? ''),\n\t\t\t\tsections.map((s) => ({ ...s, content: normalizeHtml(s.content) })),\n\t\t )\n\t\t: normalizeHtml(initialContent ?? '');\n\n\t// ── Command queue ─────────────────────────────────────────────────────────\n\t// TipTap's useEditor initializes asynchronously; the editor instance is null\n\t// until the first commit. Any imperative method called before the editor is\n\t// ready is enqueued here and flushed automatically once it becomes non-null.\n\t// Consumers never need setTimeout or readiness guards.\n\tconst pendingQueue = useRef<Array<(e: Editor) => void>>([]);\n\tconst hasCalledOnReady = useRef(false);\n\t// Keep stable refs to all callbacks so useEditor receives the same function\n\t// identity on every render — prevents TipTap from re-registering event\n\t// handlers every time the parent re-renders with new inline function props.\n\tconst onReadyRef = useRef(onReady);\n\tonReadyRef.current = onReady;\n\tconst onChangeRef = useRef(onChange);\n\tonChangeRef.current = onChange;\n\tconst onSelectionChangeRef = useRef(onSelectionChange);\n\tonSelectionChangeRef.current = onSelectionChange;\n\tconst prevFormatsRef = useRef<FormatState>(DEFAULT_FORMAT_STATE);\n\tconst onFocusRef = useRef(onFocus);\n\tonFocusRef.current = onFocus;\n\tconst onBlurRef = useRef(onBlur);\n\tonBlurRef.current = onBlur;\n\tconst onSendRef = useRef(onSend);\n\tonSendRef.current = onSend;\n\tconst agentMentionsRef = useRef(mentions?.agents ?? []);\n\tagentMentionsRef.current = mentions?.agents ?? [];\n\tconst teamMentionsRef = useRef(mentions?.teams ?? []);\n\tteamMentionsRef.current = mentions?.teams ?? [];\n\tconst slashCommandsRef = useRef(slashCommands?.items ?? []);\n\tslashCommandsRef.current = slashCommands?.items ?? [];\n\n\tconst editor = useEditor({\n\t\textensions: buildExtensions({\n\t\t\tfeatures,\n\t\t\tplaceholder: props.placeholder,\n\t\t\tmaxCharacters,\n\t\t\tcharacterLimit,\n\t\t\thasSections: (sections?.length ?? 0) > 0,\n\t\t\tmentions: {\n\t\t\t\tagents: mentions ? agentMentionsRef : undefined,\n\t\t\t\tteams: mentions ? teamMentionsRef : undefined,\n\t\t\t},\n\t\t\tslashCommands: slashCommands ? slashCommandsRef : undefined,\n\t\t\tonPaste,\n\t\t\tonSend: onSend ? (snapshot) => onSendRef.current?.(snapshot) : undefined,\n\t\t\tsendShortcut,\n\t\t\tshortcuts,\n\t\t\tonMentionSelected: mentions?.onSelect,\n\t\t\tonSlashCommandSelected: slashCommands?.onSelect,\n\t\t\trenderMentionItem: mentions?.renderItem,\n\t\t\trenderMentionDropdown: mentions?.renderDropdown,\n\t\t\tremoveMentionTriggerOnDismiss: mentions?.removeTriggerOnDismiss,\n\t\t\trenderSlashCommandItem: slashCommands?.renderItem,\n\t\t\trenderSlashCommandDropdown: slashCommands?.renderDropdown,\n\t\t}),\n\t\tcontent: initialEditorContent,\n\t\teditable: !disabled,\n\t\timmediatelyRender: false, // SSR-safe — NEVER remove this\n\t\teditorProps: {\n\t\t\tattributes: {\n\t\t\t\t...(editorClassName ? { class: editorClassName } : {}),\n\t\t\t\t...(editorStyle ? { style: cssToString(editorStyle) } : {}),\n\t\t\t},\n\t\t},\n\t\tonUpdate: ({ editor: e }) => {\n\t\t\tonChangeRef.current?.(extractContent(e));\n\t\t\tif (isJsonMode) {\n\t\t\t\tconst result = parseJson(getCodeBlockText(e));\n\t\t\t\tsetJsonError(result.valid ? null : result);\n\t\t\t}\n\t\t},\n\t\tonTransaction: ({ editor: e }) => {\n\t\t\tconst next = extractActiveFormats(e);\n\t\t\tconst prev = prevFormatsRef.current;\n\t\t\tconst changed =\n\t\t\t\tprev.bold !== next.bold ||\n\t\t\t\tprev.italic !== next.italic ||\n\t\t\t\tprev.underline !== next.underline ||\n\t\t\t\tprev.strike !== next.strike ||\n\t\t\t\tprev.bulletList !== next.bulletList ||\n\t\t\t\tprev.orderedList !== next.orderedList ||\n\t\t\t\tprev.blockquote !== next.blockquote ||\n\t\t\t\tprev.codeBlock !== next.codeBlock ||\n\t\t\t\tprev.superscript !== next.superscript ||\n\t\t\t\tprev.subscript !== next.subscript ||\n\t\t\t\tprev.textAlign !== next.textAlign ||\n\t\t\t\tprev.fontFamily !== next.fontFamily ||\n\t\t\t\tprev.fontSize !== next.fontSize ||\n\t\t\t\tprev.color !== next.color ||\n\t\t\t\tprev.highlight !== next.highlight ||\n\t\t\t\tprev.link?.href !== next.link?.href;\n\t\t\tif (changed) {\n\t\t\t\tprevFormatsRef.current = next;\n\t\t\t\tonSelectionChangeRef.current?.(next);\n\t\t\t}\n\t\t},\n\t\tonFocus: () => onFocusRef.current?.(),\n\t\tonBlur: () => onBlurRef.current?.(),\n\t});\n\n\t// ── enqueue ───────────────────────────────────────────────────────────────\n\t// Run immediately if the editor is ready; otherwise defer to the queue.\n\t// Closures passed to enqueue MUST capture all parameters explicitly —\n\t// they must NOT close over `editor` (which would be null at enqueue time).\n\tfunction enqueue(op: (e: Editor) => void): void {\n\t\tif (editor) {\n\t\t\top(editor);\n\t\t} else {\n\t\t\tpendingQueue.current.push(op);\n\t\t}\n\t}\n\n\t// Flush the pending queue and fire onReady when editor transitions null → ready.\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\t\tif (pendingQueue.current.length > 0) {\n\t\t\tconst queue = pendingQueue.current.splice(0);\n\t\t\tqueue.forEach((op) => op(editor));\n\t\t}\n\t\tif (!hasCalledOnReady.current) {\n\t\t\thasCalledOnReady.current = true;\n\t\t\tonReadyRef.current?.();\n\t\t}\n\t\t// Surface an error for invalid initialContent immediately on mount.\n\t\tif (isJsonMode) {\n\t\t\tconst result = parseJson(getCodeBlockText(editor));\n\t\t\tsetJsonError(result.valid ? null : result);\n\t\t}\n\t}, [editor, isJsonMode]);\n\n\tuseImperativeHandle(\n\t\tref,\n\t\t() => ({\n\t\t\t// ── Focus ────────────────────────────────────────────────────────\n\t\t\tfocus: (position) => enqueue((e) => e.commands.focus(position)),\n\t\t\tblur: () => enqueue((e) => e.commands.blur()),\n\n\t\t\t// ── Content ──────────────────────────────────────────────────────\n\t\t\tclearContent: () => enqueue((e) => e.commands.clearContent(true)),\n\t\t\tsetContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.setContent(normalised, { emitUpdate: true }));\n\t\t\t},\n\t\t\tinsertContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContent(normalised));\n\t\t\t},\n\t\t\tinsertInlineContent: (html) => {\n\t\t\t\tenqueue((e) => insertInlineHtml(e, html));\n\t\t\t},\n\t\t\tinsertAtStart: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(1, normalised));\n\t\t\t},\n\t\t\tinsertBlock: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\tappendInline: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// doc.content.size is after the last </p> (block boundary).\n\t\t\t\t// Subtract 1 to land inside the last paragraph so text appends\n\t\t\t\t// inline rather than being wrapped in a new paragraph each call.\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size - 1, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\t// Backwards-compatible aliases\n\t\t\tinsertAtEnd(html) {\n\t\t\t\tthis.insertBlock(html);\n\t\t\t},\n\t\t\tappendContent(html) {\n\t\t\t\tthis.appendInline(html);\n\t\t\t},\n\t\t\tgetContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tgetJSON: () => editor?.getJSON() ?? null,\n\t\t\tgetMentions: () => {\n\t\t\t\tconst agentIds = new Set<string>();\n\t\t\t\tconst teamIds = new Set<string>();\n\t\t\t\tif (!editor) return { agentIds: [], teamIds: [] };\n\t\t\t\teditor.state.doc.descendants((node) => {\n\t\t\t\t\tif (node.type.name === 'mentionAgent' && node.attrs['id'] != null) {\n\t\t\t\t\t\tagentIds.add(String(node.attrs['id']));\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tnode.type.name === 'mentionTeam' &&\n\t\t\t\t\t\tnode.attrs['id'] != null\n\t\t\t\t\t) {\n\t\t\t\t\t\tteamIds.add(String(node.attrs['id']));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn { agentIds: Array.from(agentIds), teamIds: Array.from(teamIds) };\n\t\t\t},\n\n\t\t\t// ── Selection ────────────────────────────────────────────────────\n\t\t\tgetCursorPosition: () => {\n\t\t\t\tif (!editor) return { from: 0, to: 0 };\n\t\t\t\tconst { from, to } = editor.state.selection;\n\t\t\t\treturn { from, to };\n\t\t\t},\n\t\t\tinsertAtPosition: (pos, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(pos, normalised));\n\t\t\t},\n\t\t\tgetSelectedText: () => {\n\t\t\t\tif (!editor) return '';\n\t\t\t\tconst { state } = editor;\n\t\t\t\tconst { from, to, empty } = state.selection;\n\t\t\t\tif (!empty) {\n\t\t\t\t\treturn state.doc.textBetween(from, to, ' ');\n\t\t\t\t}\n\t\t\t\t// When the cursor is inside a link with nothing selected, return the\n\t\t\t\t// full link text — useful for pre-filling a link modal's text field.\n\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\tif (linkMarkType) {\n\t\t\t\t\tconst range = getMarkRange(state.doc.resolve(from), linkMarkType);\n\t\t\t\t\tif (range) {\n\t\t\t\t\t\treturn state.doc.textBetween(range.from, range.to, ' ');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t},\n\n\t\t\t// ── Character count ───────────────────────────────────────────────\n\t\t\tgetCharacterCount: () => ({\n\t\t\t\tcount:\n\t\t\t\t\teditor?.storage.characterCount?.characters?.() ??\n\t\t\t\t\teditor?.getText().length ??\n\t\t\t\t\t0,\n\t\t\t\tlimit: maxCharacters ?? null,\n\t\t\t}),\n\n\t\t\t// ── Sections ─────────────────────────────────────────────────────\n\t\t\tgetSectionContent: (sectionId) =>\n\t\t\t\teditor\n\t\t\t\t\t? extractSectionContent(editor, sectionId)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\n\t\t\tsetSectionContent: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, normalised));\n\t\t\t},\n\n\t\t\tfocusSection: (sectionId) => {\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tif (sectionId === 'body') {\n\t\t\t\t\t\tlet endOfBody = e.state.doc.content.size - 1;\n\t\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\t\tendOfBody === e.state.doc.content.size - 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tendOfBody = pos - 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn endOfBody === e.state.doc.content.size - 1;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (endOfBody < 1) endOfBody = 1;\n\t\t\t\t\t\te.chain().focus().setTextSelection(endOfBody).run();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet targetPos = -1;\n\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\tif (targetPos !== -1) return false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// pos + nodeSize lands right after the divider;\n\t\t\t\t\t\t\t// +1 more puts us inside the first paragraph of that section.\n\t\t\t\t\t\t\ttargetPos = pos + node.nodeSize + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (targetPos !== -1) {\n\t\t\t\t\t\te.chain().focus().setTextSelection(targetPos).run();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tclearSection: (sectionId) => {\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, '<p></p>'));\n\t\t\t},\n\n\t\t\t// ── Convenience body shorthands ───────────────────────────────────\n\t\t\tgetBodyContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractBodyContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tsetBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, 'body', normalised));\n\t\t\t},\n\t\t\tsetBodyAndSections: (body, sections) => {\n\t\t\t\tconst html = buildSectionedContent(\n\t\t\t\t\tnormalizeHtml(body),\n\t\t\t\t\tsections.map((s) => ({\n\t\t\t\t\t\tid: s.id,\n\t\t\t\t\t\tcontent: normalizeHtml(s.content),\n\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t\tenqueue((e) => e.commands.setContent(html, { emitUpdate: true }));\n\t\t\t},\n\t\t\tappendBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// findSectionEndPos returns the position of the first divider (or\n\t\t\t\t// doc.content.size), which is the block boundary after the last </p>.\n\t\t\t\t// Subtract 1 to stay inside the last paragraph so successive calls\n\t\t\t\t// append inline text rather than creating a new paragraph each time.\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst boundaryPos = findSectionEndPos(e, 'body');\n\t\t\t\t\te.commands.insertContentAt(boundaryPos - 1, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionStart: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionStartPos(e, sectionId);\n\t\t\t\t\tif (pos !== -1)\n\t\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionEnd: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionEndPos(e, sectionId);\n\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t// ── Formats & actions ─────────────────────────────────────────────\n\t\t\tgetActiveFormats: () =>\n\t\t\t\teditor ? extractActiveFormats(editor) : DEFAULT_FORMAT_STATE,\n\t\t\tactions: {\n\t\t\t\ttoggleBold: () => editor?.chain().focus().toggleBold().run(),\n\t\t\t\ttoggleItalic: () => editor?.chain().focus().toggleItalic().run(),\n\t\t\t\ttoggleUnderline: () => editor?.chain().focus().toggleUnderline().run(),\n\t\t\t\ttoggleStrike: () => editor?.chain().focus().toggleStrike().run(),\n\t\t\t\ttoggleBulletList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBulletList().run(),\n\t\t\t\ttoggleOrderedList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleOrderedList().run(),\n\t\t\t\ttoggleBlockquote: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBlockquote().run(),\n\t\t\t\ttoggleCodeBlock: () => editor?.chain().focus().toggleCodeBlock().run(),\n\t\t\t\tsetTextAlign: (align) =>\n\t\t\t\t\teditor?.chain().focus().setTextAlign(align).run(),\n\t\t\t\tsetFontFamily: (font) =>\n\t\t\t\t\teditor?.chain().focus().setFontFamily(font).run(),\n\t\t\t\tsetFontSize: (size) => editor?.chain().focus().setFontSize(size).run(),\n\t\t\t\tsetColor: (color) => editor?.chain().focus().setColor(color).run(),\n\t\t\t\tsetHighlight: (color) =>\n\t\t\t\t\teditor?.chain().focus().toggleHighlight({ color }).run(),\n\t\t\t\tunsetColor: () => editor?.chain().focus().unsetColor().run(),\n\t\t\t\tunsetHighlight: () => editor?.chain().focus().unsetHighlight().run(),\n\t\t\t\tsetLink: (href, text) => {\n\t\t\t\t\tif (!editor) return;\n\t\t\t\t\tif (text !== undefined) {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.command(({ tr, state }) => {\n\t\t\t\t\t\t\t\tconst { from, to } = tr.selection;\n\t\t\t\t\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\t\t\t\t\tif (!linkMarkType) return false;\n\t\t\t\t\t\t\t\tconst linkNode = state.schema.text(text, [\n\t\t\t\t\t\t\t\t\tlinkMarkType.create({ href }),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\tconst space = state.schema.text(' ');\n\t\t\t\t\t\t\t\ttr.replaceWith(from, to, [linkNode, space]);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t\t.insertContent(' ')\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tupdateLink: (href) =>\n\t\t\t\t\teditor\n\t\t\t\t\t\t?.chain()\n\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t.run(),\n\t\t\t\tremoveLink: () =>\n\t\t\t\t\teditor?.chain().focus().extendMarkRange('link').unsetLink().run(),\n\t\t\t\tinsertEmoji: (emoji) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(emoji).run(),\n\t\t\t\tinsertVariable: (variableName) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(`{{${variableName}}}`).run(),\n\t\t\t\tinsertHtml: (html) =>\n\t\t\t\t\teditor?.commands.insertContent(normalizeHtml(html)),\n\t\t\t\tundo: () => editor?.chain().focus().undo().run(),\n\t\t\t\tredo: () => editor?.chain().focus().redo().run(),\n\t\t\t\tcanUndo: () => editor?.can().undo() ?? false,\n\t\t\t\tcanRedo: () => editor?.can().redo() ?? false,\n\t\t\t\ttoggleSuperscript: () =>\n\t\t\t\t\teditor?.chain().focus().toggleSuperscript().run(),\n\t\t\t\ttoggleSubscript: () => editor?.chain().focus().toggleSubscript().run(),\n\t\t\t\tinsertImage: (src) => editor?.chain().focus().setImage({ src }).run(),\n\t\t\t},\n\n\t\t\t// ── JSON body ─────────────────────────────────────────────────────\n\t\t\tjson: features?.jsonMode\n\t\t\t\t? {\n\t\t\t\t\t\tgetText: () => (editor ? getCodeBlockText(editor) : ''),\n\t\t\t\t\t\tsetText: (raw) => enqueue((e) => setCodeBlockText(e, raw)),\n\t\t\t\t\t\tparse: () => parseJson(editor ? getCodeBlockText(editor) : ''),\n\t\t\t\t\t\tisValid: () =>\n\t\t\t\t\t\t\tparseJson(editor ? getCodeBlockText(editor) : '').valid,\n\t\t\t\t\t\tformat: (indent = 2) =>\n\t\t\t\t\t\t\tenqueue((e) => {\n\t\t\t\t\t\t\t\tconst { valid, value } = parseJson(getCodeBlockText(e));\n\t\t\t\t\t\t\t\tif (!valid || value === null) return;\n\t\t\t\t\t\t\t\tsetCodeBlockText(e, JSON.stringify(value, null, indent));\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tminify: () =>\n\t\t\t\t\t\t\tenqueue((e) => {\n\t\t\t\t\t\t\t\tconst { valid, value } = parseJson(getCodeBlockText(e));\n\t\t\t\t\t\t\t\tif (!valid || value === null) return;\n\t\t\t\t\t\t\t\tsetCodeBlockText(e, JSON.stringify(value));\n\t\t\t\t\t\t\t}),\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t}),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[editor],\n\t);\n\n\t// ── jsonMode floating actions ────────────────────────────────────────────\n\t// Beautify pretty-prints in place (no-op / disabled while the JSON is broken);\n\t// Copy writes the raw text to the clipboard with transient feedback.\n\tconst handleJsonBeautify = () => {\n\t\tif (!editor) return;\n\t\tconst { valid, value } = parseJson(getCodeBlockText(editor));\n\t\tif (!valid || value === null) return;\n\t\tsetCodeBlockText(editor, JSON.stringify(value, null, 2));\n\t};\n\tconst handleJsonCopy = () => {\n\t\tif (!editor) return;\n\t\tvoid navigator.clipboard?.writeText(getCodeBlockText(editor));\n\t\tsetJsonCopied(true);\n\t\tsetTimeout(() => setJsonCopied(false), 1500);\n\t};\n\n\tif (!editor) return null;\n\n\treturn (\n\t\t<BikEditorShell\n\t\t\tminHeight={minHeight}\n\t\t\tmaxHeight={maxHeight}\n\t\t\ttightParagraphs={!features?.richPaste}\n\t\t\tjsonMode={isJsonMode}\n\t\t\tstyle={style}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{isJsonMode && (\n\t\t\t\t<BikJsonHeader>\n\t\t\t\t\t<span className=\"bik-json-header-label\">JSON</span>\n\t\t\t\t\t<div className=\"bik-json-header-actions\">\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleJsonBeautify}\n\t\t\t\t\t\t\tdisabled={!!jsonError}\n\t\t\t\t\t\t\ttitle=\"Format JSON\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WandSparkles size={16} />\n\t\t\t\t\t\t\t<BodyCaption>Beautify</BodyCaption>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button type=\"button\" onClick={handleJsonCopy} title=\"Copy JSON\">\n\t\t\t\t\t\t\t<Copy size={16} />\n\t\t\t\t\t\t\t{jsonCopied && <BodyCaption>Copied</BodyCaption>}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</BikJsonHeader>\n\t\t\t)}\n\t\t\t<EditorContent editor={editor} />\n\t\t\t<LinkBubbleMenu editor={editor} renderLinkTooltip={link?.renderTooltip} />\n\t\t\t{isJsonMode && jsonError ? (\n\t\t\t\trenderJsonError ? (\n\t\t\t\t\trenderJsonError(jsonError)\n\t\t\t\t) : (\n\t\t\t\t\t<BikJsonError>\n\t\t\t\t\t\t{jsonError.line != null && (\n\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\tLine {jsonError.line}\n\t\t\t\t\t\t\t\t{jsonError.column != null ? `, column ${jsonError.column}` : ''}\n\t\t\t\t\t\t\t\t:{' '}\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{jsonError.error}\n\t\t\t\t\t</BikJsonError>\n\t\t\t\t)\n\t\t\t) : null}\n\t\t</BikEditorShell>\n\t);\n};\n\nexport const BikEditor = forwardRef<BikEditorRef, BikEditorProps>(\n\tBikEditorInner,\n);\nBikEditor.displayName = 'BikEditor';\n"],"names":["cssToString","style","k","v","c","BikEditorInner","props","ref","initialContent","sections","features","disabled","maxCharacters","characterLimit","shortcuts","sendShortcut","mentions","slashCommands","link","onPaste","onReady","onChange","onSend","onFocus","onBlur","onSelectionChange","minHeight","maxHeight","className","editorClassName","editorStyle","renderJsonError","isJsonMode","jsonError","setJsonError","useState","jsonCopied","setJsonCopied","initialEditorContent","buildJsonCodeBlockHtml","buildSectionedContent","normalizeHtml","s","pendingQueue","useRef","hasCalledOnReady","onReadyRef","onChangeRef","onSelectionChangeRef","prevFormatsRef","DEFAULT_FORMAT_STATE","onFocusRef","onBlurRef","onSendRef","agentMentionsRef","teamMentionsRef","slashCommandsRef","editor","useEditor","buildExtensions","snapshot","extractContent","result","parseJson","getCodeBlockText","next","extractActiveFormats","prev","enqueue","op","useEffect","useImperativeHandle","position","e","html","normalised","insertInlineHtml","agentIds","teamIds","node","from","to","pos","state","empty","linkMarkType","range","getMarkRange","sectionId","extractSectionContent","setSectionContentInEditor","endOfBody","targetPos","extractBodyContent","body","boundaryPos","findSectionEndPos","findSectionStartPos","align","font","size","color","href","text","tr","linkNode","space","emoji","variableName","src","raw","setCodeBlockText","indent","valid","value","handleJsonBeautify","handleJsonCopy","jsxs","BikEditorShell","BikJsonHeader","jsx","WandSparkles","BodyCaption","Copy","EditorContent","LinkBubbleMenu","BikJsonError","BikEditor","forwardRef"],"mappings":"mjBAkDA,SAASA,GAAYC,EAAoC,CACxD,OAAO,OAAO,QAAQA,CAAK,EACzB,IACA,CAAC,CAACC,EAAGC,CAAC,IAAM,GAAGD,EAAE,QAAQ,WAAaE,GAAM,IAAIA,EAAE,YAAA,CAAa,EAAE,CAAC,IAAID,CAAC,EAAA,EAEvE,KAAK,GAAG,CACX,CAEA,MAAME,GAAiB,CACtBC,EACAC,IACI,CACJ,KAAM,CACL,eAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,cAAAC,EACA,eAAAC,EACA,UAAAC,EACA,aAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,GACA,QAAAC,GACA,QAAAC,EACA,SAAAC,EACA,OAAAC,EACA,QAAAC,EACA,OAAAC,EACA,kBAAAC,EACA,UAAAC,GACA,UAAAC,GACA,MAAA1B,GACA,UAAA2B,GACA,gBAAAC,EACA,YAAAC,EACA,gBAAAC,CAAA,EACGzB,EAEE0B,EAAa,CAAC,CAACtB,GAAU,SAIzB,CAACuB,EAAWC,CAAY,EAAIC,EAAAA,SAAiC,IAAI,EAEjE,CAACC,GAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAI5CG,GAAuBN,EAC1BO,yBAAuB/B,GAAkB,EAAE,EAC3CC,GAAU,OACV+B,EAAAA,sBACAC,EAAAA,cAAcjC,GAAkB,EAAE,EAClCC,EAAS,IAAKiC,IAAO,CAAE,GAAGA,EAAG,QAASD,gBAAcC,EAAE,OAAO,GAAI,CAAA,EAEjED,EAAAA,cAAcjC,GAAkB,EAAE,EAO/BmC,EAAeC,EAAAA,OAAmC,EAAE,EACpDC,EAAmBD,EAAAA,OAAO,EAAK,EAI/BE,EAAaF,EAAAA,OAAOxB,CAAO,EACjC0B,EAA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AAAI,EAAAA,IAACG,GAAAA,QAAA,CAAK,KAAM,EAAA,CAAI,EACfvF,IAAcoF,EAAAA,IAACE,EAAAA,YAAA,CAAY,SAAA,QAAA,CAAM,CAAA,CAAA,CACnC,CAAA,CAAA,CACD,CAAA,EACD,EAEDF,MAACI,EAAAA,eAAc,OAAAnE,EAAgB,EAC/B+D,EAAAA,IAACK,GAAAA,eAAA,CAAe,OAAApE,EAAgB,kBAAmBvC,IAAM,cAAe,EACvEc,GAAcC,EACdF,EACCA,EAAgBE,CAAS,SAExB6F,eAAA,CACC,SAAA,CAAA7F,EAAU,MAAQ,MAClBoF,EAAAA,KAAC,SAAA,CAAO,SAAA,CAAA,QACDpF,EAAU,KACfA,EAAU,QAAU,KAAO,YAAYA,EAAU,MAAM,GAAK,GAAG,IAC9D,GAAA,EACH,EAEAA,EAAU,KAAA,CAAA,CACZ,EAEE,IAAA,CAAA,CAAA,EAhDc,IAmDrB,EAEa8F,EAAYC,EAAAA,WACxB3H,EACD,EACA0H,EAAU,YAAc"}
1
+ {"version":3,"file":"BikEditor.js","sources":["../../../src/editor/BikEditor.tsx"],"sourcesContent":["'use client';\n\n/**\n * IMPLEMENTATION LAYER — TipTap-specific.\n * If the underlying editor is swapped, this file changes; BikEditor.types.ts and\n * src/editor/index.ts (the consumer contract) do NOT change.\n */\nimport { Editor, getMarkRange } from '@tiptap/core';\nimport { EditorContent, useEditor } from '@tiptap/react';\nimport React, {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { Code, Copy, Info, WandSparkles } from '../icons';\nimport {\n\tBikEditorShell,\n\tBikJsonBody,\n\tBikJsonEmptyState,\n\tBikJsonError,\n\tBikJsonHeader,\n} from './BikEditor.styles';\nimport {\n\tBikEditorProps,\n\tBikEditorRef,\n\tDEFAULT_FORMAT_STATE,\n\tFormatState,\n\tJsonParseResult,\n} from './BikEditor.types';\nimport {\n\tbuildJsonCodeBlockHtml,\n\tbuildSectionedContent,\n\textractActiveFormats,\n\textractBodyContent,\n\textractContent,\n\textractSectionContent,\n\tfindSectionEndPos,\n\tfindSectionStartPos,\n\tgetCodeBlockText,\n\tinsertInlineHtml,\n\tnormalizeHtml,\n\tparseJson,\n\tsetCodeBlockText,\n\tsetSectionContentInEditor,\n} from './BikEditor.utils';\nimport { buildExtensions } from './extensions/buildExtensions';\nimport { LinkBubbleMenu } from './floating/LinkBubbleMenu';\n\n/** Convert React.CSSProperties to an inline CSS string for editorProps.attributes. */\nfunction cssToString(style: React.CSSProperties): string {\n\treturn Object.entries(style)\n\t\t.map(\n\t\t\t([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${v}`,\n\t\t)\n\t\t.join(';');\n}\n\nconst BikEditorInner = (\n\tprops: BikEditorProps,\n\tref: React.Ref<BikEditorRef>,\n) => {\n\tconst {\n\t\tinitialContent,\n\t\tsections,\n\t\tfeatures,\n\t\tdisabled,\n\t\tmaxCharacters,\n\t\tcharacterLimit,\n\t\tshortcuts,\n\t\tsendShortcut,\n\t\tmentions,\n\t\tslashCommands,\n\t\tlink,\n\t\tonPaste,\n\t\tonReady,\n\t\tonChange,\n\t\tonSend,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonSelectionChange,\n\t\tminHeight,\n\t\tmaxHeight,\n\t\tstyle,\n\t\tclassName,\n\t\teditorClassName,\n\t\teditorStyle,\n\t\trenderJsonError,\n\t} = props;\n\n\tconst isJsonMode = !!features?.jsonMode;\n\n\t// Live JSON parse error, shown inside the editor when jsonMode is on.\n\t// null = valid (or not applicable) → nothing rendered.\n\tconst [jsonError, setJsonError] = useState<JsonParseResult | null>(null);\n\t// Transient \"Copied\" state for the jsonMode copy button.\n\tconst [jsonCopied, setJsonCopied] = useState(false);\n\t// jsonMode: no content yet → centered code-glyph + placeholder overlay.\n\tconst [jsonEmpty, setJsonEmpty] = useState(\n\t\tisJsonMode && !(initialContent ?? '').trim(),\n\t);\n\n\t// JSON body mode: treat initialContent as raw JSON text and wrap it in a code\n\t// block. Skips section/HTML normalisation entirely.\n\tconst initialEditorContent = isJsonMode\n\t\t? buildJsonCodeBlockHtml(initialContent ?? '')\n\t\t: sections?.length\n\t\t? buildSectionedContent(\n\t\t\t\tnormalizeHtml(initialContent ?? ''),\n\t\t\t\tsections.map((s) => ({ ...s, content: normalizeHtml(s.content) })),\n\t\t )\n\t\t: normalizeHtml(initialContent ?? '');\n\n\t// ── Command queue ─────────────────────────────────────────────────────────\n\t// TipTap's useEditor initializes asynchronously; the editor instance is null\n\t// until the first commit. Any imperative method called before the editor is\n\t// ready is enqueued here and flushed automatically once it becomes non-null.\n\t// Consumers never need setTimeout or readiness guards.\n\tconst pendingQueue = useRef<Array<(e: Editor) => void>>([]);\n\tconst hasCalledOnReady = useRef(false);\n\t// Keep stable refs to all callbacks so useEditor receives the same function\n\t// identity on every render — prevents TipTap from re-registering event\n\t// handlers every time the parent re-renders with new inline function props.\n\tconst onReadyRef = useRef(onReady);\n\tonReadyRef.current = onReady;\n\tconst onChangeRef = useRef(onChange);\n\tonChangeRef.current = onChange;\n\tconst onSelectionChangeRef = useRef(onSelectionChange);\n\tonSelectionChangeRef.current = onSelectionChange;\n\tconst prevFormatsRef = useRef<FormatState>(DEFAULT_FORMAT_STATE);\n\tconst onFocusRef = useRef(onFocus);\n\tonFocusRef.current = onFocus;\n\tconst onBlurRef = useRef(onBlur);\n\tonBlurRef.current = onBlur;\n\tconst onSendRef = useRef(onSend);\n\tonSendRef.current = onSend;\n\tconst agentMentionsRef = useRef(mentions?.agents ?? []);\n\tagentMentionsRef.current = mentions?.agents ?? [];\n\tconst teamMentionsRef = useRef(mentions?.teams ?? []);\n\tteamMentionsRef.current = mentions?.teams ?? [];\n\tconst slashCommandsRef = useRef(slashCommands?.items ?? []);\n\tslashCommandsRef.current = slashCommands?.items ?? [];\n\n\tconst editor = useEditor({\n\t\textensions: buildExtensions({\n\t\t\tfeatures,\n\t\t\tplaceholder: props.placeholder,\n\t\t\tmaxCharacters,\n\t\t\tcharacterLimit,\n\t\t\thasSections: (sections?.length ?? 0) > 0,\n\t\t\tmentions: {\n\t\t\t\tagents: mentions ? agentMentionsRef : undefined,\n\t\t\t\tteams: mentions ? teamMentionsRef : undefined,\n\t\t\t},\n\t\t\tslashCommands: slashCommands ? slashCommandsRef : undefined,\n\t\t\tonPaste,\n\t\t\tonSend: onSend ? (snapshot) => onSendRef.current?.(snapshot) : undefined,\n\t\t\tsendShortcut,\n\t\t\tshortcuts,\n\t\t\tonMentionSelected: mentions?.onSelect,\n\t\t\tonSlashCommandSelected: slashCommands?.onSelect,\n\t\t\trenderMentionItem: mentions?.renderItem,\n\t\t\trenderMentionDropdown: mentions?.renderDropdown,\n\t\t\tremoveMentionTriggerOnDismiss: mentions?.removeTriggerOnDismiss,\n\t\t\trenderSlashCommandItem: slashCommands?.renderItem,\n\t\t\trenderSlashCommandDropdown: slashCommands?.renderDropdown,\n\t\t}),\n\t\tcontent: initialEditorContent,\n\t\teditable: !disabled,\n\t\timmediatelyRender: false, // SSR-safe — NEVER remove this\n\t\teditorProps: {\n\t\t\tattributes: {\n\t\t\t\t...(editorClassName ? { class: editorClassName } : {}),\n\t\t\t\t...(editorStyle ? { style: cssToString(editorStyle) } : {}),\n\t\t\t},\n\t\t},\n\t\tonUpdate: ({ editor: e }) => {\n\t\t\tonChangeRef.current?.(extractContent(e));\n\t\t\tif (isJsonMode) {\n\t\t\t\tconst text = getCodeBlockText(e);\n\t\t\t\tconst result = parseJson(text);\n\t\t\t\tsetJsonError(result.valid ? null : result);\n\t\t\t\tsetJsonEmpty(!text.trim());\n\t\t\t}\n\t\t},\n\t\tonTransaction: ({ editor: e }) => {\n\t\t\tconst next = extractActiveFormats(e);\n\t\t\tconst prev = prevFormatsRef.current;\n\t\t\tconst changed =\n\t\t\t\tprev.bold !== next.bold ||\n\t\t\t\tprev.italic !== next.italic ||\n\t\t\t\tprev.underline !== next.underline ||\n\t\t\t\tprev.strike !== next.strike ||\n\t\t\t\tprev.bulletList !== next.bulletList ||\n\t\t\t\tprev.orderedList !== next.orderedList ||\n\t\t\t\tprev.blockquote !== next.blockquote ||\n\t\t\t\tprev.codeBlock !== next.codeBlock ||\n\t\t\t\tprev.superscript !== next.superscript ||\n\t\t\t\tprev.subscript !== next.subscript ||\n\t\t\t\tprev.textAlign !== next.textAlign ||\n\t\t\t\tprev.fontFamily !== next.fontFamily ||\n\t\t\t\tprev.fontSize !== next.fontSize ||\n\t\t\t\tprev.color !== next.color ||\n\t\t\t\tprev.highlight !== next.highlight ||\n\t\t\t\tprev.link?.href !== next.link?.href;\n\t\t\tif (changed) {\n\t\t\t\tprevFormatsRef.current = next;\n\t\t\t\tonSelectionChangeRef.current?.(next);\n\t\t\t}\n\t\t},\n\t\tonFocus: () => onFocusRef.current?.(),\n\t\tonBlur: () => onBlurRef.current?.(),\n\t});\n\n\t// ── enqueue ───────────────────────────────────────────────────────────────\n\t// Run immediately if the editor is ready; otherwise defer to the queue.\n\t// Closures passed to enqueue MUST capture all parameters explicitly —\n\t// they must NOT close over `editor` (which would be null at enqueue time).\n\tfunction enqueue(op: (e: Editor) => void): void {\n\t\tif (editor) {\n\t\t\top(editor);\n\t\t} else {\n\t\t\tpendingQueue.current.push(op);\n\t\t}\n\t}\n\n\t// Flush the pending queue and fire onReady when editor transitions null → ready.\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\t\tif (pendingQueue.current.length > 0) {\n\t\t\tconst queue = pendingQueue.current.splice(0);\n\t\t\tqueue.forEach((op) => op(editor));\n\t\t}\n\t\tif (!hasCalledOnReady.current) {\n\t\t\thasCalledOnReady.current = true;\n\t\t\tonReadyRef.current?.();\n\t\t}\n\t\t// Surface an error for invalid initialContent immediately on mount.\n\t\tif (isJsonMode) {\n\t\t\tconst text = getCodeBlockText(editor);\n\t\t\tconst result = parseJson(text);\n\t\t\tsetJsonError(result.valid ? null : result);\n\t\t\tsetJsonEmpty(!text.trim());\n\t\t}\n\t}, [editor, isJsonMode]);\n\n\tuseImperativeHandle(\n\t\tref,\n\t\t() => ({\n\t\t\t// ── Focus ────────────────────────────────────────────────────────\n\t\t\tfocus: (position) => enqueue((e) => e.commands.focus(position)),\n\t\t\tblur: () => enqueue((e) => e.commands.blur()),\n\n\t\t\t// ── Content ──────────────────────────────────────────────────────\n\t\t\tclearContent: () => enqueue((e) => e.commands.clearContent(true)),\n\t\t\tsetContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.setContent(normalised, { emitUpdate: true }));\n\t\t\t},\n\t\t\tinsertContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContent(normalised));\n\t\t\t},\n\t\t\tinsertInlineContent: (html) => {\n\t\t\t\tenqueue((e) => insertInlineHtml(e, html));\n\t\t\t},\n\t\t\tinsertAtStart: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(1, normalised));\n\t\t\t},\n\t\t\tinsertBlock: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\tappendInline: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// doc.content.size is after the last </p> (block boundary).\n\t\t\t\t// Subtract 1 to land inside the last paragraph so text appends\n\t\t\t\t// inline rather than being wrapped in a new paragraph each call.\n\t\t\t\tenqueue((e) =>\n\t\t\t\t\te.commands.insertContentAt(e.state.doc.content.size - 1, normalised),\n\t\t\t\t);\n\t\t\t},\n\t\t\t// Backwards-compatible aliases\n\t\t\tinsertAtEnd(html) {\n\t\t\t\tthis.insertBlock(html);\n\t\t\t},\n\t\t\tappendContent(html) {\n\t\t\t\tthis.appendInline(html);\n\t\t\t},\n\t\t\tgetContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tgetJSON: () => editor?.getJSON() ?? null,\n\t\t\tgetMentions: () => {\n\t\t\t\tconst agentIds = new Set<string>();\n\t\t\t\tconst teamIds = new Set<string>();\n\t\t\t\tif (!editor) return { agentIds: [], teamIds: [] };\n\t\t\t\teditor.state.doc.descendants((node) => {\n\t\t\t\t\tif (node.type.name === 'mentionAgent' && node.attrs['id'] != null) {\n\t\t\t\t\t\tagentIds.add(String(node.attrs['id']));\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tnode.type.name === 'mentionTeam' &&\n\t\t\t\t\t\tnode.attrs['id'] != null\n\t\t\t\t\t) {\n\t\t\t\t\t\tteamIds.add(String(node.attrs['id']));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn { agentIds: Array.from(agentIds), teamIds: Array.from(teamIds) };\n\t\t\t},\n\n\t\t\t// ── Selection ────────────────────────────────────────────────────\n\t\t\tgetCursorPosition: () => {\n\t\t\t\tif (!editor) return { from: 0, to: 0 };\n\t\t\t\tconst { from, to } = editor.state.selection;\n\t\t\t\treturn { from, to };\n\t\t\t},\n\t\t\tinsertAtPosition: (pos, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => e.commands.insertContentAt(pos, normalised));\n\t\t\t},\n\t\t\tgetSelectedText: () => {\n\t\t\t\tif (!editor) return '';\n\t\t\t\tconst { state } = editor;\n\t\t\t\tconst { from, to, empty } = state.selection;\n\t\t\t\tif (!empty) {\n\t\t\t\t\treturn state.doc.textBetween(from, to, ' ');\n\t\t\t\t}\n\t\t\t\t// When the cursor is inside a link with nothing selected, return the\n\t\t\t\t// full link text — useful for pre-filling a link modal's text field.\n\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\tif (linkMarkType) {\n\t\t\t\t\tconst range = getMarkRange(state.doc.resolve(from), linkMarkType);\n\t\t\t\t\tif (range) {\n\t\t\t\t\t\treturn state.doc.textBetween(range.from, range.to, ' ');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t},\n\n\t\t\t// ── Character count ───────────────────────────────────────────────\n\t\t\tgetCharacterCount: () => ({\n\t\t\t\tcount:\n\t\t\t\t\teditor?.storage.characterCount?.characters?.() ??\n\t\t\t\t\teditor?.getText().length ??\n\t\t\t\t\t0,\n\t\t\t\tlimit: maxCharacters ?? null,\n\t\t\t}),\n\n\t\t\t// ── Sections ─────────────────────────────────────────────────────\n\t\t\tgetSectionContent: (sectionId) =>\n\t\t\t\teditor\n\t\t\t\t\t? extractSectionContent(editor, sectionId)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\n\t\t\tsetSectionContent: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, normalised));\n\t\t\t},\n\n\t\t\tfocusSection: (sectionId) => {\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tif (sectionId === 'body') {\n\t\t\t\t\t\tlet endOfBody = e.state.doc.content.size - 1;\n\t\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\t\tendOfBody === e.state.doc.content.size - 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tendOfBody = pos - 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn endOfBody === e.state.doc.content.size - 1;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (endOfBody < 1) endOfBody = 1;\n\t\t\t\t\t\te.chain().focus().setTextSelection(endOfBody).run();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tlet targetPos = -1;\n\t\t\t\t\te.state.doc.descendants((node, pos) => {\n\t\t\t\t\t\tif (targetPos !== -1) return false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\t\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// pos + nodeSize lands right after the divider;\n\t\t\t\t\t\t\t// +1 more puts us inside the first paragraph of that section.\n\t\t\t\t\t\t\ttargetPos = pos + node.nodeSize + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (targetPos !== -1) {\n\t\t\t\t\t\te.chain().focus().setTextSelection(targetPos).run();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\n\t\t\tclearSection: (sectionId) => {\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, sectionId, '<p></p>'));\n\t\t\t},\n\n\t\t\t// ── Convenience body shorthands ───────────────────────────────────\n\t\t\tgetBodyContent: () =>\n\t\t\t\teditor\n\t\t\t\t\t? extractBodyContent(editor)\n\t\t\t\t\t: { html: '', text: '', isEmpty: true, characterCount: 0 },\n\t\t\tsetBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => setSectionContentInEditor(e, 'body', normalised));\n\t\t\t},\n\t\t\tsetBodyAndSections: (body, sections) => {\n\t\t\t\tconst html = buildSectionedContent(\n\t\t\t\t\tnormalizeHtml(body),\n\t\t\t\t\tsections.map((s) => ({\n\t\t\t\t\t\tid: s.id,\n\t\t\t\t\t\tcontent: normalizeHtml(s.content),\n\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t\tenqueue((e) => e.commands.setContent(html, { emitUpdate: true }));\n\t\t\t},\n\t\t\tappendBodyContent: (html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\t// findSectionEndPos returns the position of the first divider (or\n\t\t\t\t// doc.content.size), which is the block boundary after the last </p>.\n\t\t\t\t// Subtract 1 to stay inside the last paragraph so successive calls\n\t\t\t\t// append inline text rather than creating a new paragraph each time.\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst boundaryPos = findSectionEndPos(e, 'body');\n\t\t\t\t\te.commands.insertContentAt(boundaryPos - 1, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionStart: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionStartPos(e, sectionId);\n\t\t\t\t\tif (pos !== -1)\n\t\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tinsertAtSectionEnd: (sectionId, html) => {\n\t\t\t\tconst normalised = normalizeHtml(html);\n\t\t\t\tenqueue((e) => {\n\t\t\t\t\tconst pos = findSectionEndPos(e, sectionId);\n\t\t\t\t\te.commands.insertContentAt(pos, normalised, {\n\t\t\t\t\t\tparseOptions: { preserveWhitespace: true },\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\t// ── Formats & actions ─────────────────────────────────────────────\n\t\t\tgetActiveFormats: () =>\n\t\t\t\teditor ? extractActiveFormats(editor) : DEFAULT_FORMAT_STATE,\n\t\t\tactions: {\n\t\t\t\ttoggleBold: () => editor?.chain().focus().toggleBold().run(),\n\t\t\t\ttoggleItalic: () => editor?.chain().focus().toggleItalic().run(),\n\t\t\t\ttoggleUnderline: () => editor?.chain().focus().toggleUnderline().run(),\n\t\t\t\ttoggleStrike: () => editor?.chain().focus().toggleStrike().run(),\n\t\t\t\ttoggleBulletList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBulletList().run(),\n\t\t\t\ttoggleOrderedList: () =>\n\t\t\t\t\teditor?.chain().focus().toggleOrderedList().run(),\n\t\t\t\ttoggleBlockquote: () =>\n\t\t\t\t\teditor?.chain().focus().toggleBlockquote().run(),\n\t\t\t\ttoggleCodeBlock: () => editor?.chain().focus().toggleCodeBlock().run(),\n\t\t\t\tsetTextAlign: (align) =>\n\t\t\t\t\teditor?.chain().focus().setTextAlign(align).run(),\n\t\t\t\tsetFontFamily: (font) =>\n\t\t\t\t\teditor?.chain().focus().setFontFamily(font).run(),\n\t\t\t\tsetFontSize: (size) => editor?.chain().focus().setFontSize(size).run(),\n\t\t\t\tsetColor: (color) => editor?.chain().focus().setColor(color).run(),\n\t\t\t\tsetHighlight: (color) =>\n\t\t\t\t\teditor?.chain().focus().toggleHighlight({ color }).run(),\n\t\t\t\tunsetColor: () => editor?.chain().focus().unsetColor().run(),\n\t\t\t\tunsetHighlight: () => editor?.chain().focus().unsetHighlight().run(),\n\t\t\t\tsetLink: (href, text) => {\n\t\t\t\t\tif (!editor) return;\n\t\t\t\t\tif (text !== undefined) {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.command(({ tr, state }) => {\n\t\t\t\t\t\t\t\tconst { from, to } = tr.selection;\n\t\t\t\t\t\t\t\tconst linkMarkType = state.schema.marks['link'];\n\t\t\t\t\t\t\t\tif (!linkMarkType) return false;\n\t\t\t\t\t\t\t\tconst linkNode = state.schema.text(text, [\n\t\t\t\t\t\t\t\t\tlinkMarkType.create({ href }),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\tconst space = state.schema.text(' ');\n\t\t\t\t\t\t\t\ttr.replaceWith(from, to, [linkNode, space]);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t} else {\n\t\t\t\t\t\teditor\n\t\t\t\t\t\t\t.chain()\n\t\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t\t.insertContent(' ')\n\t\t\t\t\t\t\t.run();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tupdateLink: (href) =>\n\t\t\t\t\teditor\n\t\t\t\t\t\t?.chain()\n\t\t\t\t\t\t.focus()\n\t\t\t\t\t\t.extendMarkRange('link')\n\t\t\t\t\t\t.setLink({ href })\n\t\t\t\t\t\t.run(),\n\t\t\t\tremoveLink: () =>\n\t\t\t\t\teditor?.chain().focus().extendMarkRange('link').unsetLink().run(),\n\t\t\t\tinsertEmoji: (emoji) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(emoji).run(),\n\t\t\t\tinsertVariable: (variableName) =>\n\t\t\t\t\teditor?.chain().focus().insertContent(`{{${variableName}}}`).run(),\n\t\t\t\tinsertHtml: (html) =>\n\t\t\t\t\teditor?.commands.insertContent(normalizeHtml(html)),\n\t\t\t\tundo: () => editor?.chain().focus().undo().run(),\n\t\t\t\tredo: () => editor?.chain().focus().redo().run(),\n\t\t\t\tcanUndo: () => editor?.can().undo() ?? false,\n\t\t\t\tcanRedo: () => editor?.can().redo() ?? false,\n\t\t\t\ttoggleSuperscript: () =>\n\t\t\t\t\teditor?.chain().focus().toggleSuperscript().run(),\n\t\t\t\ttoggleSubscript: () => editor?.chain().focus().toggleSubscript().run(),\n\t\t\t\tinsertImage: (src) => editor?.chain().focus().setImage({ src }).run(),\n\t\t\t},\n\n\t\t\t// ── JSON body ─────────────────────────────────────────────────────\n\t\t\tjson: features?.jsonMode\n\t\t\t\t? {\n\t\t\t\t\t\tgetText: () => (editor ? getCodeBlockText(editor) : ''),\n\t\t\t\t\t\tsetText: (raw) => enqueue((e) => setCodeBlockText(e, raw)),\n\t\t\t\t\t\tparse: () => parseJson(editor ? getCodeBlockText(editor) : ''),\n\t\t\t\t\t\tisValid: () =>\n\t\t\t\t\t\t\tparseJson(editor ? getCodeBlockText(editor) : '').valid,\n\t\t\t\t\t\tformat: (indent = 2) =>\n\t\t\t\t\t\t\tenqueue((e) => {\n\t\t\t\t\t\t\t\tconst { valid, value } = parseJson(getCodeBlockText(e));\n\t\t\t\t\t\t\t\tif (!valid || value === null) return;\n\t\t\t\t\t\t\t\tsetCodeBlockText(e, JSON.stringify(value, null, indent));\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tminify: () =>\n\t\t\t\t\t\t\tenqueue((e) => {\n\t\t\t\t\t\t\t\tconst { valid, value } = parseJson(getCodeBlockText(e));\n\t\t\t\t\t\t\t\tif (!valid || value === null) return;\n\t\t\t\t\t\t\t\tsetCodeBlockText(e, JSON.stringify(value));\n\t\t\t\t\t\t\t}),\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t}),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[editor],\n\t);\n\n\t// ── jsonMode floating actions ────────────────────────────────────────────\n\t// Beautify pretty-prints in place (no-op / disabled while the JSON is broken);\n\t// Copy writes the raw text to the clipboard with transient feedback.\n\tconst handleJsonBeautify = () => {\n\t\tif (!editor) return;\n\t\tconst { valid, value } = parseJson(getCodeBlockText(editor));\n\t\tif (!valid || value === null) return;\n\t\tsetCodeBlockText(editor, JSON.stringify(value, null, 2));\n\t};\n\tconst handleJsonCopy = () => {\n\t\tif (!editor) return;\n\t\tvoid navigator.clipboard?.writeText(getCodeBlockText(editor));\n\t\tsetJsonCopied(true);\n\t\tsetTimeout(() => setJsonCopied(false), 1500);\n\t};\n\n\tif (!editor) return null;\n\n\treturn (\n\t\t<BikEditorShell\n\t\t\tminHeight={minHeight}\n\t\t\tmaxHeight={maxHeight}\n\t\t\ttightParagraphs={!features?.richPaste}\n\t\t\tjsonMode={isJsonMode}\n\t\t\tstyle={style}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{isJsonMode && (\n\t\t\t\t<BikJsonHeader>\n\t\t\t\t\t<span className=\"bik-json-header-label\">JSON</span>\n\t\t\t\t\t<div className=\"bik-json-header-actions\">\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleJsonBeautify}\n\t\t\t\t\t\t\tdisabled={!!jsonError}\n\t\t\t\t\t\t\ttitle=\"Format JSON\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WandSparkles size={16} />\n\t\t\t\t\t\t\t<BodyCaption>Beautify</BodyCaption>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button type=\"button\" onClick={handleJsonCopy} title=\"Copy JSON\">\n\t\t\t\t\t\t\t<Copy size={16} />\n\t\t\t\t\t\t\t{jsonCopied && <BodyCaption>Copied</BodyCaption>}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</BikJsonHeader>\n\t\t\t)}\n\t\t\t{isJsonMode ? (\n\t\t\t\t<BikJsonBody $error={!!jsonError}>\n\t\t\t\t\t<EditorContent editor={editor} />\n\t\t\t\t\t{jsonEmpty && (\n\t\t\t\t\t\t<BikJsonEmptyState aria-hidden>\n\t\t\t\t\t\t\t<Code size={20} />\n\t\t\t\t\t\t\t<span>{props.placeholder ?? 'Type or paste JSON here'}</span>\n\t\t\t\t\t\t</BikJsonEmptyState>\n\t\t\t\t\t)}\n\t\t\t\t</BikJsonBody>\n\t\t\t) : (\n\t\t\t\t<EditorContent editor={editor} />\n\t\t\t)}\n\t\t\t<LinkBubbleMenu editor={editor} renderLinkTooltip={link?.renderTooltip} />\n\t\t\t{isJsonMode && jsonError ? (\n\t\t\t\trenderJsonError ? (\n\t\t\t\t\trenderJsonError(jsonError)\n\t\t\t\t) : (\n\t\t\t\t\t<BikJsonError>\n\t\t\t\t\t\t<Info size={16} />\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{jsonError.line != null && (\n\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\tLine {jsonError.line}\n\t\t\t\t\t\t\t\t\t{jsonError.column != null\n\t\t\t\t\t\t\t\t\t\t? `, column ${jsonError.column}`\n\t\t\t\t\t\t\t\t\t\t: ''}\n\t\t\t\t\t\t\t\t\t:{' '}\n\t\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{jsonError.error}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</BikJsonError>\n\t\t\t\t)\n\t\t\t) : null}\n\t\t</BikEditorShell>\n\t);\n};\n\nexport const BikEditor = forwardRef<BikEditorRef, BikEditorProps>(\n\tBikEditorInner,\n);\nBikEditor.displayName = 'BikEditor';\n"],"names":["cssToString","style","k","v","c","BikEditorInner","props","ref","initialContent","sections","features","disabled","maxCharacters","characterLimit","shortcuts","sendShortcut","mentions","slashCommands","link","onPaste","onReady","onChange","onSend","onFocus","onBlur","onSelectionChange","minHeight","maxHeight","className","editorClassName","editorStyle","renderJsonError","isJsonMode","jsonError","setJsonError","useState","jsonCopied","setJsonCopied","jsonEmpty","setJsonEmpty","initialEditorContent","buildJsonCodeBlockHtml","buildSectionedContent","normalizeHtml","s","pendingQueue","useRef","hasCalledOnReady","onReadyRef","onChangeRef","onSelectionChangeRef","prevFormatsRef","DEFAULT_FORMAT_STATE","onFocusRef","onBlurRef","onSendRef","agentMentionsRef","teamMentionsRef","slashCommandsRef","editor","useEditor","buildExtensions","snapshot","extractContent","text","getCodeBlockText","result","parseJson","next","extractActiveFormats","prev","enqueue","op","useEffect","useImperativeHandle","position","e","html","normalised","insertInlineHtml","agentIds","teamIds","node","from","to","pos","state","empty","linkMarkType","range","getMarkRange","sectionId","extractSectionContent","setSectionContentInEditor","endOfBody","targetPos","extractBodyContent","body","boundaryPos","findSectionEndPos","findSectionStartPos","align","font","size","color","href","tr","linkNode","space","emoji","variableName","src","raw","setCodeBlockText","indent","valid","value","handleJsonBeautify","handleJsonCopy","jsxs","BikEditorShell","BikJsonHeader","jsx","WandSparkles","BodyCaption","Copy","BikJsonBody","EditorContent","BikJsonEmptyState","Code","LinkBubbleMenu","BikJsonError","Info","BikEditor","forwardRef"],"mappings":"8pBAoDA,SAASA,GAAYC,EAAoC,CACxD,OAAO,OAAO,QAAQA,CAAK,EACzB,IACA,CAAC,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M,EAAA,CAAI,EACfzF,IAAcsF,EAAAA,IAACE,EAAAA,YAAA,CAAY,SAAA,QAAA,CAAM,CAAA,CAAA,CACnC,CAAA,CAAA,CACD,CAAA,EACD,EAEA5F,EACAuF,EAAAA,KAACO,cAAA,CAAY,OAAQ,CAAC,CAAC7F,EACtB,SAAA,CAAAyF,MAACK,EAAAA,eAAc,OAAApE,EAAgB,EAC9BrB,IACAiF,EAAAA,KAACS,EAAAA,kBAAA,CAAkB,cAAW,GAC7B,SAAA,CAAAN,EAAAA,IAACO,GAAAA,QAAA,CAAK,KAAM,EAAA,CAAI,EAChBP,EAAAA,IAAC,OAAA,CAAM,SAAApH,EAAM,aAAe,yBAAA,CAA0B,CAAA,CAAA,CACvD,CAAA,CAAA,CAEF,EAEAoH,EAAAA,IAACK,gBAAA,CAAc,OAAApE,CAAA,CAAgB,EAEhC+D,EAAAA,IAACQ,GAAAA,eAAA,CAAe,OAAAvE,EAAgB,kBAAmBzC,IAAM,cAAe,EACvEc,GAAcC,EACdF,EACCA,EAAgBE,CAAS,SAExBkG,eAAA,CACA,SAAA,CAAAT,EAAAA,IAACU,GAAAA,QAAA,CAAK,KAAM,EAAA,CAAI,SACf,OAAA,CACC,SAAA,CAAAnG,EAAU,MAAQ,MAClBsF,EAAAA,KAAC,SAAA,CAAO,SAAA,CAAA,QACDtF,EAAU,KACfA,EAAU,QAAU,KAClB,YAAYA,EAAU,MAAM,GAC5B,GAAG,IACJ,GAAA,EACH,EAEAA,EAAU,KAAA,CAAA,CACZ,CAAA,CAAA,CACD,EAEE,IAAA,CAAA,CAAA,EAjEc,IAoErB,EAEaoG,EAAYC,EAAAA,WACxBjI,EACD,EACAgI,EAAU,YAAc"}
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),o=require("../constants/Theme.js"),i=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},r=i(t),n=r.default.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("styled-components"),e=require("../constants/Theme.js"),i=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},t=i(r),n=t.default.div`
2
2
  position: relative;
3
3
  width: 100%;
4
4
 
5
5
  .ProseMirror {
6
- min-height: ${({minHeight:e})=>e??"60px"};
7
- max-height: ${({maxHeight:e})=>e??"none"};
6
+ min-height: ${({minHeight:o})=>o??"60px"};
7
+ max-height: ${({maxHeight:o})=>o??"none"};
8
8
  overflow-y: auto;
9
9
  outline: none;
10
10
  font-size: 14px;
@@ -21,7 +21,7 @@
21
21
  no paragraph-gap concept — paragraphs are tight (margin:0) regardless of
22
22
  typed vs pasted. (A margin:0 attr still overrides to tight either way.) */
23
23
  p {
24
- margin: ${({tightParagraphs:e})=>e?"0":"1em 0"};
24
+ margin: ${({tightParagraphs:o})=>o?"0":"1em 0"};
25
25
  padding: 0;
26
26
  }
27
27
 
@@ -65,16 +65,16 @@
65
65
  /* Characters pasted beyond the soft character limit — rendered grey so the
66
66
  overflow is visible but clearly marked (see CharacterLimitExtension). */
67
67
  .bik-editor-overflow {
68
- color: ${o.COLORS.content.placeholder};
68
+ color: ${e.COLORS.content.placeholder};
69
69
  }
70
70
  }
71
71
 
72
72
  .bik-mention {
73
- color: ${o.COLORS.content.brand};
73
+ color: ${e.COLORS.content.brand};
74
74
  padding: 1px 4px;
75
75
  }
76
76
  .bik-mention--team {
77
- color: ${o.COLORS.content.brand};
77
+ color: ${e.COLORS.content.brand};
78
78
  }
79
79
  /* Typed mention chips (agent-builder): distinct colour per reference kind. */
80
80
  .bik-mention[data-kind='tool'] {
@@ -93,21 +93,17 @@
93
93
  }
94
94
 
95
95
  /* JSON body mode — scoped so normal-mode code blocks keep their default look
96
- (no reserved gutter, no monospace override). */
97
- ${({jsonMode:e})=>e&&t.css`
98
- /* Self-framed card: the header bar and the code area share one rounded
99
- border, so the component renders as a complete panel without the
100
- consumer having to wrap it. */
101
- border: 1px solid #e1e4e8;
102
- border-radius: 8px;
103
- overflow: hidden;
104
-
96
+ (no reserved gutter, no monospace override). The frame is split: the header
97
+ bar owns the top rounded border, the code area (BikJsonBody) owns its own
98
+ full border so it can recolour on focus / error without touching the
99
+ header. */
100
+ ${({jsonMode:o})=>o&&r.css`
105
101
  /* The code block IS the editor surface, sitting below the header bar.
106
102
  White fills the scroller down to the min-height (no blank strip below
107
103
  short JSON); the header owns the grey. */
108
104
  .ProseMirror {
109
105
  padding: 0;
110
- background: #ffffff;
106
+ background: ${e.COLORS.surface.standard};
111
107
  }
112
108
  /* ProseMirror appends an empty trailing paragraph AFTER the code block
113
109
  (a <p><br class="ProseMirror-trailingBreak"></p> caret-escape node).
@@ -121,8 +117,9 @@
121
117
  margin: 0;
122
118
  background: transparent;
123
119
  /* Left padding reserves the line-number gutter; each .bik-json-lineno
124
- widget hangs back into it with a matching negative margin. */
125
- padding: 12px 12px 12px 3.5em;
120
+ widget hangs back into it with a matching negative margin. Wide
121
+ enough for a 3-digit line number (up to 999). */
122
+ padding: 12px 12px 12px 4.2em;
126
123
  font-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,
127
124
  Consolas, 'Liberation Mono', monospace;
128
125
  font-size: 13px;
@@ -137,22 +134,32 @@
137
134
  font-size: inherit;
138
135
  color: #1f2328;
139
136
  }
140
- /* Line-number gutter. Numbers hang into the code block's left padding via
141
- a negative margin (width + margin-right == the reserved padding, so the
142
- code text still starts at the padding edge). Stacked right borders form
143
- one continuous divider line. */
137
+ /* Line-number gutter a contenteditable=false sibling of <code> rendered
138
+ by the code-block node view (JsonCodeBlockView), absolutely positioned
139
+ into the reserved left padding. It scrolls with <pre> as one block, so
140
+ numbers stay aligned with their lines. Stacked right borders form one
141
+ continuous divider. */
142
+ .bik-json-gutter {
143
+ position: absolute;
144
+ left: 0;
145
+ top: 12px; /* == the code block's padding-top */
146
+ width: 3.5em; /* within the 4.2em reserved left padding */
147
+ display: flex;
148
+ flex-direction: column;
149
+ user-select: none;
150
+ -webkit-user-select: none;
151
+ pointer-events: none;
152
+ }
144
153
  .bik-json-lineno {
145
- display: inline-block;
146
154
  box-sizing: border-box;
147
- width: 2.5em;
148
- margin-left: -3.5em;
149
- margin-right: 1em;
155
+ height: 1.6em; /* == code line-height (13px × 1.6) so rows align */
156
+ line-height: 1.6;
150
157
  padding-right: 0.7em;
151
158
  text-align: right;
152
- color: #8c959f;
153
- border-right: 1px solid #e1e4e8;
154
- user-select: none;
155
- -webkit-user-select: none;
159
+ /* Never let a 3-digit number (e.g. 210) break across two lines. */
160
+ white-space: nowrap;
161
+ color: ${e.COLORS.content.placeholder};
162
+ border-right: 1px solid ${e.COLORS.stroke.primary};
156
163
  }
157
164
  .bik-json-key {
158
165
  color: #0550ae;
@@ -185,62 +192,98 @@
185
192
  text-decoration-color: #6366f1;
186
193
  }
187
194
  }
188
- `,a=r.default.div`
195
+ `,a=t.default.div`
189
196
  display: flex;
190
197
  align-items: center;
191
198
  justify-content: space-between;
192
199
  gap: 8px;
193
200
  padding: 8px 12px;
194
- background: #f6f8fa;
195
- border-bottom: 1px solid #e1e4e8;
201
+ background: ${e.COLORS.surface.subdued};
202
+ border: 1px solid ${e.COLORS.stroke.primary};
203
+ border-bottom: none;
204
+ border-radius: 4px 4px 0 0;
196
205
 
197
206
  .bik-json-header-label {
198
207
  font-family: inherit;
199
208
  font-size: 14px;
200
- font-weight: 500;
201
- color: #3c4149;
209
+ line-height: 20px;
210
+ font-weight: 400;
211
+ color: ${e.COLORS.content.secondary};
202
212
  user-select: none;
203
213
  }
204
214
 
205
215
  .bik-json-header-actions {
206
216
  display: flex;
207
- gap: 6px;
217
+ gap: 8px;
208
218
  }
209
219
 
210
220
  button {
211
221
  display: inline-flex;
212
222
  align-items: center;
213
- gap: 6px;
214
- padding: 6px 10px;
223
+ gap: 4px;
224
+ height: 28px;
225
+ padding: 0 8px;
215
226
  font-family: inherit;
216
- font-size: 13px;
217
- line-height: 1.4;
218
- color: #3c4149;
219
- background: #ffffff;
220
- border: 1px solid #d0d7de;
221
- border-radius: 6px;
227
+ font-size: 12px;
228
+ line-height: 16px;
229
+ color: ${e.COLORS.content.secondary};
230
+ background: ${e.COLORS.surface.standard};
231
+ border: 1px solid ${e.COLORS.stroke.primary};
232
+ border-radius: 4px;
222
233
  cursor: pointer;
223
234
 
224
235
  &:hover:not(:disabled) {
225
- background: #f3f4f6;
226
- border-color: #adb5bd;
236
+ background: ${e.COLORS.surface.subdued};
227
237
  }
228
238
  &:disabled {
229
239
  opacity: 0.5;
230
240
  cursor: not-allowed;
231
241
  }
232
242
  }
233
- `,d=r.default.div`
234
- padding: 6px 12px;
243
+ `,s=t.default.div`
244
+ position: relative;
245
+ overflow: hidden;
246
+ background: ${e.COLORS.surface.standard};
247
+ border: 1px solid
248
+ ${({$error:o})=>o?e.COLORS.content.negative:e.COLORS.stroke.primary};
249
+ border-radius: 0 0 4px 4px;
250
+
251
+ &:focus-within {
252
+ border-color: ${({$error:o})=>o?e.COLORS.content.negative:e.BASE_COLORS.brand[800]};
253
+ }
254
+ `,d=t.default.div`
255
+ position: absolute;
256
+ inset: 0;
257
+ display: flex;
258
+ flex-direction: column;
259
+ align-items: center;
260
+ justify-content: center;
261
+ gap: 8px;
262
+ color: ${e.COLORS.content.placeholder};
263
+ font-size: 14px;
264
+ line-height: 20px;
265
+ pointer-events: none;
266
+ user-select: none;
267
+ `,l=t.default.div`
268
+ display: flex;
269
+ align-items: flex-start;
270
+ gap: 8px;
271
+ margin-top: 8px;
272
+ padding: 12px;
235
273
  font-size: 12px;
236
- line-height: 1.5;
237
- color: #d1242f;
238
- background: #fff0f0;
239
- border-top: 1px solid #ffd7d5;
274
+ line-height: 16px;
275
+ color: ${e.COLORS.content.negative};
276
+ background: ${e.COLORS.background.negative.light};
277
+ border: 1px solid ${e.COLORS.stroke.negative.lightAlt};
278
+ border-radius: 4px;
240
279
  word-break: break-word;
241
280
 
281
+ svg {
282
+ flex-shrink: 0;
283
+ }
284
+
242
285
  strong {
243
286
  font-weight: 600;
244
287
  }
245
- `;exports.BikEditorShell=n;exports.BikJsonError=d;exports.BikJsonHeader=a;
288
+ `;exports.BikEditorShell=n;exports.BikJsonBody=s;exports.BikJsonEmptyState=d;exports.BikJsonError=l;exports.BikJsonHeader=a;
246
289
  //# sourceMappingURL=BikEditor.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n\ttightParagraphs?: boolean;\n\tjsonMode?: boolean;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '60px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\t/* Paragraph spacing.\n\t\t Email/signature (rich): paragraphs carry the browser-default 1em block\n\t\t margin — the SAME spacing the sent HTML gets (we emit plain <p>, which\n\t\t renders against the default <p> margin in Gmail and our email viewer),\n\t\t so editor view == emitted HTML == Gmail. A single Enter = a new\n\t\t paragraph with a visible gap, like pasted Gmail/ChatGPT/Docs content.\n\t\t Other channels (WhatsApp/IG/FB/comments) are plain-text messaging, with\n\t\t no paragraph-gap concept — paragraphs are tight (margin:0) regardless of\n\t\t typed vs pasted. (A margin:0 attr still overrides to tight either way.) */\n\t\tp {\n\t\t\tmargin: ${({ tightParagraphs }) => (tightParagraphs ? '0' : '1em 0')};\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\t/* The empty placeholder paragraph shouldn't inherit the rich-mode 1em\n\t\t block margin (email/SMTP/signature) — otherwise the placeholder text\n\t\t is pushed down. Real (non-empty) paragraphs keep their spacing. */\n\t\tp.is-editor-empty:first-child {\n\t\t\tmargin: 0;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\n\t\t/* hidden in-flow copy of the placeholder so a multi-line\n\t\t placeholder grows the editor instead of showing a scrollbar (the\n\t\t zero-height float above adds no height). -1lh cancels the caret line. */\n\t\tp.is-editor-empty:first-child::after {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tdisplay: block;\n\t\t\tvisibility: hidden;\n\t\t\tpointer-events: none;\n\t\t\tmargin-top: -1.5em; /* one line at the editor's line-height: 1.5 */\n\t\t\tmargin-top: -1lh;\n\t\t}\n\n\t\t/* Characters pasted beyond the soft character limit — rendered grey so the\n\t\t overflow is visible but clearly marked (see CharacterLimitExtension). */\n\t\t.bik-editor-overflow {\n\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t/* Typed mention chips (agent-builder): distinct colour per reference kind. */\n\t.bik-mention[data-kind='tool'] {\n\t\tcolor: #1570ef;\n\t\tbackground: #eff8ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='subagent'] {\n\t\tcolor: #6938ef;\n\t\tbackground: #f4f3ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-variable {\n\t}\n\n\t/* JSON body mode — scoped so normal-mode code blocks keep their default look\n\t (no reserved gutter, no monospace override). */\n\t${({ jsonMode }) =>\n\t\tjsonMode &&\n\t\tcss`\n\t\t\t/* Self-framed card: the header bar and the code area share one rounded\n\t\t\t border, so the component renders as a complete panel without the\n\t\t\t consumer having to wrap it. */\n\t\t\tborder: 1px solid #e1e4e8;\n\t\t\tborder-radius: 8px;\n\t\t\toverflow: hidden;\n\n\t\t\t/* The code block IS the editor surface, sitting below the header bar.\n\t\t\t White fills the scroller down to the min-height (no blank strip below\n\t\t\t short JSON); the header owns the grey. */\n\t\t\t.ProseMirror {\n\t\t\t\tpadding: 0;\n\t\t\t\tbackground: #ffffff;\n\t\t\t}\n\t\t\t/* ProseMirror appends an empty trailing paragraph AFTER the code block\n\t\t\t (a <p><br class=\"ProseMirror-trailingBreak\"></p> caret-escape node).\n\t\t\t In JSON mode there's nothing to escape to — it only renders as a blank\n\t\t\t line under the JSON, which is the \"extra space at the bottom\". Hide it. */\n\t\t\t.ProseMirror pre + p {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t.ProseMirror pre {\n\t\t\t\tposition: relative;\n\t\t\t\tmargin: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\t/* Left padding reserves the line-number gutter; each .bik-json-lineno\n\t\t\t\t widget hangs back into it with a matching negative margin. */\n\t\t\t\tpadding: 12px 12px 12px 3.5em;\n\t\t\t\tfont-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,\n\t\t\t\t\tConsolas, 'Liberation Mono', monospace;\n\t\t\t\tfont-size: 13px;\n\t\t\t\tline-height: 1.6;\n\t\t\t\twhite-space: pre;\n\t\t\t\toverflow-x: auto;\n\t\t\t\ttab-size: 2;\n\t\t\t}\n\t\t\t.ProseMirror pre code {\n\t\t\t\tbackground: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tfont-size: inherit;\n\t\t\t\tcolor: #1f2328;\n\t\t\t}\n\t\t\t/* Line-number gutter. Numbers hang into the code block's left padding via\n\t\t\t a negative margin (width + margin-right == the reserved padding, so the\n\t\t\t code text still starts at the padding edge). Stacked right borders form\n\t\t\t one continuous divider line. */\n\t\t\t.bik-json-lineno {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: 2.5em;\n\t\t\t\tmargin-left: -3.5em;\n\t\t\t\tmargin-right: 1em;\n\t\t\t\tpadding-right: 0.7em;\n\t\t\t\ttext-align: right;\n\t\t\t\tcolor: #8c959f;\n\t\t\t\tborder-right: 1px solid #e1e4e8;\n\t\t\t\tuser-select: none;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t}\n\t\t\t.bik-json-key {\n\t\t\t\tcolor: #0550ae;\n\t\t\t}\n\t\t\t.bik-json-string {\n\t\t\t\tcolor: #0a7d33;\n\t\t\t}\n\t\t\t.bik-json-number {\n\t\t\t\tcolor: #b5590a;\n\t\t\t}\n\t\t\t.bik-json-boolean,\n\t\t\t.bik-json-null {\n\t\t\t\tcolor: #8250df;\n\t\t\t\tfont-weight: 500;\n\t\t\t}\n\t\t\t.bik-json-punct {\n\t\t\t\tcolor: #57606a;\n\t\t\t}\n\t\t`}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode header bar: a \"JSON\" label on the left and the Beautify / Copy actions\n * on the right, sitting above the code area with a bottom divider. Grey fill sets\n * it apart from the white code surface below (see the jsonMode block above).\n */\nexport const BikJsonHeader = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tpadding: 8px 12px;\n\tbackground: #f6f8fa;\n\tborder-bottom: 1px solid #e1e4e8;\n\n\t.bik-json-header-label {\n\t\tfont-family: inherit;\n\t\tfont-size: 14px;\n\t\tfont-weight: 500;\n\t\tcolor: #3c4149;\n\t\tuser-select: none;\n\t}\n\n\t.bik-json-header-actions {\n\t\tdisplay: flex;\n\t\tgap: 6px;\n\t}\n\n\tbutton {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: 6px;\n\t\tpadding: 6px 10px;\n\t\tfont-family: inherit;\n\t\tfont-size: 13px;\n\t\tline-height: 1.4;\n\t\tcolor: #3c4149;\n\t\tbackground: #ffffff;\n\t\tborder: 1px solid #d0d7de;\n\t\tborder-radius: 6px;\n\t\tcursor: pointer;\n\n\t\t&:hover:not(:disabled) {\n\t\t\tbackground: #f3f4f6;\n\t\t\tborder-color: #adb5bd;\n\t\t}\n\t\t&:disabled {\n\t\t\topacity: 0.5;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n`;\n\n/** Inline JSON parse-error banner rendered by BikEditor in jsonMode. */\nexport const BikJsonError = styled.div`\n\tpadding: 6px 12px;\n\tfont-size: 12px;\n\tline-height: 1.5;\n\tcolor: #d1242f;\n\tbackground: #fff0f0;\n\tborder-top: 1px solid #ffd7d5;\n\tword-break: break-word;\n\n\tstrong {\n\t\tfont-weight: 600;\n\t}\n`;\n"],"names":["BikEditorShell","styled","minHeight","maxHeight","tightParagraphs","COLORS","jsonMode","css","BikJsonHeader","BikJsonError"],"mappings":"uNAGaA,EAAiBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAUrB,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA,gBACtC,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAiBzC,CAAC,CAAE,gBAAAC,CAAA,IAAuBA,EAAkB,IAAM,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgDvBQ,EAAeR,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
1
+ {"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { BASE_COLORS, COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n\ttightParagraphs?: boolean;\n\tjsonMode?: boolean;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '60px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\t/* Paragraph spacing.\n\t\t Email/signature (rich): paragraphs carry the browser-default 1em block\n\t\t margin — the SAME spacing the sent HTML gets (we emit plain <p>, which\n\t\t renders against the default <p> margin in Gmail and our email viewer),\n\t\t so editor view == emitted HTML == Gmail. A single Enter = a new\n\t\t paragraph with a visible gap, like pasted Gmail/ChatGPT/Docs content.\n\t\t Other channels (WhatsApp/IG/FB/comments) are plain-text messaging, with\n\t\t no paragraph-gap concept — paragraphs are tight (margin:0) regardless of\n\t\t typed vs pasted. (A margin:0 attr still overrides to tight either way.) */\n\t\tp {\n\t\t\tmargin: ${({ tightParagraphs }) => (tightParagraphs ? '0' : '1em 0')};\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\t/* The empty placeholder paragraph shouldn't inherit the rich-mode 1em\n\t\t block margin (email/SMTP/signature) — otherwise the placeholder text\n\t\t is pushed down. Real (non-empty) paragraphs keep their spacing. */\n\t\tp.is-editor-empty:first-child {\n\t\t\tmargin: 0;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\n\t\t/* hidden in-flow copy of the placeholder so a multi-line\n\t\t placeholder grows the editor instead of showing a scrollbar (the\n\t\t zero-height float above adds no height). -1lh cancels the caret line. */\n\t\tp.is-editor-empty:first-child::after {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tdisplay: block;\n\t\t\tvisibility: hidden;\n\t\t\tpointer-events: none;\n\t\t\tmargin-top: -1.5em; /* one line at the editor's line-height: 1.5 */\n\t\t\tmargin-top: -1lh;\n\t\t}\n\n\t\t/* Characters pasted beyond the soft character limit — rendered grey so the\n\t\t overflow is visible but clearly marked (see CharacterLimitExtension). */\n\t\t.bik-editor-overflow {\n\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t/* Typed mention chips (agent-builder): distinct colour per reference kind. */\n\t.bik-mention[data-kind='tool'] {\n\t\tcolor: #1570ef;\n\t\tbackground: #eff8ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-mention[data-kind='subagent'] {\n\t\tcolor: #6938ef;\n\t\tbackground: #f4f3ff;\n\t\tborder-radius: 4px;\n\t\tfont-weight: 500;\n\t}\n\t.bik-variable {\n\t}\n\n\t/* JSON body mode — scoped so normal-mode code blocks keep their default look\n\t (no reserved gutter, no monospace override). The frame is split: the header\n\t bar owns the top rounded border, the code area (BikJsonBody) owns its own\n\t full border so it can recolour on focus / error without touching the\n\t header. */\n\t${({ jsonMode }) =>\n\t\tjsonMode &&\n\t\tcss`\n\t\t\t/* The code block IS the editor surface, sitting below the header bar.\n\t\t\t White fills the scroller down to the min-height (no blank strip below\n\t\t\t short JSON); the header owns the grey. */\n\t\t\t.ProseMirror {\n\t\t\t\tpadding: 0;\n\t\t\t\tbackground: ${COLORS.surface.standard};\n\t\t\t}\n\t\t\t/* ProseMirror appends an empty trailing paragraph AFTER the code block\n\t\t\t (a <p><br class=\"ProseMirror-trailingBreak\"></p> caret-escape node).\n\t\t\t In JSON mode there's nothing to escape to — it only renders as a blank\n\t\t\t line under the JSON, which is the \"extra space at the bottom\". Hide it. */\n\t\t\t.ProseMirror pre + p {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t.ProseMirror pre {\n\t\t\t\tposition: relative;\n\t\t\t\tmargin: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\t/* Left padding reserves the line-number gutter; each .bik-json-lineno\n\t\t\t\t widget hangs back into it with a matching negative margin. Wide\n\t\t\t\t enough for a 3-digit line number (up to 999). */\n\t\t\t\tpadding: 12px 12px 12px 4.2em;\n\t\t\t\tfont-family: 'SFMono-Regular', ui-monospace, 'JetBrains Mono', Menlo,\n\t\t\t\t\tConsolas, 'Liberation Mono', monospace;\n\t\t\t\tfont-size: 13px;\n\t\t\t\tline-height: 1.6;\n\t\t\t\twhite-space: pre;\n\t\t\t\toverflow-x: auto;\n\t\t\t\ttab-size: 2;\n\t\t\t}\n\t\t\t.ProseMirror pre code {\n\t\t\t\tbackground: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tfont-size: inherit;\n\t\t\t\tcolor: #1f2328;\n\t\t\t}\n\t\t\t/* Line-number gutter — a contenteditable=false sibling of <code> rendered\n\t\t\t by the code-block node view (JsonCodeBlockView), absolutely positioned\n\t\t\t into the reserved left padding. It scrolls with <pre> as one block, so\n\t\t\t numbers stay aligned with their lines. Stacked right borders form one\n\t\t\t continuous divider. */\n\t\t\t.bik-json-gutter {\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 0;\n\t\t\t\ttop: 12px; /* == the code block's padding-top */\n\t\t\t\twidth: 3.5em; /* within the 4.2em reserved left padding */\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\tuser-select: none;\n\t\t\t\t-webkit-user-select: none;\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\t\t\t.bik-json-lineno {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\theight: 1.6em; /* == code line-height (13px × 1.6) so rows align */\n\t\t\t\tline-height: 1.6;\n\t\t\t\tpadding-right: 0.7em;\n\t\t\t\ttext-align: right;\n\t\t\t\t/* Never let a 3-digit number (e.g. 210) break across two lines. */\n\t\t\t\twhite-space: nowrap;\n\t\t\t\tcolor: ${COLORS.content.placeholder};\n\t\t\t\tborder-right: 1px solid ${COLORS.stroke.primary};\n\t\t\t}\n\t\t\t.bik-json-key {\n\t\t\t\tcolor: #0550ae;\n\t\t\t}\n\t\t\t.bik-json-string {\n\t\t\t\tcolor: #0a7d33;\n\t\t\t}\n\t\t\t.bik-json-number {\n\t\t\t\tcolor: #b5590a;\n\t\t\t}\n\t\t\t.bik-json-boolean,\n\t\t\t.bik-json-null {\n\t\t\t\tcolor: #8250df;\n\t\t\t\tfont-weight: 500;\n\t\t\t}\n\t\t\t.bik-json-punct {\n\t\t\t\tcolor: #57606a;\n\t\t\t}\n\t\t`}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode header bar: a \"JSON\" label on the left and the Beautify / Copy actions\n * on the right. Owns the frame's top rounded border (no bottom edge — the code\n * area below draws its own top border, so the seam stays a single line even when\n * it recolours on focus/error). Grey fill sets it apart from the white code\n * surface below.\n */\nexport const BikJsonHeader = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tpadding: 8px 12px;\n\tbackground: ${COLORS.surface.subdued};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-bottom: none;\n\tborder-radius: 4px 4px 0 0;\n\n\t.bik-json-header-label {\n\t\tfont-family: inherit;\n\t\tfont-size: 14px;\n\t\tline-height: 20px;\n\t\tfont-weight: 400;\n\t\tcolor: ${COLORS.content.secondary};\n\t\tuser-select: none;\n\t}\n\n\t.bik-json-header-actions {\n\t\tdisplay: flex;\n\t\tgap: 8px;\n\t}\n\n\tbutton {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: 4px;\n\t\theight: 28px;\n\t\tpadding: 0 8px;\n\t\tfont-family: inherit;\n\t\tfont-size: 12px;\n\t\tline-height: 16px;\n\t\tcolor: ${COLORS.content.secondary};\n\t\tbackground: ${COLORS.surface.standard};\n\t\tborder: 1px solid ${COLORS.stroke.primary};\n\t\tborder-radius: 4px;\n\t\tcursor: pointer;\n\n\t\t&:hover:not(:disabled) {\n\t\t\tbackground: ${COLORS.surface.subdued};\n\t\t}\n\t\t&:disabled {\n\t\t\topacity: 0.5;\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n`;\n\n/**\n * jsonMode code surface below the header. Owns the recolourable border: brand on\n * focus, negative when the JSON is invalid (error wins over focus).\n */\nexport const BikJsonBody = styled.div<{ $error?: boolean }>`\n\tposition: relative;\n\toverflow: hidden;\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid\n\t\t${({ $error }) =>\n\t\t\t$error ? COLORS.content.negative : COLORS.stroke.primary};\n\tborder-radius: 0 0 4px 4px;\n\n\t&:focus-within {\n\t\tborder-color: ${({ $error }) =>\n\t\t\t$error ? COLORS.content.negative : BASE_COLORS.brand['800']};\n\t}\n`;\n\n/**\n * jsonMode empty state: a centered code glyph + placeholder line over the code\n * area. Pointer-events off so clicks focus the editor.\n */\nexport const BikJsonEmptyState = styled.div`\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: ${COLORS.content.placeholder};\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpointer-events: none;\n\tuser-select: none;\n`;\n\n/**\n * JSON parse-error alert rendered by BikEditor in jsonMode: a standalone rounded\n * card below the code area.\n */\nexport const BikJsonError = styled.div`\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 8px;\n\tmargin-top: 8px;\n\tpadding: 12px;\n\tfont-size: 12px;\n\tline-height: 16px;\n\tcolor: ${COLORS.content.negative};\n\tbackground: ${COLORS.background.negative.light};\n\tborder: 1px solid ${COLORS.stroke.negative.lightAlt};\n\tborder-radius: 4px;\n\tword-break: break-word;\n\n\tsvg {\n\t\tflex-shrink: 0;\n\t}\n\n\tstrong {\n\t\tfont-weight: 600;\n\t}\n`;\n"],"names":["BikEditorShell","styled","minHeight","maxHeight","tightParagraphs","COLORS","jsonMode","css","BikJsonHeader","BikJsonBody","$error","BASE_COLORS","BikJsonEmptyState","BikJsonError"],"mappings":"uNAGaA,EAAiBC,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAUrB,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA,gBACtC,CAAC,CAAE,UAAAC,KAAgBA,GAAa,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAiBzC,CAAC,CAAE,gBAAAC,CAAA,IAAuBA,EAAkB,IAAM,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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