@luzmo/analytics-components-kit 1.0.3-beta.4 → 1.0.3-beta.6

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 (236) hide show
  1. package/components/ai-chat/ai-chat-request.d.ts +11 -0
  2. package/components/ai-chat/ai-chat.d.ts +59 -54
  3. package/components/ai-chat/ai-prompt-types.d.ts +93 -0
  4. package/components/ai-chat/index.cjs +1 -1
  5. package/components/ai-chat/index.d.ts +9 -4
  6. package/components/ai-chat/index.js +2 -2
  7. package/components/ai-chat/session/ai-chat-session-controller.d.ts +51 -0
  8. package/components/ai-chat/session/ai-chat-session-types.d.ts +86 -0
  9. package/components/ai-chat/session/ai-chat-session.d.ts +81 -0
  10. package/components/ai-chat/session/index.d.ts +2 -0
  11. package/components/ai-chat/{ai-chat-streaming.d.ts → stream/ai-chat-streaming.d.ts} +6 -0
  12. package/components/ai-chat/stream/analyst-handler.d.ts +3 -0
  13. package/components/ai-chat/stream/dashboard-handler.d.ts +4 -0
  14. package/components/ai-chat/stream/index.d.ts +8 -0
  15. package/components/ai-chat/stream/item-handler.d.ts +2 -0
  16. package/components/ai-chat/stream/registry.d.ts +5 -0
  17. package/components/ai-chat/stream/shared.d.ts +10 -0
  18. package/components/ai-chat/stream/types.d.ts +26 -0
  19. package/components/ai-chat-CY73iYCg.cjs +154 -0
  20. package/components/ai-chat-DVU9XiA2.js +1788 -0
  21. package/components/ai-interaction-textarea/index.cjs +1 -1
  22. package/components/ai-interaction-textarea/index.js +1 -1
  23. package/components/{ai-interaction-textarea-BJHzUcBF.js → ai-interaction-textarea-DI98QoMZ.js} +3 -3
  24. package/components/{ai-interaction-textarea-Bd1AGBmB.cjs → ai-interaction-textarea-DqWt823F.cjs} +1 -1
  25. package/components/{base-BAzY-whv.js → base-D3ehdFno.js} +1 -1
  26. package/components/{base-CbpjVnVy.cjs → base-HUGXYn6t.cjs} +1 -1
  27. package/components/data-field/index.cjs +1 -1
  28. package/components/data-field/index.js +1 -1
  29. package/components/{data-field-97uH3l6o.cjs → data-field-DSzU9Apl.cjs} +1 -1
  30. package/components/{data-field-tfAMLb-d.js → data-field-DwSYggPc.js} +3 -3
  31. package/components/data-field-level/index.cjs +1 -1
  32. package/components/data-field-level/index.js +1 -1
  33. package/components/{data-field-level-BsDTHrJ6.js → data-field-level-BquNqRm1.js} +1 -1
  34. package/components/{data-field-level-6npuFtQo.cjs → data-field-level-CYUtLiIi.cjs} +1 -1
  35. package/components/data-field-panel/index.cjs +1 -1
  36. package/components/data-field-panel/index.js +1 -1
  37. package/components/{data-field-panel-Dv5nfM0z.cjs → data-field-panel-B_83HNyI.cjs} +1 -1
  38. package/components/{data-field-panel-P2t8d6sG.js → data-field-panel-Bqslx0EB.js} +3 -3
  39. package/components/data-fields-select/index.cjs +1 -1
  40. package/components/data-fields-select/index.js +1 -1
  41. package/components/{data-fields-select-B7vJTdZO.cjs → data-fields-select-BZj1cpL5.cjs} +1 -1
  42. package/components/{data-fields-select-DHnnYhbr.js → data-fields-select-t1ikPTLw.js} +1 -1
  43. package/components/dataset-selector-list/index.cjs +1 -1
  44. package/components/dataset-selector-list/index.js +1 -1
  45. package/components/{dataset-selector-list-DbCmavOc.cjs → dataset-selector-list-Bta-CGoN.cjs} +1 -1
  46. package/components/{dataset-selector-list-CXnDkIe2.js → dataset-selector-list-Ho8JnQp7.js} +1 -1
  47. package/components/dataset-selector-row/index.cjs +1 -1
  48. package/components/dataset-selector-row/index.js +1 -1
  49. package/components/{dataset-selector-row-HFt4sJN8.js → dataset-selector-row-8hgsmMRg.js} +4 -2
  50. package/components/{dataset-selector-row-D1U4ltKv.cjs → dataset-selector-row-CKhHK1H5.cjs} +2 -2
  51. package/components/{de-B8ds_DbE.cjs → de-CVLDoWlp.cjs} +1 -1
  52. package/components/{de-DMnvmNFg.js → de-D2bZwq4D.js} +6 -1
  53. package/components/display-settings/index.cjs +1 -1
  54. package/components/display-settings/index.js +1 -1
  55. package/components/{display-settings-BLf7lBww.cjs → display-settings-Bmb0HUlu.cjs} +1 -1
  56. package/components/{display-settings-BLMrlvMS.js → display-settings-Di9dXtUM.js} +1 -1
  57. package/components/display-settings-binning/index.cjs +1 -1
  58. package/components/display-settings-binning/index.js +1 -1
  59. package/components/{display-settings-binning-hCJ0qkt5.js → display-settings-binning-B8qUIt6T.js} +2 -2
  60. package/components/{display-settings-binning-BAg6FoqJ.cjs → display-settings-binning-CpwCqvwm.cjs} +1 -1
  61. package/components/display-settings-datetime/index.cjs +1 -1
  62. package/components/display-settings-datetime/index.js +1 -1
  63. package/components/{display-settings-datetime-BzeNlKLC.cjs → display-settings-datetime-3M3DvzTN.cjs} +1 -1
  64. package/components/{display-settings-datetime-CCxok7d7.js → display-settings-datetime-C8JfjDJK.js} +2 -2
  65. package/components/display-settings-grand-totals/index.cjs +1 -1
  66. package/components/display-settings-grand-totals/index.js +1 -1
  67. package/components/{display-settings-grand-totals-HDpr3IJ5.cjs → display-settings-grand-totals-DMDa6C5k.cjs} +1 -1
  68. package/components/{display-settings-grand-totals-C1N1cehl.js → display-settings-grand-totals-kyfMh55D.js} +2 -2
  69. package/components/display-settings-numeric/index.cjs +1 -1
  70. package/components/display-settings-numeric/index.js +1 -1
  71. package/components/{display-settings-numeric-DSs20wUu.cjs → display-settings-numeric-B51KddXI.cjs} +1 -1
  72. package/components/{display-settings-numeric-oyCfBAGV.js → display-settings-numeric-Cw8Nx5s9.js} +2 -2
  73. package/components/display-settings-period-over-period/index.cjs +1 -1
  74. package/components/display-settings-period-over-period/index.js +1 -1
  75. package/components/{display-settings-period-over-period-h8bA3V5C.js → display-settings-period-over-period-B2AN0rwz.js} +2 -2
  76. package/components/{display-settings-period-over-period-CcX7vQnt.cjs → display-settings-period-over-period-CjjA2NqZ.cjs} +1 -1
  77. package/components/{es-Cc258uTs.js → es-9-jszdOJ.js} +6 -1
  78. package/components/{es-DGC51Dm9.cjs → es-Byjf7YBI.cjs} +1 -1
  79. package/components/filter-expression-picker/index.cjs +1 -1
  80. package/components/filter-expression-picker/index.js +1 -1
  81. package/components/{filter-expression-picker-DQP5lkn4.js → filter-expression-picker-Brn-vNUd.js} +1 -1
  82. package/components/{filter-expression-picker-BMJkgHu9.cjs → filter-expression-picker-DCFZKpBE.cjs} +1 -1
  83. package/components/filter-item/index.cjs +1 -1
  84. package/components/filter-item/index.js +1 -1
  85. package/components/{filter-item-BXcYNAAm.js → filter-item-BlSQe2nu.js} +4 -4
  86. package/components/{filter-item-D9m378Qo.cjs → filter-item-Cjrhb1RR.cjs} +1 -1
  87. package/components/filter-value-picker/index.cjs +1 -1
  88. package/components/filter-value-picker/index.js +1 -1
  89. package/components/{filter-value-picker-YIkbsWDP.cjs → filter-value-picker-BCckBdal.cjs} +1 -1
  90. package/components/{filter-value-picker-B-dzcjEo.js → filter-value-picker-CBetCjIs.js} +4 -4
  91. package/components/filter-value-picker-datetime/index.cjs +1 -1
  92. package/components/filter-value-picker-datetime/index.js +1 -1
  93. package/components/{filter-value-picker-datetime-BJMcnoKH.js → filter-value-picker-datetime-CT63jJDI.js} +1 -1
  94. package/components/{filter-value-picker-datetime-BrrmcjIE.cjs → filter-value-picker-datetime-CxM6HXe3.cjs} +1 -1
  95. package/components/filter-value-picker-hierarchy/index.cjs +1 -1
  96. package/components/filter-value-picker-hierarchy/index.js +1 -1
  97. package/components/{filter-value-picker-hierarchy-B9gDxYna.cjs → filter-value-picker-hierarchy-C5QZXiQz.cjs} +1 -1
  98. package/components/{filter-value-picker-hierarchy-UdDq0CZG.js → filter-value-picker-hierarchy-CAORy2A-.js} +2 -2
  99. package/components/filter-value-picker-numeric/index.cjs +1 -1
  100. package/components/filter-value-picker-numeric/index.js +1 -1
  101. package/components/{filter-value-picker-numeric-D_dgITCq.cjs → filter-value-picker-numeric-CtOfHaJR.cjs} +1 -1
  102. package/components/{filter-value-picker-numeric-EK515Z-Y.js → filter-value-picker-numeric-Fao-PKN7.js} +1 -1
  103. package/components/filters/index.cjs +1 -1
  104. package/components/filters/index.js +1 -1
  105. package/components/{filters-H2scDNLi.js → filters-CtWut3ce.js} +2 -2
  106. package/components/{filters-8ehwgopC.cjs → filters-DI0GTL9k.cjs} +1 -1
  107. package/components/{fr-BoZFY3Qe.cjs → fr-BVxPTfyF.cjs} +1 -1
  108. package/components/{fr-B32d4zcX.js → fr-DLf99-F8.js} +6 -1
  109. package/components/{get-dataset-name-CrWWViwN.cjs → get-dataset-name-CvZduuOo.cjs} +1 -1
  110. package/components/{get-dataset-name-7FdLQo10.js → get-dataset-name-EKmxKZU9.js} +1 -1
  111. package/components/index.cjs +1 -1
  112. package/components/index.js +58 -58
  113. package/components/item-grid/helpers/grid-item-popover.d.ts +7 -1
  114. package/components/item-grid/helpers/grid-rendering.d.ts +7 -1
  115. package/components/item-grid/index.cjs +1 -1
  116. package/components/item-grid/index.js +1 -1
  117. package/components/item-grid/item-grid.d.ts +8 -0
  118. package/components/{item-grid-CxblVEy3.cjs → item-grid-Bcez8lwg.cjs} +7 -7
  119. package/components/{item-grid-B-IFwriA.js → item-grid-DgxtJ0eX.js} +574 -564
  120. package/components/item-option/index.cjs +1 -1
  121. package/components/item-option/index.js +1 -1
  122. package/components/{item-option-ChsD18x9.cjs → item-option-BgYyAKSW.cjs} +1 -1
  123. package/components/{item-option-Buxnv89s.js → item-option-DjiTHr0r.js} +1 -1
  124. package/components/item-option-action-button-group/index.cjs +1 -1
  125. package/components/item-option-action-button-group/index.js +1 -1
  126. package/components/{item-option-action-button-group-Cw9EDbG-.cjs → item-option-action-button-group-DdqzgR08.cjs} +1 -1
  127. package/components/{item-option-action-button-group-QO_darH9.js → item-option-action-button-group-U5GCtFjg.js} +1 -1
  128. package/components/{item-option-base-DjQ5poaH.cjs → item-option-base-BeIdCZMp.cjs} +1 -1
  129. package/components/{item-option-base-DMmga0dv.js → item-option-base-DM3U9dbW.js} +1 -1
  130. package/components/item-option-color-palette-picker/index.cjs +1 -1
  131. package/components/item-option-color-palette-picker/index.js +1 -1
  132. package/components/{item-option-color-palette-picker-CiE_aWRI.js → item-option-color-palette-picker-BsMZ3IUR.js} +1 -1
  133. package/components/{item-option-color-palette-picker-gZvk4ODA.cjs → item-option-color-palette-picker-oj8nSb-q.cjs} +1 -1
  134. package/components/item-option-color-picker/index.cjs +1 -1
  135. package/components/item-option-color-picker/index.js +1 -1
  136. package/components/{item-option-color-picker-DCnGqBgT.cjs → item-option-color-picker-BJKGTrIi.cjs} +1 -1
  137. package/components/{item-option-color-picker-CUskqN3R.js → item-option-color-picker-B_pemZKJ.js} +1 -1
  138. package/components/item-option-color-range/index.cjs +1 -1
  139. package/components/item-option-color-range/index.js +1 -1
  140. package/components/{item-option-color-range-B24EAbUi.cjs → item-option-color-range-BOegJZim.cjs} +1 -1
  141. package/components/{item-option-color-range-BgHXTDvx.js → item-option-color-range-DW3rdMt5.js} +1 -1
  142. package/components/item-option-multi-language-field/index.cjs +1 -1
  143. package/components/item-option-multi-language-field/index.js +1 -1
  144. package/components/{item-option-multi-language-field-DDIu7Hns.cjs → item-option-multi-language-field-BQZ4Lmiy.cjs} +1 -1
  145. package/components/{item-option-multi-language-field-qngZBXHT.js → item-option-multi-language-field-CeYgkRzs.js} +1 -1
  146. package/components/item-option-number-field/index.cjs +1 -1
  147. package/components/item-option-number-field/index.js +1 -1
  148. package/components/{item-option-number-field-Cd-cfpaq.js → item-option-number-field-CFQyJG_w.js} +1 -1
  149. package/components/{item-option-number-field-CqrO1Xu0.cjs → item-option-number-field-T2L2jFCf.cjs} +1 -1
  150. package/components/item-option-panel/index.cjs +1 -1
  151. package/components/item-option-panel/index.js +1 -1
  152. package/components/{item-option-panel-B26_sDcj.cjs → item-option-panel-BOJmKPgY.cjs} +1 -1
  153. package/components/{item-option-panel-DZiOx_sn.js → item-option-panel-ChOItFmc.js} +2 -2
  154. package/components/item-option-picker/index.cjs +1 -1
  155. package/components/item-option-picker/index.js +1 -1
  156. package/components/{item-option-picker-B86AqAWp.cjs → item-option-picker-3krQktmk.cjs} +1 -1
  157. package/components/{item-option-picker-LRahjZUz.js → item-option-picker-IBP7QFLA.js} +1 -1
  158. package/components/item-option-position-picker/index.cjs +1 -1
  159. package/components/item-option-position-picker/index.js +1 -1
  160. package/components/{item-option-position-picker-Cbi2OygH.cjs → item-option-position-picker-BiLRWUWK.cjs} +1 -1
  161. package/components/{item-option-position-picker-NUpUlyPV.js → item-option-position-picker-DF54K_Mw.js} +1 -1
  162. package/components/item-option-positions-number-field/index.cjs +1 -1
  163. package/components/item-option-positions-number-field/index.js +1 -1
  164. package/components/{item-option-positions-number-field-BbIkX6wM.cjs → item-option-positions-number-field-B6qxN1x7.cjs} +1 -1
  165. package/components/{item-option-positions-number-field-ClPil6MM.js → item-option-positions-number-field-Dchzu5NS.js} +1 -1
  166. package/components/item-option-radio-button-group/index.cjs +1 -1
  167. package/components/item-option-radio-button-group/index.js +1 -1
  168. package/components/{item-option-radio-button-group-Bdd9sU4p.js → item-option-radio-button-group-BiOpqNXX.js} +1 -1
  169. package/components/{item-option-radio-button-group-BtYYhQyI.cjs → item-option-radio-button-group-DzI_2jB3.cjs} +1 -1
  170. package/components/item-option-slider/index.cjs +1 -1
  171. package/components/item-option-slider/index.js +1 -1
  172. package/components/{item-option-slider-32oGS1fd.cjs → item-option-slider-6E4VgJpv.cjs} +1 -1
  173. package/components/{item-option-slider-BJ7gVQXP.js → item-option-slider-Dba7mmcA.js} +1 -1
  174. package/components/item-option-switch/index.cjs +1 -1
  175. package/components/item-option-switch/index.js +1 -1
  176. package/components/{item-option-switch-BMVlfdx5.js → item-option-switch-BAYX5lTr.js} +1 -1
  177. package/components/{item-option-switch-BFk3biK9.cjs → item-option-switch-Dt4pzFNi.cjs} +1 -1
  178. package/components/item-option-text-field/index.cjs +1 -1
  179. package/components/item-option-text-field/index.js +1 -1
  180. package/components/{item-option-text-field-CWvgQ3pJ.cjs → item-option-text-field-BLOz4LvH.cjs} +1 -1
  181. package/components/{item-option-text-field-BoXwVo-B.js → item-option-text-field-CHalqTt1.js} +1 -1
  182. package/components/item-slot-drop/index.cjs +1 -1
  183. package/components/item-slot-drop/index.js +1 -1
  184. package/components/{item-slot-drop-CYRVCWF0.cjs → item-slot-drop-CNeF_Qmg.cjs} +1 -1
  185. package/components/{item-slot-drop-C0GmOMQY.js → item-slot-drop-n6UHgA-Q.js} +4 -4
  186. package/components/item-slot-drop-panel/index.cjs +1 -1
  187. package/components/item-slot-drop-panel/index.js +1 -1
  188. package/components/{item-slot-drop-panel-CoRFds3a.cjs → item-slot-drop-panel-Bh6PlCJx.cjs} +1 -1
  189. package/components/{item-slot-drop-panel-Ci3Soo16.js → item-slot-drop-panel-Hhp9_pDd.js} +3 -3
  190. package/components/item-slot-picker/index.cjs +1 -1
  191. package/components/item-slot-picker/index.js +1 -1
  192. package/components/{item-slot-picker-CmnJSYIF.cjs → item-slot-picker-7oF3vLwb.cjs} +1 -1
  193. package/components/{item-slot-picker-D1_NbL1A.js → item-slot-picker-BAMVwHtd.js} +5 -5
  194. package/components/item-slot-picker-panel/index.cjs +1 -1
  195. package/components/item-slot-picker-panel/index.js +1 -1
  196. package/components/{item-slot-picker-panel-B8VvKhRF.js → item-slot-picker-panel-BYCDx6Hk.js} +3 -3
  197. package/components/{item-slot-picker-panel-DzKodYTM.cjs → item-slot-picker-panel-C6mMlurQ.cjs} +1 -1
  198. package/components/{localized-mixin-DZuGq2Fm.js → localized-mixin-CpYxJczB.js} +1 -1
  199. package/components/{localized-mixin-Dujo7nlJ.cjs → localized-mixin-CxGNXOcg.cjs} +1 -1
  200. package/components/{nl-C9Ad2LdA.cjs → nl-D4uOyZ6h.cjs} +1 -1
  201. package/components/{nl-hCQgb1fB.js → nl-QLEhlKsI.js} +6 -1
  202. package/components/{set-locale-CXnxhP_B.js → set-locale-wsrhUZVV.js} +4 -4
  203. package/components/{set-locale-MCuEsOOu.cjs → set-locale-xSK2Wd4D.cjs} +1 -1
  204. package/components/slot-menu/index.cjs +1 -1
  205. package/components/slot-menu/index.js +1 -1
  206. package/components/{slot-menu-CYNYwJnU.js → slot-menu-B431N66z.js} +3 -3
  207. package/components/{slot-menu-CDAAPyFj.cjs → slot-menu-CIQRPLvx.cjs} +1 -1
  208. package/components/slot-menu-list/index.cjs +1 -1
  209. package/components/slot-menu-list/index.js +1 -1
  210. package/components/{slot-menu-list-DbWiuJDF.cjs → slot-menu-list-BROocU0s.cjs} +1 -1
  211. package/components/{slot-menu-list-DL-x5Ggl.js → slot-menu-list-Cdh09ie0.js} +1 -1
  212. package/components/utils/base.cjs +1 -1
  213. package/components/utils/base.js +2 -2
  214. package/components/{utils-BACUV6sE.js → utils-CJ3Vy98n.js} +1 -1
  215. package/components/{utils-DKSE_5u1.cjs → utils-iY1cKQaF.cjs} +1 -1
  216. package/components/utils.cjs +1 -1
  217. package/components/utils.js +2 -2
  218. package/components/viz-item-menu/index.cjs +1 -1
  219. package/components/viz-item-menu/index.js +1 -1
  220. package/components/{viz-item-menu-DXoKwAhV.js → viz-item-menu--FyB_XCf.js} +1 -1
  221. package/components/{viz-item-menu-yr7TQY8-.cjs → viz-item-menu-D20StIE_.cjs} +1 -1
  222. package/custom-elements.json +1460 -157
  223. package/package.json +2 -2
  224. package/react/components/ai-chat/stream/index.ts +1 -0
  225. package/react/components/ai-chat/stream/types.ts +29 -0
  226. package/react/components/ai-chat.component.ts +12 -12
  227. package/react/esm/components/ai-chat/stream/index.d.ts +1 -0
  228. package/react/esm/components/ai-chat/stream/index.js +1 -0
  229. package/react/esm/components/ai-chat/stream/types.d.ts +26 -0
  230. package/react/esm/components/ai-chat/stream/types.js +1 -0
  231. package/react/esm/components/ai-chat.component.d.ts +8 -8
  232. package/react/esm/components/ai-chat.component.js +8 -8
  233. package/types/ai-chat.types.d.ts +1 -1
  234. package/components/ai-chat/request-contract.d.ts +0 -56
  235. package/components/ai-chat-D2L9_kci.js +0 -1258
  236. package/components/ai-chat-O_MP_k1b.cjs +0 -151
