@luzmo/analytics-components-kit 1.0.8 → 1.0.9-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (702) hide show
  1. package/README.md +6 -4
  2. package/components/ad-hoc-slot-content-BwcFfXCV.cjs +20 -0
  3. package/components/ad-hoc-slot-content-hSlT62VS.js +29 -0
  4. package/components/ai-chat/ai-chat-events.d.ts +139 -0
  5. package/components/ai-chat/ai-chat-request.d.ts +25 -0
  6. package/components/ai-chat/ai-chat.d.ts +347 -0
  7. package/components/ai-chat/ai-prompt-types.d.ts +133 -0
  8. package/components/ai-chat/empty-state/ai-chat-empty-state.d.ts +46 -0
  9. package/components/ai-chat/empty-state/index.d.ts +8 -0
  10. package/components/ai-chat/empty-state/types.d.ts +14 -0
  11. package/components/ai-chat/helpers/agent-config.d.ts +12 -0
  12. package/components/ai-chat/helpers/elicitation-template.d.ts +18 -0
  13. package/components/ai-chat/index.cjs +20 -0
  14. package/components/ai-chat/index.d.ts +24 -0
  15. package/components/ai-chat/index.js +22 -0
  16. package/components/ai-chat/session/ai-chat-session-controller.d.ts +60 -0
  17. package/components/ai-chat/session/ai-chat-session-types.d.ts +119 -0
  18. package/components/ai-chat/session/ai-chat-session.d.ts +119 -0
  19. package/components/ai-chat/session/index.d.ts +2 -0
  20. package/components/ai-chat/stream/chunk-extractors.d.ts +29 -0
  21. package/components/ai-chat/stream/index.d.ts +53 -0
  22. package/components/ai-chat/stream/progress.d.ts +3 -0
  23. package/components/ai-chat/stream/registry.d.ts +6 -0
  24. package/components/ai-chat/stream/stream-processor.d.ts +2 -0
  25. package/components/ai-chat/stream/transport.d.ts +26 -0
  26. package/components/ai-chat/stream/types.d.ts +59 -0
  27. package/components/ai-chat/types.d.ts +24 -0
  28. package/components/ai-chat-CVxHPPvM.js +4351 -0
  29. package/components/ai-chat-DEVIxsRP.cjs +337 -0
  30. package/components/ai-interaction-textarea/ai-interaction-textarea.d.ts +232 -0
  31. package/components/ai-interaction-textarea/index.cjs +20 -0
  32. package/components/ai-interaction-textarea/index.d.ts +10 -0
  33. package/components/ai-interaction-textarea/index.js +21 -0
  34. package/components/ai-interaction-textarea/types.d.ts +12 -0
  35. package/components/ai-interaction-textarea-D_Lw29_i.cjs +99 -0
  36. package/components/ai-interaction-textarea-i9SabsmQ.js +821 -0
  37. package/components/{area-chart-options.config-B94ERc30.js → area-chart-options.config-DJnPr93H.js} +1 -1
  38. package/components/{area-chart-positioning.config-Cbeon6-x.cjs → area-chart-positioning.config-B8xSL1XU.cjs} +1 -1
  39. package/components/{area-chart-positioning.config-BJK4Q4NL.js → area-chart-positioning.config-C0_dxknc.js} +1 -1
  40. package/components/{area-chart-slots.config-DdPO34_g.js → area-chart-slots.config-ClE-gYVY.js} +1 -1
  41. package/components/{bar-chart-options.config-B1C3t6uk.js → bar-chart-options.config-D1x5WPbL.js} +1 -1
  42. package/components/{bar-chart-positioning.config-B4UuSMIW.js → bar-chart-positioning.config-B4fazkYv.js} +1 -1
  43. package/components/{bar-chart-positioning.config-BnhZQUtb.cjs → bar-chart-positioning.config-B6A5m0ZR.cjs} +1 -1
  44. package/components/{bar-chart-slots.config-BnbZRLIr.js → bar-chart-slots.config-rMFwFprg.js} +1 -1
  45. package/components/{base-IE9Qxmub.js → base-BRTs2KqJ.js} +30 -30
  46. package/components/base-BWU343D_.cjs +20 -0
  47. package/components/{box-plot-options.config-sBfVzPTw.js → box-plot-options.config-CooBIc6N.js} +1 -1
  48. package/components/{box-plot-positioning.config-CYk5koLu.js → box-plot-positioning.config-BI9F_JjL.js} +1 -1
  49. package/components/{box-plot-positioning.config-DsldCFWm.cjs → box-plot-positioning.config-DVXXjP8U.cjs} +1 -1
  50. package/components/{box-plot-slots.config-D6F2R2dw.js → box-plot-slots.config-DS2UIfRF.js} +1 -1
  51. package/components/{bubble-chart-options.config-DKeBF5A0.js → bubble-chart-options.config-B6aLA_1d.js} +1 -1
  52. package/components/{bubble-chart-positioning.config-BV-T_2cy.cjs → bubble-chart-positioning.config-C0tGI4fC.cjs} +1 -1
  53. package/components/{bubble-chart-positioning.config-BSDmuPwq.js → bubble-chart-positioning.config-DXhama4z.js} +1 -1
  54. package/components/{bubble-chart-slots.config-BJdtdpS0.js → bubble-chart-slots.config-2qy2RqaU.js} +1 -1
  55. package/components/{bullet-chart-options.config-DdTBWTAF.js → bullet-chart-options.config-CBmbmhzI.js} +1 -1
  56. package/components/{bullet-chart-positioning.config-B3GeLs8o.js → bullet-chart-positioning.config-Czlw32Ii.js} +1 -1
  57. package/components/{bullet-chart-positioning.config-BoqQq4g_.cjs → bullet-chart-positioning.config-Dmb_yizO.cjs} +1 -1
  58. package/components/{bullet-chart-slots.config-NeUTKgYI.js → bullet-chart-slots.config-BaMmwIH0.js} +1 -1
  59. package/components/{choropleth-map-options.config-nOE0NWaD.js → choropleth-map-options.config-DWWydGJ3.js} +1 -1
  60. package/components/{choropleth-map-positioning.config-6OT0sZa5.js → choropleth-map-positioning.config-BWJmEGy6.js} +1 -1
  61. package/components/{choropleth-map-positioning.config-C_I3wf8H.cjs → choropleth-map-positioning.config-JIj9p6-n.cjs} +1 -1
  62. package/components/{choropleth-map-slots.config-BbBwTeuw.js → choropleth-map-slots.config-DqOi1kCn.js} +1 -1
  63. package/components/{circle-pack-chart-options.config-CgE8vGP9.js → circle-pack-chart-options.config-D2RCikyA.js} +1 -1
  64. package/components/{circle-pack-chart-positioning.config-D7Oke8BW.cjs → circle-pack-chart-positioning.config-D3Ogj0P9.cjs} +1 -1
  65. package/components/{circle-pack-chart-positioning.config-BuuhKB85.js → circle-pack-chart-positioning.config-PhYH_yh8.js} +1 -1
  66. package/components/{circle-pack-chart-slots.config-CJFjalBn.js → circle-pack-chart-slots.config-B7_1p86m.js} +1 -1
  67. package/components/{circular-gauge-options.config-DtNYelhq.js → circular-gauge-options.config-syWQJHKT.js} +1 -1
  68. package/components/{circular-gauge-positioning.config-DlWvKl0e.js → circular-gauge-positioning.config-COSdEO1U.js} +1 -1
  69. package/components/{circular-gauge-positioning.config-B_IJzIBn.cjs → circular-gauge-positioning.config-DxfZmoEP.cjs} +1 -1
  70. package/components/{circular-gauge-slots.config-DAKsa5Hq.js → circular-gauge-slots.config-BxjCP1ao.js} +1 -1
  71. package/components/{column-chart-options.config-C2GGiHOI.js → column-chart-options.config-B2LIl9lL.js} +1 -1
  72. package/components/{column-chart-positioning.config-DngsP5So.cjs → column-chart-positioning.config-6OVsL5vU.cjs} +1 -1
  73. package/components/{column-chart-positioning.config-BLacEiY5.js → column-chart-positioning.config-BRYZk4cF.js} +1 -1
  74. package/components/{column-chart-slots.config-Bpr-WaCi.js → column-chart-slots.config-D6MBTcj4.js} +1 -1
  75. package/components/{combination-chart-options.config-LddX4naq.js → combination-chart-options.config-0ATFph8S.js} +1 -1
  76. package/components/{combination-chart-positioning.config-BVV0Bq-d.cjs → combination-chart-positioning.config-4qgeM8BL.cjs} +1 -1
  77. package/components/{combination-chart-positioning.config-DxnmzV6O.js → combination-chart-positioning.config-CTj23r8f.js} +1 -1
  78. package/components/{combination-chart-slots.config-u-QLoQQ-.js → combination-chart-slots.config-dYT9lz8M.js} +1 -1
  79. package/components/{conditional-number-options.config-qdX9T4zu.js → conditional-number-options.config-Bv2xONtI.js} +1 -1
  80. package/components/{conditional-number-positioning.config-YEo_yFBu.js → conditional-number-positioning.config-BUdWeVNm.js} +1 -1
  81. package/components/{conditional-number-positioning.config-DfitbPT6.cjs → conditional-number-positioning.config-Dg67t4VA.cjs} +1 -1
  82. package/components/{conditional-number-slots.config-CiLUXRSe.js → conditional-number-slots.config-DtYkqtN8.js} +1 -1
  83. package/components/convert-datasets-to-data-fields-B13rl1an.cjs +20 -0
  84. package/components/convert-datasets-to-data-fields-PmQzeVLG.js +68 -0
  85. package/components/create-lazy-loader-BO_oTDF5.js +31 -0
  86. package/components/create-lazy-loader-DYPgQh0L.cjs +20 -0
  87. package/components/data-field/index.cjs +1 -1
  88. package/components/data-field/index.d.ts +1 -0
  89. package/components/data-field/index.js +1 -8
  90. package/components/data-field-CwC5VH16.js +122 -0
  91. package/components/data-field-DHpgI_wv.cjs +54 -0
  92. package/components/data-field-level/data-field-level.d.ts +40 -0
  93. package/components/data-field-level/helpers/generate-preview.d.ts +9 -0
  94. package/components/data-field-level/index.cjs +20 -0
  95. package/components/data-field-level/index.d.ts +8 -0
  96. package/components/data-field-level/index.js +21 -0
  97. package/components/data-field-level-8-eOBdl6.cjs +55 -0
  98. package/components/{data-field-yTJb-R63.js → data-field-level-Ben_W9pd.js} +49 -142
  99. package/components/data-field-panel/index.cjs +1 -1
  100. package/components/data-field-panel/index.d.ts +1 -0
  101. package/components/data-field-panel/index.js +1 -8
  102. package/components/data-field-panel-CiuTVMXF.cjs +87 -0
  103. package/components/{data-field-panel-BWBr1Fog.js → data-field-panel-DppKRagT.js} +7 -5
  104. package/components/data-fields-select/data-fields-select.d.ts +137 -0
  105. package/components/data-fields-select/index.cjs +20 -0
  106. package/components/data-fields-select/index.d.ts +9 -0
  107. package/components/data-fields-select/index.js +21 -0
  108. package/components/data-fields-select/types.d.ts +4 -0
  109. package/components/data-fields-select-DjDeBEj-.cjs +43 -0
  110. package/components/{data-fields-select-Bb1HXwlO.js → data-fields-select-HwMkrPAn.js} +18 -7
  111. package/components/dataset-icon/dataset-icon.d.ts +45 -0
  112. package/components/dataset-icon/index.cjs +20 -0
  113. package/components/dataset-icon/index.d.ts +8 -0
  114. package/components/{en-CSPDwq2y.cjs → dataset-icon/index.js} +2 -1
  115. package/components/dataset-icon/types.d.ts +11 -0
  116. package/components/dataset-icon-BEq1MNml.js +126 -0
  117. package/components/dataset-icon-tec1Xulw.cjs +64 -0
  118. package/components/dataset-selector-list/dataset-selector-list.d.ts +106 -0
  119. package/components/dataset-selector-list/index.cjs +20 -0
  120. package/components/dataset-selector-list/index.d.ts +8 -0
  121. package/components/dataset-selector-list/index.js +21 -0
  122. package/components/dataset-selector-list-BL2uKzCy.cjs +75 -0
  123. package/components/dataset-selector-list-BWavenTF.js +324 -0
  124. package/components/dataset-selector-row/dataset-selector-row.d.ts +135 -0
  125. package/components/dataset-selector-row/index.cjs +20 -0
  126. package/components/dataset-selector-row/index.d.ts +9 -0
  127. package/components/dataset-selector-row/index.js +21 -0
  128. package/components/dataset-selector-row-BP4Txybx.cjs +102 -0
  129. package/components/dataset-selector-row-C_O6h4Ir.js +428 -0
  130. package/components/{date-comparison-filter-options.config-BSzzAJPM.js → date-comparison-filter-options.config-DgLx-m3L.js} +1 -1
  131. package/components/{date-comparison-filter-slots.config-Cvze969w.js → date-comparison-filter-slots.config-BKZ13uzB.js} +1 -1
  132. package/components/{date-filter-options.config-C6VvDjd8.js → date-filter-options.config-Cbiy0QKd.js} +1 -1
  133. package/components/{date-filter-slots.config-Y8hmQh0S.js → date-filter-slots.config-SzWky1y7.js} +1 -1
  134. package/components/{de-C5CMIy08.js → de-BhKtDR6p.js} +34 -0
  135. package/components/de-DXFLsh4N.cjs +20 -0
  136. package/components/decompose-numeric-format-DGJua3rU.cjs +20 -0
  137. package/components/decompose-numeric-format-DS0j2wa1.js +36 -0
  138. package/components/decorate-DCJt-2rt.cjs +20 -0
  139. package/components/{localized-mixin-DhiGdPMj.js → decorate-DyMgX_Uh.js} +2 -26
  140. package/components/default-acceptable-data-field-types-DFOFWWnT.js +53 -0
  141. package/components/default-acceptable-data-field-types-fPsz64ka.cjs +20 -0
  142. package/components/display-settings/display-settings.d.ts +117 -0
  143. package/components/display-settings/index.cjs +20 -0
  144. package/components/display-settings/index.d.ts +8 -0
  145. package/components/display-settings/index.js +21 -0
  146. package/components/display-settings/types.d.ts +9 -0
  147. package/components/display-settings-Dmvi7XT-.cjs +142 -0
  148. package/components/display-settings-V5AltVPN.js +316 -0
  149. package/components/display-settings-binning/display-settings-binning.d.ts +32 -0
  150. package/components/display-settings-binning/index.cjs +20 -0
  151. package/components/display-settings-binning/index.d.ts +8 -0
  152. package/components/display-settings-binning/index.js +21 -0
  153. package/components/{display-settings-binning-CaE87u3h.js → display-settings-binning-BNofVnZE.js} +18 -19
  154. package/components/{display-settings-binning-CjvB12ds.cjs → display-settings-binning-C1Fvc8tj.cjs} +2 -2
  155. package/components/display-settings-datetime/display-settings-datetime.d.ts +86 -0
  156. package/components/display-settings-datetime/index.cjs +20 -0
  157. package/components/display-settings-datetime/index.d.ts +8 -0
  158. package/components/display-settings-datetime/index.js +21 -0
  159. package/components/{display-settings-datetime-5rq55OAn.js → display-settings-datetime-CUR1w0k5.js} +70 -71
  160. package/components/{display-settings-datetime-B23w7aH4.cjs → display-settings-datetime-OiFwicTh.cjs} +9 -9
  161. package/components/display-settings-grand-totals/display-settings-grand-totals.d.ts +29 -0
  162. package/components/display-settings-grand-totals/index.cjs +20 -0
  163. package/components/display-settings-grand-totals/index.d.ts +8 -0
  164. package/components/display-settings-grand-totals/index.js +21 -0
  165. package/components/display-settings-grand-totals-Bi1OcC7p.cjs +44 -0
  166. package/components/{display-settings-grand-totals-DnKvI34n.js → display-settings-grand-totals-CgzHbK1K.js} +18 -19
  167. package/components/display-settings-numeric/display-settings-numeric.d.ts +82 -0
  168. package/components/display-settings-numeric/helpers/constants.d.ts +19 -0
  169. package/components/display-settings-numeric/index.cjs +20 -0
  170. package/components/display-settings-numeric/index.d.ts +8 -0
  171. package/components/display-settings-numeric/index.js +21 -0
  172. package/components/display-settings-numeric-BQ_vQrnj.cjs +190 -0
  173. package/components/{display-settings-numeric-B8MCRz-V.js → display-settings-numeric-CUWkiQtR.js} +80 -81
  174. package/components/display-settings-period-over-period/display-settings-period-over-period.d.ts +76 -0
  175. package/components/display-settings-period-over-period/helpers/constants.d.ts +44 -0
  176. package/components/display-settings-period-over-period/index.cjs +20 -0
  177. package/components/display-settings-period-over-period/index.d.ts +8 -0
  178. package/components/{en-GB-CJR66Ci_.cjs → display-settings-period-over-period/index.js} +2 -1
  179. package/components/display-settings-period-over-period-Br08rz7r.cjs +227 -0
  180. package/components/{display-settings-period-over-period-W3dPK8LR.js → display-settings-period-over-period-C7cfSyIL.js} +86 -86
  181. package/components/{donut-chart-options.config-CPHgS1Wi.js → donut-chart-options.config-C8wpZzyJ.js} +1 -1
  182. package/components/{donut-chart-positioning.config-QOZXaJmt.cjs → donut-chart-positioning.config-B4JdERSl.cjs} +1 -1
  183. package/components/{donut-chart-positioning.config-fGckMun2.js → donut-chart-positioning.config-CWGYZUec.js} +1 -1
  184. package/components/{donut-chart-slots.config-DilGk7ju.js → donut-chart-slots.config-fGqtoKZi.js} +1 -1
  185. package/components/{dropdown-filter-options.config-DFJKns3l.js → dropdown-filter-options.config-DkiapYtc.js} +1 -1
  186. package/components/{dropdown-filter-slots.config-7heZtoEY.js → dropdown-filter-slots.config-DPcT6v-9.js} +1 -1
  187. package/components/{en-DdS5q1ZT.js → en-CcLhGxIh.js} +1 -1
  188. package/components/{en-GB-Cn0xDC0K.js → en-GB-DzkdeUQh.js} +1 -1
  189. package/components/en-GB-uxY5qmIM.cjs +20 -0
  190. package/components/{en-US-DdS5q1ZT.js → en-US-CcLhGxIh.js} +1 -1
  191. package/components/{en-US-CSPDwq2y.cjs → en-US-q_Ruzags.cjs} +1 -1
  192. package/components/en-q_Ruzags.cjs +20 -0
  193. package/components/es-DK-49nGv.cjs +20 -0
  194. package/components/{es-BCur0-77.js → es-DUENN-m1.js} +34 -0
  195. package/components/{evolution-number-options.config-DT7iGQA8.js → evolution-number-options.config-Ca9ABNVM.js} +1 -1
  196. package/components/{evolution-number-positioning.config-B7lBArog.cjs → evolution-number-positioning.config-CqQeAPbN.cjs} +1 -1
  197. package/components/{evolution-number-positioning.config-CVIysE4H.js → evolution-number-positioning.config-DZ7SVvue.js} +1 -1
  198. package/components/{evolution-number-slots.config-noZzIHkT.js → evolution-number-slots.config-CKawNqUS.js} +1 -1
  199. package/components/filter-expression-picker/filter-expression-picker.d.ts +77 -0
  200. package/components/filter-expression-picker/index.cjs +20 -0
  201. package/components/filter-expression-picker/index.d.ts +7 -0
  202. package/components/filter-expression-picker/index.js +21 -0
  203. package/components/filter-expression-picker-3xcrAACt.js +434 -0
  204. package/components/filter-expression-picker-BrtXMSBv.cjs +40 -0
  205. package/components/filter-item/filter-item.d.ts +142 -0
  206. package/components/filter-item/index.cjs +20 -0
  207. package/components/filter-item/index.d.ts +8 -0
  208. package/components/filter-item/index.js +21 -0
  209. package/components/filter-item-CH5sjhJy.js +793 -0
  210. package/components/filter-item-C_h4rbuL.cjs +111 -0
  211. package/components/filter-parameter-picker/filter-parameter-picker.d.ts +91 -0
  212. package/components/filter-parameter-picker/filter-parameter-picker.helpers.d.ts +8 -0
  213. package/components/filter-parameter-picker/index.cjs +20 -0
  214. package/components/filter-parameter-picker/index.d.ts +9 -0
  215. package/components/filter-parameter-picker/index.js +21 -0
  216. package/components/filter-parameter-picker/types.d.ts +4 -0
  217. package/components/filter-parameter-picker-CB3uIoZ2.js +372 -0
  218. package/components/filter-parameter-picker-DJKHZxlT.cjs +124 -0
  219. package/components/filter-value-picker/filter-value-picker.d.ts +72 -0
  220. package/components/filter-value-picker/index.cjs +20 -0
  221. package/components/filter-value-picker/index.d.ts +7 -0
  222. package/components/filter-value-picker/index.js +21 -0
  223. package/components/filter-value-picker-CW9vKpn1.cjs +69 -0
  224. package/components/filter-value-picker-DeO855hf.js +170 -0
  225. package/components/filter-value-picker-datetime/filter-value-picker-datetime.d.ts +51 -0
  226. package/components/filter-value-picker-datetime/index.cjs +20 -0
  227. package/components/filter-value-picker-datetime/index.d.ts +7 -0
  228. package/components/filter-value-picker-datetime/index.js +21 -0
  229. package/components/filter-value-picker-datetime-B0lLveRY.js +160 -0
  230. package/components/filter-value-picker-datetime-DapMI9Jr.cjs +51 -0
  231. package/components/filter-value-picker-hierarchy/filter-value-picker-hierarchy.d.ts +105 -0
  232. package/components/filter-value-picker-hierarchy/index.cjs +20 -0
  233. package/components/filter-value-picker-hierarchy/index.d.ts +7 -0
  234. package/components/filter-value-picker-hierarchy/index.js +21 -0
  235. package/components/filter-value-picker-hierarchy-B2xSmjFz.js +316 -0
  236. package/components/filter-value-picker-hierarchy-C9mJ8PH7.cjs +54 -0
  237. package/components/filter-value-picker-numeric/filter-value-picker-numeric.d.ts +89 -0
  238. package/components/filter-value-picker-numeric/index.cjs +20 -0
  239. package/components/filter-value-picker-numeric/index.d.ts +7 -0
  240. package/components/filter-value-picker-numeric/index.js +21 -0
  241. package/components/filter-value-picker-numeric-CayroCHe.js +237 -0
  242. package/components/filter-value-picker-numeric-DE5h7dZN.cjs +54 -0
  243. package/components/filters/filters.d.ts +62 -2
  244. package/components/filters/index.cjs +1 -1
  245. package/components/filters/index.d.ts +2 -1
  246. package/components/filters/index.js +2 -9
  247. package/components/filters/types.d.ts +2 -0
  248. package/components/filters-CGqIDlPK.cjs +199 -0
  249. package/components/filters-D5oua2IU.js +927 -0
  250. package/components/formatter-BeXmurVe.cjs +20 -0
  251. package/components/{period-over-period-condition.const-IOVIrgKJ.js → formatter-Cq5dFCyU.js} +44 -234
  252. package/components/formula/index.cjs +1 -1
  253. package/components/formula/index.js +1 -8
  254. package/components/{formula-BFvxm8kj.cjs → formula-8YhND5Y7.cjs} +13 -13
  255. package/components/{formula-CdAkO1za.js → formula-B4lrmE5g.js} +16 -14
  256. package/components/formula-codemirror/formula-codemirror.d.ts +79 -0
  257. package/components/formula-codemirror/index.d.ts +7 -0
  258. package/components/formula-codemirror/pills/formula-aggregation/formula-aggregation.d.ts +125 -0
  259. package/components/formula-codemirror/pills/formula-aggregation/index.d.ts +7 -0
  260. package/components/formula-codemirror/pills/formula-empty-argument-pill/formula-empty-argument-pill.d.ts +28 -0
  261. package/components/formula-codemirror/pills/formula-empty-argument-pill/index.d.ts +7 -0
  262. package/components/formula-codemirror/pills/formula-include-exclude-panel.d.ts +38 -0
  263. package/components/formula-codemirror-CBvQJGHq.cjs +215 -0
  264. package/components/{formula-codemirror-jVC8mjQ3.js → formula-codemirror-CVlF_Qyh.js} +23 -20
  265. package/components/formula-display-store-BJvPYYsO.cjs +20 -0
  266. package/components/{formula-display-store-CLAt_fik.js → formula-display-store-D9MWhreP.js} +239 -274
  267. package/components/formula-draggable-field/formula-draggable-field.d.ts +53 -0
  268. package/components/formula-draggable-field/index.d.ts +8 -0
  269. package/components/formula-draggable-field/types.d.ts +24 -0
  270. package/components/formula-editor/index.cjs +1 -1
  271. package/components/formula-editor/index.d.ts +1 -0
  272. package/components/formula-editor/index.js +4 -10
  273. package/components/{formula-editor-Bd9F-xdZ.js → formula-editor-BGT-QcuH.js} +148 -352
  274. package/components/formula-editor-De9Zj-9c.cjs +224 -0
  275. package/components/formula-field/formula-field.d.ts +20 -0
  276. package/components/formula-field/index.cjs +20 -0
  277. package/components/formula-field/index.d.ts +7 -0
  278. package/components/formula-field/index.js +21 -0
  279. package/components/formula-field--gNwmTRk.cjs +20 -0
  280. package/components/formula-field-CQcnyXOD.js +41 -0
  281. package/components/formula-input-base-BdKh5O_E.js +236 -0
  282. package/components/formula-input-base-CZih19kC.cjs +49 -0
  283. package/components/{fr-BnECl1nx.js → fr-CePmGBUH.js} +34 -0
  284. package/components/fr-uE3fb3kc.cjs +20 -0
  285. package/components/{funnel-chart-options.config-D21WdHBI.js → funnel-chart-options.config-CygQsQVD.js} +1 -1
  286. package/components/{funnel-chart-positioning.config-BGi7ixet.js → funnel-chart-positioning.config-B6I8z0_N.js} +1 -1
  287. package/components/{funnel-chart-positioning.config-zEqgz9Wz.cjs → funnel-chart-positioning.config-BhK0EStG.cjs} +1 -1
  288. package/components/{funnel-chart-slots.config-BWszdEe8.js → funnel-chart-slots.config-CfnSH4Ay.js} +1 -1
  289. package/components/{get-css-variable-B8sJUuig.cjs → get-css-variable-CBXsAxR6.cjs} +1 -1
  290. package/components/{get-css-variable-r1spgqX0.js → get-css-variable-DYnldi15.js} +1 -1
  291. package/components/get-dataset-name-DLjeChNS.js +32 -0
  292. package/components/get-dataset-name-mGNEfkAv.cjs +20 -0
  293. package/components/groupings-C1WNuUBe.js +52 -0
  294. package/components/groupings-CvXvU4Fr.cjs +20 -0
  295. package/components/{heat-map-options.config-DkuYkbWu.js → heat-map-options.config-X96sw-BV.js} +1 -1
  296. package/components/{heat-map-positioning.config-3dxU6qwG.cjs → heat-map-positioning.config-B9Njs88T.cjs} +1 -1
  297. package/components/{heat-map-positioning.config-CK2DBngE.js → heat-map-positioning.config-DAAt2hIR.js} +1 -1
  298. package/components/{heat-map-slots.config-Cwun49Qb.js → heat-map-slots.config-D2ypExJQ.js} +1 -1
  299. package/components/{heat-table-options.config-BJP1jVB8.js → heat-table-options.config-D6dA9J97.js} +1 -1
  300. package/components/{heat-table-positioning.config-CbscS7w1.cjs → heat-table-positioning.config-Cn7Ouv5g.cjs} +1 -1
  301. package/components/{heat-table-positioning.config-C55D814C.js → heat-table-positioning.config-D6ChanEH.js} +1 -1
  302. package/components/{heat-table-slots.config-nGB_B2mh.js → heat-table-slots.config-B1iOn6ay.js} +1 -1
  303. package/components/{hexbin-map-options.config-Bqp3u2bH.js → hexbin-map-options.config-FK9DrXGD.js} +1 -1
  304. package/components/{hexbin-map-positioning.config-CHecaD9p.cjs → hexbin-map-positioning.config-BqfRSZbU.cjs} +1 -1
  305. package/components/{hexbin-map-positioning.config-9nnyZGzx.js → hexbin-map-positioning.config-CNId41q1.js} +1 -1
  306. package/components/{hexbin-map-slots.config-BK-ftozd.js → hexbin-map-slots.config-CC1xZINm.js} +1 -1
  307. package/components/{image-options.config-Cz55iN7J.js → image-options.config-DxF0RSUF.js} +1 -1
  308. package/components/{image-slots.config-kvHutBFK.js → image-slots.config-Ba8NXeCH.js} +1 -1
  309. package/components/index.cjs +1 -840
  310. package/components/index.js +68 -6790
  311. package/components/interactive-viz-item/helpers/chart-helpers.d.ts +7 -0
  312. package/components/interactive-viz-item/index.cjs +20 -0
  313. package/components/interactive-viz-item/index.d.ts +10 -0
  314. package/components/interactive-viz-item/index.js +21 -0
  315. package/components/interactive-viz-item/interactive-viz-item.d.ts +97 -0
  316. package/components/interactive-viz-item/load-config-panel.d.ts +2 -0
  317. package/components/interactive-viz-item/types.d.ts +117 -0
  318. package/components/interactive-viz-item-CzIT8K3I.js +723 -0
  319. package/components/interactive-viz-item-DUyE1QEJ.cjs +249 -0
  320. package/components/item-grid/index.cjs +1 -1
  321. package/components/item-grid/index.js +1 -8
  322. package/components/{item-grid-D4xYhMOD.js → item-grid-BaW6EZ2a.js} +26 -24
  323. package/components/{item-grid-C2ZvM04g.cjs → item-grid-BcgBGxIq.cjs} +22 -22
  324. package/components/item-menu/item-list/item-list.d.ts +37 -0
  325. package/components/item-option/index.cjs +1 -1
  326. package/components/item-option/index.js +1 -8
  327. package/components/item-option-8PQMxg8v.cjs +269 -0
  328. package/components/item-option-action-button-group/index.cjs +1 -1
  329. package/components/item-option-action-button-group/index.js +1 -8
  330. package/components/{item-option-action-button-group-D_g6aoYd.js → item-option-action-button-group-BcZTtikv.js} +3 -2
  331. package/components/item-option-action-button-group-zZp49Gbz.cjs +53 -0
  332. package/components/item-option-base/item-option-base.d.ts +23 -0
  333. package/components/{item-option-base-CxQhI83u.js → item-option-base-DJ9FLqmu.js} +2 -2
  334. package/components/item-option-base-K2pn6CrX.cjs +56 -0
  335. package/components/item-option-color-palette-picker/index.cjs +1 -1
  336. package/components/item-option-color-palette-picker/index.js +1 -8
  337. package/components/item-option-color-palette-picker-B9JlHGA8.cjs +40 -0
  338. package/components/{item-option-color-palette-picker-CRDFqhWx.js → item-option-color-palette-picker-DJX3MxcT.js} +3 -2
  339. package/components/item-option-color-picker/index.cjs +1 -1
  340. package/components/item-option-color-picker/index.js +1 -8
  341. package/components/{item-option-color-picker-BlkpWjQh.js → item-option-color-picker-Dgz-VK03.js} +3 -2
  342. package/components/{item-option-color-picker-BJgpBbDp.cjs → item-option-color-picker-ayYko5QB.cjs} +2 -2
  343. package/components/item-option-color-range/index.cjs +1 -1
  344. package/components/item-option-color-range/index.js +1 -8
  345. package/components/item-option-color-range-Cc8thG33.cjs +98 -0
  346. package/components/{item-option-color-range-3Wp-Ywz6.js → item-option-color-range-DibSfro5.js} +3 -2
  347. package/components/{item-option-28BU_oaD.js → item-option-em2Lp2zJ.js} +54 -53
  348. package/components/item-option-guidelines/index.cjs +1 -1
  349. package/components/item-option-guidelines/index.js +1 -8
  350. package/components/{item-option-guidelines-CQ_yb7Ar.js → item-option-guidelines-DXUcdAel.js} +5 -3
  351. package/components/item-option-guidelines-h5-NrAYD.cjs +135 -0
  352. package/components/item-option-multi-language-field/index.cjs +1 -1
  353. package/components/item-option-multi-language-field/index.js +1 -8
  354. package/components/{item-option-multi-language-field-BApbe3pp.cjs → item-option-multi-language-field-BlnTZCFJ.cjs} +2 -2
  355. package/components/{item-option-multi-language-field-aLIpQWiQ.js → item-option-multi-language-field-Bqo9OeK4.js} +3 -2
  356. package/components/item-option-number-field/index.cjs +1 -1
  357. package/components/item-option-number-field/index.js +1 -8
  358. package/components/{item-option-number-field-Bv5eGoxB.js → item-option-number-field-BZHhCuuj.js} +3 -2
  359. package/components/{item-option-number-field-B72ZYOAX.cjs → item-option-number-field-D9vv1Q-O.cjs} +2 -2
  360. package/components/item-option-panel/index.cjs +1 -1
  361. package/components/item-option-panel/index.js +1 -8
  362. package/components/{item-option-panel-A8Jxzwml.cjs → item-option-panel-Bo3sC4u5.cjs} +2 -2
  363. package/components/{item-option-panel-kRH7GbzA.js → item-option-panel-DvgDiRPH.js} +5 -4
  364. package/components/item-option-picker/index.cjs +1 -1
  365. package/components/item-option-picker/index.js +1 -8
  366. package/components/{item-option-picker-DOFJ1CnI.cjs → item-option-picker-D5xhm36O.cjs} +2 -2
  367. package/components/{item-option-picker-BuUtW6gD.js → item-option-picker-cy0KK-ev.js} +3 -2
  368. package/components/item-option-position-picker/index.cjs +1 -1
  369. package/components/item-option-position-picker/index.js +1 -8
  370. package/components/item-option-position-picker-BJ35DWBL.cjs +32 -0
  371. package/components/{item-option-position-picker-mf3JQu5q.js → item-option-position-picker-BbYP1Jnh.js} +3 -2
  372. package/components/item-option-positions-number-field/index.cjs +1 -1
  373. package/components/item-option-positions-number-field/index.js +1 -8
  374. package/components/{item-option-positions-number-field-BIBWpagB.js → item-option-positions-number-field-DO4z_aKu.js} +3 -2
  375. package/components/item-option-positions-number-field-DzYQoSpk.cjs +49 -0
  376. package/components/item-option-radio-button-group/index.cjs +1 -1
  377. package/components/item-option-radio-button-group/index.js +1 -8
  378. package/components/{item-option-radio-button-group-B2HYZguB.cjs → item-option-radio-button-group-CF1gttvP.cjs} +2 -2
  379. package/components/{item-option-radio-button-group-CFnfadK2.js → item-option-radio-button-group-DX7wCv8J.js} +3 -2
  380. package/components/item-option-slider/index.cjs +1 -1
  381. package/components/item-option-slider/index.js +1 -8
  382. package/components/item-option-slider-DeGmGyZE.cjs +33 -0
  383. package/components/{item-option-slider-CH1l0Ena.js → item-option-slider-z1CwX5mE.js} +3 -2
  384. package/components/item-option-switch/index.cjs +1 -1
  385. package/components/item-option-switch/index.js +1 -8
  386. package/components/{item-option-switch-hUFRE9MC.cjs → item-option-switch-D3jq7jIt.cjs} +2 -2
  387. package/components/{item-option-switch-rqu2ePVU.js → item-option-switch-D41KguKr.js} +3 -2
  388. package/components/item-option-text-field/index.cjs +1 -1
  389. package/components/item-option-text-field/index.js +1 -8
  390. package/components/{item-option-text-field-CBFMmuK2.js → item-option-text-field-CnFcApMz.js} +3 -2
  391. package/components/{item-option-text-field-C6CocZ5q.cjs → item-option-text-field-cXy2sx5N.cjs} +2 -2
  392. package/components/item-options-configs.js +45 -45
  393. package/components/item-slot-drop/index.cjs +1 -1
  394. package/components/item-slot-drop/index.d.ts +2 -0
  395. package/components/item-slot-drop/index.js +1 -8
  396. package/components/item-slot-drop-CtEMLkmt.cjs +91 -0
  397. package/components/{item-slot-drop-DDGclwbP.js → item-slot-drop-YAKpKb2-.js} +27 -21
  398. package/components/item-slot-drop-panel/index.cjs +1 -1
  399. package/components/item-slot-drop-panel/index.js +1 -8
  400. package/components/{item-slot-drop-panel-Cj6vbgJl.js → item-slot-drop-panel-JZtBKPJu.js} +50 -48
  401. package/components/item-slot-drop-panel-aom0ugTz.cjs +57 -0
  402. package/components/item-slot-picker/index.cjs +1 -1
  403. package/components/item-slot-picker/index.js +1 -8
  404. package/components/{item-slot-picker-CjQH3MU-.js → item-slot-picker-D-FvHowO.js} +45 -39
  405. package/components/item-slot-picker-D8h7QXGD.cjs +174 -0
  406. package/components/item-slot-picker-panel/index.cjs +1 -1
  407. package/components/item-slot-picker-panel/index.js +1 -8
  408. package/components/item-slot-picker-panel-C98lpd4g.cjs +81 -0
  409. package/components/{item-slot-picker-panel-7IFk5QFC.js → item-slot-picker-panel-g4JDw1M_.js} +17 -15
  410. package/components/item-slots-configs.js +45 -45
  411. package/components/{line-chart-options.config-D8gRtfj3.js → line-chart-options.config-C3_RnROS.js} +1 -1
  412. package/components/{line-chart-positioning.config-DuXn1WD-.cjs → line-chart-positioning.config-BZUWqKWz.cjs} +1 -1
  413. package/components/{line-chart-positioning.config-D5WVvIZT.js → line-chart-positioning.config-C3VzNcws.js} +1 -1
  414. package/components/{line-chart-slots.config-C6LEwEwh.js → line-chart-slots.config-CA-I6B6o.js} +1 -1
  415. package/components/load-data-fields-for-datasets-B3XcFFfg.js +42 -0
  416. package/components/load-data-fields-for-datasets-rL24A68g.cjs +20 -0
  417. package/components/localized-mixin-DaLXe5J9.js +45 -0
  418. package/components/localized-mixin-DiUJOd06.cjs +20 -0
  419. package/components/{marker-map-options.config-BE8GnY_T.js → marker-map-options.config-OMdgbAc4.js} +1 -1
  420. package/components/{marker-map-positioning.config-D2L7cvCP.js → marker-map-positioning.config-BlvgG6yX.js} +1 -1
  421. package/components/{marker-map-positioning.config-DfN39a-Q.cjs → marker-map-positioning.config-CGF74mJI.cjs} +1 -1
  422. package/components/{marker-map-slots.config-Cyk-QFPT.js → marker-map-slots.config-CcGNgr1_.js} +1 -1
  423. package/components/{nl-h9vVAk2e.js → nl-BaZM3WoR.js} +34 -0
  424. package/components/nl-BoEhzeIh.cjs +20 -0
  425. package/components/{ohlc-chart-options.config-xgegn34C.js → ohlc-chart-options.config-CWRI5bXI.js} +1 -1
  426. package/components/{ohlc-chart-positioning.config-DsBuB0VU.cjs → ohlc-chart-positioning.config-B__cD7Wo.cjs} +1 -1
  427. package/components/{ohlc-chart-positioning.config-C53dCwaT.js → ohlc-chart-positioning.config-BdbEgiry.js} +1 -1
  428. package/components/{ohlc-chart-slots.config-CQFi8BIT.js → ohlc-chart-slots.config-Pv0xst-Y.js} +1 -1
  429. package/components/{parallel-coordinates-plot-options.config-BUQLHO1k.js → parallel-coordinates-plot-options.config-DbuNgevO.js} +1 -1
  430. package/components/{parallel-coordinates-plot-positioning.config-aiFzLnnh.cjs → parallel-coordinates-plot-positioning.config-BqdmUJLk.cjs} +1 -1
  431. package/components/{parallel-coordinates-plot-positioning.config-DhoVstsb.js → parallel-coordinates-plot-positioning.config-DNu5qhNR.js} +1 -1
  432. package/components/{parallel-coordinates-plot-slots.config-D5o-5y_j.js → parallel-coordinates-plot-slots.config-GvYC-RXK.js} +1 -1
  433. package/components/period-over-period-condition.const-BZ7j5Z5t.js +29 -0
  434. package/components/period-over-period-condition.const-C1NZ9Bkp.cjs +20 -0
  435. package/components/{pivot-table-options.config-DW9UDipI.js → pivot-table-options.config-CTz4bcGJ.js} +1 -1
  436. package/components/{pivot-table-positioning.config-Cnai84AH.js → pivot-table-positioning.config-CUfnXIHj.js} +1 -1
  437. package/components/{pivot-table-positioning.config-Bq9BoQWM.cjs → pivot-table-positioning.config-DDpgWCZ7.cjs} +1 -1
  438. package/components/{pivot-table-slots.config-Cl5z3IQo.js → pivot-table-slots.config-BAW0U3nh.js} +1 -1
  439. package/components/{pragmatic-element-adapter-C_7HSvGV.js → pragmatic-element-adapter-D0LRKx5U.js} +75 -74
  440. package/components/{pragmatic-element-adapter-DPWYJiW9.cjs → pragmatic-element-adapter-DdyH32ix.cjs} +4 -4
  441. package/components/{pyramid-chart-options.config-Cbg351Yy.js → pyramid-chart-options.config-C7btzuZj.js} +1 -1
  442. package/components/{pyramid-chart-positioning.config-D5AKNCPb.cjs → pyramid-chart-positioning.config-B2TxqefZ.cjs} +1 -1
  443. package/components/{pyramid-chart-positioning.config-BeJ5R_Ln.js → pyramid-chart-positioning.config-CZBcrHEG.js} +1 -1
  444. package/components/{pyramid-chart-slots.config-DNzq2hMx.js → pyramid-chart-slots.config-CsMMyhV3.js} +1 -1
  445. package/components/{radar-chart-options.config-DrNyOkHq.js → radar-chart-options.config-CtA6MpUp.js} +1 -1
  446. package/components/{radar-chart-positioning.config-BEIwrzhb.cjs → radar-chart-positioning.config-ddvHAHJF.cjs} +1 -1
  447. package/components/{radar-chart-positioning.config-DsfUBq4B.js → radar-chart-positioning.config-j1WOeFnM.js} +1 -1
  448. package/components/{radar-chart-slots.config-CXgfvAkt.js → radar-chart-slots.config-8Kf_WAFi.js} +1 -1
  449. package/components/{regular-table-options.config-CweBtAvm.js → regular-table-options.config-BRmS77t-.js} +1 -1
  450. package/components/{regular-table-slots.config-DCkw4Xkq.js → regular-table-slots.config-r-N9A-qA.js} +1 -1
  451. package/components/{route-map-options.config-DXHqb8Ve.js → route-map-options.config-C65J81_7.js} +1 -1
  452. package/components/{route-map-positioning.config-CuiRWzbs.js → route-map-positioning.config-ChBYybF1.js} +1 -1
  453. package/components/{route-map-positioning.config-4Wyvj5OH.cjs → route-map-positioning.config-xBhhxtYu.cjs} +1 -1
  454. package/components/{route-map-slots.config-DJ76FOsJ.js → route-map-slots.config-DMII2UuP.js} +1 -1
  455. package/components/{sankey-diagram-options.config-1lSECht4.js → sankey-diagram-options.config-nQDCRhKs.js} +1 -1
  456. package/components/{sankey-diagram-positioning.config-DtN7dARd.js → sankey-diagram-positioning.config-CudMit_S.js} +1 -1
  457. package/components/{sankey-diagram-positioning.config-CZ-zVCQo.cjs → sankey-diagram-positioning.config-tZu-dDV-.cjs} +1 -1
  458. package/components/{sankey-diagram-slots.config-BCc8P4j0.js → sankey-diagram-slots.config-DmWIGut0.js} +1 -1
  459. package/components/{scatter-plot-options.config-9zL4v24E.js → scatter-plot-options.config-BplrME7w.js} +1 -1
  460. package/components/{scatter-plot-positioning.config-BXrzdLIc.js → scatter-plot-positioning.config-BoJEGmgK.js} +1 -1
  461. package/components/{scatter-plot-positioning.config-CfAf_FUW.cjs → scatter-plot-positioning.config-DQOtIhJi.cjs} +1 -1
  462. package/components/{scatter-plot-slots.config-BMTdhTZG.js → scatter-plot-slots.config-B7wQVEEj.js} +1 -1
  463. package/components/{search-filter-options.config-B_qQjr68.js → search-filter-options.config-yAz6IIto.js} +1 -1
  464. package/components/{search-filter-slots.config-qCILSYzs.js → search-filter-slots.config-D8-V0BT5.js} +1 -1
  465. package/components/{set-locale-B-GvqA1H.cjs → set-locale-Xh_1AFbC.cjs} +1 -1
  466. package/components/{set-locale-CgCeLPlb.js → set-locale-ydAPif-7.js} +4 -4
  467. package/components/{slicer-filter-options.config-DK62SCMp.js → slicer-filter-options.config-BtGkT2hI.js} +1 -1
  468. package/components/{slicer-filter-positioning.config-BLGeCJys.js → slicer-filter-positioning.config-CY4jw7_A.js} +1 -1
  469. package/components/{slicer-filter-positioning.config-CU86hJi6.cjs → slicer-filter-positioning.config-CZY2fvwt.cjs} +1 -1
  470. package/components/{slicer-filter-slots.config-C9_NdJm4.js → slicer-filter-slots.config-DR0Wg_Zr.js} +1 -1
  471. package/components/{slider-filter-options.config-CP5bXdih.js → slider-filter-options.config-D_yZ_nFz.js} +1 -1
  472. package/components/{slider-filter-slots.config-15eAAGVn.js → slider-filter-slots.config-BUHw-32u.js} +1 -1
  473. package/components/slot-menu/index.cjs +20 -0
  474. package/components/slot-menu/index.d.ts +10 -0
  475. package/components/slot-menu/index.js +21 -0
  476. package/components/slot-menu/slot-menu.d.ts +148 -0
  477. package/components/slot-menu/types.d.ts +24 -0
  478. package/components/slot-menu-Bl6PrLIN.cjs +71 -0
  479. package/components/slot-menu-hIK2_qR3.js +429 -0
  480. package/components/slot-menu-list/index.cjs +20 -0
  481. package/components/slot-menu-list/index.d.ts +8 -0
  482. package/components/slot-menu-list/index.js +21 -0
  483. package/components/slot-menu-list/slot-menu-list.d.ts +47 -0
  484. package/components/slot-menu-list-BgwZS32Q.js +348 -0
  485. package/components/slot-menu-list-BhgD2zt4.cjs +44 -0
  486. package/components/slot-role-classification-2wChhpcq.cjs +20 -0
  487. package/components/slot-role-classification-B8bkGhQ_.js +133 -0
  488. package/components/slots-config-Cd4xAG4H.cjs +20 -0
  489. package/components/slots-config-GlSNH7Gr.js +76 -0
  490. package/components/{speedometer-chart-options.config-dsUupCqm.js → speedometer-chart-options.config-BL7evgzP.js} +1 -1
  491. package/components/{speedometer-chart-positioning.config-AeMlNxSj.cjs → speedometer-chart-positioning.config-D3CWnYTb.cjs} +1 -1
  492. package/components/{speedometer-chart-positioning.config-Dam0wOqp.js → speedometer-chart-positioning.config-cBMverSU.js} +1 -1
  493. package/components/{speedometer-chart-slots.config-DfTw7JTF.js → speedometer-chart-slots.config-2Y_x52Gy.js} +1 -1
  494. package/components/{spike-map-options.config-Dh4Ky5ZP.js → spike-map-options.config-DjoTrAsC.js} +1 -1
  495. package/components/{spike-map-positioning.config-9ShV1fUh.cjs → spike-map-positioning.config-i7ntIkN5.cjs} +1 -1
  496. package/components/{spike-map-positioning.config-BVzewpfi.js → spike-map-positioning.config-vuoKutnj.js} +1 -1
  497. package/components/{spike-map-slots.config-i-c0F9QM.js → spike-map-slots.config-DJWMFPIR.js} +1 -1
  498. package/components/{strip-plot-options.config-Vw3GoLef.js → strip-plot-options.config-tDmVlu9U.js} +1 -1
  499. package/components/{strip-plot-positioning.config-BVBdHZvL.cjs → strip-plot-positioning.config-C2H-io7l.cjs} +1 -1
  500. package/components/{strip-plot-positioning.config-OHm3LEo3.js → strip-plot-positioning.config-_-ElbWoV.js} +1 -1
  501. package/components/{strip-plot-slots.config-BuF7X3xN.js → strip-plot-slots.config-suFyIf5-.js} +1 -1
  502. package/components/{sunburst-chart-options.config-CXOrVmIe.js → sunburst-chart-options.config-Bjue_lQN.js} +1 -1
  503. package/components/{sunburst-chart-positioning.config-DQmuKm-N.cjs → sunburst-chart-positioning.config-MB8z_ZfG.cjs} +1 -1
  504. package/components/{sunburst-chart-positioning.config-BynNbbxB.js → sunburst-chart-positioning.config-yzTnv1BQ.js} +1 -1
  505. package/components/{sunburst-chart-slots.config-Cq-E6kyI.js → sunburst-chart-slots.config-BqVT-h0Z.js} +1 -1
  506. package/components/{symbol-map-options.config-Dultd0tF.js → symbol-map-options.config-Dyeya5Z2.js} +1 -1
  507. package/components/{symbol-map-positioning.config-bQk_pdAr.js → symbol-map-positioning.config-BPkEp4Pj.js} +1 -1
  508. package/components/{symbol-map-positioning.config-D6rgxXTO.cjs → symbol-map-positioning.config-L11e_Z3x.cjs} +1 -1
  509. package/components/{symbol-map-slots.config-BfdBHkzN.js → symbol-map-slots.config-Rhpher5o.js} +1 -1
  510. package/components/{text-options.config-BUiRyi3L.js → text-options.config-CXhvzzPF.js} +1 -1
  511. package/components/{text-slots.config-CM_ZaW3p.js → text-slots.config-Dzj4-x2G.js} +1 -1
  512. package/components/tokens-BWMfo_w4.cjs +20 -0
  513. package/components/tokens-Ov1pCR4Y.js +29 -0
  514. package/components/{treemap-chart-options.config-6l3HzikF.js → treemap-chart-options.config-BzOCEWog.js} +1 -1
  515. package/components/{treemap-chart-positioning.config-ZaoIngRn.cjs → treemap-chart-positioning.config-40_GcY2u.cjs} +1 -1
  516. package/components/{treemap-chart-positioning.config-BB1-rZKL.js → treemap-chart-positioning.config-CitiBQB2.js} +1 -1
  517. package/components/{treemap-chart-slots.config-CHkGtIOa.js → treemap-chart-slots.config-DRcafVU-.js} +1 -1
  518. package/components/utils/base.cjs +1 -1
  519. package/components/utils/base.js +2 -2
  520. package/components/utils/store.js +1 -1
  521. package/components/utils-SzKvwZ9-.cjs +20 -0
  522. package/components/{utils-ZoJ1cp2P.js → utils-_8LPCz9-.js} +54 -53
  523. package/components/utils.cjs +1 -1
  524. package/components/utils.js +9 -6
  525. package/components/{venn-diagram-options.config-Wi0dQsAu.js → venn-diagram-options.config-BMlduwIp.js} +1 -1
  526. package/components/{venn-diagram-positioning.config-C9ARqREi.js → venn-diagram-positioning.config-A28suR_R.js} +1 -1
  527. package/components/{venn-diagram-positioning.config-Cb10sStL.cjs → venn-diagram-positioning.config-C7bkb2Qv.cjs} +1 -1
  528. package/components/{venn-diagram-slots.config-DY04aeYK.js → venn-diagram-slots.config-CMDndPVi.js} +1 -1
  529. package/components/{video-options.config-B6pQUPB7.js → video-options.config-DdfSTJEJ.js} +1 -1
  530. package/components/{video-slots.config-C-kXGzo3.js → video-slots.config-Utnn0DBW.js} +1 -1
  531. package/components/viz-item-menu/index.cjs +20 -0
  532. package/components/viz-item-menu/index.d.ts +8 -0
  533. package/components/viz-item-menu/index.js +21 -0
  534. package/components/viz-item-menu/types.d.ts +9 -0
  535. package/components/viz-item-menu/viz-item-menu.d.ts +85 -0
  536. package/components/viz-item-menu-DsIJZRgm.js +203 -0
  537. package/components/viz-item-menu-DtHlgOqt.cjs +63 -0
  538. package/components/{wordcloud-chart-options.config-CpMtpG7q.js → wordcloud-chart-options.config-y9Z5I_ZN.js} +1 -1
  539. package/components/{wordcloud-chart-positioning.config-DC89_DYc.cjs → wordcloud-chart-positioning.config-BQFzFNko.cjs} +1 -1
  540. package/components/{wordcloud-chart-positioning.config-D59ntNtd.js → wordcloud-chart-positioning.config-Dk13J1zq.js} +1 -1
  541. package/components/{wordcloud-chart-slots.config-Cc5F92Tv.js → wordcloud-chart-slots.config-CvabtgbP.js} +1 -1
  542. package/custom-elements.json +18790 -6833
  543. package/deprecated-react/components/ai-chat.component.cjs +1 -0
  544. package/deprecated-react/components/ai-interaction-textarea.component.cjs +1 -0
  545. package/deprecated-react/components/data-field-level.component.cjs +1 -0
  546. package/deprecated-react/components/data-fields-select.component.cjs +1 -0
  547. package/deprecated-react/components/dataset-icon.component.cjs +1 -0
  548. package/deprecated-react/components/dataset-selector-list.component.cjs +1 -0
  549. package/deprecated-react/components/dataset-selector-row.component.cjs +1 -0
  550. package/deprecated-react/components/display-settings-binning.component.cjs +1 -0
  551. package/deprecated-react/components/display-settings-datetime.component.cjs +1 -0
  552. package/deprecated-react/components/display-settings-grand-totals.component.cjs +1 -0
  553. package/deprecated-react/components/display-settings-numeric.component.cjs +1 -0
  554. package/deprecated-react/components/display-settings-period-over-period.component.cjs +1 -0
  555. package/deprecated-react/components/display-settings.component.cjs +1 -0
  556. package/deprecated-react/components/filter-expression-picker.component.cjs +1 -0
  557. package/deprecated-react/components/filter-item.component.cjs +1 -0
  558. package/deprecated-react/components/filter-parameter-picker.component.cjs +1 -0
  559. package/deprecated-react/components/filter-value-picker-datetime.component.cjs +1 -0
  560. package/deprecated-react/components/filter-value-picker-hierarchy.component.cjs +1 -0
  561. package/deprecated-react/components/filter-value-picker-numeric.component.cjs +1 -0
  562. package/deprecated-react/components/filter-value-picker.component.cjs +1 -0
  563. package/deprecated-react/components/formula-field.component.cjs +1 -0
  564. package/deprecated-react/components/interactive-viz-item.component.cjs +1 -0
  565. package/deprecated-react/components/slot-menu-list.component.cjs +1 -0
  566. package/deprecated-react/components/slot-menu.component.cjs +1 -0
  567. package/deprecated-react/components/viz-item-menu.component.cjs +1 -0
  568. package/index.d.ts +25 -0
  569. package/package.json +127 -2
  570. package/react/components/ai-chat.component.ts +45 -0
  571. package/react/components/ai-interaction-textarea.component.ts +30 -0
  572. package/react/components/data-field-level.component.ts +30 -0
  573. package/react/components/data-fields-select.component.ts +27 -0
  574. package/react/components/dataset-icon.component.ts +22 -0
  575. package/react/components/dataset-selector-list.component.ts +27 -0
  576. package/react/components/dataset-selector-row.component.ts +36 -0
  577. package/react/components/display-settings-binning.component.ts +27 -0
  578. package/react/components/display-settings-datetime.component.ts +27 -0
  579. package/react/components/display-settings-grand-totals.component.ts +27 -0
  580. package/react/components/display-settings-numeric.component.ts +27 -0
  581. package/react/components/display-settings-period-over-period.component.ts +27 -0
  582. package/react/components/display-settings.component.ts +33 -0
  583. package/react/components/filter-expression-picker.component.ts +27 -0
  584. package/react/components/filter-item.component.ts +27 -0
  585. package/react/components/filter-parameter-picker.component.ts +33 -0
  586. package/react/components/filter-value-picker-datetime.component.ts +27 -0
  587. package/react/components/filter-value-picker-hierarchy.component.ts +27 -0
  588. package/react/components/filter-value-picker-numeric.component.ts +27 -0
  589. package/react/components/filter-value-picker.component.ts +27 -0
  590. package/react/components/filters.component.ts +1 -1
  591. package/react/components/formula-field.component.ts +30 -0
  592. package/react/components/interactive-viz-item.component.ts +33 -0
  593. package/react/components/slot-menu-list.component.ts +27 -0
  594. package/react/components/slot-menu.component.ts +42 -0
  595. package/react/components/viz-item-menu.component.ts +33 -0
  596. package/react/esm/components/ai-chat.component.d.ts +24 -0
  597. package/react/esm/components/ai-chat.component.js +29 -0
  598. package/react/esm/components/ai-interaction-textarea.component.d.ts +14 -0
  599. package/react/esm/components/ai-interaction-textarea.component.js +19 -0
  600. package/react/esm/components/data-field-level.component.d.ts +14 -0
  601. package/react/esm/components/data-field-level.component.js +19 -0
  602. package/react/esm/components/data-fields-select.component.d.ts +12 -0
  603. package/react/esm/components/data-fields-select.component.js +17 -0
  604. package/react/esm/components/dataset-icon.component.d.ts +8 -0
  605. package/react/esm/components/dataset-icon.component.js +13 -0
  606. package/react/esm/components/dataset-selector-list.component.d.ts +12 -0
  607. package/react/esm/components/dataset-selector-list.component.js +17 -0
  608. package/react/esm/components/dataset-selector-row.component.d.ts +18 -0
  609. package/react/esm/components/dataset-selector-row.component.js +23 -0
  610. package/react/esm/components/display-settings-binning.component.d.ts +12 -0
  611. package/react/esm/components/display-settings-binning.component.js +17 -0
  612. package/react/esm/components/display-settings-datetime.component.d.ts +12 -0
  613. package/react/esm/components/display-settings-datetime.component.js +17 -0
  614. package/react/esm/components/display-settings-grand-totals.component.d.ts +12 -0
  615. package/react/esm/components/display-settings-grand-totals.component.js +17 -0
  616. package/react/esm/components/display-settings-numeric.component.d.ts +12 -0
  617. package/react/esm/components/display-settings-numeric.component.js +17 -0
  618. package/react/esm/components/display-settings-period-over-period.component.d.ts +12 -0
  619. package/react/esm/components/display-settings-period-over-period.component.js +17 -0
  620. package/react/esm/components/display-settings.component.d.ts +16 -0
  621. package/react/esm/components/display-settings.component.js +21 -0
  622. package/react/esm/components/filter-expression-picker.component.d.ts +12 -0
  623. package/react/esm/components/filter-expression-picker.component.js +17 -0
  624. package/react/esm/components/filter-item.component.d.ts +12 -0
  625. package/react/esm/components/filter-item.component.js +17 -0
  626. package/react/esm/components/filter-parameter-picker.component.d.ts +16 -0
  627. package/react/esm/components/filter-parameter-picker.component.js +21 -0
  628. package/react/esm/components/filter-value-picker-datetime.component.d.ts +12 -0
  629. package/react/esm/components/filter-value-picker-datetime.component.js +17 -0
  630. package/react/esm/components/filter-value-picker-hierarchy.component.d.ts +12 -0
  631. package/react/esm/components/filter-value-picker-hierarchy.component.js +17 -0
  632. package/react/esm/components/filter-value-picker-numeric.component.d.ts +12 -0
  633. package/react/esm/components/filter-value-picker-numeric.component.js +17 -0
  634. package/react/esm/components/filter-value-picker.component.d.ts +12 -0
  635. package/react/esm/components/filter-value-picker.component.js +17 -0
  636. package/react/esm/components/filters.component.d.ts +1 -1
  637. package/react/esm/components/filters.component.js +1 -1
  638. package/react/esm/components/formula-field.component.d.ts +14 -0
  639. package/react/esm/components/formula-field.component.js +19 -0
  640. package/react/esm/components/interactive-viz-item.component.d.ts +16 -0
  641. package/react/esm/components/interactive-viz-item.component.js +21 -0
  642. package/react/esm/components/slot-menu-list.component.d.ts +12 -0
  643. package/react/esm/components/slot-menu-list.component.js +17 -0
  644. package/react/esm/components/slot-menu.component.d.ts +22 -0
  645. package/react/esm/components/slot-menu.component.js +27 -0
  646. package/react/esm/components/viz-item-menu.component.d.ts +16 -0
  647. package/react/esm/components/viz-item-menu.component.js +21 -0
  648. package/react/esm/index.d.ts +27 -2
  649. package/react/esm/index.js +102 -2
  650. package/react/index.ts +102 -2
  651. package/react/luzmo-stub.d.ts +140 -0
  652. package/react/package.json +2 -2
  653. package/storybook/register-components.d.ts +57 -0
  654. package/styles/tokens.d.ts +1 -0
  655. package/types/agent.types.d.ts +4 -0
  656. package/types/ai-chat.types.d.ts +104 -0
  657. package/types/data-field-events.types.d.ts +7 -0
  658. package/types.d.ts +9 -0
  659. package/utils/create-lazy-loader.d.ts +5 -0
  660. package/utils/filters/filter-text.d.ts +64 -0
  661. package/utils/filters/index.d.ts +1 -0
  662. package/utils/filters/presentation.d.ts +4 -0
  663. package/utils/filters/tests/filter-text.test.d.ts +1 -0
  664. package/utils/formatter/localized-template.d.ts +4 -0
  665. package/utils/formatter/tests/localized-template.test.d.ts +1 -0
  666. package/utils/tests/create-lazy-loader.test.d.ts +1 -0
  667. package/components/base-BtRS5vm6.cjs +0 -20
  668. package/components/data-field-fvlYzmfX.cjs +0 -89
  669. package/components/data-field-panel-Yrqn4L79.cjs +0 -87
  670. package/components/data-fields-select-Cor6sfzL.cjs +0 -41
  671. package/components/de-CdZnQbKI.cjs +0 -20
  672. package/components/display-settings-grand-totals-BZ0nlLhu.cjs +0 -44
  673. package/components/display-settings-numeric-DoScgfRy.cjs +0 -190
  674. package/components/display-settings-period-over-period-C-hp0ZKN.cjs +0 -227
  675. package/components/es-7RD7O4q3.cjs +0 -20
  676. package/components/filters-DndJU6D5.js +0 -2454
  677. package/components/filters-oB9qOk_M.cjs +0 -443
  678. package/components/formula-codemirror-ucFOD-2a.cjs +0 -215
  679. package/components/formula-display-store-DmT65fUB.cjs +0 -20
  680. package/components/formula-editor-BeZ-fu-7.cjs +0 -253
  681. package/components/fr-CGw2IwXh.cjs +0 -20
  682. package/components/item-option-BQpS6rM_.cjs +0 -269
  683. package/components/item-option-action-button-group-BwBxRLzB.cjs +0 -53
  684. package/components/item-option-base-C6uwowJD.cjs +0 -56
  685. package/components/item-option-color-palette-picker-BjHadiN0.cjs +0 -40
  686. package/components/item-option-color-range-CQo8uThO.cjs +0 -98
  687. package/components/item-option-guidelines-Daf8Ce5z.cjs +0 -135
  688. package/components/item-option-position-picker-Cnis4wLA.cjs +0 -32
  689. package/components/item-option-positions-number-field-B7gI1IKO.cjs +0 -49
  690. package/components/item-option-slider--7hmhi97.cjs +0 -33
  691. package/components/item-slot-drop-hK-rLhwa.cjs +0 -91
  692. package/components/item-slot-drop-panel-CE4f9X6F.cjs +0 -57
  693. package/components/item-slot-picker-Wf50lM5u.cjs +0 -174
  694. package/components/item-slot-picker-panel-Csn1tabr.cjs +0 -81
  695. package/components/load-data-fields-for-datasets-B76UR0sG.js +0 -86
  696. package/components/load-data-fields-for-datasets-DFYeACsu.cjs +0 -20
  697. package/components/localized-mixin-DfpurTYo.cjs +0 -20
  698. package/components/nl-BnzS_ZtB.cjs +0 -20
  699. package/components/period-over-period-condition.const-DDgiXIfR.cjs +0 -20
  700. package/components/slot-menu-1zlmyLVl.js +0 -1060
  701. package/components/slot-menu-BSu8wKLi.cjs +0 -217
  702. package/components/utils-CPIzW8sp.cjs +0 -20
