@luzmo/analytics-components-kit 1.0.3-beta.5 → 1.0.3-beta.7

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 (249) hide show
  1. package/components/ai-chat/ai-chat-request.d.ts +11 -0
  2. package/components/ai-chat/ai-chat.d.ts +72 -51
  3. package/components/ai-chat/ai-prompt-types.d.ts +93 -0
  4. package/components/ai-chat/empty-state/ai-chat-empty-state.d.ts +46 -0
  5. package/components/ai-chat/empty-state/index.d.ts +8 -0
  6. package/components/ai-chat/empty-state/types.d.ts +14 -0
  7. package/components/ai-chat/index.cjs +1 -1
  8. package/components/ai-chat/index.d.ts +11 -4
  9. package/components/ai-chat/index.js +2 -2
  10. package/components/ai-chat/session/ai-chat-session-controller.d.ts +51 -0
  11. package/components/ai-chat/session/ai-chat-session-types.d.ts +86 -0
  12. package/components/ai-chat/session/ai-chat-session.d.ts +81 -0
  13. package/components/ai-chat/session/index.d.ts +2 -0
  14. package/components/ai-chat/{ai-chat-streaming.d.ts → stream/ai-chat-streaming.d.ts} +6 -0
  15. package/components/ai-chat/stream/analyst-handler.d.ts +3 -0
  16. package/components/ai-chat/stream/dashboard-handler.d.ts +4 -0
  17. package/components/ai-chat/stream/index.d.ts +8 -0
  18. package/components/ai-chat/stream/item-handler.d.ts +2 -0
  19. package/components/ai-chat/stream/registry.d.ts +5 -0
  20. package/components/ai-chat/stream/shared.d.ts +10 -0
  21. package/components/ai-chat/stream/types.d.ts +26 -0
  22. package/components/ai-chat-BITPlYbm.cjs +178 -0
  23. package/components/ai-chat-D6fgbjA2.js +1861 -0
  24. package/components/ai-interaction-textarea/index.cjs +1 -1
  25. package/components/ai-interaction-textarea/index.js +1 -1
  26. package/components/{ai-interaction-textarea-BXmgedJt.js → ai-interaction-textarea-C1DMkiX9.js} +3 -3
  27. package/components/{ai-interaction-textarea-CogE101T.cjs → ai-interaction-textarea-wt2weV1c.cjs} +1 -1
  28. package/components/{base-BAzY-whv.js → base-D82dU2vv.js} +1 -1
  29. package/components/{base-CbpjVnVy.cjs → base-iNk9N4Tk.cjs} +1 -1
  30. package/components/data-field/index.cjs +1 -1
  31. package/components/data-field/index.js +1 -1
  32. package/components/{data-field-tfAMLb-d.js → data-field-2gH1_AhT.js} +3 -3
  33. package/components/{data-field-97uH3l6o.cjs → data-field-DDO-2ESu.cjs} +1 -1
  34. package/components/data-field-level/index.cjs +1 -1
  35. package/components/data-field-level/index.js +1 -1
  36. package/components/{data-field-level-BsDTHrJ6.js → data-field-level-2h8s8KK1.js} +1 -1
  37. package/components/{data-field-level-6npuFtQo.cjs → data-field-level-COl8ZWdN.cjs} +1 -1
  38. package/components/data-field-panel/index.cjs +1 -1
  39. package/components/data-field-panel/index.js +1 -1
  40. package/components/{data-field-panel-Dv5nfM0z.cjs → data-field-panel-CgfuCAp8.cjs} +1 -1
  41. package/components/{data-field-panel-P2t8d6sG.js → data-field-panel-P9QrDHMI.js} +3 -3
  42. package/components/data-fields-select/index.cjs +1 -1
  43. package/components/data-fields-select/index.js +1 -1
  44. package/components/{data-fields-select-DHnnYhbr.js → data-fields-select-1I8-Brdz.js} +1 -1
  45. package/components/{data-fields-select-B7vJTdZO.cjs → data-fields-select-Cudq0iLk.cjs} +1 -1
  46. package/components/dataset-selector-list/index.cjs +1 -1
  47. package/components/dataset-selector-list/index.js +1 -1
  48. package/components/{dataset-selector-list-DbCmavOc.cjs → dataset-selector-list-BxGYITHM.cjs} +1 -1
  49. package/components/{dataset-selector-list-CXnDkIe2.js → dataset-selector-list-DmbQl9uz.js} +1 -1
  50. package/components/dataset-selector-row/index.cjs +1 -1
  51. package/components/dataset-selector-row/index.js +1 -1
  52. package/components/{dataset-selector-row-Bm60zTbF.cjs → dataset-selector-row-BgGa4uFN.cjs} +1 -1
  53. package/components/{dataset-selector-row-BONcmdL2.js → dataset-selector-row-CaTsyi1d.js} +1 -1
  54. package/components/{de-DMnvmNFg.js → de-DFS1MvFY.js} +6 -1
  55. package/components/de-DWpyMlmz.cjs +20 -0
  56. package/components/display-settings/index.cjs +1 -1
  57. package/components/display-settings/index.js +1 -1
  58. package/components/{display-settings-BLf7lBww.cjs → display-settings-Bfz2tg_G.cjs} +1 -1
  59. package/components/{display-settings-BLMrlvMS.js → display-settings-DWoUj0P7.js} +1 -1
  60. package/components/display-settings-binning/index.cjs +1 -1
  61. package/components/display-settings-binning/index.js +1 -1
  62. package/components/{display-settings-binning-hCJ0qkt5.js → display-settings-binning-BIBzOWZA.js} +2 -2
  63. package/components/{display-settings-binning-BAg6FoqJ.cjs → display-settings-binning-Cf1QlQy6.cjs} +1 -1
  64. package/components/display-settings-datetime/index.cjs +1 -1
  65. package/components/display-settings-datetime/index.js +1 -1
  66. package/components/{display-settings-datetime-BzeNlKLC.cjs → display-settings-datetime-C76Et2ED.cjs} +1 -1
  67. package/components/{display-settings-datetime-CCxok7d7.js → display-settings-datetime-DGlj31eD.js} +2 -2
  68. package/components/display-settings-grand-totals/index.cjs +1 -1
  69. package/components/display-settings-grand-totals/index.js +1 -1
  70. package/components/{display-settings-grand-totals-HDpr3IJ5.cjs → display-settings-grand-totals-By98iKXS.cjs} +1 -1
  71. package/components/{display-settings-grand-totals-C1N1cehl.js → display-settings-grand-totals-ZWO02WXj.js} +2 -2
  72. package/components/display-settings-numeric/index.cjs +1 -1
  73. package/components/display-settings-numeric/index.js +1 -1
  74. package/components/{display-settings-numeric-DSs20wUu.cjs → display-settings-numeric-BPKl9ljn.cjs} +1 -1
  75. package/components/{display-settings-numeric-oyCfBAGV.js → display-settings-numeric-DHvjUxmC.js} +2 -2
  76. package/components/display-settings-period-over-period/index.cjs +1 -1
  77. package/components/display-settings-period-over-period/index.js +1 -1
  78. package/components/{display-settings-period-over-period-h8bA3V5C.js → display-settings-period-over-period-CPsfL-OC.js} +2 -2
  79. package/components/{display-settings-period-over-period-CcX7vQnt.cjs → display-settings-period-over-period-CYwa8_dX.cjs} +1 -1
  80. package/components/es-Bm4nseZH.cjs +20 -0
  81. package/components/{es-Cc258uTs.js → es-C1prodbH.js} +6 -1
  82. package/components/filter-expression-picker/index.cjs +1 -1
  83. package/components/filter-expression-picker/index.js +1 -1
  84. package/components/{filter-expression-picker-BMJkgHu9.cjs → filter-expression-picker-CJB_jgcc.cjs} +1 -1
  85. package/components/{filter-expression-picker-DQP5lkn4.js → filter-expression-picker-DbIwoTsX.js} +1 -1
  86. package/components/filter-item/index.cjs +1 -1
  87. package/components/filter-item/index.js +1 -1
  88. package/components/{filter-item-BXcYNAAm.js → filter-item-BGtJwvjk.js} +4 -4
  89. package/components/{filter-item-D9m378Qo.cjs → filter-item-as8Ocmp3.cjs} +1 -1
  90. package/components/filter-value-picker/index.cjs +1 -1
  91. package/components/filter-value-picker/index.js +1 -1
  92. package/components/{filter-value-picker-YIkbsWDP.cjs → filter-value-picker-BL-1pN_G.cjs} +1 -1
  93. package/components/{filter-value-picker-B-dzcjEo.js → filter-value-picker-BrYCGFst.js} +4 -4
  94. package/components/filter-value-picker-datetime/index.cjs +1 -1
  95. package/components/filter-value-picker-datetime/index.js +1 -1
  96. package/components/{filter-value-picker-datetime-BJMcnoKH.js → filter-value-picker-datetime-BPtF1l_J.js} +1 -1
  97. package/components/{filter-value-picker-datetime-BrrmcjIE.cjs → filter-value-picker-datetime-wXHf2Ybs.cjs} +1 -1
  98. package/components/filter-value-picker-hierarchy/index.cjs +1 -1
  99. package/components/filter-value-picker-hierarchy/index.js +1 -1
  100. package/components/{filter-value-picker-hierarchy-UdDq0CZG.js → filter-value-picker-hierarchy-CDhpfB2Y.js} +2 -2
  101. package/components/{filter-value-picker-hierarchy-B9gDxYna.cjs → filter-value-picker-hierarchy-Cmw2p2K6.cjs} +1 -1
  102. package/components/filter-value-picker-numeric/index.cjs +1 -1
  103. package/components/filter-value-picker-numeric/index.js +1 -1
  104. package/components/{filter-value-picker-numeric-EK515Z-Y.js → filter-value-picker-numeric-BEvT5oKu.js} +1 -1
  105. package/components/{filter-value-picker-numeric-D_dgITCq.cjs → filter-value-picker-numeric-UwkCyHGV.cjs} +1 -1
  106. package/components/filters/index.cjs +1 -1
  107. package/components/filters/index.js +1 -1
  108. package/components/{filters-8ehwgopC.cjs → filters-DdB5-4Db.cjs} +1 -1
  109. package/components/{filters-H2scDNLi.js → filters-ltvxQR-K.js} +2 -2
  110. package/components/{fr-B32d4zcX.js → fr-BMYUCp2R.js} +6 -1
  111. package/components/fr-BPTbVsj0.cjs +20 -0
  112. package/components/{get-dataset-name-7FdLQo10.js → get-dataset-name-BfFHT__k.js} +1 -1
  113. package/components/{get-dataset-name-CrWWViwN.cjs → get-dataset-name-Cl6mPSex.cjs} +1 -1
  114. package/components/index.cjs +1 -1
  115. package/components/index.js +58 -58
  116. package/components/item-grid/helpers/grid-item-popover.d.ts +7 -1
  117. package/components/item-grid/helpers/grid-rendering.d.ts +7 -1
  118. package/components/item-grid/index.cjs +1 -1
  119. package/components/item-grid/index.js +1 -1
  120. package/components/item-grid/item-grid.d.ts +8 -0
  121. package/components/{item-grid-CxblVEy3.cjs → item-grid-DR36E_MC.cjs} +7 -7
  122. package/components/{item-grid-B-IFwriA.js → item-grid-Q0Ggl_US.js} +574 -564
  123. package/components/item-option/index.cjs +1 -1
  124. package/components/item-option/index.js +1 -1
  125. package/components/{item-option-ChsD18x9.cjs → item-option-CbvYq_WJ.cjs} +1 -1
  126. package/components/{item-option-Buxnv89s.js → item-option-DI3KO7QY.js} +1 -1
  127. package/components/item-option-action-button-group/index.cjs +1 -1
  128. package/components/item-option-action-button-group/index.js +1 -1
  129. package/components/{item-option-action-button-group-Cw9EDbG-.cjs → item-option-action-button-group-BnMVlPWX.cjs} +1 -1
  130. package/components/{item-option-action-button-group-QO_darH9.js → item-option-action-button-group-D6IwxNDf.js} +1 -1
  131. package/components/{item-option-base-DjQ5poaH.cjs → item-option-base-CKQPWveC.cjs} +1 -1
  132. package/components/{item-option-base-DMmga0dv.js → item-option-base-DH5wKqEF.js} +1 -1
  133. package/components/item-option-color-palette-picker/index.cjs +1 -1
  134. package/components/item-option-color-palette-picker/index.js +1 -1
  135. package/components/{item-option-color-palette-picker-gZvk4ODA.cjs → item-option-color-palette-picker-h-3xHsR4.cjs} +1 -1
  136. package/components/{item-option-color-palette-picker-CiE_aWRI.js → item-option-color-palette-picker-n_OxJNd9.js} +1 -1
  137. package/components/item-option-color-picker/index.cjs +1 -1
  138. package/components/item-option-color-picker/index.js +1 -1
  139. package/components/{item-option-color-picker-CUskqN3R.js → item-option-color-picker-C1x5vS5d.js} +1 -1
  140. package/components/{item-option-color-picker-DCnGqBgT.cjs → item-option-color-picker-C6LZkkBG.cjs} +1 -1
  141. package/components/item-option-color-range/index.cjs +1 -1
  142. package/components/item-option-color-range/index.js +1 -1
  143. package/components/{item-option-color-range-BgHXTDvx.js → item-option-color-range-B2jermJT.js} +1 -1
  144. package/components/{item-option-color-range-B24EAbUi.cjs → item-option-color-range-DBiG8jhK.cjs} +1 -1
  145. package/components/item-option-multi-language-field/index.cjs +1 -1
  146. package/components/item-option-multi-language-field/index.js +1 -1
  147. package/components/{item-option-multi-language-field-qngZBXHT.js → item-option-multi-language-field-BmJY3dG0.js} +1 -1
  148. package/components/{item-option-multi-language-field-DDIu7Hns.cjs → item-option-multi-language-field-DDeFZMwX.cjs} +1 -1
  149. package/components/item-option-number-field/index.cjs +1 -1
  150. package/components/item-option-number-field/index.js +1 -1
  151. package/components/{item-option-number-field-Cd-cfpaq.js → item-option-number-field-B5ed4vvs.js} +1 -1
  152. package/components/{item-option-number-field-CqrO1Xu0.cjs → item-option-number-field-BJo-SKQB.cjs} +1 -1
  153. package/components/item-option-panel/index.cjs +1 -1
  154. package/components/item-option-panel/index.js +1 -1
  155. package/components/{item-option-panel-DZiOx_sn.js → item-option-panel-B8BKxNPg.js} +2 -2
  156. package/components/{item-option-panel-B26_sDcj.cjs → item-option-panel-Dm34avUG.cjs} +1 -1
  157. package/components/item-option-picker/index.cjs +1 -1
  158. package/components/item-option-picker/index.js +1 -1
  159. package/components/{item-option-picker-LRahjZUz.js → item-option-picker-C8evzSOb.js} +1 -1
  160. package/components/{item-option-picker-B86AqAWp.cjs → item-option-picker-DlbKU1wY.cjs} +1 -1
  161. package/components/item-option-position-picker/index.cjs +1 -1
  162. package/components/item-option-position-picker/index.js +1 -1
  163. package/components/{item-option-position-picker-NUpUlyPV.js → item-option-position-picker-Bue5o0fT.js} +1 -1
  164. package/components/{item-option-position-picker-Cbi2OygH.cjs → item-option-position-picker-CB4Y0Z6D.cjs} +1 -1
  165. package/components/item-option-positions-number-field/index.cjs +1 -1
  166. package/components/item-option-positions-number-field/index.js +1 -1
  167. package/components/{item-option-positions-number-field-BbIkX6wM.cjs → item-option-positions-number-field-Bbru1yNj.cjs} +1 -1
  168. package/components/{item-option-positions-number-field-ClPil6MM.js → item-option-positions-number-field-CdK1WdMx.js} +1 -1
  169. package/components/item-option-radio-button-group/index.cjs +1 -1
  170. package/components/item-option-radio-button-group/index.js +1 -1
  171. package/components/{item-option-radio-button-group-BtYYhQyI.cjs → item-option-radio-button-group-BCiDl5wB.cjs} +1 -1
  172. package/components/{item-option-radio-button-group-Bdd9sU4p.js → item-option-radio-button-group-BlQxNUIM.js} +1 -1
  173. package/components/item-option-slider/index.cjs +1 -1
  174. package/components/item-option-slider/index.js +1 -1
  175. package/components/{item-option-slider-BJ7gVQXP.js → item-option-slider-CX8XWUEP.js} +1 -1
  176. package/components/{item-option-slider-32oGS1fd.cjs → item-option-slider-Db-HdZ9C.cjs} +1 -1
  177. package/components/item-option-switch/index.cjs +1 -1
  178. package/components/item-option-switch/index.js +1 -1
  179. package/components/{item-option-switch-BMVlfdx5.js → item-option-switch-1wVCBJpo.js} +1 -1
  180. package/components/{item-option-switch-BFk3biK9.cjs → item-option-switch-BI0b6qMP.cjs} +1 -1
  181. package/components/item-option-text-field/index.cjs +1 -1
  182. package/components/item-option-text-field/index.js +1 -1
  183. package/components/{item-option-text-field-CWvgQ3pJ.cjs → item-option-text-field-Cuo1cBWG.cjs} +1 -1
  184. package/components/{item-option-text-field-BoXwVo-B.js → item-option-text-field-c8PsVNYB.js} +1 -1
  185. package/components/item-slot-drop/index.cjs +1 -1
  186. package/components/item-slot-drop/index.js +1 -1
  187. package/components/{item-slot-drop-CYRVCWF0.cjs → item-slot-drop-2SpLWjPC.cjs} +1 -1
  188. package/components/{item-slot-drop-C0GmOMQY.js → item-slot-drop-Cpf4DnI4.js} +4 -4
  189. package/components/item-slot-drop-panel/index.cjs +1 -1
  190. package/components/item-slot-drop-panel/index.js +1 -1
  191. package/components/{item-slot-drop-panel-Ci3Soo16.js → item-slot-drop-panel-C77wRsvJ.js} +3 -3
  192. package/components/{item-slot-drop-panel-CoRFds3a.cjs → item-slot-drop-panel-ClEOXFHz.cjs} +1 -1
  193. package/components/item-slot-picker/index.cjs +1 -1
  194. package/components/item-slot-picker/index.js +1 -1
  195. package/components/{item-slot-picker-D1_NbL1A.js → item-slot-picker-BEPRIyMJ.js} +5 -5
  196. package/components/{item-slot-picker-CmnJSYIF.cjs → item-slot-picker-B_l4VnV_.cjs} +1 -1
  197. package/components/item-slot-picker-panel/index.cjs +1 -1
  198. package/components/item-slot-picker-panel/index.js +1 -1
  199. package/components/{item-slot-picker-panel-B8VvKhRF.js → item-slot-picker-panel-B4tCFh38.js} +3 -3
  200. package/components/{item-slot-picker-panel-DzKodYTM.cjs → item-slot-picker-panel-BCzV9MAV.cjs} +1 -1
  201. package/components/{localized-mixin-Dujo7nlJ.cjs → localized-mixin-AEA3w4H0.cjs} +1 -1
  202. package/components/{localized-mixin-DZuGq2Fm.js → localized-mixin-XqTi4F7d.js} +1 -1
  203. package/components/nl-BE6MZtti.cjs +20 -0
  204. package/components/{nl-hCQgb1fB.js → nl-DzdJmn0w.js} +6 -1
  205. package/components/{set-locale-CXnxhP_B.js → set-locale-B8CaHx6q.js} +4 -4
  206. package/components/{set-locale-MCuEsOOu.cjs → set-locale-CFD7fxS3.cjs} +1 -1
  207. package/components/slot-menu/index.cjs +1 -1
  208. package/components/slot-menu/index.js +1 -1
  209. package/components/{slot-menu-CDAAPyFj.cjs → slot-menu-C8446xNy.cjs} +1 -1
  210. package/components/{slot-menu-CYNYwJnU.js → slot-menu-DuJRaqmC.js} +3 -3
  211. package/components/slot-menu-list/index.cjs +1 -1
  212. package/components/slot-menu-list/index.js +1 -1
  213. package/components/{slot-menu-list-DbWiuJDF.cjs → slot-menu-list-B6A6w2d9.cjs} +1 -1
  214. package/components/{slot-menu-list-DL-x5Ggl.js → slot-menu-list-Zzwr6h1J.js} +1 -1
  215. package/components/utils/base.cjs +1 -1
  216. package/components/utils/base.js +2 -2
  217. package/components/{utils-DKSE_5u1.cjs → utils-1SB0pExj.cjs} +1 -1
  218. package/components/{utils-BACUV6sE.js → utils-sAvG9cHu.js} +1 -1
  219. package/components/utils.cjs +1 -1
  220. package/components/utils.js +2 -2
  221. package/components/viz-item-menu/index.cjs +1 -1
  222. package/components/viz-item-menu/index.js +1 -1
  223. package/components/{viz-item-menu-yr7TQY8-.cjs → viz-item-menu-B4mavjZ5.cjs} +1 -1
  224. package/components/{viz-item-menu-DXoKwAhV.js → viz-item-menu-CEcwbasZ.js} +1 -1
  225. package/custom-elements.json +1743 -156
  226. package/package.json +1 -1
  227. package/react/components/ai-chat/empty-state/index.ts +1 -0
  228. package/react/components/ai-chat/empty-state/types.ts +16 -0
  229. package/react/components/ai-chat/stream/index.ts +1 -0
  230. package/react/components/ai-chat/stream/types.ts +29 -0
  231. package/react/components/ai-chat.component.ts +12 -12
  232. package/react/esm/components/ai-chat/empty-state/index.d.ts +1 -0
  233. package/react/esm/components/ai-chat/empty-state/index.js +1 -0
  234. package/react/esm/components/ai-chat/empty-state/types.d.ts +14 -0
  235. package/react/esm/components/ai-chat/empty-state/types.js +1 -0
  236. package/react/esm/components/ai-chat/stream/index.d.ts +1 -0
  237. package/react/esm/components/ai-chat/stream/index.js +1 -0
  238. package/react/esm/components/ai-chat/stream/types.d.ts +26 -0
  239. package/react/esm/components/ai-chat/stream/types.js +1 -0
  240. package/react/esm/components/ai-chat.component.d.ts +8 -8
  241. package/react/esm/components/ai-chat.component.js +8 -8
  242. package/types/ai-chat.types.d.ts +1 -1
  243. package/components/ai-chat/request-contract.d.ts +0 -56
  244. package/components/ai-chat-D9yB7Sw_.cjs +0 -151
  245. package/components/ai-chat-DkfD3BDG.js +0 -1258
  246. package/components/de-B8ds_DbE.cjs +0 -20
  247. package/components/es-DGC51Dm9.cjs +0 -20
  248. package/components/fr-BoZFY3Qe.cjs +0 -20
  249. package/components/nl-C9Ad2LdA.cjs +0 -20
