@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 @@
1
+ (()=>{"use strict";var e={e081a020262e(){async function e(e,{document:t=globalThis.document}={}){const s=String(e??""),i=t?.defaultView??globalThis;if(i.isSecureContext&&i.navigator?.clipboard?.writeText)try{return await i.navigator.clipboard.writeText(s),"native"}catch{}if(!t?.body||"function"!=typeof t.execCommand)throw new Error("copy_unsupported");const n=t.createElement("textarea");n.className="sf-clipboard-fallback",n.value=s,n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.style.cssText="position:fixed;inset-inline-start:-9999px;inset-block-start:0;opacity:0",t.body.append(n),n.select(),n.setSelectionRange?.(0,s.length);let a=!1;try{a=t.execCommand("copy")}finally{n.remove()}if(!a)throw new Error("copy_unsupported");return"legacy"}"undefined"!=typeof globalThis&&(globalThis.SF=globalThis.SF||{},globalThis.SF.copyText||(globalThis.SF.copyText=e))},e577837dd70a(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{G0:()=>h,Yq:()=>d,Yz:()=>c});var n=s("15b4e93ff6ed"),a=e([n]),r=a.then?(await a)():a;n=r[0];const o=864e5;function l(e){return"short"===e||"medium"===e||"long"===e||"full"===e}function d(e,{date:t="medium",time:s=null,intl:i=null,gap:a="",...r}={}){const o=(0,n.ay)(e);if(!o)return a;let d=i;return d||(d={},l(t)&&(d.dateStyle=t),l(s)&&(d.timeStyle=s),d.dateStyle||d.timeStyle||(d.dateStyle="medium")),(0,n.Qz)("DateTimeFormat",(0,n.OE)(r),d).format(o)}function c(e,{now:t=new Date}={}){const s=(0,n.ay)(e),i=(0,n.ay)(t);if(!s||!i)return Number.NaN;const a=Date.UTC(s.getFullYear(),s.getMonth(),s.getDate()),r=Date.UTC(i.getFullYear(),i.getMonth(),i.getDate());return Math.round((a-r)/o)}function h(e=new Date){const t=(0,n.ay)(e)??new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1).getTime()-t.getTime()}i()}catch(u){i(u)}})},c016c43b1452(e,t,s){s.a(e,async(e,t)=>{try{var i=s("15b4e93ff6ed"),n=e([i]);i=(n.then?(await n)():n)[0];t()}catch(e){t(e)}})},"15b4e93ff6ed"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{OE:()=>o,Qz:()=>c,ay:()=>l});var n=s("43090d1c8307"),a=e([n]),r=a.then?(await a)():a;n=r[0];function o({locale:e,node:t}={}){return String(e||"").trim()||(0,n.pageLocale)(t)}function l(e){if(null==e||""===e)return null;const t=e instanceof Date?new Date(e.getTime()):new Date("string"==typeof e&&/^\d+$/u.test(e)?Number(e):e);return Number.isNaN(t.getTime())?null:t}function d(){const e="undefined"!=typeof globalThis?globalThis:{};return e.__sfFormat||(e.__sfFormat={formatters:new Map}),e.__sfFormat.formatters}function c(e,t,s){const i=`${e}|${t}|${JSON.stringify(s)}`,n=d();if(n.has(i))return n.get(i);const a=Intl[e];let r;try{r=new a(t||void 0,s)}catch{try{r=new a(void 0,s)}catch{r=new a(t||void 0,"NumberFormat"===e?{maximumFractionDigits:2}:{})}}return n.size>=256&&n.delete(n.keys().next().value),n.set(i,r),r}i()}catch(h){i(h)}})},c9ce0852ac73(e,t,s){s.a(e,async(e,t)=>{try{var i=s("15b4e93ff6ed"),n=e([i]);i=(n.then?(await n)():n)[0],t()}catch(e){t(e)}})},ee5c3aad2640(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{O:()=>l});var n=s("15b4e93ff6ed"),a=s("e577837dd70a"),r=e([n,a]);function o(e,t){const s=Array.from(e)[0]??"";return s?s.toLocaleUpperCase(t||void 0)+e.slice(s.length):e}function l(e,{now:t=new Date,today:s,yesterday:i,tomorrow:r,weekday:l=!0,capital:d=!1,gap:c="",...h}={}){const u=(0,n.ay)(e);if(!u)return c;const p=(0,n.OE)(h),m=(0,a.Yz)(u,{now:t}),f={0:s,[-1]:i,1:r}[m];let b;if(f)b=String(f);else if(m>=-1&&m<=1)b=(0,n.Qz)("RelativeTimeFormat",p,{numeric:"auto"}).format(m,"day");else if(l&&m<-1&&m>-7)b=(0,n.Qz)("DateTimeFormat",p,{weekday:"long"}).format(u);else{const e=u.getFullYear()===(0,n.ay)(t).getFullYear()?{}:{year:"numeric"};b=(0,n.Qz)("DateTimeFormat",p,{day:"numeric",month:"long",...e}).format(u)}return d?o(b,p):b}[n,a]=r.then?(await r)():r;i()}catch(d){i(d)}})},"5b8371b87515"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{G0:()=>a.G0,Ou:()=>r.O,Yq:()=>a.Yq});var n=s("15b4e93ff6ed"),a=s("e577837dd70a"),r=s("ee5c3aad2640"),o=s("c9ce0852ac73"),l=s("c016c43b1452"),d=e([n,a,r,o,l]);[n,a,r,o,l]=d.then?(await d)():d;i()}catch(e){i(e)}})},"20db70d35f32"(){const e=Object.freeze({elements:Object.freeze(["p","br","strong","em","code","pre","ul","ol","li","blockquote","a","table","thead","tbody","tr","th","td","h2","h3","h4","del"]),codeLanguage:!1}),t=new Set(["script","style","iframe","object","embed","svg","math","template","frame","frameset","applet","noscript","noembed","noframes","textarea","select","option","button","input","form","head","title","meta","link","base","img","video","audio","source","track","canvas","picture","xmp","plaintext","portal","slot"]),s=new Set(["http:","https:","mailto:"]),i=new Set(["row","col","rowgroup","colgroup"]),n=/^language-[a-z0-9+#-]{1,24}$/i,a=/[\u0000- \u007f-\u009f]/g;function r(e){if("string"!=typeof e)return null;const t=e.trim().replace(a,"");if(!t)return null;if(t.startsWith("/"))return/^\/[/\\]/.test(t)?null:e.trim();let i;try{i=new URL(t)}catch{return null}return s.has(i.protocol)?i.href:null}function o(e,t,s,i){for(const n of e.childNodes){const e=d(n,s,i);e&&t.append(e)}}function l(e,t,s){const i=t.createDocumentFragment();return o(e,i,t,s),i}function d(e,s,a){if(3===e.nodeType)return s.createTextNode(e.data);if(1!==e.nodeType)return null;const d=e.localName;if(t.has(d)||"http://www.w3.org/1999/xhtml"!==e.namespaceURI)return null;if(!a.allowed.has(d))return l(e,s,a);const c=s.createElement(d);if("a"===d){const t=r(e.getAttribute("href"));if(!t)return l(e,s,a);c.setAttribute("href",t),c.setAttribute("rel","noopener noreferrer nofollow"),c.setAttribute("target","_blank")}if("th"===d||"td"===d){for(const t of["colspan","rowspan"]){const s=e.getAttribute(t);if(null!==s&&/^\d{1,2}$/.test(s.trim())){const e=Number(s);e>=1&&e<=50&&c.setAttribute(t,String(e))}}const t=e.getAttribute("scope")?.trim().toLowerCase();t&&i.has(t)&&c.setAttribute("scope",t)}if("code"===d&&a.codeLanguage){const t=[...e.classList].find(e=>n.test(e));t&&(c.className=t)}return o(e,c,s,a),c}"undefined"!=typeof globalThis&&(globalThis.SF=globalThis.SF||{},globalThis.SF.sanitizeHtml||(globalThis.SF.sanitizeHtml=function(s,i={}){const n=i.document??globalThis.document,a={allowed:new Set((i.elements??e.elements).map(e=>String(e).toLowerCase())),codeLanguage:i.codeLanguage??e.codeLanguage};for(const e of t)a.allowed.delete(e);const r=n.createDocumentFragment();if("string"!=typeof s||""===s)return r;const l=n.createElement("template");return l.innerHTML=s,o(l.content,r,n,a),r}),globalThis.SF.safeHref||(globalThis.SF.safeHref=r))},"09772fbfb8c4"(e,t,s){s.a(e,async(e,t)=>{try{var i=s("2a080a730149"),n=e([i]);i=(n.then?(await n)():n)[0];t()}catch(e){t(e)}})},b085757b11ac(){new Set(["number","integer"]);new Set(["draft","ready","saved"])},"166eba132218"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{Ih:()=>g,Qq:()=>u,gb:()=>f,r6:()=>w,uX:()=>b,yI:()=>p,z3:()=>c});var n=s("2a080a730149"),a=(s("20db70d35f32"),s("5b8371b87515")),r=(s("e081a020262e"),s("09772fbfb8c4")),o=s("32c771fdb2d2"),l=(s("b085757b11ac"),s("5129d0e4a162")),d=e([n,a,r,l]);[n,a,r,l]=d.then?(await d)():d;function c(e,t,s="ru"){const i=Number(e)||0,n=e=>new Intl.NumberFormat(s,{maximumFractionDigits:e<10?1:0}).format(e);return i<1024?t("size.b",{n:i}):i<1048576?t("size.kb",{n:n(i/1024)}):i<1024**3?t("size.mb",{n:n(i/1024/1024)}):t("size.gb",{n:n(i/1024**3)})}new Set(["queued","running"]);function h(e,t,s,i={}){const n=e.document.createElement(t);s&&(n.className=s);for(const[e,t]of Object.entries(i))!1!==t&&null!=t&&n.setAttribute(e,!0===t?"":String(t));return n}function u(e,t,s,i,n){const a=h(e,t,s,n);return a.textContent=i??"",a}function p(e,t,s="",i=""){const n=e.icon(t,{size:i});return s&&n.classList&&n.classList.add(...s.split(" ")),n.setAttribute?.("aria-hidden","true"),n}const m={"1/3":"1","1/2":"1",1:"2",2:"2",3:"3"};function f(e,{icon:t,label:s,appearance:i="link",scheme:n="on-surface",size:a="1/2",pressed:r,className:o=""}){const l=h(e,"button",["sf-icon-button",`sf-icon-button--size-${a}`,"sf-icon-button--icon",`sf-icon-button--${i}`,`sf-icon-button--${n}`,"flex","items-cross-center","content-main-center",o].filter(Boolean).join(" "),{type:"button","aria-label":s,title:s,"aria-pressed":void 0===r?null:String(r)});return r&&l.classList.add("active"),l.append(p(e,t,"",m[a]||"1")),l}function b(e,{label:t,appearance:s="default",scheme:i="primary",size:n="1/2",icon:a,className:r=""}){const o=h(e,"button",["sf-button",`sf-button--size-${n}`,`sf-button--${s}`,`sf-button--${i}`,"flex","items-cross-center","content-main-center",r].filter(Boolean).join(" "),{type:"button"});return a&&o.append(p(e,a,"","1")),o.append(u(e,"span","sf-button-text-container",t)),o}function g(e){return"queued"===e.status?"stage.queued":`stage.${e.stage||"searching"}`}function w(e,t){const s=(0,o.B_)(t);if(!s.length)return"";const i=s.findLast(e=>"failed"===e.state);if(i)return e.words("steps.sayFailed",{label:i.label});const n=s.findLast(e=>"running"===e.state),a=n?s.indexOf(n):s.length-1;return e.words("steps.say",{n:a+1,label:s[a].label})}i()}catch(y){i(y)}})},"32c771fdb2d2"(e,t,s){s.d(t,{B_:()=>o,sI:()=>l,ug:()=>r});const i=["running","done","failed"],n=e=>"string"==typeof e?e.trim():"";function a(e){if(null==e||""===e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function r(e,t=globalThis.document){if("string"!=typeof e)return null;const s=e.trim();if(!s||/[\u0000-\u001f\u007f]/u.test(s))return null;if(s.startsWith("/")&&/^\/[/\\]/u.test(s))return null;const i=t?.baseURI||t?.defaultView?.location?.href,n=t?.defaultView?.location?.origin;if(!i||!n||"null"===n)return null;let a;try{a=new URL(s,i)}catch{return null}return"http:"!==a.protocol&&"https:"!==a.protocol||a.origin!==n?null:s.startsWith("/")?s:a.href}function o(e){return(Array.isArray(e?.steps)?e.steps:[]).filter(e=>e&&"object"==typeof e&&n(e.label)).map((e,t)=>({code:n(e.code)||String(t),label:n(e.label),state:i.includes(e.state)?e.state:"done",started:a(e.started_at),finished:a(e.finished_at)}))}function l(e,{n:t=null,kind:s="",title:i="",href:a=null}={},o){const l=function(e,t){if(!e||"object"!=typeof e)return null;const s=r(e.preview_url,t);if(!s)return null;const i=e.locator&&"object"==typeof e.locator?e.locator:{},a={};return Number.isInteger(i.from)&&Number.isInteger(i.to)&&i.from>=0&&i.to>i.from&&Object.assign(a,{from:i.from,to:i.to}),Number.isInteger(i.page)&&i.page>0&&(a.page=i.page),{url:s,locator:Object.keys(a).length?a:null,mime:n(e.mime).toLowerCase()}}(e,o);return l?{...null==t?{}:{n:t},title:n(i)||n(e.title)||n(e.name),kind:s||n(e.kind),preview_url:l.url,locator:l.locator,mime:l.mime,...a?{href:a}:{}}:null}s.d(t,["Xt",0,["steps"]])},"5129d0e4a162"(e,t,s){s.a(e,async(e,t)=>{try{var i=s("166eba132218"),n=s("18003344cff0"),a=e([i,n]);[i,n]=a.then?(await a)():a;t()}catch(e){t(e)}})},f29bbdec6622(e,t,s){s.a(e,async(e,t)=>{try{var i=s("deb1a4d61565"),n=s("5b7d7695b41b"),a=s("43090d1c8307"),r=s("5b8371b87515"),o=s("ee12251d3680"),l=s("166eba132218"),d=s("32c771fdb2d2"),c=s("2932d43488ae"),h=s("60fe8377ff22"),u=s("240f6601a5f5"),p=s("5d717d8e5251"),m=s("443dc90eea33"),f=s("7fe52c31ba51"),b=s("b224ca2a61ea"),g=s("7e61c13e3a99"),w=s("d90b68919aff"),y=s("c8da50be6e6c"),v=s("e409dce80db2"),_=s("0b171a02b2d0"),k=e([i,n,a,r,o,l,c,h,u,m,b]);[i,n,a,r,o,l,c,h,u,m,b]=k.then?(await k)():k;var S=s.n(i);const x=new Set(["queued","running"]),q=new Set(["stopped","delayed","network"]),E=new Set(["session-expired","capability-not-provided","superseded","prevented"]),A=e=>String(e).replace(/[._]/gu,"-").replace(/[A-Z]/gu,e=>`-${e.toLowerCase()}`),N=Object.fromEntries([...g.vN,...g.vq].map(e=>[e,e.replace(/_/gu,"-")])),C=e=>e.replace(/[-_]([a-z])/gu,(e,t)=>t.toUpperCase());let T=0,L=0,F=0;function D(){if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID();const e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=[...e].map(e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}const O=new Set(["draft","sources_open","steps_open","fold_open","brief_draft","body"]),M=e=>JSON.stringify(e??null,(e,t)=>O.has(e)?void 0:t),R=".sf-chat-person__edit, .sf-chat-tools__more",j=".sf-chat-person__delete, .sf-chat-tools__more",P=2e3,B=300,I=new Set(["completed","partial"]),$={failed:"failed",limit:"limit",refused:"refused",withheld:"refused",stopped:"stopped",unfinished:"unfinished",unsent:"unsent",left:"left"},z=".sf-chat-message__bubble, .sf-chat-message__body, .sf-chat-person__bubble",K='button, sup, time, [hidden], [aria-hidden="true"], [aria-busy="true"], .sf-chat-offscreen, .sr-only, .sf-chat-sources, fieldset, .sf-chat-person__bubble--tomb',V="p, li, div, pre, td, th, h1, h2, h3, h4, h5, h6, blockquote",Q="sf-chat-window-found",W="sf-chat-window-found-current",H=["sf-list-feed","sf-chat-message","sf-chat-composer","sf-chat-interlocutor"];function U(e,{people:t=!1,edit:s=!1,remove:i=!1,acting:n=null,reactions:a=!1,reply:r=!1}={}){const o=t&&"person"!==(0,b.d5)(e),l="assistant"===e.kind||o;if(t&&!l)return(0,b.Sm)(e,{edit:s,remove:i,acting:n,reactions:a,reply:r});const c={id:(0,b.TN)(e),role:l?"assistant":"user",author:l?"assistant":"user",own:!l,growing:l&&x.has(e.status),text:e.body??"",attachments:(e.files||[]).map(e=>({id:e.id??e.key,name:e.name,bytes:e.size??void 0,...e.download_url?{href:e.download_url}:{},...e.mime?{mime:e.mime}:{},...e.preview_url?{preview_url:e.preview_url}:{}}))};if(e.created_at&&(c.created_at=e.created_at),!l)return c;const h=e.verification;if(o){const t=!0===e.is_deleted;Object.assign(c,{speaker:{kind:(0,b.d5)(e),name:e.author?.name??""},canDelete:i&&null!=e.id&&!t&&!0===e.can_delete,is_deleted:t,...e.asked_by?{asked_by:e.asked_by}:{},...a&&!t&&Array.isArray(e.reactions)?{reactions:e.reactions}:{},...r&&!t&&e.reply_to?{reply_to:e.reply_to}:{}})}return Object.assign(c,{status:e.status??(o?"completed":e.status),stage:e.stage??null,html:e.html??null,sources:e.sources||[],verification:"string"==typeof h?h:h?.state??null,notices:(e.notices||[]).map(e=>"string"==typeof e?e:e?.text).filter(Boolean),proposal:e.proposal??null,finished_at:e.finished_at??null,...void 0!==e.feedback?{feedback:e.feedback}:{},...void 0!==e.summary?{summary:e.summary}:{},...void 0!==e.limit_resets_at?{limit_resets_at:e.limit_resets_at}:{},...e.brief?{brief:e.brief}:{},...Object.fromEntries(d.Xt.filter(t=>void 0!==e[t]).map(t=>[t,e[t]]))})}function X(){const e={},t=new Set([...Object.values(g.CY),...Object.values(g.O1)].map(e=>e.former).filter(Boolean));for(const s of t)e[s]=e=>e&&(0,g.TV)(e)===s?{request_id:e.requestId,...e.payload||{}}:void 0;return e["sf-chat-window-answer"]=e=>e?{request_id:e.requestId,intent:e.intent,payload:e.payload,answer:e.answer,reason:e.reason??null}:void 0,e}const Y=()=>({outcome:"applied"}),J=(0,n.elementFromManifest)(w,{base:S(),lang:{en:v,ru:_},source:"ru",aliases:y,positional:["open-conversation","set-list-footer","open-preview"],actions:{"set-data"({data:e}){return this.applyData(e),Y()},settle({requestId:e,"request-id":t,result:s}){return this.answer(e??t,s)?Y():{outcome:"refused",reason:"unknown-request"}},"start-conversation"(){return this.startConversation().then(Y)},"open-conversation"({id:e}){return this.openConversation(e).then(Y)},"focus-composer"(){return this.focusComposer(),Y()},"open-files"(){return this.has("x-my-files")?this.openFiles().then(Y):{outcome:"refused",reason:"capability-not-provided"}},"close-files"({focus:e}){return this.closeFiles({focus:!1!==e}),Y()},"set-list-footer"({node:e}){return this.setListFooter(e),Y()},"open-find"({query:e}={}){return this.openFind({query:e}),Y()},"close-find"({focus:e}={}){return this.closeFind({focus:!1!==e}),Y()},"open-preview"({source:e}={}){return this.openPreview(e)?Y():{outcome:"refused",reason:"not-shown"}},"close-preview"({focus:e}={}){return this.closePreview({focus:!1!==e}),Y()},"open-start"({kind:e}={}){return this.has("x-conversation-start")?(this.openStart({kind:e}),Y()):{outcome:"refused",reason:"capability-not-provided"}},"close-start"({focus:e}={}){return this.closeStart({focus:!1!==e}),Y()},"open-members"(){return this.has("x-members")?this.openMembers()?Y():{outcome:"refused",reason:"no-members"}:{outcome:"refused",reason:"capability-not-provided"}},"close-members"({focus:e}={}){return this.closeMembers({focus:!1!==e}),Y()}}});class G extends J{constructor(){super(),this._data={me:null,conversations:[],conversation:null,messages:[],history:{has_older:!1},feed_state:"ready",limits:{},interlocutors:[],notice:null,conversation_list:{archived:!1,has_more:!1,loading:!1},composer_files:[],my_files:null},this._root=null,this._requests=new Map,this._drafts=new Map,this._retried=new Set,this._ratings=new Map,this._sourcesOpen=new Set,this._stepsOpen=new Map,this._preview=null,this._pressed=null,this._searchTimer=null,this._searchStatus=!1,this._repeats=new Set,this._shown=new Map,this._drawn=new Map,this._features={feedback:!0,proposals:!0,memory:!0,brief:!1},this._briefDrafts=new Map,this._partsReady=!1,this._threadsReady=!1,this._held=new Set,this._footer=null,this._files=null,this._start=null,this._members=null,this._pairNames=new Map,this._interlocutor=null,this._sending=0,this._navigating=0,this._started=!1,this._afterMessages=0,this._queues=new Map,this._busy=!1,this._sendFailed=!1,this._find={open:!1,ranges:[],at:-1,opener:null,timer:null,said:""},this._editing=new Map,this._asking=new Map,this._acting=new Map,this._runs=null,this._unread=null,this._read={conversation:null,id:null,timer:0},this._readAt=0,this._mode=void 0,this._reacting=new Map,this._picking=null,this._foldOpen=new Map,this._replies=new Map,this._replyStrip=null;for(const e of["capabilities",...Object.keys(N),...Object.values(N).map(C)]){if(!Object.prototype.hasOwnProperty.call(this,e))continue;const t=this[e];delete this[e],this[e]=t}}get offered(){const e=String(this.getAttribute("capabilities")||"").split(/\s+/u).filter(Boolean),t=this.sfPort?.capabilities;return new Set([...e,...Array.isArray(t)?t:[]])}get capabilities(){return this.getAttribute("capabilities")||""}set capabilities(e){const t="string"==typeof e?e.split(/\s+/u):[...e||[]];this.setAttribute("capabilities",t.filter(Boolean).join(" "))}has(e){return this.offered.has(e)}attributeChangedCallback(e,t,s){super.attributeChangedCallback?.(e,t,s),"no-queue"!==e||t===s?"capabilities"===e&&t!==s&&(this._started?this.sync(new Set(["capabilities"])):this.syncFooter()):this._partsReady&&(this.parts.composer.queue=!this.noQueue)}onPortConnected(e){if(!e||"function"!=typeof e.raise)throw new TypeError("sf-chat-window: the port has no raise(intent, payload)");if(e.version&&!g.vs.includes(String(e.version)))throw new TypeError(`sf-chat-window takes simai.chat-port ${g.vs.join(", ")}`);this._started?this.sync(new Set(["capabilities"])):this.syncFooter()}applyData(e={}){const t=new Set;if(!e||"object"!=typeof e)return this;for(const s of[...g.vN,...g.vq]){const i=[s,N[s],C(N[s])].find(t=>Object.prototype.hasOwnProperty.call(e,t));void 0!==i&&(this._data[s]=e[i],t.add(s))}return t.size&&this.sync(t),this}answer(e,t){const s=this._requests.get(e);if(!s)return!1;if(!t||!g.I3.includes(t.answer))throw new TypeError("sf-chat-window: the host answer is not one of the port answers");return this._requests.delete(e),this.finish(e,s,t),!0}finish(e,t,s){"applied"===s.answer&&s.data&&"object"==typeof s.data&&"conversation.start"!==t.intent&&this.applyData(s.data),this.sfEmit("settled",{requestId:e,"request-id":e,intent:t.intent,payload:t.payload,answer:s.answer,reason:s.reason??null}),t.resolve(s)}setListFooter(e){this._footer=e||null,this.syncFooter()}syncFooter(){if(!this._threadsReady)return;const{threads:e}=this.parts,t=[this.has("x-my-files")?this._files.entry:null,this._footer].filter(Boolean);t.length?e.setSlot("footer",...t):e.clearSlot("footer")}focusComposer(e){this.closeViews(),this.parts.composer.focus(e)}async startConversation(){this.closeViews(),this.closePreview({focus:!1}),this._data.conversation_list?.archived&&this.showList(!1),this._navigating++;const e=await this.request("conversation.create",{interlocutor:this.interlocutorId});this._navigating--,"applied"===e.answer?this.focusComposer():this.showResult(e)}async openConversation(e){this.closeViews(),this.closePreview({focus:!1}),this.notify(""),this._navigating++;const t=await this.request("conversation.open",{conversation_id:e});this._navigating--,this.showResult(t,()=>this.openConversation(e))}request(e,t={}){const s=g.CY[e]||g.O1[e];if(!s)throw new Error(`sf-chat-window: unknown intent ${e}`);if(s.capability&&!this.has(s.capability))return Promise.resolve({answer:"unavailable",reason:"capability-not-provided"});const i="chat-window-"+ ++T,n=(0,g.pP)(e,t),a={requestId:i,"request-id":i,intent:e,...n?{kind:n}:{},payload:t},r=this.sfPort;return new Promise(s=>{const n={intent:e,payload:t,resolve:s};r||this._requests.set(i,n);if(!this.sfEmit((0,g.rl)(e,t),a,{cancelable:!0}))return this._requests.delete(i),void s({answer:"refused",reason:"prevented"});r&&Promise.resolve().then(()=>r.raise(e,t)).then(e=>e&&g.I3.includes(e.answer)?e:{answer:"unavailable",reason:"port-answer"},e=>({answer:"unavailable",reason:"AbortError"===e?.name?"superseded":"port-failed"})).then(e=>this.finish(i,n,e))})}showResult(e,t){e&&"applied"!==e.answer&&(E.has(e.reason)||this.showInlineError(e.text||e.reason||this.words("error.load"),t))}get ctx(){if(!this._ctx){const e=this.ownerDocument,t=this;this._ctx={document:e,get locale(){return(0,a.pageLocale)(t)},words:(e,t={})=>this.sfWord(A(e),null==t.count?{vars:t}:{vars:t,count:t.count}),icon(t,{size:s=""}={}){const i=e.createElement("sf-icon");return i.setAttribute("icon",t),s&&i.setAttribute("size",s),i.setAttribute("aria-hidden","true"),i}}}return this._ctx}get words(){return this.ctx.words}get parts(){return this.root,this._parts}get root(){return this._root||(this._root=this.build()),this._root}templateContext(){return{component:this,node:this.root}}template(){return(0,o.r)(this.templateContext())}build(){const e=this.ownerDocument,t=this.words,s=(t,s,i={})=>{const n=e.createElement(t);s&&(n.className=s);for(const[e,t]of Object.entries(i))n.setAttribute(e,t);return n};(0,f.E)({ru:_,en:v}),this._headingTag=2===Number(this.getAttribute("heading-level"))?"h2":"h1",this._files=new c.L(this),this._start=new u.E(this,D),this._members=new h.X(this),this._preview=new m.Iw(this);const i=s("div","chat-shell sf-chat-surface sf-workspace sf-workspace--wide-h8",{"data-sf-workspace-view":"main"});this.hasAttribute("embedded")&&"false"!==this.getAttribute("embedded")&&i.classList.add("chat-shell--embedded");const n=s("aside","chat-shell__side sf-workspace-list",{id:"chat-side"}),a=s("div","chat-shell__side-head"),r=s("sf-chat-threads"),o=this.buildSearch(s,t);n.append(a,o.box,r);const d=s("section"===this.getAttribute("landmark")?"section":"main","chat-shell__main sf-workspace-main"),p=s(this._headingTag,"sf-chat-offscreen chat-shell__page-title"),b=s("header","chat-shell__header"),g=s("sf-chat-interlocutor"),w=s("span","chat-shell__thread-title"),y=s("div","chat-shell__spacer"),k=this._start.build(this._headingTag),S=this._members.build(this._headingTag),x=s("span","chat-shell__head-mark");x.hidden=!0;const q=s("span","chat-shell__thread-sub");q.hidden=!0;const E=s("span","chat-shell__head-who");E.append(w,q);const A=(0,l.gb)(this.ctx,{icon:"arrow_back",label:t("threads.back"),size:"1",className:"sf-workspace-back chat-shell__back"});b.append(A,g,x,E,y,S.command);const N=this.buildFind(s,t),C=s("div","chat-shell__thread-bar");C.hidden=!0;const T=(0,l.uX)(this.ctx,{label:t("thread.back"),appearance:"link",scheme:"primary",icon:"arrow_back",className:"chat-shell__thread-back"}),L=s("blockquote","chat-shell__thread-root");C.append(T,L);const F=s("sf-list-feed","chat-shell__list"),O=this._files.build(this._headingTag),M=this._preview.build(this._headingTag),R=s("div","chat-shell__composer",{id:"chat-composer",tabindex:"-1"}),j=s("sf-chat-composer"),P=s("div","chat-shell__status",{role:"status","aria-live":"polite"}),B=s("div","chat-shell__status chat-shell__status--standing");B.hidden=!0;const I=s("ul","sf-chat-greeting__suggestions chat-shell__suggestions",{"aria-label":t("empty.suggestions")});I.hidden=!0;const $=s("div","chat-shell__queue");$.hidden=!0;const z=s("p","chat-shell__queue-held"),K=s("ul","chat-shell__queue-list",{"aria-label":t("queue.label")}),V=s("span","sf-chat-offscreen",{role:"status","aria-live":"polite"});return $.append(z,K,V),R.append(B,P,$,j,I),d.append(p,b,N.box,C,F,O.root,k.root,S.root,R),i.append(n,d,M.root),this._parts={shell:i,side:n,sideHead:a,main:d,header:b,back:A,threads:r,list:F,composer:j,composerBox:R,interlocutor:g,pageTitle:p,threadTitle:w,headMark:x,threadSub:q,statusLine:P,archivedNote:B,suggestions:I,search:o.box,searchInput:o.input,searchStatus:o.status,find:N.box,findInput:N.input,findCount:N.count,findStatus:N.status,findPrevious:N.previous,findNext:N.next,queue:$,queueHeld:z,queueList:K,queueSaid:V,threadBar:C,threadBack:T,threadRoot:L,preview:M.root},this.wire(),Promise.all(H.map(e=>customElements.whenDefined(e))).then(()=>this.partsDefined()),i}buildSearch(e,t){const s=e("div","chat-shell__search",{role:"search","aria-label":t("threads.search")});s.hidden=!0;const i=e("label","sf-input sf-input--size-1 sf-input--filled flex flex-col chat-shell__search-field"),n=e("span","sf-chat-offscreen");n.textContent=t("threads.search");const a=e("span","sf-input-field items-cross-center transition flex"),r=e("span","sf-input-left flex");r.append(this.ctx.icon("search",{size:"1"}));const o=e("input","chat-shell__search-input",{type:"search",maxlength:"100",autocomplete:"off",enterkeyhint:"search",placeholder:t("threads.searchPlaceholder")});a.append(r,o),i.append(n,a);const l=e("span","sf-chat-offscreen",{role:"status","aria-live":"polite"});return s.append(i,l),o.addEventListener("input",()=>{clearTimeout(this._searchTimer),this._searchTimer=setTimeout(()=>this.search(o.value),B)}),o.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),clearTimeout(this._searchTimer),this.search(o.value)),"Escape"===e.key&&o.value&&(e.preventDefault(),e.stopPropagation(),o.value="",clearTimeout(this._searchTimer),this.search(""))}),{box:s,input:o,status:l}}async search(e){const t=String(e??"").trim();if(t===String(this._data.conversation_list?.query??"")&&!this._searchFailed)return;const s=await this.request("conversations.search",{query:t});if(this._searchFailed="applied"!==s.answer&&"superseded"!==s.reason,"applied"!==s.answer)return void this.showResult(s,()=>this.search(this.parts.searchInput.value));if(t!==this.parts.searchInput.value.trim())return;const i=(this._data.conversations||[]).length;this.parts.searchStatus.textContent=t?i?this.words("threads.found",{count:i}):this.words("threads.searchEmpty",{query:t}):""}buildFind(e,t){const s=e("div","chat-shell__find",{role:"search","aria-label":t("find.label")});s.hidden=!0;const i=e("label","sf-input sf-input--size-1 sf-input--filled flex flex-col chat-shell__find-field"),n=e("span","sf-chat-offscreen");n.textContent=t("find.label");const a=e("span","sf-input-field items-cross-center transition flex"),r=e("span","sf-input-left flex");r.append(this.ctx.icon("search",{size:"1"}));const o=e("input","chat-shell__find-input",{type:"search",maxlength:"100",autocomplete:"off",enterkeyhint:"search",placeholder:t("find.placeholder")}),d=e("span","chat-shell__find-count",{"aria-hidden":"true"});a.append(r,o,d),i.append(n,a);const c=(0,l.gb)(this.ctx,{icon:"keyboard_arrow_up",label:t("find.previous"),size:"1",className:"chat-shell__find-previous"}),h=(0,l.gb)(this.ctx,{icon:"keyboard_arrow_down",label:t("find.next"),size:"1",className:"chat-shell__find-next"}),u=(0,l.gb)(this.ctx,{icon:"close",label:t("find.close"),size:"1",className:"chat-shell__find-close"}),p=e("span","sf-chat-offscreen",{role:"status","aria-live":"polite"});return s.append(i,c,h,u,p),o.addEventListener("input",()=>this.find({say:"later"})),c.addEventListener("click",()=>this.moveFind(-1)),h.addEventListener("click",()=>this.moveFind(1)),u.addEventListener("click",()=>this.closeFind()),s.addEventListener("keydown",e=>{"Enter"===e.key&&e.target===o&&(e.preventDefault(),this.moveFind(e.shiftKey?1:-1)),"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),o.value?(o.value="",o.focus(),this.find({say:"now"})):this.closeFind())}),{box:s,input:o,count:d,status:p,previous:c,next:h}}openFind({query:e}={}){const{find:t,findInput:s}=this.parts,i=this._find;if(!i.open){this.closeViews();const e=this.ownerDocument.activeElement;i.open=!0,i.opener=e&&e!==this.ownerDocument.body?e:null,t.hidden=!1,this.sfHostState("data-find-open",!0),this.sfEmit("toggle",{kind:"find",open:!0})}null!=e&&(s.value=String(e)),s.focus(),s.select(),this.find({say:"now"})}closeFind({focus:e=!0}={}){const t=this._find;if(!t.open)return;const{find:s,findInput:i,composer:n}=this.parts,a=s.contains(this.ownerDocument.activeElement);t.open=!1,clearTimeout(t.timer),i.value="",this.find(),s.hidden=!0,this.sfHostState("data-find-open",!1),this.sfEmit("toggle",{kind:"find",open:!1});const r=t.opener;t.opener=null,(e||a)&&(r?.isConnected&&null!==r.offsetParent&&!s.contains(r)?r:n).focus({preventScroll:!0})}find({keep:e=!1,say:t=""}={}){const s=this._find,{findInput:i,findCount:n,findStatus:a,findPrevious:r,findNext:o}=this.parts,l=s.open?i.value.trim().toLowerCase():"",d=e?this.placeOf(s.ranges,s.at):null;s.ranges=l?this.rangesOf(l):[];const c=s.ranges.length,h=d?s.ranges.findIndex((e,t)=>{const i=this.placeOf(s.ranges,t);return i?.id===d.id&&i.nth===d.nth}):-1;if(s.at=-1===h?c-1:h,r.disabled=0===c,o.disabled=0===c,n.textContent=l?c?this.words("find.count",{index:s.at+1,count:c}):this.words("find.none"):"",this.markFound({scroll:!e}),clearTimeout(s.timer),!l)return a.textContent="",void(s.said="");"now"===t?this.sayFound():"later"===t&&(s.timer=setTimeout(()=>this.sayFound(),B))}placeOf(e,t){const s=e=>e?.startContainer.parentElement?.closest("[data-id]")?.dataset.id??null,i=s(e[t]);if(null===i)return null;let n=0;for(let a=t-1;a>=0&&s(e[a])===i;a--)n++;return{id:i,nth:n}}sayFound(){const e=this._find,t=this.parts.findCount.textContent;e.open&&t!==e.said&&(e.said=t,this.parts.findStatus.textContent=t)}moveFind(e){const t=this._find,s=t.ranges.length;s&&(t.at=(t.at+e+s)%s,this.parts.findCount.textContent=this.words("find.count",{index:t.at+1,count:s}),this.markFound({scroll:!0}),this.sayFound())}rangesOf(e){const t=[],s=this.ownerDocument;for(const i of this.parts.list.querySelectorAll(z)){if(i.parentElement?.closest(z))continue;const n=s.createTreeWalker(i,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.parentElement?.closest(K)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),a=[];let r="",o=null;for(let e=n.nextNode();e;e=n.nextNode()){const t=e.parentElement?.closest(V);a.length&&t!==o&&(r+="\n"),o=t,a.push({node:e,at:r.length}),r+=e.data}const l=r.toLowerCase();if(l.length!==r.length)continue;const d=e=>{let t=a[0];for(const s of a){if(s.at>e)break;t=s}return[t.node,Math.min(e-t.at,t.node.data.length)]};for(let i=l.indexOf(e);-1!==i;i=l.indexOf(e,i+e.length)){const n=s.createRange();n.setStart(...d(i)),n.setEnd(...d(i+e.length)),t.push(n)}}return t}markFound({scroll:e=!1}={}){const t=this._find,s=t.ranges[t.at]??null,i=globalThis.CSS?.highlights;i&&"function"==typeof Highlight&&(t.ranges.length?(t.all=new Highlight(...t.ranges),t.current=new Highlight(...s?[s]:[]),i.set(Q,t.all),i.set(W,t.current)):(t.all&&i.get(Q)===t.all&&i.delete(Q),t.current&&i.get(W)===t.current&&i.delete(W),t.all=null,t.current=null));const n=s?.startContainer.parentElement?.closest(".sf-chat-message, .sf-chat-person")??null;for(const e of this.parts.list.querySelectorAll(".chat-shell__found"))e!==n&&e.classList.remove("chat-shell__found");n?.classList.add("chat-shell__found"),e&&s&&this.bringIntoView(s)}bringIntoView(e){const t=this.parts.list.scroller,s=e.getBoundingClientRect();if(!t||!s.height)return;const i=t.getBoundingClientRect();s.top>=i.top&&s.bottom<=i.bottom||(t.scrollTop+=s.top-i.top-(i.height-s.height)/2)}partsDefined(){const{list:e,composer:t,interlocutor:s}=this._parts;for(const i of[e,t,s])customElements.upgrade(i);t.queue=!this.noQueue,e.renderItem=(e,t)=>this.drawMessage(e,t),e.announceItem=(e,t)=>this.sayOf(e,t),(0,f.E)({ru:_,en:v}),this._partsReady=!0,customElements.whenDefined("sf-chat-threads").then(()=>this.threadsDefined());const i=this._held;this._held=new Set,this.sync(new Set([...i,"interlocutors","limits","conversations","conversation_list","composer_files"]))}threadsDefined(){customElements.upgrade(this._parts.threads),this._threadsReady=!0,this.syncFooter(),this.syncThreads(),this.syncSelected()}wire(){const{shell:e,threads:t,list:s,composer:i,interlocutor:n}=this._parts;e.addEventListener("keydown",e=>{!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey||"KeyF"!==e.code&&"f"!==e.key?.toLowerCase()||this._data.conversation&&!this.covered&&(e.preventDefault(),this.openFind())}),e.addEventListener("sf-workspace-panel",t=>{t.target!==e||t.detail?.open||this._preview?.open&&this.closePreview()}),t.addEventListener("sf-chat-threads-create",e=>{const s=e.detail?.kind;s?this.openStart({kind:s,opener:t.querySelector(`.sf-thread-list__command[data-action="create:${CSS.escape(s)}"]`)}):this.startConversation()}),t.addEventListener("sf-chat-threads-open",e=>this.openConversation(e.detail.id)),t.addEventListener("sf-chat-threads-rename",async e=>{const t=await this.request("conversation.rename",{conversation_id:e.detail.id,title:e.detail.title});"applied"!==t.answer&&this.syncThreads(),this.showResult(t)}),t.addEventListener("sf-chat-threads-archive",e=>this.archive(e.detail.id,!0)),t.addEventListener("click",e=>{const t=e.target.closest?.(".sf-list__actions");t&&this.rowActions(t.closest(".sf-list__row")?.dataset.id)},!0),t.addEventListener("keydown",e=>{("F10"===e.key&&e.shiftKey||"ContextMenu"===e.key)&&this.rowActions(e.target.closest?.(".sf-list__row")?.dataset.id)},!0),t.addEventListener("sf-chat-threads-apply",e=>{const{id:t,action:s}=e.detail;"pin"!==s&&"unpin"!==s||this.pin(t,"pin"===s)}),t.addEventListener("sf-chat-threads-restore",e=>this.archive(e.detail.id,!1)),t.addEventListener("sf-chat-threads-toggle",e=>this.showList(e.detail.archived)),t.addEventListener("sf-chat-threads-load-more",()=>this.more()),n.addEventListener("sf-chat-interlocutor-select",e=>this.choose(e.detail.id)),s.addEventListener("sf-list-feed-load-more",e=>this.older(e.detail.before)),s.addEventListener("sf-confirm-change-answer",e=>{this.decide(e.detail.id,e.detail.accepted?"confirm":"cancel")||e.preventDefault()}),s.addEventListener("sf-chat-message-check",e=>{this.request("wait.check",{message_id:e.detail.id}).then(e=>this.showResult(e))}),s.addEventListener("sf-chat-message-rate",e=>{const{id:t,value:s}=e.detail;Object.prototype.hasOwnProperty.call(e.detail,"reason")||Object.prototype.hasOwnProperty.call(e.detail,"note")?this.rateWhy(t,e.detail.reason??null,e.detail.note??""):this.rate(t,s)}),s.addEventListener("sf-chat-message-cancel",e=>{"rate"===e.detail.kind&&this.rateWhy(e.detail.id,null,"",{skip:!0})}),s.addEventListener("sf-chat-message-retry",e=>{const{id:t,key:s,kind:i}=e.detail;void 0!==i||void 0!==t||null==s?"file"===i?this.request("file.retry",{conversation_id:this._data.conversation?.id??null,message_id:t,file_key:s}).then(e=>this.showResult(e)):null!=t&&this.askAgain(t):this.retryLocal(s)}),s.addEventListener("sf-chat-message-submit",e=>{"block"===e.detail.kind?this.submitBlock(e.detail):this.answerBrief(e.detail.id,e.detail.text)}),s.addEventListener("sf-chat-message-save",e=>this.saveEdit(e.detail.id,e.detail.values?.body)),s.addEventListener("sf-chat-message-delete",e=>this.deleteMessage(e.detail.ids?.[0])),s.addEventListener("scroll",()=>this.maybeRead(),!0),s.addEventListener("sf-chat-message-react",e=>this.react(e.detail.id,e.detail.emoji,e.detail.on)),s.addEventListener("sf-chat-message-reply",e=>this.startReply(e.detail.id)),this._parts.threadBack.addEventListener("click",()=>this.backToChat()),s.addEventListener("sf-chat-message-stop",()=>{this.request("wait.stop",{conversation_id:this._data.conversation?.id??null}).then(e=>this.showResult(e))}),s.addEventListener("sf-chat-message-toggle",e=>{if("react"===e.detail.kind)return void this.togglePicker(e.detail.id,Boolean(e.detail.open),{quiet:Boolean(e.detail.quiet)});if("fold"===e.detail.kind)return void this._foldOpen.set(String(e.detail.id),Boolean(e.detail.open));if("edit"===e.detail.kind||"delete"===e.detail.kind)return void this.peopleToggle(e.detail.id,e.detail.kind,Boolean(e.detail.open));const t=String(e.detail.id);"steps"===e.detail.kind&&this._stepsOpen.set(t,Boolean(e.detail.open)),"sources"===e.detail.kind&&(e.detail.open?this._sourcesOpen.add(t):this._sourcesOpen.delete(t))}),s.addEventListener("click",e=>{this._pressed=e.target.closest?.("button, a")??null},!0),s.addEventListener("sf-chat-message-open",e=>{if("quote"===e.detail?.kind)return e.preventDefault(),void this.showQuoted(e.detail.target);if("thread"===e.detail?.kind)return e.preventDefault(),void this.openThread(e.detail.id);if("preview"!==e.detail?.kind&&"document"!==e.detail?.kind)return;const t=this._pressed&&e.target.contains(this._pressed)?this._pressed:null,s="document"===e.detail.kind?{...e.detail.document,kind:"document",message_id:e.detail.id}:e.detail.source;this.openPreview(s,{opener:t??this.ownerDocument.activeElement})&&e.preventDefault()}),s.addEventListener("sf-updated",e=>{"sf-chat-message"===e.target?.localName&&this.messagesDrawn()}),i.addEventListener("keydown",e=>this.editLast(e)),i.addEventListener("keydown",e=>this.escapeReply(e)),i.addEventListener("sf-chat-composer-submit",e=>{e.preventDefault(),!i.busy||this.noQueue||(this._data.composer_files||[]).length?this.sendMessage(e.detail.text,(this._data.composer_files||[]).slice(),{own:!0,replyTo:this.replyOf()}):this.enqueue(e.detail.text)}),i.addEventListener("sf-chat-composer-stop",()=>{this.request("wait.stop",{conversation_id:this._data.conversation?.id??null}).then(e=>this.showResult(e))}),i.addEventListener("sf-chat-composer-attach",e=>{const t=e.detail.files||[];t.length&&this.request("file.attach",{files:t,conversation_id:this._data.conversation?.id??null,interlocutor:this.interlocutorId}).then(e=>this.showResult(e))}),i.addEventListener("sf-chat-composer-detach",async e=>{"applied"===(await this.request("file.detach",{key:e.detail.id})).answer&&i.focus()})}async sendMessage(e,t=[],{own:s=!1,repeat:i=!1,queued:n=!1,key:a=D(),replyTo:r=null}={}){const{composer:o}=this.parts;if(o.busy)return;i&&this._repeats.add(a);const l={conversation_id:this._data.conversation?.id??null,body:e,files:t,client_key:a,interlocutor:this.interlocutorId};return this.deliver(a,{own:s,queued:n,typedFor:this.draftKey,replyTo:r},()=>r?this.request("message.reply",{...l,reply_to_id:r.id}):this.request("message.send",l))}resend(e,t){if(!this.parts.composer.busy)return this.deliver(e,t,()=>this.request("message.retry",{conversation_id:this._data.conversation?.id??null,client_key:e}))}async deliver(e,{own:t,queued:s=!1,typedFor:i,replyTo:n=null},a){this._sending++,this.syncBusy();const r=await a();return this._sending--,this._sendFailed="applied"!==r.answer,"applied"===r.answer?t&&(this.parts.composer.clear(),this._drafts.delete(i),n&&this._replies.get(i)===n&&(this._replies.delete(i),this.drawReply())):this.showResult(r,s?void 0:()=>this.resend(e,{own:t,typedFor:i,replyTo:n})),this.syncBusy(),r}queueOf(e=this.draftKey){return this._queues.has(e)||this._queues.set(e,{items:[],held:null}),this._queues.get(e)}enqueue(e){const t=String(e??"").trim();if(!t)return;const s=this.queueOf(),i=this.replyOf();s.items.push({id:"queued-"+ ++F,text:t,key:null,replyTo:i}),this.parts.composer.clear(),this._drafts.delete(this.draftKey),i&&(this._replies.delete(this.draftKey),this.drawReply()),this.drawQueue(),this.sayQueue(this.words("queue.added"))}answerEnded(){const e=this._queues.get(this.draftKey);if(!e?.items.length||e.held||this.parts.composer.busy)return;const t=this.lastEnd();"waiting"!==t&&("answered"===t?this.sendQueued(e,e.items[0]):this.holdQueue(e,t))}lastEnd(){if(this._sendFailed)return"unsent";if(this.has("people"))return"answered";const e=this._data.messages||[];let t=-1;e.forEach((e,s)=>{"assistant"!==e.kind&&(t=s)});const s=e.slice(t+1).reverse().find(e=>"assistant"===e.kind);return s?I.has(s.status)?"answered":x.has(s.status)?"stopped"===s.wait?"stopped":"unfinished":$[s.status]?s.status:"failed":this.has("assistant")?"waiting":"answered"}holdQueue(e,t){e.held=$[t]||"failed",this.drawQueue(),this.sayQueue(this.words(`queue.held.${e.held}`))}async sendQueued(e,t){const s=e.items.indexOf(t);if(-1===s||this.parts.composer.busy)return;e.items.splice(s,1),e.held=null;const i=t.key;t.key??=D(),this.drawQueue();const n=i?await this.resend(i,{own:!1,queued:!0,typedFor:this.draftKey}):await this.sendMessage(t.text,[],{queued:!0,key:t.key,replyTo:t.replyTo??null});n&&"applied"!==n.answer&&(e.items.unshift(t),this.holdQueue(e,"unsent"))}editQueued(e,t){this.dropQueued(e,t);const{composer:s}=this.parts;s.value=[t.text,s.value].filter(e=>e.trim()).join("\n"),t.replyTo&&!this.replyOf()&&(this._replies.set(this.draftKey,t.replyTo),this.drawReply()),s.focus()}removeQueued(e,t){const s=this.dropQueued(e,t),i=this.parts.queueList.querySelectorAll(".chat-shell__queued-remove");(i[Math.min(s,i.length-1)]||this.parts.composer).focus()}dropQueued(e,t){const s=e.items.indexOf(t);return-1!==s&&e.items.splice(s,1),e.items.length||(e.held=null),this.drawQueue(),Math.max(s,0)}sayQueue(e){const{queueSaid:t}=this.parts;t.textContent="",requestAnimationFrame(()=>{t.textContent=e})}drawQueue(){if(!this._partsReady)return;const{queue:e,queueHeld:t,queueList:s,composer:i}=this.parts,n=this._queues.get(this.draftKey),a=n?.items||[];e.hidden=!a.length,t.textContent=a.length&&n.held?this.words(`queue.held.${n.held}`):"",t.hidden=!t.textContent;const r=this.ownerDocument,o=s.contains(r.activeElement)?r.activeElement:null,d=o?[...o.classList].find(e=>e.startsWith("chat-shell__queued-")):null,c=o?.closest("[data-queued]")?.dataset.queued;s.replaceChildren(...a.map(e=>{const t=r.createElement("li");t.className="chat-shell__queued",t.dataset.queued=e.id;const s=`chat-${e.id}`,a=r.createElement("span");a.className="chat-shell__queued-label",a.textContent=this.words(n.held?"queue.unsent":"queue.label");const o=r.createElement("p");o.className="chat-shell__queued-text",o.id=s,o.textContent=e.text,o.title=e.text;const d=r.createElement("span");d.className="chat-shell__queued-actions";const c=(e,t,i)=>{const n=(0,l.uX)(this.ctx,{label:this.words(e),appearance:"link",scheme:"primary",className:`chat-shell__queued-${t}`});return n.setAttribute("aria-describedby",s),n.addEventListener("click",i),d.append(n),n};return n.held&&(c("queue.send","send",()=>this.sendQueued(n,e)).disabled=Boolean(i.busy)),c("queue.edit","edit",()=>this.editQueued(n,e)),c("queue.remove","remove",()=>this.removeQueued(n,e)),t.append(a,o,d),t})),c&&d&&s.querySelector(`[data-queued="${CSS.escape(c)}"] .${d}`)?.focus({preventScroll:!0})}rate(e,t){const s=String(e),i=this._ratings.get(s);this._ratings.set(s,"down"===t?{value:t,asking:!0,draft:{reason:null,note:""}}:{value:t}),this.redrawRated(s,"down"===t?".sf-chat-reason .sf-chat-chip--choice":'[data-rating="up"]'),this.request("message.rate",{message_id:e,value:t}).then(e=>{"applied"!==e.answer?(i?this._ratings.set(s,i):this._ratings.delete(s),this.redrawRated(s,`[data-rating="${t}"]`),this.showResult(e)):"up"===t&&this.notify(this.words("action.thanks"))})}rateWhy(e,t,s,{skip:i=!1}={}){const n=String(e),a=this._ratings.get(n);if(!a)return;const r=String(s||"").trim();if(i||!t&&!r)return this._ratings.set(n,{value:a.value}),void this.redrawRated(n,'[data-rating="down"]');this._ratings.set(n,{value:"down",reason:t,note:r||null}),this.redrawRated(n,'[data-rating="down"]'),this.request("message.rate",{message_id:e,value:"down",reason:t,note:r||null}).then(e=>{"applied"!==e.answer?(this._ratings.set(n,{value:"down",asking:!0,draft:{reason:t,note:r}}),this.redrawRated(n,".sf-chat-reason .sf-chat-chip--choice"),this.showResult(e)):this.notify(this.words("feedback.sent"))})}redrawRated(e,t){const{list:s}=this.parts,i=s.contains(this.ownerDocument.activeElement),n=this.articleOf(e);this.syncMessages(new Set(["messages"])),i&&this.afterDraw(()=>{const t=this.articleOf(e);return t&&t!==n?t:null},e=>{const s=e?.querySelector(`${t}[aria-pressed="true"]`)||e?.querySelector(t);s?.focus({preventScroll:!0})})}articleOf(e){return this.parts.list.querySelector(`.sf-chat-message[data-id="${CSS.escape(String(e))}"]`)}rowActions(e){const{threads:t}=this.parts,s=e?(this._data.conversations||[]).find(t=>String(t.id)===String(e)):null,i=s&&this.has("x-conversation-pin")&&!this._data.conversation_list?.archived;t.actions=i?[s.pinned?{id:"unpin",text:this.words("threads.unpin"),icon:"push_pin"}:{id:"pin",text:this.words("threads.pin"),icon:"push_pin"}]:[]}threadRow(e){return this.parts.threads.querySelector(`.sf-list__row[data-id="${CSS.escape(String(e))}"] .sf-list-item[data-sf-list-roving]`)}async pin(e,t){const s=await this.request("conversation.pin",{conversation_id:e,pinned:t});"applied"===s.answer?(this.notify(this.words(t?"threads.pinned":"threads.unpinned")),this.afterDraw(()=>this.threadRow(e),e=>this.refocus(e))):this.showResult(s)}decide(e,t){const s=this._data.messages.find(t=>String(t.proposal?.code)===String(e));return!(!s||this.parts.composer.busy)&&(this.deciding(s,s.proposal.code,t),!0)}async deciding(e,t,s){this._sending++,this.syncBusy();const i=await this.request("proposal.decide",{message_id:e.id,code:t,decision:s});this._sending--,"applied"!==i.answer&&this.cardOf(t)?.setAttribute("state","open"),this.syncBusy(),this.showResult(i,()=>this.decide(t,s))}async submitBlock({id:e,block_id:t,action:s,revision:i=null,values:n={}}){const a=this._data.messages?.find(t=>(0,b.TN)(t)===String(e)),r=this._drawn.get(String(e));if(!a)return void r?.settleBlock(t,{answer:"unavailable",reason:"not-found"});const o=await this.request("block.submit",{conversation_id:this._data.conversation?.id??a.conversation_id??null,message_id:a.id,block_id:t,action:s,revision:i,values:n});null!=o?.message?.id&&String(o.message.id)===String(a.id)?this.replaceMessage(o.message):o?.block&&String(o.block.id)===String(t)&&this.replaceBlock(a,o.block),r?.settleBlock(t,o??{answer:"unavailable"})}replaceMessage(e){const t=this._data.messages||[],s=t.findIndex(t=>null!=t.id&&String(t.id)===String(e.id));s<0||(this._data.messages=[...t.slice(0,s),e,...t.slice(s+1)],this.syncMessages(new Set(["messages"])))}replaceBlock(e,t){const s=this._data.messages,i=s.indexOf(e);if(i<0)return;const n={...e,blocks:(e.blocks||[]).map(e=>String(e.id)===String(t.id)?t:e)};this._data.messages=[...s.slice(0,i),n,...s.slice(i+1)],this.syncMessages(new Set(["messages"]))}cardOf(e){return this.parts.list.querySelector(`${(0,i.tagSelector)("sf-confirm-change")}[change-id="${CSS.escape(String(e))}"]`)}async answerBrief(e,t){const s=String(t??"").trim();if(!s||this.parts.composer.busy)return;const i=await this.sendMessage(s,[]);"applied"===i?.answer&&(this._briefDrafts.delete(String(e)),this.parts.composer.focus({preventScroll:!0}))}askAgain(e){const t=this._data.messages,s=t.findIndex(t=>(0,b.TN)(t)===String(e)),i=t.slice(0,s).reverse().find(e=>"person"===e.kind);i?.body&&(this._retried.add(String(e)),this.syncMessages(new Set),this.sendMessage(i.body,(i.files||[]).filter(e=>null!=e.id),{repeat:!0}))}async choose(e){this.closeViews();const t=this._interlocutor;this._interlocutor=e,this._navigating++;const s=await this.request("interlocutor.choose",{interlocutor:e});this._navigating--,"applied"===s.answer?(this.sync(new Set(["interlocutor"])),this.focusComposer()):(this._interlocutor=t,this.sync(new Set(["interlocutor"])),this.showResult(s))}async archive(e,t){const s=Boolean(this._data.conversation_list?.archived),i=await this.request("conversation.archive",{conversation_id:e,archived:t});if("applied"===i.answer){if(t){const t=this.notify(this.words("threads.archived"),{label:this.words("threads.restore"),run:()=>this.archive(e,!1)});return void this.refocus(t)}s&&!this._data.conversation_list?.archived&&this.focusListHead(),this.notify(this.words("threads.restored")),this.afterDraw(()=>this.threadRow(e),e=>this.refocus(e))}else this.showResult(i)}async showList(e){const t=await this.request("conversations.view",{archived:e});if("applied"===t.answer)return this.showRegion("list"),void this.focusListHead();this._threadsReady&&(this.parts.threads.status=""),this.showResult(t,()=>this.showList(e))}async more(){const e=await this.request("conversations.more",{archived:Boolean(this._data.conversation_list?.archived)});"applied"!==e.answer&&(this.parts.threads.moreFailed(),this.showResult(e))}async older(e){const{list:t}=this.parts,s=this._data.conversation;if(!s||null==e)return void t.earlierFailed();this._prepended=!1;const i=await this.request("history.older",{conversation_id:s.id,before_id:e});if("applied"!==i.answer)return t.earlierFailed(),void this.showResult(i);this._prepended||this._data.conversation?.id!==s.id||t.prependItems([],{hasMore:Boolean(this._data.history?.has_older)})}focusListHead(){this.afterDraw(()=>this.parts.threads.querySelector(".sf-thread-list__head:not([hidden]) button:not([hidden])"),e=>e?.focus())}afterDraw(e,t,s=10){const i=e();i||s<=0?t(i):requestAnimationFrame(()=>this.afterDraw(e,t,s-1))}get interlocutorId(){const e=this._data.conversation,t=e?this._data.conversations?.find(t=>String(t.id)===String(e.id)):null;return e?.interlocutor??t?.interlocutor??this._interlocutor??this._data.interlocutors?.[0]?.id??null}get who(){const e=this.interlocutorId;return this._data.interlocutors?.find(t=>t.id===e)??null}get draftKey(){const e=this._data.conversation;return e?String(e.id):`new:${this.interlocutorId||""}`}sync(e){const t=this._data,s=this.parts;if((e.has("conversation")||e.has("messages")||e.has("feed_state"))&&(this._started=!0),!this._partsReady){for(const t of e)this._held.add(t);return}if(e.has("conversation")&&t.conversation){const e=t.conversations?.find(e=>String(e.id)===String(t.conversation.id)),s=t.conversation.interlocutor??e?.interlocutor;s&&(this._interlocutor=s)}e.has("limits")&&this.syncLimits(),(e.has("conversations")||e.has("conversation_list")||e.has("interlocutors")||e.has("capabilities"))&&this.syncThreads(),e.has("composer_files")&&this.syncFiles(),e.has("capabilities")&&(this.has("x-my-files")||this.closeFiles({focus:!1}),this.syncFooter()),e.has("my_files")&&this.drawFiles(),this.syncViews();const i="revoked"===t.feed_state||!0===t.conversation?.revoked;i&&this.revoke();const n=this.syncDraft();n&&this.showRegion("main"),(n||e.has("capabilities"))&&this.drawReply(),(n||e.has("interlocutors")||e.has("interlocutor")||e.has("capabilities"))&&this.syncInterlocutor(),this.syncSelected(),(e.has("conversation")||e.has("capabilities"))&&this.syncThreadBar(),s.composer.disabled=Boolean(t.conversation&&!1===t.conversation.can_send)||i,this.syncMessages(e),this.syncLayout(),this.syncBusy(),e.has("notice")&&t.notice?.text&&("error"===t.notice.kind?this.showInlineError(t.notice.text,"function"==typeof t.notice.retry?t.notice.retry:null):this.notify(t.notice.text))}syncSelected(){const{threads:e}=this.parts,t=this._data,s=t.conversation?String(this.inThread?t.conversation.parent_id??t.conversation.id:t.conversation.id):"",i=this._files.open||this._start.open?"":s;(e.getAttribute("selected")||"")!==i&&(i?e.setAttribute("selected",i):e.removeAttribute("selected"))}get messageChars(){return(0,b.gf)(this._data.limits,{people:this.has("people")})}syncLimits(){const{composer:e}=this.parts,t=this._data.limits||{};e.setAttribute("maxlength",String(this.messageChars)),e.setAttribute("max-files",String(t.files_per_message||5)),t.file_bytes?e.setAttribute("max-bytes",String(t.file_bytes)):e.removeAttribute("max-bytes"),e.setAttribute("accept",(t.file_types||[]).map(e=>`.${e}`).join(","))}syncThreads(){const{threads:e,search:t,searchInput:s}=this.parts,i=this.has("x-conversations-search");if(t.hidden=!i,!i&&s.value&&(s.value=""),!this._threadsReady)return;const n=this._data.conversation_list||{};e.toggleAttribute("archived",Boolean(n.archived));const a=this.has("x-conversation-start");if(e.toggleAttribute("no-create",!this.has("conversation-create")&&!a),a!==Boolean(e.createCommands.length)&&(e.createCommands=a?[{id:"private",text:this.words("start.private"),icon:"person_add"},{id:"group",text:this.words("start.group"),icon:"group_add"}]:[]),e.toggleAttribute("no-manage",!this.has("conversation-manage")),n.loading)return e.setThreads([],{hasMore:!1}),void(e.loading=!0);const r=this._data.conversations||[];e.loading=!1,e.setThreads(r.map(e=>this.listed(e)),{hasMore:Boolean(n.has_more)});const o=String(n.query||""),l=Boolean(o)&&0===r.length;l?e.status=this.words("threads.searchEmpty",{query:o}):this._searchStatus&&(e.status=""),this._searchStatus=l}listed(e){const t=(this._data.interlocutors||[]).slice(1),s=t.find(t=>t.id===e.interlocutor)?.title,{updated_at:i,...n}=e,a={...n,pinned:Boolean(e.pinned)};return void 0===a["updated-at"]&&void 0!==i&&(a["updated-at"]=i),s?{...a,caption:s}:a}syncFiles(){const e=this.words;this.parts.composer.files=(this._data.composer_files||[]).map(t=>({id:t.id??t.key,localId:t.key,name:t.name,bytes:t.size,progress:"uploading"===t.state?t.progress??0:null,error:"failed"===t.state?t.reason||e("error.load"):""}))}syncDraft(){const{composer:e}=this.parts,t=this.draftKey,s=this._draftKey;if(t===s)return!1;if(this._draftKey=t,void 0===s)return e.value=this._drafts.get(t)||"",!0;if(s.startsWith("new:")&&this._data.conversation&&0===this._navigating){const e=this._drafts.get(s);this._drafts.delete(s),e&&this._drafts.set(t,e);const i=this._queues.get(s);this._queues.delete(s),i&&this._queues.set(t,i),this.drawQueue();const n=this._replies.get(s);return this._replies.delete(s),n&&this._replies.set(t,n),!0}const i=e.value;i.trim()?this._drafts.set(s,i):this._drafts.delete(s),e.value=this._drafts.get(t)||"",this.closePreview({focus:!1});const n=this._queues.get(t);return n?.items.length&&!n.held&&(n.held="left"),this.drawQueue(),!0}revoke(){this._drafts.delete(this.draftKey),this._queues.delete(this.draftKey),this.drawQueue(),this._replies.delete(this.draftKey),this.drawReply(),this.parts.composer.clear()}syncInterlocutor(){const{composer:e,list:t,interlocutor:s}=this.parts,i=this.who,n=i?.capabilities,a=this._data.interlocutors||[];s.options=this.has("interlocutors")?a:i?[i]:[],s.value=this.interlocutorId||"",e.toggleAttribute("attachments",this.has("files")&&this.has("x-early-upload")&&Boolean(!n||n.attachments)),e.toggleAttribute("no-stop",this.has("people")),this.parts.interlocutor.hidden=this.has("people")&&!this.has("interlocutors"),this.has("people")?(e.setAttribute("placeholder",this.words("people.placeholder")),this._placeholder=!0):this._placeholder&&(e.removeAttribute("placeholder"),this._placeholder=!1);const r={feedback:this.has("feedback"),proposals:this.has("proposals")&&Boolean(!n||n.proposals),memory:Boolean(!n||n.memory),brief:this.has("x-brief"),blocks:this.has("x-blocks")};JSON.stringify(r)!==JSON.stringify(this._features)&&(this._features=r,t.redraw(),this.messagesDrawn());const o=this.greeting()??(this.nothingOpen?this.unselectedNote():null);o?t.setSlot("empty",o):t.clearSlot("empty")}get nothingOpen(){return!this._data.conversation&&!this.who&&!this.covered}unselectedNote(){const e=this.ownerDocument,t=e.createElement("section");t.className="sf-chat-greeting sf-chat-unselected";const s=e.createElement("p");return s.className="sf-chat-greeting__title",s.textContent=this.words("empty.unselected"),t.append(s),t}greeting(){const e=this.who,{suggestions:t}=this.parts;if(!e)return null;const s=this.ownerDocument,i=s.createElement("section");i.className="sf-chat-greeting",this._greetingId??="chat-greeting-title-"+ ++L;const n=this._greetingId;i.setAttribute("aria-labelledby",n);const a=s.createElement(this._headingTag);return a.className="sf-chat-greeting__title",a.id=n,a.textContent=e.greeting||e.title,i.append(a),t.replaceChildren(...(e.suggestions||[]).slice(0,4).map(e=>{const t=s.createElement("li"),i=s.createElement("button");return i.type="button",i.className="sf-chat-greeting__suggestion",i.textContent=e,i.addEventListener("click",()=>this.sendMessage(e,[])),t.append(i),t})),i}viewOf(e){let t=this.ownViewOf(e);const s=this.has("people")?this.daysOf().get((0,b.TN)(e)):null;return s&&(t={...t||{},day:s}),this._unread?.key&&this._unread.listKey===this._listKey&&this._unread.key===(0,b.TN)(e)?{...t||{},divider:"unread"}:t}ownViewOf(e){const t=this.has("people"),s=t&&"person"!==(0,b.d5)(e);if(!s&&"assistant"!==e.kind&&t)return this.personViewOf(e);if(s||"assistant"===e.kind){const t=this._ratings.get((0,b.TN)(e));return{wait:q.has(e.wait)?e.wait:null,retried:this._retried.has((0,b.TN)(e))||void 0,...t?{feedback:t}:{},...this._sourcesOpen.has((0,b.TN)(e))?{sources_open:!0}:{},...this._stepsOpen.has((0,b.TN)(e))?{steps_open:this._stepsOpen.get((0,b.TN)(e))}:{},...this.briefView(e),...s?this.documentView(e):{}}}return e.local?.client_key&&this._repeats.has(e.local.client_key)?{note:"repeat"}:e.command?.kind?{note:e.command.kind,code:e.command.code||""}:this.noteOf(e)}documentView(e){const t=(0,b.TN)(e),s=this._data.conversation,i=s?this._data.conversations?.find(e=>String(e.id)===String(s.id)):null,n=s?.type??i?.type??null,a=this._asking.get(t);return{document:!0,showAuthor:"private"!==n,canStop:this.has("assistant")&&!0===e.can_stop,...this._foldOpen.has(t)?{fold_open:this._foldOpen.get(t)}:{},...!a||this._acting.has(t)||e.is_deleted?{}:{askDelete:!0,...a.conflict?{conflict:{deleted:!1}}:{}},...this.socialView(e)}}socialView(e){const t=this.has("x-reactions"),s=this.has("x-reply"),i=this.has("x-threads");if(!t&&!s&&!i)return{};const n=(0,b.TN)(e),a=null!=e.id&&!0!==e.is_deleted&&(!e.local||"sent"===e.local.state),r={};if(i&&!this.inThread){const t=Number(e.thread?.replies);null!=e.id&&Number.isInteger(t)&&t>0&&(r.replies=t),a&&!1!==this._data.conversation?.can_send&&(r.canDiscuss=!0)}s&&a&&(r.canReply=!0),t&&a&&(r.canReact=!0);const o=this._reacting.get(n);o&&(r.reacting=o.emoji),t&&a&&this._picking===n&&(r.picker=!0);const l=s?e.reply_to:null;if(l){const e=(this._data.messages||[]).find(e=>null!=e.id&&String(e.id)===String(l.id));e||(r.replyLoaded=!1),!0===e?.is_deleted&&(r.replyDeleted=!0)}return r}briefView(e){if(!e.brief||!this._features.brief)return{};const t=(0,b.TN)(e),s=this._data.messages||[],i=s.findIndex(e=>(0,b.TN)(e)===t),n=i>=0?s[i+1]:null;return i>=0&&!n&&!x.has(e.status)?(this._briefDrafts.has(t)||this._briefDrafts.set(t,{}),{brief:{live:!0},brief_draft:this._briefDrafts.get(t)}):(this._briefDrafts.delete(t),{brief:{live:!1,answer:"person"===n?.kind?n.body??null:null}})}noteOf(e){if(e.body)for(const t of this._data.messages||[]){const s=t.proposal;if(s){if(e.body===s.confirm_command)return{note:"confirm",code:s.code};if(e.body===s.cancel_command)return{note:"cancel",code:s.code}}}}drawMessage(e,{view:t}={}){const s=String(e.id);let i=this._drawn.get(s);return i||(i=this.ownerDocument.createElement("sf-chat-message"),this._drawn.set(s,i)),i.features=this._features,"person"===e.template?i.setAttribute("template","person"):i.hasAttribute("template")&&i.removeAttribute("template"),i.display={...t??{},busy:Boolean(this.parts.composer.busy)},i.message=e,i}sayOf(e,{view:t}={}){if("person"===e.template){const t=String(e.text||"").replace(/\s+/gu," ").trim();return e.own||e.isDeleted||!t?"":e.authorName?`${e.authorName}: ${t}`:t}if("assistant"!==e.role)return"";if(t?.document&&!1!==t.showAuthor){if(x.has(e.status)||e.is_deleted)return"";const t=(e.text||"").replace(/\s*\[\d+\]/gu,"").replace(/\s+/gu," ").trim(),s=e.speaker?.name;return s&&t?`${s}: ${t}`:t}if(x.has(e.status))return t?.wait?this.words(`status.${t.wait}`):(0,l.r6)(this.ctx,e)||this.words((0,l.Ih)(e));const s=(e.text||"").replace(/\s*\[\d+\]/gu,"").replace(/\s+/gu," ").trim(),i="completed"===e.status?this.words("list.answered"):"partial"===e.status?this.words("status.partial"):"";return i?`${i}. ${s}`:s}messagesDrawn(){this._afterMessages||(this._afterMessages=requestAnimationFrame(()=>{this._afterMessages=0,this.markLast(),this.syncBusy(),this._find.open&&this.parts.findInput.value.trim()&&this.find({keep:!0}),this.maybeRead()}))}markLast(){const e=this.parts.list.querySelectorAll(".sf-chat-message--assistant");e.forEach((t,s)=>t.classList.toggle("sf-chat-message--last",s===e.length-1))}syncMessages(e){const{list:t}=this.parts;this.followDocument();const s=this._data,i=s.conversation?`c:${s.conversation.id}`:this.draftKey,n=s.feed_state,a=["people","edit","delete","read"].map(e=>this.has(e)?e:"").join(" ");a!==this._mode&&(this.syncLimits(),this.watchDay());const r=i!==this._listKey||"loading"===n!=("loading"===this._feed)||"revoked"===n||a!==this._mode,o=Boolean(s.history?.has_older);i!==this._listKey&&this.leavePeople(),this._listKey=i,this._feed=n,this._mode=a;const l="revoked"===n?[]:s.messages||[],d=this.findUnread(i,n,l);if(r){this._shown.clear(),this._drawn.clear(),this._waiting=!1;for(const e of l)this._shown.set((0,b.TN)(e),{message:e,viewKey:M(this.viewOf(e))});return t.setItems(l.map(e=>this.placed(e)),{hasMore:o}),this.messagesDrawn(),void(d&&this.revealUnread())}const c=this.has("people")&&(e.has("conversation")||e.has("conversations")||e.has("limits")&&this._editing.size>0);if(!e.has("messages")&&!e.has("history")&&!c&&e.size)return;const h=new Set(l.map(b.TN));for(const e of[...this._shown.keys()])h.has(e)||(t.detach({id:e}),this._shown.delete(e),this._drawn.delete(e));const u=l.findIndex(e=>this._shown.has((0,b.TN)(e)));if(u>0){const e=l.slice(0,u);this.has("people")&&this.daysOf().size&&this.holdReading();for(const t of e)this._shown.set((0,b.TN)(t),{message:t,viewKey:M(this.viewOf(t))});t.prependItems(e.map(e=>this.placed(e)),{hasMore:o}),this._prepended=!0}else e.has("history")&&(t.hasMore=o);for(const e of l.slice(Math.max(u,0))){const s=(0,b.TN)(e),i=this.viewOf(e),n=M(i),a=this._shown.get(s);a&&a.message===e&&a.viewKey===n||(this._shown.set(s,{message:e,viewKey:n}),t.upsert(this.drawable(e),i))}this.messagesDrawn(),d&&this.revealUnread()}placed(e){const t=this.viewOf(e),s=this.drawable(e);return t&&Object.values(t).some(Boolean)&&queueMicrotask(()=>{this.parts.list.setView(s.id,t),this.messagesDrawn()}),s}get workspace(){const e=this._parts?.shell;if(!e)return null;const t=globalThis.SF?.workspace;return"function"==typeof t?t(e):null}showRegion(e){const t=this._parts?.shell;if(!t)return;const s=this.workspace;s?s.show(e):t.setAttribute("data-sf-workspace-view",e)}showPanel(e){const t=this._parts?.shell;if(!t)return;const s=this.workspace;s?s.panel(e):e?t.setAttribute("data-sf-workspace-panel","open"):t.removeAttribute("data-sf-workspace-panel")}get panelDrawer(){return!!this._preview?.open&&"wide"!==(this.workspace?.layout??"wide")}syncLayout(){if(!this._started)return;const e=this._data,{shell:t,suggestions:s,pageTitle:i}=this.parts,n=!e.conversation||"ready"===e.feed_state&&0===(e.messages||[]).length;t.classList.toggle("chat-shell--empty",n&&!this.covered),s.hidden=!n||!s.childElementCount;const a=this.nothingOpen;t.classList.toggle("chat-shell--unselected",a),this.parts.composerBox.hidden=a,i.hidden=n||this.covered,this.syncTitles()}syncHeadWho(e,t){const{shell:s,headMark:i,threadSub:n,interlocutor:a}=this.parts,r=this.has("people");s.classList.toggle("chat-shell--people",r),a.hidden=r&&!this.has("interlocutors");const o=r?t?.subtitle??e?.subtitle??"":"";n.textContent=o,n.hidden=!o;const l=r&&e&&t?.avatar&&"object"==typeof t.avatar?t.avatar:null,d=l?JSON.stringify(l):"";if(d===this._headMarkKey)return;if(this._headMarkKey=d,i.replaceChildren(),i.hidden=!l,!l)return;const c=this.ownerDocument,h="square"===l.shape,u="string"==typeof l.icon?l.icon.trim():"";if(u&&!l["image-url"]){const e=c.createElement("span");e.className=`sf-avatar sf-avatar--size-1 sf-avatar--placeholder ${h?"sf-avatar--square":""} inline-flex flex-none items-cross-center content-main-center`,e.setAttribute("aria-hidden","true");const t=c.createElement("sf-icon");return t.setAttribute("icon",u),e.append(t),void i.append(e)}const p=c.createElement("sf-avatar");p.setAttribute("size","1"),p.setAttribute("tone","auto"),p.setAttribute("aria-label",e.title||t?.title||""),p.setAttribute("aria-hidden","true"),p.setAttribute("inert",""),h&&p.setAttribute("shape","square"),l["image-url"]&&p.setAttribute("image-url",l["image-url"]),l.text&&p.setAttribute("text",l.text),i.append(p)}syncTitles(){const{threadTitle:e,pageTitle:t,archivedNote:s}=this.parts,i=this._data.conversation,n=i?this._data.conversations?.find(e=>String(e.id)===String(i.id)):null,a=i&&this.has("x-conversation-start")&&(n?.title||this._pairNames.get(String(i.id)))||"";e.textContent=this.inThread?this.words("thread.title"):i?.title||n?.title||a,this.syncHeadWho(i,n),t.textContent=this.inThread?this.words("thread.title"):i?.title||a||this.who?.title||"";const r=!!i&&Boolean(i.archived??n?.archived);if((r!==this._archivedShown||i?.id!==this._archivedFor)&&(this._archivedShown=r,this._archivedFor=i?.id,s.replaceChildren(),s.hidden=!r,r)){const e=this.ownerDocument.createElement("span");e.textContent=this.words("threads.archivedOpen");const t=(0,l.uX)(this.ctx,{label:this.words("threads.restore"),appearance:"link",scheme:"primary",className:"chat-shell__status-action"}),n=i.id;t.addEventListener("click",()=>this.archive(n,!1)),s.append(e,t)}}syncBusy(){const{composer:e,list:t}=this.parts,s=!this.has("people")&&(this._data.messages||[]).some(e=>"assistant"===e.kind&&x.has(e.status)&&null==e.wait),n=this._sending>0||s;e.busy=n;for(const e of t.querySelectorAll((0,i.tagSelector)("sf-confirm-change")))e.toggleAttribute("disabled",n);for(const e of t.querySelectorAll("fieldset.sf-chat-brief[data-live]"))e.disabled=n;for(const e of t.querySelectorAll(".sf-chat-block[data-live] > sf-view-properties"))e.inert=n;this._waiting&&!s&&0===this._sending&&e.focus({preventScroll:!0}),this._waiting=s;const a=this._queues.get(this.draftKey);n&&"left"===a?.held&&(a.held=null,this.drawQueue()),n!==this._busy&&(this._busy=n,this.drawQueue(),n||queueMicrotask(()=>this.answerEnded()))}drawable(e){const t=this.drawnView(e);return"assistant"===t.role&&this.has("x-blocks")&&Array.isArray(e.blocks)&&e.blocks.length&&(t.blocks=e.blocks),t}drawnView(e){return this.has("people")?U(e,{people:!0,edit:this.has("edit"),remove:this.has("delete"),acting:this._acting.get((0,b.TN)(e))??null,reactions:this.has("x-reactions"),reply:this.has("x-reply")}):U(e)}personViewOf(e){const t=(0,b.TN)(e),s=this.runsOf().get(t)??{first:!0,last:!0,showName:!1},i={own:!0===e.author?.own,first:s.first,last:s.last,showName:s.showName},n=this._acting.get(t);n&&(i.acting=`${n.action}:${n.state}`);const a=this._editing.get(t),r=this._asking.get(t);return a&&!n?(i.editing=a.draft,i.editLimit=this.messageChars,a.conflict&&(i.conflict={deleted:Boolean(e.is_deleted)})):!r||n||e.is_deleted||(i.askDelete=!0,r.conflict&&(i.conflict={deleted:!1})),Object.assign(i,this.socialView(e))}togglePicker(e,t,{quiet:s=!1}={}){const i=String(e),n=this.messageOf(i);if(!this.has("x-reactions")||!n)return;if(t&&(!0===n.is_deleted||null==n.id))return;const a=t?i:this._picking===i?null:this._picking;a!==this._picking&&(this._picking=a,this.redrawPerson(i,t||s?null:".sf-chat-tools__react"))}async react(e,t,s){const i=String(e),n=this.messageOf(i),a="string"==typeof t?t:"";if(!a||!this.has("x-reactions")||!n||null==n.id||!0===n.is_deleted)return;if(this._reacting.has(i))return;const r=`.sf-chat-reaction[data-emoji="${CSS.escape(a)}"], .sf-chat-tools__react`;this._reacting.set(i,{emoji:a}),this._picking=null,this.redrawPerson(i,r);const o=await this.request("message.react",{conversation_id:this._data.conversation?.id??null,message_id:n.id,emoji:a,on:Boolean(s)});this._reacting.delete(i),"applied"===o.answer?o.data?.message&&this.mergeMessage(o.data.message,{same:!0}):E.has(o.reason)||this.notify(o.text||this.words("reactions.refused")),this.redrawPerson(i,r)}replyOf(){return this.has("x-reply")?this._replies.get(this.draftKey)??null:null}startReply(e){const t=this.messageOf(String(e));if(!this.has("x-reply")||!t||null==t.id||!0===t.is_deleted)return;const s=!0===t.author?.own?this.words("reply.you"):t.author?.name??"",i=String(t.body??"").replace(/\s+/gu," ").trim()||(t.files||[])[0]?.name||"";this._replies.set(this.draftKey,{id:t.id,name:s,text:i.slice(0,200)}),this.drawReply(),this.parts.list.announce(this.words("reply.say",{name:s})),this.parts.composer.focus()}cancelReply(){this._replies.delete(this.draftKey),this.drawReply()}escapeReply(e){"Escape"===e.key&&!e.isComposing&&229!==e.keyCode&&this.replyOf()&&(e.preventDefault(),e.stopPropagation(),this.cancelReply(),this.parts.composer.focus({preventScroll:!0}))}drawReply(){const e=this.replyOf();let t=this._replyStrip;if(!t){if(!e)return;const s=this.ownerDocument;t=this._replyStrip=s.createElement("div"),t.className="chat-shell__reply",t.setAttribute("role","group"),t.setAttribute("aria-label",this.words("reply.label"));const i=s.createElement("span");i.className="chat-shell__reply-text";const n=s.createElement("span");n.className="chat-shell__reply-name";const a=s.createElement("span");i.append(n,a);const r=(0,l.gb)(this.ctx,{icon:"close",label:this.words("reply.cancel"),size:"1/2",className:"chat-shell__reply-close"});r.addEventListener("click",()=>{this.cancelReply(),this.parts.composer.focus({preventScroll:!0})}),t.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),this.cancelReply(),this.parts.composer.focus({preventScroll:!0}))}),t.append(i,r),t._name=n,t._said=a,this.parts.composerBox.insertBefore(t,this.parts.composer)}t.hidden=!e,t._name.textContent=e?.name??"",t._said.textContent=e?.text?` ${e.text}`:"",t.title=e?`${e.name} ${e.text}`.trim():""}showQuoted(e){const{list:t}=this.parts,s=t.querySelector(`.sf-list-feed__item[data-id="${CSS.escape(String(e))}"]`),i=s?.querySelector("article");if(!i)return;const n=globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches;i.scrollIntoView({block:"center",behavior:n?"auto":"smooth"}),i.classList.remove("chat-shell__quoted"),i.offsetWidth,i.classList.add("chat-shell__quoted"),setTimeout(()=>i.classList.remove("chat-shell__quoted"),1600);const a=t.focusTarget(s);a?.focus({preventScroll:!0})}daysOf(){const e=this._data.messages||[],t=new Date,s=t.toDateString(),i=(0,a.pageLocale)(this);return this._days?.of===e&&this._days.today===s&&this._days.locale===i||(this._days={of:e,today:s,locale:i,map:(0,b.CJ)(e,{now:t,locale:i,today:this.words("people.today"),yesterday:this.words("people.yesterday")})}),this._days.map}watchDay(){clearTimeout(this._dayTimer),this._dayTimer=0,this.isConnected&&this._partsReady&&this.has("people")&&(this._dayTimer=setTimeout(()=>this.dayTurned(),(0,r.G0)()+1e3))}dayTurned(){this.watchDay(),this._days&&this._days.today!==(new Date).toDateString()&&this.syncMessages(new Set(["messages"]))}holdReading(){const{list:e}=this.parts,t=e.scroller;if(!t)return;const s=t.getBoundingClientRect().top,i=[...e.querySelectorAll(".sf-list-feed__item")].find(e=>e.getBoundingClientRect().bottom>s);if(!i)return;const n=()=>(i.querySelector("article")??i).getBoundingClientRect().top,a=n(),r=this._hold={};let o=8;const l=()=>{if(this._hold!==r||!i.isConnected)return;const e=n()-a;e&&(t.scrollTop+=e),--o>0&&requestAnimationFrame(l)};requestAnimationFrame(l)}runsOf(){const e=this._data.messages||[],t=this._data.conversation,s=t?this._data.conversations?.find(e=>String(e.id)===String(t.id)):null,i=t?.type??s?.type??null,n=this.daysOf();return this._runs?.of===e&&this._runs.type===i&&this._runs.days===n||(this._runs={of:e,type:i,days:n,map:(0,b.ky)(e,{type:i,breaks:n})}),this._runs.map}leavePeople(){this._editing.clear(),this._asking.clear(),this._acting.clear(),this._unread=null,this._reacting.clear(),this._picking=null}findUnread(e,t,s){if(!this.has("read")||this._unread?.listKey===e)return!1;const i=this._data.conversation;if(!i||"ready"!==t||!s.length)return!1;const n=this._data.conversations?.find(e=>String(e.id)===String(i.id)),a=(0,b.SK)(s,n?.unread_count);return this._unread={listKey:e,key:a,revealing:Boolean(a)},Boolean(a)}revealUnread(){const e=this._unread,{list:t}=this.parts;let s=null,i=0;const n=a=>{if(this._unread!==e)return;const r=t.querySelector(".sf-chat-divider--unread")?.parentElement.querySelector(".sf-chat-divider")??null,o=t.scroller,l=o?.scrollTop??null;if(i=null!==l&&l===s?i+1:0,s=l,(!r||i<2)&&a>0)requestAnimationFrame(()=>n(a-1));else{if(r&&o){const e=r.getBoundingClientRect().top-o.getBoundingClientRect().top;e<0&&o.scrollTo({top:o.scrollTop+e,behavior:"instant"})}e.revealing=!1,this.maybeRead()}};requestAnimationFrame(()=>n(60))}maybeRead(){if(!this._partsReady||!this.has("read"))return;const e=this._data,t=e.conversation;if(!t||"ready"!==e.feed_state||!0===t.revoked||this._unread?.revealing)return;const s=e.messages||[];let i=s.length-1;for(;i>=0&&null==s[i].id;)i--;if(i<0)return;const n=s[i],a=this._read;if(a.conversation!==String(t.id))return clearTimeout(a.timer),this._read={conversation:String(t.id),id:null,timer:0},this.maybeRead();if(null!==a.id){if(a.id===String(n.id))return;if(s.findIndex(e=>String(e.id)===a.id)>=i)return}if(!this.lastSeen())return;const r=this._readAt+P-Date.now();if(r>0)return void(a.timer||(a.timer=setTimeout(()=>{a.timer=0,this.maybeRead()},r)));const o=a.id;a.id=String(n.id),this._readAt=Date.now(),this.request("message.read",{conversation_id:t.id,message_id:n.id}).then(e=>{"applied"!==e.answer&&this._read===a&&a.id===String(n.id)&&(a.id=o)})}lastSeen(){const{list:e,main:t}=this.parts,s=e.scroller;return!(!s||!s.clientHeight||this.covered||t.inert)&&("hidden"!==this.ownerDocument.visibilityState&&e.isAtLatest())}connectedCallback(){super.connectedCallback?.(),this._onVisible??=()=>{this.maybeRead(),this.dayTurned()},this.ownerDocument.addEventListener("visibilitychange",this._onVisible),this.watchDay()}disconnectedCallback(){this.ownerDocument.removeEventListener("visibilitychange",this._onVisible),clearTimeout(this._read.timer),this._read.timer=0,clearTimeout(this._dayTimer),this._dayTimer=0,super.disconnectedCallback?.()}messageOf(e){return(this._data.messages||[]).find(t=>(0,b.TN)(t)===String(e))??null}peopleToggle(e,t,s){const i=String(e),n=this.messageOf(i);if(!n||!this.has("people"))return;if(!s){const e="edit"===t&&this._editing.get(i)?.fromField;return"edit"===t?this._editing.delete(i):this._asking.delete(i),this.redrawPerson(i,e?null:"edit"===t?R:j),void(e&&this.parts.composer.focus({preventScroll:!0}))}if(this._acting.has(i)||n.is_deleted)return;const a="edit"===t?"can_edit":"can_delete";if(this.has(t)&&!0===n[a]){for(const[e,t]of this._editing){const s=this.messageOf(e);e===i||t.conflict||t.draft.body!==(s?.body??"")||this._editing.delete(e)}for(const e of[...this._asking.keys()])e!==i&&this._asking.delete(e);"edit"===t?(this._asking.delete(i),this._editing.has(i)||this._editing.set(i,{draft:{body:n.body??""},revision:n.revision??null,conflict:null,clientKey:null})):(this._editing.delete(i),this._asking.set(i,{revision:n.revision??null,conflict:!1,clientKey:null})),this.redrawPerson(i)}}editLast(e){if("ArrowUp"!==e.key||e.defaultPrevented||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)return;if(e.isComposing||229===e.keyCode||!this.has("people")||!this.has("edit"))return;const{composer:t,list:s}=this.parts;if(e.target!==t.field||""!==t.value||t.chips.length||t.disabled)return;const i=this._data;if(!i.conversation||!0===i.conversation.revoked||"ready"!==i.feed_state||this.covered)return;const n=(0,b.Eu)(i.messages);if(null===n||this._acting.has(n))return;e.preventDefault(),this.peopleToggle(n,"edit",!0);const a=this._editing.get(n);if(!a)return;a.fromField=!0;const r=()=>s.querySelector(`.sf-list-feed__item[data-id="${CSS.escape(n)}"]`);this.afterDraw(()=>r()?.querySelector(".sf-chat-person__edit-field"),e=>{e?.focus({preventScroll:!0}),requestAnimationFrame(()=>requestAnimationFrame(()=>r()?.querySelector("article")?.scrollIntoView({block:"nearest"})))})}async saveEdit(e,t){const s=String(e),i=this._editing.get(s),n=this.messageOf(s),a=String(t??"").trim();if(!i||!n||!a||this._acting.has(s))return;if(a.length>this.messageChars)return;i.draft.body=a;const r=i.revision;i.clientKey&&i.sentRevision===r&&i.sentBody===a||(i.clientKey=D()),i.sentRevision=r,i.sentBody=a,this._acting.set(s,{action:"edit",state:"pending",clientKey:i.clientKey,body:a}),this.redrawPerson(s,null);const o=await this.request("message.edit",{conversation_id:this._data.conversation?.id??null,message_id:n.id,revision:r,body:a,client_key:i.clientKey});if(this._acting.delete(s),this._editing.get(s)===i){if("applied"===o.answer){this._editing.delete(s);const e=o.data?.message;return e?this.mergeMessage(e):o.data?.messages||this.mergeMessage({...this.messageOf(s)??n,body:a,is_edited:!0},{same:!0}),this.redrawPerson(s,i.fromField?null:R),void(i.fromField&&this.parts.composer.focus({preventScroll:!0}))}"conflict"!==o.answer?(this.redrawPerson(s,".sf-chat-person__edit-field"),this.showResult(o)):this.conflict(s,i,o.current)}}conflict(e,t,s){s&&"object"==typeof s&&this.mergeMessage(s);const i=this.messageOf(e);t.conflict=!0,t.revision=i?.revision??t.revision;const n=Boolean(i?.is_deleted);this.parts.list.announce(this.words(n?"people.conflictDeleted":"people.conflict")),this.redrawPerson(e,n?".sf-chat-person__edit-cancel":".sf-chat-person__edit-field",{reveal:!0})}async deleteMessage(e){const t=String(e??""),s=this._asking.get(t),i=this.messageOf(t);if(!s||!i||this._acting.has(t))return;const n=s.revision;s.clientKey&&s.sentRevision===n||(s.clientKey=D()),s.sentRevision=n,this._acting.set(t,{action:"delete",state:"pending",clientKey:s.clientKey,body:null}),this.redrawPerson(t,null);const a=await this.request("message.delete",{conversation_id:this._data.conversation?.id??null,message_id:i.id,revision:n,client_key:s.clientKey});if(this._acting.delete(t),this._asking.get(t)===s){if("applied"===a.answer){this._asking.delete(t);const e=a.data?.message;return e?this.mergeMessage(e):a.data?.messages||this.mergeMessage({...this.messageOf(t)??i,body:"",files:[],is_deleted:!0,can_edit:!1,can_delete:!1},{same:!0}),void this.redrawPerson(t,"article")}if("conflict"===a.answer){a.current&&"object"==typeof a.current&&this.mergeMessage(a.current);const e=this.messageOf(t);return!e||e.is_deleted?(this._asking.delete(t),void this.redrawPerson(t,"article")):(s.conflict=!0,s.revision=e.revision??n,this.parts.list.announce(this.words("people.conflict")),void this.redrawPerson(t,".sf-chat-person__ask .sf-button--error",{reveal:!0}))}this.redrawPerson(t,".sf-chat-person__ask button"),this.showResult(a)}}retryLocal(e){const t=(this._data.messages||[]).find(t=>t.local?.client_key===e);"send"!==t?.local?.action&&t?this.request("message.retry",{conversation_id:this._data.conversation?.id??null,client_key:e}).then(e=>this.showResult(e)):this.resend(e,{own:!1,typedFor:this.draftKey})}mergeMessage(e,{same:t=!1}={}){if(!e||null==e.id)return;const s=this._data.messages||[],i=s.findIndex(t=>null!=t.id&&String(t.id)===String(e.id));if(-1===i)return;const n=(0,b.wo)(s[i].revision,e.revision);if(n>0||0===n&&!t&&null!=s[i].revision)return;const a=s.slice();a[i]=e,this.applyData({messages:a})}redrawPerson(e,t=null,{reveal:s=!1}={}){const{list:i}=this.parts,n=this.ownerDocument,a=()=>i.querySelector(`.sf-list-feed__item[data-id="${CSS.escape(String(e))}"]`),r=a()?.querySelector("article")??null,o=i.contains(n.activeElement)||n.activeElement===n.body||!n.activeElement;this.syncMessages(new Set(["messages"])),t&&o&&this.afterDraw(()=>{const e=a()?.querySelector("article");return e&&e!==r?e:null},e=>{const n="article"===t?null:e?.querySelector(t);n?n.focus({preventScroll:!0}):a()&&i.focusItem(a()),s&&e&&requestAnimationFrame(()=>requestAnimationFrame(()=>e.scrollIntoView({block:"nearest"})))})}openFiles(){if(!this.has("x-my-files"))return Promise.resolve();const e=this._files;e.open||(this.closeFind({focus:!1}),this.closePreview({focus:!1}),this.closeStart({focus:!1}),this.closeMembers({focus:!1}),e.open=!0,e.asking=null,e.problem=null,e.root.hidden=!1,e.entry.setAttribute("aria-current","page"),this.parts.shell.classList.add("chat-shell--files"),this.showRegion("main"),this.syncSelected(),this.syncLayout());const t=this.loadFiles();return e.title.focus({preventScroll:!0}),t}closeFiles({focus:e=!0}={}){const t=this._files;t?.open&&(t.open=!1,t.asking=null,t.problem=null,t.root.hidden=!0,t.entry.removeAttribute("aria-current"),this.parts.shell.classList.remove("chat-shell--files"),this.syncSelected(),this.syncLayout(),e&&this.parts.composer.focus({preventScroll:!0}))}get covered(){return Boolean(this._files?.open||this._start?.open||this._members?.open)}closeViews(){this.closeFiles({focus:!1}),this.closeStart({focus:!1}),this.closeMembers({focus:!1})}returnFocus(e){const{composer:t}=this.parts;e?.isConnected?(e.focus({preventScroll:!0}),this.ownerDocument.activeElement!==e&&t.focus({preventScroll:!0})):t.focus({preventScroll:!0})}syncViews(){const e=this._members,t=this.membersOffered;!e.open||t&&e.conversation===String(this._data.conversation.id)||this.closeMembers({focus:!1}),this._start.open&&!this.has("x-conversation-start")&&this.closeStart({focus:!1}),e.command.hidden=!t||this.covered;const s=this._start.open||e.open,{list:i,composerBox:n,find:a,interlocutor:r,threadTitle:o}=this.parts;for(const e of[i,n,a,r,o])e.inert=s}get inThread(){return this.has("x-threads")&&"thread"===this._data.conversation?.type}async openThread(e){const t=this._data.conversation?.id??null;if(null===t||null==e||this.inThread)return;e=this.messageOf(e)?.id??e,this._navigating++;const s=await this.request("thread.open",{conversation_id:t,message_id:e});if(this._navigating--,"applied"!==s.answer)return void this.showResult(s,()=>this.openThread(e));this._threadFrom={conversation:t,message:e};const i=s.data?.conversation_id??s.data?.conversation?.id??null;null!==i&&String(i)!==String(this._data.conversation?.id)&&await this.openConversation(i),this.inThread&&this.focusComposer()}async backToChat(){const e=this._data.conversation,t=this._threadFrom&&String(this._threadFrom.conversation)===String(e?.parent_id??this._threadFrom.conversation)?this._threadFrom:null,s=e?.parent_id??t?.conversation??null,i=e?.root?.id??t?.message??null;if(null===s)return;if(await this.openConversation(s),this.inThread||null===i)return;const{list:n}=this.parts;this.afterDraw(()=>n.querySelector(`.sf-list-feed__item[data-id="${CSS.escape(String(i))}"] article`),e=>{e&&this.showQuoted(i)})}syncThreadBar(){const{threadBar:e,threadRoot:t}=this.parts,s=this.inThread;if(e.hidden=!s,!s)return void t.replaceChildren();const i=this._data.conversation.root,n=this.ownerDocument;if(t.replaceChildren(),t.hidden=!i,!i)return;const a=i.author?.name??i.author?.title??"";if(a){const e=n.createElement("span");e.className="chat-shell__thread-root-who",e.textContent=a,t.append(e)}const r=n.createElement("span");r.className="chat-shell__thread-root-text";const o=!0===i.is_deleted;r.classList.toggle("chat-shell__thread-root-text--deleted",o),r.textContent=o?this.words("thread.rootDeleted"):String(i.text??i.body??""),t.append(r)}get membersOffered(){const e=this._data.conversation;if(!e||!this.has("x-members"))return!1;const t=this._data.conversations?.find(t=>String(t.id)===String(e.id));return(0,p.u9)(e.type??t?.type)}openStart(e={}){const{kind:t,opener:s=null}="string"==typeof e?{kind:e}:e??{};if(!this.has("x-conversation-start"))return!1;const i=this._start;if(i.form?.sending)return!1;const n="group"===t?"group":"private";this.closeFind({focus:!1}),this.closePreview({focus:!1}),this.closeFiles({focus:!1}),this.closeMembers({focus:!1});const a=this.ownerDocument.activeElement,r=s??(a&&a!==this.ownerDocument.body&&!i.root.contains(a)?a:null);return i.opener=r??i.opener,i.open||(i.open=!0,i.root.hidden=!1,this.parts.shell.classList.add("chat-shell--start"),this.showRegion("main"),this.sfHostState("data-start-open",!0)),this.sfEmit("toggle",{kind:"start",open:!0,form:n}),this.syncSelected(),this.syncLayout(),this.syncViews(),i.show(n),i.title.focus({preventScroll:!0}),!0}closeStart({focus:e=!0}={}){const t=this._start;if(!t?.open)return;const s=t.root.contains(this.ownerDocument.activeElement);t.open=!1,t.root.hidden=!0,t.clear(),this.parts.shell.classList.remove("chat-shell--start"),this.sfHostState("data-start-open",!1),this.sfEmit("toggle",{kind:"start",open:!1}),this.syncSelected(),this.syncLayout(),this.syncViews();const{opener:i}=t;t.opener=null,(e||s)&&this.returnFocus(i)}async startAnswered(e,{person:t=null}={}){const s=e.data&&"object"==typeof e.data?e.data:{},i=s.conversation;this._navigating++,this.closeStart({focus:!1}),i&&t?.label&&this._pairNames.set(String(i.id),t.label),this._data.conversation_list?.archived&&this.showList(!1);if(i&&String(this._data.conversation?.id)!==String(i.id)&&void 0===s.messages){this.applyData({...s,messages:[],history:{has_older:!1},feed_state:"loading"});const e=await this.request("conversation.open",{conversation_id:i.id});!("loading"===this._data.feed_state&&String(this._data.conversation?.id)===String(i.id))||"applied"===e.answer&&void 0===e.data?.messages||this.applyData({feed_state:"ready"}),this.showResult(e,()=>this.openConversation(i.id))}else Object.keys(s).length&&this.applyData(s);this._navigating--,this.focusComposer()}openMembers({opener:e=null}={}){const t=this._members,s=this._data.conversation?.id;if(!this.membersOffered)return!1;if(!t.open){this.closeFind({focus:!1}),this.closePreview({focus:!1}),this.closeFiles({focus:!1}),this.closeStart({focus:!1});const i=this.ownerDocument.activeElement;t.opener=e??(i&&i!==this.ownerDocument.body?i:null),t.open=!0,t.conversation=String(s),t.members=[],t.reset(),t.root.hidden=!1,this.parts.shell.classList.add("chat-shell--members"),this.showRegion("main"),this.sfHostState("data-members-open",!0),this.sfEmit("toggle",{kind:"members",open:!0}),this.syncLayout(),this.syncViews()}return this.loadMembers(),t.title.focus({preventScroll:!0}),!0}closeMembers({focus:e=!0}={}){const t=this._members;if(!t?.open)return;const s=t.root.contains(this.ownerDocument.activeElement);t.open=!1,t.asked++,t.state="idle",t.members=[],t.reset(),t.root.hidden=!0,t.body.replaceChildren(),this.parts.shell.classList.remove("chat-shell--members"),this.sfHostState("data-members-open",!1),this.sfEmit("toggle",{kind:"members",open:!1}),this.syncLayout(),this.syncViews();const{opener:i}=t;t.opener=null,(e||s)&&this.returnFocus(i)}leftGroup(){const e=this._data.conversation?.id;this.closeMembers({focus:!1}),null!=e&&this.openConversation(e)}async loadMembers(){const e=this._members,t=++e.asked;e.state="loading",e.draw();const s=await this.request("members.list",{conversation_id:this._data.conversation?.id??null});if(e.open&&t===e.asked){if("applied"===s.answer)return e.state="ready",e.takeRoster(s.data),e.draw(),void e.say(e.countText(e.members.length));e.state="refused"===s.answer?"denied":"error",e.draw(),e.say(this.words("denied"===e.state?"members.denied":"members.failed"))}}openPreview(e,{opener:t=null}={}){const s=this._preview,i=s?.targetOf(e);if(!i)return!1;const n="chat-window-"+ ++T,a="document"===i.kind;if(!this.sfEmit("open",{requestId:n,"request-id":n,intent:a?"document.open":"preview.open",kind:a?"document":"preview",payload:a?{document:i}:{source:i}},{cancelable:!0}))return!1;const r=this.ownerDocument.activeElement,o=t??(r&&r!==this.ownerDocument.body?r:null);return s.open||(this.closeViews(),s.open=!0,s.root.hidden=!1,this.showPanel(!0),this.sfHostState("data-preview-open",!0),this.sfEmit("toggle",{kind:"preview",open:!0})),s.opener=o&&!s.root.contains(o)?o:s.opener,s.openerFinder=this.findAgain(o),s.show(i),s.title.focus({preventScroll:!0}),!0}focusDocumentField(e,t,s){if(null==t)return!1;this.panelDrawer&&this.closePreview({focus:!1});const i=null==e?.message_id?null:this._drawn.get(e.message_id),n=[...this._drawn.values()].filter(e=>e!==i).reverse();return[i,...n].some(e=>e?.isConnected&&!0===e.focusField?.(t,s))}followDocument(){const e=this._preview;if(!e?.open||"document"!==e.source?.kind)return;const t=e.source;for(const s of this._data.messages||[])for(const i of s.blocks||[]){if("document"!==i?.kind||String(i.document_id)!==t.document_id)continue;const n=e.targetOf({...i,kind:"document",message_id:s.id,downloads:(i.downloads||[]).map(e=>({...e,href:e.url}))});if(!n)return;return void((n.revision!==t.revision||n.preview_url!==t.preview_url||n.state!==t.state||n.missing.length!==t.missing.length)&&e.show(n))}}closePreview({focus:e=!0}={}){const t=this._preview;if(!t?.open)return;const s=t.root.contains(this.ownerDocument.activeElement);t.open=!1,t.root.hidden=!0,t.clear(),this.showPanel(!1),this.sfHostState("data-preview-open",!1),this.sfEmit("toggle",{kind:"preview",open:!1});const i=t.opener?.isConnected?t.opener:t.openerFinder?.();t.opener=null,t.openerFinder=null,(e||s)&&(i?.isConnected&&null!==i.offsetParent?i:this.parts.composer).focus({preventScroll:!0})}findAgain(e){const t=e?.closest?.(".sf-chat-message[data-id]");if(!t)return null;const s=t.getAttribute("data-id"),i=e.getAttribute("aria-controls"),n=[...e.classList].find(e=>/^sf-chat-(footnote|sources__preview|deliverable__preview)$/u.test(e)),a=n?[...t.querySelectorAll(`.${n}`)].indexOf(e):-1;return()=>{const e=[...this.parts.list.querySelectorAll(".sf-chat-message[data-id]")].find(e=>e.getAttribute("data-id")===s);return e?i&&"sf-chat-footnote"===n?e.querySelector(`.sf-chat-footnote[aria-controls="${CSS.escape(i)}"]`):n&&a>=0?e.querySelectorAll(`.${n}`)[a]??null:null:null}}async loadFiles(){const e=this._files;e.state="loading",this.drawFiles();const t=await this.request("files.list");if(e.open){if("applied"===t.answer){e.state="ready",this.drawFiles();const t=(this._data.my_files?.files||[]).length;return void e.say(t?this.words("files.count",{count:t}):this.words("files.empty"))}"superseded"!==t.reason&&(e.state="error",e.reason=E.has(t.reason)?"":t.reason||"",this.drawFiles(),e.say(e.reason||this.words("files.error")))}}drawFiles(){this._files?.open&&this._files.draw(this._data.my_files)}async removeFile(e){const t=this._files;if(null!=t.removing)return;const s=this._data.my_files?.files||[],i=s.findIndex(t=>String(t.id)===String(e)),n=s[i]?.name??"";t.removing=e,this.drawFiles(),t.rowOf(e)?.querySelector(".chat-files__ask")?.focus();const a=await this.request("files.remove",{file_id:e});if(t.removing=null,"applied"===a.answer){t.asking=null,t.problem=null,this.drawFiles(),t.say(this.words("files.deleted",{name:n}));const e=t.body.querySelectorAll(".chat-files__item"),s=e[Math.min(Math.max(i,0),e.length-1)];return void(s?.querySelector(".chat-files__download, .chat-files__delete")||t.title).focus({preventScroll:!0})}t.problem=E.has(a.reason)?null:{id:e,text:a.reason||this.words("error.load")},this.drawFiles(),t.rowOf(e)?.querySelector(".chat-files__confirm")?.focus()}expire(e,t,s,i=e){const n=this.ownerDocument,a=this.parts.composer;setTimeout(function t(){if(!e.isConnected)return;if(i.matches(":hover, :focus-within"))return void setTimeout(t,1e3);const r=i.contains(n.activeElement);s(),r&&a.focus({preventScroll:!0})},t)}notify(e,t){const{statusLine:s}=this.parts;if(s.replaceChildren(),!e)return null;const i=this.ownerDocument.createElement("span");if(i.textContent=e,s.append(i),t){const e=(0,l.uX)(this.ctx,{label:t.label,appearance:"link",scheme:"primary",className:"chat-shell__status-action"});return e.addEventListener("click",()=>{this.notify(""),t.run()}),s.append(e),e}return this.expire(i,8e3,()=>s.replaceChildren(),s),null}showInlineError(e,t){const s=this.ownerDocument,{composerBox:i}=this.parts,n=s.createElement("div");n.className="sf-chat-notice sf-chat-notice--failed chat-shell__error",n.setAttribute("role","alert");const a=s.createElement("p");if(a.className="sf-chat-notice__text",a.textContent=e,n.append(a),t){const e=s.createElement("button");e.className="sf-chat-notice__action",e.type="button",e.textContent=this.words("action.retry"),e.addEventListener("click",()=>{n.remove(),t()}),n.append(e)}i.querySelector(".chat-shell__error")?.remove(),i.prepend(n),t||this.expire(n,12e3,()=>n.remove())}refocus(e){const t=this.ownerDocument;t.activeElement&&t.activeElement!==t.body&&t.activeElement.isConnected||(e?.isConnected&&null!==e.offsetParent?e:this.parts.composer).focus({preventScroll:!0})}sfAliasAdapters(){return X()}}for(const Z of[...g.vN,...g.vq]){const ee={configurable:!0,get(){return this._data[Z]},set(e){this.applyData({[Z]:e})}};Object.defineProperty(G.prototype,Z,ee),Object.defineProperty(G.prototype,C(N[Z]),ee)}G.define("sf-chat-window"),t()}catch(te){t(te)}})},"2932d43488ae"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{L:()=>l});var n=s("5b8371b87515"),a=s("166eba132218"),r=e([n,a]);[n,a]=r.then?(await r)():r;let o=0;class l{constructor(e){this.win=e,this.open=!1,this.state="idle",this.reason="",this.asking=null,this.removing=null,this.problem=null}get ctx(){return this.win.ctx}get words(){return this.win.words}build(e){const t=this.ctx,s=t.document,i="chat-files-"+ ++o;this.headingLevel=Number(e.slice(1));const n=s.createElement("button");n.type="button",n.className="sf-thread-list__command chat-files__entry",n.dataset.action="my-files",n.setAttribute("aria-controls",i);const r=s.createElement("span");r.textContent=this.words("files.entry"),n.append((0,a.yI)(t,"folder_open","","2"),r),n.addEventListener("click",()=>this.win.openFiles());const l=s.createElement("section");l.className="chat-files",l.id=i,l.hidden=!0,l.setAttribute("aria-labelledby",`${i}-title`);const d=s.createElement("div");d.className="chat-files__head";const c=(0,a.gb)(t,{icon:"arrow_back",label:this.words("files.back"),size:"1"});c.classList.add("chat-files__back"),c.addEventListener("click",()=>this.win.closeFiles());const h=s.createElement(e);h.className="chat-files__title",h.id=`${i}-title`,h.tabIndex=-1,h.textContent=this.words("files.title"),d.append(c,h);const u=s.createElement("div");u.className="chat-files__usage",u.hidden=!0;const p=s.createElement("p");p.className="chat-files__used";const m=s.createElement("sf-progress-bar");m.className="chat-files__bar",m.setAttribute("size","1/2"),m.setAttribute("label",this.words("files.usage")),u.append(p,m);const f=s.createElement("div");f.className="chat-files__body";const b=s.createElement("p");return b.className="sf-chat-offscreen",b.setAttribute("role","status"),b.setAttribute("aria-live","polite"),l.append(d,u,f,b),l.addEventListener("keydown",e=>{"Escape"!==e.key||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),null==this.asking||this.removing?this.win.closeFiles():this.cancelAsk())}),l.addEventListener("sf-empty-state-action",()=>this.win.loadFiles()),Object.assign(this,{entry:n,root:l,title:h,usage:u,used:p,bar:m,body:f,status:b}),this}say(e){this.status.textContent="",requestAnimationFrame(()=>{this.status.textContent=e})}draw(e){const t=this.ctx.document;if(this.body.setAttribute("aria-busy",String("loading"===this.state)),"loading"===this.state&&!e){this.usage.hidden=!0;const e=t.createElement("p");return e.className="chat-files__loading",e.textContent=this.words("files.loading"),void this.body.replaceChildren(e)}if("error"===this.state)return this.usage.hidden=!0,void this.body.replaceChildren(this.emptyState("error",this.words("files.error"),this.reason||this.words("error.load")));if(!e)return void this.body.replaceChildren();this.drawUsage(e);const s=e.files||[];if(!s.length)return void this.body.replaceChildren(this.emptyState("no-data",this.words("files.empty"),this.words("files.emptyText"),"folder_open"));const i=t.createElement("ul");i.className="chat-files__list",i.setAttribute("aria-labelledby",this.title.id),i.append(...s.map(e=>this.row(e))),this.body.replaceChildren(i)}emptyState(e,t,s,i=""){const n=this.ctx.document.createElement("sf-empty-state");return n.setAttribute("kind",e),n.setAttribute("size","1"),n.setAttribute("title",t),n.setAttribute("text",s),n.setAttribute("heading-level",String(Math.min(6,this.headingLevel+1))),i&&n.setAttribute("icon",i),n.setAttribute("live","off"),n}drawUsage(e){const{locale:t}=this.ctx,s=Number(e.used_bytes),i=Number(e.quota_bytes);if(!Number.isFinite(s))return void(this.usage.hidden=!0);this.usage.hidden=!1;const n=(0,a.z3)(s,this.words,t),r=Number.isFinite(i)&&i>0?this.words("files.used",{used:n,quota:(0,a.z3)(i,this.words,t)}):n;if(this.used.textContent=r,this.bar.hidden=!(Number.isFinite(i)&&i>0),this.bar.hidden)return;const o=Math.min(100,Math.max(0,s/i*100));this.bar.setAttribute("value",String(Number(o.toFixed(1)))),this.bar.setAttribute("value-text",r)}row(e){const t=this.ctx,s=t.document,i=this.words,n=s.createElement("li");n.className="chat-files__item",n.dataset.id=String(e.id);const r=s.createElement("span");r.className="chat-files__icon",r.setAttribute("aria-hidden","true"),r.append((0,a.yI)(t,"description","","2"));const o=s.createElement("div");o.className="chat-files__text";const l=s.createElement("span");l.className="chat-files__name",l.title=e.name,l.textContent=e.name;const d=s.createElement("span");d.className="chat-files__meta";const c=[null!=e.size?(0,a.z3)(e.size,i,t.locale):"",this.date(e.created_at)].filter(Boolean),h=s.createElement("span");if(h.textContent=c.join(" · "),d.append(h),e.saved_to_base){const e=s.createElement("span");e.className="chat-files__saved",e.append((0,a.yI)(t,"library_add_check","","1"),s.createTextNode(i("files.saved"))),d.append(e)}o.append(l,d),n.append(r,o);return String(this.asking)===String(e.id)?(n.classList.add("chat-files__item--asking"),n.append(this.question(e)),n):(n.append(this.actions(e)),n)}actions(e){const t=this.ctx,s=t.document,i=this.words,n=s.createElement("div");if(n.className="chat-files__actions",e.download_url){const r=s.createElement("a");r.className="sf-button sf-button--size-1/2 sf-button--ghost sf-button--on-surface flex items-cross-center content-main-center chat-files__download",r.href=e.download_url,r.setAttribute("download",e.name||""),r.setAttribute("aria-label",i("files.downloadLabel",{name:e.name}));const o=s.createElement("span");o.className="sf-button-text-container",o.textContent=i("files.download"),r.append((0,a.yI)(t,"download","","1"),o),n.append(r)}const r=(0,a.uX)(t,{label:i("files.delete"),appearance:"ghost",scheme:"on-surface",icon:"delete",className:"chat-files__delete"});return r.setAttribute("aria-label",i("files.deleteLabel",{name:e.name})),r.addEventListener("click",()=>this.ask(e.id)),n.append(r),n}question(e){const t=this.ctx,s=t.document,i=this.words,n=String(this.removing)===String(e.id),r=s.createElement("div");r.className="chat-files__ask",r.tabIndex=-1,r.setAttribute("role","group");const o=`${this.root.id}-ask`;r.setAttribute("aria-labelledby",o);const l=s.createElement("p");if(l.className="chat-files__question",l.id=o,l.textContent=i("files.deleteAsk",{name:e.name}),r.append(l),this.problem&&String(this.problem.id)===String(e.id)){const e=s.createElement("p");e.className="chat-files__problem",e.setAttribute("role","alert"),e.textContent=this.problem.text,r.append(e)}const d=s.createElement("div");d.className="chat-files__ask-actions";const c=(0,a.uX)(t,{label:i(n?"files.deleting":"files.delete"),appearance:"default",scheme:"error",className:"chat-files__confirm"}),h=(0,a.uX)(t,{label:i("files.cancel"),appearance:"ghost",scheme:"on-surface",className:"chat-files__cancel"});return c.disabled=n,h.disabled=n,c.addEventListener("click",()=>this.win.removeFile(e.id)),h.addEventListener("click",()=>this.cancelAsk()),d.append(c,h),r.append(d),r}date(e){const t=new Date(e).getFullYear()===(new Date).getFullYear();return(0,n.Yq)(e,{locale:this.ctx.locale,intl:{day:"numeric",month:"long",...t?{}:{year:"numeric"}}})}ask(e){this.asking=e,this.problem=null,this.win.drawFiles(),this.rowOf(e)?.querySelector(".chat-files__cancel")?.focus()}cancelAsk(){const e=this.asking;this.asking=null,this.problem=null,this.win.drawFiles(),this.rowOf(e)?.querySelector(".chat-files__delete")?.focus()}rowOf(e){return null==e?null:this.body.querySelector(`.chat-files__item[data-id="${CSS.escape(String(e))}"]`)}}i()}catch(e){i(e)}})},e3469cf61587(e,t,s){s.d(t,{cm:()=>n,ih:()=>a,rw:()=>o,xA:()=>l});const i=Object.freeze(["manager","member","observer"]);Object.freeze(["member.add","member.remove","member.role","member.transfer","member.leave"]);function n(e){const t=[];return!0===e?.canChangeRole&&t.push("role"),!0===e?.canRemove&&t.push("remove"),!0===e?.canTransfer&&t.push("transfer"),t}function a(e){const t=[];return!0===e?.can_manage&&t.push("add"),!0===e?.can_leave&&t.push("leave"),t}const r=Object.freeze(["remove","transfer","leave"]);function o(e){const t={};return"boolean"==typeof e?.can_manage&&(t.can_manage=e.can_manage),"boolean"==typeof e?.can_leave&&(t.can_leave=e.can_leave),t}function l(e,t={}){if("applied"===t?.answer){const s=t.data||{};return"member.leave"===e?{state:"left"}:"member.remove"===e?{state:"removed",id:s.removed_user_id??null}:{state:"roster",participants:Array.isArray(s.participants)?s.participants:null,own:o(s)}}const s=t?.reason??"";return"owner-transfer-required"===s?{state:"line",word:"members.leave-owner",retry:!1,reload:!1}:"group-full"===s?{state:"line",word:"members.full",retry:!1,reload:!1}:"invalid-recipient"===s?{state:"line",word:"members.add-invalid",retry:!1,reload:!1}:"access-denied"===s||"not-found"===s?{state:"line",word:"members.denied-action",retry:!1,reload:!0}:"prevented"===s?{state:"line",word:"",retry:!1,reload:!1}:{state:"line",word:"members.failed-action",retry:!0,reload:!1}}s.d(t,["Ur",0,(e,t)=>[...(e||[]).map(e=>e?.id),...null==t?[]:[t]].filter(e=>null!=e),"qV",0,r,"qn",0,i])},"60fe8377ff22"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{X:()=>h});var n=s("166eba132218"),a=s("5d717d8e5251"),r=s("e3469cf61587"),o=e([n]),l=o.then?(await o)():o;n=l[0];let d=0;const c=(...e)=>Promise.all(e.map(e=>customElements.whenDefined(e)));class h{constructor(e){this.win=e,this.open=!1,this.state="idle",this.members=[],this.conversation=null,this.asked=0,this.opener=null,this.strip=null,this.adding=!1,this.pending=new Set,this.problem=null,this.own={}}get ctx(){return this.win.ctx}get words(){return this.win.words}get managing(){return this.win.has("x-members-manage")}takeRoster(e){this.members=Array.isArray(e?.participants)?e.participants:[],this.own=(0,r.rw)(e)}build(e){const t=this.ctx,s=t.document,i="chat-members-"+ ++d;this.headingLevel=Number(e.slice(1));const a=(0,n.uX)(t,{label:this.words("members.open"),appearance:"ghost",scheme:"on-surface",icon:"group",className:"chat-shell__members-open"});a.hidden=!0,a.setAttribute("aria-controls",i),a.addEventListener("click",()=>this.win.openMembers({opener:a}));const r=s.createElement("section");r.className="chat-members",r.id=i,r.hidden=!0,r.setAttribute("aria-labelledby",`${i}-title`);const o=s.createElement("div");o.className="chat-members__head";const l=(0,n.gb)(t,{icon:"arrow_back",label:this.words("members.back"),size:"1",className:"chat-members__back"});l.addEventListener("click",()=>this.win.closeMembers());const c=s.createElement(e);c.className="chat-members__title",c.id=`${i}-title`,c.tabIndex=-1,c.textContent=this.words("members.open");const h=s.createElement("span");h.className="chat-members__count";const u=s.createElement("div");u.className="chat-members__tools",o.append(l,c,h,u);const p=s.createElement("div");p.className="chat-members__problem";const m=s.createElement("div");m.className="chat-members__add",m.hidden=!0;const f=s.createElement("div");f.className="chat-members__body";const b=s.createElement("p");return b.className="sf-chat-offscreen",b.setAttribute("role","status"),b.setAttribute("aria-live","polite"),r.append(o,p,m,f,b),r.addEventListener("keydown",e=>{if("Escape"===e.key&&!e.defaultPrevented)return e.preventDefault(),e.stopPropagation(),this.strip?this.closeStrip({focus:!0}):this.adding?this.closeAdd({focus:!0}):void this.win.closeMembers()}),r.addEventListener("sf-empty-state-action",()=>this.win.loadMembers()),Object.assign(this,{command:a,root:r,title:c,count:h,tools:u,line:p,add:m,body:f,status:b}),this}reset(){this.own={},this.strip=null,this.adding=!1,this.pending.clear(),this.problem=null,this.add.hidden=!0,this.add.replaceChildren(),this.line.replaceChildren(),this.tools.replaceChildren()}say(e){this.status.textContent="",requestAnimationFrame(()=>{this.status.textContent=e})}countText(e){return this.win.sfWord("members-count",{count:e})}draw(){const e=this.ctx.document;if(this.body.setAttribute("aria-busy",String("loading"===this.state)),this.count.textContent="ready"===this.state?this.countText(this.members.length):"",this.drawTools(),this.drawProblem(),"loading"===this.state)return void this.body.replaceChildren(this.lineOf(this.words("members.loading")));if("denied"===this.state)return void this.body.replaceChildren(this.lineOf(this.words("members.denied")));if("error"===this.state){const t=e.createElement("sf-empty-state");return t.setAttribute("kind","error"),t.setAttribute("size","1"),t.setAttribute("heading",this.words("members.failed")),t.setAttribute("text",this.words("error.load")),t.setAttribute("heading-level",String(Math.min(6,this.headingLevel+1))),t.setAttribute("live","off"),void this.body.replaceChildren(t)}const t=e.createElement("ul");t.className="chat-members__list",t.setAttribute("aria-labelledby",this.title.id);const s=e.createDocumentFragment();for(const e of this.members)s.append(this.row(e));t.append(s),this.body.replaceChildren(t)}lineOf(e){const t=this.ctx.document.createElement("p");return t.className="chat-members__line",t.textContent=e,t}drawTools(){if(this.tools.replaceChildren(),!this.managing||"ready"!==this.state)return;const e=(0,r.ih)({...this.win._data.conversation,...this.own});if(e.includes("add")){const e=(0,n.uX)(this.ctx,{label:this.words("members.add"),appearance:"ghost",scheme:"primary",icon:"person_add",className:"chat-members__tool chat-members__add-open"});e.setAttribute("aria-expanded",String(this.adding)),this.busy(e,this.pending.has("add")),e.addEventListener("click",()=>this.adding?this.closeAdd({focus:!1}):this.openAdd()),this.tools.append(e)}if(e.includes("leave")){const e=(0,n.uX)(this.ctx,{label:this.words("members.leave"),appearance:"ghost",scheme:"on-surface",icon:"logout",className:"chat-members__tool chat-members__leave"});this.busy(e,this.pending.has("leave")),e.addEventListener("click",()=>this.ask("leave",null)),this.tools.append(e)}}busy(e,t){e.toggleAttribute("aria-busy",t),e.classList.toggle("chat-members__busy",t),t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled")}row(e){const t=this.ctx.document,{id:s,name:i,role:o}=(0,a.TL)(e),l=t.createElement("li");l.className="chat-members__row",l.dataset.id=String(s);const d=t.createElement("div");d.className="chat-members__who";const c=t.createElement("span");c.className="sf-avatar sf-avatar--size-1/2 sf-avatar--text inline-flex flex-none items-cross-center content-main-center overflow-hidden",c.setAttribute("aria-hidden","true"),c.textContent=(0,a.bB)(i);const h=t.createElement("span");if(h.className="chat-members__name",h.textContent=i,h.title=i,d.append(c,h),o){const e=t.createElement("span");e.className="chat-members__role",e.textContent=this.words(o),d.append(e)}l.append(d);const u=this.managing?(0,r.cm)(e):[];if(u.length){const t=String(this.strip?.id)===String(s),a=(0,n.gb)(this.ctx,{icon:"more_horiz",label:this.win.sfWord("members-actions",{vars:{name:i}}),size:"1",className:"chat-members__more"});a.setAttribute("aria-expanded",String(t)),this.busy(a,this.pending.has(String(s))),a.addEventListener("click",()=>t?this.closeStrip({focus:!0}):this.openStrip(e)),d.append(a),t&&l.append(this.stripOf(e,u))}return l}openStrip(e){this.pending.has(String(e.id))||(this.strip={id:e.id,ask:null},this.redraw(()=>this.stripNode()?.querySelector("button")))}closeStrip({focus:e=!1}={}){const t=this.strip?.id;this.strip=null,this.redraw(e?()=>this.moreOf(t):null)}stripOf(e,t){const s=this.ctx.document,i=s.createElement("div");i.className="chat-members__strip",i.setAttribute("role","group"),i.setAttribute("aria-label",this.win.sfWord("members-actions",{vars:{name:e.name??""}}));const a=this.pending.has(String(e.id));if(this.strip.ask)return i.append(...this.question(this.strip.ask,e)),i;if(t.includes("role")){const t=s.createElement("div");t.className="chat-members__roles",t.setAttribute("role","group"),t.setAttribute("aria-label",this.words("members.role-change"));for(const s of r.qn){const i=e.role===s,r=(0,n.uX)(this.ctx,{label:this.words(`members.role.${s}`),appearance:i?"tonal":"ghost",scheme:"on-surface",className:"chat-members__role-pick"});r.setAttribute("aria-pressed",String(i)),this.busy(r,a),i||r.addEventListener("click",()=>this.act("member.role",e,{role:s})),t.append(r)}i.append(t)}if(t.includes("remove")){const t=(0,n.uX)(this.ctx,{label:this.words("members.remove"),appearance:"ghost",scheme:"primary",className:"chat-members__remove"});this.busy(t,a),t.addEventListener("click",()=>this.ask("remove",e)),i.append(t)}if(t.includes("transfer")){const t=(0,n.uX)(this.ctx,{label:this.words("members.transfer"),appearance:"ghost",scheme:"on-surface",className:"chat-members__transfer"});this.busy(t,a),t.addEventListener("click",()=>this.ask("transfer",e)),i.append(t)}return i}question(e,t){const s=this.ctx.document,i=s.createElement("p");i.className="chat-members__ask";const a=s.createElement("strong");a.textContent=this.words(`members.ask-${e}`);const r=s.createElement("span");r.textContent=this.words(`members.then-${e}`),i.append(a," ",r);const o=(0,n.uX)(this.ctx,{label:this.words(`members.yes-${e}`),appearance:"default",scheme:"primary",className:"chat-members__yes"}),l=(0,n.uX)(this.ctx,{label:this.words("members.cancel"),appearance:"ghost",scheme:"on-surface",className:"chat-members__no"}),d=this.pending.has("leave"===e?"leave":String(t?.id));this.busy(o,d);const c={remove:"member.remove",transfer:"member.transfer",leave:"member.leave"}[e];o.addEventListener("click",()=>this.act(c,t)),l.addEventListener("click",()=>"leave"===e?this.closeLeave():this.closeStrip({focus:!0}));const h=s.createElement("div");return h.className="chat-members__ask-row",h.append(o,l),[i,h]}ask(e,t){if(r.qV.includes(e)){if("leave"===e)return this.strip={id:null,ask:"leave"},this.drawLeave(),void this.focusIn(this.root.querySelector(".chat-members__leave-ask .chat-members__no"));this.strip={id:t.id,ask:e},this.redraw(()=>this.stripNode()?.querySelector(".chat-members__no"))}}drawLeave(){if(this.root.querySelector(".chat-members__leave-ask")?.remove(),"leave"!==this.strip?.ask)return;const e=this.ctx.document.createElement("div");e.className="chat-members__strip chat-members__leave-ask",e.setAttribute("role","group"),e.setAttribute("aria-label",this.words("members.leave")),e.append(...this.question("leave",null)),this.line.before(e)}closeLeave(){this.strip=null,this.drawLeave(),this.focusIn(this.tools.querySelector(".chat-members__leave"))}openAdd(){if(this.pending.has("add"))return;this.adding=!0;const e=this.ctx.document,t=e.createElement("p");t.className="chat-members__warn",t.textContent=this.words("members.add-warning");const s=e.createElement("sf-input-lookup");s.className="chat-members__people";const i=(0,a.QJ)(this.win._data.limits?.group);for(const[e,t]of Object.entries({size:"1",label:this.words("members.add-label"),placeholder:this.words("start.placeholder"),"min-length":String(i.search_min),"max-results":String(i.search_max),maxlength:String(i.query_chars)}))s.setAttribute(e,t);s.addEventListener("change",e=>{const t=e.detail?.item??e.detail?.value,s=t?.value??t?.id;"removed"!==e.detail?.action&&null!=s&&this.act("member.add",{id:s,name:t.label??""})});const o=(0,n.uX)(this.ctx,{label:this.words("members.add-done"),appearance:"ghost",scheme:"on-surface",className:"chat-members__add-done"});o.addEventListener("click",()=>this.closeAdd({focus:!0})),this.add.replaceChildren(t,s,o),this.add.hidden=!1,this.drawTools(),c("sf-input-lookup").then(()=>{this.adding&&s.isConnected&&(customElements.upgrade(this.add),s.provider=(e,t)=>this.search(e,t),s.exclude=(0,r.Ur)(this.members,this.win._data.me?.id),this.win.afterDraw(()=>s.querySelector("input"),e=>e?.focus()))})}closeAdd({focus:e=!1}={}){this.adding=!1,this.add.hidden=!0,this.add.replaceChildren(),this.drawTools(),e&&this.focusIn(this.tools.querySelector(".chat-members__add-open"))}async search(e,{signal:t}={}){const s=await this.win.request("recipients.search",{query:e});if(t?.aborted||!this.adding)return{items:[]};if("applied"!==s?.answer)return{status:"unavailable"};return{items:(Array.isArray(s.data?.items)?s.data.items:[]).filter(e=>e&&null!==e.id&&void 0!==e.id).map(a.T)}}async act(e,t,s={}){const i="member.add"===e?"add":"member.leave"===e?"leave":String(t?.id);if(this.pending.has(i))return;this.pending.add(i),this.problem=null,this.redraw();const n=this.win._data.conversation?.id??null,a="member.leave"===e?{conversation_id:n}:{conversation_id:n,user_id:t?.id,...s},o=this.asked,l=await this.win.request(e,a);if(this.pending.delete(i),!this.open||o!==this.asked)return;const d=(0,r.xA)(e,l);if("left"===d.state)return this.say(this.words("members.left")),void this.win.leftGroup();if("removed"===d.state){const e=String(d.id??t?.id);return this.members=this.members.filter(t=>String(t.id)!==e),this.strip=null,this.redraw(()=>this.title),void this.say(this.win.sfWord("members-removed",{vars:{name:t?.name??""}}))}if("roster"!==d.state)d.word?(this.problem={word:d.word,retry:d.retry?()=>this.act(e,t,s):null},"member.leave"===e&&(this.strip=null),this.redraw(),this.say(this.words(d.word)),d.reload&&this.win.loadMembers()):this.redraw();else if(d.participants&&(this.members=d.participants),this.own={...this.own,...d.own},"member.add"!==e&&(this.strip=null),this.redraw("member.add"===e?null:()=>this.moreOf(t?.id)??this.title),"member.add"===e){const e=this.add.querySelector("sf-input-lookup");e&&(e.value=null,e.exclude=(0,r.Ur)(this.members,this.win._data.me?.id)),this.say(this.win.sfWord("members-added",{vars:{name:t?.name??""}}))}else this.say(this.words("member.transfer"===e?"members.transferred":"members.role-changed"))}drawProblem(){if(this.line.replaceChildren(),!this.problem)return;const e=this.ctx.document,t=e.createElement("div");t.className="sf-chat-notice sf-chat-notice--failed chat-members__notice",t.setAttribute("role","alert");const s=e.createElement("p");if(s.className="sf-chat-notice__text",s.textContent=this.words(this.problem.word),t.append(s),this.problem.retry){const s=e.createElement("button");s.type="button",s.className="sf-chat-notice__action",s.textContent=this.words("action.retry"),s.addEventListener("click",this.problem.retry),t.append(s)}this.line.append(t)}redraw(e=null){const t=this.root,s=t.scrollTop;this.draw(),this.drawLeave(),t.scrollTop=s,e&&this.focusIn(e())}focusIn(e){e&&"function"==typeof e.focus&&e.focus({preventScroll:!1})}rowNode(e){return null==e?null:this.body.querySelector(`.chat-members__row[data-id="${CSS.escape(String(e))}"]`)}moreOf(e){return this.rowNode(e)?.querySelector(".chat-members__more")??null}stripNode(){return this.rowNode(this.strip?.id)?.querySelector(".chat-members__strip")??null}}i()}catch(e){i(e)}})},"7fe52c31ba51"(e,t,s){s.d(t,{E:()=>a});const i={"sf-list-feed":{"region-label":"list-region","log-label":"list-label","earlier-text":"list-earlier","loading-earlier-text":"list-loading-earlier","latest-label":"list-latest","you-text":"you"},"sf-chat-threads":{label:"threads-label","create-text":"threads-new","archive-text":"threads-archive","unarchive-text":"threads-unarchive","archive-view":"threads-archive-view","back-text":"threads-back","empty-text":"threads-empty","archive-empty-text":"threads-archive-empty"},"sf-confirm-change":{"changes-label":"proposal-label","before-text":"proposal-was","after-text":"proposal-will","accept-text":"proposal-confirm","decline-text":"proposal-cancel","accepting-text":"proposal-confirming","declining-text":"proposal-cancelling","accepted-text":"proposal-applied","declined-text":"proposal-rejected","expired-text":"proposal-expired","until-text":"proposal-until"}};let n=null;function a(e,t=globalThis.SF?.language){if(!t?.registerAll||n===t)return!1;n=t;for(const[s,n]of Object.entries(e)){const e=n?.runtime??{},a={};for(const[t,s]of Object.entries(i))a[t]=Object.fromEntries(Object.entries(s).filter(([,t])=>"string"==typeof e[t]).map(([t,s])=>[t,e[s]]));t.registerAll(s,a)}return!0}},b224ca2a61ea(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{CJ:()=>g,Eu:()=>w,SK:()=>_,Sm:()=>p,d5:()=>l,gf:()=>u,ky:()=>v,wo:()=>k});var n=s("5b8371b87515"),a=e([n]),r=a.then?(await a)():a;n=r[0];const o=new Set(["assistant","agent","bot"]);function l(e){const t=e?.author?.kind;return o.has(t)?t:"assistant"===e?.kind?"assistant":"person"}const d=e=>String(e.id??e.local?.client_key??""),c=3e5,h=4e3;function u(e,{people:t=!1}={}){const s=(t?Number(e?.message_chars):0)||Number(e?.body_chars);return s>0?s:h}function p(e,{edit:t=!1,remove:s=!1,acting:i=null,reactions:n=!1,reply:a=!1}={}){const r=e.author||{},o=i??(e.local?{clientKey:e.local.client_key,action:e.local.action,state:e.local.state,body:e.local.body??null}:null),l=null!=e.id&&!0!==e.is_deleted&&"pending"!==o?.state,c=!0===e.is_deleted,h={id:d(e),role:"user",template:"person",author:`person:${r.id??""}`,own:!0===r.own,growing:!1,text:c?"":e.body??"",body:c?"":e.body??"",authorName:r.name??"",isEdited:!0===e.is_edited,isDeleted:c,canEdit:t&&l&&!0===e.can_edit,canDelete:s&&l&&!0===e.can_delete,files:c?[]:(e.files||[]).map(e=>({id:e.id,key:e.key,name:e.name,size:e.size??null,state:e.state??"ready",...e.download_url?{downloadUrl:e.download_url}:{}}))},u=r.avatar_url??r.avatar;return u&&(h.authorAvatar=u),n&&!c&&Array.isArray(e.reactions)&&(h.reactions=e.reactions),a&&!c&&e.reply_to&&(h.reply_to=e.reply_to),e.created_at&&(h.createdAt=e.created_at,h.created_at=e.created_at),o&&(h.local=o),h}function m(e,t){if(!e||!t)return!0;const s=new Date(e),i=new Date(t);return!(!Number.isNaN(s.getTime())&&!Number.isNaN(i.getTime()))||s.toDateString()===i.toDateString()&&Math.abs(i-s)<=c}function f(e){if(!e?.created_at)return null;const t=new Date(e.created_at);return Number.isNaN(t.getTime())?null:t}function b(e,{now:t=new Date,locale:s,today:i="",yesterday:a=""}={}){return(0,n.Ou)(e,{now:t,locale:s,today:i||void 0,yesterday:a||void 0,weekday:!1})}function g(e=[],t={}){const s=new Map;let i=null;for(const n of e){const e=f(n);e&&e.toDateString()!==i&&(i=e.toDateString(),s.set(d(n),b(e,t)))}return s}function w(e=[]){for(let t=e.length-1;t>=0;t--){const s=e[t];if("person"===l(s)&&!0===s.author?.own&&!0===s.can_edit&&(!0!==s.is_deleted&&null!=s.id&&"pending"!==s.local?.state))return d(s)}return null}function y(e,t){return Boolean(e&&t)&&"person"===l(e)&&"person"===l(t)&&String(e.author?.id??"")===String(t.author?.id??"")&&!0===e.author?.own==(!0===t.author?.own)&&m(e.created_at,t.created_at)}function v(e=[],{type:t=null,breaks:s=null}={}){const i=new Map;return e.forEach((n,a)=>{if("person"!==l(n))return;const r=e[a+1];i.set(d(n),{first:!y(e[a-1],n)||Boolean(s?.has(d(n))),last:!y(n,r)||Boolean(r&&s?.has(d(r))),showName:"private"!==t&&!0!==n.author?.own})}),i}function _(e=[],t=0){let s=Math.max(0,Math.floor(Number(t)||0)),i=null;for(let t=e.length-1;t>=0&&s>0;t--){const n=e[t];!0!==n.author?.own&&!0!==n.is_deleted&&(i=d(n),s--)}return i}function k(e,t){if(null==e||null==t)return null==e?null==t?0:-1:1;const s=Number(e),i=Number(t);return Number.isFinite(s)&&Number.isFinite(i)?Math.sign(s-i):String(e)===String(t)?0:-1}s.d(t,["TN",0,d]),i()}catch(S){i(S)}})},"7e61c13e3a99"(e,t,s){s.d(t,{TV:()=>o,pP:()=>r,rl:()=>a});const i={"conversation.open":{verb:"open",kind:"conversation",capability:null,former:"chat-port:open"},"history.older":{verb:"load-more",kind:"history",capability:null,former:"chat-port:older"},"message.send":{verb:"submit",kind:null,capability:null,former:"chat-port:send"},"message.retry":{verb:"retry",kind:"message",capability:null,former:"chat-port:retry"},"message.edit":{verb:"save",kind:null,capability:"edit",former:"chat-port:edit"},"message.delete":{verb:"delete",kind:"message",capability:"delete",former:"chat-port:delete"},"message.read":{verb:"read",kind:null,capability:"read",former:"chat-port:read"},"message.rate":{verb:"rate",kind:null,capability:"feedback",former:"chat-port:rate"},"file.retry":{verb:"retry",kind:"file",capability:"files",former:"chat-port:file-retry"},"proposal.decide":{verb:"answer",kind:null,capability:"proposals",former:"chat-port:decide"},"wait.check":{verb:"check",kind:null,capability:"assistant",former:"chat-port:check"},"wait.stop":{verb:"stop",kind:null,capability:"assistant",former:"chat-port:stop"},"conversation.create":{verb:"create",kind:null,capability:"conversation-create",former:"chat-port:create"},"conversation.rename":{verb:"rename",kind:null,capability:"conversation-manage",former:"chat-port:rename"},"conversation.archive":{verb:"archive",kind:null,capability:"conversation-manage",former:"chat-port:archive"},"interlocutor.choose":{verb:"select",kind:null,capability:"interlocutors",former:"chat-port:interlocutor"}},n={"conversations.view":{verb:"open",kind:"list",capability:"x-archive-view",former:"chat-window:view"},"conversations.more":{verb:"load-more",kind:"conversations",capability:"x-conversations-paging",former:"chat-window:more"},"conversations.search":{verb:"query",kind:null,capability:"x-conversations-search",former:"chat-window:search"},"conversation.pin":{verb:"pin",kind:null,capability:"x-conversation-pin",former:"chat-window:pin"},"file.attach":{verb:"attach",kind:null,capability:"x-early-upload",former:"chat-window:attach"},"file.detach":{verb:"detach",kind:null,capability:"x-early-upload",former:"chat-window:detach"},"files.list":{verb:"open",kind:"files",capability:"x-my-files",former:"chat-window:files"},"files.remove":{verb:"delete",kind:"file",capability:"x-my-files",former:"chat-window:file-remove"},"recipients.search":{verb:"query",kind:"recipients",capability:"x-conversation-start",former:null},"conversation.start":{verb:"create",kind:"payload",capability:"x-conversation-start",former:null},"members.list":{verb:"open",kind:"members",capability:"x-members",former:null},"message.reply":{verb:"submit",kind:"reply",capability:"x-reply",former:null},"message.react":{verb:"react",kind:null,capability:"x-reactions",former:null},"member.add":{verb:"apply",kind:"member",capability:"x-members-manage",former:null},"member.remove":{verb:"apply",kind:"member",capability:"x-members-manage",former:null},"member.role":{verb:"apply",kind:"member",capability:"x-members-manage",former:null},"member.transfer":{verb:"apply",kind:"member",capability:"x-members-manage",former:null},"member.leave":{verb:"apply",kind:"member",capability:"x-members-manage",former:null},"thread.open":{verb:"open",kind:"thread",capability:"x-threads",former:null},"block.submit":{verb:"submit",kind:"block",capability:"x-blocks",former:null}};function a(e,t={}){const s=i[e]||n[e];return s?"conversation.archive"===e&&!1===t.archived?"restore":s.verb:""}function r(e,t={}){const s=i[e]||n[e];return s?.kind?"payload"===s.kind?t.kind??null:s.kind:null}function o(e){const t=i[e?.intent]||n[e?.intent];return t?t.former:""}s.d(t,["CY",0,i,"I3",0,["applied","conflict","refused","unavailable"],"O1",0,n,"vN",0,["me","conversations","conversation","messages","history","feed_state","limits","interlocutors","notice"],"vq",0,["conversation_list","composer_files","my_files"],"vs",0,["1.0","1.0.0"]])},"443dc90eea33"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{Iw:()=>d});var n=s("166eba132218"),a=s("32c771fdb2d2"),r=e([n]),o=r.then?(await r)():r;n=o[0];let l=0;class d{constructor(e){this.win=e,this.open=!1,this.source=null,this.opener=null,this.loading=0}get ctx(){return this.win.ctx}get words(){return this.win.words}build(e){const t=this.ctx,s=t.document,i="chat-preview-"+ ++l,a=s.createElement("aside");a.className="chat-shell__preview chat-preview sf-workspace-panel",a.id=i,a.hidden=!0,a.setAttribute("aria-labelledby",`${i}-title`);const r=s.createElement("div");r.className="chat-preview__head";const o=(0,n.gb)(t,{icon:"arrow_back",label:this.words("preview.back"),size:"1"});o.classList.add("chat-preview__back"),o.addEventListener("click",()=>this.win.closePreview());const d=s.createElement("div");d.className="chat-preview__titles";const c=s.createElement("h1"===e?"h2":"h3");c.className="chat-preview__title",c.id=`${i}-title`,c.tabIndex=-1;const h=s.createElement("p");h.className="chat-preview__meta",d.append(c,h);const u=s.createElement("a");u.className="sf-icon-button sf-icon-button--size-1 sf-icon-button--icon sf-icon-button--link sf-icon-button--on-surface flex items-cross-center content-main-center chat-preview__tab",u.target="_blank",u.rel="noopener",u.setAttribute("aria-label",this.words("preview.newTab")),u.title=this.words("preview.newTab"),u.append((0,n.yI)(t,"open_in_new","","2"));const p=(0,n.gb)(t,{icon:"close",label:this.words("preview.close"),size:"1"});p.classList.add("chat-preview__close"),p.addEventListener("click",()=>this.win.closePreview()),r.append(o,d,u,p);const m=s.createElement("div");m.className="chat-preview__body",m.tabIndex=0,m.setAttribute("role","region"),m.setAttribute("aria-labelledby",`${i}-title`);const f=s.createElement("p");return f.className="sf-chat-offscreen",f.setAttribute("role","status"),f.setAttribute("aria-live","polite"),a.append(r,m,f),a.addEventListener("keydown",e=>{"Escape"!==e.key||e.defaultPrevented||this.win.panelDrawer||(e.preventDefault(),e.stopPropagation(),this.win.closePreview())}),Object.assign(this,{root:a,head:r,back:o,title:c,meta:h,tab:u,close:p,body:m,status:f}),this}frameScroll(){try{return this.frame?.contentWindow?.scrollY??null}catch{return null}}loadDocument(){const e=this.source,t=++this.loading,s=this.ctx.document,i=this.keepScroll;this.body.setAttribute("aria-busy","true");const a=[];if(e.downloads.length||e.missing.length){const t=s.createElement("div");t.className="chat-preview__bar",e.missing.length&&t.append((0,n.Qq)(this.ctx,"p","chat-preview__hint",this.words("document.hint")));for(const i of e.downloads){const e=s.createElement("a");e.className="sf-button sf-button--size-1/2 sf-button--outline sf-button--primary flex items-cross-center content-main-center chat-preview__download",e.href=i.href,e.setAttribute("download",""),e.dataset.format=i.format,e.append((0,n.yI)(this.ctx,"download","","1"),(0,n.Qq)(this.ctx,"span","sf-button-text-container",i.label)),t.append(e)}a.push(t)}const r=s.createElement("iframe");r.className="chat-preview__frame chat-preview__frame--document",r.title=e.title||this.words("document.untitled"),r.setAttribute("sandbox","allow-same-origin"),r.setAttribute("referrerpolicy","same-origin"),r.addEventListener("load",()=>{if(t===this.loading&&this.open&&(this.body.setAttribute("aria-busy","false"),this.wireMarks(r,e),i))try{r.contentWindow.scrollTo(0,i)}catch{}},{once:!0}),r.src=e.preview_url,a.push(r),this.frame=r,this.body.replaceChildren(...a),this.say(this.words("document.opened",{title:this.title.textContent}))}wireMarks(e,t){let s=null;try{s=e.contentDocument}catch{s=null}if(!s?.body)return;const i=s.createElement("style");i.textContent="mark[data-field]{cursor:pointer}mark[data-field]:hover{box-shadow:0 0 0 2px #e0b400}mark[data-field]:focus-visible{outline:2px solid #1a5fd0;outline-offset:2px}",s.head?.append(i);const n=new Map(t.missing.map(e=>[e.field,e]));for(const e of s.querySelectorAll("mark[data-field]")){const t=e.getAttribute("data-field");if(!t)continue;const s=n.get(t);e.tabIndex=0,e.setAttribute("role","button"),e.title=this.words("document.fillField",{label:s?.label||e.textContent.trim()})}const a=e=>{const s=e.target?.closest?.("mark[data-field]");if(!s)return;if("keydown"===e.type&&"Enter"!==e.key&&" "!==e.key)return;e.preventDefault();const i=s.getAttribute("data-field");this.win.focusDocumentField(t,n.get(i)?.block??t.form_block,i)};s.addEventListener("click",a),s.addEventListener("keydown",a)}say(e){this.status.textContent="",requestAnimationFrame(()=>{this.status.textContent=e})}targetOf(e){return e&&"object"==typeof e?"document"===e.kind?g(e,this.ctx.document):(0,a.sI)(e,{n:e.n??null,kind:e.kind||"",title:e.title||e.name||"",href:e.href||null},this.ctx.document):null}show(e){const t="document"===e.kind&&"document"===this.source?.kind&&this.source.document_id===e.document_id;if(this.keepScroll=t?this.frameScroll():null,this.source=e,this.root.classList.toggle("chat-preview--document","document"===e.kind),"document"===e.kind)return this.title.textContent=e.title||this.words("document.untitled"),this.meta.textContent=w(this.words,e),this.meta.hidden=!this.meta.textContent,this.tab.href=e.preview_url,this.loadDocument();this.title.textContent=e.title||this.words("preview.untitled");const s=e.kind&&["base","my_base","web","file"].includes(e.kind)?this.words(`preview.kind.${e.kind}`):"";return this.meta.textContent=[null!=e.n?this.words("preview.number",{n:e.n}):"",s].filter(Boolean).join(" · "),this.meta.hidden=!this.meta.textContent,this.tab.href=e.preview_url,this.load()}async load(){const e=this.source,t=++this.loading,s=this.ctx.document;this.body.setAttribute("aria-busy","true"),this.body.replaceChildren((0,n.Qq)(this.ctx,"p","chat-preview__note",this.words("preview.loading")));const i=e=>"application/pdf"===e;let a=e.mime,r=null,o=!1;if(!i(a))try{const t=await s.defaultView.fetch(e.preview_url,{credentials:"same-origin",headers:{Accept:"text/html, text/plain;q=0.9, */*;q=0.1"}});if(!t.ok)throw new Error(String(t.status));a||=String(t.headers.get("content-type")||"").split(";")[0].trim().toLowerCase(),i(a)||(r=await t.text())}catch{o=!0}if(t!==this.loading||!this.open)return;if(this.body.setAttribute("aria-busy","false"),o){const e=(0,n.uX)(this.ctx,{label:this.words("preview.retry"),appearance:"outline",scheme:"primary",size:"1/2",className:"chat-preview__retry"});e.addEventListener("click",()=>this.load());const t=s.createElement("div");return t.className="chat-preview__problem",t.setAttribute("role","alert"),t.append((0,n.Qq)(this.ctx,"p","chat-preview__note",this.words("preview.error")),e),void this.body.replaceChildren(t)}if(i(a)){const t=s.createElement("iframe");return t.className="chat-preview__frame",t.title=e.title||this.words("preview.untitled"),t.src=e.locator?.page?`${e.preview_url.split("#")[0]}#page=${e.locator.page}`:e.preview_url,t.setAttribute("referrerpolicy","same-origin"),this.body.replaceChildren(t),void this.say(this.words("preview.opened",{title:this.title.textContent}))}if(!a||a.includes("html")){const t=s.createElement("div");t.className="sf-chat-markup chat-preview__text";const i=void 0===e.locator?.from?p(r??"",u(e.preview_url,s),s):null;return t.append(globalThis.SF.sanitizeHtml(i??r??"",{document:s})),this.body.replaceChildren(t),void this.mark(t,i?m(t,s):e.locator)}if(a.startsWith("text/")){const t=(0,n.Qq)(this.ctx,"div","chat-preview__text chat-preview__plain",r??"");return this.body.replaceChildren(t),void this.mark(t,e.locator)}const l=s.createElement("div");l.className="chat-preview__problem",l.append((0,n.Qq)(this.ctx,"p","chat-preview__note",this.words("preview.unsupported"))),this.body.replaceChildren(l),this.say(this.words("preview.unsupported"))}mark(e,t){const s=this.words("preview.opened",{title:this.title.textContent});if(!t||!Number.isInteger(t.from)||!Number.isInteger(t.to))return void this.say(s);const i=this.ctx.document,n=i.createTreeWalker(e,4),a=[];let r=0;for(let e=n.nextNode();e;e=n.nextNode()){const s=r,i=r+e.data.length;if(r=i,!(i<=t.from)){if(s>=t.to)break;a.push({node:e,from:Math.max(0,t.from-s),to:Math.min(e.data.length,t.to-s)})}}const o=[];for(const e of a){if(e.to<=e.from)continue;let t=e.node;e.from>0&&(t=t.splitText(e.from)),e.to-e.from<t.data.length&&t.splitText(e.to-e.from);const s=i.createElement("mark");s.className="chat-preview__mark",t.replaceWith(s),s.append(t),o.push(s)}if(!o.length)return void this.say(s);o[0].classList.add("chat-preview__mark--first");for(const t of[...e.querySelectorAll("mark:not(.chat-preview__mark)")])t.querySelector(".chat-preview__mark")&&t.replaceWith(...t.childNodes);const l=i.defaultView.matchMedia?.("(prefers-reduced-motion: reduce)").matches;requestAnimationFrame(()=>o[0].scrollIntoView({block:"center",behavior:l?"auto":"smooth"})),this.say(`${s}. ${this.words("preview.marked")}`)}clear(){this.loading++,this.source=null,this.frame=null,this.root.classList.remove("chat-preview--document"),this.body.replaceChildren(),this.title.textContent="",this.meta.textContent="",this.tab.removeAttribute("href")}}const c="",h="";function u(e,t){if("string"!=typeof e||!e.includes("#"))return"";try{return decodeURIComponent(new URL(e,t?.baseURI||"http://localhost/").hash.slice(1))}catch{return""}}function p(e,t,s){if(!t||!e||"function"!=typeof s?.defaultView?.DOMParser)return null;const i=(new s.defaultView.DOMParser).parseFromString(e,"text/html"),n=i.getElementById(t);return n&&n.textContent.trim()?(n.prepend(i.createTextNode(c)),n.append(i.createTextNode(h)),`<!doctype html>${i.documentElement.outerHTML}`):null}function m(e,t){const s=t.createTreeWalker(e,4);let i=0,n=null,a=null;for(let e=s.nextNode();e;e=s.nextNode()){if(!e.data.includes(c)&&!e.data.includes(h)){i+=e.data.length;continue}let t="";for(const s of e.data)s!==c?s!==h?t+=s:a=i+t.length:null===n&&(n=i+t.length);e.data=t,i+=t.length}return null!==n&&null!==a&&a>n?{from:n,to:a}:null}const f=new Set(["draft","ready","saved"]),b=e=>"string"==typeof e?e.trim():"";function g(e,t){const s=y(e.preview_url,t);return s&&b(String(e.document_id??""))?{kind:"document",id:String(e.id??e.document_id),message_id:null==e.message_id?null:String(e.message_id),document_id:String(e.document_id),title:b(e.title),revision:e.revision??null,state:f.has(e.state)?e.state:"draft",preview_url:s,form_block:null==e.form_block?null:String(e.form_block),downloads:(Array.isArray(e.downloads)?e.downloads:[]).map(e=>({format:b(e?.format),label:b(e?.label)||b(e?.format).toUpperCase(),href:y(e?.href??e?.url,t)})).filter(e=>e.href&&e.label),missing:(Array.isArray(e.missing)?e.missing:[]).filter(e=>b(e?.field)).map(e=>({field:b(e.field),label:b(e.label)||b(e.field),block:null==e.block?null:String(e.block)}))}:null}function w(e,t){return[e(`document.${t.state}`),t.missing.length?e("document.missing",{count:t.missing.length,n:t.missing.length}):""].filter(Boolean).join(" · ")}const y=(e,t)=>(0,a.ug)(e,t);i()}catch(v){i(v)}})},"5d717d8e5251"(e,t,s){s.d(t,{XW:()=>p,ah:()=>u,QJ:()=>o,u9:()=>b,bB:()=>l,TL:()=>f,T:()=>d,hz:()=>c,pq:()=>h});const i=new Set(["а","без","в","во","для","до","за","из","из-за","из-под","и","к","ко","между","на","над","о","об","от","по","под","при","про","с","со","у","через","the","a","an","and","for","from","in","of","on","to"]);function n(e){const t=globalThis.Intl?.Segmenter;if("function"==typeof t){for(const{segment:s}of new t(void 0,{granularity:"grapheme"}).segment(e))return s;return""}return Array.from(e)[0]||""}function a(e="",t={}){const{maxLetters:s=2,skipWords:a=i,fallback:r="",locale:o}=t,l=function(e=""){return String(e||"").trim().split(/[\s/|]+/).map(e=>e.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu,"")).filter(Boolean)}(e);let d=l.filter((e,t)=>0===t||!a.has(String(e).toLowerCase()));if(1===d.length){const e=d[0].split(/[-\u2010-\u2015]+/u).filter(Boolean);e.length>1&&(d=e)}if(!d.length)return String(r);const c=d.length>1?d.slice(0,Math.max(1,s)).map(n).join(""):n(d[0]);return(o?c.toLocaleUpperCase(o):c.toUpperCase())||String(r)}const r=Object.freeze({title_chars:120,members_max:49,search_min:2,search_max:20,query_chars:80});function o(e){const t=e&&"object"==typeof e?e:{},s=e=>{const s=Math.trunc(Number(t[e]));return Number.isFinite(s)&&s>0?s:r[e]};return Object.fromEntries(Object.keys(r).map(e=>[e,s(e)]))}const l=e=>a(e);function d(e){const t=String(e?.name??""),s=l(t);return{value:e?.id,label:t,...s?{avatar:{initials:s}}:{}}}function c(e,t=r){if("refused"===e?.answer&&"access-denied"===e.reason)return{state:"denied"};if("applied"!==e?.answer)return{state:"failed",reason:e?.reason??null};const s=Array.isArray(e.data?.items)?e.data.items:[];return{state:"items",items:s.filter(e=>e&&null!==e.id&&void 0!==e.id).map(d),truncated:s.length>=t.search_max}}function h(e){if("applied"===e?.answer)return"opened";const t=e?.reason??null;return"prevented"===t||"superseded"===t?"silent":"conflict"===e?.answer||"conflict"===t?"conflict":"refused"===e?.answer&&"access-denied"===t?"denied":"refused"===e?.answer&&"invalid-recipient"===t?"recipient":"refused"===e?.answer&&"invalid-group"===t?"group":"retry"}function u({title:e="",members:t=[]}={},s=r){const i=String(e).trim();return{title:i?[...i].length>s.title_chars?"long":"":"required",members:t.length?"":"required"}}class p{constructor(e){this.mint=e,this.key=null,this.form=null}take(e,t){const s=JSON.stringify([e,t]);return this.key&&this.form===s||(this.key=this.mint(),this.form=s),this.key}reset(){this.key=null,this.form=null}}const m=Object.freeze(["owner","manager","member","observer"]),f=e=>{return{id:e?.id,name:String(e?.name??""),role:(t=e?.role,m.includes(t)?`members.role.${t}`:"")};var t},b=e=>"group"===e||"channel"===e},"240f6601a5f5"(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{E:()=>h});var n=s("166eba132218"),a=s("5d717d8e5251"),r=e([n]),o=r.then?(await r)():r;n=o[0];let l=0;const d=3e4,c=(...e)=>Promise.all(e.map(e=>customElements.whenDefined(e)));class h{constructor(e,t){this.win=e,this.mintKey=t,this.open=!1,this.form=null,this.opener=null}get ctx(){return this.win.ctx}get words(){return this.win.words}build(e){const t=this.ctx.document,s="chat-start-"+ ++l,i=t.createElement("section");i.className="chat-start",i.id=s,i.hidden=!0,i.setAttribute("aria-labelledby",`${s}-title`);const a=t.createElement("div");a.className="chat-start__head";const r=(0,n.gb)(this.ctx,{icon:"arrow_back",label:this.words("start.back"),size:"1",className:"chat-start__back"});r.addEventListener("click",()=>this.leave());const o=t.createElement(e);o.className="chat-start__title",o.id=`${s}-title`,o.tabIndex=-1,a.append(r,o);const d=t.createElement("div");d.className="chat-start__body";const c=t.createElement("p");return c.className="sf-chat-offscreen",c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),i.append(a,d,c),i.addEventListener("keydown",e=>{"Escape"!==e.key||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),this.leave())}),Object.assign(this,{root:i,back:r,title:o,body:d,status:c}),this}leave(){this.form?.sending||this.win.closeStart()}say(e){this.status.textContent="",requestAnimationFrame(()=>{this.status.textContent=e})}show(e){const t=this.ctx.document,s=this.words,i=(0,a.QJ)(this.win._data.limits?.group),n="group"===e,r=globalThis.matchMedia?.("(pointer: coarse)").matches?"2":"1",o={kind:e,sending:!1,done:!1,key:new a.XW(this.mintKey),limits:i,denied:!1};this.form=o,this.title.textContent=s(n?"start.group":"start.private");const l=t.createElement("form");l.className="chat-start__form",l.noValidate=!0,l.addEventListener("submit",e=>{e.preventDefault(),n&&this.submit()});const d=[];if(n){o.field=t.createElement("sf-input"),o.field.className="chat-start__name";for(const[e,t]of Object.entries({size:r,label:s("start.name"),maxlength:String(i.title_chars),autocomplete:"off"}))o.field.setAttribute(e,t);o.field.toggleAttribute("required",!0),o.field.addEventListener("input",()=>this.markName("")),d.push(o.field)}const h=t.createElement("sf-input-lookup");h.className="chat-start__people";for(const[e,t]of Object.entries({size:r,label:s(n?"start.members":"start.person"),placeholder:s("start.placeholder"),"min-length":String(i.search_min),"max-results":String(i.search_max),maxlength:String(i.query_chars)}))h.setAttribute(e,t);if(n&&(h.toggleAttribute("multiple",!0),h.toggleAttribute("required",!0),h.setAttribute("max-items",String(i.members_max))),h.addEventListener("change",e=>this.chosen(o,e.detail)),o.lookup=h,d.push(h),o.line=t.createElement("div"),o.line.className="chat-start__line",o.quiet=t.createElement("p"),o.quiet.className="chat-start__quiet",o.quiet.hidden=!0,d.push(o.line,o.quiet),n){const e=t.createElement("div");e.className="chat-start__actions",o.create=t.createElement("sf-button"),o.create.className="chat-start__create",o.create.setAttribute("size",r),o.create.setAttribute("native-type","submit"),o.create.setAttribute("text",s("start.create")),e.append(o.create),d.push(e)}l.append(...d),this.body.replaceChildren(l);c(...n?["sf-input-lookup","sf-input","sf-button"]:["sf-input-lookup"]).then(()=>{if(this.form!==o)return;customElements.upgrade(l),h.provider=(e,t)=>this.search(o,e,t);const e=this.win._data.me?.id;h.exclude=null==e?[]:[e];const s=t.activeElement;s!==this.title&&s!==t.body&&s||this.focusField(o.field??h)})}focusField(e){this.win.afterDraw(()=>e.querySelector("input"),e=>e?.focus())}clear(){this.form=null,this.body.replaceChildren()}async search(e,t,{signal:s}={}){const i=await this.win.request("recipients.search",{query:t});if(s?.aborted||this.form!==e)return{items:[]};const n=(0,a.hz)(i,e.limits);if("denied"===n.state)return e.denied=!0,this.showLine(e,this.words("start.denied")),e.lookup.close(),{status:"unavailable"};if("failed"===n.state){if("prevented"===i?.reason)return{status:"unavailable"};throw new Error("recipients.search")}return e.denied&&(e.denied=!1,this.showLine(e,"")),n.truncated?{items:n.items,notice:this.win.sfWord("start-truncated",{count:e.limits.search_max})}:{items:n.items}}chosen(e,{action:t,value:s}={}){this.form===e&&("group"!==e.kind?(this.showLine(e,""),"removed"!==t&&s&&this.sendPrivate(e)):this.markMembers(""))}sendPrivate(e){const t=e.lookup.value;!e.sending&&t&&(e.person=t,this.send(e,{kind:"private",user_id:t.value}))}submit(){const e=this.form;if(!e||"group"!==e.kind||e.sending)return;const t=String(e.field.value??"").trim(),s=e.lookup.value||[],i=(0,a.ah)({title:t,members:s},e.limits);if(this.markName("required"===i.title?this.words("start.nameRequired"):"long"===i.title?this.win.sfWord("start-name-long",{count:e.limits.title_chars}):""),this.markMembers(i.members?this.words("start.membersRequired"):""),i.title||i.members)return void this.focusField(i.title?e.field:e.lookup);const n=s.map(e=>e.value);this.send(e,{kind:"group",title:t,member_ids:n,client_key:e.key.take(t,n)})}async send(e,t){e.sending=!0,this.showLine(e,""),this.drawBusy(e);let s=0,i=!1;const n=this.win.request("conversation.start",t),r=await Promise.race([n,new Promise(e=>{s=setTimeout(()=>{i=!0,e({answer:"unavailable",reason:"no-answer"})},d)})]);if(clearTimeout(s),i&&n.then(t=>{this.form!==e||e.sending||e.done||"opened"!==(0,a.pq)(t)||this.opened(e,t)}),this.form!==e)return;const o=(0,a.pq)(r);"opened"!==o?(e.sending=!1,this.drawBusy(e),this.refused(e,o)):this.opened(e,r)}opened(e,t){e.done=!0,this.win.startAnswered(t,{person:"private"===e.kind?e.person:null})}refused(e,t){const s=this.words,i="group"===e.kind;"silent"!==t&&("denied"===t?(this.showLine(e,s("start.denied")),this.focusField(e.field??e.lookup)):"recipient"===t&&i?(this.markMembers(s("start.recipientGroup")),this.focusField(e.lookup)):"recipient"===t?(this.showLine(e,s("start.recipient")),this.focusField(e.lookup)):"group"===t&&i?(this.markName(s("start.groupInvalid")),this.focusField(e.field)):"conflict"===t&&i?(e.key.reset(),this.showLine(e,s("start.conflict")),this.focusField(e.field)):(this.showLine(e,s(i?"start.groupFailed":"start.privateFailed"),()=>i?this.submit():this.sendPrivate(e)),e.line.querySelector("button")?.focus()))}drawBusy(e){const{sending:t,lookup:s,field:i,create:n,quiet:a,kind:r}=e;this.back.disabled=t,s.toggleAttribute("readonly",t),i?.toggleAttribute("readonly",t),n?.toggleAttribute("loading",t),"private"===r&&(a.hidden=!t,a.textContent=t?this.words("start.opening"):"")}showLine(e,t,s){const i=this.ctx.document;if(e.line.replaceChildren(),!t)return;const n=i.createElement("div");n.className="sf-chat-notice sf-chat-notice--failed chat-start__problem",n.setAttribute("role","alert");const a=i.createElement("p");if(a.className="sf-chat-notice__text",a.textContent=t,n.append(a),s){const e=i.createElement("button");e.type="button",e.className="sf-chat-notice__action",e.textContent=this.words("action.retry"),e.addEventListener("click",s),n.append(e)}e.line.append(n)}markName(e){this.mark(this.form?.field,e)}markMembers(e){this.mark(this.form?.lookup,e)}mark(e,t){e&&(e.toggleAttribute("invalid",Boolean(t)),t?e.setAttribute("error-message",t):e.removeAttribute("error-message"))}}i()}catch(e){i(e)}})},ee12251d3680(e,t,s){s.a(e,async(e,i)=>{try{s.d(t,{r:()=>o});var n=s("2a080a730149"),a=e([n]),r=a.then?(await a)():a;n=r[0];function o(e){return n.html`${e.node??n.nothing}`}i()}catch(l){i(l)}})},"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}))},"18003344cff0"(e){e.exports=globalThis.SF&&globalThis.SF.runtimeModule?globalThis.SF.runtimeModule("layer-stack",1):new Promise((e,t)=>globalThis.addEventListener("sf-runtime-ready",()=>globalThis.SF.runtimeModule("layer-stack",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}))},c8da50be6e6c(e){e.exports=JSON.parse('{"$comment":"Dated aliases of sf-chat-window for the shim (core/js/aliases.js, standard §16 item 20). The 0.3 window raised each port intent as chat-port:<name> and each window capability as chat-window:<name>, with {request_id, ...payload}; 1.0 raises one event per verb, sf-chat-window-<verb> {request-id, intent, kind, payload} (vocabulary 1.1.5 §5, §5.1), so every row is split, sent only when the detail\'s intent is the one the old name stood for (when, since a verb carries several old names), and the element adapter (sfAliasAdapters) makes its 0.3 detail. sf-chat-window-answer became the fact settled.","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","aliases":[{"from":"chat-port:open","to":"sf-chat-window-open","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent conversation.open: open {kind: conversation} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversation.open"}},{"from":"chat-port:older","to":"sf-chat-window-load-more","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent history.older: load-more {kind: history} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"history.older"}},{"from":"chat-port:send","to":"sf-chat-window-submit","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent message.send: submit {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"message.send"}},{"from":"chat-port:retry","to":"sf-chat-window-retry","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent message.retry: retry {kind: message} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"message.retry"}},{"from":"chat-port:edit","to":"sf-chat-window-save","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent message.edit: save {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"message.edit"}},{"from":"chat-port:delete","to":"sf-chat-window-delete","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent message.delete: delete {kind: message} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"message.delete"}},{"from":"chat-port:read","to":"sf-chat-window-read","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent message.read: read {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"message.read"}},{"from":"chat-port:rate","to":"sf-chat-window-rate","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent message.rate: rate {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"message.rate"}},{"from":"chat-port:file-retry","to":"sf-chat-window-retry","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent file.retry: retry {kind: file} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"file.retry"}},{"from":"chat-port:decide","to":"sf-chat-window-answer","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent proposal.decide: answer {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"proposal.decide"}},{"from":"chat-port:check","to":"sf-chat-window-check","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent wait.check: check {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"wait.check"}},{"from":"chat-port:stop","to":"sf-chat-window-stop","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent wait.stop: stop {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"wait.stop"}},{"from":"chat-port:create","to":"sf-chat-window-create","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent conversation.create: create {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversation.create"}},{"from":"chat-port:rename","to":"sf-chat-window-rename","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent conversation.rename: rename {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversation.rename"}},{"from":"chat-port:archive","to":"sf-chat-window-archive","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent conversation.archive: archive {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversation.archive"}},{"from":"chat-port:archive","to":"sf-chat-window-restore","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent conversation.archive with archived false: restore {request-id, intent, payload}; the 0.3 detail {request_id, conversation_id, archived: false} is made by the element adapter","when":{"intent":"conversation.archive"}},{"from":"chat-port:interlocutor","to":"sf-chat-window-select","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the port intent interlocutor.choose: select {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"interlocutor.choose"}},{"from":"chat-window:view","to":"sf-chat-window-open","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-archive-view, conversations.view: open {kind: list} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversations.view"}},{"from":"chat-window:more","to":"sf-chat-window-load-more","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-conversations-paging, conversations.more: load-more {kind: conversations} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversations.more"}},{"from":"chat-window:search","to":"sf-chat-window-query","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-conversations-search, conversations.search: query {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversations.search"}},{"from":"chat-window:pin","to":"sf-chat-window-pin","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-conversation-pin, conversation.pin: pin {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"conversation.pin"}},{"from":"chat-window:attach","to":"sf-chat-window-attach","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-early-upload, file.attach: attach {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"file.attach"}},{"from":"chat-window:detach","to":"sf-chat-window-detach","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-early-upload, file.detach: detach {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"file.detach"}},{"from":"chat-window:files","to":"sf-chat-window-open","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-my-files, files.list: open {kind: files} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"files.list"}},{"from":"chat-window:file-remove","to":"sf-chat-window-delete","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":true,"section":"§8, §4.9, vocabulary 1.1.5 §5, §5.1, §9","note":"the window capability x-my-files, files.remove: delete {kind: file} {request-id, intent, payload}; the 0.3 detail {request_id, ...payload} is made by the element adapter (sfAliasAdapters) for this intent only","when":{"intent":"files.remove"}},{"from":"sf-chat-window-answer","to":"sf-chat-window-settled","kind":"event","component":"sf-chat-window","since":"2026-10-28","remove_after":"2026-12-01","mode":"split","cancelable":false,"section":"§8, vocabulary 1.1.5 §5 settle","note":"the fact of a host answer: settled {request-id, intent, payload, answer, reason}; the 0.3 detail {request_id, intent, payload, answer, reason} is made by the element adapter"}]}')},d90b68919aff(e){e.exports=JSON.parse('{"id":"smart.chat-window","tag":"sf-chat-window","version":"1.14.3","kind":"leaf","settings":{"capabilities":{"type":"string","default":""},"landmark":{"type":"enum","values":["main","section"],"default":"main"},"heading-level":{"type":"number","integer":true,"min":1,"max":2,"default":1},"embedded":{"type":"boolean","default":false},"no-queue":{"type":"boolean","default":false},"me":{"type":"object","optional":true,"nullable":true},"conversations":{"type":"list","default":[]},"conversation":{"type":"object","optional":true,"nullable":true},"messages":{"type":"list","default":[]},"history":{"type":"object","default":{"has_older":false}},"feed-state":{"type":"enum","values":["ready","loading","revoked"],"default":"ready"},"limits":{"type":"object","default":{}},"interlocutors":{"type":"list","default":[]},"notice":{"type":"object","optional":true,"nullable":true},"conversation-list":{"type":"object","default":{"archived":false,"has_more":false,"loading":false}},"composer-files":{"type":"list","default":[]},"my-files":{"type":"object","optional":true,"nullable":true}},"values":{},"events":{"open":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"load-more":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"submit":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"retry":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"save":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"delete":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"read":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"rate":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"answer":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"check":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"stop":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"create":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"rename":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"archive":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"restore":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"select":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"query":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"pin":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true,"own-verb":true},"attach":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"detach":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true},"settled":{"carries":{"request-id":"string","intent":"string","payload":"object","answer":{"type":"enum","values":["applied","conflict","refused","unavailable"]},"reason":{"type":"string","nullable":true,"optional":true}}},"toggle":{"carries":{"kind":{"type":"enum","values":["find","preview","start","members"]},"open":"boolean","form":{"type":"enum","values":["private","group"],"optional":true}}},"react":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true,"own-verb":true},"apply":{"carries":{"request-id":"string","intent":{"type":"string"},"kind":{"type":"string","optional":true},"payload":{"type":"object"}},"cancelable":true,"own-verb":true}},"actions":{"set-data":{"with":{"data":"object"}},"settle":{"with":{"request-id":"string","result":"object"}},"start-conversation":{},"open-conversation":{"with":{"id":"id"}},"focus-composer":{},"open-files":{},"close-files":{"with":{"focus":{"type":"boolean","optional":true}}},"set-list-footer":{"with":{"node":{"type":"object","nullable":true}}},"open-find":{"with":{"query":{"type":"string","optional":true}}},"close-find":{"with":{"focus":{"type":"boolean","optional":true}}},"open-preview":{"with":{"source":{"type":"object"}}},"close-preview":{"with":{"focus":{"type":"boolean","optional":true}}},"open-start":{"with":{"kind":{"type":"enum","values":["private","group"],"optional":true}}},"close-start":{"with":{"focus":{"type":"boolean","optional":true}}},"open-members":{},"close-members":{"with":{"focus":{"type":"boolean","optional":true}}}},"port":{"id":"simai.chat-port","version":"1.0.0","contract":"src/core/contracts/ports/simai.chat-port/1.0.0/port.json"},"presentation":{"skeleton":{"late":[]}},"host-states":{"data-find-open":"boolean","data-preview-open":"boolean","data-start-open":"boolean","data-members-open":"boolean"},"css-variables":{"--sf-chat-window-side-width":{"type":"length","state":"default"},"--sf-chat-window-side-color":{"type":"color","state":"default"},"--sf-chat-window-width":{"type":"length","state":"default"},"--sf-chat-window-text-color":{"type":"color","state":"default"},"--sf-chat-window-muted-color":{"type":"color","state":"default"},"--sf-chat-window-border-color":{"type":"color","state":"default"}}}')},e409dce80db2(e){e.exports=JSON.parse('{"title":"Chat window","runtime":{"action-retry":"Try again","action-thanks":"Thanks for the feedback","empty-suggestions":"Example questions","empty-unselected":"Pick a conversation on the left, or start a new one","error-load":"Could not load. Check the connection and try again.","feedback-sent":"Thanks, noted","files-back":"Back to the conversation","files-cancel":"Cancel","files-count":"Files: {count}","files-delete":"Delete","files-delete-ask":"Delete the file “{name}”? What was saved from it into your base stays.","files-delete-label":"Delete {name}","files-deleted":"File “{name}” deleted","files-deleting":"Deleting…","files-download":"Download","files-download-label":"Download {name}","files-empty":"No files yet","files-empty-text":"Files you attach to a question to the assistant will appear here","files-entry":"My files","files-error":"Could not load the files","files-loading":"Loading files","files-saved":"Saved to your base","files-title":"My files","files-usage":"Space for your files","files-used":"{used} of {quota} used","find-close":"Close the search","find-count":"{index} of {count}","find-label":"Search in the conversation","find-next":"Next match","find-none":"Nothing found","find-placeholder":"Find in the conversation","find-previous":"Previous match","list-answered":"Answer ready","list-earlier":"Show earlier messages","list-label":"Messages","list-latest":"To the latest message","list-loading-earlier":"Loading earlier messages","list-region":"Conversation","members-actions":"Actions: {name}","members-add":"Add","members-add-done":"Done","members-add-invalid":"This person cannot be added","members-add-label":"Who to add","members-add-warning":"A new member sees the whole conversation, not only from today.","members-added":"In the group: {name}","members-ask-leave":"Leave the group?","members-ask-remove":"Remove from the group?","members-ask-transfer":"Hand the group over?","members-back":"Back","members-cancel":"Cancel","members-count":{"one":"{n} member","other":"{n} members"},"members-denied":"The member list is unavailable","members-denied-action":"Not available","members-failed":"Could not load the members","members-failed-action":"That did not work","members-full":"The group already has 500 people","members-leave":"Leave","members-leave-owner":"Hand the group over first","members-left":"You left the group","members-loading":"Loading members","members-open":"Members","members-remove":"Remove","members-removed":"Removed from the group: {name}","members-role-change":"Role","members-role-changed":"Role changed","members-role-manager":"Manager","members-role-member":"Member","members-role-observer":"Observer","members-role-owner":"Owner","members-then-leave":"You lose access to the conversation and its files.","members-then-remove":"They lose access to the conversation and its files.","members-then-transfer":"You become a member and no longer manage it.","members-transfer":"Hand over","members-transferred":"Ownership handed over","members-yes-leave":"Leave","members-yes-remove":"Remove","members-yes-transfer":"Hand over","people-conflict":"Someone has already changed this message","people-conflict-deleted":"Someone has already deleted this message","people-placeholder":"Write a message","people-today":"Today","people-yesterday":"Yesterday","preview-back":"Back","preview-close":"Close preview","preview-error":"Could not load the source","preview-kind-base":"Knowledge base","preview-kind-file":"File","preview-kind-my-base":"My knowledge base","preview-kind-web":"Website","preview-loading":"Loading…","preview-marked":"The passage is highlighted","preview-new-tab":"Open in a new tab","preview-number":"Source {n}","preview-opened":"Preview open: {title}","preview-retry":"Retry","preview-unsupported":"This file cannot be shown here. Open it in a new tab.","preview-untitled":"Source","proposal-applied":"Applied","proposal-cancel":"Cancel","proposal-cancelling":"Cancelling…","proposal-confirm":"Confirm","proposal-confirming":"Applying…","proposal-expired":"The confirmation has expired. Ask for the change again.","proposal-label":"What will change","proposal-rejected":"Cancelled","proposal-until":"Confirm by {time}","proposal-was":"Was","proposal-will":"Will be","queue-added":"The question will be sent after the answer","queue-edit":"Edit","queue-held-failed":"Not sent: the answer ended with an error","queue-held-left":"Not sent: the conversation was left before the answer","queue-held-limit":"Not sent: the limit is used up","queue-held-refused":"Not sent: the answer was a refusal","queue-held-stopped":"Not sent: waiting was stopped","queue-held-unfinished":"Not sent: the answer is not ready yet","queue-held-unsent":"Not sent: the message did not go through","queue-label":"Will send after the answer","queue-remove":"Remove","queue-send":"Send","queue-unsent":"Not sent","reactions-refused":"The reaction could not be saved","reply-cancel":"Do not reply","reply-label":"Replying to a message","reply-say":"Replying to: {name}","reply-you":"You","size-b":"{n} B","size-gb":"{n} GB","size-kb":"{n} KB","size-mb":"{n} MB","stage-acting":"Working on it","stage-checking":"Checking","stage-queued":"Your question is queued","stage-searching":"Searching the knowledge base","stage-writing":"Writing the answer","start-back":"Back","start-conflict":"The form changed after it was sent. Check the name and members and press Create again.","start-create":"Create","start-denied":"Creation is unavailable","start-group":"New group","start-group-failed":"Could not create the group","start-group-invalid":"Check the group\'s name and members","start-members":"Members","start-members-required":"Choose at least one person","start-name":"Name","start-name-long":{"one":"No more than {n} character","other":"No more than {n} characters"},"start-name-required":"Enter a name","start-opening":"Opening…","start-person":"Who to write to","start-placeholder":"Person\'s name","start-private":"New chat","start-private-failed":"Could not open the chat","start-recipient":"This person cannot be written to","start-recipient-group":"Someone chosen cannot be written to. Remove them and try again.","start-truncated":"Showing the first {n}. Narrow your search.","status-delayed":"The answer is taking longer than usual","status-network":"No connection. Check your internet.","status-partial":"Answer with a caveat","status-stopped":"Stopped waiting. The answer may still arrive later.","steps-say":"Step {n}: {label}","steps-say-failed":"Failed: {label}","thread-back":"Back to chat","thread-root-deleted":"Message deleted","thread-title":"Discussion","threads-archive":"Archive","threads-archive-empty":"The archive is empty","threads-archive-view":"Archive","threads-archived":"Conversation archived","threads-archived-open":"This conversation is archived","threads-back":"Back to conversations","threads-empty":"No conversations yet","threads-found":"Conversations found: {count}","threads-label":"Conversations","threads-new":"New conversation","threads-pin":"Pin","threads-pinned":"Conversation pinned","threads-restore":"Restore","threads-restored":"Conversation restored","threads-search":"Find a conversation","threads-search-empty":"Nothing found for “{query}”","threads-search-placeholder":"Search by title","threads-unarchive":"Restore from archive","threads-unpin":"Unpin","threads-unpinned":"Conversation unpinned","you":"You","document-draft":"Draft","document-fill-field":"Fill in: {label}","document-hint":"What is still to fill in is marked yellow. Press it to go to the form\'s field.","document-missing":{"one":"{n} field to fill in","other":"{n} fields to fill in"},"document-opened":"Document opened: {title}","document-ready":"Everything is filled in","document-saved":"Saved to documents","document-untitled":"Document"},"events":{"pin":{"label":"Pin"}}}')},"0b171a02b2d0"(e){e.exports=JSON.parse('{"title":"Окно чата","runtime":{"action-retry":"Повторить","action-thanks":"Спасибо за оценку","empty-suggestions":"Примеры вопросов","empty-unselected":"Выберите разговор слева или начните новый","error-load":"Не удалось загрузить. Проверьте связь и попробуйте ещё раз.","feedback-sent":"Спасибо, учтём","files-back":"К разговору","files-cancel":"Отмена","files-count":"Файлов: {count}","files-delete":"Удалить","files-delete-ask":"Удалить файл «{name}»? То, что сохранено из него в базу, останется.","files-delete-label":"Удалить {name}","files-deleted":"Файл «{name}» удалён","files-deleting":"Удаляю…","files-download":"Скачать","files-download-label":"Скачать {name}","files-empty":"Файлов пока нет","files-empty-text":"Здесь появятся файлы, которые вы прикрепите к вопросу помощнику","files-entry":"Мои файлы","files-error":"Не удалось загрузить файлы","files-loading":"Загружаю файлы","files-saved":"Сохранён в базу","files-title":"Мои файлы","files-usage":"Место для ваших файлов","files-used":"Занято {used} из {quota}","find-close":"Закрыть поиск","find-count":"{index} из {count}","find-label":"Поиск в разговоре","find-next":"Следующее совпадение","find-none":"Ничего не найдено","find-placeholder":"Найти в разговоре","find-previous":"Предыдущее совпадение","list-answered":"Ответ готов","list-earlier":"Показать предыдущие сообщения","list-label":"Сообщения","list-latest":"К последнему сообщению","list-loading-earlier":"Загружаю предыдущие сообщения","list-region":"Переписка","members-actions":"Действия: {name}","members-add":"Добавить","members-add-done":"Готово","members-add-invalid":"Этого человека нельзя добавить","members-add-label":"Кого добавить","members-add-warning":"Новый участник увидит всю переписку, а не только с сегодняшнего дня.","members-added":"В группе: {name}","members-ask-leave":"Выйти из группы?","members-ask-remove":"Исключить из группы?","members-ask-transfer":"Передать владение?","members-back":"Назад","members-cancel":"Отмена","members-count":{"one":"{n} участник","few":"{n} участника","many":"{n} участников","other":"{n} участника"},"members-denied":"Состав недоступен","members-denied-action":"Недоступно","members-failed":"Не удалось загрузить участников","members-failed-action":"Не удалось","members-full":"В группе уже 500 человек","members-leave":"Выйти","members-leave-owner":"Сначала передайте владение","members-left":"Вы вышли из группы","members-loading":"Загружаю участников","members-open":"Участники","members-remove":"Исключить","members-removed":"Исключено из группы: {name}","members-role-change":"Роль","members-role-changed":"Роль изменена","members-role-manager":"Руководитель","members-role-member":"Участник","members-role-observer":"Наблюдатель","members-role-owner":"Владелец","members-then-leave":"Вы потеряете доступ к переписке и файлам.","members-then-remove":"Человек потеряет доступ к переписке и файлам.","members-then-transfer":"Вы станете участником и потеряете управление.","members-transfer":"Передать владение","members-transferred":"Владение передано","members-yes-leave":"Выйти","members-yes-remove":"Исключить","members-yes-transfer":"Передать","people-conflict":"Сообщение уже изменили","people-conflict-deleted":"Сообщение уже удалили","people-placeholder":"Напишите сообщение","people-today":"Сегодня","people-yesterday":"Вчера","preview-back":"Назад","preview-close":"Закрыть просмотр","preview-error":"Не удалось загрузить источник","preview-kind-base":"База знаний","preview-kind-file":"Файл","preview-kind-my-base":"Моя база знаний","preview-kind-web":"Сайт","preview-loading":"Загружаю…","preview-marked":"Отрывок выделен","preview-new-tab":"Открыть в новой вкладке","preview-number":"Источник {n}","preview-opened":"Открыт просмотр: {title}","preview-retry":"Повторить","preview-unsupported":"Этот файл здесь не показать. Откройте его в новой вкладке.","preview-untitled":"Источник","proposal-applied":"Применено","proposal-cancel":"Отменить","proposal-cancelling":"Отменяю…","proposal-confirm":"Подтвердить","proposal-confirming":"Применяю…","proposal-expired":"Срок подтверждения истёк. Попросите подготовить изменение заново.","proposal-label":"Что изменится","proposal-rejected":"Отменено","proposal-until":"Подтвердить можно до {time}","proposal-was":"Было","proposal-will":"Станет","queue-added":"Вопрос отправится после ответа","queue-edit":"Изменить","queue-held-failed":"Не отправлено: ответ завершился ошибкой","queue-held-left":"Не отправлено: разговор закрыли до ответа","queue-held-limit":"Не отправлено: исчерпан лимит","queue-held-refused":"Не отправлено: в ответе отказано","queue-held-stopped":"Не отправлено: ожидание остановлено","queue-held-unfinished":"Не отправлено: ответ ещё не готов","queue-held-unsent":"Не отправлено: сообщение не дошло","queue-label":"Отправлю после ответа","queue-remove":"Убрать","queue-send":"Отправить","queue-unsent":"Не отправлено","reactions-refused":"Реакцию не удалось сохранить","reply-cancel":"Не отвечать","reply-label":"Ответ на сообщение","reply-say":"Ответ на сообщение: {name}","reply-you":"Вы","size-b":"{n} Б","size-gb":"{n} ГБ","size-kb":"{n} КБ","size-mb":"{n} МБ","stage-acting":"Выполняю","stage-checking":"Проверяю","stage-queued":"Вопрос в очереди","stage-searching":"Ищу в базе знаний","stage-writing":"Пишу ответ","start-back":"Назад","start-conflict":"Форма изменилась после отправки. Проверьте название и состав и нажмите «Создать» ещё раз.","start-create":"Создать","start-denied":"Создание недоступно","start-group":"Новая группа","start-group-failed":"Не удалось создать группу","start-group-invalid":"Проверьте название и состав группы","start-members":"Участники","start-members-required":"Выберите хотя бы одного человека","start-name":"Название","start-name-long":{"one":"Не больше {n} символа","few":"Не больше {n} символов","many":"Не больше {n} символов","other":"Не больше {n} символа"},"start-name-required":"Введите название","start-opening":"Открываю…","start-person":"Кому написать","start-placeholder":"Имя человека","start-private":"Новый диалог","start-private-failed":"Не удалось открыть диалог","start-recipient":"Этому человеку нельзя написать","start-recipient-group":"Кому-то из выбранных нельзя написать. Уберите его и попробуйте снова.","start-truncated":"Показаны первые {n}. Уточните запрос.","status-delayed":"Ответ задерживается","status-network":"Нет связи. Проверьте интернет.","status-partial":"Ответ с оговоркой","status-stopped":"Ожидание остановлено. Ответ может прийти позже.","steps-say":"Шаг {n}: {label}","steps-say-failed":"Не получилось: {label}","thread-back":"В чат","thread-root-deleted":"Сообщение удалено","thread-title":"Обсуждение","threads-archive":"В архив","threads-archive-empty":"В архиве пусто","threads-archive-view":"Архив","threads-archived":"Разговор в архиве","threads-archived-open":"Этот разговор в архиве","threads-back":"К разговорам","threads-empty":"Разговоров пока нет","threads-found":"Найдено разговоров: {count}","threads-label":"Разговоры","threads-new":"Новый разговор","threads-pin":"Закрепить","threads-pinned":"Разговор закреплён","threads-restore":"Вернуть","threads-restored":"Разговор возвращён","threads-search":"Найти разговор","threads-search-empty":"Ничего не нашлось по запросу «{query}»","threads-search-placeholder":"Поиск по названию","threads-unarchive":"Вернуть из архива","threads-unpin":"Открепить","threads-unpinned":"Разговор откреплён","you":"Вы","document-draft":"Черновик","document-fill-field":"Заполнить: {label}","document-hint":"Жёлтым отмечено то, что ещё не заполнено. Нажмите — откроется поле анкеты.","document-missing":{"one":"{n} поле не заполнено","few":"{n} поля не заполнены","many":"{n} полей не заполнено","other":"{n} поля не заполнено"},"document-opened":"Открыт документ: {title}","document-ready":"Всё заполнено","document-saved":"Сохранён в документах","document-untitled":"Документ"},"events":{"pin":{"label":"Закрепить"}}}')}};const t={};function s(i){const n=t[i];if(void 0!==n)return n.exports;const a=t[i]={exports:{}};return e[i](a,a.exports,s),a.exports}(()=>{const e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",i=e?Symbol("webpack exports"):"__webpack_exports__",n=e?Symbol("webpack error"):"__webpack_error__",a=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,d=e.exports;let c,h,u;const p=new Promise((e,t)=>{u=t,h=e});p[i]=d,p[t]=e=>(o&&e(o),l.forEach(e),p.catch(e=>{})),e.exports=p;s(e=>{let s;c=(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[i]=e,a(s)},e=>{r[n]=e,a(s)});const r={};return r[t]=e=>e(s),r}}const s={};return s[t]=e=>{},s[i]=e,s}))(e);const r=()=>c.map(e=>{if(e[n])throw e[n];return e[i]}),d=new Promise(e=>{s=()=>e(r),s.r=0;const i=e=>e!==o&&!l.has(e)&&(l.add(e),e&&!e.d&&(s.r++,e.push(s)));c.map(e=>e[t](i))});return s.r?d:r()},e=>(e?u(p[n]=e):h(d),a(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 i=0;i<t.length;){var n=t[i++],a=t[i++];s.o(e,n)?0===a&&i++:0===a?Object.defineProperty(e,n,{enumerable:!0,value:t[i++]}):Object.defineProperty(e,n,{enumerable:!0,get:a})}else for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);s("f29bbdec6622")})();