@wirabyte/ui 3.0.0-beta.0 → 3.1.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/CHANGELOG.md +42 -0
  2. package/README.md +6 -6
  3. package/fesm2022/wirabyte-ui-accordion.mjs +4 -4
  4. package/fesm2022/wirabyte-ui-accordion.mjs.map +1 -1
  5. package/fesm2022/wirabyte-ui-alert.mjs +2 -2
  6. package/fesm2022/wirabyte-ui-alert.mjs.map +1 -1
  7. package/fesm2022/wirabyte-ui-asidemenu.mjs +2 -2
  8. package/fesm2022/wirabyte-ui-asidemenu.mjs.map +1 -1
  9. package/fesm2022/wirabyte-ui-avatar.mjs +13 -6
  10. package/fesm2022/wirabyte-ui-avatar.mjs.map +1 -1
  11. package/fesm2022/wirabyte-ui-breadcrumb.mjs +4 -2
  12. package/fesm2022/wirabyte-ui-breadcrumb.mjs.map +1 -1
  13. package/fesm2022/wirabyte-ui-button.mjs +3 -3
  14. package/fesm2022/wirabyte-ui-button.mjs.map +1 -1
  15. package/fesm2022/wirabyte-ui-card.mjs +8 -8
  16. package/fesm2022/wirabyte-ui-card.mjs.map +1 -1
  17. package/fesm2022/wirabyte-ui-chat.mjs +391 -0
  18. package/fesm2022/wirabyte-ui-chat.mjs.map +1 -0
  19. package/fesm2022/wirabyte-ui-config.mjs +55 -2
  20. package/fesm2022/wirabyte-ui-config.mjs.map +1 -1
  21. package/fesm2022/wirabyte-ui-core.mjs +155 -2
  22. package/fesm2022/wirabyte-ui-core.mjs.map +1 -1
  23. package/fesm2022/wirabyte-ui-datepicker.mjs +6 -5
  24. package/fesm2022/wirabyte-ui-datepicker.mjs.map +1 -1
  25. package/fesm2022/wirabyte-ui-descriptions.mjs +133 -0
  26. package/fesm2022/wirabyte-ui-descriptions.mjs.map +1 -0
  27. package/fesm2022/wirabyte-ui-dialog.mjs +2 -2
  28. package/fesm2022/wirabyte-ui-dialog.mjs.map +1 -1
  29. package/fesm2022/wirabyte-ui-drawer.mjs +2 -2
  30. package/fesm2022/wirabyte-ui-drawer.mjs.map +1 -1
  31. package/fesm2022/wirabyte-ui-emptystate.mjs +2 -2
  32. package/fesm2022/wirabyte-ui-emptystate.mjs.map +1 -1
  33. package/fesm2022/wirabyte-ui-errorpage.mjs +2 -2
  34. package/fesm2022/wirabyte-ui-errorpage.mjs.map +1 -1
  35. package/fesm2022/wirabyte-ui-fieldset.mjs +4 -4
  36. package/fesm2022/wirabyte-ui-fieldset.mjs.map +1 -1
  37. package/fesm2022/wirabyte-ui-metergroup.mjs +19 -5
  38. package/fesm2022/wirabyte-ui-metergroup.mjs.map +1 -1
  39. package/fesm2022/wirabyte-ui-navbar.mjs +2 -2
  40. package/fesm2022/wirabyte-ui-navbar.mjs.map +1 -1
  41. package/fesm2022/wirabyte-ui-panel.mjs +6 -6
  42. package/fesm2022/wirabyte-ui-panel.mjs.map +1 -1
  43. package/fesm2022/wirabyte-ui-popover.mjs +2 -2
  44. package/fesm2022/wirabyte-ui-popover.mjs.map +1 -1
  45. package/fesm2022/wirabyte-ui-result.mjs +2 -2
  46. package/fesm2022/wirabyte-ui-result.mjs.map +1 -1
  47. package/fesm2022/wirabyte-ui-scheduler.mjs +505 -0
  48. package/fesm2022/wirabyte-ui-scheduler.mjs.map +1 -0
  49. package/fesm2022/wirabyte-ui-selectbutton.mjs +25 -4
  50. package/fesm2022/wirabyte-ui-selectbutton.mjs.map +1 -1
  51. package/fesm2022/wirabyte-ui-signaturepad.mjs +310 -0
  52. package/fesm2022/wirabyte-ui-signaturepad.mjs.map +1 -0
  53. package/fesm2022/wirabyte-ui-sitefooter.mjs +1 -1
  54. package/fesm2022/wirabyte-ui-sitefooter.mjs.map +1 -1
  55. package/fesm2022/wirabyte-ui-stat.mjs +149 -0
  56. package/fesm2022/wirabyte-ui-stat.mjs.map +1 -0
  57. package/fesm2022/wirabyte-ui-table.mjs +3 -3
  58. package/fesm2022/wirabyte-ui-table.mjs.map +1 -1
  59. package/fesm2022/wirabyte-ui-tabs.mjs +3 -3
  60. package/fesm2022/wirabyte-ui-tabs.mjs.map +1 -1
  61. package/fesm2022/wirabyte-ui-tag.mjs +2 -2
  62. package/fesm2022/wirabyte-ui-tag.mjs.map +1 -1
  63. package/fesm2022/wirabyte-ui-textarea.mjs +32 -0
  64. package/fesm2022/wirabyte-ui-textarea.mjs.map +1 -1
  65. package/fesm2022/wirabyte-ui-thai.mjs +2 -2
  66. package/fesm2022/wirabyte-ui-thai.mjs.map +1 -1
  67. package/fesm2022/wirabyte-ui-toolbar.mjs +6 -6
  68. package/fesm2022/wirabyte-ui-toolbar.mjs.map +1 -1
  69. package/package.json +21 -1
  70. package/schematics/core/catalog.cjs +22 -1
  71. package/schematics/core/families.cjs +42 -0
  72. package/schematics/core/overrides.cjs +25 -0
  73. package/schematics/core/thai/locale.cjs +66 -0
  74. package/schematics/ng-add/index.cjs +3 -1
  75. package/theme/_data.scss +239 -7
  76. package/theme/_index.scss +29 -0
  77. package/themes/glass/amber.css +36 -7
  78. package/themes/glass/blue.css +36 -7
  79. package/themes/glass/cyan.css +36 -7
  80. package/themes/glass/emerald.css +36 -7
  81. package/themes/glass/fuchsia.css +36 -7
  82. package/themes/glass/green.css +36 -7
  83. package/themes/glass/indigo.css +36 -7
  84. package/themes/glass/lime.css +36 -7
  85. package/themes/glass/orange.css +36 -7
  86. package/themes/glass/pink.css +36 -7
  87. package/themes/glass/purple.css +36 -7
  88. package/themes/glass/red.css +36 -7
  89. package/themes/glass/rose.css +36 -7
  90. package/themes/glass/sky.css +36 -7
  91. package/themes/glass/teal.css +36 -7
  92. package/themes/glass/theme.css +36 -7
  93. package/themes/glass/violet.css +36 -7
  94. package/themes/glass/wira.css +36 -7
  95. package/themes/glass/yellow.css +36 -7
  96. package/themes/lanna/amber.css +36 -7
  97. package/themes/lanna/blue.css +36 -7
  98. package/themes/lanna/cyan.css +36 -7
  99. package/themes/lanna/emerald.css +36 -7
  100. package/themes/lanna/fuchsia.css +36 -7
  101. package/themes/lanna/green.css +36 -7
  102. package/themes/lanna/indigo.css +36 -7
  103. package/themes/lanna/lime.css +36 -7
  104. package/themes/lanna/orange.css +36 -7
  105. package/themes/lanna/pink.css +36 -7
  106. package/themes/lanna/purple.css +36 -7
  107. package/themes/lanna/red.css +36 -7
  108. package/themes/lanna/rose.css +36 -7
  109. package/themes/lanna/sky.css +36 -7
  110. package/themes/lanna/teal.css +36 -7
  111. package/themes/lanna/theme.css +36 -7
  112. package/themes/lanna/violet.css +36 -7
  113. package/themes/lanna/wira.css +36 -7
  114. package/themes/lanna/yellow.css +36 -7
  115. package/themes/mali/amber.css +30 -1
  116. package/themes/mali/blue.css +30 -1
  117. package/themes/mali/cyan.css +30 -1
  118. package/themes/mali/emerald.css +30 -1
  119. package/themes/mali/fuchsia.css +30 -1
  120. package/themes/mali/green.css +30 -1
  121. package/themes/mali/indigo.css +30 -1
  122. package/themes/mali/lime.css +30 -1
  123. package/themes/mali/orange.css +30 -1
  124. package/themes/mali/pink.css +30 -1
  125. package/themes/mali/purple.css +30 -1
  126. package/themes/mali/red.css +30 -1
  127. package/themes/mali/rose.css +30 -1
  128. package/themes/mali/sky.css +30 -1
  129. package/themes/mali/teal.css +30 -1
  130. package/themes/mali/theme.css +30 -1
  131. package/themes/mali/violet.css +30 -1
  132. package/themes/mali/wira.css +30 -1
  133. package/themes/mali/yellow.css +30 -1
  134. package/themes/material/amber.css +30 -1
  135. package/themes/material/blue.css +30 -1
  136. package/themes/material/cyan.css +30 -1
  137. package/themes/material/emerald.css +30 -1
  138. package/themes/material/fuchsia.css +30 -1
  139. package/themes/material/green.css +30 -1
  140. package/themes/material/indigo.css +30 -1
  141. package/themes/material/lime.css +30 -1
  142. package/themes/material/orange.css +30 -1
  143. package/themes/material/pink.css +30 -1
  144. package/themes/material/purple.css +30 -1
  145. package/themes/material/red.css +30 -1
  146. package/themes/material/rose.css +30 -1
  147. package/themes/material/sky.css +30 -1
  148. package/themes/material/teal.css +30 -1
  149. package/themes/material/theme.css +30 -1
  150. package/themes/material/violet.css +30 -1
  151. package/themes/material/wira.css +30 -1
  152. package/themes/material/yellow.css +30 -1
  153. package/themes/nakhon/amber.css +36 -7
  154. package/themes/nakhon/blue.css +36 -7
  155. package/themes/nakhon/cyan.css +36 -7
  156. package/themes/nakhon/emerald.css +36 -7
  157. package/themes/nakhon/fuchsia.css +36 -7
  158. package/themes/nakhon/green.css +36 -7
  159. package/themes/nakhon/indigo.css +36 -7
  160. package/themes/nakhon/lime.css +36 -7
  161. package/themes/nakhon/orange.css +36 -7
  162. package/themes/nakhon/pink.css +36 -7
  163. package/themes/nakhon/purple.css +36 -7
  164. package/themes/nakhon/red.css +36 -7
  165. package/themes/nakhon/rose.css +36 -7
  166. package/themes/nakhon/sky.css +36 -7
  167. package/themes/nakhon/teal.css +36 -7
  168. package/themes/nakhon/theme.css +36 -7
  169. package/themes/nakhon/violet.css +36 -7
  170. package/themes/nakhon/wira.css +36 -7
  171. package/themes/nakhon/yellow.css +36 -7
  172. package/themes/phet/amber.css +30 -1
  173. package/themes/phet/blue.css +30 -1
  174. package/themes/phet/cyan.css +30 -1
  175. package/themes/phet/emerald.css +30 -1
  176. package/themes/phet/fuchsia.css +30 -1
  177. package/themes/phet/green.css +30 -1
  178. package/themes/phet/indigo.css +30 -1
  179. package/themes/phet/lime.css +30 -1
  180. package/themes/phet/orange.css +30 -1
  181. package/themes/phet/pink.css +30 -1
  182. package/themes/phet/purple.css +30 -1
  183. package/themes/phet/red.css +30 -1
  184. package/themes/phet/rose.css +30 -1
  185. package/themes/phet/sky.css +30 -1
  186. package/themes/phet/teal.css +30 -1
  187. package/themes/phet/theme.css +30 -1
  188. package/themes/phet/violet.css +30 -1
  189. package/themes/phet/wira.css +30 -1
  190. package/themes/phet/yellow.css +30 -1
  191. package/themes/siam/amber.css +36 -7
  192. package/themes/siam/blue.css +36 -7
  193. package/themes/siam/cyan.css +36 -7
  194. package/themes/siam/emerald.css +36 -7
  195. package/themes/siam/fuchsia.css +36 -7
  196. package/themes/siam/green.css +36 -7
  197. package/themes/siam/indigo.css +36 -7
  198. package/themes/siam/lime.css +36 -7
  199. package/themes/siam/orange.css +36 -7
  200. package/themes/siam/pink.css +36 -7
  201. package/themes/siam/purple.css +36 -7
  202. package/themes/siam/red.css +36 -7
  203. package/themes/siam/rose.css +36 -7
  204. package/themes/siam/sky.css +36 -7
  205. package/themes/siam/teal.css +36 -7
  206. package/themes/siam/theme.css +36 -7
  207. package/themes/siam/violet.css +36 -7
  208. package/themes/siam/wira.css +36 -7
  209. package/themes/siam/yellow.css +36 -7
  210. package/themes/sila/amber.css +30 -1
  211. package/themes/sila/blue.css +30 -1
  212. package/themes/sila/cyan.css +30 -1
  213. package/themes/sila/emerald.css +30 -1
  214. package/themes/sila/fuchsia.css +30 -1
  215. package/themes/sila/green.css +30 -1
  216. package/themes/sila/indigo.css +30 -1
  217. package/themes/sila/lime.css +30 -1
  218. package/themes/sila/orange.css +30 -1
  219. package/themes/sila/pink.css +30 -1
  220. package/themes/sila/purple.css +30 -1
  221. package/themes/sila/red.css +30 -1
  222. package/themes/sila/rose.css +30 -1
  223. package/themes/sila/sky.css +30 -1
  224. package/themes/sila/teal.css +30 -1
  225. package/themes/sila/theme.css +30 -1
  226. package/themes/sila/violet.css +30 -1
  227. package/themes/sila/wira.css +30 -1
  228. package/themes/sila/yellow.css +30 -1
  229. package/themes/wira/amber.css +45 -16
  230. package/themes/wira/blue.css +45 -16
  231. package/themes/wira/cyan.css +45 -16
  232. package/themes/wira/emerald.css +45 -16
  233. package/themes/wira/fuchsia.css +45 -16
  234. package/themes/wira/green.css +45 -16
  235. package/themes/wira/indigo.css +45 -16
  236. package/themes/wira/lime.css +45 -16
  237. package/themes/wira/orange.css +45 -16
  238. package/themes/wira/pink.css +45 -16
  239. package/themes/wira/purple.css +45 -16
  240. package/themes/wira/red.css +45 -16
  241. package/themes/wira/rose.css +45 -16
  242. package/themes/wira/sky.css +45 -16
  243. package/themes/wira/teal.css +45 -16
  244. package/themes/wira/theme.css +45 -16
  245. package/themes/wira/violet.css +45 -16
  246. package/themes/wira/wira.css +45 -16
  247. package/themes/wira/yellow.css +45 -16
  248. package/types/wirabyte-ui-avatar.d.ts +8 -3
  249. package/types/wirabyte-ui-breadcrumb.d.ts +3 -1
  250. package/types/wirabyte-ui-button.d.ts +1 -1
  251. package/types/wirabyte-ui-chat.d.ts +192 -0
  252. package/types/wirabyte-ui-config.d.ts +34 -0
  253. package/types/wirabyte-ui-core.d.ts +62 -3
  254. package/types/wirabyte-ui-datepicker.d.ts +3 -2
  255. package/types/wirabyte-ui-descriptions.d.ts +67 -0
  256. package/types/wirabyte-ui-metergroup.d.ts +17 -2
  257. package/types/wirabyte-ui-scheduler.d.ts +199 -0
  258. package/types/wirabyte-ui-selectbutton.d.ts +12 -1
  259. package/types/wirabyte-ui-signaturepad.d.ts +108 -0
  260. package/types/wirabyte-ui-stat.d.ts +72 -0
  261. package/types/wirabyte-ui-textarea.d.ts +3 -0
