@luzmo/analytics-components-kit 1.0.3-beta.12 → 1.0.3-beta.14
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.
- package/components/ai-chat/ai-chat.d.ts +19 -6
- package/components/ai-chat/empty-state/ai-chat-empty-state.d.ts +3 -3
- package/components/ai-chat/index.cjs +1 -1
- package/components/ai-chat/index.js +2 -2
- package/components/ai-chat-B0pW6kHf.js +3670 -0
- package/components/ai-chat-BMsg63kL.cjs +245 -0
- package/components/ai-interaction-textarea/ai-interaction-textarea.d.ts +2 -2
- package/components/ai-interaction-textarea/index.cjs +1 -1
- package/components/ai-interaction-textarea/index.js +2 -2
- package/components/{ai-interaction-textarea-BK25Gh9y.cjs → ai-interaction-textarea-BdwiRaLH.cjs} +1 -1
- package/components/{ai-interaction-textarea-KVfak9dJ.js → ai-interaction-textarea-BrIlb9n1.js} +3 -3
- package/components/{area-chart-positioning.config-CluRgySg.cjs → area-chart-positioning.config-Clvr_Aan.cjs} +1 -1
- package/components/{area-chart-positioning.config-BQ3W781c.js → area-chart-positioning.config-CuPvdTc_.js} +1 -1
- package/components/{bar-chart-positioning.config-bjKRYhyf.js → bar-chart-positioning.config-CqOU-wdj.js} +1 -1
- package/components/{bar-chart-positioning.config-DWoRFpau.cjs → bar-chart-positioning.config-Crwcy-yr.cjs} +1 -1
- package/components/{base-Cz8X1AUZ.js → base-BwKUauGs.js} +1 -1
- package/components/{base-CHERUz8a.cjs → base-ZuhO2UZd.cjs} +1 -1
- package/components/{box-plot-positioning.config-BkbkePNB.cjs → box-plot-positioning.config-Buxfxl5u.cjs} +1 -1
- package/components/{box-plot-positioning.config-D1L4YnVo.js → box-plot-positioning.config-CJi0zuFg.js} +1 -1
- package/components/{bubble-chart-positioning.config-sr_USUKd.js → bubble-chart-positioning.config-3iE4D0XL.js} +1 -1
- package/components/{bubble-chart-positioning.config-BmYsMt4g.cjs → bubble-chart-positioning.config-DpR9mwIF.cjs} +1 -1
- package/components/{bullet-chart-positioning.config-Bt0wTYY8.cjs → bullet-chart-positioning.config-4dG5YGWS.cjs} +1 -1
- package/components/{bullet-chart-positioning.config-ssxudOXU.js → bullet-chart-positioning.config-O7IS72VB.js} +1 -1
- package/components/{choropleth-map-positioning.config-BgCM0Nn0.cjs → choropleth-map-positioning.config-BvKjYfiU.cjs} +1 -1
- package/components/{choropleth-map-positioning.config-mLRtpeR3.js → choropleth-map-positioning.config-Dlqf-3-f.js} +1 -1
- package/components/{circle-pack-chart-positioning.config-BgCs5R92.cjs → circle-pack-chart-positioning.config-B6_Onx6i.cjs} +1 -1
- package/components/{circle-pack-chart-positioning.config-Bn4sFin7.js → circle-pack-chart-positioning.config-DNpMU7Z-.js} +1 -1
- package/components/{circular-gauge-positioning.config-Cy5CjLIk.cjs → circular-gauge-positioning.config-CX0pSRGc.cjs} +1 -1
- package/components/{circular-gauge-positioning.config-D2U5NmLq.js → circular-gauge-positioning.config-DMHwidbv.js} +1 -1
- package/components/{column-chart-positioning.config-b18vDVsz.cjs → column-chart-positioning.config-5K8NNZ1J.cjs} +1 -1
- package/components/{column-chart-positioning.config-iS4x5dCV.js → column-chart-positioning.config-CWqxK8FS.js} +1 -1
- package/components/{combination-chart-positioning.config-DaKmP7Kh.js → combination-chart-positioning.config-6Jw9GWdP.js} +1 -1
- package/components/{combination-chart-positioning.config-pT4a4ILl.cjs → combination-chart-positioning.config-BRU6ecRd.cjs} +1 -1
- package/components/{conditional-number-positioning.config-CPu4skJn.cjs → conditional-number-positioning.config-BnuBruTt.cjs} +1 -1
- package/components/{conditional-number-positioning.config-CtboUqkS.js → conditional-number-positioning.config-BpWa0OTR.js} +1 -1
- package/components/data-field/data-field.d.ts +7 -2
- package/components/data-field/index.cjs +1 -1
- package/components/data-field/index.js +2 -2
- package/components/{data-field-Dllzzk51.js → data-field-TXDuIrVY.js} +4 -4
- package/components/{data-field-CK5mg8ov.cjs → data-field-hLReNkXW.cjs} +1 -1
- package/components/data-field-level/data-field-level.d.ts +8 -2
- package/components/data-field-level/index.cjs +1 -1
- package/components/data-field-level/index.js +2 -2
- package/components/{data-field-level-DuMJGtLR.cjs → data-field-level-BsmyaMeC.cjs} +1 -1
- package/components/{data-field-level-oQY5cKmY.js → data-field-level-HHH9hMmb.js} +1 -1
- package/components/data-field-panel/data-field-panel.d.ts +2 -2
- package/components/data-field-panel/index.cjs +1 -1
- package/components/data-field-panel/index.js +2 -2
- package/components/{data-field-panel-vy8_v5PR.cjs → data-field-panel-DxbDbMKy.cjs} +1 -1
- package/components/{data-field-panel-26OP024i.js → data-field-panel-DyNtkiMX.js} +3 -3
- package/components/data-fields-select/data-fields-select.d.ts +2 -2
- package/components/data-fields-select/index.cjs +1 -1
- package/components/data-fields-select/index.js +2 -2
- package/components/{data-fields-select-BKDJq_se.js → data-fields-select-CPAUibFD.js} +2 -2
- package/components/{data-fields-select-BqO9U_fB.cjs → data-fields-select-tOKVkjkh.cjs} +1 -1
- package/components/dataset-icon/dataset-icon.d.ts +2 -2
- package/components/dataset-icon/index.js +1 -1
- package/components/dataset-selector-list/dataset-selector-list.d.ts +2 -2
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +2 -2
- package/components/{dataset-selector-list-C4w3pJAF.js → dataset-selector-list-B3pSpE_Y.js} +1 -1
- package/components/{dataset-selector-list-BX3hM0p5.cjs → dataset-selector-list-MO9cYlwk.cjs} +1 -1
- package/components/dataset-selector-row/dataset-selector-row.d.ts +2 -2
- package/components/dataset-selector-row/index.cjs +1 -1
- package/components/dataset-selector-row/index.js +2 -2
- package/components/{dataset-selector-row-C_epl89V.cjs → dataset-selector-row-BIuDsjRv.cjs} +1 -1
- package/components/{dataset-selector-row-63ER0c_P.js → dataset-selector-row-Dve-Xb5j.js} +1 -1
- package/components/de-CFeKdBZ_.cjs +20 -0
- package/components/de-bxx-Ya_Y.js +464 -0
- package/components/display-settings/display-settings.d.ts +4 -3
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +2 -2
- package/components/{display-settings-B2CNf_4m.js → display-settings-BtLYNbeD.js} +1 -1
- package/components/{display-settings-COST2fVX.cjs → display-settings-DNwcbq4m.cjs} +1 -1
- package/components/display-settings-binning/display-settings-binning.d.ts +2 -1
- package/components/display-settings-binning/index.cjs +1 -1
- package/components/display-settings-binning/index.js +2 -2
- package/components/{display-settings-binning-DlmnLcxO.js → display-settings-binning-6PvcJnfm.js} +2 -2
- package/components/{display-settings-binning-ByYez8lF.cjs → display-settings-binning-UqBDqKHg.cjs} +1 -1
- package/components/display-settings-datetime/display-settings-datetime.d.ts +3 -1
- package/components/display-settings-datetime/index.cjs +1 -1
- package/components/display-settings-datetime/index.js +2 -2
- package/components/{display-settings-datetime-psWGvnDN.cjs → display-settings-datetime-BHjfhUcN.cjs} +2 -2
- package/components/{display-settings-datetime-_Q5En-Id.js → display-settings-datetime-D7VTKM4O.js} +4 -4
- package/components/display-settings-grand-totals/display-settings-grand-totals.d.ts +1 -1
- package/components/display-settings-grand-totals/index.cjs +1 -1
- package/components/display-settings-grand-totals/index.js +2 -2
- package/components/{display-settings-grand-totals-B6U0qZsW.cjs → display-settings-grand-totals-Bg1bAe4Y.cjs} +1 -1
- package/components/{display-settings-grand-totals-BS4LAKpj.js → display-settings-grand-totals-N8z2xbbZ.js} +2 -2
- package/components/display-settings-numeric/display-settings-numeric.d.ts +1 -1
- package/components/display-settings-numeric/index.cjs +1 -1
- package/components/display-settings-numeric/index.js +2 -2
- package/components/{display-settings-numeric-BgjYHCkN.js → display-settings-numeric-BtXC1gPj.js} +12 -12
- package/components/{display-settings-numeric-BWdO2rGj.cjs → display-settings-numeric-D5hQU-sd.cjs} +1 -1
- package/components/display-settings-period-over-period/display-settings-period-over-period.d.ts +5 -3
- package/components/display-settings-period-over-period/index.cjs +1 -1
- package/components/display-settings-period-over-period/index.js +2 -2
- package/components/{display-settings-period-over-period-BEFyH0yI.js → display-settings-period-over-period-CSLfTV7e.js} +2 -2
- package/components/{display-settings-period-over-period-C3f23PVH.cjs → display-settings-period-over-period-DzSsF1nw.cjs} +1 -1
- package/components/{donut-chart-positioning.config-HfFYDF5j.cjs → donut-chart-positioning.config-BSb68HFR.cjs} +1 -1
- package/components/{donut-chart-positioning.config-0vaHRSc2.js → donut-chart-positioning.config-Dx3jt1n_.js} +1 -1
- package/components/es-DelFOUQS.js +464 -0
- package/components/es-fAEaQEhg.cjs +20 -0
- package/components/{evolution-number-positioning.config-ut9UHsCD.js → evolution-number-positioning.config-BA8aL9iJ.js} +1 -1
- package/components/{evolution-number-positioning.config-CEPjMM87.cjs → evolution-number-positioning.config-DQbhwiGv.cjs} +1 -1
- package/components/filter-expression-picker/filter-expression-picker.d.ts +2 -1
- package/components/filter-expression-picker/index.cjs +1 -1
- package/components/filter-expression-picker/index.js +2 -2
- package/components/{filter-expression-picker-C_LCUIow.js → filter-expression-picker-BlzebHtT.js} +1 -1
- package/components/{filter-expression-picker-CtfEW0z9.cjs → filter-expression-picker-Co7iUnwo.cjs} +1 -1
- package/components/filter-item/filter-item.d.ts +2 -1
- package/components/filter-item/index.cjs +1 -1
- package/components/filter-item/index.js +2 -2
- package/components/{filter-item-B8xgxpHy.js → filter-item-BIa9Y1TU.js} +4 -4
- package/components/{filter-item-DOBYOfTH.cjs → filter-item-DiuMzccR.cjs} +1 -1
- package/components/filter-parameter-picker/filter-parameter-picker.d.ts +1 -1
- package/components/filter-parameter-picker/index.js +1 -1
- package/components/filter-value-picker/filter-value-picker.d.ts +2 -1
- package/components/filter-value-picker/index.cjs +1 -1
- package/components/filter-value-picker/index.js +2 -2
- package/components/{filter-value-picker-DTlwSC__.cjs → filter-value-picker-BdsGUgBl.cjs} +1 -1
- package/components/{filter-value-picker-B8494YGt.js → filter-value-picker-DV4IRVag.js} +4 -4
- package/components/filter-value-picker-datetime/filter-value-picker-datetime.d.ts +2 -1
- package/components/filter-value-picker-datetime/index.cjs +1 -1
- package/components/filter-value-picker-datetime/index.js +2 -2
- package/components/{filter-value-picker-datetime-Ab0vZLuW.cjs → filter-value-picker-datetime-DvV2PR3B.cjs} +1 -1
- package/components/{filter-value-picker-datetime-C__dbLwJ.js → filter-value-picker-datetime-_EDhhzr_.js} +2 -2
- package/components/filter-value-picker-hierarchy/filter-value-picker-hierarchy.d.ts +2 -1
- package/components/filter-value-picker-hierarchy/index.cjs +1 -1
- package/components/filter-value-picker-hierarchy/index.js +2 -2
- package/components/{filter-value-picker-hierarchy-Dv5qF762.js → filter-value-picker-hierarchy-CgYAWQ-g.js} +2 -2
- package/components/{filter-value-picker-hierarchy-CQfDao3J.cjs → filter-value-picker-hierarchy-CqZXOE2D.cjs} +1 -1
- package/components/filter-value-picker-numeric/filter-value-picker-numeric.d.ts +2 -1
- package/components/filter-value-picker-numeric/index.cjs +1 -1
- package/components/filter-value-picker-numeric/index.js +2 -2
- package/components/{filter-value-picker-numeric-CPor-VLy.js → filter-value-picker-numeric-C4VF0Kot.js} +1 -1
- package/components/{filter-value-picker-numeric-DNCCxdwh.cjs → filter-value-picker-numeric-t24bCjgg.cjs} +1 -1
- package/components/filters/filters.d.ts +1 -1
- package/components/filters/index.cjs +1 -1
- package/components/filters/index.js +2 -2
- package/components/{filters-D1vuRGRC.cjs → filters-C10dtogk.cjs} +1 -1
- package/components/{filters-BymXxTXZ.js → filters-DJ9eq7Xq.js} +2 -2
- package/components/formula/formula.d.ts +5 -4
- package/components/formula/index.cjs +1 -1
- package/components/formula/index.js +2 -2
- package/components/{formula-BZuUMeUb.js → formula-BgvJ0GQ4.js} +2 -2
- package/components/{formula-u4CxsVki.cjs → formula-DHQae3tc.cjs} +1 -1
- package/components/formula-codemirror/formula-codemirror.d.ts +4 -4
- package/components/formula-codemirror/pills/formula-aggregation/formula-aggregation.d.ts +4 -4
- package/components/formula-codemirror/pills/formula-empty-argument-pill/formula-empty-argument-pill.d.ts +4 -4
- package/components/formula-codemirror/pills/formula-include-exclude-panel.d.ts +2 -2
- package/components/{formula-codemirror-p7ssM_dZ.cjs → formula-codemirror-BZTsmrYL.cjs} +3 -3
- package/components/{formula-codemirror-CYBD_5bC.js → formula-codemirror-iySUHkZq.js} +6 -6
- package/components/formula-display-store-CTXbAK2f.cjs +20 -0
- package/components/{formula-display-store-BtD83k2x.js → formula-display-store-CcBMayNE.js} +22 -19
- package/components/formula-draggable-field/formula-draggable-field.d.ts +2 -2
- package/components/formula-editor/formula-aggregations-list.d.ts +3 -3
- package/components/formula-editor/formula-datasets-list.d.ts +3 -3
- package/components/formula-editor/formula-description.d.ts +2 -2
- package/components/formula-editor/formula-editor.d.ts +3 -3
- package/components/formula-editor/formula-functions-list.d.ts +3 -3
- package/components/formula-editor/index.cjs +1 -1
- package/components/formula-editor/index.d.ts +3 -3
- package/components/formula-editor/index.js +4 -4
- package/components/{formula-editor-DfTDtGC4.cjs → formula-editor-L1af23DU.cjs} +2 -2
- package/components/{formula-editor-C1zz5pEL.js → formula-editor-YtSlmUwM.js} +9 -6
- package/components/formula-field/formula-field.d.ts +3 -3
- package/components/formula-field/index.cjs +1 -1
- package/components/formula-field/index.js +2 -2
- package/components/{formula-field-Dd1vnGZA.cjs → formula-field-CpKC6bbr.cjs} +1 -1
- package/components/{formula-field-B2TQe1Z_.js → formula-field-DdZ4ll8e.js} +1 -1
- package/components/{formula-input-base-B-Li9TP4.js → formula-input-base-B18f5b5l.js} +1 -1
- package/components/{formula-input-base-DjJ2Q4gu.cjs → formula-input-base-BlHhsmsp.cjs} +1 -1
- package/components/fr-5jK3qviC.cjs +20 -0
- package/components/fr-DjXcKdWm.js +464 -0
- package/components/{funnel-chart-positioning.config-D7Xlk3FE.js → funnel-chart-positioning.config-DtUWAc7T.js} +1 -1
- package/components/{funnel-chart-positioning.config-BrzmZ7am.cjs → funnel-chart-positioning.config-w2JdWOJK.cjs} +1 -1
- package/components/{get-dataset-name-CQ6DnC9l.cjs → get-dataset-name-CZU5eeyo.cjs} +1 -1
- package/components/{get-dataset-name-DqnY_mgB.js → get-dataset-name-gEWlDRD5.js} +1 -1
- package/components/{groupings-JilcSOEe.js → groupings-Txqk_wHs.js} +1 -1
- package/components/{groupings-BdNTQMKX.cjs → groupings-n-soRcZA.cjs} +1 -1
- package/components/{heat-map-positioning.config-I3Ug3uV1.cjs → heat-map-positioning.config-BCsBYI1C.cjs} +1 -1
- package/components/{heat-map-positioning.config-CRIig7j8.js → heat-map-positioning.config-DIQNlbm1.js} +1 -1
- package/components/{heat-table-positioning.config-ScLRznks.js → heat-table-positioning.config-B6OntYKu.js} +1 -1
- package/components/{heat-table-positioning.config-ovhEUbVq.cjs → heat-table-positioning.config-DKMu_7fQ.cjs} +1 -1
- package/components/{hexbin-map-positioning.config-kkKW5lhz.cjs → hexbin-map-positioning.config-BtxDUhio.cjs} +1 -1
- package/components/{hexbin-map-positioning.config-9QZqjbYe.js → hexbin-map-positioning.config-D9jHfncD.js} +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +52 -52
- package/components/item-grid/helpers/grid-item-popover.d.ts +1 -1
- package/components/item-grid/helpers/grid-rendering.d.ts +2 -2
- package/components/item-grid/index.cjs +1 -1
- package/components/item-grid/index.js +2 -2
- package/components/item-grid/item-grid-item-actions-menu.d.ts +2 -1
- package/components/item-grid/item-grid.d.ts +1 -1
- package/components/item-grid/types.d.ts +1 -1
- package/components/{item-grid-CN26hp77.cjs → item-grid-Hcahqw8V.cjs} +1 -1
- package/components/{item-grid-Cg2weB0_.js → item-grid-bjpi9sSB.js} +1 -1
- package/components/item-option/index.cjs +1 -1
- package/components/item-option/index.js +2 -2
- package/components/item-option/item-option.d.ts +11 -1
- package/components/{item-option-irtdsy-C.js → item-option-B7cG4nHM.js} +1 -1
- package/components/{item-option-BiYr_Mq6.cjs → item-option-CiMdtMdo.cjs} +1 -1
- package/components/item-option-action-button-group/index.cjs +1 -1
- package/components/item-option-action-button-group/index.js +2 -2
- package/components/item-option-action-button-group/item-option-action-button-group.d.ts +7 -2
- package/components/{item-option-action-button-group-Dx3xkGD_.cjs → item-option-action-button-group-BtS9Ho3y.cjs} +1 -1
- package/components/{item-option-action-button-group-Brzy-Bfe.js → item-option-action-button-group-CvT79MQj.js} +1 -1
- package/components/item-option-base/item-option-base.d.ts +1 -1
- package/components/{item-option-base-dBn9Kbg0.js → item-option-base-CWK-MoDz.js} +1 -1
- package/components/{item-option-base-Cv8StwBp.cjs → item-option-base-vrkMCFHF.cjs} +1 -1
- package/components/item-option-color-palette-picker/index.cjs +1 -1
- package/components/item-option-color-palette-picker/index.js +2 -2
- package/components/item-option-color-palette-picker/item-option-color-palette-picker.d.ts +2 -2
- package/components/{item-option-color-palette-picker-orXAN_x8.cjs → item-option-color-palette-picker-BlhO3Kri.cjs} +1 -1
- package/components/{item-option-color-palette-picker-dE6IJWsA.js → item-option-color-palette-picker-CbtgwN1J.js} +1 -1
- package/components/item-option-color-picker/index.cjs +1 -1
- package/components/item-option-color-picker/index.js +2 -2
- package/components/item-option-color-picker/item-option-color-picker.d.ts +10 -4
- package/components/{item-option-color-picker-BIe2BdWA.cjs → item-option-color-picker-C-D1vohW.cjs} +1 -1
- package/components/{item-option-color-picker-S0N7EfsT.js → item-option-color-picker-CccU9Lry.js} +1 -1
- package/components/item-option-color-range/index.cjs +1 -1
- package/components/item-option-color-range/index.js +2 -2
- package/components/item-option-color-range/item-option-color-range.d.ts +2 -2
- package/components/{item-option-color-range-CxUXZVKY.cjs → item-option-color-range-CbKK4m6t.cjs} +1 -1
- package/components/{item-option-color-range-n3UXaYBl.js → item-option-color-range-DwP4zb0q.js} +1 -1
- package/components/item-option-multi-language-field/index.cjs +1 -1
- package/components/item-option-multi-language-field/index.js +2 -2
- package/components/item-option-multi-language-field/item-option-multi-language-field.d.ts +10 -1
- package/components/{item-option-multi-language-field-DywcCJYW.js → item-option-multi-language-field-C71-iMVr.js} +1 -1
- package/components/{item-option-multi-language-field-DqHtYV3B.cjs → item-option-multi-language-field-CfPtLuVH.cjs} +1 -1
- package/components/item-option-number-field/index.cjs +1 -1
- package/components/item-option-number-field/index.js +2 -2
- package/components/item-option-number-field/item-option-number-field.d.ts +14 -1
- package/components/{item-option-number-field-Dk7HZ4qV.cjs → item-option-number-field-0XRgAD5B.cjs} +1 -1
- package/components/{item-option-number-field-CTCKepM3.js → item-option-number-field-CP8SMZMR.js} +1 -1
- package/components/item-option-panel/index.cjs +1 -1
- package/components/item-option-panel/index.js +2 -2
- package/components/item-option-panel/item-option-panel.d.ts +2 -2
- package/components/{item-option-panel-veSHsj_H.js → item-option-panel-BwYSwYSj.js} +2 -2
- package/components/{item-option-panel-D3FQZete.cjs → item-option-panel-JQ26EogB.cjs} +1 -1
- package/components/item-option-picker/index.cjs +1 -1
- package/components/item-option-picker/index.js +2 -2
- package/components/item-option-picker/item-option-picker.d.ts +9 -5
- package/components/{item-option-picker-BpJmk1Zt.cjs → item-option-picker-BJsgcTnE.cjs} +1 -1
- package/components/{item-option-picker-BMBG1JUf.js → item-option-picker-DIWqO_S7.js} +1 -1
- package/components/item-option-position-picker/index.cjs +1 -1
- package/components/item-option-position-picker/index.js +2 -2
- package/components/item-option-position-picker/item-option-position-picker.d.ts +5 -1
- package/components/{item-option-position-picker-CfSJvTYq.cjs → item-option-position-picker-BdT0UnEB.cjs} +1 -1
- package/components/{item-option-position-picker-Cla-sN0D.js → item-option-position-picker-DidnyN7_.js} +1 -1
- package/components/item-option-positions-number-field/index.cjs +1 -1
- package/components/item-option-positions-number-field/index.js +2 -2
- package/components/item-option-positions-number-field/item-option-positions-number-field.d.ts +11 -1
- package/components/{item-option-positions-number-field-92fppVXW.js → item-option-positions-number-field-B3ZRQ-GZ.js} +1 -1
- package/components/{item-option-positions-number-field-Dy_61Be2.cjs → item-option-positions-number-field-DPMVuUMn.cjs} +1 -1
- package/components/item-option-radio-button-group/index.cjs +1 -1
- package/components/item-option-radio-button-group/index.js +2 -2
- package/components/item-option-radio-button-group/item-option-radio-button-group.d.ts +9 -2
- package/components/{item-option-radio-button-group-maNKpXym.js → item-option-radio-button-group-BpAYKUcc.js} +1 -1
- package/components/{item-option-radio-button-group-CC_3O8pS.cjs → item-option-radio-button-group-D_tAaLOQ.cjs} +1 -1
- package/components/item-option-slider/index.cjs +1 -1
- package/components/item-option-slider/index.js +2 -2
- package/components/item-option-slider/item-option-slider.d.ts +9 -1
- package/components/{item-option-slider-DEWWO09h.js → item-option-slider-CQI88p3O.js} +1 -1
- package/components/{item-option-slider-VX1pqQ_8.cjs → item-option-slider-DQx3yabJ.cjs} +1 -1
- package/components/item-option-switch/index.cjs +1 -1
- package/components/item-option-switch/index.js +2 -2
- package/components/item-option-switch/item-option-switch.d.ts +5 -1
- package/components/{item-option-switch-BZaacV9H.cjs → item-option-switch-BZ9JDF_Q.cjs} +1 -1
- package/components/{item-option-switch-BUuGrKEd.js → item-option-switch-CZ00Bd-L.js} +1 -1
- package/components/item-option-text-field/index.cjs +1 -1
- package/components/item-option-text-field/index.js +2 -2
- package/components/item-option-text-field/item-option-text-field.d.ts +7 -1
- package/components/{item-option-text-field-Bq6wbGL6.cjs → item-option-text-field-BbxPFuHZ.cjs} +1 -1
- package/components/{item-option-text-field-t9b0Oh5Q.js → item-option-text-field-C8VTaY4N.js} +1 -1
- package/components/item-slot-drop/index.cjs +1 -1
- package/components/item-slot-drop/index.js +2 -2
- package/components/item-slot-drop/item-slot-drop.d.ts +12 -2
- package/components/{item-slot-drop-BAugbTP7.cjs → item-slot-drop-BhCP8AHW.cjs} +1 -1
- package/components/{item-slot-drop-Dk0qmzUO.js → item-slot-drop-C3R8PW1h.js} +4 -4
- package/components/item-slot-drop-panel/index.cjs +1 -1
- package/components/item-slot-drop-panel/index.js +2 -2
- package/components/item-slot-drop-panel/item-slot-drop-panel.d.ts +2 -2
- package/components/{item-slot-drop-panel-VPpjeFrw.cjs → item-slot-drop-panel-DF5odPJm.cjs} +1 -1
- package/components/{item-slot-drop-panel-C_UUROsO.js → item-slot-drop-panel-jKBmZxM0.js} +39 -39
- package/components/item-slot-picker/index.cjs +1 -1
- package/components/item-slot-picker/index.js +2 -2
- package/components/item-slot-picker/item-slot-picker.d.ts +3 -6
- package/components/{item-slot-picker-C0jGWuEH.js → item-slot-picker-CPz4v6dj.js} +5 -5
- package/components/{item-slot-picker-BMhGEWPB.cjs → item-slot-picker-DQJ-lnZM.cjs} +1 -1
- package/components/item-slot-picker-panel/index.cjs +1 -1
- package/components/item-slot-picker-panel/index.js +2 -2
- package/components/item-slot-picker-panel/item-slot-picker-panel.d.ts +2 -2
- package/components/{item-slot-picker-panel-DaSpTAdY.js → item-slot-picker-panel-CML1pMrC.js} +3 -3
- package/components/{item-slot-picker-panel-CNcTxMIr.cjs → item-slot-picker-panel-sdxrlk9Z.cjs} +1 -1
- package/components/{line-chart-positioning.config-guGEmG8P.cjs → line-chart-positioning.config-CIj2s14W.cjs} +1 -1
- package/components/{line-chart-positioning.config-RmlM3nO1.js → line-chart-positioning.config-DyWkf5Op.js} +1 -1
- package/components/{localized-mixin-D-vS5BnD.js → localized-mixin-BOaeCN9a.js} +1 -1
- package/components/{localized-mixin-2FpAMHwf.cjs → localized-mixin-BPOcHne5.cjs} +1 -1
- package/components/{marker-map-positioning.config-ClYn1SUX.js → marker-map-positioning.config-BlaqR84i.js} +1 -1
- package/components/{marker-map-positioning.config-HuFFsD3K.cjs → marker-map-positioning.config-DyPBnrcf.cjs} +1 -1
- package/components/nl-CnJ7GWFR.js +464 -0
- package/components/nl-DWGcdw3F.cjs +20 -0
- package/components/{ohlc-chart-positioning.config-CtZP5MS0.js → ohlc-chart-positioning.config-C1Ib-YRX.js} +1 -1
- package/components/{ohlc-chart-positioning.config-BPdr7Si5.cjs → ohlc-chart-positioning.config-nhYy7sdP.cjs} +1 -1
- package/components/{parallel-coordinates-plot-positioning.config-CA5h7KJv.cjs → parallel-coordinates-plot-positioning.config-B7iWes6n.cjs} +1 -1
- package/components/{parallel-coordinates-plot-positioning.config-BOZEluCJ.js → parallel-coordinates-plot-positioning.config-DzkH_hSg.js} +1 -1
- package/components/periods.const-Db0nXrwr.cjs +20 -0
- package/components/{periods.const-HrIWnjuj.js → periods.const-NCTkxnvG.js} +7 -7
- package/components/{pivot-table-positioning.config-04nWPY5F.cjs → pivot-table-positioning.config-BAeF1Wr5.cjs} +1 -1
- package/components/{pivot-table-positioning.config-BzR_GjPq.js → pivot-table-positioning.config-QmdQVsVL.js} +1 -1
- package/components/{pyramid-chart-positioning.config-BSHvolbF.cjs → pyramid-chart-positioning.config-Cwme_V9D.cjs} +1 -1
- package/components/{pyramid-chart-positioning.config-Dab07G57.js → pyramid-chart-positioning.config-n6MctfWS.js} +1 -1
- package/components/{radar-chart-positioning.config-Dot-ihEX.js → radar-chart-positioning.config-CK4dsAUh.js} +1 -1
- package/components/{radar-chart-positioning.config-lWNoL_ti.cjs → radar-chart-positioning.config-DKMjOOy9.cjs} +1 -1
- package/components/{route-map-positioning.config-CpyaFMpy.js → route-map-positioning.config-CwXaSsNt.js} +1 -1
- package/components/{route-map-positioning.config-BMBpp8hz.cjs → route-map-positioning.config-VnefcNLZ.cjs} +1 -1
- package/components/{sankey-diagram-positioning.config-uEZJdbL1.cjs → sankey-diagram-positioning.config-C8r1HXKi.cjs} +1 -1
- package/components/{sankey-diagram-positioning.config-B2qMdRR_.js → sankey-diagram-positioning.config-M7BTpPC-.js} +1 -1
- package/components/{scatter-plot-positioning.config-A15kkfVw.cjs → scatter-plot-positioning.config-CGlwev2w.cjs} +1 -1
- package/components/{scatter-plot-positioning.config-DuMse9Q0.js → scatter-plot-positioning.config-TW95PU_c.js} +1 -1
- package/components/{set-locale-jZiDepO3.cjs → set-locale-C67nRXJu.cjs} +1 -1
- package/components/{set-locale-Cs_8MmRC.js → set-locale-DA368j-c.js} +4 -4
- package/components/{slicer-filter-positioning.config-D5Y7aMbf.cjs → slicer-filter-positioning.config-B3HV3P5V.cjs} +1 -1
- package/components/{slicer-filter-positioning.config-YYnMg11W.js → slicer-filter-positioning.config-SW3t4sXb.js} +1 -1
- package/components/slot-menu/index.cjs +1 -1
- package/components/slot-menu/index.js +2 -2
- package/components/slot-menu/slot-menu.d.ts +14 -1
- package/components/slot-menu/types.d.ts +1 -1
- package/components/{slot-menu-B8Ea429p.cjs → slot-menu-BX_79i8j.cjs} +1 -1
- package/components/{slot-menu-CeLuEEBz.js → slot-menu-D5ZpNhRn.js} +3 -3
- package/components/slot-menu-list/index.cjs +1 -1
- package/components/slot-menu-list/index.js +2 -2
- package/components/slot-menu-list/slot-menu-list.d.ts +3 -1
- package/components/{slot-menu-list-IZWcfcmg.js → slot-menu-list--vSUiSqX.js} +1 -1
- package/components/{slot-menu-list-CWkK2C36.cjs → slot-menu-list-Fs6XHhqt.cjs} +1 -1
- package/components/{speedometer-chart-positioning.config-B7c-6ne3.cjs → speedometer-chart-positioning.config-CTgIInxK.cjs} +1 -1
- package/components/{speedometer-chart-positioning.config-DhlZ31Du.js → speedometer-chart-positioning.config-Cf7VkFvv.js} +1 -1
- package/components/{spike-map-positioning.config-Bx5e0pta.cjs → spike-map-positioning.config-BDWoRvI1.cjs} +1 -1
- package/components/{spike-map-positioning.config-DRTGpAGE.js → spike-map-positioning.config-tMMqD_L6.js} +1 -1
- package/components/{strip-plot-positioning.config-BsUrhFUU.cjs → strip-plot-positioning.config-CflwBF0n.cjs} +1 -1
- package/components/{strip-plot-positioning.config-BCq3Obcq.js → strip-plot-positioning.config-cyY2RoOQ.js} +1 -1
- package/components/{sunburst-chart-positioning.config-DsUpWjsv.cjs → sunburst-chart-positioning.config-BrkN0iSP.cjs} +1 -1
- package/components/{sunburst-chart-positioning.config-CEw-7DlR.js → sunburst-chart-positioning.config-CXqQ3rZw.js} +1 -1
- package/components/{symbol-map-positioning.config-F1KEG07X.cjs → symbol-map-positioning.config-B4yTOZ45.cjs} +1 -1
- package/components/{symbol-map-positioning.config-DukiOU1b.js → symbol-map-positioning.config-BhZjksQ9.js} +1 -1
- package/components/{treemap-chart-positioning.config-Dt_82T4Z.js → treemap-chart-positioning.config-BTOpuIyU.js} +1 -1
- package/components/{treemap-chart-positioning.config-ChJIaI2Y.cjs → treemap-chart-positioning.config-Cbu39jHd.cjs} +1 -1
- package/components/utils/base.cjs +1 -1
- package/components/utils/base.js +2 -2
- package/components/{utils-DA-SRzw2.cjs → utils-Ab_wibuA.cjs} +1 -1
- package/components/{utils-BJDK6vjC.js → utils-CO7Bx0Nw.js} +1 -1
- package/components/utils.cjs +1 -1
- package/components/utils.js +2 -2
- package/components/{venn-diagram-positioning.config-Bbbtw4NL.cjs → venn-diagram-positioning.config-G91Md8yt.cjs} +1 -1
- package/components/{venn-diagram-positioning.config-TNx0fkeZ.js → venn-diagram-positioning.config-xddK9cxF.js} +1 -1
- package/components/viz-item-menu/index.cjs +1 -1
- package/components/viz-item-menu/index.js +2 -2
- package/components/viz-item-menu/viz-item-menu.d.ts +2 -2
- package/components/{viz-item-menu-BAJGKail.cjs → viz-item-menu-B2pAY_Jv.cjs} +1 -1
- package/components/{viz-item-menu-B-fDL_91.js → viz-item-menu-D09pw6dZ.js} +1 -1
- package/components/{wordcloud-chart-positioning.config-BFiq-yn7.cjs → wordcloud-chart-positioning.config-DAYAximq.cjs} +1 -1
- package/components/{wordcloud-chart-positioning.config-DnNXKglL.js → wordcloud-chart-positioning.config-DjUW_gBa.js} +1 -1
- package/custom-elements.json +9909 -4701
- package/package.json +4 -3
- package/react/components/filter-expression-picker.component.ts +2 -0
- package/react/components/filter-item.component.ts +2 -0
- package/react/components/filter-value-picker-datetime.component.ts +2 -0
- package/react/components/filter-value-picker-hierarchy.component.ts +2 -0
- package/react/components/filter-value-picker-numeric.component.ts +2 -0
- package/react/components/filter-value-picker.component.ts +2 -0
- package/react/components/formula-editor.component.ts +5 -5
- package/react/components/formula-field.component.ts +5 -5
- package/react/components/formula.component.ts +6 -3
- package/react/components/item-slot-drop.component.ts +1 -0
- package/react/components/slot-menu.component.ts +1 -0
- package/react/esm/components/filter-expression-picker.component.d.ts +2 -0
- package/react/esm/components/filter-expression-picker.component.js +2 -0
- package/react/esm/components/filter-item.component.d.ts +2 -0
- package/react/esm/components/filter-item.component.js +2 -0
- package/react/esm/components/filter-value-picker-datetime.component.d.ts +2 -0
- package/react/esm/components/filter-value-picker-datetime.component.js +2 -0
- package/react/esm/components/filter-value-picker-hierarchy.component.d.ts +2 -0
- package/react/esm/components/filter-value-picker-hierarchy.component.js +2 -0
- package/react/esm/components/filter-value-picker-numeric.component.d.ts +2 -0
- package/react/esm/components/filter-value-picker-numeric.component.js +2 -0
- package/react/esm/components/filter-value-picker.component.d.ts +2 -0
- package/react/esm/components/filter-value-picker.component.js +2 -0
- package/react/esm/components/formula-editor.component.d.ts +3 -3
- package/react/esm/components/formula-field.component.d.ts +3 -3
- package/react/esm/components/formula.component.d.ts +4 -2
- package/react/esm/components/formula.component.js +2 -0
- package/react/esm/components/item-slot-drop.component.d.ts +1 -0
- package/react/esm/components/item-slot-drop.component.js +1 -0
- package/react/esm/components/slot-menu.component.d.ts +1 -0
- package/react/esm/components/slot-menu.component.js +1 -0
- package/react/luzmo-stub.d.ts +2 -5
- package/react/utils/base/base.d.ts +1 -1
- package/react/utils/base/focusable.d.ts +1 -1
- package/react/utils/base/localized-mixin.d.ts +1 -1
- package/react/utils/base/sized-mixin.d.ts +1 -1
- package/react/utils/formula/base/formula-base.d.ts +3 -3
- package/react/utils/formula/base/formula-input-base.d.ts +1 -1
- package/react/utils/formula/config/build-datasets.d.ts +2 -2
- package/react/utils/formula/render-explanation-tooltip.d.ts +1 -1
- package/react/utils/formula/store/formula-display-store.d.ts +1 -1
- package/react/utils/store/index.d.ts +5 -5
- package/react/utils/store/store-registry.d.ts +1 -1
- package/utils/base/base.d.ts +1 -1
- package/utils/base/focusable.d.ts +1 -1
- package/utils/base/localized-mixin.d.ts +1 -1
- package/utils/base/sized-mixin.d.ts +1 -1
- package/utils/formula/base/formula-base.d.ts +3 -3
- package/utils/formula/base/formula-input-base.d.ts +1 -1
- package/utils/formula/config/build-datasets.d.ts +2 -2
- package/utils/formula/render-explanation-tooltip.d.ts +1 -1
- package/utils/formula/store/formula-display-store.d.ts +1 -1
- package/utils/store/index.d.ts +5 -5
- package/utils/store/store-registry.d.ts +1 -1
- package/components/ai-chat-8O_eA0_D.cjs +0 -182
- package/components/ai-chat-BYlVFmdP.js +0 -2227
- package/components/de-CVvgeZTs.cjs +0 -20
- package/components/de-DVZUfIYZ.js +0 -462
- package/components/es-Bky9FlQy.cjs +0 -20
- package/components/es-DOdKwPbt.js +0 -462
- package/components/formula-display-store-_432SuSV.cjs +0 -20
- package/components/fr-BoQOc12J.cjs +0 -20
- package/components/fr-CFvQqjGj.js +0 -462
- package/components/nl-DWIG_M9v.cjs +0 -20
- package/components/nl-j7E4XtgO.js +0 -462
- package/components/periods.const-BZNdPqwm.cjs +0 -20
|
@@ -0,0 +1,3670 @@
|
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2026 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
|
7
|
+
* This license allows users with a current active Luzmo account
|
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
11
|
+
*
|
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
* SOFTWARE.
|
|
19
|
+
* */
|
|
20
|
+
import { i as e } from "./base-BwKUauGs.js";
|
|
21
|
+
import { t } from "./decorate-CaYbmmmm.js";
|
|
22
|
+
import "./ai-interaction-textarea-BrIlb9n1.js";
|
|
23
|
+
import { msg as n } from "@lit/localize/lit-localize";
|
|
24
|
+
import { luzmoEllipsisVertical as r, luzmoIcon as i, luzmoSpin as a } from "@luzmo/icons";
|
|
25
|
+
import "@luzmo/lucero/chat-message";
|
|
26
|
+
import "@luzmo/lucero/overlay";
|
|
27
|
+
import "@luzmo/lucero/popover";
|
|
28
|
+
import "@luzmo/lucero/progress-steps";
|
|
29
|
+
import { html as o, nothing as s, unsafeCSS as c } from "lit";
|
|
30
|
+
import { property as l, state as u } from "lit/decorators.js";
|
|
31
|
+
import { unsafeHTML as d } from "lit/directives/unsafe-html.js";
|
|
32
|
+
import "@luzmo/lucero/action-button";
|
|
33
|
+
//#region node_modules/dompurify/dist/purify.es.mjs
|
|
34
|
+
function ee(e, t) {
|
|
35
|
+
(t == null || t > e.length) && (t = e.length);
|
|
36
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
37
|
+
return r;
|
|
38
|
+
}
|
|
39
|
+
function te(e) {
|
|
40
|
+
if (Array.isArray(e)) return e;
|
|
41
|
+
}
|
|
42
|
+
function ne(e, t) {
|
|
43
|
+
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
44
|
+
if (n != null) {
|
|
45
|
+
var r, i, a, o, s = [], c = !0, l = !1;
|
|
46
|
+
try {
|
|
47
|
+
if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
l = !0, i = e;
|
|
50
|
+
} finally {
|
|
51
|
+
try {
|
|
52
|
+
if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
53
|
+
} finally {
|
|
54
|
+
if (l) throw i;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return s;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function re() {
|
|
61
|
+
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
62
|
+
}
|
|
63
|
+
function ie(e, t) {
|
|
64
|
+
return te(e) || ne(e, t) || ae(e, t) || re();
|
|
65
|
+
}
|
|
66
|
+
function ae(e, t) {
|
|
67
|
+
if (e) {
|
|
68
|
+
if (typeof e == "string") return ee(e, t);
|
|
69
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
70
|
+
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) ? ee(e, t) : void 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
var oe = Object.entries, se = Object.setPrototypeOf, f = Object.isFrozen, p = Object.getPrototypeOf, m = Object.getOwnPropertyDescriptor, h = Object.freeze, g = Object.seal, ce = Object.create, _ = typeof Reflect < "u" && Reflect, le = _.apply, ue = _.construct;
|
|
74
|
+
h ||= function(e) {
|
|
75
|
+
return e;
|
|
76
|
+
}, g ||= function(e) {
|
|
77
|
+
return e;
|
|
78
|
+
}, le ||= function(e, t) {
|
|
79
|
+
var n = [...arguments].slice(2);
|
|
80
|
+
return e.apply(t, n);
|
|
81
|
+
}, ue ||= function(e) {
|
|
82
|
+
return new e(...[...arguments].slice(1));
|
|
83
|
+
};
|
|
84
|
+
var de = x(Array.prototype.forEach), fe = x(Array.prototype.lastIndexOf), pe = x(Array.prototype.pop), me = x(Array.prototype.push), he = x(Array.prototype.splice), ge = Array.isArray, _e = x(String.prototype.toLowerCase), ve = x(String.prototype.toString), ye = x(String.prototype.match), be = x(String.prototype.replace), xe = x(String.prototype.indexOf), Se = x(String.prototype.trim), Ce = x(Number.prototype.toString), we = x(Boolean.prototype.toString), v = typeof BigInt > "u" ? null : x(BigInt.prototype.toString), Te = typeof Symbol > "u" ? null : x(Symbol.prototype.toString), y = x(Object.prototype.hasOwnProperty), Ee = x(Object.prototype.toString), b = x(RegExp.prototype.test), De = Oe(TypeError);
|
|
85
|
+
function x(e) {
|
|
86
|
+
return function(t) {
|
|
87
|
+
t instanceof RegExp && (t.lastIndex = 0);
|
|
88
|
+
var n = [...arguments].slice(1);
|
|
89
|
+
return le(e, t, n);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function Oe(e) {
|
|
93
|
+
return function() {
|
|
94
|
+
return ue(e, [...arguments]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function S(e, t) {
|
|
98
|
+
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _e;
|
|
99
|
+
if (se && se(e, null), !ge(t)) return e;
|
|
100
|
+
let r = t.length;
|
|
101
|
+
for (; r--;) {
|
|
102
|
+
let i = t[r];
|
|
103
|
+
if (typeof i == "string") {
|
|
104
|
+
let e = n(i);
|
|
105
|
+
e !== i && (f(t) || (t[r] = e), i = e);
|
|
106
|
+
}
|
|
107
|
+
e[i] = !0;
|
|
108
|
+
}
|
|
109
|
+
return e;
|
|
110
|
+
}
|
|
111
|
+
function ke(e) {
|
|
112
|
+
for (let t = 0; t < e.length; t++) y(e, t) || (e[t] = null);
|
|
113
|
+
return e;
|
|
114
|
+
}
|
|
115
|
+
function C(e) {
|
|
116
|
+
let t = ce(null);
|
|
117
|
+
for (let r of oe(e)) {
|
|
118
|
+
var n = ie(r, 2);
|
|
119
|
+
let i = n[0], a = n[1];
|
|
120
|
+
y(e, i) && (ge(a) ? t[i] = ke(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = C(a) : t[i] = a);
|
|
121
|
+
}
|
|
122
|
+
return t;
|
|
123
|
+
}
|
|
124
|
+
function Ae(e) {
|
|
125
|
+
switch (typeof e) {
|
|
126
|
+
case "string": return e;
|
|
127
|
+
case "number": return Ce(e);
|
|
128
|
+
case "boolean": return we(e);
|
|
129
|
+
case "bigint": return v ? v(e) : "0";
|
|
130
|
+
case "symbol": return Te ? Te(e) : "Symbol()";
|
|
131
|
+
case "undefined": return Ee(e);
|
|
132
|
+
case "function":
|
|
133
|
+
case "object": {
|
|
134
|
+
if (e === null) return Ee(e);
|
|
135
|
+
let t = e, n = w(t, "toString");
|
|
136
|
+
if (typeof n == "function") {
|
|
137
|
+
let e = n(t);
|
|
138
|
+
return typeof e == "string" ? e : Ee(e);
|
|
139
|
+
}
|
|
140
|
+
return Ee(e);
|
|
141
|
+
}
|
|
142
|
+
default: return Ee(e);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function w(e, t) {
|
|
146
|
+
for (; e !== null;) {
|
|
147
|
+
let n = m(e, t);
|
|
148
|
+
if (n) {
|
|
149
|
+
if (n.get) return x(n.get);
|
|
150
|
+
if (typeof n.value == "function") return x(n.value);
|
|
151
|
+
}
|
|
152
|
+
e = p(e);
|
|
153
|
+
}
|
|
154
|
+
function n() {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return n;
|
|
158
|
+
}
|
|
159
|
+
function je(e) {
|
|
160
|
+
try {
|
|
161
|
+
return b(e, ""), !0;
|
|
162
|
+
} catch {
|
|
163
|
+
return !1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
var Me = h(/* @__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(".")), Ne = h(/* @__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(".")), Pe = h([
|
|
167
|
+
"feBlend",
|
|
168
|
+
"feColorMatrix",
|
|
169
|
+
"feComponentTransfer",
|
|
170
|
+
"feComposite",
|
|
171
|
+
"feConvolveMatrix",
|
|
172
|
+
"feDiffuseLighting",
|
|
173
|
+
"feDisplacementMap",
|
|
174
|
+
"feDistantLight",
|
|
175
|
+
"feDropShadow",
|
|
176
|
+
"feFlood",
|
|
177
|
+
"feFuncA",
|
|
178
|
+
"feFuncB",
|
|
179
|
+
"feFuncG",
|
|
180
|
+
"feFuncR",
|
|
181
|
+
"feGaussianBlur",
|
|
182
|
+
"feImage",
|
|
183
|
+
"feMerge",
|
|
184
|
+
"feMergeNode",
|
|
185
|
+
"feMorphology",
|
|
186
|
+
"feOffset",
|
|
187
|
+
"fePointLight",
|
|
188
|
+
"feSpecularLighting",
|
|
189
|
+
"feSpotLight",
|
|
190
|
+
"feTile",
|
|
191
|
+
"feTurbulence"
|
|
192
|
+
]), Fe = h([
|
|
193
|
+
"animate",
|
|
194
|
+
"color-profile",
|
|
195
|
+
"cursor",
|
|
196
|
+
"discard",
|
|
197
|
+
"font-face",
|
|
198
|
+
"font-face-format",
|
|
199
|
+
"font-face-name",
|
|
200
|
+
"font-face-src",
|
|
201
|
+
"font-face-uri",
|
|
202
|
+
"foreignobject",
|
|
203
|
+
"hatch",
|
|
204
|
+
"hatchpath",
|
|
205
|
+
"mesh",
|
|
206
|
+
"meshgradient",
|
|
207
|
+
"meshpatch",
|
|
208
|
+
"meshrow",
|
|
209
|
+
"missing-glyph",
|
|
210
|
+
"script",
|
|
211
|
+
"set",
|
|
212
|
+
"solidcolor",
|
|
213
|
+
"unknown",
|
|
214
|
+
"use"
|
|
215
|
+
]), Ie = h(/* @__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(".")), Le = h([
|
|
216
|
+
"maction",
|
|
217
|
+
"maligngroup",
|
|
218
|
+
"malignmark",
|
|
219
|
+
"mlongdiv",
|
|
220
|
+
"mscarries",
|
|
221
|
+
"mscarry",
|
|
222
|
+
"msgroup",
|
|
223
|
+
"mstack",
|
|
224
|
+
"msline",
|
|
225
|
+
"msrow",
|
|
226
|
+
"semantics",
|
|
227
|
+
"annotation",
|
|
228
|
+
"annotation-xml",
|
|
229
|
+
"mprescripts",
|
|
230
|
+
"none"
|
|
231
|
+
]), Re = h(["#text"]), ze = h(/* @__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(".")), Be = h(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), Ve = h(/* @__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(".")), He = h([
|
|
232
|
+
"xlink:href",
|
|
233
|
+
"xml:id",
|
|
234
|
+
"xlink:title",
|
|
235
|
+
"xml:space",
|
|
236
|
+
"xmlns:xlink"
|
|
237
|
+
]), Ue = g(/{{[\w\W]*|^[\w\W]*}}/g), We = g(/<%[\w\W]*|^[\w\W]*%>/g), Ge = g(/\${[\w\W]*/g), Ke = g(/^data-[\-\w.\u00B7-\uFFFF]+$/), qe = g(/^aria-[\-\w]+$/), Je = g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Ye = g(/^(?:\w+script|data):/i), Xe = g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Ze = g(/^html$/i), Qe = g(/^[a-z][.\w]*(-[.\w]+)+$/i), $e = g(/<[/\w!]/g), et = g(/<[/\w]/g), tt = g(/<\/no(script|embed|frames)/i), nt = g(/\/>/i), T = {
|
|
238
|
+
element: 1,
|
|
239
|
+
attribute: 2,
|
|
240
|
+
text: 3,
|
|
241
|
+
cdataSection: 4,
|
|
242
|
+
entityReference: 5,
|
|
243
|
+
entityNode: 6,
|
|
244
|
+
processingInstruction: 7,
|
|
245
|
+
comment: 8,
|
|
246
|
+
document: 9,
|
|
247
|
+
documentType: 10,
|
|
248
|
+
documentFragment: 11,
|
|
249
|
+
notation: 12
|
|
250
|
+
}, rt = function() {
|
|
251
|
+
return typeof window > "u" ? null : window;
|
|
252
|
+
}, it = function(e, t) {
|
|
253
|
+
if (typeof e != "object" || typeof e.createPolicy != "function") return null;
|
|
254
|
+
let n = null, r = "data-tt-policy-suffix";
|
|
255
|
+
t && t.hasAttribute(r) && (n = t.getAttribute(r));
|
|
256
|
+
let i = "dompurify" + (n ? "#" + n : "");
|
|
257
|
+
try {
|
|
258
|
+
return e.createPolicy(i, {
|
|
259
|
+
createHTML(e) {
|
|
260
|
+
return e;
|
|
261
|
+
},
|
|
262
|
+
createScriptURL(e) {
|
|
263
|
+
return e;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
} catch {
|
|
267
|
+
return console.warn("TrustedTypes policy " + i + " could not be created."), null;
|
|
268
|
+
}
|
|
269
|
+
}, at = function() {
|
|
270
|
+
return {
|
|
271
|
+
afterSanitizeAttributes: [],
|
|
272
|
+
afterSanitizeElements: [],
|
|
273
|
+
afterSanitizeShadowDOM: [],
|
|
274
|
+
beforeSanitizeAttributes: [],
|
|
275
|
+
beforeSanitizeElements: [],
|
|
276
|
+
beforeSanitizeShadowDOM: [],
|
|
277
|
+
uponSanitizeAttribute: [],
|
|
278
|
+
uponSanitizeElement: [],
|
|
279
|
+
uponSanitizeShadowNode: []
|
|
280
|
+
};
|
|
281
|
+
}, E = function(e, t, n, r) {
|
|
282
|
+
return y(e, t) && ge(e[t]) ? S(r.base ? C(r.base) : {}, e[t], r.transform) : n;
|
|
283
|
+
};
|
|
284
|
+
function ot() {
|
|
285
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : rt(), t = (e) => ot(e);
|
|
286
|
+
if (t.version = "3.4.11", t.removed = [], !e || !e.document || e.document.nodeType !== T.document || !e.Element) return t.isSupported = !1, t;
|
|
287
|
+
let n = e.document, r = n, i = r.currentScript;
|
|
288
|
+
e.DocumentFragment;
|
|
289
|
+
let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
|
|
290
|
+
e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
|
|
291
|
+
let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, ee = w(d, "cloneNode"), te = w(d, "remove"), ne = w(d, "nextSibling"), re = w(d, "childNodes"), ie = w(d, "parentNode"), ae = w(d, "shadowRoot"), se = w(d, "attributes"), f = o && o.prototype ? w(o.prototype, "nodeType") : null, p = o && o.prototype ? w(o.prototype, "nodeName") : null;
|
|
292
|
+
if (typeof a == "function") {
|
|
293
|
+
let e = n.createElement("template");
|
|
294
|
+
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
295
|
+
}
|
|
296
|
+
let m, _ = "", le, ue = !1, Ce = 0, we = function() {
|
|
297
|
+
if (Ce > 0) throw De("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.");
|
|
298
|
+
}, v = function(e) {
|
|
299
|
+
we(), Ce++;
|
|
300
|
+
try {
|
|
301
|
+
return m.createHTML(e);
|
|
302
|
+
} finally {
|
|
303
|
+
Ce--;
|
|
304
|
+
}
|
|
305
|
+
}, Te = function(e) {
|
|
306
|
+
we(), Ce++;
|
|
307
|
+
try {
|
|
308
|
+
return m.createScriptURL(e);
|
|
309
|
+
} finally {
|
|
310
|
+
Ce--;
|
|
311
|
+
}
|
|
312
|
+
}, Ee = function() {
|
|
313
|
+
return ue ||= (le = it(u, i), !0), le;
|
|
314
|
+
}, x = n, Oe = x.implementation, ke = x.createNodeIterator, st = x.createDocumentFragment, ct = x.getElementsByTagName, D = r.importNode, O = at();
|
|
315
|
+
t.isSupported = typeof oe == "function" && typeof ie == "function" && Oe && Oe.createHTMLDocument !== void 0;
|
|
316
|
+
let k = Ue, lt = We, A = Ge, ut = Ke, j = qe, dt = Ye, ft = Xe, pt = Qe, mt = Je, M = null, ht = S({}, [
|
|
317
|
+
...Me,
|
|
318
|
+
...Ne,
|
|
319
|
+
...Pe,
|
|
320
|
+
...Ie,
|
|
321
|
+
...Re
|
|
322
|
+
]), N = null, gt = S({}, [
|
|
323
|
+
...ze,
|
|
324
|
+
...Be,
|
|
325
|
+
...Ve,
|
|
326
|
+
...He
|
|
327
|
+
]), P = Object.seal(ce(null, {
|
|
328
|
+
tagNameCheck: {
|
|
329
|
+
writable: !0,
|
|
330
|
+
configurable: !1,
|
|
331
|
+
enumerable: !0,
|
|
332
|
+
value: null
|
|
333
|
+
},
|
|
334
|
+
attributeNameCheck: {
|
|
335
|
+
writable: !0,
|
|
336
|
+
configurable: !1,
|
|
337
|
+
enumerable: !0,
|
|
338
|
+
value: null
|
|
339
|
+
},
|
|
340
|
+
allowCustomizedBuiltInElements: {
|
|
341
|
+
writable: !0,
|
|
342
|
+
configurable: !1,
|
|
343
|
+
enumerable: !0,
|
|
344
|
+
value: !1
|
|
345
|
+
}
|
|
346
|
+
})), _t = null, vt = null, F = Object.seal(ce(null, {
|
|
347
|
+
tagCheck: {
|
|
348
|
+
writable: !0,
|
|
349
|
+
configurable: !1,
|
|
350
|
+
enumerable: !0,
|
|
351
|
+
value: null
|
|
352
|
+
},
|
|
353
|
+
attributeCheck: {
|
|
354
|
+
writable: !0,
|
|
355
|
+
configurable: !1,
|
|
356
|
+
enumerable: !0,
|
|
357
|
+
value: null
|
|
358
|
+
}
|
|
359
|
+
})), yt = !0, bt = !0, xt = !1, St = !0, I = !1, Ct = !0, L = !1, wt = !1, Tt = null, Et = null, Dt = !1, Ot = !1, kt = !1, At = !1, R = !0, jt = !1, Mt = "user-content-", Nt = !0, Pt = !1, Ft = {}, z = null, It = S({}, /* @__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(".")), Lt = null, Rt = S({}, [
|
|
360
|
+
"audio",
|
|
361
|
+
"video",
|
|
362
|
+
"img",
|
|
363
|
+
"source",
|
|
364
|
+
"image",
|
|
365
|
+
"track"
|
|
366
|
+
]), zt = null, Bt = S({}, [
|
|
367
|
+
"alt",
|
|
368
|
+
"class",
|
|
369
|
+
"for",
|
|
370
|
+
"id",
|
|
371
|
+
"label",
|
|
372
|
+
"name",
|
|
373
|
+
"pattern",
|
|
374
|
+
"placeholder",
|
|
375
|
+
"role",
|
|
376
|
+
"summary",
|
|
377
|
+
"title",
|
|
378
|
+
"value",
|
|
379
|
+
"style",
|
|
380
|
+
"xmlns"
|
|
381
|
+
]), Vt = "http://www.w3.org/1998/Math/MathML", Ht = "http://www.w3.org/2000/svg", B = "http://www.w3.org/1999/xhtml", Ut = B, Wt = !1, Gt = null, Kt = S({}, [
|
|
382
|
+
Vt,
|
|
383
|
+
Ht,
|
|
384
|
+
B
|
|
385
|
+
], ve), qt = h([
|
|
386
|
+
"mi",
|
|
387
|
+
"mo",
|
|
388
|
+
"mn",
|
|
389
|
+
"ms",
|
|
390
|
+
"mtext"
|
|
391
|
+
]), Jt = S({}, qt), Yt = h(["annotation-xml"]), Xt = S({}, Yt), Zt = S({}, [
|
|
392
|
+
"title",
|
|
393
|
+
"style",
|
|
394
|
+
"font",
|
|
395
|
+
"a",
|
|
396
|
+
"script"
|
|
397
|
+
]), Qt = null, $t = ["application/xhtml+xml", "text/html"], V = null, H = null, en = n.createElement("form"), tn = function(e) {
|
|
398
|
+
return e instanceof RegExp || e instanceof Function;
|
|
399
|
+
}, nn = function() {
|
|
400
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
401
|
+
if (H && H === e) return;
|
|
402
|
+
(!e || typeof e != "object") && (e = {}), e = C(e), Qt = $t.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, V = Qt === "application/xhtml+xml" ? ve : _e, M = E(e, "ALLOWED_TAGS", ht, { transform: V }), N = E(e, "ALLOWED_ATTR", gt, { transform: V }), Gt = E(e, "ALLOWED_NAMESPACES", Kt, { transform: ve }), zt = E(e, "ADD_URI_SAFE_ATTR", Bt, {
|
|
403
|
+
transform: V,
|
|
404
|
+
base: Bt
|
|
405
|
+
}), Lt = E(e, "ADD_DATA_URI_TAGS", Rt, {
|
|
406
|
+
transform: V,
|
|
407
|
+
base: Rt
|
|
408
|
+
}), z = E(e, "FORBID_CONTENTS", It, { transform: V }), _t = E(e, "FORBID_TAGS", C({}), { transform: V }), vt = E(e, "FORBID_ATTR", C({}), { transform: V }), Ft = y(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? C(e.USE_PROFILES) : e.USE_PROFILES : !1, yt = e.ALLOW_ARIA_ATTR !== !1, bt = e.ALLOW_DATA_ATTR !== !1, xt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, St = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, I = e.SAFE_FOR_TEMPLATES || !1, Ct = e.SAFE_FOR_XML !== !1, L = e.WHOLE_DOCUMENT || !1, Ot = e.RETURN_DOM || !1, kt = e.RETURN_DOM_FRAGMENT || !1, At = e.RETURN_TRUSTED_TYPE || !1, Dt = e.FORCE_BODY || !1, R = e.SANITIZE_DOM !== !1, jt = e.SANITIZE_NAMED_PROPS || !1, Nt = e.KEEP_CONTENT !== !1, Pt = e.IN_PLACE || !1, mt = je(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Je, Ut = typeof e.NAMESPACE == "string" ? e.NAMESPACE : B, Jt = y(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? C(e.MATHML_TEXT_INTEGRATION_POINTS) : S({}, qt), Xt = y(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? C(e.HTML_INTEGRATION_POINTS) : S({}, Yt);
|
|
409
|
+
let t = y(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? C(e.CUSTOM_ELEMENT_HANDLING) : ce(null);
|
|
410
|
+
if (P = ce(null), y(t, "tagNameCheck") && tn(t.tagNameCheck) && (P.tagNameCheck = t.tagNameCheck), y(t, "attributeNameCheck") && tn(t.attributeNameCheck) && (P.attributeNameCheck = t.attributeNameCheck), y(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (P.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), g(P), I && (bt = !1), kt && (Ot = !0), Ft && (M = S({}, Re), N = ce(null), Ft.html === !0 && (S(M, Me), S(N, ze)), Ft.svg === !0 && (S(M, Ne), S(N, Be), S(N, He)), Ft.svgFilters === !0 && (S(M, Pe), S(N, Be), S(N, He)), Ft.mathMl === !0 && (S(M, Ie), S(N, Ve), S(N, He))), F.tagCheck = null, F.attributeCheck = null, y(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? F.tagCheck = e.ADD_TAGS : ge(e.ADD_TAGS) && (M === ht && (M = C(M)), S(M, e.ADD_TAGS, V))), y(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? F.attributeCheck = e.ADD_ATTR : ge(e.ADD_ATTR) && (N === gt && (N = C(N)), S(N, e.ADD_ATTR, V))), y(e, "ADD_URI_SAFE_ATTR") && ge(e.ADD_URI_SAFE_ATTR) && S(zt, e.ADD_URI_SAFE_ATTR, V), y(e, "FORBID_CONTENTS") && ge(e.FORBID_CONTENTS) && (z === It && (z = C(z)), S(z, e.FORBID_CONTENTS, V)), y(e, "ADD_FORBID_CONTENTS") && ge(e.ADD_FORBID_CONTENTS) && (z === It && (z = C(z)), S(z, e.ADD_FORBID_CONTENTS, V)), Nt && (M["#text"] = !0), L && S(M, [
|
|
411
|
+
"html",
|
|
412
|
+
"head",
|
|
413
|
+
"body"
|
|
414
|
+
]), M.table && (S(M, ["tbody"]), delete _t.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
415
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw De("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
416
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw De("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
417
|
+
let t = m;
|
|
418
|
+
m = e.TRUSTED_TYPES_POLICY;
|
|
419
|
+
try {
|
|
420
|
+
_ = v("");
|
|
421
|
+
} catch (e) {
|
|
422
|
+
throw m = t, e;
|
|
423
|
+
}
|
|
424
|
+
} else e.TRUSTED_TYPES_POLICY === null ? (m = void 0, _ = "") : (m === void 0 && (m = Ee()), m && typeof _ == "string" && (_ = v("")));
|
|
425
|
+
h && h(e), H = e;
|
|
426
|
+
}, rn = S({}, [
|
|
427
|
+
...Ne,
|
|
428
|
+
...Pe,
|
|
429
|
+
...Fe
|
|
430
|
+
]), an = S({}, [...Ie, ...Le]), on = function(e, t, n) {
|
|
431
|
+
return t.namespaceURI === B ? e === "svg" : t.namespaceURI === Vt ? e === "svg" && (n === "annotation-xml" || Jt[n]) : !!rn[e];
|
|
432
|
+
}, sn = function(e, t, n) {
|
|
433
|
+
return t.namespaceURI === B ? e === "math" : t.namespaceURI === Ht ? e === "math" && Xt[n] : !!an[e];
|
|
434
|
+
}, U = function(e, t, n) {
|
|
435
|
+
return t.namespaceURI === Ht && !Xt[n] || t.namespaceURI === Vt && !Jt[n] ? !1 : !an[e] && (Zt[e] || !rn[e]);
|
|
436
|
+
}, cn = function(e) {
|
|
437
|
+
let t = ie(e);
|
|
438
|
+
(!t || !t.tagName) && (t = {
|
|
439
|
+
namespaceURI: Ut,
|
|
440
|
+
tagName: "template"
|
|
441
|
+
});
|
|
442
|
+
let n = _e(e.tagName), r = _e(t.tagName);
|
|
443
|
+
return Gt[e.namespaceURI] ? e.namespaceURI === Ht ? on(n, t, r) : e.namespaceURI === Vt ? sn(n, t, r) : e.namespaceURI === B ? U(n, t, r) : !!(Qt === "application/xhtml+xml" && Gt[e.namespaceURI]) : !1;
|
|
444
|
+
}, W = function(e) {
|
|
445
|
+
me(t.removed, { element: e });
|
|
446
|
+
try {
|
|
447
|
+
ie(e).removeChild(e);
|
|
448
|
+
} catch {
|
|
449
|
+
if (te(e), !ie(e)) throw De("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
450
|
+
}
|
|
451
|
+
}, G = function(e) {
|
|
452
|
+
let t = re(e);
|
|
453
|
+
if (t) {
|
|
454
|
+
let e = [];
|
|
455
|
+
de(t, (t) => {
|
|
456
|
+
me(e, t);
|
|
457
|
+
}), de(e, (e) => {
|
|
458
|
+
try {
|
|
459
|
+
te(e);
|
|
460
|
+
} catch {}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
let n = se(e);
|
|
464
|
+
if (n) for (let t = n.length - 1; t >= 0; --t) {
|
|
465
|
+
let r = n[t], i = r && r.name;
|
|
466
|
+
if (typeof i == "string") try {
|
|
467
|
+
e.removeAttribute(i);
|
|
468
|
+
} catch {}
|
|
469
|
+
}
|
|
470
|
+
}, K = function(e, n) {
|
|
471
|
+
try {
|
|
472
|
+
me(t.removed, {
|
|
473
|
+
attribute: n.getAttributeNode(e),
|
|
474
|
+
from: n
|
|
475
|
+
});
|
|
476
|
+
} catch {
|
|
477
|
+
me(t.removed, {
|
|
478
|
+
attribute: null,
|
|
479
|
+
from: n
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
if (n.removeAttribute(e), e === "is") if (Ot || kt) try {
|
|
483
|
+
W(n);
|
|
484
|
+
} catch {}
|
|
485
|
+
else try {
|
|
486
|
+
n.setAttribute(e, "");
|
|
487
|
+
} catch {}
|
|
488
|
+
}, ln = function(e) {
|
|
489
|
+
let t = se(e);
|
|
490
|
+
if (t) for (let n = t.length - 1; n >= 0; --n) {
|
|
491
|
+
let r = t[n], i = r && r.name;
|
|
492
|
+
if (!(typeof i != "string" || N[V(i)])) try {
|
|
493
|
+
e.removeAttribute(i);
|
|
494
|
+
} catch {}
|
|
495
|
+
}
|
|
496
|
+
}, un = function(e) {
|
|
497
|
+
let t = [e];
|
|
498
|
+
for (; t.length > 0;) {
|
|
499
|
+
let e = t.pop();
|
|
500
|
+
(f ? f(e) : e.nodeType) === T.element && ln(e);
|
|
501
|
+
let n = re(e);
|
|
502
|
+
if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
|
|
503
|
+
}
|
|
504
|
+
}, dn = function(e) {
|
|
505
|
+
let t = null, r = null;
|
|
506
|
+
if (Dt) e = "<remove></remove>" + e;
|
|
507
|
+
else {
|
|
508
|
+
let t = ye(e, /^[\r\n\t ]+/);
|
|
509
|
+
r = t && t[0];
|
|
510
|
+
}
|
|
511
|
+
Qt === "application/xhtml+xml" && Ut === B && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
512
|
+
let i = m ? v(e) : e;
|
|
513
|
+
if (Ut === B) try {
|
|
514
|
+
t = new l().parseFromString(i, Qt);
|
|
515
|
+
} catch {}
|
|
516
|
+
if (!t || !t.documentElement) {
|
|
517
|
+
t = Oe.createDocument(Ut, "template", null);
|
|
518
|
+
try {
|
|
519
|
+
t.documentElement.innerHTML = Wt ? _ : i;
|
|
520
|
+
} catch {}
|
|
521
|
+
}
|
|
522
|
+
let a = t.body || t.documentElement;
|
|
523
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), Ut === B ? ct.call(t, L ? "html" : "body")[0] : L ? t.documentElement : a;
|
|
524
|
+
}, fn = function(e) {
|
|
525
|
+
return ke.call(e.ownerDocument || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
|
|
526
|
+
}, pn = function(e) {
|
|
527
|
+
return e = be(e, k, " "), e = be(e, lt, " "), e = be(e, A, " "), e;
|
|
528
|
+
}, q = function(e) {
|
|
529
|
+
e.normalize();
|
|
530
|
+
let t = ke.call(e.ownerDocument || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), n = t.nextNode();
|
|
531
|
+
for (; n;) n.data = pn(n.data), n = t.nextNode();
|
|
532
|
+
let r = e.querySelectorAll?.call(e, "template");
|
|
533
|
+
r && de(r, (e) => {
|
|
534
|
+
Y(e.content) && q(e.content);
|
|
535
|
+
});
|
|
536
|
+
}, J = function(e) {
|
|
537
|
+
let t = p ? p(e) : null;
|
|
538
|
+
return typeof t != "string" || V(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== se(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== f(e) || e.childNodes !== re(e);
|
|
539
|
+
}, Y = function(e) {
|
|
540
|
+
if (!f || typeof e != "object" || !e) return !1;
|
|
541
|
+
try {
|
|
542
|
+
return f(e) === T.documentFragment;
|
|
543
|
+
} catch {
|
|
544
|
+
return !1;
|
|
545
|
+
}
|
|
546
|
+
}, X = function(e) {
|
|
547
|
+
if (!f || typeof e != "object" || !e) return !1;
|
|
548
|
+
try {
|
|
549
|
+
return typeof f(e) == "number";
|
|
550
|
+
} catch {
|
|
551
|
+
return !1;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
function Z(e, n, r) {
|
|
555
|
+
e.length !== 0 && de(e, (e) => {
|
|
556
|
+
e.call(t, n, r, H);
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
let mn = function(e, t) {
|
|
560
|
+
return !!(Ct && e.hasChildNodes() && !X(e.firstElementChild) && b($e, e.textContent) && b($e, e.innerHTML) || Ct && e.namespaceURI === B && t === "style" && X(e.firstElementChild) || e.nodeType === T.processingInstruction || Ct && e.nodeType === T.comment && b(et, e.data));
|
|
561
|
+
}, Q = function(e, t) {
|
|
562
|
+
if (!_t[t] && vn(t) && (P.tagNameCheck instanceof RegExp && b(P.tagNameCheck, t) || P.tagNameCheck instanceof Function && P.tagNameCheck(t))) return !1;
|
|
563
|
+
if (Nt && !z[t]) {
|
|
564
|
+
let t = ie(e), n = re(e);
|
|
565
|
+
if (n && t) {
|
|
566
|
+
let r = n.length;
|
|
567
|
+
for (let i = r - 1; i >= 0; --i) {
|
|
568
|
+
let r = Pt ? n[i] : ee(n[i], !0);
|
|
569
|
+
t.insertBefore(r, ne(e));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return W(e), !0;
|
|
574
|
+
}, hn = function(e) {
|
|
575
|
+
if (Z(O.beforeSanitizeElements, e, null), J(e)) return W(e), !0;
|
|
576
|
+
let n = V(p ? p(e) : e.nodeName);
|
|
577
|
+
if (Z(O.uponSanitizeElement, e, {
|
|
578
|
+
tagName: n,
|
|
579
|
+
allowedTags: M
|
|
580
|
+
}), mn(e, n)) return W(e), !0;
|
|
581
|
+
if (_t[n] || !(F.tagCheck instanceof Function && F.tagCheck(n)) && !M[n]) return Q(e, n);
|
|
582
|
+
if ((f ? f(e) : e.nodeType) === T.element && !cn(e) || (n === "noscript" || n === "noembed" || n === "noframes") && b(tt, e.innerHTML)) return W(e), !0;
|
|
583
|
+
if (I && e.nodeType === T.text) {
|
|
584
|
+
let n = pn(e.textContent);
|
|
585
|
+
e.textContent !== n && (me(t.removed, { element: e.cloneNode() }), e.textContent = n);
|
|
586
|
+
}
|
|
587
|
+
return Z(O.afterSanitizeElements, e, null), !1;
|
|
588
|
+
}, gn = function(e, t, r) {
|
|
589
|
+
if (vt[t] || R && (t === "id" || t === "name") && (r in n || r in en)) return !1;
|
|
590
|
+
let i = N[t] || F.attributeCheck instanceof Function && F.attributeCheck(t, e);
|
|
591
|
+
if (!(bt && b(ut, t)) && !(yt && b(j, t))) {
|
|
592
|
+
if (!i) {
|
|
593
|
+
if (!(vn(e) && (P.tagNameCheck instanceof RegExp && b(P.tagNameCheck, e) || P.tagNameCheck instanceof Function && P.tagNameCheck(e)) && (P.attributeNameCheck instanceof RegExp && b(P.attributeNameCheck, t) || P.attributeNameCheck instanceof Function && P.attributeNameCheck(t, e)) || t === "is" && P.allowCustomizedBuiltInElements && (P.tagNameCheck instanceof RegExp && b(P.tagNameCheck, r) || P.tagNameCheck instanceof Function && P.tagNameCheck(r)))) return !1;
|
|
594
|
+
} else if (!zt[t] && !b(mt, be(r, ft, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && xe(r, "data:") === 0 && Lt[e]) && !(xt && !b(dt, be(r, ft, ""))) && r) return !1;
|
|
595
|
+
}
|
|
596
|
+
return !0;
|
|
597
|
+
}, _n = S({}, [
|
|
598
|
+
"annotation-xml",
|
|
599
|
+
"color-profile",
|
|
600
|
+
"font-face",
|
|
601
|
+
"font-face-format",
|
|
602
|
+
"font-face-name",
|
|
603
|
+
"font-face-src",
|
|
604
|
+
"font-face-uri",
|
|
605
|
+
"missing-glyph"
|
|
606
|
+
]), vn = function(e) {
|
|
607
|
+
return !_n[_e(e)] && b(pt, e);
|
|
608
|
+
}, yn = function(e, t, n, r) {
|
|
609
|
+
if (m && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
|
|
610
|
+
case "TrustedHTML": return v(r);
|
|
611
|
+
case "TrustedScriptURL": return Te(r);
|
|
612
|
+
}
|
|
613
|
+
return r;
|
|
614
|
+
}, bn = function(e, n, r, i) {
|
|
615
|
+
try {
|
|
616
|
+
r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), J(e) ? W(e) : pe(t.removed);
|
|
617
|
+
} catch {
|
|
618
|
+
K(n, e);
|
|
619
|
+
}
|
|
620
|
+
}, xn = function(e) {
|
|
621
|
+
Z(O.beforeSanitizeAttributes, e, null);
|
|
622
|
+
let t = e.attributes;
|
|
623
|
+
if (!t || J(e)) return;
|
|
624
|
+
let n = {
|
|
625
|
+
attrName: "",
|
|
626
|
+
attrValue: "",
|
|
627
|
+
keepAttr: !0,
|
|
628
|
+
allowedAttributes: N,
|
|
629
|
+
forceKeepAttr: void 0
|
|
630
|
+
}, r = t.length, i = V(e.nodeName);
|
|
631
|
+
for (; r--;) {
|
|
632
|
+
let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = V(o), u = c, d = o === "value" ? u : Se(u);
|
|
633
|
+
if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, Z(O.uponSanitizeAttribute, e, n), d = n.attrValue, jt && (l === "id" || l === "name") && xe(d, Mt) !== 0 && (K(o, e), d = Mt + d), Ct && b(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
|
|
634
|
+
K(o, e);
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
if (l === "attributename" && ye(d, "href")) {
|
|
638
|
+
K(o, e);
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
if (!n.forceKeepAttr) {
|
|
642
|
+
if (!n.keepAttr) {
|
|
643
|
+
K(o, e);
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if (!St && b(nt, d)) {
|
|
647
|
+
K(o, e);
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
if (I && (d = pn(d)), !gn(i, l, d)) {
|
|
651
|
+
K(o, e);
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
d = yn(i, l, s, d), d !== u && bn(e, o, s, d);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
Z(O.afterSanitizeAttributes, e, null);
|
|
658
|
+
}, Sn = function(e) {
|
|
659
|
+
let t = null, n = fn(e);
|
|
660
|
+
for (Z(O.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (Z(O.uponSanitizeShadowNode, t, null), hn(t), xn(t), Y(t.content) && Sn(t.content), (f ? f(t) : t.nodeType) === T.element) {
|
|
661
|
+
let e = ae(t);
|
|
662
|
+
Y(e) && (Cn(e), Sn(e));
|
|
663
|
+
}
|
|
664
|
+
Z(O.afterSanitizeShadowDOM, e, null);
|
|
665
|
+
}, Cn = function(e) {
|
|
666
|
+
let t = [{
|
|
667
|
+
node: e,
|
|
668
|
+
shadow: null
|
|
669
|
+
}];
|
|
670
|
+
for (; t.length > 0;) {
|
|
671
|
+
let e = t.pop();
|
|
672
|
+
if (e.shadow) {
|
|
673
|
+
Sn(e.shadow);
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
let n = e.node, r = (f ? f(n) : n.nodeType) === T.element, i = re(n);
|
|
677
|
+
if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
678
|
+
node: i[e],
|
|
679
|
+
shadow: null
|
|
680
|
+
});
|
|
681
|
+
if (r) {
|
|
682
|
+
let e = p ? p(n) : null;
|
|
683
|
+
if (typeof e == "string" && V(e) === "template") {
|
|
684
|
+
let e = n.content;
|
|
685
|
+
Y(e) && t.push({
|
|
686
|
+
node: e,
|
|
687
|
+
shadow: null
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (r) {
|
|
692
|
+
let e = ae(n);
|
|
693
|
+
Y(e) && t.push({
|
|
694
|
+
node: null,
|
|
695
|
+
shadow: e
|
|
696
|
+
}, {
|
|
697
|
+
node: e,
|
|
698
|
+
shadow: null
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
return t.sanitize = function(e) {
|
|
704
|
+
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
|
|
705
|
+
if (Wt = !e, Wt && (e = "<!-->"), typeof e != "string" && !X(e) && (e = Ae(e), typeof e != "string")) throw De("dirty is not a string, aborting");
|
|
706
|
+
if (!t.isSupported) return e;
|
|
707
|
+
wt ? (M = Tt, N = Et) : nn(n), (O.uponSanitizeElement.length > 0 || O.uponSanitizeAttribute.length > 0) && (M = C(M)), O.uponSanitizeAttribute.length > 0 && (N = C(N)), t.removed = [];
|
|
708
|
+
let c = Pt && typeof e != "string" && X(e);
|
|
709
|
+
if (c) {
|
|
710
|
+
let t = p ? p(e) : e.nodeName;
|
|
711
|
+
if (typeof t == "string") {
|
|
712
|
+
let e = V(t);
|
|
713
|
+
if (!M[e] || _t[e]) throw De("root node is forbidden and cannot be sanitized in-place");
|
|
714
|
+
}
|
|
715
|
+
if (J(e)) throw De("root node is clobbered and cannot be sanitized in-place");
|
|
716
|
+
try {
|
|
717
|
+
Cn(e);
|
|
718
|
+
} catch (t) {
|
|
719
|
+
throw G(e), t;
|
|
720
|
+
}
|
|
721
|
+
} else if (X(e)) i = dn("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === T.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Cn(a);
|
|
722
|
+
else {
|
|
723
|
+
if (!Ot && !I && !L && e.indexOf("<") === -1) return m && At ? v(e) : e;
|
|
724
|
+
if (i = dn(e), !i) return Ot ? null : At ? _ : "";
|
|
725
|
+
}
|
|
726
|
+
i && Dt && W(i.firstChild);
|
|
727
|
+
let l = fn(c ? e : i);
|
|
728
|
+
try {
|
|
729
|
+
for (; o = l.nextNode();) hn(o), xn(o), Y(o.content) && Sn(o.content);
|
|
730
|
+
} catch (t) {
|
|
731
|
+
throw c && G(e), t;
|
|
732
|
+
}
|
|
733
|
+
if (c) return de(t.removed, (e) => {
|
|
734
|
+
e.element && un(e.element);
|
|
735
|
+
}), I && q(e), e;
|
|
736
|
+
if (Ot) {
|
|
737
|
+
if (I && q(i), kt) for (s = st.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
|
|
738
|
+
else s = i;
|
|
739
|
+
return (N.shadowroot || N.shadowrootmode) && (s = D.call(r, s, !0)), s;
|
|
740
|
+
}
|
|
741
|
+
let u = L ? i.outerHTML : i.innerHTML;
|
|
742
|
+
return L && M["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && b(Ze, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), I && (u = pn(u)), m && At ? v(u) : u;
|
|
743
|
+
}, t.setConfig = function() {
|
|
744
|
+
nn(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), wt = !0, Tt = M, Et = N;
|
|
745
|
+
}, t.clearConfig = function() {
|
|
746
|
+
H = null, wt = !1, Tt = null, Et = null, m = le, _ = "";
|
|
747
|
+
}, t.isValidAttribute = function(e, t, n) {
|
|
748
|
+
return H || nn({}), gn(V(e), V(t), n);
|
|
749
|
+
}, t.addHook = function(e, t) {
|
|
750
|
+
typeof t == "function" && y(O, e) && me(O[e], t);
|
|
751
|
+
}, t.removeHook = function(e, t) {
|
|
752
|
+
if (y(O, e)) {
|
|
753
|
+
if (t !== void 0) {
|
|
754
|
+
let n = fe(O[e], t);
|
|
755
|
+
return n === -1 ? void 0 : he(O[e], n, 1)[0];
|
|
756
|
+
}
|
|
757
|
+
return pe(O[e]);
|
|
758
|
+
}
|
|
759
|
+
}, t.removeHooks = function(e) {
|
|
760
|
+
y(O, e) && (O[e] = []);
|
|
761
|
+
}, t.removeAllHooks = function() {
|
|
762
|
+
O = at();
|
|
763
|
+
}, t;
|
|
764
|
+
}
|
|
765
|
+
var st = ot();
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region node_modules/marked/lib/marked.esm.js
|
|
768
|
+
function ct() {
|
|
769
|
+
return {
|
|
770
|
+
async: !1,
|
|
771
|
+
breaks: !1,
|
|
772
|
+
extensions: null,
|
|
773
|
+
gfm: !0,
|
|
774
|
+
hooks: null,
|
|
775
|
+
pedantic: !1,
|
|
776
|
+
renderer: null,
|
|
777
|
+
silent: !1,
|
|
778
|
+
tokenizer: null,
|
|
779
|
+
walkTokens: null
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
var D = ct();
|
|
783
|
+
function O(e) {
|
|
784
|
+
D = e;
|
|
785
|
+
}
|
|
786
|
+
var k = { exec: () => null };
|
|
787
|
+
function lt(e) {
|
|
788
|
+
let t = [];
|
|
789
|
+
return (n) => {
|
|
790
|
+
let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
|
|
791
|
+
return i || (i = e(r), t[r] = i), i;
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function A(e, t = "") {
|
|
795
|
+
let n = typeof e == "string" ? e : e.source, r = {
|
|
796
|
+
replace: (e, t) => {
|
|
797
|
+
let i = typeof t == "string" ? t : t.source;
|
|
798
|
+
return i = i.replace(j.caret, "$1"), n = n.replace(e, i), r;
|
|
799
|
+
},
|
|
800
|
+
getRegex: () => new RegExp(n, t)
|
|
801
|
+
};
|
|
802
|
+
return r;
|
|
803
|
+
}
|
|
804
|
+
var ut = ((e = "") => {
|
|
805
|
+
try {
|
|
806
|
+
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
807
|
+
} catch {
|
|
808
|
+
return !1;
|
|
809
|
+
}
|
|
810
|
+
})(), j = {
|
|
811
|
+
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
812
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
813
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
814
|
+
beginningSpace: /^\s+/,
|
|
815
|
+
endingHash: /#$/,
|
|
816
|
+
startingSpaceChar: /^ /,
|
|
817
|
+
endingSpaceChar: / $/,
|
|
818
|
+
nonSpaceChar: /[^ ]/,
|
|
819
|
+
newLineCharGlobal: /\n/g,
|
|
820
|
+
tabCharGlobal: /\t/g,
|
|
821
|
+
multipleSpaceGlobal: /\s+/g,
|
|
822
|
+
blankLine: /^[ \t]*$/,
|
|
823
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
824
|
+
blockquoteStart: /^ {0,3}>/,
|
|
825
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
826
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
827
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
828
|
+
listIsTask: /^\[[ xX]\] +\S/,
|
|
829
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
830
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
831
|
+
anyLine: /\n.*\n/,
|
|
832
|
+
hrefBrackets: /^<(.*)>$/,
|
|
833
|
+
tableDelimiter: /[:|]/,
|
|
834
|
+
tableAlignChars: /^\||\| *$/g,
|
|
835
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
836
|
+
tableAlignRight: /^ *-+: *$/,
|
|
837
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
838
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
839
|
+
startATag: /^<a /i,
|
|
840
|
+
endATag: /^<\/a>/i,
|
|
841
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
842
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
843
|
+
startAngleBracket: /^</,
|
|
844
|
+
endAngleBracket: />$/,
|
|
845
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
846
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
847
|
+
escapeTest: /[&<>"']/,
|
|
848
|
+
escapeReplace: /[&<>"']/g,
|
|
849
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
850
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
851
|
+
caret: /(^|[^\[])\^/g,
|
|
852
|
+
percentDecode: /%25/g,
|
|
853
|
+
findPipe: /\|/g,
|
|
854
|
+
splitPipe: / \|/,
|
|
855
|
+
slashPipe: /\\\|/g,
|
|
856
|
+
carriageReturn: /\r\n|\r/g,
|
|
857
|
+
spaceLine: /^ +$/gm,
|
|
858
|
+
notSpaceStart: /^\S*/,
|
|
859
|
+
endingNewline: /\n$/,
|
|
860
|
+
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
861
|
+
nextBulletRegex: lt((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
862
|
+
hrRegex: lt((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
|
|
863
|
+
fencesBeginRegex: lt((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
864
|
+
headingBeginRegex: lt((e) => RegExp(`^ {0,${e}}#`)),
|
|
865
|
+
htmlBeginRegex: lt((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
866
|
+
blockquoteBeginRegex: lt((e) => RegExp(`^ {0,${e}}>`))
|
|
867
|
+
}, dt = /^(?:[ \t]*(?:\n|$))+/, ft = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, pt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, mt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, M = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ht = / {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+|$)/, gt = A(N).replace(/bull/g, ht).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(), P = A(N).replace(/bull/g, ht).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(), _t = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, vt = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, yt = A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), bt = A(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, ht).getRegex(), xt = "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", St = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, I = A("^ {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", St).replace("tag", xt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Ct = A(_t).replace("hr", mt).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", xt).getRegex(), L = {
|
|
868
|
+
blockquote: A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ct).getRegex(),
|
|
869
|
+
code: ft,
|
|
870
|
+
def: yt,
|
|
871
|
+
fences: pt,
|
|
872
|
+
heading: M,
|
|
873
|
+
hr: mt,
|
|
874
|
+
html: I,
|
|
875
|
+
lheading: gt,
|
|
876
|
+
list: bt,
|
|
877
|
+
newline: dt,
|
|
878
|
+
paragraph: Ct,
|
|
879
|
+
table: k,
|
|
880
|
+
text: vt
|
|
881
|
+
}, wt = A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", mt).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", xt).getRegex(), Tt = {
|
|
882
|
+
...L,
|
|
883
|
+
lheading: P,
|
|
884
|
+
table: wt,
|
|
885
|
+
paragraph: A(_t).replace("hr", mt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", wt).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", xt).getRegex()
|
|
886
|
+
}, Et = {
|
|
887
|
+
...L,
|
|
888
|
+
html: A("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", St).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(),
|
|
889
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
890
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
891
|
+
fences: k,
|
|
892
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
893
|
+
paragraph: A(_t).replace("hr", mt).replace("heading", " *#{1,6} *[^\n]").replace("lheading", gt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
894
|
+
}, Dt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ot = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, kt = /^( {2,}|\\)\n(?!\s*$)/, At = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, R = /[\p{P}\p{S}]/u, jt = /[\s\p{P}\p{S}]/u, Mt = /[^\s\p{P}\p{S}]/u, Nt = A(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, jt).getRegex(), Pt = /(?!~)[\p{P}\p{S}]/u, Ft = /(?!~)[\s\p{P}\p{S}]/u, z = /(?:[^\s\p{P}\p{S}]|~)/u, It = A(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ut ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Lt = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Rt = A(Lt, "u").replace(/punct/g, R).getRegex(), zt = A(Lt, "u").replace(/punct/g, Pt).getRegex(), Bt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Vt = A(Bt, "gu").replace(/notPunctSpace/g, Mt).replace(/punctSpace/g, jt).replace(/punct/g, R).getRegex(), Ht = A(Bt, "gu").replace(/notPunctSpace/g, z).replace(/punctSpace/g, Ft).replace(/punct/g, Pt).getRegex(), B = A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Mt).replace(/punctSpace/g, jt).replace(/punct/g, R).getRegex(), Ut = A(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, R).getRegex(), Wt = A("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Mt).replace(/punctSpace/g, jt).replace(/punct/g, R).getRegex(), Gt = A(/\\(punct)/, "gu").replace(/punct/g, R).getRegex(), Kt = A(/^<(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(), qt = A(St).replace("(?:-->|$)", "-->").getRegex(), Jt = A("^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", qt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Yt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Xt = A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Yt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Zt = A(/^!?\[(label)\]\[(ref)\]/).replace("label", Yt).replace("ref", F).getRegex(), Qt = A(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), $t = A("reflink|nolink(?!\\()", "g").replace("reflink", Zt).replace("nolink", Qt).getRegex(), V = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, H = {
|
|
895
|
+
_backpedal: k,
|
|
896
|
+
anyPunctuation: Gt,
|
|
897
|
+
autolink: Kt,
|
|
898
|
+
blockSkip: It,
|
|
899
|
+
br: kt,
|
|
900
|
+
code: Ot,
|
|
901
|
+
del: k,
|
|
902
|
+
delLDelim: k,
|
|
903
|
+
delRDelim: k,
|
|
904
|
+
emStrongLDelim: Rt,
|
|
905
|
+
emStrongRDelimAst: Vt,
|
|
906
|
+
emStrongRDelimUnd: B,
|
|
907
|
+
escape: Dt,
|
|
908
|
+
link: Xt,
|
|
909
|
+
nolink: Qt,
|
|
910
|
+
punctuation: Nt,
|
|
911
|
+
reflink: Zt,
|
|
912
|
+
reflinkSearch: $t,
|
|
913
|
+
tag: Jt,
|
|
914
|
+
text: At,
|
|
915
|
+
url: k
|
|
916
|
+
}, en = {
|
|
917
|
+
...H,
|
|
918
|
+
link: A(/^!?\[(label)\]\((.*?)\)/).replace("label", Yt).getRegex(),
|
|
919
|
+
reflink: A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Yt).getRegex()
|
|
920
|
+
}, tn = {
|
|
921
|
+
...H,
|
|
922
|
+
emStrongRDelimAst: Ht,
|
|
923
|
+
emStrongLDelim: zt,
|
|
924
|
+
delLDelim: Ut,
|
|
925
|
+
delRDelim: Wt,
|
|
926
|
+
url: A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", V).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
927
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
928
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
929
|
+
text: A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", V).getRegex()
|
|
930
|
+
}, nn = {
|
|
931
|
+
...tn,
|
|
932
|
+
br: A(kt).replace("{2,}", "*").getRegex(),
|
|
933
|
+
text: A(tn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
934
|
+
}, rn = {
|
|
935
|
+
normal: L,
|
|
936
|
+
gfm: Tt,
|
|
937
|
+
pedantic: Et
|
|
938
|
+
}, an = {
|
|
939
|
+
normal: H,
|
|
940
|
+
gfm: tn,
|
|
941
|
+
breaks: nn,
|
|
942
|
+
pedantic: en
|
|
943
|
+
}, on = {
|
|
944
|
+
"&": "&",
|
|
945
|
+
"<": "<",
|
|
946
|
+
">": ">",
|
|
947
|
+
"\"": """,
|
|
948
|
+
"'": "'"
|
|
949
|
+
}, sn = (e) => on[e];
|
|
950
|
+
function U(e, t) {
|
|
951
|
+
if (t) {
|
|
952
|
+
if (j.escapeTest.test(e)) return e.replace(j.escapeReplace, sn);
|
|
953
|
+
} else if (j.escapeTestNoEncode.test(e)) return e.replace(j.escapeReplaceNoEncode, sn);
|
|
954
|
+
return e;
|
|
955
|
+
}
|
|
956
|
+
function cn(e) {
|
|
957
|
+
try {
|
|
958
|
+
e = encodeURI(e).replace(j.percentDecode, "%");
|
|
959
|
+
} catch {
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
return e;
|
|
963
|
+
}
|
|
964
|
+
function W(e, t) {
|
|
965
|
+
let n = e.replace(j.findPipe, (e, t, n) => {
|
|
966
|
+
let r = !1, i = t;
|
|
967
|
+
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
968
|
+
return r ? "|" : " |";
|
|
969
|
+
}).split(j.splitPipe), r = 0;
|
|
970
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
971
|
+
else for (; n.length < t;) n.push("");
|
|
972
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(j.slashPipe, "|");
|
|
973
|
+
return n;
|
|
974
|
+
}
|
|
975
|
+
function G(e, t, n) {
|
|
976
|
+
let r = e.length;
|
|
977
|
+
if (r === 0) return "";
|
|
978
|
+
let i = 0;
|
|
979
|
+
for (; i < r;) {
|
|
980
|
+
let a = e.charAt(r - i - 1);
|
|
981
|
+
if (a === t && !n) i++;
|
|
982
|
+
else if (a !== t && n) i++;
|
|
983
|
+
else break;
|
|
984
|
+
}
|
|
985
|
+
return e.slice(0, r - i);
|
|
986
|
+
}
|
|
987
|
+
function K(e) {
|
|
988
|
+
let t = e.split("\n"), n = t.length - 1;
|
|
989
|
+
for (; n >= 0 && j.blankLine.test(t[n]);) n--;
|
|
990
|
+
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
991
|
+
}
|
|
992
|
+
function ln(e, t) {
|
|
993
|
+
if (e.indexOf(t[1]) === -1) return -1;
|
|
994
|
+
let n = 0;
|
|
995
|
+
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
996
|
+
else if (e[r] === t[0]) n++;
|
|
997
|
+
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
998
|
+
return n > 0 ? -2 : -1;
|
|
999
|
+
}
|
|
1000
|
+
function un(e, t = 0) {
|
|
1001
|
+
let n = t, r = "";
|
|
1002
|
+
for (let t of e) if (t === " ") {
|
|
1003
|
+
let e = 4 - n % 4;
|
|
1004
|
+
r += " ".repeat(e), n += e;
|
|
1005
|
+
} else r += t, n++;
|
|
1006
|
+
return r;
|
|
1007
|
+
}
|
|
1008
|
+
function dn(e, t, n, r, i) {
|
|
1009
|
+
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
1010
|
+
r.state.inLink = !0;
|
|
1011
|
+
let c = {
|
|
1012
|
+
type: e[0].charAt(0) === "!" ? "image" : "link",
|
|
1013
|
+
raw: n,
|
|
1014
|
+
href: a,
|
|
1015
|
+
title: o,
|
|
1016
|
+
text: s,
|
|
1017
|
+
tokens: r.inlineTokens(s)
|
|
1018
|
+
};
|
|
1019
|
+
return r.state.inLink = !1, c;
|
|
1020
|
+
}
|
|
1021
|
+
function fn(e, t, n) {
|
|
1022
|
+
let r = e.match(n.other.indentCodeCompensation);
|
|
1023
|
+
if (r === null) return t;
|
|
1024
|
+
let i = r[1];
|
|
1025
|
+
return t.split("\n").map((e) => {
|
|
1026
|
+
let t = e.match(n.other.beginningSpace);
|
|
1027
|
+
if (t === null) return e;
|
|
1028
|
+
let [r] = t;
|
|
1029
|
+
return r.length >= i.length ? e.slice(i.length) : e;
|
|
1030
|
+
}).join("\n");
|
|
1031
|
+
}
|
|
1032
|
+
var pn = class {
|
|
1033
|
+
options;
|
|
1034
|
+
rules;
|
|
1035
|
+
lexer;
|
|
1036
|
+
constructor(e) {
|
|
1037
|
+
this.options = e || D;
|
|
1038
|
+
}
|
|
1039
|
+
space(e) {
|
|
1040
|
+
let t = this.rules.block.newline.exec(e);
|
|
1041
|
+
if (t && t[0].length > 0) return {
|
|
1042
|
+
type: "space",
|
|
1043
|
+
raw: t[0]
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
code(e) {
|
|
1047
|
+
let t = this.rules.block.code.exec(e);
|
|
1048
|
+
if (t) {
|
|
1049
|
+
let e = this.options.pedantic ? t[0] : K(t[0]);
|
|
1050
|
+
return {
|
|
1051
|
+
type: "code",
|
|
1052
|
+
raw: e,
|
|
1053
|
+
codeBlockStyle: "indented",
|
|
1054
|
+
text: e.replace(this.rules.other.codeRemoveIndent, "")
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
fences(e) {
|
|
1059
|
+
let t = this.rules.block.fences.exec(e);
|
|
1060
|
+
if (t) {
|
|
1061
|
+
let e = t[0], n = fn(e, t[3] || "", this.rules);
|
|
1062
|
+
return {
|
|
1063
|
+
type: "code",
|
|
1064
|
+
raw: e,
|
|
1065
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
1066
|
+
text: n
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
heading(e) {
|
|
1071
|
+
let t = this.rules.block.heading.exec(e);
|
|
1072
|
+
if (t) {
|
|
1073
|
+
let e = t[2].trim();
|
|
1074
|
+
if (this.rules.other.endingHash.test(e)) {
|
|
1075
|
+
let t = G(e, "#");
|
|
1076
|
+
(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
|
|
1077
|
+
}
|
|
1078
|
+
return {
|
|
1079
|
+
type: "heading",
|
|
1080
|
+
raw: G(t[0], "\n"),
|
|
1081
|
+
depth: t[1].length,
|
|
1082
|
+
text: e,
|
|
1083
|
+
tokens: this.lexer.inline(e)
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
hr(e) {
|
|
1088
|
+
let t = this.rules.block.hr.exec(e);
|
|
1089
|
+
if (t) return {
|
|
1090
|
+
type: "hr",
|
|
1091
|
+
raw: G(t[0], "\n")
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
blockquote(e) {
|
|
1095
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
1096
|
+
if (t) {
|
|
1097
|
+
let e = G(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
1098
|
+
for (; e.length > 0;) {
|
|
1099
|
+
let t = !1, a = [], o;
|
|
1100
|
+
for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
1101
|
+
else if (!t) a.push(e[o]);
|
|
1102
|
+
else break;
|
|
1103
|
+
e = e.slice(o);
|
|
1104
|
+
let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1105
|
+
n = n ? `${n}
|
|
1106
|
+
${s}` : s, r = r ? `${r}
|
|
1107
|
+
${c}` : c;
|
|
1108
|
+
let l = this.lexer.state.top;
|
|
1109
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
|
|
1110
|
+
let u = i.at(-1);
|
|
1111
|
+
if (u?.type === "code") break;
|
|
1112
|
+
if (u?.type === "blockquote") {
|
|
1113
|
+
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
|
|
1114
|
+
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;
|
|
1115
|
+
break;
|
|
1116
|
+
} else if (u?.type === "list") {
|
|
1117
|
+
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
|
|
1118
|
+
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");
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
return {
|
|
1123
|
+
type: "blockquote",
|
|
1124
|
+
raw: n,
|
|
1125
|
+
tokens: i,
|
|
1126
|
+
text: r
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
list(e) {
|
|
1131
|
+
let t = this.rules.block.list.exec(e);
|
|
1132
|
+
if (t) {
|
|
1133
|
+
let n = t[1].trim(), r = n.length > 1, i = {
|
|
1134
|
+
type: "list",
|
|
1135
|
+
raw: "",
|
|
1136
|
+
ordered: r,
|
|
1137
|
+
start: r ? +n.slice(0, -1) : "",
|
|
1138
|
+
loose: !1,
|
|
1139
|
+
items: []
|
|
1140
|
+
};
|
|
1141
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1142
|
+
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
1143
|
+
for (; e;) {
|
|
1144
|
+
let n = !1, r = "", s = "";
|
|
1145
|
+
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
1146
|
+
r = t[0], e = e.substring(r.length);
|
|
1147
|
+
let c = un(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
1148
|
+
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) {
|
|
1149
|
+
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), ee = this.rules.other.blockquoteBeginRegex(d);
|
|
1150
|
+
for (; e;) {
|
|
1151
|
+
let te = e.split("\n", 1)[0], ne;
|
|
1152
|
+
if (l = te, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), ne = l) : ne = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || ee.test(l) || t.test(l) || n.test(l)) break;
|
|
1153
|
+
if (ne.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + ne.slice(d);
|
|
1154
|
+
else {
|
|
1155
|
+
if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
|
|
1156
|
+
s += "\n" + l;
|
|
1157
|
+
}
|
|
1158
|
+
u = !l.trim(), r += te + "\n", e = e.substring(te.length + 1), c = ne.slice(d);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
|
|
1162
|
+
type: "list_item",
|
|
1163
|
+
raw: r,
|
|
1164
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
|
|
1165
|
+
loose: !1,
|
|
1166
|
+
text: s,
|
|
1167
|
+
tokens: []
|
|
1168
|
+
}), i.raw += r;
|
|
1169
|
+
}
|
|
1170
|
+
let s = i.items.at(-1);
|
|
1171
|
+
if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
|
|
1172
|
+
else return;
|
|
1173
|
+
i.raw = i.raw.trimEnd();
|
|
1174
|
+
for (let e of i.items) {
|
|
1175
|
+
this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []);
|
|
1176
|
+
let t = e.tokens[0];
|
|
1177
|
+
if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
|
|
1178
|
+
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, "");
|
|
1179
|
+
for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
|
|
1180
|
+
this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
let n = this.rules.other.listTaskCheckbox.exec(e.raw);
|
|
1184
|
+
if (n) {
|
|
1185
|
+
let t = {
|
|
1186
|
+
type: "checkbox",
|
|
1187
|
+
raw: n[0] + " ",
|
|
1188
|
+
checked: n[0] !== "[ ]"
|
|
1189
|
+
};
|
|
1190
|
+
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({
|
|
1191
|
+
type: "paragraph",
|
|
1192
|
+
raw: t.raw,
|
|
1193
|
+
text: t.raw,
|
|
1194
|
+
tokens: [t]
|
|
1195
|
+
}) : e.tokens.unshift(t);
|
|
1196
|
+
}
|
|
1197
|
+
} else e.task &&= !1;
|
|
1198
|
+
if (!i.loose) {
|
|
1199
|
+
let t = e.tokens.filter((e) => e.type === "space");
|
|
1200
|
+
i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
if (i.loose) for (let e of i.items) {
|
|
1204
|
+
e.loose = !0;
|
|
1205
|
+
for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
|
|
1206
|
+
}
|
|
1207
|
+
return i;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
html(e) {
|
|
1211
|
+
let t = this.rules.block.html.exec(e);
|
|
1212
|
+
if (t) {
|
|
1213
|
+
let e = K(t[0]);
|
|
1214
|
+
return {
|
|
1215
|
+
type: "html",
|
|
1216
|
+
block: !0,
|
|
1217
|
+
raw: e,
|
|
1218
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
1219
|
+
text: e
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
def(e) {
|
|
1224
|
+
let t = this.rules.block.def.exec(e);
|
|
1225
|
+
if (t) {
|
|
1226
|
+
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];
|
|
1227
|
+
return {
|
|
1228
|
+
type: "def",
|
|
1229
|
+
tag: e,
|
|
1230
|
+
raw: G(t[0], "\n"),
|
|
1231
|
+
href: n,
|
|
1232
|
+
title: r
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
table(e) {
|
|
1237
|
+
let t = this.rules.block.table.exec(e);
|
|
1238
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1239
|
+
let n = W(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 = {
|
|
1240
|
+
type: "table",
|
|
1241
|
+
raw: G(t[0], "\n"),
|
|
1242
|
+
header: [],
|
|
1243
|
+
align: [],
|
|
1244
|
+
rows: []
|
|
1245
|
+
};
|
|
1246
|
+
if (n.length === r.length) {
|
|
1247
|
+
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);
|
|
1248
|
+
for (let e = 0; e < n.length; e++) a.header.push({
|
|
1249
|
+
text: n[e],
|
|
1250
|
+
tokens: this.lexer.inline(n[e]),
|
|
1251
|
+
header: !0,
|
|
1252
|
+
align: a.align[e]
|
|
1253
|
+
});
|
|
1254
|
+
for (let e of i) a.rows.push(W(e, a.header.length).map((e, t) => ({
|
|
1255
|
+
text: e,
|
|
1256
|
+
tokens: this.lexer.inline(e),
|
|
1257
|
+
header: !1,
|
|
1258
|
+
align: a.align[t]
|
|
1259
|
+
})));
|
|
1260
|
+
return a;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
lheading(e) {
|
|
1264
|
+
let t = this.rules.block.lheading.exec(e);
|
|
1265
|
+
if (t) {
|
|
1266
|
+
let e = t[1].trim();
|
|
1267
|
+
return {
|
|
1268
|
+
type: "heading",
|
|
1269
|
+
raw: G(t[0], "\n"),
|
|
1270
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
1271
|
+
text: e,
|
|
1272
|
+
tokens: this.lexer.inline(e)
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
paragraph(e) {
|
|
1277
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
1278
|
+
if (t) {
|
|
1279
|
+
let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
|
|
1280
|
+
return {
|
|
1281
|
+
type: "paragraph",
|
|
1282
|
+
raw: t[0],
|
|
1283
|
+
text: e,
|
|
1284
|
+
tokens: this.lexer.inline(e)
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
text(e) {
|
|
1289
|
+
let t = this.rules.block.text.exec(e);
|
|
1290
|
+
if (t) return {
|
|
1291
|
+
type: "text",
|
|
1292
|
+
raw: t[0],
|
|
1293
|
+
text: t[0],
|
|
1294
|
+
tokens: this.lexer.inline(t[0])
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
escape(e) {
|
|
1298
|
+
let t = this.rules.inline.escape.exec(e);
|
|
1299
|
+
if (t) return {
|
|
1300
|
+
type: "escape",
|
|
1301
|
+
raw: t[0],
|
|
1302
|
+
text: t[1]
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
tag(e) {
|
|
1306
|
+
let t = this.rules.inline.tag.exec(e);
|
|
1307
|
+
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), {
|
|
1308
|
+
type: "html",
|
|
1309
|
+
raw: t[0],
|
|
1310
|
+
inLink: this.lexer.state.inLink,
|
|
1311
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
1312
|
+
block: !1,
|
|
1313
|
+
text: t[0]
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
link(e) {
|
|
1317
|
+
let t = this.rules.inline.link.exec(e);
|
|
1318
|
+
if (t) {
|
|
1319
|
+
let e = t[2].trim();
|
|
1320
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
|
|
1321
|
+
if (!this.rules.other.endAngleBracket.test(e)) return;
|
|
1322
|
+
let t = G(e.slice(0, -1), "\\");
|
|
1323
|
+
if ((e.length - t.length) % 2 == 0) return;
|
|
1324
|
+
} else {
|
|
1325
|
+
let e = ln(t[2], "()");
|
|
1326
|
+
if (e === -2) return;
|
|
1327
|
+
if (e > -1) {
|
|
1328
|
+
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
1329
|
+
t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
let n = t[2], r = "";
|
|
1333
|
+
if (this.options.pedantic) {
|
|
1334
|
+
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
1335
|
+
e && (n = e[1], r = e[3]);
|
|
1336
|
+
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
1337
|
+
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)), dn(t, {
|
|
1338
|
+
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
1339
|
+
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
1340
|
+
}, t[0], this.lexer, this.rules);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
reflink(e, t) {
|
|
1344
|
+
let n;
|
|
1345
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
1346
|
+
let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
1347
|
+
if (!e) {
|
|
1348
|
+
let e = n[0].charAt(0);
|
|
1349
|
+
return {
|
|
1350
|
+
type: "text",
|
|
1351
|
+
raw: e,
|
|
1352
|
+
text: e
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
return dn(n, e, n[0], this.lexer, this.rules);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
emStrong(e, t, n = "") {
|
|
1359
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
1360
|
+
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))) {
|
|
1361
|
+
let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1362
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) !== null;) {
|
|
1363
|
+
if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
|
|
1364
|
+
if (a = [...i].length, r[3] || r[4]) {
|
|
1365
|
+
o += a;
|
|
1366
|
+
continue;
|
|
1367
|
+
} else if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
|
|
1368
|
+
s += a;
|
|
1369
|
+
continue;
|
|
1370
|
+
}
|
|
1371
|
+
if (o -= a, o > 0) continue;
|
|
1372
|
+
a = Math.min(a, a + o + s);
|
|
1373
|
+
let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
|
|
1374
|
+
if (Math.min(n, a) % 2) {
|
|
1375
|
+
let e = c.slice(1, -1);
|
|
1376
|
+
return {
|
|
1377
|
+
type: "em",
|
|
1378
|
+
raw: c,
|
|
1379
|
+
text: e,
|
|
1380
|
+
tokens: this.lexer.inlineTokens(e)
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
let l = c.slice(2, -2);
|
|
1384
|
+
return {
|
|
1385
|
+
type: "strong",
|
|
1386
|
+
raw: c,
|
|
1387
|
+
text: l,
|
|
1388
|
+
tokens: this.lexer.inlineTokens(l)
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
codespan(e) {
|
|
1394
|
+
let t = this.rules.inline.code.exec(e);
|
|
1395
|
+
if (t) {
|
|
1396
|
+
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);
|
|
1397
|
+
return n && r && (e = e.substring(1, e.length - 1)), {
|
|
1398
|
+
type: "codespan",
|
|
1399
|
+
raw: t[0],
|
|
1400
|
+
text: e
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
br(e) {
|
|
1405
|
+
let t = this.rules.inline.br.exec(e);
|
|
1406
|
+
if (t) return {
|
|
1407
|
+
type: "br",
|
|
1408
|
+
raw: t[0]
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
del(e, t, n = "") {
|
|
1412
|
+
let r = this.rules.inline.delLDelim.exec(e);
|
|
1413
|
+
if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1414
|
+
let n = [...r[0]].length - 1, i, a, o = n, s = this.rules.inline.delRDelim;
|
|
1415
|
+
for (s.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = s.exec(t)) !== null;) {
|
|
1416
|
+
if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
|
|
1417
|
+
if (r[3] || r[4]) {
|
|
1418
|
+
o += a;
|
|
1419
|
+
continue;
|
|
1420
|
+
}
|
|
1421
|
+
if (o -= a, o > 0) continue;
|
|
1422
|
+
a = Math.min(a, a + o);
|
|
1423
|
+
let t = [...r[0]][0].length, s = e.slice(0, n + r.index + t + a), c = s.slice(n, -n);
|
|
1424
|
+
return {
|
|
1425
|
+
type: "del",
|
|
1426
|
+
raw: s,
|
|
1427
|
+
text: c,
|
|
1428
|
+
tokens: this.lexer.inlineTokens(c)
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
autolink(e) {
|
|
1434
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
1435
|
+
if (t) {
|
|
1436
|
+
let e, n;
|
|
1437
|
+
return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
|
|
1438
|
+
type: "link",
|
|
1439
|
+
raw: t[0],
|
|
1440
|
+
text: e,
|
|
1441
|
+
href: n,
|
|
1442
|
+
tokens: [{
|
|
1443
|
+
type: "text",
|
|
1444
|
+
raw: e,
|
|
1445
|
+
text: e
|
|
1446
|
+
}]
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
url(e) {
|
|
1451
|
+
let t;
|
|
1452
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
1453
|
+
let e, n;
|
|
1454
|
+
if (t[2] === "@") e = t[0], n = "mailto:" + e;
|
|
1455
|
+
else {
|
|
1456
|
+
let r;
|
|
1457
|
+
do
|
|
1458
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
1459
|
+
while (r !== t[0]);
|
|
1460
|
+
e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
|
|
1461
|
+
}
|
|
1462
|
+
return {
|
|
1463
|
+
type: "link",
|
|
1464
|
+
raw: t[0],
|
|
1465
|
+
text: e,
|
|
1466
|
+
href: n,
|
|
1467
|
+
tokens: [{
|
|
1468
|
+
type: "text",
|
|
1469
|
+
raw: e,
|
|
1470
|
+
text: e
|
|
1471
|
+
}]
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
inlineText(e) {
|
|
1476
|
+
let t = this.rules.inline.text.exec(e);
|
|
1477
|
+
if (t) {
|
|
1478
|
+
let e = this.lexer.state.inRawBlock;
|
|
1479
|
+
return {
|
|
1480
|
+
type: "text",
|
|
1481
|
+
raw: t[0],
|
|
1482
|
+
text: t[0],
|
|
1483
|
+
escaped: e
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}, q = class e {
|
|
1488
|
+
tokens;
|
|
1489
|
+
options;
|
|
1490
|
+
state;
|
|
1491
|
+
inlineQueue;
|
|
1492
|
+
tokenizer;
|
|
1493
|
+
constructor(e) {
|
|
1494
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || D, this.options.tokenizer = this.options.tokenizer || new pn(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
1495
|
+
inLink: !1,
|
|
1496
|
+
inRawBlock: !1,
|
|
1497
|
+
top: !0
|
|
1498
|
+
};
|
|
1499
|
+
let t = {
|
|
1500
|
+
other: j,
|
|
1501
|
+
block: rn.normal,
|
|
1502
|
+
inline: an.normal
|
|
1503
|
+
};
|
|
1504
|
+
this.options.pedantic ? (t.block = rn.pedantic, t.inline = an.pedantic) : this.options.gfm && (t.block = rn.gfm, this.options.breaks ? t.inline = an.breaks : t.inline = an.gfm), this.tokenizer.rules = t;
|
|
1505
|
+
}
|
|
1506
|
+
static get rules() {
|
|
1507
|
+
return {
|
|
1508
|
+
block: rn,
|
|
1509
|
+
inline: an
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
static lex(t, n) {
|
|
1513
|
+
return new e(n).lex(t);
|
|
1514
|
+
}
|
|
1515
|
+
static lexInline(t, n) {
|
|
1516
|
+
return new e(n).inlineTokens(t);
|
|
1517
|
+
}
|
|
1518
|
+
lex(e) {
|
|
1519
|
+
e = e.replace(j.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
1520
|
+
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1521
|
+
let t = this.inlineQueue[e];
|
|
1522
|
+
this.inlineTokens(t.src, t.tokens);
|
|
1523
|
+
}
|
|
1524
|
+
return this.inlineQueue = [], this.tokens;
|
|
1525
|
+
}
|
|
1526
|
+
blockTokens(e, t = [], n = !1) {
|
|
1527
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(j.tabCharGlobal, " ").replace(j.spaceLine, ""));
|
|
1528
|
+
let r = Infinity;
|
|
1529
|
+
for (; e;) {
|
|
1530
|
+
if (e.length < r) r = e.length;
|
|
1531
|
+
else {
|
|
1532
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1535
|
+
let i;
|
|
1536
|
+
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;
|
|
1537
|
+
if (i = this.tokenizer.space(e)) {
|
|
1538
|
+
e = e.substring(i.raw.length);
|
|
1539
|
+
let n = t.at(-1);
|
|
1540
|
+
i.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(i);
|
|
1541
|
+
continue;
|
|
1542
|
+
}
|
|
1543
|
+
if (i = this.tokenizer.code(e)) {
|
|
1544
|
+
e = e.substring(i.raw.length);
|
|
1545
|
+
let n = t.at(-1);
|
|
1546
|
+
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);
|
|
1547
|
+
continue;
|
|
1548
|
+
}
|
|
1549
|
+
if (i = this.tokenizer.fences(e)) {
|
|
1550
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1551
|
+
continue;
|
|
1552
|
+
}
|
|
1553
|
+
if (i = this.tokenizer.heading(e)) {
|
|
1554
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1555
|
+
continue;
|
|
1556
|
+
}
|
|
1557
|
+
if (i = this.tokenizer.hr(e)) {
|
|
1558
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1559
|
+
continue;
|
|
1560
|
+
}
|
|
1561
|
+
if (i = this.tokenizer.blockquote(e)) {
|
|
1562
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1563
|
+
continue;
|
|
1564
|
+
}
|
|
1565
|
+
if (i = this.tokenizer.list(e)) {
|
|
1566
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1567
|
+
continue;
|
|
1568
|
+
}
|
|
1569
|
+
if (i = this.tokenizer.html(e)) {
|
|
1570
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1571
|
+
continue;
|
|
1572
|
+
}
|
|
1573
|
+
if (i = this.tokenizer.def(e)) {
|
|
1574
|
+
e = e.substring(i.raw.length);
|
|
1575
|
+
let n = t.at(-1);
|
|
1576
|
+
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] = {
|
|
1577
|
+
href: i.href,
|
|
1578
|
+
title: i.title
|
|
1579
|
+
}, t.push(i));
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
if (i = this.tokenizer.table(e)) {
|
|
1583
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1584
|
+
continue;
|
|
1585
|
+
}
|
|
1586
|
+
if (i = this.tokenizer.lheading(e)) {
|
|
1587
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
1588
|
+
continue;
|
|
1589
|
+
}
|
|
1590
|
+
let a = e;
|
|
1591
|
+
if (this.options.extensions?.startBlock) {
|
|
1592
|
+
let t = Infinity, n = e.slice(1), r;
|
|
1593
|
+
this.options.extensions.startBlock.forEach((e) => {
|
|
1594
|
+
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
1595
|
+
}), t < Infinity && t >= 0 && (a = e.substring(0, t + 1));
|
|
1596
|
+
}
|
|
1597
|
+
if (this.state.top && (i = this.tokenizer.paragraph(a))) {
|
|
1598
|
+
let r = t.at(-1);
|
|
1599
|
+
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);
|
|
1600
|
+
continue;
|
|
1601
|
+
}
|
|
1602
|
+
if (i = this.tokenizer.text(e)) {
|
|
1603
|
+
e = e.substring(i.raw.length);
|
|
1604
|
+
let n = t.at(-1);
|
|
1605
|
+
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);
|
|
1606
|
+
continue;
|
|
1607
|
+
}
|
|
1608
|
+
if (e) {
|
|
1609
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1610
|
+
break;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
return this.state.top = !0, t;
|
|
1614
|
+
}
|
|
1615
|
+
inline(e, t = []) {
|
|
1616
|
+
return this.inlineQueue.push({
|
|
1617
|
+
src: e,
|
|
1618
|
+
tokens: t
|
|
1619
|
+
}), t;
|
|
1620
|
+
}
|
|
1621
|
+
inlineTokens(e, t = []) {
|
|
1622
|
+
this.tokenizer.lexer = this;
|
|
1623
|
+
let n = e, r = null;
|
|
1624
|
+
if (this.tokens.links) {
|
|
1625
|
+
let e = Object.keys(this.tokens.links);
|
|
1626
|
+
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));
|
|
1627
|
+
}
|
|
1628
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1629
|
+
let i;
|
|
1630
|
+
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);
|
|
1631
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
1632
|
+
let a = !1, o = "", s = Infinity;
|
|
1633
|
+
for (; e;) {
|
|
1634
|
+
if (e.length < s) s = e.length;
|
|
1635
|
+
else {
|
|
1636
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1637
|
+
break;
|
|
1638
|
+
}
|
|
1639
|
+
a || (o = ""), a = !1;
|
|
1640
|
+
let r;
|
|
1641
|
+
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;
|
|
1642
|
+
if (r = this.tokenizer.escape(e)) {
|
|
1643
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1644
|
+
continue;
|
|
1645
|
+
}
|
|
1646
|
+
if (r = this.tokenizer.tag(e)) {
|
|
1647
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1648
|
+
continue;
|
|
1649
|
+
}
|
|
1650
|
+
if (r = this.tokenizer.link(e)) {
|
|
1651
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1652
|
+
continue;
|
|
1653
|
+
}
|
|
1654
|
+
if (r = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1655
|
+
e = e.substring(r.raw.length);
|
|
1656
|
+
let n = t.at(-1);
|
|
1657
|
+
r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
1658
|
+
continue;
|
|
1659
|
+
}
|
|
1660
|
+
if (r = this.tokenizer.emStrong(e, n, o)) {
|
|
1661
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
if (r = this.tokenizer.codespan(e)) {
|
|
1665
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1666
|
+
continue;
|
|
1667
|
+
}
|
|
1668
|
+
if (r = this.tokenizer.br(e)) {
|
|
1669
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1670
|
+
continue;
|
|
1671
|
+
}
|
|
1672
|
+
if (r = this.tokenizer.del(e, n, o)) {
|
|
1673
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1674
|
+
continue;
|
|
1675
|
+
}
|
|
1676
|
+
if (r = this.tokenizer.autolink(e)) {
|
|
1677
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1678
|
+
continue;
|
|
1679
|
+
}
|
|
1680
|
+
if (!this.state.inLink && (r = this.tokenizer.url(e))) {
|
|
1681
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1682
|
+
continue;
|
|
1683
|
+
}
|
|
1684
|
+
let i = e;
|
|
1685
|
+
if (this.options.extensions?.startInline) {
|
|
1686
|
+
let t = Infinity, n = e.slice(1), r;
|
|
1687
|
+
this.options.extensions.startInline.forEach((e) => {
|
|
1688
|
+
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
1689
|
+
}), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
|
|
1690
|
+
}
|
|
1691
|
+
if (r = this.tokenizer.inlineText(i)) {
|
|
1692
|
+
e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (o = r.raw.slice(-1)), a = !0;
|
|
1693
|
+
let n = t.at(-1);
|
|
1694
|
+
n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
1695
|
+
continue;
|
|
1696
|
+
}
|
|
1697
|
+
if (e) {
|
|
1698
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
1699
|
+
break;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
return t;
|
|
1703
|
+
}
|
|
1704
|
+
infiniteLoopError(e) {
|
|
1705
|
+
let t = "Infinite loop on byte: " + e;
|
|
1706
|
+
if (this.options.silent) console.error(t);
|
|
1707
|
+
else throw Error(t);
|
|
1708
|
+
}
|
|
1709
|
+
}, J = class {
|
|
1710
|
+
options;
|
|
1711
|
+
parser;
|
|
1712
|
+
constructor(e) {
|
|
1713
|
+
this.options = e || D;
|
|
1714
|
+
}
|
|
1715
|
+
space(e) {
|
|
1716
|
+
return "";
|
|
1717
|
+
}
|
|
1718
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
1719
|
+
let r = (t || "").match(j.notSpaceStart)?.[0], i = e.replace(j.endingNewline, "") + "\n";
|
|
1720
|
+
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";
|
|
1721
|
+
}
|
|
1722
|
+
blockquote({ tokens: e }) {
|
|
1723
|
+
return `<blockquote>
|
|
1724
|
+
${this.parser.parse(e)}</blockquote>
|
|
1725
|
+
`;
|
|
1726
|
+
}
|
|
1727
|
+
html({ text: e }) {
|
|
1728
|
+
return e;
|
|
1729
|
+
}
|
|
1730
|
+
def(e) {
|
|
1731
|
+
return "";
|
|
1732
|
+
}
|
|
1733
|
+
heading({ tokens: e, depth: t }) {
|
|
1734
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1735
|
+
`;
|
|
1736
|
+
}
|
|
1737
|
+
hr(e) {
|
|
1738
|
+
return "<hr>\n";
|
|
1739
|
+
}
|
|
1740
|
+
list(e) {
|
|
1741
|
+
let t = e.ordered, n = e.start, r = "";
|
|
1742
|
+
for (let t = 0; t < e.items.length; t++) {
|
|
1743
|
+
let n = e.items[t];
|
|
1744
|
+
r += this.listitem(n);
|
|
1745
|
+
}
|
|
1746
|
+
let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
1747
|
+
return "<" + i + a + ">\n" + r + "</" + i + ">\n";
|
|
1748
|
+
}
|
|
1749
|
+
listitem(e) {
|
|
1750
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
1751
|
+
`;
|
|
1752
|
+
}
|
|
1753
|
+
checkbox({ checked: e }) {
|
|
1754
|
+
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
|
|
1755
|
+
}
|
|
1756
|
+
paragraph({ tokens: e }) {
|
|
1757
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
1758
|
+
`;
|
|
1759
|
+
}
|
|
1760
|
+
table(e) {
|
|
1761
|
+
let t = "", n = "";
|
|
1762
|
+
for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
|
|
1763
|
+
t += this.tablerow({ text: n });
|
|
1764
|
+
let r = "";
|
|
1765
|
+
for (let t = 0; t < e.rows.length; t++) {
|
|
1766
|
+
let i = e.rows[t];
|
|
1767
|
+
n = "";
|
|
1768
|
+
for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
|
|
1769
|
+
r += this.tablerow({ text: n });
|
|
1770
|
+
}
|
|
1771
|
+
return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
|
|
1772
|
+
}
|
|
1773
|
+
tablerow({ text: e }) {
|
|
1774
|
+
return `<tr>
|
|
1775
|
+
${e}</tr>
|
|
1776
|
+
`;
|
|
1777
|
+
}
|
|
1778
|
+
tablecell(e) {
|
|
1779
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
1780
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
1781
|
+
`;
|
|
1782
|
+
}
|
|
1783
|
+
strong({ tokens: e }) {
|
|
1784
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
1785
|
+
}
|
|
1786
|
+
em({ tokens: e }) {
|
|
1787
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1788
|
+
}
|
|
1789
|
+
codespan({ text: e }) {
|
|
1790
|
+
return `<code>${U(e, !0)}</code>`;
|
|
1791
|
+
}
|
|
1792
|
+
br(e) {
|
|
1793
|
+
return "<br>";
|
|
1794
|
+
}
|
|
1795
|
+
del({ tokens: e }) {
|
|
1796
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1797
|
+
}
|
|
1798
|
+
link({ href: e, title: t, tokens: n }) {
|
|
1799
|
+
let r = this.parser.parseInline(n), i = cn(e);
|
|
1800
|
+
if (i === null) return r;
|
|
1801
|
+
e = i;
|
|
1802
|
+
let a = "<a href=\"" + e + "\"";
|
|
1803
|
+
return t && (a += " title=\"" + U(t) + "\""), a += ">" + r + "</a>", a;
|
|
1804
|
+
}
|
|
1805
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1806
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1807
|
+
let i = cn(e);
|
|
1808
|
+
if (i === null) return U(n);
|
|
1809
|
+
e = i;
|
|
1810
|
+
let a = `<img src="${e}" alt="${U(n)}"`;
|
|
1811
|
+
return t && (a += ` title="${U(t)}"`), a += ">", a;
|
|
1812
|
+
}
|
|
1813
|
+
text(e) {
|
|
1814
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : U(e.text);
|
|
1815
|
+
}
|
|
1816
|
+
}, Y = class {
|
|
1817
|
+
strong({ text: e }) {
|
|
1818
|
+
return e;
|
|
1819
|
+
}
|
|
1820
|
+
em({ text: e }) {
|
|
1821
|
+
return e;
|
|
1822
|
+
}
|
|
1823
|
+
codespan({ text: e }) {
|
|
1824
|
+
return e;
|
|
1825
|
+
}
|
|
1826
|
+
del({ text: e }) {
|
|
1827
|
+
return e;
|
|
1828
|
+
}
|
|
1829
|
+
html({ text: e }) {
|
|
1830
|
+
return e;
|
|
1831
|
+
}
|
|
1832
|
+
text({ text: e }) {
|
|
1833
|
+
return e;
|
|
1834
|
+
}
|
|
1835
|
+
link({ text: e }) {
|
|
1836
|
+
return "" + e;
|
|
1837
|
+
}
|
|
1838
|
+
image({ text: e }) {
|
|
1839
|
+
return "" + e;
|
|
1840
|
+
}
|
|
1841
|
+
br() {
|
|
1842
|
+
return "";
|
|
1843
|
+
}
|
|
1844
|
+
checkbox({ raw: e }) {
|
|
1845
|
+
return e;
|
|
1846
|
+
}
|
|
1847
|
+
}, X = class e {
|
|
1848
|
+
options;
|
|
1849
|
+
renderer;
|
|
1850
|
+
textRenderer;
|
|
1851
|
+
constructor(e) {
|
|
1852
|
+
this.options = e || D, this.options.renderer = this.options.renderer || new J(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Y();
|
|
1853
|
+
}
|
|
1854
|
+
static parse(t, n) {
|
|
1855
|
+
return new e(n).parse(t);
|
|
1856
|
+
}
|
|
1857
|
+
static parseInline(t, n) {
|
|
1858
|
+
return new e(n).parseInline(t);
|
|
1859
|
+
}
|
|
1860
|
+
parse(e) {
|
|
1861
|
+
this.renderer.parser = this;
|
|
1862
|
+
let t = "";
|
|
1863
|
+
for (let n = 0; n < e.length; n++) {
|
|
1864
|
+
let r = e[n];
|
|
1865
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
1866
|
+
let e = r, n = this.options.extensions.renderers[e.type].call({ parser: this }, e);
|
|
1867
|
+
if (n !== !1 || ![
|
|
1868
|
+
"space",
|
|
1869
|
+
"hr",
|
|
1870
|
+
"heading",
|
|
1871
|
+
"code",
|
|
1872
|
+
"table",
|
|
1873
|
+
"blockquote",
|
|
1874
|
+
"list",
|
|
1875
|
+
"html",
|
|
1876
|
+
"def",
|
|
1877
|
+
"paragraph",
|
|
1878
|
+
"text"
|
|
1879
|
+
].includes(e.type)) {
|
|
1880
|
+
t += n || "";
|
|
1881
|
+
continue;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
let i = r;
|
|
1885
|
+
switch (i.type) {
|
|
1886
|
+
case "space":
|
|
1887
|
+
t += this.renderer.space(i);
|
|
1888
|
+
break;
|
|
1889
|
+
case "hr":
|
|
1890
|
+
t += this.renderer.hr(i);
|
|
1891
|
+
break;
|
|
1892
|
+
case "heading":
|
|
1893
|
+
t += this.renderer.heading(i);
|
|
1894
|
+
break;
|
|
1895
|
+
case "code":
|
|
1896
|
+
t += this.renderer.code(i);
|
|
1897
|
+
break;
|
|
1898
|
+
case "table":
|
|
1899
|
+
t += this.renderer.table(i);
|
|
1900
|
+
break;
|
|
1901
|
+
case "blockquote":
|
|
1902
|
+
t += this.renderer.blockquote(i);
|
|
1903
|
+
break;
|
|
1904
|
+
case "list":
|
|
1905
|
+
t += this.renderer.list(i);
|
|
1906
|
+
break;
|
|
1907
|
+
case "checkbox":
|
|
1908
|
+
t += this.renderer.checkbox(i);
|
|
1909
|
+
break;
|
|
1910
|
+
case "html":
|
|
1911
|
+
t += this.renderer.html(i);
|
|
1912
|
+
break;
|
|
1913
|
+
case "def":
|
|
1914
|
+
t += this.renderer.def(i);
|
|
1915
|
+
break;
|
|
1916
|
+
case "paragraph":
|
|
1917
|
+
t += this.renderer.paragraph(i);
|
|
1918
|
+
break;
|
|
1919
|
+
case "text":
|
|
1920
|
+
t += this.renderer.text(i);
|
|
1921
|
+
break;
|
|
1922
|
+
default: {
|
|
1923
|
+
let e = "Token with \"" + i.type + "\" type was not found.";
|
|
1924
|
+
if (this.options.silent) return console.error(e), "";
|
|
1925
|
+
throw Error(e);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
return t;
|
|
1930
|
+
}
|
|
1931
|
+
parseInline(e, t = this.renderer) {
|
|
1932
|
+
this.renderer.parser = this;
|
|
1933
|
+
let n = "";
|
|
1934
|
+
for (let r = 0; r < e.length; r++) {
|
|
1935
|
+
let i = e[r];
|
|
1936
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1937
|
+
let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1938
|
+
if (e !== !1 || ![
|
|
1939
|
+
"escape",
|
|
1940
|
+
"html",
|
|
1941
|
+
"link",
|
|
1942
|
+
"image",
|
|
1943
|
+
"strong",
|
|
1944
|
+
"em",
|
|
1945
|
+
"codespan",
|
|
1946
|
+
"br",
|
|
1947
|
+
"del",
|
|
1948
|
+
"text"
|
|
1949
|
+
].includes(i.type)) {
|
|
1950
|
+
n += e || "";
|
|
1951
|
+
continue;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
let a = i;
|
|
1955
|
+
switch (a.type) {
|
|
1956
|
+
case "escape":
|
|
1957
|
+
n += t.text(a);
|
|
1958
|
+
break;
|
|
1959
|
+
case "html":
|
|
1960
|
+
n += t.html(a);
|
|
1961
|
+
break;
|
|
1962
|
+
case "link":
|
|
1963
|
+
n += t.link(a);
|
|
1964
|
+
break;
|
|
1965
|
+
case "image":
|
|
1966
|
+
n += t.image(a);
|
|
1967
|
+
break;
|
|
1968
|
+
case "checkbox":
|
|
1969
|
+
n += t.checkbox(a);
|
|
1970
|
+
break;
|
|
1971
|
+
case "strong":
|
|
1972
|
+
n += t.strong(a);
|
|
1973
|
+
break;
|
|
1974
|
+
case "em":
|
|
1975
|
+
n += t.em(a);
|
|
1976
|
+
break;
|
|
1977
|
+
case "codespan":
|
|
1978
|
+
n += t.codespan(a);
|
|
1979
|
+
break;
|
|
1980
|
+
case "br":
|
|
1981
|
+
n += t.br(a);
|
|
1982
|
+
break;
|
|
1983
|
+
case "del":
|
|
1984
|
+
n += t.del(a);
|
|
1985
|
+
break;
|
|
1986
|
+
case "text":
|
|
1987
|
+
n += t.text(a);
|
|
1988
|
+
break;
|
|
1989
|
+
default: {
|
|
1990
|
+
let e = "Token with \"" + a.type + "\" type was not found.";
|
|
1991
|
+
if (this.options.silent) return console.error(e), "";
|
|
1992
|
+
throw Error(e);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return n;
|
|
1997
|
+
}
|
|
1998
|
+
}, Z = class {
|
|
1999
|
+
options;
|
|
2000
|
+
block;
|
|
2001
|
+
constructor(e) {
|
|
2002
|
+
this.options = e || D;
|
|
2003
|
+
}
|
|
2004
|
+
static passThroughHooks = new Set([
|
|
2005
|
+
"preprocess",
|
|
2006
|
+
"postprocess",
|
|
2007
|
+
"processAllTokens",
|
|
2008
|
+
"emStrongMask"
|
|
2009
|
+
]);
|
|
2010
|
+
static passThroughHooksRespectAsync = new Set([
|
|
2011
|
+
"preprocess",
|
|
2012
|
+
"postprocess",
|
|
2013
|
+
"processAllTokens"
|
|
2014
|
+
]);
|
|
2015
|
+
preprocess(e) {
|
|
2016
|
+
return e;
|
|
2017
|
+
}
|
|
2018
|
+
postprocess(e) {
|
|
2019
|
+
return e;
|
|
2020
|
+
}
|
|
2021
|
+
processAllTokens(e) {
|
|
2022
|
+
return e;
|
|
2023
|
+
}
|
|
2024
|
+
emStrongMask(e) {
|
|
2025
|
+
return e;
|
|
2026
|
+
}
|
|
2027
|
+
provideLexer(e = this.block) {
|
|
2028
|
+
return e ? q.lex : q.lexInline;
|
|
2029
|
+
}
|
|
2030
|
+
provideParser(e = this.block) {
|
|
2031
|
+
return e ? X.parse : X.parseInline;
|
|
2032
|
+
}
|
|
2033
|
+
}, mn = new class {
|
|
2034
|
+
defaults = ct();
|
|
2035
|
+
options = this.setOptions;
|
|
2036
|
+
parse = this.parseMarkdown(!0);
|
|
2037
|
+
parseInline = this.parseMarkdown(!1);
|
|
2038
|
+
Parser = X;
|
|
2039
|
+
Renderer = J;
|
|
2040
|
+
TextRenderer = Y;
|
|
2041
|
+
Lexer = q;
|
|
2042
|
+
Tokenizer = pn;
|
|
2043
|
+
Hooks = Z;
|
|
2044
|
+
constructor(...e) {
|
|
2045
|
+
this.use(...e);
|
|
2046
|
+
}
|
|
2047
|
+
walkTokens(e, t) {
|
|
2048
|
+
let n = [];
|
|
2049
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
2050
|
+
case "table": {
|
|
2051
|
+
let e = r;
|
|
2052
|
+
for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
|
|
2053
|
+
for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
|
|
2054
|
+
break;
|
|
2055
|
+
}
|
|
2056
|
+
case "list": {
|
|
2057
|
+
let e = r;
|
|
2058
|
+
n = n.concat(this.walkTokens(e.items, t));
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
default: {
|
|
2062
|
+
let e = r;
|
|
2063
|
+
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
|
|
2064
|
+
let i = e[r].flat(Infinity);
|
|
2065
|
+
n = n.concat(this.walkTokens(i, t));
|
|
2066
|
+
}) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
return n;
|
|
2070
|
+
}
|
|
2071
|
+
use(...e) {
|
|
2072
|
+
let t = this.defaults.extensions || {
|
|
2073
|
+
renderers: {},
|
|
2074
|
+
childTokens: {}
|
|
2075
|
+
};
|
|
2076
|
+
return e.forEach((e) => {
|
|
2077
|
+
let n = { ...e };
|
|
2078
|
+
if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
|
|
2079
|
+
if (!e.name) throw Error("extension name required");
|
|
2080
|
+
if ("renderer" in e) {
|
|
2081
|
+
let n = t.renderers[e.name];
|
|
2082
|
+
n ? t.renderers[e.name] = function(...t) {
|
|
2083
|
+
let r = e.renderer.apply(this, t);
|
|
2084
|
+
return r === !1 && (r = n.apply(this, t)), r;
|
|
2085
|
+
} : t.renderers[e.name] = e.renderer;
|
|
2086
|
+
}
|
|
2087
|
+
if ("tokenizer" in e) {
|
|
2088
|
+
if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
|
|
2089
|
+
let n = t[e.level];
|
|
2090
|
+
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]));
|
|
2091
|
+
}
|
|
2092
|
+
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
2093
|
+
}), n.extensions = t), e.renderer) {
|
|
2094
|
+
let t = this.defaults.renderer || new J(this.defaults);
|
|
2095
|
+
for (let n in e.renderer) {
|
|
2096
|
+
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
2097
|
+
if (["options", "parser"].includes(n)) continue;
|
|
2098
|
+
let r = n, i = e.renderer[r], a = t[r];
|
|
2099
|
+
t[r] = (...e) => {
|
|
2100
|
+
let n = i.apply(t, e);
|
|
2101
|
+
return n === !1 && (n = a.apply(t, e)), n || "";
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
n.renderer = t;
|
|
2105
|
+
}
|
|
2106
|
+
if (e.tokenizer) {
|
|
2107
|
+
let t = this.defaults.tokenizer || new pn(this.defaults);
|
|
2108
|
+
for (let n in e.tokenizer) {
|
|
2109
|
+
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
2110
|
+
if ([
|
|
2111
|
+
"options",
|
|
2112
|
+
"rules",
|
|
2113
|
+
"lexer"
|
|
2114
|
+
].includes(n)) continue;
|
|
2115
|
+
let r = n, i = e.tokenizer[r], a = t[r];
|
|
2116
|
+
t[r] = (...e) => {
|
|
2117
|
+
let n = i.apply(t, e);
|
|
2118
|
+
return n === !1 && (n = a.apply(t, e)), n;
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
n.tokenizer = t;
|
|
2122
|
+
}
|
|
2123
|
+
if (e.hooks) {
|
|
2124
|
+
let t = this.defaults.hooks || new Z();
|
|
2125
|
+
for (let n in e.hooks) {
|
|
2126
|
+
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
2127
|
+
if (["options", "block"].includes(n)) continue;
|
|
2128
|
+
let r = n, i = e.hooks[r], a = t[r];
|
|
2129
|
+
Z.passThroughHooks.has(n) ? t[r] = (e) => {
|
|
2130
|
+
if (this.defaults.async && Z.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
2131
|
+
let n = await i.call(t, e);
|
|
2132
|
+
return a.call(t, n);
|
|
2133
|
+
})();
|
|
2134
|
+
let r = i.call(t, e);
|
|
2135
|
+
return a.call(t, r);
|
|
2136
|
+
} : t[r] = (...e) => {
|
|
2137
|
+
if (this.defaults.async) return (async () => {
|
|
2138
|
+
let n = await i.apply(t, e);
|
|
2139
|
+
return n === !1 && (n = await a.apply(t, e)), n;
|
|
2140
|
+
})();
|
|
2141
|
+
let n = i.apply(t, e);
|
|
2142
|
+
return n === !1 && (n = a.apply(t, e)), n;
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
n.hooks = t;
|
|
2146
|
+
}
|
|
2147
|
+
if (e.walkTokens) {
|
|
2148
|
+
let t = this.defaults.walkTokens, r = e.walkTokens;
|
|
2149
|
+
n.walkTokens = function(e) {
|
|
2150
|
+
let n = [];
|
|
2151
|
+
return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
this.defaults = {
|
|
2155
|
+
...this.defaults,
|
|
2156
|
+
...n
|
|
2157
|
+
};
|
|
2158
|
+
}), this;
|
|
2159
|
+
}
|
|
2160
|
+
setOptions(e) {
|
|
2161
|
+
return this.defaults = {
|
|
2162
|
+
...this.defaults,
|
|
2163
|
+
...e
|
|
2164
|
+
}, this;
|
|
2165
|
+
}
|
|
2166
|
+
lexer(e, t) {
|
|
2167
|
+
return q.lex(e, t ?? this.defaults);
|
|
2168
|
+
}
|
|
2169
|
+
parser(e, t) {
|
|
2170
|
+
return X.parse(e, t ?? this.defaults);
|
|
2171
|
+
}
|
|
2172
|
+
parseMarkdown(e) {
|
|
2173
|
+
return (t, n) => {
|
|
2174
|
+
let r = { ...n }, i = {
|
|
2175
|
+
...this.defaults,
|
|
2176
|
+
...r
|
|
2177
|
+
}, a = this.onError(!!i.silent, !!i.async);
|
|
2178
|
+
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."));
|
|
2179
|
+
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
2180
|
+
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
2181
|
+
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
2182
|
+
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? q.lex : q.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
2183
|
+
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
2184
|
+
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? X.parse : X.parseInline)(a, i);
|
|
2185
|
+
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
2186
|
+
})().catch(a);
|
|
2187
|
+
try {
|
|
2188
|
+
i.hooks && (t = i.hooks.preprocess(t));
|
|
2189
|
+
let n = (i.hooks ? i.hooks.provideLexer(e) : e ? q.lex : q.lexInline)(t, i);
|
|
2190
|
+
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
2191
|
+
let r = (i.hooks ? i.hooks.provideParser(e) : e ? X.parse : X.parseInline)(n, i);
|
|
2192
|
+
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
2193
|
+
} catch (e) {
|
|
2194
|
+
return a(e);
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
onError(e, t) {
|
|
2199
|
+
return (n) => {
|
|
2200
|
+
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
2201
|
+
let e = "<p>An error occurred:</p><pre>" + U(n.message + "", !0) + "</pre>";
|
|
2202
|
+
return t ? Promise.resolve(e) : e;
|
|
2203
|
+
}
|
|
2204
|
+
if (t) return Promise.reject(n);
|
|
2205
|
+
throw n;
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
}();
|
|
2209
|
+
function Q(e, t) {
|
|
2210
|
+
return mn.parse(e, t);
|
|
2211
|
+
}
|
|
2212
|
+
Q.options = Q.setOptions = function(e) {
|
|
2213
|
+
return mn.setOptions(e), Q.defaults = mn.defaults, O(Q.defaults), Q;
|
|
2214
|
+
}, Q.getDefaults = ct, Q.defaults = D, Q.use = function(...e) {
|
|
2215
|
+
return mn.use(...e), Q.defaults = mn.defaults, O(Q.defaults), Q;
|
|
2216
|
+
}, Q.walkTokens = function(e, t) {
|
|
2217
|
+
return mn.walkTokens(e, t);
|
|
2218
|
+
}, Q.parseInline = mn.parseInline, Q.Parser = X, Q.parser = X.parse, Q.Renderer = J, Q.TextRenderer = Y, Q.Lexer = q, Q.lexer = q.lex, Q.Tokenizer = pn, Q.Hooks = Z, Q.parse = Q, Q.options, Q.setOptions, Q.use, Q.walkTokens, Q.parseInline, X.parse, q.lex;
|
|
2219
|
+
//#endregion
|
|
2220
|
+
//#region src/components/ai-chat/empty-state/ai-chat-empty-state.module.scss?inline
|
|
2221
|
+
var hn = ":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-strong,600);--ai-chat-empty-state-title-line-height:1.4;--ai-chat-empty-state-title-color:var(--luzmo-font-color);--ai-chat-empty-state-subtitle-font-size:var(--luzmo-font-size-s);--ai-chat-empty-state-subtitle-font-weight:var(--luzmo-font-weight);--ai-chat-empty-state-subtitle-line-height:var(--luzmo-line-height);--ai-chat-empty-state-subtitle-color:var(--luzmo-font-color-dimmed,var(--luzmo-font-color-extra-dimmed))}", gn = class extends e {
|
|
2222
|
+
constructor(...e) {
|
|
2223
|
+
super(...e), this.title = n("What can I help you with?", { desc: "Title for the AI chat empty state" }), this.subtitle = "", this.suggestions = [], this.disabled = !1;
|
|
2224
|
+
}
|
|
2225
|
+
static {
|
|
2226
|
+
this.styles = c(hn);
|
|
2227
|
+
}
|
|
2228
|
+
static {
|
|
2229
|
+
this.tagName = "luzmo-ai-chat-empty-state";
|
|
2230
|
+
}
|
|
2231
|
+
_handleSuggestionActivate(e) {
|
|
2232
|
+
if (this.disabled) return;
|
|
2233
|
+
let t = e.prompt ?? e.label;
|
|
2234
|
+
this.dispatchEvent(new CustomEvent("luzmo-suggestion-selected", {
|
|
2235
|
+
detail: {
|
|
2236
|
+
label: e.label,
|
|
2237
|
+
prompt: t,
|
|
2238
|
+
selectedDatasets: e.selectedDatasets
|
|
2239
|
+
},
|
|
2240
|
+
bubbles: !0,
|
|
2241
|
+
composed: !0
|
|
2242
|
+
}));
|
|
2243
|
+
}
|
|
2244
|
+
render() {
|
|
2245
|
+
let e = this.suggestions.length > 0;
|
|
2246
|
+
return o`
|
|
2247
|
+
<section class="empty-state" aria-labelledby="ai-chat-empty-state-title">
|
|
2248
|
+
<header class="header">
|
|
2249
|
+
<h2 id="ai-chat-empty-state-title" class="title">${this.title}</h2>
|
|
2250
|
+
</header>
|
|
2251
|
+
|
|
2252
|
+
${e ? o`
|
|
2253
|
+
<div class="actions">
|
|
2254
|
+
${this.subtitle ? o`<p class="subtitle">${this.subtitle}</p>` : s}
|
|
2255
|
+
<div
|
|
2256
|
+
class="suggestions"
|
|
2257
|
+
role="group"
|
|
2258
|
+
aria-label=${n("Prompt suggestions", { desc: "Accessible label for the AI chat empty state suggestion list" })}
|
|
2259
|
+
>
|
|
2260
|
+
${this.suggestions.map((e) => o`
|
|
2261
|
+
<luzmo-action-button
|
|
2262
|
+
variant="accent"
|
|
2263
|
+
size="s"
|
|
2264
|
+
?disabled=${this.disabled}
|
|
2265
|
+
@click=${() => this._handleSuggestionActivate(e)}
|
|
2266
|
+
>
|
|
2267
|
+
${e.label}
|
|
2268
|
+
</luzmo-action-button>
|
|
2269
|
+
`)}
|
|
2270
|
+
</div>
|
|
2271
|
+
</div>
|
|
2272
|
+
` : s}
|
|
2273
|
+
</section>
|
|
2274
|
+
`;
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
//#endregion
|
|
2278
|
+
//#region src/components/ai-chat/empty-state/index.ts
|
|
2279
|
+
t([l({ type: String })], gn.prototype, "title", void 0), t([l({ type: String })], gn.prototype, "subtitle", void 0), t([l({ type: Array })], gn.prototype, "suggestions", void 0), t([l({
|
|
2280
|
+
type: Boolean,
|
|
2281
|
+
reflect: !0
|
|
2282
|
+
})], gn.prototype, "disabled", void 0), customElements.get("luzmo-ai-chat-empty-state") || customElements.define("luzmo-ai-chat-empty-state", gn);
|
|
2283
|
+
//#endregion
|
|
2284
|
+
//#region src/components/ai-chat/ai-chat-request.ts
|
|
2285
|
+
function _n(e, t) {
|
|
2286
|
+
return `${e.replace(/\/+$/, "")}/${t.replace(/^\/+|\/+$/g, "")}/aiprompt`;
|
|
2287
|
+
}
|
|
2288
|
+
function vn(e) {
|
|
2289
|
+
return e.type === "placeholder" ? null : {
|
|
2290
|
+
...e,
|
|
2291
|
+
version: e.version || "",
|
|
2292
|
+
title: e.title || e.options?.title,
|
|
2293
|
+
filters: e.filterGroups || [],
|
|
2294
|
+
aichartId: e.aichartId || ""
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
function yn(e, t) {
|
|
2298
|
+
return [{
|
|
2299
|
+
type: "text",
|
|
2300
|
+
text: e
|
|
2301
|
+
}, ...t.map((e) => ({
|
|
2302
|
+
type: "dataset",
|
|
2303
|
+
id: e
|
|
2304
|
+
}))];
|
|
2305
|
+
}
|
|
2306
|
+
function bn(e, t, n) {
|
|
2307
|
+
return {
|
|
2308
|
+
agent: e,
|
|
2309
|
+
task: t,
|
|
2310
|
+
stream: n.stream ?? !0,
|
|
2311
|
+
response_mode: "mixed",
|
|
2312
|
+
...n.conversationId ? { conversation_id: n.conversationId } : {},
|
|
2313
|
+
...n.localeId ? { locale_id: n.localeId } : {}
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
function xn(e) {
|
|
2317
|
+
let t = yn(e.prompt, e.datasetIds), n = e.chart ? vn(e.chart) : null;
|
|
2318
|
+
return n && t.push({
|
|
2319
|
+
type: "item",
|
|
2320
|
+
value: n
|
|
2321
|
+
}), {
|
|
2322
|
+
...bn("item", e.task ?? "generate", e),
|
|
2323
|
+
input: t
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
function Sn(e) {
|
|
2327
|
+
let t = yn(e.prompt, e.datasetIds);
|
|
2328
|
+
return e.dashboard && t.push({
|
|
2329
|
+
type: "dashboard",
|
|
2330
|
+
value: e.dashboard,
|
|
2331
|
+
...e.currentScreenMode ? { current_screen_mode: e.currentScreenMode } : {}
|
|
2332
|
+
}), {
|
|
2333
|
+
...bn("dashboard", "generate", e),
|
|
2334
|
+
timezone_id: e.timezoneId ?? "UTC",
|
|
2335
|
+
input: t
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
function Cn(e) {
|
|
2339
|
+
return {
|
|
2340
|
+
...bn("analyst", "generate", e),
|
|
2341
|
+
input: yn(e.prompt, e.datasetIds)
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
function wn(e, t) {
|
|
2345
|
+
switch (e) {
|
|
2346
|
+
case "dashboard": return Sn(t);
|
|
2347
|
+
case "analyst": return Cn(t);
|
|
2348
|
+
default: return xn(t);
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
function Tn(e, t) {
|
|
2352
|
+
let { authKey: n, authToken: r, apiVersion: i = "0.1.0" } = t;
|
|
2353
|
+
return {
|
|
2354
|
+
key: n,
|
|
2355
|
+
token: r,
|
|
2356
|
+
action: "create",
|
|
2357
|
+
version: i,
|
|
2358
|
+
properties: wn(e, t)
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2361
|
+
function En(e, t, n, r = "0.1.0", i = null) {
|
|
2362
|
+
return {
|
|
2363
|
+
key: t,
|
|
2364
|
+
token: n,
|
|
2365
|
+
action: "delete",
|
|
2366
|
+
version: r,
|
|
2367
|
+
properties: {
|
|
2368
|
+
agent: "item",
|
|
2369
|
+
restore_to_message_id: e,
|
|
2370
|
+
...i ? { conversation_id: i } : {}
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
//#endregion
|
|
2375
|
+
//#region src/components/ai-chat/stream/transport.ts
|
|
2376
|
+
async function Dn(e) {
|
|
2377
|
+
let t = await fetch(e.url, {
|
|
2378
|
+
method: "POST",
|
|
2379
|
+
headers: { "Content-Type": "application/json" },
|
|
2380
|
+
mode: "cors",
|
|
2381
|
+
body: JSON.stringify(e.body),
|
|
2382
|
+
signal: e.signal
|
|
2383
|
+
});
|
|
2384
|
+
if (!t.ok) {
|
|
2385
|
+
let e = await t.json().catch(() => null);
|
|
2386
|
+
throw Error(e?.message || `API request failed with status ${t.status}`);
|
|
2387
|
+
}
|
|
2388
|
+
if (!t.body) throw Error("Response body is not readable");
|
|
2389
|
+
return {
|
|
2390
|
+
body: t.body,
|
|
2391
|
+
conversationId: t.headers.get("x-conversation-id")
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
function On(e) {
|
|
2395
|
+
let t = e.trim();
|
|
2396
|
+
if (!t || t.startsWith(":") || t.startsWith("event:") || t.startsWith("id:")) return null;
|
|
2397
|
+
let n = t;
|
|
2398
|
+
return n.startsWith("data:") && (n = n.slice(5).trimStart()), !n || n === "[DONE]" ? null : JSON.parse(n);
|
|
2399
|
+
}
|
|
2400
|
+
function kn(e, t) {
|
|
2401
|
+
try {
|
|
2402
|
+
let n = On(e);
|
|
2403
|
+
n && t(n);
|
|
2404
|
+
} catch {
|
|
2405
|
+
console.error("Failed to parse stream line");
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
async function An(e, t) {
|
|
2409
|
+
let n = e.getReader(), r = new TextDecoder(), i = "";
|
|
2410
|
+
try {
|
|
2411
|
+
for (;;) {
|
|
2412
|
+
let { done: e, value: a } = await n.read();
|
|
2413
|
+
if (e) break;
|
|
2414
|
+
i += r.decode(a, { stream: !0 });
|
|
2415
|
+
let o = i.split(/\r?\n/);
|
|
2416
|
+
i = o.pop() ?? "";
|
|
2417
|
+
for (let e of o) kn(e, t);
|
|
2418
|
+
}
|
|
2419
|
+
i += r.decode();
|
|
2420
|
+
let e = i.trim();
|
|
2421
|
+
e && kn(e, t);
|
|
2422
|
+
} finally {
|
|
2423
|
+
n.releaseLock();
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
//#endregion
|
|
2427
|
+
//#region src/components/ai-chat/stream/progress.ts
|
|
2428
|
+
function jn() {
|
|
2429
|
+
return {
|
|
2430
|
+
id: "root",
|
|
2431
|
+
step: "root",
|
|
2432
|
+
status: "pending",
|
|
2433
|
+
children: [{
|
|
2434
|
+
id: "client-init",
|
|
2435
|
+
step: "iqInit",
|
|
2436
|
+
status: "inProgress",
|
|
2437
|
+
description: n("Thinking", { desc: "Label shown in the AI chat progress tree while the assistant starts processing a prompt" })
|
|
2438
|
+
}]
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
function Mn(e) {
|
|
2442
|
+
let t = e.progress;
|
|
2443
|
+
return typeof t != "object" || !t ? !1 : "id" in t && "step" in t && "status" in t;
|
|
2444
|
+
}
|
|
2445
|
+
//#endregion
|
|
2446
|
+
//#region src/components/ai-chat/stream/chunk-extractors.ts
|
|
2447
|
+
function Nn(e) {
|
|
2448
|
+
if (!e || typeof e != "object") return "";
|
|
2449
|
+
let t = e.assistant_message;
|
|
2450
|
+
if (!t || typeof t != "object") return "";
|
|
2451
|
+
if (typeof t.message == "string") return t.message;
|
|
2452
|
+
if (typeof t.text == "string") return t.text;
|
|
2453
|
+
if (typeof t.summary == "string") return t.summary;
|
|
2454
|
+
let n = t.content;
|
|
2455
|
+
return typeof n == "string" ? n : n && typeof n == "object" && typeof n.text == "string" ? n.text : "";
|
|
2456
|
+
}
|
|
2457
|
+
function Pn(e) {
|
|
2458
|
+
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 : "";
|
|
2459
|
+
}
|
|
2460
|
+
function Fn(e) {
|
|
2461
|
+
return Pn(e) || Nn(e.result);
|
|
2462
|
+
}
|
|
2463
|
+
function In(e) {
|
|
2464
|
+
return !!e.done || e.type === "finish" || e.type === "done" || "question" in e;
|
|
2465
|
+
}
|
|
2466
|
+
function Ln(e, t) {
|
|
2467
|
+
let n = typeof e.conversation_id == "string" && e.conversation_id || typeof e.conversationId == "string" && e.conversationId;
|
|
2468
|
+
n && t.callbacks.onConversationIdChange(n);
|
|
2469
|
+
}
|
|
2470
|
+
function Rn(e) {
|
|
2471
|
+
for (let t of e) if (t && typeof t == "object" && t.type === "item") {
|
|
2472
|
+
let e = t.value;
|
|
2473
|
+
if (e && typeof e == "object") return e;
|
|
2474
|
+
}
|
|
2475
|
+
return null;
|
|
2476
|
+
}
|
|
2477
|
+
function zn(e) {
|
|
2478
|
+
let t = e.chart ?? e.generatedChart;
|
|
2479
|
+
if (t && typeof t == "object") return t;
|
|
2480
|
+
let n = e.aiMessageAssets ?? e.ai_message_assets;
|
|
2481
|
+
if (Array.isArray(n)) {
|
|
2482
|
+
let e = Rn(n);
|
|
2483
|
+
if (e) return e;
|
|
2484
|
+
}
|
|
2485
|
+
let r = e.result;
|
|
2486
|
+
if (r && typeof r == "object") {
|
|
2487
|
+
let e = r.assistant_message, t = e?.aiMessageAssets ?? e?.ai_message_assets;
|
|
2488
|
+
if (Array.isArray(t)) return Rn(t);
|
|
2489
|
+
}
|
|
2490
|
+
return null;
|
|
2491
|
+
}
|
|
2492
|
+
function Bn(e) {
|
|
2493
|
+
for (let t of e) if (t && typeof t == "object" && t.type === "dashboard") {
|
|
2494
|
+
let e = t.value;
|
|
2495
|
+
if (e && typeof e == "object" && Array.isArray(e.views)) return e;
|
|
2496
|
+
}
|
|
2497
|
+
return null;
|
|
2498
|
+
}
|
|
2499
|
+
function Vn(e) {
|
|
2500
|
+
for (let t of e) if (t && typeof t == "object" && t.type === "dashboard") {
|
|
2501
|
+
let e = t.name;
|
|
2502
|
+
if (e && typeof e == "object") return e;
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
function Hn(...e) {
|
|
2506
|
+
return e.find(Array.isArray);
|
|
2507
|
+
}
|
|
2508
|
+
function Un(e) {
|
|
2509
|
+
if (e.views && Array.isArray(e.views)) return e;
|
|
2510
|
+
let t = e.aiMessageAssets ?? e.ai_message_assets;
|
|
2511
|
+
if (Array.isArray(t)) return Bn(t);
|
|
2512
|
+
let n = e.result;
|
|
2513
|
+
if (n && typeof n == "object") {
|
|
2514
|
+
let e = n.assistant_message, t = e?.aiMessageAssets ?? e?.ai_message_assets;
|
|
2515
|
+
if (Array.isArray(t)) return Bn(t);
|
|
2516
|
+
}
|
|
2517
|
+
return null;
|
|
2518
|
+
}
|
|
2519
|
+
function Wn(e) {
|
|
2520
|
+
let t = e.aiMessageAssets ?? e.ai_message_assets, n = e.result?.assistant_message, r = Hn(t, n?.aiMessageAssets ?? n?.ai_message_assets);
|
|
2521
|
+
return r ? Vn(r) : void 0;
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/components/ai-chat/stream/stream-processor.ts
|
|
2525
|
+
var Gn = new Set([
|
|
2526
|
+
"conversation-id",
|
|
2527
|
+
"conversation_id",
|
|
2528
|
+
"keepalive",
|
|
2529
|
+
"ping",
|
|
2530
|
+
"finish",
|
|
2531
|
+
"done"
|
|
2532
|
+
]);
|
|
2533
|
+
function Kn(e, t, n) {
|
|
2534
|
+
return {
|
|
2535
|
+
agent: n.agent,
|
|
2536
|
+
conversationId: t.callbacks.getConversationId(),
|
|
2537
|
+
...typeof e.messageId == "string" ? { messageId: e.messageId } : {},
|
|
2538
|
+
raw: e
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
function qn(e, t, n, r, i) {
|
|
2542
|
+
let a = {
|
|
2543
|
+
...Kn(n, e, t),
|
|
2544
|
+
recognized: !0,
|
|
2545
|
+
type: r,
|
|
2546
|
+
data: i
|
|
2547
|
+
};
|
|
2548
|
+
e.callbacks.onStep(a);
|
|
2549
|
+
}
|
|
2550
|
+
function Jn(e, t, n, r, i) {
|
|
2551
|
+
let a = {
|
|
2552
|
+
...Kn(n, e, t),
|
|
2553
|
+
recognized: !1,
|
|
2554
|
+
type: r,
|
|
2555
|
+
data: i
|
|
2556
|
+
};
|
|
2557
|
+
e.callbacks.onStep(a);
|
|
2558
|
+
}
|
|
2559
|
+
function Yn(e) {
|
|
2560
|
+
e.state.progressCollapsed || (e.state.progressCollapsed = !0, e.callbacks.onProgressCollapsed(!0));
|
|
2561
|
+
}
|
|
2562
|
+
function Xn(e, t) {
|
|
2563
|
+
Yn(e), e.aiMessage.message = (e.aiMessage.message || "") + t, e.callbacks.onMessageUpdate(e.aiMessage);
|
|
2564
|
+
}
|
|
2565
|
+
function Zn(e) {
|
|
2566
|
+
if (!e) return null;
|
|
2567
|
+
let t = e.descriptionMetadata?.decision;
|
|
2568
|
+
if (t === "create" || t === "edit" || t === "question") return t;
|
|
2569
|
+
for (let t of e.children ?? []) {
|
|
2570
|
+
let e = Zn(t);
|
|
2571
|
+
if (e) return e;
|
|
2572
|
+
}
|
|
2573
|
+
return null;
|
|
2574
|
+
}
|
|
2575
|
+
function Qn(e, t, n) {
|
|
2576
|
+
if (!Mn(e)) return !1;
|
|
2577
|
+
let r = e.progress;
|
|
2578
|
+
if (t.callbacks.onProgress(r), qn(t, n, e, "progress", r), t.state.decision === null) {
|
|
2579
|
+
let i = Zn(r);
|
|
2580
|
+
i && (t.state.decision = i, qn(t, n, e, "decision", { decision: i }));
|
|
2581
|
+
}
|
|
2582
|
+
return !0;
|
|
2583
|
+
}
|
|
2584
|
+
function $n(e) {
|
|
2585
|
+
return !!e.error || e.type === "error" || typeof e.error_text == "string";
|
|
2586
|
+
}
|
|
2587
|
+
function er(e) {
|
|
2588
|
+
return typeof e.error_text == "string" && e.error_text ? e.error_text : typeof e.error == "string" && e.error ? e.error : n("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" });
|
|
2589
|
+
}
|
|
2590
|
+
function tr(e, t, n) {
|
|
2591
|
+
if (!$n(e)) return !1;
|
|
2592
|
+
let r = er(e);
|
|
2593
|
+
return t.aiMessage.message = r, t.aiMessage.isError = !0, t.callbacks.onMessageUpdate(t.aiMessage), xr(e, t, n, e.error ?? r), !0;
|
|
2594
|
+
}
|
|
2595
|
+
function nr(e) {
|
|
2596
|
+
return typeof e.question == "string" && e.question ? e.question : typeof e.text == "string" && e.text ? e.text : "";
|
|
2597
|
+
}
|
|
2598
|
+
function rr(e, t, n) {
|
|
2599
|
+
if (e.type !== "interrupt") return !1;
|
|
2600
|
+
let r = nr(e);
|
|
2601
|
+
return r && (t.state.interruptQuestion = r, Xn(t, r), qn(t, n, e, "interrupt", { question: r })), xr(e, t, n), !0;
|
|
2602
|
+
}
|
|
2603
|
+
function ir(e) {
|
|
2604
|
+
return typeof e.asset_id == "string" ? e.asset_id : typeof e.asset_type == "string" ? e.asset_type : "default";
|
|
2605
|
+
}
|
|
2606
|
+
function ar(e) {
|
|
2607
|
+
return typeof e.asset_type == "string" ? e.asset_type : "";
|
|
2608
|
+
}
|
|
2609
|
+
function or(e) {
|
|
2610
|
+
return {
|
|
2611
|
+
assetType: ar(e),
|
|
2612
|
+
snapshot: {}
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2615
|
+
function sr(e, t) {
|
|
2616
|
+
return {
|
|
2617
|
+
...e,
|
|
2618
|
+
...t
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
function cr(e) {
|
|
2622
|
+
let t = e.asset_delta ?? e.delta;
|
|
2623
|
+
return t && typeof t == "object" ? t : null;
|
|
2624
|
+
}
|
|
2625
|
+
function lr(e, t) {
|
|
2626
|
+
t.state.assets[ir(e)] = or(e);
|
|
2627
|
+
}
|
|
2628
|
+
function ur(e, t) {
|
|
2629
|
+
let n = ir(e), r = t.state.assets[n] ?? or(e), i = cr(e);
|
|
2630
|
+
i && (r.snapshot = sr(r.snapshot, i)), t.state.assets[n] = r;
|
|
2631
|
+
}
|
|
2632
|
+
function dr(e, t) {
|
|
2633
|
+
let n = e.asset ?? e.value ?? e.asset_delta ?? e.delta;
|
|
2634
|
+
return n && typeof n == "object" ? sr(t?.snapshot ?? {}, n) : t?.snapshot ?? {};
|
|
2635
|
+
}
|
|
2636
|
+
function fr(e, t, n) {
|
|
2637
|
+
let r = ir(e), i = t.state.assets[r], a = i?.assetType || ar(e), o = dr(e, i);
|
|
2638
|
+
delete t.state.assets[r], hr(a, o, e, t, n);
|
|
2639
|
+
}
|
|
2640
|
+
function pr(e, t, n) {
|
|
2641
|
+
switch (e.type) {
|
|
2642
|
+
case "asset_start": return lr(e, t), !0;
|
|
2643
|
+
case "asset_delta": return ur(e, t), !0;
|
|
2644
|
+
case "asset_end": return fr(e, t, n), !0;
|
|
2645
|
+
default: return !1;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
function mr(e, t, n, r) {
|
|
2649
|
+
n.state.chartSnapshot = e, n.aiMessage.hasChart = !0, typeof t.messageId == "string" && (n.aiMessage.apiMessageId = t.messageId), n.callbacks.onMessageUpdate(n.aiMessage), qn(n, r, t, "chart", e);
|
|
2650
|
+
}
|
|
2651
|
+
function hr(e, t, n, r, i) {
|
|
2652
|
+
switch (e) {
|
|
2653
|
+
case "dashboard-title": {
|
|
2654
|
+
let e = t.name;
|
|
2655
|
+
e && typeof e == "object" && (r.state.dashboardName = e, qn(r, i, n, "dashboard-title", { name: e }));
|
|
2656
|
+
return;
|
|
2657
|
+
}
|
|
2658
|
+
case "dashboard-layout":
|
|
2659
|
+
qn(r, i, n, "dashboard-layout", t);
|
|
2660
|
+
return;
|
|
2661
|
+
case "dashboard-item":
|
|
2662
|
+
qn(r, i, n, "dashboard-item", {
|
|
2663
|
+
slot: Number(t.slot),
|
|
2664
|
+
chart: t.chart ?? t
|
|
2665
|
+
});
|
|
2666
|
+
return;
|
|
2667
|
+
case "dashboard":
|
|
2668
|
+
r.state.dashboardSnapshot = t;
|
|
2669
|
+
return;
|
|
2670
|
+
default: gr(e, t, n, r, i);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
function gr(e, t, n, r, i) {
|
|
2674
|
+
if (i.chartAssetType && e === i.chartAssetType) {
|
|
2675
|
+
mr(t, n, r, i);
|
|
2676
|
+
return;
|
|
2677
|
+
}
|
|
2678
|
+
if (i.dashboardAssetType && e === i.dashboardAssetType) {
|
|
2679
|
+
r.state.dashboardSnapshot = t;
|
|
2680
|
+
return;
|
|
2681
|
+
}
|
|
2682
|
+
Jn(r, i, n, e || "asset", t);
|
|
2683
|
+
}
|
|
2684
|
+
function _r(e, t, n) {
|
|
2685
|
+
let r = !1;
|
|
2686
|
+
if (n.dashboardAssetType) {
|
|
2687
|
+
let n = Un(e);
|
|
2688
|
+
if (n) {
|
|
2689
|
+
t.state.dashboardSnapshot = n;
|
|
2690
|
+
let i = Wn(e);
|
|
2691
|
+
i && (t.state.dashboardName = i), r = !0;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
if (n.chartAssetType && !t.state.chartSnapshot) {
|
|
2695
|
+
let i = zn(e);
|
|
2696
|
+
i && (mr(i, e, t, n), r = !0);
|
|
2697
|
+
}
|
|
2698
|
+
return r;
|
|
2699
|
+
}
|
|
2700
|
+
function vr(e, t, n) {
|
|
2701
|
+
return {
|
|
2702
|
+
...e,
|
|
2703
|
+
generatedChart: t,
|
|
2704
|
+
conversationId: n.callbacks.getConversationId()
|
|
2705
|
+
};
|
|
2706
|
+
}
|
|
2707
|
+
function yr(e, t, n) {
|
|
2708
|
+
for (let r of Object.keys(t.state.assets)) {
|
|
2709
|
+
let i = t.state.assets[r];
|
|
2710
|
+
delete t.state.assets[r], !(n.chartAssetType && i.assetType === n.chartAssetType && t.state.chartSnapshot || n.dashboardAssetType && i.assetType === n.dashboardAssetType && t.state.dashboardSnapshot) && hr(i.assetType, i.snapshot, e, t, n);
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
function br(e, t, n) {
|
|
2714
|
+
let r = t.state.dashboardSnapshot ?? (n.dashboardAssetType ? Un(e) : null), i = t.state.chartSnapshot ?? (n.chartAssetType ? zn(e) : null);
|
|
2715
|
+
return {
|
|
2716
|
+
agent: n.agent,
|
|
2717
|
+
conversationId: t.callbacks.getConversationId(),
|
|
2718
|
+
message: t.aiMessage,
|
|
2719
|
+
...r ? { dashboard: r } : {},
|
|
2720
|
+
...i ? { chart: vr(e, i, t) } : {},
|
|
2721
|
+
...t.state.dashboardName ? { name: t.state.dashboardName } : {},
|
|
2722
|
+
raw: e
|
|
2723
|
+
};
|
|
2724
|
+
}
|
|
2725
|
+
function xr(e, t, n, r) {
|
|
2726
|
+
if (!t.state.completed) {
|
|
2727
|
+
if (t.state.completed = !0, yr(e, t, n), Yn(t), r !== void 0) {
|
|
2728
|
+
t.callbacks.onComplete({
|
|
2729
|
+
agent: n.agent,
|
|
2730
|
+
conversationId: t.callbacks.getConversationId(),
|
|
2731
|
+
message: t.aiMessage,
|
|
2732
|
+
error: r,
|
|
2733
|
+
raw: e
|
|
2734
|
+
});
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
t.callbacks.onComplete(br(e, t, n));
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
function Sr(e) {
|
|
2741
|
+
return typeof e.type == "string" && e.type ? e.type : typeof e.asset_type == "string" && e.asset_type ? e.asset_type : "";
|
|
2742
|
+
}
|
|
2743
|
+
function Cr(e, t, n) {
|
|
2744
|
+
let r = Fn(e);
|
|
2745
|
+
return r ? (t.state.accumulatedText += r, Xn(t, r), qn(t, n, e, "text", {
|
|
2746
|
+
delta: r,
|
|
2747
|
+
text: t.state.accumulatedText
|
|
2748
|
+
}), !0) : !1;
|
|
2749
|
+
}
|
|
2750
|
+
function wr(e, t, n, r, i) {
|
|
2751
|
+
if (r || i) return;
|
|
2752
|
+
let a = Sr(e);
|
|
2753
|
+
a && !Gn.has(a) && Jn(t, n, e, a, e);
|
|
2754
|
+
}
|
|
2755
|
+
function Tr(e, t, n) {
|
|
2756
|
+
if (Ln(e, t), Qn(e, t, n) || tr(e, t, n) || rr(e, t, n) || pr(e, t, n)) return;
|
|
2757
|
+
let r = Cr(e, t, n), i = _r(e, t, n), a = r || i, o = In(e);
|
|
2758
|
+
wr(e, t, n, a, o), o && xr(e, t, n);
|
|
2759
|
+
}
|
|
2760
|
+
//#endregion
|
|
2761
|
+
//#region src/components/ai-chat/stream/registry.ts
|
|
2762
|
+
function Er(e) {
|
|
2763
|
+
switch (e) {
|
|
2764
|
+
case "dashboard": return {
|
|
2765
|
+
agent: e,
|
|
2766
|
+
dashboardAssetType: "dashboard"
|
|
2767
|
+
};
|
|
2768
|
+
case "item": return {
|
|
2769
|
+
agent: e,
|
|
2770
|
+
chartAssetType: "item"
|
|
2771
|
+
};
|
|
2772
|
+
default: return { agent: e };
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
function Dr(e) {
|
|
2776
|
+
let t = Er(e);
|
|
2777
|
+
return (e, n) => Tr(e, n, t);
|
|
2778
|
+
}
|
|
2779
|
+
function Or() {
|
|
2780
|
+
return {
|
|
2781
|
+
progressCollapsed: !1,
|
|
2782
|
+
accumulatedText: "",
|
|
2783
|
+
decision: null,
|
|
2784
|
+
assets: {},
|
|
2785
|
+
dashboardSnapshot: null,
|
|
2786
|
+
dashboardName: void 0,
|
|
2787
|
+
chartSnapshot: null,
|
|
2788
|
+
interruptQuestion: null,
|
|
2789
|
+
completed: !1
|
|
2790
|
+
};
|
|
2791
|
+
}
|
|
2792
|
+
//#endregion
|
|
2793
|
+
//#region src/components/ai-chat/session/ai-chat-session.ts
|
|
2794
|
+
function kr() {
|
|
2795
|
+
return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
2796
|
+
}
|
|
2797
|
+
var Ar = class {
|
|
2798
|
+
constructor(e, t = {}) {
|
|
2799
|
+
this._uiBridgeCallbacks = {}, this._subscribers = /* @__PURE__ */ new Set(), this._state = {
|
|
2800
|
+
messages: [],
|
|
2801
|
+
selectedDatasets: [],
|
|
2802
|
+
isGenerating: !1,
|
|
2803
|
+
progress: null,
|
|
2804
|
+
progressCollapsed: !1,
|
|
2805
|
+
conversationId: null,
|
|
2806
|
+
inflightMessage: null
|
|
2807
|
+
}, this._abortController = null, this._inflightMessage = null, this._receivedProgress = !1, this._config = {
|
|
2808
|
+
apiUrl: "https://api.luzmo.com",
|
|
2809
|
+
apiVersion: "0.1.0",
|
|
2810
|
+
stream: !0,
|
|
2811
|
+
...e
|
|
2812
|
+
}, this._hostCallbacks = t, this._state = {
|
|
2813
|
+
...this._state,
|
|
2814
|
+
messages: e.messages ? [...e.messages] : [],
|
|
2815
|
+
selectedDatasets: e.selectedDatasets ? [...e.selectedDatasets] : [],
|
|
2816
|
+
conversationId: e.conversationId ?? null,
|
|
2817
|
+
isGenerating: e.isGenerating ?? !1,
|
|
2818
|
+
progress: e.progress ?? null,
|
|
2819
|
+
progressCollapsed: e.progressCollapsed ?? !1
|
|
2820
|
+
};
|
|
2821
|
+
}
|
|
2822
|
+
get state() {
|
|
2823
|
+
return this._state;
|
|
2824
|
+
}
|
|
2825
|
+
get isGenerating() {
|
|
2826
|
+
return this._state.isGenerating;
|
|
2827
|
+
}
|
|
2828
|
+
subscribe(e) {
|
|
2829
|
+
return this._subscribers.add(e), e(this._state), () => {
|
|
2830
|
+
this._subscribers.delete(e);
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
setUiBridge(e) {
|
|
2834
|
+
this._uiBridgeCallbacks = e;
|
|
2835
|
+
}
|
|
2836
|
+
updateConfig(e) {
|
|
2837
|
+
this._config = {
|
|
2838
|
+
...this._config,
|
|
2839
|
+
...e
|
|
2840
|
+
};
|
|
2841
|
+
let t = {};
|
|
2842
|
+
if ("conversationId" in e) {
|
|
2843
|
+
let n = e.conversationId ?? null;
|
|
2844
|
+
n !== this._state.conversationId && (t.conversationId = n);
|
|
2845
|
+
}
|
|
2846
|
+
if ("selectedDatasets" in e && e.selectedDatasets) {
|
|
2847
|
+
let n = [...e.selectedDatasets];
|
|
2848
|
+
this._areSelectedDatasetsEqual(n, this._state.selectedDatasets) || (t.selectedDatasets = n);
|
|
2849
|
+
}
|
|
2850
|
+
if ("messages" in e && e.messages) {
|
|
2851
|
+
let n = [...e.messages];
|
|
2852
|
+
this._areChatMessagesEqual(n, this._state.messages) || (t.messages = n);
|
|
2853
|
+
}
|
|
2854
|
+
"isGenerating" in e && e.isGenerating !== this._state.isGenerating && (t.isGenerating = e.isGenerating), "progress" in e && (t.progress = e.progress ?? null), "progressCollapsed" in e && e.progressCollapsed !== this._state.progressCollapsed && (t.progressCollapsed = e.progressCollapsed), Object.keys(t).length > 0 && this._patchState(t);
|
|
2855
|
+
}
|
|
2856
|
+
setSelectedDatasets(e) {
|
|
2857
|
+
this._patchState({ selectedDatasets: [...e] }), this._emit("onDatasetsChanged", this._state.selectedDatasets);
|
|
2858
|
+
}
|
|
2859
|
+
addDataset(e) {
|
|
2860
|
+
this._state.selectedDatasets.some((t) => t.id === e.id) || (this._patchState({ selectedDatasets: [...this._state.selectedDatasets, e] }), this._emit("onDatasetsChanged", this._state.selectedDatasets));
|
|
2861
|
+
}
|
|
2862
|
+
removeDataset(e) {
|
|
2863
|
+
let t = this._state.selectedDatasets.filter((t) => t.id !== e);
|
|
2864
|
+
t.length !== this._state.selectedDatasets.length && (this._patchState({ selectedDatasets: t }), this._emit("onDatasetsChanged", this._state.selectedDatasets));
|
|
2865
|
+
}
|
|
2866
|
+
isDatasetRequirementMet() {
|
|
2867
|
+
return !this._config.requireDataset || this._state.selectedDatasets.length > 0;
|
|
2868
|
+
}
|
|
2869
|
+
getAiPromptUrl() {
|
|
2870
|
+
return _n(this._config.apiUrl ?? "https://api.luzmo.com", this._config.apiVersion ?? "0.1.0");
|
|
2871
|
+
}
|
|
2872
|
+
buildRequestBody(e, t) {
|
|
2873
|
+
return Tn(this._config.agent, {
|
|
2874
|
+
prompt: e,
|
|
2875
|
+
datasetIds: t,
|
|
2876
|
+
authKey: this._config.authKey,
|
|
2877
|
+
authToken: this._config.authToken,
|
|
2878
|
+
conversationId: this._state.conversationId,
|
|
2879
|
+
chart: this._config.chart ?? null,
|
|
2880
|
+
dashboard: this._config.dashboard ?? null,
|
|
2881
|
+
currentScreenMode: this._config.currentScreenMode,
|
|
2882
|
+
localeId: this._config.localeId,
|
|
2883
|
+
timezoneId: this._config.timezoneId,
|
|
2884
|
+
task: this._config.task,
|
|
2885
|
+
modelPreference: this._config.modelPreference,
|
|
2886
|
+
apiVersion: this._config.apiVersion,
|
|
2887
|
+
stream: this._config.stream
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2890
|
+
buildPromptSubmittedDetail(e, t, n, r) {
|
|
2891
|
+
return {
|
|
2892
|
+
prompt: e,
|
|
2893
|
+
selectedDatasets: t,
|
|
2894
|
+
datasetIds: n,
|
|
2895
|
+
agent: this._config.agent,
|
|
2896
|
+
request: this.buildRequestBody(e, n),
|
|
2897
|
+
url: this.getAiPromptUrl(),
|
|
2898
|
+
...r ? { signal: r } : {}
|
|
2899
|
+
};
|
|
2900
|
+
}
|
|
2901
|
+
async submit(e) {
|
|
2902
|
+
let t = e.datasetIds ?? this._state.selectedDatasets.map((e) => e.id);
|
|
2903
|
+
if (!this.isDatasetRequirementMet()) return;
|
|
2904
|
+
this._abortInflight();
|
|
2905
|
+
let n = {
|
|
2906
|
+
id: e.aiMessageId ?? kr(),
|
|
2907
|
+
type: "ai",
|
|
2908
|
+
message: ""
|
|
2909
|
+
}, r = [...this._state.messages];
|
|
2910
|
+
if (!e.skipUserMessage) {
|
|
2911
|
+
let t = {
|
|
2912
|
+
id: kr(),
|
|
2913
|
+
type: "user",
|
|
2914
|
+
message: e.prompt
|
|
2915
|
+
};
|
|
2916
|
+
r = [...r, t], this._emit("onMessageSent", t, [...this._state.selectedDatasets]);
|
|
2917
|
+
}
|
|
2918
|
+
r = [...r, n], this._inflightMessage = n, this._receivedProgress = !1;
|
|
2919
|
+
let i = new AbortController();
|
|
2920
|
+
this._abortController = i, this._patchState({
|
|
2921
|
+
messages: r,
|
|
2922
|
+
isGenerating: !0,
|
|
2923
|
+
progress: jn(),
|
|
2924
|
+
progressCollapsed: !1,
|
|
2925
|
+
inflightMessage: n
|
|
2926
|
+
});
|
|
2927
|
+
let a = t, o = [...this._state.selectedDatasets];
|
|
2928
|
+
if (this._hasCallback("onPromptSubmitted")) {
|
|
2929
|
+
let t = this.buildPromptSubmittedDetail(e.prompt, o, a, i.signal);
|
|
2930
|
+
try {
|
|
2931
|
+
await this._invokeCallback("onPromptSubmitted", t);
|
|
2932
|
+
} catch (e) {
|
|
2933
|
+
e.name === "AbortError" ? this.abort() : (this._handleSubmitError(e, n), this._finalizeInflightMessage()), this._patchState({ isGenerating: !1 });
|
|
2934
|
+
}
|
|
2935
|
+
return;
|
|
2936
|
+
}
|
|
2937
|
+
let s = this.buildRequestBody(e.prompt, t), c = Dr(this._config.agent), l = {
|
|
2938
|
+
aiMessage: n,
|
|
2939
|
+
callbacks: this._createStreamCallbacks(),
|
|
2940
|
+
state: Or()
|
|
2941
|
+
}, u = this._config.fetchStreaming ?? Dn, d = !1;
|
|
2942
|
+
try {
|
|
2943
|
+
let { body: e, conversationId: t } = await u({
|
|
2944
|
+
url: this.getAiPromptUrl(),
|
|
2945
|
+
body: s,
|
|
2946
|
+
signal: i.signal
|
|
2947
|
+
});
|
|
2948
|
+
t && this._setConversationId(t), await An(e, (e) => c(e, l)), d = !0;
|
|
2949
|
+
} catch (e) {
|
|
2950
|
+
e.name !== "AbortError" && (this._handleSubmitError(e, n), d = !0);
|
|
2951
|
+
} finally {
|
|
2952
|
+
this._abortController === i && (d ? this._finalizeInflightMessage() : this._discardInflightMessage(), this._patchState({ isGenerating: !1 }), this._abortController = null);
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
async restore(e) {
|
|
2956
|
+
if (this._config.agent !== "item") return {};
|
|
2957
|
+
let t = En(e.restoreToMessageId, this._config.authKey, this._config.authToken, this._config.apiVersion, this._state.conversationId);
|
|
2958
|
+
if (this._patchState({
|
|
2959
|
+
isGenerating: !0,
|
|
2960
|
+
progress: null,
|
|
2961
|
+
progressCollapsed: !1
|
|
2962
|
+
}), this._hasCallback("onRestoreRequested")) {
|
|
2963
|
+
let n = {
|
|
2964
|
+
apiMessageId: e.restoreToMessageId,
|
|
2965
|
+
messageIndex: e.messageIndex,
|
|
2966
|
+
request: t,
|
|
2967
|
+
url: this.getAiPromptUrl()
|
|
2968
|
+
};
|
|
2969
|
+
try {
|
|
2970
|
+
await this._invokeCallback("onRestoreRequested", n);
|
|
2971
|
+
} finally {
|
|
2972
|
+
this._patchState({ isGenerating: !1 });
|
|
2973
|
+
}
|
|
2974
|
+
return {};
|
|
2975
|
+
}
|
|
2976
|
+
try {
|
|
2977
|
+
let n = await fetch(this.getAiPromptUrl(), {
|
|
2978
|
+
method: "POST",
|
|
2979
|
+
headers: { "Content-Type": "application/json" },
|
|
2980
|
+
mode: "cors",
|
|
2981
|
+
body: JSON.stringify(t)
|
|
2982
|
+
});
|
|
2983
|
+
if (!n.ok) {
|
|
2984
|
+
let e = await n.json().catch(() => null);
|
|
2985
|
+
throw Error(e?.message || `API request failed with status ${n.status}`);
|
|
2986
|
+
}
|
|
2987
|
+
let r = await n.json().catch(() => null), i = r?.generatedChart ?? (r ? zn(r) : null), a = {
|
|
2988
|
+
...typeof r?.message == "string" ? { message: r.message } : {},
|
|
2989
|
+
...i ? { chart: {
|
|
2990
|
+
...r,
|
|
2991
|
+
generatedChart: i
|
|
2992
|
+
} } : {}
|
|
2993
|
+
}, o = e.messageIndex >= 0 && e.messageIndex < this._state.messages.length ? this._state.messages.slice(0, e.messageIndex + 1) : this._state.messages;
|
|
2994
|
+
if (a.message && o[e.messageIndex]?.type === "ai" && (o[e.messageIndex] = {
|
|
2995
|
+
...o[e.messageIndex],
|
|
2996
|
+
message: a.message
|
|
2997
|
+
}), this._patchState({ messages: [...o] }), a.chart || a.message) {
|
|
2998
|
+
let t = o[e.messageIndex], n = t?.type === "ai" ? t : {
|
|
2999
|
+
id: kr(),
|
|
3000
|
+
type: "ai",
|
|
3001
|
+
message: a.message ?? ""
|
|
3002
|
+
};
|
|
3003
|
+
this._emit("onComplete", {
|
|
3004
|
+
agent: this._config.agent,
|
|
3005
|
+
conversationId: this._state.conversationId,
|
|
3006
|
+
message: n,
|
|
3007
|
+
...a.chart ? { chart: a.chart } : {},
|
|
3008
|
+
...r ? { raw: r } : {}
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
return a;
|
|
3012
|
+
} finally {
|
|
3013
|
+
this._patchState({ isGenerating: !1 });
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
buildRestoreRequest(e) {
|
|
3017
|
+
return En(e, this._config.authKey, this._config.authToken, this._config.apiVersion, this._state.conversationId);
|
|
3018
|
+
}
|
|
3019
|
+
abort(e = {}) {
|
|
3020
|
+
this._abortInflight(), this._patchState({
|
|
3021
|
+
isGenerating: !1,
|
|
3022
|
+
progress: null,
|
|
3023
|
+
progressCollapsed: !1,
|
|
3024
|
+
inflightMessage: null
|
|
3025
|
+
}), e.notify && this._emit("onPromptStopped");
|
|
3026
|
+
}
|
|
3027
|
+
_abortInflight() {
|
|
3028
|
+
this._abortController?.abort(), this._abortController = null, this._discardInflightMessage();
|
|
3029
|
+
}
|
|
3030
|
+
_createStreamCallbacks() {
|
|
3031
|
+
return {
|
|
3032
|
+
onConversationIdChange: (e) => this._setConversationId(e),
|
|
3033
|
+
onProgress: (e) => {
|
|
3034
|
+
this._receivedProgress = !0, this._patchState({ progress: e });
|
|
3035
|
+
},
|
|
3036
|
+
onProgressCollapsed: (e) => {
|
|
3037
|
+
this._patchState({ progressCollapsed: e });
|
|
3038
|
+
},
|
|
3039
|
+
onMessageUpdate: (e) => {
|
|
3040
|
+
this._inflightMessage = e, this._upsertMessage(e), this._patchState({ inflightMessage: { ...e } });
|
|
3041
|
+
},
|
|
3042
|
+
getConversationId: () => this._state.conversationId,
|
|
3043
|
+
onStep: (e) => {
|
|
3044
|
+
this._emit("onStep", e);
|
|
3045
|
+
},
|
|
3046
|
+
onComplete: (e) => {
|
|
3047
|
+
this._emit("onComplete", e);
|
|
3048
|
+
}
|
|
3049
|
+
};
|
|
3050
|
+
}
|
|
3051
|
+
_setConversationId(e) {
|
|
3052
|
+
this._config = {
|
|
3053
|
+
...this._config,
|
|
3054
|
+
conversationId: e
|
|
3055
|
+
}, this._patchState({ conversationId: e }), this._emit("onConversationIdChange", e);
|
|
3056
|
+
}
|
|
3057
|
+
_upsertMessage(e) {
|
|
3058
|
+
let t = this._state.messages.findIndex((t) => t.id === e.id);
|
|
3059
|
+
if (t === -1) {
|
|
3060
|
+
this._patchState({ messages: [...this._state.messages, { ...e }] });
|
|
3061
|
+
return;
|
|
3062
|
+
}
|
|
3063
|
+
let n = this._state.messages.map((n, r) => r === t ? { ...e } : n);
|
|
3064
|
+
this._patchState({ messages: n });
|
|
3065
|
+
}
|
|
3066
|
+
_finalizeInflightMessage() {
|
|
3067
|
+
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({
|
|
3068
|
+
progress: null,
|
|
3069
|
+
progressCollapsed: !1,
|
|
3070
|
+
inflightMessage: null
|
|
3071
|
+
}));
|
|
3072
|
+
}
|
|
3073
|
+
_removeInflightFromMessages() {
|
|
3074
|
+
this._inflightMessage && this._patchState({ messages: this._state.messages.filter((e) => e.id !== this._inflightMessage.id) });
|
|
3075
|
+
}
|
|
3076
|
+
_discardInflightMessage() {
|
|
3077
|
+
let e = !!(this._inflightMessage || this._state.inflightMessage);
|
|
3078
|
+
this._removeInflightFromMessages(), this._inflightMessage = null, this._receivedProgress = !1, e && this._patchState({ inflightMessage: null });
|
|
3079
|
+
}
|
|
3080
|
+
_handleSubmitError(e, t) {
|
|
3081
|
+
t.message = n("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" }), t.isError = !0, delete t.progress, this._inflightMessage = t, this._upsertMessage(t), this._patchState({
|
|
3082
|
+
inflightMessage: { ...t },
|
|
3083
|
+
progress: null,
|
|
3084
|
+
progressCollapsed: !1
|
|
3085
|
+
}), this._emit("onComplete", {
|
|
3086
|
+
agent: this._config.agent,
|
|
3087
|
+
conversationId: this._state.conversationId,
|
|
3088
|
+
message: t,
|
|
3089
|
+
error: e
|
|
3090
|
+
});
|
|
3091
|
+
}
|
|
3092
|
+
_hasCallback(e) {
|
|
3093
|
+
return typeof this._hostCallbacks[e] == "function" || typeof this._uiBridgeCallbacks[e] == "function";
|
|
3094
|
+
}
|
|
3095
|
+
_emit(e, ...t) {
|
|
3096
|
+
this._invokeCallback(e, ...t);
|
|
3097
|
+
}
|
|
3098
|
+
async _invokeCallback(e, ...t) {
|
|
3099
|
+
let n = this._hostCallbacks[e], r = this._uiBridgeCallbacks[e];
|
|
3100
|
+
typeof n == "function" && await n(...t), typeof r == "function" && await r(...t);
|
|
3101
|
+
}
|
|
3102
|
+
_patchState(e) {
|
|
3103
|
+
this._state = {
|
|
3104
|
+
...this._state,
|
|
3105
|
+
...e
|
|
3106
|
+
}, this._emit("onStateChange", this._state);
|
|
3107
|
+
for (let e of this._subscribers) e(this._state);
|
|
3108
|
+
}
|
|
3109
|
+
_areSelectedDatasetsEqual(e, t) {
|
|
3110
|
+
return e.length === t.length ? e.every((e, n) => e.id === t[n]?.id) : !1;
|
|
3111
|
+
}
|
|
3112
|
+
_areChatMessagesEqual(e, t) {
|
|
3113
|
+
return e.length === t.length ? e.every((e, n) => {
|
|
3114
|
+
let r = t[n];
|
|
3115
|
+
return e.id === r?.id && e.apiMessageId === r?.apiMessageId && e.type === r?.type && e.message === r?.message && e.isError === r?.isError && e.hasChart === r?.hasChart && JSON.stringify(e.progress ?? null) === JSON.stringify(r?.progress ?? null);
|
|
3116
|
+
}) : !1;
|
|
3117
|
+
}
|
|
3118
|
+
};
|
|
3119
|
+
function jr(e, t) {
|
|
3120
|
+
return new Ar(e, t);
|
|
3121
|
+
}
|
|
3122
|
+
//#endregion
|
|
3123
|
+
//#region src/components/ai-chat/session/ai-chat-session-controller.ts
|
|
3124
|
+
var Mr = class {
|
|
3125
|
+
constructor(e) {
|
|
3126
|
+
this.options = e, this._session = null, this._ownsSession = !1, this._seededFromProps = !1, this._unsubscribe = null;
|
|
3127
|
+
}
|
|
3128
|
+
get current() {
|
|
3129
|
+
return this._session;
|
|
3130
|
+
}
|
|
3131
|
+
get state() {
|
|
3132
|
+
if (this._session) return this._session.state;
|
|
3133
|
+
let e = this.options.getSeed();
|
|
3134
|
+
return {
|
|
3135
|
+
messages: e.messages,
|
|
3136
|
+
selectedDatasets: e.selectedDatasets,
|
|
3137
|
+
isGenerating: !1,
|
|
3138
|
+
progress: null,
|
|
3139
|
+
progressCollapsed: !1,
|
|
3140
|
+
conversationId: e.conversationId,
|
|
3141
|
+
inflightMessage: null
|
|
3142
|
+
};
|
|
3143
|
+
}
|
|
3144
|
+
get ownsCurrentSession() {
|
|
3145
|
+
return this._ownsSession;
|
|
3146
|
+
}
|
|
3147
|
+
setSession(e) {
|
|
3148
|
+
if (!e) {
|
|
3149
|
+
this._clearSession();
|
|
3150
|
+
return;
|
|
3151
|
+
}
|
|
3152
|
+
this._ownsSession && this._session !== e && this._session?.abort(), this._ownsSession = !1, this._session = e, e.updateConfig(this.options.getConfig()), this._wire(e);
|
|
3153
|
+
}
|
|
3154
|
+
syncProperties(e) {
|
|
3155
|
+
if (!e.has("chatSession")) {
|
|
3156
|
+
if (this._createSessionIfMissing(), this._session) {
|
|
3157
|
+
let t = this.options.getConfig();
|
|
3158
|
+
Object.keys(t).some((t) => e.has(t)) && this._session.updateConfig(t);
|
|
3159
|
+
}
|
|
3160
|
+
(e.has("messages") || e.has("selectedDatasets")) && this._seedFromPropsOnce();
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
requireSession() {
|
|
3164
|
+
return this._createSessionIfMissing(), this._session.updateConfig(this.options.getConfig()), this._session;
|
|
3165
|
+
}
|
|
3166
|
+
connect() {
|
|
3167
|
+
this._session && this._wire(this._session);
|
|
3168
|
+
}
|
|
3169
|
+
teardown() {
|
|
3170
|
+
this._unwire(), this._ownsSession &&= (this._session?.abort(), this._session = null, !1), this._seededFromProps = !1;
|
|
3171
|
+
}
|
|
3172
|
+
_createSessionIfMissing() {
|
|
3173
|
+
if (this._session) return;
|
|
3174
|
+
let e = this.options.getSeed();
|
|
3175
|
+
this._session = jr({
|
|
3176
|
+
...this.options.getConfig(),
|
|
3177
|
+
messages: e.messages.length > 0 ? [...e.messages] : void 0,
|
|
3178
|
+
selectedDatasets: e.selectedDatasets.length > 0 ? [...e.selectedDatasets] : void 0
|
|
3179
|
+
}), this._ownsSession = !0, this._seededFromProps = e.messages.length > 0 || e.selectedDatasets.length > 0, this._wire(this._session);
|
|
3180
|
+
}
|
|
3181
|
+
_clearSession() {
|
|
3182
|
+
this._unwire(), this._ownsSession && this._session?.abort(), this._session = null, this._ownsSession = !1;
|
|
3183
|
+
}
|
|
3184
|
+
_seedFromPropsOnce() {
|
|
3185
|
+
if (!this._ownsSession || this._seededFromProps) return;
|
|
3186
|
+
let e = this.requireSession(), t = this.options.getSeed(), n = {};
|
|
3187
|
+
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);
|
|
3188
|
+
}
|
|
3189
|
+
_wire(e) {
|
|
3190
|
+
this._unwire(), e.setUiBridge(this.options.createDomBridge()), this._unsubscribe = e.subscribe(() => {
|
|
3191
|
+
this.options.onRenderNeeded();
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
_unwire() {
|
|
3195
|
+
this._unsubscribe?.(), this._unsubscribe = null;
|
|
3196
|
+
}
|
|
3197
|
+
}, Nr = ":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 .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{justify-content:space-between;align-items:flex-start;gap:1rem;display:flex}:host .assistant-message-wrapper luzmo-chat-message{width:fit-content;display:contents}:host .assistant-context-menu-trigger{width:var(--luzmo-ai-chat-context-menu-trigger-size,var(--ai-chat-context-menu-trigger-size));height:var(--luzmo-ai-chat-context-menu-trigger-size,var(--ai-chat-context-menu-trigger-size));border:.0625rem solid var(--luzmo-ai-chat-context-menu-trigger-border-color,var(--ai-chat-context-menu-trigger-border-color));border-radius:var(--luzmo-ai-chat-context-menu-trigger-border-radius,var(--ai-chat-context-menu-trigger-border-radius));background:var(--luzmo-ai-chat-context-menu-trigger-background,var(--ai-chat-context-menu-trigger-background));color:var(--luzmo-ai-chat-context-menu-trigger-color,var(--ai-chat-context-menu-trigger-color));cursor:pointer;justify-content:center;align-items:center;padding:0;font-size:.875rem;line-height:1;transition:all .15s;display:inline-flex}:host .assistant-context-menu-trigger:hover{background:var(--luzmo-ai-chat-context-menu-trigger-hover-background,var(--ai-chat-context-menu-trigger-hover-background));border-color:var(--luzmo-ai-chat-context-menu-trigger-hover-border-color,var(--ai-chat-context-menu-trigger-hover-border-color));color:var(--luzmo-ai-chat-context-menu-trigger-hover-color,var(--ai-chat-context-menu-trigger-hover-color))}:host .assistant-context-menu-trigger:disabled{cursor:not-allowed;opacity:.6}:host .assistant-context-menu-trigger:disabled:hover{background:var(--luzmo-ai-chat-context-menu-trigger-background,var(--ai-chat-context-menu-trigger-background));border-color:var(--luzmo-ai-chat-context-menu-trigger-border-color,var(--ai-chat-context-menu-trigger-border-color));color:var(--luzmo-ai-chat-context-menu-trigger-color,var(--ai-chat-context-menu-trigger-color))}:host .assistant-context-menu-item{width:100%;color:var(--luzmo-font-color);text-align:start;cursor:pointer;font-family:var(--luzmo-ai-chat-context-menu-item-font-family,var(--ai-chat-context-menu-item-font-family));background:0 0;border:0;padding:.5rem .75rem}:host .assistant-context-menu-item:hover{background:var(--luzmo-ai-chat-context-menu-item-hover-background,var(--ai-chat-context-menu-item-hover-background))}:host .assistant-context-menu-item:disabled{opacity:.4;cursor:not-allowed}:host .assistant-context-menu-item:disabled:hover{background:0 0}:host luzmo-ai-interaction-textarea{flex-grow:0;flex-shrink:0}:host luzmo-progress-steps{padding:0 .25rem}:host .loading-message{color:var(--luzmo-font-color);align-items:center;gap:.5rem;display:flex}:host .loading-message svg{color:var(--luzmo-ai-chat-loading-message-color,var(--ai-chat-loading-message-color));font-size:var(--luzmo-ai-chat-loading-message-icon-font-size,var(--ai-chat-loading-message-icon-font-size,1rem));justify-content:center;align-items:center;display:flex}:host .loading-message svg.spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){:host .assistant-context-menu-trigger{transition:none}:host .loading-message svg.spin{animation:none}}:host{--ai-chat-background:var(--luzmo-background-color);--ai-chat-border-radius:0;--ai-chat-padding:0;--ai-chat-gap:1rem;--ai-chat-border:none;--ai-chat-box-shadow:none;--ai-chat-loading-message-color:var(--luzmo-primary);--ai-chat-loading-message-icon-font-size:1rem;--ai-chat-error-message-color:var(--luzmo-danger,#dc3545);--ai-chat-scrollbar-width:var(--luzmo-scrollbar-size);--ai-chat-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--ai-chat-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--ai-chat-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--ai-chat-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--ai-chat-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background);--ai-chat-context-menu-trigger-size:1.5rem;--ai-chat-context-menu-trigger-border-color:var(--luzmo-border-color);--ai-chat-context-menu-trigger-border-radius:.375rem;--ai-chat-context-menu-trigger-background:var(--luzmo-background-color,transparent);--ai-chat-context-menu-trigger-color:var(--luzmo-font-color,#5a5a5a);--ai-chat-context-menu-trigger-hover-background:var(--luzmo-background-color-hover,#4434ff14);--ai-chat-context-menu-trigger-hover-border-color:var(--luzmo-border-color-hover,var(--luzmo-border-color));--ai-chat-context-menu-trigger-hover-color:var(--luzmo-font-color,#5a5a5a);--ai-chat-context-menu-item-hover-background:var(--luzmo-background-color-hover,#4434ff14);--ai-chat-context-menu-item-font-family:var(--luzmo-font-family);--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)}", $ = class extends e {
|
|
3198
|
+
constructor(...e) {
|
|
3199
|
+
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.flagOpendata = !1, this.hideDatasetButton = !1, this.hideDatasetIcons = !1, this.disableDatasetModification = !1, this.hideSelectedDatasets = !1, this.disableColumnMentions = !1, this.requireDataset = !1, this.agent = "item", this.task = "generate", this.modelPreference = "performance", this.chatSession = null, this.conversationId = null, this.chart = null, this.dashboard = null, this.timezoneId = "UTC", this.apiVersion = "0.1.0", this.stream = !0, this.loadingMessage = null, this.initialPrompt = null, this.emptyStateTitle = "", this.emptyStateSubtitle = "", this.emptyStateSuggestions = [], this._textareaValue = "", this._lastProcessedInitialPrompt = null, this._session = new Mr({
|
|
3200
|
+
getConfig: () => this._buildSessionConfig(),
|
|
3201
|
+
getSeed: () => ({
|
|
3202
|
+
messages: this.messages,
|
|
3203
|
+
selectedDatasets: this.selectedDatasets,
|
|
3204
|
+
conversationId: this.conversationId
|
|
3205
|
+
}),
|
|
3206
|
+
createDomBridge: () => this._createDomBridgeCallbacks(),
|
|
3207
|
+
onRenderNeeded: () => {
|
|
3208
|
+
this.requestUpdate(), this.updateComplete.then(() => this._scrollToBottom());
|
|
3209
|
+
}
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
static {
|
|
3213
|
+
this.styles = c(Nr);
|
|
3214
|
+
}
|
|
3215
|
+
static {
|
|
3216
|
+
this.tagName = "luzmo-ai-chat";
|
|
3217
|
+
}
|
|
3218
|
+
get session() {
|
|
3219
|
+
return this._session.current;
|
|
3220
|
+
}
|
|
3221
|
+
_getRenderState() {
|
|
3222
|
+
return this._session.state;
|
|
3223
|
+
}
|
|
3224
|
+
_createDomBridgeCallbacks() {
|
|
3225
|
+
return {
|
|
3226
|
+
onMessageSent: (e, t) => {
|
|
3227
|
+
this.dispatchEvent(new CustomEvent("luzmo-message-sent", {
|
|
3228
|
+
detail: {
|
|
3229
|
+
message: e,
|
|
3230
|
+
selectedDatasets: t
|
|
3231
|
+
},
|
|
3232
|
+
bubbles: !0,
|
|
3233
|
+
composed: !0
|
|
3234
|
+
}));
|
|
3235
|
+
},
|
|
3236
|
+
onDatasetsChanged: (e) => {
|
|
3237
|
+
this.dispatchEvent(new CustomEvent("luzmo-datasets-changed", {
|
|
3238
|
+
detail: { selectedDatasets: e },
|
|
3239
|
+
bubbles: !0,
|
|
3240
|
+
composed: !0
|
|
3241
|
+
}));
|
|
3242
|
+
},
|
|
3243
|
+
onConversationIdChange: (e) => this._emitConversationIdChanged(e),
|
|
3244
|
+
onStep: (e) => {
|
|
3245
|
+
this.dispatchEvent(new CustomEvent("luzmo-step", {
|
|
3246
|
+
detail: e,
|
|
3247
|
+
bubbles: !0,
|
|
3248
|
+
composed: !0
|
|
3249
|
+
}));
|
|
3250
|
+
},
|
|
3251
|
+
onComplete: (e) => {
|
|
3252
|
+
this.dispatchEvent(new CustomEvent("luzmo-complete", {
|
|
3253
|
+
detail: e,
|
|
3254
|
+
bubbles: !0,
|
|
3255
|
+
composed: !0
|
|
3256
|
+
}));
|
|
3257
|
+
},
|
|
3258
|
+
onPromptStopped: () => {
|
|
3259
|
+
this.dispatchEvent(new CustomEvent("luzmo-stop", {
|
|
3260
|
+
bubbles: !0,
|
|
3261
|
+
composed: !0
|
|
3262
|
+
}));
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3265
|
+
}
|
|
3266
|
+
_buildSessionConfig() {
|
|
3267
|
+
return {
|
|
3268
|
+
agent: this.agent,
|
|
3269
|
+
authKey: this.authKey,
|
|
3270
|
+
authToken: this.authToken,
|
|
3271
|
+
apiUrl: this.apiUrl,
|
|
3272
|
+
apiVersion: this.apiVersion,
|
|
3273
|
+
stream: this.stream,
|
|
3274
|
+
conversationId: this.conversationId,
|
|
3275
|
+
chart: this.chart,
|
|
3276
|
+
dashboard: this.dashboard,
|
|
3277
|
+
currentScreenMode: this.currentScreenMode,
|
|
3278
|
+
localeId: this.localeId,
|
|
3279
|
+
timezoneId: this.timezoneId,
|
|
3280
|
+
task: this.task,
|
|
3281
|
+
modelPreference: this.modelPreference,
|
|
3282
|
+
requireDataset: this.requireDataset
|
|
3283
|
+
};
|
|
3284
|
+
}
|
|
3285
|
+
_emitConversationIdChanged(e) {
|
|
3286
|
+
this.conversationId = e, this.dispatchEvent(new CustomEvent("luzmo-conversation-id-changed", {
|
|
3287
|
+
detail: { conversationId: e },
|
|
3288
|
+
bubbles: !0,
|
|
3289
|
+
composed: !0
|
|
3290
|
+
}));
|
|
3291
|
+
}
|
|
3292
|
+
async _restoreViaSession(e, t) {
|
|
3293
|
+
await this._session.requireSession().restore({
|
|
3294
|
+
restoreToMessageId: e,
|
|
3295
|
+
messageIndex: t
|
|
3296
|
+
});
|
|
3297
|
+
}
|
|
3298
|
+
async _handleRestoreState(e, t) {
|
|
3299
|
+
if (e.apiMessageId && this.agent === "item") try {
|
|
3300
|
+
await this._restoreViaSession(e.apiMessageId, t);
|
|
3301
|
+
} catch (e) {
|
|
3302
|
+
console.error("AI restore error:", e);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
_handleDatasetSelected(e) {
|
|
3306
|
+
this._session.requireSession().addDataset(e.detail);
|
|
3307
|
+
}
|
|
3308
|
+
_handleDatasetRemoved(e) {
|
|
3309
|
+
this._session.requireSession().removeDataset(e.detail.id);
|
|
3310
|
+
}
|
|
3311
|
+
async _submitViaSession(e, t = {}) {
|
|
3312
|
+
let n = this._session.requireSession();
|
|
3313
|
+
if (n.isDatasetRequirementMet()) {
|
|
3314
|
+
this._textareaValue = "";
|
|
3315
|
+
try {
|
|
3316
|
+
await n.submit({
|
|
3317
|
+
prompt: e,
|
|
3318
|
+
...t
|
|
3319
|
+
});
|
|
3320
|
+
} catch (e) {
|
|
3321
|
+
e.name !== "AbortError" && console.error("AI prompt session error:", e);
|
|
3322
|
+
}
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
async _handlePromptSubmitted(e) {
|
|
3326
|
+
await this._submitViaSession(e.detail.prompt);
|
|
3327
|
+
}
|
|
3328
|
+
_handlePromptStopped() {
|
|
3329
|
+
let e = this._session.current;
|
|
3330
|
+
if (this._textareaValue = "", e) {
|
|
3331
|
+
e.abort({ notify: !0 });
|
|
3332
|
+
return;
|
|
3333
|
+
}
|
|
3334
|
+
this.dispatchEvent(new CustomEvent("luzmo-stop", {
|
|
3335
|
+
bubbles: !0,
|
|
3336
|
+
composed: !0
|
|
3337
|
+
}));
|
|
3338
|
+
}
|
|
3339
|
+
async _handleEmptyStateSuggestionSelected(e) {
|
|
3340
|
+
let { prompt: t, selectedDatasets: n } = e.detail, r = this._session.requireSession();
|
|
3341
|
+
n?.length && r.setSelectedDatasets(n), await this._submitViaSession(t);
|
|
3342
|
+
}
|
|
3343
|
+
async _processInitialPrompt() {
|
|
3344
|
+
!this.initialPrompt || this.initialPrompt === this._lastProcessedInitialPrompt || this._session.requireSession().isDatasetRequirementMet() && (this._lastProcessedInitialPrompt = this.initialPrompt, await this._submitViaSession(this.initialPrompt, { skipUserMessage: !0 }));
|
|
3345
|
+
}
|
|
3346
|
+
connectedCallback() {
|
|
3347
|
+
super.connectedCallback(), this._session.connect();
|
|
3348
|
+
}
|
|
3349
|
+
disconnectedCallback() {
|
|
3350
|
+
super.disconnectedCallback(), this._session.teardown();
|
|
3351
|
+
}
|
|
3352
|
+
_scrollToBottom() {
|
|
3353
|
+
let e = this.shadowRoot?.querySelector(".chat-messages-container");
|
|
3354
|
+
e && requestAnimationFrame(() => {
|
|
3355
|
+
requestAnimationFrame(() => {
|
|
3356
|
+
e.scrollTop = e.scrollHeight;
|
|
3357
|
+
});
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3360
|
+
updated(e) {
|
|
3361
|
+
super.updated?.(e), this._syncSession(e), this._handleInitialPromptChange();
|
|
3362
|
+
}
|
|
3363
|
+
_syncSession(e) {
|
|
3364
|
+
if (e.has("chatSession")) {
|
|
3365
|
+
this._session.setSession(this.chatSession);
|
|
3366
|
+
return;
|
|
3367
|
+
}
|
|
3368
|
+
this._session.syncProperties(e);
|
|
3369
|
+
}
|
|
3370
|
+
_handleInitialPromptChange() {
|
|
3371
|
+
this.initialPrompt && this.initialPrompt !== this._lastProcessedInitialPrompt ? this._processInitialPrompt() : this.initialPrompt || (this._lastProcessedInitialPrompt = null);
|
|
3372
|
+
}
|
|
3373
|
+
_renderMarkdown(e) {
|
|
3374
|
+
let t = String(Q.parse(e, { async: !1 }));
|
|
3375
|
+
return st.sanitize(t, {
|
|
3376
|
+
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("."),
|
|
3377
|
+
ALLOWED_ATTR: [
|
|
3378
|
+
"href",
|
|
3379
|
+
"title",
|
|
3380
|
+
"target",
|
|
3381
|
+
"rel"
|
|
3382
|
+
],
|
|
3383
|
+
ALLOW_DATA_ATTR: !1,
|
|
3384
|
+
FORBID_TAGS: [
|
|
3385
|
+
"script",
|
|
3386
|
+
"style",
|
|
3387
|
+
"iframe",
|
|
3388
|
+
"object",
|
|
3389
|
+
"embed",
|
|
3390
|
+
"link",
|
|
3391
|
+
"form",
|
|
3392
|
+
"input",
|
|
3393
|
+
"button"
|
|
3394
|
+
],
|
|
3395
|
+
FORBID_ATTR: [
|
|
3396
|
+
"onerror",
|
|
3397
|
+
"onload",
|
|
3398
|
+
"onclick",
|
|
3399
|
+
"onmouseover",
|
|
3400
|
+
"onfocus",
|
|
3401
|
+
"onblur"
|
|
3402
|
+
]
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3405
|
+
_renderProgress() {
|
|
3406
|
+
let { progress: e, progressCollapsed: t } = this._getRenderState();
|
|
3407
|
+
return e?.children?.length ? o`
|
|
3408
|
+
<luzmo-progress-steps
|
|
3409
|
+
.progress=${e}
|
|
3410
|
+
?collapsed=${t}
|
|
3411
|
+
size="s"
|
|
3412
|
+
></luzmo-progress-steps>
|
|
3413
|
+
` : s;
|
|
3414
|
+
}
|
|
3415
|
+
_isLastAiMessageWithProgress(e, t) {
|
|
3416
|
+
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;
|
|
3417
|
+
return !1;
|
|
3418
|
+
}
|
|
3419
|
+
_renderRestoreMenu(e, t, a, c = !1) {
|
|
3420
|
+
if (!(this.agent === "item" && this.showAssistantContextMenu && e.hasChart && e.apiMessageId && !e.isError && e.id !== a)) return s;
|
|
3421
|
+
let l = `context-menu-trigger-${e.apiMessageId}`;
|
|
3422
|
+
return o`
|
|
3423
|
+
<div class="assistant-context-menu">
|
|
3424
|
+
<button
|
|
3425
|
+
id=${l}
|
|
3426
|
+
class="assistant-context-menu-trigger"
|
|
3427
|
+
type="button"
|
|
3428
|
+
aria-label=${n("Open restore menu", { desc: "Accessible label for the ai chat restore menu trigger" })}
|
|
3429
|
+
aria-haspopup="menu"
|
|
3430
|
+
?disabled=${c}
|
|
3431
|
+
>
|
|
3432
|
+
${i(r)}
|
|
3433
|
+
</button>
|
|
3434
|
+
<luzmo-overlay
|
|
3435
|
+
trigger="${l}@click"
|
|
3436
|
+
placement="bottom-end"
|
|
3437
|
+
>
|
|
3438
|
+
<luzmo-popover>
|
|
3439
|
+
<button
|
|
3440
|
+
class="assistant-context-menu-item"
|
|
3441
|
+
type="button"
|
|
3442
|
+
?disabled=${c}
|
|
3443
|
+
@click=${() => this._handleRestoreState(e, t)}
|
|
3444
|
+
>
|
|
3445
|
+
${n("Restore state", { desc: "Context menu action that restores the chart to this message state" })}
|
|
3446
|
+
</button>
|
|
3447
|
+
</luzmo-popover>
|
|
3448
|
+
</luzmo-overlay>
|
|
3449
|
+
</div>
|
|
3450
|
+
`;
|
|
3451
|
+
}
|
|
3452
|
+
_renderMessages() {
|
|
3453
|
+
let { messages: e, inflightMessage: t, isGenerating: n } = this._getRenderState(), r = t !== null, i = [...e].reverse().find((e) => e.type === "ai")?.id, a = e.filter((e) => !t || e.id !== t.id);
|
|
3454
|
+
return a.map((t) => {
|
|
3455
|
+
let c = !!t.progress?.children?.length, l = c && this._isLastAiMessageWithProgress(t, a), u = c && (r || n || !l), ee = c ? o`
|
|
3456
|
+
<luzmo-progress-steps
|
|
3457
|
+
.progress=${t.progress}
|
|
3458
|
+
?condensed=${u}
|
|
3459
|
+
collapsed
|
|
3460
|
+
no-animate
|
|
3461
|
+
size="s"
|
|
3462
|
+
></luzmo-progress-steps>
|
|
3463
|
+
` : s;
|
|
3464
|
+
if (t.type === "user") return o`
|
|
3465
|
+
<luzmo-chat-message
|
|
3466
|
+
avatar-placement="bottom"
|
|
3467
|
+
position="right"
|
|
3468
|
+
variant="primary"
|
|
3469
|
+
size="s"
|
|
3470
|
+
>
|
|
3471
|
+
${t.message}
|
|
3472
|
+
</luzmo-chat-message>
|
|
3473
|
+
`;
|
|
3474
|
+
let te = e.indexOf(t);
|
|
3475
|
+
return o`
|
|
3476
|
+
${ee}
|
|
3477
|
+
<div class="assistant-message-wrapper">
|
|
3478
|
+
<luzmo-chat-message
|
|
3479
|
+
class=${t.isError ? "error" : ""}
|
|
3480
|
+
role=${t.isError ? "alert" : s}
|
|
3481
|
+
avatar-placement="bottom"
|
|
3482
|
+
position="left"
|
|
3483
|
+
quiet
|
|
3484
|
+
size="s"
|
|
3485
|
+
>
|
|
3486
|
+
<div class="markdown-content">${d(this._renderMarkdown(t.message))}</div>
|
|
3487
|
+
</luzmo-chat-message>
|
|
3488
|
+
|
|
3489
|
+
${this._renderRestoreMenu(t, te, i, r)}
|
|
3490
|
+
</div>
|
|
3491
|
+
`;
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
_renderStreamingResponse() {
|
|
3495
|
+
let { inflightMessage: e } = this._getRenderState();
|
|
3496
|
+
return e?.message ? o`
|
|
3497
|
+
<luzmo-chat-message
|
|
3498
|
+
avatar-placement="bottom"
|
|
3499
|
+
position="left"
|
|
3500
|
+
quiet
|
|
3501
|
+
size="s"
|
|
3502
|
+
>
|
|
3503
|
+
<div class="markdown-content">${d(this._renderMarkdown(e.message))}</div>
|
|
3504
|
+
</luzmo-chat-message>
|
|
3505
|
+
` : s;
|
|
3506
|
+
}
|
|
3507
|
+
_renderLoadingMessage() {
|
|
3508
|
+
let { isGenerating: e, progress: t, inflightMessage: r } = this._getRenderState();
|
|
3509
|
+
if (!e || t?.children?.length || r?.message) return s;
|
|
3510
|
+
let c = this.agent === "dashboard" ? !this.dashboard : this.chart?.type === "placeholder", l = this.agent === "dashboard" ? c ? n("Creating dashboard...", { desc: "Label for ai chat creating dashboard message" }) : n("Updating dashboard...", { desc: "Label for ai chat updating dashboard message" }) : c ? n("Creating item...", { desc: "Label for ai chat creating item message" }) : n("Updating item...", { desc: "Label for ai chat updating item message" });
|
|
3511
|
+
return o`
|
|
3512
|
+
<luzmo-chat-message
|
|
3513
|
+
avatar-placement="bottom"
|
|
3514
|
+
position="left"
|
|
3515
|
+
quiet
|
|
3516
|
+
size="s"
|
|
3517
|
+
>
|
|
3518
|
+
<div class="loading-message" role="status" aria-live="polite">
|
|
3519
|
+
<span class="icon-lg">${i(a, { className: "spin" })}</span>
|
|
3520
|
+
<span class="loading-message-text">${this.loadingMessage || l}</span>
|
|
3521
|
+
</div>
|
|
3522
|
+
</luzmo-chat-message>
|
|
3523
|
+
`;
|
|
3524
|
+
}
|
|
3525
|
+
_renderEmptyState() {
|
|
3526
|
+
if (this._getRenderState().messages.length > 0) return s;
|
|
3527
|
+
let e = n("What can I help you with?", { desc: "Title for the AI chat empty state" }), t = this.emptyStateSuggestions.length > 0;
|
|
3528
|
+
return o`
|
|
3529
|
+
<luzmo-ai-chat-empty-state
|
|
3530
|
+
.title=${this.emptyStateTitle || e}
|
|
3531
|
+
.subtitle=${t ? this.emptyStateSubtitle : ""}
|
|
3532
|
+
.suggestions=${this.emptyStateSuggestions}
|
|
3533
|
+
?disabled=${this.disabled || this._getRenderState().isGenerating}
|
|
3534
|
+
@luzmo-suggestion-selected=${this._handleEmptyStateSuggestionSelected}
|
|
3535
|
+
></luzmo-ai-chat-empty-state>
|
|
3536
|
+
`;
|
|
3537
|
+
}
|
|
3538
|
+
render() {
|
|
3539
|
+
let { selectedDatasets: e, isGenerating: t } = this._getRenderState();
|
|
3540
|
+
return o`
|
|
3541
|
+
<div class="chat-container" role="region" aria-label=${n("AI Chat", { desc: "Accessible label for AI chat region" })}>
|
|
3542
|
+
<div class="chat-messages-container" role="log" aria-live="polite">
|
|
3543
|
+
${this._renderEmptyState()}
|
|
3544
|
+
${this._renderMessages()}
|
|
3545
|
+
${this._renderProgress()}
|
|
3546
|
+
${this._renderStreamingResponse()}
|
|
3547
|
+
${this._renderLoadingMessage()}
|
|
3548
|
+
</div>
|
|
3549
|
+
|
|
3550
|
+
<luzmo-ai-interaction-textarea
|
|
3551
|
+
role="group"
|
|
3552
|
+
aria-label=${n("AI prompt input", { desc: "Accessible label for the ai chat prompt input area" })}
|
|
3553
|
+
.value=${this._textareaValue}
|
|
3554
|
+
.selectedDatasets=${e}
|
|
3555
|
+
.placeholder=${this.placeholder}
|
|
3556
|
+
?disabled=${this.disabled}
|
|
3557
|
+
?is-generating=${t}
|
|
3558
|
+
?stoppable=${this.stoppable}
|
|
3559
|
+
?hide-dataset-button=${this.hideDatasetButton}
|
|
3560
|
+
?hide-dataset-icons=${this.hideDatasetIcons}
|
|
3561
|
+
?disable-dataset-modification=${this.disableDatasetModification}
|
|
3562
|
+
?hide-selected-datasets=${this.hideSelectedDatasets}
|
|
3563
|
+
?disable-column-mentions=${this.disableColumnMentions}
|
|
3564
|
+
?require-dataset=${this.requireDataset}
|
|
3565
|
+
auth-key=${this.authKey}
|
|
3566
|
+
auth-token=${this.authToken}
|
|
3567
|
+
api-url=${this.apiUrl}
|
|
3568
|
+
app-server=${this.appServer}
|
|
3569
|
+
?flag-opendata=${this.flagOpendata}
|
|
3570
|
+
@prompt-submitted=${this._handlePromptSubmitted}
|
|
3571
|
+
@prompt-stopped=${this._handlePromptStopped}
|
|
3572
|
+
@dataset-selected=${this._handleDatasetSelected}
|
|
3573
|
+
@dataset-removed=${this._handleDatasetRemoved}
|
|
3574
|
+
></luzmo-ai-interaction-textarea>
|
|
3575
|
+
</div>
|
|
3576
|
+
`;
|
|
3577
|
+
}
|
|
3578
|
+
};
|
|
3579
|
+
t([l({ type: Array })], $.prototype, "messages", void 0), t([l({
|
|
3580
|
+
type: Array,
|
|
3581
|
+
attribute: "selected-datasets"
|
|
3582
|
+
})], $.prototype, "selectedDatasets", void 0), t([l({ type: String })], $.prototype, "placeholder", void 0), t([l({
|
|
3583
|
+
type: Boolean,
|
|
3584
|
+
reflect: !0
|
|
3585
|
+
})], $.prototype, "disabled", void 0), t([l({
|
|
3586
|
+
type: Boolean,
|
|
3587
|
+
reflect: !0
|
|
3588
|
+
})], $.prototype, "stoppable", void 0), t([l({
|
|
3589
|
+
type: Boolean,
|
|
3590
|
+
attribute: "show-assistant-context-menu"
|
|
3591
|
+
})], $.prototype, "showAssistantContextMenu", void 0), t([l({
|
|
3592
|
+
type: String,
|
|
3593
|
+
attribute: "auth-key"
|
|
3594
|
+
})], $.prototype, "authKey", void 0), t([l({
|
|
3595
|
+
type: String,
|
|
3596
|
+
attribute: "auth-token"
|
|
3597
|
+
})], $.prototype, "authToken", void 0), t([l({
|
|
3598
|
+
type: String,
|
|
3599
|
+
attribute: "api-url"
|
|
3600
|
+
})], $.prototype, "apiUrl", void 0), t([l({
|
|
3601
|
+
type: String,
|
|
3602
|
+
attribute: "app-server"
|
|
3603
|
+
})], $.prototype, "appServer", void 0), t([l({
|
|
3604
|
+
type: Boolean,
|
|
3605
|
+
attribute: "flag-opendata"
|
|
3606
|
+
})], $.prototype, "flagOpendata", void 0), t([l({
|
|
3607
|
+
type: Boolean,
|
|
3608
|
+
attribute: "hide-dataset-button"
|
|
3609
|
+
})], $.prototype, "hideDatasetButton", void 0), t([l({
|
|
3610
|
+
type: Boolean,
|
|
3611
|
+
attribute: "hide-dataset-icons"
|
|
3612
|
+
})], $.prototype, "hideDatasetIcons", void 0), t([l({
|
|
3613
|
+
type: Boolean,
|
|
3614
|
+
attribute: "disable-dataset-modification"
|
|
3615
|
+
})], $.prototype, "disableDatasetModification", void 0), t([l({
|
|
3616
|
+
type: Boolean,
|
|
3617
|
+
attribute: "hide-selected-datasets"
|
|
3618
|
+
})], $.prototype, "hideSelectedDatasets", void 0), t([l({
|
|
3619
|
+
type: Boolean,
|
|
3620
|
+
attribute: "disable-column-mentions"
|
|
3621
|
+
})], $.prototype, "disableColumnMentions", void 0), t([l({
|
|
3622
|
+
type: Boolean,
|
|
3623
|
+
attribute: "require-dataset"
|
|
3624
|
+
})], $.prototype, "requireDataset", void 0), t([l({ type: String })], $.prototype, "agent", void 0), t([l({ type: String })], $.prototype, "task", void 0), t([l({
|
|
3625
|
+
type: String,
|
|
3626
|
+
attribute: "model-preference"
|
|
3627
|
+
})], $.prototype, "modelPreference", void 0), t([l({ attribute: !1 })], $.prototype, "chatSession", void 0), t([l({
|
|
3628
|
+
type: String,
|
|
3629
|
+
attribute: "conversation-id"
|
|
3630
|
+
})], $.prototype, "conversationId", void 0), t([l({
|
|
3631
|
+
type: Object,
|
|
3632
|
+
attribute: "chart"
|
|
3633
|
+
})], $.prototype, "chart", void 0), t([l({ type: Object })], $.prototype, "dashboard", void 0), t([l({
|
|
3634
|
+
type: String,
|
|
3635
|
+
attribute: "current-screen-mode"
|
|
3636
|
+
})], $.prototype, "currentScreenMode", void 0), t([l({
|
|
3637
|
+
type: String,
|
|
3638
|
+
attribute: "locale-id"
|
|
3639
|
+
})], $.prototype, "localeId", void 0), t([l({
|
|
3640
|
+
type: String,
|
|
3641
|
+
attribute: "timezone-id"
|
|
3642
|
+
})], $.prototype, "timezoneId", void 0), t([l({
|
|
3643
|
+
type: String,
|
|
3644
|
+
attribute: "api-version"
|
|
3645
|
+
})], $.prototype, "apiVersion", void 0), t([l({ converter: { fromAttribute: (e) => e !== "false" && e !== null } })], $.prototype, "stream", void 0), t([l({
|
|
3646
|
+
type: String,
|
|
3647
|
+
attribute: "loading-message"
|
|
3648
|
+
})], $.prototype, "loadingMessage", void 0), t([l({
|
|
3649
|
+
type: String,
|
|
3650
|
+
attribute: "initial-prompt"
|
|
3651
|
+
})], $.prototype, "initialPrompt", void 0), t([l({
|
|
3652
|
+
type: String,
|
|
3653
|
+
attribute: "empty-state-title"
|
|
3654
|
+
})], $.prototype, "emptyStateTitle", void 0), t([l({
|
|
3655
|
+
type: String,
|
|
3656
|
+
attribute: "empty-state-subtitle"
|
|
3657
|
+
})], $.prototype, "emptyStateSubtitle", void 0), t([l({
|
|
3658
|
+
type: Array,
|
|
3659
|
+
attribute: !1
|
|
3660
|
+
})], $.prototype, "emptyStateSuggestions", void 0), t([u()], $.prototype, "_textareaValue", void 0);
|
|
3661
|
+
//#endregion
|
|
3662
|
+
//#region src/components/ai-chat/ai-chat-events.ts
|
|
3663
|
+
function Pr(e) {
|
|
3664
|
+
return e.recognized === !0;
|
|
3665
|
+
}
|
|
3666
|
+
//#endregion
|
|
3667
|
+
//#region src/components/ai-chat/index.ts
|
|
3668
|
+
customElements.get("luzmo-ai-chat") || customElements.define("luzmo-ai-chat", $);
|
|
3669
|
+
//#endregion
|
|
3670
|
+
export { vn as C, xn as S, gn as T, En as _, jr as a, Cn as b, Er as c, Un as d, jn as f, An as g, On as h, Ar as i, Tr as l, Dn as m, $ as n, Or as o, Mn as p, Mr as r, Dr as s, Pr as t, zn as u, wn as v, _n as w, Sn as x, Tn as y };
|