@eifi1/ui-kit 0.23.0 → 0.24.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 (101) hide show
  1. package/README.md +6 -6
  2. package/dist/chart.d.ts +2 -4
  3. package/dist/components/amount-input.d.ts +16 -9
  4. package/dist/components/amount-input.js +13 -11
  5. package/dist/components/amount-input.js.map +1 -1
  6. package/dist/components/autocomplete.d.ts +5 -0
  7. package/dist/components/autocomplete.js +39 -37
  8. package/dist/components/autocomplete.js.map +1 -1
  9. package/dist/components/button-group.d.ts +2 -4
  10. package/dist/components/calculator.d.ts +2 -4
  11. package/dist/components/column-mapper.d.ts +62 -9
  12. package/dist/components/column-mapper.js +85 -49
  13. package/dist/components/column-mapper.js.map +1 -1
  14. package/dist/components/combobox.d.ts +33 -1
  15. package/dist/components/combobox.js +8 -2
  16. package/dist/components/combobox.js.map +1 -1
  17. package/dist/components/confirm-dialog.d.ts +2 -4
  18. package/dist/components/copy-button.d.ts +2 -4
  19. package/dist/components/danger-confirm.d.ts +2 -4
  20. package/dist/components/danger-confirm.js +52 -5
  21. package/dist/components/danger-confirm.js.map +1 -1
  22. package/dist/components/entity-combobox.d.ts +13 -1
  23. package/dist/components/entity-combobox.js +13 -4
  24. package/dist/components/entity-combobox.js.map +1 -1
  25. package/dist/components/facing-pair.d.ts +2 -4
  26. package/dist/components/file-button.d.ts +2 -4
  27. package/dist/components/file-dropzone.d.ts +2 -4
  28. package/dist/components/form-actions.d.ts +1 -3
  29. package/dist/components/form-actions.js +15 -1
  30. package/dist/components/form-actions.js.map +1 -1
  31. package/dist/components/iban-input.d.ts +2 -4
  32. package/dist/components/language-select.d.ts +2 -4
  33. package/dist/components/money-field.d.ts +2 -4
  34. package/dist/components/multi-entity-combobox.d.ts +5 -1
  35. package/dist/components/multi-entity-combobox.js +11 -3
  36. package/dist/components/multi-entity-combobox.js.map +1 -1
  37. package/dist/components/number-field.d.ts +2 -4
  38. package/dist/components/number-input.d.ts +2 -4
  39. package/dist/components/numpad-sheet.d.ts +2 -4
  40. package/dist/components/phone-input.d.ts +2 -4
  41. package/dist/components/series-chart.d.ts +2 -4
  42. package/dist/components/settings-fields.d.ts +2 -4
  43. package/dist/components/share-card.d.ts +1 -3
  44. package/dist/components/text-link.d.ts +1 -3
  45. package/dist/components/time-input.d.ts +2 -4
  46. package/dist/components/ui.d.ts +2 -4
  47. package/dist/components/ui.js +55 -17
  48. package/dist/components/ui.js.map +1 -1
  49. package/dist/feedback/feedback-attachment.d.ts +66 -1
  50. package/dist/feedback/feedback-attachment.js +32 -12
  51. package/dist/feedback/feedback-attachment.js.map +1 -1
  52. package/dist/feedback/feedback-dialog.d.ts +66 -1
  53. package/dist/feedback/feedback-inbox.d.ts +67 -253
  54. package/dist/feedback/feedback-thread.d.ts +1 -3
  55. package/dist/feedback/feedback-thread.js +8 -2
  56. package/dist/feedback/feedback-thread.js.map +1 -1
  57. package/dist/{feedback-BxeQVzwq.d.ts → feedback-DOwPu-Il.d.ts} +878 -18
  58. package/dist/feedback.d.ts +2 -4
  59. package/dist/hooks/use-file-drop.d.ts +2 -4
  60. package/dist/i18n/defaults.d.ts +2 -4
  61. package/dist/i18n/german.d.ts +2 -4
  62. package/dist/i18n/kit-labels.d.ts +1 -3
  63. package/dist/i18n/languages.d.ts +2 -4
  64. package/dist/i18n/locales/de-CH.d.ts +2 -4
  65. package/dist/i18n/locales/en.d.ts +2 -4
  66. package/dist/i18n/locales/es.d.ts +2 -4
  67. package/dist/i18n/locales/fr.d.ts +2 -4
  68. package/dist/i18n/locales/hu.d.ts +2 -4
  69. package/dist/i18n/locales/it.d.ts +2 -4
  70. package/dist/i18n/locales/zh.d.ts +2 -4
  71. package/dist/i18n/review.d.ts +2 -4
  72. package/dist/index.d.ts +2 -4
  73. package/dist/lib/strip-fade.d.ts +2 -2
  74. package/dist/lib/strip-fade.js.map +1 -1
  75. package/dist/rhf/fields.d.ts +59 -8
  76. package/dist/rhf/fields.js +61 -3
  77. package/dist/rhf/fields.js.map +1 -1
  78. package/dist/rhf/form.d.ts +2 -4
  79. package/dist/rhf.d.ts +3 -5
  80. package/dist/rhf.js.map +1 -1
  81. package/dist/shell/app-shell.d.ts +1 -3
  82. package/dist/shell/top-bar-brand.d.ts +2 -4
  83. package/dist/shell.d.ts +1 -3
  84. package/dist/wizard/stepper-nav.d.ts +2 -4
  85. package/dist/wizard.d.ts +2 -4
  86. package/package.json +1 -1
  87. package/src/components/amount-input.tsx +37 -20
  88. package/src/components/autocomplete.tsx +16 -5
  89. package/src/components/column-mapper.tsx +181 -79
  90. package/src/components/combobox.tsx +41 -3
  91. package/src/components/danger-confirm.tsx +193 -22
  92. package/src/components/entity-combobox.tsx +28 -5
  93. package/src/components/form-actions.tsx +20 -1
  94. package/src/components/multi-entity-combobox.tsx +16 -3
  95. package/src/components/ui.tsx +107 -0
  96. package/src/feedback/feedback-attachment.tsx +65 -12
  97. package/src/feedback/feedback-thread.tsx +66 -6
  98. package/src/lib/strip-fade.ts +2 -2
  99. package/src/rhf/fields.tsx +167 -6
  100. package/src/rhf.ts +1 -1
  101. package/dist/feedback-attachment-fGAzZPf0.d.ts +0 -469
@@ -1,2 +1,67 @@
1
1
  import 'react';
2
- export { D as DEFAULT_ATTACHMENT_ACCEPT, a as DEFAULT_FEEDBACK_ATTACHMENT_LABELS, c as DEFAULT_MAX_ATTACHMENTS, d as DEFAULT_MAX_ATTACHMENT_BYTES, F as FeedbackAttachmentError, e as FeedbackAttachmentErrorInfo, f as FeedbackAttachmentField, g as FeedbackAttachmentFieldLabels, h as FeedbackAttachmentFieldMultipleProps, i as FeedbackAttachmentFieldProps, j as FeedbackAttachmentFieldRefsProps, k as FeedbackAttachmentFieldSingleProps, m as FeedbackAttachmentRef, n as FeedbackAttachmentRefsError, x as pastedName } from '../feedback-attachment-fGAzZPf0.js';
2
+ export { X as DEFAULT_ATTACHMENT_ACCEPT, a5 as DEFAULT_FEEDBACK_ATTACHMENT_LABELS, ad as DEFAULT_MAX_ATTACHMENTS, ae as DEFAULT_MAX_ATTACHMENT_BYTES, aH as FeedbackAttachmentError, aI as FeedbackAttachmentErrorInfo, aJ as FeedbackAttachmentField, aK as FeedbackAttachmentFieldLabels, aL as FeedbackAttachmentFieldMultipleProps, aM as FeedbackAttachmentFieldProps, aN as FeedbackAttachmentFieldRefsProps, aO as FeedbackAttachmentFieldSingleProps, aQ as FeedbackAttachmentRef, aR as FeedbackAttachmentRefsError, cM as pastedName } from '../feedback-DOwPu-Il.js';
3
+ import '../components/tooltip.js';
4
+ import '../hooks/use-anchored-rect.js';
5
+ import '../lib/clipping.js';
6
+ import '../data-table-labels-B7OdnM0S.js';
7
+ import '../components/data-table-sort.js';
8
+ import '../components/swipeable-row.js';
9
+ import '../components/mini-calendar.js';
10
+ import '../components/calendar-heatmap.js';
11
+ import '../components/popover.js';
12
+ import '../components/chip.js';
13
+ import 'lucide-react';
14
+ import '../components/field-sync.js';
15
+ import '../wizard/types.js';
16
+ import '../tour/tour.js';
17
+ import '../search/command-palette.js';
18
+ import '../search/global-search.js';
19
+ import '../search/search-index.js';
20
+ import '../components/month-picker.js';
21
+ import '../components/page-contents.js';
22
+ import '../components/series-chart-labels.js';
23
+ import '../components/pie-chart-labels.js';
24
+ import '../components/sparkline.js';
25
+ import '../components/stat-tile.js';
26
+ import '../components/signature-pad.js';
27
+ import '../components/password-strength.js';
28
+ import '../components/swatch-picker.js';
29
+ import '../components/tile-radio.js';
30
+ import '../components/icon-picker.js';
31
+ import '../components/dialog-frame.js';
32
+ import '../components/modal.js';
33
+ import '../hooks/use-search-param-state.js';
34
+ import '../components/measured-grid.js';
35
+ import '../components/account-settings-labels.js';
36
+ import '../components/floating-panel.js';
37
+ import '../components/bulk-action-bar.js';
38
+ import '../components/list.js';
39
+ import '../components/signed-amount.js';
40
+ import '../components/breadcrumbs.js';
41
+ import '../components/toast.js';
42
+ import '../components/description-list.js';
43
+ import '../components/line-items.js';
44
+ import '../components/progress-bar.js';
45
+ import '../components/error-boundary.js';
46
+ import '../components/authed-image.js';
47
+ import '../hooks/use-authed-src.js';
48
+ import '../components/image-grid.js';
49
+ import '../components/lightbox.js';
50
+ import '../components/write-lock.js';
51
+ import '../components/legal.js';
52
+ import '../components/account-chips.js';
53
+ import '../lib/format.js';
54
+ import '../components/reauth-dialog.js';
55
+ import '../components/server-wake.js';
56
+ import '../lib/server-wake.js';
57
+ import '../components/translation-review-labels.js';
58
+ import '../lib/translation-review.js';
59
+ import '../components/country-select.js';
60
+ import '../components/inline-edit-field.js';
61
+ import '../lib/iban.js';
62
+ import '../lib/phone.js';
63
+ import '../components/sign-chip.js';
64
+ import '../components/column-mapper.js';
65
+ import '../lib/column-mapping.js';
66
+ import '../lib/table-text.js';
67
+ import '../components/field-parts.js';
@@ -27,6 +27,8 @@ const DEFAULT_FEEDBACK_ATTACHMENT_LABELS = {
27
27
  attachmentUploading: "Uploading\u2026",
28
28
  attachmentUploadFailed: (name) => `\u201C${name}\u201D could not be uploaded`
29
29
  };