@@ -0,0 +1,1861 @@
1
+ /*! * A kit of modern Luzmo Web Components for analytics in your web application.
2
+ *
3
+ * Copyright © 2026 Luzmo
4
+ * All rights reserved.
5
+ * Luzmo web components (“Luzmo Web Components”)
6
+ * must be used according to the Luzmo Terms of Service.
7
+ * This license allows users with a current active Luzmo account
8
+ * to use the Luzmo Web Components. This license terminates
9
+ * automatically if a user no longer has an active Luzmo account.
10
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ * */
20
+ import { i as e } from "./base-D82dU2vv.js";
21
+ import { t } from "./decorate-DKLaHs_w.js";
22
+ import "./ai-interaction-textarea-C1DMkiX9.js";
23
+ import { msg as n } from "@lit/localize/lit-localize";
24
+ import { luzmoEllipsisVertical as r, luzmoIcon as i, luzmoSpin as a } from "@luzmo/icons";
25
+ import "@luzmo/lucero/chat-message";
26
+ import "@luzmo/lucero/overlay";
27
+ import "@luzmo/lucero/popover";
28
+ import "@luzmo/lucero/progress-steps";
29
+ import { html as o, nothing as s, unsafeCSS as c } from "lit";
30
+ import { property as l, state as u } from "lit/decorators.js";
31
+ import { unsafeHTML as d } from "lit/directives/unsafe-html.js";
32
+ import "@luzmo/lucero/suggestion";
33
+ //#region node_modules/dompurify/dist/purify.es.mjs
34
+ var { entries: ee, setPrototypeOf: te, isFrozen: ne, getPrototypeOf: f, getOwnPropertyDescriptor: re } = Object, { freeze: p, seal: m, create: ie } = Object, { apply: ae, construct: oe } = typeof Reflect < "u" && Reflect;
35
+ p ||= function(e) {
36
+ return e;
37
+ }, m ||= function(e) {
38
+ return e;
39
+ }, ae ||= function(e, t) {
40
+ var n = [...arguments].slice(2);
41
+ return e.apply(t, n);
42
+ }, oe ||= function(e) {
43
+ return new e(...[...arguments].slice(1));
44
+ };
45
+ var se = v(Array.prototype.forEach), ce = v(Array.prototype.lastIndexOf), le = v(Array.prototype.pop), ue = v(Array.prototype.push), de = v(Array.prototype.splice), fe = v(String.prototype.toLowerCase), pe = v(String.prototype.toString), me = v(String.prototype.match), h = v(String.prototype.replace), he = v(String.prototype.indexOf), ge = v(String.prototype.trim), g = v(Object.prototype.hasOwnProperty), _ = v(RegExp.prototype.test), _e = y(TypeError);
46
+ function v(e) {
47
+ return function(t) {
48
+ t instanceof RegExp && (t.lastIndex = 0);
49
+ var n = [...arguments].slice(1);
50
+ return ae(e, t, n);
51
+ };
52
+ }
53
+ function y(e) {
54
+ return function() {
55
+ return oe(e, [...arguments]);
56
+ };
57
+ }
58
+ function b(e, t) {
59
+ let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : fe;
60
+ te && te(e, null);
61
+ let r = t.length;
62
+ for (; r--;) {
63
+ let i = t[r];
64
+ if (typeof i == "string") {
65
+ let e = n(i);
66
+ e !== i && (ne(t) || (t[r] = e), i = e);
67
+ }
68
+ e[i] = !0;
69
+ }
70
+ return e;
71
+ }
72
+ function x(e) {
73
+ for (let t = 0; t < e.length; t++) g(e, t) || (e[t] = null);
74
+ return e;
75
+ }
76
+ function S(e) {
77
+ let t = ie(null);
78
+ for (let [n, r] of ee(e)) g(e, n) && (Array.isArray(r) ? t[n] = x(r) : r && typeof r == "object" && r.constructor === Object ? t[n] = S(r) : t[n] = r);
79
+ return t;
80
+ }
81
+ function ve(e, t) {
82
+ for (; e !== null;) {
83
+ let n = re(e, t);
84
+ if (n) {
85
+ if (n.get) return v(n.get);
86
+ if (typeof n.value == "function") return v(n.value);
87
+ }
88
+ e = f(e);
89
+ }
90
+ function n() {
91
+ return null;
92
+ }
93
+ return n;
94
+ }
95
+ var ye = p(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), be = p(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), xe = p([
96
+ "feBlend",
97
+ "feColorMatrix",
98
+ "feComponentTransfer",
99
+ "feComposite",
100
+ "feConvolveMatrix",
101
+ "feDiffuseLighting",
102
+ "feDisplacementMap",
103
+ "feDistantLight",
104
+ "feDropShadow",
105
+ "feFlood",
106
+ "feFuncA",
107
+ "feFuncB",
108
+ "feFuncG",
109
+ "feFuncR",
110
+ "feGaussianBlur",
111
+ "feImage",
112
+ "feMerge",
113
+ "feMergeNode",
114
+ "feMorphology",
115
+ "feOffset",
116
+ "fePointLight",
117
+ "feSpecularLighting",
118
+ "feSpotLight",
119
+ "feTile",
120
+ "feTurbulence"
121
+ ]), Se = p([
122
+ "animate",
123
+ "color-profile",
124
+ "cursor",
125
+ "discard",
126
+ "font-face",
127
+ "font-face-format",
128
+ "font-face-name",
129
+ "font-face-src",
130
+ "font-face-uri",
131
+ "foreignobject",
132
+ "hatch",
133
+ "hatchpath",
134
+ "mesh",
135
+ "meshgradient",
136
+ "meshpatch",
137
+ "meshrow",
138
+ "missing-glyph",
139
+ "script",
140
+ "set",
141
+ "solidcolor",
142
+ "unknown",
143
+ "use"
144
+ ]), Ce = p(/* @__PURE__ */ "math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")), we = p([
145
+ "maction",
146
+ "maligngroup",
147
+ "malignmark",
148
+ "mlongdiv",
149
+ "mscarries",
150
+ "mscarry",
151
+ "msgroup",
152
+ "mstack",
153
+ "msline",
154
+ "msrow",
155
+ "semantics",
156
+ "annotation",
157
+ "annotation-xml",
158
+ "mprescripts",
159
+ "none"
160
+ ]), Te = p(["#text"]), Ee = p(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot".split(".")), De = p(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), Oe = p(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), ke = p([
161
+ "xlink:href",
162
+ "xml:id",
163
+ "xlink:title",
164
+ "xml:space",
165
+ "xmlns:xlink"
166
+ ]), Ae = m(/\{\{[\w\W]*|[\w\W]*\}\}/gm), je = m(/<%[\w\W]*|[\w\W]*%>/gm), Me = m(/\$\{[\w\W]*/gm), Ne = m(/^data-[\-\w.\u00B7-\uFFFF]+$/), Pe = m(/^aria-[\-\w]+$/), Fe = m(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), C = m(/^(?:\w+script|data):/i), Ie = m(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Le = m(/^html$/i), Re = m(/^[a-z][.\w]*(-[.\w]+)+$/i), ze = /* @__PURE__ */ Object.freeze({
167
+ __proto__: null,
168
+ ARIA_ATTR: Pe,
169
+ ATTR_WHITESPACE: Ie,
170
+ CUSTOM_ELEMENT: Re,
171
+ DATA_ATTR: Ne,
172
+ DOCTYPE_NAME: Le,
173
+ ERB_EXPR: je,
174
+ IS_ALLOWED_URI: Fe,
175
+ IS_SCRIPT_OR_DATA: C,
176
+ MUSTACHE_EXPR: Ae,
177
+ TMPLIT_EXPR: Me
178
+ }), Be = {
179
+ element: 1,
180
+ text: 3,
181
+ progressingInstruction: 7,
182
+ comment: 8,
183
+ document: 9
184
+ }, Ve = function() {
185
+ return typeof window > "u" ? null : window;
186
+ }, He = function(e, t) {
187
+ if (typeof e != "object" || typeof e.createPolicy != "function") return null;
188
+ let n = null, r = "data-tt-policy-suffix";
189
+ t && t.hasAttribute(r) && (n = t.getAttribute(r));
190
+ let i = "dompurify" + (n ? "#" + n : "");
191
+ try {
192
+ return e.createPolicy(i, {
193
+ createHTML(e) {
194
+ return e;
195
+ },
196
+ createScriptURL(e) {
197
+ return e;
198
+ }
199
+ });
200
+ } catch {
201
+ return console.warn("TrustedTypes policy " + i + " could not be created."), null;
202
+ }
203
+ }, Ue = function() {
204
+ return {
205
+ afterSanitizeAttributes: [],
206
+ afterSanitizeElements: [],
207
+ afterSanitizeShadowDOM: [],
208
+ beforeSanitizeAttributes: [],
209
+ beforeSanitizeElements: [],
210
+ beforeSanitizeShadowDOM: [],
211
+ uponSanitizeAttribute: [],
212
+ uponSanitizeElement: [],
213
+ uponSanitizeShadowNode: []
214
+ };
215
+ };
216
+ function We() {
217
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ve(), t = (e) => We(e);
218
+ if (t.version = "3.4.0", t.removed = [], !e || !e.document || e.document.nodeType !== Be.document || !e.Element) return t.isSupported = !1, t;
219
+ let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: s, Element: c, NodeFilter: l, NamedNodeMap: u = e.NamedNodeMap || e.MozNamedAttrMap, HTMLFormElement: d, DOMParser: te, trustedTypes: ne } = e, f = c.prototype, re = ve(f, "cloneNode"), m = ve(f, "remove"), ae = ve(f, "nextSibling"), oe = ve(f, "childNodes"), v = ve(f, "parentNode");
220
+ if (typeof o == "function") {
221
+ let e = n.createElement("template");
222
+ e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
223
+ }
224
+ let y, x = "", { implementation: Ae, createNodeIterator: je, createDocumentFragment: Me, getElementsByTagName: Ne } = n, { importNode: Pe } = r, C = Ue();
225
+ t.isSupported = typeof ee == "function" && typeof v == "function" && Ae && Ae.createHTMLDocument !== void 0;
226
+ let { MUSTACHE_EXPR: Ie, ERB_EXPR: Re, TMPLIT_EXPR: Ge, DATA_ATTR: Ke, ARIA_ATTR: w, IS_SCRIPT_OR_DATA: qe, ATTR_WHITESPACE: Je, CUSTOM_ELEMENT: Ye } = ze, { IS_ALLOWED_URI: Xe } = ze, T = null, Ze = b({}, [
227
+ ...ye,
228
+ ...be,
229
+ ...xe,
230
+ ...Ce,
231
+ ...Te
232
+ ]), E = null, Qe = b({}, [
233
+ ...Ee,
234
+ ...De,
235
+ ...Oe,
236
+ ...ke
237
+ ]), D = Object.seal(ie(null, {
238
+ tagNameCheck: {
239
+ writable: !0,
240
+ configurable: !1,
241
+ enumerable: !0,
242
+ value: null
243
+ },
244
+ attributeNameCheck: {
245
+ writable: !0,
246
+ configurable: !1,
247
+ enumerable: !0,
248
+ value: null
249
+ },
250
+ allowCustomizedBuiltInElements: {
251
+ writable: !0,
252
+ configurable: !1,
253
+ enumerable: !0,
254
+ value: !1
255
+ }
256
+ })), O = null, k = null, A = Object.seal(ie(null, {
257
+ tagCheck: {
258
+ writable: !0,
259
+ configurable: !1,
260
+ enumerable: !0,
261
+ value: null
262
+ },
263
+ attributeCheck: {
264
+ writable: !0,
265
+ configurable: !1,
266
+ enumerable: !0,
267
+ value: null
268
+ }
269
+ })), $e = !0, et = !0, tt = !1, nt = !0, j = !1, M = !0, N = !1, P = !1, F = !1, I = !1, L = !1, R = !1, z = !0, rt = !1, B = !0, V = !1, H = {}, U = null, it = b({}, [
270
+ "annotation-xml",
271
+ "audio",
272
+ "colgroup",
273
+ "desc",
274
+ "foreignobject",
275
+ "head",
276
+ "iframe",
277
+ "math",
278
+ "mi",
279
+ "mn",
280
+ "mo",
281
+ "ms",
282
+ "mtext",
283
+ "noembed",
284
+ "noframes",
285
+ "noscript",
286
+ "plaintext",
287
+ "script",
288
+ "style",
289
+ "svg",
290
+ "template",
291
+ "thead",
292
+ "title",
293
+ "video",
294
+ "xmp"
295
+ ]), at = null, ot = b({}, [
296
+ "audio",
297
+ "video",
298
+ "img",
299
+ "source",
300
+ "image",
301
+ "track"
302
+ ]), st = null, ct = b({}, [
303
+ "alt",
304
+ "class",
305
+ "for",
306
+ "id",
307
+ "label",
308
+ "name",
309
+ "pattern",
310
+ "placeholder",
311
+ "role",
312
+ "summary",
313
+ "title",
314
+ "value",
315
+ "style",
316
+ "xmlns"
317
+ ]), lt = "http://www.w3.org/1998/Math/MathML", ut = "http://www.w3.org/2000/svg", W = "http://www.w3.org/1999/xhtml", G = W, dt = !1, ft = null, pt = b({}, [
318
+ lt,
319
+ ut,
320
+ W
321
+ ], pe), K = b({}, [
322
+ "mi",
323
+ "mo",
324
+ "mn",
325
+ "ms",
326
+ "mtext"
327
+ ]), q = b({}, ["annotation-xml"]), mt = b({}, [
328
+ "title",
329
+ "style",
330
+ "font",
331
+ "a",
332
+ "script"
333
+ ]), J = null, ht = ["application/xhtml+xml", "text/html"], Y = null, X = null, gt = n.createElement("form"), _t = function(e) {
334
+ return e instanceof RegExp || e instanceof Function;
335
+ }, vt = function() {
336
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
337
+ if (!(X && X === e)) {
338
+ if ((!e || typeof e != "object") && (e = {}), e = S(e), J = ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, Y = J === "application/xhtml+xml" ? pe : fe, T = g(e, "ALLOWED_TAGS") ? b({}, e.ALLOWED_TAGS, Y) : Ze, E = g(e, "ALLOWED_ATTR") ? b({}, e.ALLOWED_ATTR, Y) : Qe, ft = g(e, "ALLOWED_NAMESPACES") ? b({}, e.ALLOWED_NAMESPACES, pe) : pt, st = g(e, "ADD_URI_SAFE_ATTR") ? b(S(ct), e.ADD_URI_SAFE_ATTR, Y) : ct, at = g(e, "ADD_DATA_URI_TAGS") ? b(S(ot), e.ADD_DATA_URI_TAGS, Y) : ot, U = g(e, "FORBID_CONTENTS") ? b({}, e.FORBID_CONTENTS, Y) : it, O = g(e, "FORBID_TAGS") ? b({}, e.FORBID_TAGS, Y) : S({}), k = g(e, "FORBID_ATTR") ? b({}, e.FORBID_ATTR, Y) : S({}), H = g(e, "USE_PROFILES") ? e.USE_PROFILES : !1, $e = e.ALLOW_ARIA_ATTR !== !1, et = e.ALLOW_DATA_ATTR !== !1, tt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, nt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, j = e.SAFE_FOR_TEMPLATES || !1, M = e.SAFE_FOR_XML !== !1, N = e.WHOLE_DOCUMENT || !1, I = e.RETURN_DOM || !1, L = e.RETURN_DOM_FRAGMENT || !1, R = e.RETURN_TRUSTED_TYPE || !1, F = e.FORCE_BODY || !1, z = e.SANITIZE_DOM !== !1, rt = e.SANITIZE_NAMED_PROPS || !1, B = e.KEEP_CONTENT !== !1, V = e.IN_PLACE || !1, Xe = e.ALLOWED_URI_REGEXP || Fe, G = e.NAMESPACE || W, K = e.MATHML_TEXT_INTEGRATION_POINTS || K, q = e.HTML_INTEGRATION_POINTS || q, D = e.CUSTOM_ELEMENT_HANDLING || ie(null), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (D.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (D.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (D.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), j && (et = !1), L && (I = !0), H && (T = b({}, Te), E = ie(null), H.html === !0 && (b(T, ye), b(E, Ee)), H.svg === !0 && (b(T, be), b(E, De), b(E, ke)), H.svgFilters === !0 && (b(T, xe), b(E, De), b(E, ke)), H.mathMl === !0 && (b(T, Ce), b(E, Oe), b(E, ke))), A.tagCheck = null, A.attributeCheck = null, e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? A.tagCheck = e.ADD_TAGS : (T === Ze && (T = S(T)), b(T, e.ADD_TAGS, Y))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? A.attributeCheck = e.ADD_ATTR : (E === Qe && (E = S(E)), b(E, e.ADD_ATTR, Y))), e.ADD_URI_SAFE_ATTR && b(st, e.ADD_URI_SAFE_ATTR, Y), e.FORBID_CONTENTS && (U === it && (U = S(U)), b(U, e.FORBID_CONTENTS, Y)), e.ADD_FORBID_CONTENTS && (U === it && (U = S(U)), b(U, e.ADD_FORBID_CONTENTS, Y)), B && (T["#text"] = !0), N && b(T, [
339
+ "html",
340
+ "head",
341
+ "body"
342
+ ]), T.table && (b(T, ["tbody"]), delete O.tbody), e.TRUSTED_TYPES_POLICY) {
343
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw _e("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
344
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw _e("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
345
+ y = e.TRUSTED_TYPES_POLICY, x = y.createHTML("");
346
+ } else y === void 0 && (y = He(ne, i)), y !== null && typeof x == "string" && (x = y.createHTML(""));
347
+ p && p(e), X = e;
348
+ }
349
+ }, yt = b({}, [
350
+ ...be,
351
+ ...xe,
352
+ ...Se
353
+ ]), bt = b({}, [...Ce, ...we]), xt = function(e) {
354
+ let t = v(e);
355
+ (!t || !t.tagName) && (t = {
356
+ namespaceURI: G,
357
+ tagName: "template"
358
+ });
359
+ let n = fe(e.tagName), r = fe(t.tagName);
360
+ return ft[e.namespaceURI] ? e.namespaceURI === ut ? t.namespaceURI === W ? n === "svg" : t.namespaceURI === lt ? n === "svg" && (r === "annotation-xml" || K[r]) : !!yt[n] : e.namespaceURI === lt ? t.namespaceURI === W ? n === "math" : t.namespaceURI === ut ? n === "math" && q[r] : !!bt[n] : e.namespaceURI === W ? t.namespaceURI === ut && !q[r] || t.namespaceURI === lt && !K[r] ? !1 : !bt[n] && (mt[n] || !yt[n]) : !!(J === "application/xhtml+xml" && ft[e.namespaceURI]) : !1;
361
+ }, Z = function(e) {
362
+ ue(t.removed, { element: e });
363
+ try {
364
+ v(e).removeChild(e);
365
+ } catch {
366
+ m(e);
367
+ }
368
+ }, Q = function(e, n) {
369
+ try {
370
+ ue(t.removed, {
371
+ attribute: n.getAttributeNode(e),
372
+ from: n
373
+ });
374
+ } catch {
375
+ ue(t.removed, {
376
+ attribute: null,
377
+ from: n
378
+ });
379
+ }
380
+ if (n.removeAttribute(e), e === "is") if (I || L) try {
381
+ Z(n);
382
+ } catch {}
383
+ else try {
384
+ n.setAttribute(e, "");
385
+ } catch {}
386
+ }, St = function(e) {
387
+ let t = null, r = null;
388
+ if (F) e = "<remove></remove>" + e;
389
+ else {
390
+ let t = me(e, /^[\r\n\t ]+/);
391
+ r = t && t[0];
392
+ }
393
+ J === "application/xhtml+xml" && G === W && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
394
+ let i = y ? y.createHTML(e) : e;
395
+ if (G === W) try {
396
+ t = new te().parseFromString(i, J);
397
+ } catch {}
398
+ if (!t || !t.documentElement) {
399
+ t = Ae.createDocument(G, "template", null);
400
+ try {
401
+ t.documentElement.innerHTML = dt ? x : i;
402
+ } catch {}
403
+ }
404
+ let a = t.body || t.documentElement;
405
+ return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), G === W ? Ne.call(t, N ? "html" : "body")[0] : N ? t.documentElement : a;
406
+ }, Ct = function(e) {
407
+ return je.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
408
+ }, wt = function(e) {
409
+ return e instanceof d && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof u) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
410
+ }, Tt = function(e) {
411
+ return typeof s == "function" && e instanceof s;
412
+ };
413
+ function $(e, n, r) {
414
+ se(e, (e) => {
415
+ e.call(t, n, r, X);
416
+ });
417
+ }
418
+ let Et = function(e) {
419
+ let n = null;
420
+ if ($(C.beforeSanitizeElements, e, null), wt(e)) return Z(e), !0;
421
+ let r = Y(e.nodeName);
422
+ if ($(C.uponSanitizeElement, e, {
423
+ tagName: r,
424
+ allowedTags: T
425
+ }), M && e.hasChildNodes() && !Tt(e.firstElementChild) && _(/<[/\w!]/g, e.innerHTML) && _(/<[/\w!]/g, e.textContent) || M && e.namespaceURI === W && r === "style" && Tt(e.firstElementChild) || e.nodeType === Be.progressingInstruction || M && e.nodeType === Be.comment && _(/<[/\w]/g, e.data)) return Z(e), !0;
426
+ if (O[r] || !(A.tagCheck instanceof Function && A.tagCheck(r)) && !T[r]) {
427
+ if (!O[r] && Ot(r) && (D.tagNameCheck instanceof RegExp && _(D.tagNameCheck, r) || D.tagNameCheck instanceof Function && D.tagNameCheck(r))) return !1;
428
+ if (B && !U[r]) {
429
+ let t = v(e) || e.parentNode, n = oe(e) || e.childNodes;
430
+ if (n && t) {
431
+ let r = n.length;
432
+ for (let i = r - 1; i >= 0; --i) {
433
+ let r = re(n[i], !0);
434
+ r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r, ae(e));
435
+ }
436
+ }
437
+ }
438
+ return Z(e), !0;
439
+ }
440
+ return e instanceof c && !xt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && _(/<\/no(script|embed|frames)/i, e.innerHTML) ? (Z(e), !0) : (j && e.nodeType === Be.text && (n = e.textContent, se([
441
+ Ie,
442
+ Re,
443
+ Ge
444
+ ], (e) => {
445
+ n = h(n, e, " ");
446
+ }), e.textContent !== n && (ue(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(C.afterSanitizeElements, e, null), !1);
447
+ }, Dt = function(e, t, r) {
448
+ if (k[t] || z && (t === "id" || t === "name") && (r in n || r in gt)) return !1;
449
+ if (!(et && !k[t] && _(Ke, t)) && !($e && _(w, t)) && !(A.attributeCheck instanceof Function && A.attributeCheck(t, e))) {
450
+ if (!E[t] || k[t]) {
451
+ if (!(Ot(e) && (D.tagNameCheck instanceof RegExp && _(D.tagNameCheck, e) || D.tagNameCheck instanceof Function && D.tagNameCheck(e)) && (D.attributeNameCheck instanceof RegExp && _(D.attributeNameCheck, t) || D.attributeNameCheck instanceof Function && D.attributeNameCheck(t, e)) || t === "is" && D.allowCustomizedBuiltInElements && (D.tagNameCheck instanceof RegExp && _(D.tagNameCheck, r) || D.tagNameCheck instanceof Function && D.tagNameCheck(r)))) return !1;
452
+ } else if (!st[t] && !_(Xe, h(r, Je, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && he(r, "data:") === 0 && at[e]) && !(tt && !_(qe, h(r, Je, ""))) && r) return !1;
453
+ }
454
+ return !0;
455
+ }, Ot = function(e) {
456
+ return e !== "annotation-xml" && me(e, Ye);
457
+ }, kt = function(e) {
458
+ $(C.beforeSanitizeAttributes, e, null);
459
+ let { attributes: n } = e;
460
+ if (!n || wt(e)) return;
461
+ let r = {
462
+ attrName: "",
463
+ attrValue: "",
464
+ keepAttr: !0,
465
+ allowedAttributes: E,
466
+ forceKeepAttr: void 0
467
+ }, i = n.length;
468
+ for (; i--;) {
469
+ let { name: a, namespaceURI: o, value: s } = n[i], c = Y(a), l = s, u = a === "value" ? l : ge(l);
470
+ if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(C.uponSanitizeAttribute, e, r), u = r.attrValue, rt && (c === "id" || c === "name") && (Q(a, e), u = "user-content-" + u), M && _(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, u)) {
471
+ Q(a, e);
472
+ continue;
473
+ }
474
+ if (c === "attributename" && me(u, "href")) {
475
+ Q(a, e);
476
+ continue;
477
+ }
478
+ if (r.forceKeepAttr) continue;
479
+ if (!r.keepAttr) {
480
+ Q(a, e);
481
+ continue;
482
+ }
483
+ if (!nt && _(/\/>/i, u)) {
484
+ Q(a, e);
485
+ continue;
486
+ }
487
+ j && se([
488
+ Ie,
489
+ Re,
490
+ Ge
491
+ ], (e) => {
492
+ u = h(u, e, " ");
493
+ });
494
+ let d = Y(e.nodeName);
495
+ if (!Dt(d, c, u)) {
496
+ Q(a, e);
497
+ continue;
498
+ }
499
+ if (y && typeof ne == "object" && typeof ne.getAttributeType == "function" && !o) switch (ne.getAttributeType(d, c)) {
500
+ case "TrustedHTML":
501
+ u = y.createHTML(u);
502
+ break;
503
+ case "TrustedScriptURL":
504
+ u = y.createScriptURL(u);
505
+ break;
506
+ }
507
+ if (u !== l) try {
508
+ o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u), wt(e) ? Z(e) : le(t.removed);
509
+ } catch {
510
+ Q(a, e);
511
+ }
512
+ }
513
+ $(C.afterSanitizeAttributes, e, null);
514
+ }, At = function(e) {
515
+ let t = null, n = Ct(e);
516
+ for ($(C.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) $(C.uponSanitizeShadowNode, t, null), Et(t), kt(t), t.content instanceof a && At(t.content);
517
+ $(C.afterSanitizeShadowDOM, e, null);
518
+ };
519
+ return t.sanitize = function(e) {
520
+ let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null, c = null, l = null;
521
+ if (dt = !e, dt && (e = "<!-->"), typeof e != "string" && !Tt(e)) if (typeof e.toString == "function") {
522
+ if (e = e.toString(), typeof e != "string") throw _e("dirty is not a string, aborting");
523
+ } else throw _e("toString is not a function");
524
+ if (!t.isSupported) return e;
525
+ if (P || vt(n), t.removed = [], typeof e == "string" && (V = !1), V) {
526
+ if (e.nodeName) {
527
+ let t = Y(e.nodeName);
528
+ if (!T[t] || O[t]) throw _e("root node is forbidden and cannot be sanitized in-place");
529
+ }
530
+ } else if (e instanceof s) i = St("<!---->"), o = i.ownerDocument.importNode(e, !0), o.nodeType === Be.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? i = o : i.appendChild(o);
531
+ else {
532
+ if (!I && !j && !N && e.indexOf("<") === -1) return y && R ? y.createHTML(e) : e;
533
+ if (i = St(e), !i) return I ? null : R ? x : "";
534
+ }
535
+ i && F && Z(i.firstChild);
536
+ let u = Ct(V ? e : i);
537
+ for (; c = u.nextNode();) Et(c), kt(c), c.content instanceof a && At(c.content);
538
+ if (V) return e;
539
+ if (I) {
540
+ if (j) {
541
+ i.normalize();
542
+ let e = i.innerHTML;
543
+ se([
544
+ Ie,
545
+ Re,
546
+ Ge
547
+ ], (t) => {
548
+ e = h(e, t, " ");
549
+ }), i.innerHTML = e;
550
+ }
551
+ if (L) for (l = Me.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
552
+ else l = i;
553
+ return (E.shadowroot || E.shadowrootmode) && (l = Pe.call(r, l, !0)), l;
554
+ }
555
+ let d = N ? i.outerHTML : i.innerHTML;
556
+ return N && T["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && _(Le, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), j && se([
557
+ Ie,
558
+ Re,
559
+ Ge
560
+ ], (e) => {
561
+ d = h(d, e, " ");
562
+ }), y && R ? y.createHTML(d) : d;
563
+ }, t.setConfig = function() {
564
+ vt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), P = !0;
565
+ }, t.clearConfig = function() {
566
+ X = null, P = !1;
567
+ }, t.isValidAttribute = function(e, t, n) {
568
+ return X || vt({}), Dt(Y(e), Y(t), n);
569
+ }, t.addHook = function(e, t) {
570
+ typeof t == "function" && ue(C[e], t);
571
+ }, t.removeHook = function(e, t) {
572
+ if (t !== void 0) {
573
+ let n = ce(C[e], t);
574
+ return n === -1 ? void 0 : de(C[e], n, 1)[0];
575
+ }
576
+ return le(C[e]);
577
+ }, t.removeHooks = function(e) {
578
+ C[e] = [];
579
+ }, t.removeAllHooks = function() {
580
+ C = Ue();
581
+ }, t;
582
+ }
583
+ var Ge = We(), Ke = ":host{box-sizing:border-box;width:100%;min-height:0;padding-block:var(--luzmo-ai-chat-empty-state-padding-block,var(--ai-chat-empty-state-padding-block));padding-inline:var(--luzmo-ai-chat-empty-state-padding-inline,var(--ai-chat-empty-state-padding-inline));flex:1;justify-content:center;align-items:center;display:flex}.empty-state{justify-content:center;align-items:center;gap:var(--luzmo-ai-chat-empty-state-header-actions-gap,var(--ai-chat-empty-state-header-actions-gap));width:100%;max-width:var(--luzmo-ai-chat-empty-state-max-width,var(--ai-chat-empty-state-max-width));text-align:center;flex-direction:column;display:flex}.header{flex-direction:column;align-items:center;width:100%;display:flex}.actions{align-items:center;gap:var(--luzmo-ai-chat-empty-state-actions-gap,var(--ai-chat-empty-state-actions-gap));flex-direction:column;width:100%;display:flex}.title{font-family:var(--luzmo-font-family);font-size:var(--luzmo-ai-chat-empty-state-title-font-size,var(--ai-chat-empty-state-title-font-size));font-weight:var(--luzmo-ai-chat-empty-state-title-font-weight,var(--ai-chat-empty-state-title-font-weight));line-height:var(--luzmo-ai-chat-empty-state-title-line-height,var(--ai-chat-empty-state-title-line-height));color:var(--luzmo-ai-chat-empty-state-title-color,var(--ai-chat-empty-state-title-color));text-wrap:balance;margin:0}.subtitle{font-family:var(--luzmo-font-family);font-size:var(--luzmo-ai-chat-empty-state-subtitle-font-size,var(--ai-chat-empty-state-subtitle-font-size));font-weight:var(--luzmo-ai-chat-empty-state-subtitle-font-weight,var(--ai-chat-empty-state-subtitle-font-weight));line-height:var(--luzmo-ai-chat-empty-state-subtitle-line-height,var(--ai-chat-empty-state-subtitle-line-height));color:var(--luzmo-ai-chat-empty-state-subtitle-color,var(--ai-chat-empty-state-subtitle-color));margin:0}.suggestions{justify-content:center;align-items:center;gap:var(--luzmo-ai-chat-empty-state-suggestions-gap,var(--ai-chat-empty-state-suggestions-gap));flex-wrap:wrap;width:100%;display:flex}luzmo-suggestion{max-width:100%}:host{--ai-chat-empty-state-header-actions-gap:1.5rem;--ai-chat-empty-state-actions-gap:var(--luzmo-spacing-4);--ai-chat-empty-state-suggestions-gap:var(--luzmo-spacing-3);--ai-chat-empty-state-max-width:22.5rem;--ai-chat-empty-state-padding-block:2rem;--ai-chat-empty-state-padding-inline:var(--luzmo-spacing-5);--ai-chat-empty-state-title-font-size:var(--luzmo-font-size-l);--ai-chat-empty-state-title-font-weight:var(--luzmo-font-weight-strong,600);--ai-chat-empty-state-title-line-height:1.4;--ai-chat-empty-state-title-color:var(--luzmo-font-color);--ai-chat-empty-state-subtitle-font-size:var(--luzmo-font-size-s);--ai-chat-empty-state-subtitle-font-weight:var(--luzmo-font-weight);--ai-chat-empty-state-subtitle-line-height:var(--luzmo-line-height);--ai-chat-empty-state-subtitle-color:var(--luzmo-font-color-dimmed,var(--luzmo-font-color-extra-dimmed))}", w = class extends e {
584
+ constructor(...e) {
585
+ super(...e), this.title = n("What can I help you with?", { desc: "Title for the AI chat empty state" }), this.subtitle = "", this.suggestions = [], this.disabled = !1;
586
+ }
587
+ static {
588
+ this.styles = c(Ke);
589
+ }
590
+ static {
591
+ this.tagName = "luzmo-ai-chat-empty-state";
592
+ }
593
+ _handleSuggestionActivate(e) {
594
+ if (this.disabled) return;
595
+ let t = e.prompt ?? e.label;
596
+ this.dispatchEvent(new CustomEvent("luzmo-suggestion-selected", {
597
+ detail: {
598
+ label: e.label,
599
+ prompt: t,
600
+ selectedDatasets: e.selectedDatasets
601
+ },
602
+ bubbles: !0,
603
+ composed: !0
604
+ }));
605
+ }
606
+ render() {
607
+ let e = this.suggestions.length > 0;
608
+ return o`
609
+ <section class="empty-state" aria-labelledby="ai-chat-empty-state-title">
610
+ <header class="header">
611
+ <h2 id="ai-chat-empty-state-title" class="title">${this.title}</h2>
612
+ </header>
613
+
614
+ ${e ? o`
615
+ <div class="actions">
616
+ ${this.subtitle ? o`<p class="subtitle">${this.subtitle}</p>` : s}
617
+ <div
618
+ class="suggestions"
619
+ role="group"
620
+ aria-label=${n("Prompt suggestions", { desc: "Accessible label for the AI chat empty state suggestion list" })}
621
+ >
622
+ ${this.suggestions.map((e) => o`
623
+ <luzmo-suggestion
624
+ variant="prompt"
625
+ ?disabled=${this.disabled}
626
+ @click=${() => this._handleSuggestionActivate(e)}
627
+ >
628
+ ${e.label}
629
+ </luzmo-suggestion>
630
+ `)}
631
+ </div>
632
+ </div>
633
+ ` : s}
634
+ </section>
635
+ `;
636
+ }
637
+ };
638
+ //#endregion
639
+ //#region src/components/ai-chat/empty-state/index.ts
640
+ t([l({ type: String })], w.prototype, "title", void 0), t([l({ type: String })], w.prototype, "subtitle", void 0), t([l({ type: Array })], w.prototype, "suggestions", void 0), t([l({
641
+ type: Boolean,
642
+ reflect: !0
643
+ })], w.prototype, "disabled", void 0), customElements.get("luzmo-ai-chat-empty-state") || customElements.define("luzmo-ai-chat-empty-state", w);
644
+ //#endregion
645
+ //#region src/components/ai-chat/ai-chat-request.ts
646
+ function qe(e, t) {
647
+ return `${e.replace(/\/+$/, "")}/${t.replace(/^\/+|\/+$/g, "")}/aiprompt`;
648
+ }
649
+ function Je(e) {
650
+ return e.type === "placeholder" ? null : {
651
+ ...e,
652
+ version: e.version || "",
653
+ title: e.title || e.options?.title,
654
+ filters: e.filterGroups || [],
655
+ aichartId: e.aichartId || ""
656
+ };
657
+ }
658
+ function Ye(e, t) {
659
+ return [{
660
+ type: "text",
661
+ text: e
662
+ }, ...t.map((e) => ({
663
+ type: "dataset",
664
+ id: e
665
+ }))];
666
+ }
667
+ function Xe(e, t, n) {
668
+ return {
669
+ agent: e,
670
+ task: t,
671
+ stream: n.stream ?? !0,
672
+ response_mode: "mixed",
673
+ ...n.conversationId ? { conversation_id: n.conversationId } : {},
674
+ ...n.localeId ? { locale_id: n.localeId } : {}
675
+ };
676
+ }
677
+ function T(e) {
678
+ let t = Ye(e.prompt, e.datasetIds), n = e.chart ? Je(e.chart) : null;
679
+ return n && t.push({
680
+ type: "item",
681
+ value: n
682
+ }), {
683
+ ...Xe("item", e.task ?? "generate", e),
684
+ input: t
685
+ };
686
+ }
687
+ function Ze(e) {
688
+ let t = Ye(e.prompt, e.datasetIds);
689
+ return e.dashboard && t.push({
690
+ type: "dashboard",
691
+ value: e.dashboard,
692
+ ...e.currentScreenMode ? { current_screen_mode: e.currentScreenMode } : {}
693
+ }), {
694
+ ...Xe("dashboard", "generate", e),
695
+ timezone_id: e.timezoneId ?? "UTC",
696
+ input: t
697
+ };
698
+ }
699
+ function E(e) {
700
+ return {
701
+ ...Xe("analyst", "generate", e),
702
+ input: Ye(e.prompt, e.datasetIds)
703
+ };
704
+ }
705
+ function Qe(e, t) {
706
+ switch (e) {
707
+ case "dashboard": return Ze(t);
708
+ case "analyst": return E(t);
709
+ default: return T(t);
710
+ }
711
+ }
712
+ function D(e, t) {
713
+ let { authKey: n, authToken: r, apiVersion: i = "0.1.0" } = t;
714
+ return {
715
+ key: n,
716
+ token: r,
717
+ action: "create",
718
+ version: i,
719
+ properties: Qe(e, t)
720
+ };
721
+ }
722
+ function O(e, t, n, r = "0.1.0", i = null) {
723
+ return {
724
+ key: t,
725
+ token: n,
726
+ action: "delete",
727
+ version: r,
728
+ properties: {
729
+ agent: "item",
730
+ restore_to_message_id: e,
731
+ ...i ? { conversation_id: i } : {}
732
+ }
733
+ };
734
+ }
735
+ //#endregion
736
+ //#region src/components/ai-chat/stream/ai-chat-streaming.ts
737
+ function k() {
738
+ return {
739
+ id: "root",
740
+ step: "root",
741
+ status: "pending",
742
+ children: [{
743
+ id: "client-init",
744
+ step: "iqInit",
745
+ status: "inProgress",
746
+ description: "Thinking"
747
+ }]
748
+ };
749
+ }
750
+ function A(e) {
751
+ let t = e.progress;
752
+ return typeof t != "object" || !t ? !1 : "id" in t && "step" in t && "status" in t;
753
+ }
754
+ async function $e(e) {
755
+ let t = await fetch(e.url, {
756
+ method: "POST",
757
+ headers: { "Content-Type": "application/json" },
758
+ mode: "cors",
759
+ body: JSON.stringify(e.body),
760
+ signal: e.signal
761
+ });
762
+ if (!t.ok) {
763
+ let e = await t.json().catch(() => null);
764
+ throw Error(e?.message || `API request failed with status ${t.status}`);
765
+ }
766
+ if (!t.body) throw Error("Response body is not readable");
767
+ return {
768
+ body: t.body,
769
+ conversationId: t.headers.get("x-conversation-id")
770
+ };
771
+ }
772
+ function et(e) {
773
+ let t = e.trim();
774
+ if (!t || t.startsWith(":") || t.startsWith("event:") || t.startsWith("id:")) return null;
775
+ let n = t;
776
+ return n.startsWith("data:") && (n = n.slice(5).trimStart()), !n || n === "[DONE]" ? null : JSON.parse(n);
777
+ }
778
+ function tt(e, t) {
779
+ try {
780
+ let n = et(e);
781
+ n && t(n);
782
+ } catch {
783
+ console.error("Failed to parse stream line");
784
+ }
785
+ }
786
+ async function nt(e, t) {
787
+ let n = e.getReader(), r = new TextDecoder(), i = "";
788
+ try {
789
+ for (;;) {
790
+ let { done: e, value: a } = await n.read();
791
+ if (e) break;
792
+ i += r.decode(a, { stream: !0 });
793
+ let o = i.split(/\r?\n/);
794
+ i = o.pop() ?? "";
795
+ for (let e of o) tt(e, t);
796
+ }
797
+ i += r.decode();
798
+ let e = i.trim();
799
+ e && tt(e, t);
800
+ } finally {
801
+ n.releaseLock();
802
+ }
803
+ }
804
+ //#endregion
805
+ //#region src/components/ai-chat/stream/shared.ts
806
+ function j(e) {
807
+ if (!e || typeof e != "object") return "";
808
+ let t = e.assistant_message;
809
+ if (!t || typeof t != "object") return "";
810
+ if (typeof t.message == "string") return t.message;
811
+ if (typeof t.text == "string") return t.text;
812
+ if (typeof t.summary == "string") return t.summary;
813
+ let n = t.content;
814
+ return typeof n == "string" ? n : n && typeof n == "object" && typeof n.text == "string" ? n.text : "";
815
+ }
816
+ function M(e) {
817
+ return typeof e.text_delta == "string" ? e.text_delta : typeof e.chunk == "string" ? e.chunk : typeof e.message == "string" ? e.message : typeof e.summary == "string" ? e.summary : "";
818
+ }
819
+ function N(e) {
820
+ return M(e) || j(e.result);
821
+ }
822
+ function P(e) {
823
+ return !!e.done || e.type === "finish" || e.type === "done" || "question" in e;
824
+ }
825
+ function F(e, t) {
826
+ let n = typeof e.conversation_id == "string" && e.conversation_id || typeof e.conversationId == "string" && e.conversationId;
827
+ n && t.callbacks.onConversationIdChange(n);
828
+ }
829
+ function I(e, t) {
830
+ return A(e) ? (t.callbacks.onProgress(e.progress), !0) : !1;
831
+ }
832
+ function L(e, t) {
833
+ if (!(e.error || e.type === "error" || typeof e.error_text == "string")) return !1;
834
+ let r = typeof e.error_text == "string" && e.error_text || typeof e.error == "string" && e.error || n("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" });
835
+ return t.aiMessage.message = r, t.aiMessage.isError = !0, t.callbacks.onMessageUpdate(t.aiMessage), t.callbacks.onProgressCollapsed(!0), t.callbacks.dispatchResponseReceived(t.aiMessage, !0), !0;
836
+ }
837
+ function R(e, t) {
838
+ t && (e.state.progressCollapsed || (e.state.progressCollapsed = !0, e.callbacks.onProgressCollapsed(!0)), e.aiMessage.message = (e.aiMessage.message || "") + t, e.callbacks.onMessageUpdate(e.aiMessage));
839
+ }
840
+ function z(e, t, n = !1) {
841
+ t && (e.state.progressCollapsed = !0, e.callbacks.onProgressCollapsed(!0)), (n || t && e.aiMessage.message) && e.callbacks.dispatchResponseReceived(e.aiMessage, t);
842
+ }
843
+ function rt(e) {
844
+ for (let t of e) if (t && typeof t == "object" && t.type === "item") {
845
+ let e = t.value;
846
+ if (e && typeof e == "object") return e;
847
+ }
848
+ return null;
849
+ }
850
+ function B(e) {
851
+ let t = e.chart ?? e.generatedChart;
852
+ if (t && typeof t == "object") return t;
853
+ let n = e.aiMessageAssets ?? e.ai_message_assets;
854
+ if (Array.isArray(n)) {
855
+ let e = rt(n);
856
+ if (e) return e;
857
+ }
858
+ let r = e.result;
859
+ if (r && typeof r == "object") {
860
+ let e = r.assistant_message, t = e?.aiMessageAssets ?? e?.ai_message_assets;
861
+ if (Array.isArray(t)) return rt(t);
862
+ }
863
+ return null;
864
+ }
865
+ //#endregion
866
+ //#region src/components/ai-chat/stream/analyst-handler.ts
867
+ function V(e, t) {
868
+ if (F(e, t), I(e, t) || L(e, t)) return;
869
+ let n = N(e);
870
+ n && R(t, n), z(t, P(e), !!n);
871
+ }
872
+ //#endregion
873
+ //#region src/components/ai-chat/stream/dashboard-handler.ts
874
+ function H(e) {
875
+ for (let t of e) if (t && typeof t == "object" && t.type === "dashboard") {
876
+ let e = t.value;
877
+ if (e && typeof e == "object" && Array.isArray(e.views)) return e;
878
+ }
879
+ return null;
880
+ }
881
+ function U(e) {
882
+ for (let t of e) if (t && typeof t == "object" && t.type === "dashboard") {
883
+ let e = t.name;
884
+ if (e && typeof e == "object") return e;
885
+ }
886
+ }
887
+ function it(e) {
888
+ if (e.views && Array.isArray(e.views)) return e;
889
+ let t = e.aiMessageAssets ?? e.ai_message_assets;
890
+ if (Array.isArray(t)) return H(t);
891
+ let n = e.result;
892
+ if (n && typeof n == "object") {
893
+ let e = n.assistant_message, t = e?.aiMessageAssets ?? e?.ai_message_assets;
894
+ if (Array.isArray(t)) return H(t);
895
+ }
896
+ return null;
897
+ }
898
+ function at(...e) {
899
+ return e.find(Array.isArray);
900
+ }
901
+ function ot(e, t) {
902
+ if (e.asset_type !== "dashboard") return;
903
+ let n = e.asset_delta ?? e.delta;
904
+ if (n && typeof n == "object") {
905
+ let e = n;
906
+ t.state.dashboardSnapshot = {
907
+ ...t.state.dashboardSnapshot ?? { views: [] },
908
+ ...e,
909
+ views: e.views ?? t.state.dashboardSnapshot?.views ?? []
910
+ };
911
+ }
912
+ }
913
+ function st(e, t, n) {
914
+ e.callbacks.dispatchDashboardGenerated({
915
+ dashboard: t,
916
+ conversationId: e.callbacks.getConversationId(),
917
+ ...n ? { name: n } : {}
918
+ });
919
+ }
920
+ function ct(e, t) {
921
+ if (F(e, t), I(e, t) || L(e, t)) return;
922
+ if (e.type === "interrupt") {
923
+ let n = typeof e.question == "string" && e.question || typeof e.text == "string" && e.text || null;
924
+ n && (t.state.interruptQuestion = n, R(t, n));
925
+ return;
926
+ }
927
+ if (e.type === "asset_start" && e.asset_type === "dashboard") {
928
+ t.state.dashboardSnapshot = { views: [] };
929
+ return;
930
+ }
931
+ if (e.type === "asset_delta") {
932
+ ot(e, t);
933
+ return;
934
+ }
935
+ let n = N(e);
936
+ n && R(t, n);
937
+ let r = it(e);
938
+ if (r) {
939
+ t.state.dashboardSnapshot = r;
940
+ let n = r.aiMessageAssets ?? r.ai_message_assets, i = e.aiMessageAssets ?? e.ai_message_assets, a = e.result?.assistant_message, o = at(n, i, a?.aiMessageAssets ?? a?.ai_message_assets), s = o ? U(o) : void 0;
941
+ s && (t.state.dashboardName = s);
942
+ }
943
+ let i = P(e);
944
+ i && t.state.dashboardSnapshot && st(t, t.state.dashboardSnapshot, t.state.dashboardName), z(t, i, !!n);
945
+ }
946
+ //#endregion
947
+ //#region src/components/ai-chat/stream/item-handler.ts
948
+ function lt(e, t) {
949
+ let n = e.asset_type;
950
+ if (n && n !== "item") return;
951
+ let r = e.asset_delta ?? e.delta;
952
+ r && typeof r == "object" && (t.state.itemSnapshot = {
953
+ ...t.state.itemSnapshot,
954
+ ...r
955
+ });
956
+ }
957
+ function ut(e, t, n) {
958
+ n.aiMessage.hasChart = !0, typeof t.messageId == "string" && (n.aiMessage.apiMessageId = t.messageId);
959
+ let r = {
960
+ ...t,
961
+ generatedChart: e,
962
+ conversationId: n.callbacks.getConversationId()
963
+ };
964
+ n.callbacks.dispatchChartGenerated(r);
965
+ let i = M(t);
966
+ i ? R(n, i) : n.callbacks.onMessageUpdate(n.aiMessage);
967
+ }
968
+ function W(e, t) {
969
+ if (F(e, t), I(e, t) || L(e, t)) return;
970
+ if (e.type === "asset_start" && e.asset_type === "item") {
971
+ t.state.itemSnapshot = null;
972
+ return;
973
+ }
974
+ if (e.type === "asset_delta") {
975
+ lt(e, t);
976
+ return;
977
+ }
978
+ let n = N(e);
979
+ n && R(t, n);
980
+ let r = P(e), i = B(e) ?? (r ? t.state.itemSnapshot : null);
981
+ if (i) {
982
+ ut(i, e, t), r && z(t, !0, !!n);
983
+ return;
984
+ }
985
+ z(t, r, !!n);
986
+ }
987
+ //#endregion
988
+ //#region src/components/ai-chat/stream/registry.ts
989
+ function G(e) {
990
+ switch (e) {
991
+ case "dashboard": return ct;
992
+ case "analyst": return V;
993
+ default: return W;
994
+ }
995
+ }
996
+ function dt() {
997
+ return {
998
+ progressCollapsed: !1,
999
+ dashboardSnapshot: null,
1000
+ dashboardName: void 0,
1001
+ interruptQuestion: null,
1002
+ itemSnapshot: null
1003
+ };
1004
+ }
1005
+ //#endregion
1006
+ //#region src/components/ai-chat/session/ai-chat-session.ts
1007
+ function ft() {
1008
+ return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
1009
+ }
1010
+ var pt = class {
1011
+ constructor(e, t = {}) {
1012
+ this._uiBridgeCallbacks = {}, this._subscribers = /* @__PURE__ */ new Set(), this._state = {
1013
+ messages: [],
1014
+ selectedDatasets: [],
1015
+ isGenerating: !1,
1016
+ progress: null,
1017
+ progressCollapsed: !1,
1018
+ conversationId: null,
1019
+ inflightMessage: null
1020
+ }, this._abortController = null, this._inflightMessage = null, this._receivedProgress = !1, this._config = {
1021
+ apiUrl: "https://api.luzmo.com",
1022
+ apiVersion: "0.1.0",
1023
+ stream: !0,
1024
+ ...e
1025
+ }, this._hostCallbacks = t, this._state = {
1026
+ ...this._state,
1027
+ messages: e.messages ? [...e.messages] : [],
1028
+ selectedDatasets: e.selectedDatasets ? [...e.selectedDatasets] : [],
1029
+ conversationId: e.conversationId ?? null,
1030
+ isGenerating: e.isGenerating ?? !1,
1031
+ progress: e.progress ?? null,
1032
+ progressCollapsed: e.progressCollapsed ?? !1
1033
+ };
1034
+ }
1035
+ get state() {
1036
+ return this._state;
1037
+ }
1038
+ get isGenerating() {
1039
+ return this._state.isGenerating;
1040
+ }
1041
+ subscribe(e) {
1042
+ return this._subscribers.add(e), e(this._state), () => {
1043
+ this._subscribers.delete(e);
1044
+ };
1045
+ }
1046
+ setUiBridge(e) {
1047
+ this._uiBridgeCallbacks = e;
1048
+ }
1049
+ updateConfig(e) {
1050
+ this._config = {
1051
+ ...this._config,
1052
+ ...e
1053
+ };
1054
+ let t = {};
1055
+ if ("conversationId" in e) {
1056
+ let n = e.conversationId ?? null;
1057
+ n !== this._state.conversationId && (t.conversationId = n);
1058
+ }
1059
+ if ("selectedDatasets" in e && e.selectedDatasets) {
1060
+ let n = [...e.selectedDatasets];
1061
+ this._areSelectedDatasetsEqual(n, this._state.selectedDatasets) || (t.selectedDatasets = n);
1062
+ }
1063
+ if ("messages" in e && e.messages) {
1064
+ let n = [...e.messages];
1065
+ this._areChatMessagesEqual(n, this._state.messages) || (t.messages = n);
1066
+ }
1067
+ "isGenerating" in e && e.isGenerating !== this._state.isGenerating && (t.isGenerating = e.isGenerating), "progress" in e && (t.progress = e.progress ?? null), "progressCollapsed" in e && e.progressCollapsed !== this._state.progressCollapsed && (t.progressCollapsed = e.progressCollapsed), Object.keys(t).length > 0 && this._patchState(t);
1068
+ }
1069
+ setSelectedDatasets(e) {
1070
+ this._patchState({ selectedDatasets: [...e] }), this._emit("onDatasetsChanged", this._state.selectedDatasets);
1071
+ }
1072
+ addDataset(e) {
1073
+ this._state.selectedDatasets.some((t) => t.id === e.id) || (this._patchState({ selectedDatasets: [...this._state.selectedDatasets, e] }), this._emit("onDatasetsChanged", this._state.selectedDatasets));
1074
+ }
1075
+ removeDataset(e) {
1076
+ let t = this._state.selectedDatasets.filter((t) => t.id !== e);
1077
+ t.length !== this._state.selectedDatasets.length && (this._patchState({ selectedDatasets: t }), this._emit("onDatasetsChanged", this._state.selectedDatasets));
1078
+ }
1079
+ isDatasetRequirementMet() {
1080
+ return !this._config.requireDataset || this._state.selectedDatasets.length > 0;
1081
+ }
1082
+ getAiPromptUrl() {
1083
+ return qe(this._config.apiUrl ?? "https://api.luzmo.com", this._config.apiVersion ?? "0.1.0");
1084
+ }
1085
+ buildRequestBody(e, t) {
1086
+ return D(this._config.agent, {
1087
+ prompt: e,
1088
+ datasetIds: t,
1089
+ authKey: this._config.authKey,
1090
+ authToken: this._config.authToken,
1091
+ conversationId: this._state.conversationId,
1092
+ chart: this._config.chart ?? null,
1093
+ dashboard: this._config.dashboard ?? null,
1094
+ currentScreenMode: this._config.currentScreenMode,
1095
+ localeId: this._config.localeId,
1096
+ timezoneId: this._config.timezoneId,
1097
+ task: this._config.task,
1098
+ modelPreference: this._config.modelPreference,
1099
+ apiVersion: this._config.apiVersion,
1100
+ stream: this._config.stream
1101
+ });
1102
+ }
1103
+ buildPromptSubmittedDetail(e, t, n) {
1104
+ return {
1105
+ prompt: e,
1106
+ selectedDatasets: t,
1107
+ datasetIds: n,
1108
+ agent: this._config.agent,
1109
+ request: this.buildRequestBody(e, n),
1110
+ url: this.getAiPromptUrl()
1111
+ };
1112
+ }
1113
+ async submit(e) {
1114
+ let t = e.datasetIds ?? this._state.selectedDatasets.map((e) => e.id);
1115
+ if (!this.isDatasetRequirementMet()) return;
1116
+ this.abortInflight();
1117
+ let n = {
1118
+ id: e.aiMessageId ?? ft(),
1119
+ type: "ai",
1120
+ message: ""
1121
+ }, r = [...this._state.messages];
1122
+ if (!e.skipUserMessage) {
1123
+ let t = {
1124
+ id: ft(),
1125
+ type: "user",
1126
+ message: e.prompt
1127
+ };
1128
+ r = [...r, t], this._emit("onMessageSent", t, [...this._state.selectedDatasets]);
1129
+ }
1130
+ r = [...r, n], this._inflightMessage = n, this._receivedProgress = !1, this._patchState({
1131
+ messages: r,
1132
+ isGenerating: !0,
1133
+ progress: k(),
1134
+ progressCollapsed: !1,
1135
+ inflightMessage: n
1136
+ });
1137
+ let i = t, a = [...this._state.selectedDatasets];
1138
+ if (this._hasCallback("onPromptSubmitted")) {
1139
+ let t = this.buildPromptSubmittedDetail(e.prompt, a, i);
1140
+ try {
1141
+ await this._invokeCallback("onPromptSubmitted", t);
1142
+ } catch (e) {
1143
+ e.name === "AbortError" ? this.abort() : (this._handleSubmitError(e, n), this._finalizeInflightMessage()), this._patchState({ isGenerating: !1 });
1144
+ }
1145
+ return;
1146
+ }
1147
+ let o = this.buildRequestBody(e.prompt, t), s = new AbortController();
1148
+ this._abortController = s;
1149
+ let c = G(this._config.agent), l = {
1150
+ aiMessage: n,
1151
+ callbacks: this._createStreamCallbacks(),
1152
+ state: dt()
1153
+ }, u = this._config.fetchStreaming ?? $e, d = !1;
1154
+ try {
1155
+ let { body: e, conversationId: t } = await u({
1156
+ url: this.getAiPromptUrl(),
1157
+ body: o,
1158
+ signal: s.signal
1159
+ });
1160
+ t && this._setConversationId(t), await nt(e, (e) => c(e, l)), d = !0;
1161
+ } catch (e) {
1162
+ e.name !== "AbortError" && (this._handleSubmitError(e, n), d = !0);
1163
+ } finally {
1164
+ this._abortController === s && (d ? this._finalizeInflightMessage() : (this._removeInflightFromMessages(), this._inflightMessage = null, this._patchState({ inflightMessage: null })), this._patchState({ isGenerating: !1 }), this._abortController = null);
1165
+ }
1166
+ }
1167
+ async restore(e) {
1168
+ if (this._config.agent !== "item") return {};
1169
+ let t = O(e.restoreToMessageId, this._config.authKey, this._config.authToken, this._config.apiVersion, this._state.conversationId);
1170
+ if (this._patchState({
1171
+ isGenerating: !0,
1172
+ progress: null,
1173
+ progressCollapsed: !1
1174
+ }), this._hasCallback("onRestoreRequested")) {
1175
+ let n = {
1176
+ apiMessageId: e.restoreToMessageId,
1177
+ messageIndex: e.messageIndex,
1178
+ request: t,
1179
+ url: this.getAiPromptUrl()
1180
+ };
1181
+ try {
1182
+ await this._invokeCallback("onRestoreRequested", n);
1183
+ } finally {
1184
+ this._patchState({ isGenerating: !1 });
1185
+ }
1186
+ return {};
1187
+ }
1188
+ try {
1189
+ let n = await fetch(this.getAiPromptUrl(), {
1190
+ method: "POST",
1191
+ headers: { "Content-Type": "application/json" },
1192
+ mode: "cors",
1193
+ body: JSON.stringify(t)
1194
+ });
1195
+ if (!n.ok) {
1196
+ let e = await n.json().catch(() => null);
1197
+ throw Error(e?.message || `API request failed with status ${n.status}`);
1198
+ }
1199
+ let r = await n.json().catch(() => null), i = r?.generatedChart ?? (r ? B(r) : null), a = {
1200
+ ...typeof r?.message == "string" ? { message: r.message } : {},
1201
+ ...i ? { chart: {
1202
+ ...r,
1203
+ generatedChart: i
1204
+ } } : {}
1205
+ }, o = e.messageIndex >= 0 && e.messageIndex < this._state.messages.length ? this._state.messages.slice(0, e.messageIndex + 1) : this._state.messages;
1206
+ return a.message && o[e.messageIndex]?.type === "ai" && (o[e.messageIndex] = {
1207
+ ...o[e.messageIndex],
1208
+ message: a.message
1209
+ }), this._patchState({ messages: [...o] }), a.chart && this._emit("onChartGenerated", a.chart), a.message && o[e.messageIndex] && this._emit("onResponseReceived", o[e.messageIndex], !0), a;
1210
+ } finally {
1211
+ this._patchState({ isGenerating: !1 });
1212
+ }
1213
+ }
1214
+ buildRestoreRequest(e) {
1215
+ return O(e, this._config.authKey, this._config.authToken, this._config.apiVersion, this._state.conversationId);
1216
+ }
1217
+ abort() {
1218
+ this.abortInflight(), this._patchState({
1219
+ isGenerating: !1,
1220
+ progress: null,
1221
+ progressCollapsed: !1,
1222
+ inflightMessage: null
1223
+ });
1224
+ }
1225
+ abortInflight() {
1226
+ this._abortController?.abort(), this._abortController = null, this._removeEmptyInflightFromMessages(), this._inflightMessage = null;
1227
+ }
1228
+ _createStreamCallbacks() {
1229
+ return {
1230
+ onConversationIdChange: (e) => this._setConversationId(e),
1231
+ onProgress: (e) => {
1232
+ this._receivedProgress = !0, this._patchState({ progress: e });
1233
+ },
1234
+ onProgressCollapsed: (e) => {
1235
+ this._patchState({ progressCollapsed: e });
1236
+ },
1237
+ onMessageUpdate: (e) => {
1238
+ this._inflightMessage = e, this._upsertMessage(e), this._patchState({ inflightMessage: { ...e } });
1239
+ },
1240
+ dispatchChartGenerated: (e) => {
1241
+ this._emit("onChartGenerated", e);
1242
+ },
1243
+ dispatchDashboardGenerated: (e) => {
1244
+ this._emit("onDashboardGenerated", e);
1245
+ },
1246
+ dispatchResponseReceived: (e, t) => {
1247
+ this._emit("onResponseReceived", e, t);
1248
+ },
1249
+ getConversationId: () => this._state.conversationId
1250
+ };
1251
+ }
1252
+ _setConversationId(e) {
1253
+ this._config = {
1254
+ ...this._config,
1255
+ conversationId: e
1256
+ }, this._patchState({ conversationId: e }), this._emit("onConversationIdChange", e);
1257
+ }
1258
+ _upsertMessage(e) {
1259
+ let t = this._state.messages.findIndex((t) => t.id === e.id);
1260
+ if (t === -1) {
1261
+ this._patchState({ messages: [...this._state.messages, { ...e }] });
1262
+ return;
1263
+ }
1264
+ let n = this._state.messages.map((n, r) => r === t ? { ...e } : n);
1265
+ this._patchState({ messages: n });
1266
+ }
1267
+ _finalizeInflightMessage() {
1268
+ this._inflightMessage && (this._state.progress && this._receivedProgress && (this._inflightMessage.progress = structuredClone(this._state.progress), this._upsertMessage(this._inflightMessage)), this._inflightMessage = null, this._receivedProgress = !1, this._patchState({
1269
+ progress: null,
1270
+ progressCollapsed: !1,
1271
+ inflightMessage: null
1272
+ }));
1273
+ }
1274
+ _removeInflightFromMessages() {
1275
+ this._inflightMessage && this._patchState({ messages: this._state.messages.filter((e) => e.id !== this._inflightMessage.id) });
1276
+ }
1277
+ _removeEmptyInflightFromMessages() {
1278
+ this._inflightMessage && !this._inflightMessage.message ? this._removeInflightFromMessages() : this._inflightMessage && this._finalizeInflightMessage();
1279
+ }
1280
+ _handleSubmitError(e, t) {
1281
+ t.message = n("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" }), t.isError = !0, delete t.progress, this._inflightMessage = t, this._upsertMessage(t), this._patchState({
1282
+ inflightMessage: { ...t },
1283
+ progress: null,
1284
+ progressCollapsed: !1
1285
+ }), this._emit("onError", e, t), this._emit("onResponseReceived", t, !0, e);
1286
+ }
1287
+ _hasCallback(e) {
1288
+ return typeof this._hostCallbacks[e] == "function" || typeof this._uiBridgeCallbacks[e] == "function";
1289
+ }
1290
+ _emit(e, ...t) {
1291
+ this._invokeCallback(e, ...t);
1292
+ }
1293
+ async _invokeCallback(e, ...t) {
1294
+ let n = this._hostCallbacks[e], r = this._uiBridgeCallbacks[e];
1295
+ typeof n == "function" && await n(...t), typeof r == "function" && await r(...t);
1296
+ }
1297
+ _patchState(e) {
1298
+ this._state = {
1299
+ ...this._state,
1300
+ ...e
1301
+ }, this._emit("onStateChange", this._state);
1302
+ for (let e of this._subscribers) e(this._state);
1303
+ }
1304
+ _areSelectedDatasetsEqual(e, t) {
1305
+ return e.length === t.length ? e.every((e, n) => e.id === t[n]?.id) : !1;
1306
+ }
1307
+ _areChatMessagesEqual(e, t) {
1308
+ return e.length === t.length ? e.every((e, n) => {
1309
+ let r = t[n];
1310
+ return e.id === r?.id && e.apiMessageId === r?.apiMessageId && e.type === r?.type && e.message === r?.message && e.isError === r?.isError && e.hasChart === r?.hasChart && JSON.stringify(e.progress ?? null) === JSON.stringify(r?.progress ?? null);
1311
+ }) : !1;
1312
+ }
1313
+ };
1314
+ function K(e, t) {
1315
+ return new pt(e, t);
1316
+ }
1317
+ //#endregion
1318
+ //#region src/components/ai-chat/session/ai-chat-session-controller.ts
1319
+ var q = class {
1320
+ constructor(e) {
1321
+ this.options = e, this._session = null, this._ownsSession = !1, this._seededFromProps = !1, this._unsubscribe = null;
1322
+ }
1323
+ get current() {
1324
+ return this._session;
1325
+ }
1326
+ get state() {
1327
+ if (this._session) return this._session.state;
1328
+ let e = this.options.getSeed();
1329
+ return {
1330
+ messages: e.messages,
1331
+ selectedDatasets: e.selectedDatasets,
1332
+ isGenerating: !1,
1333
+ progress: null,
1334
+ progressCollapsed: !1,
1335
+ conversationId: e.conversationId,
1336
+ inflightMessage: null
1337
+ };
1338
+ }
1339
+ get ownsCurrentSession() {
1340
+ return this._ownsSession;
1341
+ }
1342
+ setSession(e) {
1343
+ if (!e) {
1344
+ this._clearSession();
1345
+ return;
1346
+ }
1347
+ this._ownsSession && this._session !== e && this._session?.abort(), this._ownsSession = !1, this._session = e, e.updateConfig(this.options.getConfig()), this._wire(e);
1348
+ }
1349
+ syncProperties(e) {
1350
+ if (!e.has("chatSession")) {
1351
+ if (this._createSessionIfMissing(), this._session) {
1352
+ let t = this.options.getConfig();
1353
+ Object.keys(t).some((t) => e.has(t)) && this._session.updateConfig(t);
1354
+ }
1355
+ (e.has("messages") || e.has("selectedDatasets")) && this._seedFromPropsOnce();
1356
+ }
1357
+ }
1358
+ requireSession() {
1359
+ return this._createSessionIfMissing(), this._session.updateConfig(this.options.getConfig()), this._session;
1360
+ }
1361
+ connect() {
1362
+ this._session && this._wire(this._session);
1363
+ }
1364
+ teardown() {
1365
+ this._unwire(), this._ownsSession &&= (this._session?.abort(), this._session = null, !1), this._seededFromProps = !1;
1366
+ }
1367
+ _createSessionIfMissing() {
1368
+ if (this._session) return;
1369
+ let e = this.options.getSeed();
1370
+ this._session = K({
1371
+ ...this.options.getConfig(),
1372
+ messages: e.messages.length > 0 ? [...e.messages] : void 0,
1373
+ selectedDatasets: e.selectedDatasets.length > 0 ? [...e.selectedDatasets] : void 0
1374
+ }), this._ownsSession = !0, this._seededFromProps = e.messages.length > 0 || e.selectedDatasets.length > 0, this._wire(this._session);
1375
+ }
1376
+ _clearSession() {
1377
+ this._unwire(), this._ownsSession && this._session?.abort(), this._session = null, this._ownsSession = !1;
1378
+ }
1379
+ _seedFromPropsOnce() {
1380
+ if (!this._ownsSession || this._seededFromProps) return;
1381
+ let e = this.requireSession(), t = this.options.getSeed(), n = {};
1382
+ e.state.messages.length === 0 && t.messages.length > 0 && (n.messages = [...t.messages]), e.state.selectedDatasets.length === 0 && t.selectedDatasets.length > 0 && (n.selectedDatasets = [...t.selectedDatasets]), Object.keys(n).length > 0 && (e.updateConfig(n), this._seededFromProps = !0);
1383
+ }
1384
+ _wire(e) {
1385
+ this._unwire(), e.setUiBridge(this.options.createDomBridge()), this._unsubscribe = e.subscribe(() => {
1386
+ this.options.onRenderNeeded();
1387
+ });
1388
+ }
1389
+ _unwire() {
1390
+ this._unsubscribe?.(), this._unsubscribe = null;
1391
+ }
1392
+ }, mt = ":host{box-sizing:border-box;flex-direction:column;width:100%;height:100%;display:flex}:host .chat-container{background:var(--luzmo-ai-chat-background,var(--ai-chat-background));border-radius:var(--luzmo-ai-chat-border-radius,var(--ai-chat-border-radius));width:100%;height:100%;min-height:0;padding:var(--luzmo-ai-chat-padding,var(--ai-chat-padding));gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));border:var(--luzmo-ai-chat-border,var(--ai-chat-border));box-shadow:var(--luzmo-ai-chat-box-shadow,var(--ai-chat-box-shadow));box-sizing:border-box;flex-direction:column;flex:1;display:flex;overflow:hidden}:host .chat-messages-container{gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));flex-direction:column;flex:1;min-height:0;display:flex;overflow:auto}:host .chat-messages-container luzmo-ai-chat-empty-state{flex:1;min-height:0}:host .chat-messages-container::-webkit-scrollbar{width:var(--luzmo-ai-chat-scrollbar-width,var(--ai-chat-scrollbar-width))}:host .chat-messages-container::-webkit-scrollbar-track{background:var(--luzmo-ai-chat-scrollbar-track-background,var(--ai-chat-scrollbar-track-background));border-radius:var(--luzmo-ai-chat-scrollbar-track-border-radius,var(--ai-chat-scrollbar-track-border-radius))}:host .chat-messages-container::-webkit-scrollbar-thumb{background:var(--luzmo-ai-chat-scrollbar-thumb-background,var(--ai-chat-scrollbar-thumb-background));border-radius:var(--luzmo-ai-chat-scrollbar-thumb-border-radius,var(--ai-chat-scrollbar-thumb-border-radius))}:host .chat-messages-container::-webkit-scrollbar-thumb:hover{background:var(--luzmo-ai-chat-scrollbar-thumb-hover-background,var(--ai-chat-scrollbar-thumb-hover-background))}:host .chat-messages-container{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-ai-chat-scrollbar-thumb-background,var(--ai-chat-scrollbar-thumb-background)) var(--luzmo-ai-chat-scrollbar-track-background,var(--ai-chat-scrollbar-track-background))}:host luzmo-chat-message{--luzmo-primary:rgba(var(--luzmo-primary-rgb), .08);--chat-message-primary-text-color:var(--luzmo-font-color);--chat-message-primary-border-color:transparent}:host luzmo-chat-message.error{color:var(--luzmo-ai-chat-error-message-color,var(--ai-chat-error-message-color))}:host .assistant-message-wrapper{justify-content:space-between;align-items:flex-start;gap:1rem;display:flex}:host .assistant-message-wrapper luzmo-chat-message{width:fit-content;display:contents}:host .assistant-context-menu-trigger{width:var(--luzmo-ai-chat-context-menu-trigger-size,var(--ai-chat-context-menu-trigger-size));height:var(--luzmo-ai-chat-context-menu-trigger-size,var(--ai-chat-context-menu-trigger-size));border:.0625rem solid var(--luzmo-ai-chat-context-menu-trigger-border-color,var(--ai-chat-context-menu-trigger-border-color));border-radius:var(--luzmo-ai-chat-context-menu-trigger-border-radius,var(--ai-chat-context-menu-trigger-border-radius));background:var(--luzmo-ai-chat-context-menu-trigger-background,var(--ai-chat-context-menu-trigger-background));color:var(--luzmo-ai-chat-context-menu-trigger-color,var(--ai-chat-context-menu-trigger-color));cursor:pointer;justify-content:center;align-items:center;padding:0;font-size:.875rem;line-height:1;transition:all .15s;display:inline-flex}:host .assistant-context-menu-trigger:hover{background:var(--luzmo-ai-chat-context-menu-trigger-hover-background,var(--ai-chat-context-menu-trigger-hover-background));border-color:var(--luzmo-ai-chat-context-menu-trigger-hover-border-color,var(--ai-chat-context-menu-trigger-hover-border-color));color:var(--luzmo-ai-chat-context-menu-trigger-hover-color,var(--ai-chat-context-menu-trigger-hover-color))}:host .assistant-context-menu-trigger:disabled{cursor:not-allowed;opacity:.6}:host .assistant-context-menu-trigger:disabled:hover{background:var(--luzmo-ai-chat-context-menu-trigger-background,var(--ai-chat-context-menu-trigger-background));border-color:var(--luzmo-ai-chat-context-menu-trigger-border-color,var(--ai-chat-context-menu-trigger-border-color));color:var(--luzmo-ai-chat-context-menu-trigger-color,var(--ai-chat-context-menu-trigger-color))}:host .assistant-context-menu-item{width:100%;color:var(--luzmo-font-color);text-align:start;cursor:pointer;font-family:var(--luzmo-ai-chat-context-menu-item-font-family,var(--ai-chat-context-menu-item-font-family));background:0 0;border:0;padding:.5rem .75rem}:host .assistant-context-menu-item:hover{background:var(--luzmo-ai-chat-context-menu-item-hover-background,var(--ai-chat-context-menu-item-hover-background))}:host .assistant-context-menu-item:disabled{opacity:.4;cursor:not-allowed}:host .assistant-context-menu-item:disabled:hover{background:0 0}:host luzmo-ai-interaction-textarea{flex-grow:0;flex-shrink:0}:host luzmo-progress-steps{padding:0 .25rem}:host .loading-message{color:var(--luzmo-font-color);align-items:center;gap:.5rem;display:flex}:host .loading-message svg{color:var(--luzmo-ai-chat-loading-message-color,var(--ai-chat-loading-message-color));font-size:var(--luzmo-ai-chat-loading-message-icon-font-size,var(--ai-chat-loading-message-icon-font-size,1rem));justify-content:center;align-items:center;display:flex}:host .loading-message svg.spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){:host .assistant-context-menu-trigger{transition:none}:host .loading-message svg.spin{animation:none}}:host{--ai-chat-background:var(--luzmo-background-color);--ai-chat-border-radius:0;--ai-chat-padding:0;--ai-chat-gap:1rem;--ai-chat-border:none;--ai-chat-box-shadow:none;--ai-chat-loading-message-color:var(--luzmo-primary);--ai-chat-loading-message-icon-font-size:1rem;--ai-chat-error-message-color:var(--luzmo-danger,#dc3545);--ai-chat-scrollbar-width:var(--luzmo-scrollbar-size);--ai-chat-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--ai-chat-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--ai-chat-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--ai-chat-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--ai-chat-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background);--ai-chat-context-menu-trigger-size:1.5rem;--ai-chat-context-menu-trigger-border-color:var(--luzmo-border-color);--ai-chat-context-menu-trigger-border-radius:.375rem;--ai-chat-context-menu-trigger-background:var(--luzmo-background-color,transparent);--ai-chat-context-menu-trigger-color:var(--luzmo-font-color,#5a5a5a);--ai-chat-context-menu-trigger-hover-background:var(--luzmo-background-color-hover,#4434ff14);--ai-chat-context-menu-trigger-hover-border-color:var(--luzmo-border-color-hover,var(--luzmo-border-color));--ai-chat-context-menu-trigger-hover-color:var(--luzmo-font-color,#5a5a5a);--ai-chat-context-menu-item-hover-background:var(--luzmo-background-color-hover,#4434ff14);--ai-chat-context-menu-item-font-family:var(--luzmo-font-family)}", J = class extends e {
1393
+ constructor(...e) {
1394
+ super(...e), this.messages = [], this.selectedDatasets = [], this.placeholder = "Describe your change", this.disabled = !1, this.showAssistantContextMenu = !1, this.authKey = "", this.authToken = "", this.apiUrl = "https://api.luzmo.com", this.appServer = "https://app.luzmo.com", this.flagOpendata = !1, this.hideDatasetButton = !1, this.hideDatasetIcons = !1, this.disableDatasetModification = !1, this.hideSelectedDatasets = !1, this.disableColumnMentions = !1, this.requireDataset = !1, this.agent = "item", this.task = "generate", this.modelPreference = "performance", this.chatSession = null, this.conversationId = null, this.chart = null, this.dashboard = null, this.timezoneId = "UTC", this.apiVersion = "0.1.0", this.stream = !0, this.loadingMessage = null, this.initialPrompt = null, this.emptyStateTitle = "", this.emptyStateSubtitle = "", this.emptyStateSuggestions = [], this._textareaValue = "", this._lastProcessedInitialPrompt = null, this._session = new q({
1395
+ getConfig: () => this._buildSessionConfig(),
1396
+ getSeed: () => ({
1397
+ messages: this.messages,
1398
+ selectedDatasets: this.selectedDatasets,
1399
+ conversationId: this.conversationId
1400
+ }),
1401
+ createDomBridge: () => this._createDomBridgeCallbacks(),
1402
+ onRenderNeeded: () => {
1403
+ this.requestUpdate(), this.updateComplete.then(() => this._scrollToBottom());
1404
+ }
1405
+ });
1406
+ }
1407
+ static {
1408
+ this.styles = c(mt);
1409
+ }
1410
+ static {
1411
+ this.tagName = "luzmo-ai-chat";
1412
+ }
1413
+ get session() {
1414
+ return this._session.current;
1415
+ }
1416
+ _getRenderState() {
1417
+ return this._session.state;
1418
+ }
1419
+ _createDomBridgeCallbacks() {
1420
+ return {
1421
+ onMessageSent: (e, t) => {
1422
+ this.dispatchEvent(new CustomEvent("luzmo-message-sent", {
1423
+ detail: {
1424
+ message: e,
1425
+ selectedDatasets: t
1426
+ },
1427
+ bubbles: !0,
1428
+ composed: !0
1429
+ }));
1430
+ },
1431
+ onDatasetsChanged: (e) => {
1432
+ this.dispatchEvent(new CustomEvent("luzmo-datasets-changed", {
1433
+ detail: { selectedDatasets: e },
1434
+ bubbles: !0,
1435
+ composed: !0
1436
+ }));
1437
+ },
1438
+ onConversationIdChange: (e) => this._emitConversationIdChanged(e),
1439
+ onChartGenerated: (e) => {
1440
+ this.dispatchEvent(new CustomEvent("luzmo-chart-generated", {
1441
+ detail: { aiSampleChart: e },
1442
+ bubbles: !0,
1443
+ composed: !0
1444
+ }));
1445
+ },
1446
+ onDashboardGenerated: (e) => {
1447
+ this.dispatchEvent(new CustomEvent("luzmo-dashboard-generated", {
1448
+ detail: e,
1449
+ bubbles: !0,
1450
+ composed: !0
1451
+ }));
1452
+ },
1453
+ onResponseReceived: (e, t, n) => {
1454
+ this.dispatchEvent(new CustomEvent("luzmo-response-received", {
1455
+ detail: {
1456
+ message: e,
1457
+ done: t,
1458
+ ...n === void 0 ? {} : { error: n }
1459
+ },
1460
+ bubbles: !0,
1461
+ composed: !0
1462
+ }));
1463
+ }
1464
+ };
1465
+ }
1466
+ _buildSessionConfig() {
1467
+ return {
1468
+ agent: this.agent,
1469
+ authKey: this.authKey,
1470
+ authToken: this.authToken,
1471
+ apiUrl: this.apiUrl,
1472
+ apiVersion: this.apiVersion,
1473
+ stream: this.stream,
1474
+ conversationId: this.conversationId,
1475
+ chart: this.chart,
1476
+ dashboard: this.dashboard,
1477
+ currentScreenMode: this.currentScreenMode,
1478
+ localeId: this.localeId,
1479
+ timezoneId: this.timezoneId,
1480
+ task: this.task,
1481
+ modelPreference: this.modelPreference,
1482
+ requireDataset: this.requireDataset
1483
+ };
1484
+ }
1485
+ _emitConversationIdChanged(e) {
1486
+ this.conversationId = e, this.dispatchEvent(new CustomEvent("luzmo-conversation-id-changed", {
1487
+ detail: { conversationId: e },
1488
+ bubbles: !0,
1489
+ composed: !0
1490
+ }));
1491
+ }
1492
+ async _restoreViaSession(e, t) {
1493
+ await this._session.requireSession().restore({
1494
+ restoreToMessageId: e,
1495
+ messageIndex: t
1496
+ });
1497
+ }
1498
+ async _handleRestoreState(e, t) {
1499
+ if (e.apiMessageId && this.agent === "item") try {
1500
+ await this._restoreViaSession(e.apiMessageId, t);
1501
+ } catch (e) {
1502
+ console.error("AI restore error:", e);
1503
+ }
1504
+ }
1505
+ _handleDatasetSelected(e) {
1506
+ this._session.requireSession().addDataset(e.detail);
1507
+ }
1508
+ _handleDatasetRemoved(e) {
1509
+ this._session.requireSession().removeDataset(e.detail.id);
1510
+ }
1511
+ async _submitViaSession(e, t = {}) {
1512
+ let n = this._session.requireSession();
1513
+ if (n.isDatasetRequirementMet()) {
1514
+ this._textareaValue = "";
1515
+ try {
1516
+ await n.submit({
1517
+ prompt: e,
1518
+ ...t
1519
+ });
1520
+ } catch (e) {
1521
+ e.name !== "AbortError" && console.error("AI prompt session error:", e);
1522
+ }
1523
+ }
1524
+ }
1525
+ async _handlePromptSubmitted(e) {
1526
+ await this._submitViaSession(e.detail.prompt);
1527
+ }
1528
+ async _handleEmptyStateSuggestionSelected(e) {
1529
+ let { prompt: t, selectedDatasets: n } = e.detail, r = this._session.requireSession();
1530
+ n?.length && r.setSelectedDatasets(n), await this._submitViaSession(t);
1531
+ }
1532
+ async _processInitialPrompt() {
1533
+ !this.initialPrompt || this.initialPrompt === this._lastProcessedInitialPrompt || this._session.requireSession().isDatasetRequirementMet() && (this._lastProcessedInitialPrompt = this.initialPrompt, await this._submitViaSession(this.initialPrompt, { skipUserMessage: !0 }));
1534
+ }
1535
+ connectedCallback() {
1536
+ super.connectedCallback(), this._session.connect();
1537
+ }
1538
+ disconnectedCallback() {
1539
+ super.disconnectedCallback(), this._session.teardown();
1540
+ }
1541
+ _scrollToBottom() {
1542
+ let e = this.shadowRoot?.querySelector(".chat-messages-container");
1543
+ e && requestAnimationFrame(() => {
1544
+ requestAnimationFrame(() => {
1545
+ e.scrollTop = e.scrollHeight;
1546
+ });
1547
+ });
1548
+ }
1549
+ updated(e) {
1550
+ super.updated?.(e), this._syncSession(e), this._handleInitialPromptChange();
1551
+ }
1552
+ _syncSession(e) {
1553
+ if (e.has("chatSession")) {
1554
+ this._session.setSession(this.chatSession);
1555
+ return;
1556
+ }
1557
+ this._session.syncProperties(e);
1558
+ }
1559
+ _handleInitialPromptChange() {
1560
+ this.initialPrompt && this.initialPrompt !== this._lastProcessedInitialPrompt ? this._processInitialPrompt() : this.initialPrompt || (this._lastProcessedInitialPrompt = null);
1561
+ }
1562
+ _sanitizeMessage(e) {
1563
+ return Ge.sanitize(e, {
1564
+ ALLOWED_TAGS: [
1565
+ "p",
1566
+ "br",
1567
+ "strong",
1568
+ "em",
1569
+ "b",
1570
+ "i",
1571
+ "u",
1572
+ "s",
1573
+ "code",
1574
+ "pre",
1575
+ "blockquote",
1576
+ "ul",
1577
+ "ol",
1578
+ "li",
1579
+ "a"
1580
+ ],
1581
+ ALLOWED_ATTR: [
1582
+ "href",
1583
+ "title",
1584
+ "target",
1585
+ "rel"
1586
+ ],
1587
+ ALLOW_DATA_ATTR: !1,
1588
+ FORBID_TAGS: [
1589
+ "script",
1590
+ "iframe",
1591
+ "object",
1592
+ "embed",
1593
+ "form",
1594
+ "input",
1595
+ "button"
1596
+ ],
1597
+ FORBID_ATTR: [
1598
+ "onerror",
1599
+ "onload",
1600
+ "onclick",
1601
+ "onmouseover",
1602
+ "onfocus",
1603
+ "onblur"
1604
+ ]
1605
+ });
1606
+ }
1607
+ _renderProgress() {
1608
+ let { progress: e, progressCollapsed: t } = this._getRenderState();
1609
+ return e?.children?.length ? o`
1610
+ <luzmo-progress-steps
1611
+ .progress=${e}
1612
+ ?collapsed=${t}
1613
+ size="s"
1614
+ ></luzmo-progress-steps>
1615
+ ` : s;
1616
+ }
1617
+ _isLastAiMessageWithProgress(e, t) {
1618
+ for (let n = t.length - 1; n >= 0; n--) if (t[n].type === "ai" && t[n].progress?.children?.length) return t[n].id === e.id;
1619
+ return !1;
1620
+ }
1621
+ _renderRestoreMenu(e, t, a, c = !1) {
1622
+ if (!(this.agent === "item" && this.showAssistantContextMenu && e.hasChart && e.apiMessageId && !e.isError && e.id !== a)) return s;
1623
+ let l = `context-menu-trigger-${e.apiMessageId}`;
1624
+ return o`
1625
+ <div class="assistant-context-menu">
1626
+ <button
1627
+ id=${l}
1628
+ class="assistant-context-menu-trigger"
1629
+ type="button"
1630
+ aria-label=${n("Open restore menu", { desc: "Accessible label for the ai chat restore menu trigger" })}
1631
+ aria-haspopup="menu"
1632
+ ?disabled=${c}
1633
+ >
1634
+ ${i(r)}
1635
+ </button>
1636
+ <luzmo-overlay
1637
+ trigger="${l}@click"
1638
+ placement="bottom-end"
1639
+ >
1640
+ <luzmo-popover>
1641
+ <button
1642
+ class="assistant-context-menu-item"
1643
+ type="button"
1644
+ ?disabled=${c}
1645
+ @click=${() => this._handleRestoreState(e, t)}
1646
+ >
1647
+ ${n("Restore state", { desc: "Context menu action that restores the chart to this message state" })}
1648
+ </button>
1649
+ </luzmo-popover>
1650
+ </luzmo-overlay>
1651
+ </div>
1652
+ `;
1653
+ }
1654
+ _renderMessages() {
1655
+ let { messages: e, inflightMessage: t, isGenerating: n } = this._getRenderState(), r = t !== null, i = [...e].reverse().find((e) => e.type === "ai")?.id, a = e.filter((e) => !t || e.id !== t.id);
1656
+ return a.map((t) => {
1657
+ let c = !!t.progress?.children?.length, l = c && this._isLastAiMessageWithProgress(t, a), u = c && (r || n || !l), ee = c ? o`
1658
+ <luzmo-progress-steps
1659
+ .progress=${t.progress}
1660
+ ?condensed=${u}
1661
+ collapsed
1662
+ no-animate
1663
+ size="s"
1664
+ ></luzmo-progress-steps>
1665
+ ` : s;
1666
+ if (t.type === "user") return o`
1667
+ <luzmo-chat-message
1668
+ avatar-placement="bottom"
1669
+ position="right"
1670
+ variant="primary"
1671
+ size="s"
1672
+ >
1673
+ ${t.message}
1674
+ </luzmo-chat-message>
1675
+ `;
1676
+ let te = e.indexOf(t);
1677
+ return o`
1678
+ ${ee}
1679
+ <div class="assistant-message-wrapper">
1680
+ <luzmo-chat-message
1681
+ class=${t.isError ? "error" : ""}
1682
+ role=${t.isError ? "alert" : s}
1683
+ avatar-placement="bottom"
1684
+ position="left"
1685
+ quiet
1686
+ size="s"
1687
+ >
1688
+ ${d(this._sanitizeMessage(t.message))}
1689
+ </luzmo-chat-message>
1690
+
1691
+ ${this._renderRestoreMenu(t, te, i, r)}
1692
+ </div>
1693
+ `;
1694
+ });
1695
+ }
1696
+ _renderStreamingResponse() {
1697
+ let { inflightMessage: e } = this._getRenderState();
1698
+ return e?.message ? o`
1699
+ <luzmo-chat-message
1700
+ avatar-placement="bottom"
1701
+ position="left"
1702
+ quiet
1703
+ size="s"
1704
+ >
1705
+ ${d(this._sanitizeMessage(e.message))}
1706
+ </luzmo-chat-message>
1707
+ ` : s;
1708
+ }
1709
+ _renderLoadingMessage() {
1710
+ let { isGenerating: e, progress: t } = this._getRenderState();
1711
+ if (!e || t?.children?.length) return s;
1712
+ let r = this.agent === "dashboard" ? !this.dashboard : this.chart?.type === "placeholder", c = this.agent === "dashboard" ? r ? n("Creating dashboard...", { desc: "Label for ai chat creating dashboard message" }) : n("Updating dashboard...", { desc: "Label for ai chat updating dashboard message" }) : r ? n("Creating item...", { desc: "Label for ai chat creating item message" }) : n("Updating item...", { desc: "Label for ai chat updating item message" });
1713
+ return o`
1714
+ <luzmo-chat-message
1715
+ avatar-placement="bottom"
1716
+ position="left"
1717
+ quiet
1718
+ size="s"
1719
+ >
1720
+ <div class="loading-message" role="status" aria-live="polite">
1721
+ <span class="icon-lg">${i(a, { className: "spin" })}</span>
1722
+ <span class="loading-message-text">${this.loadingMessage || c}</span>
1723
+ </div>
1724
+ </luzmo-chat-message>
1725
+ `;
1726
+ }
1727
+ _renderEmptyState() {
1728
+ if (this._getRenderState().messages.length > 0) return s;
1729
+ let e = n("What can I help you with?", { desc: "Title for the AI chat empty state" }), t = this.emptyStateSuggestions.length > 0;
1730
+ return o`
1731
+ <luzmo-ai-chat-empty-state
1732
+ .title=${this.emptyStateTitle || e}
1733
+ .subtitle=${t ? this.emptyStateSubtitle : ""}
1734
+ .suggestions=${this.emptyStateSuggestions}
1735
+ ?disabled=${this.disabled || this._getRenderState().isGenerating}
1736
+ @luzmo-suggestion-selected=${this._handleEmptyStateSuggestionSelected}
1737
+ ></luzmo-ai-chat-empty-state>
1738
+ `;
1739
+ }
1740
+ render() {
1741
+ let { selectedDatasets: e, isGenerating: t } = this._getRenderState();
1742
+ return o`
1743
+ <div class="chat-container" role="region" aria-label=${n("AI Chat", { desc: "Accessible label for AI chat region" })}>
1744
+ <div class="chat-messages-container" role="log" aria-live="polite">
1745
+ ${this._renderEmptyState()}
1746
+ ${this._renderMessages()}
1747
+ ${this._renderProgress()}
1748
+ ${this._renderStreamingResponse()}
1749
+ ${this._renderLoadingMessage()}
1750
+ </div>
1751
+
1752
+ <luzmo-ai-interaction-textarea
1753
+ role="group"
1754
+ aria-label=${n("AI prompt input", { desc: "Accessible label for the ai chat prompt input area" })}
1755
+ .value=${this._textareaValue}
1756
+ .selectedDatasets=${e}
1757
+ .placeholder=${this.placeholder}
1758
+ ?disabled=${this.disabled}
1759
+ ?is-generating=${t}
1760
+ ?hide-dataset-button=${this.hideDatasetButton}
1761
+ ?hide-dataset-icons=${this.hideDatasetIcons}
1762
+ ?disable-dataset-modification=${this.disableDatasetModification}
1763
+ ?hide-selected-datasets=${this.hideSelectedDatasets}
1764
+ ?disable-column-mentions=${this.disableColumnMentions}
1765
+ ?require-dataset=${this.requireDataset}
1766
+ auth-key=${this.authKey}
1767
+ auth-token=${this.authToken}
1768
+ api-url=${this.apiUrl}
1769
+ app-server=${this.appServer}
1770
+ ?flag-opendata=${this.flagOpendata}
1771
+ @prompt-submitted=${this._handlePromptSubmitted}
1772
+ @dataset-selected=${this._handleDatasetSelected}
1773
+ @dataset-removed=${this._handleDatasetRemoved}
1774
+ ></luzmo-ai-interaction-textarea>
1775
+ </div>
1776
+ `;
1777
+ }
1778
+ };
1779
+ //#endregion
1780
+ //#region src/components/ai-chat/index.ts
1781
+ t([l({ type: Array })], J.prototype, "messages", void 0), t([l({
1782
+ type: Array,
1783
+ attribute: "selected-datasets"
1784
+ })], J.prototype, "selectedDatasets", void 0), t([l({ type: String })], J.prototype, "placeholder", void 0), t([l({
1785
+ type: Boolean,
1786
+ reflect: !0
1787
+ })], J.prototype, "disabled", void 0), t([l({
1788
+ type: Boolean,
1789
+ attribute: "show-assistant-context-menu"
1790
+ })], J.prototype, "showAssistantContextMenu", void 0), t([l({
1791
+ type: String,
1792
+ attribute: "auth-key"
1793
+ })], J.prototype, "authKey", void 0), t([l({
1794
+ type: String,
1795
+ attribute: "auth-token"
1796
+ })], J.prototype, "authToken", void 0), t([l({
1797
+ type: String,
1798
+ attribute: "api-url"
1799
+ })], J.prototype, "apiUrl", void 0), t([l({
1800
+ type: String,
1801
+ attribute: "app-server"
1802
+ })], J.prototype, "appServer", void 0), t([l({
1803
+ type: Boolean,
1804
+ attribute: "flag-opendata"
1805
+ })], J.prototype, "flagOpendata", void 0), t([l({
1806
+ type: Boolean,
1807
+ attribute: "hide-dataset-button"
1808
+ })], J.prototype, "hideDatasetButton", void 0), t([l({
1809
+ type: Boolean,
1810
+ attribute: "hide-dataset-icons"
1811
+ })], J.prototype, "hideDatasetIcons", void 0), t([l({
1812
+ type: Boolean,
1813
+ attribute: "disable-dataset-modification"
1814
+ })], J.prototype, "disableDatasetModification", void 0), t([l({
1815
+ type: Boolean,
1816
+ attribute: "hide-selected-datasets"
1817
+ })], J.prototype, "hideSelectedDatasets", void 0), t([l({
1818
+ type: Boolean,
1819
+ attribute: "disable-column-mentions"
1820
+ })], J.prototype, "disableColumnMentions", void 0), t([l({
1821
+ type: Boolean,
1822
+ attribute: "require-dataset"
1823
+ })], J.prototype, "requireDataset", void 0), t([l({ type: String })], J.prototype, "agent", void 0), t([l({ type: String })], J.prototype, "task", void 0), t([l({
1824
+ type: String,
1825
+ attribute: "model-preference"
1826
+ })], J.prototype, "modelPreference", void 0), t([l({ attribute: !1 })], J.prototype, "chatSession", void 0), t([l({
1827
+ type: String,
1828
+ attribute: "conversation-id"
1829
+ })], J.prototype, "conversationId", void 0), t([l({
1830
+ type: Object,
1831
+ attribute: "chart"
1832
+ })], J.prototype, "chart", void 0), t([l({ type: Object })], J.prototype, "dashboard", void 0), t([l({
1833
+ type: String,
1834
+ attribute: "current-screen-mode"
1835
+ })], J.prototype, "currentScreenMode", void 0), t([l({
1836
+ type: String,
1837
+ attribute: "locale-id"
1838
+ })], J.prototype, "localeId", void 0), t([l({
1839
+ type: String,
1840
+ attribute: "timezone-id"
1841
+ })], J.prototype, "timezoneId", void 0), t([l({
1842
+ type: String,
1843
+ attribute: "api-version"
1844
+ })], J.prototype, "apiVersion", void 0), t([l({ converter: { fromAttribute: (e) => e !== "false" && e !== null } })], J.prototype, "stream", void 0), t([l({
1845
+ type: String,
1846
+ attribute: "loading-message"
1847
+ })], J.prototype, "loadingMessage", void 0), t([l({
1848
+ type: String,
1849
+ attribute: "initial-prompt"
1850
+ })], J.prototype, "initialPrompt", void 0), t([l({
1851
+ type: String,
1852
+ attribute: "empty-state-title"
1853
+ })], J.prototype, "emptyStateTitle", void 0), t([l({
1854
+ type: String,
1855
+ attribute: "empty-state-subtitle"
1856
+ })], J.prototype, "emptyStateSubtitle", void 0), t([l({
1857
+ type: Array,
1858
+ attribute: !1
1859
+ })], J.prototype, "emptyStateSuggestions", void 0), t([u()], J.prototype, "_textareaValue", void 0), customElements.get("luzmo-ai-chat") || customElements.define("luzmo-ai-chat", J);
1860
+ //#endregion
1861
+ export { Ze as _, dt as a, qe as b, k as c, et as d, nt as f, E as g, D as h, K as i, $e as l, Qe as m, q as n, G as o, O as p, pt as r, B as s, J as t, A as u, T as v, w as x, Je as y };