atagen

malice

public
Star0
Watch0
824dfd38cdf3a131fab37ae25a60f3b51ccd93bc
2
ssh://brewery@pls.lobotomise.me:33/atagen/malice.git

Blame: web/src/lib/MessageRow.svelte

973f8fbdaf80atagen2026-09-28 09:10 UTC1
<script lang="ts">
973f8fbdaf80atagen2026-09-28 09:10 UTC2
  import MediaAttachmentView from './MediaAttachmentView.svelte';
973f8fbdaf80atagen2026-09-28 09:10 UTC3
  import MxcAvatar from './MxcAvatar.svelte';
544a170ead2catagen2026-10-20 11:47 UTC4
  import Emoji from './Emoji.svelte';
544a170ead2catagen2026-10-20 11:47 UTC5
  import EmojiText from './EmojiText.svelte';
df3c0f2b3da4atagen2026-10-22 13:07 UTC6
  import MessageText from './MessageText.svelte';
544a170ead2catagen2026-10-20 11:47 UTC7
  import ReactionPicker from './ReactionPicker.svelte';
b8ab00377c20atagen2026-10-22 05:13 UTC8
  import LinkCard from './LinkCard.svelte';
ecb8598b38afatagen2026-10-22 09:19 UTC9
  import { mediaUrl, messageMediaUrl } from './api';
df3c0f2b3da4atagen2026-10-22 13:07 UTC10
  import type { ImagePack, LinkPreview, Person, QuickReaction, ReplyReference, SendState, TimelineContent, TimelineEvent } from './types';
973f8fbdaf80atagen2026-09-28 09:10 UTC11
  import { senderLabel } from './types';
973f8fbdaf80atagen2026-09-28 09:10 UTC12
  import { formatClock, formatDay, initialsOf, senderHue } from './format';
973f8fbdaf80atagen2026-09-28 09:10 UTC13
  import { findUrls } from './urls';
787cdbbf0721atagen2026-10-24 06:50 UTC14
  import { mentionsFromHtml, resolveMentions, stripMarkdownPills } from './mentions';
973f8fbdaf80atagen2026-09-28 09:10 UTC15
973f8fbdaf80atagen2026-09-28 09:10 UTC16
  export let itemId: string;
973f8fbdaf80atagen2026-09-28 09:10 UTC17
  export let event: TimelineEvent;
973f8fbdaf80atagen2026-09-28 09:10 UTC18
  export let showSender: boolean;
973f8fbdaf80atagen2026-09-28 09:10 UTC19
  export let reacting: boolean;
ecb8598b38afatagen2026-10-22 09:19 UTC20
  export let onReact: (eventId: string, key: string, shortcode?: string) => void;
973f8fbdaf80atagen2026-09-28 09:10 UTC21
  export let senderAvatar: string | null = null;
544a170ead2catagen2026-10-20 11:47 UTC22
  export let quickReactions: QuickReaction[] = [];
544a170ead2catagen2026-10-20 11:47 UTC23
  export let packs: ImagePack[] = [];
544a170ead2catagen2026-10-20 11:47 UTC24
  export let onQuickChange: (list: QuickReaction[]) => void = () => {};
ecb8598b38afatagen2026-10-22 09:19 UTC25
  export let linkPreviews: Record<string, LinkPreview | null> = {};
ecb8598b38afatagen2026-10-22 09:19 UTC26
  export let loadPreview: ((url: string) => void) | null = null;
df3c0f2b3da4atagen2026-10-22 13:07 UTC27
  export let people: Record<string, Person> = {};
df3c0f2b3da4atagen2026-10-22 13:07 UTC28
  export let onReply: ((target: ReplyReference) => void) | null = null;
df3c0f2b3da4atagen2026-10-22 13:07 UTC29
  export let onJump: ((eventId: string) => void) | null = null;
cf23dbf4e77catagen2026-10-23 06:36 UTC30
  export let onEdit: ((eventId: string, body: string) => void) | null = null;
cf23dbf4e77catagen2026-10-23 06:36 UTC31
  export let editing = false;
df3c0f2b3da4atagen2026-10-22 13:07 UTC32
  export let showSent = true;
705b1e1062c2atagen2026-10-23 09:05 UTC33
  export let self: string | null = null;
d8624c214c04atagen2026-10-24 08:24 UTC34
  export let onUser: ((userId: string, x: number, y: number, menu: boolean) => void) | null = null;
d095131eec0eatagen2026-10-24 08:39 UTC35
  export let onCloneSticker: ((eventId: string, body: string, x: number, y: number) => void) | null = null;
0380cd8c765catagen2026-10-24 09:08 UTC36
  export let onMore: ((event: TimelineEvent, x: number, y: number) => void) | null = null;