30
+ const FIELD_ROOT = "relative min-w-0 max-w-full";
31
+ const buttonIcon = (size) => size === "sm" ? "size-3.5" : "size-4";
30
32
  function FeedbackAttachmentField(props) {
31
33
  if (props.refs) return /* @__PURE__ */ jsx(RefsField, { ...props });
32
34
  return props.multiple ? /* @__PURE__ */ jsx(MultipleField, { ...props }) : /* @__PURE__ */ jsx(SingleField, { ...props });
@@ -42,6 +44,8 @@ function SingleField({
42
44
  documentPaste = false,
43
45
  pasteFrom,
44
46
  disabled = false,
47
+ buttonVariant = "secondary",
48
+ buttonSize = "md",
45
49
  className
46
50
  }) {
47
51
  const [previewFor, setPreviewFor] = useState(null);
@@ -77,7 +81,7 @@ function SingleField({
77
81
  return /* @__PURE__ */ jsxs(
78
82
  "div",
79
83
  {
80
- className: cn("relative", className),
84
+ className: cn(FIELD_ROOT, className),
81
85
  onPaste,
82
86
  children: [
83
87
  /* @__PURE__ */ jsx(Heading, { text: labelsProp?.attachment }),
@@ -105,11 +109,12 @@ function SingleField({
105
109
  Button,
106
110
  {
107
111
  type: "button",
108
- variant: "secondary",
112
+ variant: buttonVariant,
113
+ size: buttonSize,
109
114
  disabled,
110
115
  onClick: () => fileInputRef.current?.click(),
111
116
  children: [
112
- /* @__PURE__ */ jsx(Paperclip, { className: "size-4" }),
117
+ /* @__PURE__ */ jsx(Paperclip, { className: buttonIcon(buttonSize) }),
113
118
  " ",
114
119
  text.attachmentAdd
115
120
  ]
@@ -121,7 +126,9 @@ function SingleField({
121
126
  capture: onCaptureScreenshot,
122
127
  onFile: pick,
123
128
  label: text.attachmentCapture,
124
- disabled
129
+ disabled,
130
+ variant: buttonVariant,
131
+ size: buttonSize
125
132
  }
126
133
  )
127
134
  ] }),
@@ -159,6 +166,8 @@ function MultipleField({
159
166
  documentPaste = false,
160
167
  pasteFrom,
161
168
  disabled = false,
169
+ buttonVariant = "secondary",
170
+ buttonSize = "md",
162
171
  className
163
172
  }) {
164
173
  const rootRef = useRef(null);
@@ -230,7 +239,7 @@ function MultipleField({
230
239
  remove: () => commit(latest.current.filter((f) => f !== file))
231
240
  }))
232
241
  ];
233
- return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative space-y-2", className), onPaste, children: [
242
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn(FIELD_ROOT, "space-y-2", className), onPaste, children: [
234
243
  /* @__PURE__ */ jsx(Heading, { text: labelsProp?.attachment, className: "mb-0" }),
235
244
  chips.length > 0 && // One chip per row, full width: wrapped chips of name-dependent widths made a
236
245
  // ragged block in a 430px dialog, and a column keeps every name and remove
@@ -265,12 +274,13 @@ function MultipleField({
265
274
  Button,
266
275
  {
267
276
  type: "button",
268
- variant: "secondary",
277
+ variant: buttonVariant,
278
+ size: buttonSize,
269
279
  "data-attachment-action": "",
270
280
  disabled,
271
281
  onClick: () => fileInputRef.current?.click(),
272
282
  children: [
273
- /* @__PURE__ */ jsx(Paperclip, { className: "size-4" }),
283
+ /* @__PURE__ */ jsx(Paperclip, { className: buttonIcon(buttonSize) }),
274
284
  " ",
275
285
  text.attachmentAdd
276
286
  ]
@@ -283,6 +293,8 @@ function MultipleField({
283
293
  onFile: capture,
284
294
  label: text.attachmentCapture,
285
295
  disabled,
296
+ variant: buttonVariant,
297
+ size: buttonSize,
286
298
  "data-attachment-action": ""
287
299
  }
288
300
  )
@@ -325,6 +337,8 @@ function RefsField({
325
337
  disabled = false,
326
338
  commit: commits,
327
339
  disabledReason: ownDisabledReason,
340
+ buttonVariant = "secondary",
341
+ buttonSize = "md",
328
342
  className
329
343
  }) {
330
344
  const rootRef = useRef(null);
@@ -429,7 +443,7 @@ function RefsField({
429
443
  onRemove?.(key);
430
444
  };
431
445
  const hasChips = value.length > 0 || uploads.length > 0;
432
- return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative space-y-2", className), onPaste, children: [
446
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn(FIELD_ROOT, "space-y-2", className), onPaste, children: [
433
447
  /* @__PURE__ */ jsx(Heading, { text: labelsProp?.attachment, className: "mb-0" }),
434
448
  hasChips && /* @__PURE__ */ jsxs("ul", { "aria-label": text.attachmentList, className: "flex flex-col gap-2", children: [
435
449
  value.map((ref, index) => /* @__PURE__ */ jsxs(
@@ -477,13 +491,14 @@ function RefsField({
477
491
  Button,
478
492
  {
479
493
  type: "button",
480
- variant: "secondary",
494
+ variant: buttonVariant,
495
+ size: buttonSize,
481
496
  "data-attachment-action": "",
482
497
  disabled,
483
498
  disabledReason: reason,
484
499
  onClick: () => fileInputRef.current?.click(),
485
500
  children: [
486
- /* @__PURE__ */ jsx(Paperclip, { className: "size-4" }),
501
+ /* @__PURE__ */ jsx(Paperclip, { className: buttonIcon(buttonSize) }),
487
502
  " ",
488
503
  text.attachmentAdd
489
504
  ]
@@ -497,6 +512,8 @@ function RefsField({
497
512
  label: text.attachmentCapture,
498
513
  disabled,
499
514
  disabledReason: reason,
515
+ variant: buttonVariant,
516
+ size: buttonSize,
500
517
  "data-attachment-action": ""
501
518
  }
502
519
  )
@@ -538,6 +555,8 @@ function CaptureButton({
538
555
  label,
539
556
  disabled = false,
540
557
  disabledReason,
558
+ variant,
559
+ size,
541
560
  ...rest
542
561
  }) {
543
562
  const [capturing, setCapturing] = useState(false);
@@ -545,7 +564,8 @@ function CaptureButton({
545
564
  Button,
546
565
  {
547
566
  type: "button",
548
- variant: "secondary",
567
+ variant,
568
+ size,
549
569
  disabled: capturing || disabled,
550
570
  disabledReason,
551
571
  ...rest,
@@ -557,7 +577,7 @@ function CaptureButton({
557
577
  }).finally(() => setCapturing(false));
558
578
  },
559
579
  children: [
560
- /* @__PURE__ */ jsx(Camera, { className: "size-4" }),
580
+ /* @__PURE__ */ jsx(Camera, { className: buttonIcon(size) }),
561
581
  " ",
562
582
  capturing ? "\u2026" : label
563
583
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/feedback/feedback-attachment.tsx"],"sourcesContent":["import { cn } from \"../lib/cn\";\nimport {\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ClipboardEvent as ReactClipboardEvent,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { Camera, FileText, Image as ImageIcon, Paperclip, X } from \"lucide-react\";\nimport { Button, IconButton, Spinner } from \"../components/ui\";\nimport { DEFAULT_FILE_PICKER_LABELS, formatAccept } from \"../components/file-button\";\nimport { useCommitReason } from \"../components/write-lock\";\nimport { useKitFileLabels, useKitLabels } from \"../i18n/kit-labels\";\nimport type { FeedbackAttachmentLabels } from \"./feedback-dialog\";\n\nexport const DEFAULT_ATTACHMENT_ACCEPT = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"];\nexport const DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;\n/** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given\n * (0.15.5). Five photos of one problem is already a lot to look through; a report\n * that needs more is a conversation, which the thread is for. */\nexport const DEFAULT_MAX_ATTACHMENTS = 5;\n\n/**\n * The field's own strings — the `feedbackAttachment` namespace of `<UiKitProvider\n * labels>`. The keys are {@link FeedbackAttachmentLabels}' own, so the `labels` prop\n * (and a whole `FeedbackDialogLabels` handed down by the dialog) merges over them\n * one to one. The optional heading, `attachment`, stays a prop: a note editor puts\n * the buttons straight under its textarea and wants none.\n *\n * Before 0.7.0 the two optional keys fell back to hard-coded English, so a German app\n * that relied on its provider got \"Capture screenshot\" under a German form.\n *\n * The three keys added in 0.15.5 for `multiple` mode are optional, so a complete\n * `UiKitLabels` typed before it still compiles; they fall back to English. So is\n * `attachmentScreenshot` (0.16.0).\n */\nexport interface FeedbackAttachmentFieldLabels {\n attachmentAdd: string;\n attachmentCapture: string;\n attachmentPaste: string;\n attachmentRemove: string;\n /** `multiple` mode: the accessible name of the list of chosen files — and, since\n * 0.16.0, the heading `<FeedbackDialog attachments=\"multiple\">` puts over it. */\n attachmentList?: string;\n /** `multiple` mode (0.16.0): what the screenshot slot's chip is called — \"Screenshot\"\n * rather than the capture's file name (\"screenshot.webp\"), which says nothing a\n * reporter chose. The file name stays as the chip's second line. */\n attachmentScreenshot?: string;\n /** `multiple` mode: one chip's remove button — \"Remove photo.jpg\". Named per file,\n * because five buttons all called \"Remove attachment\" say nothing about which. */\n attachmentRemoveFile?: (name: string) => string;\n /** `multiple` mode: the line shown in place of the add buttons once `max` is reached. */\n attachmentLimit?: (max: number) => string;\n /** `refs` mode (0.22.0, keksdose K16): the second line of a chip whose upload is still\n * running, where an uploaded one shows its size — \"Uploading…\". Optional, like the\n * keys above, so a `UiKitLabels` typed before it still compiles. */\n attachmentUploading?: string;\n /** `refs` mode (0.23.0, keksdose G5a): {@link FeedbackAttachmentErrorInfo.message} for\n * an `\"upload\"` refusal — \"“huge.png” could not be uploaded\". The other refusals'\n * sentences are the `filePicker` namespace's, shared with FileButton. Optional, like\n * the keys above. */\n attachmentUploadFailed?: (name: string) => string;\n}\n\nexport const DEFAULT_FEEDBACK_ATTACHMENT_LABELS: FeedbackAttachmentFieldLabels = {\n attachmentAdd: \"Attach image\",\n attachmentCapture: \"Capture screenshot\",\n attachmentPaste: \"…or paste a screenshot from the clipboard.\",\n attachmentRemove: \"Remove attachment\",\n attachmentList: \"Attachments\",\n attachmentScreenshot: \"Screenshot\",\n attachmentRemoveFile: (name) => `Remove ${name}`,\n attachmentLimit: (max) =>\n `Up to ${max} ${max === 1 ? \"attachment\" : \"attachments\"} — remove one to add another.`,\n attachmentUploading: \"Uploading…\",\n attachmentUploadFailed: (name) => `“${name}” could not be uploaded`,\n};\n\n/** Why a file was turned away. `\"count\"` only ever comes from `multiple` (and `refs`)\n * mode: more files arrived at once than `max` left room for, and the surplus was\n * dropped. */\nexport type FeedbackAttachmentError = \"type\" | \"size\" | \"count\";\n\n/** `refs` mode's reasons: {@link FeedbackAttachmentError}, or `\"upload\"` — `onUpload`\n * rejected, and what it rejected with is `onError`'s second argument. A type of its\n * own so a host's exhaustive switch over the File modes' reasons stays exhaustive. */\nexport type FeedbackAttachmentRefsError = FeedbackAttachmentError | \"upload\";\n\n/**\n * What `onError` knows about a refusal beyond its kind (0.23.0, keksdose G5a): the file\n * it was about, the limit that refused it, and a sentence that says both.\n *\n * keksdose's support chat toasted \"File too large\" with no name — the field's `onError`\n * carried a kind and nothing else, so a refusal could not say WHICH of three pasted\n * screenshots went, nor what the ceiling was, and its own `AttachmentPicker` (a\n * FileButton, whose `onReject` hands over `{ file, message }`) said more than the kit's\n * field would have. This is that, for every mode.\n *\n * It arrives as an EXTRA argument, after the ones `onError` already had, so a handler\n * written for 0.22 — `(kind) => …`, or `refs` mode's `(kind, error) => …` — compiles\n * and behaves as before:\n *\n * - single and `multiple`: `onError(kind, info)`;\n * - `refs`: `onError(kind, error, info)` — the second place is `onUpload`'s rejection\n * since 0.22 (`undefined` for the other kinds, as it always was), so the info comes\n * third rather than changing what a 0.22 handler reads there. It also carries that\n * `error`, so one helper `(kind, info) => …` serves all three modes.\n *\n * An object rather than more positional arguments because what a host reaches for\n * differs by kind — the bytes for `\"size\"`, `max` for `\"count\"`, the server's answer for\n * `\"upload\"` — and a field added later must not shift anyone's arguments.\n */\nexport interface FeedbackAttachmentErrorInfo {\n /** The file refused — under the name the field would have given it (a pasted image\n * is already \"pasted.png\"). For `\"count\"`, the first of the surplus; for\n * `\"upload\"`, the file whose upload failed. */\n file: File;\n /** `\"count\"`: every file of the surplus (several can arrive in one pick). Otherwise\n * `[file]`. */\n files: File[];\n /**\n * One translated sentence naming the file and the limit — the ones FileButton's\n * `onReject` hands over, from the same `filePicker` namespace: \"“huge.png” is larger\n * than 10 MB\", \"Only image/png, image/jpeg files\", \"“c.png” was not added: at most 5\n * files\" (several at once: \"3 files were not added\"). `\"upload\"`: the field's own\n * `attachmentUploadFailed`, \"“huge.png” could not be uploaded\" — a host with a better\n * sentence from the server's answer uses `error`. Ready for a toast as it is.\n */\n message: string;\n /** The field's `maxBytes` — the ceiling a `\"size\"` refusal went over, in bytes. */\n maxBytes: number;\n /** The field's `accept` — the types a `\"type\"` refusal was not among. */\n accept: string[];\n /** The field's `max` — the ceiling a `\"count\"` refusal hit. Absent in single mode,\n * which holds one file by definition. */\n max?: number;\n /** `\"upload\"` only: what `onUpload` rejected with — `onError`'s second argument. */\n error?: unknown;\n}\n\n/**\n * One uploaded attachment in `refs` mode: what the host's upload answered with. `key`\n * identifies it (a storage key, an upload id) and is what a remove goes by; `name` is\n * what the chip says. `size` (bytes) and `type` (mime) are optional — given, the chip\n * shows the size and an image icon or a file icon accordingly.\n */\nexport interface FeedbackAttachmentRef {\n key: string;\n name: string;\n size?: number;\n type?: string;\n}\n\ninterface FeedbackAttachmentFieldBaseProps {\n /** Prop > `<UiKitProvider labels={{ feedbackAttachment }}>` > English. Optional\n * since 0.7.0; `attachment` (the heading) is only ever read from here. */\n labels?: Partial<FeedbackAttachmentLabels> &\n Pick<Partial<FeedbackAttachmentFieldLabels>, \"attachmentUploading\" | \"attachmentUploadFailed\">;\n accept?: string[];\n maxBytes?: number;\n /**\n * Take no files for now (0.23.0, keksdose G5b): the add and capture buttons, the\n * hidden file input and every chip's remove button are natively disabled, and a paste\n * is let through untouched. The chips stay as they are — what is about to be sent\n * stays readable.\n *\n * For the moment a send is in flight. keksdose's support picker is `disabled` while\n * the message goes out, because the message carries the attachments AS THEY WERE at\n * the press: a chip removed mid-send has gone with it all the same, and one added\n * mid-send looks as if it had. The field has no drop target; the paste is its drop.\n *\n * This is a pause, not a lock that explains itself — for that, `refs` mode (the mode\n * that commits) takes `commit` and `disabledReason`.\n */\n disabled?: boolean;\n /** Snapshot the app view behind this and return it as a File. A \"Capture\n * screenshot\" button appears only when it is given. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** Listen for the paste on `document` rather than on this field's own\n * subtree. For a modal, which owns the whole page while it is up. */\n documentPaste?: boolean;\n /** Listen for the paste within this element's subtree rather than this\n * field's own — for a field standing *beside* the text box a paste is made\n * in, whose common parent is where the event bubbles to. Ignored when\n * `documentPaste` is set. */\n pasteFrom?: RefObject<HTMLElement | null>;\n className?: string;\n}\n\n/** One file: choosing a second means removing the first. The field's only mode until 0.15.5. */\nexport interface FeedbackAttachmentFieldSingleProps extends FeedbackAttachmentFieldBaseProps {\n multiple?: false;\n refs?: false;\n value: File | null;\n onChange: (file: File | null) => void;\n /** A file was refused. `info` (0.23.0) names it and the limit — see\n * {@link FeedbackAttachmentErrorInfo}. */\n onError?: (kind: \"type\" | \"size\", info: FeedbackAttachmentErrorInfo) => void;\n // Multiple-mode props, refused here: without `multiple` they would be silently ignored.\n max?: never;\n screenshot?: never;\n onScreenshotChange?: never;\n // `refs` mode's lock: a staged File is not a commit (see the refs props).\n commit?: never;\n disabledReason?: never;\n}\n\n/**\n * Several files (0.15.5, keksdose dev#578: \"pasted two photos, the second overwrote\n * the first\"). Every way in ADDS — a pick of several files, a paste, a capture — up to\n * `max`, and each file is a removable chip.\n */\nexport interface FeedbackAttachmentFieldMultipleProps extends FeedbackAttachmentFieldBaseProps {\n multiple: true;\n refs?: false;\n value: File[];\n onChange: (files: File[]) => void;\n /** How many files `value` may hold. Default {@link DEFAULT_MAX_ATTACHMENTS} (5). The\n * add buttons and the paste hint are offered only while there is room. */\n max?: number;\n /** Per file: a rejected one is reported and the others are still added. `\"count\"` is\n * once per pick, with the whole surplus in `info.files`. `info` (0.23.0): see\n * {@link FeedbackAttachmentErrorInfo}. */\n onError?: (kind: FeedbackAttachmentError, info: FeedbackAttachmentErrorInfo) => void;\n /**\n * A separate slot for THE screenshot, outside `value` and `max`. Given\n * `onScreenshotChange`, what `onCaptureScreenshot` returns lands here instead of in\n * `value`, shown as the first chip, and the capture button is offered only while the\n * slot is empty — a second snapshot of the same view is not more evidence. This is\n * how `<FeedbackDialog attachments=\"multiple\">` keeps the screenshot apart from the\n * photos; a form built from the parts can do the same.\n */\n screenshot?: File | null;\n onScreenshotChange?: (file: File | null) => void;\n // `refs` mode's lock: a staged File is not a commit (see the refs props).\n commit?: never;\n disabledReason?: never;\n}\n\n/**\n * Uploaded on pick (0.22.0, keksdose K16). keksdose's support chat uploads each file\n * the moment it is chosen and sends the message with the REFS the uploads answered —\n * a 10 MB screenshot is refused while the reporter is still typing, not when they\n * press Send — so its `AttachmentPicker` could not use this field, whose value is\n * `File`s held until the form is submitted. Here the value is\n * {@link FeedbackAttachmentRef}s: every way in (pick, paste, capture) validates the\n * file as the other modes do, then hands it to `onUpload` and shows a chip with a\n * spinner until it answers; the ref it resolves to joins `value` through `onChange`.\n * A rejection drops the chip and reports `onError(\"upload\", error)`. A chip is removed\n * BY KEY: `onChange` gets the list without it, and `onRemove` the key, for a host that\n * deletes the upload on the server too.\n *\n * Uploads still running count against `max`, so five picks in quick succession cannot\n * overshoot it; they are not in `value` until they land, so a send that reads `value`\n * sends only what has arrived — hold Send back while {@link onUploadingChange} says\n * an upload is running. Several files upload side by side and join in the order they\n * finish. The File modes are unchanged.\n */\nexport interface FeedbackAttachmentFieldRefsProps extends FeedbackAttachmentFieldBaseProps {\n refs: true;\n multiple?: never;\n value: FeedbackAttachmentRef[];\n onChange: (refs: FeedbackAttachmentRef[]) => void;\n /** Upload one file; resolve to its ref, or reject to refuse it. Called once per\n * accepted file, the moment it is chosen. */\n onUpload: (file: File) => Promise<FeedbackAttachmentRef>;\n /** A chip was removed — after `onChange` — with its ref's key. */\n onRemove?: (key: string) => void;\n /** Whether any upload is running: `true` when the first starts, `false` when the\n * last settles — for the host's Send, which should wait. */\n onUploadingChange?: (uploading: boolean) => void;\n /** How many refs `value` may hold, uploads in flight included. Default\n * {@link DEFAULT_MAX_ATTACHMENTS} (5). */\n max?: number;\n /** Per file. `\"upload\"` carries what `onUpload` rejected with as `error` (`undefined`\n * for the other kinds). `info` (0.23.0) comes third so a 0.22 handler's `error` is\n * still the second argument — see {@link FeedbackAttachmentErrorInfo}. */\n onError?: (kind: FeedbackAttachmentRefsError, error: unknown, info: FeedbackAttachmentErrorInfo) => void;\n /**\n * This field COMMITS (0.23.0): each file is uploaded the moment it is chosen, and a\n * remove may delete the upload (`onRemove`) — a save, unlike the File modes, which\n * only stage a file for a form sent later (and so stay open under a lock, like every\n * field). Under a locked {@link WriteLockProvider} it takes the `disabledReason` path\n * with the lock's reason, which wins over one of its own. No provider, or an unlocked\n * one: no effect.\n */\n commit?: boolean;\n /**\n * Why no file can be added or removed — the write lock's sentence, a quota, a thread\n * closed to replies. Unlike `disabled`, it SAYS so, the kit's commit-control way: the\n * buttons (add, capture, every chip's remove) stay focusable, `aria-disabled`, with\n * the reason in the kit Tooltip and their description; no pick, paste or remove gets\n * through; and the reason stands where the paste hint was, for a phone that never\n * hovers. The chips stay readable.\n */\n disabledReason?: ReactNode;\n screenshot?: never;\n onScreenshotChange?: never;\n}\n\nexport type FeedbackAttachmentFieldProps =\n | FeedbackAttachmentFieldSingleProps\n | FeedbackAttachmentFieldMultipleProps\n | FeedbackAttachmentFieldRefsProps;\n\n/**\n * Picking one picture: the file dialog, a capture of the app view, or a paste.\n * With `multiple`, picking several (see {@link FeedbackAttachmentFieldMultipleProps}).\n *\n * Lifted out of {@link FeedbackDialog} so the *reply* half of the feature can\n * have it too (Steering Design feedback #128). A report is a conversation — it\n * is filed, it is answered, and the reporter sends it back saying that is not\n * what they meant — and the screenshot showing what they mean is taken at\n * whichever of those points they looked. Only the first of them had a way to\n * attach one, so everything after it had to be described in words.\n *\n * **Three ways in, and they are three because no one of them covers the others.**\n * The file dialog needs a file on disk; `onCaptureScreenshot` snapshots the\n * *whole* app view; and the clipboard is where a region snip already is on every\n * platform (Steering Design feedback #39). Somebody who wanted to show one panel\n * had to save a crop and then find it again.\n *\n * `documentPaste` and `pasteFrom` decide where the paste is listened for, and\n * it is a real choice rather than a flag with a default. A modal traps focus,\n * so while it is up every paste in the page is meant for it — including one\n * made with nothing in particular focused, which never reaches a React\n * `onPaste` on a child: that is `documentPaste`. An editor **inline on a\n * page** is not that: the page around it has its own fields, so it listens\n * within its own subtree and a paste elsewhere stays where it was aimed. But\n * \"its own subtree\" has to include the text box the paste is actually made in,\n * and that box is this field's *sibling*, not its child — a paste in it bubbles\n * to their common parent and never through here. `pasteFrom` is that parent\n * (Steering Design feedback #140): the element whose subtree is listened to,\n * handed in by whoever renders both the box and this field side by side.\n */\nexport function FeedbackAttachmentField(props: FeedbackAttachmentFieldProps) {\n // One component per mode rather than one with branches: the modes hold different\n // state (one preview vs. one per chip vs. uploads in flight), and a hook order that\n // depends on a prop is a crash the day a caller flips it.\n if (props.refs) return <RefsField {...props} />;\n return props.multiple ? <MultipleField {...props} /> : <SingleField {...props} />;\n}\n\nfunction SingleField({\n value,\n onChange,\n labels: labelsProp,\n accept = DEFAULT_ATTACHMENT_ACCEPT,\n maxBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onError,\n onCaptureScreenshot,\n documentPaste = false,\n pasteFrom,\n disabled = false,\n className,\n}: FeedbackAttachmentFieldSingleProps) {\n // The object URL is keyed to the file it was made for, so a stale one (from the\n // previous file, or after `value` is cleared) is never shown — no reset needed.\n const [previewFor, setPreviewFor] = useState<{ file: File; url: string } | null>(null);\n const preview = value && previewFor?.file === value ? previewFor.url : null;\n const fileInputRef = useRef<HTMLInputElement>(null);\n // `file.size` from `<UiKitProvider labels>`, formatted in its locale — see FileDropzone.\n const fileText = useKitFileLabels();\n const text = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n const errorInfo = useErrorInfo(accept, maxBytes, undefined, text);\n\n // Object-URL preview lifecycle (create on change, revoke on cleanup).\n useEffect(() => {\n if (!value) return;\n const url = URL.createObjectURL(value);\n // The URL is an external resource that must be created and revoked in step\n // with the effect (a render-time `createObjectURL` would leak, and StrictMode's\n // remount would revoke a memoised one out from under the <img>).\n // eslint-disable-next-line react-hooks/set-state-in-effect -- publishing an external resource's handle\n setPreviewFor({ file: value, url });\n return () => URL.revokeObjectURL(url);\n }, [value]);\n\n const pick = (file: File | undefined | null) => {\n if (!file) return;\n const problem = rejection(file, accept, maxBytes);\n if (problem) {\n onError?.(problem, errorInfo(problem, [file]));\n return;\n }\n onChange(file);\n };\n\n const onPaste = usePaste(\n (images) => {\n // Clipboard images arrive named \"image.png\" at best and unnamed at worst,\n // and the name is what the inbox shows beside the thumbnail. A name that\n // says where it came from is more use than the browser's.\n const file = images[0];\n pick(new File([file], pastedName(file.type), { type: file.type }));\n },\n documentPaste,\n pasteFrom,\n disabled,\n );\n\n return (\n <div\n // `relative` for the same reason as FileDropzone: the `sr-only` file input below\n // is `position: absolute`, and without a positioned ancestor it is laid out\n // against the initial containing block — extending the DOCUMENT height to its own\n // offset and producing a phantom second scrollbar on any long page.\n className={cn(\"relative\", className)}\n onPaste={onPaste}\n >\n <Heading text={labelsProp?.attachment} />\n {value ? (\n <div className=\"flex items-start gap-2\">\n {value.type.startsWith(\"image/\") && preview ? (\n <img\n src={preview}\n alt={value.name}\n className=\"h-20 w-20 rounded border border-[var(--border)] object-cover\"\n />\n ) : (\n // Non-image attachments (PDF, text) can't preview as an <img>, so\n // show a neutral file tile with the name/size beside it instead.\n <div className=\"flex h-20 w-20 items-center justify-center rounded border border-[var(--border)] text-[var(--text-placeholder)]\">\n <FileText className=\"size-8\" />\n </div>\n )}\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{value.name}</div>\n <div className=\"text-xs text-[var(--text-muted)]\">\n {fileText.size(value.size)}\n </div>\n </div>\n <RemoveButton label={text.attachmentRemove} onClick={() => onChange(null)} disabled={disabled} />\n </div>\n ) : (\n <div className=\"space-y-1.5\">\n <div className=\"flex flex-wrap gap-2\">\n <Button\n type=\"button\"\n variant=\"secondary\"\n disabled={disabled}\n onClick={() => fileInputRef.current?.click()}\n >\n <Paperclip className=\"size-4\" /> {text.attachmentAdd}\n </Button>\n {onCaptureScreenshot && (\n <CaptureButton\n capture={onCaptureScreenshot}\n onFile={pick}\n label={text.attachmentCapture}\n disabled={disabled}\n />\n )}\n </div>\n {/* Said out loud, because a gesture with no affordance is a gesture\n nobody finds. */}\n <p className=\"text-xs text-[var(--text-muted)]\">\n {text.attachmentPaste}\n </p>\n </div>\n )}\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept.join(\",\")}\n className=\"sr-only\"\n disabled={disabled}\n onChange={(e) => {\n pick(e.target.files?.[0]);\n e.target.value = \"\";\n }}\n />\n </div>\n );\n}\n\nfunction MultipleField({\n value,\n onChange,\n max = DEFAULT_MAX_ATTACHMENTS,\n screenshot = null,\n onScreenshotChange,\n labels: labelsProp,\n accept = DEFAULT_ATTACHMENT_ACCEPT,\n maxBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onError,\n onCaptureScreenshot,\n documentPaste = false,\n pasteFrom,\n disabled = false,\n className,\n}: FeedbackAttachmentFieldMultipleProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const fileText = useKitFileLabels();\n const text = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n const removeLabel = text.attachmentRemoveFile ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentRemoveFile!;\n const limitLabel = text.attachmentLimit ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentLimit!;\n const screenshotLabel = text.attachmentScreenshot ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentScreenshot!;\n const errorInfo = useErrorInfo(accept, maxBytes, max, text);\n\n // What an add or a remove builds on: the `value` prop, plus whatever this field has\n // already handed to `onChange` since the parent last rendered. The field is\n // controlled, so between an `onChange` and the re-render that brings it back, `value`\n // is stale — and two adds in that gap (two pastes, a paste and a pick, delivered by\n // native listeners whose updates React batches) each spread the SAME old list, and\n // the second dropped the first. Re-synced to the prop after every commit, so a\n // parent that refuses a change (or edits the list itself) is what wins.\n const latest = useRef(value);\n useLayoutEffect(() => {\n latest.current = value;\n });\n const commit = (next: File[]) => {\n latest.current = next;\n onChange(next);\n };\n\n const hasSlot = onScreenshotChange !== undefined;\n const room = Math.max(0, max - value.length);\n // The screenshot slot is its own thing: it neither counts against `max` nor is\n // closed by it, so a full set of photos still leaves the capture on offer.\n const canCapture = !!onCaptureScreenshot && (hasSlot ? !screenshot : room > 0);\n\n const add = (incoming: File[], pasted = false) => {\n const current = latest.current;\n const accepted: File[] = [];\n const taken = new Set([...current, ...(screenshot ? [screenshot] : [])].map((f) => f.name));\n for (const raw of incoming) {\n // Two pastes are two files called \"pasted.png\", and a backend that stores by\n // name keeps one of them — the very loss this mode exists to end. A picked\n // file keeps its own name: it is the user's, and they may look for it. Named\n // before the check, so a refusal names it as the single field's does.\n const file = pasted ? renamed(raw, uniqueName(pastedName(raw.type), taken)) : raw;\n const problem = rejection(file, accept, maxBytes);\n if (problem) {\n onError?.(problem, errorInfo(problem, [file]));\n continue;\n }\n taken.add(file.name);\n // The same File object twice is one file chosen twice, not two.\n if (!current.includes(file)) accepted.push(file);\n }\n if (accepted.length === 0) return;\n const space = Math.max(0, max - current.length);\n if (accepted.length > space) onError?.(\"count\", errorInfo(\"count\", accepted.slice(space)));\n const kept = accepted.slice(0, space);\n if (kept.length > 0) commit([...current, ...kept]);\n };\n\n const onPaste = usePaste((images) => add(images, true), documentPaste, pasteFrom, disabled);\n\n const capture = (file: File) => {\n if (!hasSlot) {\n add([file]);\n return;\n }\n const problem = rejection(file, accept, maxBytes);\n if (problem) onError?.(problem, errorInfo(problem, [file]));\n else onScreenshotChange(file);\n };\n\n // Removing a chip removes the button that had focus. Focus goes to the chip that\n // took its place — the next one — and, when it was the last, to the first action\n // button (there is room again, so \"Attach\" is back), else to the chip before it.\n // Applied once the parent has re-rendered with the shorter list: the field is\n // controlled, and focusing before that would land on the chip being removed.\n const pendingFocus = useRef<number | null>(null);\n useEffect(() => {\n const index = pendingFocus.current;\n if (index === null) return;\n pendingFocus.current = null;\n const root = rootRef.current;\n if (!root) return;\n const removes = root.querySelectorAll<HTMLElement>(\"[data-attachment-remove]\");\n const target =\n removes[index] ?? root.querySelector<HTMLElement>(\"[data-attachment-action]\") ?? removes[index - 1];\n target?.focus();\n }, [value, screenshot]);\n\n const chips: Array<{ file: File; screenshot: boolean; name: string; remove: () => void }> = [\n ...(hasSlot && screenshot\n ? [{ file: screenshot, screenshot: true, name: screenshotLabel, remove: () => onScreenshotChange(null) }]\n : []),\n ...value.map((file) => ({\n file,\n screenshot: false,\n name: file.name,\n remove: () => commit(latest.current.filter((f) => f !== file)),\n })),\n ];\n\n return (\n <div ref={rootRef} className={cn(\"relative space-y-2\", className)} onPaste={onPaste}>\n <Heading text={labelsProp?.attachment} className=\"mb-0\" />\n {chips.length > 0 && (\n // One chip per row, full width: wrapped chips of name-dependent widths made a\n // ragged block in a 430px dialog, and a column keeps every name and remove\n // button in the same place — the next chip's button is right under the last.\n <ul aria-label={text.attachmentList} className=\"flex flex-col gap-2\">\n {chips.map((chip, index) => (\n <li\n key={fileKey(chip.file)}\n className=\"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--bg-surface)] p-1\"\n >\n <ChipPreview file={chip.file} screenshot={chip.screenshot} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{chip.name}</div>\n <div className=\"truncate text-xs text-[var(--text-muted)]\">\n {/* The screenshot's file name moves down here: still there for the\n reporter who wants to know what will be sent, not its title. */}\n {chip.screenshot ? `${chip.file.name} · ${fileText.size(chip.file.size)}` : fileText.size(chip.file.size)}\n </div>\n </div>\n <RemoveButton\n label={removeLabel(chip.name)}\n disabled={disabled}\n onClick={() => {\n pendingFocus.current = index;\n chip.remove();\n }}\n />\n </li>\n ))}\n </ul>\n )}\n {(room > 0 || canCapture) && (\n <div className=\"flex flex-wrap gap-2\">\n {room > 0 && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n data-attachment-action=\"\"\n disabled={disabled}\n onClick={() => fileInputRef.current?.click()}\n >\n <Paperclip className=\"size-4\" /> {text.attachmentAdd}\n </Button>\n )}\n {canCapture && onCaptureScreenshot && (\n <CaptureButton\n capture={onCaptureScreenshot}\n onFile={capture}\n label={text.attachmentCapture}\n disabled={disabled}\n data-attachment-action=\"\"\n />\n )}\n </div>\n )}\n <p className=\"text-xs text-[var(--text-muted)]\">\n {room > 0 ? text.attachmentPaste : limitLabel(max)}\n </p>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple={room > 1}\n accept={accept.join(\",\")}\n className=\"sr-only\"\n // Out of the tab order and the accessibility tree: the button above is\n // the way in, and a second, unlabelled \"Choose files\" stop is noise.\n tabIndex={-1}\n aria-hidden\n disabled={disabled}\n onChange={(e) => {\n add(Array.from(e.target.files ?? []));\n e.target.value = \"\";\n }}\n />\n </div>\n );\n}\n\n/** A file `refs` mode is uploading: its own id (a ref has no key yet), and the file. */\ninterface Upload {\n id: number;\n file: File;\n}\n\nlet nextUploadId = 0;\n\nfunction RefsField({\n value,\n onChange,\n onUpload,\n onRemove,\n onUploadingChange,\n max = DEFAULT_MAX_ATTACHMENTS,\n labels: labelsProp,\n accept = DEFAULT_ATTACHMENT_ACCEPT,\n maxBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onError,\n onCaptureScreenshot,\n documentPaste = false,\n pasteFrom,\n disabled = false,\n commit: commits,\n disabledReason: ownDisabledReason,\n className,\n}: FeedbackAttachmentFieldRefsProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const fileText = useKitFileLabels();\n const text = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n const removeLabel = text.attachmentRemoveFile ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentRemoveFile!;\n const limitLabel = text.attachmentLimit ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentLimit!;\n const uploadingLabel = text.attachmentUploading ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploading!;\n const errorInfo = useErrorInfo(accept, maxBytes, max, text);\n // The lock's reason (under `commit`) over the field's own; with either, the controls\n // take the focusable `aria-disabled` path and say why — Button's and IconButton's\n // `disabledReason`, handed down as is.\n const disabledReason = useCommitReason(commits, ownDisabledReason);\n const locked = hasReason(disabledReason);\n const reason = locked ? disabledReason : undefined;\n const inert = disabled || locked;\n\n // As in `multiple` mode: `value` plus whatever has been handed to `onChange` since\n // the parent last rendered — two uploads landing in one tick must both survive.\n const latest = useRef(value);\n useLayoutEffect(() => {\n latest.current = value;\n });\n const commit = (next: FeedbackAttachmentRef[]) => {\n latest.current = next;\n onChange(next);\n };\n\n const [uploads, setUploads] = useState<Upload[]>([]);\n // The uploads in flight, kept in a ref as well: `add` runs several times before a\n // render when files arrive together, and each must see the others — their count\n // against `max`, their names against a pasted image's.\n const inFlight = useRef<Upload[]>([]);\n // Unmounted (the dialog closed mid-upload): a late answer is not this field's to\n // commit, and setting state on it would be a no-op at best.\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const uploadingChange = useRef(onUploadingChange);\n useEffect(() => {\n uploadingChange.current = onUploadingChange;\n });\n\n const room = Math.max(0, max - value.length - uploads.length);\n\n const start = (file: File) => {\n const upload: Upload = { id: nextUploadId++, file };\n inFlight.current = [...inFlight.current, upload];\n if (inFlight.current.length === 1) uploadingChange.current?.(true);\n setUploads(inFlight.current);\n const settle = () => {\n inFlight.current = inFlight.current.filter((u) => u.id !== upload.id);\n if (!mounted.current) return;\n setUploads(inFlight.current);\n if (inFlight.current.length === 0) uploadingChange.current?.(false);\n };\n let answer: Promise<FeedbackAttachmentRef>;\n try {\n answer = Promise.resolve(onUpload(file));\n } catch (error) {\n answer = Promise.reject(error);\n }\n answer.then(\n (ref) => {\n settle();\n if (mounted.current) commit([...latest.current, ref]);\n },\n (error: unknown) => {\n settle();\n if (mounted.current) onError?.(\"upload\", error, errorInfo(\"upload\", [file], error));\n },\n );\n };\n\n const add = (incoming: File[], pasted = false) => {\n let space = Math.max(0, max - latest.current.length - inFlight.current.length);\n const taken = new Set([...latest.current.map((r) => r.name), ...inFlight.current.map((u) => u.file.name)]);\n const dropped: File[] = [];\n for (const raw of incoming) {\n // Pasted images are all \"image.png\" to the clipboard; as in `multiple` mode,\n // each gets a name of its own before it is checked and uploaded under it.\n const file = pasted ? renamed(raw, uniqueName(pastedName(raw.type), taken)) : raw;\n const problem = rejection(file, accept, maxBytes);\n if (problem) {\n // `undefined` in `error`'s place, as in 0.22: only an upload has one.\n onError?.(problem, undefined, errorInfo(problem, [file]));\n continue;\n }\n taken.add(file.name);\n if (space === 0) {\n dropped.push(file);\n continue;\n }\n space -= 1;\n start(file);\n }\n if (dropped.length > 0) onError?.(\"count\", undefined, errorInfo(\"count\", dropped));\n };\n\n const onPaste = usePaste((images) => add(images, true), documentPaste, pasteFrom, inert);\n\n // Focus after a remove, as in `multiple` mode: the next chip, else the first action.\n const pendingFocus = useRef<number | null>(null);\n useEffect(() => {\n const index = pendingFocus.current;\n if (index === null) return;\n pendingFocus.current = null;\n const root = rootRef.current;\n if (!root) return;\n const removes = root.querySelectorAll<HTMLElement>(\"[data-attachment-remove]\");\n const target =\n removes[index] ?? root.querySelector<HTMLElement>(\"[data-attachment-action]\") ?? removes[index - 1];\n target?.focus();\n }, [value]);\n\n const remove = (key: string, index: number) => {\n if (inert) return;\n pendingFocus.current = index;\n commit(latest.current.filter((r) => r.key !== key));\n onRemove?.(key);\n };\n\n const hasChips = value.length > 0 || uploads.length > 0;\n\n return (\n <div ref={rootRef} className={cn(\"relative space-y-2\", className)} onPaste={onPaste}>\n <Heading text={labelsProp?.attachment} className=\"mb-0\" />\n {hasChips && (\n <ul aria-label={text.attachmentList} className=\"flex flex-col gap-2\">\n {value.map((ref, index) => (\n <li\n key={`ref:${ref.key}`}\n className=\"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--bg-surface)] p-1\"\n >\n <RefGlyph type={ref.type} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{ref.name}</div>\n {ref.size !== undefined && (\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{fileText.size(ref.size)}</div>\n )}\n </div>\n <RemoveButton\n label={removeLabel(ref.name)}\n onClick={() => remove(ref.key, index)}\n disabled={disabled}\n reason={reason}\n />\n </li>\n ))}\n {uploads.map((upload) => (\n <li\n key={`upload:${upload.id}`}\n aria-busy=\"true\"\n data-attachment-uploading=\"\"\n className=\"flex min-w-0 items-center gap-2 rounded-md border border-dashed border-[var(--border)] bg-[var(--bg-surface)] p-1\"\n >\n <span className=\"flex size-12 shrink-0 items-center justify-center rounded border border-[var(--border)] bg-[var(--bg-surface-2)] text-[var(--text-placeholder)]\">\n <Spinner label={null} className=\"size-5\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{upload.file.name}</div>\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{uploadingLabel}</div>\n </div>\n </li>\n ))}\n </ul>\n )}\n {room > 0 && (\n <div className=\"flex flex-wrap gap-2\">\n <Button\n type=\"button\"\n variant=\"secondary\"\n data-attachment-action=\"\"\n disabled={disabled}\n disabledReason={reason}\n onClick={() => fileInputRef.current?.click()}\n >\n <Paperclip className=\"size-4\" /> {text.attachmentAdd}\n </Button>\n {onCaptureScreenshot && (\n <CaptureButton\n capture={onCaptureScreenshot}\n onFile={(file) => add([file])}\n label={text.attachmentCapture}\n disabled={disabled}\n disabledReason={reason}\n data-attachment-action=\"\"\n />\n )}\n </div>\n )}\n {locked ? (\n // Where the paste hint was: a phone never hovers, so the Tooltip alone would\n // leave a touch user with buttons that do nothing and no word why.\n <div data-attachment-reason=\"\" className=\"text-xs text-[var(--text-muted)]\">\n {disabledReason}\n </div>\n ) : (\n <p className=\"text-xs text-[var(--text-muted)]\">{room > 0 ? text.attachmentPaste : limitLabel(max)}</p>\n )}\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple={room > 1}\n accept={accept.join(\",\")}\n className=\"sr-only\"\n tabIndex={-1}\n aria-hidden\n disabled={inert}\n onChange={(e) => {\n add(Array.from(e.target.files ?? []));\n e.target.value = \"\";\n }}\n />\n </div>\n );\n}\n\n/** A ref chip's picture. The bytes are on the server, not here, so there is nothing to\n * preview: an image glyph for an image `type`, a file glyph for anything else. */\nfunction RefGlyph({ type }: { type?: string }) {\n return (\n <span className=\"flex size-12 shrink-0 items-center justify-center rounded border border-[var(--border)] bg-[var(--bg-surface-2)] text-[var(--text-placeholder)]\">\n {type?.startsWith(\"image/\") ? <ImageIcon aria-hidden className=\"size-6\" /> : <FileText aria-hidden className=\"size-6\" />}\n </span>\n );\n}\n\nfunction Heading({ text, className }: { text?: string; className?: string }) {\n if (!text) return null;\n return (\n <div className={cn(\"mb-1 text-xs font-medium uppercase tracking-wide text-[var(--text-muted)]\", className)}>\n {text}\n </div>\n );\n}\n\nfunction CaptureButton({\n capture,\n onFile,\n label,\n disabled = false,\n disabledReason,\n ...rest\n}: {\n capture: () => Promise<File | null>;\n onFile: (file: File) => void;\n label: string;\n disabled?: boolean;\n disabledReason?: ReactNode;\n \"data-attachment-action\"?: string;\n}) {\n const [capturing, setCapturing] = useState(false);\n return (\n <Button\n type=\"button\"\n variant=\"secondary\"\n disabled={capturing || disabled}\n disabledReason={disabledReason}\n {...rest}\n onClick={() => {\n if (capturing || disabled) return;\n setCapturing(true);\n void capture()\n .then((file) => {\n if (file) onFile(file);\n })\n .finally(() => setCapturing(false));\n }}\n >\n <Camera className=\"size-4\" /> {capturing ? \"…\" : label}\n </Button>\n );\n}\n\n/**\n * A chip's (or the single file's) remove button: the kit's IconButton at the 28px the\n * hand-built one had, so `disabled` (0.23.0) dims and disables it the kit way and a\n * `reason` takes IconButton's `disabledReason` path — focusable, `aria-disabled`, the\n * reason in the Tooltip — rather than a third copy of either here.\n */\nfunction RemoveButton({\n label,\n onClick,\n disabled,\n reason,\n}: {\n label: string;\n onClick: () => void;\n disabled: boolean;\n reason?: ReactNode;\n}) {\n return (\n <IconButton\n type=\"button\"\n size=\"xs\"\n tone=\"muted\"\n data-attachment-remove=\"\"\n aria-label={label}\n disabled={disabled}\n disabledReason={reason}\n onClick={onClick}\n className=\"shrink-0\"\n >\n <X aria-hidden />\n </IconButton>\n );\n}\n\n/** A reason worth showing: `null`, `false` and `\"\"` are a caller's \"no reason\". */\nfunction hasReason(reason: ReactNode): boolean {\n return reason !== undefined && reason !== null && reason !== false && reason !== \"\";\n}\n\n/**\n * The {@link FeedbackAttachmentErrorInfo} builder of one field: its limits, and the\n * sentence for each refusal. The sentences are the `filePicker` namespace's — the ones\n * FileButton and FileDropzone say — so an app that translated those has these too, and\n * a refusal reads the same whichever of the kit's pickers made it. Only the upload\n * failure, which no other picker has, is this field's own (`attachmentUploadFailed`).\n */\nfunction useErrorInfo(\n accept: string[],\n maxBytes: number,\n max: number | undefined,\n text: FeedbackAttachmentFieldLabels,\n) {\n const picker = useKitLabels(\"filePicker\", DEFAULT_FILE_PICKER_LABELS);\n const fileText = useKitFileLabels();\n const uploadFailed = text.attachmentUploadFailed ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploadFailed!;\n return (kind: FeedbackAttachmentRefsError, files: File[], error?: unknown): FeedbackAttachmentErrorInfo => {\n const file = files[0];\n let message: string;\n if (kind === \"type\") {\n // FileButton's rule: name what IS accepted (\"Only image/png, image/jpeg files\"),\n // unless the app translated `rejectedType` but not yet `rejectedTypeOnly` — its\n // own sentence beats an English one.\n const acceptText = formatAccept(accept.join(\",\"));\n const useOnly =\n acceptText !== \"\" &&\n (picker.rejectedTypeOnly !== DEFAULT_FILE_PICKER_LABELS.rejectedTypeOnly ||\n picker.rejectedType === DEFAULT_FILE_PICKER_LABELS.rejectedType);\n message = useOnly ? picker.rejectedTypeOnly(acceptText, file.name) : picker.rejectedType(file.name);\n } else if (kind === \"size\") {\n message = picker.rejectedSize(file.name, fileText.size(maxBytes));\n } else if (kind === \"count\") {\n message = files.length === 1 ? picker.rejectedCount(file.name, max ?? 1) : picker.rejectedMany(files.length);\n } else {\n message = uploadFailed(file.name);\n }\n return {\n file,\n files,\n message,\n maxBytes,\n accept,\n ...(max !== undefined ? { max } : null),\n ...(kind === \"upload\" ? { error } : null),\n };\n };\n}\n\n/** A chip's picture: the image itself, or a file glyph for anything that is not one.\n * Decorative (`alt=\"\"`) — the name stands beside it. Its own component so the object\n * URL lives exactly as long as the chip: removing the chip unmounts it and revokes. */\nfunction ChipPreview({ file, screenshot }: { file: File; screenshot: boolean }) {\n const isImage = file.type.startsWith(\"image/\");\n const [previewFor, setPreviewFor] = useState<{ file: File; url: string } | null>(null);\n const url = previewFor?.file === file ? previewFor.url : null;\n useEffect(() => {\n if (!isImage) return;\n const next = URL.createObjectURL(file);\n // As in the single field: an external resource created and revoked with the effect.\n // eslint-disable-next-line react-hooks/set-state-in-effect -- publishing an external resource's handle\n setPreviewFor({ file, url: next });\n return () => URL.revokeObjectURL(next);\n }, [file, isImage]);\n\n return (\n <span className=\"relative flex size-12 shrink-0 items-center justify-center overflow-hidden rounded border border-[var(--border)] bg-[var(--bg-surface-2)] text-[var(--text-placeholder)]\">\n {isImage && url ? (\n <img src={url} alt=\"\" className=\"size-full object-cover\" />\n ) : (\n <FileText aria-hidden className=\"size-6\" />\n )}\n {screenshot && (\n // Marks the slot apart from the photos: it is why the capture button is gone.\n <span className=\"absolute bottom-0.5 end-0.5 rounded-sm bg-[var(--bg-surface)] p-0.5 text-[var(--text-secondary)]\">\n <Camera aria-hidden className=\"size-3\" />\n </span>\n )}\n </span>\n );\n}\n\n/** A stable React key per File object — the name is not one (two pastes, two\n * \"pasted.png\" before renaming; the same photo picked from two folders). */\nconst fileKeys = new WeakMap<File, number>();\nlet nextFileKey = 0;\nfunction fileKey(file: File): number {\n let key = fileKeys.get(file);\n if (key === undefined) {\n key = nextFileKey++;\n fileKeys.set(file, key);\n }\n return key;\n}\n\nfunction rejection(file: File, accept: string[], maxBytes: number): \"type\" | \"size\" | null {\n if (!accept.includes(file.type)) return \"type\";\n if (file.size > maxBytes) return \"size\";\n return null;\n}\n\nfunction renamed(file: File, name: string): File {\n return new File([file], name, { type: file.type });\n}\n\n/** `pasted.png`, then `pasted-2.png`, `pasted-3.png`… — the first name not in `taken`. */\nfunction uniqueName(name: string, taken: Set<string>): string {\n if (!taken.has(name)) return name;\n const dot = name.lastIndexOf(\".\");\n const [stem, ext] = dot > 0 ? [name.slice(0, dot), name.slice(dot)] : [name, \"\"];\n let n = 2;\n while (taken.has(`${stem}-${n}${ext}`)) n++;\n return `${stem}-${n}${ext}`;\n}\n\n/**\n * The paste listener both modes share. `onImages` gets every image file on the\n * clipboard (the single field takes the first). It is registered once rather than per\n * render, so it reads the handler — which closes over props that change identity on\n * every render — out of a ref rather than out of its own dependency list. Returns the\n * `onPaste` for the field's root, or `undefined` when listening elsewhere.\n */\nfunction usePaste(\n onImages: (images: File[]) => void,\n documentPaste: boolean,\n pasteFrom: RefObject<HTMLElement | null> | undefined,\n /** `disabled` / locked (0.23.0): the paste goes where it was going, untouched — not\n * swallowed, so a text half still lands in the box it was made in. */\n off: boolean,\n) {\n // `null` while off, so the listeners below leave the event alone entirely.\n const handler = off ? null : onImages;\n const latest = useRef(handler);\n useEffect(() => {\n latest.current = handler;\n });\n\n // The element listened on, where it is not this field's own subtree: the\n // document for a modal, the given parent for an inline editor. Read inside\n // the effect rather than in render, because a ref's `current` is only set\n // once the parent has mounted — which it has by the time effects run.\n useEffect(() => {\n const target: EventTarget | null = documentPaste ? document : (pasteFrom?.current ?? null);\n if (!target) return;\n const onPaste = (event: Event) => {\n if (!latest.current) return;\n const clipboard = (event as ClipboardEvent).clipboardData;\n takeImages(clipboard, () => event.preventDefault(), latest.current);\n };\n target.addEventListener(\"paste\", onPaste);\n return () => target.removeEventListener(\"paste\", onPaste);\n }, [documentPaste, pasteFrom]);\n\n const listensElsewhere = documentPaste || pasteFrom !== undefined;\n return listensElsewhere\n ? undefined\n : (event: ReactClipboardEvent) => {\n if (!latest.current) return;\n takeImages(event.clipboardData, () => event.preventDefault(), latest.current);\n };\n}\n\nfunction takeImages(clipboard: DataTransfer | null, stop: () => void, onImages: (images: File[]) => void) {\n const images = Array.from(clipboard?.items ?? [])\n .filter((item) => item.kind === \"file\" && item.type.startsWith(\"image/\"))\n .map((item) => item.getAsFile())\n .filter((file): file is File => file !== null);\n if (images.length === 0) return;\n // Only once there IS an image: a paste of text into a field must stay a\n // paste of text, and a clipboard holding both is a copy whose text half is\n // what the field was focused for.\n stop();\n onImages(images);\n}\n\n/** What a pasted image is called once it is an attachment.\n *\n * The extension is read off the mime type rather than assumed to be `.png`:\n * Safari puts TIFF on the clipboard and a file called `pasted.png` that is not\n * a PNG is one the receiving end opens wrong. */\nexport function pastedName(type: string): string {\n const subtype = type.split(\"/\")[1] ?? \"png\";\n // `image/svg+xml` and friends carry a suffix that is not part of the\n // extension, and none of them are in the accepted list anyway.\n return `pasted.${subtype.split(\"+\")[0]}`;\n}\n"],"mappings":";AAqVyB,cAuFf,YAvFe;AArVzB,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAA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AAG,EAAE,CAAC,CAAC;AACxC;","names":[]}
1
+ {"version":3,"sources":["../../src/feedback/feedback-attachment.tsx"],"sourcesContent":["import { cn } from \"../lib/cn\";\nimport {\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ClipboardEvent as ReactClipboardEvent,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { Camera, FileText, Image as ImageIcon, Paperclip, X } from \"lucide-react\";\nimport { Button, IconButton, Spinner } from \"../components/ui\";\nimport type { ButtonSize, ButtonVariant } from \"../components/ui\";\nimport { DEFAULT_FILE_PICKER_LABELS, formatAccept } from \"../components/file-button\";\nimport { useCommitReason } from \"../components/write-lock\";\nimport { useKitFileLabels, useKitLabels } from \"../i18n/kit-labels\";\nimport type { FeedbackAttachmentLabels } from \"./feedback-dialog\";\n\nexport const DEFAULT_ATTACHMENT_ACCEPT = [\"image/png\", \"image/jpeg\", \"image/webp\", \"image/gif\"];\nexport const DEFAULT_MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;\n/** How many files `<FeedbackAttachmentField multiple>` takes when `max` is not given\n * (0.15.5). Five photos of one problem is already a lot to look through; a report\n * that needs more is a conversation, which the thread is for. */\nexport const DEFAULT_MAX_ATTACHMENTS = 5;\n\n/**\n * The field's own strings — the `feedbackAttachment` namespace of `<UiKitProvider\n * labels>`. The keys are {@link FeedbackAttachmentLabels}' own, so the `labels` prop\n * (and a whole `FeedbackDialogLabels` handed down by the dialog) merges over them\n * one to one. The optional heading, `attachment`, stays a prop: a note editor puts\n * the buttons straight under its textarea and wants none.\n *\n * Before 0.7.0 the two optional keys fell back to hard-coded English, so a German app\n * that relied on its provider got \"Capture screenshot\" under a German form.\n *\n * The three keys added in 0.15.5 for `multiple` mode are optional, so a complete\n * `UiKitLabels` typed before it still compiles; they fall back to English. So is\n * `attachmentScreenshot` (0.16.0).\n */\nexport interface FeedbackAttachmentFieldLabels {\n attachmentAdd: string;\n attachmentCapture: string;\n attachmentPaste: string;\n attachmentRemove: string;\n /** `multiple` mode: the accessible name of the list of chosen files — and, since\n * 0.16.0, the heading `<FeedbackDialog attachments=\"multiple\">` puts over it. */\n attachmentList?: string;\n /** `multiple` mode (0.16.0): what the screenshot slot's chip is called — \"Screenshot\"\n * rather than the capture's file name (\"screenshot.webp\"), which says nothing a\n * reporter chose. The file name stays as the chip's second line. */\n attachmentScreenshot?: string;\n /** `multiple` mode: one chip's remove button — \"Remove photo.jpg\". Named per file,\n * because five buttons all called \"Remove attachment\" say nothing about which. */\n attachmentRemoveFile?: (name: string) => string;\n /** `multiple` mode: the line shown in place of the add buttons once `max` is reached. */\n attachmentLimit?: (max: number) => string;\n /** `refs` mode (0.22.0, keksdose K16): the second line of a chip whose upload is still\n * running, where an uploaded one shows its size — \"Uploading…\". Optional, like the\n * keys above, so a `UiKitLabels` typed before it still compiles. */\n attachmentUploading?: string;\n /** `refs` mode (0.23.0, keksdose G5a): {@link FeedbackAttachmentErrorInfo.message} for\n * an `\"upload\"` refusal — \"“huge.png” could not be uploaded\". The other refusals'\n * sentences are the `filePicker` namespace's, shared with FileButton. Optional, like\n * the keys above. */\n attachmentUploadFailed?: (name: string) => string;\n}\n\nexport const DEFAULT_FEEDBACK_ATTACHMENT_LABELS: FeedbackAttachmentFieldLabels = {\n attachmentAdd: \"Attach image\",\n attachmentCapture: \"Capture screenshot\",\n attachmentPaste: \"…or paste a screenshot from the clipboard.\",\n attachmentRemove: \"Remove attachment\",\n attachmentList: \"Attachments\",\n attachmentScreenshot: \"Screenshot\",\n attachmentRemoveFile: (name) => `Remove ${name}`,\n attachmentLimit: (max) =>\n `Up to ${max} ${max === 1 ? \"attachment\" : \"attachments\"} — remove one to add another.`,\n attachmentUploading: \"Uploading…\",\n attachmentUploadFailed: (name) => `“${name}” could not be uploaded`,\n};\n\n/** Why a file was turned away. `\"count\"` only ever comes from `multiple` (and `refs`)\n * mode: more files arrived at once than `max` left room for, and the surplus was\n * dropped. */\nexport type FeedbackAttachmentError = \"type\" | \"size\" | \"count\";\n\n/** `refs` mode's reasons: {@link FeedbackAttachmentError}, or `\"upload\"` — `onUpload`\n * rejected, and what it rejected with is `onError`'s second argument. A type of its\n * own so a host's exhaustive switch over the File modes' reasons stays exhaustive. */\nexport type FeedbackAttachmentRefsError = FeedbackAttachmentError | \"upload\";\n\n/**\n * What `onError` knows about a refusal beyond its kind (0.23.0, keksdose G5a): the file\n * it was about, the limit that refused it, and a sentence that says both.\n *\n * keksdose's support chat toasted \"File too large\" with no name — the field's `onError`\n * carried a kind and nothing else, so a refusal could not say WHICH of three pasted\n * screenshots went, nor what the ceiling was, and its own `AttachmentPicker` (a\n * FileButton, whose `onReject` hands over `{ file, message }`) said more than the kit's\n * field would have. This is that, for every mode.\n *\n * It arrives as an EXTRA argument, after the ones `onError` already had, so a handler\n * written for 0.22 — `(kind) => …`, or `refs` mode's `(kind, error) => …` — compiles\n * and behaves as before:\n *\n * - single and `multiple`: `onError(kind, info)`;\n * - `refs`: `onError(kind, error, info)` — the second place is `onUpload`'s rejection\n * since 0.22 (`undefined` for the other kinds, as it always was), so the info comes\n * third rather than changing what a 0.22 handler reads there. It also carries that\n * `error`, so one helper `(kind, info) => …` serves all three modes.\n *\n * An object rather than more positional arguments because what a host reaches for\n * differs by kind — the bytes for `\"size\"`, `max` for `\"count\"`, the server's answer for\n * `\"upload\"` — and a field added later must not shift anyone's arguments.\n */\nexport interface FeedbackAttachmentErrorInfo {\n /** The file refused — under the name the field would have given it (a pasted image\n * is already \"pasted.png\"). For `\"count\"`, the first of the surplus; for\n * `\"upload\"`, the file whose upload failed. */\n file: File;\n /** `\"count\"`: every file of the surplus (several can arrive in one pick). Otherwise\n * `[file]`. */\n files: File[];\n /**\n * One translated sentence naming the file and the limit — the ones FileButton's\n * `onReject` hands over, from the same `filePicker` namespace: \"“huge.png” is larger\n * than 10 MB\", \"Only image/png, image/jpeg files\", \"“c.png” was not added: at most 5\n * files\" (several at once: \"3 files were not added\"). `\"upload\"`: the field's own\n * `attachmentUploadFailed`, \"“huge.png” could not be uploaded\" — a host with a better\n * sentence from the server's answer uses `error`. Ready for a toast as it is.\n */\n message: string;\n /** The field's `maxBytes` — the ceiling a `\"size\"` refusal went over, in bytes. */\n maxBytes: number;\n /** The field's `accept` — the types a `\"type\"` refusal was not among. */\n accept: string[];\n /** The field's `max` — the ceiling a `\"count\"` refusal hit. Absent in single mode,\n * which holds one file by definition. */\n max?: number;\n /** `\"upload\"` only: what `onUpload` rejected with — `onError`'s second argument. */\n error?: unknown;\n}\n\n/**\n * One uploaded attachment in `refs` mode: what the host's upload answered with. `key`\n * identifies it (a storage key, an upload id) and is what a remove goes by; `name` is\n * what the chip says. `size` (bytes) and `type` (mime) are optional — given, the chip\n * shows the size and an image icon or a file icon accordingly.\n */\nexport interface FeedbackAttachmentRef {\n key: string;\n name: string;\n size?: number;\n type?: string;\n}\n\ninterface FeedbackAttachmentFieldBaseProps {\n /** Prop > `<UiKitProvider labels={{ feedbackAttachment }}>` > English. Optional\n * since 0.7.0; `attachment` (the heading) is only ever read from here. */\n labels?: Partial<FeedbackAttachmentLabels> &\n Pick<Partial<FeedbackAttachmentFieldLabels>, \"attachmentUploading\" | \"attachmentUploadFailed\">;\n accept?: string[];\n maxBytes?: number;\n /**\n * Take no files for now (0.23.0, keksdose G5b): the add and capture buttons, the\n * hidden file input and every chip's remove button are natively disabled, and a paste\n * is let through untouched. The chips stay as they are — what is about to be sent\n * stays readable.\n *\n * For the moment a send is in flight. keksdose's support picker is `disabled` while\n * the message goes out, because the message carries the attachments AS THEY WERE at\n * the press: a chip removed mid-send has gone with it all the same, and one added\n * mid-send looks as if it had. The field has no drop target; the paste is its drop.\n *\n * This is a pause, not a lock that explains itself — for that, `refs` mode (the mode\n * that commits) takes `commit` and `disabledReason`.\n */\n disabled?: boolean;\n /** Snapshot the app view behind this and return it as a File. A \"Capture\n * screenshot\" button appears only when it is given. */\n onCaptureScreenshot?: () => Promise<File | null>;\n /** Listen for the paste on `document` rather than on this field's own\n * subtree. For a modal, which owns the whole page while it is up. */\n documentPaste?: boolean;\n /** Listen for the paste within this element's subtree rather than this\n * field's own — for a field standing *beside* the text box a paste is made\n * in, whose common parent is where the event bubbles to. Ignored when\n * `documentPaste` is set. */\n pasteFrom?: RefObject<HTMLElement | null>;\n /**\n * The add and capture buttons' look (0.24.0, keksdose) — Button's own `variant`.\n * Default `\"secondary\"`, the look they always had.\n *\n * keksdose's support chat puts this field in ChatComposer's `attachmentSlot`, in the\n * row with Send, where its own picker had been a `ghost` / `sm` FileButton: two\n * bordered full-size buttons under a chat box read as a second form, and the field\n * gave no way to say otherwise. Every mode, wherever the buttons appear; the chips'\n * remove buttons keep their size.\n */\n buttonVariant?: ButtonVariant;\n /** The add and capture buttons' size — Button's own `size`, with `buttonVariant`.\n * Default `\"md\"`. `\"sm\"` draws their icons at 14px, as a small button's are. */\n buttonSize?: ButtonSize;\n className?: string;\n}\n\n/**\n * The field's root, in every mode. `relative` for the `sr-only` file input (see the\n * single field). `min-w-0 max-w-full` (0.24.0, keksdose) because the field is often a\n * FLEX ITEM — ChatComposer's `attachmentSlot` row, FormActions' `start` — and a flex item\n * is never narrower than its content's min-content width unless told it may be. A chip\n * truncates its name only inside a box of bounded width, and a screenshot's name\n * (\"Screenshot 2026-10-03 at 07.45.12.png\") was the min-content: the field grew to it\n * and ran off a 390px phone composer (measured in Chromium: the field's right edge at\n * 592px, the page 614px wide). keksdose passed `className=\"min-w-0 max-w-full\"` at both\n * its callers to stop it; here once, for every host. In normal flow — a dialog, a note\n * editor — both are no-ops.\n */\nconst FIELD_ROOT = \"relative min-w-0 max-w-full\";\n\n/** Paperclip and camera at the size the button's text is: 16px at `md`, 14px at `sm`. */\nconst buttonIcon = (size: ButtonSize) => (size === \"sm\" ? \"size-3.5\" : \"size-4\");\n\n/** One file: choosing a second means removing the first. The field's only mode until 0.15.5. */\nexport interface FeedbackAttachmentFieldSingleProps extends FeedbackAttachmentFieldBaseProps {\n multiple?: false;\n refs?: false;\n value: File | null;\n onChange: (file: File | null) => void;\n /** A file was refused. `info` (0.23.0) names it and the limit — see\n * {@link FeedbackAttachmentErrorInfo}. */\n onError?: (kind: \"type\" | \"size\", info: FeedbackAttachmentErrorInfo) => void;\n // Multiple-mode props, refused here: without `multiple` they would be silently ignored.\n max?: never;\n screenshot?: never;\n onScreenshotChange?: never;\n // `refs` mode's lock: a staged File is not a commit (see the refs props).\n commit?: never;\n disabledReason?: never;\n}\n\n/**\n * Several files (0.15.5, keksdose dev#578: \"pasted two photos, the second overwrote\n * the first\"). Every way in ADDS — a pick of several files, a paste, a capture — up to\n * `max`, and each file is a removable chip.\n */\nexport interface FeedbackAttachmentFieldMultipleProps extends FeedbackAttachmentFieldBaseProps {\n multiple: true;\n refs?: false;\n value: File[];\n onChange: (files: File[]) => void;\n /** How many files `value` may hold. Default {@link DEFAULT_MAX_ATTACHMENTS} (5). The\n * add buttons and the paste hint are offered only while there is room. */\n max?: number;\n /** Per file: a rejected one is reported and the others are still added. `\"count\"` is\n * once per pick, with the whole surplus in `info.files`. `info` (0.23.0): see\n * {@link FeedbackAttachmentErrorInfo}. */\n onError?: (kind: FeedbackAttachmentError, info: FeedbackAttachmentErrorInfo) => void;\n /**\n * A separate slot for THE screenshot, outside `value` and `max`. Given\n * `onScreenshotChange`, what `onCaptureScreenshot` returns lands here instead of in\n * `value`, shown as the first chip, and the capture button is offered only while the\n * slot is empty — a second snapshot of the same view is not more evidence. This is\n * how `<FeedbackDialog attachments=\"multiple\">` keeps the screenshot apart from the\n * photos; a form built from the parts can do the same.\n */\n screenshot?: File | null;\n onScreenshotChange?: (file: File | null) => void;\n // `refs` mode's lock: a staged File is not a commit (see the refs props).\n commit?: never;\n disabledReason?: never;\n}\n\n/**\n * Uploaded on pick (0.22.0, keksdose K16). keksdose's support chat uploads each file\n * the moment it is chosen and sends the message with the REFS the uploads answered —\n * a 10 MB screenshot is refused while the reporter is still typing, not when they\n * press Send — so its `AttachmentPicker` could not use this field, whose value is\n * `File`s held until the form is submitted. Here the value is\n * {@link FeedbackAttachmentRef}s: every way in (pick, paste, capture) validates the\n * file as the other modes do, then hands it to `onUpload` and shows a chip with a\n * spinner until it answers; the ref it resolves to joins `value` through `onChange`.\n * A rejection drops the chip and reports `onError(\"upload\", error)`. A chip is removed\n * BY KEY: `onChange` gets the list without it, and `onRemove` the key, for a host that\n * deletes the upload on the server too.\n *\n * Uploads still running count against `max`, so five picks in quick succession cannot\n * overshoot it; they are not in `value` until they land, so a send that reads `value`\n * sends only what has arrived — hold Send back while {@link onUploadingChange} says\n * an upload is running. Several files upload side by side and join in the order they\n * finish. The File modes are unchanged.\n */\nexport interface FeedbackAttachmentFieldRefsProps extends FeedbackAttachmentFieldBaseProps {\n refs: true;\n multiple?: never;\n value: FeedbackAttachmentRef[];\n onChange: (refs: FeedbackAttachmentRef[]) => void;\n /** Upload one file; resolve to its ref, or reject to refuse it. Called once per\n * accepted file, the moment it is chosen. */\n onUpload: (file: File) => Promise<FeedbackAttachmentRef>;\n /** A chip was removed — after `onChange` — with its ref's key. */\n onRemove?: (key: string) => void;\n /** Whether any upload is running: `true` when the first starts, `false` when the\n * last settles — for the host's Send, which should wait. */\n onUploadingChange?: (uploading: boolean) => void;\n /** How many refs `value` may hold, uploads in flight included. Default\n * {@link DEFAULT_MAX_ATTACHMENTS} (5). */\n max?: number;\n /** Per file. `\"upload\"` carries what `onUpload` rejected with as `error` (`undefined`\n * for the other kinds). `info` (0.23.0) comes third so a 0.22 handler's `error` is\n * still the second argument — see {@link FeedbackAttachmentErrorInfo}. */\n onError?: (kind: FeedbackAttachmentRefsError, error: unknown, info: FeedbackAttachmentErrorInfo) => void;\n /**\n * This field COMMITS (0.23.0): each file is uploaded the moment it is chosen, and a\n * remove may delete the upload (`onRemove`) — a save, unlike the File modes, which\n * only stage a file for a form sent later (and so stay open under a lock, like every\n * field). Under a locked {@link WriteLockProvider} it takes the `disabledReason` path\n * with the lock's reason, which wins over one of its own. No provider, or an unlocked\n * one: no effect.\n */\n commit?: boolean;\n /**\n * Why no file can be added or removed — the write lock's sentence, a quota, a thread\n * closed to replies. Unlike `disabled`, it SAYS so, the kit's commit-control way: the\n * buttons (add, capture, every chip's remove) stay focusable, `aria-disabled`, with\n * the reason in the kit Tooltip and their description; no pick, paste or remove gets\n * through; and the reason stands where the paste hint was, for a phone that never\n * hovers. The chips stay readable.\n */\n disabledReason?: ReactNode;\n screenshot?: never;\n onScreenshotChange?: never;\n}\n\nexport type FeedbackAttachmentFieldProps =\n | FeedbackAttachmentFieldSingleProps\n | FeedbackAttachmentFieldMultipleProps\n | FeedbackAttachmentFieldRefsProps;\n\n/**\n * Picking one picture: the file dialog, a capture of the app view, or a paste.\n * With `multiple`, picking several (see {@link FeedbackAttachmentFieldMultipleProps}).\n *\n * Lifted out of {@link FeedbackDialog} so the *reply* half of the feature can\n * have it too (Steering Design feedback #128). A report is a conversation — it\n * is filed, it is answered, and the reporter sends it back saying that is not\n * what they meant — and the screenshot showing what they mean is taken at\n * whichever of those points they looked. Only the first of them had a way to\n * attach one, so everything after it had to be described in words.\n *\n * **Three ways in, and they are three because no one of them covers the others.**\n * The file dialog needs a file on disk; `onCaptureScreenshot` snapshots the\n * *whole* app view; and the clipboard is where a region snip already is on every\n * platform (Steering Design feedback #39). Somebody who wanted to show one panel\n * had to save a crop and then find it again.\n *\n * `documentPaste` and `pasteFrom` decide where the paste is listened for, and\n * it is a real choice rather than a flag with a default. A modal traps focus,\n * so while it is up every paste in the page is meant for it — including one\n * made with nothing in particular focused, which never reaches a React\n * `onPaste` on a child: that is `documentPaste`. An editor **inline on a\n * page** is not that: the page around it has its own fields, so it listens\n * within its own subtree and a paste elsewhere stays where it was aimed. But\n * \"its own subtree\" has to include the text box the paste is actually made in,\n * and that box is this field's *sibling*, not its child — a paste in it bubbles\n * to their common parent and never through here. `pasteFrom` is that parent\n * (Steering Design feedback #140): the element whose subtree is listened to,\n * handed in by whoever renders both the box and this field side by side.\n */\nexport function FeedbackAttachmentField(props: FeedbackAttachmentFieldProps) {\n // One component per mode rather than one with branches: the modes hold different\n // state (one preview vs. one per chip vs. uploads in flight), and a hook order that\n // depends on a prop is a crash the day a caller flips it.\n if (props.refs) return <RefsField {...props} />;\n return props.multiple ? <MultipleField {...props} /> : <SingleField {...props} />;\n}\n\nfunction SingleField({\n value,\n onChange,\n labels: labelsProp,\n accept = DEFAULT_ATTACHMENT_ACCEPT,\n maxBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onError,\n onCaptureScreenshot,\n documentPaste = false,\n pasteFrom,\n disabled = false,\n buttonVariant = \"secondary\",\n buttonSize = \"md\",\n className,\n}: FeedbackAttachmentFieldSingleProps) {\n // The object URL is keyed to the file it was made for, so a stale one (from the\n // previous file, or after `value` is cleared) is never shown — no reset needed.\n const [previewFor, setPreviewFor] = useState<{ file: File; url: string } | null>(null);\n const preview = value && previewFor?.file === value ? previewFor.url : null;\n const fileInputRef = useRef<HTMLInputElement>(null);\n // `file.size` from `<UiKitProvider labels>`, formatted in its locale — see FileDropzone.\n const fileText = useKitFileLabels();\n const text = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n const errorInfo = useErrorInfo(accept, maxBytes, undefined, text);\n\n // Object-URL preview lifecycle (create on change, revoke on cleanup).\n useEffect(() => {\n if (!value) return;\n const url = URL.createObjectURL(value);\n // The URL is an external resource that must be created and revoked in step\n // with the effect (a render-time `createObjectURL` would leak, and StrictMode's\n // remount would revoke a memoised one out from under the <img>).\n // eslint-disable-next-line react-hooks/set-state-in-effect -- publishing an external resource's handle\n setPreviewFor({ file: value, url });\n return () => URL.revokeObjectURL(url);\n }, [value]);\n\n const pick = (file: File | undefined | null) => {\n if (!file) return;\n const problem = rejection(file, accept, maxBytes);\n if (problem) {\n onError?.(problem, errorInfo(problem, [file]));\n return;\n }\n onChange(file);\n };\n\n const onPaste = usePaste(\n (images) => {\n // Clipboard images arrive named \"image.png\" at best and unnamed at worst,\n // and the name is what the inbox shows beside the thumbnail. A name that\n // says where it came from is more use than the browser's.\n const file = images[0];\n pick(new File([file], pastedName(file.type), { type: file.type }));\n },\n documentPaste,\n pasteFrom,\n disabled,\n );\n\n return (\n <div\n // `relative` for the same reason as FileDropzone: the `sr-only` file input below\n // is `position: absolute`, and without a positioned ancestor it is laid out\n // against the initial containing block — extending the DOCUMENT height to its own\n // offset and producing a phantom second scrollbar on any long page. And\n // `min-w-0 max-w-full`, so a long name truncates in a flex row: see FIELD_ROOT.\n className={cn(FIELD_ROOT, className)}\n onPaste={onPaste}\n >\n <Heading text={labelsProp?.attachment} />\n {value ? (\n <div className=\"flex items-start gap-2\">\n {value.type.startsWith(\"image/\") && preview ? (\n <img\n src={preview}\n alt={value.name}\n className=\"h-20 w-20 rounded border border-[var(--border)] object-cover\"\n />\n ) : (\n // Non-image attachments (PDF, text) can't preview as an <img>, so\n // show a neutral file tile with the name/size beside it instead.\n <div className=\"flex h-20 w-20 items-center justify-center rounded border border-[var(--border)] text-[var(--text-placeholder)]\">\n <FileText className=\"size-8\" />\n </div>\n )}\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{value.name}</div>\n <div className=\"text-xs text-[var(--text-muted)]\">\n {fileText.size(value.size)}\n </div>\n </div>\n <RemoveButton label={text.attachmentRemove} onClick={() => onChange(null)} disabled={disabled} />\n </div>\n ) : (\n <div className=\"space-y-1.5\">\n <div className=\"flex flex-wrap gap-2\">\n <Button\n type=\"button\"\n variant={buttonVariant}\n size={buttonSize}\n disabled={disabled}\n onClick={() => fileInputRef.current?.click()}\n >\n <Paperclip className={buttonIcon(buttonSize)} /> {text.attachmentAdd}\n </Button>\n {onCaptureScreenshot && (\n <CaptureButton\n capture={onCaptureScreenshot}\n onFile={pick}\n label={text.attachmentCapture}\n disabled={disabled}\n variant={buttonVariant}\n size={buttonSize}\n />\n )}\n </div>\n {/* Said out loud, because a gesture with no affordance is a gesture\n nobody finds. */}\n <p className=\"text-xs text-[var(--text-muted)]\">\n {text.attachmentPaste}\n </p>\n </div>\n )}\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept.join(\",\")}\n className=\"sr-only\"\n disabled={disabled}\n onChange={(e) => {\n pick(e.target.files?.[0]);\n e.target.value = \"\";\n }}\n />\n </div>\n );\n}\n\nfunction MultipleField({\n value,\n onChange,\n max = DEFAULT_MAX_ATTACHMENTS,\n screenshot = null,\n onScreenshotChange,\n labels: labelsProp,\n accept = DEFAULT_ATTACHMENT_ACCEPT,\n maxBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onError,\n onCaptureScreenshot,\n documentPaste = false,\n pasteFrom,\n disabled = false,\n buttonVariant = \"secondary\",\n buttonSize = \"md\",\n className,\n}: FeedbackAttachmentFieldMultipleProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const fileText = useKitFileLabels();\n const text = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n const removeLabel = text.attachmentRemoveFile ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentRemoveFile!;\n const limitLabel = text.attachmentLimit ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentLimit!;\n const screenshotLabel = text.attachmentScreenshot ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentScreenshot!;\n const errorInfo = useErrorInfo(accept, maxBytes, max, text);\n\n // What an add or a remove builds on: the `value` prop, plus whatever this field has\n // already handed to `onChange` since the parent last rendered. The field is\n // controlled, so between an `onChange` and the re-render that brings it back, `value`\n // is stale — and two adds in that gap (two pastes, a paste and a pick, delivered by\n // native listeners whose updates React batches) each spread the SAME old list, and\n // the second dropped the first. Re-synced to the prop after every commit, so a\n // parent that refuses a change (or edits the list itself) is what wins.\n const latest = useRef(value);\n useLayoutEffect(() => {\n latest.current = value;\n });\n const commit = (next: File[]) => {\n latest.current = next;\n onChange(next);\n };\n\n const hasSlot = onScreenshotChange !== undefined;\n const room = Math.max(0, max - value.length);\n // The screenshot slot is its own thing: it neither counts against `max` nor is\n // closed by it, so a full set of photos still leaves the capture on offer.\n const canCapture = !!onCaptureScreenshot && (hasSlot ? !screenshot : room > 0);\n\n const add = (incoming: File[], pasted = false) => {\n const current = latest.current;\n const accepted: File[] = [];\n const taken = new Set([...current, ...(screenshot ? [screenshot] : [])].map((f) => f.name));\n for (const raw of incoming) {\n // Two pastes are two files called \"pasted.png\", and a backend that stores by\n // name keeps one of them — the very loss this mode exists to end. A picked\n // file keeps its own name: it is the user's, and they may look for it. Named\n // before the check, so a refusal names it as the single field's does.\n const file = pasted ? renamed(raw, uniqueName(pastedName(raw.type), taken)) : raw;\n const problem = rejection(file, accept, maxBytes);\n if (problem) {\n onError?.(problem, errorInfo(problem, [file]));\n continue;\n }\n taken.add(file.name);\n // The same File object twice is one file chosen twice, not two.\n if (!current.includes(file)) accepted.push(file);\n }\n if (accepted.length === 0) return;\n const space = Math.max(0, max - current.length);\n if (accepted.length > space) onError?.(\"count\", errorInfo(\"count\", accepted.slice(space)));\n const kept = accepted.slice(0, space);\n if (kept.length > 0) commit([...current, ...kept]);\n };\n\n const onPaste = usePaste((images) => add(images, true), documentPaste, pasteFrom, disabled);\n\n const capture = (file: File) => {\n if (!hasSlot) {\n add([file]);\n return;\n }\n const problem = rejection(file, accept, maxBytes);\n if (problem) onError?.(problem, errorInfo(problem, [file]));\n else onScreenshotChange(file);\n };\n\n // Removing a chip removes the button that had focus. Focus goes to the chip that\n // took its place — the next one — and, when it was the last, to the first action\n // button (there is room again, so \"Attach\" is back), else to the chip before it.\n // Applied once the parent has re-rendered with the shorter list: the field is\n // controlled, and focusing before that would land on the chip being removed.\n const pendingFocus = useRef<number | null>(null);\n useEffect(() => {\n const index = pendingFocus.current;\n if (index === null) return;\n pendingFocus.current = null;\n const root = rootRef.current;\n if (!root) return;\n const removes = root.querySelectorAll<HTMLElement>(\"[data-attachment-remove]\");\n const target =\n removes[index] ?? root.querySelector<HTMLElement>(\"[data-attachment-action]\") ?? removes[index - 1];\n target?.focus();\n }, [value, screenshot]);\n\n const chips: Array<{ file: File; screenshot: boolean; name: string; remove: () => void }> = [\n ...(hasSlot && screenshot\n ? [{ file: screenshot, screenshot: true, name: screenshotLabel, remove: () => onScreenshotChange(null) }]\n : []),\n ...value.map((file) => ({\n file,\n screenshot: false,\n name: file.name,\n remove: () => commit(latest.current.filter((f) => f !== file)),\n })),\n ];\n\n return (\n <div ref={rootRef} className={cn(FIELD_ROOT, \"space-y-2\", className)} onPaste={onPaste}>\n <Heading text={labelsProp?.attachment} className=\"mb-0\" />\n {chips.length > 0 && (\n // One chip per row, full width: wrapped chips of name-dependent widths made a\n // ragged block in a 430px dialog, and a column keeps every name and remove\n // button in the same place — the next chip's button is right under the last.\n <ul aria-label={text.attachmentList} className=\"flex flex-col gap-2\">\n {chips.map((chip, index) => (\n <li\n key={fileKey(chip.file)}\n className=\"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--bg-surface)] p-1\"\n >\n <ChipPreview file={chip.file} screenshot={chip.screenshot} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{chip.name}</div>\n <div className=\"truncate text-xs text-[var(--text-muted)]\">\n {/* The screenshot's file name moves down here: still there for the\n reporter who wants to know what will be sent, not its title. */}\n {chip.screenshot ? `${chip.file.name} · ${fileText.size(chip.file.size)}` : fileText.size(chip.file.size)}\n </div>\n </div>\n <RemoveButton\n label={removeLabel(chip.name)}\n disabled={disabled}\n onClick={() => {\n pendingFocus.current = index;\n chip.remove();\n }}\n />\n </li>\n ))}\n </ul>\n )}\n {(room > 0 || canCapture) && (\n <div className=\"flex flex-wrap gap-2\">\n {room > 0 && (\n <Button\n type=\"button\"\n variant={buttonVariant}\n size={buttonSize}\n data-attachment-action=\"\"\n disabled={disabled}\n onClick={() => fileInputRef.current?.click()}\n >\n <Paperclip className={buttonIcon(buttonSize)} /> {text.attachmentAdd}\n </Button>\n )}\n {canCapture && onCaptureScreenshot && (\n <CaptureButton\n capture={onCaptureScreenshot}\n onFile={capture}\n label={text.attachmentCapture}\n disabled={disabled}\n variant={buttonVariant}\n size={buttonSize}\n data-attachment-action=\"\"\n />\n )}\n </div>\n )}\n <p className=\"text-xs text-[var(--text-muted)]\">\n {room > 0 ? text.attachmentPaste : limitLabel(max)}\n </p>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple={room > 1}\n accept={accept.join(\",\")}\n className=\"sr-only\"\n // Out of the tab order and the accessibility tree: the button above is\n // the way in, and a second, unlabelled \"Choose files\" stop is noise.\n tabIndex={-1}\n aria-hidden\n disabled={disabled}\n onChange={(e) => {\n add(Array.from(e.target.files ?? []));\n e.target.value = \"\";\n }}\n />\n </div>\n );\n}\n\n/** A file `refs` mode is uploading: its own id (a ref has no key yet), and the file. */\ninterface Upload {\n id: number;\n file: File;\n}\n\nlet nextUploadId = 0;\n\nfunction RefsField({\n value,\n onChange,\n onUpload,\n onRemove,\n onUploadingChange,\n max = DEFAULT_MAX_ATTACHMENTS,\n labels: labelsProp,\n accept = DEFAULT_ATTACHMENT_ACCEPT,\n maxBytes = DEFAULT_MAX_ATTACHMENT_BYTES,\n onError,\n onCaptureScreenshot,\n documentPaste = false,\n pasteFrom,\n disabled = false,\n commit: commits,\n disabledReason: ownDisabledReason,\n buttonVariant = \"secondary\",\n buttonSize = \"md\",\n className,\n}: FeedbackAttachmentFieldRefsProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const fileText = useKitFileLabels();\n const text = useKitLabels(\"feedbackAttachment\", DEFAULT_FEEDBACK_ATTACHMENT_LABELS, labelsProp);\n const removeLabel = text.attachmentRemoveFile ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentRemoveFile!;\n const limitLabel = text.attachmentLimit ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentLimit!;\n const uploadingLabel = text.attachmentUploading ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploading!;\n const errorInfo = useErrorInfo(accept, maxBytes, max, text);\n // The lock's reason (under `commit`) over the field's own; with either, the controls\n // take the focusable `aria-disabled` path and say why — Button's and IconButton's\n // `disabledReason`, handed down as is.\n const disabledReason = useCommitReason(commits, ownDisabledReason);\n const locked = hasReason(disabledReason);\n const reason = locked ? disabledReason : undefined;\n const inert = disabled || locked;\n\n // As in `multiple` mode: `value` plus whatever has been handed to `onChange` since\n // the parent last rendered — two uploads landing in one tick must both survive.\n const latest = useRef(value);\n useLayoutEffect(() => {\n latest.current = value;\n });\n const commit = (next: FeedbackAttachmentRef[]) => {\n latest.current = next;\n onChange(next);\n };\n\n const [uploads, setUploads] = useState<Upload[]>([]);\n // The uploads in flight, kept in a ref as well: `add` runs several times before a\n // render when files arrive together, and each must see the others — their count\n // against `max`, their names against a pasted image's.\n const inFlight = useRef<Upload[]>([]);\n // Unmounted (the dialog closed mid-upload): a late answer is not this field's to\n // commit, and setting state on it would be a no-op at best.\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const uploadingChange = useRef(onUploadingChange);\n useEffect(() => {\n uploadingChange.current = onUploadingChange;\n });\n\n const room = Math.max(0, max - value.length - uploads.length);\n\n const start = (file: File) => {\n const upload: Upload = { id: nextUploadId++, file };\n inFlight.current = [...inFlight.current, upload];\n if (inFlight.current.length === 1) uploadingChange.current?.(true);\n setUploads(inFlight.current);\n const settle = () => {\n inFlight.current = inFlight.current.filter((u) => u.id !== upload.id);\n if (!mounted.current) return;\n setUploads(inFlight.current);\n if (inFlight.current.length === 0) uploadingChange.current?.(false);\n };\n let answer: Promise<FeedbackAttachmentRef>;\n try {\n answer = Promise.resolve(onUpload(file));\n } catch (error) {\n answer = Promise.reject(error);\n }\n answer.then(\n (ref) => {\n settle();\n if (mounted.current) commit([...latest.current, ref]);\n },\n (error: unknown) => {\n settle();\n if (mounted.current) onError?.(\"upload\", error, errorInfo(\"upload\", [file], error));\n },\n );\n };\n\n const add = (incoming: File[], pasted = false) => {\n let space = Math.max(0, max - latest.current.length - inFlight.current.length);\n const taken = new Set([...latest.current.map((r) => r.name), ...inFlight.current.map((u) => u.file.name)]);\n const dropped: File[] = [];\n for (const raw of incoming) {\n // Pasted images are all \"image.png\" to the clipboard; as in `multiple` mode,\n // each gets a name of its own before it is checked and uploaded under it.\n const file = pasted ? renamed(raw, uniqueName(pastedName(raw.type), taken)) : raw;\n const problem = rejection(file, accept, maxBytes);\n if (problem) {\n // `undefined` in `error`'s place, as in 0.22: only an upload has one.\n onError?.(problem, undefined, errorInfo(problem, [file]));\n continue;\n }\n taken.add(file.name);\n if (space === 0) {\n dropped.push(file);\n continue;\n }\n space -= 1;\n start(file);\n }\n if (dropped.length > 0) onError?.(\"count\", undefined, errorInfo(\"count\", dropped));\n };\n\n const onPaste = usePaste((images) => add(images, true), documentPaste, pasteFrom, inert);\n\n // Focus after a remove, as in `multiple` mode: the next chip, else the first action.\n const pendingFocus = useRef<number | null>(null);\n useEffect(() => {\n const index = pendingFocus.current;\n if (index === null) return;\n pendingFocus.current = null;\n const root = rootRef.current;\n if (!root) return;\n const removes = root.querySelectorAll<HTMLElement>(\"[data-attachment-remove]\");\n const target =\n removes[index] ?? root.querySelector<HTMLElement>(\"[data-attachment-action]\") ?? removes[index - 1];\n target?.focus();\n }, [value]);\n\n const remove = (key: string, index: number) => {\n if (inert) return;\n pendingFocus.current = index;\n commit(latest.current.filter((r) => r.key !== key));\n onRemove?.(key);\n };\n\n const hasChips = value.length > 0 || uploads.length > 0;\n\n return (\n <div ref={rootRef} className={cn(FIELD_ROOT, \"space-y-2\", className)} onPaste={onPaste}>\n <Heading text={labelsProp?.attachment} className=\"mb-0\" />\n {hasChips && (\n <ul aria-label={text.attachmentList} className=\"flex flex-col gap-2\">\n {value.map((ref, index) => (\n <li\n key={`ref:${ref.key}`}\n className=\"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--bg-surface)] p-1\"\n >\n <RefGlyph type={ref.type} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{ref.name}</div>\n {ref.size !== undefined && (\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{fileText.size(ref.size)}</div>\n )}\n </div>\n <RemoveButton\n label={removeLabel(ref.name)}\n onClick={() => remove(ref.key, index)}\n disabled={disabled}\n reason={reason}\n />\n </li>\n ))}\n {uploads.map((upload) => (\n <li\n key={`upload:${upload.id}`}\n aria-busy=\"true\"\n data-attachment-uploading=\"\"\n className=\"flex min-w-0 items-center gap-2 rounded-md border border-dashed border-[var(--border)] bg-[var(--bg-surface)] p-1\"\n >\n <span className=\"flex size-12 shrink-0 items-center justify-center rounded border border-[var(--border)] bg-[var(--bg-surface-2)] text-[var(--text-placeholder)]\">\n <Spinner label={null} className=\"size-5\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm text-[var(--text-secondary)]\">{upload.file.name}</div>\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{uploadingLabel}</div>\n </div>\n </li>\n ))}\n </ul>\n )}\n {room > 0 && (\n <div className=\"flex flex-wrap gap-2\">\n <Button\n type=\"button\"\n variant={buttonVariant}\n size={buttonSize}\n data-attachment-action=\"\"\n disabled={disabled}\n disabledReason={reason}\n onClick={() => fileInputRef.current?.click()}\n >\n <Paperclip className={buttonIcon(buttonSize)} /> {text.attachmentAdd}\n </Button>\n {onCaptureScreenshot && (\n <CaptureButton\n capture={onCaptureScreenshot}\n onFile={(file) => add([file])}\n label={text.attachmentCapture}\n disabled={disabled}\n disabledReason={reason}\n variant={buttonVariant}\n size={buttonSize}\n data-attachment-action=\"\"\n />\n )}\n </div>\n )}\n {locked ? (\n // Where the paste hint was: a phone never hovers, so the Tooltip alone would\n // leave a touch user with buttons that do nothing and no word why.\n <div data-attachment-reason=\"\" className=\"text-xs text-[var(--text-muted)]\">\n {disabledReason}\n </div>\n ) : (\n <p className=\"text-xs text-[var(--text-muted)]\">{room > 0 ? text.attachmentPaste : limitLabel(max)}</p>\n )}\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple={room > 1}\n accept={accept.join(\",\")}\n className=\"sr-only\"\n tabIndex={-1}\n aria-hidden\n disabled={inert}\n onChange={(e) => {\n add(Array.from(e.target.files ?? []));\n e.target.value = \"\";\n }}\n />\n </div>\n );\n}\n\n/** A ref chip's picture. The bytes are on the server, not here, so there is nothing to\n * preview: an image glyph for an image `type`, a file glyph for anything else. */\nfunction RefGlyph({ type }: { type?: string }) {\n return (\n <span className=\"flex size-12 shrink-0 items-center justify-center rounded border border-[var(--border)] bg-[var(--bg-surface-2)] text-[var(--text-placeholder)]\">\n {type?.startsWith(\"image/\") ? <ImageIcon aria-hidden className=\"size-6\" /> : <FileText aria-hidden className=\"size-6\" />}\n </span>\n );\n}\n\nfunction Heading({ text, className }: { text?: string; className?: string }) {\n if (!text) return null;\n return (\n <div className={cn(\"mb-1 text-xs font-medium uppercase tracking-wide text-[var(--text-muted)]\", className)}>\n {text}\n </div>\n );\n}\n\nfunction CaptureButton({\n capture,\n onFile,\n label,\n disabled = false,\n disabledReason,\n variant,\n size,\n ...rest\n}: {\n capture: () => Promise<File | null>;\n onFile: (file: File) => void;\n label: string;\n disabled?: boolean;\n disabledReason?: ReactNode;\n variant: ButtonVariant;\n size: ButtonSize;\n \"data-attachment-action\"?: string;\n}) {\n const [capturing, setCapturing] = useState(false);\n return (\n <Button\n type=\"button\"\n variant={variant}\n size={size}\n disabled={capturing || disabled}\n disabledReason={disabledReason}\n {...rest}\n onClick={() => {\n if (capturing || disabled) return;\n setCapturing(true);\n void capture()\n .then((file) => {\n if (file) onFile(file);\n })\n .finally(() => setCapturing(false));\n }}\n >\n <Camera className={buttonIcon(size)} /> {capturing ? \"…\" : label}\n </Button>\n );\n}\n\n/**\n * A chip's (or the single file's) remove button: the kit's IconButton at the 28px the\n * hand-built one had, so `disabled` (0.23.0) dims and disables it the kit way and a\n * `reason` takes IconButton's `disabledReason` path — focusable, `aria-disabled`, the\n * reason in the Tooltip — rather than a third copy of either here.\n */\nfunction RemoveButton({\n label,\n onClick,\n disabled,\n reason,\n}: {\n label: string;\n onClick: () => void;\n disabled: boolean;\n reason?: ReactNode;\n}) {\n return (\n <IconButton\n type=\"button\"\n size=\"xs\"\n tone=\"muted\"\n data-attachment-remove=\"\"\n aria-label={label}\n disabled={disabled}\n disabledReason={reason}\n onClick={onClick}\n className=\"shrink-0\"\n >\n <X aria-hidden />\n </IconButton>\n );\n}\n\n/** A reason worth showing: `null`, `false` and `\"\"` are a caller's \"no reason\". */\nfunction hasReason(reason: ReactNode): boolean {\n return reason !== undefined && reason !== null && reason !== false && reason !== \"\";\n}\n\n/**\n * The {@link FeedbackAttachmentErrorInfo} builder of one field: its limits, and the\n * sentence for each refusal. The sentences are the `filePicker` namespace's — the ones\n * FileButton and FileDropzone say — so an app that translated those has these too, and\n * a refusal reads the same whichever of the kit's pickers made it. Only the upload\n * failure, which no other picker has, is this field's own (`attachmentUploadFailed`).\n */\nfunction useErrorInfo(\n accept: string[],\n maxBytes: number,\n max: number | undefined,\n text: FeedbackAttachmentFieldLabels,\n) {\n const picker = useKitLabels(\"filePicker\", DEFAULT_FILE_PICKER_LABELS);\n const fileText = useKitFileLabels();\n const uploadFailed = text.attachmentUploadFailed ?? DEFAULT_FEEDBACK_ATTACHMENT_LABELS.attachmentUploadFailed!;\n return (kind: FeedbackAttachmentRefsError, files: File[], error?: unknown): FeedbackAttachmentErrorInfo => {\n const file = files[0];\n let message: string;\n if (kind === \"type\") {\n // FileButton's rule: name what IS accepted (\"Only image/png, image/jpeg files\"),\n // unless the app translated `rejectedType` but not yet `rejectedTypeOnly` — its\n // own sentence beats an English one.\n const acceptText = formatAccept(accept.join(\",\"));\n const useOnly =\n acceptText !== \"\" &&\n (picker.rejectedTypeOnly !== DEFAULT_FILE_PICKER_LABELS.rejectedTypeOnly ||\n picker.rejectedType === DEFAULT_FILE_PICKER_LABELS.rejectedType);\n message = useOnly ? picker.rejectedTypeOnly(acceptText, file.name) : picker.rejectedType(file.name);\n } else if (kind === \"size\") {\n message = picker.rejectedSize(file.name, fileText.size(maxBytes));\n } else if (kind === \"count\") {\n message = files.length === 1 ? picker.rejectedCount(file.name, max ?? 1) : picker.rejectedMany(files.length);\n } else {\n message = uploadFailed(file.name);\n }\n return {\n file,\n files,\n message,\n maxBytes,\n accept,\n ...(max !== undefined ? { max } : null),\n ...(kind === \"upload\" ? { error } : null),\n };\n };\n}\n\n/** A chip's picture: the image itself, or a file glyph for anything that is not one.\n * Decorative (`alt=\"\"`) — the name stands beside it. Its own component so the object\n * URL lives exactly as long as the chip: removing the chip unmounts it and revokes. */\nfunction ChipPreview({ file, screenshot }: { file: File; screenshot: boolean }) {\n const isImage = file.type.startsWith(\"image/\");\n const [previewFor, setPreviewFor] = useState<{ file: File; url: string } | null>(null);\n const url = previewFor?.file === file ? previewFor.url : null;\n useEffect(() => {\n if (!isImage) return;\n const next = URL.createObjectURL(file);\n // As in the single field: an external resource created and revoked with the effect.\n // eslint-disable-next-line react-hooks/set-state-in-effect -- publishing an external resource's handle\n setPreviewFor({ file, url: next });\n return () => URL.revokeObjectURL(next);\n }, [file, isImage]);\n\n return (\n <span className=\"relative flex size-12 shrink-0 items-center justify-center overflow-hidden rounded border border-[var(--border)] bg-[var(--bg-surface-2)] text-[var(--text-placeholder)]\">\n {isImage && url ? (\n <img src={url} alt=\"\" className=\"size-full object-cover\" />\n ) : (\n <FileText aria-hidden className=\"size-6\" />\n )}\n {screenshot && (\n // Marks the slot apart from the photos: it is why the capture button is gone.\n <span className=\"absolute bottom-0.5 end-0.5 rounded-sm bg-[var(--bg-surface)] p-0.5 text-[var(--text-secondary)]\">\n <Camera aria-hidden className=\"size-3\" />\n </span>\n )}\n </span>\n );\n}\n\n/** A stable React key per File object — the name is not one (two pastes, two\n * \"pasted.png\" before renaming; the same photo picked from two folders). */\nconst fileKeys = new WeakMap<File, number>();\nlet nextFileKey = 0;\nfunction fileKey(file: File): number {\n let key = fileKeys.get(file);\n if (key === undefined) {\n key = nextFileKey++;\n fileKeys.set(file, key);\n }\n return key;\n}\n\nfunction rejection(file: File, accept: string[], maxBytes: number): \"type\" | \"size\" | null {\n if (!accept.includes(file.type)) return \"type\";\n if (file.size > maxBytes) return \"size\";\n return null;\n}\n\nfunction renamed(file: File, name: string): File {\n return new File([file], name, { type: file.type });\n}\n\n/** `pasted.png`, then `pasted-2.png`, `pasted-3.png`… — the first name not in `taken`. */\nfunction uniqueName(name: string, taken: Set<string>): string {\n if (!taken.has(name)) return name;\n const dot = name.lastIndexOf(\".\");\n const [stem, ext] = dot > 0 ? [name.slice(0, dot), name.slice(dot)] : [name, \"\"];\n let n = 2;\n while (taken.has(`${stem}-${n}${ext}`)) n++;\n return `${stem}-${n}${ext}`;\n}\n\n/**\n * The paste listener both modes share. `onImages` gets every image file on the\n * clipboard (the single field takes the first). It is registered once rather than per\n * render, so it reads the handler — which closes over props that change identity on\n * every render — out of a ref rather than out of its own dependency list. Returns the\n * `onPaste` for the field's root, or `undefined` when listening elsewhere.\n */\nfunction usePaste(\n onImages: (images: File[]) => void,\n documentPaste: boolean,\n pasteFrom: RefObject<HTMLElement | null> | undefined,\n /** `disabled` / locked (0.23.0): the paste goes where it was going, untouched — not\n * swallowed, so a text half still lands in the box it was made in. */\n off: boolean,\n) {\n // `null` while off, so the listeners below leave the event alone entirely.\n const handler = off ? null : onImages;\n const latest = useRef(handler);\n useEffect(() => {\n latest.current = handler;\n });\n\n // The element listened on, where it is not this field's own subtree: the\n // document for a modal, the given parent for an inline editor. Read inside\n // the effect rather than in render, because a ref's `current` is only set\n // once the parent has mounted — which it has by the time effects run.\n useEffect(() => {\n const target: EventTarget | null = documentPaste ? document : (pasteFrom?.current ?? null);\n if (!target) return;\n const onPaste = (event: Event) => {\n if (!latest.current) return;\n const clipboard = (event as ClipboardEvent).clipboardData;\n takeImages(clipboard, () => event.preventDefault(), latest.current);\n };\n target.addEventListener(\"paste\", onPaste);\n return () => target.removeEventListener(\"paste\", onPaste);\n }, [documentPaste, pasteFrom]);\n\n const listensElsewhere = documentPaste || pasteFrom !== undefined;\n return listensElsewhere\n ? undefined\n : (event: ReactClipboardEvent) => {\n if (!latest.current) return;\n takeImages(event.clipboardData, () => event.preventDefault(), latest.current);\n };\n}\n\nfunction takeImages(clipboard: DataTransfer | null, stop: () => void, onImages: (images: File[]) => void) {\n const images = Array.from(clipboard?.items ?? [])\n .filter((item) => item.kind === \"file\" && item.type.startsWith(\"image/\"))\n .map((item) => item.getAsFile())\n .filter((file): file is File => file !== null);\n if (images.length === 0) return;\n // Only once there IS an image: a paste of text into a field must stay a\n // paste of text, and a clipboard holding both is a copy whose text half is\n // what the field was focused for.\n stop();\n onImages(images);\n}\n\n/** What a pasted image is called once it is an attachment.\n *\n * The extension is read off the mime type rather than assumed to be `.png`:\n * Safari puts TIFF on the clipboard and a file called `pasted.png` that is not\n * a PNG is one the receiving end opens wrong. */\nexport function pastedName(type: string): string {\n const subtype = type.split(\"/\")[1] ?? \"png\";\n // `image/svg+xml` and friends carry a suffix that is not part of the\n // extension, and none of them are in the accepted list anyway.\n return `pasted.${subtype.split(\"+\")[0]}`;\n}\n"],"mappings":";AAqXyB,cA0Ff,YA1Fe;AArXzB,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,QAAQ,UAAU,SAAS,WAAW,WAAW,SAAS;AACnE,SAAS,QAAQ,YAAY,eAAe;AAE5C,SAAS,4BAA4B,oBAAoB;AACzD,SAAS,uBAAuB;AAChC,SAAS,kBAAkB,oBAAoB;AAGxC,MAAM,4BAA4B,CAAC,aAAa,cAAc,cAAc,WAAW;AACvF,MAAM,+BAA+B,KAAK,OAAO;AAIjD,MAAM,0BAA0B;AA4ChC,MAAM,qCAAoE;AAAA,EAC/E,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EA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