@layers-app/shared 0.4.8 → 0.4.9

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 (128) hide show
  1. package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts +2 -0
  2. package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts.map +1 -1
  3. package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.js +22 -17
  4. package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts +15 -0
  5. package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts.map +1 -0
  6. package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.js +36 -0
  7. package/dist/components/AttachmentsGalleryModal/components/GallerySlide.js +22 -22
  8. package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts +14 -0
  9. package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts.map +1 -0
  10. package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.js +31 -0
  11. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  12. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +179 -120
  13. package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts +18 -0
  14. package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts.map +1 -0
  15. package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.js +35 -0
  16. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts +34 -0
  17. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts.map +1 -0
  18. package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.js +71 -0
  19. package/dist/components/AttachmentsGalleryModal/styles.module.css.js +31 -27
  20. package/dist/components/CommentComposer/CommentComposer.module.css.js +13 -9
  21. package/dist/components/CommentComposer/index.d.ts +2 -1
  22. package/dist/components/CommentComposer/index.d.ts.map +1 -1
  23. package/dist/components/CommentComposer/index.js +343 -325
  24. package/dist/components/CommentComposer/types.d.ts +4 -0
  25. package/dist/components/CommentComposer/types.d.ts.map +1 -1
  26. package/dist/components/VideoPlayer/VideoPlayer.d.ts +24 -0
  27. package/dist/components/VideoPlayer/VideoPlayer.d.ts.map +1 -0
  28. package/dist/components/VideoPlayer/VideoPlayer.js +727 -0
  29. package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts +8 -0
  30. package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts.map +1 -0
  31. package/dist/components/VideoPlayer/components/MobileDrawer/index.js +67 -0
  32. package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts +7 -0
  33. package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts.map +1 -0
  34. package/dist/components/VideoPlayer/components/SelectListOptionButton.js +44 -0
  35. package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts +9 -0
  36. package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts.map +1 -0
  37. package/dist/components/VideoPlayer/components/StoryboardPreview.js +38 -0
  38. package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts +33 -0
  39. package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts.map +1 -0
  40. package/dist/components/VideoPlayer/components/VideoCustomControls.js +601 -0
  41. package/dist/components/VideoPlayer/components/VideoIcons.d.ts +25 -0
  42. package/dist/components/VideoPlayer/components/VideoIcons.d.ts.map +1 -0
  43. package/dist/components/VideoPlayer/components/VideoIcons.js +145 -0
  44. package/dist/components/VideoPlayer/components/VideoMenu.d.ts +27 -0
  45. package/dist/components/VideoPlayer/components/VideoMenu.d.ts.map +1 -0
  46. package/dist/components/VideoPlayer/components/VideoMenu.js +77 -0
  47. package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts +17 -0
  48. package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts.map +1 -0
  49. package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.js +289 -0
  50. package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts +10 -0
  51. package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts.map +1 -0
  52. package/dist/components/VideoPlayer/components/VideoQualityMenu/index.js +55 -0
  53. package/dist/components/VideoPlayer/components/VideoSelect.d.ts +10 -0
  54. package/dist/components/VideoPlayer/components/VideoSelect.d.ts.map +1 -0
  55. package/dist/components/VideoPlayer/components/VideoSelect.js +168 -0
  56. package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts +12 -0
  57. package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts.map +1 -0
  58. package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.js +48 -0
  59. package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts +25 -0
  60. package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts.map +1 -0
  61. package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.js +384 -0
  62. package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts +21 -0
  63. package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts.map +1 -0
  64. package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.js +264 -0
  65. package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts +10 -0
  66. package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts.map +1 -0
  67. package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.js +39 -0
  68. package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts +14 -0
  69. package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts.map +1 -0
  70. package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.js +360 -0
  71. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts +16 -0
  72. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts.map +1 -0
  73. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts +14 -0
  74. package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts.map +1 -0
  75. package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts +4 -0
  76. package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts.map +1 -0
  77. package/dist/components/VideoPlayer/components/VideoSettingsModal/context.js +14 -0
  78. package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts +22 -0
  79. package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts.map +1 -0
  80. package/dist/components/VideoPlayer/components/VideoSettingsModal/index.js +211 -0
  81. package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts +11 -0
  82. package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts.map +1 -0
  83. package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.js +41 -0
  84. package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts +10 -0
  85. package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts.map +1 -0
  86. package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.js +69 -0
  87. package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts +21 -0
  88. package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts.map +1 -0
  89. package/dist/components/VideoPlayer/hooks/useStoryboard.js +91 -0
  90. package/dist/components/VideoPlayer/index.d.ts +11 -0
  91. package/dist/components/VideoPlayer/index.d.ts.map +1 -0
  92. package/dist/components/VideoPlayer/types.d.ts +101 -0
  93. package/dist/components/VideoPlayer/types.d.ts.map +1 -0
  94. package/dist/components/VideoPlayer/utils/chapters.d.ts +8 -0
  95. package/dist/components/VideoPlayer/utils/chapters.d.ts.map +1 -0
  96. package/dist/components/VideoPlayer/utils/chapters.js +38 -0
  97. package/dist/components/VideoPlayer/utils/storyboard.d.ts +5 -0
  98. package/dist/components/VideoPlayer/utils/storyboard.d.ts.map +1 -0
  99. package/dist/components/VideoPlayer/utils/storyboard.js +47 -0
  100. package/dist/components/VideoPlayer/utils/subtitles.d.ts +18 -0
  101. package/dist/components/VideoPlayer/utils/subtitles.d.ts.map +1 -0
  102. package/dist/components/VideoPlayer/utils/subtitles.js +23 -0
  103. package/dist/components/VideoPlayer/utils/touch.d.ts +3 -0
  104. package/dist/components/VideoPlayer/utils/touch.d.ts.map +1 -0
  105. package/dist/components/VideoPlayer/utils/touch.js +5 -0
  106. package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts +10 -0
  107. package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts.map +1 -0
  108. package/dist/components/VideoPlayer/utils/videoPlayerUtils.js +22 -0
  109. package/dist/components/VideoPlayer/utils/videoSettings.d.ts +69 -0
  110. package/dist/components/VideoPlayer/utils/videoSettings.d.ts.map +1 -0
  111. package/dist/components/VideoPlayer/utils/videoSettings.js +90 -0
  112. package/dist/helpers/getFileType.d.ts +1 -1
  113. package/dist/helpers/getFileType.d.ts.map +1 -1
  114. package/dist/helpers/getFileType.js +3 -2
  115. package/dist/hooks/useDateUtils.d.ts +3 -1
  116. package/dist/hooks/useDateUtils.d.ts.map +1 -1
  117. package/dist/hooks/useDateUtils.js +23 -18
  118. package/dist/index.css +1 -1
  119. package/dist/index.d.ts +2 -0
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +585 -567
  122. package/dist/lang/locales/ui_en.json.js +9 -7
  123. package/dist/lang/locales/ui_es.json.js +6 -4
  124. package/dist/lang/locales/ui_ru.json.js +8 -6
  125. package/dist/videoSettings/createVideoSettingsDataSource.d.ts +19 -0
  126. package/dist/videoSettings/createVideoSettingsDataSource.d.ts.map +1 -0
  127. package/dist/videoSettings/createVideoSettingsDataSource.js +127 -0
  128. package/package.json +2 -1
