@simai-studio/chat 0.0.0-stage → 1.0.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 (261) hide show
  1. package/LICENSE.md +182 -0
  2. package/README.md +65 -2
  3. package/dist/package-receipt.json +1551 -0
  4. package/dist/set.json +105 -0
  5. package/dist/smart/chat-composer/aliases.json +56 -0
  6. package/dist/smart/chat-composer/aliases.json.gz +0 -0
  7. package/dist/smart/chat-composer/component.json +658 -0
  8. package/dist/smart/chat-composer/component.json.gz +0 -0
  9. package/dist/smart/chat-composer/css/chat-composer.css +318 -0
  10. package/dist/smart/chat-composer/css/chat-composer.css.gz +0 -0
  11. package/dist/smart/chat-composer/css/chat-composer.min.css +2 -0
  12. package/dist/smart/chat-composer/css/chat-composer.min.css.gz +0 -0
  13. package/dist/smart/chat-composer/examples.json +531 -0
  14. package/dist/smart/chat-composer/examples.json.gz +0 -0
  15. package/dist/smart/chat-composer/js/chat-composer.js +1023 -0
  16. package/dist/smart/chat-composer/js/chat-composer.js.gz +0 -0
  17. package/dist/smart/chat-composer/js/chat-composer.min.js +75 -0
  18. package/dist/smart/chat-composer/js/chat-composer.min.js.gz +0 -0
  19. package/dist/smart/chat-composer/lang/en.json +31 -0
  20. package/dist/smart/chat-composer/lang/en.json.gz +0 -0
  21. package/dist/smart/chat-composer/lang/ru.json +31 -0
  22. package/dist/smart/chat-composer/lang/ru.json.gz +0 -0
  23. package/dist/smart/chat-composer/probe.json +400 -0
  24. package/dist/smart/chat-composer/probe.json.gz +0 -0
  25. package/dist/smart/chat-composer/smart.manifest.json +625 -0
  26. package/dist/smart/chat-composer/smart.manifest.json.gz +0 -0
  27. package/dist/smart/chat-composer/static/default/busy.html +20 -0
  28. package/dist/smart/chat-composer/static/default/busy.html.gz +0 -0
  29. package/dist/smart/chat-composer/static/default/disabled.html +20 -0
  30. package/dist/smart/chat-composer/static/default/disabled.html.gz +0 -0
  31. package/dist/smart/chat-composer/static/default/files.html +44 -0
  32. package/dist/smart/chat-composer/static/default/files.html.gz +0 -0
  33. package/dist/smart/chat-composer/static/default/near-limit.html +20 -0
  34. package/dist/smart/chat-composer/static/default/near-limit.html.gz +0 -0
  35. package/dist/smart/chat-composer/static/default/reference.html +20 -0
  36. package/dist/smart/chat-composer/static/default/reference.html.gz +0 -0
  37. package/dist/smart/chat-composer/static/sheets.json +88 -0
  38. package/dist/smart/chat-composer/static/sheets.json.gz +0 -0
  39. package/dist/smart/chat-composer/studio.fixture.json +18 -0
  40. package/dist/smart/chat-composer/studio.fixture.json.gz +0 -0
  41. package/dist/smart/chat-composer/studio.scenario.json +37 -0
  42. package/dist/smart/chat-composer/studio.scenario.json.gz +0 -0
  43. package/dist/smart/chat-composer/template/default.css +273 -0
  44. package/dist/smart/chat-composer/template/default.css.gz +0 -0
  45. package/dist/smart/chat-composer/template/default.js +109 -0
  46. package/dist/smart/chat-composer/template/default.js.gz +0 -0
  47. package/dist/smart/chat-composer/template/parts.js +82 -0
  48. package/dist/smart/chat-composer/template/parts.js.gz +0 -0
  49. package/dist/smart/chat-interlocutor/aliases.json +20 -0
  50. package/dist/smart/chat-interlocutor/aliases.json.gz +0 -0
  51. package/dist/smart/chat-interlocutor/component.json +435 -0
  52. package/dist/smart/chat-interlocutor/component.json.gz +0 -0
  53. package/dist/smart/chat-interlocutor/css/chat-interlocutor.css +107 -0
  54. package/dist/smart/chat-interlocutor/css/chat-interlocutor.css.gz +0 -0
  55. package/dist/smart/chat-interlocutor/css/chat-interlocutor.min.css +2 -0
  56. package/dist/smart/chat-interlocutor/css/chat-interlocutor.min.css.gz +0 -0
  57. package/dist/smart/chat-interlocutor/examples.json +379 -0
  58. package/dist/smart/chat-interlocutor/examples.json.gz +0 -0
  59. package/dist/smart/chat-interlocutor/js/chat-interlocutor.js +531 -0
  60. package/dist/smart/chat-interlocutor/js/chat-interlocutor.js.gz +0 -0
  61. package/dist/smart/chat-interlocutor/js/chat-interlocutor.min.js +22 -0
  62. package/dist/smart/chat-interlocutor/js/chat-interlocutor.min.js.gz +0 -0
  63. package/dist/smart/chat-interlocutor/lang/en.json +13 -0
  64. package/dist/smart/chat-interlocutor/lang/en.json.gz +0 -0
  65. package/dist/smart/chat-interlocutor/lang/ru.json +13 -0
  66. package/dist/smart/chat-interlocutor/lang/ru.json.gz +0 -0
  67. package/dist/smart/chat-interlocutor/probe.json +204 -0
  68. package/dist/smart/chat-interlocutor/probe.json.gz +0 -0
  69. package/dist/smart/chat-interlocutor/smart.manifest.json +406 -0
  70. package/dist/smart/chat-interlocutor/smart.manifest.json.gz +0 -0
  71. package/dist/smart/chat-interlocutor/static/default/former.html +10 -0
  72. package/dist/smart/chat-interlocutor/static/default/former.html.gz +0 -0
  73. package/dist/smart/chat-interlocutor/static/default/grouped.html +10 -0
  74. package/dist/smart/chat-interlocutor/static/default/grouped.html.gz +0 -0
  75. package/dist/smart/chat-interlocutor/static/default/reference.html +10 -0
  76. package/dist/smart/chat-interlocutor/static/default/reference.html.gz +0 -0
  77. package/dist/smart/chat-interlocutor/static/default/single.html +10 -0
  78. package/dist/smart/chat-interlocutor/static/default/single.html.gz +0 -0
  79. package/dist/smart/chat-interlocutor/static/sheets.json +105 -0
  80. package/dist/smart/chat-interlocutor/static/sheets.json.gz +0 -0
  81. package/dist/smart/chat-interlocutor/studio.fixture.json +25 -0
  82. package/dist/smart/chat-interlocutor/studio.fixture.json.gz +0 -0
  83. package/dist/smart/chat-interlocutor/studio.scenario.json +41 -0
  84. package/dist/smart/chat-interlocutor/studio.scenario.json.gz +0 -0
  85. package/dist/smart/chat-interlocutor/template/default.css +58 -0
  86. package/dist/smart/chat-interlocutor/template/default.css.gz +0 -0
  87. package/dist/smart/chat-interlocutor/template/default.js +43 -0
  88. package/dist/smart/chat-interlocutor/template/default.js.gz +0 -0
  89. package/dist/smart/chat-message/aliases.json +114 -0
  90. package/dist/smart/chat-message/aliases.json.gz +0 -0
  91. package/dist/smart/chat-message/component.json +822 -0
  92. package/dist/smart/chat-message/component.json.gz +0 -0
  93. package/dist/smart/chat-message/css/chat-message.css +3291 -0
  94. package/dist/smart/chat-message/css/chat-message.css.gz +0 -0
  95. package/dist/smart/chat-message/css/chat-message.min.css +2 -0
  96. package/dist/smart/chat-message/css/chat-message.min.css.gz +0 -0
  97. package/dist/smart/chat-message/examples.json +1604 -0
  98. package/dist/smart/chat-message/examples.json.gz +0 -0
  99. package/dist/smart/chat-message/js/chat-message.js +5498 -0
  100. package/dist/smart/chat-message/js/chat-message.js.gz +0 -0
  101. package/dist/smart/chat-message/js/chat-message.min.js +25 -0
  102. package/dist/smart/chat-message/js/chat-message.min.js.gz +0 -0
  103. package/dist/smart/chat-message/lang/en.json +181 -0
  104. package/dist/smart/chat-message/lang/en.json.gz +0 -0
  105. package/dist/smart/chat-message/lang/ru.json +185 -0
  106. package/dist/smart/chat-message/lang/ru.json.gz +0 -0
  107. package/dist/smart/chat-message/probe.json +1029 -0
  108. package/dist/smart/chat-message/probe.json.gz +0 -0
  109. package/dist/smart/chat-message/smart.manifest.json +814 -0
  110. package/dist/smart/chat-message/smart.manifest.json.gz +0 -0
  111. package/dist/smart/chat-message/static/default/brief-card.html +2 -0
  112. package/dist/smart/chat-message/static/default/brief-card.html.gz +0 -0
  113. package/dist/smart/chat-message/static/default/brief-questions.html +2 -0
  114. package/dist/smart/chat-message/static/default/brief-questions.html.gz +0 -0
  115. package/dist/smart/chat-message/static/default/deliverables.html +2 -0
  116. package/dist/smart/chat-message/static/default/deliverables.html.gz +0 -0
  117. package/dist/smart/chat-message/static/default/document.html +13 -0
  118. package/dist/smart/chat-message/static/default/document.html.gz +0 -0
  119. package/dist/smart/chat-message/static/default/failed.html +2 -0
  120. package/dist/smart/chat-message/static/default/failed.html.gz +0 -0
  121. package/dist/smart/chat-message/static/default/feedback-reason.html +2 -0
  122. package/dist/smart/chat-message/static/default/feedback-reason.html.gz +0 -0
  123. package/dist/smart/chat-message/static/default/limit.html +2 -0
  124. package/dist/smart/chat-message/static/default/limit.html.gz +0 -0
  125. package/dist/smart/chat-message/static/default/proposal.html +42 -0
  126. package/dist/smart/chat-message/static/default/proposal.html.gz +0 -0
  127. package/dist/smart/chat-message/static/default/question.html +18 -0
  128. package/dist/smart/chat-message/static/default/question.html.gz +0 -0
  129. package/dist/smart/chat-message/static/default/reference.html +2 -0
  130. package/dist/smart/chat-message/static/default/reference.html.gz +0 -0
  131. package/dist/smart/chat-message/static/default/steps.html +2 -0
  132. package/dist/smart/chat-message/static/default/steps.html.gz +0 -0
  133. package/dist/smart/chat-message/static/default/stopped.html +2 -0
  134. package/dist/smart/chat-message/static/default/stopped.html.gz +0 -0
  135. package/dist/smart/chat-message/static/default/waiting.html +2 -0
  136. package/dist/smart/chat-message/static/default/waiting.html.gz +0 -0
  137. package/dist/smart/chat-message/static/person/person-own.html +2 -0
  138. package/dist/smart/chat-message/static/person/person-own.html.gz +0 -0
  139. package/dist/smart/chat-message/static/person/person-reply.html +6 -0
  140. package/dist/smart/chat-message/static/person/person-reply.html.gz +0 -0
  141. package/dist/smart/chat-message/static/person/person.html +14 -0
  142. package/dist/smart/chat-message/static/person/person.html.gz +0 -0
  143. package/dist/smart/chat-message/static/sheets.json +398 -0
  144. package/dist/smart/chat-message/static/sheets.json.gz +0 -0
  145. package/dist/smart/chat-message/studio.fixture.json +27 -0
  146. package/dist/smart/chat-message/studio.fixture.json.gz +0 -0
  147. package/dist/smart/chat-message/studio.scenario.json +22 -0
  148. package/dist/smart/chat-message/studio.scenario.json.gz +0 -0
  149. package/dist/smart/chat-message/template/default.css +1895 -0
  150. package/dist/smart/chat-message/template/default.css.gz +0 -0
  151. package/dist/smart/chat-message/template/default.js +27 -0
  152. package/dist/smart/chat-message/template/default.js.gz +0 -0
  153. package/dist/smart/chat-message/template/person.js +11 -0
  154. package/dist/smart/chat-message/template/person.js.gz +0 -0
  155. package/dist/smart/chat-threads/aliases.json +174 -0
  156. package/dist/smart/chat-threads/aliases.json.gz +0 -0
  157. package/dist/smart/chat-threads/component.json +1232 -0
  158. package/dist/smart/chat-threads/component.json.gz +0 -0
  159. package/dist/smart/chat-threads/css/chat-threads.css +150 -0
  160. package/dist/smart/chat-threads/css/chat-threads.css.gz +0 -0
  161. package/dist/smart/chat-threads/css/chat-threads.min.css +2 -0
  162. package/dist/smart/chat-threads/css/chat-threads.min.css.gz +0 -0
  163. package/dist/smart/chat-threads/examples.json +689 -0
  164. package/dist/smart/chat-threads/examples.json.gz +0 -0
  165. package/dist/smart/chat-threads/js/chat-threads.js +859 -0
  166. package/dist/smart/chat-threads/js/chat-threads.js.gz +0 -0
  167. package/dist/smart/chat-threads/js/chat-threads.min.js +39 -0
  168. package/dist/smart/chat-threads/js/chat-threads.min.js.gz +0 -0
  169. package/dist/smart/chat-threads/lang/en.json +18 -0
  170. package/dist/smart/chat-threads/lang/en.json.gz +0 -0
  171. package/dist/smart/chat-threads/lang/ru.json +18 -0
  172. package/dist/smart/chat-threads/lang/ru.json.gz +0 -0
  173. package/dist/smart/chat-threads/probe.json +406 -0
  174. package/dist/smart/chat-threads/probe.json.gz +0 -0
  175. package/dist/smart/chat-threads/smart.manifest.json +1152 -0
  176. package/dist/smart/chat-threads/smart.manifest.json.gz +0 -0
  177. package/dist/smart/chat-threads/static/default/activity.html +139 -0
  178. package/dist/smart/chat-threads/static/default/activity.html.gz +0 -0
  179. package/dist/smart/chat-threads/static/default/activity.skeleton.html +139 -0
  180. package/dist/smart/chat-threads/static/default/activity.skeleton.html.gz +0 -0
  181. package/dist/smart/chat-threads/static/default/archive.html +55 -0
  182. package/dist/smart/chat-threads/static/default/archive.html.gz +0 -0
  183. package/dist/smart/chat-threads/static/default/archive.skeleton.html +55 -0
  184. package/dist/smart/chat-threads/static/default/archive.skeleton.html.gz +0 -0
  185. package/dist/smart/chat-threads/static/default/avatars.html +104 -0
  186. package/dist/smart/chat-threads/static/default/avatars.html.gz +0 -0
  187. package/dist/smart/chat-threads/static/default/avatars.skeleton.html +104 -0
  188. package/dist/smart/chat-threads/static/default/avatars.skeleton.html.gz +0 -0
  189. package/dist/smart/chat-threads/static/default/empty.html +48 -0
  190. package/dist/smart/chat-threads/static/default/empty.html.gz +0 -0
  191. package/dist/smart/chat-threads/static/default/loading.html +48 -0
  192. package/dist/smart/chat-threads/static/default/loading.html.gz +0 -0
  193. package/dist/smart/chat-threads/static/default/people.html +95 -0
  194. package/dist/smart/chat-threads/static/default/people.html.gz +0 -0
  195. package/dist/smart/chat-threads/static/default/people.skeleton.html +95 -0
  196. package/dist/smart/chat-threads/static/default/people.skeleton.html.gz +0 -0
  197. package/dist/smart/chat-threads/static/default/reference.html +114 -0
  198. package/dist/smart/chat-threads/static/default/reference.html.gz +0 -0
  199. package/dist/smart/chat-threads/static/default/reference.skeleton.html +114 -0
  200. package/dist/smart/chat-threads/static/default/reference.skeleton.html.gz +0 -0
  201. package/dist/smart/chat-threads/static/default/ungrouped.html +94 -0
  202. package/dist/smart/chat-threads/static/default/ungrouped.html.gz +0 -0
  203. package/dist/smart/chat-threads/static/default/ungrouped.skeleton.html +94 -0
  204. package/dist/smart/chat-threads/static/default/ungrouped.skeleton.html.gz +0 -0
  205. package/dist/smart/chat-threads/static/sheets.json +422 -0
  206. package/dist/smart/chat-threads/static/sheets.json.gz +0 -0
  207. package/dist/smart/chat-threads/studio.fixture.json +23 -0
  208. package/dist/smart/chat-threads/studio.fixture.json.gz +0 -0
  209. package/dist/smart/chat-threads/template/default.css +113 -0
  210. package/dist/smart/chat-threads/template/default.css.gz +0 -0
  211. package/dist/smart/chat-threads/template/default.js +62 -0
  212. package/dist/smart/chat-threads/template/default.js.gz +0 -0
  213. package/dist/smart/chat-window/aliases.json +395 -0
  214. package/dist/smart/chat-window/aliases.json.gz +0 -0
  215. package/dist/smart/chat-window/component.json +2809 -0
  216. package/dist/smart/chat-window/component.json.gz +0 -0
  217. package/dist/smart/chat-window/css/chat-window.css +1717 -0
  218. package/dist/smart/chat-window/css/chat-window.css.gz +0 -0
  219. package/dist/smart/chat-window/css/chat-window.min.css +2 -0
  220. package/dist/smart/chat-window/css/chat-window.min.css.gz +0 -0
  221. package/dist/smart/chat-window/examples.json +2798 -0
  222. package/dist/smart/chat-window/examples.json.gz +0 -0
  223. package/dist/smart/chat-window/js/chat-window.js +12382 -0
  224. package/dist/smart/chat-window/js/chat-window.js.gz +0 -0
  225. package/dist/smart/chat-window/js/chat-window.min.js +1 -0
  226. package/dist/smart/chat-window/js/chat-window.min.js.gz +0 -0
  227. package/dist/smart/chat-window/lang/en.json +212 -0
  228. package/dist/smart/chat-window/lang/en.json.gz +0 -0
  229. package/dist/smart/chat-window/lang/ru.json +218 -0
  230. package/dist/smart/chat-window/lang/ru.json.gz +0 -0
  231. package/dist/smart/chat-window/probe.json +2023 -0
  232. package/dist/smart/chat-window/probe.json.gz +0 -0
  233. package/dist/smart/chat-window/smart.manifest.json +2835 -0
  234. package/dist/smart/chat-window/smart.manifest.json.gz +0 -0
  235. package/dist/smart/chat-window/static/default/archived.html +97 -0
  236. package/dist/smart/chat-window/static/default/archived.html.gz +0 -0
  237. package/dist/smart/chat-window/static/default/embedded.html +119 -0
  238. package/dist/smart/chat-window/static/default/embedded.html.gz +0 -0
  239. package/dist/smart/chat-window/static/default/greeting.html +119 -0
  240. package/dist/smart/chat-window/static/default/greeting.html.gz +0 -0
  241. package/dist/smart/chat-window/static/default/people.html +110 -0
  242. package/dist/smart/chat-window/static/default/people.html.gz +0 -0
  243. package/dist/smart/chat-window/static/default/proposal.html +157 -0
  244. package/dist/smart/chat-window/static/default/proposal.html.gz +0 -0
  245. package/dist/smart/chat-window/static/default/reference.html +117 -0
  246. package/dist/smart/chat-window/static/default/reference.html.gz +0 -0
  247. package/dist/smart/chat-window/static/default/waiting.html +117 -0
  248. package/dist/smart/chat-window/static/default/waiting.html.gz +0 -0
  249. package/dist/smart/chat-window/static/sheets.json +476 -0
  250. package/dist/smart/chat-window/static/sheets.json.gz +0 -0
  251. package/dist/smart/chat-window/studio.fixture.json +13 -0
  252. package/dist/smart/chat-window/studio.fixture.json.gz +0 -0
  253. package/dist/smart/chat-window/studio.scenario.json +95 -0
  254. package/dist/smart/chat-window/studio.scenario.json.gz +0 -0
  255. package/dist/smart/chat-window/template/default.css +1168 -0
  256. package/dist/smart/chat-window/template/default.css.gz +0 -0
  257. package/dist/smart/chat-window/template/default.js +12 -0
  258. package/dist/smart/chat-window/template/default.js.gz +0 -0
  259. package/dist/smart/rule.js +185 -0
  260. package/dist/smart/rule.js.gz +0 -0
  261. package/package.json +29 -4