d8624c214c04atagen2026-10-24 08:24 UTC37
d8624c214c04atagen2026-10-24 08:24 UTC38
  function openUser(ev: MouseEvent, menu: boolean): void {
d8624c214c04atagen2026-10-24 08:24 UTC39
    if (!onUser) return;
d8624c214c04atagen2026-10-24 08:24 UTC40
    const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect();
d8624c214c04atagen2026-10-24 08:24 UTC41
    onUser(event.sender.user_id, menu ? ev.clientX : rect.left, menu ? ev.clientY : rect.bottom + 4, menu);
d8624c214c04atagen2026-10-24 08:24 UTC42
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC43
544a170ead2catagen2026-10-20 11:47 UTC44
  const PICKER_WIDTH = 320;
544a170ead2catagen2026-10-20 11:47 UTC45
  const PICKER_HEIGHT = 380;
544a170ead2catagen2026-10-20 11:47 UTC46
  const PICKER_MARGIN = 8;
df3c0f2b3da4atagen2026-10-22 13:07 UTC47
  const MAX_READERS = 3;
05a48e9e7942atagen2026-10-24 09:32 UTC48
  const STATE_LABELS: Record<string, string> = {
05a48e9e7942atagen2026-10-24 09:32 UTC49
    'm.room.pinned_events': 'changed the pinned messages',
05a48e9e7942atagen2026-10-24 09:32 UTC50
    'm.room.power_levels': 'changed the room permissions',
05a48e9e7942atagen2026-10-24 09:32 UTC51
    'm.room.join_rules': 'changed who can join',
05a48e9e7942atagen2026-10-24 09:32 UTC52
    'm.room.history_visibility': 'changed who can read history',
05a48e9e7942atagen2026-10-24 09:32 UTC53
    'm.room.guest_access': 'changed guest access',
05a48e9e7942atagen2026-10-24 09:32 UTC54
    'm.room.canonical_alias': 'changed the room address',
05a48e9e7942atagen2026-10-24 09:32 UTC55
    'm.room.server_acl': 'changed the server access list',
05a48e9e7942atagen2026-10-24 09:32 UTC56
    'm.space.child': 'changed the rooms in this space',
05a48e9e7942atagen2026-10-24 09:32 UTC57
    'm.space.parent': 'changed the parent space',
05a48e9e7942atagen2026-10-24 09:32 UTC58
    'im.ponies.room_emotes': 'updated a sticker pack'
05a48e9e7942atagen2026-10-24 09:32 UTC59
  };
544a170ead2catagen2026-10-20 11:47 UTC60
544a170ead2catagen2026-10-20 11:47 UTC61
  let row: HTMLDivElement;
544a170ead2catagen2026-10-20 11:47 UTC62
  let pickerPop: HTMLDivElement | undefined;
544a170ead2catagen2026-10-20 11:47 UTC63
  let selected = false;
544a170ead2catagen2026-10-20 11:47 UTC64
  let pickerOpen = false;
544a170ead2catagen2026-10-20 11:47 UTC65
  let pickerStyle = '';
973f8fbdaf80atagen2026-09-28 09:10 UTC66
973f8fbdaf80atagen2026-09-28 09:10 UTC67
  const MEMBERSHIP_LABELS: Record<string, string> = {
973f8fbdaf80atagen2026-09-28 09:10 UTC68
    Joined: 'joined the room',
973f8fbdaf80atagen2026-09-28 09:10 UTC69
    Left: 'left the room',
973f8fbdaf80atagen2026-09-28 09:10 UTC70
    Banned: 'was banned',
973f8fbdaf80atagen2026-09-28 09:10 UTC71
    Unbanned: 'was unbanned',
973f8fbdaf80atagen2026-09-28 09:10 UTC72
    Kicked: 'was kicked',
973f8fbdaf80atagen2026-09-28 09:10 UTC73
    KickedAndBanned: 'was kicked and banned',
973f8fbdaf80atagen2026-09-28 09:10 UTC74
    Invited: 'was invited',
973f8fbdaf80atagen2026-09-28 09:10 UTC75
    InvitationAccepted: 'accepted the invite',
973f8fbdaf80atagen2026-09-28 09:10 UTC76
    InvitationRejected: 'rejected the invite',
973f8fbdaf80atagen2026-09-28 09:10 UTC77
    InvitationRevoked: 'had the invite revoked',
973f8fbdaf80atagen2026-09-28 09:10 UTC78
    Knocked: 'requested to join',
973f8fbdaf80atagen2026-09-28 09:10 UTC79
    KnockAccepted: 'was let in',
973f8fbdaf80atagen2026-09-28 09:10 UTC80
    KnockRetracted: 'withdrew the request to join',
973f8fbdaf80atagen2026-09-28 09:10 UTC81
    KnockDenied: 'had the request to join denied'
973f8fbdaf80atagen2026-09-28 09:10 UTC82
  };
973f8fbdaf80atagen2026-09-28 09:10 UTC83
f604ef6df0c4atagen2026-10-24 10:08 UTC84
  $: name = event.sender.display_name ?? people[event.sender.user_id]?.name ?? event.sender.user_id;
973f8fbdaf80atagen2026-09-28 09:10 UTC85
  $: displayName = event.sender.name_ambiguous ? `${name} (${event.sender.user_id})` : name;
df3c0f2b3da4atagen2026-10-22 13:07 UTC86
  $: readers = event.read_by.map((id) => people[id] ?? { user_id: id, name: id, avatar: null });
973f8fbdaf80atagen2026-09-28 09:10 UTC87
  $: interactive = event.content.kind === 'Message' || event.content.kind === 'Sticker' || event.content.kind === 'Poll';
705b1e1062c2atagen2026-10-23 09:05 UTC88
  $: message = event.content.kind === 'Message' ? event.content.message : null;
705b1e1062c2atagen2026-10-23 09:05 UTC89
  $: stripped = stripMarkdownPills(message ? (message.media ? message.media.caption : message.body) ?? '' : '');
787cdbbf0721atagen2026-10-24 06:50 UTC90
  $: linked = message ? [...mentionsFromHtml(message.formatted_body), ...stripped.mentions] : [];
787cdbbf0721atagen2026-10-24 06:50 UTC91
  $: mentions = resolveMentions(stripped.text, linked);
787cdbbf0721atagen2026-10-24 06:50 UTC92
  $: mentionsMe = self !== null && [...linked, ...mentions].some((m) => m.user_id === self);
705b1e1062c2atagen2026-10-23 09:05 UTC93
  $: previews = findUrls(stripped.text);
705b1e1062c2atagen2026-10-23 09:05 UTC94
  $: bundled = message ? message.link_previews : [];
705b1e1062c2atagen2026-10-23 09:05 UTC95
  $: cards = previews
705b1e1062c2atagen2026-10-23 09:05 UTC96
    .map((link) => ({ link, preview: bundled.find((b) => b.url === link.href) ?? linkPreviews[link.href] ?? null }))
705b1e1062c2atagen2026-10-23 09:05 UTC97
    .filter((c) => c.preview && (c.preview.title || c.preview.description || c.preview.image));
ecb8598b38afatagen2026-10-22 09:19 UTC98
  $: if (loadPreview) {
ecb8598b38afatagen2026-10-22 09:19 UTC99
    for (const link of previews) {
ecb8598b38afatagen2026-10-22 09:19 UTC100
      if (!bundled.some((b) => b.url === link.href) && !(link.href in linkPreviews)) loadPreview(link.href);
ecb8598b38afatagen2026-10-22 09:19 UTC101
    }
ecb8598b38afatagen2026-10-22 09:19 UTC102
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC103
f604ef6df0c4atagen2026-10-24 10:08 UTC104
  $: sent = interactive && showSent && event.own && event.send_state.kind === 'Sent' && event.event_id !== null;
f604ef6df0c4atagen2026-10-24 10:08 UTC105
973f8fbdaf80atagen2026-09-28 09:10 UTC106
  function sendLabel(state: SendState): string {
973f8fbdaf80atagen2026-09-28 09:10 UTC107
    if (state.kind === 'Failed') return state.will_retry ? 'failed — will retry' : 'failed — not delivered';
973f8fbdaf80atagen2026-09-28 09:10 UTC108
    if (state.kind === 'Sending') return 'sending…';
973f8fbdaf80atagen2026-09-28 09:10 UTC109
    return '';
973f8fbdaf80atagen2026-09-28 09:10 UTC110
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC111
544a170ead2catagen2026-10-20 11:47 UTC112
  function toggleSelected(e: MouseEvent) {
544a170ead2catagen2026-10-20 11:47 UTC113
    if (!interactive || (e.target as Element).closest('a, button, input, video, audio, .picker-pop')) return;
544a170ead2catagen2026-10-20 11:47 UTC114
    selected = !selected;
544a170ead2catagen2026-10-20 11:47 UTC115
  }
544a170ead2catagen2026-10-20 11:47 UTC116
544a170ead2catagen2026-10-20 11:47 UTC117
  function deselectOutside(e: PointerEvent) {
544a170ead2catagen2026-10-20 11:47 UTC118
    if (selected && !pickerOpen && !row.contains(e.target as Node)) selected = false;
544a170ead2catagen2026-10-20 11:47 UTC119
  }
544a170ead2catagen2026-10-20 11:47 UTC120
544a170ead2catagen2026-10-20 11:47 UTC121
  function openPicker(e: MouseEvent) {
544a170ead2catagen2026-10-20 11:47 UTC122
    if (pickerOpen) {
544a170ead2catagen2026-10-20 11:47 UTC123
      pickerOpen = false;
544a170ead2catagen2026-10-20 11:47 UTC124
      return;
544a170ead2catagen2026-10-20 11:47 UTC125
    }
544a170ead2catagen2026-10-20 11:47 UTC126
    const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
544a170ead2catagen2026-10-20 11:47 UTC127
    const height = Math.min(PICKER_HEIGHT, window.innerHeight - 2 * PICKER_MARGIN);
544a170ead2catagen2026-10-20 11:47 UTC128
    const below = window.innerHeight - rect.bottom - PICKER_MARGIN >= height;
544a170ead2catagen2026-10-20 11:47 UTC129
    const top = below ? rect.bottom + 4 : Math.max(PICKER_MARGIN, rect.top - height - 4);
544a170ead2catagen2026-10-20 11:47 UTC130
    const maxLeft = window.innerWidth - PICKER_WIDTH - PICKER_MARGIN;
544a170ead2catagen2026-10-20 11:47 UTC131
    const left = Math.max(PICKER_MARGIN, Math.min(rect.right - PICKER_WIDTH, maxLeft));
544a170ead2catagen2026-10-20 11:47 UTC132
    pickerStyle = `top:${top}px;left:${left}px;height:${height}px`;
544a170ead2catagen2026-10-20 11:47 UTC133
    selected = true;
544a170ead2catagen2026-10-20 11:47 UTC134
    pickerOpen = true;
544a170ead2catagen2026-10-20 11:47 UTC135
  }
544a170ead2catagen2026-10-20 11:47 UTC136
544a170ead2catagen2026-10-20 11:47 UTC137
  function closePicker() {
544a170ead2catagen2026-10-20 11:47 UTC138
    pickerOpen = false;
544a170ead2catagen2026-10-20 11:47 UTC139
  }
544a170ead2catagen2026-10-20 11:47 UTC140
ecb8598b38afatagen2026-10-22 09:19 UTC141
  function isImageKey(key: string): boolean {
ecb8598b38afatagen2026-10-22 09:19 UTC142
    return key.startsWith('mxc://') || packs.some((p) => p.images.some((i) => i.reaction_key === key));
ecb8598b38afatagen2026-10-22 09:19 UTC143
  }
ecb8598b38afatagen2026-10-22 09:19 UTC144
ecb8598b38afatagen2026-10-22 09:19 UTC145
  function react(key: string, shortcode: string | null) {
ecb8598b38afatagen2026-10-22 09:19 UTC146
    if (shortcode && isImageKey(key)) onReact(event.event_id ?? '', key, shortcode);
ecb8598b38afatagen2026-10-22 09:19 UTC147
    else onReact(event.event_id ?? '', key);
ecb8598b38afatagen2026-10-22 09:19 UTC148
  }
ecb8598b38afatagen2026-10-22 09:19 UTC149
df3c0f2b3da4atagen2026-10-22 13:07 UTC150
  function reply() {
df3c0f2b3da4atagen2026-10-22 13:07 UTC151
    if (!event.event_id || !onReply) return;
df3c0f2b3da4atagen2026-10-22 13:07 UTC152
    onReply({
df3c0f2b3da4atagen2026-10-22 13:07 UTC153
      event_id: event.event_id,
df3c0f2b3da4atagen2026-10-22 13:07 UTC154
      details: { kind: 'Ready', sender: event.sender, content: event.content, timestamp_ms: event.timestamp_ms }
df3c0f2b3da4atagen2026-10-22 13:07 UTC155
    });
df3c0f2b3da4atagen2026-10-22 13:07 UTC156
  }
df3c0f2b3da4atagen2026-10-22 13:07 UTC157
cf23dbf4e77catagen2026-10-23 06:36 UTC158
  $: editableBody =
cf23dbf4e77catagen2026-10-23 06:36 UTC159
    event.own && event.editable && event.event_id && event.content.kind === 'Message' && event.content.message.kind === 'Text'
cf23dbf4e77catagen2026-10-23 06:36 UTC160
      ? event.content.message.body
cf23dbf4e77catagen2026-10-23 06:36 UTC161
      : null;
cf23dbf4e77catagen2026-10-23 06:36 UTC162
cf23dbf4e77catagen2026-10-23 06:36 UTC163
  function edit() {
cf23dbf4e77catagen2026-10-23 06:36 UTC164
    if (!event.event_id || editableBody === null || !onEdit) return;
cf23dbf4e77catagen2026-10-23 06:36 UTC165
    onEdit(event.event_id, editableBody);
cf23dbf4e77catagen2026-10-23 06:36 UTC166
  }
cf23dbf4e77catagen2026-10-23 06:36 UTC167
cf23dbf4e77catagen2026-10-23 06:36 UTC168
  function reactorNames(senders: string[]): string {
cf23dbf4e77catagen2026-10-23 06:36 UTC169
    const names = senders.map((id) => people[id]?.name ?? id);
cf23dbf4e77catagen2026-10-23 06:36 UTC170
    if (names.length <= 12) return names.join(', ');
cf23dbf4e77catagen2026-10-23 06:36 UTC171
    return `${names.slice(0, 12).join(', ')} and ${names.length - 12} more`;
cf23dbf4e77catagen2026-10-23 06:36 UTC172
  }
cf23dbf4e77catagen2026-10-23 06:36 UTC173
ecb8598b38afatagen2026-10-22 09:19 UTC174
  function pick(key: string, shortcode: string | null) {
544a170ead2catagen2026-10-20 11:47 UTC175
    pickerOpen = false;
ecb8598b38afatagen2026-10-22 09:19 UTC176
    react(key, shortcode);
544a170ead2catagen2026-10-20 11:47 UTC177
  }
544a170ead2catagen2026-10-20 11:47 UTC178
544a170ead2catagen2026-10-20 11:47 UTC179
  function closeOnScroll(e: Event) {
544a170ead2catagen2026-10-20 11:47 UTC180
    if (pickerOpen && !pickerPop?.contains(e.target as Node)) pickerOpen = false;
544a170ead2catagen2026-10-20 11:47 UTC181
  }
544a170ead2catagen2026-10-20 11:47 UTC182
973f8fbdaf80atagen2026-09-28 09:10 UTC183
  function actorLabel(userId: string, name: string | null): string {
f604ef6df0c4atagen2026-10-24 10:08 UTC184
    return name ?? people[userId]?.name ?? userId;
973f8fbdaf80atagen2026-09-28 09:10 UTC185
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC186
973f8fbdaf80atagen2026-09-28 09:10 UTC187
  function replyPreview(content: TimelineContent): string {
705b1e1062c2atagen2026-10-23 09:05 UTC188
    if (content.kind === 'Message') return stripMarkdownPills(content.message.body).text;
973f8fbdaf80atagen2026-09-28 09:10 UTC189
    if (content.kind === 'Sticker') return content.body || 'Sticker';
973f8fbdaf80atagen2026-09-28 09:10 UTC190
    if (content.kind === 'Poll') return `Poll: ${content.question}`;
973f8fbdaf80atagen2026-09-28 09:10 UTC191
    if (content.kind === 'Redacted') return 'Message deleted';
973f8fbdaf80atagen2026-09-28 09:10 UTC192
    if (content.kind === 'UnableToDecrypt') return 'Unable to decrypt';
973f8fbdaf80atagen2026-09-28 09:10 UTC193
    return systemLine(content);
973f8fbdaf80atagen2026-09-28 09:10 UTC194
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC195
f604ef6df0c4atagen2026-10-24 10:08 UTC196
  function systemLine(content: TimelineContent, actor = displayName): string {
973f8fbdaf80atagen2026-09-28 09:10 UTC197
    switch (content.kind) {
973f8fbdaf80atagen2026-09-28 09:10 UTC198
      case 'Redacted':
973f8fbdaf80atagen2026-09-28 09:10 UTC199
        return 'Message deleted';
973f8fbdaf80atagen2026-09-28 09:10 UTC200
      case 'UnableToDecrypt':
f604ef6df0c4atagen2026-10-24 10:08 UTC201
        return `Message from ${actor} could not be decrypted`;
973f8fbdaf80atagen2026-09-28 09:10 UTC202
      case 'Membership': {
973f8fbdaf80atagen2026-09-28 09:10 UTC203
        const who = actorLabel(content.user_id, content.display_name);
973f8fbdaf80atagen2026-09-28 09:10 UTC204
        return `${who} ${MEMBERSHIP_LABELS[content.change] ?? 'updated their membership'}`;
973f8fbdaf80atagen2026-09-28 09:10 UTC205
      }
973f8fbdaf80atagen2026-09-28 09:10 UTC206
      case 'Profile': {
973f8fbdaf80atagen2026-09-28 09:10 UTC207
        const who = actorLabel(content.user_id, null);
973f8fbdaf80atagen2026-09-28 09:10 UTC208
        const parts: string[] = [];
973f8fbdaf80atagen2026-09-28 09:10 UTC209
        if (content.display_name) {
973f8fbdaf80atagen2026-09-28 09:10 UTC210
          parts.push(
973f8fbdaf80atagen2026-09-28 09:10 UTC211
            content.display_name.new
973f8fbdaf80atagen2026-09-28 09:10 UTC212
              ? `changed their display name to "${content.display_name.new}"`
973f8fbdaf80atagen2026-09-28 09:10 UTC213
              : 'removed their display name'
973f8fbdaf80atagen2026-09-28 09:10 UTC214
          );
973f8fbdaf80atagen2026-09-28 09:10 UTC215
        }
973f8fbdaf80atagen2026-09-28 09:10 UTC216
        if (content.avatar) parts.push('changed their avatar');
973f8fbdaf80atagen2026-09-28 09:10 UTC217
        return `${who} ${parts.length > 0 ? parts.join(' and ') : 'updated their profile'}`;
973f8fbdaf80atagen2026-09-28 09:10 UTC218
      }
973f8fbdaf80atagen2026-09-28 09:10 UTC219
      case 'RoomName':
973f8fbdaf80atagen2026-09-28 09:10 UTC220
        return content.name
f604ef6df0c4atagen2026-10-24 10:08 UTC221
          ? `${actor} changed the room name to "${content.name}"`
f604ef6df0c4atagen2026-10-24 10:08 UTC222
          : `${actor} removed the room name`;
973f8fbdaf80atagen2026-09-28 09:10 UTC223
      case 'RoomTopic':
973f8fbdaf80atagen2026-09-28 09:10 UTC224
        return content.topic
f604ef6df0c4atagen2026-10-24 10:08 UTC225
          ? `${actor} changed the topic to "${content.topic}"`
f604ef6df0c4atagen2026-10-24 10:08 UTC226
          : `${actor} removed the topic`;
973f8fbdaf80atagen2026-09-28 09:10 UTC227
      case 'RoomAvatar':
f604ef6df0c4atagen2026-10-24 10:08 UTC228
        return content.avatar ? `${actor} changed the room avatar` : `${actor} removed the room avatar`;
973f8fbdaf80atagen2026-09-28 09:10 UTC229
      case 'EncryptionEnabled':
f604ef6df0c4atagen2026-10-24 10:08 UTC230
        return `${actor} enabled encryption in this room`;
973f8fbdaf80atagen2026-09-28 09:10 UTC231
      case 'RoomCreated':
f604ef6df0c4atagen2026-10-24 10:08 UTC232
        return `${actor} created the room`;
973f8fbdaf80atagen2026-09-28 09:10 UTC233
      case 'RoomUpgraded':
f604ef6df0c4atagen2026-10-24 10:08 UTC234
        return `${actor} upgraded the room to a new version`;
973f8fbdaf80atagen2026-09-28 09:10 UTC235
      case 'OtherState':
f604ef6df0c4atagen2026-10-24 10:08 UTC236
        return `${actor} ${STATE_LABELS[content.event_type] ?? `sent a state event (${content.event_type})`}`;
973f8fbdaf80atagen2026-09-28 09:10 UTC237
      case 'Other':
f604ef6df0c4atagen2026-10-24 10:08 UTC238
        return `${actor} sent an event (${content.event_type})`;
973f8fbdaf80atagen2026-09-28 09:10 UTC239
      default:
f604ef6df0c4atagen2026-10-24 10:08 UTC240
        return actor;
973f8fbdaf80atagen2026-09-28 09:10 UTC241
    }
973f8fbdaf80atagen2026-09-28 09:10 UTC242
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC243
</script>
973f8fbdaf80atagen2026-09-28 09:10 UTC244
544a170ead2catagen2026-10-20 11:47 UTC245
<svelte:window
544a170ead2catagen2026-10-20 11:47 UTC246
  on:pointerdown={deselectOutside}
544a170ead2catagen2026-10-20 11:47 UTC247
  on:keydown={(e) => e.key === 'Escape' && (selected = false)}
544a170ead2catagen2026-10-20 11:47 UTC248
  on:scroll|capture={closeOnScroll}
544a170ead2catagen2026-10-20 11:47 UTC249
  on:resize={closePicker}
544a170ead2catagen2026-10-20 11:47 UTC250
/>
544a170ead2catagen2026-10-20 11:47 UTC251
544a170ead2catagen2026-10-20 11:47 UTC252
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
544a170ead2catagen2026-10-20 11:47 UTC253
<div
544a170ead2catagen2026-10-20 11:47 UTC254
  class="msg"
544a170ead2catagen2026-10-20 11:47 UTC255
  class:own={event.own}
cf23dbf4e77catagen2026-10-23 06:36 UTC256
  class:editing
705b1e1062c2atagen2026-10-23 09:05 UTC257
  class:mentioned={mentionsMe}
544a170ead2catagen2026-10-20 11:47 UTC258
  class:system={!interactive}
df3c0f2b3da4atagen2026-10-22 13:07 UTC259
  class:has-readers={interactive && readers.length > 0}
544a170ead2catagen2026-10-20 11:47 UTC260
  class:selected
544a170ead2catagen2026-10-20 11:47 UTC261
  data-item={itemId}
df3c0f2b3da4atagen2026-10-22 13:07 UTC262
  data-event={event.event_id}
544a170ead2catagen2026-10-20 11:47 UTC263
  bind:this={row}
544a170ead2catagen2026-10-20 11:47 UTC264
  on:click={toggleSelected}
544a170ead2catagen2026-10-20 11:47 UTC265
>
544a170ead2catagen2026-10-20 11:47 UTC266
  {#if interactive && event.event_id}
544a170ead2catagen2026-10-20 11:47 UTC267
    <div class="actions" role="toolbar" aria-label={`Actions for message from ${displayName}`}>
544a170ead2catagen2026-10-20 11:47 UTC268
      {#each quickReactions as r (r.key)}
544a170ead2catagen2026-10-20 11:47 UTC269
        {@const label = r.shortcode ? `:${r.shortcode}:` : r.key}
544a170ead2catagen2026-10-20 11:47 UTC270
        <button
544a170ead2catagen2026-10-20 11:47 UTC271
          type="button"
544a170ead2catagen2026-10-20 11:47 UTC272
          title={`React ${label}`}
544a170ead2catagen2026-10-20 11:47 UTC273
          aria-label={`React ${label} to message from ${displayName}`}
544a170ead2catagen2026-10-20 11:47 UTC274
          disabled={reacting}
ecb8598b38afatagen2026-10-22 09:19 UTC275
          on:click={() => react(r.key, r.shortcode)}
544a170ead2catagen2026-10-20 11:47 UTC276
        >
544a170ead2catagen2026-10-20 11:47 UTC277
          {#if r.key.startsWith('mxc://')}
544a170ead2catagen2026-10-20 11:47 UTC278
            <img class="emote" src={mediaUrl(r.key) ?? ''} alt="" />
544a170ead2catagen2026-10-20 11:47 UTC279
          {:else}
544a170ead2catagen2026-10-20 11:47 UTC280
            <Emoji emoji={r.key} size={18} />
544a170ead2catagen2026-10-20 11:47 UTC281
          {/if}
544a170ead2catagen2026-10-20 11:47 UTC282
        </button>
544a170ead2catagen2026-10-20 11:47 UTC283
      {/each}
544a170ead2catagen2026-10-20 11:47 UTC284
      <button
544a170ead2catagen2026-10-20 11:47 UTC285
        type="button"
544a170ead2catagen2026-10-20 11:47 UTC286
        title="Add reaction"
544a170ead2catagen2026-10-20 11:47 UTC287
        aria-label={`Add reaction to message from ${displayName}`}
544a170ead2catagen2026-10-20 11:47 UTC288
        aria-haspopup="dialog"
544a170ead2catagen2026-10-20 11:47 UTC289
        aria-expanded={pickerOpen}
544a170ead2catagen2026-10-20 11:47 UTC290
        on:pointerdown|stopPropagation
544a170ead2catagen2026-10-20 11:47 UTC291
        on:click={openPicker}
544a170ead2catagen2026-10-20 11:47 UTC292
      >
544a170ead2catagen2026-10-20 11:47 UTC293
        ☺+
544a170ead2catagen2026-10-20 11:47 UTC294
      </button>
d095131eec0eatagen2026-10-24 08:39 UTC295
      {#if onCloneSticker && event.content.kind === 'Sticker'}
d095131eec0eatagen2026-10-24 08:39 UTC296
        {@const stickerBody = event.content.body}
d095131eec0eatagen2026-10-24 08:39 UTC297
        {@const stickerId = event.event_id}
d095131eec0eatagen2026-10-24 08:39 UTC298
        <button
d095131eec0eatagen2026-10-24 08:39 UTC299
          type="button"
d095131eec0eatagen2026-10-24 08:39 UTC300
          title="Clone sticker"
d095131eec0eatagen2026-10-24 08:39 UTC301
          aria-label="Clone sticker to one of your packs"
d095131eec0eatagen2026-10-24 08:39 UTC302
          on:click|stopPropagation={(ev) => onCloneSticker?.(stickerId, stickerBody, ev.clientX, ev.clientY)}
d095131eec0eatagen2026-10-24 08:39 UTC303
        >
d095131eec0eatagen2026-10-24 08:39 UTC304
          ⧉
d095131eec0eatagen2026-10-24 08:39 UTC305
        </button>
d095131eec0eatagen2026-10-24 08:39 UTC306
      {/if}
df3c0f2b3da4atagen2026-10-22 13:07 UTC307
      {#if onReply}
df3c0f2b3da4atagen2026-10-22 13:07 UTC308
        <button
df3c0f2b3da4atagen2026-10-22 13:07 UTC309
          type="button"
df3c0f2b3da4atagen2026-10-22 13:07 UTC310
          title="Reply"
df3c0f2b3da4atagen2026-10-22 13:07 UTC311
          aria-label={`Reply to message from ${displayName}`}
df3c0f2b3da4atagen2026-10-22 13:07 UTC312
          on:click|stopPropagation={reply}
df3c0f2b3da4atagen2026-10-22 13:07 UTC313
        >
df3c0f2b3da4atagen2026-10-22 13:07 UTC314
          ↩
df3c0f2b3da4atagen2026-10-22 13:07 UTC315
        </button>
df3c0f2b3da4atagen2026-10-22 13:07 UTC316
      {/if}
cf23dbf4e77catagen2026-10-23 06:36 UTC317
      {#if onEdit && editableBody !== null}
cf23dbf4e77catagen2026-10-23 06:36 UTC318
        <button type="button" title="Edit" aria-label="Edit your message" on:click|stopPropagation={edit}>
cf23dbf4e77catagen2026-10-23 06:36 UTC319
          ✎
cf23dbf4e77catagen2026-10-23 06:36 UTC320
        </button>
cf23dbf4e77catagen2026-10-23 06:36 UTC321
      {/if}
0380cd8c765catagen2026-10-24 09:08 UTC322
      {#if onMore}
0380cd8c765catagen2026-10-24 09:08 UTC323
        <button
0380cd8c765catagen2026-10-24 09:08 UTC324
          type="button"
0380cd8c765catagen2026-10-24 09:08 UTC325
          title="More"
0380cd8c765catagen2026-10-24 09:08 UTC326
          aria-label={`More actions for message from ${displayName}`}
0380cd8c765catagen2026-10-24 09:08 UTC327
          aria-haspopup="menu"
0380cd8c765catagen2026-10-24 09:08 UTC328
          on:click|stopPropagation={(ev) => onMore?.(event, ev.clientX, ev.clientY)}
0380cd8c765catagen2026-10-24 09:08 UTC329
        >
0380cd8c765catagen2026-10-24 09:08 UTC330
          ⋯
0380cd8c765catagen2026-10-24 09:08 UTC331
        </button>
0380cd8c765catagen2026-10-24 09:08 UTC332
      {/if}
544a170ead2catagen2026-10-20 11:47 UTC333
    </div>
544a170ead2catagen2026-10-20 11:47 UTC334
    {#if pickerOpen}
544a170ead2catagen2026-10-20 11:47 UTC335
      <div class="picker-pop" style={pickerStyle} bind:this={pickerPop}>
ecb8598b38afatagen2026-10-22 09:19 UTC336
        <ReactionPicker {packs} quick={quickReactions} onPick={pick} {onQuickChange} onClose={closePicker} />
544a170ead2catagen2026-10-20 11:47 UTC337
      </div>
544a170ead2catagen2026-10-20 11:47 UTC338
    {/if}
544a170ead2catagen2026-10-20 11:47 UTC339
  {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC340
  {#if showSender}
d8624c214c04atagen2026-10-24 08:24 UTC341
    <button
d8624c214c04atagen2026-10-24 08:24 UTC342
      type="button"
d8624c214c04atagen2026-10-24 08:24 UTC343
      class="user-hit"
d8624c214c04atagen2026-10-24 08:24 UTC344
      tabindex="-1"
d8624c214c04atagen2026-10-24 08:24 UTC345
      aria-hidden="true"
d8624c214c04atagen2026-10-24 08:24 UTC346
      on:click|stopPropagation={(ev) => openUser(ev, false)}
d8624c214c04atagen2026-10-24 08:24 UTC347
      on:contextmenu|preventDefault|stopPropagation={(ev) => openUser(ev, true)}
d8624c214c04atagen2026-10-24 08:24 UTC348
    >
d8624c214c04atagen2026-10-24 08:24 UTC349
      {#if senderAvatar}
d8624c214c04atagen2026-10-24 08:24 UTC350
        <MxcAvatar mxc={senderAvatar} label={name} size={34} />
d8624c214c04atagen2026-10-24 08:24 UTC351
      {:else}
d8624c214c04atagen2026-10-24 08:24 UTC352
        <span class="avatar" style={`background:hsl(${senderHue(event.sender.user_id)} 35% 32%)`}>
d8624c214c04atagen2026-10-24 08:24 UTC353
          {initialsOf(name)}
d8624c214c04atagen2026-10-24 08:24 UTC354
        </span>
d8624c214c04atagen2026-10-24 08:24 UTC355
      {/if}
d8624c214c04atagen2026-10-24 08:24 UTC356
    </button>
973f8fbdaf80atagen2026-09-28 09:10 UTC357
  {:else}
973f8fbdaf80atagen2026-09-28 09:10 UTC358
    <div class="avatar-spacer" aria-hidden="true">
973f8fbdaf80atagen2026-09-28 09:10 UTC359
      <span class="hover-time">{formatClock(event.timestamp_ms)}</span>
973f8fbdaf80atagen2026-09-28 09:10 UTC360
    </div>
973f8fbdaf80atagen2026-09-28 09:10 UTC361
  {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC362
  <div class="msg-body">
973f8fbdaf80atagen2026-09-28 09:10 UTC363
    {#if showSender}
973f8fbdaf80atagen2026-09-28 09:10 UTC364
      <div class="msg-head">
d8624c214c04atagen2026-10-24 08:24 UTC365
        <button
d8624c214c04atagen2026-10-24 08:24 UTC366
          type="button"
d8624c214c04atagen2026-10-24 08:24 UTC367
          class="sender"
d8624c214c04atagen2026-10-24 08:24 UTC368
          style={`color:hsl(${senderHue(event.sender.user_id)} 70% var(--name-lightness))`}
d8624c214c04atagen2026-10-24 08:24 UTC369
          on:click|stopPropagation={(ev) => openUser(ev, false)}
d8624c214c04atagen2026-10-24 08:24 UTC370
          on:contextmenu|preventDefault|stopPropagation={(ev) => openUser(ev, true)}
d8624c214c04atagen2026-10-24 08:24 UTC371
        >
973f8fbdaf80atagen2026-09-28 09:10 UTC372
          {displayName}
d8624c214c04atagen2026-10-24 08:24 UTC373
        </button>
973f8fbdaf80atagen2026-09-28 09:10 UTC374
        <time class="time" datetime={new Date(event.timestamp_ms).toISOString()}>
973f8fbdaf80atagen2026-09-28 09:10 UTC375
          {formatDay(event.timestamp_ms)} {formatClock(event.timestamp_ms)}
973f8fbdaf80atagen2026-09-28 09:10 UTC376
        </time>
973f8fbdaf80atagen2026-09-28 09:10 UTC377
        {#if event.content.kind === 'Message' && event.content.message.edited}
973f8fbdaf80atagen2026-09-28 09:10 UTC378
          <span class="edited" title="Edited">(edited)</span>
973f8fbdaf80atagen2026-09-28 09:10 UTC379
        {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC380
      </div>
973f8fbdaf80atagen2026-09-28 09:10 UTC381
    {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC382
    {#if event.reply_to}
df3c0f2b3da4atagen2026-10-22 13:07 UTC383
      {@const target = event.reply_to.event_id}
df3c0f2b3da4atagen2026-10-22 13:07 UTC384
      <button
df3c0f2b3da4atagen2026-10-22 13:07 UTC385
        type="button"
df3c0f2b3da4atagen2026-10-22 13:07 UTC386
        class="reply-quote"
df3c0f2b3da4atagen2026-10-22 13:07 UTC387
        disabled={!onJump}
df3c0f2b3da4atagen2026-10-22 13:07 UTC388
        title="Jump to the original message"
df3c0f2b3da4atagen2026-10-22 13:07 UTC389
        on:click|stopPropagation={() => onJump?.(target)}
df3c0f2b3da4atagen2026-10-22 13:07 UTC390
      >
973f8fbdaf80atagen2026-09-28 09:10 UTC391
        {#if event.reply_to.details.kind === 'Ready'}
f604ef6df0c4atagen2026-10-24 10:08 UTC392
          <span class="reply-sender">{event.reply_to.details.sender.display_name ?? people[event.reply_to.details.sender.user_id]?.name ?? senderLabel(event.reply_to.details.sender)}</span>
df3c0f2b3da4atagen2026-10-22 13:07 UTC393
          <span class="reply-text"><EmojiText text={replyPreview(event.reply_to.details.content)} /></span>
973f8fbdaf80atagen2026-09-28 09:10 UTC394
        {:else if event.reply_to.details.kind === 'Pending'}
973f8fbdaf80atagen2026-09-28 09:10 UTC395
          Loading reply…
973f8fbdaf80atagen2026-09-28 09:10 UTC396
        {:else}
973f8fbdaf80atagen2026-09-28 09:10 UTC397
          Reply unavailable
973f8fbdaf80atagen2026-09-28 09:10 UTC398
        {/if}
df3c0f2b3da4atagen2026-10-22 13:07 UTC399
      </button>
973f8fbdaf80atagen2026-09-28 09:10 UTC400
    {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC401
973f8fbdaf80atagen2026-09-28 09:10 UTC402
    {#if event.content.kind === 'Message'}
973f8fbdaf80atagen2026-09-28 09:10 UTC403
      {@const m = event.content.message}
705b1e1062c2atagen2026-10-23 09:05 UTC404
      {#if stripped.text}
05a48e9e7942atagen2026-10-24 09:32 UTC405
        <div class="text" class:emote={m.kind === 'Emote'} class:notice={m.kind === 'Notice' || m.kind === 'ServerNotice'}>{#if m.kind === 'Emote'}* {displayName} {/if}<MessageText text={stripped.text} html={m.formatted_body} jumbo={m.kind === 'Text'} {mentions} {self} nameOf={(id) => people[id]?.name ?? null} />{#if m.edited && !showSender}<span class="edited" title="Edited">(edited)</span>{/if}</div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC406
      {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC407
      {#if m.media}
973f8fbdaf80atagen2026-09-28 09:10 UTC408
        <MediaAttachmentView attachment={m.media} />
973f8fbdaf80atagen2026-09-28 09:10 UTC409
      {/if}
705b1e1062c2atagen2026-10-23 09:05 UTC410
      {#if cards.length > 0}
973f8fbdaf80atagen2026-09-28 09:10 UTC411
        <div class="link-previews">
705b1e1062c2atagen2026-10-23 09:05 UTC412
          {#each cards as card (card.link.href)}
705b1e1062c2atagen2026-10-23 09:05 UTC413
            <LinkCard link={card.link} preview={card.preview} />
973f8fbdaf80atagen2026-09-28 09:10 UTC414
          {/each}
973f8fbdaf80atagen2026-09-28 09:10 UTC415
        </div>
973f8fbdaf80atagen2026-09-28 09:10 UTC416
      {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC417
    {:else if event.content.kind === 'Sticker'}
973f8fbdaf80atagen2026-09-28 09:10 UTC418
      {#if event.content.media}
973f8fbdaf80atagen2026-09-28 09:10 UTC419
        <MediaAttachmentView attachment={event.content.media} />
dfd1feaae855atagen2026-10-24 10:54 UTC420
      {:else if event.content.body}<p class="text"><EmojiText text={event.content.body} /></p>{/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC421
    {:else if event.content.kind === 'Poll'}
973f8fbdaf80atagen2026-09-28 09:10 UTC422
      <p class="text">📊 {event.content.question}</p>
973f8fbdaf80atagen2026-09-28 09:10 UTC423
    {:else}
f604ef6df0c4atagen2026-10-24 10:08 UTC424
      <p class="system-line">{systemLine(event.content, displayName)}</p>
973f8fbdaf80atagen2026-09-28 09:10 UTC425
    {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC426
973f8fbdaf80atagen2026-09-28 09:10 UTC427
    {#if interactive && event.reactions.length > 0}
973f8fbdaf80atagen2026-09-28 09:10 UTC428
      <div class="reactions" aria-label="Reactions">
973f8fbdaf80atagen2026-09-28 09:10 UTC429
        {#each event.reactions as r (r.key)}
973f8fbdaf80atagen2026-09-28 09:10 UTC430
          <button
973f8fbdaf80atagen2026-09-28 09:10 UTC431
            type="button"
973f8fbdaf80atagen2026-09-28 09:10 UTC432
            class="reaction"
973f8fbdaf80atagen2026-09-28 09:10 UTC433
            class:mine={r.own}
d4c0d65f690aatagen2026-10-24 12:50 UTC434
            aria-label={`${r.shortcode ? `:${r.shortcode}:` : r.key.startsWith('mxc://') ? 'custom emote' : r.key}, ${r.count} reaction${r.count === 1 ? '' : 's'}`}
973f8fbdaf80atagen2026-09-28 09:10 UTC435
            disabled={!event.event_id || reacting}
973f8fbdaf80atagen2026-09-28 09:10 UTC436
            on:click={() => event.event_id && onReact(event.event_id, r.key)}
973f8fbdaf80atagen2026-09-28 09:10 UTC437
          >
ecb8598b38afatagen2026-10-22 09:19 UTC438
            {#if r.image}
ecb8598b38afatagen2026-10-22 09:19 UTC439
              <img class="emote" src={messageMediaUrl(r.image, 'Thumbnail')} alt={r.shortcode ?? ''} title={r.shortcode ?? ''} />
ecb8598b38afatagen2026-10-22 09:19 UTC440
            {:else if r.key.startsWith('mxc://')}
544a170ead2catagen2026-10-20 11:47 UTC441
              <img class="emote" src={mediaUrl(r.key) ?? ''} alt="" />
544a170ead2catagen2026-10-20 11:47 UTC442
            {:else}
544a170ead2catagen2026-10-20 11:47 UTC443
              <Emoji emoji={r.key} size={16} />
544a170ead2catagen2026-10-20 11:47 UTC444
            {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC445
            <span class="count">{r.count}</span>
cf23dbf4e77catagen2026-10-23 06:36 UTC446
            <span class="reactors" role="tooltip" id={`${itemId}-reactors-${r.key}`}>
cf23dbf4e77catagen2026-10-23 06:36 UTC447
              <span class="reactors-key">{r.shortcode ? `:${r.shortcode}:` : r.key.startsWith('mxc://') ? 'custom emote' : r.key}</span>
cf23dbf4e77catagen2026-10-23 06:36 UTC448
              {reactorNames(r.senders)}
cf23dbf4e77catagen2026-10-23 06:36 UTC449
            </span>
973f8fbdaf80atagen2026-09-28 09:10 UTC450
          </button>
973f8fbdaf80atagen2026-09-28 09:10 UTC451
        {/each}
973f8fbdaf80atagen2026-09-28 09:10 UTC452
      </div>
973f8fbdaf80atagen2026-09-28 09:10 UTC453
    {/if}
f604ef6df0c4atagen2026-10-24 10:08 UTC454
    {#if sent}<span class="sent-tick" title="Sent" aria-label="Sent">✓</span>{/if}
df3c0f2b3da4atagen2026-10-22 13:07 UTC455
    {#if interactive && sendLabel(event.send_state)}
973f8fbdaf80atagen2026-09-28 09:10 UTC456
      <div class="msg-foot">
df3c0f2b3da4atagen2026-10-22 13:07 UTC457
        <span class="sendstate" class:failed={event.send_state.kind === 'Failed'}>{sendLabel(event.send_state)}</span>
df3c0f2b3da4atagen2026-10-22 13:07 UTC458
      </div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC459
    {/if}
df3c0f2b3da4atagen2026-10-22 13:07 UTC460
    {#if interactive && readers.length > 0}
df3c0f2b3da4atagen2026-10-22 13:07 UTC461
      {@const seenBy = `Seen by ${readers.map((r) => r.name).join(', ')}`}
df3c0f2b3da4atagen2026-10-22 13:07 UTC462
      <div class="readby" title={seenBy} aria-label={seenBy} role="img">
df3c0f2b3da4atagen2026-10-22 13:07 UTC463
        {#each readers.slice(0, MAX_READERS) as r (r.user_id)}
df3c0f2b3da4atagen2026-10-22 13:07 UTC464
          <MxcAvatar mxc={r.avatar} label={r.name} size={16} />
df3c0f2b3da4atagen2026-10-22 13:07 UTC465
        {/each}
df3c0f2b3da4atagen2026-10-22 13:07 UTC466
        {#if readers.length > MAX_READERS}<span class="more">+{readers.length - MAX_READERS}</span>{/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC467
      </div>
973f8fbdaf80atagen2026-09-28 09:10 UTC468
    {/if}
973f8fbdaf80atagen2026-09-28 09:10 UTC469
  </div>
973f8fbdaf80atagen2026-09-28 09:10 UTC470
</div>
973f8fbdaf80atagen2026-09-28 09:10 UTC471
973f8fbdaf80atagen2026-09-28 09:10 UTC472
<style>
df3c0f2b3da4atagen2026-10-22 13:07 UTC473
  .msg { position: relative; display: flex; gap: 10px; padding: var(--msg-gap, 3px) 0; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC474
  .msg:hover, .msg.selected { background: var(--hover-faint); }
544a170ead2catagen2026-10-20 11:47 UTC475
  .msg:hover .hover-time, .msg.selected .hover-time { opacity: 1; }
544a170ead2catagen2026-10-20 11:47 UTC476
  .msg-foot { display: flex; align-items: center; gap: 8px; }
973f8fbdaf80atagen2026-09-28 09:10 UTC477
  .sendstate { font-size: 11px; color: var(--muted); }
f604ef6df0c4atagen2026-10-24 10:08 UTC478
  .sent-tick { position: absolute; right: 12px; bottom: 4px; font-size: 11px; color: var(--muted); }
973f8fbdaf80atagen2026-09-28 09:10 UTC479
  .sendstate.failed { color: var(--danger); }
973f8fbdaf80atagen2026-09-28 09:10 UTC480
  .link-previews { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 420px; }
973f8fbdaf80atagen2026-09-28 09:10 UTC481
  .avatar {
973f8fbdaf80atagen2026-09-28 09:10 UTC482
    flex: none;
973f8fbdaf80atagen2026-09-28 09:10 UTC483
    width: 34px; height: 34px;
973f8fbdaf80atagen2026-09-28 09:10 UTC484
    border-radius: 50%;
973f8fbdaf80atagen2026-09-28 09:10 UTC485
    display: grid; place-items: center;
973f8fbdaf80atagen2026-09-28 09:10 UTC486
    font-size: 12px; font-weight: 700; color: #fff;
973f8fbdaf80atagen2026-09-28 09:10 UTC487
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC488
  .avatar-spacer { flex: none; width: 34px; padding-top: 2px; text-align: center; }
973f8fbdaf80atagen2026-09-28 09:10 UTC489
  .hover-time { opacity: 0; font-size: 10.5px; color: var(--muted); }
973f8fbdaf80atagen2026-09-28 09:10 UTC490
  .msg-body { min-width: 0; flex: 1; }
973f8fbdaf80atagen2026-09-28 09:10 UTC491
  .msg-head { display: flex; align-items: baseline; gap: 8px; }
d8624c214c04atagen2026-10-24 08:24 UTC492
  .sender { font-weight: 650; font-size: 13.5px; padding: 0; border: none; background: none; font-family: inherit; cursor: pointer; }
d8624c214c04atagen2026-10-24 08:24 UTC493
  .sender:hover { text-decoration: underline; }
d8624c214c04atagen2026-10-24 08:24 UTC494
  .user-hit { flex: none; align-self: flex-start; padding: 0; border: none; background: none; border-radius: 50%; cursor: pointer; }
973f8fbdaf80atagen2026-09-28 09:10 UTC495
  .time, .edited { color: var(--muted); font-size: 11.5px; }
cf23dbf4e77catagen2026-10-23 06:36 UTC496
  .text .edited { margin-left: 6px; }
cf23dbf4e77catagen2026-10-23 06:36 UTC497
  .msg.editing { background: color-mix(in srgb, var(--accent) 10%, transparent); }
705b1e1062c2atagen2026-10-23 09:05 UTC498
  .msg.mentioned { background: color-mix(in srgb, var(--warn) 8%, transparent); box-shadow: inset 2px 0 0 var(--warn); }
973f8fbdaf80atagen2026-09-28 09:10 UTC499
  .reply-quote {
df3c0f2b3da4atagen2026-10-22 13:07 UTC500
    display: flex; gap: 6px; align-items: baseline;
df3c0f2b3da4atagen2026-10-22 13:07 UTC501
    max-width: min(100%, 520px);
df3c0f2b3da4atagen2026-10-22 13:07 UTC502
    border: none;
973f8fbdaf80atagen2026-09-28 09:10 UTC503
    border-left: 2px solid var(--accent);
973f8fbdaf80atagen2026-09-28 09:10 UTC504
    padding: 2px 8px;
973f8fbdaf80atagen2026-09-28 09:10 UTC505
    margin: 2px 0 4px;
973f8fbdaf80atagen2026-09-28 09:10 UTC506
    color: var(--muted);
973f8fbdaf80atagen2026-09-28 09:10 UTC507
    font-size: 12.5px;
df3c0f2b3da4atagen2026-10-22 13:07 UTC508
    text-align: left;
973f8fbdaf80atagen2026-09-28 09:10 UTC509
    background: var(--bg-soft);
05a48e9e7942atagen2026-10-24 09:32 UTC510
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
df3c0f2b3da4atagen2026-10-22 13:07 UTC511
    cursor: pointer;
973f8fbdaf80atagen2026-09-28 09:10 UTC512
  }
df3c0f2b3da4atagen2026-10-22 13:07 UTC513
  .reply-quote:disabled { cursor: default; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC514
  .reply-quote:hover:not(:disabled) { color: var(--text); }
df3c0f2b3da4atagen2026-10-22 13:07 UTC515
  .reply-sender { flex: none; font-weight: 650; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC516
  .reply-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC517
  :global(.msg.flash) { animation: reply-flash 1.2s ease-out; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC518
  @keyframes -global-reply-flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } }
973f8fbdaf80atagen2026-09-28 09:10 UTC519
  .text {
973f8fbdaf80atagen2026-09-28 09:10 UTC520
    margin: 1px 0 2px;
973f8fbdaf80atagen2026-09-28 09:10 UTC521
    font-size: 14px;
df3c0f2b3da4atagen2026-10-22 13:07 UTC522
    line-height: var(--msg-line-height, 1.5);
973f8fbdaf80atagen2026-09-28 09:10 UTC523
    white-space: pre-wrap;
973f8fbdaf80atagen2026-09-28 09:10 UTC524
    overflow-wrap: anywhere;
973f8fbdaf80atagen2026-09-28 09:10 UTC525
  }
973f8fbdaf80atagen2026-09-28 09:10 UTC526
  .text.emote { font-style: italic; color: var(--muted); }
973f8fbdaf80atagen2026-09-28 09:10 UTC527
  .text.notice { color: var(--muted); }
973f8fbdaf80atagen2026-09-28 09:10 UTC528
  .system-line { color: var(--muted); font-size: 12.5px; font-style: italic; margin: 1px 0; }
f604ef6df0c4atagen2026-10-24 10:08 UTC529
  .msg.system { opacity: 0.85; --msg-gap: 1.5px; }
f604ef6df0c4atagen2026-10-24 10:08 UTC530
  .msg.system .avatar-spacer { height: 0; padding-top: 0; }
dfd1feaae855atagen2026-10-24 10:54 UTC531
  .reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: max(4px, var(--msg-gap, 3px)); }
973f8fbdaf80atagen2026-09-28 09:10 UTC532
  .reaction {
973f8fbdaf80atagen2026-09-28 09:10 UTC533
    display: inline-flex; align-items: center; gap: 4px;
973f8fbdaf80atagen2026-09-28 09:10 UTC534
    background: var(--bg-soft);
973f8fbdaf80atagen2026-09-28 09:10 UTC535
    border: 1px solid var(--border);
05a48e9e7942atagen2026-10-24 09:32 UTC536
    border-radius: var(--r-sm);
973f8fbdaf80atagen2026-09-28 09:10 UTC537
    padding: 1px 8px;
973f8fbdaf80atagen2026-09-28 09:10 UTC538
    font-size: 13px;
973f8fbdaf80atagen2026-09-28 09:10 UTC539
    color: var(--text);
973f8fbdaf80atagen2026-09-28 09:10 UTC540
    cursor: pointer;
973f8fbdaf80atagen2026-09-28 09:10 UTC541
  }
cf23dbf4e77catagen2026-10-23 06:36 UTC542
  .reaction { position: relative; }
cf23dbf4e77catagen2026-10-23 06:36 UTC543
  .reactors {
cf23dbf4e77catagen2026-10-23 06:36 UTC544
    position: absolute;
cf23dbf4e77catagen2026-10-23 06:36 UTC545
    left: 0;
cf23dbf4e77catagen2026-10-23 06:36 UTC546
    bottom: calc(100% + 6px);
cf23dbf4e77catagen2026-10-23 06:36 UTC547
    z-index: 15;
cf23dbf4e77catagen2026-10-23 06:36 UTC548
    display: none;
cf23dbf4e77catagen2026-10-23 06:36 UTC549
    width: max-content;
cf23dbf4e77catagen2026-10-23 06:36 UTC550
    max-width: 260px;
cf23dbf4e77catagen2026-10-23 06:36 UTC551
    padding: 6px 9px;
cf23dbf4e77catagen2026-10-23 06:36 UTC552
    border: 1px solid var(--border);
05a48e9e7942atagen2026-10-24 09:32 UTC553
    border-radius: var(--r-md);
cf23dbf4e77catagen2026-10-23 06:36 UTC554
    background: var(--panel-2);
cf23dbf4e77catagen2026-10-23 06:36 UTC555
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.3);
cf23dbf4e77catagen2026-10-23 06:36 UTC556
    color: var(--text);
cf23dbf4e77catagen2026-10-23 06:36 UTC557
    font-size: 12px;
cf23dbf4e77catagen2026-10-23 06:36 UTC558
    line-height: 1.35;
cf23dbf4e77catagen2026-10-23 06:36 UTC559
    text-align: left;
cf23dbf4e77catagen2026-10-23 06:36 UTC560
    white-space: normal;
cf23dbf4e77catagen2026-10-23 06:36 UTC561
    pointer-events: none;
cf23dbf4e77catagen2026-10-23 06:36 UTC562
  }
cf23dbf4e77catagen2026-10-23 06:36 UTC563
  .reactors-key { display: block; color: var(--muted); font-size: 11px; }
cf23dbf4e77catagen2026-10-23 06:36 UTC564
  .reaction:hover .reactors, .reaction:focus-visible .reactors { display: block; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC565
  .reaction.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
973f8fbdaf80atagen2026-09-28 09:10 UTC566
  .reaction:disabled { cursor: default; opacity: 0.85; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC567
  .msg.has-readers .msg-body { padding-right: 72px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC568
  .readby { position: absolute; right: 12px; bottom: 4px; display: flex; align-items: center; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC569
  .readby > :global(* + *) { margin-left: -4px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC570
  .readby :global(.mxc-avatar), .readby :global(.mxc-fallback) { box-shadow: 0 0 0 1.5px var(--bg); }
df3c0f2b3da4atagen2026-10-22 13:07 UTC571
  .readby .more { margin-left: 3px; font-size: 10.5px; color: var(--muted); }
544a170ead2catagen2026-10-20 11:47 UTC572
  .actions {
05a48e9e7942atagen2026-10-24 09:32 UTC573
    position: absolute; top: -12px; right: 10px; z-index: 2;
544a170ead2catagen2026-10-20 11:47 UTC574
    display: flex; gap: 2px;
544a170ead2catagen2026-10-20 11:47 UTC575
    padding: 2px;
544a170ead2catagen2026-10-20 11:47 UTC576
    background: var(--bg-soft);
544a170ead2catagen2026-10-20 11:47 UTC577
    border: 1px solid var(--border);
05a48e9e7942atagen2026-10-24 09:32 UTC578
    border-radius: var(--r-md);
544a170ead2catagen2026-10-20 11:47 UTC579
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
544a170ead2catagen2026-10-20 11:47 UTC580
    opacity: 0;
d4c0d65f690aatagen2026-10-24 12:50 UTC581
    visibility: hidden;
544a170ead2catagen2026-10-20 11:47 UTC582
    pointer-events: none;
544a170ead2catagen2026-10-20 11:47 UTC583
  }
d4c0d65f690aatagen2026-10-24 12:50 UTC584
  .msg:hover .actions, .msg:focus-within .actions, .msg.selected .actions { opacity: 1; visibility: visible; pointer-events: auto; }
d4c0d65f690aatagen2026-10-24 12:50 UTC585
  :global(.timeline-inner:has(.msg.selected)) .msg:not(.selected) .actions { opacity: 0; visibility: hidden; pointer-events: none; }
544a170ead2catagen2026-10-20 11:47 UTC586
  .actions button {
973f8fbdaf80atagen2026-09-28 09:10 UTC587
    background: transparent;
973f8fbdaf80atagen2026-09-28 09:10 UTC588
    border: 1px solid transparent;
05a48e9e7942atagen2026-10-24 09:32 UTC589
    border-radius: var(--r-sm);
973f8fbdaf80atagen2026-09-28 09:10 UTC590
    cursor: pointer;
544a170ead2catagen2026-10-20 11:47 UTC591
    font-size: 14px;
544a170ead2catagen2026-10-20 11:47 UTC592
    padding: 1px 5px;
973f8fbdaf80atagen2026-09-28 09:10 UTC593
  }
df3c0f2b3da4atagen2026-10-22 13:07 UTC594
  .actions button:hover:not(:disabled) { border-color: var(--border); background: var(--hover); }
544a170ead2catagen2026-10-20 11:47 UTC595
  .actions button:disabled { opacity: 0.4; cursor: default; }
544a170ead2catagen2026-10-20 11:47 UTC596
  .emote { width: 1.3em; height: 1.3em; object-fit: contain; vertical-align: middle; }
05a48e9e7942atagen2026-10-24 09:32 UTC597
  .picker-pop { position: fixed; z-index: 60; width: 320px; max-width: calc(100vw - 16px); animation: pop-in var(--pop); }
973f8fbdaf80atagen2026-09-28 09:10 UTC598
</style>