@mobilon-dev/chotto 0.3.88 → 0.3.90

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 (24) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.js +2 -2
  3. package/dist/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue2.js +41 -33
  4. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue.js +2 -2
  5. package/dist/components/2_feed_elements/MessageReactions/MessageReactions.vue2.js +15 -15
  6. package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue.js +4 -4
  7. package/dist/components/2_feed_elements/ReplyTextMessage/ReplyTextMessage.vue2.js +52 -16
  8. package/dist/components/3_compounds/ChatInput/ChatInput.vue.js +2 -2
  9. package/dist/components/3_compounds/ChatInput/ChatInput.vue2.js +165 -96
  10. package/dist/components/3_compounds/Feed/composables/useFeedScrollTo.js +38 -13
  11. package/dist/functions/renderAppleEmojis.js +24 -20
  12. package/dist/hooks/messages/useStartEdit.js +1 -1
  13. package/dist/themes/dark.css +1 -1
  14. package/dist/themes/default.css +1 -1
  15. package/dist/themes/glass.css +1 -1
  16. package/dist/themes/green.css +1 -1
  17. package/dist/themes/mobilon1.css +1 -1
  18. package/dist/types/components/2_chatinput_elements/ButtonEmojiPicker/ButtonEmojiPicker.vue.d.ts +15 -0
  19. package/dist/types/components/2_feed_elements/BaseReplyMessage/styles/types.d.ts +6 -0
  20. package/dist/types/components/2_feed_elements/ReplyTextMessage/stories/ReplyTextMessage.stories.d.ts +1 -0
  21. package/dist/types/components/2_feed_elements/ReplyTextMessage/styles/types.d.ts +22 -0
  22. package/dist/types/components/2_feed_elements/TextMessage/styles/types.d.ts +18 -0
  23. package/dist/types/functions/renderAppleEmojis.d.ts +1 -0
  24. package/package.json +1 -1
@@ -1,26 +1,27 @@
1
- import { defineComponent as X, inject as Z, ref as f, computed as h, watch as m, nextTick as v, unref as a, onMounted as ee, createElementBlock as g, openBlock as y, createElementVNode as u, createVNode as H, renderSlot as A, toDisplayString as te, createCommentVNode as ne, withDirectives as le, withKeys as ie, normalizeClass as E, vModelText as oe } from "vue";
2
- import { useImmediateDebouncedRef as se } from "../../../hooks/useImmediateDebouncedRef.js";
3
- import { useMessageDraft as ae } from "../../../hooks/useMessageDraft.js";
1
+ import { defineComponent as re, inject as ue, ref as f, computed as _, watch as h, nextTick as d, unref as r, onMounted as ce, createElementBlock as C, openBlock as I, createElementVNode as p, createVNode as P, renderSlot as W, toDisplayString as de, createCommentVNode as pe, withDirectives as fe, normalizeClass as H, withKeys as he, vModelText as me } from "vue";
2
+ import { useImmediateDebouncedRef as ve } from "../../../hooks/useImmediateDebouncedRef.js";
3
+ import { useMessageDraft as ge } from "../../../hooks/useMessageDraft.js";
4
4
  import "../../../hooks/useSearchModel.js";
5
5
  import "../../../hooks/useTheme.js";
6
- import { useEmojiNative as re } from "../../../hooks/useEmojiNative.js";
6
+ import { useEmojiNative as ye } from "../../../hooks/useEmojiNative.js";
7
7
  /* empty css */
8
8
  /* empty css */
9
- import { t as c } from "../../../locale/useLocale.js";
9
+ import { t as m } from "../../../locale/useLocale.js";
10
10
  /* empty css */
11
11
  import "../../../node_modules/linkifyjs/dist/linkify.js";
12
12
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
13
13
  import "../../../functions/parseMarkdown.js";