@@ -0,0 +1,4351 @@
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 "./tokens-Ov1pCR4Y.js";
21
+ import { c as e, d as t, s as n, u as r } from "./ai-interaction-textarea-i9SabsmQ.js";
22
+ import { i } from "./base-BRTs2KqJ.js";
23
+ import { t as a } from "./decorate-DyMgX_Uh.js";
24
+ import { msg as o } from "@lit/localize/lit-localize";
25
+ import { luzmoEllipsisVertical as s, luzmoIcon as c, luzmoSpin as l } from "@luzmo/icons";
26
+ import "@luzmo/lucero/button";
27
+ import "@luzmo/lucero/chat-message";
28
+ import "@luzmo/lucero/icon";
29
+ import "@luzmo/lucero/overlay";
30
+ import "@luzmo/lucero/popover";
31
+ import "@luzmo/lucero/progress-steps";
32
+ import { html as u, nothing as d, unsafeCSS as f } from "lit";
33
+ import { property as p, state as m } from "lit/decorators.js";
34
+ import { unsafeHTML as ee } from "lit/directives/unsafe-html.js";
35
+ import "@luzmo/lucero/action-button";
36
+ import "@luzmo/lucero/question-box";
37
+ import { guard as h } from "lit/directives/guard.js";
38
+ import { keyed as te } from "lit/directives/keyed.js";
39
+ //#region node_modules/dompurify/dist/purify.es.mjs
40
+ function ne(e, t) {
41
+ this.v = e, this.k = t;
42
+ }
43
+ function re(e, t) {
44
+ (t == null || t > e.length) && (t = e.length);
45
+ for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
46
+ return r;
47
+ }
48
+ function ie(e) {
49
+ if (Array.isArray(e)) return e;
50
+ }
51
+ function ae(e, t) {
52
+ var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
53
+ if (n != null) {
54
+ var r, i, a, o, s = [], c = !0, l = !1;
55
+ try {
56
+ if (a = (n = n.call(e)).next, t === 0) {
57
+ if (Object(n) !== n) return;
58
+ c = !1;
59
+ } else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
60
+ } catch (e) {
61
+ l = !0, i = e;
62
+ } finally {
63
+ try {
64
+ if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
65
+ } finally {
66
+ if (l) throw i;
67
+ }
68
+ }
69
+ return s;
70
+ }
71
+ }
72
+ function oe() {
73
+ throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
74
+ }
75
+ function se(e, t) {
76
+ return ie(e) || ae(e, t) || ce(e, t) || oe();
77
+ }
78
+ function ce(e, t) {
79
+ if (e) {
80
+ if (typeof e == "string") return re(e, t);
81
+ var n = {}.toString.call(e).slice(8, -1);
82
+ return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? re(e, t) : void 0;
83
+ }
84
+ }
85
+ function g(e) {
86
+ var t, n;
87
+ function r(t, n) {
88
+ try {
89
+ var a = e[t](n), o = a.value, s = o instanceof ne;
90
+ Promise.resolve(s ? o.v : o).then(function(n) {
91
+ if (s) {
92
+ var c = t === "return" && o.k ? t : "next";
93
+ if (!o.k || n.done) return r(c, n);
94
+ n = e[c](n).value;
95
+ }
96
+ i(!!a.done, n);
97
+ }, function(e) {
98
+ r("throw", e);
99
+ });
100
+ } catch (e) {
101
+ i(2, e);
102
+ }
103
+ }
104
+ function i(e, i) {
105
+ e === 2 ? t.reject(i) : t.resolve({
106
+ value: i,
107
+ done: e
108
+ }), (t = t.next) ? r(t.key, t.arg) : n = null;
109
+ }
110
+ this._invoke = function(e, i) {
111
+ return new Promise(function(a, o) {
112
+ var s = {
113
+ key: e,
114
+ arg: i,
115
+ resolve: a,
116
+ reject: o,
117
+ next: null
118
+ };
119
+ n ? n = n.next = s : (t = n = s, r(e, i));
120
+ });
121
+ }, typeof e.return != "function" && (this.return = void 0);
122
+ }
123
+ g.prototype[typeof Symbol == "function" && Symbol.asyncIterator || "@@asyncIterator"] = function() {
124
+ return this;
125
+ }, g.prototype.next = function(e) {
126
+ return this._invoke("next", e);
127
+ }, g.prototype.throw = function(e) {
128
+ return this._invoke("throw", e);
129
+ }, g.prototype.return = function(e) {
130
+ return this._invoke("return", e);
131
+ };
132
+ var le = Object.entries, _ = Object.setPrototypeOf, ue = Object.isFrozen, de = Object.getPrototypeOf, fe = Object.getOwnPropertyDescriptor, v = Object.freeze, y = Object.seal, pe = Object.create, me = typeof Reflect < "u" && Reflect, he = me.apply, ge = me.construct;
133
+ v ||= function(e) {
134
+ return e;
135
+ }, y ||= function(e) {
136
+ return e;
137
+ }, he ||= function(e, t) {
138
+ var n = [...arguments].slice(2);
139
+ return e.apply(t, n);
140
+ }, ge ||= function(e) {
141
+ return new e(...[...arguments].slice(1));
142
+ };
143
+ var _e = C(Array.prototype.forEach);
144
+ Array.prototype.indexOf;
145
+ var ve = C(Array.prototype.lastIndexOf), ye = C(Array.prototype.pop), be = C(Array.prototype.push);
146
+ Array.prototype.slice;
147
+ var xe = C(Array.prototype.splice), Se = Array.isArray, Ce = C(String.prototype.toLowerCase), we = C(String.prototype.toString), Te = C(String.prototype.match), Ee = C(String.prototype.replace), De = C(String.prototype.indexOf), Oe = C(String.prototype.trim), ke = C(Number.prototype.toString), Ae = C(Boolean.prototype.toString), je = typeof BigInt > "u" ? null : C(BigInt.prototype.toString), Me = typeof Symbol > "u" ? null : C(Symbol.prototype.toString), b = C(Object.prototype.hasOwnProperty), Ne = C(Object.prototype.toString), x = C(RegExp.prototype.test), S = Pe(TypeError);
148
+ function C(e) {
149
+ return function(t) {
150
+ t instanceof RegExp && (t.lastIndex = 0);
151
+ var n = [...arguments].slice(1);
152
+ return he(e, t, n);
153
+ };
154
+ }
155
+ function Pe(e) {
156
+ return function() {
157
+ return ge(e, [...arguments]);
158
+ };
159
+ }
160
+ function w(e, t) {
161
+ let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ce;
162
+ if (_ && _(e, null), !Se(t)) return e;
163
+ let r = t.length;
164
+ for (; r--;) {
165
+ let i = t[r];
166
+ if (typeof i == "string") {
167
+ let e = n(i);
168
+ e !== i && (ue(t) || (t[r] = e), i = e);
169
+ }
170
+ e[i] = !0;
171
+ }
172
+ return e;
173
+ }
174
+ function T(e) {
175
+ for (let t = 0; t < e.length; t++) b(e, t) || (e[t] = null);
176
+ return e;
177
+ }
178
+ function E(e) {
179
+ let t = pe(null);
180
+ for (let r of le(e)) {
181
+ var n = se(r, 2);
182
+ let i = n[0], a = n[1];
183
+ b(e, i) && (Se(a) ? t[i] = T(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = E(a) : t[i] = a);
184
+ }
185
+ return t;
186
+ }
187
+ function Fe(e) {
188
+ switch (typeof e) {
189
+ case "string": return e;
190
+ case "number": return ke(e);
191
+ case "boolean": return Ae(e);
192
+ case "bigint": return je ? je(e) : "0";
193
+ case "symbol": return Me ? Me(e) : "Symbol()";
194
+ case "undefined": return Ne(e);
195
+ case "function":
196
+ case "object": {
197
+ if (e === null) return Ne(e);
198
+ let t = e, n = D(t, "toString");
199
+ if (typeof n == "function") {
200
+ let e = n(t);
201
+ return typeof e == "string" ? e : Ne(e);
202
+ }
203
+ return Ne(e);
204
+ }
205
+ default: return Ne(e);
206
+ }
207
+ }
208
+ function D(e, t) {
209
+ for (; e !== null;) {
210
+ let n = fe(e, t);
211
+ if (n) {
212
+ if (n.get) return C(n.get);
213
+ if (typeof n.value == "function") return C(n.value);
214
+ }
215
+ e = de(e);
216
+ }
217
+ function n() {
218
+ return null;
219
+ }
220
+ return n;
221
+ }
222
+ function Ie(e) {
223
+ try {
224
+ return x(e, ""), !0;
225
+ } catch {
226
+ return !1;
227
+ }
228
+ }
229
+ var Le = v(/* @__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(".")), Re = v(/* @__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(".")), ze = v([
230
+ "feBlend",
231
+ "feColorMatrix",
232
+ "feComponentTransfer",
233
+ "feComposite",
234
+ "feConvolveMatrix",
235
+ "feDiffuseLighting",
236
+ "feDisplacementMap",
237
+ "feDistantLight",
238
+ "feDropShadow",
239
+ "feFlood",
240
+ "feFuncA",
241
+ "feFuncB",
242
+ "feFuncG",
243
+ "feFuncR",
244
+ "feGaussianBlur",
245
+ "feImage",
246
+ "feMerge",
247
+ "feMergeNode",
248
+ "feMorphology",
249
+ "feOffset",
250
+ "fePointLight",
251
+ "feSpecularLighting",
252
+ "feSpotLight",
253
+ "feTile",
254
+ "feTurbulence"
255
+ ]), Be = v([
256
+ "animate",
257
+ "color-profile",
258
+ "cursor",
259
+ "discard",
260
+ "font-face",
261
+ "font-face-format",
262
+ "font-face-name",
263
+ "font-face-src",
264
+ "font-face-uri",
265
+ "foreignobject",
266
+ "hatch",
267
+ "hatchpath",
268
+ "mesh",
269
+ "meshgradient",
270
+ "meshpatch",
271
+ "meshrow",
272
+ "missing-glyph",
273
+ "script",
274
+ "set",
275
+ "solidcolor",
276
+ "unknown",
277
+ "use"
278
+ ]), Ve = v(/* @__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(".")), He = v([
279
+ "maction",
280
+ "maligngroup",
281
+ "malignmark",
282
+ "mlongdiv",
283
+ "mscarries",
284
+ "mscarry",
285
+ "msgroup",
286
+ "mstack",
287
+ "msline",
288
+ "msrow",
289
+ "semantics",
290
+ "annotation",
291
+ "annotation-xml",
292
+ "mprescripts",
293
+ "none"
294
+ ]), Ue = v(["#text"]), We = v(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.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".split(".")), Ge = v(/* @__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.dominant-baseline.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.pointer-events.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-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.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(".")), Ke = v(/* @__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(".")), qe = v([
295
+ "xlink:href",
296
+ "xml:id",
297
+ "xlink:title",
298
+ "xml:space",
299
+ "xmlns:xlink"
300
+ ]), Je = y(/{{[\w\W]*|^[\w\W]*}}/g), Ye = y(/<%[\w\W]*|^[\w\W]*%>/g), Xe = y(/\${[\w\W]*/g), Ze = y(/^data-[\-\w.\u00B7-\uFFFF]+$/), Qe = y(/^aria-[\-\w]+$/), $e = y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), et = y(/^(?:\w+script|data):/i), tt = y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), nt = y(/^html$/i), rt = y(/^[a-z][.\w]*(-[.\w]+)+$/i), it = y(/<[/\w!]/g), at = y(/<[/\w]/g), ot = y(/<\/no(script|embed|frames)/i), st = y(/\/>/i), O = {
301
+ element: 1,
302
+ attribute: 2,
303
+ text: 3,
304
+ cdataSection: 4,
305
+ entityReference: 5,
306
+ entityNode: 6,
307
+ processingInstruction: 7,
308
+ comment: 8,
309
+ document: 9,
310
+ documentType: 10,
311
+ documentFragment: 11,
312
+ notation: 12
313
+ }, ct = [
314
+ "style",
315
+ "script",
316
+ "xmp",
317
+ "iframe",
318
+ "noembed",
319
+ "noframes",
320
+ "plaintext",
321
+ "noscript"
322
+ ], lt = v(w({}, ct)), ut = function() {
323
+ let e = {};
324
+ return _e(ct, (t) => {
325
+ e[t] = y(RegExp("</" + t + "(?=[\\t\\n\\f\\r />])", "i"));
326
+ }), v(e);
327
+ }(), dt = function() {
328
+ return typeof window > "u" ? null : window;
329
+ }, ft = function(e, t) {
330
+ if (typeof e != "object" || typeof e.createPolicy != "function") return null;
331
+ let n = null, r = "data-tt-policy-suffix";
332
+ t && t.hasAttribute(r) && (n = t.getAttribute(r));
333
+ let i = "dompurify" + (n ? "#" + n : "");
334
+ try {
335
+ return e.createPolicy(i, {
336
+ createHTML(e) {
337
+ return e;
338
+ },
339
+ createScriptURL(e) {
340
+ return e;
341
+ }
342
+ });
343
+ } catch {
344
+ return console.warn("TrustedTypes policy " + i + " could not be created."), null;
345
+ }
346
+ }, pt = function() {
347
+ return {
348
+ afterSanitizeAttributes: [],
349
+ afterSanitizeElements: [],
350
+ afterSanitizeShadowDOM: [],
351
+ beforeSanitizeAttributes: [],
352
+ beforeSanitizeElements: [],
353
+ beforeSanitizeShadowDOM: [],
354
+ uponSanitizeAttribute: [],
355
+ uponSanitizeElement: [],
356
+ uponSanitizeShadowNode: []
357
+ };
358
+ }, mt = function(e, t, n, r) {
359
+ return b(e, t) && Se(e[t]) ? w(r.base ? E(r.base) : {}, e[t], r.transform) : n;
360
+ }, ht = function(e, t, n) {
361
+ let r = b(e, t) ? e[t] : void 0;
362
+ return r && typeof r == "object" ? E(r) : n();
363
+ };
364
+ function gt() {
365
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : dt(), t = (e) => gt(e);
366
+ if (t.version = "3.4.16", t.removed = [], !e || !e.document || e.document.nodeType !== O.document || !e.Element) return t.isSupported = !1, t;
367
+ let n = e.document, r = n, i = r.currentScript;
368
+ e.DocumentFragment;
369
+ let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
370
+ e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
371
+ let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = D(d, "cloneNode"), p = D(d, "remove"), m = D(d, "removeAttributeNode"), ee = D(d, "nextSibling"), h = D(d, "childNodes"), te = D(d, "parentNode"), ne = D(d, "shadowRoot"), re = D(d, "attributes"), ie = o && o.prototype ? D(o.prototype, "nodeType") : null, ae = o && o.prototype ? D(o.prototype, "nodeName") : null, oe = o && o.prototype ? D(o.prototype, "ownerDocument") : null, se = function(e) {
372
+ return ie ? ie(e) : e.nodeType;
373
+ }, ce = function(e) {
374
+ return ae ? ae(e) : e.nodeName;
375
+ };
376
+ if (typeof a == "function") {
377
+ let e = n.createElement("template");
378
+ e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
379
+ }
380
+ let g, _ = "", ue, de = !1, fe = 0, me = function() {
381
+ if (fe > 0) throw S("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
382
+ }, he = function(e) {
383
+ me(), fe++;
384
+ try {
385
+ return g.createHTML(e);
386
+ } finally {
387
+ fe--;
388
+ }
389
+ }, ge = function(e) {
390
+ me(), fe++;
391
+ try {
392
+ return g.createScriptURL(e);
393
+ } finally {
394
+ fe--;
395
+ }
396
+ }, ke = function() {
397
+ return de ||= (ue = ft(u, i), !0), ue;
398
+ }, Ae = n, je = Ae.implementation, Me = Ae.createNodeIterator, Ne = Ae.createDocumentFragment, C = Ae.getElementsByTagName, Pe = r.importNode, T = pt();
399
+ t.isSupported = typeof le == "function" && typeof te == "function" && je && je.createHTMLDocument !== void 0;
400
+ let ct = Je, _t = Ye, vt = Xe, yt = Ze, bt = Qe, xt = et, St = tt, k = rt, Ct = $e, A = null, wt = w({}, [
401
+ ...Le,
402
+ ...Re,
403
+ ...ze,
404
+ ...Ve,
405
+ ...Ue
406
+ ]), j = null, Tt = w({}, [
407
+ ...We,
408
+ ...Ge,
409
+ ...Ke,
410
+ ...qe
411
+ ]), M = Object.seal(pe(null, {
412
+ tagNameCheck: {
413
+ writable: !0,
414
+ configurable: !1,
415
+ enumerable: !0,
416
+ value: null
417
+ },
418
+ attributeNameCheck: {
419
+ writable: !0,
420
+ configurable: !1,
421
+ enumerable: !0,
422
+ value: null
423
+ },
424
+ allowCustomizedBuiltInElements: {
425
+ writable: !0,
426
+ configurable: !1,
427
+ enumerable: !0,
428
+ value: !1
429
+ }
430
+ })), Et = null, Dt = null, N = Object.seal(pe(null, {
431
+ tagCheck: {
432
+ writable: !0,
433
+ configurable: !1,
434
+ enumerable: !0,
435
+ value: null
436
+ },
437
+ attributeCheck: {
438
+ writable: !0,
439
+ configurable: !1,
440
+ enumerable: !0,
441
+ value: null
442
+ }
443
+ })), Ot = !0, kt = !0, At = !1, jt = !0, P = !1, F = !0, I = !1, Mt = !1, Nt = null, Pt = null, Ft = !1, L = !1, It = !1, Lt = !1, Rt = !0, zt = !1, Bt = "user-content-", Vt = !0, Ht = !1, R = {}, z = null, Ut = w({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), Wt = null, Gt = w({}, [
444
+ "audio",
445
+ "video",
446
+ "img",
447
+ "source",
448
+ "image",
449
+ "track"
450
+ ]), Kt = null, qt = w({}, [
451
+ "alt",
452
+ "class",
453
+ "for",
454
+ "id",
455
+ "label",
456
+ "name",
457
+ "pattern",
458
+ "placeholder",
459
+ "role",
460
+ "summary",
461
+ "title",
462
+ "value",
463
+ "style",
464
+ "xmlns"
465
+ ]), Jt = "http://www.w3.org/1998/Math/MathML", Yt = "http://www.w3.org/2000/svg", B = "http://www.w3.org/1999/xhtml", Xt = B, Zt = !1, Qt = null, $t = w({}, [
466
+ Jt,
467
+ Yt,
468
+ B
469
+ ], we), en = v([
470
+ "mi",
471
+ "mo",
472
+ "mn",
473
+ "ms",
474
+ "mtext"
475
+ ]), tn = w({}, en), nn = v(["annotation-xml"]), rn = w({}, nn), an = w({}, [
476
+ "title",
477
+ "style",
478
+ "font",
479
+ "a",
480
+ "script"
481
+ ]), on = null, sn = ["application/xhtml+xml", "text/html"], V = null, cn = null, ln = n.createElement("form"), un = function(e) {
482
+ return e instanceof RegExp || e instanceof Function;
483
+ }, dn = function() {
484
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
485
+ if (cn && cn === e) return;
486
+ (!e || typeof e != "object") && (e = {}), e = E(e), on = sn.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, V = on === "application/xhtml+xml" ? we : Ce, A = mt(e, "ALLOWED_TAGS", wt, { transform: V }), j = mt(e, "ALLOWED_ATTR", Tt, { transform: V }), Qt = mt(e, "ALLOWED_NAMESPACES", $t, { transform: we }), Kt = mt(e, "ADD_URI_SAFE_ATTR", qt, {
487
+ transform: V,
488
+ base: qt
489
+ }), Wt = mt(e, "ADD_DATA_URI_TAGS", Gt, {
490
+ transform: V,
491
+ base: Gt
492
+ }), z = mt(e, "FORBID_CONTENTS", Ut, { transform: V }), Et = mt(e, "FORBID_TAGS", E({}), { transform: V }), Dt = mt(e, "FORBID_ATTR", E({}), { transform: V }), R = b(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? E(e.USE_PROFILES) : e.USE_PROFILES : !1, Ot = e.ALLOW_ARIA_ATTR !== !1, kt = e.ALLOW_DATA_ATTR !== !1, At = e.ALLOW_UNKNOWN_PROTOCOLS || !1, jt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, P = e.SAFE_FOR_TEMPLATES || !1, F = e.SAFE_FOR_XML !== !1, I = e.WHOLE_DOCUMENT || !1, L = e.RETURN_DOM || !1, It = e.RETURN_DOM_FRAGMENT || !1, Lt = e.RETURN_TRUSTED_TYPE || !1, Ft = e.FORCE_BODY || !1, Rt = e.SANITIZE_DOM !== !1, zt = e.SANITIZE_NAMED_PROPS || !1, Vt = e.KEEP_CONTENT !== !1, Ht = e.IN_PLACE || !1, Ct = Ie(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : $e, Xt = typeof e.NAMESPACE == "string" ? e.NAMESPACE : B, tn = ht(e, "MATHML_TEXT_INTEGRATION_POINTS", () => w({}, en)), rn = ht(e, "HTML_INTEGRATION_POINTS", () => w({}, nn));
493
+ let t = ht(e, "CUSTOM_ELEMENT_HANDLING", () => pe(null));
494
+ if (M = pe(null), b(t, "tagNameCheck") && un(t.tagNameCheck) && (M.tagNameCheck = t.tagNameCheck), b(t, "attributeNameCheck") && un(t.attributeNameCheck) && (M.attributeNameCheck = t.attributeNameCheck), b(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (M.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), y(M), P && (kt = !1), It && (L = !0), R && (A = w({}, Ue), j = pe(null), R.html === !0 && (w(A, Le), w(j, We)), R.svg === !0 && (w(A, Re), w(j, Ge), w(j, qe)), R.svgFilters === !0 && (w(A, ze), w(j, Ge), w(j, qe)), R.mathMl === !0 && (w(A, Ve), w(j, Ke), w(j, qe))), N.tagCheck = null, N.attributeCheck = null, b(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? N.tagCheck = e.ADD_TAGS : Se(e.ADD_TAGS) && (A === wt && (A = E(A)), w(A, e.ADD_TAGS, V))), b(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? N.attributeCheck = e.ADD_ATTR : Se(e.ADD_ATTR) && (j === Tt && (j = E(j)), w(j, e.ADD_ATTR, V))), b(e, "ADD_FORBID_CONTENTS") && Se(e.ADD_FORBID_CONTENTS) && (z === Ut && (z = E(z)), w(z, e.ADD_FORBID_CONTENTS, V)), Vt && (A["#text"] = !0), I && w(A, [
495
+ "html",
496
+ "head",
497
+ "body"
498
+ ]), A.table && (w(A, ["tbody"]), delete Et.tbody), e.TRUSTED_TYPES_POLICY) {
499
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw S("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
500
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw S("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
501
+ let t = g;
502
+ g = e.TRUSTED_TYPES_POLICY;
503
+ try {
504
+ _ = he("");
505
+ } catch (e) {
506
+ throw g = t, e;
507
+ }
508
+ } else e.TRUSTED_TYPES_POLICY === null ? (g = void 0, _ = "") : (g === void 0 && (g = ke()), g && typeof _ == "string" && (_ = he("")));
509
+ v && v(e), cn = e;
510
+ }, fn = w({}, [
511
+ ...Re,
512
+ ...ze,
513
+ ...Be
514
+ ]), pn = w({}, [...Ve, ...He]), mn = function(e, t, n) {
515
+ return t.namespaceURI === B ? e === "svg" : t.namespaceURI === Jt ? e === "svg" && (n === "annotation-xml" || tn[n]) : !!fn[e];
516
+ }, hn = function(e, t, n) {
517
+ return t.namespaceURI === B ? e === "math" : t.namespaceURI === Yt ? e === "math" && rn[n] : !!pn[e];
518
+ }, gn = function(e, t, n) {
519
+ return t.namespaceURI === Yt && !rn[n] || t.namespaceURI === Jt && !tn[n] ? !1 : !pn[e] && (an[e] || !fn[e]);
520
+ }, _n = function(e) {
521
+ let t = te(e);
522
+ (!t || !t.tagName) && (t = {
523
+ namespaceURI: Xt,
524
+ tagName: "template"
525
+ });
526
+ let n = Ce(e.tagName), r = Ce(t.tagName);
527
+ return Qt[e.namespaceURI] ? e.namespaceURI === Yt ? mn(n, t, r) : e.namespaceURI === Jt ? hn(n, t, r) : e.namespaceURI === B ? gn(n, t, r) : !!(on === "application/xhtml+xml" && Qt[e.namespaceURI]) : !1;
528
+ }, H = function(e) {
529
+ be(t.removed, { element: e });
530
+ try {
531
+ te(e).removeChild(e);
532
+ } catch {
533
+ if (p(e), !te(e)) throw S("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
534
+ }
535
+ }, vn = function(e, t, n) {
536
+ try {
537
+ m(e, t);
538
+ } catch {
539
+ try {
540
+ e.removeAttribute(n);
541
+ } catch {}
542
+ }
543
+ }, yn = function(e) {
544
+ xn(e);
545
+ let t = h(e);
546
+ if (t) {
547
+ let e = [];
548
+ _e(t, (t) => {
549
+ be(e, t);
550
+ }), _e(e, (e) => {
551
+ try {
552
+ p(e);
553
+ } catch {}
554
+ });
555
+ }
556
+ let n = re(e);
557
+ if (n) for (let t = n.length - 1; t >= 0; --t) {
558
+ let r = n[t], i = r && r.name;
559
+ typeof i == "string" && vn(e, r, i);
560
+ }
561
+ }, U = function(e, n, r) {
562
+ if (!r) try {
563
+ r = n.getAttributeNode(e);
564
+ } catch {
565
+ r = null;
566
+ }
567
+ be(t.removed, {
568
+ attribute: r || null,
569
+ from: n
570
+ });
571
+ try {
572
+ r ? m(n, r) : n.removeAttribute(e);
573
+ } catch {
574
+ try {
575
+ n.removeAttribute(e);
576
+ } catch {}
577
+ }
578
+ if (e === "is") if (L || It) try {
579
+ H(n);
580
+ } catch {}
581
+ else try {
582
+ n.setAttribute(e, "");
583
+ } catch {}
584
+ }, bn = function(e) {
585
+ let t = re(e);
586
+ if (t) for (let n = t.length - 1; n >= 0; --n) {
587
+ let r = t[n], i = r && r.name;
588
+ typeof i != "string" || j[V(i)] || vn(e, r, i);
589
+ }
590
+ }, xn = function(e) {
591
+ let t = [e];
592
+ for (; t.length > 0;) {
593
+ let e = t.pop();
594
+ se(e) === O.element && bn(e);
595
+ let n = h(e);
596
+ if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
597
+ }
598
+ }, W = function(e, t) {
599
+ return F ? e === "patchsrc" || e === "for" && t !== "label" && t !== "output" : !1;
600
+ }, Sn = function(e) {
601
+ if (!F) return;
602
+ let t = [e];
603
+ for (; t.length > 0;) {
604
+ let e = t.pop(), n = se(e);
605
+ if (n === O.processingInstruction || n === O.comment && x(at, e.data)) {
606
+ try {
607
+ p(e);
608
+ } catch {}
609
+ continue;
610
+ }
611
+ if (n === O.element) {
612
+ let t = e, n = V(ce(e));
613
+ try {
614
+ t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && W("for", n) && t.removeAttribute("for");
615
+ } catch {}
616
+ }
617
+ let r = h(e);
618
+ if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
619
+ }
620
+ }, Cn = function(e) {
621
+ let t = null, r = null;
622
+ if (Ft) e = "<remove></remove>" + e;
623
+ else {
624
+ let t = Te(e, /^[\r\n\t ]+/);
625
+ r = t && t[0];
626
+ }
627
+ on === "application/xhtml+xml" && Xt === B && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
628
+ let i = g ? he(e) : e;
629
+ if (Xt === B) try {
630
+ t = new l().parseFromString(i, on);
631
+ } catch {}
632
+ if (!t || !t.documentElement) {
633
+ t = je.createDocument(Xt, "template", null);
634
+ try {
635
+ t.documentElement.innerHTML = Zt ? _ : i;
636
+ } catch {}
637
+ }
638
+ let a = t.body || t.documentElement;
639
+ return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), Xt === B ? C.call(t, I ? "html" : "body")[0] : I ? t.documentElement : a;
640
+ }, wn = function(e) {
641
+ let t = oe ? oe(e) : e.ownerDocument;
642
+ return Me.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
643
+ }, Tn = function(e) {
644
+ return e = Ee(e, ct, " "), e = Ee(e, _t, " "), e = Ee(e, vt, " "), e;
645
+ }, En = function(e) {
646
+ e.normalize();
647
+ let t = oe ? oe(e) : e.ownerDocument, n = Me.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
648
+ for (; r;) r.data = Tn(r.data), r = n.nextNode();
649
+ let i = e.querySelectorAll?.call(e, "template");
650
+ i && _e(i, (e) => {
651
+ K(e.content) && En(e.content);
652
+ });
653
+ }, G = function(e) {
654
+ let t = ae ? ae(e) : null;
655
+ return typeof t != "string" || V(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== re(e) || typeof e.removeAttribute != "function" || typeof e.removeAttributeNode != "function" || typeof e.getAttributeNode != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== ie(e) || e.childNodes !== h(e);
656
+ }, K = function(e) {
657
+ if (!ie || typeof e != "object" || !e) return !1;
658
+ try {
659
+ return ie(e) === O.documentFragment;
660
+ } catch {
661
+ return !1;
662
+ }
663
+ }, q = function(e) {
664
+ if (!ie || typeof e != "object" || !e) return !1;
665
+ try {
666
+ return typeof ie(e) == "number";
667
+ } catch {
668
+ return !1;
669
+ }
670
+ };
671
+ function J(e, n, r) {
672
+ e.length !== 0 && _e(e, (e) => {
673
+ e.call(t, n, r, cn);
674
+ });
675
+ }
676
+ let Y = function(e, t) {
677
+ return !!(F && e.hasChildNodes() && !q(e.firstElementChild) && x(it, e.textContent) && x(it, e.innerHTML) || F && e.namespaceURI === B && lt[t] && (q(e.firstElementChild) || typeof e.textContent == "string" && x(ut[t], e.textContent)) || e.nodeType === O.processingInstruction || F && e.nodeType === O.comment && x(at, e.data));
678
+ }, X = function(e, t) {
679
+ return e instanceof RegExp ? x(e, t) : e instanceof Function && !!e(t, ...[...arguments].slice(2));
680
+ }, Dn = function(e, t, n) {
681
+ if (!Et[t] && Mn(t) && X(M.tagNameCheck, t)) return !1;
682
+ if (Vt && !z[t]) {
683
+ let t = te(e), r = h(e);
684
+ if (r && t) {
685
+ let i = r.length;
686
+ for (let a = i - 1; a >= 0; --a) {
687
+ let i = e === n ? f(r[a], !0) : r[a];
688
+ t.insertBefore(i, ee(e));
689
+ }
690
+ }
691
+ }
692
+ return H(e), !0;
693
+ }, Z = function(e, t, n, r) {
694
+ return e.length === 0 ? t : t === n || t === r ? E(t) : t;
695
+ }, On = function(e, t) {
696
+ return e === t || te(e) !== null ? !1 : (Ht && xn(e), !0);
697
+ }, kn = function(e, n) {
698
+ if (J(T.beforeSanitizeElements, e, null), On(e, n)) return !0;
699
+ if (G(e)) return H(e), !0;
700
+ let r = V(ce(e));
701
+ if (A = Z(T.uponSanitizeElement, A, wt, Nt), J(T.uponSanitizeElement, e, {
702
+ tagName: r,
703
+ allowedTags: A
704
+ }), On(e, n)) return !0;
705
+ if (Y(e, r)) return H(e), !0;
706
+ if (Et[r] || !(N.tagCheck instanceof Function && N.tagCheck(r)) && !A[r]) {
707
+ let t = Dn(e, r, n);
708
+ return t === !1 && (J(T.afterSanitizeElements, e, null), On(e, n)) ? !0 : t;
709
+ }
710
+ if (se(e) === O.element && !_n(e) || (r === "noscript" || r === "noembed" || r === "noframes") && x(ot, e.innerHTML)) return H(e), !0;
711
+ if (P && e.nodeType === O.text) {
712
+ let n = Tn(e.textContent);
713
+ e.textContent !== n && (be(t.removed, { element: e.cloneNode() }), e.textContent = n);
714
+ }
715
+ return J(T.afterSanitizeElements, e, null), On(e, n);
716
+ }, An = function(e, t, r) {
717
+ if (Dt[t] || W(t, e) || Rt && (t === "id" || t === "name") && (r in n || r in ln)) return !1;
718
+ let i = j[t] || N.attributeCheck instanceof Function && N.attributeCheck(t, e);
719
+ return kt && x(yt, t) || Ot && x(bt, t) ? !0 : i ? Kt[t] || x(Ct, Ee(r, St, "")) || (t === "src" || t === "xlink:href" || t === "href") && e !== "script" && De(r, "data:") === 0 && Wt[e] || At && !x(xt, Ee(r, St, "")) ? !0 : !r : Mn(e) && X(M.tagNameCheck, e) && X(M.attributeNameCheck, t, e) || t === "is" && M.allowCustomizedBuiltInElements && X(M.tagNameCheck, r);
720
+ }, jn = w({}, [
721
+ "annotation-xml",
722
+ "color-profile",
723
+ "font-face",
724
+ "font-face-format",
725
+ "font-face-name",
726
+ "font-face-src",
727
+ "font-face-uri",
728
+ "missing-glyph"
729
+ ]), Mn = function(e) {
730
+ return !jn[Ce(e)] && x(k, e);
731
+ }, Nn = function(e, t, n, r) {
732
+ if (g && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
733
+ case "TrustedHTML": return he(r);
734
+ case "TrustedScriptURL": return ge(r);
735
+ }
736
+ return r;
737
+ }, Pn = function(e, t, n, r) {
738
+ try {
739
+ return n ? e.setAttributeNS(n, t, r) : e.setAttribute(t, r), G(e) ? (H(e), !1) : !0;
740
+ } catch {
741
+ return U(t, e), !1;
742
+ }
743
+ }, Fn = function(e, n) {
744
+ if (J(T.beforeSanitizeAttributes, e, null), On(e, n)) return;
745
+ let r = e.attributes;
746
+ if (!r || G(e)) return;
747
+ j = Z(T.uponSanitizeAttribute, j, Tt, Pt);
748
+ let i = {
749
+ attrName: "",
750
+ attrValue: "",
751
+ keepAttr: !0,
752
+ allowedAttributes: j,
753
+ forceKeepAttr: void 0
754
+ }, a = r.length, o = V(e.nodeName);
755
+ for (; a--;) {
756
+ let n = r[a], s = n.name, c = n.namespaceURI, l = n.value, u = V(s), d = l, f = s === "value" ? d : Oe(d), p = !1;
757
+ if (i.attrName = u, i.attrValue = f, i.keepAttr = !0, i.forceKeepAttr = void 0, J(T.uponSanitizeAttribute, e, i), f = i.attrValue, zt && (u === "id" || u === "name") && De(f, Bt) !== 0 && (U(s, e, n), f = Bt + f, p = !0), F && x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, f)) {
758
+ U(s, e, n);
759
+ continue;
760
+ }
761
+ if (u === "attributename" && Te(f, "href")) {
762
+ U(s, e, n);
763
+ continue;
764
+ }
765
+ if (!i.forceKeepAttr) {
766
+ if (!i.keepAttr) {
767
+ U(s, e, n);
768
+ continue;
769
+ }
770
+ if (!jt && x(st, f)) {
771
+ U(s, e, n);
772
+ continue;
773
+ }
774
+ if (P && (f = Tn(f)), !An(o, u, f)) {
775
+ U(s, e, n);
776
+ continue;
777
+ }
778
+ f = Nn(o, u, c, f), f !== d && Pn(e, s, c, f) && p && ye(t.removed);
779
+ }
780
+ }
781
+ J(T.afterSanitizeAttributes, e, null), On(e, n);
782
+ }, In = function(e) {
783
+ let t = null, n = wn(e);
784
+ for (J(T.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (J(T.uponSanitizeShadowNode, t, null), kn(t, e), Fn(t, e), K(t.content) && In(t.content), se(t) === O.element) {
785
+ let e = ne(t);
786
+ K(e) && (Ln(e), In(e));
787
+ }
788
+ J(T.afterSanitizeShadowDOM, e, null);
789
+ }, Ln = function(e) {
790
+ let t = [{
791
+ node: e,
792
+ shadow: null
793
+ }];
794
+ for (; t.length > 0;) {
795
+ let e = t.pop();
796
+ if (e.shadow) {
797
+ In(e.shadow);
798
+ continue;
799
+ }
800
+ let n = e.node, r = se(n) === O.element, i = h(n);
801
+ if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
802
+ node: i[e],
803
+ shadow: null
804
+ });
805
+ if (r) {
806
+ let e = ae ? ae(n) : null;
807
+ if (typeof e == "string" && V(e) === "template") {
808
+ let e = n.content;
809
+ K(e) && t.push({
810
+ node: e,
811
+ shadow: null
812
+ });
813
+ }
814
+ }
815
+ if (r) {
816
+ let e = ne(n);
817
+ K(e) && t.push({
818
+ node: null,
819
+ shadow: e
820
+ }, {
821
+ node: e,
822
+ shadow: null
823
+ });
824
+ }
825
+ }
826
+ };
827
+ return t.sanitize = function(e) {
828
+ let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
829
+ if (Zt = !e, Zt && (e = "<!-->"), typeof e != "string" && !q(e) && (e = Fe(e), typeof e != "string")) throw S("dirty is not a string, aborting");
830
+ if (!t.isSupported) return e;
831
+ Mt ? (A = Nt, j = Pt) : dn(n), (T.uponSanitizeElement.length > 0 || T.uponSanitizeAttribute.length > 0) && (A = E(A)), T.uponSanitizeAttribute.length > 0 && (j = E(j)), t.removed = [];
832
+ let c = Ht && typeof e != "string" && q(e);
833
+ if (c) {
834
+ Sn(e);
835
+ let t = ce(e);
836
+ if (typeof t == "string") {
837
+ let n = V(t);
838
+ if (!A[n] || Et[n]) throw yn(e), S("root node is forbidden and cannot be sanitized in-place");
839
+ }
840
+ if (G(e)) throw yn(e), S("root node is clobbered and cannot be sanitized in-place");
841
+ try {
842
+ Ln(e);
843
+ } catch (t) {
844
+ throw yn(e), t;
845
+ }
846
+ } else if (q(e)) i = Cn("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === O.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Ln(i);
847
+ else {
848
+ if (!L && !P && !I && e.indexOf("<") === -1) return g && Lt ? he(e) : e;
849
+ if (i = Cn(e), !i) return L ? null : Lt ? _ : "";
850
+ }
851
+ i && Ft && H(i.firstChild);
852
+ let l = c ? e : i;
853
+ try {
854
+ let e = wn(l);
855
+ for (; o = e.nextNode();) kn(o, l), Fn(o, l), K(o.content) && In(o.content);
856
+ } catch (n) {
857
+ throw c && (yn(e), _e(t.removed, (e) => {
858
+ e.element && xn(e.element);
859
+ })), n;
860
+ }
861
+ if (c) {
862
+ let n = !1;
863
+ if (_e(t.removed, (t) => {
864
+ t.element && (t.element === e && (n = !0), xn(t.element));
865
+ }), n) throw S("a node selected for removal could not be safely returned; refusing to sanitize in place");
866
+ return P && En(e), e;
867
+ }
868
+ if (L) {
869
+ if (P && En(i), It) for (s = Ne.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
870
+ else s = i;
871
+ return (j.shadowroot || j.shadowrootmode) && (s = Pe.call(r, s, !0)), s;
872
+ }
873
+ let u = I ? i.outerHTML : i.innerHTML;
874
+ return I && A["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && x(nt, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), P && (u = Tn(u)), g && Lt ? he(u) : u;
875
+ }, t.setConfig = function() {
876
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
877
+ dn(e), Mt = !0, Nt = A, Pt = j;
878
+ }, t.clearConfig = function() {
879
+ cn = null, Mt = !1, Nt = null, Pt = null, g = ue, _ = "";
880
+ }, t.isValidAttribute = function(e, t, n) {
881
+ cn || dn({});
882
+ let r = V(e), i = V(t);
883
+ return An(r, i, n);
884
+ }, t.addHook = function(e, t) {
885
+ typeof t == "function" && b(T, e) && be(T[e], t);
886
+ }, t.removeHook = function(e, t) {
887
+ if (b(T, e)) {
888
+ if (t !== void 0) {
889
+ let n = ve(T[e], t);
890
+ return n === -1 ? void 0 : xe(T[e], n, 1)[0];
891
+ }
892
+ return ye(T[e]);
893
+ }
894
+ }, t.removeHooks = function(e) {
895
+ b(T, e) && (T[e] = []);
896
+ }, t.removeAllHooks = function() {
897
+ T = pt();
898
+ }, t;
899
+ }
900
+ var _t = gt();
901
+ //#endregion
902
+ //#region node_modules/marked/lib/marked.esm.js
903
+ function vt() {
904
+ return {
905
+ async: !1,
906
+ breaks: !1,
907
+ extensions: null,
908
+ gfm: !0,
909
+ hooks: null,
910
+ pedantic: !1,
911
+ renderer: null,
912
+ silent: !1,
913
+ tokenizer: null,
914
+ walkTokens: null
915
+ };
916
+ }
917
+ var yt = vt();
918
+ function bt(e) {
919
+ yt = e;
920
+ }
921
+ var xt = { exec: () => null };
922
+ function St(e) {
923
+ let t = [];
924
+ return (n) => {
925
+ let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
926
+ return i || (i = e(r), t[r] = i), i;
927
+ };
928
+ }
929
+ function k(e, t = "") {
930
+ let n = typeof e == "string" ? e : e.source, r = {
931
+ replace: (e, t) => {
932
+ let i = typeof t == "string" ? t : t.source;
933
+ return i = i.replace(A.caret, "$1"), n = n.replace(e, i), r;
934
+ },
935
+ getRegex: () => new RegExp(n, t)
936
+ };
937
+ return r;
938
+ }
939
+ var Ct = ((e = "") => {
940
+ try {
941
+ return !!RegExp("(?<=1)(?<!1)" + e);
942
+ } catch {
943
+ return !1;
944
+ }
945
+ })(), A = {
946
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
947
+ outputLinkReplace: /\\([\[\]])/g,
948
+ indentCodeCompensation: /^(\s+)(?:```)/,
949
+ beginningSpace: /^\s+/,
950
+ endingHash: /#$/,
951
+ startingSpaceChar: /^ /,
952
+ endingSpaceChar: / $/,
953
+ nonSpaceChar: /[^ ]/,
954
+ newLineCharGlobal: /\n/g,
955
+ tabCharGlobal: /\t/g,
956
+ multipleSpaceGlobal: /\s+/g,
957
+ blankLine: /^[ \t]*$/,
958
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
959
+ blockquoteStart: /^ {0,3}>/,
960
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
961
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
962
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
963
+ listIsTask: /^\[[ xX]\] +\S/,
964
+ listReplaceTask: /^\[[ xX]\] +/,
965
+ listTaskCheckbox: /\[[ xX]\]/,
966
+ anyLine: /\n.*\n/,
967
+ hrefBrackets: /^<(.*)>$/,
968
+ tableDelimiter: /[:|]/,
969
+ tableAlignChars: /^\||\| *$/g,
970
+ tableRowBlankLine: /\n[ \t]*$/,
971
+ tableAlignRight: /^ *-+: *$/,
972
+ tableAlignCenter: /^ *:-+: *$/,
973
+ tableAlignLeft: /^ *:-+ *$/,
974
+ startATag: /^<a /i,
975
+ endATag: /^<\/a>/i,
976
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
977
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
978
+ startAngleBracket: /^</,
979
+ endAngleBracket: />$/,
980
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
981
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
982
+ escapeTest: /[&<>"']/,
983
+ escapeReplace: /[&<>"']/g,
984
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
985
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
986
+ caret: /(^|[^\[])\^/g,
987
+ percentDecode: /%25/g,
988
+ findPipe: /\|/g,
989
+ splitPipe: / \|/,
990
+ slashPipe: /\\\|/g,
991
+ carriageReturn: /\r\n|\r/g,
992
+ spaceLine: /^ +$/gm,
993
+ notSpaceStart: /^\S*/,
994
+ endingNewline: /\n$/,
995
+ listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
996
+ nextBulletRegex: St((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
997
+ hrRegex: St((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
998
+ fencesBeginRegex: St((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
999
+ headingBeginRegex: St((e) => RegExp(`^ {0,${e}}#`)),
1000
+ htmlBeginRegex: St((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
1001
+ blockquoteBeginRegex: St((e) => RegExp(`^ {0,${e}}>`))
1002
+ }, wt = /^(?:[ \t]*(?:\n|$))+/, j = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Tt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, M = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Et = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Dt = / {0,3}(?:[*+-]|\d{1,9}[.)])/, N = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Ot = k(N).replace(/bull/g, Dt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), kt = k(N).replace(/bull/g, Dt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), At = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, jt = /^[^\n]+/, P = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, F = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", P).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), I = k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, Dt).getRegex(), Mt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", Nt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Pt = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", Nt).replace("tag", Mt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Ft = k(At).replace("hr", M).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Mt).getRegex(), L = {
1003
+ blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ft).getRegex(),
1004
+ code: j,
1005
+ def: F,
1006
+ fences: Tt,
1007
+ heading: Et,
1008
+ hr: M,
1009
+ html: Pt,
1010
+ lheading: Ot,
1011
+ list: I,
1012
+ newline: wt,
1013
+ paragraph: Ft,
1014
+ table: xt,
1015
+ text: jt
1016
+ }, It = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", M).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Mt).getRegex(), Lt = {
1017
+ ...L,
1018
+ lheading: kt,
1019
+ table: It,
1020
+ paragraph: k(At).replace("hr", M).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", It).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Mt).getRegex()
1021
+ }, Rt = {
1022
+ ...L,
1023
+ html: k("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", Nt).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
1024
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1025
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
1026
+ fences: xt,
1027
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
1028
+ paragraph: k(At).replace("hr", M).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Ot).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
1029
+ }, zt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Bt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Vt = /^( {2,}|\\)\n(?!\s*$)/, Ht = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, R = /[\p{P}\p{S}]/u, z = /[\s\p{P}\p{S}]/u, Ut = /[^\s\p{P}\p{S}]/u, Wt = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, z).getRegex(), Gt = /(?!~)[\p{P}\p{S}]/u, Kt = /(?!~)[\s\p{P}\p{S}]/u, qt = /(?:[^\s\p{P}\p{S}]|~)/u, Jt = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ct ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Yt = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, B = k(Yt, "u").replace(/punct/g, R).getRegex(), Xt = k(Yt, "u").replace(/punct/g, Gt).getRegex(), Zt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Qt = k(Zt, "gu").replace(/notPunctSpace/g, Ut).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), $t = k(Zt, "gu").replace(/notPunctSpace/g, qt).replace(/punctSpace/g, Kt).replace(/punct/g, Gt).getRegex(), en = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Ut).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), tn = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, R).getRegex(), nn = k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Ut).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), rn = k(/\\(punct)/, "gu").replace(/punct/g, R).getRegex(), an = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), on = k(Nt).replace("(?:-->|$)", "-->").getRegex(), sn = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", on).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), V = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, cn = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", V).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ln = k(/^!?\[(label)\]\[(ref)\]/).replace("label", V).replace("ref", P).getRegex(), un = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", P).getRegex(), dn = k("reflink|nolink(?!\\()", "g").replace("reflink", ln).replace("nolink", un).getRegex(), fn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, pn = {
1030
+ _backpedal: xt,
1031
+ anyPunctuation: rn,
1032
+ autolink: an,
1033
+ blockSkip: Jt,
1034
+ br: Vt,
1035
+ code: Bt,
1036
+ del: xt,
1037
+ delLDelim: xt,
1038
+ delRDelim: xt,
1039
+ emStrongLDelim: B,
1040
+ emStrongRDelimAst: Qt,
1041
+ emStrongRDelimUnd: en,
1042
+ escape: zt,
1043
+ link: cn,
1044
+ nolink: un,
1045
+ punctuation: Wt,
1046
+ reflink: ln,
1047
+ reflinkSearch: dn,
1048
+ tag: sn,
1049
+ text: Ht,
1050
+ url: xt
1051
+ }, mn = {
1052
+ ...pn,
1053
+ link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", V).getRegex(),
1054
+ reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", V).getRegex()
1055
+ }, hn = {
1056
+ ...pn,
1057
+ emStrongRDelimAst: $t,
1058
+ emStrongLDelim: Xt,
1059
+ delLDelim: tn,
1060
+ delRDelim: nn,
1061
+ url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", fn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
1062
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1063
+ del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
1064
+ text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", fn).getRegex()
1065
+ }, gn = {
1066
+ ...hn,
1067
+ br: k(Vt).replace("{2,}", "*").getRegex(),
1068
+ text: k(hn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
1069
+ }, _n = {
1070
+ normal: L,
1071
+ gfm: Lt,
1072
+ pedantic: Rt
1073
+ }, H = {
1074
+ normal: pn,
1075
+ gfm: hn,
1076
+ breaks: gn,
1077
+ pedantic: mn
1078
+ }, vn = {
1079
+ "&": "&amp;",
1080
+ "<": "&lt;",
1081
+ ">": "&gt;",
1082
+ "\"": "&quot;",
1083
+ "'": "&#39;"
1084
+ }, yn = (e) => vn[e];
1085
+ function U(e, t) {
1086
+ if (t) {
1087
+ if (A.escapeTest.test(e)) return e.replace(A.escapeReplace, yn);
1088
+ } else if (A.escapeTestNoEncode.test(e)) return e.replace(A.escapeReplaceNoEncode, yn);
1089
+ return e;
1090
+ }
1091
+ function bn(e) {
1092
+ try {
1093
+ e = encodeURI(e).replace(A.percentDecode, "%");
1094
+ } catch {
1095
+ return null;
1096
+ }
1097
+ return e;
1098
+ }
1099
+ function xn(e, t) {
1100
+ let n = e.replace(A.findPipe, (e, t, n) => {
1101
+ let r = !1, i = t;
1102
+ for (; --i >= 0 && n[i] === "\\";) r = !r;
1103
+ return r ? "|" : " |";
1104
+ }).split(A.splitPipe), r = 0;
1105
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
1106
+ else for (; n.length < t;) n.push("");
1107
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(A.slashPipe, "|");
1108
+ return n;
1109
+ }
1110
+ function W(e, t, n) {
1111
+ let r = e.length;
1112
+ if (r === 0) return "";
1113
+ let i = 0;
1114
+ for (; i < r;) {
1115
+ let a = e.charAt(r - i - 1);
1116
+ if (a === t && !n) i++;
1117
+ else if (a !== t && n) i++;
1118
+ else break;
1119
+ }
1120
+ return e.slice(0, r - i);
1121
+ }
1122
+ function Sn(e) {
1123
+ let t = e.split("\n"), n = t.length - 1;
1124
+ for (; n >= 0 && A.blankLine.test(t[n]);) n--;
1125
+ return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
1126
+ }
1127
+ function Cn(e, t) {
1128
+ if (e.indexOf(t[1]) === -1) return -1;
1129
+ let n = 0;
1130
+ for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
1131
+ else if (e[r] === t[0]) n++;
1132
+ else if (e[r] === t[1] && (n--, n < 0)) return r;
1133
+ return n > 0 ? -2 : -1;
1134
+ }
1135
+ function wn(e, t = 0) {
1136
+ let n = t, r = "";
1137
+ for (let t of e) if (t === " ") {
1138
+ let e = 4 - n % 4;
1139
+ r += " ".repeat(e), n += e;
1140
+ } else r += t, n++;
1141
+ return r;
1142
+ }
1143
+ function Tn(e, t, n, r, i) {
1144
+ let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
1145
+ r.state.inLink = !0;
1146
+ let c = {
1147
+ type: e[0].charAt(0) === "!" ? "image" : "link",
1148
+ raw: n,
1149
+ href: a,
1150
+ title: o,
1151
+ text: s,
1152
+ tokens: r.inlineTokens(s)
1153
+ };
1154
+ return r.state.inLink = !1, c;
1155
+ }
1156
+ function En(e, t, n) {
1157
+ let r = e.match(n.other.indentCodeCompensation);
1158
+ if (r === null) return t;
1159
+ let i = r[1];
1160
+ return t.split("\n").map((e) => {
1161
+ let t = e.match(n.other.beginningSpace);
1162
+ if (t === null) return e;
1163
+ let [r] = t;
1164
+ return r.length >= i.length ? e.slice(i.length) : e;
1165
+ }).join("\n");
1166
+ }
1167
+ var G = class {
1168
+ options;
1169
+ rules;
1170
+ lexer;
1171
+ constructor(e) {
1172
+ this.options = e || yt;
1173
+ }
1174
+ space(e) {
1175
+ let t = this.rules.block.newline.exec(e);
1176
+ if (t && t[0].length > 0) return {
1177
+ type: "space",
1178
+ raw: t[0]
1179
+ };
1180
+ }
1181
+ code(e) {
1182
+ let t = this.rules.block.code.exec(e);
1183
+ if (t) {
1184
+ let e = this.options.pedantic ? t[0] : Sn(t[0]);
1185
+ return {
1186
+ type: "code",
1187
+ raw: e,
1188
+ codeBlockStyle: "indented",
1189
+ text: e.replace(this.rules.other.codeRemoveIndent, "")
1190
+ };
1191
+ }
1192
+ }
1193
+ fences(e) {
1194
+ let t = this.rules.block.fences.exec(e);
1195
+ if (t) {
1196
+ let e = t[0], n = En(e, t[3] || "", this.rules);
1197
+ return {
1198
+ type: "code",
1199
+ raw: e,
1200
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
1201
+ text: n
1202
+ };
1203
+ }
1204
+ }
1205
+ heading(e) {
1206
+ let t = this.rules.block.heading.exec(e);
1207
+ if (t) {
1208
+ let e = t[2].trim();
1209
+ if (this.rules.other.endingHash.test(e)) {
1210
+ let t = W(e, "#");
1211
+ (this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
1212
+ }
1213
+ return {
1214
+ type: "heading",
1215
+ raw: W(t[0], "\n"),
1216
+ depth: t[1].length,
1217
+ text: e,
1218
+ tokens: this.lexer.inline(e)
1219
+ };
1220
+ }
1221
+ }
1222
+ hr(e) {
1223
+ let t = this.rules.block.hr.exec(e);
1224
+ if (t) return {
1225
+ type: "hr",
1226
+ raw: W(t[0], "\n")
1227
+ };
1228
+ }
1229
+ blockquote(e) {
1230
+ let t = this.rules.block.blockquote.exec(e);
1231
+ if (t) {
1232
+ let e = W(t[0], "\n").split("\n"), n = "", r = "", i = [];
1233
+ for (; e.length > 0;) {
1234
+ let t = !1, a = [], o;
1235
+ for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
1236
+ else if (!t) a.push(e[o]);
1237
+ else break;
1238
+ e = e.slice(o);
1239
+ let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
1240
+ n = n ? `${n}
1241
+ ${s}` : s, r = r ? `${r}
1242
+ ${c}` : c;
1243
+ let l = this.lexer.state.top;
1244
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
1245
+ let u = i.at(-1);
1246
+ if (u?.type === "code") break;
1247
+ if (u?.type === "blockquote") {
1248
+ let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
1249
+ i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
1250
+ break;
1251
+ } else if (u?.type === "list") {
1252
+ let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
1253
+ i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
1254
+ continue;
1255
+ }
1256
+ }
1257
+ return {
1258
+ type: "blockquote",
1259
+ raw: n,
1260
+ tokens: i,
1261
+ text: r
1262
+ };
1263
+ }
1264
+ }
1265
+ list(e) {
1266
+ let t = this.rules.block.list.exec(e);
1267
+ if (t) {
1268
+ let n = t[1].trim(), r = n.length > 1, i = {
1269
+ type: "list",
1270
+ raw: "",
1271
+ ordered: r,
1272
+ start: r ? +n.slice(0, -1) : "",
1273
+ loose: !1,
1274
+ items: []
1275
+ };
1276
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
1277
+ let a = this.rules.other.listItemRegex(n), o = !1;
1278
+ for (; e;) {
1279
+ let n = !1, r = "", s = "";
1280
+ if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
1281
+ r = t[0], e = e.substring(r.length);
1282
+ let c = wn(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
1283
+ if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
1284
+ let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
1285
+ for (; e;) {
1286
+ let p = e.split("\n", 1)[0], m;
1287
+ if (l = p, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), m = l) : m = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || f.test(l) || t.test(l) || n.test(l)) break;
1288
+ if (m.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + m.slice(d);
1289
+ else {
1290
+ if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
1291
+ s += "\n" + l;
1292
+ }
1293
+ u = !l.trim(), r += p + "\n", e = e.substring(p.length + 1), c = m.slice(d);
1294
+ }
1295
+ }
1296
+ i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
1297
+ type: "list_item",
1298
+ raw: r,
1299
+ task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
1300
+ loose: !1,
1301
+ text: s,
1302
+ tokens: []
1303
+ }), i.raw += r;
1304
+ }
1305
+ let s = i.items.at(-1);
1306
+ if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
1307
+ else return;
1308
+ i.raw = i.raw.trimEnd();
1309
+ for (let e of i.items) {
1310
+ this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []);
1311
+ let t = e.tokens[0];
1312
+ if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
1313
+ e.text = e.text.replace(this.rules.other.listReplaceTask, ""), t.raw = t.raw.replace(this.rules.other.listReplaceTask, ""), t.text = t.text.replace(this.rules.other.listReplaceTask, "");
1314
+ for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
1315
+ this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
1316
+ break;
1317
+ }
1318
+ let n = this.rules.other.listTaskCheckbox.exec(e.raw);
1319
+ if (n) {
1320
+ let t = {
1321
+ type: "checkbox",
1322
+ raw: n[0] + " ",
1323
+ checked: n[0] !== "[ ]"
1324
+ };
1325
+ e.checked = t.checked, i.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = t.raw + e.tokens[0].raw, e.tokens[0].text = t.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(t)) : e.tokens.unshift({
1326
+ type: "paragraph",
1327
+ raw: t.raw,
1328
+ text: t.raw,
1329
+ tokens: [t]
1330
+ }) : e.tokens.unshift(t);
1331
+ }
1332
+ } else e.task &&= !1;
1333
+ if (!i.loose) {
1334
+ let t = e.tokens.filter((e) => e.type === "space");
1335
+ i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
1336
+ }
1337
+ }
1338
+ if (i.loose) for (let e of i.items) {
1339
+ e.loose = !0;
1340
+ for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
1341
+ }
1342
+ return i;
1343
+ }
1344
+ }
1345
+ html(e) {
1346
+ let t = this.rules.block.html.exec(e);
1347
+ if (t) {
1348
+ let e = Sn(t[0]);
1349
+ return {
1350
+ type: "html",
1351
+ block: !0,
1352
+ raw: e,
1353
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
1354
+ text: e
1355
+ };
1356
+ }
1357
+ }
1358
+ def(e) {
1359
+ let t = this.rules.block.def.exec(e);
1360
+ if (t) {
1361
+ let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
1362
+ return {
1363
+ type: "def",
1364
+ tag: e,
1365
+ raw: W(t[0], "\n"),
1366
+ href: n,
1367
+ title: r
1368
+ };
1369
+ }
1370
+ }
1371
+ table(e) {
1372
+ let t = this.rules.block.table.exec(e);
1373
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
1374
+ let n = xn(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
1375
+ type: "table",
1376
+ raw: W(t[0], "\n"),
1377
+ header: [],
1378
+ align: [],
1379
+ rows: []
1380
+ };
1381
+ if (n.length === r.length) {
1382
+ for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
1383
+ for (let e = 0; e < n.length; e++) a.header.push({
1384
+ text: n[e],
1385
+ tokens: this.lexer.inline(n[e]),
1386
+ header: !0,
1387
+ align: a.align[e]
1388
+ });
1389
+ for (let e of i) a.rows.push(xn(e, a.header.length).map((e, t) => ({
1390
+ text: e,
1391
+ tokens: this.lexer.inline(e),
1392
+ header: !1,
1393
+ align: a.align[t]
1394
+ })));
1395
+ return a;
1396
+ }
1397
+ }
1398
+ lheading(e) {
1399
+ let t = this.rules.block.lheading.exec(e);
1400
+ if (t) {
1401
+ let e = t[1].trim();
1402
+ return {
1403
+ type: "heading",
1404
+ raw: W(t[0], "\n"),
1405
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
1406
+ text: e,
1407
+ tokens: this.lexer.inline(e)
1408
+ };
1409
+ }
1410
+ }
1411
+ paragraph(e) {
1412
+ let t = this.rules.block.paragraph.exec(e);
1413
+ if (t) {
1414
+ let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
1415
+ return {
1416
+ type: "paragraph",
1417
+ raw: t[0],
1418
+ text: e,
1419
+ tokens: this.lexer.inline(e)
1420
+ };
1421
+ }
1422
+ }
1423
+ text(e) {
1424
+ let t = this.rules.block.text.exec(e);
1425
+ if (t) return {
1426
+ type: "text",
1427
+ raw: t[0],
1428
+ text: t[0],
1429
+ tokens: this.lexer.inline(t[0])
1430
+ };
1431
+ }
1432
+ escape(e) {
1433
+ let t = this.rules.inline.escape.exec(e);
1434
+ if (t) return {
1435
+ type: "escape",
1436
+ raw: t[0],
1437
+ text: t[1]
1438
+ };
1439
+ }
1440
+ tag(e) {
1441
+ let t = this.rules.inline.tag.exec(e);
1442
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
1443
+ type: "html",
1444
+ raw: t[0],
1445
+ inLink: this.lexer.state.inLink,
1446
+ inRawBlock: this.lexer.state.inRawBlock,
1447
+ block: !1,
1448
+ text: t[0]
1449
+ };
1450
+ }
1451
+ link(e) {
1452
+ let t = this.rules.inline.link.exec(e);
1453
+ if (t) {
1454
+ let e = t[2].trim();
1455
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
1456
+ if (!this.rules.other.endAngleBracket.test(e)) return;
1457
+ let t = W(e.slice(0, -1), "\\");
1458
+ if ((e.length - t.length) % 2 == 0) return;
1459
+ } else {
1460
+ let e = Cn(t[2], "()");
1461
+ if (e === -2) return;
1462
+ if (e > -1) {
1463
+ let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
1464
+ t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
1465
+ }
1466
+ }
1467
+ let n = t[2], r = "";
1468
+ if (this.options.pedantic) {
1469
+ let e = this.rules.other.pedanticHrefTitle.exec(n);
1470
+ e && (n = e[1], r = e[3]);
1471
+ } else r = t[3] ? t[3].slice(1, -1) : "";
1472
+ return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), Tn(t, {
1473
+ href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
1474
+ title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
1475
+ }, t[0], this.lexer, this.rules);
1476
+ }
1477
+ }
1478
+ reflink(e, t) {
1479
+ let n;
1480
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
1481
+ let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
1482
+ if (!e) {
1483
+ let e = n[0].charAt(0);
1484
+ return {
1485
+ type: "text",
1486
+ raw: e,
1487
+ text: e
1488
+ };
1489
+ }
1490
+ return Tn(n, e, n[0], this.lexer, this.rules);
1491
+ }
1492
+ }
1493
+ emStrong(e, t, n = "") {
1494
+ let r = this.rules.inline.emStrongLDelim.exec(e);
1495
+ if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
1496
+ let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1497
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) !== null;) {
1498
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
1499
+ if (a = [...i].length, r[3] || r[4]) {
1500
+ o += a;
1501
+ continue;
1502
+ } else if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
1503
+ s += a;
1504
+ continue;
1505
+ }
1506
+ if (o -= a, o > 0) continue;
1507
+ a = Math.min(a, a + o + s);
1508
+ let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
1509
+ if (Math.min(n, a) % 2) {
1510
+ let e = c.slice(1, -1);
1511
+ return {
1512
+ type: "em",
1513
+ raw: c,
1514
+ text: e,
1515
+ tokens: this.lexer.inlineTokens(e)
1516
+ };
1517
+ }
1518
+ let l = c.slice(2, -2);
1519
+ return {
1520
+ type: "strong",
1521
+ raw: c,
1522
+ text: l,
1523
+ tokens: this.lexer.inlineTokens(l)
1524
+ };
1525
+ }
1526
+ }
1527
+ }
1528
+ codespan(e) {
1529
+ let t = this.rules.inline.code.exec(e);
1530
+ if (t) {
1531
+ let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
1532
+ return n && r && (e = e.substring(1, e.length - 1)), {
1533
+ type: "codespan",
1534
+ raw: t[0],
1535
+ text: e
1536
+ };
1537
+ }
1538
+ }
1539
+ br(e) {
1540
+ let t = this.rules.inline.br.exec(e);
1541
+ if (t) return {
1542
+ type: "br",
1543
+ raw: t[0]
1544
+ };
1545
+ }
1546
+ del(e, t, n = "") {
1547
+ let r = this.rules.inline.delLDelim.exec(e);
1548
+ if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
1549
+ let n = [...r[0]].length - 1, i, a, o = n, s = this.rules.inline.delRDelim;
1550
+ for (s.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = s.exec(t)) !== null;) {
1551
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
1552
+ if (r[3] || r[4]) {
1553
+ o += a;
1554
+ continue;
1555
+ }
1556
+ if (o -= a, o > 0) continue;
1557
+ a = Math.min(a, a + o);
1558
+ let t = [...r[0]][0].length, s = e.slice(0, n + r.index + t + a), c = s.slice(n, -n);
1559
+ return {
1560
+ type: "del",
1561
+ raw: s,
1562
+ text: c,
1563
+ tokens: this.lexer.inlineTokens(c)
1564
+ };
1565
+ }
1566
+ }
1567
+ }
1568
+ autolink(e) {
1569
+ let t = this.rules.inline.autolink.exec(e);
1570
+ if (t) {
1571
+ let e, n;
1572
+ return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
1573
+ type: "link",
1574
+ raw: t[0],
1575
+ text: e,
1576
+ href: n,
1577
+ tokens: [{
1578
+ type: "text",
1579
+ raw: e,
1580
+ text: e
1581
+ }]
1582
+ };
1583
+ }
1584
+ }
1585
+ url(e) {
1586
+ let t;
1587
+ if (t = this.rules.inline.url.exec(e)) {
1588
+ let e, n;
1589
+ if (t[2] === "@") e = t[0], n = "mailto:" + e;
1590
+ else {
1591
+ let r;
1592
+ do
1593
+ r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
1594
+ while (r !== t[0]);
1595
+ e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
1596
+ }
1597
+ return {
1598
+ type: "link",
1599
+ raw: t[0],
1600
+ text: e,
1601
+ href: n,
1602
+ tokens: [{
1603
+ type: "text",
1604
+ raw: e,
1605
+ text: e
1606
+ }]
1607
+ };
1608
+ }
1609
+ }
1610
+ inlineText(e) {
1611
+ let t = this.rules.inline.text.exec(e);
1612
+ if (t) {
1613
+ let e = this.lexer.state.inRawBlock;
1614
+ return {
1615
+ type: "text",
1616
+ raw: t[0],
1617
+ text: t[0],
1618
+ escaped: e
1619
+ };
1620
+ }
1621
+ }
1622
+ }, K = class e {
1623
+ tokens;
1624
+ options;
1625
+ state;
1626
+ inlineQueue;
1627
+ tokenizer;
1628
+ constructor(e) {
1629
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || yt, this.options.tokenizer = this.options.tokenizer || new G(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1630
+ inLink: !1,
1631
+ inRawBlock: !1,
1632
+ top: !0
1633
+ };
1634
+ let t = {
1635
+ other: A,
1636
+ block: _n.normal,
1637
+ inline: H.normal
1638
+ };
1639
+ this.options.pedantic ? (t.block = _n.pedantic, t.inline = H.pedantic) : this.options.gfm && (t.block = _n.gfm, this.options.breaks ? t.inline = H.breaks : t.inline = H.gfm), this.tokenizer.rules = t;
1640
+ }
1641
+ static get rules() {
1642
+ return {
1643
+ block: _n,
1644
+ inline: H
1645
+ };
1646
+ }
1647
+ static lex(t, n) {
1648
+ return new e(n).lex(t);
1649
+ }
1650
+ static lexInline(t, n) {
1651
+ return new e(n).inlineTokens(t);
1652
+ }
1653
+ lex(e) {
1654
+ e = e.replace(A.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
1655
+ for (let e = 0; e < this.inlineQueue.length; e++) {
1656
+ let t = this.inlineQueue[e];
1657
+ this.inlineTokens(t.src, t.tokens);
1658
+ }
1659
+ return this.inlineQueue = [], this.tokens;
1660
+ }
1661
+ blockTokens(e, t = [], n = !1) {
1662
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(A.tabCharGlobal, " ").replace(A.spaceLine, ""));
1663
+ let r = Infinity;
1664
+ for (; e;) {
1665
+ if (e.length < r) r = e.length;
1666
+ else {
1667
+ this.infiniteLoopError(e.charCodeAt(0));
1668
+ break;
1669
+ }
1670
+ let i;
1671
+ if (this.options.extensions?.block?.some((n) => (i = n.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
1672
+ if (i = this.tokenizer.space(e)) {
1673
+ e = e.substring(i.raw.length);
1674
+ let n = t.at(-1);
1675
+ i.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(i);
1676
+ continue;
1677
+ }
1678
+ if (i = this.tokenizer.code(e)) {
1679
+ e = e.substring(i.raw.length);
1680
+ let n = t.at(-1);
1681
+ n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.at(-1).src = n.text) : t.push(i);
1682
+ continue;
1683
+ }
1684
+ if (i = this.tokenizer.fences(e)) {
1685
+ e = e.substring(i.raw.length), t.push(i);
1686
+ continue;
1687
+ }
1688
+ if (i = this.tokenizer.heading(e)) {
1689
+ e = e.substring(i.raw.length), t.push(i);
1690
+ continue;
1691
+ }
1692
+ if (i = this.tokenizer.hr(e)) {
1693
+ e = e.substring(i.raw.length), t.push(i);
1694
+ continue;
1695
+ }
1696
+ if (i = this.tokenizer.blockquote(e)) {
1697
+ e = e.substring(i.raw.length), t.push(i);
1698
+ continue;
1699
+ }
1700
+ if (i = this.tokenizer.list(e)) {
1701
+ e = e.substring(i.raw.length), t.push(i);
1702
+ continue;
1703
+ }
1704
+ if (i = this.tokenizer.html(e)) {
1705
+ e = e.substring(i.raw.length), t.push(i);
1706
+ continue;
1707
+ }
1708
+ if (i = this.tokenizer.def(e)) {
1709
+ e = e.substring(i.raw.length);
1710
+ let n = t.at(-1);
1711
+ n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = {
1712
+ href: i.href,
1713
+ title: i.title
1714
+ }, t.push(i));
1715
+ continue;
1716
+ }
1717
+ if (i = this.tokenizer.table(e)) {
1718
+ e = e.substring(i.raw.length), t.push(i);
1719
+ continue;
1720
+ }
1721
+ if (i = this.tokenizer.lheading(e)) {
1722
+ e = e.substring(i.raw.length), t.push(i);
1723
+ continue;
1724
+ }
1725
+ let a = e;
1726
+ if (this.options.extensions?.startBlock) {
1727
+ let t = Infinity, n = e.slice(1), r;
1728
+ this.options.extensions.startBlock.forEach((e) => {
1729
+ r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
1730
+ }), t < Infinity && t >= 0 && (a = e.substring(0, t + 1));
1731
+ }
1732
+ if (this.state.top && (i = this.tokenizer.paragraph(a))) {
1733
+ let r = t.at(-1);
1734
+ n && r?.type === "paragraph" ? (r.raw += (r.raw.endsWith("\n") ? "" : "\n") + i.raw, r.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(i), n = a.length !== e.length, e = e.substring(i.raw.length);
1735
+ continue;
1736
+ }
1737
+ if (i = this.tokenizer.text(e)) {
1738
+ e = e.substring(i.raw.length);
1739
+ let n = t.at(-1);
1740
+ n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(i);
1741
+ continue;
1742
+ }
1743
+ if (e) {
1744
+ this.infiniteLoopError(e.charCodeAt(0));
1745
+ break;
1746
+ }
1747
+ }
1748
+ return this.state.top = !0, t;
1749
+ }
1750
+ inline(e, t = []) {
1751
+ return this.inlineQueue.push({
1752
+ src: e,
1753
+ tokens: t
1754
+ }), t;
1755
+ }
1756
+ inlineTokens(e, t = []) {
1757
+ this.tokenizer.lexer = this;
1758
+ let n = e, r = null;
1759
+ if (this.tokens.links) {
1760
+ let e = Object.keys(this.tokens.links);
1761
+ if (e.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;) e.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1762
+ }
1763
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1764
+ let i;
1765
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1766
+ n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
1767
+ let a = !1, o = "", s = Infinity;
1768
+ for (; e;) {
1769
+ if (e.length < s) s = e.length;
1770
+ else {
1771
+ this.infiniteLoopError(e.charCodeAt(0));
1772
+ break;
1773
+ }
1774
+ a || (o = ""), a = !1;
1775
+ let r;
1776
+ if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
1777
+ if (r = this.tokenizer.escape(e)) {
1778
+ e = e.substring(r.raw.length), t.push(r);
1779
+ continue;
1780
+ }
1781
+ if (r = this.tokenizer.tag(e)) {
1782
+ e = e.substring(r.raw.length), t.push(r);
1783
+ continue;
1784
+ }
1785
+ if (r = this.tokenizer.link(e)) {
1786
+ e = e.substring(r.raw.length), t.push(r);
1787
+ continue;
1788
+ }
1789
+ if (r = this.tokenizer.reflink(e, this.tokens.links)) {
1790
+ e = e.substring(r.raw.length);
1791
+ let n = t.at(-1);
1792
+ r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
1793
+ continue;
1794
+ }
1795
+ if (r = this.tokenizer.emStrong(e, n, o)) {
1796
+ e = e.substring(r.raw.length), t.push(r);
1797
+ continue;
1798
+ }
1799
+ if (r = this.tokenizer.codespan(e)) {
1800
+ e = e.substring(r.raw.length), t.push(r);
1801
+ continue;
1802
+ }
1803
+ if (r = this.tokenizer.br(e)) {
1804
+ e = e.substring(r.raw.length), t.push(r);
1805
+ continue;
1806
+ }
1807
+ if (r = this.tokenizer.del(e, n, o)) {
1808
+ e = e.substring(r.raw.length), t.push(r);
1809
+ continue;
1810
+ }
1811
+ if (r = this.tokenizer.autolink(e)) {
1812
+ e = e.substring(r.raw.length), t.push(r);
1813
+ continue;
1814
+ }
1815
+ if (!this.state.inLink && (r = this.tokenizer.url(e))) {
1816
+ e = e.substring(r.raw.length), t.push(r);
1817
+ continue;
1818
+ }
1819
+ let i = e;
1820
+ if (this.options.extensions?.startInline) {
1821
+ let t = Infinity, n = e.slice(1), r;
1822
+ this.options.extensions.startInline.forEach((e) => {
1823
+ r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
1824
+ }), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
1825
+ }
1826
+ if (r = this.tokenizer.inlineText(i)) {
1827
+ e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (o = r.raw.slice(-1)), a = !0;
1828
+ let n = t.at(-1);
1829
+ n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
1830
+ continue;
1831
+ }
1832
+ if (e) {
1833
+ this.infiniteLoopError(e.charCodeAt(0));
1834
+ break;
1835
+ }
1836
+ }
1837
+ return t;
1838
+ }
1839
+ infiniteLoopError(e) {
1840
+ let t = "Infinite loop on byte: " + e;
1841
+ if (this.options.silent) console.error(t);
1842
+ else throw Error(t);
1843
+ }
1844
+ }, q = class {
1845
+ options;
1846
+ parser;
1847
+ constructor(e) {
1848
+ this.options = e || yt;
1849
+ }
1850
+ space(e) {
1851
+ return "";
1852
+ }
1853
+ code({ text: e, lang: t, escaped: n }) {
1854
+ let r = (t || "").match(A.notSpaceStart)?.[0], i = e.replace(A.endingNewline, "") + "\n";
1855
+ return r ? "<pre><code class=\"language-" + U(r) + "\">" + (n ? i : U(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : U(i, !0)) + "</code></pre>\n";
1856
+ }
1857
+ blockquote({ tokens: e }) {
1858
+ return `<blockquote>
1859
+ ${this.parser.parse(e)}</blockquote>
1860
+ `;
1861
+ }
1862
+ html({ text: e }) {
1863
+ return e;
1864
+ }
1865
+ def(e) {
1866
+ return "";
1867
+ }
1868
+ heading({ tokens: e, depth: t }) {
1869
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1870
+ `;
1871
+ }
1872
+ hr(e) {
1873
+ return "<hr>\n";
1874
+ }
1875
+ list(e) {
1876
+ let t = e.ordered, n = e.start, r = "";
1877
+ for (let t = 0; t < e.items.length; t++) {
1878
+ let n = e.items[t];
1879
+ r += this.listitem(n);
1880
+ }
1881
+ let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
1882
+ return "<" + i + a + ">\n" + r + "</" + i + ">\n";
1883
+ }
1884
+ listitem(e) {
1885
+ return `<li>${this.parser.parse(e.tokens)}</li>
1886
+ `;
1887
+ }
1888
+ checkbox({ checked: e }) {
1889
+ return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
1890
+ }
1891
+ paragraph({ tokens: e }) {
1892
+ return `<p>${this.parser.parseInline(e)}</p>
1893
+ `;
1894
+ }
1895
+ table(e) {
1896
+ let t = "", n = "";
1897
+ for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
1898
+ t += this.tablerow({ text: n });
1899
+ let r = "";
1900
+ for (let t = 0; t < e.rows.length; t++) {
1901
+ let i = e.rows[t];
1902
+ n = "";
1903
+ for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
1904
+ r += this.tablerow({ text: n });
1905
+ }
1906
+ return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
1907
+ }
1908
+ tablerow({ text: e }) {
1909
+ return `<tr>
1910
+ ${e}</tr>
1911
+ `;
1912
+ }
1913
+ tablecell(e) {
1914
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1915
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1916
+ `;
1917
+ }
1918
+ strong({ tokens: e }) {
1919
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1920
+ }
1921
+ em({ tokens: e }) {
1922
+ return `<em>${this.parser.parseInline(e)}</em>`;
1923
+ }
1924
+ codespan({ text: e }) {
1925
+ return `<code>${U(e, !0)}</code>`;
1926
+ }
1927
+ br(e) {
1928
+ return "<br>";
1929
+ }
1930
+ del({ tokens: e }) {
1931
+ return `<del>${this.parser.parseInline(e)}</del>`;
1932
+ }
1933
+ link({ href: e, title: t, tokens: n }) {
1934
+ let r = this.parser.parseInline(n), i = bn(e);
1935
+ if (i === null) return r;
1936
+ e = i;
1937
+ let a = "<a href=\"" + e + "\"";
1938
+ return t && (a += " title=\"" + U(t) + "\""), a += ">" + r + "</a>", a;
1939
+ }
1940
+ image({ href: e, title: t, text: n, tokens: r }) {
1941
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1942
+ let i = bn(e);
1943
+ if (i === null) return U(n);
1944
+ e = i;
1945
+ let a = `<img src="${e}" alt="${U(n)}"`;
1946
+ return t && (a += ` title="${U(t)}"`), a += ">", a;
1947
+ }
1948
+ text(e) {
1949
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : U(e.text);
1950
+ }
1951
+ }, J = class {
1952
+ strong({ text: e }) {
1953
+ return e;
1954
+ }
1955
+ em({ text: e }) {
1956
+ return e;
1957
+ }
1958
+ codespan({ text: e }) {
1959
+ return e;
1960
+ }
1961
+ del({ text: e }) {
1962
+ return e;
1963
+ }
1964
+ html({ text: e }) {
1965
+ return e;
1966
+ }
1967
+ text({ text: e }) {
1968
+ return e;
1969
+ }
1970
+ link({ text: e }) {
1971
+ return "" + e;
1972
+ }
1973
+ image({ text: e }) {
1974
+ return "" + e;
1975
+ }
1976
+ br() {
1977
+ return "";
1978
+ }
1979
+ checkbox({ raw: e }) {
1980
+ return e;
1981
+ }
1982
+ }, Y = class e {
1983
+ options;
1984
+ renderer;
1985
+ textRenderer;
1986
+ constructor(e) {
1987
+ this.options = e || yt, this.options.renderer = this.options.renderer || new q(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new J();
1988
+ }
1989
+ static parse(t, n) {
1990
+ return new e(n).parse(t);
1991
+ }
1992
+ static parseInline(t, n) {
1993
+ return new e(n).parseInline(t);
1994
+ }
1995
+ parse(e) {
1996
+ this.renderer.parser = this;
1997
+ let t = "";
1998
+ for (let n = 0; n < e.length; n++) {
1999
+ let r = e[n];
2000
+ if (this.options.extensions?.renderers?.[r.type]) {
2001
+ let e = r, n = this.options.extensions.renderers[e.type].call({ parser: this }, e);
2002
+ if (n !== !1 || ![
2003
+ "space",
2004
+ "hr",
2005
+ "heading",
2006
+ "code",
2007
+ "table",
2008
+ "blockquote",
2009
+ "list",
2010
+ "html",
2011
+ "def",
2012
+ "paragraph",
2013
+ "text"
2014
+ ].includes(e.type)) {
2015
+ t += n || "";
2016
+ continue;
2017
+ }
2018
+ }
2019
+ let i = r;
2020
+ switch (i.type) {
2021
+ case "space":
2022
+ t += this.renderer.space(i);
2023
+ break;
2024
+ case "hr":
2025
+ t += this.renderer.hr(i);
2026
+ break;
2027
+ case "heading":
2028
+ t += this.renderer.heading(i);
2029
+ break;
2030
+ case "code":
2031
+ t += this.renderer.code(i);
2032
+ break;
2033
+ case "table":
2034
+ t += this.renderer.table(i);
2035
+ break;
2036
+ case "blockquote":
2037
+ t += this.renderer.blockquote(i);
2038
+ break;
2039
+ case "list":
2040
+ t += this.renderer.list(i);
2041
+ break;
2042
+ case "checkbox":
2043
+ t += this.renderer.checkbox(i);
2044
+ break;
2045
+ case "html":
2046
+ t += this.renderer.html(i);
2047
+ break;
2048
+ case "def":
2049
+ t += this.renderer.def(i);
2050
+ break;
2051
+ case "paragraph":
2052
+ t += this.renderer.paragraph(i);
2053
+ break;
2054
+ case "text":
2055
+ t += this.renderer.text(i);
2056
+ break;
2057
+ default: {
2058
+ let e = "Token with \"" + i.type + "\" type was not found.";
2059
+ if (this.options.silent) return console.error(e), "";
2060
+ throw Error(e);
2061
+ }
2062
+ }
2063
+ }
2064
+ return t;
2065
+ }
2066
+ parseInline(e, t = this.renderer) {
2067
+ this.renderer.parser = this;
2068
+ let n = "";
2069
+ for (let r = 0; r < e.length; r++) {
2070
+ let i = e[r];
2071
+ if (this.options.extensions?.renderers?.[i.type]) {
2072
+ let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
2073
+ if (e !== !1 || ![
2074
+ "escape",
2075
+ "html",
2076
+ "link",
2077
+ "image",
2078
+ "strong",
2079
+ "em",
2080
+ "codespan",
2081
+ "br",
2082
+ "del",
2083
+ "text"
2084
+ ].includes(i.type)) {
2085
+ n += e || "";
2086
+ continue;
2087
+ }
2088
+ }
2089
+ let a = i;
2090
+ switch (a.type) {
2091
+ case "escape":
2092
+ n += t.text(a);
2093
+ break;
2094
+ case "html":
2095
+ n += t.html(a);
2096
+ break;
2097
+ case "link":
2098
+ n += t.link(a);
2099
+ break;
2100
+ case "image":
2101
+ n += t.image(a);
2102
+ break;
2103
+ case "checkbox":
2104
+ n += t.checkbox(a);
2105
+ break;
2106
+ case "strong":
2107
+ n += t.strong(a);
2108
+ break;
2109
+ case "em":
2110
+ n += t.em(a);
2111
+ break;
2112
+ case "codespan":
2113
+ n += t.codespan(a);
2114
+ break;
2115
+ case "br":
2116
+ n += t.br(a);
2117
+ break;
2118
+ case "del":
2119
+ n += t.del(a);
2120
+ break;
2121
+ case "text":
2122
+ n += t.text(a);
2123
+ break;
2124
+ default: {
2125
+ let e = "Token with \"" + a.type + "\" type was not found.";
2126
+ if (this.options.silent) return console.error(e), "";
2127
+ throw Error(e);
2128
+ }
2129
+ }
2130
+ }
2131
+ return n;
2132
+ }
2133
+ }, X = class {
2134
+ options;
2135
+ block;
2136
+ constructor(e) {
2137
+ this.options = e || yt;
2138
+ }
2139
+ static passThroughHooks = /* @__PURE__ */ new Set([
2140
+ "preprocess",
2141
+ "postprocess",
2142
+ "processAllTokens",
2143
+ "emStrongMask"
2144
+ ]);
2145
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
2146
+ "preprocess",
2147
+ "postprocess",
2148
+ "processAllTokens"
2149
+ ]);
2150
+ preprocess(e) {
2151
+ return e;
2152
+ }
2153
+ postprocess(e) {
2154
+ return e;
2155
+ }
2156
+ processAllTokens(e) {
2157
+ return e;
2158
+ }
2159
+ emStrongMask(e) {
2160
+ return e;
2161
+ }
2162
+ provideLexer(e = this.block) {
2163
+ return e ? K.lex : K.lexInline;
2164
+ }
2165
+ provideParser(e = this.block) {
2166
+ return e ? Y.parse : Y.parseInline;
2167
+ }
2168
+ }, Dn = new class {
2169
+ defaults = vt();
2170
+ options = this.setOptions;
2171
+ parse = this.parseMarkdown(!0);
2172
+ parseInline = this.parseMarkdown(!1);
2173
+ Parser = Y;
2174
+ Renderer = q;
2175
+ TextRenderer = J;
2176
+ Lexer = K;
2177
+ Tokenizer = G;
2178
+ Hooks = X;
2179
+ constructor(...e) {
2180
+ this.use(...e);
2181
+ }
2182
+ walkTokens(e, t) {
2183
+ let n = [];
2184
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
2185
+ case "table": {
2186
+ let e = r;
2187
+ for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
2188
+ for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
2189
+ break;
2190
+ }
2191
+ case "list": {
2192
+ let e = r;
2193
+ n = n.concat(this.walkTokens(e.items, t));
2194
+ break;
2195
+ }
2196
+ default: {
2197
+ let e = r;
2198
+ this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
2199
+ let i = e[r].flat(Infinity);
2200
+ n = n.concat(this.walkTokens(i, t));
2201
+ }) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
2202
+ }
2203
+ }
2204
+ return n;
2205
+ }
2206
+ use(...e) {
2207
+ let t = this.defaults.extensions || {
2208
+ renderers: {},
2209
+ childTokens: {}
2210
+ };
2211
+ return e.forEach((e) => {
2212
+ let n = { ...e };
2213
+ if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
2214
+ if (!e.name) throw Error("extension name required");
2215
+ if ("renderer" in e) {
2216
+ let n = t.renderers[e.name];
2217
+ n ? t.renderers[e.name] = function(...t) {
2218
+ let r = e.renderer.apply(this, t);
2219
+ return r === !1 && (r = n.apply(this, t)), r;
2220
+ } : t.renderers[e.name] = e.renderer;
2221
+ }
2222
+ if ("tokenizer" in e) {
2223
+ if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
2224
+ let n = t[e.level];
2225
+ n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
2226
+ }
2227
+ "childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
2228
+ }), n.extensions = t), e.renderer) {
2229
+ let t = this.defaults.renderer || new q(this.defaults);
2230
+ for (let n in e.renderer) {
2231
+ if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
2232
+ if (["options", "parser"].includes(n)) continue;
2233
+ let r = n, i = e.renderer[r], a = t[r];
2234
+ t[r] = (...e) => {
2235
+ let n = i.apply(t, e);
2236
+ return n === !1 && (n = a.apply(t, e)), n || "";
2237
+ };
2238
+ }
2239
+ n.renderer = t;
2240
+ }
2241
+ if (e.tokenizer) {
2242
+ let t = this.defaults.tokenizer || new G(this.defaults);
2243
+ for (let n in e.tokenizer) {
2244
+ if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
2245
+ if ([
2246
+ "options",
2247
+ "rules",
2248
+ "lexer"
2249
+ ].includes(n)) continue;
2250
+ let r = n, i = e.tokenizer[r], a = t[r];
2251
+ t[r] = (...e) => {
2252
+ let n = i.apply(t, e);
2253
+ return n === !1 && (n = a.apply(t, e)), n;
2254
+ };
2255
+ }
2256
+ n.tokenizer = t;
2257
+ }
2258
+ if (e.hooks) {
2259
+ let t = this.defaults.hooks || new X();
2260
+ for (let n in e.hooks) {
2261
+ if (!(n in t)) throw Error(`hook '${n}' does not exist`);
2262
+ if (["options", "block"].includes(n)) continue;
2263
+ let r = n, i = e.hooks[r], a = t[r];
2264
+ X.passThroughHooks.has(n) ? t[r] = (e) => {
2265
+ if (this.defaults.async && X.passThroughHooksRespectAsync.has(n)) return (async () => {
2266
+ let n = await i.call(t, e);
2267
+ return a.call(t, n);
2268
+ })();
2269
+ let r = i.call(t, e);
2270
+ return a.call(t, r);
2271
+ } : t[r] = (...e) => {
2272
+ if (this.defaults.async) return (async () => {
2273
+ let n = await i.apply(t, e);
2274
+ return n === !1 && (n = await a.apply(t, e)), n;
2275
+ })();
2276
+ let n = i.apply(t, e);
2277
+ return n === !1 && (n = a.apply(t, e)), n;
2278
+ };
2279
+ }
2280
+ n.hooks = t;
2281
+ }
2282
+ if (e.walkTokens) {
2283
+ let t = this.defaults.walkTokens, r = e.walkTokens;
2284
+ n.walkTokens = function(e) {
2285
+ let n = [];
2286
+ return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
2287
+ };
2288
+ }
2289
+ this.defaults = {
2290
+ ...this.defaults,
2291
+ ...n
2292
+ };
2293
+ }), this;
2294
+ }
2295
+ setOptions(e) {
2296
+ return this.defaults = {
2297
+ ...this.defaults,
2298
+ ...e
2299
+ }, this;
2300
+ }
2301
+ lexer(e, t) {
2302
+ return K.lex(e, t ?? this.defaults);
2303
+ }
2304
+ parser(e, t) {
2305
+ return Y.parse(e, t ?? this.defaults);
2306
+ }
2307
+ parseMarkdown(e) {
2308
+ return (t, n) => {
2309
+ let r = { ...n }, i = {
2310
+ ...this.defaults,
2311
+ ...r
2312
+ }, a = this.onError(!!i.silent, !!i.async);
2313
+ if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
2314
+ if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
2315
+ if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
2316
+ if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
2317
+ let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? K.lex : K.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
2318
+ i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
2319
+ let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? Y.parse : Y.parseInline)(a, i);
2320
+ return i.hooks ? await i.hooks.postprocess(o) : o;
2321
+ })().catch(a);
2322
+ try {
2323
+ i.hooks && (t = i.hooks.preprocess(t));
2324
+ let n = (i.hooks ? i.hooks.provideLexer(e) : e ? K.lex : K.lexInline)(t, i);
2325
+ i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
2326
+ let r = (i.hooks ? i.hooks.provideParser(e) : e ? Y.parse : Y.parseInline)(n, i);
2327
+ return i.hooks && (r = i.hooks.postprocess(r)), r;
2328
+ } catch (e) {
2329
+ return a(e);
2330
+ }
2331
+ };
2332
+ }
2333
+ onError(e, t) {
2334
+ return (n) => {
2335
+ if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
2336
+ let e = "<p>An error occurred:</p><pre>" + U(n.message + "", !0) + "</pre>";
2337
+ return t ? Promise.resolve(e) : e;
2338
+ }
2339
+ if (t) return Promise.reject(n);
2340
+ throw n;
2341
+ };
2342
+ }
2343
+ }();
2344
+ function Z(e, t) {
2345
+ return Dn.parse(e, t);
2346
+ }
2347
+ Z.options = Z.setOptions = function(e) {
2348
+ return Dn.setOptions(e), Z.defaults = Dn.defaults, bt(Z.defaults), Z;
2349
+ }, Z.getDefaults = vt, Z.defaults = yt, Z.use = function(...e) {
2350
+ return Dn.use(...e), Z.defaults = Dn.defaults, bt(Z.defaults), Z;
2351
+ }, Z.walkTokens = function(e, t) {
2352
+ return Dn.walkTokens(e, t);
2353
+ }, Z.parseInline = Dn.parseInline, Z.Parser = Y, Z.parser = Y.parse, Z.Renderer = q, Z.TextRenderer = J, Z.Lexer = K, Z.lexer = K.lex, Z.Tokenizer = G, Z.Hooks = X, Z.parse = Z, Z.options, Z.setOptions, Z.use, Z.walkTokens, Z.parseInline, Y.parse, K.lex;
2354
+ //#endregion
2355
+ //#region src/components/ai-chat/ai-chat.module.scss?inline
2356
+ var On = ":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 luzmo-chat-message.cancelled{color:var(--luzmo-ai-chat-cancelled-message-color,var(--ai-chat-cancelled-message-color));font-style:italic}:host .user-message-content{gap:var(--luzmo-spacing-3,8px);flex-direction:column;display:flex}:host .user-message-attachments{gap:var(--luzmo-spacing-2,4px);flex-wrap:wrap;display:flex}:host .user-message-attachment{width:var(--luzmo-ai-chat-user-message-attachment-size,var(--ai-chat-user-message-attachment-size));height:var(--luzmo-ai-chat-user-message-attachment-size,var(--ai-chat-user-message-attachment-size));object-fit:cover;object-position:center;border-radius:var(--luzmo-border-radius-s,4px);pointer-events:none;display:block}:host .user-message-text{white-space:pre-wrap;overflow-wrap:anywhere}:host .markdown-content{line-height:var(--luzmo-ai-chat-markdown-line-height,var(--ai-chat-markdown-line-height))}:host .markdown-content>:first-child{margin-top:0}:host .markdown-content>:last-child{margin-bottom:0}:host .markdown-content p,:host .markdown-content ul,:host .markdown-content ol,:host .markdown-content blockquote,:host .markdown-content pre,:host .markdown-content table{margin:0 0 var(--luzmo-ai-chat-markdown-spacing,var(--ai-chat-markdown-spacing))}:host .markdown-content h1,:host .markdown-content h2,:host .markdown-content h3,:host .markdown-content h4,:host .markdown-content h5,:host .markdown-content h6{margin:var(--luzmo-ai-chat-markdown-heading-spacing,var(--ai-chat-markdown-heading-spacing)) 0 var(--luzmo-ai-chat-markdown-spacing,var(--ai-chat-markdown-spacing));font-weight:var(--luzmo-ai-chat-markdown-heading-font-weight,var(--ai-chat-markdown-heading-font-weight))}:host .markdown-content ul,:host .markdown-content ol{padding-inline-start:var(--luzmo-ai-chat-markdown-list-indent,var(--ai-chat-markdown-list-indent))}:host .markdown-content a{color:var(--luzmo-ai-chat-markdown-link-color,var(--ai-chat-markdown-link-color))}:host .markdown-content code{font-family:var(--luzmo-ai-chat-markdown-code-font-family,var(--ai-chat-markdown-code-font-family));font-size:var(--luzmo-ai-chat-markdown-code-font-size,var(--ai-chat-markdown-code-font-size));background:var(--luzmo-ai-chat-markdown-code-background,var(--ai-chat-markdown-code-background));border-radius:var(--luzmo-ai-chat-markdown-code-border-radius,var(--ai-chat-markdown-code-border-radius));padding:.1em .3em}:host .markdown-content pre{background:var(--luzmo-ai-chat-markdown-code-background,var(--ai-chat-markdown-code-background));border-radius:var(--luzmo-ai-chat-markdown-code-border-radius,var(--ai-chat-markdown-code-border-radius));padding:.75em 1em;overflow-x:auto}:host .markdown-content pre code{background:0 0;padding:0}:host .markdown-content blockquote{border-inline-start:.1875rem solid var(--luzmo-ai-chat-markdown-border-color,var(--ai-chat-markdown-border-color));padding-inline-start:.75rem}:host .markdown-content hr{border:0;border-top:.0625rem solid var(--luzmo-ai-chat-markdown-border-color,var(--ai-chat-markdown-border-color));margin:var(--luzmo-ai-chat-markdown-heading-spacing,var(--ai-chat-markdown-heading-spacing)) 0}:host .markdown-content table{border-collapse:collapse;width:100%}:host .markdown-content th,:host .markdown-content td{border:.0625rem solid var(--luzmo-ai-chat-markdown-border-color,var(--ai-chat-markdown-border-color));text-align:start;padding:.375rem .625rem}:host .markdown-content th{background:var(--luzmo-ai-chat-markdown-table-header-background,var(--ai-chat-markdown-table-header-background));font-weight:600}:host .assistant-message-wrapper{gap:var(--luzmo-ai-chat-assistant-message-actions-margin-top,var(--ai-chat-assistant-message-actions-margin-top));font-family:var(--luzmo-ai-chat-assistant-message-font-family,var(--ai-chat-assistant-message-font-family));font-size:var(--luzmo-ai-chat-assistant-message-font-size,var(--ai-chat-assistant-message-font-size));line-height:var(--luzmo-ai-chat-assistant-message-line-height,var(--ai-chat-assistant-message-line-height));--chat-message-font-family:var(--luzmo-ai-chat-assistant-message-font-family,var(--ai-chat-assistant-message-font-family));--luzmo-chat-message-font-family:var(--luzmo-ai-chat-assistant-message-font-family,var(--ai-chat-assistant-message-font-family));--chat-message-font-size:var(--luzmo-ai-chat-assistant-message-font-size,var(--ai-chat-assistant-message-font-size));--luzmo-chat-message-font-size:var(--luzmo-ai-chat-assistant-message-font-size,var(--ai-chat-assistant-message-font-size));--chat-message-line-height:var(--luzmo-ai-chat-assistant-message-line-height,var(--ai-chat-assistant-message-line-height));--luzmo-chat-message-line-height:var(--luzmo-ai-chat-assistant-message-line-height,var(--ai-chat-assistant-message-line-height));flex-direction:column;display:flex}:host .assistant-message-body{justify-content:space-between;align-items:flex-start;gap:1rem;display:flex}:host .assistant-message-actions{align-items:center;gap:var(--luzmo-ai-chat-assistant-message-actions-gap,var(--ai-chat-assistant-message-actions-gap));flex-wrap:wrap;display:none}:host .assistant-message-actions.assistant-message-actions--has-content{display:flex}:host .assistant-message-actions.assistant-message-actions--confirming{flex-direction:column;align-items:flex-start}:host .assistant-message-actions .assistant-message-action-confirm-message{font-style:var(--luzmo-ai-chat-assistant-message-actions-font-style,var(--ai-chat-assistant-message-actions-font-style));color:var(--luzmo-ai-chat-assistant-message-actions-color,var(--ai-chat-assistant-message-actions-color));white-space:pre-line}:host .assistant-message-actions .assistant-message-action-confirm-controls{align-items:center;gap:var(--luzmo-ai-chat-assistant-message-actions-gap,var(--ai-chat-assistant-message-actions-gap));flex-wrap:wrap;display:flex}:host .assistant-message-actions luzmo-button.assistant-message-action,:host .assistant-message-actions slot::slotted(luzmo-button),:host .assistant-message-actions slot::slotted(button),:host .assistant-message-actions slot::slotted(a),:host .assistant-message-actions slot::slotted(input),:host .assistant-message-actions slot::slotted(select),:host .assistant-message-actions slot::slotted(textarea){font-style:normal}:host .assistant-message-actions slot::slotted(:not(luzmo-button):not(button):not(a):not(input):not(select):not(textarea)){font-style:var(--luzmo-ai-chat-assistant-message-actions-font-style,var(--ai-chat-assistant-message-actions-font-style));color:var(--luzmo-ai-chat-assistant-message-actions-color,var(--ai-chat-assistant-message-actions-color))}: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-cancelled-message-color:var(--luzmo-font-color-dimmed,var(--luzmo-font-color-extra-dimmed));--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);--ai-chat-markdown-line-height:1.5;--ai-chat-markdown-spacing:var(--luzmo-spacing-3);--ai-chat-markdown-heading-spacing:var(--luzmo-spacing-4);--ai-chat-markdown-heading-font-weight:var(--luzmo-font-weight-bold);--ai-chat-markdown-list-indent:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-3));--ai-chat-markdown-link-color:var(--luzmo-primary);--ai-chat-markdown-code-font-family:var(--luzmo-font-family-mono,ui-monospace, monospace);--ai-chat-markdown-code-font-size:.875em;--ai-chat-markdown-code-background:var(--luzmo-background-color-highlight);--ai-chat-markdown-code-border-radius:var(--luzmo-border-radius-s);--ai-chat-markdown-border-color:var(--luzmo-border-color);--ai-chat-markdown-table-header-background:var(--luzmo-background-color-highlight);--ai-chat-assistant-message-actions-gap:var(--luzmo-spacing-2);--ai-chat-assistant-message-actions-margin-top:var(--luzmo-spacing-3);--ai-chat-assistant-message-actions-color:var(--luzmo-font-color-extra-dimmed);--ai-chat-assistant-message-actions-font-style:italic;--ai-chat-assistant-message-font-family:var(--luzmo-font-family);--ai-chat-assistant-message-font-size:var(--luzmo-font-size-s,12px);--ai-chat-assistant-message-line-height:var(--ai-chat-markdown-line-height);--ai-chat-user-message-attachment-size:64px}";
2357
+ //#endregion
2358
+ //#region src/components/ai-chat/helpers/agent-config.ts
2359
+ function kn(e, t) {
2360
+ if (e.agentConfig) {
2361
+ let n = e.agentConfig, r = t ?? kn({
2362
+ ...e,
2363
+ agentConfig: void 0
2364
+ });
2365
+ return n.context === void 0 && n.type === r.type ? {
2366
+ ...r,
2367
+ ...n,
2368
+ context: r.context
2369
+ } : n.context === void 0 ? {
2370
+ ...n,
2371
+ context: null
2372
+ } : n;
2373
+ }
2374
+ switch (e.agent ?? "item") {
2375
+ case "item":
2376
+ default: return {
2377
+ type: "item",
2378
+ context: {
2379
+ chart: e.chart,
2380
+ task: e.task
2381
+ }
2382
+ };
2383
+ case "dashboard": return {
2384
+ type: "dashboard",
2385
+ context: {
2386
+ dashboard: e.dashboard,
2387
+ currentScreenMode: e.currentScreenMode
2388
+ }
2389
+ };
2390
+ case "custom-item": return {
2391
+ type: "custom-item",
2392
+ context: { customItem: e.customItem }
2393
+ };
2394
+ case "analyst": return { type: "analyst" };
2395
+ }
2396
+ }
2397
+ function An(e) {
2398
+ return {
2399
+ chart: null,
2400
+ dashboard: null,
2401
+ customItem: null,
2402
+ currentScreenMode: void 0,
2403
+ task: void 0,
2404
+ ...e.context
2405
+ };
2406
+ }
2407
+ //#endregion
2408
+ //#region src/components/ai-chat/empty-state/ai-chat-empty-state.module.scss?inline
2409
+ var jn = ":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-action-button{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);--ai-chat-empty-state-title-line-height:1.4;--ai-chat-empty-state-title-color:var(--luzmo-font-color-hard);--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))}", Mn = class extends i {
2410
+ constructor(...e) {
2411
+ super(...e), this.title = o("What can I help you with?", { desc: "Title for the AI chat empty state" }), this.subtitle = "", this.suggestions = [], this.disabled = !1;
2412
+ }
2413
+ static {
2414
+ this.styles = f(jn);
2415
+ }
2416
+ static {
2417
+ this.tagName = "luzmo-ai-chat-empty-state";
2418
+ }
2419
+ _handleSuggestionActivate(e) {
2420
+ if (this.disabled) return;
2421
+ let t = e.prompt ?? e.label;
2422
+ this.dispatchEvent(new CustomEvent("luzmo-suggestion-selected", {
2423
+ detail: {
2424
+ label: e.label,
2425
+ prompt: t,
2426
+ selectedDatasets: e.selectedDatasets
2427
+ },
2428
+ bubbles: !0,
2429
+ composed: !0
2430
+ }));
2431
+ }
2432
+ render() {
2433
+ let e = this.suggestions.length > 0;
2434
+ return u`
2435
+ <section class="empty-state" aria-labelledby="ai-chat-empty-state-title">
2436
+ <header class="header">
2437
+ <h2 id="ai-chat-empty-state-title" class="title">${this.title}</h2>
2438
+ </header>
2439
+
2440
+ ${e ? u`
2441
+ <div class="actions">
2442
+ ${this.subtitle ? u`<p class="subtitle">${this.subtitle}</p>` : d}
2443
+ <div
2444
+ class="suggestions"
2445
+ role="group"
2446
+ aria-label=${o("Prompt suggestions", { desc: "Accessible label for the AI chat empty state suggestion list" })}
2447
+ >
2448
+ ${this.suggestions.map((e) => u`
2449
+ <luzmo-action-button
2450
+ variant="accent"
2451
+ size="s"
2452
+ ?disabled=${this.disabled}
2453
+ @click=${() => this._handleSuggestionActivate(e)}
2454
+ >
2455
+ ${e.label}
2456
+ </luzmo-action-button>
2457
+ `)}
2458
+ </div>
2459
+ </div>
2460
+ ` : d}
2461
+ </section>
2462
+ `;
2463
+ }
2464
+ };
2465
+ //#endregion
2466
+ //#region src/components/ai-chat/empty-state/index.ts
2467
+ a([p({ type: String })], Mn.prototype, "title", void 0), a([p({ type: String })], Mn.prototype, "subtitle", void 0), a([p({ type: Array })], Mn.prototype, "suggestions", void 0), a([p({
2468
+ type: Boolean,
2469
+ reflect: !0
2470
+ })], Mn.prototype, "disabled", void 0), customElements.get("luzmo-ai-chat-empty-state") || customElements.define("luzmo-ai-chat-empty-state", Mn);
2471
+ //#endregion
2472
+ //#region src/components/ai-chat/helpers/elicitation-template.ts
2473
+ var Nn = "answer", Pn = (e) => e.stopPropagation();
2474
+ function Fn(e) {
2475
+ let t = e.content?.[Nn];
2476
+ return typeof t == "string" ? t : void 0;
2477
+ }
2478
+ async function In(e) {
2479
+ e.stopPropagation();
2480
+ let t = e.currentTarget;
2481
+ await t.updateComplete, t.submit();
2482
+ }
2483
+ function Ln({ message: e, state: t, onSubmit: n }) {
2484
+ let r = e.elicitation;
2485
+ if (!r) return d;
2486
+ let i = [{
2487
+ id: Nn,
2488
+ type: "single",
2489
+ title: r.question,
2490
+ required: !0,
2491
+ options: r.options.map((e) => ({
2492
+ value: e,
2493
+ label: e
2494
+ }))
2495
+ }];
2496
+ return te(`${e.id}:${t}`, u`
2497
+ <luzmo-question-box
2498
+ size="s"
2499
+ .questions=${i}
2500
+ .value=${h([r.answer], () => r.answer ? { [Nn]: r.answer } : {})}
2501
+ .labels=${{
2502
+ submit: o("Submit", { desc: "Button that sends the chosen answer to an AI agent question" }),
2503
+ answerTitle: o("Answer", { desc: "Heading above the answer chosen for an AI agent question" }),
2504
+ change: o("Change", { desc: "Button that goes back to pick another answer for an AI agent question" })
2505
+ }}
2506
+ ?readonly=${t === "answered"}
2507
+ ?disabled=${t === "closed"}
2508
+ hide-close
2509
+ hide-skip
2510
+ @luzmo-submit=${n}
2511
+ @input=${Pn}
2512
+ @change=${In}
2513
+ @luzmo-cancel=${Pn}
2514
+ ></luzmo-question-box>
2515
+ `);
2516
+ }
2517
+ //#endregion
2518
+ //#region src/components/ai-chat/ai-chat-request.ts
2519
+ function Rn(e, t) {
2520
+ return `${e.replace(/\/+$/, "")}/${t.replace(/^\/+|\/+$/g, "")}/aiprompt`;
2521
+ }
2522
+ function zn(e) {
2523
+ return e.type === "placeholder" ? null : {
2524
+ ...e,
2525
+ version: e.version || "",
2526
+ title: e.title || e.options?.title,
2527
+ filters: e.filterGroups || [],
2528
+ aichartId: e.aichartId || ""
2529
+ };
2530
+ }
2531
+ function Bn(e, t, n = []) {
2532
+ return [
2533
+ {
2534
+ type: "text",
2535
+ text: e
2536
+ },
2537
+ ...t.map((e) => ({
2538
+ type: "dataset",
2539
+ id: e
2540
+ })),
2541
+ ...n.map((e) => ({
2542
+ type: "image",
2543
+ url: e
2544
+ }))
2545
+ ];
2546
+ }
2547
+ function Vn(e) {
2548
+ return {
2549
+ stream: e.stream ?? !0,
2550
+ response_mode: "mixed",
2551
+ ...e.conversationId ? { conversation_id: e.conversationId } : {},
2552
+ ...e.localeId ? { locale_id: e.localeId } : {}
2553
+ };
2554
+ }
2555
+ function Hn(e, t, n) {
2556
+ return {
2557
+ agent: e,
2558
+ task: t,
2559
+ ...Vn(n)
2560
+ };
2561
+ }
2562
+ function Un(e) {
2563
+ let t = Bn(e.prompt, e.datasetIds, e.attachmentUrls), n = e.chart ? zn(e.chart) : null;
2564
+ return n && t.push({
2565
+ type: "item",
2566
+ value: n
2567
+ }), {
2568
+ ...Hn("item", e.task ?? "generate", e),
2569
+ input: t
2570
+ };
2571
+ }
2572
+ function Wn(e) {
2573
+ let t = Bn(e.prompt, e.datasetIds, e.attachmentUrls);
2574
+ return e.dashboard && t.push({
2575
+ type: "dashboard",
2576
+ value: e.dashboard,
2577
+ ...e.currentScreenMode ? { current_screen_mode: e.currentScreenMode } : {}
2578
+ }), {
2579
+ ...Hn("dashboard", "generate", e),
2580
+ timezone_id: e.timezoneId ?? "UTC",
2581
+ input: t
2582
+ };
2583
+ }
2584
+ function Gn(e) {
2585
+ return {
2586
+ ...Hn("analyst", "generate", e),
2587
+ input: Bn(e.prompt, e.datasetIds, e.attachmentUrls)
2588
+ };
2589
+ }
2590
+ function Kn(e) {
2591
+ let t = Bn(e.prompt, [], e.attachmentUrls);
2592
+ return e.customItem && t.push({
2593
+ type: "custom-item",
2594
+ value: e.customItem
2595
+ }), {
2596
+ ...Hn("custom-item", "generate", e),
2597
+ text_format: "markdown",
2598
+ ...e.internal ? { internal: !0 } : {},
2599
+ input: t
2600
+ };
2601
+ }
2602
+ function qn(e, t) {
2603
+ let n = Bn(t.prompt, t.datasetIds, t.attachmentUrls), r = t.chart ? zn(t.chart) : null;
2604
+ return r && n.push({
2605
+ type: "item",
2606
+ value: r
2607
+ }), t.dashboard && n.push({
2608
+ type: "dashboard",
2609
+ value: t.dashboard,
2610
+ ...t.currentScreenMode ? { current_screen_mode: t.currentScreenMode } : {}
2611
+ }), {
2612
+ agent_id: e,
2613
+ ...Vn(t),
2614
+ input: n
2615
+ };
2616
+ }
2617
+ function Jn(e, t) {
2618
+ if (t.agentId) return qn(t.agentId, t);
2619
+ switch (e) {
2620
+ case "dashboard": return Wn(t);
2621
+ case "analyst": return Gn(t);
2622
+ case "custom-item": return Kn(t);
2623
+ default: return Un(t);
2624
+ }
2625
+ }
2626
+ function Yn(e, n) {
2627
+ let { authKey: r, authToken: i, apiVersion: a = "0.1.0" } = n;
2628
+ return n.attachmentUrls?.length && t(n.attachmentUrls), {
2629
+ key: r,
2630
+ token: i,
2631
+ action: "create",
2632
+ version: a,
2633
+ properties: Jn(e, n)
2634
+ };
2635
+ }
2636
+ function Xn(e, t, n, r = "0.1.0", i = null) {
2637
+ return {
2638
+ key: t,
2639
+ token: n,
2640
+ action: "delete",
2641
+ version: r,
2642
+ properties: {
2643
+ agent: "item",
2644
+ restore_to_message_id: e,
2645
+ ...i ? { conversation_id: i } : {}
2646
+ }
2647
+ };
2648
+ }
2649
+ //#endregion
2650
+ //#region src/components/ai-chat/stream/transport.ts
2651
+ async function Zn(e) {
2652
+ let t = await fetch(e.url, {
2653
+ method: "POST",
2654
+ headers: { "Content-Type": "application/json" },
2655
+ mode: "cors",
2656
+ body: JSON.stringify(e.body),
2657
+ signal: e.signal
2658
+ });
2659
+ if (!t.ok) {
2660
+ let e = await t.json().catch(() => null);
2661
+ throw Error(e?.message || `API request failed with status ${t.status}`);
2662
+ }
2663
+ if (!t.body) throw Error("Response body is not readable");
2664
+ return {
2665
+ body: t.body,
2666
+ conversationId: t.headers.get("x-conversation-id")
2667
+ };
2668
+ }
2669
+ function Qn(e) {
2670
+ let t = e.trim();
2671
+ if (!t || t.startsWith(":") || t.startsWith("event:") || t.startsWith("id:")) return null;
2672
+ let n = t;
2673
+ return n.startsWith("data:") && (n = n.slice(5).trimStart()), !n || n === "[DONE]" ? null : JSON.parse(n);
2674
+ }
2675
+ function $n(e, t) {
2676
+ try {
2677
+ let n = Qn(e);
2678
+ n && t(n);
2679
+ } catch {
2680
+ console.error("Failed to parse stream line");
2681
+ }
2682
+ }
2683
+ async function er(e, t) {
2684
+ let n = e.getReader(), r = new TextDecoder(), i = "";
2685
+ try {
2686
+ for (;;) {
2687
+ let { done: e, value: a } = await n.read();
2688
+ if (e) break;
2689
+ i += r.decode(a, { stream: !0 });
2690
+ let o = i.split(/\r?\n/);
2691
+ i = o.pop() ?? "";
2692
+ for (let e of o) $n(e, t);
2693
+ }
2694
+ i += r.decode();
2695
+ let e = i.trim();
2696
+ e && $n(e, t);
2697
+ } finally {
2698
+ n.releaseLock();
2699
+ }
2700
+ }
2701
+ //#endregion
2702
+ //#region src/components/ai-chat/stream/progress.ts
2703
+ function tr() {
2704
+ return {
2705
+ id: "root",
2706
+ step: "root",
2707
+ status: "pending",
2708
+ children: [{
2709
+ id: "client-init",
2710
+ step: "iqInit",
2711
+ status: "inProgress",
2712
+ description: o("Thinking", { desc: "Label shown in the AI chat progress tree while the assistant starts processing a prompt" })
2713
+ }]
2714
+ };
2715
+ }
2716
+ function nr(e) {
2717
+ let t = e.progress;
2718
+ return typeof t != "object" || !t ? !1 : "id" in t && "step" in t && "status" in t;
2719
+ }
2720
+ //#endregion
2721
+ //#region src/components/ai-chat/stream/chunk-extractors.ts
2722
+ function rr(e) {
2723
+ if (!e || typeof e != "object") return "";
2724
+ let t = e.assistant_message;
2725
+ if (!t || typeof t != "object") return "";
2726
+ if (typeof t.message == "string") return t.message;
2727
+ if (typeof t.text == "string") return t.text;
2728
+ if (typeof t.summary == "string") return t.summary;
2729
+ let n = t.content;
2730
+ return typeof n == "string" ? n : n && typeof n == "object" && typeof n.text == "string" ? n.text : "";
2731
+ }
2732
+ function ir(e) {
2733
+ return e.type === "text_delta" && typeof e.delta == "string" ? e.delta : 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 : "";
2734
+ }
2735
+ function ar(e) {
2736
+ return rr(e.result);
2737
+ }
2738
+ function or(e) {
2739
+ return !!e.done || e.type === "finish" || e.type === "done" || "question" in e;
2740
+ }
2741
+ function sr(e, t) {
2742
+ let n = typeof e.conversation_id == "string" && e.conversation_id || typeof e.conversationId == "string" && e.conversationId;
2743
+ n && t.callbacks.onConversationIdChange(n);
2744
+ }
2745
+ function cr(e) {
2746
+ for (let t of e) if (t && typeof t == "object" && t.type === "item") {
2747
+ let e = t.value;
2748
+ if (e && typeof e == "object") return e;
2749
+ }
2750
+ return null;
2751
+ }
2752
+ function lr(e) {
2753
+ let t = e.chart ?? e.generatedChart;
2754
+ if (t && typeof t == "object") return t;
2755
+ let n = e.aiMessageAssets ?? e.ai_message_assets;
2756
+ if (Array.isArray(n)) {
2757
+ let e = cr(n);
2758
+ if (e) return e;
2759
+ }
2760
+ let r = e.result;
2761
+ if (r && typeof r == "object") {
2762
+ let e = r.assistant_message, t = e?.aiMessageAssets ?? e?.ai_message_assets;
2763
+ if (Array.isArray(t)) return cr(t);
2764
+ }
2765
+ return null;
2766
+ }
2767
+ function ur(e) {
2768
+ for (let t of e) if (t && typeof t == "object" && t.type === "dashboard") {
2769
+ let e = t.value;
2770
+ if (e && typeof e == "object" && Array.isArray(e.views)) return e;
2771
+ }
2772
+ return null;
2773
+ }
2774
+ function dr(e) {
2775
+ for (let t of e) if (t && typeof t == "object" && t.type === "dashboard") {
2776
+ let e = t.name;
2777
+ if (e && typeof e == "object") return e;
2778
+ }
2779
+ }
2780
+ function fr(...e) {
2781
+ return e.find(Array.isArray);
2782
+ }
2783
+ function pr(e) {
2784
+ if (e.views && Array.isArray(e.views)) return e;
2785
+ let t = e.aiMessageAssets ?? e.ai_message_assets;
2786
+ if (Array.isArray(t)) return ur(t);
2787
+ let n = e.result;
2788
+ if (n && typeof n == "object") {
2789
+ let e = n.assistant_message, t = e?.aiMessageAssets ?? e?.ai_message_assets;
2790
+ if (Array.isArray(t)) return ur(t);
2791
+ }
2792
+ return null;
2793
+ }
2794
+ function mr(e) {
2795
+ let t = e.aiMessageAssets ?? e.ai_message_assets, n = e.result?.assistant_message, r = fr(t, n?.aiMessageAssets ?? n?.ai_message_assets);
2796
+ return r ? dr(r) : void 0;
2797
+ }
2798
+ function hr(e) {
2799
+ let t = e.result?.assistant_message;
2800
+ for (let n of [e.aiMessageAssets ?? e.ai_message_assets, t?.aiMessageAssets ?? t?.ai_message_assets]) if (Array.isArray(n)) {
2801
+ for (let e of n) if (e && typeof e == "object" && e.type === "custom-item" && e.value && typeof e.value == "object" && !Array.isArray(e.value)) return e.value;
2802
+ }
2803
+ return null;
2804
+ }
2805
+ //#endregion
2806
+ //#region src/components/ai-chat/stream/stream-processor.ts
2807
+ var gr = /* @__PURE__ */ new Set([
2808
+ "conversation-id",
2809
+ "conversation_id",
2810
+ "keepalive",
2811
+ "ping",
2812
+ "finish",
2813
+ "done"
2814
+ ]);
2815
+ function _r(e, t, n) {
2816
+ return {
2817
+ agent: n.agent,
2818
+ conversationId: t.callbacks.getConversationId(),
2819
+ ...typeof e.messageId == "string" ? { messageId: e.messageId } : {},
2820
+ raw: e
2821
+ };
2822
+ }
2823
+ function Q(e, t, n, r, i) {
2824
+ let a = {
2825
+ ..._r(n, e, t),
2826
+ recognized: !0,
2827
+ type: r,
2828
+ data: i
2829
+ };
2830
+ e.callbacks.onStep(a);
2831
+ }
2832
+ function vr(e, t, n, r, i) {
2833
+ let a = {
2834
+ ..._r(n, e, t),
2835
+ recognized: !1,
2836
+ type: r,
2837
+ data: i
2838
+ };
2839
+ e.callbacks.onStep(a);
2840
+ }
2841
+ function yr(e) {
2842
+ e.state.progressCollapsed || (e.state.progressCollapsed = !0, e.callbacks.onProgressCollapsed(!0));
2843
+ }
2844
+ function br(e, t) {
2845
+ yr(e), e.aiMessage.message = (e.aiMessage.message || "") + t, e.callbacks.onMessageUpdate(e.aiMessage);
2846
+ }
2847
+ function xr(e) {
2848
+ if (!e) return null;
2849
+ let t = e.descriptionMetadata?.decision;
2850
+ if (t === "create" || t === "edit" || t === "question") return t;
2851
+ for (let t of e.children ?? []) {
2852
+ let e = xr(t);
2853
+ if (e) return e;
2854
+ }
2855
+ return null;
2856
+ }
2857
+ function Sr(e, t, n) {
2858
+ if (!nr(e)) return !1;
2859
+ let r = e.progress;
2860
+ if (t.callbacks.onProgress(r), Q(t, n, e, "progress", r), t.state.decision === null) {
2861
+ let i = xr(r);
2862
+ i && (t.state.decision = i, Q(t, n, e, "decision", { decision: i }));
2863
+ }
2864
+ return !0;
2865
+ }
2866
+ function Cr(e) {
2867
+ return !!e.error || e.type === "error" || typeof e.error_text == "string";
2868
+ }
2869
+ function wr(e) {
2870
+ return typeof e.error_text == "string" && e.error_text ? e.error_text : typeof e.error == "string" && e.error ? e.error : o("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" });
2871
+ }
2872
+ function Tr(e, t, n) {
2873
+ if (!Cr(e)) return !1;
2874
+ let r = wr(e);
2875
+ return t.aiMessage.message = r, t.aiMessage.isError = !0, delete t.aiMessage.elicitation, t.callbacks.onMessageUpdate(t.aiMessage), Yr(e, t, n, e.error ?? r), !0;
2876
+ }
2877
+ function Er(e) {
2878
+ return typeof e.question == "string" && e.question ? e.question : typeof e.text == "string" && e.text ? e.text : "";
2879
+ }
2880
+ function Dr(e, t, n) {
2881
+ if (e.type !== "interrupt") return !1;
2882
+ let r = Er(e);
2883
+ return r && (t.state.interruptQuestion = r, br(t, r), Q(t, n, e, "interrupt", { question: r })), Yr(e, t, n), !0;
2884
+ }
2885
+ function Or(e) {
2886
+ let t = e.elicitation;
2887
+ if (!t || typeof t != "object") return null;
2888
+ let { question: n, options: r } = t, i = typeof n == "string" ? n.trim() : "", a = Array.isArray(r) ? [...new Set(r.filter((e) => typeof e == "string").map((e) => e.trim()))].filter(Boolean) : [];
2889
+ return i && a.length >= 2 ? {
2890
+ question: i,
2891
+ options: a
2892
+ } : null;
2893
+ }
2894
+ function kr(e, t, n) {
2895
+ if (e.type !== "elicitation") return !1;
2896
+ let r = Or(e);
2897
+ return r ? (yr(t), t.aiMessage.elicitation = r, t.callbacks.onMessageUpdate(t.aiMessage), Q(t, n, e, "elicitation", {
2898
+ question: r.question,
2899
+ options: r.options
2900
+ }), !0) : (vr(t, n, e, "elicitation", e), !0);
2901
+ }
2902
+ function Ar(e) {
2903
+ return typeof e.asset_id == "string" ? e.asset_id : typeof e.asset_type == "string" ? e.asset_type : "default";
2904
+ }
2905
+ function jr(e) {
2906
+ return typeof e.asset_type == "string" ? e.asset_type : "";
2907
+ }
2908
+ function Mr(e) {
2909
+ return {
2910
+ assetType: jr(e),
2911
+ snapshot: {}
2912
+ };
2913
+ }
2914
+ function Nr(e, t) {
2915
+ return {
2916
+ ...e,
2917
+ ...t
2918
+ };
2919
+ }
2920
+ function Pr(e) {
2921
+ let t = e.asset_delta ?? e.delta;
2922
+ return t && typeof t == "object" ? t : null;
2923
+ }
2924
+ function Fr(e, t) {
2925
+ t.state.assets[Ar(e)] = Mr(e);
2926
+ }
2927
+ function Ir(e, t) {
2928
+ let n = Ar(e), r = t.state.assets[n] ?? Mr(e), i = Pr(e);
2929
+ i && (r.snapshot = Nr(r.snapshot, i)), t.state.assets[n] = r;
2930
+ }
2931
+ function Lr(e, t) {
2932
+ let n = e.asset ?? e.value ?? e.asset_delta ?? e.delta;
2933
+ return n && typeof n == "object" ? Nr(t?.snapshot ?? {}, n) : t?.snapshot ?? {};
2934
+ }
2935
+ function Rr(e, t, n) {
2936
+ let r = Ar(e), i = t.state.assets[r], a = i?.assetType || jr(e), o = Lr(e, i);
2937
+ delete t.state.assets[r], Hr(a, o, e, t, n);
2938
+ }
2939
+ function zr(e, t, n) {
2940
+ switch (e.type) {
2941
+ case "asset_start": return Fr(e, t), !0;
2942
+ case "asset_delta": return Ir(e, t), !0;
2943
+ case "asset_end": return Rr(e, t, n), !0;
2944
+ default: return !1;
2945
+ }
2946
+ }
2947
+ function Br(e, t, n, r) {
2948
+ n.state.chartSnapshot = e, n.aiMessage.hasChart = !0, typeof t.messageId == "string" && (n.aiMessage.apiMessageId = t.messageId), n.callbacks.onMessageUpdate(n.aiMessage), Q(n, r, t, "chart", e);
2949
+ }
2950
+ function Vr(e, t, n, r) {
2951
+ n.state.customItemSnapshot = e, Q(n, r, t, "custom-item", e);
2952
+ }
2953
+ function Hr(e, t, n, r, i) {
2954
+ switch (e) {
2955
+ case "dashboard-title": {
2956
+ let e = t.name;
2957
+ e && typeof e == "object" && (r.state.dashboardName = e, Q(r, i, n, "dashboard-title", { name: e }));
2958
+ return;
2959
+ }
2960
+ case "dashboard-layout":
2961
+ Q(r, i, n, "dashboard-layout", t);
2962
+ return;
2963
+ case "dashboard-item":
2964
+ Q(r, i, n, "dashboard-item", {
2965
+ slot: Number(t.slot),
2966
+ chart: t.chart ?? t
2967
+ });
2968
+ return;
2969
+ case "dashboard":
2970
+ r.state.dashboardSnapshot = t;
2971
+ return;
2972
+ default: Ur(e, t, n, r, i);
2973
+ }
2974
+ }
2975
+ function Ur(e, t, n, r, i) {
2976
+ if (i.chartAssetType && e === i.chartAssetType) {
2977
+ Br(t, n, r, i);
2978
+ return;
2979
+ }
2980
+ if (i.dashboardAssetType && e === i.dashboardAssetType) {
2981
+ r.state.dashboardSnapshot = t;
2982
+ return;
2983
+ }
2984
+ if (i.customItemAssetType && e === i.customItemAssetType) {
2985
+ Vr(t, n, r, i);
2986
+ return;
2987
+ }
2988
+ vr(r, i, n, e || "asset", t);
2989
+ }
2990
+ function Wr(e, t, n) {
2991
+ let r = !1;
2992
+ if (n.dashboardAssetType) {
2993
+ let n = pr(e);
2994
+ if (n) {
2995
+ t.state.dashboardSnapshot = n;
2996
+ let i = mr(e);
2997
+ i && (t.state.dashboardName = i), r = !0;
2998
+ }
2999
+ }
3000
+ if (n.chartAssetType && !t.state.chartSnapshot) {
3001
+ let i = lr(e);
3002
+ i && (Br(i, e, t, n), r = !0);
3003
+ }
3004
+ if (n.customItemAssetType && !t.state.customItemSnapshot) {
3005
+ let i = hr(e);
3006
+ i && (Vr(i, e, t, n), r = !0);
3007
+ }
3008
+ return r;
3009
+ }
3010
+ function Gr(e, t, n) {
3011
+ return {
3012
+ ...e,
3013
+ generatedChart: t,
3014
+ conversationId: n.callbacks.getConversationId()
3015
+ };
3016
+ }
3017
+ function Kr(e, t, n) {
3018
+ for (let r of Object.keys(t.state.assets)) {
3019
+ let i = t.state.assets[r];
3020
+ delete t.state.assets[r], !(n.chartAssetType && i.assetType === n.chartAssetType && t.state.chartSnapshot || n.dashboardAssetType && i.assetType === n.dashboardAssetType && t.state.dashboardSnapshot || n.customItemAssetType && i.assetType === n.customItemAssetType && t.state.customItemSnapshot) && Hr(i.assetType, i.snapshot, e, t, n);
3021
+ }
3022
+ }
3023
+ function qr(e, t) {
3024
+ let n = ar(e);
3025
+ !n || t.aiMessage.message === n || (t.aiMessage.message = n, t.callbacks.onMessageUpdate(t.aiMessage));
3026
+ }
3027
+ function Jr(e, t, n) {
3028
+ let r = t.state.dashboardSnapshot ?? (n.dashboardAssetType ? pr(e) : null), i = t.state.chartSnapshot ?? (n.chartAssetType ? lr(e) : null);
3029
+ return {
3030
+ agent: n.agent,
3031
+ conversationId: t.callbacks.getConversationId(),
3032
+ message: t.aiMessage,
3033
+ ...r ? { dashboard: r } : {},
3034
+ ...i ? { chart: Gr(e, i, t) } : {},
3035
+ ...t.state.customItemSnapshot ? { customItem: t.state.customItemSnapshot } : {},
3036
+ ...t.state.dashboardName ? { name: t.state.dashboardName } : {},
3037
+ raw: e
3038
+ };
3039
+ }
3040
+ function Yr(e, t, n, r) {
3041
+ if (!t.state.completed) {
3042
+ if (t.state.completed = !0, Kr(e, t, n), yr(t), r !== void 0) {
3043
+ t.callbacks.onComplete({
3044
+ agent: n.agent,
3045
+ conversationId: t.callbacks.getConversationId(),
3046
+ message: t.aiMessage,
3047
+ error: r,
3048
+ raw: e
3049
+ });
3050
+ return;
3051
+ }
3052
+ qr(e, t), t.callbacks.onComplete(Jr(e, t, n));
3053
+ }
3054
+ }
3055
+ function Xr(e) {
3056
+ return typeof e.type == "string" && e.type ? e.type : typeof e.asset_type == "string" && e.asset_type ? e.asset_type : "";
3057
+ }
3058
+ function Zr(e, t, n) {
3059
+ let r = ir(e);
3060
+ return r ? (t.state.accumulatedText += r, br(t, r), Q(t, n, e, "text", {
3061
+ delta: r,
3062
+ text: t.state.accumulatedText
3063
+ }), !0) : !1;
3064
+ }
3065
+ function Qr(e, t, n, r, i) {
3066
+ if (r || i) return;
3067
+ let a = Xr(e);
3068
+ a && !gr.has(a) && vr(t, n, e, a, e);
3069
+ }
3070
+ function $r(e, t, n) {
3071
+ if (sr(e, t), Sr(e, t, n) || Tr(e, t, n) || Dr(e, t, n) || kr(e, t, n) || zr(e, t, n)) return;
3072
+ let r = Zr(e, t, n), i = Wr(e, t, n), a = r || i, o = or(e);
3073
+ Qr(e, t, n, a, o), o && Yr(e, t, n);
3074
+ }
3075
+ //#endregion
3076
+ //#region src/components/ai-chat/stream/registry.ts
3077
+ function ei(e) {
3078
+ switch (e) {
3079
+ case "dashboard": return {
3080
+ agent: e,
3081
+ dashboardAssetType: "dashboard"
3082
+ };
3083
+ case "item": return {
3084
+ agent: e,
3085
+ chartAssetType: "item"
3086
+ };
3087
+ case "custom-item": return {
3088
+ agent: e,
3089
+ customItemAssetType: "custom-item"
3090
+ };
3091
+ default: return { agent: e };
3092
+ }
3093
+ }
3094
+ function ti(e) {
3095
+ let t = ei(e);
3096
+ return (e, n) => $r(e, n, t);
3097
+ }
3098
+ function ni() {
3099
+ return {
3100
+ progressCollapsed: !1,
3101
+ accumulatedText: "",
3102
+ decision: null,
3103
+ assets: {},
3104
+ dashboardSnapshot: null,
3105
+ dashboardName: void 0,
3106
+ chartSnapshot: null,
3107
+ customItemSnapshot: null,
3108
+ interruptQuestion: null,
3109
+ completed: !1
3110
+ };
3111
+ }
3112
+ //#endregion
3113
+ //#region src/components/ai-chat/session/ai-chat-session.ts
3114
+ function ri() {
3115
+ return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
3116
+ }
3117
+ var ii = class {
3118
+ constructor(e, t = {}) {
3119
+ this._uiBridgeCallbacks = {}, this._subscribers = /* @__PURE__ */ new Set(), this._state = {
3120
+ messages: [],
3121
+ selectedDatasets: [],
3122
+ isGenerating: !1,
3123
+ progress: null,
3124
+ progressCollapsed: !1,
3125
+ conversationId: null,
3126
+ inflightMessage: null
3127
+ }, this._abortController = null, this._inflightMessage = null, this._receivedProgress = !1, this._config = {
3128
+ apiUrl: "https://api.luzmo.com",
3129
+ apiVersion: "0.1.0",
3130
+ stream: !0,
3131
+ ...e
3132
+ }, e.agentConfig && (this._config.agentConfig = kn(e)), this._hostCallbacks = t, this._state = {
3133
+ ...this._state,
3134
+ messages: e.messages ? [...e.messages] : [],
3135
+ selectedDatasets: e.selectedDatasets ? [...e.selectedDatasets] : [],
3136
+ conversationId: e.conversationId ?? null,
3137
+ isGenerating: e.isGenerating ?? !1,
3138
+ progress: e.progress ?? null,
3139
+ progressCollapsed: e.progressCollapsed ?? !1
3140
+ };
3141
+ }
3142
+ get state() {
3143
+ return this._state;
3144
+ }
3145
+ get isGenerating() {
3146
+ return this._state.isGenerating;
3147
+ }
3148
+ get agentConfig() {
3149
+ return kn(this._config);
3150
+ }
3151
+ subscribe(e) {
3152
+ return this._subscribers.add(e), e(this._state), () => {
3153
+ this._subscribers.delete(e);
3154
+ };
3155
+ }
3156
+ setUiBridge(e) {
3157
+ this._uiBridgeCallbacks = e;
3158
+ }
3159
+ updateConfig(e) {
3160
+ let t = this.agentConfig, n = this._config.agentConfig !== void 0;
3161
+ this._config = {
3162
+ ...this._config,
3163
+ ...e
3164
+ }, e.agentConfig && (this._config.agentConfig = kn(this._config, t));
3165
+ let r = {};
3166
+ if ("conversationId" in e) {
3167
+ let t = e.conversationId ?? null;
3168
+ t !== this._state.conversationId && (r.conversationId = t);
3169
+ }
3170
+ if ("selectedDatasets" in e && e.selectedDatasets) {
3171
+ let t = [...e.selectedDatasets];
3172
+ this._areSelectedDatasetsEqual(t, this._state.selectedDatasets) || (r.selectedDatasets = t);
3173
+ }
3174
+ if ("messages" in e && e.messages) {
3175
+ let t = [...e.messages];
3176
+ this._areChatMessagesEqual(t, this._state.messages) || (r.messages = t);
3177
+ }
3178
+ if ("isGenerating" in e && e.isGenerating !== this._state.isGenerating && (r.isGenerating = e.isGenerating), "progress" in e && (r.progress = e.progress ?? null), "progressCollapsed" in e && e.progressCollapsed !== this._state.progressCollapsed && (r.progressCollapsed = e.progressCollapsed), Object.keys(r).length > 0) this._patchState(r);
3179
+ else if ("agentConfig" in e && (n || this._config.agentConfig !== void 0)) {
3180
+ let e = this.agentConfig;
3181
+ (e.type !== t.type || e.context !== t.context) && this._notifySubscribers();
3182
+ }
3183
+ }
3184
+ setSelectedDatasets(e) {
3185
+ this._patchState({ selectedDatasets: [...e] }), this._emit("onDatasetsChanged", this._state.selectedDatasets);
3186
+ }
3187
+ addDataset(e) {
3188
+ this._state.selectedDatasets.some((t) => t.id === e.id) || (this._patchState({ selectedDatasets: [...this._state.selectedDatasets, e] }), this._emit("onDatasetsChanged", this._state.selectedDatasets));
3189
+ }
3190
+ removeDataset(e) {
3191
+ let t = this._state.selectedDatasets.filter((t) => t.id !== e);
3192
+ t.length !== this._state.selectedDatasets.length && (this._patchState({ selectedDatasets: t }), this._emit("onDatasetsChanged", this._state.selectedDatasets));
3193
+ }
3194
+ isDatasetRequirementMet(e) {
3195
+ return !this._config.requireDataset || this._state.selectedDatasets.length > 0 || !!e;
3196
+ }
3197
+ getAiPromptUrl() {
3198
+ return Rn(this._config.apiUrl ?? "https://api.luzmo.com", this._config.apiVersion ?? "0.1.0");
3199
+ }
3200
+ buildRequestBody(e, t, n = [], r = this._config.agentId, i = {}) {
3201
+ return Yn(this.agentConfig.type, {
3202
+ prompt: e,
3203
+ datasetIds: t,
3204
+ authKey: this._config.authKey,
3205
+ authToken: this._config.authToken,
3206
+ conversationId: this._state.conversationId,
3207
+ agentId: r,
3208
+ chart: this._config.chart ?? null,
3209
+ dashboard: this._config.dashboard ?? null,
3210
+ customItem: this._config.customItem ?? null,
3211
+ currentScreenMode: this._config.currentScreenMode,
3212
+ localeId: this._config.localeId,
3213
+ timezoneId: this._config.timezoneId,
3214
+ task: this._config.task,
3215
+ ...this._config.agentConfig ? An(this.agentConfig) : {},
3216
+ modelPreference: this._config.modelPreference,
3217
+ apiVersion: this._config.apiVersion,
3218
+ stream: this._config.stream,
3219
+ attachmentUrls: n,
3220
+ internal: i.internal
3221
+ });
3222
+ }
3223
+ buildPromptSubmittedDetail(e) {
3224
+ let t = e.attachmentUrls ?? [];
3225
+ return {
3226
+ prompt: e.prompt,
3227
+ selectedDatasets: e.selectedDatasets,
3228
+ datasetIds: e.datasetIds,
3229
+ agent: this.agentConfig.type,
3230
+ request: this.buildRequestBody(e.prompt, e.datasetIds, t, e.agentId, { internal: e.internal }),
3231
+ url: this.getAiPromptUrl(),
3232
+ ...e.signal ? { signal: e.signal } : {},
3233
+ ...e.attachments?.length ? { attachments: e.attachments } : {},
3234
+ ...t.length ? { attachmentUrls: t } : {}
3235
+ };
3236
+ }
3237
+ async _resolveAttachmentUrls(e, i) {
3238
+ if (e.attachmentUrls?.length) return t(e.attachmentUrls), [...e.attachmentUrls];
3239
+ let a = (e.attachments ?? []).map((e) => e.file).filter((e) => !!e);
3240
+ if (a.length === 0) return [];
3241
+ r(a);
3242
+ let o = this._hostCallbacks.uploadAttachments ?? this._uiBridgeCallbacks.uploadAttachments;
3243
+ if (typeof o == "function") return this._normalizeUploadedUrls(await o(a, { signal: i }), a.length);
3244
+ let { authKey: s, authToken: c, apiUrl: l = "https://api.luzmo.com", apiVersion: u = "0.1.0" } = this._config;
3245
+ if (!s || !c) {
3246
+ if (this._hasCallback("onPromptSubmitted")) return [];
3247
+ throw Error("Image attachments require authKey/authToken for built-in upload, or provide uploadAttachments / attachmentUrls.");
3248
+ }
3249
+ return this._normalizeUploadedUrls(await n({
3250
+ files: a,
3251
+ authKey: s,
3252
+ authToken: c,
3253
+ apiUrl: l,
3254
+ apiVersion: u,
3255
+ signal: i
3256
+ }), a.length);
3257
+ }
3258
+ _normalizeUploadedUrls(e, n) {
3259
+ let r = Array.isArray(e) ? e.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
3260
+ if (r.length !== n) throw Error(`Image upload returned ${r.length} URL(s) for ${n} file(s). Return one non-empty signed URL per file, in the same order.`);
3261
+ return t(r), r;
3262
+ }
3263
+ async submit(e) {
3264
+ await this._submit(e);
3265
+ }
3266
+ async _submit(e) {
3267
+ let t = e.datasetIds ?? this._state.selectedDatasets.map((e) => e.id);
3268
+ if (!this.isDatasetRequirementMet(e.agentId)) return !1;
3269
+ this._abortInflight();
3270
+ let n = new AbortController();
3271
+ this._abortController = n;
3272
+ let r;
3273
+ try {
3274
+ r = await this._resolveAttachmentUrls(e, n.signal);
3275
+ } catch (e) {
3276
+ if (this._abortController === n && (this._abortController = null), n.signal.aborted || e.name === "AbortError") return !1;
3277
+ throw e;
3278
+ }
3279
+ if (n.signal.aborted || this._abortController !== n) return !1;
3280
+ let i = {
3281
+ id: e.aiMessageId ?? ri(),
3282
+ type: "ai",
3283
+ message: ""
3284
+ }, a = [...this._state.messages];
3285
+ if (!e.skipUserMessage) {
3286
+ let t = {
3287
+ id: ri(),
3288
+ type: "user",
3289
+ message: e.prompt,
3290
+ ...r.length ? { attachmentUrls: r } : {}
3291
+ };
3292
+ a = [...a, t], this._emit("onMessageSent", t, [...this._state.selectedDatasets]);
3293
+ }
3294
+ a = [...a, i], this._inflightMessage = i, this._receivedProgress = !1, this._patchState({
3295
+ messages: a,
3296
+ isGenerating: !0,
3297
+ progress: tr(),
3298
+ progressCollapsed: !1,
3299
+ inflightMessage: i
3300
+ });
3301
+ let o = t, s = [...this._state.selectedDatasets];
3302
+ if (this._hasCallback("onPromptSubmitted")) {
3303
+ let t = this.buildPromptSubmittedDetail({
3304
+ prompt: e.prompt,
3305
+ selectedDatasets: s,
3306
+ datasetIds: o,
3307
+ signal: n.signal,
3308
+ attachments: e.attachments,
3309
+ attachmentUrls: r,
3310
+ agentId: e.agentId,
3311
+ internal: e.internal
3312
+ });
3313
+ try {
3314
+ await this._invokeCallback("onPromptSubmitted", t);
3315
+ } catch (e) {
3316
+ e.name === "AbortError" ? this.abort() : (this._handleSubmitError(e, i, t.agent), this._finalizeInflightMessage()), this._patchState({ isGenerating: !1 });
3317
+ }
3318
+ return !0;
3319
+ }
3320
+ let c = this.buildRequestBody(e.prompt, t, r, e.agentId, { internal: e.internal }), l = this.agentConfig.type, u = ti(l), d = {
3321
+ aiMessage: i,
3322
+ callbacks: this._createStreamCallbacks(),
3323
+ state: ni()
3324
+ }, f = this._config.fetchStreaming ?? Zn, p = !1;
3325
+ try {
3326
+ let { body: e, conversationId: t } = await f({
3327
+ url: this.getAiPromptUrl(),
3328
+ body: c,
3329
+ signal: n.signal
3330
+ });
3331
+ t && this._setConversationId(t), await er(e, (e) => u(e, d)), p = !0;
3332
+ } catch (e) {
3333
+ e.name !== "AbortError" && (this._handleSubmitError(e, i, l), p = !0);
3334
+ } finally {
3335
+ this._abortController === n && (p ? this._finalizeInflightMessage() : this._discardInflightMessage(), this._patchState({ isGenerating: !1 }), this._abortController = null);
3336
+ }
3337
+ return !0;
3338
+ }
3339
+ async answerElicitation(e, t, n = {}) {
3340
+ let r = this._state.messages.at(-1), i = r?.id === e ? r.elicitation : void 0;
3341
+ if (this._state.isGenerating || !i || i.answer || !i.options.includes(t) || !this.isDatasetRequirementMet(n.agentId)) return !1;
3342
+ let a = (t) => {
3343
+ this._patchState({ messages: this._state.messages.map((n) => n.id === e ? {
3344
+ ...n,
3345
+ elicitation: {
3346
+ ...i,
3347
+ answer: t
3348
+ }
3349
+ } : n) });
3350
+ };
3351
+ a(t);
3352
+ let o = !1;
3353
+ try {
3354
+ o = await this._submit({
3355
+ ...n,
3356
+ prompt: t
3357
+ });
3358
+ } finally {
3359
+ o || a(void 0);
3360
+ }
3361
+ return o;
3362
+ }
3363
+ async restore(e) {
3364
+ let t = this.agentConfig.type;
3365
+ if (t !== "item") return {};
3366
+ let n = Xn(e.restoreToMessageId, this._config.authKey, this._config.authToken, this._config.apiVersion, this._state.conversationId);
3367
+ if (this._patchState({
3368
+ isGenerating: !0,
3369
+ progress: null,
3370
+ progressCollapsed: !1
3371
+ }), this._hasCallback("onRestoreRequested")) {
3372
+ let t = {
3373
+ apiMessageId: e.restoreToMessageId,
3374
+ messageIndex: e.messageIndex,
3375
+ request: n,
3376
+ url: this.getAiPromptUrl()
3377
+ };
3378
+ try {
3379
+ await this._invokeCallback("onRestoreRequested", t);
3380
+ } finally {
3381
+ this._patchState({ isGenerating: !1 });
3382
+ }
3383
+ return {};
3384
+ }
3385
+ try {
3386
+ let r = await fetch(this.getAiPromptUrl(), {
3387
+ method: "POST",
3388
+ headers: { "Content-Type": "application/json" },
3389
+ mode: "cors",
3390
+ body: JSON.stringify(n)
3391
+ });
3392
+ if (!r.ok) {
3393
+ let e = await r.json().catch(() => null);
3394
+ throw Error(e?.message || `API request failed with status ${r.status}`);
3395
+ }
3396
+ let i = await r.json().catch(() => null), a = i?.generatedChart ?? (i ? lr(i) : null), o = {
3397
+ ...typeof i?.message == "string" ? { message: i.message } : {},
3398
+ ...a ? { chart: {
3399
+ ...i,
3400
+ generatedChart: a
3401
+ } } : {}
3402
+ }, s = e.messageIndex >= 0 && e.messageIndex < this._state.messages.length ? this._state.messages.slice(0, e.messageIndex + 1) : this._state.messages;
3403
+ if (o.message && s[e.messageIndex]?.type === "ai" && (s[e.messageIndex] = {
3404
+ ...s[e.messageIndex],
3405
+ message: o.message
3406
+ }), this._patchState({ messages: [...s] }), o.chart || o.message) {
3407
+ let n = s[e.messageIndex], r = n?.type === "ai" ? n : {
3408
+ id: ri(),
3409
+ type: "ai",
3410
+ message: o.message ?? ""
3411
+ };
3412
+ this._emit("onComplete", {
3413
+ agent: t,
3414
+ conversationId: this._state.conversationId,
3415
+ message: r,
3416
+ ...o.chart ? { chart: o.chart } : {},
3417
+ ...i ? { raw: i } : {}
3418
+ });
3419
+ }
3420
+ return o;
3421
+ } finally {
3422
+ this._patchState({ isGenerating: !1 });
3423
+ }
3424
+ }
3425
+ buildRestoreRequest(e) {
3426
+ return Xn(e, this._config.authKey, this._config.authToken, this._config.apiVersion, this._state.conversationId);
3427
+ }
3428
+ abort(e = {}) {
3429
+ this._abortController?.abort(), this._abortController = null, e.notify && this._inflightMessage ? this._markInflightCancelled(e.cancelledMessage) : this._discardInflightMessage(), this._patchState({
3430
+ isGenerating: !1,
3431
+ progress: null,
3432
+ progressCollapsed: !1
3433
+ }), e.notify && this._emit("onPromptStopped");
3434
+ }
3435
+ _abortInflight() {
3436
+ this._abortController?.abort(), this._abortController = null, this._discardInflightMessage();
3437
+ }
3438
+ _createStreamCallbacks() {
3439
+ return {
3440
+ onConversationIdChange: (e) => this._setConversationId(e),
3441
+ onProgress: (e) => {
3442
+ this._receivedProgress = !0, this._patchState({ progress: e });
3443
+ },
3444
+ onProgressCollapsed: (e) => {
3445
+ this._patchState({ progressCollapsed: e });
3446
+ },
3447
+ onMessageUpdate: (e) => {
3448
+ this._inflightMessage = e, this._upsertMessage(e), this._patchState({ inflightMessage: { ...e } });
3449
+ },
3450
+ getConversationId: () => this._state.conversationId,
3451
+ onStep: (e) => {
3452
+ this._emit("onStep", e);
3453
+ },
3454
+ onComplete: (e) => {
3455
+ this._emit("onComplete", e);
3456
+ }
3457
+ };
3458
+ }
3459
+ _setConversationId(e) {
3460
+ this._config = {
3461
+ ...this._config,
3462
+ conversationId: e
3463
+ }, this._patchState({ conversationId: e }), this._emit("onConversationIdChange", e);
3464
+ }
3465
+ _upsertMessage(e) {
3466
+ let t = this._state.messages.findIndex((t) => t.id === e.id);
3467
+ if (t === -1) {
3468
+ this._patchState({ messages: [...this._state.messages, { ...e }] });
3469
+ return;
3470
+ }
3471
+ let n = this._state.messages.map((n, r) => r === t ? { ...e } : n);
3472
+ this._patchState({ messages: n });
3473
+ }
3474
+ _finalizeInflightMessage() {
3475
+ 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({
3476
+ progress: null,
3477
+ progressCollapsed: !1,
3478
+ inflightMessage: null
3479
+ }));
3480
+ }
3481
+ _removeInflightFromMessages() {
3482
+ this._inflightMessage && this._patchState({ messages: this._state.messages.filter((e) => e.id !== this._inflightMessage.id) });
3483
+ }
3484
+ _markInflightCancelled(e) {
3485
+ this._inflightMessage && (this._inflightMessage.message = e ?? o("Response cancelled.", { desc: "Placeholder shown in ai chat where the assistant reply would appear when the user stops an in-flight response" }), this._inflightMessage.isCancelled = !0, this._inflightMessage.hasChart = !1, delete this._inflightMessage.progress, delete this._inflightMessage.elicitation, this._upsertMessage(this._inflightMessage), this._inflightMessage = null, this._receivedProgress = !1, this._patchState({ inflightMessage: null }));
3486
+ }
3487
+ _discardInflightMessage() {
3488
+ let e = !!(this._inflightMessage || this._state.inflightMessage);
3489
+ this._removeInflightFromMessages(), this._inflightMessage = null, this._receivedProgress = !1, e && this._patchState({ inflightMessage: null });
3490
+ }
3491
+ _handleSubmitError(e, t, n) {
3492
+ t.message = o("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, delete t.elicitation, this._inflightMessage = t, this._upsertMessage(t), this._patchState({
3493
+ inflightMessage: { ...t },
3494
+ progress: null,
3495
+ progressCollapsed: !1
3496
+ }), this._emit("onComplete", {
3497
+ agent: n,
3498
+ conversationId: this._state.conversationId,
3499
+ message: t,
3500
+ error: e
3501
+ });
3502
+ }
3503
+ _hasCallback(e) {
3504
+ return typeof this._hostCallbacks[e] == "function" || typeof this._uiBridgeCallbacks[e] == "function";
3505
+ }
3506
+ _emit(e, ...t) {
3507
+ this._invokeCallback(e, ...t);
3508
+ }
3509
+ async _invokeCallback(e, ...t) {
3510
+ let n = this._hostCallbacks[e], r = this._uiBridgeCallbacks[e];
3511
+ typeof n == "function" && await n(...t), typeof r == "function" && await r(...t);
3512
+ }
3513
+ _patchState(e) {
3514
+ this._state = {
3515
+ ...this._state,
3516
+ ...e
3517
+ }, this._emit("onStateChange", this._state), this._notifySubscribers();
3518
+ }
3519
+ _notifySubscribers() {
3520
+ for (let e of this._subscribers) e(this._state);
3521
+ }
3522
+ _areSelectedDatasetsEqual(e, t) {
3523
+ return e.length === t.length && e.every((e, n) => e.id === t[n]?.id);
3524
+ }
3525
+ _areChatMessagesEqual(e, t) {
3526
+ return e.length === t.length && e.every((e, n) => {
3527
+ let r = t[n];
3528
+ return e.id === r?.id && e.apiMessageId === r?.apiMessageId && e.type === r?.type && e.message === r?.message && e.isError === r?.isError && e.isCancelled === r?.isCancelled && e.hasChart === r?.hasChart && JSON.stringify(e.progress ?? null) === JSON.stringify(r?.progress ?? null) && JSON.stringify(e.actions ?? null) === JSON.stringify(r?.actions ?? null) && JSON.stringify(e.attachmentUrls ?? null) === JSON.stringify(r?.attachmentUrls ?? null) && JSON.stringify(e.elicitation ?? null) === JSON.stringify(r?.elicitation ?? null);
3529
+ });
3530
+ }
3531
+ };
3532
+ function ai(e, t) {
3533
+ return new ii(e, t);
3534
+ }
3535
+ //#endregion
3536
+ //#region src/components/ai-chat/session/ai-chat-session-controller.ts
3537
+ var oi = class {
3538
+ constructor(e) {
3539
+ this.options = e, this._session = null, this._ownsSession = !1, this._customItemFromProps = !1, this._seededFromProps = !1, this._unsubscribe = null;
3540
+ }
3541
+ get current() {
3542
+ return this._session;
3543
+ }
3544
+ get state() {
3545
+ if (this._session) return this._session.state;
3546
+ let e = this.options.getSeed();
3547
+ return {
3548
+ messages: e.messages,
3549
+ selectedDatasets: e.selectedDatasets,
3550
+ isGenerating: !1,
3551
+ progress: null,
3552
+ progressCollapsed: !1,
3553
+ conversationId: e.conversationId,
3554
+ inflightMessage: null
3555
+ };
3556
+ }
3557
+ get ownsCurrentSession() {
3558
+ return this._ownsSession;
3559
+ }
3560
+ setSession(e) {
3561
+ if (!e) {
3562
+ this._clearSession();
3563
+ return;
3564
+ }
3565
+ this._ownsSession && this._session !== e && this._session?.abort(), this._ownsSession = !1, this._session = e, this._mergeHostElementConfig(e), this._wire(e);
3566
+ }
3567
+ syncProperties(e) {
3568
+ if (!e.has("chatSession")) {
3569
+ if (this._createSessionIfMissing(), this._session) {
3570
+ let t = this.options.getConfig();
3571
+ if (Object.keys(t).some((t) => e.has(t)) && (this._ownsSession ? this._session.updateConfig(t) : this._mergeHostElementConfig(this._session)), e.has("selectedDatasets") && this._ownsSession) {
3572
+ let e = this.options.getSeed().selectedDatasets, t = this._session.state.selectedDatasets;
3573
+ (e.length !== t.length || e.some((e, n) => e.id !== t[n]?.id)) && this._session.updateConfig({ selectedDatasets: e });
3574
+ }
3575
+ }
3576
+ (e.has("messages") || e.has("selectedDatasets")) && this._seedFromPropsOnce();
3577
+ }
3578
+ }
3579
+ requireSession() {
3580
+ return this._createSessionIfMissing(), this._ownsSession ? this._session.updateConfig(this.options.getConfig()) : this._session && this._mergeHostElementConfig(this._session), this._session;
3581
+ }
3582
+ _mergeHostElementConfig(e) {
3583
+ let t = this.options.getConfig(), n = {
3584
+ authKey: t.authKey,
3585
+ authToken: t.authToken,
3586
+ apiUrl: t.apiUrl,
3587
+ apiVersion: t.apiVersion,
3588
+ stream: t.stream,
3589
+ localeId: t.localeId,
3590
+ timezoneId: t.timezoneId,
3591
+ modelPreference: t.modelPreference,
3592
+ requireDataset: t.requireDataset,
3593
+ agent: t.agent
3594
+ };
3595
+ t.agentConfig !== void 0 && (n.agentConfig = t.agentConfig), t.task !== void 0 && (n.task = t.task), t.chart != null && (n.chart = t.chart), t.dashboard != null && (n.dashboard = t.dashboard), t.customItem != null && (this._customItemFromProps = !0), this._customItemFromProps && (n.customItem = t.customItem ?? null), t.currentScreenMode != null && (n.currentScreenMode = t.currentScreenMode), t.conversationId != null && (n.conversationId = t.conversationId), e.updateConfig(n);
3596
+ }
3597
+ connect() {
3598
+ this._session && this._wire(this._session);
3599
+ }
3600
+ teardown() {
3601
+ this._unwire(), this._ownsSession &&= (this._session?.abort(), this._session = null, !1), this._seededFromProps = !1;
3602
+ }
3603
+ _createSessionIfMissing() {
3604
+ if (this._session) return;
3605
+ let e = this.options.getSeed();
3606
+ this._session = ai({
3607
+ ...this.options.getConfig(),
3608
+ messages: e.messages.length > 0 ? [...e.messages] : void 0,
3609
+ selectedDatasets: e.selectedDatasets.length > 0 ? [...e.selectedDatasets] : void 0
3610
+ }), this._ownsSession = !0, this._seededFromProps = e.messages.length > 0 || e.selectedDatasets.length > 0, this._wire(this._session);
3611
+ }
3612
+ _clearSession() {
3613
+ this._unwire(), this._ownsSession && this._session?.abort(), this._session = null, this._ownsSession = !1;
3614
+ }
3615
+ _seedFromPropsOnce() {
3616
+ if (!this._ownsSession || this._seededFromProps) return;
3617
+ let e = this.requireSession(), t = this.options.getSeed(), n = {};
3618
+ 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);
3619
+ }
3620
+ _wire(e) {
3621
+ this._unwire(), e.setUiBridge(this.options.createDomBridge()), this._unsubscribe = e.subscribe(() => {
3622
+ this.options.onRenderNeeded();
3623
+ });
3624
+ }
3625
+ _unwire() {
3626
+ this._unsubscribe?.(), this._unsubscribe = null;
3627
+ }
3628
+ }, $ = class t extends i {
3629
+ constructor(...e) {
3630
+ super(...e), this.messages = [], this.selectedDatasets = [], this.placeholder = "Describe your change", this.disabled = !1, this.stoppable = !1, this.showAssistantContextMenu = !1, this.authKey = "", this.authToken = "", this.apiUrl = "https://api.luzmo.com", this.appServer = "https://app.luzmo.com", this.includePublicDatasets = !1, this.hideDatasetButton = !1, this.hideDatasetIcons = !1, this.disableDatasetModification = !1, this.hideSelectedDatasets = !1, this.hideAgents = !1, this.disableColumnMentions = !1, this.requireDataset = !1, this.allowImages = !1, this.allowVoiceInput = !1, this.acceptedFileTypes = [], this.agent = "item", this.task = "generate", this.modelPreference = "performance", this.chatSession = null, this.conversationId = null, this.chart = null, this.dashboard = null, this.customItem = null, this.timezoneId = "UTC", this.apiVersion = "0.1.0", this.stream = !0, this.loadingMessage = null, this.cancelledMessage = null, this.initialPrompt = null, this.emptyStateTitle = "", this.emptyStateSubtitle = "", this.emptyStateSuggestions = [], this._textareaValue = "", this._assistantMessageActionsSlotHasContent = !1, this._pendingAssistantMessageAction = null, this._shouldFocusAssistantMessageActionConfirm = !1, this._lastProcessedInitialPrompt = null, this._session = new oi({
3631
+ getConfig: () => this._buildSessionConfig(),
3632
+ getSeed: () => ({
3633
+ messages: this.messages,
3634
+ selectedDatasets: Array.isArray(this.selectedDatasets) ? this.selectedDatasets : [],
3635
+ conversationId: this.conversationId
3636
+ }),
3637
+ createDomBridge: () => this._createDomBridgeCallbacks(),
3638
+ onRenderNeeded: () => {
3639
+ this.requestUpdate(), this.updateComplete.then(() => this._scrollToBottom());
3640
+ }
3641
+ }), this._handleAssistantMessageActionsSlotChange = (e) => {
3642
+ let t = e.target.assignedElements({ flatten: !0 }).length > 0;
3643
+ this._setAssistantMessageActionsSlotHasContent(t);
3644
+ }, this._handleAssistantMessageActionConfirmKeydown = (e) => {
3645
+ e.key !== "Escape" || !this._pendingAssistantMessageAction || (e.preventDefault(), e.stopPropagation(), this._cancelAssistantMessageActionConfirm());
3646
+ };
3647
+ }
3648
+ static {
3649
+ this.styles = f(On);
3650
+ }
3651
+ static {
3652
+ this.tagName = "luzmo-ai-chat";
3653
+ }
3654
+ static {
3655
+ this.assistantMessageActionsSlot = "assistant-message-actions";
3656
+ }
3657
+ get flagOpendata() {
3658
+ return this.includePublicDatasets;
3659
+ }
3660
+ set flagOpendata(e) {
3661
+ this.includePublicDatasets = e;
3662
+ }
3663
+ get session() {
3664
+ return this._session.current;
3665
+ }
3666
+ _getRenderState() {
3667
+ return this._session.state;
3668
+ }
3669
+ _createDomBridgeCallbacks() {
3670
+ return {
3671
+ onMessageSent: (e, t) => {
3672
+ this.dispatchEvent(new CustomEvent("luzmo-message-sent", {
3673
+ detail: {
3674
+ message: e,
3675
+ selectedDatasets: t
3676
+ },
3677
+ bubbles: !0,
3678
+ composed: !0
3679
+ }));
3680
+ },
3681
+ onDatasetsChanged: (e) => {
3682
+ this.dispatchEvent(new CustomEvent("luzmo-datasets-changed", {
3683
+ detail: { selectedDatasets: e },
3684
+ bubbles: !0,
3685
+ composed: !0
3686
+ }));
3687
+ },
3688
+ onConversationIdChange: (e) => this._emitConversationIdChanged(e),
3689
+ onStep: (e) => {
3690
+ this.dispatchEvent(new CustomEvent("luzmo-step", {
3691
+ detail: e,
3692
+ bubbles: !0,
3693
+ composed: !0
3694
+ }));
3695
+ },
3696
+ onComplete: (e) => {
3697
+ this.dispatchEvent(new CustomEvent("luzmo-complete", {
3698
+ detail: e,
3699
+ bubbles: !0,
3700
+ composed: !0
3701
+ }));
3702
+ },
3703
+ onPromptStopped: () => {
3704
+ this.dispatchEvent(new CustomEvent("luzmo-stop", {
3705
+ bubbles: !0,
3706
+ composed: !0
3707
+ }));
3708
+ },
3709
+ ...typeof this.uploadAttachments == "function" ? { uploadAttachments: (e, t) => this.uploadAttachments(e, t) } : {}
3710
+ };
3711
+ }
3712
+ get _pickedAgentId() {
3713
+ if (!this.hideAgents) return this.shadowRoot?.querySelector("luzmo-ai-interaction-textarea")?.selectedAgent?.id;
3714
+ }
3715
+ get _resolvedAcceptedFileTypes() {
3716
+ return this.acceptedFileTypes.length > 0 ? this.acceptedFileTypes : this.allowImages ? [...e] : [];
3717
+ }
3718
+ _buildSessionConfig() {
3719
+ return {
3720
+ agent: this.agent,
3721
+ agentConfig: this.agentConfig,
3722
+ agentId: this.agentId,
3723
+ authKey: this.authKey,
3724
+ authToken: this.authToken,
3725
+ apiUrl: this.apiUrl,
3726
+ apiVersion: this.apiVersion,
3727
+ stream: this.stream,
3728
+ conversationId: this.conversationId,
3729
+ chart: this.chart,
3730
+ dashboard: this.dashboard,
3731
+ customItem: this.customItem,
3732
+ currentScreenMode: this.currentScreenMode,
3733
+ localeId: this.localeId,
3734
+ timezoneId: this.timezoneId,
3735
+ task: this.task,
3736
+ modelPreference: this.modelPreference,
3737
+ requireDataset: this.requireDataset
3738
+ };
3739
+ }
3740
+ _getAgentConfig() {
3741
+ let e = this._session.current?.agentConfig;
3742
+ return this.agentConfig === void 0 && this.chatSession && e ? e : kn(this._buildSessionConfig(), e);
3743
+ }
3744
+ _emitConversationIdChanged(e) {
3745
+ this.conversationId = e, this.dispatchEvent(new CustomEvent("luzmo-conversation-id-changed", {
3746
+ detail: { conversationId: e },
3747
+ bubbles: !0,
3748
+ composed: !0
3749
+ }));
3750
+ }
3751
+ async _restoreViaSession(e, t) {
3752
+ await this._session.requireSession().restore({
3753
+ restoreToMessageId: e,
3754
+ messageIndex: t
3755
+ });
3756
+ }
3757
+ async _handleRestoreState(e, t) {
3758
+ if (e.apiMessageId && this._getAgentConfig().type === "item") try {
3759
+ await this._restoreViaSession(e.apiMessageId, t);
3760
+ } catch (e) {
3761
+ console.error("AI restore error:", e);
3762
+ }
3763
+ }
3764
+ _handleDatasetSelected(e) {
3765
+ this._session.requireSession().addDataset(e.detail);
3766
+ }
3767
+ _handleDatasetRemoved(e) {
3768
+ this._session.requireSession().removeDataset(e.detail.id);
3769
+ }
3770
+ _handleAgentSelected() {
3771
+ this._processInitialPrompt();
3772
+ }
3773
+ async _submitViaSession(e, t = {}) {
3774
+ let n = this._session.requireSession();
3775
+ if (!n.isDatasetRequirementMet(t.agentId)) return !1;
3776
+ this._textareaValue = "";
3777
+ try {
3778
+ return await n.submit({
3779
+ prompt: e,
3780
+ ...t
3781
+ }), !0;
3782
+ } catch (e) {
3783
+ return e.name !== "AbortError" && console.error("AI prompt session error:", e), !1;
3784
+ }
3785
+ }
3786
+ async _handlePromptSubmitted(e) {
3787
+ let t = e.detail.prompt;
3788
+ await this._submitViaSession(t, {
3789
+ ...e.detail.attachments?.length ? { attachments: e.detail.attachments } : {},
3790
+ ...e.detail.attachmentUrls?.length ? { attachmentUrls: e.detail.attachmentUrls } : {},
3791
+ ...e.detail.selectedAgent ? { agentId: e.detail.selectedAgent.id } : {}
3792
+ }) || (this._textareaValue = t);
3793
+ }
3794
+ _handlePromptStopped() {
3795
+ let e = this._session.current;
3796
+ if (this._textareaValue = "", e) {
3797
+ e.abort({
3798
+ notify: !0,
3799
+ cancelledMessage: this.cancelledMessage ?? void 0
3800
+ });
3801
+ return;
3802
+ }
3803
+ this.dispatchEvent(new CustomEvent("luzmo-stop", {
3804
+ bubbles: !0,
3805
+ composed: !0
3806
+ }));
3807
+ }
3808
+ async _handleEmptyStateSuggestionSelected(e) {
3809
+ let { prompt: t, selectedDatasets: n } = e.detail, r = this._session.requireSession();
3810
+ n?.length && r.setSelectedDatasets(n), await this._submitViaSession(t, { agentId: this._pickedAgentId });
3811
+ }
3812
+ async _processInitialPrompt() {
3813
+ if (!this.initialPrompt || this.initialPrompt === this._lastProcessedInitialPrompt) return;
3814
+ let e = this._pickedAgentId;
3815
+ this._session.requireSession().isDatasetRequirementMet(e) && (this._lastProcessedInitialPrompt = this.initialPrompt, await this._submitViaSession(this.initialPrompt, {
3816
+ skipUserMessage: !0,
3817
+ agentId: e
3818
+ }));
3819
+ }
3820
+ connectedCallback() {
3821
+ super.connectedCallback(), this._session.connect();
3822
+ }
3823
+ disconnectedCallback() {
3824
+ super.disconnectedCallback(), this._session.teardown();
3825
+ }
3826
+ _scrollToBottom() {
3827
+ let e = this.shadowRoot?.querySelector(".chat-messages-container");
3828
+ e && requestAnimationFrame(() => {
3829
+ requestAnimationFrame(() => {
3830
+ e.scrollTop = e.scrollHeight;
3831
+ });
3832
+ });
3833
+ }
3834
+ willUpdate(e) {
3835
+ super.willUpdate?.(e), this._syncPendingAssistantMessageAction();
3836
+ }
3837
+ updated(e) {
3838
+ super.updated?.(e), this._syncSession(e), this._handleInitialPromptChange(), e.has("uploadAttachments") && this._session.current?.setUiBridge(this._createDomBridgeCallbacks()), this.updateComplete.then(() => {
3839
+ this._syncAssistantMessageActionsVisibility(), this._focusPendingAssistantMessageActionConfirm();
3840
+ });
3841
+ }
3842
+ _syncSession(e) {
3843
+ if (e.has("chatSession")) {
3844
+ this._session.setSession(this.chatSession);
3845
+ return;
3846
+ }
3847
+ this._session.syncProperties(e);
3848
+ }
3849
+ _handleInitialPromptChange() {
3850
+ this.initialPrompt && this.initialPrompt !== this._lastProcessedInitialPrompt ? this._processInitialPrompt() : this.initialPrompt || (this._lastProcessedInitialPrompt = null);
3851
+ }
3852
+ _renderMarkdown(e) {
3853
+ let t = String(Z.parse(e, { async: !1 }));
3854
+ return _t.sanitize(t, {
3855
+ ALLOWED_TAGS: /* @__PURE__ */ "p.br.strong.em.b.i.u.s.code.pre.blockquote.hr.ul.ol.li.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.th.td.a".split("."),
3856
+ ALLOWED_ATTR: [
3857
+ "href",
3858
+ "title",
3859
+ "target",
3860
+ "rel"
3861
+ ],
3862
+ ALLOW_DATA_ATTR: !1,
3863
+ FORBID_TAGS: [
3864
+ "script",
3865
+ "style",
3866
+ "iframe",
3867
+ "object",
3868
+ "embed",
3869
+ "link",
3870
+ "form",
3871
+ "input",
3872
+ "button"
3873
+ ],
3874
+ FORBID_ATTR: [
3875
+ "onerror",
3876
+ "onload",
3877
+ "onclick",
3878
+ "onmouseover",
3879
+ "onfocus",
3880
+ "onblur"
3881
+ ]
3882
+ });
3883
+ }
3884
+ _renderProgress() {
3885
+ let { progress: e, progressCollapsed: t } = this._getRenderState();
3886
+ return e?.children?.length ? u`
3887
+ <luzmo-progress-steps
3888
+ .progress=${e}
3889
+ ?collapsed=${t}
3890
+ size="s"
3891
+ ></luzmo-progress-steps>
3892
+ ` : d;
3893
+ }
3894
+ _isLastAiMessageWithProgress(e, t) {
3895
+ 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;
3896
+ return !1;
3897
+ }
3898
+ _syncAssistantMessageActionsVisibility() {
3899
+ let e = ((this.shadowRoot?.querySelector(`slot[name="${t.assistantMessageActionsSlot}"]`) ?? null)?.assignedElements({ flatten: !0 }).length ?? 0) > 0;
3900
+ this._setAssistantMessageActionsSlotHasContent(e);
3901
+ }
3902
+ _setAssistantMessageActionsSlotHasContent(e) {
3903
+ e !== this._assistantMessageActionsSlotHasContent && (this._assistantMessageActionsSlotHasContent = e);
3904
+ }
3905
+ _isLatestAssistantMessage(e, t) {
3906
+ return !!(t && e === t);
3907
+ }
3908
+ _hasBuiltInAssistantMessageActions(e) {
3909
+ return (e.actions?.length ?? 0) > 0;
3910
+ }
3911
+ _assistantMessageActionsFooterHasContent(e, t) {
3912
+ return this._hasBuiltInAssistantMessageActions(e) || t && this._assistantMessageActionsSlotHasContent;
3913
+ }
3914
+ _syncPendingAssistantMessageAction() {
3915
+ let e = this._pendingAssistantMessageAction;
3916
+ if (!e) return;
3917
+ let { messages: t } = this._getRenderState(), n = t.find((t) => t.id === e.messageId), r = n?.actions?.find((t) => t.id === e.actionId);
3918
+ (!n || !r?.confirm) && (this._pendingAssistantMessageAction = null, this._shouldFocusAssistantMessageActionConfirm = !1);
3919
+ }
3920
+ _getDefaultAssistantMessageActionConfirmMessage() {
3921
+ return o("Are you sure?", { desc: "Default assistant message action confirmation prompt" });
3922
+ }
3923
+ _isAssistantMessageActionConfirming(e) {
3924
+ let t = this._pendingAssistantMessageAction, n = e.id;
3925
+ return !!(t && n && t.messageId === n);
3926
+ }
3927
+ _getPendingAssistantMessageAction(e) {
3928
+ let t = this._pendingAssistantMessageAction, n = e.id;
3929
+ if (!(!t || !n || t.messageId !== n)) return e.actions?.find((e) => e.id === t.actionId);
3930
+ }
3931
+ _handleAssistantMessageAction(e, t) {
3932
+ let n = e.id;
3933
+ n && this.dispatchEvent(new CustomEvent("luzmo-assistant-message-action", {
3934
+ detail: {
3935
+ messageId: n,
3936
+ actionId: t.id,
3937
+ message: e
3938
+ },
3939
+ bubbles: !0,
3940
+ composed: !0
3941
+ }));
3942
+ }
3943
+ _handleAssistantMessageActionClick(e, t) {
3944
+ let n = e.id;
3945
+ if (n) {
3946
+ if (t.confirm) {
3947
+ this._pendingAssistantMessageAction = {
3948
+ messageId: n,
3949
+ actionId: t.id
3950
+ }, this._shouldFocusAssistantMessageActionConfirm = !0;
3951
+ return;
3952
+ }
3953
+ this._handleAssistantMessageAction(e, t);
3954
+ }
3955
+ }
3956
+ _cancelAssistantMessageActionConfirm() {
3957
+ this._pendingAssistantMessageAction = null, this._shouldFocusAssistantMessageActionConfirm = !1;
3958
+ }
3959
+ _confirmAssistantMessageAction(e, t) {
3960
+ this._pendingAssistantMessageAction = null, this._shouldFocusAssistantMessageActionConfirm = !1, this._handleAssistantMessageAction(e, t);
3961
+ }
3962
+ _focusPendingAssistantMessageActionConfirm() {
3963
+ !this._shouldFocusAssistantMessageActionConfirm || !this._pendingAssistantMessageAction || (this._shouldFocusAssistantMessageActionConfirm = !1, (this.shadowRoot?.querySelector("luzmo-button.assistant-message-action-confirm-cancel"))?.focus?.());
3964
+ }
3965
+ _renderBuiltInAssistantMessageAction(e, t) {
3966
+ return u`
3967
+ <luzmo-button
3968
+ class="assistant-message-action"
3969
+ size="xs"
3970
+ variant="neutral"
3971
+ treatment="outline"
3972
+ ?disabled=${this.disabled || t.disabled || !e.id}
3973
+ @click=${() => this._handleAssistantMessageActionClick(e, t)}
3974
+ >
3975
+ ${t.icon ? u`<luzmo-icon slot="icon" .icon=${t.icon} size="xs"></luzmo-icon>` : d}
3976
+ ${t.label}
3977
+ </luzmo-button>
3978
+ `;
3979
+ }
3980
+ _renderAssistantMessageActionConfirm(e) {
3981
+ let t = this._getPendingAssistantMessageAction(e);
3982
+ if (!t) return d;
3983
+ let n = t.confirmMessage ?? this._getDefaultAssistantMessageActionConfirmMessage(), r = this.disabled || t.disabled || !e.id;
3984
+ return u`
3985
+ <span class="assistant-message-action-confirm-message" role="status" aria-live="polite">${n}</span>
3986
+ <div class="assistant-message-action-confirm-controls">
3987
+ <luzmo-button
3988
+ class="assistant-message-action-confirm-cancel"
3989
+ size="xs"
3990
+ variant="neutral"
3991
+ treatment="outline"
3992
+ ?disabled=${this.disabled}
3993
+ @click=${this._cancelAssistantMessageActionConfirm}
3994
+ >
3995
+ ${o("Cancel", { desc: "Cancel assistant message action confirmation" })}
3996
+ </luzmo-button>
3997
+ <luzmo-button
3998
+ class="assistant-message-action-confirm-confirm"
3999
+ size="xs"
4000
+ variant=${t.confirmVariant ?? "negative"}
4001
+ ?disabled=${r}
4002
+ @click=${() => this._confirmAssistantMessageAction(e, t)}
4003
+ >
4004
+ ${t.label}
4005
+ </luzmo-button>
4006
+ </div>
4007
+ `;
4008
+ }
4009
+ _renderAssistantMessageActions(e, n) {
4010
+ let r = e.actions ?? [], i = r.length > 0, a = this._isLatestAssistantMessage(e, n), o = this._isAssistantMessageActionConfirming(e);
4011
+ return !i && !a ? d : u`
4012
+ <div
4013
+ class="assistant-message-actions ${this._assistantMessageActionsFooterHasContent(e, a) ? "assistant-message-actions--has-content" : ""} ${o ? "assistant-message-actions--confirming" : ""}"
4014
+ @keydown=${o ? this._handleAssistantMessageActionConfirmKeydown : d}
4015
+ >
4016
+ ${o ? this._renderAssistantMessageActionConfirm(e) : u`
4017
+ ${r.map((t) => this._renderBuiltInAssistantMessageAction(e, t))}
4018
+ ${a ? u`
4019
+ <slot
4020
+ name=${t.assistantMessageActionsSlot}
4021
+ @slotchange=${this._handleAssistantMessageActionsSlotChange}
4022
+ ></slot>
4023
+ ` : d}
4024
+ `}
4025
+ </div>
4026
+ `;
4027
+ }
4028
+ _renderRestoreMenu(e, t, n, r = !1) {
4029
+ if (!(this._getAgentConfig().type === "item" && this.showAssistantContextMenu && e.hasChart && e.apiMessageId && !e.isError && e.id !== n)) return d;
4030
+ let i = `context-menu-trigger-${e.apiMessageId}`;
4031
+ return u`
4032
+ <div class="assistant-context-menu">
4033
+ <button
4034
+ id=${i}
4035
+ class="assistant-context-menu-trigger"
4036
+ type="button"
4037
+ aria-label=${o("Open restore menu", { desc: "Accessible label for the ai chat restore menu trigger" })}
4038
+ aria-haspopup="menu"
4039
+ ?disabled=${r}
4040
+ >
4041
+ ${c(s)}
4042
+ </button>
4043
+ <luzmo-overlay
4044
+ trigger="${i}@click"
4045
+ placement="bottom-end"
4046
+ >
4047
+ <luzmo-popover>
4048
+ <button
4049
+ class="assistant-context-menu-item"
4050
+ type="button"
4051
+ ?disabled=${r}
4052
+ @click=${() => this._handleRestoreState(e, t)}
4053
+ >
4054
+ ${o("Restore state", { desc: "Context menu action that restores the chart to this message state" })}
4055
+ </button>
4056
+ </luzmo-popover>
4057
+ </luzmo-overlay>
4058
+ </div>
4059
+ `;
4060
+ }
4061
+ _renderMessages() {
4062
+ let { messages: e, inflightMessage: t, isGenerating: n } = this._getRenderState(), r = t !== null, i = e.filter((e) => !t || e.id !== t.id), a = [...i].reverse().find((e) => e.type === "ai"), s = a?.id;
4063
+ return i.map((t) => {
4064
+ let c = !!t.progress?.children?.length, l = c && this._isLastAiMessageWithProgress(t, i), f = c && (r || n || !l), p = c ? u`
4065
+ <luzmo-progress-steps
4066
+ .progress=${t.progress}
4067
+ ?condensed=${f}
4068
+ collapsed
4069
+ no-animate
4070
+ size="s"
4071
+ ></luzmo-progress-steps>
4072
+ ` : d;
4073
+ if (t.type === "user") {
4074
+ let e = t.attachmentUrls ?? [];
4075
+ return u`
4076
+ <luzmo-chat-message
4077
+ avatar-placement="bottom"
4078
+ position="right"
4079
+ variant="primary"
4080
+ size="s"
4081
+ >
4082
+ <div class="user-message-content">
4083
+ ${e.length > 0 ? u`
4084
+ <div class="user-message-attachments">
4085
+ ${e.map((e) => u`
4086
+ <img
4087
+ class="user-message-attachment"
4088
+ src=${e}
4089
+ alt=${o("Attached image", { desc: "Accessible label for an image attached to a user chat message" })}
4090
+ width="64"
4091
+ height="64"
4092
+ />
4093
+ `)}
4094
+ </div>
4095
+ ` : d}
4096
+ <div class="user-message-text">${t.message}</div>
4097
+ </div>
4098
+ </luzmo-chat-message>
4099
+ `;
4100
+ }
4101
+ let m = e.indexOf(t), h = t.isError ? "error" : t.isCancelled ? "cancelled" : "", te = !!t.elicitation && (!t.message.trim() || t.message.trim() === t.elicitation?.question), ne = t.isCancelled ? t.message : te ? d : u`<div class="markdown-content">${ee(this._renderMarkdown(t.message))}</div>`;
4102
+ return u`
4103
+ ${p}
4104
+ <div class="assistant-message-wrapper">
4105
+ <div class="assistant-message-body">
4106
+ <luzmo-chat-message
4107
+ class=${h}
4108
+ role=${t.isError ? "alert" : d}
4109
+ avatar-placement="bottom"
4110
+ position="left"
4111
+ quiet
4112
+ size="s"
4113
+ >
4114
+ ${ne}
4115
+ ${Ln({
4116
+ message: t,
4117
+ state: t.elicitation?.answer ? "answered" : t.id && t === i.at(-1) && !n && !this.disabled ? "open" : "closed",
4118
+ onSubmit: (e) => this._handleElicitationSubmit(t, e)
4119
+ })}
4120
+ </luzmo-chat-message>
4121
+
4122
+ ${this._renderRestoreMenu(t, m, s, r)}
4123
+ </div>
4124
+
4125
+ ${this._renderAssistantMessageActions(t, a)}
4126
+ </div>
4127
+ `;
4128
+ });
4129
+ }
4130
+ async _handleElicitationSubmit(e, t) {
4131
+ t.stopPropagation();
4132
+ let n = t.currentTarget, r = n.parentElement, i = Fn(t.detail), a = !1;
4133
+ if (e.id && i) try {
4134
+ let t = this._session.requireSession().answerElicitation(e.id, i, { agentId: this._pickedAgentId });
4135
+ await this.updateComplete;
4136
+ let n = r?.querySelector("luzmo-question-box[readonly]");
4137
+ await n?.updateComplete, n?.focus(), a = await t;
4138
+ } catch (e) {
4139
+ e.name !== "AbortError" && console.error("AI prompt session error:", e);
4140
+ }
4141
+ a || (n.reset(), await n.updateComplete, n.focus());
4142
+ }
4143
+ _renderStreamingResponse() {
4144
+ let { inflightMessage: e } = this._getRenderState();
4145
+ return e?.message ? u`
4146
+ <luzmo-chat-message
4147
+ avatar-placement="bottom"
4148
+ position="left"
4149
+ quiet
4150
+ size="s"
4151
+ >
4152
+ <div class="markdown-content">${ee(this._renderMarkdown(e.message))}</div>
4153
+ </luzmo-chat-message>
4154
+ ` : d;
4155
+ }
4156
+ _renderLoadingMessage() {
4157
+ let { isGenerating: e, progress: t, inflightMessage: n } = this._getRenderState();
4158
+ if (!e || t?.children?.length || n?.message) return d;
4159
+ let r = this._getAgentConfig(), i = An(r), a = r.type === "dashboard" ? !i.dashboard : i.chart?.type === "placeholder", s = r.type === "dashboard" ? a ? o("Creating dashboard...", { desc: "Label for ai chat creating dashboard message" }) : o("Updating dashboard...", { desc: "Label for ai chat updating dashboard message" }) : a ? o("Creating item...", { desc: "Label for ai chat creating item message" }) : o("Updating item...", { desc: "Label for ai chat updating item message" });
4160
+ return u`
4161
+ <luzmo-chat-message
4162
+ avatar-placement="bottom"
4163
+ position="left"
4164
+ quiet
4165
+ size="s"
4166
+ >
4167
+ <div class="loading-message" role="status" aria-live="polite">
4168
+ <span class="icon-lg">${c(l, { className: "spin" })}</span>
4169
+ <span class="loading-message-text">${this.loadingMessage || s}</span>
4170
+ </div>
4171
+ </luzmo-chat-message>
4172
+ `;
4173
+ }
4174
+ _renderEmptyState() {
4175
+ if (this._getRenderState().messages.length > 0) return d;
4176
+ let e = o("What can I help you with?", { desc: "Title for the AI chat empty state" }), t = this.emptyStateSuggestions.length > 0;
4177
+ return u`
4178
+ <luzmo-ai-chat-empty-state
4179
+ .title=${this.emptyStateTitle || e}
4180
+ .subtitle=${t ? this.emptyStateSubtitle : ""}
4181
+ .suggestions=${this.emptyStateSuggestions}
4182
+ ?disabled=${this.disabled || this._getRenderState().isGenerating}
4183
+ @luzmo-suggestion-selected=${this._handleEmptyStateSuggestionSelected}
4184
+ ></luzmo-ai-chat-empty-state>
4185
+ `;
4186
+ }
4187
+ render() {
4188
+ let { selectedDatasets: e, isGenerating: t } = this._getRenderState();
4189
+ return u`
4190
+ <div class="chat-container" role="region" aria-label=${o("AI Chat", { desc: "Accessible label for AI chat region" })}>
4191
+ <div class="chat-messages-container" role="log" aria-live="polite">
4192
+ ${this._renderEmptyState()}
4193
+ ${this._renderMessages()}
4194
+ ${this._renderProgress()}
4195
+ ${this._renderStreamingResponse()}
4196
+ ${this._renderLoadingMessage()}
4197
+ </div>
4198
+
4199
+ <luzmo-ai-interaction-textarea
4200
+ role="group"
4201
+ aria-label=${o("AI prompt input", { desc: "Accessible label for the ai chat prompt input area" })}
4202
+ .value=${this._textareaValue}
4203
+ .selectedDatasets=${e}
4204
+ .placeholder=${this.placeholder}
4205
+ ?disabled=${this.disabled}
4206
+ ?is-generating=${t}
4207
+ ?stoppable=${this.stoppable}
4208
+ ?hide-dataset-button=${this.hideDatasetButton}
4209
+ ?hide-dataset-icons=${this.hideDatasetIcons}
4210
+ ?disable-dataset-modification=${this.disableDatasetModification}
4211
+ ?hide-selected-datasets=${this.hideSelectedDatasets}
4212
+ ?hide-agents=${this.hideAgents}
4213
+ ?disable-column-mentions=${this.disableColumnMentions}
4214
+ ?require-dataset=${this.requireDataset}
4215
+ ?allow-images=${this.allowImages}
4216
+ ?allow-voice-input=${this.allowVoiceInput}
4217
+ .acceptedFileTypes=${this._resolvedAcceptedFileTypes}
4218
+ .uploadAttachments=${this.uploadAttachments}
4219
+ auth-key=${this.authKey}
4220
+ auth-token=${this.authToken}
4221
+ api-url=${this.apiUrl}
4222
+ api-version=${this.apiVersion}
4223
+ app-server=${this.appServer}
4224
+ ?include-public-datasets=${this.includePublicDatasets}
4225
+ @prompt-submitted=${this._handlePromptSubmitted}
4226
+ @prompt-stopped=${this._handlePromptStopped}
4227
+ @dataset-selected=${this._handleDatasetSelected}
4228
+ @dataset-removed=${this._handleDatasetRemoved}
4229
+ @luzmo-agent-selected=${this._handleAgentSelected}
4230
+ ></luzmo-ai-interaction-textarea>
4231
+ </div>
4232
+ `;
4233
+ }
4234
+ };
4235
+ a([p({ type: Array })], $.prototype, "messages", void 0), a([p({
4236
+ type: Array,
4237
+ attribute: "selected-datasets"
4238
+ })], $.prototype, "selectedDatasets", void 0), a([p({ type: String })], $.prototype, "placeholder", void 0), a([p({
4239
+ type: Boolean,
4240
+ reflect: !0
4241
+ })], $.prototype, "disabled", void 0), a([p({
4242
+ type: Boolean,
4243
+ reflect: !0
4244
+ })], $.prototype, "stoppable", void 0), a([p({
4245
+ type: Boolean,
4246
+ attribute: "show-assistant-context-menu"
4247
+ })], $.prototype, "showAssistantContextMenu", void 0), a([p({
4248
+ type: String,
4249
+ attribute: "auth-key"
4250
+ })], $.prototype, "authKey", void 0), a([p({
4251
+ type: String,
4252
+ attribute: "auth-token"
4253
+ })], $.prototype, "authToken", void 0), a([p({
4254
+ type: String,
4255
+ attribute: "api-url"
4256
+ })], $.prototype, "apiUrl", void 0), a([p({
4257
+ type: String,
4258
+ attribute: "app-server"
4259
+ })], $.prototype, "appServer", void 0), a([p({
4260
+ type: Boolean,
4261
+ reflect: !0,
4262
+ attribute: "include-public-datasets"
4263
+ })], $.prototype, "includePublicDatasets", void 0), a([p({
4264
+ type: Boolean,
4265
+ attribute: "flag-opendata"
4266
+ })], $.prototype, "flagOpendata", null), a([p({
4267
+ type: Boolean,
4268
+ attribute: "hide-dataset-button"
4269
+ })], $.prototype, "hideDatasetButton", void 0), a([p({
4270
+ type: Boolean,
4271
+ attribute: "hide-dataset-icons"
4272
+ })], $.prototype, "hideDatasetIcons", void 0), a([p({
4273
+ type: Boolean,
4274
+ attribute: "disable-dataset-modification"
4275
+ })], $.prototype, "disableDatasetModification", void 0), a([p({
4276
+ type: Boolean,
4277
+ attribute: "hide-selected-datasets"
4278
+ })], $.prototype, "hideSelectedDatasets", void 0), a([p({
4279
+ type: Boolean,
4280
+ reflect: !0,
4281
+ attribute: "hide-agents"
4282
+ })], $.prototype, "hideAgents", void 0), a([p({
4283
+ type: Boolean,
4284
+ attribute: "disable-column-mentions"
4285
+ })], $.prototype, "disableColumnMentions", void 0), a([p({
4286
+ type: Boolean,
4287
+ attribute: "require-dataset"
4288
+ })], $.prototype, "requireDataset", void 0), a([p({
4289
+ type: Boolean,
4290
+ reflect: !0,
4291
+ attribute: "allow-images"
4292
+ })], $.prototype, "allowImages", void 0), a([p({
4293
+ type: Boolean,
4294
+ reflect: !0,
4295
+ attribute: "allow-voice-input"
4296
+ })], $.prototype, "allowVoiceInput", void 0), a([p({
4297
+ type: Array,
4298
+ attribute: "accepted-file-types"
4299
+ })], $.prototype, "acceptedFileTypes", void 0), a([p({ attribute: !1 })], $.prototype, "uploadAttachments", void 0), a([p({ type: String })], $.prototype, "agent", void 0), a([p({ attribute: !1 })], $.prototype, "agentConfig", void 0), a([p({
4300
+ type: String,
4301
+ attribute: "agent-id"
4302
+ })], $.prototype, "agentId", void 0), a([p({ type: String })], $.prototype, "task", void 0), a([p({
4303
+ type: String,
4304
+ attribute: "model-preference"
4305
+ })], $.prototype, "modelPreference", void 0), a([p({ attribute: !1 })], $.prototype, "chatSession", void 0), a([p({
4306
+ type: String,
4307
+ attribute: "conversation-id"
4308
+ })], $.prototype, "conversationId", void 0), a([p({
4309
+ type: Object,
4310
+ attribute: "chart"
4311
+ })], $.prototype, "chart", void 0), a([p({ type: Object })], $.prototype, "dashboard", void 0), a([p({ attribute: !1 })], $.prototype, "customItem", void 0), a([p({
4312
+ type: String,
4313
+ attribute: "current-screen-mode"
4314
+ })], $.prototype, "currentScreenMode", void 0), a([p({
4315
+ type: String,
4316
+ attribute: "locale-id"
4317
+ })], $.prototype, "localeId", void 0), a([p({
4318
+ type: String,
4319
+ attribute: "timezone-id"
4320
+ })], $.prototype, "timezoneId", void 0), a([p({
4321
+ type: String,
4322
+ attribute: "api-version"
4323
+ })], $.prototype, "apiVersion", void 0), a([p({ converter: { fromAttribute: (e) => e !== "false" && e !== null } })], $.prototype, "stream", void 0), a([p({
4324
+ type: String,
4325
+ attribute: "loading-message"
4326
+ })], $.prototype, "loadingMessage", void 0), a([p({
4327
+ type: String,
4328
+ attribute: "cancelled-message"
4329
+ })], $.prototype, "cancelledMessage", void 0), a([p({
4330
+ type: String,
4331
+ attribute: "initial-prompt"
4332
+ })], $.prototype, "initialPrompt", void 0), a([p({
4333
+ type: String,
4334
+ attribute: "empty-state-title"
4335
+ })], $.prototype, "emptyStateTitle", void 0), a([p({
4336
+ type: String,
4337
+ attribute: "empty-state-subtitle"
4338
+ })], $.prototype, "emptyStateSubtitle", void 0), a([p({
4339
+ type: Array,
4340
+ attribute: !1
4341
+ })], $.prototype, "emptyStateSuggestions", void 0), a([m()], $.prototype, "_textareaValue", void 0), a([m()], $.prototype, "_assistantMessageActionsSlotHasContent", void 0), a([m()], $.prototype, "_pendingAssistantMessageAction", void 0);
4342
+ //#endregion
4343
+ //#region src/components/ai-chat/ai-chat-events.ts
4344
+ function si(e) {
4345
+ return e.recognized === !0;
4346
+ }
4347
+ //#endregion
4348
+ //#region src/components/ai-chat/index.ts
4349
+ customElements.get("luzmo-ai-chat") || customElements.define("luzmo-ai-chat", $);
4350
+ //#endregion
4351
+ export { Un as C, Mn as D, Rn as E, Wn as S, zn as T, Xn as _, ai as a, Gn as b, ei as c, pr as d, tr as f, er as g, Qn as h, ii as i, $r as l, Zn as m, $ as n, ni as o, nr as p, oi as r, ti as s, si as t, lr as u, Jn as v, qn as w, Kn as x, Yn as y };