@mobilon-dev/chotto 0.3.80 → 0.3.82

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 (47) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/1_icons/MessageStatus/ErrorStatusIcon.vue.js +7 -0
  3. package/dist/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/ErrorStatusIcon.vue2.js +5 -5
  4. package/dist/components/1_icons/MessageStatus/PendingStatusIcon.vue.js +7 -0
  5. package/dist/components/1_icons/MessageStatus/ReadStatusIcon.vue.js +7 -0
  6. package/dist/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/ReadStatusIcon.vue2.js +1 -1
  7. package/dist/components/1_icons/MessageStatus/ReceivedStatusIcon.vue.js +7 -0
  8. package/dist/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/ReceivedStatusIcon.vue2.js +9 -9
  9. package/dist/components/1_icons/MessageStatus/SentStatusIcon.vue.js +7 -0
  10. package/dist/components/2_chatinput_elements/FilePreview/FilePreview.vue.js +1 -1
  11. package/dist/components/2_chatinput_elements/FilePreview/FilePreview.vue2.js +39 -38
  12. package/dist/components/2_chatinput_elements/StickerPicker/StickerPicker.vue.js +2 -2
  13. package/dist/components/2_chatinput_elements/StickerPicker/StickerPicker.vue2.js +123 -122
  14. package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue.js +2 -2
  15. package/dist/components/2_chatlist_elements/ChatItem/ChatItem.vue2.js +132 -139
  16. package/dist/components/2_feed_elements/MessageStatusIndicator/MessageStatusIndicator.vue.js +2 -2
  17. package/dist/components/2_feed_elements/MessageStatusIndicator/MessageStatusIndicator.vue2.js +5 -5
  18. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
  19. package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +78 -77
  20. package/dist/components/2_modals/ModalVideoRecorder/ModalVideoRecorder.vue.js +2 -2
  21. package/dist/components/2_modals/ModalVideoRecorder/ModalVideoRecorder.vue2.js +58 -58
  22. package/dist/functions/playNotificationAudio.js +4 -3
  23. package/dist/functions/safeMediaPlay.js +17 -0
  24. package/dist/index.js +234 -221
  25. package/dist/themes/dark.css +1 -1
  26. package/dist/themes/default.css +1 -1
  27. package/dist/themes/glass.css +1 -1
  28. package/dist/themes/green.css +1 -1
  29. package/dist/themes/mobilon1.css +1 -1
  30. package/dist/types/components/2_chatlist_elements/ChatItem/styles/types.d.ts +2 -4
  31. package/dist/types/components/index.d.ts +5 -0
  32. package/dist/types/functions/index.d.ts +1 -0
  33. package/dist/types/functions/safeMediaPlay.d.ts +3 -0
  34. package/package.json +1 -1
  35. package/dist/components/2_feed_elements/MessageStatusIndicator/icons/ErrorStatusIcon.vue.js +0 -7
  36. package/dist/components/2_feed_elements/MessageStatusIndicator/icons/PendingStatusIcon.vue.js +0 -7
  37. package/dist/components/2_feed_elements/MessageStatusIndicator/icons/ReadStatusIcon.vue.js +0 -7
  38. package/dist/components/2_feed_elements/MessageStatusIndicator/icons/ReceivedStatusIcon.vue.js +0 -7
  39. package/dist/components/2_feed_elements/MessageStatusIndicator/icons/SentStatusIcon.vue.js +0 -7
  40. /package/dist/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/PendingStatusIcon.vue2.js +0 -0
  41. /package/dist/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/SentStatusIcon.vue2.js +0 -0
  42. /package/dist/types/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/ErrorStatusIcon.vue.d.ts +0 -0
  43. /package/dist/types/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/PendingStatusIcon.vue.d.ts +0 -0
  44. /package/dist/types/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/ReadStatusIcon.vue.d.ts +0 -0
  45. /package/dist/types/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/ReceivedStatusIcon.vue.d.ts +0 -0
  46. /package/dist/types/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/SentStatusIcon.vue.d.ts +0 -0
  47. /package/dist/types/components/{2_feed_elements/MessageStatusIndicator/icons → 1_icons/MessageStatus}/index.d.ts +0 -0
