@sdata/web-vue 3.18.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/dist/sd.css +489 -0
  2. package/dist/sd.min.css +2 -2
  3. package/es/_components/icon-hover.vue.d.ts +1 -1
  4. package/es/_components/input-label/input-label.d.ts +13 -1
  5. package/es/_components/input-label/input-label.js +35 -5
  6. package/es/_components/input-label/style/index.css +6 -0
  7. package/es/_components/input-label/style/input-label.scss +8 -0
  8. package/es/_components/picker/input-range.vue.d.ts +24 -1
  9. package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +42 -6
  10. package/es/_components/picker/input.vue.d.ts +24 -1
  11. package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +31 -4
  12. package/es/_components/picker/style/index.scss +8 -0
  13. package/es/_components/select-view/select-view.d.ts +15 -3
  14. package/es/_components/select-view/select-view.js +10 -1
  15. package/es/_components/select-view/style/index.css +12 -0
  16. package/es/_components/virtual-list/virtual-list.vue.d.ts +6 -6
  17. package/es/_hooks/use-fit-width.d.ts +22 -0
  18. package/es/_hooks/use-fit-width.js +76 -0
  19. package/es/_hooks/use-form-item.d.ts +1 -1
  20. package/es/_hooks/use-size.d.ts +1 -1
  21. package/es/anchor/anchor.vue.d.ts +1 -1
  22. package/es/anchor/index.d.ts +3 -3
  23. package/es/auto-complete/auto-complete.d.ts +20 -2
  24. package/es/auto-complete/auto-complete.js +18 -0
  25. package/es/auto-complete/index.d.ts +36 -6
  26. package/es/basic-crud-table/basic-crud-table.vue.d.ts +2 -2
  27. package/es/basic-crud-table/basic-crud-table.vue_vue_type_script_setup_true_lang.js +6 -4
  28. package/es/basic-crud-table/index.d.ts +5 -5
  29. package/es/basic-crud-table/types.d.ts +2 -0
  30. package/es/button/button.vue.d.ts +2 -2
  31. package/es/button/index.d.ts +6 -6
  32. package/es/card/card.d.ts +25 -3
  33. package/es/card/card.js +11 -2
  34. package/es/card/index.d.ts +45 -6
  35. package/es/carousel/carousel-indicator.vue.d.ts +1 -1
  36. package/es/cascader/base-cascader-panel.d.ts +4 -1
  37. package/es/cascader/base-cascader-panel.js +2 -1
  38. package/es/cascader/cascader-option.d.ts +1 -1
  39. package/es/cascader/cascader-panel.vue.d.ts +1 -1
  40. package/es/cascader/cascader-search-panel.d.ts +4 -1
  41. package/es/cascader/cascader-search-panel.js +2 -1
  42. package/es/cascader/cascader.vue.d.ts +7 -5
  43. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +22 -2
  44. package/es/cascader/types.d.ts +4 -1
  45. package/es/checkbox/checkbox.d.ts +3 -3
  46. package/es/checkbox/index.d.ts +6 -6
  47. package/es/collapse/collapse-item.d.ts +3 -3
  48. package/es/collapse/index.d.ts +3 -3
  49. package/es/color-picker/color-picker.d.ts +2 -2
  50. package/es/color-picker/index.d.ts +6 -6
  51. package/es/components.d.ts +4 -0
  52. package/es/config-provider/config-provider.vue.d.ts +68 -1
  53. package/es/config-provider/config-provider.vue_vue_type_script_setup_true_lang.js +67 -1
  54. package/es/config-provider/context.d.ts +12 -0
  55. package/es/config-provider/index.d.ts +102 -3
  56. package/es/date-picker/index.d.ts +87 -23
  57. package/es/date-picker/interface.d.ts +2 -1
  58. package/es/date-picker/picker-panel.vue.d.ts +1 -1
  59. package/es/date-picker/picker.vue.d.ts +39 -17
  60. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +30 -1
  61. package/es/date-picker/pickers/date-picker.d.ts +18 -0
  62. package/es/date-picker/pickers/date-picker.js +16 -0
  63. package/es/date-picker/range-picker-panel.vue.d.ts +1 -1
  64. package/es/date-picker/range-picker.vue.d.ts +39 -17
  65. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +27 -1
  66. package/es/date-picker/style/index.css +6 -0
  67. package/es/descriptions/descriptions.d.ts +3 -3
  68. package/es/descriptions/index.d.ts +9 -9
  69. package/es/divider/divider.d.ts +1 -1
  70. package/es/divider/index.d.ts +3 -3
  71. package/es/drawer/drawer.vue.d.ts +4 -4
  72. package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +1 -1
  73. package/es/drawer/index.d.ts +11 -11
  74. package/es/dropdown/dropdown-button.vue.d.ts +2 -2
  75. package/es/dropdown/dropdown-option.vue.d.ts +1 -1
  76. package/es/dropdown/dropdown-submenu.vue.d.ts +2 -2
  77. package/es/dropdown/dropdown.vue.d.ts +1 -1
  78. package/es/dropdown/index.d.ts +21 -21
  79. package/es/ellipsis/ellipsis.vue.d.ts +1 -1
  80. package/es/ellipsis/index.d.ts +6 -6
  81. package/es/ellipsis/performant-ellipsis.vue.d.ts +1 -1
  82. package/es/form/form-item.vue.d.ts +1 -1
  83. package/es/form/form.vue.d.ts +1 -1
  84. package/es/form/index.d.ts +9 -9
  85. package/es/grid/grid-row.vue.d.ts +3 -3
  86. package/es/grid/index.d.ts +9 -9
  87. package/es/icon/icon-arrow-up/icon-arrow-up.js +5 -0
  88. package/es/icon/icon-arrow-up/icon-arrow-up.vue_vue_type_script_setup_true_lang.js +52 -0
  89. package/es/icon/icon-arrow-up/index.js +9 -0
  90. package/es/icon/icon-mute/icon-mute.js +5 -0
  91. package/es/icon/icon-mute/icon-mute.vue_vue_type_script_setup_true_lang.js +52 -0
  92. package/es/icon/icon-mute/index.js +9 -0
  93. package/es/icon/icon-voice/icon-voice.js +5 -0
  94. package/es/icon/icon-voice/icon-voice.vue_vue_type_script_setup_true_lang.js +52 -0
  95. package/es/icon/icon-voice/index.js +9 -0
  96. package/es/image/preview-action.d.ts +6 -6
  97. package/es/image/preview-group.vue.d.ts +1 -1
  98. package/es/index.css +489 -0
  99. package/es/index.d.ts +6 -1
  100. package/es/index.js +5 -1
  101. package/es/index.scss +2 -0
  102. package/es/input/index.d.ts +99 -6
  103. package/es/input/input-password.vue.d.ts +18 -0
  104. package/es/input/input-password.vue_vue_type_script_setup_true_lang.js +24 -2
  105. package/es/input/input-search.d.ts +18 -0
  106. package/es/input/input-search.js +20 -2
  107. package/es/input/input.d.ts +29 -2
  108. package/es/input/input.js +45 -3
  109. package/es/input/style/index.css +16 -0
  110. package/es/input/style/index.scss +21 -0
  111. package/es/input-number/index.d.ts +36 -6
  112. package/es/input-number/input-number.d.ts +20 -2
  113. package/es/input-number/input-number.js +19 -0
  114. package/es/input-tag/index.d.ts +36 -6
  115. package/es/input-tag/input-tag.d.ts +20 -2
  116. package/es/input-tag/input-tag.js +35 -4
  117. package/es/input-tag/style/index.css +6 -0
  118. package/es/input-tag/style/input-tag.scss +8 -0
  119. package/es/kv-list/index.d.ts +72 -32
  120. package/es/link/index.d.ts +6 -6
  121. package/es/link/link.vue.d.ts +2 -2
  122. package/es/list/index.d.ts +9 -0
  123. package/es/list/list.d.ts +7 -0
  124. package/es/list/list.js +8 -2
  125. package/es/locale/interface.d.ts +22 -0
  126. package/es/locale/lang/ar-eg.js +21 -1
  127. package/es/locale/lang/de-de.js +21 -1
  128. package/es/locale/lang/en-us.js +21 -1
  129. package/es/locale/lang/es-es.js +21 -1
  130. package/es/locale/lang/fr-fr.js +21 -1
  131. package/es/locale/lang/id-id.js +21 -1
  132. package/es/locale/lang/it-it.js +21 -1
  133. package/es/locale/lang/ja-jp.js +21 -1
  134. package/es/locale/lang/km-kh.js +21 -1
  135. package/es/locale/lang/ko-kr.js +21 -1
  136. package/es/locale/lang/ms-my.js +21 -1
  137. package/es/locale/lang/nl-nl.js +21 -1
  138. package/es/locale/lang/pt-pt.js +21 -1
  139. package/es/locale/lang/ru-ru.js +21 -1
  140. package/es/locale/lang/th-th.js +21 -1
  141. package/es/locale/lang/vi-vn.js +21 -1
  142. package/es/locale/lang/zh-cn.js +21 -1
  143. package/es/locale/lang/zh-tw.js +21 -1
  144. package/es/mention/index.d.ts +39 -9
  145. package/es/mention/mention.d.ts +21 -3
  146. package/es/mention/mention.js +24 -1
  147. package/es/mention/style/index.css +6 -0
  148. package/es/mention/style/index.scss +8 -0
  149. package/es/menu/item.d.ts +1 -1
  150. package/es/message/message-list.d.ts +1 -1
  151. package/es/modal/index.d.ts +9 -9
  152. package/es/modal/modal.vue.d.ts +3 -3
  153. package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +1 -1
  154. package/es/popconfirm/index.d.ts +3 -3
  155. package/es/popconfirm/popconfirm.vue.d.ts +1 -1
  156. package/es/popover/index.d.ts +6 -6
  157. package/es/popover/popover.vue.d.ts +2 -2
  158. package/es/progress/circle.vue.d.ts +1 -1
  159. package/es/progress/line.vue.d.ts +1 -1
  160. package/es/qr-code/index.d.ts +27 -21
  161. package/es/qr-code/qr-code.vue.d.ts +8 -6
  162. package/es/qr-code/qr-code.vue_vue_type_script_setup_true_lang.js +5 -2
  163. package/es/radio/index.d.ts +6 -6
  164. package/es/radio/radio.d.ts +3 -3
  165. package/es/rate/index.d.ts +3 -3
  166. package/es/rate/rate.d.ts +1 -1
  167. package/es/resize-box/index.d.ts +5 -5
  168. package/es/resize-box/resize-box.vue.d.ts +3 -3
  169. package/es/rich-text-editor/built-in-components.d.ts +5 -0
  170. package/es/rich-text-editor/built-in-components.js +6 -0
  171. package/es/rich-text-editor/index.d.ts +195 -0
  172. package/es/rich-text-editor/index.js +12 -0
  173. package/es/rich-text-editor/nodes/inline-component-node.d.ts +30 -0
  174. package/es/rich-text-editor/nodes/inline-component-node.js +86 -0
  175. package/es/rich-text-editor/rich-text-editor.js +5 -0
  176. package/es/rich-text-editor/rich-text-editor.vue.d.ts +76 -0
  177. package/es/rich-text-editor/rich-text-editor.vue_vue_type_script_setup_true_lang.js +630 -0
  178. package/es/rich-text-editor/rich-text-node-renderer.js +5 -0
  179. package/es/rich-text-editor/rich-text-node-renderer.vue.d.ts +28 -0
  180. package/es/rich-text-editor/rich-text-node-renderer.vue_vue_type_script_setup_true_lang.js +133 -0
  181. package/es/rich-text-editor/style/css.js +2 -0
  182. package/es/rich-text-editor/style/index.css +164 -0
  183. package/es/rich-text-editor/style/index.d.ts +2 -0
  184. package/es/rich-text-editor/style/index.js +2 -0
  185. package/es/rich-text-editor/style/index.scss +193 -0
  186. package/es/rich-text-editor/style/token.scss +36 -0
  187. package/es/rich-text-editor/types.d.ts +148 -0
  188. package/es/sd-vue.js +6 -0
  189. package/es/select/index.d.ts +117 -54
  190. package/es/select/interface.d.ts +2 -1
  191. package/es/select/select-dropdown.vue.d.ts +3 -0
  192. package/es/select/select-dropdown.vue_vue_type_script_setup_true_lang.js +2 -4
  193. package/es/select/select.d.ts +62 -25
  194. package/es/select/select.js +28 -1
  195. package/es/sender/context.d.ts +8 -0
  196. package/es/sender/context.js +4 -0
  197. package/es/sender/index.d.ts +119 -0
  198. package/es/sender/index.js +20 -0
  199. package/es/sender/sender-header.js +5 -0
  200. package/es/sender/sender-header.vue.d.ts +28 -0
  201. package/es/sender/sender-header.vue_vue_type_script_setup_true_lang.js +127 -0
  202. package/es/sender/sender-switch.js +5 -0
  203. package/es/sender/sender-switch.vue.d.ts +32 -0
  204. package/es/sender/sender-switch.vue_vue_type_script_setup_true_lang.js +95 -0
  205. package/es/sender/sender.js +5 -0
  206. package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +895 -0
  207. package/es/sender/style/css.js +3 -0
  208. package/es/sender/style/index.css +301 -0
  209. package/es/sender/style/index.d.ts +3 -0
  210. package/es/sender/style/index.js +3 -0
  211. package/es/sender/style/index.scss +359 -0
  212. package/es/sender/style/token.scss +43 -0
  213. package/es/sender/types.d.ts +228 -0
  214. package/es/sender/use-speech.d.ts +19 -0
  215. package/es/sender/use-speech.js +338 -0
  216. package/es/slider/index.d.ts +3 -3
  217. package/es/slider/slider-input.vue.d.ts +1 -1
  218. package/es/slider/slider.vue.d.ts +1 -1
  219. package/es/space/index.d.ts +9 -9
  220. package/es/space/space.d.ts +2 -2
  221. package/es/spin/index.d.ts +18 -3
  222. package/es/spin/spin.d.ts +10 -1
  223. package/es/spin/spin.js +72 -10
  224. package/es/statistic/index.d.ts +3 -3
  225. package/es/statistic/statistic.vue.d.ts +1 -1
  226. package/es/steps/index.d.ts +5 -5
  227. package/es/steps/step.vue.d.ts +2 -2
  228. package/es/steps/steps.vue.d.ts +1 -1
  229. package/es/table/index.d.ts +68 -23
  230. package/es/table/interface.d.ts +3 -0
  231. package/es/table/table-column.d.ts +1 -1
  232. package/es/table/table-operation-td.d.ts +12 -12
  233. package/es/table/table-td.d.ts +2 -2
  234. package/es/table/table.d.ts +27 -8
  235. package/es/table/table.js +7 -2
  236. package/es/tabs/index.d.ts +12 -12
  237. package/es/tabs/tabs-nav.d.ts +1 -1
  238. package/es/tabs/tabs.d.ts +4 -4
  239. package/es/tag/index.d.ts +6 -6
  240. package/es/tag/tag.vue.d.ts +2 -2
  241. package/es/textarea/index.d.ts +38 -8
  242. package/es/textarea/style/index.css +6 -0
  243. package/es/textarea/style/index.scss +8 -0
  244. package/es/textarea/textarea.vue.d.ts +21 -3
  245. package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +36 -3
  246. package/es/time-picker/index.d.ts +36 -6
  247. package/es/time-picker/interface.d.ts +2 -1
  248. package/es/time-picker/range-panel.js +58 -0
  249. package/es/time-picker/time-picker.vue.d.ts +20 -2
  250. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +30 -1
  251. package/es/timeline/index.d.ts +45 -6
  252. package/es/timeline/timeline.d.ts +25 -3
  253. package/es/timeline/timeline.js +11 -2
  254. package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +9 -5
  255. package/es/toolbar/types.d.ts +2 -0
  256. package/es/tooltip/index.d.ts +6 -6
  257. package/es/tooltip/tooltip.vue.d.ts +2 -2
  258. package/es/tour/index.d.ts +3 -3
  259. package/es/tour/tour.vue.d.ts +1 -1
  260. package/es/transfer/index.d.ts +3 -3
  261. package/es/transfer/transfer.vue.d.ts +1 -1
  262. package/es/tree/tree.vue.d.ts +4 -4
  263. package/es/tree-select/interface.d.ts +2 -1
  264. package/es/tree-select/tree-select.vue.d.ts +32 -7
  265. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +27 -1
  266. package/es/trigger/index.d.ts +12 -12
  267. package/es/trigger/trigger.d.ts +4 -4
  268. package/es/typography/base.d.ts +4 -4
  269. package/es/typography/edit-content.vue.d.ts +2 -2
  270. package/es/upload/index.d.ts +6 -6
  271. package/es/upload/upload-button.d.ts +1 -1
  272. package/es/upload/upload.d.ts +2 -2
  273. package/es/verification-code/index.d.ts +3 -3
  274. package/es/verification-code/verification-code.d.ts +1 -1
  275. package/es/watermark/index.d.ts +3 -3
  276. package/es/watermark/watermark.d.ts +1 -1
  277. package/json/vetur-attributes.json +295 -2
  278. package/json/vetur-tags.json +103 -3
  279. package/json/web-types.json +746 -53
  280. package/package.json +10 -1