@@ -1,355 +1,373 @@
1
- import { jsx as n, jsxs as C } from "react/jsx-runtime";
2
- import { useState as ee, useRef as v, useMemo as U, useCallback as te, useEffect as A } from "react";
3
- import { useTranslation as oe } from "react-i18next";
4
- import { Attachment02Icon as re, Sent02Icon as ne } from "@hugeicons/core-free-icons";
5
- import { HugeiconsIcon as $ } from "@hugeicons/react";
6
- import { Stack as se, Box as ie, Group as B, FileButton as le, ActionIcon as P, UnstyledButton as ae, Text as ce, Button as de, Popover as L } from "@mantine/core";
7
- import { getMaxUploadSize as me } from "../../config/envConfig.js";
8
- import { showErrorNotification as W } from "../../helpers/showNotifications.js";
9
- import { AttachmentsPreview as ue } from "../AttachmentsPreview/AttachmentsPreview.js";
10
- import { CommentEditorHandler as fe } from "./CommentEditorHotkeys.js";
11
- import { useVirtualAnchor as pe } from "./useVirtualAnchor.js";
12
- import y from "./CommentComposer.module.css.js";
13
- function j(r) {
14
- return "id" in r;
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import { memo as re, useState as ne, useRef as b, useMemo as U, useCallback as se, useEffect as A } from "react";
3
+ import { useTranslation as ie } from "react-i18next";
4
+ import { Attachment02Icon as le, Sent02Icon as ae } from "@hugeicons/core-free-icons";
5
+ import { HugeiconsIcon as B } from "@hugeicons/react";
6
+ import { Stack as ce, Box as de, Group as P, FileButton as me, ActionIcon as W, UnstyledButton as ue, Text as fe, Button as pe, Popover as L } from "@mantine/core";
7
+ import { getMaxUploadSize as he } from "../../config/envConfig.js";
8
+ import { showErrorNotification as j } from "../../helpers/showNotifications.js";
9
+ import { AttachmentsPreview as ge } from "../AttachmentsPreview/AttachmentsPreview.js";
10
+ import { CommentEditorHandler as xe } from "./CommentEditorHotkeys.js";
11
+ import { useVirtualAnchor as ye } from "./useVirtualAnchor.js";
12
+ import p from "./CommentComposer.module.css.js";
13
+ function k(n) {
14
+ return "id" in n;
15
15
  }
16
- function he(r) {
17
- return typeof r == "object" && "isTemp" in r;
16
+ function Ee(n) {
17
+ return typeof n == "object" && "isTemp" in n;
18
18
  }
19
- function ge(r) {
20
- const c = URL.createObjectURL(r);
19
+ function be(n) {
20
+ const c = URL.createObjectURL(n);
21
21
  return {
22
22
  id: `temp-${crypto.randomUUID()}`,
23
- name: r.name,
24
- type: r.type,
25
- size: r.size,
23
+ name: n.name,
24
+ type: n.type,
25
+ size: n.size,
26
26
  url: c,
27
27
  src: c,
28
- isImage: r.type.startsWith("image/"),
28
+ isImage: n.type.startsWith("image/"),
29
29
  isTemp: !0,
30
- raw: r
30
+ raw: n
31
31
  };
32
32
  }
33
- const M = () => me() ?? 5 * 1024 * 1024, xe = 10;
34
- function ye(r, c) {
35
- return r(`composer.${c}`, { defaultValue: "" }) || r(`editor.composer.${c}`);
33
+ const M = () => he() ?? 5 * 1024 * 1024, we = 10;
34
+ function Ce(n, c) {
35
+ return n(`composer.${c}`, { defaultValue: "" }) || n(`editor.composer.${c}`);
36
36
  }
37
- const Re = ({
38
- children: r,
39
- onSubmit: c,
40
- initialDraft: d,
41
- updateLocation: N,
42
- onBlur: k,
43
- setEdit: R,
44
- ns: S = "comments",
45
- autoFocus: G
46
- }) => {
47
- const [m, _] = ee({
48
- text: d?.text ?? "",
49
- files: d?.files ?? []
50
- }), { t: h } = oe(S), X = h(S === "comments" ? "composer.placeholder" : "editor.composer.placeholder"), g = v(null), u = typeof d?.text < "u", a = {
51
- text: m.text,
52
- files: m.files
53
- }, Y = v(null), p = v(null), V = U(
54
- () => ({
55
- container: document.createElement("div"),
56
- elements: []
57
- }),
58
- []
59
- ), q = v(null), f = !!N, J = pe({
60
- isFloat: f,
61
- updateLocation: N,
62
- selectionRef: q,
63
- selectionState: V
64
- }), I = 10 * 30 * 0.7, b = te(() => {
65
- if (!p.current) return;
66
- const e = p.current, t = e.querySelector(
67
- '[class*="editorWrapper"]'
68
- ), s = t?.scrollHeight || 0, o = s > I, l = s > 35, i = e.closest(
69
- '[class*="commentComposerFloat"]'
70
- ) || e;
71
- f && l ? i.setAttribute("data-multiline", "true") : i.removeAttribute("data-multiline"), o && t ? (t.style.maxHeight = `${I}px`, t.style.overflowY = "auto", t.style.scrollbarWidth = "thin", i.setAttribute("data-editor-constrained", "true")) : t && (t.style.maxHeight = "", t.style.overflowY = "", t.style.scrollbarWidth = "", i.removeAttribute("data-editor-constrained"));
72
- }, [p, f, I]);
73
- A(() => {
74
- b();
75
- }, [b]), A(() => {
76
- if (!p.current) return;
77
- const e = new ResizeObserver(() => {
78
- b();
79
- });
80
- return e.observe(p.current), () => {
81
- e.disconnect();
82
- };
83
- }, [b]), A(() => {
84
- const e = document.querySelector("main");
85
- if (e && f) {
86
- const t = e.style.overflow;
87
- return e.style.overflow = "hidden", () => {
88
- e.style.overflow = t;
37
+ const Ue = re(
38
+ ({
39
+ children: n,
40
+ onSubmit: c,
41
+ initialDraft: d,
42
+ updateLocation: R,
43
+ onBlur: G,
44
+ setEdit: N,
45
+ ns: S = "comments",
46
+ compact: X = !1,
47
+ placeholder: Y,
48
+ autoFocus: V
49
+ }) => {
50
+ const [m, _] = ne({
51
+ text: d?.text ?? "",
52
+ files: d?.files ?? []
53
+ }), { t: g } = ie(S), q = Y ?? g(S === "comments" ? "composer.placeholder" : "editor.composer.placeholder"), x = b(null), u = typeof d?.text < "u", a = {
54
+ text: m.text,
55
+ files: m.files
56
+ }, J = b(null), h = b(null), O = b(null), K = U(
57
+ () => ({
58
+ container: document.createElement("div"),
59
+ elements: []
60
+ }),
61
+ []
62
+ ), D = b(null), f = !!R, Q = ye({
63
+ isFloat: f,
64
+ updateLocation: R,
65
+ selectionRef: D,
66
+ selectionState: K
67
+ }), I = 10 * 30 * 0.7, w = se(() => {
68
+ if (!h.current) return;
69
+ const e = h.current, t = e.querySelector(
70
+ '[class*="editorWrapper"]'
71
+ ), s = t?.scrollHeight || 0, o = s > I, l = s > 35, i = e.closest(
72
+ '[class*="commentComposerFloat"]'
73
+ ) || e;
74
+ f && l ? i.setAttribute("data-multiline", "true") : i.removeAttribute("data-multiline"), o && t ? (t.style.maxHeight = `${I}px`, t.style.overflowY = "auto", t.style.scrollbarWidth = "thin", i.setAttribute("data-editor-constrained", "true")) : t && (t.style.maxHeight = "", t.style.overflowY = "", t.style.scrollbarWidth = "", i.removeAttribute("data-editor-constrained"));
75
+ }, [h, f, I]);
76
+ A(() => {
77
+ w();
78
+ }, [w]), A(() => {
79
+ if (!h.current) return;
80
+ const e = new ResizeObserver(() => {
81
+ w();
82
+ });
83
+ return e.observe(h.current), () => {
84
+ e.disconnect();
89
85
  };
90
- }
91
- }, [f]);
92
- const { textChanged: K, newFiles: D, deletedFiles: Q, hasChanges: F } = U(() => {
93
- const e = d?.files || [], t = m.files, s = d?.text !== a.text, o = t.filter((i) => i.isTemp), x = new Set(
94
- t.filter(
95
- (i) => j(i)
96
- ).map((i) => i.id)
97
- ), l = e.filter(j).filter((i) => !x.has(i.id)), E = u ? JSON.stringify(d) === JSON.stringify(m) : a.text.trim().length > 0 || o.length > 0 || l.length > 0;
98
- return {
99
- textChanged: s,
100
- newFiles: o,
101
- deletedFiles: l,
102
- hasChanges: E
103
- };
104
- }, [u, d, m, a.text]), H = () => {
105
- R ? R({
106
- id: "",
107
- text: "",
108
- files: []
109
- }) : k?.();
110
- }, T = (e, t = !1) => {
111
- _((s) => {
112
- if (t)
113
- return { text: "", files: [] };
114
- const o = typeof e == "function" ? e(s) : e;
86
+ }, [w]), A(() => {
87
+ const e = document.querySelector("main");
88
+ if (e && f) {
89
+ const t = e.style.overflow;
90
+ return e.style.overflow = "hidden", () => {
91
+ e.style.overflow = t;
92
+ };
93
+ }
94
+ }, [f]);
95
+ const { textChanged: Z, newFiles: ee, deletedFiles: te, hasChanges: F } = U(() => {
96
+ const e = d?.files || [], t = m.files, s = d?.text !== a.text, o = t.filter((i) => i.isTemp), y = new Set(
97
+ t.filter(
98
+ (i) => k(i)
99
+ ).map((i) => i.id)
100
+ ), l = e.filter(k).filter((i) => !y.has(i.id)), E = u ? JSON.stringify(d) === JSON.stringify(m) : a.text.trim().length > 0 || o.length > 0 || l.length > 0;
115
101
  return {
116
- text: o.text,
117
- files: o.files
102
+ textChanged: s,
103
+ newFiles: o,
104
+ deletedFiles: l,
105
+ hasChanges: E
118
106
  };
119
- });
120
- }, Z = (e, t) => {
121
- e && t((s) => {
122
- const o = s.files, x = xe - o.length, l = [], E = [];
123
- e.forEach((z) => {
124
- z.size > M() ? E.push(z) : l.push(z);
125
- }), E.length > 0 && W({
126
- message: h("composer.uploadErrors.fileTooLarge", {
127
- defaultValue: h("editor.composer.uploadErrors.fileTooLarge", { maxSize: Math.round(M() / (1024 * 1024)) }),
128
- maxSize: Math.round(M() / (1024 * 1024))
129
- })
130
- }), l.length > x && W({
131
- message: ye(h, "uploadErrors.tooManyFiles")
107
+ }, [u, d, m, a.text]), H = () => {
108
+ N ? N({
109
+ id: "",
110
+ text: "",
111
+ files: []
112
+ }) : G?.();
113
+ }, T = (e, t = !1) => {
114
+ _((s) => {
115
+ if (t)
116
+ return { text: "", files: [] };
117
+ const o = typeof e == "function" ? e(s) : e;
118
+ return {
119
+ text: o.text,
120
+ files: o.files
121
+ };
132
122
  });
133
- const i = l.slice(0, x);
134
- return {
135
- ...s,
136
- files: [...o, ...i.map(ge)]
137
- };
138
- });
139
- }, w = async () => {
140
- try {
141
- u ? await c({
142
- mode: "edit",
143
- data: {
144
- textChanged: K,
145
- newFiles: D,
146
- deletedFiles: Q,
147
- newText: a.text
148
- }
149
- }) : await c({
150
- mode: "create",
151
- data: {
152
- text: a.text,
153
- files: m.files.filter(he)
154
- }
123
+ }, oe = (e, t) => {
124
+ e && t((s) => {
125
+ const o = s.files, y = we - o.length, l = [], E = [];
126
+ e.forEach((z) => {
127
+ z.size > M() ? E.push(z) : l.push(z);
128
+ }), E.length > 0 && j({
129
+ message: g("composer.uploadErrors.fileTooLarge", {
130
+ defaultValue: g("editor.composer.uploadErrors.fileTooLarge", {
131
+ maxSize: Math.round(M() / (1024 * 1024))
132
+ }),
133
+ maxSize: Math.round(M() / (1024 * 1024))
134
+ })
135
+ }), l.length > y && j({
136
+ message: Ce(g, "uploadErrors.tooManyFiles")
137
+ });
138
+ const i = l.slice(0, y);
139
+ return {
140
+ ...s,
141
+ files: [...o, ...i.map(be)]
142
+ };
155
143
  });
156
- } catch {
157
- return;
158
- }
159
- H(), g.current && g.current.update(() => {
160
- const e = g.current._editorState._nodeMap.get("root");
161
- if (!e) return;
162
- e.clear();
163
- const t = g.current._nodes.get("paragraph");
164
- if (!t) return;
165
- const s = new t.klass();
166
- e.append(s), s.select();
167
- }), T({ text: "", files: [] }, !0);
168
- }, O = /* @__PURE__ */ n(
169
- se,
170
- {
171
- ref: p,
172
- className: `
173
- ${y.commentComposerWrapper}
174
- ${u ? y.editMode : ""}
175
- ${f ? y.commentComposerFloat : ""}
144
+ }, C = async () => {
145
+ try {
146
+ u ? await c({
147
+ mode: "edit",
148
+ data: {
149
+ textChanged: Z,
150
+ newFiles: ee,
151
+ deletedFiles: te,
152
+ newText: a.text
153
+ }
154
+ }) : await c({
155
+ mode: "create",
156
+ data: {
157
+ text: a.text,
158
+ files: m.files.filter(Ee)
159
+ }
160
+ });
161
+ } catch {
162
+ return;
163
+ }
164
+ H(), x.current && x.current.update(() => {
165
+ const e = x.current._editorState._nodeMap.get("root");
166
+ if (!e) return;
167
+ e.clear();
168
+ const t = x.current._nodes.get("paragraph");
169
+ if (!t) return;
170
+ const s = new t.klass();
171
+ e.append(s), s.select();
172
+ }), T({ text: "", files: [] }, !0);
173
+ }, $ = /* @__PURE__ */ r(
174
+ ce,
175
+ {
176
+ ref: h,
177
+ className: `
178
+ ${p.commentComposerWrapper}
179
+ ${u ? p.editMode : ""}
180
+ ${f ? p.commentComposerFloat : ""}
181
+ ${X ? p.compact : ""}
176
182
  `,
177
- children: /* @__PURE__ */ C(
178
- "div",
179
- {
180
- className: y.composerContainer,
181
- style: {
182
- "--placeholder-text": `"${X}"`
183
- },
184
- children: [
185
- /* @__PURE__ */ n("div", { className: y.editorWrapper, children: /* @__PURE__ */ n(
186
- fe,
187
- {
188
- onSubmit: w,
189
- editorRef: g,
190
- inputContainerRef: p,
191
- commentDraft: a,
192
- onBlur: H,
193
- isEdit: u,
194
- isFloat: f,
195
- hasChanges: F,
196
- ns: S,
197
- forceAutoFocus: G,
198
- children: r?.({
199
- onSubmit: w,
200
- handleBlur: () => {
201
- },
202
- setCommentDraft: T,
183
+ children: /* @__PURE__ */ v(
184
+ "div",
185
+ {
186
+ className: p.composerContainer,
187
+ style: {
188
+ "--placeholder-text": `"${q}"`
189
+ },
190
+ children: [
191
+ /* @__PURE__ */ r("div", { className: p.editorWrapper, children: /* @__PURE__ */ r(
192
+ xe,
193
+ {
194
+ onSubmit: C,
195
+ editorRef: x,
196
+ inputContainerRef: h,
203
197
  commentDraft: a,
204
- editorRef: g,
205
- initialContent: d?.text ?? ""
206
- })
207
- }
208
- ) }),
209
- /* @__PURE__ */ n(ie, { h: 10, "data-editor-spacer": !0, tabIndex: 0, style: { width: "100%" } }),
210
- /* @__PURE__ */ n(
211
- ue,
212
- {
213
- files: m.files,
214
- mode: "draft",
215
- onRemove: (e) => _((t) => ({
216
- ...t,
217
- files: t.files.filter((s, o) => o !== e)
218
- }))
219
- }
220
- ),
221
- /* @__PURE__ */ C(
222
- B,
223
- {
224
- justify: u ? "space-between" : "flex-end",
225
- "data-comment-footer": !0,
226
- align: "center",
227
- w: "unset",
228
- mt: m.files.length ? "xs" : 0,
229
- tabIndex: 0,
230
- gap: "4px",
231
- children: [
232
- /* @__PURE__ */ n(
233
- le,
234
- {
235
- onChange: (e) => Z(e, T),
236
- multiple: !0,
237
- children: (e) => /* @__PURE__ */ n(P, { ...e, variant: "subtle", size: "lg", color: "gray", children: /* @__PURE__ */ n(
238
- $,
239
- {
240
- style: { transform: "rotate(35deg)" },
241
- icon: re,
242
- size: 20
243
- }
244
- ) })
245
- }
246
- ),
247
- u ? /* @__PURE__ */ C(B, { gap: "8px", children: [
248
- /* @__PURE__ */ n(
249
- ae,
198
+ onBlur: H,
199
+ isEdit: u,
200
+ isFloat: f,
201
+ hasChanges: F,
202
+ ns: S,
203
+ forceAutoFocus: V,
204
+ children: n?.({
205
+ onSubmit: C,
206
+ handleBlur: () => {
207
+ },
208
+ setCommentDraft: T,
209
+ commentDraft: a,
210
+ editorRef: x,
211
+ initialContent: d?.text ?? ""
212
+ })
213
+ }
214
+ ) }),
215
+ /* @__PURE__ */ r(
216
+ de,
217
+ {
218
+ h: 10,
219
+ "data-editor-spacer": !0,
220
+ tabIndex: 0,
221
+ style: { width: "100%" }
222
+ }
223
+ ),
224
+ /* @__PURE__ */ r("div", { className: p.attachmentsSlot, children: /* @__PURE__ */ r(
225
+ ge,
226
+ {
227
+ files: m.files,
228
+ mode: "draft",
229
+ onRemove: (e) => _((t) => ({
230
+ ...t,
231
+ files: t.files.filter((s, o) => o !== e)
232
+ }))
233
+ }
234
+ ) }),
235
+ /* @__PURE__ */ v(
236
+ P,
237
+ {
238
+ justify: u ? "space-between" : "flex-end",
239
+ "data-comment-footer": !0,
240
+ align: "center",
241
+ w: "unset",
242
+ mt: m.files.length ? "xs" : 0,
243
+ tabIndex: 0,
244
+ gap: "4px",
245
+ children: [
246
+ /* @__PURE__ */ r(
247
+ me,
250
248
  {
251
- onClick: H,
252
- "data-no-focus": !0,
253
- style: {
254
- cursor: "pointer",
255
- padding: 0,
256
- margin: 0,
257
- background: "none",
258
- border: "none"
249
+ resetRef: O,
250
+ onChange: (e) => {
251
+ oe(e, T), O.current?.();
259
252
  },
260
- children: /* @__PURE__ */ n(ce, { size: "sm", c: "dimmed", children: h("composer.cancel") })
253
+ multiple: !0,
254
+ children: (e) => /* @__PURE__ */ r(W, { ...e, variant: "subtle", size: "lg", color: "gray", children: /* @__PURE__ */ r(
255
+ B,
256
+ {
257
+ style: { transform: "rotate(35deg)" },
258
+ icon: le,
259
+ size: 20
260
+ }
261
+ ) })
261
262
  }
262
263
  ),
263
- /* @__PURE__ */ n(
264
- de,
264
+ u ? /* @__PURE__ */ v(P, { gap: "8px", children: [
265
+ /* @__PURE__ */ r(
266
+ ue,
267
+ {
268
+ onClick: H,
269
+ "data-no-focus": !0,
270
+ style: {
271
+ cursor: "pointer",
272
+ padding: 0,
273
+ margin: 0,
274
+ background: "none",
275
+ border: "none"
276
+ },
277
+ children: /* @__PURE__ */ r(fe, { size: "sm", c: "dimmed", children: g("composer.cancel") })
278
+ }
279
+ ),
280
+ /* @__PURE__ */ r(
281
+ pe,
282
+ {
283
+ size: "xs",
284
+ radius: "md",
285
+ onClick: C,
286
+ disabled: u ? F : !F,
287
+ children: g("composer.save")
288
+ }
289
+ )
290
+ ] }) : /* @__PURE__ */ r(
291
+ W,
265
292
  {
266
- size: "xs",
267
- radius: "md",
268
- onClick: w,
269
- disabled: u ? F : !F,
270
- children: h("composer.save")
293
+ size: "lg",
294
+ "data-comment-submit-button": !0,
295
+ variant: "filled",
296
+ onClick: C,
297
+ disabled: !a.text.trim() && a.files.length === 0,
298
+ children: /* @__PURE__ */ r(B, { icon: ae, size: 20 })
271
299
  }
272
300
  )
273
- ] }) : /* @__PURE__ */ n(
274
- P,
275
- {
276
- size: "lg",
277
- "data-comment-submit-button": !0,
278
- variant: "filled",
279
- onClick: w,
280
- disabled: !a.text.trim() && a.files.length === 0,
281
- children: /* @__PURE__ */ n($, { icon: ne, size: 20 })
282
- }
283
- )
284
- ]
285
- }
286
- )
287
- ]
288
- }
289
- )
290
- }
291
- );
292
- return f ? /* @__PURE__ */ C(
293
- L,
294
- {
295
- opened: !0,
296
- position: "bottom-start",
297
- offset: 10,
298
- withinPortal: !1,
299
- floatingStrategy: "fixed",
300
- zIndex: 300,
301
- middlewares: {
302
- flip: { padding: 8 },
303
- shift: { padding: 8 },
304
- size: {
305
- padding: 8,
306
- apply: ({ availableHeight: e, rects: t, elements: s }) => {
307
- const o = s.floating;
308
- if (!o) return;
309
- if (e < t.floating.height) {
310
- const l = Math.max(e, 120);
311
- Object.assign(o.style, {
312
- maxHeight: `${l}px`,
313
- overflowY: "auto"
314
- }), o.setAttribute("data-constrained", "true");
315
- } else
316
- o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
301
+ ]
302
+ }
303
+ )
304
+ ]
317
305
  }
318
- }
319
- },
320
- styles: {
321
- dropdown: {
322
- padding: 0
323
- }
324
- },
325
- children: [
326
- /* @__PURE__ */ n(L.Target, { children: /* @__PURE__ */ n(
327
- "div",
328
- {
329
- ref: J,
330
- style: {
331
- position: "fixed",
332
- width: "5px",
333
- height: "5px",
334
- pointerEvents: "none",
335
- visibility: "hidden",
336
- top: 0,
337
- left: 0
306
+ )
307
+ }
308
+ );
309
+ return f ? /* @__PURE__ */ v(
310
+ L,
311
+ {
312
+ opened: !0,
313
+ position: "bottom-start",
314
+ offset: 10,
315
+ withinPortal: !1,
316
+ floatingStrategy: "fixed",
317
+ zIndex: 300,
318
+ middlewares: {
319
+ flip: { padding: 8 },
320
+ shift: { padding: 8 },
321
+ size: {
322
+ padding: 8,
323
+ apply: ({ availableHeight: e, rects: t, elements: s }) => {
324
+ const o = s.floating;
325
+ if (!o) return;
326
+ if (e < t.floating.height) {
327
+ const l = Math.max(e, 120);
328
+ Object.assign(o.style, {
329
+ maxHeight: `${l}px`,
330
+ overflowY: "auto"
331
+ }), o.setAttribute("data-constrained", "true");
332
+ } else
333
+ o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
338
334
  }
339
335
  }
340
- ) }),
341
- /* @__PURE__ */ n(
342
- L.Dropdown,
343
- {
344
- ref: Y,
345
- className: y.commentComposerFloat,
346
- children: O
336
+ },
337
+ styles: {
338
+ dropdown: {
339
+ padding: 0
347
340
  }
348
- )
349
- ]
350
- }
351
- ) : O;
352
- };
341
+ },
342
+ children: [
343
+ /* @__PURE__ */ r(L.Target, { children: /* @__PURE__ */ r(
344
+ "div",
345
+ {
346
+ ref: Q,
347
+ style: {
348
+ position: "fixed",
349
+ width: "5px",
350
+ height: "5px",
351
+ pointerEvents: "none",
352
+ visibility: "hidden",
353
+ top: 0,
354
+ left: 0
355
+ }
356
+ }
357
+ ) }),
358
+ /* @__PURE__ */ r(
359
+ L.Dropdown,
360
+ {
361
+ ref: J,
362
+ className: p.commentComposerFloat,
363
+ children: $
364
+ }
365
+ )
366
+ ]
367
+ }
368
+ ) : $;
369
+ }
370
+ );
353
371
  export {
354
- Re as CommentComposer
372
+ Ue as CommentComposer
355
373
  };