@@ -1,36 +1,37 @@
1
- import { defineComponent as oe, inject as ie, ref as p, computed as w, watch as le, createElementBlock as r, openBlock as o, Fragment as me, createElementVNode as l, createBlock as c, unref as a, normalizeStyle as F, normalizeClass as y, createCommentVNode as i, createVNode as m, withCtx as d, createTextVNode as re, toDisplayString as T, Transition as b, withModifiers as $, Teleport as ue } from "vue";
2
- import de from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
3
- import ce from "../../1_atoms/LinkPreview/LinkPreview.vue.js";
4
- import ge from "../../1_atoms/EmbedPreview/EmbedPreview.vue.js";
5
- import ve from "../BaseReplyMessage/BaseReplyMessage.vue.js";
6
- import fe from "../../2_modals/ModalFullscreen/ModalFullscreen.vue.js";
7
- import ye from "../MessageReactions/MessageReactions.vue.js";
8
- import be from "../MessageStatusIndicator/MessageStatusIndicator.vue.js";
9
- import ke from "../MessageSmsInvite/MessageSmsInvite.vue.js";
1
+ import { defineComponent as ie, inject as le, ref as w, computed as p, watch as me, createElementBlock as r, openBlock as o, Fragment as re, createElementVNode as l, createBlock as c, unref as a, normalizeStyle as F, normalizeClass as y, createCommentVNode as i, createVNode as m, withCtx as d, createTextVNode as ue, toDisplayString as T, Transition as b, withModifiers as P, Teleport as de } from "vue";
2
+ import ce from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
3
+ import ge from "../../1_atoms/LinkPreview/LinkPreview.vue.js";
4
+ import ve from "../../1_atoms/EmbedPreview/EmbedPreview.vue.js";
5
+ import fe from "../BaseReplyMessage/BaseReplyMessage.vue.js";
6
+ import ye from "../../2_modals/ModalFullscreen/ModalFullscreen.vue.js";
7
+ import be from "../MessageReactions/MessageReactions.vue.js";
8
+ import ke from "../MessageStatusIndicator/MessageStatusIndicator.vue.js";
9
+ import we from "../MessageSmsInvite/MessageSmsInvite.vue.js";
10
10
  import pe from "../../1_atoms/Tooltip/Tooltip.vue.js";
11
- import { useMessageActions as we } from "../../../hooks/messages/useMessageActions.js";
12
- import { useMessageLinks as he } from "../../../hooks/messages/useMessageLinks.js";
13
- import { useChannelAccentColor as xe } from "../../../hooks/messages/useChannelAccentColor.js";
14
- import { useSubtextTooltip as Me } from "../../../hooks/messages/useSubtextTooltip.js";
15
- import { getStatus as Te, getStatusTitle as Re } from "../../../functions/getStatusMessage.js";
16
- import { getMessageClass as Ce } from "../../../functions/getMessageClass.js";
17
- import { createReactionHandlers as Se } from "../../../functions/createReactionHandlers.js";
11
+ import { useMessageActions as he } from "../../../hooks/messages/useMessageActions.js";
12
+ import { useMessageLinks as xe } from "../../../hooks/messages/useMessageLinks.js";
13
+ import { useChannelAccentColor as Me } from "../../../hooks/messages/useChannelAccentColor.js";
14
+ import { useSubtextTooltip as Te } from "../../../hooks/messages/useSubtextTooltip.js";
15
+ import { getStatus as Re, getStatusTitle as Ce } from "../../../functions/getStatusMessage.js";
16
+ import { safeMediaPlayVoid as $ } from "../../../functions/safeMediaPlay.js";
17
+ import { getMessageClass as Se } from "../../../functions/getMessageClass.js";
18
+ import { createReactionHandlers as Ie } from "../../../functions/createReactionHandlers.js";
18
19
  import "../../../functions/parseMarkdown.js";
19
20
  import "../../../hooks/useMessageDraft.js";
20
21
  import "../../../hooks/useSearchModel.js";
21
- import { useTheme as Ie } from "../../../hooks/useTheme.js";
22
+ import { useTheme as Ae } from "../../../hooks/useTheme.js";
22
23
  /* empty css */
23
24
  /* empty css */