@@ -1,1258 +0,0 @@
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-BAzY-whv.js";
21
- import { t } from "./decorate-DKLaHs_w.js";
22
- import "./ai-interaction-textarea-BJHzUcBF.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
- //#region node_modules/dompurify/dist/purify.es.mjs
33
- var { entries: ee, setPrototypeOf: te, isFrozen: f, getPrototypeOf: p, getOwnPropertyDescriptor: ne } = Object, { freeze: m, seal: h, create: re } = Object, { apply: ie, construct: ae } = typeof Reflect < "u" && Reflect;
34
- m ||= function(e) {
35
- return e;
36
- }, h ||= function(e) {
37
- return e;
38
- }, ie ||= function(e, t) {
39
- var n = [...arguments].slice(2);
40
- return e.apply(t, n);
41
- }, ae ||= function(e) {
42
- return new e(...[...arguments].slice(1));
43
- };
44
- var g = S(Array.prototype.forEach), oe = S(Array.prototype.lastIndexOf), se = S(Array.prototype.pop), _ = S(Array.prototype.push), ce = S(Array.prototype.splice), le = S(String.prototype.toLowerCase), ue = S(String.prototype.toString), de = S(String.prototype.match), v = S(String.prototype.replace), fe = S(String.prototype.indexOf), pe = S(String.prototype.trim), y = S(Object.prototype.hasOwnProperty), b = S(RegExp.prototype.test), x = C(TypeError);
45
- function S(e) {
46
- return function(t) {
47
- t instanceof RegExp && (t.lastIndex = 0);
48
- var n = [...arguments].slice(1);
49
- return ie(e, t, n);
50
- };
51
- }
52
- function C(e) {
53
- return function() {
54
- return ae(e, [...arguments]);
55
- };
56
- }
57
- function w(e, t) {
58
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : le;
59
- te && te(e, null);
60
- let r = t.length;
61
- for (; r--;) {
62
- let i = t[r];
63
- if (typeof i == "string") {
64
- let e = n(i);
65
- e !== i && (f(t) || (t[r] = e), i = e);
66
- }
67
- e[i] = !0;
68
- }
69
- return e;
70
- }
71
- function T(e) {
72
- for (let t = 0; t < e.length; t++) y(e, t) || (e[t] = null);
73
- return e;
74
- }
75
- function E(e) {
76
- let t = re(null);
77
- for (let [n, r] of ee(e)) y(e, n) && (Array.isArray(r) ? t[n] = T(r) : r && typeof r == "object" && r.constructor === Object ? t[n] = E(r) : t[n] = r);
78
- return t;
79
- }
80
- function D(e, t) {
81
- for (; e !== null;) {
82
- let n = ne(e, t);
83
- if (n) {
84
- if (n.get) return S(n.get);
85
- if (typeof n.value == "function") return S(n.value);
86
- }
87
- e = p(e);
88
- }
89
- function n() {
90
- return null;
91
- }
92
- return n;
93
- }
94
- var me = m(/* @__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(".")), he = m(/* @__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(".")), ge = m([
95
- "feBlend",
96
- "feColorMatrix",
97
- "feComponentTransfer",
98
- "feComposite",
99
- "feConvolveMatrix",
100
- "feDiffuseLighting",
101
- "feDisplacementMap",
102
- "feDistantLight",
103
- "feDropShadow",
104
- "feFlood",
105
- "feFuncA",
106
- "feFuncB",
107
- "feFuncG",
108
- "feFuncR",
109
- "feGaussianBlur",
110
- "feImage",
111
- "feMerge",
112
- "feMergeNode",
113
- "feMorphology",
114
- "feOffset",
115
- "fePointLight",
116
- "feSpecularLighting",
117
- "feSpotLight",
118
- "feTile",
119
- "feTurbulence"
120
- ]), _e = m([
121
- "animate",
122
- "color-profile",
123
- "cursor",
124
- "discard",
125
- "font-face",
126
- "font-face-format",
127
- "font-face-name",
128
- "font-face-src",
129
- "font-face-uri",
130
- "foreignobject",
131
- "hatch",
132
- "hatchpath",
133
- "mesh",
134
- "meshgradient",
135
- "meshpatch",
136
- "meshrow",
137
- "missing-glyph",
138
- "script",
139
- "set",
140
- "solidcolor",
141
- "unknown",
142
- "use"
143
- ]), ve = m(/* @__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(".")), ye = m([
144
- "maction",
145
- "maligngroup",
146
- "malignmark",
147
- "mlongdiv",
148
- "mscarries",
149
- "mscarry",
150
- "msgroup",
151
- "mstack",
152
- "msline",
153
- "msrow",
154
- "semantics",
155
- "annotation",
156
- "annotation-xml",
157
- "mprescripts",
158
- "none"
159
- ]), be = m(["#text"]), xe = m(/* @__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(".")), Se = m(/* @__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(".")), Ce = m(/* @__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(".")), we = m([
160
- "xlink:href",
161
- "xml:id",
162
- "xlink:title",
163
- "xml:space",
164
- "xmlns:xlink"
165
- ]), Te = h(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Ee = h(/<%[\w\W]*|[\w\W]*%>/gm), De = h(/\$\{[\w\W]*/gm), Oe = h(/^data-[\-\w.\u00B7-\uFFFF]+$/), ke = h(/^aria-[\-\w]+$/), Ae = h(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), O = h(/^(?:\w+script|data):/i), k = h(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), je = h(/^html$/i), A = h(/^[a-z][.\w]*(-[.\w]+)+$/i), Me = /* @__PURE__ */ Object.freeze({
166
- __proto__: null,
167
- ARIA_ATTR: ke,
168
- ATTR_WHITESPACE: k,
169
- CUSTOM_ELEMENT: A,
170
- DATA_ATTR: Oe,
171
- DOCTYPE_NAME: je,
172
- ERB_EXPR: Ee,
173
- IS_ALLOWED_URI: Ae,
174
- IS_SCRIPT_OR_DATA: O,
175
- MUSTACHE_EXPR: Te,
176
- TMPLIT_EXPR: De
177
- }), j = {
178
- element: 1,
179
- text: 3,
180
- progressingInstruction: 7,
181
- comment: 8,
182
- document: 9
183
- }, Ne = function() {
184
- return typeof window > "u" ? null : window;
185
- }, Pe = function(e, t) {
186
- if (typeof e != "object" || typeof e.createPolicy != "function") return null;
187
- let n = null, r = "data-tt-policy-suffix";
188
- t && t.hasAttribute(r) && (n = t.getAttribute(r));
189
- let i = "dompurify" + (n ? "#" + n : "");
190
- try {
191
- return e.createPolicy(i, {
192
- createHTML(e) {
193
- return e;
194
- },
195
- createScriptURL(e) {
196
- return e;
197
- }
198
- });
199
- } catch {
200
- return console.warn("TrustedTypes policy " + i + " could not be created."), null;
201
- }
202
- }, Fe = function() {
203
- return {
204
- afterSanitizeAttributes: [],
205
- afterSanitizeElements: [],
206
- afterSanitizeShadowDOM: [],
207
- beforeSanitizeAttributes: [],
208
- beforeSanitizeElements: [],
209
- beforeSanitizeShadowDOM: [],
210
- uponSanitizeAttribute: [],
211
- uponSanitizeElement: [],
212
- uponSanitizeShadowNode: []
213
- };
214
- };
215
- function Ie() {
216
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ne(), t = (e) => Ie(e);
217
- if (t.version = "3.4.0", t.removed = [], !e || !e.document || e.document.nodeType !== j.document || !e.Element) return t.isSupported = !1, t;
218
- 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: f } = e, p = c.prototype, ne = D(p, "cloneNode"), h = D(p, "remove"), ie = D(p, "nextSibling"), ae = D(p, "childNodes"), S = D(p, "parentNode");
219
- if (typeof o == "function") {
220
- let e = n.createElement("template");
221
- e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
222
- }
223
- let C, T = "", { implementation: Te, createNodeIterator: Ee, createDocumentFragment: De, getElementsByTagName: Oe } = n, { importNode: ke } = r, O = Fe();
224
- t.isSupported = typeof ee == "function" && typeof S == "function" && Te && Te.createHTMLDocument !== void 0;
225
- let { MUSTACHE_EXPR: k, ERB_EXPR: A, TMPLIT_EXPR: M, DATA_ATTR: Le, ARIA_ATTR: Re, IS_SCRIPT_OR_DATA: ze, ATTR_WHITESPACE: Be, CUSTOM_ELEMENT: Ve } = Me, { IS_ALLOWED_URI: He } = Me, N = null, P = w({}, [
226
- ...me,
227
- ...he,
228
- ...ge,
229
- ...ve,
230
- ...be
231
- ]), F = null, Ue = w({}, [
232
- ...xe,
233
- ...Se,
234
- ...Ce,
235
- ...we
236
- ]), I = Object.seal(re(null, {
237
- tagNameCheck: {
238
- writable: !0,
239
- configurable: !1,
240
- enumerable: !0,
241
- value: null
242
- },
243
- attributeNameCheck: {
244
- writable: !0,
245
- configurable: !1,
246
- enumerable: !0,
247
- value: null
248
- },
249
- allowCustomizedBuiltInElements: {
250
- writable: !0,
251
- configurable: !1,
252
- enumerable: !0,
253
- value: !1
254
- }
255
- })), L = null, We = null, R = Object.seal(re(null, {
256
- tagCheck: {
257
- writable: !0,
258
- configurable: !1,
259
- enumerable: !0,
260
- value: null
261
- },
262
- attributeCheck: {
263
- writable: !0,
264
- configurable: !1,
265
- enumerable: !0,
266
- value: null
267
- }
268
- })), Ge = !0, Ke = !0, qe = !1, Je = !0, z = !1, B = !0, V = !1, Ye = !1, Xe = !1, H = !1, Ze = !1, Qe = !1, $e = !0, et = !1, tt = !0, U = !1, W = {}, G = null, nt = w({}, [
269
- "annotation-xml",
270
- "audio",
271
- "colgroup",
272
- "desc",
273
- "foreignobject",
274
- "head",
275
- "iframe",
276
- "math",
277
- "mi",
278
- "mn",
279
- "mo",
280
- "ms",
281
- "mtext",
282
- "noembed",
283
- "noframes",
284
- "noscript",
285
- "plaintext",
286
- "script",
287
- "style",
288
- "svg",
289
- "template",
290
- "thead",
291
- "title",
292
- "video",
293
- "xmp"
294
- ]), rt = null, it = w({}, [
295
- "audio",
296
- "video",
297
- "img",
298
- "source",
299
- "image",
300
- "track"
301
- ]), at = null, ot = w({}, [
302
- "alt",
303
- "class",
304
- "for",
305
- "id",
306
- "label",
307
- "name",
308
- "pattern",
309
- "placeholder",
310
- "role",
311
- "summary",
312
- "title",
313
- "value",
314
- "style",
315
- "xmlns"
316
- ]), st = "http://www.w3.org/1998/Math/MathML", ct = "http://www.w3.org/2000/svg", K = "http://www.w3.org/1999/xhtml", q = K, lt = !1, ut = null, dt = w({}, [
317
- st,
318
- ct,
319
- K
320
- ], ue), ft = w({}, [
321
- "mi",
322
- "mo",
323
- "mn",
324
- "ms",
325
- "mtext"
326
- ]), pt = w({}, ["annotation-xml"]), mt = w({}, [
327
- "title",
328
- "style",
329
- "font",
330
- "a",
331
- "script"
332
- ]), J = null, ht = ["application/xhtml+xml", "text/html"], Y = null, X = null, gt = n.createElement("form"), _t = function(e) {
333
- return e instanceof RegExp || e instanceof Function;
334
- }, vt = function() {
335
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
336
- if (!(X && X === e)) {
337
- if ((!e || typeof e != "object") && (e = {}), e = E(e), J = ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, Y = J === "application/xhtml+xml" ? ue : le, N = y(e, "ALLOWED_TAGS") ? w({}, e.ALLOWED_TAGS, Y) : P, F = y(e, "ALLOWED_ATTR") ? w({}, e.ALLOWED_ATTR, Y) : Ue, ut = y(e, "ALLOWED_NAMESPACES") ? w({}, e.ALLOWED_NAMESPACES, ue) : dt, at = y(e, "ADD_URI_SAFE_ATTR") ? w(E(ot), e.ADD_URI_SAFE_ATTR, Y) : ot, rt = y(e, "ADD_DATA_URI_TAGS") ? w(E(it), e.ADD_DATA_URI_TAGS, Y) : it, G = y(e, "FORBID_CONTENTS") ? w({}, e.FORBID_CONTENTS, Y) : nt, L = y(e, "FORBID_TAGS") ? w({}, e.FORBID_TAGS, Y) : E({}), We = y(e, "FORBID_ATTR") ? w({}, e.FORBID_ATTR, Y) : E({}), W = y(e, "USE_PROFILES") ? e.USE_PROFILES : !1, Ge = e.ALLOW_ARIA_ATTR !== !1, Ke = e.ALLOW_DATA_ATTR !== !1, qe = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Je = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, z = e.SAFE_FOR_TEMPLATES || !1, B = e.SAFE_FOR_XML !== !1, V = e.WHOLE_DOCUMENT || !1, H = e.RETURN_DOM || !1, Ze = e.RETURN_DOM_FRAGMENT || !1, Qe = e.RETURN_TRUSTED_TYPE || !1, Xe = e.FORCE_BODY || !1, $e = e.SANITIZE_DOM !== !1, et = e.SANITIZE_NAMED_PROPS || !1, tt = e.KEEP_CONTENT !== !1, U = e.IN_PLACE || !1, He = e.ALLOWED_URI_REGEXP || Ae, q = e.NAMESPACE || K, ft = e.MATHML_TEXT_INTEGRATION_POINTS || ft, pt = e.HTML_INTEGRATION_POINTS || pt, I = e.CUSTOM_ELEMENT_HANDLING || re(null), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (I.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (I.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (I.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), z && (Ke = !1), Ze && (H = !0), W && (N = w({}, be), F = re(null), W.html === !0 && (w(N, me), w(F, xe)), W.svg === !0 && (w(N, he), w(F, Se), w(F, we)), W.svgFilters === !0 && (w(N, ge), w(F, Se), w(F, we)), W.mathMl === !0 && (w(N, ve), w(F, Ce), w(F, we))), R.tagCheck = null, R.attributeCheck = null, e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? R.tagCheck = e.ADD_TAGS : (N === P && (N = E(N)), w(N, e.ADD_TAGS, Y))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? R.attributeCheck = e.ADD_ATTR : (F === Ue && (F = E(F)), w(F, e.ADD_ATTR, Y))), e.ADD_URI_SAFE_ATTR && w(at, e.ADD_URI_SAFE_ATTR, Y), e.FORBID_CONTENTS && (G === nt && (G = E(G)), w(G, e.FORBID_CONTENTS, Y)), e.ADD_FORBID_CONTENTS && (G === nt && (G = E(G)), w(G, e.ADD_FORBID_CONTENTS, Y)), tt && (N["#text"] = !0), V && w(N, [
338
- "html",
339
- "head",
340
- "body"
341
- ]), N.table && (w(N, ["tbody"]), delete L.tbody), e.TRUSTED_TYPES_POLICY) {
342
- if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw x("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
343
- if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw x("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
344
- C = e.TRUSTED_TYPES_POLICY, T = C.createHTML("");
345
- } else C === void 0 && (C = Pe(f, i)), C !== null && typeof T == "string" && (T = C.createHTML(""));
346
- m && m(e), X = e;
347
- }
348
- }, yt = w({}, [
349
- ...he,
350
- ...ge,
351
- ..._e
352
- ]), bt = w({}, [...ve, ...ye]), xt = function(e) {
353
- let t = S(e);
354
- (!t || !t.tagName) && (t = {
355
- namespaceURI: q,
356
- tagName: "template"
357
- });
358
- let n = le(e.tagName), r = le(t.tagName);
359
- return ut[e.namespaceURI] ? e.namespaceURI === ct ? t.namespaceURI === K ? n === "svg" : t.namespaceURI === st ? n === "svg" && (r === "annotation-xml" || ft[r]) : !!yt[n] : e.namespaceURI === st ? t.namespaceURI === K ? n === "math" : t.namespaceURI === ct ? n === "math" && pt[r] : !!bt[n] : e.namespaceURI === K ? t.namespaceURI === ct && !pt[r] || t.namespaceURI === st && !ft[r] ? !1 : !bt[n] && (mt[n] || !yt[n]) : !!(J === "application/xhtml+xml" && ut[e.namespaceURI]) : !1;
360
- }, Z = function(e) {
361
- _(t.removed, { element: e });
362
- try {
363
- S(e).removeChild(e);
364
- } catch {
365
- h(e);
366
- }
367
- }, Q = function(e, n) {
368
- try {
369
- _(t.removed, {
370
- attribute: n.getAttributeNode(e),
371
- from: n
372
- });
373
- } catch {
374
- _(t.removed, {
375
- attribute: null,
376
- from: n
377
- });
378
- }
379
- if (n.removeAttribute(e), e === "is") if (H || Ze) try {
380
- Z(n);
381
- } catch {}
382
- else try {
383
- n.setAttribute(e, "");
384
- } catch {}
385
- }, St = function(e) {
386
- let t = null, r = null;
387
- if (Xe) e = "<remove></remove>" + e;
388
- else {
389
- let t = de(e, /^[\r\n\t ]+/);
390
- r = t && t[0];
391
- }
392
- J === "application/xhtml+xml" && q === K && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
393
- let i = C ? C.createHTML(e) : e;
394
- if (q === K) try {
395
- t = new te().parseFromString(i, J);
396
- } catch {}
397
- if (!t || !t.documentElement) {
398
- t = Te.createDocument(q, "template", null);
399
- try {
400
- t.documentElement.innerHTML = lt ? T : i;
401
- } catch {}
402
- }
403
- let a = t.body || t.documentElement;
404
- return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), q === K ? Oe.call(t, V ? "html" : "body")[0] : V ? t.documentElement : a;
405
- }, Ct = function(e) {
406
- return Ee.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
407
- }, wt = function(e) {
408
- 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");
409
- }, Tt = function(e) {
410
- return typeof s == "function" && e instanceof s;
411
- };
412
- function $(e, n, r) {
413
- g(e, (e) => {
414
- e.call(t, n, r, X);
415
- });
416
- }
417
- let Et = function(e) {
418
- let n = null;
419
- if ($(O.beforeSanitizeElements, e, null), wt(e)) return Z(e), !0;
420
- let r = Y(e.nodeName);
421
- if ($(O.uponSanitizeElement, e, {
422
- tagName: r,
423
- allowedTags: N
424
- }), B && e.hasChildNodes() && !Tt(e.firstElementChild) && b(/<[/\w!]/g, e.innerHTML) && b(/<[/\w!]/g, e.textContent) || B && e.namespaceURI === K && r === "style" && Tt(e.firstElementChild) || e.nodeType === j.progressingInstruction || B && e.nodeType === j.comment && b(/<[/\w]/g, e.data)) return Z(e), !0;
425
- if (L[r] || !(R.tagCheck instanceof Function && R.tagCheck(r)) && !N[r]) {
426
- if (!L[r] && Ot(r) && (I.tagNameCheck instanceof RegExp && b(I.tagNameCheck, r) || I.tagNameCheck instanceof Function && I.tagNameCheck(r))) return !1;
427
- if (tt && !G[r]) {
428
- let t = S(e) || e.parentNode, n = ae(e) || e.childNodes;
429
- if (n && t) {
430
- let r = n.length;
431
- for (let i = r - 1; i >= 0; --i) {
432
- let r = ne(n[i], !0);
433
- r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r, ie(e));
434
- }
435
- }
436
- }
437
- return Z(e), !0;
438
- }
439
- return e instanceof c && !xt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && b(/<\/no(script|embed|frames)/i, e.innerHTML) ? (Z(e), !0) : (z && e.nodeType === j.text && (n = e.textContent, g([
440
- k,
441
- A,
442
- M
443
- ], (e) => {
444
- n = v(n, e, " ");
445
- }), e.textContent !== n && (_(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(O.afterSanitizeElements, e, null), !1);
446
- }, Dt = function(e, t, r) {
447
- if (We[t] || $e && (t === "id" || t === "name") && (r in n || r in gt)) return !1;
448
- if (!(Ke && !We[t] && b(Le, t)) && !(Ge && b(Re, t)) && !(R.attributeCheck instanceof Function && R.attributeCheck(t, e))) {
449
- if (!F[t] || We[t]) {
450
- if (!(Ot(e) && (I.tagNameCheck instanceof RegExp && b(I.tagNameCheck, e) || I.tagNameCheck instanceof Function && I.tagNameCheck(e)) && (I.attributeNameCheck instanceof RegExp && b(I.attributeNameCheck, t) || I.attributeNameCheck instanceof Function && I.attributeNameCheck(t, e)) || t === "is" && I.allowCustomizedBuiltInElements && (I.tagNameCheck instanceof RegExp && b(I.tagNameCheck, r) || I.tagNameCheck instanceof Function && I.tagNameCheck(r)))) return !1;
451
- } else if (!at[t] && !b(He, v(r, Be, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && fe(r, "data:") === 0 && rt[e]) && !(qe && !b(ze, v(r, Be, ""))) && r) return !1;
452
- }
453
- return !0;
454
- }, Ot = function(e) {
455
- return e !== "annotation-xml" && de(e, Ve);
456
- }, kt = function(e) {
457
- $(O.beforeSanitizeAttributes, e, null);
458
- let { attributes: n } = e;
459
- if (!n || wt(e)) return;
460
- let r = {
461
- attrName: "",
462
- attrValue: "",
463
- keepAttr: !0,
464
- allowedAttributes: F,
465
- forceKeepAttr: void 0
466
- }, i = n.length;
467
- for (; i--;) {
468
- let { name: a, namespaceURI: o, value: s } = n[i], c = Y(a), l = s, u = a === "value" ? l : pe(l);
469
- if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(O.uponSanitizeAttribute, e, r), u = r.attrValue, et && (c === "id" || c === "name") && (Q(a, e), u = "user-content-" + u), B && b(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, u)) {
470
- Q(a, e);
471
- continue;
472
- }
473
- if (c === "attributename" && de(u, "href")) {
474
- Q(a, e);
475
- continue;
476
- }
477
- if (r.forceKeepAttr) continue;
478
- if (!r.keepAttr) {
479
- Q(a, e);
480
- continue;
481
- }
482
- if (!Je && b(/\/>/i, u)) {
483
- Q(a, e);
484
- continue;
485
- }
486
- z && g([
487
- k,
488
- A,
489
- M
490
- ], (e) => {
491
- u = v(u, e, " ");
492
- });
493
- let d = Y(e.nodeName);
494
- if (!Dt(d, c, u)) {
495
- Q(a, e);
496
- continue;
497
- }
498
- if (C && typeof f == "object" && typeof f.getAttributeType == "function" && !o) switch (f.getAttributeType(d, c)) {
499
- case "TrustedHTML":
500
- u = C.createHTML(u);
501
- break;
502
- case "TrustedScriptURL":
503
- u = C.createScriptURL(u);
504
- break;
505
- }
506
- if (u !== l) try {
507
- o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u), wt(e) ? Z(e) : se(t.removed);
508
- } catch {
509
- Q(a, e);
510
- }
511
- }
512
- $(O.afterSanitizeAttributes, e, null);
513
- }, At = function(e) {
514
- let t = null, n = Ct(e);
515
- for ($(O.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) $(O.uponSanitizeShadowNode, t, null), Et(t), kt(t), t.content instanceof a && At(t.content);
516
- $(O.afterSanitizeShadowDOM, e, null);
517
- };
518
- return t.sanitize = function(e) {
519
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null, c = null, l = null;
520
- if (lt = !e, lt && (e = "<!-->"), typeof e != "string" && !Tt(e)) if (typeof e.toString == "function") {
521
- if (e = e.toString(), typeof e != "string") throw x("dirty is not a string, aborting");
522
- } else throw x("toString is not a function");
523
- if (!t.isSupported) return e;
524
- if (Ye || vt(n), t.removed = [], typeof e == "string" && (U = !1), U) {
525
- if (e.nodeName) {
526
- let t = Y(e.nodeName);
527
- if (!N[t] || L[t]) throw x("root node is forbidden and cannot be sanitized in-place");
528
- }
529
- } else if (e instanceof s) i = St("<!---->"), o = i.ownerDocument.importNode(e, !0), o.nodeType === j.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? i = o : i.appendChild(o);
530
- else {
531
- if (!H && !z && !V && e.indexOf("<") === -1) return C && Qe ? C.createHTML(e) : e;
532
- if (i = St(e), !i) return H ? null : Qe ? T : "";
533
- }
534
- i && Xe && Z(i.firstChild);
535
- let u = Ct(U ? e : i);
536
- for (; c = u.nextNode();) Et(c), kt(c), c.content instanceof a && At(c.content);
537
- if (U) return e;
538
- if (H) {
539
- if (z) {
540
- i.normalize();
541
- let e = i.innerHTML;
542
- g([
543
- k,
544
- A,
545
- M
546
- ], (t) => {
547
- e = v(e, t, " ");
548
- }), i.innerHTML = e;
549
- }
550
- if (Ze) for (l = De.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
551
- else l = i;
552
- return (F.shadowroot || F.shadowrootmode) && (l = ke.call(r, l, !0)), l;
553
- }
554
- let d = V ? i.outerHTML : i.innerHTML;
555
- return V && N["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && b(je, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), z && g([
556
- k,
557
- A,
558
- M
559
- ], (e) => {
560
- d = v(d, e, " ");
561
- }), C && Qe ? C.createHTML(d) : d;
562
- }, t.setConfig = function() {
563
- vt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), Ye = !0;
564
- }, t.clearConfig = function() {
565
- X = null, Ye = !1;
566
- }, t.isValidAttribute = function(e, t, n) {
567
- return X || vt({}), Dt(Y(e), Y(t), n);
568
- }, t.addHook = function(e, t) {
569
- typeof t == "function" && _(O[e], t);
570
- }, t.removeHook = function(e, t) {
571
- if (t !== void 0) {
572
- let n = oe(O[e], t);
573
- return n === -1 ? void 0 : ce(O[e], n, 1)[0];
574
- }
575
- return se(O[e]);
576
- }, t.removeHooks = function(e) {
577
- O[e] = [];
578
- }, t.removeAllHooks = function() {
579
- O = Fe();
580
- }, t;
581
- }
582
- var M = Ie();
583
- //#endregion
584
- //#region src/components/ai-chat/ai-chat-streaming.ts
585
- function Le() {
586
- return {
587
- id: "root",
588
- step: "root",
589
- status: "pending",
590
- children: [{
591
- id: "client-init",
592
- step: "iqInit",
593
- status: "inProgress",
594
- description: "Thinking"
595
- }]
596
- };
597
- }
598
- function Re(e) {
599
- let t = e.progress;
600
- return typeof t != "object" || !t ? !1 : "id" in t && "step" in t && "status" in t;
601
- }
602
- async function ze(e) {
603
- let t = await fetch(e.url, {
604
- method: "POST",
605
- headers: { "Content-Type": "application/json" },
606
- mode: "cors",
607
- body: JSON.stringify(e.body),
608
- signal: e.signal
609
- });
610
- if (!t.ok) {
611
- let e = await t.json().catch(() => null);
612
- throw Error(e?.message || `API request failed with status ${t.status}`);
613
- }
614
- if (!t.body) throw Error("Response body is not readable");
615
- return {
616
- body: t.body,
617
- conversationId: t.headers.get("x-conversation-id")
618
- };
619
- }
620
- async function Be(e, t) {
621
- let n = e.getReader(), r = new TextDecoder(), i = "";
622
- try {
623
- for (;;) {
624
- let { done: e, value: a } = await n.read();
625
- if (e) break;
626
- i += r.decode(a, { stream: !0 });
627
- let o = i.split("\n");
628
- i = o.pop() ?? "";
629
- for (let e of o) if (e.trim()) try {
630
- t(JSON.parse(e));
631
- } catch {
632
- console.error("Failed to parse NDJSON line:", e);
633
- }
634
- }
635
- if (i += r.decode(), i.trim()) try {
636
- t(JSON.parse(i));
637
- } catch {
638
- console.error("Failed to parse final NDJSON buffer:", i);
639
- }
640
- } finally {
641
- n.releaseLock();
642
- }
643
- }
644
- //#endregion
645
- //#region src/components/ai-chat/ai-chat.module.scss?inline
646
- var Ve = ":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::-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)}";
647
- //#endregion
648
- //#region src/components/ai-chat/request-contract.ts
649
- function He(e) {
650
- let { prompt: t, datasetIds: n, authKey: r, authToken: i, conversationId: a, chart: o, modelPreference: s, apiVersion: c = "0.1.0", stream: l = !0 } = e;
651
- return {
652
- key: r,
653
- token: i,
654
- action: "create",
655
- version: c,
656
- properties: {
657
- content: {
658
- role: "user",
659
- content: t
660
- },
661
- ...a ? { conversation_id: a } : {}
662
- },
663
- options: {
664
- available_datasets: n,
665
- stream: l,
666
- ...n.length > 0 ? { dataset_id: n[0] } : {},
667
- ...o && o.type !== "placeholder" ? { chart: {
668
- ...o,
669
- version: o.version || "",
670
- title: o.title || o.options.title,
671
- filters: o.filterGroups || [],
672
- aichartId: o.aichartId || ""
673
- } } : {},
674
- model_preference: s
675
- }
676
- };
677
- }
678
- function N(e, t, n, r = "0.1.0") {
679
- return {
680
- key: t,
681
- token: n,
682
- action: "delete",
683
- version: r,
684
- properties: { restore_to_message_id: e }
685
- };
686
- }
687
- //#endregion
688
- //#region src/components/ai-chat/ai-chat.ts
689
- var P = class extends e {
690
- constructor(...e) {
691
- 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.modelPreference = "performance", this.requestMode = "internal", this.isGenerating = !1, this.conversationId = null, this.chart = null, this.apiVersion = "0.1.0", this.stream = !0, this.loadingMessage = null, this.initialPrompt = null, this.progress = null, this.progressCollapsed = !1, this._progress = null, this._progressCollapsed = !1, this._isGeneratingInternal = !1, this._textareaValue = "", this._abortController = null, this._inflightAiMessage = null, this._lastProcessedInitialPrompt = null, this._receivedProgress = !1;
692
- }
693
- static {
694
- this.styles = c(Ve);
695
- }
696
- static {
697
- this.tagName = "luzmo-ai-chat";
698
- }
699
- _generateMessageId() {
700
- return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
701
- }
702
- _buildRequestBody(e, t) {
703
- return He({
704
- prompt: e,
705
- datasetIds: t,
706
- authKey: this.authKey,
707
- authToken: this.authToken,
708
- conversationId: this.conversationId,
709
- chart: this.chart,
710
- modelPreference: this.modelPreference,
711
- apiVersion: this.apiVersion,
712
- stream: this.stream
713
- });
714
- }
715
- _buildDeleteRequestBody(e) {
716
- return N(e, this.authKey, this.authToken, this.apiVersion);
717
- }
718
- _finalizeInflightMessage() {
719
- this._inflightAiMessage &&= (this._progress && this._receivedProgress && (this._inflightAiMessage.progress = structuredClone(this._progress), this._updateMessage(this._inflightAiMessage)), this._progress = null, this._progressCollapsed = !1, this._receivedProgress = !1, null);
720
- }
721
- async _sendStreamingMessage(e, t) {
722
- this._abortController && (this._abortController.abort(), this._inflightAiMessage && !this._inflightAiMessage.message && (this.messages = this.messages.filter((e) => e.id !== this._inflightAiMessage.id))), this._finalizeInflightMessage(), this._inflightAiMessage = t;
723
- let n = new AbortController();
724
- this._abortController = n, this._progress = Le(), this._progressCollapsed = !1, this._receivedProgress = !1;
725
- let r = !1;
726
- try {
727
- let { body: i, conversationId: a } = await ze({
728
- url: `${this.apiUrl}/${this.apiVersion}/aimessagedeprecated`,
729
- body: e,
730
- signal: n.signal
731
- });
732
- a && (this.conversationId = a), await Be(i, (e) => this._processStreamChunk(e, t)), r = !0;
733
- } finally {
734
- this._abortController === n && (r ? this._finalizeInflightMessage() : this._inflightAiMessage = null, this._isGeneratingInternal = !1, this._abortController = null);
735
- }
736
- }
737
- _processStreamChunk(e, t) {
738
- if (Re(e) && (this._receivedProgress = !0, this._progress = e.progress), e.error) {
739
- 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, this._updateMessage(t), this._progress = null, this._progressCollapsed = !1, this.dispatchEvent(new CustomEvent("luzmo-response-received", {
740
- detail: {
741
- message: t,
742
- done: !0
743
- },
744
- bubbles: !0,
745
- composed: !0
746
- }));
747
- return;
748
- }
749
- let r = e.chart ?? e.generatedChart;
750
- if (r) {
751
- t.hasChart = !0, typeof e.messageId == "string" && (t.apiMessageId = e.messageId);
752
- let n = {
753
- ...e,
754
- generatedChart: r,
755
- conversationId: this.conversationId
756
- };
757
- this.dispatchEvent(new CustomEvent("luzmo-chart-generated", {
758
- detail: { aiSampleChart: n },
759
- bubbles: !0,
760
- composed: !0
761
- }));
762
- let i = typeof e.chunk == "string" && e.chunk || typeof e.message == "string" && e.message;
763
- i && (t.message = (t.message || "") + i), this._updateMessage(t), (e.done || "question" in e) && (this._progressCollapsed = !0, t.message && this.dispatchEvent(new CustomEvent("luzmo-response-received", {
764
- detail: {
765
- message: t,
766
- done: !0
767
- },
768
- bubbles: !0,
769
- composed: !0
770
- })));
771
- return;
772
- }
773
- let i = typeof e.chunk == "string" && e.chunk || typeof e.message == "string" && e.message || "";
774
- i && (this._progressCollapsed ||= !0, t.message = (t.message || "") + i, this._updateMessage(t));
775
- let a = e.done || "question" in e;
776
- a && (this._progressCollapsed = !0), (i || a && t.message) && this.dispatchEvent(new CustomEvent("luzmo-response-received", {
777
- detail: {
778
- message: t,
779
- done: !!a
780
- },
781
- bubbles: !0,
782
- composed: !0
783
- }));
784
- }
785
- _addUserMessage(e, t) {
786
- let n = {
787
- id: this._generateMessageId(),
788
- type: "user",
789
- message: e
790
- };
791
- this.messages = [...this.messages, n], this._textareaValue = "", this.dispatchEvent(new CustomEvent("luzmo-message-sent", {
792
- detail: {
793
- message: n,
794
- selectedDatasets: t
795
- },
796
- bubbles: !0,
797
- composed: !0
798
- }));
799
- }
800
- _updateMessage(e) {
801
- this.messages = this.messages.map((t) => t.id === e.id ? { ...e } : t);
802
- }
803
- _truncateMessagesAfterRestore(e) {
804
- e < 0 || e >= this.messages.length || (this.messages = this.messages.slice(0, e + 1));
805
- }
806
- async _restoreInternal(e, t) {
807
- let n = this._buildDeleteRequestBody(e), r = await fetch(`${this.apiUrl}/${this.apiVersion}/aimessagedeprecated`, {
808
- method: "POST",
809
- headers: { "Content-Type": "application/json" },
810
- mode: "cors",
811
- body: JSON.stringify(n)
812
- });
813
- if (!r.ok) {
814
- let e = await r.json().catch(() => null);
815
- throw Error(e?.message || `API request failed with status ${r.status}`);
816
- }
817
- let i = await r.json().catch(() => null);
818
- if (this._truncateMessagesAfterRestore(t), i?.generatedChart && this.dispatchEvent(new CustomEvent("luzmo-chart-generated", {
819
- detail: { aiSampleChart: i },
820
- bubbles: !0,
821
- composed: !0
822
- })), i?.message) {
823
- let e = this.messages[t];
824
- e?.type === "ai" && (e.message = i.message, this._updateMessage(e), this.dispatchEvent(new CustomEvent("luzmo-response-received", {
825
- detail: {
826
- message: e,
827
- done: !0
828
- },
829
- bubbles: !0,
830
- composed: !0
831
- })));
832
- }
833
- }
834
- async _handleRestoreState(e, t) {
835
- if (e.apiMessageId) {
836
- if (this.requestMode === "external") {
837
- let n = this._buildDeleteRequestBody(e.apiMessageId), r = {
838
- apiMessageId: e.apiMessageId,
839
- messageIndex: t,
840
- request: n,
841
- url: `${this.apiUrl}/${this.apiVersion}/aimessagedeprecated`
842
- };
843
- this.dispatchEvent(new CustomEvent("luzmo-restore-requested", {
844
- detail: r,
845
- bubbles: !0,
846
- composed: !0
847
- }));
848
- return;
849
- }
850
- try {
851
- this._isGeneratingInternal = !0, await this._restoreInternal(e.apiMessageId, t);
852
- } catch (e) {
853
- this._handleAPIError(e);
854
- } finally {
855
- this._isGeneratingInternal = !1;
856
- }
857
- }
858
- }
859
- _prepareForAIResponse() {
860
- this._isGeneratingInternal = !0;
861
- let e = {
862
- id: this._generateMessageId(),
863
- type: "ai",
864
- message: ""
865
- };
866
- return this.messages = [...this.messages, e], e;
867
- }
868
- _handleAPIError(e, t) {
869
- console.error("AI Chart Generation Error:", e), this._progress = null, this._progressCollapsed = !1;
870
- let r = n("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" });
871
- if (t) t.message = r, t.isError = !0, delete t.progress, this._updateMessage(t);
872
- else {
873
- let e = {
874
- id: this._generateMessageId(),
875
- type: "ai",
876
- message: r,
877
- isError: !0
878
- };
879
- this.messages = [...this.messages, e], t = e;
880
- }
881
- this.dispatchEvent(new CustomEvent("luzmo-response-received", {
882
- detail: {
883
- message: t,
884
- error: e
885
- },
886
- bubbles: !0,
887
- composed: !0
888
- }));
889
- }
890
- _handleDatasetSelected(e) {
891
- let t = e.detail;
892
- this.selectedDatasets.some((e) => e.id === t.id) || (this.selectedDatasets = [...this.selectedDatasets, t], this._emitDatasetsChanged());
893
- }
894
- _handleDatasetRemoved(e) {
895
- let t = e.detail;
896
- this.selectedDatasets = this.selectedDatasets.filter((e) => e.id !== t.id), this._emitDatasetsChanged();
897
- }
898
- _emitDatasetsChanged() {
899
- this.dispatchEvent(new CustomEvent("luzmo-datasets-changed", {
900
- detail: { selectedDatasets: this.selectedDatasets },
901
- bubbles: !0,
902
- composed: !0
903
- }));
904
- }
905
- _isDatasetRequirementMet(e) {
906
- return !this.requireDataset || e.length > 0;
907
- }
908
- async _handlePromptSubmitted(e) {
909
- let { prompt: t, selectedDatasets: n } = e.detail;
910
- if (!this._isDatasetRequirementMet(n)) return;
911
- let r = n.map((e) => e.id), i = this._buildRequestBody(t, r);
912
- if (this._addUserMessage(t, n), this.requestMode === "external") {
913
- let e = {
914
- prompt: t,
915
- selectedDatasets: n,
916
- datasetIds: r,
917
- request: i,
918
- url: `${this.apiUrl}/${this.apiVersion}/aimessagedeprecated`
919
- };
920
- this.dispatchEvent(new CustomEvent("luzmo-prompt-submitted", {
921
- detail: e,
922
- bubbles: !0,
923
- composed: !0
924
- }));
925
- return;
926
- }
927
- let a = this._prepareForAIResponse();
928
- try {
929
- await this._sendStreamingMessage(i, a);
930
- } catch (e) {
931
- e.name !== "AbortError" && this._handleAPIError(e, a);
932
- }
933
- }
934
- async _processInitialPrompt() {
935
- if (!this.initialPrompt || this.initialPrompt === this._lastProcessedInitialPrompt || !this._isDatasetRequirementMet(this.selectedDatasets)) return;
936
- this._lastProcessedInitialPrompt = this.initialPrompt;
937
- let e = this.selectedDatasets.map((e) => e.id), t = this._buildRequestBody(this.initialPrompt, e), n = `${this.apiUrl}/${this.apiVersion}/aimessagedeprecated`;
938
- if (this.requestMode === "external") {
939
- let r = {
940
- prompt: this.initialPrompt,
941
- selectedDatasets: this.selectedDatasets,
942
- datasetIds: e,
943
- request: t,
944
- url: n
945
- };
946
- this.dispatchEvent(new CustomEvent("luzmo-prompt-submitted", {
947
- detail: r,
948
- bubbles: !0,
949
- composed: !0
950
- }));
951
- return;
952
- }
953
- let r = this._prepareForAIResponse();
954
- try {
955
- await this._sendStreamingMessage(t, r);
956
- } catch (e) {
957
- e.name !== "AbortError" && this._handleAPIError(e, r);
958
- }
959
- }
960
- disconnectedCallback() {
961
- super.disconnectedCallback(), this._abortController?.abort(), this._abortController = null, this._finalizeInflightMessage(), this._isGeneratingInternal = !1;
962
- }
963
- _scrollToBottom() {
964
- let e = this.shadowRoot?.querySelector(".chat-messages-container");
965
- e && requestAnimationFrame(() => {
966
- requestAnimationFrame(() => {
967
- e.scrollTop = e.scrollHeight;
968
- });
969
- });
970
- }
971
- updated(e) {
972
- super.updated?.(e), (e.has("messages") || e.has("_progress") || e.has("progress")) && this.updateComplete.then(() => this._scrollToBottom()), this.initialPrompt && this.initialPrompt !== this._lastProcessedInitialPrompt ? this._processInitialPrompt() : this.initialPrompt || (this._lastProcessedInitialPrompt = null);
973
- }
974
- _sanitizeMessage(e) {
975
- return M.sanitize(e, {
976
- ALLOWED_TAGS: [
977
- "p",
978
- "br",
979
- "strong",
980
- "em",
981
- "b",
982
- "i",
983
- "u",
984
- "s",
985
- "code",
986
- "pre",
987
- "blockquote",
988
- "ul",
989
- "ol",
990
- "li",
991
- "a"
992
- ],
993
- ALLOWED_ATTR: [
994
- "href",
995
- "title",
996
- "target",
997
- "rel"
998
- ],
999
- ALLOW_DATA_ATTR: !1,
1000
- FORBID_TAGS: [
1001
- "script",
1002
- "iframe",
1003
- "object",
1004
- "embed",
1005
- "form",
1006
- "input",
1007
- "button"
1008
- ],
1009
- FORBID_ATTR: [
1010
- "onerror",
1011
- "onload",
1012
- "onclick",
1013
- "onmouseover",
1014
- "onfocus",
1015
- "onblur"
1016
- ]
1017
- });
1018
- }
1019
- _renderProgress() {
1020
- let e = this.requestMode === "external" ? this.progress : this._progress, t = this.requestMode === "external" ? this.progressCollapsed : this._progressCollapsed;
1021
- return e?.children?.length ? o`
1022
- <luzmo-progress-steps
1023
- .progress=${e}
1024
- ?collapsed=${t}
1025
- size="s"
1026
- ></luzmo-progress-steps>
1027
- ` : s;
1028
- }
1029
- _isLastAiMessageWithProgress(e, t) {
1030
- 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;
1031
- return !1;
1032
- }
1033
- _renderRestoreMenu(e, t, a, c = !1) {
1034
- if (!(this.showAssistantContextMenu && e.hasChart && e.apiMessageId && !e.isError && e.id !== a)) return s;
1035
- let l = `context-menu-trigger-${e.apiMessageId}`;
1036
- return o`
1037
- <div class="assistant-context-menu">
1038
- <button
1039
- id=${l}
1040
- class="assistant-context-menu-trigger"
1041
- type="button"
1042
- ?disabled=${c}
1043
- >
1044
- ${i(r)}
1045
- </button>
1046
- <luzmo-overlay
1047
- trigger="${l}@click"
1048
- placement="bottom-end"
1049
- >
1050
- <luzmo-popover>
1051
- <button
1052
- class="assistant-context-menu-item"
1053
- type="button"
1054
- ?disabled=${c}
1055
- @click=${() => this._handleRestoreState(e, t)}
1056
- >
1057
- ${n("Restore state", { desc: "Context menu action that restores the chart to this message state" })}
1058
- </button>
1059
- </luzmo-popover>
1060
- </luzmo-overlay>
1061
- </div>
1062
- `;
1063
- }
1064
- _renderMessages() {
1065
- let e = this.requestMode === "external" ? this.isGenerating : this._inflightAiMessage !== null, t = [...this.messages].reverse().find((e) => e.type === "ai")?.id, n = this.messages.filter((e) => !this._inflightAiMessage || e.id !== this._inflightAiMessage.id);
1066
- return n.map((r) => {
1067
- let i = !!r.progress?.children?.length, a = i && this._isLastAiMessageWithProgress(r, n), c = i && (e || !a), l = i ? o`
1068
- <luzmo-progress-steps
1069
- .progress=${r.progress}
1070
- ?condensed=${c}
1071
- collapsed
1072
- no-animate
1073
- size="s"
1074
- ></luzmo-progress-steps>
1075
- ` : s;
1076
- if (r.type === "user") return o`
1077
- <luzmo-chat-message
1078
- avatar-placement="bottom"
1079
- position="right"
1080
- variant="primary"
1081
- size="s"
1082
- >
1083
- ${r.message}
1084
- </luzmo-chat-message>
1085
- `;
1086
- let u = this.messages.indexOf(r);
1087
- return o`
1088
- ${l}
1089
- <div class="assistant-message-wrapper">
1090
- <luzmo-chat-message
1091
- class=${r.isError ? "error" : ""}
1092
- role=${r.isError ? "alert" : s}
1093
- avatar-placement="bottom"
1094
- position="left"
1095
- quiet
1096
- size="s"
1097
- >
1098
- ${d(this._sanitizeMessage(r.message))}
1099
- </luzmo-chat-message>
1100
-
1101
- ${this._renderRestoreMenu(r, u, t, e)}
1102
- </div>
1103
- `;
1104
- });
1105
- }
1106
- _renderStreamingResponse() {
1107
- return this._inflightAiMessage?.message ? o`
1108
- <luzmo-chat-message
1109
- avatar-placement="bottom"
1110
- position="left"
1111
- quiet
1112
- size="s"
1113
- >
1114
- ${d(this._sanitizeMessage(this._inflightAiMessage.message))}
1115
- </luzmo-chat-message>
1116
- ` : s;
1117
- }
1118
- _renderLoadingMessage() {
1119
- let e = this.requestMode === "external" ? this.isGenerating : this._isGeneratingInternal, t = this.requestMode === "external" ? this.progress : this._progress;
1120
- return !e || t?.children?.length ? s : o`
1121
- <luzmo-chat-message
1122
- avatar-placement="bottom"
1123
- position="left"
1124
- quiet
1125
- size="s"
1126
- >
1127
- <div class="loading-message" role="status" aria-live="polite">
1128
- <span class="icon-lg">${i(a, { className: "spin" })}</span>
1129
- <span class="loading-message-text">${this.loadingMessage || (this.chart?.type === "placeholder" ? n("Creating item...", { desc: "Label for ai chat creating item message" }) : n("Updating item...", { desc: "Label for ai chat updating item message" }))}</span>
1130
- </div>
1131
- </luzmo-chat-message>
1132
- `;
1133
- }
1134
- _renderPlaceholderMessage() {
1135
- return this.messages.length > 0 ? o`
1136
-
1137
- ` : o`
1138
- <luzmo-chat-message
1139
- avatar-placement="bottom"
1140
- position="left"
1141
- quiet
1142
- size="s"
1143
- >
1144
- ${n("Describe how you want to edit this item…", { desc: "Label for ai chat placeholder message" })}
1145
- </luzmo-chat-message>
1146
- `;
1147
- }
1148
- render() {
1149
- let e = this.requestMode === "external" ? this.isGenerating : this._isGeneratingInternal;
1150
- return o`
1151
- <div class="chat-container" role="region" aria-label=${n("AI Chat", { desc: "Accessible label for AI chat region" })}>
1152
- <div class="chat-messages-container" role="log" aria-live="polite">
1153
- ${this._renderPlaceholderMessage()}
1154
- ${this._renderMessages()}
1155
- ${this._renderProgress()}
1156
- ${this._renderStreamingResponse()}
1157
- ${this._renderLoadingMessage()}
1158
- </div>
1159
-
1160
- <luzmo-ai-interaction-textarea
1161
- .value=${this._textareaValue}
1162
- .selectedDatasets=${this.selectedDatasets}
1163
- .placeholder=${this.placeholder}
1164
- ?disabled=${this.disabled}
1165
- ?is-generating=${e}
1166
- ?hide-dataset-button=${this.hideDatasetButton}
1167
- ?hide-dataset-icons=${this.hideDatasetIcons}
1168
- ?disable-dataset-modification=${this.disableDatasetModification}
1169
- ?hide-selected-datasets=${this.hideSelectedDatasets}
1170
- ?disable-column-mentions=${this.disableColumnMentions}
1171
- ?require-dataset=${this.requireDataset}
1172
- auth-key=${this.authKey}
1173
- auth-token=${this.authToken}
1174
- api-url=${this.apiUrl}
1175
- app-server=${this.appServer}
1176
- ?flag-opendata=${this.flagOpendata}
1177
- @prompt-submitted=${this._handlePromptSubmitted}
1178
- @dataset-selected=${this._handleDatasetSelected}
1179
- @dataset-removed=${this._handleDatasetRemoved}
1180
- ></luzmo-ai-interaction-textarea>
1181
- </div>
1182
- `;
1183
- }
1184
- };
1185
- //#endregion
1186
- //#region src/components/ai-chat/index.ts
1187
- t([l({ type: Array })], P.prototype, "messages", void 0), t([l({
1188
- type: Array,
1189
- attribute: "selected-datasets"
1190
- })], P.prototype, "selectedDatasets", void 0), t([l({ type: String })], P.prototype, "placeholder", void 0), t([l({
1191
- type: Boolean,
1192
- reflect: !0
1193
- })], P.prototype, "disabled", void 0), t([l({
1194
- type: Boolean,
1195
- attribute: "show-assistant-context-menu"
1196
- })], P.prototype, "showAssistantContextMenu", void 0), t([l({
1197
- type: String,
1198
- attribute: "auth-key"
1199
- })], P.prototype, "authKey", void 0), t([l({
1200
- type: String,
1201
- attribute: "auth-token"
1202
- })], P.prototype, "authToken", void 0), t([l({
1203
- type: String,
1204
- attribute: "api-url"
1205
- })], P.prototype, "apiUrl", void 0), t([l({
1206
- type: String,
1207
- attribute: "app-server"
1208
- })], P.prototype, "appServer", void 0), t([l({
1209
- type: Boolean,
1210
- attribute: "flag-opendata"
1211
- })], P.prototype, "flagOpendata", void 0), t([l({
1212
- type: Boolean,
1213
- attribute: "hide-dataset-button"
1214
- })], P.prototype, "hideDatasetButton", void 0), t([l({
1215
- type: Boolean,
1216
- attribute: "hide-dataset-icons"
1217
- })], P.prototype, "hideDatasetIcons", void 0), t([l({
1218
- type: Boolean,
1219
- attribute: "disable-dataset-modification"
1220
- })], P.prototype, "disableDatasetModification", void 0), t([l({
1221
- type: Boolean,
1222
- attribute: "hide-selected-datasets"
1223
- })], P.prototype, "hideSelectedDatasets", void 0), t([l({
1224
- type: Boolean,
1225
- attribute: "disable-column-mentions"
1226
- })], P.prototype, "disableColumnMentions", void 0), t([l({
1227
- type: Boolean,
1228
- attribute: "require-dataset"
1229
- })], P.prototype, "requireDataset", void 0), t([l({
1230
- type: String,
1231
- attribute: "model-preference"
1232
- })], P.prototype, "modelPreference", void 0), t([l({
1233
- type: String,
1234
- attribute: "request-mode"
1235
- })], P.prototype, "requestMode", void 0), t([l({
1236
- type: Boolean,
1237
- attribute: "is-generating"
1238
- })], P.prototype, "isGenerating", void 0), t([l({
1239
- type: String,
1240
- attribute: "conversation-id"
1241
- })], P.prototype, "conversationId", void 0), t([l({
1242
- type: Object,
1243
- attribute: "chart"
1244
- })], P.prototype, "chart", void 0), t([l({
1245
- type: String,
1246
- attribute: "api-version"
1247
- })], P.prototype, "apiVersion", void 0), t([l({ converter: { fromAttribute: (e) => e !== "false" && e !== null } })], P.prototype, "stream", void 0), t([l({
1248
- type: String,
1249
- attribute: "loading-message"
1250
- })], P.prototype, "loadingMessage", void 0), t([l({
1251
- type: String,
1252
- attribute: "initial-prompt"
1253
- })], P.prototype, "initialPrompt", void 0), t([l({ type: Object })], P.prototype, "progress", void 0), t([l({
1254
- type: Boolean,
1255
- attribute: "progress-collapsed"
1256
- })], P.prototype, "progressCollapsed", void 0), t([u()], P.prototype, "_progress", void 0), t([u()], P.prototype, "_progressCollapsed", void 0), t([u()], P.prototype, "_isGeneratingInternal", void 0), t([u()], P.prototype, "_textareaValue", void 0), customElements.get("luzmo-ai-chat") || customElements.define("luzmo-ai-chat", P);
1257
- //#endregion
1258
- export { ze as a, Le as i, N as n, Re as o, He as r, Be as s, P as t };