@@ -0,0 +1,391 @@
1
+ import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { TemplateRef, EventEmitter, inject, ChangeDetectorRef, ViewChild, ContentChild, ContentChildren, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
4
+ import { ɵtoBool as _toBool, WuConfig, ɵrefreshOnTranslation as _refreshOnTranslation, ɵassertSupportedAngular as _assertSupportedAngular, ɵWU_SKIP_VERSION_CHECK as _WU_SKIP_VERSION_CHECK, ɵfindTemplate as _findTemplate, WuTemplate } from '@wirabyte/ui/config';
5
+ import { formatDate, datePattern, toDateValue } from '@wirabyte/ui/core';
6
+
7
+ const IMAGE = /\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i;
8
+ const NEAR_BOTTOM = 80;
9
+ /** Thai vowels written before their consonant: an initial is the consonant, not these. */
10
+ const LEADING_VOWEL = /[\u0E40-\u0E44]/;
11
+ const TYPING_EVERY = 2000;
12
+ const asTemplate = (v) => (v instanceof TemplateRef ? v : null);
13
+ /**
14
+ * A conversation: `<wu-chat [messages]="messages" [currentUserId]="me.id" (onSend)="send($event)">`. Bubbles on the
15
+ * left for others and on the right for you, grouped by sender and time, day separators (วันนี้, เมื่อวาน, then the date
16
+ * in the app's calendar), pictures and file cards, read marks, who is typing, and a message box that grows with the
17
+ * text: Enter sends, Shift+Enter starts a new line, pasted pictures are attached. New messages scroll into view unless
18
+ * the reader has scrolled up to read older ones. The component only shows and emits; sending is the app's job.
19
+ */
20
+ class WuChat {
21
+ set messages(v) {
22
+ const list = Array.isArray(v) ? v : [];
23
+ const grew = list.length > this._messages.length;
24
+ const last = list[list.length - 1];
25
+ // Follow new messages while the reader is at the bottom, and always after sending one yourself.
26
+ if (grew && (this.atBottom || (last && this.isMine(last))))
27
+ this.scrollPending = true;
28
+ this._messages = list;
29
+ this.rows = null;
30
+ }
31
+ get messages() {
32
+ return this._messages;
33
+ }
34
+ /** No message box: a closed conversation. `readonlyMessage` replaces the default line. */
35
+ set readonly(v) { this._readonly = _toBool(v); }
36
+ get readonly() { return this._readonly; }
37
+ /** A spinner instead of the messages while they load. */
38
+ set loading(v) { this._loading = _toBool(v); }
39
+ get loading() { return this._loading; }
40
+ /** The send button shows a spinner and the box waits. */
41
+ set sending(v) { this._sending = _toBool(v); }
42
+ get sending() { return this._sending; }
43
+ /** `false` hides the attach button (pasting files then does nothing either). */
44
+ set attach(v) { this._attach = v === undefined ? true : _toBool(v); }
45
+ get attach() { return this._attach; }
46
+ /** A button above the oldest message that emits `(onLoadMore)`. */
47
+ set hasMore(v) { this._hasMore = _toBool(v); }
48
+ get hasMore() { return this._hasMore; }
49
+ /** `false` leaves out the avatars beside other people's messages. */
50
+ set showAvatars(v) { this._avatars = v === undefined ? true : _toBool(v); }
51
+ get showAvatars() { return this._avatars; }
52
+ constructor() {
53
+ /** Messages from the same sender within this many minutes join one group (one name, one avatar). Default 5. */
54
+ this.groupMinutes = 5;
55
+ this.onSend = new EventEmitter();
56
+ /** While the reader types, at most every 2 seconds: send "is typing" to the others. */
57
+ this.onTyping = new EventEmitter();
58
+ this.onAttachmentClick = new EventEmitter();
59
+ this.onRetry = new EventEmitter();
60
+ this.onLoadMore = new EventEmitter();
61
+ this.onFileRejected = new EventEmitter();
62
+ this.draft = '';
63
+ this.pending = [];
64
+ this._messages = [];
65
+ this.rows = null;
66
+ this._readonly = false;
67
+ this._loading = false;
68
+ this._sending = false;
69
+ this._attach = true;
70
+ this._hasMore = false;
71
+ this._avatars = true;
72
+ this.atBottom = true;
73
+ this.scrollPending = true;
74
+ this.lastTyping = 0;
75
+ this.cdr = inject(ChangeDetectorRef);
76
+ this.config = inject(WuConfig);
77
+ this.i18n = _refreshOnTranslation();
78
+ this.translated = this.config.translationChange.subscribe(() => (this.rows = null));
79
+ _assertSupportedAngular(inject(_WU_SKIP_VERSION_CHECK, { optional: true }));
80
+ }
81
+ ngAfterViewChecked() {
82
+ if (!this.scrollPending || !this.scroller)
83
+ return;
84
+ this.scrollPending = false;
85
+ const el = this.scroller.nativeElement;
86
+ el.scrollTop = el.scrollHeight;
87
+ this.atBottom = true;
88
+ }
89
+ ngOnDestroy() {
90
+ this.i18n.unsubscribe();
91
+ this.translated.unsubscribe();
92
+ for (const p of this.pending)
93
+ if (p.preview)
94
+ URL.revokeObjectURL(p.preview);
95
+ }
96
+ // ---------- what the template reads ----------
97
+ get t() {
98
+ return this.config.translation.chat;
99
+ }
100
+ /** `<ng-template #message let-message>`: the inside of a bubble. */
101
+ get messageTemplate() {
102
+ return asTemplate(this.messageRef) || _findTemplate(this.templates, 'message');
103
+ }
104
+ get rootClass() {
105
+ return ['wu-chat', this.styleClass || ''].filter(Boolean).join(' ');
106
+ }
107
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
+ get rootStyle() {
109
+ const own = this.style && typeof this.style === 'object' ? this.style : {};
110
+ const h = this.height;
111
+ const height = h === null || h === undefined || h === '' ? undefined : typeof h === 'number' || /^\d+(\.\d+)?$/.test(String(h)) ? `${h}px` : String(h);
112
+ return height ? { ...own, '--wu-chat-height': height } : own;
113
+ }
114
+ get view() {
115
+ if (!this.rows)
116
+ this.rows = this.build();
117
+ return this.rows;
118
+ }
119
+ get typingText() {
120
+ const names = (Array.isArray(this.typing) ? this.typing : this.typing ? [this.typing] : []).filter(Boolean);
121
+ if (!names.length)
122
+ return '';
123
+ const t = this.t;
124
+ if (names.length === 1)
125
+ return (t?.typing ?? '{name} is typing').replace('{name}', names[0]);
126
+ return (t?.typingMany ?? '{count} people are typing').replace('{count}', String(names.length));
127
+ }
128
+ get canSend() {
129
+ return !this._sending && (!!this.draft.trim() || this.pending.length > 0);
130
+ }
131
+ trackRow(_, row) {
132
+ return row.key;
133
+ }
134
+ initials(name) {
135
+ const words = (name || '').trim().split(/\s+/).filter(Boolean);
136
+ if (!words.length)
137
+ return '?';
138
+ const first = (word) => Array.from(word).find((ch) => !LEADING_VOWEL.test(ch)) || word[0];
139
+ return first(words[0]) + (words.length > 1 ? first(words[words.length - 1]) : '');
140
+ }
141
+ isImage(a) {
142
+ return a.type ? a.type === 'image' : IMAGE.test(a.name) || IMAGE.test(a.url || '');
143
+ }
144
+ sizeText(bytes) {
145
+ if (bytes === undefined || bytes === null || !Number.isFinite(bytes))
146
+ return '';
147
+ if (bytes < 1024)
148
+ return `${bytes} B`;
149
+ if (bytes < 1024 * 1024)
150
+ return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} kB`;
151
+ return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
152
+ }
153
+ readText(m) {
154
+ if (!m.read)
155
+ return '';
156
+ if (typeof m.read === 'number' && m.read > 1)
157
+ return (this.t?.readBy ?? 'Read by {count}').replace('{count}', String(m.read));
158
+ return this.t?.read ?? 'Read';
159
+ }
160
+ // ---------- events ----------
161
+ onScroll() {
162
+ const el = this.scroller?.nativeElement;
163
+ if (el)
164
+ this.atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < NEAR_BOTTOM;
165
+ }
166
+ onKeydown(event) {
167
+ if (event.key !== 'Enter' || event.shiftKey || event.isComposing)
168
+ return;
169
+ event.preventDefault();
170
+ this.send();
171
+ }
172
+ onInput() {
173
+ this.grow();
174
+ const now = Date.now();
175
+ if (this.draft && now - this.lastTyping > TYPING_EVERY) {
176
+ this.lastTyping = now;
177
+ this.onTyping.emit();
178
+ }
179
+ }
180
+ onPaste(event) {
181
+ if (!this._attach)
182
+ return;
183
+ const files = Array.from(event.clipboardData?.files || []);
184
+ if (!files.length)
185
+ return;
186
+ event.preventDefault();
187
+ this.add(files);
188
+ }
189
+ openFiles() {
190
+ this.fileInput?.nativeElement.click();
191
+ }
192
+ onFilesChosen(event) {
193
+ const input = event.target;
194
+ this.add(Array.from(input.files || []));
195
+ input.value = '';
196
+ }
197
+ removePending(index) {
198
+ const [p] = this.pending.splice(index, 1);
199
+ if (p?.preview)
200
+ URL.revokeObjectURL(p.preview);
201
+ this.pending = [...this.pending];
202
+ }
203
+ send() {
204
+ if (!this.canSend || this._readonly)
205
+ return;
206
+ const files = this.pending.map((p) => p.file);
207
+ for (const p of this.pending)
208
+ if (p.preview)
209
+ URL.revokeObjectURL(p.preview);
210
+ this.onSend.emit({ text: this.draft.trim(), files });
211
+ this.draft = '';
212
+ this.pending = [];
213
+ this.scrollPending = true;
214
+ setTimeout(() => this.grow());
215
+ this.cdr.markForCheck();
216
+ }
217
+ attachmentClick(event, attachment, message) {
218
+ this.onAttachmentClick.emit({ originalEvent: event, attachment, message });
219
+ }
220
+ // ---------- internals ----------
221
+ isMine(m) {
222
+ if (m.mine !== undefined)
223
+ return m.mine;
224
+ return this.currentUserId !== null && this.currentUserId !== undefined && m.sender?.id === this.currentUserId;
225
+ }
226
+ add(files) {
227
+ const max = this.maxFileSize;
228
+ const kept = [];
229
+ for (const file of files) {
230
+ if (max && file.size > max) {
231
+ this.onFileRejected.emit(file);
232
+ continue;
233
+ }
234
+ kept.push({ file, preview: file.type.startsWith('image/') && typeof URL !== 'undefined' ? URL.createObjectURL(file) : null });
235
+ }
236
+ this.pending = [...this.pending, ...kept];
237
+ this.cdr.markForCheck();
238
+ }
239
+ /** The box grows with its text up to a few lines, then scrolls. */
240
+ grow() {
241
+ const t = this.box?.nativeElement;
242
+ if (!t || !t.getClientRects().length)
243
+ return;
244
+ t.style.height = 'auto';
245
+ t.style.height = Math.min(t.scrollHeight, 160) + 'px';
246
+ }
247
+ build() {
248
+ const rows = [];
249
+ const lang = this.config.translation.code || 'th';
250
+ const calendar = this.config.calendarFor(lang);
251
+ const locale = this.config.translation;
252
+ const timeOf = (d) => formatDate(d, datePattern('time', lang, calendar), { locale, calendar });
253
+ const today = startOfDay(this.config.now());
254
+ let day = '';
255
+ let prev = null;
256
+ this._messages.forEach((m, i) => {
257
+ const at = toDateValue(m.time) || new Date(NaN);
258
+ const dayKey = Number.isNaN(at.getTime()) ? '' : `${at.getFullYear()}-${at.getMonth()}-${at.getDate()}`;
259
+ if (dayKey && dayKey !== day) {
260
+ day = dayKey;
261
+ const diff = Math.round((today - startOfDay(at)) / 86400000);
262
+ const label = diff === 0
263
+ ? this.t?.today ?? 'Today'
264
+ : diff === 1
265
+ ? this.t?.yesterday ?? 'Yesterday'
266
+ : formatDate(at, datePattern('long', lang, calendar), { locale, calendar });
267
+ rows.push({ kind: 'day', key: 'd' + dayKey, label });
268
+ prev = null;
269
+ }
270
+ const key = 'm' + (m.id ?? i);
271
+ const time = Number.isNaN(at.getTime()) ? '' : timeOf(at);
272
+ if (m.system) {
273
+ rows.push({ kind: 'system', key, message: m, time });
274
+ prev = null;
275
+ return;
276
+ }
277
+ const mine = this.isMine(m);
278
+ const sender = m.sender?.id ?? m.sender?.name ?? null;
279
+ const first = !prev || prev.mine !== mine || prev.sender !== sender || at.getTime() - prev.at > Math.max(0, this.groupMinutes) * 60000;
280
+ if (first && rows.length) {
281
+ const before = rows[rows.length - 1];
282
+ if (before.kind === 'message')
283
+ before.last = true;
284
+ }
285
+ rows.push({ kind: 'message', key, message: m, mine, first, last: false, time });
286
+ prev = { mine, sender, at: at.getTime() };
287
+ });
288
+ const tail = rows[rows.length - 1];
289
+ if (tail && tail.kind === 'message')
290
+ tail.last = true;
291
+ for (let i = 0; i < rows.length - 1; i++) {
292
+ const r = rows[i];
293
+ if (r.kind === 'message' && rows[i + 1].kind !== 'message')
294
+ r.last = true;
295
+ }
296
+ return rows;
297
+ }
298
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: WuChat, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
299
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.25", type: WuChat, isStandalone: true, selector: "wu-chat", inputs: { messages: "messages", currentUserId: "currentUserId", typing: "typing", readonly: "readonly", readonlyMessage: "readonlyMessage", placeholder: "placeholder", loading: "loading", sending: "sending", attach: "attach", accept: "accept", maxFileSize: "maxFileSize", groupMinutes: "groupMinutes", hasMore: "hasMore", showAvatars: "showAvatars", height: "height", ariaLabel: "ariaLabel", styleClass: "styleClass", style: "style" }, outputs: { onSend: "onSend", onTyping: "onTyping", onAttachmentClick: "onAttachmentClick", onRetry: "onRetry", onLoadMore: "onLoadMore", onFileRejected: "onFileRejected" }, host: { classAttribute: "wu-chat-host" }, queries: [{ propertyName: "messageRef", first: true, predicate: ["message"] }, { propertyName: "templates", predicate: WuTemplate }], viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true }, { propertyName: "box", first: true, predicate: ["box"], descendants: true }, { propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<section [class]=\"rootClass\" [style]=\"rootStyle\" [attr.aria-label]=\"ariaLabel || t?.messages || null\">\n <div #scroller class=\"wu-chat-scroll\" role=\"log\" aria-live=\"polite\" (scroll)=\"onScroll()\">\n <div *ngIf=\"hasMore && !loading\" class=\"wu-chat-more\">\n <button type=\"button\" class=\"wu-chat-more-button\" (click)=\"onLoadMore.emit()\">{{ t?.loadMore || 'Earlier messages' }}</button>\n </div>\n\n <div *ngIf=\"loading\" class=\"wu-chat-loading\" aria-busy=\"true\"><span class=\"wu-chat-spinner\" aria-hidden=\"true\"></span></div>\n\n <div *ngIf=\"!loading && !messages.length\" class=\"wu-chat-empty\">\n <svg class=\"wu-chat-empty-art\" viewBox=\"0 0 64 48\" aria-hidden=\"true\">\n <path d=\"M8 6h34a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H22l-9 8v-8H8a6 6 0 0 1-6-6V12a6 6 0 0 1 6-6z\" />\n <path d=\"M54 18h2a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6h-2v6l-8-6H34a6 6 0 0 1-6-6v-2\" />\n </svg>\n <strong>{{ t?.emptyTitle || 'No messages yet' }}</strong>\n <span *ngIf=\"!readonly\">{{ t?.emptyDescription || 'Start typing below' }}</span>\n </div>\n\n <ng-container *ngIf=\"!loading\">\n <ng-container *ngFor=\"let row of view; trackBy: trackRow\">\n <div *ngIf=\"row.kind === 'day'\" class=\"wu-chat-day\"><span>{{ row.label }}</span></div>\n\n <div *ngIf=\"row.kind === 'system'\" class=\"wu-chat-system\">\n <span>{{ row.message.text }}<ng-container *ngIf=\"row.time\"> \u00B7 {{ row.time }}</ng-container></span>\n </div>\n\n <div\n *ngIf=\"row.kind === 'message'\"\n class=\"wu-chat-line\"\n [class.wu-chat-mine]=\"row.mine\"\n [class.wu-chat-first]=\"row.first\"\n [class.wu-chat-last]=\"row.last\"\n [class.wu-chat-sending]=\"row.message.status === 'sending'\"\n [class.wu-chat-failed]=\"row.message.status === 'failed'\"\n >\n <div *ngIf=\"!row.mine && showAvatars\" class=\"wu-chat-avatar\" aria-hidden=\"true\">\n <ng-container *ngIf=\"row.first\">\n <img *ngIf=\"row.message.sender?.avatar; else letters\" [src]=\"row.message.sender?.avatar\" alt=\"\" />\n <ng-template #letters><span>{{ initials(row.message.sender?.name) }}</span></ng-template>\n </ng-container>\n </div>\n <div class=\"wu-chat-stack\">\n <span *ngIf=\"!row.mine && row.first && row.message.sender?.name\" class=\"wu-chat-name\">\n {{ row.message.sender?.name }}\n <span *ngIf=\"row.message.sender?.badge\" class=\"wu-chat-badge\">{{ row.message.sender?.badge }}</span>\n </span>\n <div class=\"wu-chat-bubble-row\">\n <div class=\"wu-chat-bubble\">\n <ng-container *ngIf=\"messageTemplate; else plain\">\n <ng-container *ngTemplateOutlet=\"messageTemplate; context: { $implicit: row.message, mine: row.mine }\"></ng-container>\n </ng-container>\n <ng-template #plain>\n <ng-container *ngFor=\"let a of row.message.attachments || []\">\n <a\n *ngIf=\"isImage(a); else fileCard\"\n class=\"wu-chat-image\"\n [attr.href]=\"a.url || null\"\n [attr.target]=\"a.url ? '_blank' : null\"\n [attr.rel]=\"a.url ? 'noopener' : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <img [src]=\"a.thumbnail || a.url\" [alt]=\"a.name\" loading=\"lazy\" />\n </a>\n <ng-template #fileCard>\n <a\n class=\"wu-chat-file\"\n [attr.href]=\"a.url || null\"\n [attr.download]=\"a.url ? a.name : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n <span class=\"wu-chat-file-name\">{{ a.name }}</span>\n <span *ngIf=\"a.size !== undefined\" class=\"wu-chat-file-size\">{{ sizeText(a.size) }}</span>\n </a>\n </ng-template>\n </ng-container>\n <span *ngIf=\"row.message.text\" class=\"wu-chat-text\">{{ row.message.text }}</span>\n </ng-template>\n </div>\n <div class=\"wu-chat-meta\">\n <ng-container *ngIf=\"row.message.status === 'failed'; else normal\">\n <span class=\"wu-chat-error\">{{ t?.failed || 'Not sent' }}</span>\n <button type=\"button\" class=\"wu-chat-retry\" (click)=\"onRetry.emit(row.message)\">{{ t?.retry || 'Send again' }}</button>\n </ng-container>\n <ng-template #normal>\n <span *ngIf=\"row.mine && row.message.read\">{{ readText(row.message) }}</span>\n <span>{{ row.time }}</span>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n <div *ngIf=\"typingText\" class=\"wu-chat-typing\">\n <span class=\"wu-chat-dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span>\n {{ typingText }}\n </div>\n </div>\n\n <div *ngIf=\"readonly; else composer\" class=\"wu-chat-closed\">{{ readonlyMessage || t?.closed || 'This conversation is closed' }}</div>\n <ng-template #composer>\n <div *ngIf=\"pending.length\" class=\"wu-chat-pending\">\n <span *ngFor=\"let p of pending; let i = index\" class=\"wu-chat-pending-item\">\n <img *ngIf=\"p.preview; else pendingIcon\" [src]=\"p.preview\" alt=\"\" />\n <ng-template #pendingIcon>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n </ng-template>\n <span class=\"wu-chat-pending-name\">{{ p.file.name || 'clipboard.png' }}</span>\n <button type=\"button\" class=\"wu-chat-pending-remove\" [attr.aria-label]=\"(t?.removeFile || 'Remove file') + ' ' + (p.file.name || '')\" (click)=\"removePending(i)\">\u00D7</button>\n </span>\n </div>\n <div class=\"wu-chat-composer\">\n <input #fileInput type=\"file\" multiple hidden [attr.accept]=\"accept || null\" (change)=\"onFilesChosen($event)\" />\n <button\n *ngIf=\"attach\"\n type=\"button\"\n class=\"wu-chat-icon-button\"\n [attr.aria-label]=\"t?.attach || 'Attach files'\"\n [attr.title]=\"t?.attach || 'Attach files'\"\n (click)=\"openFiles()\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M13.5 7.5 8 13a3.5 3.5 0 0 1-5-5l6-6a2.3 2.3 0 0 1 3.3 3.3L6.5 11a1.2 1.2 0 0 1-1.7-1.7L10 4.2\" /></svg>\n </button>\n <textarea\n #box\n class=\"wu-chat-input\"\n rows=\"1\"\n [value]=\"draft\"\n [attr.placeholder]=\"placeholder || t?.placeholder || 'Type a message'\"\n [attr.aria-label]=\"placeholder || t?.placeholder || 'Type a message'\"\n (input)=\"draft = box.value; onInput()\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n ></textarea>\n <button\n type=\"button\"\n class=\"wu-chat-send\"\n [disabled]=\"!canSend\"\n [attr.aria-label]=\"t?.send || 'Send'\"\n [attr.title]=\"t?.send || 'Send'\"\n [attr.aria-busy]=\"sending || null\"\n (click)=\"send()\"\n >\n <span *ngIf=\"sending; else plane\" class=\"wu-chat-spinner\" aria-hidden=\"true\"></span>\n <ng-template #plane>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M14.5 1.5 7 9M14.5 1.5 10 14.5 7 9 1.5 6z\" /></svg>\n </ng-template>\n </button>\n </div>\n </ng-template>\n</section>\n", styles: ["@layer wiraui.components{wu-chat{display:block;min-width:0}.wu-chat{display:flex;flex-direction:column;box-sizing:border-box;height:var(--wu-chat-height);min-height:0;overflow:hidden;border:1px solid var(--wu-border);border-radius:var(--wu-card-radius);background:var(--wu-card-bg);color:var(--wu-text);font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-chat-scroll{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--wu-chat-gap);min-height:0;padding:1rem;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.wu-chat-more{display:flex;justify-content:center;padding-bottom:.5rem}.wu-chat-more-button,.wu-chat-retry{margin:0;padding:.25rem .75rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-full);background:var(--wu-card-bg);color:var(--wu-text-muted);font:inherit;font-size:.8125rem;cursor:pointer}.wu-chat-more-button:hover,.wu-chat-retry:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-loading,.wu-chat-empty{display:flex;flex:1 1 auto;flex-direction:column;align-items:center;justify-content:center;gap:.25rem;color:var(--wu-text-muted);text-align:center}.wu-chat-empty strong{color:var(--wu-text);font-family:var(--wu-heading-font-family);font-weight:600}.wu-chat-empty-art{width:4rem;margin-bottom:.5rem;fill:color-mix(in srgb,var(--wu-primary-color) 12%,transparent);stroke:var(--wu-primary-color);stroke-width:1.5;stroke-linejoin:round}.wu-chat-day,.wu-chat-system{display:flex;justify-content:center;margin:.75rem 0 .5rem}.wu-chat-day>span,.wu-chat-system>span{padding:.125rem .75rem;border-radius:var(--wu-radius-full);background:var(--wu-hover-bg);color:var(--wu-text-muted);font-size:.75rem;text-align:center}.wu-chat-line{display:flex;align-items:flex-end;gap:.5rem;max-width:100%}.wu-chat-line.wu-chat-first{margin-top:.5rem}.wu-chat-mine{flex-direction:row-reverse}.wu-chat-avatar{display:inline-flex;flex:none;align-self:flex-start;align-items:center;justify-content:center;width:2rem;height:2rem;overflow:hidden;border-radius:50%}.wu-chat-first .wu-chat-avatar{background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.75rem;font-weight:600}.wu-chat-avatar img{width:100%;height:100%;object-fit:cover}.wu-chat-stack{display:flex;flex-direction:column;align-items:flex-start;gap:.125rem;min-width:0;max-width:min(75%,36rem)}.wu-chat-mine .wu-chat-stack{align-items:flex-end}.wu-chat-name{display:inline-flex;align-items:center;gap:.375rem;padding:0 .5rem;color:var(--wu-text-muted);font-size:.75rem}.wu-chat-badge{padding:0 .375rem;border-radius:var(--wu-radius-full);background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.6875rem;font-weight:600}.wu-chat-bubble-row{display:flex;align-items:flex-end;gap:.375rem;min-width:0}.wu-chat-mine .wu-chat-bubble-row{flex-direction:row-reverse}.wu-chat-bubble{display:flex;flex-direction:column;gap:.375rem;min-width:0;padding:.5rem .875rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg);color:var(--wu-chat-bubble-color);overflow-wrap:anywhere}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-last) .wu-chat-bubble{border-end-start-radius:.375rem}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-first) .wu-chat-bubble{border-start-start-radius:.375rem}.wu-chat-mine .wu-chat-bubble{background:var(--wu-chat-mine-bg);color:var(--wu-chat-mine-color)}.wu-chat-mine:not(.wu-chat-last) .wu-chat-bubble{border-end-end-radius:.375rem}.wu-chat-mine:not(.wu-chat-first) .wu-chat-bubble{border-start-end-radius:.375rem}.wu-chat-sending .wu-chat-bubble{opacity:.6}.wu-chat-failed .wu-chat-bubble{outline:1px solid var(--wu-danger-color)}.wu-chat-text{white-space:pre-wrap}.wu-chat-meta{display:flex;flex:none;flex-direction:column;align-items:flex-end;color:var(--wu-chat-meta-color);font-size:.6875rem;line-height:1.3;white-space:nowrap}.wu-chat-line:not(.wu-chat-mine) .wu-chat-meta{align-items:flex-start}.wu-chat-error{color:var(--wu-danger-text);font-weight:600}.wu-chat-retry{margin-top:.125rem;padding:0 .5rem;font-size:.6875rem}.wu-chat-image{display:block;overflow:hidden;border-radius:calc(var(--wu-chat-bubble-radius) - .25rem);cursor:pointer}.wu-chat-image img{display:block;max-width:min(16rem,100%);max-height:16rem;object-fit:cover}.wu-chat-file{display:inline-flex;align-items:center;gap:.5rem;min-width:0;padding:.5rem .75rem;border-radius:var(--wu-radius-md);background:color-mix(in srgb,currentColor 10%,transparent);color:inherit;text-decoration:none;cursor:pointer}.wu-chat-file svg,.wu-chat-icon-button svg,.wu-chat-send svg,.wu-chat-pending-item svg{flex:none;width:1.125rem;height:1.125rem;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.wu-chat-file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-file-size{flex:none;opacity:.7;font-size:.75rem}.wu-chat-typing{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;color:var(--wu-text-muted);font-size:.8125rem}.wu-chat-dots{display:inline-flex;gap:3px;padding:.5rem .625rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg)}.wu-chat-dots i{width:6px;height:6px;border-radius:50%;background:currentColor;animation:wu-chat-dot 1.2s infinite ease-in-out}.wu-chat-dots i:nth-child(2){animation-delay:.15s}.wu-chat-dots i:nth-child(3){animation-delay:.3s}@keyframes wu-chat-dot{0%,60%,to{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}.wu-chat-closed{padding:.875rem 1rem;border-top:1px solid var(--wu-border);color:var(--wu-text-muted);font-size:.875rem;text-align:center}.wu-chat-pending{display:flex;flex-wrap:wrap;gap:.5rem;padding:.5rem .75rem 0;border-top:1px solid var(--wu-border)}.wu-chat-pending-item{display:inline-flex;align-items:center;gap:.375rem;max-width:14rem;padding:.25rem .25rem .25rem .375rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-md);font-size:.8125rem}.wu-chat-pending-item img{width:1.75rem;height:1.75rem;border-radius:var(--wu-radius-sm);object-fit:cover}.wu-chat-pending-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-pending-remove{width:1.5rem;height:1.5rem;margin:0;padding:0;border:0;border-radius:var(--wu-radius-sm);background:transparent;color:var(--wu-text-muted);font-size:1rem;line-height:1;cursor:pointer}.wu-chat-pending-remove:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-composer{display:flex;align-items:flex-end;gap:.5rem;padding:.625rem .75rem;border-top:1px solid var(--wu-border)}.wu-chat-pending+.wu-chat-composer{border-top:0}.wu-chat-input{flex:1 1 auto;box-sizing:border-box;min-width:0;max-height:10rem;margin:0;padding:.5rem .875rem;border:var(--wu-field-border-width) solid var(--wu-field-border);border-radius:var(--wu-radius-xl);background:var(--wu-field-bg);color:var(--wu-field-color);font:inherit;line-height:1.5;resize:none;outline:none}.wu-chat-input::placeholder{color:var(--wu-field-placeholder)}.wu-chat-input:focus{border-color:var(--wu-primary-color);box-shadow:var(--wu-control-focus-shadow)}.wu-chat-icon-button,.wu-chat-send{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2.375rem;height:2.375rem;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wu-text-muted);cursor:pointer}.wu-chat-icon-button:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-send{background:var(--wu-primary-color);color:var(--wu-primary-contrast)}.wu-chat-send:hover:not(:disabled){background:var(--wu-primary-hover)}.wu-chat-send:disabled{opacity:var(--wu-disabled-opacity);cursor:default}:is(.wu-chat-icon-button,.wu-chat-send,.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove,.wu-chat-image,.wu-chat-file):focus-visible{outline:var(--wu-control-focus-outline);outline-offset:var(--wu-control-focus-offset)}.wu-chat-spinner{width:1rem;height:1rem;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:wu-chat-spin .8s linear infinite}.wu-chat-loading .wu-chat-spinner{width:1.75rem;height:1.75rem;color:var(--wu-primary-color)}@keyframes wu-chat-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.wu-chat-dots i,.wu-chat-spinner{animation-duration:.01ms;animation-iteration-count:1}}@media(pointer:coarse){.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove{min-width:24px;min-height:24px}}@media(max-width:480px){.wu-chat-stack{max-width:85%}.wu-chat-scroll{padding:.75rem}}}\n"], dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
300
+ }
301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: WuChat, decorators: [{
302
+ type: Component,
303
+ args: [{ selector: 'wu-chat', standalone: true, imports: [NgFor, NgIf, NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'wu-chat-host' }, template: "<section [class]=\"rootClass\" [style]=\"rootStyle\" [attr.aria-label]=\"ariaLabel || t?.messages || null\">\n <div #scroller class=\"wu-chat-scroll\" role=\"log\" aria-live=\"polite\" (scroll)=\"onScroll()\">\n <div *ngIf=\"hasMore && !loading\" class=\"wu-chat-more\">\n <button type=\"button\" class=\"wu-chat-more-button\" (click)=\"onLoadMore.emit()\">{{ t?.loadMore || 'Earlier messages' }}</button>\n </div>\n\n <div *ngIf=\"loading\" class=\"wu-chat-loading\" aria-busy=\"true\"><span class=\"wu-chat-spinner\" aria-hidden=\"true\"></span></div>\n\n <div *ngIf=\"!loading && !messages.length\" class=\"wu-chat-empty\">\n <svg class=\"wu-chat-empty-art\" viewBox=\"0 0 64 48\" aria-hidden=\"true\">\n <path d=\"M8 6h34a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H22l-9 8v-8H8a6 6 0 0 1-6-6V12a6 6 0 0 1 6-6z\" />\n <path d=\"M54 18h2a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6h-2v6l-8-6H34a6 6 0 0 1-6-6v-2\" />\n </svg>\n <strong>{{ t?.emptyTitle || 'No messages yet' }}</strong>\n <span *ngIf=\"!readonly\">{{ t?.emptyDescription || 'Start typing below' }}</span>\n </div>\n\n <ng-container *ngIf=\"!loading\">\n <ng-container *ngFor=\"let row of view; trackBy: trackRow\">\n <div *ngIf=\"row.kind === 'day'\" class=\"wu-chat-day\"><span>{{ row.label }}</span></div>\n\n <div *ngIf=\"row.kind === 'system'\" class=\"wu-chat-system\">\n <span>{{ row.message.text }}<ng-container *ngIf=\"row.time\"> \u00B7 {{ row.time }}</ng-container></span>\n </div>\n\n <div\n *ngIf=\"row.kind === 'message'\"\n class=\"wu-chat-line\"\n [class.wu-chat-mine]=\"row.mine\"\n [class.wu-chat-first]=\"row.first\"\n [class.wu-chat-last]=\"row.last\"\n [class.wu-chat-sending]=\"row.message.status === 'sending'\"\n [class.wu-chat-failed]=\"row.message.status === 'failed'\"\n >\n <div *ngIf=\"!row.mine && showAvatars\" class=\"wu-chat-avatar\" aria-hidden=\"true\">\n <ng-container *ngIf=\"row.first\">\n <img *ngIf=\"row.message.sender?.avatar; else letters\" [src]=\"row.message.sender?.avatar\" alt=\"\" />\n <ng-template #letters><span>{{ initials(row.message.sender?.name) }}</span></ng-template>\n </ng-container>\n </div>\n <div class=\"wu-chat-stack\">\n <span *ngIf=\"!row.mine && row.first && row.message.sender?.name\" class=\"wu-chat-name\">\n {{ row.message.sender?.name }}\n <span *ngIf=\"row.message.sender?.badge\" class=\"wu-chat-badge\">{{ row.message.sender?.badge }}</span>\n </span>\n <div class=\"wu-chat-bubble-row\">\n <div class=\"wu-chat-bubble\">\n <ng-container *ngIf=\"messageTemplate; else plain\">\n <ng-container *ngTemplateOutlet=\"messageTemplate; context: { $implicit: row.message, mine: row.mine }\"></ng-container>\n </ng-container>\n <ng-template #plain>\n <ng-container *ngFor=\"let a of row.message.attachments || []\">\n <a\n *ngIf=\"isImage(a); else fileCard\"\n class=\"wu-chat-image\"\n [attr.href]=\"a.url || null\"\n [attr.target]=\"a.url ? '_blank' : null\"\n [attr.rel]=\"a.url ? 'noopener' : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <img [src]=\"a.thumbnail || a.url\" [alt]=\"a.name\" loading=\"lazy\" />\n </a>\n <ng-template #fileCard>\n <a\n class=\"wu-chat-file\"\n [attr.href]=\"a.url || null\"\n [attr.download]=\"a.url ? a.name : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n <span class=\"wu-chat-file-name\">{{ a.name }}</span>\n <span *ngIf=\"a.size !== undefined\" class=\"wu-chat-file-size\">{{ sizeText(a.size) }}</span>\n </a>\n </ng-template>\n </ng-container>\n <span *ngIf=\"row.message.text\" class=\"wu-chat-text\">{{ row.message.text }}</span>\n </ng-template>\n </div>\n <div class=\"wu-chat-meta\">\n <ng-container *ngIf=\"row.message.status === 'failed'; else normal\">\n <span class=\"wu-chat-error\">{{ t?.failed || 'Not sent' }}</span>\n <button type=\"button\" class=\"wu-chat-retry\" (click)=\"onRetry.emit(row.message)\">{{ t?.retry || 'Send again' }}</button>\n </ng-container>\n <ng-template #normal>\n <span *ngIf=\"row.mine && row.message.read\">{{ readText(row.message) }}</span>\n <span>{{ row.time }}</span>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n <div *ngIf=\"typingText\" class=\"wu-chat-typing\">\n <span class=\"wu-chat-dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span>\n {{ typingText }}\n </div>\n </div>\n\n <div *ngIf=\"readonly; else composer\" class=\"wu-chat-closed\">{{ readonlyMessage || t?.closed || 'This conversation is closed' }}</div>\n <ng-template #composer>\n <div *ngIf=\"pending.length\" class=\"wu-chat-pending\">\n <span *ngFor=\"let p of pending; let i = index\" class=\"wu-chat-pending-item\">\n <img *ngIf=\"p.preview; else pendingIcon\" [src]=\"p.preview\" alt=\"\" />\n <ng-template #pendingIcon>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n </ng-template>\n <span class=\"wu-chat-pending-name\">{{ p.file.name || 'clipboard.png' }}</span>\n <button type=\"button\" class=\"wu-chat-pending-remove\" [attr.aria-label]=\"(t?.removeFile || 'Remove file') + ' ' + (p.file.name || '')\" (click)=\"removePending(i)\">\u00D7</button>\n </span>\n </div>\n <div class=\"wu-chat-composer\">\n <input #fileInput type=\"file\" multiple hidden [attr.accept]=\"accept || null\" (change)=\"onFilesChosen($event)\" />\n <button\n *ngIf=\"attach\"\n type=\"button\"\n class=\"wu-chat-icon-button\"\n [attr.aria-label]=\"t?.attach || 'Attach files'\"\n [attr.title]=\"t?.attach || 'Attach files'\"\n (click)=\"openFiles()\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M13.5 7.5 8 13a3.5 3.5 0 0 1-5-5l6-6a2.3 2.3 0 0 1 3.3 3.3L6.5 11a1.2 1.2 0 0 1-1.7-1.7L10 4.2\" /></svg>\n </button>\n <textarea\n #box\n class=\"wu-chat-input\"\n rows=\"1\"\n [value]=\"draft\"\n [attr.placeholder]=\"placeholder || t?.placeholder || 'Type a message'\"\n [attr.aria-label]=\"placeholder || t?.placeholder || 'Type a message'\"\n (input)=\"draft = box.value; onInput()\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n ></textarea>\n <button\n type=\"button\"\n class=\"wu-chat-send\"\n [disabled]=\"!canSend\"\n [attr.aria-label]=\"t?.send || 'Send'\"\n [attr.title]=\"t?.send || 'Send'\"\n [attr.aria-busy]=\"sending || null\"\n (click)=\"send()\"\n >\n <span *ngIf=\"sending; else plane\" class=\"wu-chat-spinner\" aria-hidden=\"true\"></span>\n <ng-template #plane>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M14.5 1.5 7 9M14.5 1.5 10 14.5 7 9 1.5 6z\" /></svg>\n </ng-template>\n </button>\n </div>\n </ng-template>\n</section>\n", styles: ["@layer wiraui.components{wu-chat{display:block;min-width:0}.wu-chat{display:flex;flex-direction:column;box-sizing:border-box;height:var(--wu-chat-height);min-height:0;overflow:hidden;border:1px solid var(--wu-border);border-radius:var(--wu-card-radius);background:var(--wu-card-bg);color:var(--wu-text);font-family:var(--wu-font-family);font-size:var(--wu-font-size);line-height:var(--wu-line-height)}.wu-chat-scroll{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--wu-chat-gap);min-height:0;padding:1rem;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.wu-chat-more{display:flex;justify-content:center;padding-bottom:.5rem}.wu-chat-more-button,.wu-chat-retry{margin:0;padding:.25rem .75rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-full);background:var(--wu-card-bg);color:var(--wu-text-muted);font:inherit;font-size:.8125rem;cursor:pointer}.wu-chat-more-button:hover,.wu-chat-retry:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-loading,.wu-chat-empty{display:flex;flex:1 1 auto;flex-direction:column;align-items:center;justify-content:center;gap:.25rem;color:var(--wu-text-muted);text-align:center}.wu-chat-empty strong{color:var(--wu-text);font-family:var(--wu-heading-font-family);font-weight:600}.wu-chat-empty-art{width:4rem;margin-bottom:.5rem;fill:color-mix(in srgb,var(--wu-primary-color) 12%,transparent);stroke:var(--wu-primary-color);stroke-width:1.5;stroke-linejoin:round}.wu-chat-day,.wu-chat-system{display:flex;justify-content:center;margin:.75rem 0 .5rem}.wu-chat-day>span,.wu-chat-system>span{padding:.125rem .75rem;border-radius:var(--wu-radius-full);background:var(--wu-hover-bg);color:var(--wu-text-muted);font-size:.75rem;text-align:center}.wu-chat-line{display:flex;align-items:flex-end;gap:.5rem;max-width:100%}.wu-chat-line.wu-chat-first{margin-top:.5rem}.wu-chat-mine{flex-direction:row-reverse}.wu-chat-avatar{display:inline-flex;flex:none;align-self:flex-start;align-items:center;justify-content:center;width:2rem;height:2rem;overflow:hidden;border-radius:50%}.wu-chat-first .wu-chat-avatar{background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.75rem;font-weight:600}.wu-chat-avatar img{width:100%;height:100%;object-fit:cover}.wu-chat-stack{display:flex;flex-direction:column;align-items:flex-start;gap:.125rem;min-width:0;max-width:min(75%,36rem)}.wu-chat-mine .wu-chat-stack{align-items:flex-end}.wu-chat-name{display:inline-flex;align-items:center;gap:.375rem;padding:0 .5rem;color:var(--wu-text-muted);font-size:.75rem}.wu-chat-badge{padding:0 .375rem;border-radius:var(--wu-radius-full);background:color-mix(in srgb,var(--wu-primary-color) var(--wu-tag-soft-mix),transparent);color:var(--wu-primary-soft-text);font-size:.6875rem;font-weight:600}.wu-chat-bubble-row{display:flex;align-items:flex-end;gap:.375rem;min-width:0}.wu-chat-mine .wu-chat-bubble-row{flex-direction:row-reverse}.wu-chat-bubble{display:flex;flex-direction:column;gap:.375rem;min-width:0;padding:.5rem .875rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg);color:var(--wu-chat-bubble-color);overflow-wrap:anywhere}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-last) .wu-chat-bubble{border-end-start-radius:.375rem}.wu-chat-line:not(.wu-chat-mine):not(.wu-chat-first) .wu-chat-bubble{border-start-start-radius:.375rem}.wu-chat-mine .wu-chat-bubble{background:var(--wu-chat-mine-bg);color:var(--wu-chat-mine-color)}.wu-chat-mine:not(.wu-chat-last) .wu-chat-bubble{border-end-end-radius:.375rem}.wu-chat-mine:not(.wu-chat-first) .wu-chat-bubble{border-start-end-radius:.375rem}.wu-chat-sending .wu-chat-bubble{opacity:.6}.wu-chat-failed .wu-chat-bubble{outline:1px solid var(--wu-danger-color)}.wu-chat-text{white-space:pre-wrap}.wu-chat-meta{display:flex;flex:none;flex-direction:column;align-items:flex-end;color:var(--wu-chat-meta-color);font-size:.6875rem;line-height:1.3;white-space:nowrap}.wu-chat-line:not(.wu-chat-mine) .wu-chat-meta{align-items:flex-start}.wu-chat-error{color:var(--wu-danger-text);font-weight:600}.wu-chat-retry{margin-top:.125rem;padding:0 .5rem;font-size:.6875rem}.wu-chat-image{display:block;overflow:hidden;border-radius:calc(var(--wu-chat-bubble-radius) - .25rem);cursor:pointer}.wu-chat-image img{display:block;max-width:min(16rem,100%);max-height:16rem;object-fit:cover}.wu-chat-file{display:inline-flex;align-items:center;gap:.5rem;min-width:0;padding:.5rem .75rem;border-radius:var(--wu-radius-md);background:color-mix(in srgb,currentColor 10%,transparent);color:inherit;text-decoration:none;cursor:pointer}.wu-chat-file svg,.wu-chat-icon-button svg,.wu-chat-send svg,.wu-chat-pending-item svg{flex:none;width:1.125rem;height:1.125rem;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.wu-chat-file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-file-size{flex:none;opacity:.7;font-size:.75rem}.wu-chat-typing{display:flex;align-items:center;gap:.5rem;margin-top:.5rem;color:var(--wu-text-muted);font-size:.8125rem}.wu-chat-dots{display:inline-flex;gap:3px;padding:.5rem .625rem;border-radius:var(--wu-chat-bubble-radius);background:var(--wu-chat-bubble-bg)}.wu-chat-dots i{width:6px;height:6px;border-radius:50%;background:currentColor;animation:wu-chat-dot 1.2s infinite ease-in-out}.wu-chat-dots i:nth-child(2){animation-delay:.15s}.wu-chat-dots i:nth-child(3){animation-delay:.3s}@keyframes wu-chat-dot{0%,60%,to{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}.wu-chat-closed{padding:.875rem 1rem;border-top:1px solid var(--wu-border);color:var(--wu-text-muted);font-size:.875rem;text-align:center}.wu-chat-pending{display:flex;flex-wrap:wrap;gap:.5rem;padding:.5rem .75rem 0;border-top:1px solid var(--wu-border)}.wu-chat-pending-item{display:inline-flex;align-items:center;gap:.375rem;max-width:14rem;padding:.25rem .25rem .25rem .375rem;border:1px solid var(--wu-border);border-radius:var(--wu-radius-md);font-size:.8125rem}.wu-chat-pending-item img{width:1.75rem;height:1.75rem;border-radius:var(--wu-radius-sm);object-fit:cover}.wu-chat-pending-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wu-chat-pending-remove{width:1.5rem;height:1.5rem;margin:0;padding:0;border:0;border-radius:var(--wu-radius-sm);background:transparent;color:var(--wu-text-muted);font-size:1rem;line-height:1;cursor:pointer}.wu-chat-pending-remove:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-composer{display:flex;align-items:flex-end;gap:.5rem;padding:.625rem .75rem;border-top:1px solid var(--wu-border)}.wu-chat-pending+.wu-chat-composer{border-top:0}.wu-chat-input{flex:1 1 auto;box-sizing:border-box;min-width:0;max-height:10rem;margin:0;padding:.5rem .875rem;border:var(--wu-field-border-width) solid var(--wu-field-border);border-radius:var(--wu-radius-xl);background:var(--wu-field-bg);color:var(--wu-field-color);font:inherit;line-height:1.5;resize:none;outline:none}.wu-chat-input::placeholder{color:var(--wu-field-placeholder)}.wu-chat-input:focus{border-color:var(--wu-primary-color);box-shadow:var(--wu-control-focus-shadow)}.wu-chat-icon-button,.wu-chat-send{display:inline-flex;flex:none;align-items:center;justify-content:center;width:2.375rem;height:2.375rem;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wu-text-muted);cursor:pointer}.wu-chat-icon-button:hover{background:var(--wu-hover-bg);color:var(--wu-text)}.wu-chat-send{background:var(--wu-primary-color);color:var(--wu-primary-contrast)}.wu-chat-send:hover:not(:disabled){background:var(--wu-primary-hover)}.wu-chat-send:disabled{opacity:var(--wu-disabled-opacity);cursor:default}:is(.wu-chat-icon-button,.wu-chat-send,.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove,.wu-chat-image,.wu-chat-file):focus-visible{outline:var(--wu-control-focus-outline);outline-offset:var(--wu-control-focus-offset)}.wu-chat-spinner{width:1rem;height:1rem;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:wu-chat-spin .8s linear infinite}.wu-chat-loading .wu-chat-spinner{width:1.75rem;height:1.75rem;color:var(--wu-primary-color)}@keyframes wu-chat-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.wu-chat-dots i,.wu-chat-spinner{animation-duration:.01ms;animation-iteration-count:1}}@media(pointer:coarse){.wu-chat-more-button,.wu-chat-retry,.wu-chat-pending-remove{min-width:24px;min-height:24px}}@media(max-width:480px){.wu-chat-stack{max-width:85%}.wu-chat-scroll{padding:.75rem}}}\n"] }]
304
+ }], ctorParameters: () => [], propDecorators: { messages: [{
305
+ type: Input
306
+ }], currentUserId: [{
307
+ type: Input
308
+ }], typing: [{
309
+ type: Input
310
+ }], readonly: [{
311
+ type: Input
312
+ }], readonlyMessage: [{
313
+ type: Input
314
+ }], placeholder: [{
315
+ type: Input
316
+ }], loading: [{
317
+ type: Input
318
+ }], sending: [{
319
+ type: Input
320
+ }], attach: [{
321
+ type: Input
322
+ }], accept: [{
323
+ type: Input
324
+ }], maxFileSize: [{
325
+ type: Input
326
+ }], groupMinutes: [{
327
+ type: Input
328
+ }], hasMore: [{
329
+ type: Input
330
+ }], showAvatars: [{
331
+ type: Input
332
+ }], height: [{
333
+ type: Input
334
+ }], ariaLabel: [{
335
+ type: Input
336
+ }], styleClass: [{
337
+ type: Input
338
+ }], style: [{
339
+ type: Input
340
+ }], onSend: [{
341
+ type: Output
342
+ }], onTyping: [{
343
+ type: Output
344
+ }], onAttachmentClick: [{
345
+ type: Output
346
+ }], onRetry: [{
347
+ type: Output
348
+ }], onLoadMore: [{
349
+ type: Output
350
+ }], onFileRejected: [{
351
+ type: Output
352
+ }], templates: [{
353
+ type: ContentChildren,
354
+ args: [WuTemplate]
355
+ }], messageRef: [{
356
+ type: ContentChild,
357
+ args: ['message', { descendants: false }]
358
+ }], scroller: [{
359
+ type: ViewChild,
360
+ args: ['scroller']
361
+ }], box: [{
362
+ type: ViewChild,
363
+ args: ['box']
364
+ }], fileInput: [{
365
+ type: ViewChild,
366
+ args: ['fileInput']
367
+ }] } });
368
+ function startOfDay(d) {
369
+ return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
370
+ }
371
+
372
+ /** For NgModule apps. Standalone apps can import `WuChat` directly. */
373
+ class WuChatModule {
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: WuChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
375
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: WuChatModule, imports: [WuChat], exports: [WuChat] }); }
376
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: WuChatModule }); }
377
+ }
378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: WuChatModule, decorators: [{
379
+ type: NgModule,
380
+ args: [{
381
+ imports: [WuChat],
382
+ exports: [WuChat],
383
+ }]
384
+ }] });
385
+
386
+ /**
387
+ * Generated bundle index. Do not edit.
388
+ */
389
+
390
+ export { WuChat, WuChatModule };
391
+ //# sourceMappingURL=wirabyte-ui-chat.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirabyte-ui-chat.mjs","sources":["../../lib/chat/chat.component.ts","../../lib/chat/chat.component.html","../../lib/chat/chat.module.ts","../../lib/chat/wirabyte-ui-chat.ts"],"sourcesContent":["import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common';\nimport {\n AfterViewChecked,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChild,\n ContentChildren,\n ElementRef,\n EventEmitter,\n inject,\n Input,\n OnDestroy,\n Output,\n QueryList,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n ɵassertSupportedAngular,\n ɵfindTemplate,\n ɵrefreshOnTranslation,\n ɵtoBool,\n ɵWU_SKIP_VERSION_CHECK,\n WuConfig,\n WuTemplate,\n} from '@wirabyte/ui/config';\nimport { datePattern, formatDate, toDateValue, WuChatMessages } from '@wirabyte/ui/core';\nimport { WuChatAttachment, WuChatAttachmentClickEvent, WuChatMessage, WuChatSendEvent, ɵWuChatRow } from './chat.types';\n\nconst IMAGE = /\\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i;\nconst NEAR_BOTTOM = 80;\n/** Thai vowels written before their consonant: an initial is the consonant, not these. */\nconst LEADING_VOWEL = /[\\u0E40-\\u0E44]/;\nconst TYPING_EVERY = 2000;\nconst asTemplate = (v: unknown): TemplateRef<unknown> | null => (v instanceof TemplateRef ? v : null);\n\n/** A file waiting in the composer, with a preview URL when it is a picture. */\ninterface Pending {\n file: File;\n preview: string | null;\n}\n\n/**\n * A conversation: `<wu-chat [messages]=\"messages\" [currentUserId]=\"me.id\" (onSend)=\"send($event)\">`. Bubbles on the\n * left for others and on the right for you, grouped by sender and time, day separators (วันนี้, เมื่อวาน, then the date\n * in the app's calendar), pictures and file cards, read marks, who is typing, and a message box that grows with the\n * text: Enter sends, Shift+Enter starts a new line, pasted pictures are attached. New messages scroll into view unless\n * the reader has scrolled up to read older ones. The component only shows and emits; sending is the app's job.\n */\n@Component({\n selector: 'wu-chat',\n standalone: true,\n imports: [NgFor, NgIf, NgTemplateOutlet],\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.css'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'wu-chat-host' },\n})\nexport class WuChat implements AfterViewChecked, OnDestroy {\n @Input() set messages(v: WuChatMessage[] | null | undefined) {\n const list = Array.isArray(v) ? v : [];\n const grew = list.length > this._messages.length;\n const last = list[list.length - 1];\n // Follow new messages while the reader is at the bottom, and always after sending one yourself.\n if (grew && (this.atBottom || (last && this.isMine(last)))) this.scrollPending = true;\n this._messages = list;\n this.rows = null;\n }\n get messages(): WuChatMessage[] {\n return this._messages;\n }\n /** Your user id: messages whose `sender.id` matches are drawn on the right. `mine` on a message wins. */\n @Input() currentUserId?: string | number | null;\n /** Names of the people typing right now. */\n @Input() typing?: string[] | string | null;\n /** No message box: a closed conversation. `readonlyMessage` replaces the default line. */\n @Input() set readonly(v: unknown) { this._readonly = ɵtoBool(v); }\n get readonly(): boolean { return this._readonly; }\n @Input() readonlyMessage?: string | null;\n @Input() placeholder?: string | null;\n /** A spinner instead of the messages while they load. */\n @Input() set loading(v: unknown) { this._loading = ɵtoBool(v); }\n get loading(): boolean { return this._loading; }\n /** The send button shows a spinner and the box waits. */\n @Input() set sending(v: unknown) { this._sending = ɵtoBool(v); }\n get sending(): boolean { return this._sending; }\n /** `false` hides the attach button (pasting files then does nothing either). */\n @Input() set attach(v: unknown) { this._attach = v === undefined ? true : ɵtoBool(v); }\n get attach(): boolean { return this._attach; }\n /** File types the attach button offers: `'image/*,.pdf'`. */\n @Input() accept?: string | null;\n /** Largest file in bytes; bigger ones are left out and emitted in `(onFileRejected)`. */\n @Input() maxFileSize?: number | null;\n /** Messages from the same sender within this many minutes join one group (one name, one avatar). Default 5. */\n @Input() groupMinutes = 5;\n /** A button above the oldest message that emits `(onLoadMore)`. */\n @Input() set hasMore(v: unknown) { this._hasMore = ɵtoBool(v); }\n get hasMore(): boolean { return this._hasMore; }\n /** `false` leaves out the avatars beside other people's messages. */\n @Input() set showAvatars(v: unknown) { this._avatars = v === undefined ? true : ɵtoBool(v); }\n get showAvatars(): boolean { return this._avatars; }\n /** Height of the whole chat. Default: the theme's (`--wu-chat-height`). `'100%'` fills a sized parent. */\n @Input() height?: string | number | null;\n @Input() ariaLabel?: string | null;\n @Input() styleClass?: string | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() style?: Record<string, any> | string | null;\n\n @Output() readonly onSend = new EventEmitter<WuChatSendEvent>();\n /** While the reader types, at most every 2 seconds: send \"is typing\" to the others. */\n @Output() readonly onTyping = new EventEmitter<void>();\n @Output() readonly onAttachmentClick = new EventEmitter<WuChatAttachmentClickEvent>();\n @Output() readonly onRetry = new EventEmitter<WuChatMessage>();\n @Output() readonly onLoadMore = new EventEmitter<void>();\n @Output() readonly onFileRejected = new EventEmitter<File>();\n\n @ContentChildren(WuTemplate) protected templates?: QueryList<WuTemplate>;\n @ContentChild('message', { descendants: false }) protected messageRef?: unknown;\n @ViewChild('scroller') private scroller?: ElementRef<HTMLElement>;\n @ViewChild('box') private box?: ElementRef<HTMLTextAreaElement>;\n @ViewChild('fileInput') private fileInput?: ElementRef<HTMLInputElement>;\n\n draft = '';\n pending: Pending[] = [];\n private _messages: WuChatMessage[] = [];\n private rows: ɵWuChatRow[] | null = null;\n private _readonly = false;\n private _loading = false;\n private _sending = false;\n private _attach = true;\n private _hasMore = false;\n private _avatars = true;\n private atBottom = true;\n private scrollPending = true;\n private lastTyping = 0;\n private readonly cdr = inject(ChangeDetectorRef);\n private readonly config = inject(WuConfig);\n private readonly i18n = ɵrefreshOnTranslation();\n private readonly translated = this.config.translationChange.subscribe(() => (this.rows = null));\n\n constructor() {\n ɵassertSupportedAngular(inject(ɵWU_SKIP_VERSION_CHECK, { optional: true }));\n }\n\n ngAfterViewChecked(): void {\n if (!this.scrollPending || !this.scroller) return;\n this.scrollPending = false;\n const el = this.scroller.nativeElement;\n el.scrollTop = el.scrollHeight;\n this.atBottom = true;\n }\n\n ngOnDestroy(): void {\n this.i18n.unsubscribe();\n this.translated.unsubscribe();\n for (const p of this.pending) if (p.preview) URL.revokeObjectURL(p.preview);\n }\n\n // ---------- what the template reads ----------\n\n get t(): WuChatMessages | undefined {\n return this.config.translation.chat;\n }\n /** `<ng-template #message let-message>`: the inside of a bubble. */\n get messageTemplate(): TemplateRef<unknown> | null {\n return asTemplate(this.messageRef) || ɵfindTemplate(this.templates, 'message');\n }\n get rootClass(): string {\n return ['wu-chat', this.styleClass || ''].filter(Boolean).join(' ');\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get rootStyle(): Record<string, any> {\n const own = this.style && typeof this.style === 'object' ? this.style : {};\n const h = this.height;\n const height = h === null || h === undefined || h === '' ? undefined : typeof h === 'number' || /^\\d+(\\.\\d+)?$/.test(String(h)) ? `${h}px` : String(h);\n return height ? { ...own, '--wu-chat-height': height } : own;\n }\n get view(): ɵWuChatRow[] {\n if (!this.rows) this.rows = this.build();\n return this.rows;\n }\n get typingText(): string {\n const names = (Array.isArray(this.typing) ? this.typing : this.typing ? [this.typing] : []).filter(Boolean);\n if (!names.length) return '';\n const t = this.t;\n if (names.length === 1) return (t?.typing ?? '{name} is typing').replace('{name}', names[0]);\n return (t?.typingMany ?? '{count} people are typing').replace('{count}', String(names.length));\n }\n get canSend(): boolean {\n return !this._sending && (!!this.draft.trim() || this.pending.length > 0);\n }\n trackRow(_: number, row: ɵWuChatRow): string {\n return row.key;\n }\n initials(name: string | undefined): string {\n const words = (name || '').trim().split(/\\s+/).filter(Boolean);\n if (!words.length) return '?';\n const first = (word: string) => Array.from(word).find((ch) => !LEADING_VOWEL.test(ch)) || word[0];\n return first(words[0]) + (words.length > 1 ? first(words[words.length - 1]) : '');\n }\n isImage(a: WuChatAttachment): boolean {\n return a.type ? a.type === 'image' : IMAGE.test(a.name) || IMAGE.test(a.url || '');\n }\n sizeText(bytes: number | undefined): string {\n if (bytes === undefined || bytes === null || !Number.isFinite(bytes)) return '';\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} kB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n }\n readText(m: WuChatMessage): string {\n if (!m.read) return '';\n if (typeof m.read === 'number' && m.read > 1) return (this.t?.readBy ?? 'Read by {count}').replace('{count}', String(m.read));\n return this.t?.read ?? 'Read';\n }\n\n // ---------- events ----------\n\n onScroll(): void {\n const el = this.scroller?.nativeElement;\n if (el) this.atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < NEAR_BOTTOM;\n }\n onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Enter' || event.shiftKey || event.isComposing) return;\n event.preventDefault();\n this.send();\n }\n onInput(): void {\n this.grow();\n const now = Date.now();\n if (this.draft && now - this.lastTyping > TYPING_EVERY) {\n this.lastTyping = now;\n this.onTyping.emit();\n }\n }\n onPaste(event: ClipboardEvent): void {\n if (!this._attach) return;\n const files = Array.from(event.clipboardData?.files || []);\n if (!files.length) return;\n event.preventDefault();\n this.add(files);\n }\n openFiles(): void {\n this.fileInput?.nativeElement.click();\n }\n onFilesChosen(event: Event): void {\n const input = event.target as HTMLInputElement;\n this.add(Array.from(input.files || []));\n input.value = '';\n }\n removePending(index: number): void {\n const [p] = this.pending.splice(index, 1);\n if (p?.preview) URL.revokeObjectURL(p.preview);\n this.pending = [...this.pending];\n }\n send(): void {\n if (!this.canSend || this._readonly) return;\n const files = this.pending.map((p) => p.file);\n for (const p of this.pending) if (p.preview) URL.revokeObjectURL(p.preview);\n this.onSend.emit({ text: this.draft.trim(), files });\n this.draft = '';\n this.pending = [];\n this.scrollPending = true;\n setTimeout(() => this.grow());\n this.cdr.markForCheck();\n }\n attachmentClick(event: Event, attachment: WuChatAttachment, message: WuChatMessage): void {\n this.onAttachmentClick.emit({ originalEvent: event, attachment, message });\n }\n\n // ---------- internals ----------\n\n private isMine(m: WuChatMessage): boolean {\n if (m.mine !== undefined) return m.mine;\n return this.currentUserId !== null && this.currentUserId !== undefined && m.sender?.id === this.currentUserId;\n }\n\n private add(files: File[]): void {\n const max = this.maxFileSize;\n const kept: Pending[] = [];\n for (const file of files) {\n if (max && file.size > max) {\n this.onFileRejected.emit(file);\n continue;\n }\n kept.push({ file, preview: file.type.startsWith('image/') && typeof URL !== 'undefined' ? URL.createObjectURL(file) : null });\n }\n this.pending = [...this.pending, ...kept];\n this.cdr.markForCheck();\n }\n\n /** The box grows with its text up to a few lines, then scrolls. */\n private grow(): void {\n const t = this.box?.nativeElement;\n if (!t || !t.getClientRects().length) return;\n t.style.height = 'auto';\n t.style.height = Math.min(t.scrollHeight, 160) + 'px';\n }\n\n private build(): ɵWuChatRow[] {\n const rows: ɵWuChatRow[] = [];\n const lang = this.config.translation.code || 'th';\n const calendar = this.config.calendarFor(lang);\n const locale = this.config.translation;\n const timeOf = (d: Date) => formatDate(d, datePattern('time', lang, calendar), { locale, calendar });\n const today = startOfDay(this.config.now());\n let day = '';\n let prev: { mine: boolean; sender: unknown; at: number } | null = null;\n this._messages.forEach((m, i) => {\n const at = toDateValue(m.time) || new Date(NaN);\n const dayKey = Number.isNaN(at.getTime()) ? '' : `${at.getFullYear()}-${at.getMonth()}-${at.getDate()}`;\n if (dayKey && dayKey !== day) {\n day = dayKey;\n const diff = Math.round((today - startOfDay(at)) / 86400000);\n const label =\n diff === 0\n ? this.t?.today ?? 'Today'\n : diff === 1\n ? this.t?.yesterday ?? 'Yesterday'\n : formatDate(at, datePattern('long', lang, calendar), { locale, calendar });\n rows.push({ kind: 'day', key: 'd' + dayKey, label });\n prev = null;\n }\n const key = 'm' + (m.id ?? i);\n const time = Number.isNaN(at.getTime()) ? '' : timeOf(at);\n if (m.system) {\n rows.push({ kind: 'system', key, message: m, time });\n prev = null;\n return;\n }\n const mine = this.isMine(m);\n const sender = m.sender?.id ?? m.sender?.name ?? null;\n const first =\n !prev || prev.mine !== mine || prev.sender !== sender || at.getTime() - prev.at > Math.max(0, this.groupMinutes) * 60000;\n if (first && rows.length) {\n const before = rows[rows.length - 1];\n if (before.kind === 'message') before.last = true;\n }\n rows.push({ kind: 'message', key, message: m, mine, first, last: false, time });\n prev = { mine, sender, at: at.getTime() };\n });\n const tail = rows[rows.length - 1];\n if (tail && tail.kind === 'message') tail.last = true;\n for (let i = 0; i < rows.length - 1; i++) {\n const r = rows[i];\n if (r.kind === 'message' && rows[i + 1].kind !== 'message') r.last = true;\n }\n return rows;\n }\n}\n\nfunction startOfDay(d: Date): number {\n return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();\n}\n","<section [class]=\"rootClass\" [style]=\"rootStyle\" [attr.aria-label]=\"ariaLabel || t?.messages || null\">\n <div #scroller class=\"wu-chat-scroll\" role=\"log\" aria-live=\"polite\" (scroll)=\"onScroll()\">\n <div *ngIf=\"hasMore && !loading\" class=\"wu-chat-more\">\n <button type=\"button\" class=\"wu-chat-more-button\" (click)=\"onLoadMore.emit()\">{{ t?.loadMore || 'Earlier messages' }}</button>\n </div>\n\n <div *ngIf=\"loading\" class=\"wu-chat-loading\" aria-busy=\"true\"><span class=\"wu-chat-spinner\" aria-hidden=\"true\"></span></div>\n\n <div *ngIf=\"!loading && !messages.length\" class=\"wu-chat-empty\">\n <svg class=\"wu-chat-empty-art\" viewBox=\"0 0 64 48\" aria-hidden=\"true\">\n <path d=\"M8 6h34a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H22l-9 8v-8H8a6 6 0 0 1-6-6V12a6 6 0 0 1 6-6z\" />\n <path d=\"M54 18h2a6 6 0 0 1 6 6v12a6 6 0 0 1-6 6h-2v6l-8-6H34a6 6 0 0 1-6-6v-2\" />\n </svg>\n <strong>{{ t?.emptyTitle || 'No messages yet' }}</strong>\n <span *ngIf=\"!readonly\">{{ t?.emptyDescription || 'Start typing below' }}</span>\n </div>\n\n <ng-container *ngIf=\"!loading\">\n <ng-container *ngFor=\"let row of view; trackBy: trackRow\">\n <div *ngIf=\"row.kind === 'day'\" class=\"wu-chat-day\"><span>{{ row.label }}</span></div>\n\n <div *ngIf=\"row.kind === 'system'\" class=\"wu-chat-system\">\n <span>{{ row.message.text }}<ng-container *ngIf=\"row.time\"> · {{ row.time }}</ng-container></span>\n </div>\n\n <div\n *ngIf=\"row.kind === 'message'\"\n class=\"wu-chat-line\"\n [class.wu-chat-mine]=\"row.mine\"\n [class.wu-chat-first]=\"row.first\"\n [class.wu-chat-last]=\"row.last\"\n [class.wu-chat-sending]=\"row.message.status === 'sending'\"\n [class.wu-chat-failed]=\"row.message.status === 'failed'\"\n >\n <div *ngIf=\"!row.mine && showAvatars\" class=\"wu-chat-avatar\" aria-hidden=\"true\">\n <ng-container *ngIf=\"row.first\">\n <img *ngIf=\"row.message.sender?.avatar; else letters\" [src]=\"row.message.sender?.avatar\" alt=\"\" />\n <ng-template #letters><span>{{ initials(row.message.sender?.name) }}</span></ng-template>\n </ng-container>\n </div>\n <div class=\"wu-chat-stack\">\n <span *ngIf=\"!row.mine && row.first && row.message.sender?.name\" class=\"wu-chat-name\">\n {{ row.message.sender?.name }}\n <span *ngIf=\"row.message.sender?.badge\" class=\"wu-chat-badge\">{{ row.message.sender?.badge }}</span>\n </span>\n <div class=\"wu-chat-bubble-row\">\n <div class=\"wu-chat-bubble\">\n <ng-container *ngIf=\"messageTemplate; else plain\">\n <ng-container *ngTemplateOutlet=\"messageTemplate; context: { $implicit: row.message, mine: row.mine }\"></ng-container>\n </ng-container>\n <ng-template #plain>\n <ng-container *ngFor=\"let a of row.message.attachments || []\">\n <a\n *ngIf=\"isImage(a); else fileCard\"\n class=\"wu-chat-image\"\n [attr.href]=\"a.url || null\"\n [attr.target]=\"a.url ? '_blank' : null\"\n [attr.rel]=\"a.url ? 'noopener' : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <img [src]=\"a.thumbnail || a.url\" [alt]=\"a.name\" loading=\"lazy\" />\n </a>\n <ng-template #fileCard>\n <a\n class=\"wu-chat-file\"\n [attr.href]=\"a.url || null\"\n [attr.download]=\"a.url ? a.name : null\"\n [attr.role]=\"a.url ? null : 'button'\"\n [attr.tabindex]=\"a.url ? null : 0\"\n (click)=\"attachmentClick($event, a, row.message)\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n <span class=\"wu-chat-file-name\">{{ a.name }}</span>\n <span *ngIf=\"a.size !== undefined\" class=\"wu-chat-file-size\">{{ sizeText(a.size) }}</span>\n </a>\n </ng-template>\n </ng-container>\n <span *ngIf=\"row.message.text\" class=\"wu-chat-text\">{{ row.message.text }}</span>\n </ng-template>\n </div>\n <div class=\"wu-chat-meta\">\n <ng-container *ngIf=\"row.message.status === 'failed'; else normal\">\n <span class=\"wu-chat-error\">{{ t?.failed || 'Not sent' }}</span>\n <button type=\"button\" class=\"wu-chat-retry\" (click)=\"onRetry.emit(row.message)\">{{ t?.retry || 'Send again' }}</button>\n </ng-container>\n <ng-template #normal>\n <span *ngIf=\"row.mine && row.message.read\">{{ readText(row.message) }}</span>\n <span>{{ row.time }}</span>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n <div *ngIf=\"typingText\" class=\"wu-chat-typing\">\n <span class=\"wu-chat-dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span>\n {{ typingText }}\n </div>\n </div>\n\n <div *ngIf=\"readonly; else composer\" class=\"wu-chat-closed\">{{ readonlyMessage || t?.closed || 'This conversation is closed' }}</div>\n <ng-template #composer>\n <div *ngIf=\"pending.length\" class=\"wu-chat-pending\">\n <span *ngFor=\"let p of pending; let i = index\" class=\"wu-chat-pending-item\">\n <img *ngIf=\"p.preview; else pendingIcon\" [src]=\"p.preview\" alt=\"\" />\n <ng-template #pendingIcon>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M9 1.5H4.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5L9 1.5zM9 1.5V5h3.5\" /></svg>\n </ng-template>\n <span class=\"wu-chat-pending-name\">{{ p.file.name || 'clipboard.png' }}</span>\n <button type=\"button\" class=\"wu-chat-pending-remove\" [attr.aria-label]=\"(t?.removeFile || 'Remove file') + ' ' + (p.file.name || '')\" (click)=\"removePending(i)\">×</button>\n </span>\n </div>\n <div class=\"wu-chat-composer\">\n <input #fileInput type=\"file\" multiple hidden [attr.accept]=\"accept || null\" (change)=\"onFilesChosen($event)\" />\n <button\n *ngIf=\"attach\"\n type=\"button\"\n class=\"wu-chat-icon-button\"\n [attr.aria-label]=\"t?.attach || 'Attach files'\"\n [attr.title]=\"t?.attach || 'Attach files'\"\n (click)=\"openFiles()\"\n >\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M13.5 7.5 8 13a3.5 3.5 0 0 1-5-5l6-6a2.3 2.3 0 0 1 3.3 3.3L6.5 11a1.2 1.2 0 0 1-1.7-1.7L10 4.2\" /></svg>\n </button>\n <textarea\n #box\n class=\"wu-chat-input\"\n rows=\"1\"\n [value]=\"draft\"\n [attr.placeholder]=\"placeholder || t?.placeholder || 'Type a message'\"\n [attr.aria-label]=\"placeholder || t?.placeholder || 'Type a message'\"\n (input)=\"draft = box.value; onInput()\"\n (keydown)=\"onKeydown($event)\"\n (paste)=\"onPaste($event)\"\n ></textarea>\n <button\n type=\"button\"\n class=\"wu-chat-send\"\n [disabled]=\"!canSend\"\n [attr.aria-label]=\"t?.send || 'Send'\"\n [attr.title]=\"t?.send || 'Send'\"\n [attr.aria-busy]=\"sending || null\"\n (click)=\"send()\"\n >\n <span *ngIf=\"sending; else plane\" class=\"wu-chat-spinner\" aria-hidden=\"true\"></span>\n <ng-template #plane>\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M14.5 1.5 7 9M14.5 1.5 10 14.5 7 9 1.5 6z\" /></svg>\n </ng-template>\n </button>\n </div>\n </ng-template>\n</section>\n","import { NgModule } from '@angular/core';\nimport { WuChat } from './chat.component';\n\n/** For NgModule apps. Standalone apps can import `WuChat` directly. */\n@NgModule({\n imports: [WuChat],\n exports: [WuChat],\n})\nexport class WuChatModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ɵtoBool","ɵrefreshOnTranslation","ɵassertSupportedAngular","ɵWU_SKIP_VERSION_CHECK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