@@ -0,0 +1,895 @@
1
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectSpread2.js";
2
+ import { getPrefixCls } from "../_utils/global-config.js";
3
+ import IconClose from "../icon/icon-close/index.js";
4
+ import { useI18n } from "../locale/index.js";
5
+ import { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText } from "../_hooks/use-readonly-tip.js";
6
+ import Tooltip from "../tooltip/index.js";
7
+ import Button from "../button/index.js";
8
+ import Textarea from "../textarea/index.js";
9
+ import RichTextEditor from "../rich-text-editor/index.js";
10
+ import { senderInjectionKey } from "./context.js";
11
+ import IconArrowUp from "../icon/icon-arrow-up/index.js";
12
+ import IconMute from "../icon/icon-mute/index.js";
13
+ import IconVoice from "../icon/icon-voice/index.js";
14
+ import { useSpeech } from "./use-speech.js";
15
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, h, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, provide, renderSlot, resolveDynamicComponent, shallowRef, toRef, unref, useAttrs, watch, withCtx } from "vue";
16
+ import { createReusableTemplate } from "@vueuse/core";
17
+ import { INSERT_LINE_BREAK_COMMAND } from "lexical";
18
+ //#region components/sender/sender.vue?vue&type=script&setup=true&lang.ts
19
+ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, {
20
+ name: "Sender",
21
+ inheritAttrs: false
22
+ }), {}, {
23
+ __name: "sender",
24
+ props: {
25
+ modelValue: {},
26
+ defaultValue: { default: "" },
27
+ loading: { type: Boolean },
28
+ readonly: { type: [Boolean, String] },
29
+ submitType: { default: "enter" },
30
+ disabled: { type: Boolean },
31
+ slotConfig: {},
32
+ allowSpeech: { type: [Boolean, Object] },
33
+ autoSize: {
34
+ type: [Boolean, Object],
35
+ default: () => ({ maxRows: 8 })
36
+ },
37
+ skill: {},
38
+ placeholder: {},
39
+ showActions: {
40
+ type: Boolean,
41
+ default: true
42
+ },
43
+ suffixPlacement: { default: "content" },
44
+ components: {},
45
+ classNames: { default: () => ({}) },
46
+ styles: { default: () => ({}) },
47
+ onKeydown: {},
48
+ onKeyup: {}
49
+ },
50
+ emits: [
51
+ "update:modelValue",
52
+ "change",
53
+ "submit",
54
+ "cancel",
55
+ "paste",
56
+ "pasteFile",
57
+ "focus",
58
+ "blur",
59
+ "speechStart",
60
+ "speechData",
61
+ "speechEnd",
62
+ "speechError",
63
+ "speechTransportOpen",
64
+ "speechTransportMessage",
65
+ "speechTransportClose"
66
+ ],
67
+ setup(__props, { expose: __expose, emit: __emit }) {
68
+ const props = __props;
69
+ const emit = __emit;
70
+ const { t } = useI18n();
71
+ const [DefineSuffix, ReuseSuffix] = createReusableTemplate();
72
+ const RenderContent = defineComponent({
73
+ name: "SenderRenderContent",
74
+ props: { content: { type: null } },
75
+ setup(renderProps) {
76
+ return () => {
77
+ var _renderProps$content;
78
+ return (_renderProps$content = renderProps.content) !== null && _renderProps$content !== void 0 ? _renderProps$content : null;
79
+ };
80
+ }
81
+ });
82
+ const CustomSlotRenderer = defineComponent({
83
+ name: "SenderCustomSlotRenderer",
84
+ props: {
85
+ renderer: {
86
+ type: Function,
87
+ required: true
88
+ },
89
+ value: { type: null },
90
+ item: {
91
+ type: Object,
92
+ required: true
93
+ },
94
+ disabled: Boolean,
95
+ readonly: Boolean
96
+ },
97
+ emits: { change: (_value) => true },
98
+ setup(renderProps, { emit: emitCustomChange }) {
99
+ return () => renderProps.renderer(renderProps.value, (value) => emitCustomChange("change", value), {
100
+ disabled: renderProps.disabled,
101
+ readonly: renderProps.readonly
102
+ }, renderProps.item);
103
+ }
104
+ });
105
+ const SkillTag = defineComponent({
106
+ name: "SenderSkillTag",
107
+ props: {
108
+ skill: {
109
+ type: Object,
110
+ required: true
111
+ },
112
+ disabled: Boolean,
113
+ readonly: Boolean
114
+ },
115
+ emits: { remove: (_event) => true },
116
+ setup(tagProps, { emit: emitRemove, slots }) {
117
+ const closeClass = computed(() => [`${prefixCls}-skill-tag-close`, { [`${prefixCls}-skill-tag-close-disabled`]: tagProps.disabled || tagProps.readonly || typeof tagProps.skill.closable === "object" && tagProps.skill.closable.disabled }]);
118
+ const tooltipProps = computed(() => typeof tagProps.skill.tooltip === "string" ? { content: tagProps.skill.tooltip } : tagProps.skill.tooltip);
119
+ const handleRemove = (event) => {
120
+ event.stopPropagation();
121
+ emitRemove("remove", event);
122
+ };
123
+ const handleRemoveKeydown = (event) => {
124
+ if (event.key !== "Enter" && event.key !== " ") return;
125
+ event.preventDefault();
126
+ event.stopPropagation();
127
+ emitRemove("remove", event);
128
+ };
129
+ const renderTag = () => {
130
+ var _slots$skillTitle, _slots$skillCloseIc;
131
+ return h("span", {
132
+ class: `${prefixCls}-skill-tag`,
133
+ tabindex: tagProps.skill.tooltip ? "0" : void 0
134
+ }, [h("span", { class: `${prefixCls}-skill-tag-text` }, [(_slots$skillTitle = slots["skill-title"]) === null || _slots$skillTitle === void 0 ? void 0 : _slots$skillTitle.call(slots, { skill: tagProps.skill })]), tagProps.skill.closable ? h("span", {
135
+ "class": closeClass.value,
136
+ "role": "button",
137
+ "tabindex": "0",
138
+ "aria-label": t("sender.removeSkill"),
139
+ "onClick": handleRemove,
140
+ "onKeydown": handleRemoveKeydown
141
+ }, [(_slots$skillCloseIc = slots["skill-close-icon"]) === null || _slots$skillCloseIc === void 0 ? void 0 : _slots$skillCloseIc.call(slots, { skill: tagProps.skill })]) : null]);
142
+ };
143
+ return () => tagProps.skill.tooltip ? h(Tooltip, tooltipProps.value, { default: renderTag }) : renderTag();
144
+ }
145
+ });
146
+ const attrs = useAttrs();
147
+ const instance = getCurrentInstance();
148
+ const prefixCls = getPrefixCls("sender");
149
+ const readonlyTipHoverVisible = shallowRef(false);
150
+ const { tipVisible: readonlyTipInteractionVisible, show: showReadonlyTip, hide: hideReadonlyTip } = useReadonlyTip(toRef(props, "readonly"), computed(() => Boolean(props.disabled)));
151
+ const readonlyTipText = useReadonlyTipText(toRef(props, "readonly"));
152
+ const readonlyTipDisabled = computed(() => !props.readonly || props.disabled);
153
+ const readonlyTipVisible = computed(() => !readonlyTipDisabled.value && (readonlyTipHoverVisible.value || readonlyTipInteractionVisible.value));
154
+ const containerRef = shallowRef();
155
+ const textareaRef = shallowRef();
156
+ const slotInputRef = shallowRef();
157
+ const slotEditorReady = shallowRef(false);
158
+ const runtimeSlotConfig = shallowRef([]);
159
+ const activeSkill = shallowRef();
160
+ if (props.skill) activeSkill.value = props.skill;
161
+ const slotValue = shallowRef({
162
+ value: "",
163
+ slotConfig: [],
164
+ skill: props.skill
165
+ });
166
+ const innerValue = shallowRef(props.defaultValue);
167
+ const pendingValue = shallowRef();
168
+ provide(senderInjectionKey, {
169
+ prefixCls,
170
+ classNames: toRef(props, "classNames"),
171
+ styles: toRef(props, "styles")
172
+ });
173
+ const isControlled = computed(() => {
174
+ var _instance$vnode$props;
175
+ return Object.hasOwn((_instance$vnode$props = instance === null || instance === void 0 ? void 0 : instance.vnode.props) !== null && _instance$vnode$props !== void 0 ? _instance$vnode$props : {}, "modelValue");
176
+ });
177
+ const mergedValue = computed(() => {
178
+ var _props$modelValue;
179
+ return isControlled.value ? (_props$modelValue = props.modelValue) !== null && _props$modelValue !== void 0 ? _props$modelValue : "" : innerValue.value;
180
+ });
181
+ const isSlotMode = computed(() => props.slotConfig !== void 0 || Boolean(props.skill));
182
+ const inputComponent = computed(() => {
183
+ var _props$components$inp, _props$components;
184
+ return (_props$components$inp = (_props$components = props.components) === null || _props$components === void 0 ? void 0 : _props$components.input) !== null && _props$components$inp !== void 0 ? _props$components$inp : Textarea;
185
+ });
186
+ const allSlotConfig = computed(() => {
187
+ var _props$slotConfig, _props$slotConfig2;
188
+ const propKeys = new Set(((_props$slotConfig = props.slotConfig) !== null && _props$slotConfig !== void 0 ? _props$slotConfig : []).flatMap((item) => item.key ? [item.key] : []));
189
+ return [...(_props$slotConfig2 = props.slotConfig) !== null && _props$slotConfig2 !== void 0 ? _props$slotConfig2 : [], ...runtimeSlotConfig.value.filter((item) => !item.key || !propKeys.has(item.key))];
190
+ });
191
+ const keyedSlotConfig = computed(() => new Map(allSlotConfig.value.flatMap((item) => item.key ? [[item.key, item]] : [])));
192
+ const slotEditorClassNames = computed(() => ({
193
+ root: [
194
+ `${prefixCls}-input`,
195
+ `${prefixCls}-input-slot`,
196
+ props.classNames.input
197
+ ].filter(Boolean).join(" "),
198
+ content: `${prefixCls}-input-slot-content`,
199
+ placeholder: `${prefixCls}-input-slot-placeholder`,
200
+ component: `${prefixCls}-slot`
201
+ }));
202
+ const slotEditorStyles = computed(() => ({ root: props.styles.input }));
203
+ const handleReadonlyTipVisibleChange = (visible) => {
204
+ readonlyTipHoverVisible.value = visible && !readonlyTipDisabled.value;
205
+ };
206
+ const handleReadonlyKeydown = (event) => {
207
+ const target = event.target;
208
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
209
+ readonlyTipHoverVisible.value = false;
210
+ hideReadonlyTip();
211
+ return;
212
+ }
213
+ if (isReadonlyModificationKey(event)) showReadonlyTip();
214
+ };
215
+ const rootClass = computed(() => [
216
+ prefixCls,
217
+ `${prefixCls}-main`,
218
+ attrs.class,
219
+ props.classNames.root,
220
+ { [`${prefixCls}-disabled`]: props.disabled }
221
+ ]);
222
+ const toJsonValue = (value) => {
223
+ if (value === void 0) return null;
224
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
225
+ try {
226
+ return JSON.parse(JSON.stringify(value));
227
+ } catch (_unused) {
228
+ return String(value);
229
+ }
230
+ };
231
+ const updateCustomSlot = (update, value) => {
232
+ update(toJsonValue(value));
233
+ };
234
+ const getSlotDefaultValue = (config) => {
235
+ var _config$value, _ref, _config$props$value, _config$props, _config$props2, _config$props$default, _config$props3;
236
+ if (config.type === "text") return (_config$value = config.value) !== null && _config$value !== void 0 ? _config$value : "";
237
+ if (config.type === "tag") return (_ref = (_config$props$value = (_config$props = config.props) === null || _config$props === void 0 ? void 0 : _config$props.value) !== null && _config$props$value !== void 0 ? _config$props$value : (_config$props2 = config.props) === null || _config$props2 === void 0 ? void 0 : _config$props2.label) !== null && _ref !== void 0 ? _ref : "";
238
+ return (_config$props$default = (_config$props3 = config.props) === null || _config$props3 === void 0 ? void 0 : _config$props3.defaultValue) !== null && _config$props$default !== void 0 ? _config$props$default : "";
239
+ };
240
+ const createSlotNode = (config, previousValue) => {
241
+ const value = toJsonValue(previousValue !== null && previousValue !== void 0 ? previousValue : getSlotDefaultValue(config));
242
+ if (config.type === "input" || config.type === "content") {
243
+ var _config$props$placeho, _config$props4;
244
+ return {
245
+ key: config.key,
246
+ name: "input",
247
+ value,
248
+ props: _objectSpread2({ placeholder: (_config$props$placeho = (_config$props4 = config.props) === null || _config$props4 === void 0 ? void 0 : _config$props4.placeholder) !== null && _config$props$placeho !== void 0 ? _config$props$placeho : "" }, config.type === "content" ? { class: `${prefixCls}-slot-content` } : {}),
249
+ textValue: String(value !== null && value !== void 0 ? value : "")
250
+ };
251
+ }
252
+ if (config.type === "select") {
253
+ var _config$props$placeho2, _config$props5, _config$props$options, _config$props6;
254
+ return {
255
+ key: config.key,
256
+ name: "select",
257
+ value,
258
+ props: {
259
+ placeholder: (_config$props$placeho2 = (_config$props5 = config.props) === null || _config$props5 === void 0 ? void 0 : _config$props5.placeholder) !== null && _config$props$placeho2 !== void 0 ? _config$props$placeho2 : "",
260
+ options: (_config$props$options = (_config$props6 = config.props) === null || _config$props6 === void 0 ? void 0 : _config$props6.options.map((option) => ({
261
+ label: option,
262
+ value: option
263
+ }))) !== null && _config$props$options !== void 0 ? _config$props$options : []
264
+ },
265
+ textValue: String(value !== null && value !== void 0 ? value : "")
266
+ };
267
+ }
268
+ if (config.type === "tag") {
269
+ var _config$props7, _config$props$value2, _config$props8;
270
+ const label = (_config$props7 = config.props) === null || _config$props7 === void 0 ? void 0 : _config$props7.label;
271
+ return {
272
+ key: config.key,
273
+ name: "tag",
274
+ value,
275
+ props: { label: typeof label === "string" || typeof label === "number" ? String(label) : String((_config$props$value2 = (_config$props8 = config.props) === null || _config$props8 === void 0 ? void 0 : _config$props8.value) !== null && _config$props$value2 !== void 0 ? _config$props$value2 : "") },
276
+ textValue: String(value !== null && value !== void 0 ? value : "")
277
+ };
278
+ }
279
+ return {
280
+ key: config.key,
281
+ name: "senderCustom",
282
+ value,
283
+ textValue: String(value !== null && value !== void 0 ? value : "")
284
+ };
285
+ };
286
+ const createSkillNode = () => activeSkill.value ? {
287
+ key: "__sender_skill__",
288
+ name: "senderSkill",
289
+ value: activeSkill.value.value,
290
+ textValue: ""
291
+ } : void 0;
292
+ const createSlotEditorContent = (previousContent = []) => {
293
+ const previousValues = new Map(previousContent.flatMap((item) => typeof item === "string" ? [] : [[item.key, item.value]]));
294
+ const skillNode = createSkillNode();
295
+ return [...skillNode ? [skillNode] : [], ...allSlotConfig.value.map((config) => {
296
+ var _config$value2;
297
+ return config.type === "text" ? (_config$value2 = config.value) !== null && _config$value2 !== void 0 ? _config$value2 : "" : createSlotNode(config, previousValues.get(config.key));
298
+ })];
299
+ };
300
+ function resolveSlotValue(content) {
301
+ const result = [];
302
+ const resolvedConfig = [];
303
+ for (const item of content) {
304
+ var _item$value, _config$formatResult, _config$formatResult2;
305
+ if (typeof item === "string") {
306
+ result.push(item);
307
+ if (item) resolvedConfig.push({
308
+ type: "text",
309
+ value: item
310
+ });
311
+ continue;
312
+ }
313
+ if (item.name === "senderSkill") continue;
314
+ const config = keyedSlotConfig.value.get(item.key);
315
+ if (!config) continue;
316
+ const rawValue = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : "";
317
+ result.push((_config$formatResult = (_config$formatResult2 = config.formatResult) === null || _config$formatResult2 === void 0 ? void 0 : _config$formatResult2.call(config, rawValue)) !== null && _config$formatResult !== void 0 ? _config$formatResult : String(rawValue));
318
+ resolvedConfig.push(_objectSpread2(_objectSpread2({}, config), {}, { value: rawValue }));
319
+ }
320
+ return {
321
+ value: result.join(""),
322
+ slotConfig: resolvedConfig,
323
+ skill: activeSkill.value
324
+ };
325
+ }
326
+ const syncSlotEditor = () => {
327
+ if (!slotEditorReady.value || !slotInputRef.value) return;
328
+ const content = createSlotEditorContent(slotInputRef.value.getContent());
329
+ slotInputRef.value.setContent(content, { tag: "sd-sender-slot-sync" });
330
+ };
331
+ const handleSlotEditorReady = () => {
332
+ slotEditorReady.value = true;
333
+ syncSlotEditor();
334
+ };
335
+ const handleSlotEditorChange = () => {
336
+ var _slotInputRef$value$g, _slotInputRef$value;
337
+ if (!slotEditorReady.value) return;
338
+ const content = (_slotInputRef$value$g = (_slotInputRef$value = slotInputRef.value) === null || _slotInputRef$value === void 0 ? void 0 : _slotInputRef$value.getContent()) !== null && _slotInputRef$value$g !== void 0 ? _slotInputRef$value$g : [];
339
+ if (activeSkill.value && !content.some((item) => typeof item !== "string" && item.name === "senderSkill")) activeSkill.value = void 0;
340
+ slotValue.value = resolveSlotValue(content);
341
+ handleSlotChange(slotValue.value);
342
+ };
343
+ const getCustomSlotName = (key) => `slot-${key}`;
344
+ const getCustomConfig = (key) => {
345
+ const config = keyedSlotConfig.value.get(key);
346
+ return (config === null || config === void 0 ? void 0 : config.type) === "custom" ? config : void 0;
347
+ };
348
+ const removeSkill = (event, remove) => {
349
+ var _activeSkill$value, _config$onClose;
350
+ if (!((_activeSkill$value = activeSkill.value) === null || _activeSkill$value === void 0 ? void 0 : _activeSkill$value.closable) || props.disabled || props.readonly) return;
351
+ const config = typeof activeSkill.value.closable === "object" ? activeSkill.value.closable : void 0;
352
+ if (config === null || config === void 0 ? void 0 : config.disabled) return;
353
+ activeSkill.value = void 0;
354
+ remove();
355
+ config === null || config === void 0 || (_config$onClose = config.onClose) === null || _config$onClose === void 0 || _config$onClose.call(config, event);
356
+ };
357
+ function clearSlotEditor() {
358
+ var _slotInputRef$value2;
359
+ runtimeSlotConfig.value = [];
360
+ activeSkill.value = props.skill;
361
+ const skillNode = createSkillNode();
362
+ (_slotInputRef$value2 = slotInputRef.value) === null || _slotInputRef$value2 === void 0 || _slotInputRef$value2.setContent(skillNode ? [skillNode] : [], { tag: "sd-sender-slot-clear" });
363
+ }
364
+ const getNormalValue = () => ({
365
+ value: mergedValue.value,
366
+ slotConfig: [],
367
+ skill: void 0
368
+ });
369
+ const getCurrentValue = () => isSlotMode.value ? slotValue.value : getNormalValue();
370
+ const setNormalValue = (value, event) => {
371
+ if (!isControlled.value) innerValue.value = value;
372
+ emit("update:modelValue", value);
373
+ emit("change", value, event, [], void 0);
374
+ };
375
+ const handleValueUpdate = (value) => {
376
+ pendingValue.value = value;
377
+ queueMicrotask(() => {
378
+ if (pendingValue.value !== value) return;
379
+ pendingValue.value = void 0;
380
+ setNormalValue(value);
381
+ });
382
+ };
383
+ const handleInput = (value, event) => {
384
+ pendingValue.value = void 0;
385
+ setNormalValue(value, event);
386
+ };
387
+ function handleSlotChange(value, event) {
388
+ emit("change", value.value, event, value.slotConfig, value.skill);
389
+ }
390
+ const submitDisabled = computed(() => !getCurrentValue().value);
391
+ const clearDisabled = computed(() => !getCurrentValue().value);
392
+ const cancelDisabled = computed(() => !props.loading);
393
+ const triggerSend = () => {
394
+ if (props.loading || props.disabled || submitDisabled.value) return;
395
+ const value = getCurrentValue();
396
+ emit("submit", value.value, value.slotConfig, value.skill);
397
+ };
398
+ const triggerClear = () => {
399
+ if (props.disabled || clearDisabled.value) return;
400
+ if (isSlotMode.value) clearSlotEditor();
401
+ else setNormalValue("");
402
+ };
403
+ const triggerCancel = () => {
404
+ if (cancelDisabled.value || props.disabled) return;
405
+ emit("cancel");
406
+ };
407
+ const { available: speechAvailable, recording, requesting: speechRequesting, statusText: speechStatusText, trigger: triggerSpeech } = useSpeech(toRef(props, "allowSpeech"), {
408
+ onStart: (event) => emit("speechStart", event),
409
+ onData: (event) => emit("speechData", event),
410
+ onEnd: (event) => emit("speechEnd", event),
411
+ onError: (event) => emit("speechError", event),
412
+ onTransportOpen: (event) => emit("speechTransportOpen", event),
413
+ onTransportMessage: (event) => emit("speechTransportMessage", event),
414
+ onTransportClose: (event) => emit("speechTransportClose", event)
415
+ });
416
+ const actionContext = computed(() => ({
417
+ send: triggerSend,
418
+ clear: triggerClear,
419
+ cancel: triggerCancel,
420
+ speech: () => triggerSpeech(false),
421
+ submitDisabled: Boolean(props.disabled || submitDisabled.value),
422
+ clearDisabled: Boolean(props.disabled || clearDisabled.value),
423
+ cancelDisabled: Boolean(props.disabled || cancelDisabled.value),
424
+ speechDisabled: Boolean(props.disabled || !speechAvailable.value || speechRequesting.value),
425
+ recording: recording.value,
426
+ loading: Boolean(props.loading)
427
+ }));
428
+ const shouldSubmit = (event) => {
429
+ if (event.isComposing || event.key !== "Enter") return false;
430
+ const modifierPressed = event.ctrlKey || event.altKey || event.metaKey;
431
+ return props.submitType === "enter" && !event.shiftKey && !modifierPressed || props.submitType === "shiftEnter" && event.shiftKey && !modifierPressed;
432
+ };
433
+ const handleKeydown = (event) => {
434
+ var _props$onKeydown;
435
+ if (((_props$onKeydown = props.onKeydown) === null || _props$onKeydown === void 0 ? void 0 : _props$onKeydown.call(props, event)) === false) return;
436
+ if (shouldSubmit(event)) {
437
+ event.preventDefault();
438
+ triggerSend();
439
+ }
440
+ };
441
+ const handleSlotKeydown = (event) => {
442
+ var _props$onKeydown2;
443
+ if (((_props$onKeydown2 = props.onKeydown) === null || _props$onKeydown2 === void 0 ? void 0 : _props$onKeydown2.call(props, event)) === false || event.isComposing || event.key !== "Enter") return;
444
+ const target = event.target;
445
+ if (target instanceof Element && target.closest(`.${prefixCls}-skill-tag`)) return;
446
+ const modifierPressed = event.ctrlKey || event.altKey || event.metaKey;
447
+ if (shouldSubmit(event)) {
448
+ event.preventDefault();
449
+ event.stopPropagation();
450
+ triggerSend();
451
+ return;
452
+ }
453
+ if (!modifierPressed) {
454
+ var _slotInputRef$value3;
455
+ event.preventDefault();
456
+ event.stopPropagation();
457
+ (_slotInputRef$value3 = slotInputRef.value) === null || _slotInputRef$value3 === void 0 || _slotInputRef$value3.dispatchCommand(INSERT_LINE_BREAK_COMMAND, void 0);
458
+ }
459
+ };
460
+ const handlePaste = (event) => {
461
+ var _event$clipboardData, _event$clipboardData2;
462
+ const files = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.files;
463
+ if (!((_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.getData("text/plain")) && (files === null || files === void 0 ? void 0 : files.length)) {
464
+ event.preventDefault();
465
+ emit("pasteFile", files);
466
+ }
467
+ emit("paste", event);
468
+ };
469
+ const handleSlotPaste = (event) => {
470
+ var _event$clipboardData3, _event$clipboardData4;
471
+ const files = (_event$clipboardData3 = event.clipboardData) === null || _event$clipboardData3 === void 0 ? void 0 : _event$clipboardData3.files;
472
+ const text = (_event$clipboardData4 = event.clipboardData) === null || _event$clipboardData4 === void 0 ? void 0 : _event$clipboardData4.getData("text/plain");
473
+ handlePaste(event);
474
+ if (!text && (files === null || files === void 0 ? void 0 : files.length)) event.stopPropagation();
475
+ };
476
+ const getNativeTextarea = () => {
477
+ var _containerRef$value$q, _containerRef$value;
478
+ const exposed = textareaRef.value;
479
+ if (exposed instanceof HTMLTextAreaElement) return exposed;
480
+ const element = exposed === null || exposed === void 0 ? void 0 : exposed.$el;
481
+ if (element instanceof HTMLTextAreaElement) return element;
482
+ if (element instanceof Element) {
483
+ const textarea = element.querySelector("textarea");
484
+ if (textarea) return textarea;
485
+ }
486
+ return (_containerRef$value$q = (_containerRef$value = containerRef.value) === null || _containerRef$value === void 0 ? void 0 : _containerRef$value.querySelector("textarea")) !== null && _containerRef$value$q !== void 0 ? _containerRef$value$q : null;
487
+ };
488
+ const focus = (options) => {
489
+ var _textareaRef$value, _textareaRef$value$fo, _options$cursor;
490
+ if (isSlotMode.value) {
491
+ var _slotInputRef$value5;
492
+ const { cursor = "end", preventScroll = false, key } = options !== null && options !== void 0 ? options : {};
493
+ if (cursor === "slot") {
494
+ var _slotInputRef$value4, _ref2;
495
+ const root = (_slotInputRef$value4 = slotInputRef.value) === null || _slotInputRef$value4 === void 0 ? void 0 : _slotInputRef$value4.rootElement;
496
+ const selector = key ? `[data-rich-text-component-key="${CSS.escape(key)}"]` : "[data-rich-text-component]";
497
+ const component = root === null || root === void 0 ? void 0 : root.querySelector(selector);
498
+ const control = component === null || component === void 0 ? void 0 : component.querySelector("input, textarea, button, [contenteditable=\"true\"]");
499
+ (_ref2 = control !== null && control !== void 0 ? control : component) === null || _ref2 === void 0 || _ref2.focus({ preventScroll });
500
+ return;
501
+ }
502
+ (_slotInputRef$value5 = slotInputRef.value) === null || _slotInputRef$value5 === void 0 || _slotInputRef$value5.focus(void 0, {
503
+ preventScroll,
504
+ selection: cursor === "all" ? "all" : cursor
505
+ });
506
+ return;
507
+ }
508
+ const textarea = getNativeTextarea();
509
+ if (textarea) textarea.focus({ preventScroll: options === null || options === void 0 ? void 0 : options.preventScroll });
510
+ else (_textareaRef$value = textareaRef.value) === null || _textareaRef$value === void 0 || (_textareaRef$value$fo = _textareaRef$value.focus) === null || _textareaRef$value$fo === void 0 || _textareaRef$value$fo.call(_textareaRef$value);
511
+ if (!textarea) return;
512
+ const cursor = (_options$cursor = options === null || options === void 0 ? void 0 : options.cursor) !== null && _options$cursor !== void 0 ? _options$cursor : "end";
513
+ const position = cursor === "start" ? 0 : textarea.value.length;
514
+ if (cursor === "all") textarea.select();
515
+ else textarea.setSelectionRange(position, position);
516
+ };
517
+ const blur = () => {
518
+ var _slotInputRef$value6;
519
+ if (isSlotMode.value) (_slotInputRef$value6 = slotInputRef.value) === null || _slotInputRef$value6 === void 0 || _slotInputRef$value6.blur();
520
+ else {
521
+ var _textareaRef$value2, _textareaRef$value2$b;
522
+ const textarea = getNativeTextarea();
523
+ if (textarea) textarea.blur();
524
+ else (_textareaRef$value2 = textareaRef.value) === null || _textareaRef$value2 === void 0 || (_textareaRef$value2$b = _textareaRef$value2.blur) === null || _textareaRef$value2$b === void 0 || _textareaRef$value2$b.call(_textareaRef$value2);
525
+ }
526
+ };
527
+ const insert = (value, position = "cursor", replaceCharacters, preventScroll) => {
528
+ if (isSlotMode.value) {
529
+ if (typeof value === "string") {
530
+ var _slotInputRef$value7;
531
+ (_slotInputRef$value7 = slotInputRef.value) === null || _slotInputRef$value7 === void 0 || _slotInputRef$value7.insertText(value, {
532
+ position,
533
+ replaceCharacters
534
+ });
535
+ } else {
536
+ var _slotInputRef$value8;
537
+ runtimeSlotConfig.value = [...runtimeSlotConfig.value, ...value];
538
+ (_slotInputRef$value8 = slotInputRef.value) === null || _slotInputRef$value8 === void 0 || _slotInputRef$value8.insertContent(value.map((config) => {
539
+ var _config$value3;
540
+ return config.type === "text" ? (_config$value3 = config.value) !== null && _config$value3 !== void 0 ? _config$value3 : "" : createSlotNode(config);
541
+ }), {
542
+ position,
543
+ replaceCharacters
544
+ });
545
+ }
546
+ if (preventScroll) nextTick(() => focus({
547
+ cursor: "end",
548
+ preventScroll: true
549
+ }));
550
+ return;
551
+ }
552
+ const insertValue = typeof value === "string" ? value : value.map(formatSlot).join("");
553
+ const textarea = getNativeTextarea();
554
+ const current = mergedValue.value;
555
+ let start = position === "start" ? 0 : current.length;
556
+ let end = start;
557
+ if (position === "cursor" && textarea) {
558
+ start = textarea.selectionStart;
559
+ end = textarea.selectionEnd;
560
+ }
561
+ if (replaceCharacters && current.slice(0, start).endsWith(replaceCharacters)) start -= replaceCharacters.length;
562
+ setNormalValue(`${current.slice(0, start)}${insertValue}${current.slice(end)}`);
563
+ requestAnimationFrame(() => {
564
+ var _getNativeTextarea;
565
+ focus({ preventScroll });
566
+ const nextPosition = start + insertValue.length;
567
+ (_getNativeTextarea = getNativeTextarea()) === null || _getNativeTextarea === void 0 || _getNativeTextarea.setSelectionRange(nextPosition, nextPosition);
568
+ });
569
+ };
570
+ const clear = () => {
571
+ if (isSlotMode.value) clearSlotEditor();
572
+ else setNormalValue("");
573
+ };
574
+ const getValue = () => getCurrentValue();
575
+ watch(() => props.slotConfig, () => syncSlotEditor(), { deep: true });
576
+ watch(() => props.skill, (skill) => {
577
+ activeSkill.value = skill;
578
+ syncSlotEditor();
579
+ });
580
+ watch(isSlotMode, (enabled) => {
581
+ if (!enabled) slotEditorReady.value = false;
582
+ });
583
+ function formatSlot(slot) {
584
+ var _slot$value, _ref3, _slot$props$value, _slot$props, _slot$props2, _slot$props$defaultVa, _slot$props3, _slot$formatResult, _slot$formatResult2;
585
+ if (slot.type === "text") return (_slot$value = slot.value) !== null && _slot$value !== void 0 ? _slot$value : "";
586
+ if (slot.type === "tag") return String((_ref3 = (_slot$props$value = (_slot$props = slot.props) === null || _slot$props === void 0 ? void 0 : _slot$props.value) !== null && _slot$props$value !== void 0 ? _slot$props$value : (_slot$props2 = slot.props) === null || _slot$props2 === void 0 ? void 0 : _slot$props2.label) !== null && _ref3 !== void 0 ? _ref3 : "");
587
+ const value = (_slot$props$defaultVa = (_slot$props3 = slot.props) === null || _slot$props3 === void 0 ? void 0 : _slot$props3.defaultValue) !== null && _slot$props$defaultVa !== void 0 ? _slot$props$defaultVa : "";
588
+ return (_slot$formatResult = (_slot$formatResult2 = slot.formatResult) === null || _slot$formatResult2 === void 0 ? void 0 : _slot$formatResult2.call(slot, value)) !== null && _slot$formatResult !== void 0 ? _slot$formatResult : String(value);
589
+ }
590
+ const handleContentMousedown = (event) => {
591
+ if (event.target === event.currentTarget) {
592
+ event.preventDefault();
593
+ focus();
594
+ }
595
+ };
596
+ const StopLoadingIcon = defineComponent({
597
+ name: "SenderStopLoadingIcon",
598
+ inheritAttrs: false,
599
+ setup(_, { attrs: iconAttrs }) {
600
+ return () => h("svg", _objectSpread2(_objectSpread2({}, iconAttrs), {}, {
601
+ color: "currentColor",
602
+ viewBox: "0 0 1000 1000",
603
+ xmlns: "http://www.w3.org/2000/svg"
604
+ }), [
605
+ h("title", null, t("sender.stopGenerating")),
606
+ h("rect", {
607
+ fill: "currentColor",
608
+ height: 250,
609
+ rx: 24,
610
+ ry: 24,
611
+ width: 250,
612
+ x: 375,
613
+ y: 375
614
+ }),
615
+ h("circle", {
616
+ cx: 500,
617
+ cy: 500,
618
+ fill: "none",
619
+ r: 450,
620
+ stroke: "currentColor",
621
+ strokeWidth: 100,
622
+ opacity: .45
623
+ }),
624
+ h("circle", {
625
+ class: `${prefixCls}-loading-spinner`,
626
+ cx: 500,
627
+ cy: 500,
628
+ fill: "none",
629
+ r: 450,
630
+ stroke: "currentColor",
631
+ strokeWidth: 100,
632
+ strokeDasharray: "600 9999999"
633
+ })
634
+ ]);
635
+ }
636
+ });
637
+ const RecordingIcon = defineComponent({
638
+ name: "SenderRecordingIcon",
639
+ inheritAttrs: false,
640
+ setup(_, { attrs: iconAttrs }) {
641
+ const bars = Array.from({ length: 4 }, (__, index) => h("rect", {
642
+ class: `${prefixCls}-recording-bar`,
643
+ style: { animationDelay: `${index * .2}s` },
644
+ fill: "currentColor",
645
+ rx: 70,
646
+ ry: 70,
647
+ height: 250,
648
+ width: 140,
649
+ x: index * 286.6667,
650
+ y: 375
651
+ }));
652
+ return () => h("svg", _objectSpread2(_objectSpread2({}, iconAttrs), {}, {
653
+ color: "currentColor",
654
+ viewBox: "0 0 1000 1000",
655
+ xmlns: "http://www.w3.org/2000/svg"
656
+ }), [h("title", null, t("sender.recording")), ...bars]);
657
+ }
658
+ });
659
+ __expose({
660
+ get inputElement() {
661
+ var _slotInputRef$value$r, _slotInputRef$value9;
662
+ return isSlotMode.value ? (_slotInputRef$value$r = (_slotInputRef$value9 = slotInputRef.value) === null || _slotInputRef$value9 === void 0 ? void 0 : _slotInputRef$value9.rootElement) !== null && _slotInputRef$value$r !== void 0 ? _slotInputRef$value$r : null : getNativeTextarea();
663
+ },
664
+ get nativeElement() {
665
+ var _containerRef$value2;
666
+ return (_containerRef$value2 = containerRef.value) !== null && _containerRef$value2 !== void 0 ? _containerRef$value2 : null;
667
+ },
668
+ focus,
669
+ blur,
670
+ insert,
671
+ clear,
672
+ getValue
673
+ });
674
+ return (_ctx, _cache) => {
675
+ return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(DefineSuffix), null, {
676
+ default: withCtx(() => {
677
+ var _props$classNames, _props$styles;
678
+ return [createElementVNode("div", {
679
+ class: normalizeClass([`${unref(prefixCls)}-actions-list`, (_props$classNames = __props.classNames) === null || _props$classNames === void 0 ? void 0 : _props$classNames.suffix]),
680
+ style: normalizeStyle((_props$styles = __props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.suffix)
681
+ }, [renderSlot(_ctx.$slots, "suffix", { actions: actionContext.value }, () => [createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-actions-list-presets`) }, [__props.allowSpeech ? (openBlock(), createBlock(unref(Button), {
682
+ key: 0,
683
+ type: "text",
684
+ loading: unref(speechRequesting),
685
+ disabled: actionContext.value.speechDisabled,
686
+ title: unref(speechStatusText),
687
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.speechDisabled }]),
688
+ "aria-label": unref(speechStatusText),
689
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(triggerSpeech)())
690
+ }, {
691
+ icon: withCtx(() => [unref(recording) ? (openBlock(), createBlock(unref(RecordingIcon), {
692
+ key: 0,
693
+ class: normalizeClass(`${unref(prefixCls)}-actions-btn-recording-icon`)
694
+ }, null, 8, ["class"])) : actionContext.value.speechDisabled ? (openBlock(), createBlock(unref(IconMute), { key: 1 })) : (openBlock(), createBlock(unref(IconVoice), { key: 2 }))]),
695
+ _: 1
696
+ }, 8, [
697
+ "loading",
698
+ "disabled",
699
+ "title",
700
+ "class",
701
+ "aria-label"
702
+ ])) : createCommentVNode("", true), __props.loading ? (openBlock(), createBlock(unref(Button), {
703
+ key: 1,
704
+ type: "text",
705
+ shape: "circle",
706
+ disabled: actionContext.value.cancelDisabled,
707
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, `${unref(prefixCls)}-actions-btn-loading-button`]),
708
+ "aria-label": unref(t)("sender.stopGenerating"),
709
+ onClick: triggerCancel
710
+ }, {
711
+ icon: withCtx(() => [createVNode(unref(StopLoadingIcon), { class: normalizeClass(`${unref(prefixCls)}-actions-btn-loading-icon`) }, null, 8, ["class"])]),
712
+ _: 1
713
+ }, 8, [
714
+ "disabled",
715
+ "class",
716
+ "aria-label"
717
+ ])) : (openBlock(), createBlock(unref(Button), {
718
+ key: 2,
719
+ type: "primary",
720
+ shape: "circle",
721
+ disabled: actionContext.value.submitDisabled,
722
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.submitDisabled }]),
723
+ "aria-label": unref(t)("sender.send"),
724
+ onClick: triggerSend
725
+ }, {
726
+ icon: withCtx(() => [createVNode(unref(IconArrowUp))]),
727
+ _: 1
728
+ }, 8, [
729
+ "disabled",
730
+ "class",
731
+ "aria-label"
732
+ ]))], 2)])], 6)];
733
+ }),
734
+ _: 3
735
+ }), createVNode(unref(Tooltip), {
736
+ "popup-visible": readonlyTipVisible.value,
737
+ content: unref(readonlyTipText),
738
+ disabled: readonlyTipDisabled.value,
739
+ position: "top",
740
+ onPopupVisibleChange: handleReadonlyTipVisibleChange
741
+ }, {
742
+ default: withCtx(() => {
743
+ var _props$styles2, _props$classNames2, _props$styles3, _props$classNames3, _props$styles4, _props$classNames4, _props$styles5, _props$classNames5, _props$styles6;
744
+ return [createElementVNode("div", mergeProps({
745
+ ref_key: "containerRef",
746
+ ref: containerRef
747
+ }, _ctx.$attrs, {
748
+ class: rootClass.value,
749
+ style: (_props$styles2 = __props.styles) === null || _props$styles2 === void 0 ? void 0 : _props$styles2.root,
750
+ onClick: _cache[5] || (_cache[5] = (...args) => unref(showReadonlyTip) && unref(showReadonlyTip)(...args)),
751
+ onKeydownCapture: handleReadonlyKeydown
752
+ }), [
753
+ renderSlot(_ctx.$slots, "header", { actions: actionContext.value }),
754
+ createElementVNode("div", {
755
+ class: normalizeClass([`${unref(prefixCls)}-content`, (_props$classNames2 = __props.classNames) === null || _props$classNames2 === void 0 ? void 0 : _props$classNames2.content]),
756
+ style: normalizeStyle((_props$styles3 = __props.styles) === null || _props$styles3 === void 0 ? void 0 : _props$styles3.content),
757
+ onMousedown: handleContentMousedown
758
+ }, [
759
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
760
+ key: 0,
761
+ class: normalizeClass([`${unref(prefixCls)}-prefix`, (_props$classNames3 = __props.classNames) === null || _props$classNames3 === void 0 ? void 0 : _props$classNames3.prefix]),
762
+ style: normalizeStyle((_props$styles4 = __props.styles) === null || _props$styles4 === void 0 ? void 0 : _props$styles4.prefix)
763
+ }, [renderSlot(_ctx.$slots, "prefix", { actions: actionContext.value })], 6)) : createCommentVNode("", true),
764
+ isSlotMode.value ? (openBlock(), createBlock(unref(RichTextEditor), {
765
+ key: 1,
766
+ ref_key: "slotInputRef",
767
+ ref: slotInputRef,
768
+ placeholder: __props.placeholder,
769
+ disabled: __props.disabled,
770
+ readonly: Boolean(__props.readonly),
771
+ "auto-size": __props.autoSize,
772
+ "class-names": slotEditorClassNames.value,
773
+ styles: slotEditorStyles.value,
774
+ "aria-label": unref(t)("sender.messageInput"),
775
+ onReady: handleSlotEditorReady,
776
+ onChange: handleSlotEditorChange,
777
+ onKeydownCapture: handleSlotKeydown,
778
+ onKeyupCapture: __props.onKeyup,
779
+ onPasteCapture: handleSlotPaste,
780
+ onFocus: _cache[1] || (_cache[1] = ($event) => emit("focus", $event)),
781
+ onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur", $event))
782
+ }, {
783
+ "node-senderSkill": withCtx(({ remove }) => [activeSkill.value ? (openBlock(), createBlock(unref(SkillTag), {
784
+ key: 0,
785
+ skill: activeSkill.value,
786
+ disabled: __props.disabled,
787
+ readonly: Boolean(__props.readonly),
788
+ onRemove: (event) => removeSkill(event, remove)
789
+ }, {
790
+ "skill-title": withCtx(({ skill }) => [renderSlot(_ctx.$slots, "skill-title", { skill }, () => {
791
+ var _skill$title;
792
+ return [createVNode(unref(RenderContent), { content: (_skill$title = skill.title) !== null && _skill$title !== void 0 ? _skill$title : skill.value }, null, 8, ["content"])];
793
+ })]),
794
+ "skill-close-icon": withCtx(({ skill }) => [renderSlot(_ctx.$slots, "skill-close-icon", { skill }, () => [typeof skill.closable === "object" && skill.closable.closeIcon ? (openBlock(), createBlock(unref(RenderContent), {
795
+ key: 0,
796
+ content: skill.closable.closeIcon
797
+ }, null, 8, ["content"])) : (openBlock(), createBlock(unref(IconClose), { key: 1 }))])]),
798
+ _: 3
799
+ }, 8, [
800
+ "skill",
801
+ "disabled",
802
+ "readonly",
803
+ "onRemove"
804
+ ])) : createCommentVNode("", true)]),
805
+ "node-senderCustom": withCtx((slotProps) => {
806
+ var _getCustomConfig;
807
+ return [_ctx.$slots[getCustomSlotName(slotProps.node.key)] ? renderSlot(_ctx.$slots, getCustomSlotName(slotProps.node.key), {
808
+ value: slotProps.node.value,
809
+ item: getCustomConfig(slotProps.node.key),
810
+ disabled: slotProps.disabled,
811
+ readonly: slotProps.readonly,
812
+ onChange: (value) => updateCustomSlot(slotProps.update, value)
813
+ }, void 0, void 0, 0) : ((_getCustomConfig = getCustomConfig(slotProps.node.key)) === null || _getCustomConfig === void 0 ? void 0 : _getCustomConfig.customRender) ? (openBlock(), createBlock(unref(CustomSlotRenderer), {
814
+ key: 1,
815
+ renderer: getCustomConfig(slotProps.node.key).customRender,
816
+ value: slotProps.node.value,
817
+ item: getCustomConfig(slotProps.node.key),
818
+ disabled: slotProps.disabled,
819
+ readonly: slotProps.readonly,
820
+ onChange: ($event) => updateCustomSlot(slotProps.update, $event)
821
+ }, null, 8, [
822
+ "renderer",
823
+ "value",
824
+ "item",
825
+ "disabled",
826
+ "readonly",
827
+ "onChange"
828
+ ])) : createCommentVNode("", true)];
829
+ }),
830
+ _: 3
831
+ }, 8, [
832
+ "placeholder",
833
+ "disabled",
834
+ "readonly",
835
+ "auto-size",
836
+ "class-names",
837
+ "styles",
838
+ "aria-label",
839
+ "onKeyupCapture"
840
+ ])) : (openBlock(), createBlock(resolveDynamicComponent(inputComponent.value), {
841
+ key: 2,
842
+ ref_key: "textareaRef",
843
+ ref: textareaRef,
844
+ "model-value": mergedValue.value,
845
+ "default-value": __props.defaultValue,
846
+ placeholder: __props.placeholder,
847
+ disabled: __props.disabled,
848
+ readonly: __props.readonly,
849
+ "auto-size": __props.autoSize,
850
+ class: normalizeClass([`${unref(prefixCls)}-input`, (_props$classNames4 = __props.classNames) === null || _props$classNames4 === void 0 ? void 0 : _props$classNames4.input]),
851
+ style: normalizeStyle((_props$styles5 = __props.styles) === null || _props$styles5 === void 0 ? void 0 : _props$styles5.input),
852
+ "onUpdate:modelValue": handleValueUpdate,
853
+ onInput: handleInput,
854
+ onKeydown: handleKeydown,
855
+ onKeyup: __props.onKeyup,
856
+ onPaste: handlePaste,
857
+ onFocus: _cache[3] || (_cache[3] = ($event) => emit("focus", $event)),
858
+ onBlur: _cache[4] || (_cache[4] = ($event) => emit("blur", $event))
859
+ }, null, 40, [
860
+ "model-value",
861
+ "default-value",
862
+ "placeholder",
863
+ "disabled",
864
+ "readonly",
865
+ "auto-size",
866
+ "class",
867
+ "style",
868
+ "onKeyup"
869
+ ])),
870
+ __props.showActions && __props.suffixPlacement === "content" ? (openBlock(), createBlock(unref(ReuseSuffix), { key: 3 })) : createCommentVNode("", true)
871
+ ], 38),
872
+ _ctx.$slots.footer || __props.showActions && __props.suffixPlacement === "footer" ? (openBlock(), createElementBlock("div", {
873
+ key: 0,
874
+ class: normalizeClass([`${unref(prefixCls)}-footer`, (_props$classNames5 = __props.classNames) === null || _props$classNames5 === void 0 ? void 0 : _props$classNames5.footer]),
875
+ style: normalizeStyle((_props$styles6 = __props.styles) === null || _props$styles6 === void 0 ? void 0 : _props$styles6.footer)
876
+ }, [_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
877
+ key: 0,
878
+ class: normalizeClass(`${unref(prefixCls)}-footer-content`)
879
+ }, [renderSlot(_ctx.$slots, "footer", { actions: actionContext.value })], 2)) : createCommentVNode("", true), __props.showActions && __props.suffixPlacement === "footer" ? (openBlock(), createElementBlock("div", {
880
+ key: 1,
881
+ class: normalizeClass(`${unref(prefixCls)}-footer-suffix`)
882
+ }, [createVNode(unref(ReuseSuffix))], 2)) : createCommentVNode("", true)], 6)) : createCommentVNode("", true)
883
+ ], 16)];
884
+ }),
885
+ _: 3
886
+ }, 8, [
887
+ "popup-visible",
888
+ "content",
889
+ "disabled"
890
+ ])], 64);
891
+ };
892
+ }
893
+ }));
894
+ //#endregion
895
+ export { sender_vue_vue_type_script_setup_true_lang_default as default };