14
- import { textToAppleEmojiHtml as ue } from "../../../functions/renderAppleEmojis.js";
15
- import ce from "./icons/SendIcon.vue.js";
16
- import de from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
17
- const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = { class: "chat-input__inline-buttons" }, ve = {
14
+ import { textToAppleEmojiHtml as xe, textContainsEmoji as _e } from "../../../functions/renderAppleEmojis.js";
15
+ import { hideEditPreview as Te } from "../../../hooks/messages/useStartEdit.js";
16
+ import be from "./icons/SendIcon.vue.js";
17
+ import Se from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
18
+ const Ce = { class: "chat-input__container" }, Ie = ["id"], we = ["id"], Ae = { class: "chat-input__inline-buttons" }, Ee = {
18
19
  key: 0,
19
20
  class: "chat-input__input chat-input__disabled-placeholder"
20
- }, ge = {
21
+ }, Me = {
21
22
  key: 1,
22
23
  class: "chat-input__input-wrap"
23
- }, ye = ["innerHTML"], _e = ["disabled", "placeholder"], xe = ["disabled"], be = { class: "" }, Ie = { class: "chat-input__third-line" }, je = /* @__PURE__ */ X({
24
+ }, Fe = ["innerHTML"], He = ["disabled", "placeholder"], Re = ["disabled"], ke = { class: "" }, ze = { class: "chat-input__third-line" }, Ze = /* @__PURE__ */ re({
24
25
  __name: "ChatInput",
25
26
  props: {
26
27
  state: {
@@ -49,103 +50,164 @@ const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = {
49
50
  }
50
51
  },
51
52
  emits: ["send", "typing"],
52
- setup(d, { emit: k }) {
53
- const _ = k, p = Z("chatAppId"), { resetMessage: D, getMessage: l, setMessageText: x, setForceSendMessage: F } = ae(p), { isNative: C } = re(p), n = f(), b = f(), L = se("", 2e3), P = f(), R = h(() => ue(l().text || "")), T = () => {
54
- b.value && n.value && (b.value.scrollTop = n.value.scrollTop);
55
- }, r = d, z = h(() => !!(r.state == "disabled" || l().text == "" && !l().file || l().isRecording)), B = h(() => {
53
+ setup(v, { emit: B }) {
54
+ const w = B, g = ue("chatAppId"), { resetMessage: L, getMessage: l, setMessageText: T, setForceSendMessage: j, resetEdit: q } = ge(g), { isNative: K } = ye(g), n = f(), A = f(), u = f(!1), y = f(!1), N = ve("", 2e3), R = f(), O = _(() => xe(l().text || "")), x = _(
55
+ () => !K.value && _e(l().text || "")
56
+ ), c = () => {
57
+ if (!A.value || !n.value) return;
58
+ const e = n.value, t = A.value, i = Math.max(0, e.offsetWidth - e.clientWidth);
59
+ t.style.right = i > 0 ? `${i}px` : "", t.scrollTop = e.scrollTop;
60
+ };
61
+ let b = 0;
62
+ function E() {
63
+ if (!x.value) {
64
+ u.value = !1;
65
+ return;
66
+ }
67
+ b && cancelAnimationFrame(b), b = requestAnimationFrame(() => {
68
+ b = 0;
69
+ const e = n.value;
70
+ if (!e) {
71
+ u.value = !1;
72
+ return;
73
+ }
74
+ const t = e.selectionStart !== e.selectionEnd;
75
+ u.value !== t && (u.value = t, t || d(c));
76
+ });
77
+ }
78
+ const a = v, Y = _(() => !!(a.state == "disabled" || l().text == "" && !l().file || l().isRecording)), $ = _(() => {
56
79
  var t;
57
- if (r.inputButtonColor)
58
- return r.inputButtonColor;
59
- if (!((t = r.selectedChannel) != null && t.channelId))
80
+ if (a.inputButtonColor)
81
+ return a.inputButtonColor;
82
+ if (!((t = a.selectedChannel) != null && t.channelId))
60
83
  return "#25D366";
61
- const e = r.selectedChannel.channelId.toLowerCase();
84
+ const e = a.selectedChannel.channelId.toLowerCase();
62
85
  return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
63
- }), W = h(() => {
86
+ }), V = _(() => {
64
87
  var t;
65
- if (!((t = r.selectedChannel) != null && t.channelId))
66
- return c("component.ChatInput.InputPlaceholder");
67
- const e = r.selectedChannel.channelId.toLowerCase();
68
- return e.includes("whatsapp") || e.includes("waba") ? c("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? c("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? c("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? c("component.ChatInput.MaxInputPlaceholder") : c("component.ChatInput.InputPlaceholder");
88
+ if (!((t = a.selectedChannel) != null && t.channelId))
89
+ return m("component.ChatInput.InputPlaceholder");
90
+ const e = a.selectedChannel.channelId.toLowerCase();
91
+ return e.includes("whatsapp") || e.includes("waba") ? m("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? m("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? m("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? m("component.ChatInput.MaxInputPlaceholder") : m("component.ChatInput.InputPlaceholder");
69
92
  });
70
- m(
71
- () => L.value,
93
+ h(
94
+ () => N.value,
72
95
  () => {
73
- _("typing");
96
+ w("typing");
74
97
  }
75
- ), m(
76
- () => r.focusOnInputArea,
98
+ ), h(
77
99
  () => {
78
- r.focusOnInputArea && v(() => {
79
- const e = a(n);
100
+ var e;
101
+ return (e = l().edit) == null ? void 0 : e.messageId;
102
+ },
103
+ (e, t) => {
104
+ e != null && e !== t && (y.value = !0, d(() => {
105
+ if (!y.value) return;
106
+ const i = n.value;
107
+ i && (M(i), y.value = !1, S(i), requestAnimationFrame(() => S(i)));
108
+ }));
109
+ }
110
+ ), h(
111
+ () => a.focusOnInputArea,
112
+ () => {
113
+ a.focusOnInputArea && d(() => {
114
+ const e = r(n);
80
115
  e == null || e.focus();
81
116
  });
82
117
  },
83
118
  { immediate: !0 }
84
- ), m(
119
+ ), h(
85
120
  () => l().text,
86
121
  () => {
87
- v(() => {
122
+ d(() => {
88
123
  const e = n.value;
89
- if (!e) return;
90
- const t = e.scrollTop;
91
- e.style.height = "auto";
92
- const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, q = parseFloat(i.lineHeight) || o * 1.4, S = 40, w = q * 11, M = e.scrollHeight, K = l().text.split(`
93
- `).length > 1, s = document.createElement("div");
94
- s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
95
- const V = s.offsetWidth;
96
- document.body.removeChild(s);
97
- const $ = parseFloat(i.paddingLeft) || 0, G = parseFloat(i.paddingRight) || 0, U = e.clientWidth - $ - G, J = V > U, Q = K || J;
98
- l().text.trim() && Q ? M <= w ? (e.style.height = M + "px", e.style.overflowY = "hidden") : (e.style.height = w + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = S + "px", e.style.overflowY = "hidden"), T();
124
+ e && (M(e), y.value && (y.value = !1, S(e), requestAnimationFrame(() => S(e))));
99
125
  });
100
126
  },
101
127
  { immediate: !0 }
102
- ), m(
128
+ ), h(x, (e) => {
129
+ e && d(() => {
130
+ const t = n.value;
131
+ if (!t) return;
132
+ const i = t.scrollTop;
133
+ M(t), t.scrollTop = i, c(), requestAnimationFrame(c);
134
+ });
135
+ });
136
+ function M(e) {
137
+ const t = e.scrollTop;
138
+ e.style.height = "auto";
139
+ const i = getComputedStyle(e), o = parseFloat(i.fontSize) || 16, ee = parseFloat(i.lineHeight) || o * 1.4, k = 40, z = ee * 11, D = e.scrollHeight, te = l().text.split(`
140
+ `).length > 1, s = document.createElement("div");
141
+ s.style.position = "absolute", s.style.visibility = "hidden", s.style.whiteSpace = "nowrap", s.style.font = i.font, s.style.fontSize = i.fontSize, s.style.fontFamily = i.fontFamily, s.style.fontWeight = i.fontWeight, s.style.letterSpacing = i.letterSpacing, s.textContent = l().text, document.body.appendChild(s);
142
+ const ne = s.offsetWidth;
143
+ document.body.removeChild(s);
144
+ const ie = parseFloat(i.paddingLeft) || 0, le = parseFloat(i.paddingRight) || 0, oe = e.clientWidth - ie - le, se = ne > oe, ae = te || se;
145
+ l().text.trim() && ae ? D <= z ? (e.style.height = D + "px", e.style.overflowY = "hidden") : (e.style.height = z + "px", e.style.overflowY = "auto", e.scrollTop = t) : (e.style.height = k + "px", e.style.overflowY = "hidden"), c(), requestAnimationFrame(c);
146
+ }
147
+ function S(e) {
148
+ if (a.state === "disabled" || l().isRecording) return;
149
+ const t = e.value.length;
150
+ e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, c();
151
+ }
152
+ h(
103
153
  () => l().forceSend,
104
154
  () => {
105
- l().forceSend && (I(), F(!1));
155
+ l().forceSend && (F(), j(!1));
106
156
  }
107
157
  );
108
- const j = (e) => {
158
+ const U = (e) => {
109
159
  const t = e.target;
110
- _("typing", t.value);
111
- }, N = () => {
112
- v(() => {
160
+ w("typing", t.value);
161
+ }, G = () => {
162
+ d(() => {
113
163
  const e = n.value;
114
164
  e && (e.style.height = "40px", e.style.overflowY = "hidden");
115
165
  });
116
166
  };
117
- ee(() => {
118
- N();
167
+ ce(() => {
168
+ G();
119
169
  });
120
- const O = (e) => {
170
+ const J = (e) => {
121
171
  if (e.shiftKey) {
122
172
  if (n.value instanceof HTMLTextAreaElement) {
123
173
  let t = n.value.selectionStart;
124
174
  t && (n.value.setRangeText(`
125
- `, t, t, "end"), x(n.value.value));
175
+ `, t, t, "end"), T(n.value.value));
126
176
  }
127
177
  e.preventDefault();
128
178
  } else if (e.ctrlKey) {
129
179
  if (n.value instanceof HTMLTextAreaElement) {
130
180
  let t = n.value.selectionStart;
131
181
  t && (n.value.setRangeText(`
132
- `, t, t, "end"), x(n.value.value));
182
+ `, t, t, "end"), T(n.value.value));
133
183
  }
134
184
  e.preventDefault();
135
185
  } else
136
- e.preventDefault(), I();
137
- }, Y = (e) => {
186
+ e.preventDefault(), F();
187
+ }, Q = (e) => {
138
188
  if (n.value) {
139
189
  const t = n.value.value;
140
190
  n.value.value = e.newText;
141
191
  const i = e.newText.length - (t.length - (e.end - e.start)), o = e.start + i;
142
- x(e.newText), v(() => {
192
+ T(e.newText), d(() => {
143
193
  n.value && (n.value.setSelectionRange(o, o), n.value.focus());
144
194
  });
145
195
  }
146
- }, I = () => {
196
+ };
197
+ function X() {
198
+ q(), T(""), Te(g), R.value = void 0, n.value && n.value.focus();
199
+ }
200
+ function Z() {
201
+ const e = l();
202
+ return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
203
+ }
204
+ const F = () => {
147
205
  var t, i;
148
206
  const e = f(l());
207
+ if (e.value.edit && Z()) {
208
+ X();
209
+ return;
210
+ }
149
211
  if (e.value.text != "" || e.value.file) {
150
212
  const o = {
151
213
  type: "",
@@ -155,63 +217,70 @@ const pe = { class: "chat-input__container" }, fe = ["id"], he = ["id"], me = {
155
217
  size: "",
156
218
  reply: void 0
157
219
  };
158
- e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit), _("send", o), D(), P.value = void 0, n.value && n.value.focus();
220
+ e.value.file ? (o.type = "message." + e.value.file.type, o.url = e.value.file.url, o.filename = e.value.file.name, o.size = (t = e.value.file.size) == null ? void 0 : t.toString(), o.text = (i = e == null ? void 0 : e.value) == null ? void 0 : i.text.trim()) : (o.type = "message.text", o.text = e.value.text.trim()), e.value.reply && (o.reply = e.value.reply), e.value.edit && (o.edit = e.value.edit), w("send", o), L(), R.value = void 0, n.value && n.value.focus();
159
221
  }
160
222
  };
161
- return (e, t) => (y(), g("div", pe, [
162
- u("div", {
163
- id: "chat-input-reply-line-" + a(p),
223
+ return (e, t) => (I(), C("div", Ce, [
224
+ p("div", {
225
+ id: "chat-input-reply-line-" + r(g),
164
226
  class: "chat-input__reply-line"
165
- }, null, 8, fe),
166
- u("div", {
167
- id: "chat-input-file-line-" + a(p),
227
+ }, null, 8, Ie),
228
+ p("div", {
229
+ id: "chat-input-file-line-" + r(g),
168
230
  class: "chat-input__file-line"
169
- }, null, 8, he),
170
- u("div", me, [
171
- A(e.$slots, "inline-buttons", {}, void 0, !0)
231
+ }, null, 8, we),
232
+ p("div", Ae, [
233
+ W(e.$slots, "inline-buttons", {}, void 0, !0)
172
234
  ]),
173
- d.disabledPlaceholder && (d.state == "disabled" || a(l)().isRecording) ? (y(), g("div", ve, te(d.disabledPlaceholder), 1)) : (y(), g("div", ge, [
174
- !a(C) && a(l)().text ? (y(), g("div", {
235
+ v.disabledPlaceholder && (v.state == "disabled" || r(l)().isRecording) ? (I(), C("div", Ee, de(v.disabledPlaceholder), 1)) : (I(), C("div", Me, [
236
+ x.value ? (I(), C("div", {
175
237
  key: 0,
176
238
  ref_key: "refMirror",
177
- ref: b,
178
- class: "chat-input__input-mirror",
239
+ ref: A,
240
+ class: H(["chat-input__input-mirror", { "chat-input__input-mirror--hidden": u.value }]),
179
241
  "aria-hidden": "true",
180
- innerHTML: R.value
181
- }, null, 8, ye)) : ne("", !0),
182
- le(u("textarea", {
242
+ innerHTML: O.value
243
+ }, null, 10, Fe)) : pe("", !0),
244
+ fe(p("textarea", {
183
245
  ref_key: "refInput",
184
246
  ref: n,
185
- "onUpdate:modelValue": t[0] || (t[0] = (i) => a(l)().text = i),
186
- disabled: d.state == "disabled" || a(l)().isRecording,
187
- class: E(["chat-input__input", { "chat-input__input--emoji-images": !a(C) }]),
188
- placeholder: W.value,
189
- onKeydown: ie(O, ["enter"]),
190
- onInput: j,
191
- onScroll: T
192
- }, null, 42, _e), [
193
- [oe, a(l)().text]
247
+ "onUpdate:modelValue": t[0] || (t[0] = (i) => r(l)().text = i),
248
+ disabled: v.state == "disabled" || r(l)().isRecording,
249
+ class: H(["chat-input__input", {
250
+ "chat-input__input--emoji-images": x.value && !u.value,
251
+ "chat-input__input--selecting": x.value && u.value
252
+ }]),
253
+ placeholder: V.value,
254
+ onKeydown: he(J, ["enter"]),
255
+ onInput: U,
256
+ onScroll: c,
257
+ onSelect: E,
258
+ onMouseup: E,
259
+ onKeyup: E,
260
+ onBlur: t[1] || (t[1] = (i) => u.value = !1)
261
+ }, null, 42, He), [
262
+ [me, r(l)().text]
194
263
  ])
195
264
  ])),
196
- H(de, {
265
+ P(Se, {
197
266
  textarea: n.value,
198
- onFormatApplied: Y
267
+ onFormatApplied: Q
199
268
  }, null, 8, ["textarea"]),
200
- u("button", {
201
- class: E(["chat-input__button", { "chat-input__button-disabled": z.value }]),
202
- disabled: a(l)().isRecording,
203
- onClick: I
269
+ p("button", {
270
+ class: H(["chat-input__button", { "chat-input__button-disabled": Y.value }]),
271
+ disabled: r(l)().isRecording,
272
+ onClick: F
204
273
  }, [
205
- u("span", be, [
206
- H(a(ce), { color: B.value }, null, 8, ["color"])
274
+ p("span", ke, [
275
+ P(r(be), { color: $.value }, null, 8, ["color"])
207
276
  ])
208
- ], 10, xe),
209
- u("div", Ie, [
210
- A(e.$slots, "buttons", {}, void 0, !0)
277
+ ], 10, Re),
278
+ p("div", ze, [
279
+ W(e.$slots, "buttons", {}, void 0, !0)
211
280
  ])
212
281
  ]));
213
282
  }
214
283
  });
215
284
  export {
216
- je as default
285
+ Ze as default
217
286
  };
@@ -1,18 +1,43 @@
1
- import { watch as m } from "vue";
2
- function d({ targetIdRef: l, feedContainerId: s, focusClass: n = "focused-message" }) {
3
- m(
4
- () => l.value,
5
- (o) => {
6
- var c;
7
- if (!o) return;
8
- const e = document.getElementById(o), t = document.getElementById(s);
9
- e instanceof HTMLElement && t instanceof HTMLElement && (t.scrollTop = e.offsetTop + e.clientHeight / 2 - t.clientHeight / 2, (c = e.children[0]) == null || c.classList.add(n), setTimeout(() => {
10
- var i;
11
- (i = e.children[0]) == null || i.classList.remove(n);
12
- }, 2e3));
1
+ import { watch as u, nextTick as f } from "vue";
2
+ function g(r) {
3
+ const e = r.trim();
4
+ if (!e || document.getElementById(e))
5
+ return e;
6
+ const n = e.startsWith("msg-") ? e : `msg-${e}`;
7
+ if (document.getElementById(n))
8
+ return n;
9
+ try {
10
+ const t = JSON.parse(e);
11
+ if ((t == null ? void 0 : t.messageId) != null) {
12
+ const s = `msg-${t.messageId}`;
13
+ if (document.getElementById(s))
14
+ return s;
15
+ }
16
+ } catch {
17
+ }
18
+ return n;
19
+ }
20
+ function T({ targetIdRef: r, feedContainerId: e, focusClass: n = "focused-message" }) {
21
+ u(
22
+ () => r.value,
23
+ (t) => {
24
+ if (!t) return;
25
+ const s = (i = 0) => {
26
+ var l;
27
+ const d = g(t), o = document.getElementById(d), c = document.getElementById(e);
28
+ if (o instanceof HTMLElement && c instanceof HTMLElement) {
29
+ c.scrollTop = o.offsetTop + o.clientHeight / 2 - c.clientHeight / 2, (l = o.children[0]) == null || l.classList.add(n), setTimeout(() => {
30
+ var m;
31
+ (m = o.children[0]) == null || m.classList.remove(n);
32
+ }, 2e3);
33
+ return;
34
+ }
35
+ i < 5 && setTimeout(() => s(i + 1), 50);
36
+ };
37
+ f(() => s());
13
38
  }
14
39
  );
15
40
  }
16
41
  export {
17
- d as useFeedScrollTo
42
+ T as useFeedScrollTo
18
43
  };
@@ -1,4 +1,4 @@
1
- const f = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64", p = new RegExp("(?:\\p{Regional_Indicator}{2})|(?:[#*0-9]\\uFE0F?\\u20E3)|(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier_Base})(?:\\uFE0F|\\uFE0E)?)*)", "gu"), g = "height:1.2em;width:1.2em;margin:0 0.05em;vertical-align:-0.2em;display:inline";
1
+ const f = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64", s = new RegExp("(?:\\p{Regional_Indicator}{2})|(?:[#*0-9]\\uFE0F?\\u20E3)|(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier_Base})(?:\\uFE0F|\\uFE0E)?)*)", "gu"), g = "height:1.2em;width:1.2em;margin:0 0.05em;vertical-align:-0.2em;display:inline";
2
2
  function u(e, t) {
3
3
  const n = [];
4
4
  for (const c of e) {
@@ -21,7 +21,7 @@ function h(e) {
21
21
  }
22
22
  return null;
23
23
  }
24
- function T(e, t) {
24
+ function x(e, t) {
25
25
  const n = h(t);
26
26
  n && e.addEventListener(
27
27
  "error",
@@ -31,7 +31,7 @@ function T(e, t) {
31
31
  { once: !0 }
32
32
  );
33
33
  }
34
- function x(e) {
34
+ function T(e) {
35
35
  const t = u(e);
36
36
  if (!t) return e;
37
37
  const n = `${f}/${t}.png`, c = h(e), a = c ? ` data-fallback="${E(c)}" onerror="if(this.dataset.fallback&&this.src!==this.dataset.fallback){this.onerror=null;this.src=this.dataset.fallback}"` : "";
@@ -40,20 +40,23 @@ function x(e) {
40
40
  function E(e) {
41
41
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
42
42
  }
43
- function N(e) {
43
+ function I(e) {
44
44
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
45
45
  }
46
- function I(e) {
47
- return e ? N(e).replace(p, (n) => x(n)) : "";
46
+ function N(e) {
47
+ return e ? I(e).replace(s, (n) => T(n)) : "";
48
48
  }
49
49
  function $(e) {
50
+ return e ? (s.lastIndex = 0, s.test(e)) : !1;
51
+ }
52
+ function A(e) {
50
53
  var m;
51
54
  if (!e || typeof document > "u") return e;
52
55
  const t = document.createElement("div");
53
56
  t.innerHTML = e;
54
57
  const n = document.createTreeWalker(t, NodeFilter.SHOW_TEXT, {
55
- acceptNode: (s) => {
56
- let r = s.parentNode;
58
+ acceptNode: (d) => {
59
+ let r = d.parentNode;
57
60
  for (; r && r !== t; ) {
58
61
  const o = r.nodeName;
59
62
  if (o === "SCRIPT" || o === "STYLE" || o === "TEXTAREA")
@@ -66,27 +69,28 @@ function $(e) {
66
69
  let a;
67
70
  for (; a = n.nextNode(); )
68
71
  c.push(a);
69
- for (const s of c.reverse()) {
70
- const r = s.textContent || "";
71
- if (p.lastIndex = 0, !p.test(r)) continue;
72
- p.lastIndex = 0;
72
+ for (const d of c.reverse()) {
73
+ const r = d.textContent || "";
74
+ if (s.lastIndex = 0, !s.test(r)) continue;
75
+ s.lastIndex = 0;
73
76
  const o = document.createDocumentFragment();
74
- let d = 0, i;
75
- for (; i = p.exec(r); ) {
76
- i.index > d && o.appendChild(document.createTextNode(r.slice(d, i.index)));
77
+ let p = 0, i;
78
+ for (; i = s.exec(r); ) {
79
+ i.index > p && o.appendChild(document.createTextNode(r.slice(p, i.index)));
77
80
  const l = document.createElement("img");
78
- l.className = "chotto-emoji", l.src = F(i[0]), l.alt = i[0], l.draggable = !1, l.setAttribute("style", g), T(l, i[0]), o.appendChild(l), d = i.index + i[0].length;
81
+ l.className = "chotto-emoji", l.src = F(i[0]), l.alt = i[0], l.draggable = !1, l.setAttribute("style", g), x(l, i[0]), o.appendChild(l), p = i.index + i[0].length;
79
82
  }
80
- d < r.length && o.appendChild(document.createTextNode(r.slice(d))), (m = s.parentNode) == null || m.replaceChild(o, s);
83
+ p < r.length && o.appendChild(document.createTextNode(r.slice(p))), (m = d.parentNode) == null || m.replaceChild(o, d);
81
84
  }
82
85
  return t.innerHTML;
83
86
  }
84
87
  export {
85
88
  f as APPLE_EMOJI_CDN,
86
- x as createAppleEmojiImgHtml,
89
+ T as createAppleEmojiImgHtml,
87
90
  u as emojiToAppleCode,
88
91
  h as getAppleEmojiFallbackUrl,
89
92
  F as getAppleEmojiUrl,
90
- $ as replaceEmojisInHtml,
91
- I as textToAppleEmojiHtml
93
+ A as replaceEmojisInHtml,
94
+ $ as textContainsEmoji,
95
+ N as textToAppleEmojiHtml
92
96
  };
@@ -14,7 +14,7 @@ import { hideReplyPreview as s, showReplyPreview as r } from "./useStartReply.js
14
14
  function R(t) {
15
15
  const { setEdit: e, setMessageText: o, resetReply: m } = p(t);
16
16
  return { startEdit: (i) => {
17
- m(), r(t), e(i), o(i.text ?? "");
17
+ m(), r(t), o(i.text ?? ""), e(i);
18
18
  } };
19
19
  }
20
20
  function g(t) {