24
- const Ae = ["messageId"], Ee = ["src"], Le = {
25
+ const Ee = ["messageId"], Le = ["src"], Be = {
25
26
  key: 1,
26
27
  class: "video-message__subtext"
27
- }, Be = ["src"], Fe = {
28
+ }, Fe = ["src"], Pe = {
28
29
  key: 0,
29
30
  class: "video-message__info-container"
30
- }, $e = { class: "video-message__time" }, Pe = {
31
+ }, $e = { class: "video-message__time" }, Oe = {
31
32
  key: 1,
32
33
  class: "video-message__text-container"
33
- }, Oe = ["innerHTML"], je = ["src", "alt"], ms = /* @__PURE__ */ oe({
34
+ }, je = ["innerHTML"], He = ["src", "alt"], us = /* @__PURE__ */ ie({
34
35
  inheritAttrs: !1,
35
36
  __name: "VideoMessage",
36
37
  props: {
@@ -62,31 +63,31 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
62
63
  }
63
64
  },
64
65
  emits: ["action", "reply", "sms-invite"],
65
- setup(e, { emit: P }) {
66
- const O = ie("chatAppId"), { getTheme: R } = Ie(O), t = e, h = P;
66
+ setup(e, { emit: O }) {
67
+ const j = le("chatAppId"), { getTheme: R } = Ae(j), t = e, h = O;
67
68
  function C(u) {
68
- return Ce(u.position, "video-message");
69
+ return Se(u.position, "video-message");
69
70
  }
70
- const S = p(), g = p(), x = p(!1), v = p(!1), { linkedHtml: j, inNewWindow: I } = he(() => t.message.text), {
71
+ const S = w(), g = w(), x = w(!1), v = w(!1), { linkedHtml: H, inNewWindow: I } = xe(() => t.message.text), {
71
72
  isOpenMenu: M,
72
- buttonMenuVisible: H,
73
- showMenu: N,
73
+ buttonMenuVisible: N,
74
+ showMenu: V,
74
75
  hideMenu: A,
75
76
  clickAction: q,
76
77
  viewsAction: E,
77
78
  handleClickReplied: D
78
- } = we(t.message, h), U = () => {
79
- N(), v.value = !0;
80
- }, V = w(() => Te(t.message.status)), z = w(() => Re(t.message.status, t.message.statusMsg)), { bubbleStyle: W } = xe(
81
- w(() => t.message),
79
+ } = he(t.message, h), U = () => {
80
+ V(), v.value = !0;
81
+ }, z = p(() => Re(t.message.status)), W = p(() => Ce(t.message.status, t.message.statusMsg)), { bubbleStyle: G } = Me(
82
+ p(() => t.message),
82
83
  { cssVariable: "--chotto-videomessage-right-bg", position: "right" }
83
- ), G = () => {
84
- g.value && (g.value.currentTime = 0, g.value.play());
84
+ ), J = () => {
85
+ g.value && (g.value.currentTime = 0, $(g.value));
85
86
  };
86
- le([S, g], ([u, s]) => {
87
- u ? s && (s.pause(), s.currentTime = 0) : s && (s.play(), s.currentTime = 0);
87
+ me([S, g], ([u, s]) => {
88
+ u ? s && (s.pause(), s.currentTime = 0) : s && (s.currentTime = 0, $(s));
88
89
  });
89
- const J = w(() => t.message.reply && t.message.text ? "0" : t.message.text ? "5px 5px 0 0" : t.message.reply ? "0 0 5px 5px" : "8px"), K = () => x.value = !1, { onToggleReaction: Q, onAddReaction: X, onRemoveReaction: Y } = Se(h), Z = async () => {
90
+ const K = p(() => t.message.reply && t.message.text ? "0" : t.message.text ? "5px 5px 0 0" : t.message.reply ? "0 0 5px 5px" : "8px"), Q = () => x.value = !1, { onToggleReaction: X, onAddReaction: Y, onRemoveReaction: Z } = Ie(h), _ = async () => {
90
91
  var u, s;
91
92
  if (t.message.url)
92
93
  try {
@@ -97,7 +98,7 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
97
98
  });
98
99
  if (!n.ok)
99
100
  throw new Error(`HTTP error! status: ${n.status}`);
100
- const se = n.headers.get("content-type") || "", te = await n.blob(), k = ((s = (u = t.message.url.split(".").pop()) == null ? void 0 : u.split("?")[0]) == null ? void 0 : s.toLowerCase()) || "", ae = {
101
+ const te = n.headers.get("content-type") || "", ae = await n.blob(), k = ((s = (u = t.message.url.split(".").pop()) == null ? void 0 : u.split("?")[0]) == null ? void 0 : s.toLowerCase()) || "", ne = {
101
102
  "video/mp4": "mp4",
102
103
  "video/webm": "webm",
103
104
  "video/ogg": "ogv",
@@ -105,24 +106,24 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
105
106
  "video/x-matroska": "mkv",
106
107
  "application/octet-stream": k || "mp4"
107
108
  };
108
- let L = k && ["mp4", "mov", "webm", "ogv", "mkv"].includes(k) ? k : ae[se] || "mp4";
109
- const ne = t.message.alt ? t.message.alt.includes(".") ? t.message.alt : `${t.message.alt}.${L}` : `video-${t.message.messageId}.${L}`, B = window.URL.createObjectURL(te), f = document.createElement("a");
110
- f.href = B, f.download = ne, document.body.appendChild(f), f.click(), document.body.removeChild(f), window.URL.revokeObjectURL(B);
109
+ let L = k && ["mp4", "mov", "webm", "ogv", "mkv"].includes(k) ? k : ne[te] || "mp4";
110
+ const oe = t.message.alt ? t.message.alt.includes(".") ? t.message.alt : `${t.message.alt}.${L}` : `video-${t.message.messageId}.${L}`, B = window.URL.createObjectURL(ae), f = document.createElement("a");
111
+ f.href = B, f.download = oe, document.body.appendChild(f), f.click(), document.body.removeChild(f), window.URL.revokeObjectURL(B);
111
112
  } catch (n) {
112
113
  console.error("Ошибка при скачивании видео:", n), window.open(t.message.url, "_blank");
113
114
  }
114
- }, _ = Me(() => t.message, () => t.subtextTooltipData);
115
- function ee() {
115
+ }, ee = Te(() => t.message, () => t.subtextTooltipData);
116
+ function se() {
116
117
  h("sms-invite", t.message);
117
118
  }
118
- return (u, s) => (o(), r(me, null, [
119
+ return (u, s) => (o(), r(re, null, [
119
120
  l("div", {
120
121
  class: y(["video-message", [
121
122
  C(e.message),
122
123
  e.applyStyle(e.message)
123
124
  ]]),
124
125
  messageId: e.message.messageId,
125
- style: F(a(W)),
126
+ style: F(a(G)),
126
127
  onMouseleave: s[5] || (s[5] = //@ts-ignore
127
128
  (...n) => a(A) && a(A)(...n))
128
129
  }, [
@@ -132,15 +133,15 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
132
133
  src: e.message.avatar,
133
134
  height: "32",
134
135
  width: "32"
135
- }, null, 8, Ee)) : i("", !0),
136
- e.message.subText && e.isFirstInSeries ? (o(), r("p", Le, [
136
+ }, null, 8, Le)) : i("", !0),
137
+ e.message.subText && e.isFirstInSeries ? (o(), r("p", Be, [
137
138
  m(pe, {
138
- text: a(_),
139
+ text: a(ee),
139
140
  position: e.message.position === "left" ? "right" : "left",
140
141
  offset: 8
141
142
  }, {
142
143
  default: d(() => [
143
- re(T(e.message.subText), 1)
144
+ ue(T(e.message.subText), 1)
144
145
  ]),
145
146
  _: 1
146
147
  }, 8, ["text", "position"])
@@ -148,7 +149,7 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
148
149
  l("div", {
149
150
  class: y(["video-message__content", { "is-first": e.isFirstInSeries, "with-avatar-indent": !e.isFirstInSeries && e.message.avatar }])
150
151
  }, [
151
- e.message.reply ? (o(), c(ve, {
152
+ e.message.reply ? (o(), c(fe, {
152
153
  key: 0,
153
154
  style: { margin: "10px 10px 4px 16px" },
154
155
  class: y(e.message.position),
@@ -165,19 +166,19 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
165
166
  ref_key: "previewPlayer",
166
167
  ref: g,
167
168
  class: "video-message__video",
168
- style: F({ borderRadius: J.value }),
169
+ style: F({ borderRadius: K.value }),
169
170
  src: e.message.url,
170
171
  muted: !0,
171
172
  autoplay: "",
172
- onEnded: G
173
- }, null, 44, Be),
173
+ onEnded: J
174
+ }, null, 44, Fe),
174
175
  m(b, { name: "modal-fade" }, {
175
176
  default: d(() => [
176
- v.value ? (o(), r("div", Fe, [
177
+ v.value ? (o(), r("div", Pe, [
177
178
  e.message.views ? (o(), r("div", {
178
179
  key: 0,
179
180
  class: "video-message__views",
180
- onClick: s[0] || (s[0] = $(
181
+ onClick: s[0] || (s[0] = P(
181
182
  //@ts-ignore
182
183
  (...n) => a(E) && a(E)(...n),
183
184
  ["stop"]
@@ -187,12 +188,12 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
187
188
  l("p", null, T(e.message.views), 1)
188
189
  ])) : i("", !0),
189
190
  l("span", $e, T(e.message.time), 1),
190
- m(be, {
191
+ m(ke, {
191
192
  "base-class": "video-message",
192
193
  "message-class": C(e.message),
193
194
  "message-status": e.message.status,
194
- "status-class": V.value,
195
- "status-title": z.value
195
+ "status-class": z.value,
196
+ "status-title": W.value
196
197
  }, null, 8, ["message-class", "message-status", "status-class", "status-title"])
197
198
  ])) : i("", !0)
198
199
  ]),
@@ -204,7 +205,7 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
204
205
  key: 0,
205
206
  class: "video-message__download-button",
206
207
  type: "button",
207
- onClick: $(Z, ["stop"])
208
+ onClick: P(_, ["stop"])
208
209
  }, [...s[7] || (s[7] = [
209
210
  l("span", { class: "pi pi-download" }, null, -1)
210
211
  ])])) : i("", !0)
@@ -214,7 +215,7 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
214
215
  ], 32),
215
216
  m(b, { name: "modal-fade" }, {
216
217
  default: d(() => [
217
- a(H) && e.message.actions ? (o(), r("button", {
218
+ a(N) && e.message.actions ? (o(), r("button", {
218
219
  key: 0,
219
220
  class: "video-message__menu-button",
220
221
  onClick: s[3] || (s[3] = (n) => M.value = !a(M))
@@ -226,7 +227,7 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
226
227
  }),
227
228
  m(b, { name: "context-menu" }, {
228
229
  default: d(() => [
229
- a(M) && e.message.actions ? (o(), c(de, {
230
+ a(M) && e.message.actions ? (o(), c(ce, {
230
231
  key: 0,
231
232
  class: "video-message__context-menu",
232
233
  actions: e.message.actions,
@@ -235,47 +236,47 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
235
236
  ]),
236
237
  _: 1
237
238
  }),
238
- e.message.text ? (o(), r("div", Pe, [
239
+ e.message.text ? (o(), r("div", Oe, [
239
240
  l("p", {
240
241
  onClick: s[4] || (s[4] = //@ts-ignore
241
242
  (...n) => a(I) && a(I)(...n)),
242
- innerHTML: a(j)
243
- }, null, 8, Oe)
243
+ innerHTML: a(H)
244
+ }, null, 8, je)
244
245
  ])) : i("", !0),
245
- m(ke, {
246
+ m(we, {
246
247
  status: e.message.status,
247
248
  "has-messenger-account": e.message.hasMessengerAccount,
248
249
  channel: e.channel,
249
- onSmsInvite: ee
250
+ onSmsInvite: se
250
251
  }, null, 8, ["status", "has-messenger-account", "channel"]),
251
- e.message.linkPreview ? (o(), c(ce, {
252
+ e.message.linkPreview ? (o(), c(ge, {
252
253
  key: 2,
253
254
  class: y(["video-message__link-preview", e.message.position]),
254
255
  "link-preview": e.message.linkPreview
255
256
  }, null, 8, ["class", "link-preview"])) : i("", !0),
256
- e.message.embed ? (o(), c(ge, {
257
+ e.message.embed ? (o(), c(ve, {
257
258
  key: 3,
258
259
  class: y(e.message.position),
259
260
  embed: e.message.embed
260
261
  }, null, 8, ["class", "embed"])) : i("", !0),
261
- m(ye, {
262
+ m(be, {
262
263
  reactions: e.message.reactions,
263
264
  "message-id": e.message.messageId,
264
265
  enabled: e.reactionsEnabled,
265
- onToggleReaction: a(Q),
266
- onAddReaction: a(X),
267
- onRemoveReaction: a(Y)
266
+ onToggleReaction: a(X),
267
+ onAddReaction: a(Y),
268
+ onRemoveReaction: a(Z)
268
269
  }, null, 8, ["reactions", "message-id", "enabled", "onToggleReaction", "onAddReaction", "onRemoveReaction"])
269
270
  ], 2)
270
- ], 46, Ae),
271
- (o(), c(ue, { to: "body" }, [
271
+ ], 46, Ee),
272
+ (o(), c(de, { to: "body" }, [
272
273
  m(b, { name: "modal-fade" }, {
273
274
  default: d(() => [
274
- x.value ? (o(), c(fe, {
275
+ x.value ? (o(), c(ye, {
275
276
  key: 0,
276
277
  "data-theme": a(R)().theme ? a(R)().theme : "light",
277
278
  title: e.message.alt,
278
- onClose: K
279
+ onClose: Q
279
280
  }, {
280
281
  default: d(() => [
281
282
  l("video", {
@@ -286,7 +287,7 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
286
287
  alt: e.message.alt,
287
288
  controls: "",
288
289
  autoplay: ""
289
- }, null, 8, je)
290
+ }, null, 8, He)
290
291
  ]),
291
292
  _: 1
292
293
  }, 8, ["data-theme", "title"])) : i("", !0)
@@ -298,5 +299,5 @@ const Ae = ["messageId"], Ee = ["src"], Le = {
298
299
  }
299
300
  });
300
301
  export {
301
- ms as default
302
+ us as default
302
303
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./ModalVideoRecorder.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const d = /* @__PURE__ */ r(o, [["__scopeId", "data-v-47304124"]]);
4
+ const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-dd94f275"]]);
5
5
  export {
6
- d as default
6
+ a as default
7
7
  };
@@ -1,45 +1,46 @@
1
- import { defineComponent as N, ref as l, computed as z, onMounted as $, createElementBlock as m, openBlock as f, Fragment as q, createElementVNode as o, withDirectives as E, vShow as L, createCommentVNode as g, normalizeClass as y, toDisplayString as A, nextTick as G, unref as k } from "vue";
2
- const H = { class: "video-recorder__header" }, J = { class: "video-recorder__controls" }, K = { class: "video-recorder__recording-container" }, P = { class: "video-recorder__recording-time" }, X = /* @__PURE__ */ N({
1
+ import { defineComponent as z, ref as l, computed as P, onMounted as $, createElementBlock as _, openBlock as f, Fragment as q, createElementVNode as o, withDirectives as D, vShow as E, createCommentVNode as b, normalizeClass as g, toDisplayString as A, nextTick as G, unref as y } from "vue";
2
+ import { safeMediaPlayVoid as L } from "../../../functions/safeMediaPlay.js";
3
+ import "../../../functions/parseMarkdown.js";
4
+ const H = { class: "video-recorder__header" }, J = { class: "video-recorder__controls" }, K = { class: "video-recorder__recording-container" }, Q = { class: "video-recorder__recording-time" }, ee = /* @__PURE__ */ z({
3
5
  __name: "ModalVideoRecorder",
4
6
  emits: ["change", "submit", "close"],
5
- setup(Q, { emit: F }) {
6
- const S = l(), s = l(0), i = l(0), u = l(0), d = l(0), I = z(() => {
7
- let a = d.value < 10 ? "0" + d.value : d.value, e = u.value < 10 ? "0" + u.value : u.value, t = i.value < 10 ? "0" + i.value : i.value, b = s.value < 10 ? "00" + s.value : s.value < 100 ? "0" + s.value : s.value;
8
- return r.value ? a + ":" + e + ":" + t + ":" + b : " ";
9
- }), p = l(), R = l(), r = l(!1), v = l(), _ = l(), w = l([]), n = l(), V = l(), c = l("camera"), O = () => {
10
- c.value == "camera" ? (c.value = "screen", B()) : c.value == "screen" && (C(), c.value = "camera", M());
7
+ setup(W, { emit: F }) {
8
+ const M = l(), r = l(0), n = l(0), u = l(0), d = l(0), I = P(() => {
9
+ let a = d.value < 10 ? "0" + d.value : d.value, e = u.value < 10 ? "0" + u.value : u.value, i = n.value < 10 ? "0" + n.value : n.value, N = r.value < 10 ? "00" + r.value : r.value < 100 ? "0" + r.value : r.value;
10
+ return t.value ? a + ":" + e + ":" + i + ":" + N : " ";
11
+ }), m = l(), k = l(), t = l(!1), v = l(), p = l(), R = l([]), s = l(), V = l(), c = l("camera"), O = () => {
12
+ c.value == "camera" ? (c.value = "screen", B()) : c.value == "screen" && (w(), c.value = "camera", h());
11
13
  }, T = async () => {
12
- !r.value && _.value instanceof MediaStream && (v.value = new MediaRecorder(_.value), v.value.start(), v.value.ondataavailable = (a) => {
13
- w.value.push(a.data);
14
- }, r.value = !0, S.value = setInterval(() => {
15
- s.value += 10, s.value == 1e3 && (s.value = 0, i.value++, i.value == 60 && (i.value = 0, u.value++, u.value == 60 && (u.value = 0, d.value++)));
14
+ !t.value && p.value instanceof MediaStream && (v.value = new MediaRecorder(p.value), v.value.start(), v.value.ondataavailable = (a) => {
15
+ R.value.push(a.data);
16
+ }, t.value = !0, M.value = setInterval(() => {
17
+ r.value += 10, r.value == 1e3 && (r.value = 0, n.value++, n.value == 60 && (n.value = 0, u.value++, u.value == 60 && (u.value = 0, d.value++)));
16
18
  }, 10));
17
19
  }, U = async () => {
18
- D(), C(), n.value && (n.value = void 0, await M());
20
+ S(), w(), s.value && (s.value = void 0, await h());
19
21
  }, j = () => {
20
22
  v.value && (v.value.stop(), v.value.onstop = async () => {
21
- V.value = new File(w.value, "videomessage.mp4", { type: "video/*" });
23
+ V.value = new File(R.value, "videomessage.mp4", { type: "video/*" });
22
24
  const a = URL.createObjectURL(V.value);
23
- n.value = a, G(() => {
24
- R.value && (R.value.src = a);
25
+ s.value = a, G(() => {
26
+ k.value && (k.value.src = a);
25
27
  });
26
- }), D(), C();
28
+ }), S(), w();
27
29
  };
28
- function C() {
30
+ function w() {
29
31
  var e;
30
- let a = (e = _.value) == null ? void 0 : e.getTracks();
31
- a == null || a.forEach((t) => t.stop());
32
+ let a = (e = p.value) == null ? void 0 : e.getTracks();
33
+ a == null || a.forEach((i) => i.stop());
32
34
  }
33
- const D = () => {
34
- clearInterval(S.value), s.value = 0, i.value = 0, u.value = 0, d.value = 0, r.value = !1, v.value = void 0, w.value = [];
35
- }, h = F, x = () => {
36
- h("change", { videoFile: V.value }), h("submit");
37
- }, M = async () => {
35
+ const S = () => {
36
+ clearInterval(M.value), r.value = 0, n.value = 0, u.value = 0, d.value = 0, t.value = !1, v.value = void 0, R.value = [];
37
+ }, C = F, x = () => {
38
+ C("change", { videoFile: V.value }), C("submit");
39
+ }, h = async () => {
38
40
  await navigator.mediaDevices.getUserMedia({ audio: !0, video: !0 }).then((a) => {
39
- const e = k(p.value);
40
- _.value = a, e.srcObject = a, e.addEventListener("loadedmetadata", () => {
41
- var t;
42
- (t = k(p.value)) == null || t.play();
41
+ const e = y(m.value);
42
+ p.value = a, e.srcObject = a, e.addEventListener("loadedmetadata", () => {
43
+ L(y(m.value));
43
44
  }), e.muted = !0;
44
45
  });
45
46
  }, B = async () => {
@@ -50,84 +51,83 @@ const H = { class: "video-recorder__header" }, J = { class: "video-recorder__con
50
51
  audio: !1
51
52
  };
52
53
  await navigator.mediaDevices.getDisplayMedia(a).then((e) => {
53
- const t = k(p.value);
54
- _.value = e, t.srcObject = e, t.addEventListener("loadedmetadata", () => {
55
- var b;
56
- (b = k(p.value)) == null || b.play();
57
- }), t.muted = !0;
54
+ const i = y(m.value);
55
+ p.value = e, i.srcObject = e, i.addEventListener("loadedmetadata", () => {
56
+ L(y(m.value));
57
+ }), i.muted = !0;
58
58
  });
59
59
  };
60
60
  return $(async () => {
61
- await M();
62
- }), (a, e) => (f(), m(q, null, [
61
+ await h();
62
+ }), (a, e) => (f(), _(q, null, [
63
63
  o("div", H, [
64
64
  o("button", {
65
65
  class: "video-recorder__button video-recorder__button-close",
66
- onClick: e[0] || (e[0] = (t) => h("close"))
66
+ onClick: e[0] || (e[0] = (i) => C("close"))
67
67
  }, [...e[1] || (e[1] = [
68
68
  o("span", { class: "pi pi-times" }, null, -1)
69
69
  ])])
70
70
  ]),
71
71
  o("div", null, [
72
- E(o("video", {
72
+ D(o("video", {
73
73
  ref_key: "refVideo",
74
- ref: p,
74
+ ref: m,
75
75
  class: "video-recorder__view-area"
76
76
  }, null, 512), [
77
- [L, !n.value]
77
+ [E, !s.value]
78
78
  ]),
79
- E(o("video", {
79
+ D(o("video", {
80
80
  ref_key: "refRecord",
81
- ref: R,
81
+ ref: k,
82
82
  class: "video-recorder__view-area",
83
83
  controls: ""
84
84
  }, null, 512), [
85
- [L, n.value]
85
+ [E, s.value]
86
86
  ]),
87
87
  o("div", J, [
88
88
  o("div", K, [
89
- !r.value && !n.value ? (f(), m("button", {
89
+ !t.value && !s.value ? (f(), _("button", {
90
90
  key: 0,
91
91
  class: "video-recorder__button",
92
92
  onClick: O
93
93
  }, [
94
94
  o("span", {
95
- class: y({
95
+ class: g({
96
96
  "pi pi-desktop": c.value == "camera",
97
97
  "pi pi-camera": c.value == "screen"
98
98
  })
99
99
  }, null, 2)
100
- ])) : g("", !0),
101
- n.value ? g("", !0) : (f(), m("button", {
100
+ ])) : b("", !0),
101
+ s.value ? b("", !0) : (f(), _("button", {
102
102
  key: 1,
103
- class: y(["video-recorder__button", { "video-recorder__recording-button": r.value }]),
103
+ class: g(["video-recorder__button", { "video-recorder__recording-button": t.value }]),
104
104
  onClick: T
105
105
  }, [
106
106
  o("span", {
107
- class: y(["pi", {
108
- "pi-circle-fill video-recorder__recording-icon": r.value,
109
- "pi-video": !r.value
107
+ class: g(["pi", {
108
+ "pi-circle-fill video-recorder__recording-icon": t.value,
109
+ "pi-video": !t.value
110
110
  }])
111
111
  }, null, 2)
112
112
  ], 2)),
113
- !r.value && n.value ? (f(), m("button", {
113
+ !t.value && s.value ? (f(), _("button", {
114
114
  key: 2,
115
115
  class: "video-recorder__button",
116
116
  onClick: U
117
117
  }, [...e[2] || (e[2] = [
118
118
  o("span", { class: "pi pi-trash" }, null, -1)
119
- ])])) : g("", !0),
120
- r.value ? (f(), m("button", {
119
+ ])])) : b("", !0),
120
+ t.value ? (f(), _("button", {
121
121
  key: 3,
122
122
  class: "video-recorder__button",
123
123
  onClick: j
124
124
  }, [...e[3] || (e[3] = [
125
125
  o("div", { class: "video-recorder__stop" }, null, -1)
126
- ])])) : g("", !0),
127
- o("span", P, A(I.value), 1)
126
+ ])])) : b("", !0),
127
+ o("span", Q, A(I.value), 1)
128
128
  ]),
129
129
  o("button", {
130
- class: y(["video-recorder__button", { "video-recorder__button-disabled": !n.value }]),
130
+ class: g(["video-recorder__button", { "video-recorder__button-disabled": !s.value }]),
131
131
  onClick: x
132
132
  }, [...e[4] || (e[4] = [
133
133
  o("span", { class: "video-recorder__save-button" }, " Прикрепить видео ", -1)
@@ -138,5 +138,5 @@ const H = { class: "video-recorder__header" }, J = { class: "video-recorder__con
138
138
  }
139
139
  });
140
140
  export {
141
- X as default
141
+ ee as default
142
142
  };