@@ -0,0 +1,75 @@
1
+ (()=>{"use strict";var e={e849f0d25e58(e,t,s){s.a(e,async(e,t)=>{try{var a=s("deb1a4d61565"),i=s("5b7d7695b41b"),n=s("e92fd2d1a38c"),r=s("43090d1c8307"),o=s("c790b3e0c605"),l=s("78eece9c0d65"),c=s("c570a02c474e"),h=s("018100550391"),d=s("3de0b0ac7d3d"),u=e([a,i,n,r,o]);[a,i,n,r,o]=u.then?(await u)():u;var p=s.n(a);const f=4e3,m=5,b=()=>({outcome:"applied"}),g=(0,i.elementFromManifest)(l,{base:p(),lang:{en:h,ru:d},source:"ru",aliases:c,actions:{"set-files"({files:e}){return this.files=e,b()},clear(){return this.value="",this.notice="",b()}}});class v extends g{static get props(){return{...super.props,templateName:{attribute:"template",default:"default"}}}constructor(){super(),this._notice="",this._busyHint=!1,this._level="",this._said="",this._tallText=!1,this._dragging=!1,this._depth=0,this._draft=void 0,this._observer=null,this._observed=null;for(const e of["files","value","busy","queue","disabled"]){if(!Object.prototype.hasOwnProperty.call(this,e))continue;const t=this[e];delete this[e],this[e]=t}}get field(){return this._hasRendered?this.querySelector("textarea.sf-chat-composer__input"):null}get value(){const e=this.field;return e?e.value:this._draft??this.getAttribute("value")??""}set value(e){const t=null==e?"":String(e),s=this.field;s?(s.value=t,s.dispatchEvent(new Event("input"))):this._draft=t}get chips(){const e=this.files;return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e).map(e=>({...e,name:String(e.name??"")})):[]}get limit(){return this.maxlength>0?this.maxlength:f}get fileLimit(){return this.maxFiles>0?this.maxFiles:m}get notice(){return this._notice}set notice(e){const t=e?String(e):"";t!==this._notice&&(this._notice=t,this.requestComponentUpdate("notice"))}focusDelegate(){return this.field}sfAliasAdapters(){return{"sf-chat-send":e=>e?{text:e.text,attachmentIds:e.attachmentIds}:void 0,"sf-chat-action":e=>e?{action:"remove-attachment",id:e.id,name:e.name}:void 0}}get basePath(){return(0,n.instancePath)(this,{kind:"sf-chat-composer"})}formatBytes(e){const t=Number(e)||0,s=(0,r.pageLocale)(this),a=e=>new Intl.NumberFormat(s,{maximumFractionDigits:e<10?1:0}).format(e);return t<1024?this.sfWord("size-b-text",{vars:{n:t}}):t<1048576?this.sfWord("size-kb-text",{vars:{n:a(t/1024)}}):t<1024**3?this.sfWord("size-mb-text",{vars:{n:a(t/1024/1024)}}):this.sfWord("size-gb-text",{vars:{n:a(t/1024**3)}})}get queueing(){return this.busy&&this.queue&&0===this.chips.length}templateContext(){const e=this.chips,t=this.busy,s=this.queueing,a=this.disabled,i=this.value.length,r=this.limit,o=i>.8*r,l=i>r,c=o?l?this.sfWord("too-long-text",{vars:{max:r}}):this.sfWord("count-text",{vars:{count:i,max:r}}):"",h=l?"over":o?"near":"";h!==this._level&&(this._level=h,this._said=h?c:""),t||(this._busyHint=!1);const d=this._busyHint?this.queue?"busy-files-text":"busy-text":s?"queue-hint-text":"hint-text",u=this.basePath;return{component:this,files:e,busy:t,disabled:a,noStop:this.noStop,attachments:this.attachments,accept:this.accept,attachDisabled:a||e.length>=this.fileLimit,ready:this.canSend(),near:o,over:l,countText:c,said:this._said,notice:this._notice,busyHint:this._busyHint,hint:this.sfWord(d),queueing:s,tall:e.length>0||this._tallText,dragging:this._dragging,placeholder:this.placeholder||this.sfWord("placeholder-text"),fieldLabel:this.sfWord("field-label"),attachLabel:this.sfWord("attach-label"),sendLabel:this.sfWord(s?"queue-label":"send-label"),stopLabel:this.sfWord("stop-label"),dropText:this.sfWord("drop-text"),inputId:(0,n.partId)(u,"input"),statusId:(0,n.partId)(u,"status"),hintId:(0,n.partId)(u,"hint"),fileWords:{file:(e,t)=>this.sfWord("file-label",{vars:{name:e,size:t}}),uploading:e=>this.sfWord("uploading-text",{vars:{percent:e}}),remove:e=>this.sfWord("remove-label",{vars:{name:e}}),size:e=>this.formatBytes(e)}}}template(){return(0,o.d)(this.templateContext())}afterRender(e){super.afterRender?.(e);const t=this.field;if(t){if(void 0!==this._draft||!this._started){this._started=!0;const e=this._draft??this.getAttribute("value")??"";this._draft=void 0,e&&t.value!==e&&(this.value=e)}this._observed!==t&&(this._observer?.disconnect(),this._observer="undefined"==typeof ResizeObserver?null:new ResizeObserver(()=>this.shape()),this._observer?.observe(t.closest(".sf-chat-composer__field")??t),this._observed=t),this.shape()}}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._observed=null,super.disconnectedCallback()}shape(){const e=this.field;if(!e)return;const t=getComputedStyle(e),s=parseFloat(t.lineHeight)||24,a=e.scrollHeight-parseFloat(t.paddingBlockStart||0)-parseFloat(t.paddingBlockEnd||0)>1.5*s;a!==this._tallText&&(this._tallText=a,this.requestComponentUpdate("shape"))}onInput(){this.requestComponentUpdate("input")}onKey(e){if("Enter"===e.key&&!e.shiftKey&&!e.isComposing&&229!==e.keyCode){if(e.preventDefault(),this.busy&&!this.queueing&&this.value.trim())return this._busyHint=!0,void this.requestComponentUpdate("busy-hint");this.send()}}onPaste(e){const t=[...e.clipboardData?.files||[]];t.length&&this.attachments&&(e.preventDefault(),this.offerFiles(t))}pick(){this.querySelector(".sf-chat-composer__picker")?.click()}onPicked(e){this.offerFiles([...e.files||[]]),e.value=""}canAttach(){return this.attachments&&!this.disabled}onDragEnter(e){this.canAttach()&&e.dataTransfer?.types?.includes("Files")&&(e.preventDefault(),this._depth+=1,this.setDragging(!0))}onDragOver(e){this.canAttach()&&e.preventDefault()}onDragLeave(){this._depth=Math.max(0,this._depth-1),this._depth||this.setDragging(!1)}onDrop(e){this._depth=0,this.setDragging(!1),this.canAttach()&&(e.preventDefault(),this.offerFiles([...e.dataTransfer?.files||[]]))}setDragging(e){this._dragging!==e&&(this._dragging=e,this.requestComponentUpdate("dragging"))}offerFiles(e){if(!e.length)return;const t=String(this.accept||"").split(",").map(e=>e.trim().toLowerCase()).filter(Boolean),s=Math.max(0,this.fileLimit-this.chips.length),a=this.maxBytes>0?this.maxBytes:0,i=[],n=[];for(const r of e){const e=`.${(String(r.name).split(".").pop()||"").toLowerCase()}`;t.length&&!t.includes(e)?n.push({file:r,reason:this.sfWord("bad-type-text")}):a&&r.size>a?n.push({file:r,reason:this.sfWord("too-big-text",{vars:{size:this.formatBytes(a)}})}):i.length>=s?n.push({file:r,reason:this.sfWord("too-many-text",{count:this.fileLimit,vars:{max:this.fileLimit}})}):i.push(r)}this.notice=n.map(e=>`${e.file.name}: ${e.reason}`).join("; "),this.sfEmit("attach",{files:i,rejected:n},{cancelable:!0})}removeFile(e){this.sfEmit("detach",{id:e.id,name:e.name},{cancelable:!0})}canSend(){const e=this.value.trim(),t=this.chips,s=t.some(e=>void 0!==e.progress&&null!==e.progress&&e.progress<1&&!e.error),a=t.some(e=>e.id&&!e.error);return(!this.busy||this.queueing)&&!this.disabled&&!s&&(e.length>0||a)&&this.value.length<=this.limit}send(){if(!this.canSend())return;const e=this.value.trim(),t=this.chips.filter(e=>e.id&&!e.error).map(e=>e.id);this.sfEmit("submit",{text:e,attachmentIds:t,"attachment-ids":t},{cancelable:!0})&&(this.notice="")}stop(){this.sfEmit("stop",{},{cancelable:!0}),this.field?.focus()}}v.define("sf-chat-composer"),t()}catch(e){t(e)}})},c790b3e0c605(e,t,s){s.a(e,async(e,a)=>{try{s.d(t,{d:()=>l});var i=s("2a080a730149"),n=s("efa66f8927d1"),r=s("09772fbfb8c4"),o=e([i,n,r]);[i,n,r]=o.then?(await o)():o;function l(e){const{component:t}=e,s=["sf-chat-composer",e.over?"sf-chat-composer--over":"",e.disabled?"sf-chat-composer--disabled":"",e.dragging?"sf-chat-composer--dragging":""].filter(Boolean).join(" ");return i.html`
2
+ <form
3
+ class=${s}
4
+ novalidate
5
+ @submit=${e=>{e.preventDefault(),t.send()}}
6
+ @dragenter=${e=>t.onDragEnter(e)}
7
+ @dragover=${e=>t.onDragOver(e)}
8
+ @dragleave=${()=>t.onDragLeave()}
9
+ @drop=${e=>t.onDrop(e)}
10
+ >
11
+ <div class="sf-chat-composer__box${e.tall?" sf-chat-composer__box--tall":""}">
12
+ <div class="sf-chat-composer__files" ?hidden=${!e.files.length}>${(0,n.repeat)(e.files,(e,t)=>e.localId??e.id??`#${t}`,s=>(0,r.ye)(s,{words:e.fileWords,removable:!0,onRemove:e=>t.removeFile(e)}))}</div>
13
+ <div class="sf-chat-composer__row">
14
+ ${(0,r.gb)({icon:"attach_file",label:e.attachLabel,size:"1",className:"sf-chat-composer__attach",hidden:!e.attachments,disabled:e.attachDisabled,onClick:()=>t.pick()})}
15
+ <label class="sf-textarea sf-textarea--size-1 sf-textarea--flush sf-chat-composer__field"><textarea
16
+ class="sf-chat-composer__input"
17
+ rows="1"
18
+ data-auto-grow
19
+ data-max-rows="8"
20
+ id=${e.inputId}
21
+ aria-label=${e.fieldLabel}
22
+ aria-describedby=${e.statusId}
23
+ placeholder=${e.placeholder}
24
+ ?disabled=${e.disabled}
25
+ @input=${()=>t.onInput()}
26
+ @keydown=${e=>t.onKey(e)}
27
+ @paste=${e=>t.onPaste(e)}
28
+ ></textarea></label>
29
+ <span class="sf-chat-composer__count" id=${e.statusId} ?hidden=${!e.near}>${e.countText}</span>
30
+ ${(0,r.gb)({icon:"arrow_upward",label:e.sendLabel,appearance:e.ready?"default":"tonal",scheme:e.ready?"primary":"on-surface",size:"1",className:"sf-chat-composer__send",type:"submit",hidden:e.busy&&!(e.queueing&&e.ready),disabled:!e.ready})}
31
+ ${(0,r.gb)({icon:"stop",label:e.stopLabel,appearance:"default",scheme:"on-surface",size:"1",className:"sf-chat-composer__stop",hidden:!e.busy||e.noStop,onClick:()=>t.stop()})}
32
+ </div>
33
+ <div class="sf-chat-composer__drop" aria-hidden="true">${e.dropText}</div>
34
+ </div>
35
+ <p class="sf-chat-composer__notice" role="alert" ?hidden=${!e.notice}>${e.notice}</p>
36
+ <p
37
+ class="sf-chat-composer__hint${e.busyHint?" sf-chat-composer__hint--busy":""}"
38
+ id=${e.hintId}
39
+ aria-live="polite"
40
+ >${e.hint}</p>
41
+ <input
42
+ class="sf-chat-composer__picker"
43
+ type="file"
44
+ multiple
45
+ hidden
46
+ accept=${e.accept||i.nothing}
47
+ @change=${e=>t.onPicked(e.currentTarget)}
48
+ >
49
+ <span class="sf-chat-composer__said sr-only" aria-live="polite">${e.said}</span>
50
+ </form>
51
+ `}a()}catch(c){a(c)}})},"09772fbfb8c4"(e,t,s){s.a(e,async(e,a)=>{try{s.d(t,{gb:()=>l,ye:()=>h});var i=s("2a080a730149"),n=e([i]),r=n.then?(await n)():n;i=r[0];const o={"1/3":"1","1/2":"1",1:"2",2:"2",3:"3"};function l({icon:e,label:t,appearance:s="link",scheme:a="on-surface",size:n="1/2",className:r="",type:l="button",disabled:c=!1,hidden:h=!1,onClick:d=null}){return i.html`<button
52
+ type=${l}
53
+ class="sf-icon-button sf-icon-button--size-${n} sf-icon-button--icon sf-icon-button--${s} sf-icon-button--${a} flex items-cross-center content-main-center ${r}"
54
+ aria-label=${t}
55
+ title=${t}
56
+ ?disabled=${c}
57
+ ?hidden=${h}
58
+ @click=${d??i.nothing}
59
+ ><sf-icon icon=${e} size=${o[n]||"1"} aria-hidden="true"></sf-icon></button>`}function c(e){if(e.error)return"error";const t=e.progress;return null!=t&&t<1?"uploading":"ready"}function h(e,{words:t,removable:s=!1,onRemove:a=null}={}){const n=c(e),r=String(e.name??""),o=t.size(e.bytes),h=Math.round(100*(e.progress||0)),d="uploading"===n?t.uploading(h):e.error||o;return i.html`<div class="sf-chat-attachment sf-chat-attachment--${n}" role="group" aria-label=${t.file(r,o)}>
60
+ <span class="sf-chat-attachment__icon" aria-hidden="true"><sf-icon icon=${"error"===n?"error":"description"} size="2" aria-hidden="true"></sf-icon></span>
61
+ <span class="sf-chat-attachment__body">
62
+ <span class="sf-chat-attachment__name" title=${r}>${r}</span>
63
+ <span class="sf-chat-attachment__meta" title=${e.error||i.nothing} role=${e.error?"alert":i.nothing}>${d}</span>
64
+ </span>
65
+ ${"uploading"===n?i.html`<span
66
+ class="sf-chat-attachment__progress"
67
+ role="progressbar"
68
+ aria-valuemin="0"
69
+ aria-valuemax="100"
70
+ aria-valuenow=${String(h)}
71
+ aria-label=${r}
72
+ style="--sf-chat-attachment--progress: ${e.progress||0}"
73
+ ></span>`:i.nothing}
74
+ ${s?l({icon:"close",label:t.remove(r),size:"1/2",className:"sf-chat-attachment__remove",onClick:()=>a?.(e)}):i.nothing}
75
+ </div>`}a()}catch(d){a(d)}})},"5b7d7695b41b"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("element-manifest",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("element-manifest",1).then(e,t),{once:!0}))},e92fd2d1a38c(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("instance-path",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("instance-path",1).then(e,t),{once:!0}))},efa66f8927d1(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit/directives/repeat.js",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit/directives/repeat.js",1).then(e,t),{once:!0}))},"2a080a730149"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("lit",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("lit",1).then(e,t),{once:!0}))},"43090d1c8307"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("page-language",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("page-language",1).then(e,t),{once:!0}))},deb1a4d61565(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("smart-base",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("smart-base",1).then(e,t),{once:!0}))},c570a02c474e(e){e.exports=JSON.parse('{"$comment":"Dated aliases of sf-chat-composer for the shim (core/js/aliases.js, standard §16 item 20). The 0.3 events of simai/ui-chat follow the vocabulary\'s names; two need the element\'s detail adapters (sfAliasAdapters).","component":"sf-chat-composer","since":"2026-10-28","remove_after":"2026-12-01","aliases":[{"from":"sf-chat-send","to":"sf-chat-composer-submit","kind":"event","component":"sf-chat-composer","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, vocabulary 1.1.5 §5, §5.1, §7","note":"the 0.3 detail {text, attachmentIds}: the element\'s adapter (sfAliasAdapters) makes it from {text, attachmentIds}"},{"from":"sf-chat-stop","to":"sf-chat-composer-stop","kind":"event","component":"sf-chat-composer","since":"2026-10-28","remove_after":"2026-12-01","mode":"same-detail","cancelable":true,"section":"§8, vocabulary 1.1.5 §5, §5.1, §7","note":"an event takes its tag and a verb; the chat\'s own stop (vocabulary 1.1.3 §5.1); {} is unchanged"},{"from":"sf-chat-files","to":"sf-chat-composer-attach","kind":"event","component":"sf-chat-composer","since":"2026-10-28","remove_after":"2026-12-01","mode":"same-detail","cancelable":true,"section":"§8, vocabulary 1.1.5 §5, §5.1, §7","note":"vocabulary §5 attach; {files, rejected} is unchanged"},{"from":"sf-chat-action","to":"sf-chat-composer-detach","kind":"event","component":"sf-chat-composer","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, vocabulary 1.1.5 §5, §5.1, §7","note":"the 0.3 general action event {action: remove-attachment, id, name}: the element\'s adapter puts action back on {id, name}"}]}')},"78eece9c0d65"(e){e.exports=JSON.parse('{"id":"smart.chat-composer","tag":"sf-chat-composer","version":"1.2.3","kind":"leaf","settings":{"placeholder":{"type":"string","default-from":"runtime.placeholder-text"},"maxlength":{"type":"number","default":4000,"integer":true,"min":1},"max-files":{"type":"number","default":5,"integer":true,"min":1},"max-bytes":{"type":"number","default":0,"integer":true,"min":0},"accept":{"type":"string","default":""},"attachments":{"type":"boolean","default":false},"busy":{"type":"boolean","default":false},"queue":{"type":"boolean","default":false},"disabled":{"type":"boolean","default":false},"files":{"type":"list","default":[],"of":{"id":"id","localId":{"type":"id","optional":true},"name":"string","bytes":"number","progress":{"type":"number","nullable":true,"optional":true},"error":{"type":"string","nullable":true,"optional":true}},"entries":{"key":"id","changes":"content"}},"no-stop":{"type":"boolean","default":false}},"values":{"value":{"type":"string","default":""}},"events":{"submit":{"carries":{"text":"string","attachment-ids":"list"},"cancelable":true},"stop":{"carries":{},"cancelable":true},"attach":{"carries":{"files":"list","rejected":{"type":"list","schema":{"items":{"type":"object","required":["file","reason"],"properties":{"file":{"type":"object"},"reason":{"type":"string"}}}}}},"cancelable":true},"detach":{"carries":{"id":"id","name":{"type":"string","optional":true}},"cancelable":true}},"actions":{"set-files":{"with":{"files":{"type":"list","schema":{"items":{"type":"object","required":["name"],"properties":{"id":{"type":"string"},"localId":{"type":"string"},"name":{"type":"string"},"bytes":{"type":"number"},"progress":{"type":["number","null"]},"error":{"type":["string","null"]}}}}}}},"clear":{}},"host-states":{},"css-variables":{"--sf-chat-composer-background-color":{"type":"color","state":"default"},"--sf-chat-composer-border-color":{"type":"color","state":"default"},"--sf-chat-composer-hint-color":{"type":"color","state":"default"},"--sf-chat-composer-height":{"type":"length","state":"default"}}}')},"018100550391"(e){e.exports=JSON.parse('{"title":"Chat composer","runtime":{"attach-label":"Attach a file","bad-type-text":"this file type is not supported","busy-files-text":"A message with files can be sent once the answer comes","busy-text":"Wait for the answer or stop waiting","count-text":"{count} of {max}","drop-text":"Drop to attach","field-label":"Message","file-label":"File {name}, {size}","hint-text":"Enter to send, Shift+Enter for a new line","placeholder-text":"Ask anything","queue-hint-text":"Enter to send after the answer, Shift+Enter for a new line","queue-label":"Send after the answer","remove-label":"Remove the file {name}","send-label":"Send","size-b-text":"{n} B","size-gb-text":"{n} GB","size-kb-text":"{n} KB","size-mb-text":"{n} MB","stop-label":"Stop waiting","too-big-text":"the file is larger than {size}","too-long-text":"The message is longer than {max} characters","too-many-text":{"one":"you can attach only {max} file","other":"you can attach up to {max} files"},"uploading-text":"Uploading, {percent}%"}}')},"3de0b0ac7d3d"(e){e.exports=JSON.parse('{"title":"Поле вопроса чата","runtime":{"attach-label":"Прикрепить файл","bad-type-text":"этот тип файла не поддерживается","busy-files-text":"Сообщение с файлами можно отправить, когда придёт ответ","busy-text":"Дождитесь ответа или остановите ожидание","count-text":"{count} из {max}","drop-text":"Отпустите, чтобы прикрепить","field-label":"Сообщение","file-label":"Файл {name}, {size}","hint-text":"Enter — отправить, Shift+Enter — новая строка","placeholder-text":"Спросите что-нибудь","queue-hint-text":"Enter — отправить после ответа, Shift+Enter — новая строка","queue-label":"Отправить после ответа","remove-label":"Убрать файл {name}","send-label":"Отправить","size-b-text":"{n} Б","size-gb-text":"{n} ГБ","size-kb-text":"{n} КБ","size-mb-text":"{n} МБ","stop-label":"Остановить ожидание","too-big-text":"файл больше {size}","too-long-text":"Сообщение длиннее {max} знаков","too-many-text":{"one":"можно прикрепить не больше {max} файла","other":"можно прикрепить не больше {max} файлов"},"uploading-text":"Загружается, {percent}%"}}')}};const t={};function s(a){const i=t[a];if(void 0!==i)return i.exports;const n=t[a]={exports:{}};return e[a](n,n.exports,s),n.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",a=e?Symbol("webpack exports"):"__webpack_exports__",i=e?Symbol("webpack error"):"__webpack_error__",n=e=>{e?.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))};s.a=(e,s,r)=>{let o;r&&((o=[]).d=-1);const l=new Set,c=e.exports;let h,d,u;const p=new Promise((e,t)=>{u=t,d=e});p[a]=c,p[t]=e=>(o&&e(o),l.forEach(e),p.catch(e=>{})),e.exports=p;s(e=>{let s;h=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){const s=[];s.d=0,e.then(e=>{r[a]=e,n(s)},e=>{r[i]=e,n(s)});const r={};return r[t]=e=>e(s),r}}const s={};return s[t]=e=>{},s[a]=e,s}))(e);const r=()=>h.map(e=>{if(e[i])throw e[i];return e[a]}),c=new Promise(e=>{s=()=>e(r),s.r=0;const a=e=>e!==o&&!l.has(e)&&(l.add(e),e&&!e.d&&(s.r++,e.push(s)));h.map(e=>e[t](a))});return s.r?c:r()},e=>(e?u(p[i]=e):d(c),n(o))),o?.d<0&&(o.d=0)}})(),s.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{if(Array.isArray(t))for(var a=0;a<t.length;){var i=t[a++],n=t[a++];s.o(e,i)?0===n&&a++:0===n?Object.defineProperty(e,i,{enumerable:!0,value:t[a++]}):Object.defineProperty(e,i,{enumerable:!0,get:n})}else for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);s("e849f0d25e58")})();
@@ -0,0 +1,31 @@
1
+ {
2
+ "title": "Chat composer",
3
+ "runtime": {
4
+ "attach-label": "Attach a file",
5
+ "bad-type-text": "this file type is not supported",
6
+ "busy-files-text": "A message with files can be sent once the answer comes",
7
+ "busy-text": "Wait for the answer or stop waiting",
8
+ "count-text": "{count} of {max}",
9
+ "drop-text": "Drop to attach",
10
+ "field-label": "Message",
11
+ "file-label": "File {name}, {size}",
12
+ "hint-text": "Enter to send, Shift+Enter for a new line",
13
+ "placeholder-text": "Ask anything",
14
+ "queue-hint-text": "Enter to send after the answer, Shift+Enter for a new line",
15
+ "queue-label": "Send after the answer",
16
+ "remove-label": "Remove the file {name}",
17
+ "send-label": "Send",
18
+ "size-b-text": "{n} B",
19
+ "size-gb-text": "{n} GB",
20
+ "size-kb-text": "{n} KB",
21
+ "size-mb-text": "{n} MB",
22
+ "stop-label": "Stop waiting",
23
+ "too-big-text": "the file is larger than {size}",
24
+ "too-long-text": "The message is longer than {max} characters",
25
+ "too-many-text": {
26
+ "one": "you can attach only {max} file",
27
+ "other": "you can attach up to {max} files"
28
+ },
29
+ "uploading-text": "Uploading, {percent}%"
30
+ }
31
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "title": "Поле вопроса чата",
3
+ "runtime": {
4
+ "attach-label": "Прикрепить файл",
5
+ "bad-type-text": "этот тип файла не поддерживается",
6
+ "busy-files-text": "Сообщение с файлами можно отправить, когда придёт ответ",
7
+ "busy-text": "Дождитесь ответа или остановите ожидание",
8
+ "count-text": "{count} из {max}",
9
+ "drop-text": "Отпустите, чтобы прикрепить",
10
+ "field-label": "Сообщение",
11
+ "file-label": "Файл {name}, {size}",
12
+ "hint-text": "Enter — отправить, Shift+Enter — новая строка",
13
+ "placeholder-text": "Спросите что-нибудь",
14
+ "queue-hint-text": "Enter — отправить после ответа, Shift+Enter — новая строка",
15
+ "queue-label": "Отправить после ответа",
16
+ "remove-label": "Убрать файл {name}",
17
+ "send-label": "Отправить",
18
+ "size-b-text": "{n} Б",
19
+ "size-gb-text": "{n} ГБ",
20
+ "size-kb-text": "{n} КБ",
21
+ "size-mb-text": "{n} МБ",
22
+ "stop-label": "Остановить ожидание",
23
+ "too-big-text": "файл больше {size}",
24
+ "too-long-text": "Сообщение длиннее {max} знаков",
25
+ "too-many-text": {
26
+ "one": "можно прикрепить не больше {max} файла",
27
+ "other": "можно прикрепить не больше {max} файлов"
28
+ },
29
+ "uploading-text": "Загружается, {percent}%"
30
+ }
31
+ }
@@ -0,0 +1,400 @@
1
+ {
2
+ "component": "sf-chat-composer",
3
+ "probe": "sf-chat-composer against component.json (standard simai.smart-component 1.3.9 §12, gate 20); the behaviour simai/ui-chat's tests/browser/staff.test.mjs holds for it: Enter sends, Shift+Enter breaks the line, the stop button while an answer is awaited, the count past 80 %, the files checked and their chips",
4
+ "format": "stands/15-scenarios (A4 modal: a page, probes in steps); the runner is ui-source tests/browser/manifest-probes.browser.mjs, run for the package by scripts/run-manifest-probes.mjs",
5
+ "page": {
6
+ "lang": "ru",
7
+ "body": [
8
+ "<main>",
9
+ " <sf-chat-composer id=\"plain\"></sf-chat-composer>",
10
+ " <sf-chat-composer id=\"limit\" maxlength=\"10\"></sf-chat-composer>",
11
+ " <sf-chat-composer id=\"files\" attachments accept=\".pdf,.docx\" max-files=\"2\" max-bytes=\"1024\"></sf-chat-composer>",
12
+ "</main>"
13
+ ]
14
+ },
15
+ "probes": [
16
+ {
17
+ "id": "p1-enter-submits",
18
+ "title": "Enter sends the trimmed text as sf-chat-composer-submit {text, attachment-ids} once, and the 0.3 sf-chat-send {text, attachmentIds} once, noted with its dates; the composer does not clear itself",
19
+ "covers": "events.submit, aliases sf-chat-send, keyboard Enter commit, values.value",
20
+ "steps": [
21
+ {
22
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#plain').value = ' Сколько дней отпуска? ', document.querySelector('#plain .sf-chat-composer__input').focus(), true)",
23
+ "wait": 200,
24
+ "check": "document.querySelector('#plain .sf-chat-composer__send').disabled === false && document.querySelector('#plain .sf-chat-composer__send').classList.contains('sf-icon-button--primary')"
25
+ },
26
+ {
27
+ "user": "keyboard:Enter",
28
+ "expect": {
29
+ "events": [
30
+ {
31
+ "name": "sf-chat-composer-submit",
32
+ "count": 1,
33
+ "detail": {
34
+ "text": "Сколько дней отпуска?",
35
+ "attachment-ids": []
36
+ }
37
+ },
38
+ {
39
+ "name": "sf-chat-send",
40
+ "count": 1,
41
+ "detail": {
42
+ "text": "Сколько дней отпуска?",
43
+ "attachmentIds": []
44
+ }
45
+ }
46
+ ],
47
+ "journal": [
48
+ {
49
+ "from": "sf-chat-send",
50
+ "to": "sf-chat-composer-submit",
51
+ "since": "2026-10-28",
52
+ "remove_after": "2026-12-01"
53
+ }
54
+ ]
55
+ },
56
+ "check": "document.querySelector('#plain').value === ' Сколько дней отпуска? '"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "id": "p2-shift-enter-breaks-line",
62
+ "title": "Shift+Enter breaks the line and sends nothing; an empty field sends nothing on Enter and its send button is quiet (tonal on-surface), not a disabled primary",
63
+ "covers": "keyboard Shift+Enter, accessibility.x-keys",
64
+ "steps": [
65
+ {
66
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#plain').value = 'Первая строка', document.querySelector('#plain .sf-chat-composer__input').focus(), true)",
67
+ "wait": 200
68
+ },
69
+ {
70
+ "user": "keyboard:Shift+Enter",
71
+ "expect": {
72
+ "events": [
73
+ {
74
+ "name": "sf-chat-composer-submit",
75
+ "count": 0
76
+ }
77
+ ]
78
+ },
79
+ "check": "document.querySelector('#plain').value.includes('\\n')"
80
+ },
81
+ {
82
+ "script": "(document.querySelector('#plain').value = '', document.querySelector('#plain .sf-chat-composer__input').focus(), true)",
83
+ "wait": 200
84
+ },
85
+ {
86
+ "user": "keyboard:Enter",
87
+ "expect": {
88
+ "events": [
89
+ {
90
+ "name": "sf-chat-composer-submit",
91
+ "count": 0
92
+ }
93
+ ]
94
+ },
95
+ "check": "(() => { const b = document.querySelector('#plain .sf-chat-composer__send'); return b.disabled && b.classList.contains('sf-icon-button--tonal') && b.classList.contains('sf-icon-button--on-surface') && b.getAttribute('aria-label') === 'Отправить'; })()"
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "id": "p3-busy-stop",
101
+ "title": "busy: send becomes «Остановить ожидание»; Enter with text sends nothing and the hint says why; the stop button sends sf-chat-composer-stop and the 0.3 sf-chat-stop once and gives the focus back to the field; not busy, the hint is the Enter hint again",
102
+ "covers": "settings.busy, events.stop, aliases sf-chat-stop, runtime.busy-text, runtime.hint-text",
103
+ "steps": [
104
+ {
105
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#plain').busy = true, document.querySelector('#plain').value = 'Ещё вопрос', document.querySelector('#plain .sf-chat-composer__input').focus(), true)",
106
+ "wait": 250,
107
+ "check": "(() => { const c = document.querySelector('#plain'); return c.querySelector('.sf-chat-composer__send').hidden && !c.querySelector('.sf-chat-composer__stop').hidden && c.querySelector('.sf-chat-composer__stop').getAttribute('aria-label') === 'Остановить ожидание' && c.querySelector('.sf-chat-composer__hint').textContent.trim() === 'Enter — отправить, Shift+Enter — новая строка'; })()"
108
+ },
109
+ {
110
+ "user": "keyboard:Enter",
111
+ "expect": {
112
+ "events": [
113
+ {
114
+ "name": "sf-chat-composer-submit",
115
+ "count": 0
116
+ }
117
+ ]
118
+ },
119
+ "check": "(() => { const h = document.querySelector('#plain .sf-chat-composer__hint'); return h.textContent.trim() === 'Дождитесь ответа или остановите ожидание' && h.classList.contains('sf-chat-composer__hint--busy') && h.getAttribute('aria-live') === 'polite'; })()"
120
+ },
121
+ {
122
+ "user": "click:#plain .sf-chat-composer__stop",
123
+ "expect": {
124
+ "events": [
125
+ {
126
+ "name": "sf-chat-composer-stop",
127
+ "count": 1
128
+ },
129
+ {
130
+ "name": "sf-chat-stop",
131
+ "count": 1
132
+ }
133
+ ],
134
+ "journal": [
135
+ {
136
+ "from": "sf-chat-stop",
137
+ "to": "sf-chat-composer-stop",
138
+ "since": "2026-10-28",
139
+ "remove_after": "2026-12-01"
140
+ }
141
+ ]
142
+ },
143
+ "check": "document.activeElement === document.querySelector('#plain .sf-chat-composer__input')"
144
+ },
145
+ {
146
+ "script": "(document.querySelector('#plain').busy = false, true)",
147
+ "wait": 250,
148
+ "check": "(() => { const c = document.querySelector('#plain'); return !c.querySelector('.sf-chat-composer__send').hidden && c.querySelector('.sf-chat-composer__stop').hidden && c.querySelector('.sf-chat-composer__hint').textContent.trim() === 'Enter — отправить, Shift+Enter — новая строка' && !c.querySelector('.sf-chat-composer__hint--busy'); })()"
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ "id": "p4-max-chars",
154
+ "title": "past 80 % of maxlength the count shows and describes the field; past the limit it says so, the box is in error and send is off",
155
+ "covers": "settings.maxlength, runtime.count-text, runtime.too-long-text",
156
+ "steps": [
157
+ {
158
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#limit').value = 'Отпуск', true)",
159
+ "wait": 250,
160
+ "check": "(() => { const c = document.querySelector('#limit'); const count = c.querySelector('.sf-chat-composer__count'); return count.hidden && c.querySelector('.sf-chat-composer__input').getAttribute('aria-describedby') === count.id; })()"
161
+ },
162
+ {
163
+ "script": "(document.querySelector('#limit').value = 'Мой отпуск', true)",
164
+ "wait": 250,
165
+ "check": "(() => { const c = document.querySelector('#limit'); const count = c.querySelector('.sf-chat-composer__count'); return !count.hidden && count.textContent.trim() === '10 из 10' && !c.querySelector('.sf-chat-composer--over') && !c.querySelector('.sf-chat-composer__send').disabled; })()"
166
+ },
167
+ {
168
+ "script": "(document.querySelector('#limit').value = 'Мой отпуск?', true)",
169
+ "wait": 250,
170
+ "check": "(() => { const c = document.querySelector('#limit'); return c.querySelector('.sf-chat-composer__count').textContent.trim() === 'Сообщение длиннее 10 знаков' && c.querySelector('.sf-chat-composer--over') !== null && c.querySelector('.sf-chat-composer__send').disabled && c.querySelector('.sf-chat-composer__said').textContent.trim() === 'Сообщение длиннее 10 знаков'; })()"
171
+ }
172
+ ]
173
+ },
174
+ {
175
+ "id": "p5-files-checked",
176
+ "title": "files from the picker are checked by type, size and count: the refused are named in the alert notice, the accepted go in sf-chat-composer-attach and the 0.3 sf-chat-files once",
177
+ "covers": "settings.accept, settings.max-bytes, settings.max-files, events.attach, aliases sf-chat-files, runtime.bad-type-text, runtime.too-big-text, runtime.too-many-text",
178
+ "steps": [
179
+ {
180
+ "script": "(await customElements.whenDefined('sf-chat-composer'), window.__attached = null, document.querySelector('#files').addEventListener('sf-chat-composer-attach', (event) => { window.__attached = event.detail.files.map((file) => file.name); }, {once: true}), true)",
181
+ "wait": 200
182
+ },
183
+ {
184
+ "script": "(() => { const dt = new DataTransfer(); for (const [name, size] of [['a.pdf', 10], ['setup.exe', 10], ['big.pdf', 2048], ['b.docx', 10], ['c.pdf', 10]]) dt.items.add(new File(['x'.repeat(size)], name)); const picker = document.querySelector('#files').querySelector('.sf-chat-composer__picker'); picker.files = dt.files; picker.dispatchEvent(new Event('change', {bubbles: true})); return true; })()",
185
+ "wait": 300,
186
+ "expect": {
187
+ "events": [
188
+ {
189
+ "name": "sf-chat-composer-attach",
190
+ "count": 1
191
+ },
192
+ {
193
+ "name": "sf-chat-files",
194
+ "count": 1
195
+ }
196
+ ],
197
+ "journal": [
198
+ {
199
+ "from": "sf-chat-files",
200
+ "to": "sf-chat-composer-attach",
201
+ "since": "2026-10-28",
202
+ "remove_after": "2026-12-01"
203
+ }
204
+ ]
205
+ },
206
+ "check": "(() => { const notice = document.querySelector('#files').querySelector('.sf-chat-composer__notice'); return JSON.stringify(window.__attached) === JSON.stringify(['a.pdf', 'b.docx']) && !notice.hidden && notice.getAttribute('role') === 'alert' && notice.textContent === 'setup.exe: этот тип файла не поддерживается; big.pdf: файл больше 1 КБ; c.pdf: можно прикрепить не больше 2 файлов'; })()"
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "id": "p6-chips",
212
+ "title": "set-files, the 0.3 setFiles: chips with size, upload progress and the server's refusal; while one uploads send is off and the files button is off at max-files; a chip's remove sends sf-chat-composer-detach {id, name} and the 0.3 sf-chat-action {action: remove-attachment, id, name}",
213
+ "covers": "settings.files, actions.set-files, events.detach, aliases sf-chat-action, runtime.file-label, runtime.uploading-text, runtime.remove-label",
214
+ "steps": [
215
+ {
216
+ "script": "(await customElements.whenDefined('sf-chat-composer'), true)",
217
+ "wait": 200
218
+ },
219
+ {
220
+ "action": {
221
+ "name": "set-files",
222
+ "with": [
223
+ {
224
+ "id": "att_1",
225
+ "localId": "f1",
226
+ "name": "Договор.pdf",
227
+ "bytes": 48213
228
+ },
229
+ {
230
+ "localId": "f2",
231
+ "name": "Регламент.docx",
232
+ "bytes": 1572864,
233
+ "progress": 0.4
234
+ },
235
+ {
236
+ "localId": "f3",
237
+ "name": "Скан.pdf",
238
+ "bytes": 2048,
239
+ "error": "не похоже на документ"
240
+ }
241
+ ]
242
+ },
243
+ "target": "#files",
244
+ "wait": 300,
245
+ "expect": {
246
+ "returns": {
247
+ "outcome": "applied"
248
+ }
249
+ },
250
+ "check": "(() => { const c = document.querySelector('#files'); const chips = c.querySelectorAll('.sf-chat-composer__files .sf-chat-attachment'); const bar = c.querySelector('.sf-chat-attachment--uploading [role=progressbar]'); return chips.length === 3 && c.querySelector('.sf-chat-attachment--ready').getAttribute('aria-label') === 'Файл Договор.pdf, 47 КБ' && c.querySelector('.sf-chat-attachment--ready .sf-chat-attachment__meta').textContent.trim() === '47 КБ' && c.querySelector('.sf-chat-attachment--uploading .sf-chat-attachment__meta').textContent.trim() === 'Загружается, 40%' && bar?.getAttribute('aria-valuenow') === '40' && c.querySelector('.sf-chat-attachment--error .sf-chat-attachment__meta').getAttribute('role') === 'alert' && c.querySelector('.sf-chat-composer__send').disabled && c.querySelector('.sf-chat-composer__attach').disabled && c.querySelector('.sf-chat-composer__box--tall') !== null; })()"
251
+ },
252
+ {
253
+ "user": "click:#files .sf-chat-attachment--ready .sf-chat-attachment__remove",
254
+ "expect": {
255
+ "events": [
256
+ {
257
+ "name": "sf-chat-composer-detach",
258
+ "count": 1,
259
+ "detail": {
260
+ "id": "att_1",
261
+ "name": "Договор.pdf"
262
+ }
263
+ },
264
+ {
265
+ "name": "sf-chat-action",
266
+ "count": 1,
267
+ "detail": {
268
+ "action": "remove-attachment",
269
+ "id": "att_1",
270
+ "name": "Договор.pdf"
271
+ }
272
+ }
273
+ ],
274
+ "journal": [
275
+ {
276
+ "from": "sf-chat-action",
277
+ "to": "sf-chat-composer-detach",
278
+ "since": "2026-10-28",
279
+ "remove_after": "2026-12-01"
280
+ }
281
+ ]
282
+ }
283
+ }
284
+ ]
285
+ },
286
+ {
287
+ "id": "p7-ready-file-sends",
288
+ "title": "a ready file with no text can be sent: submit carries its id",
289
+ "covers": "events.submit attachment-ids",
290
+ "steps": [
291
+ {
292
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#files').files = [{id: 'att_9', localId: 'f9', name: 'Отчёт.pdf', bytes: 1200}], true)",
293
+ "wait": 300,
294
+ "check": "document.querySelector('#files').querySelector('.sf-chat-composer__send').disabled === false"
295
+ },
296
+ {
297
+ "user": "click:#files .sf-chat-composer__send",
298
+ "expect": {
299
+ "events": [
300
+ {
301
+ "name": "sf-chat-composer-submit",
302
+ "count": 1,
303
+ "detail": {
304
+ "text": "",
305
+ "attachment-ids": [
306
+ "att_9"
307
+ ]
308
+ }
309
+ }
310
+ ]
311
+ }
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "id": "p8-clear-focus-disabled",
317
+ "title": "clear empties the field; focus() lands in the field; disabled turns the field and send off",
318
+ "covers": "actions.clear, settings.disabled, focus delegation",
319
+ "steps": [
320
+ {
321
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#plain').value = 'Черновик', true)",
322
+ "wait": 200
323
+ },
324
+ {
325
+ "action": {
326
+ "name": "clear"
327
+ },
328
+ "target": "#plain",
329
+ "wait": 200,
330
+ "expect": {
331
+ "returns": {
332
+ "outcome": "applied"
333
+ }
334
+ },
335
+ "check": "document.querySelector('#plain').value === '' && document.querySelector('#plain .sf-chat-composer__input').value === ''"
336
+ },
337
+ {
338
+ "script": "(document.querySelector('#plain').focus(), true)",
339
+ "wait": 100,
340
+ "check": "document.activeElement === document.querySelector('#plain .sf-chat-composer__input')"
341
+ },
342
+ {
343
+ "script": "(document.querySelector('#plain').value = 'Текст', document.querySelector('#plain').disabled = true, true)",
344
+ "wait": 250,
345
+ "check": "(() => { const c = document.querySelector('#plain'); return c.querySelector('.sf-chat-composer__input').disabled && c.querySelector('.sf-chat-composer__send').disabled && c.querySelector('.sf-chat-composer--disabled') !== null; })()"
346
+ }
347
+ ]
348
+ },
349
+ {
350
+ "id": "p9-queue",
351
+ "title": "queue: while busy a message of text still goes out as sf-chat-composer-submit, by Enter or by «Отправить после ответа» beside «Остановить ожидание», and the hint says it goes after the answer; a message with files waits and the hint says why",
352
+ "covers": "settings.queue, settings.busy, events.submit, runtime.queue-label, runtime.queue-hint-text, runtime.busy-files-text",
353
+ "steps": [
354
+ {
355
+ "script": "(await customElements.whenDefined('sf-chat-composer'), document.querySelector('#plain').busy = true, document.querySelector('#plain').queue = true, document.querySelector('#plain').value = 'Ещё вопрос', document.querySelector('#plain .sf-chat-composer__input').focus(), true)",
356
+ "wait": 250,
357
+ "check": "(() => { const c = document.querySelector('#plain'); const send = c.querySelector('.sf-chat-composer__send'); return !send.hidden && !send.disabled && send.getAttribute('aria-label') === 'Отправить после ответа' && !c.querySelector('.sf-chat-composer__stop').hidden && c.querySelector('.sf-chat-composer__hint').textContent.trim() === 'Enter — отправить после ответа, Shift+Enter — новая строка'; })()"
358
+ },
359
+ {
360
+ "user": "keyboard:Enter",
361
+ "expect": {
362
+ "events": [
363
+ {
364
+ "name": "sf-chat-composer-submit",
365
+ "count": 1,
366
+ "detail": {
367
+ "text": "Ещё вопрос",
368
+ "attachment-ids": []
369
+ }
370
+ }
371
+ ]
372
+ },
373
+ "check": "document.querySelector('#plain').value === 'Ещё вопрос'"
374
+ },
375
+ {
376
+ "script": "(document.querySelector('#plain').value = '', true)",
377
+ "wait": 200,
378
+ "check": "(() => { const c = document.querySelector('#plain'); return c.querySelector('.sf-chat-composer__send').hidden && !c.querySelector('.sf-chat-composer__stop').hidden; })()"
379
+ },
380
+ {
381
+ "script": "(document.querySelector('#files').busy = true, document.querySelector('#files').queue = true, document.querySelector('#files').files = [{id: 'att_1', name: 'Договор.pdf', bytes: 512}], document.querySelector('#files').value = 'С файлом', document.querySelector('#files .sf-chat-composer__input').focus(), true)",
382
+ "wait": 250,
383
+ "check": "document.querySelector('#files .sf-chat-composer__send').hidden"
384
+ },
385
+ {
386
+ "user": "keyboard:Enter",
387
+ "expect": {
388
+ "events": [
389
+ {
390
+ "name": "sf-chat-composer-submit",
391
+ "count": 0
392
+ }
393
+ ]
394
+ },
395
+ "check": "document.querySelector('#files .sf-chat-composer__hint').textContent.trim() === 'Сообщение с файлами можно отправить, когда придёт ответ'"
396
+ }
397
+ ]
398
+ }
399
+ ]
400
+ }