//! Chat — the rules a conversation is made of, ported from//! `packages/core/src/messages/*`.//!//! Eleven small modules and one rule between them: **a message row is written//! once and read in N files**. Everything here follows from that. The preview//! line, the group-event sentence, the tick a bubble draws, the id a reaction//! gets — each has exactly ONE implementation, because the relay writes the//! same row into every member's file and two spellings of any of them would//! show up as one member's copy of a conversation quietly disagreeing with//! another's.//!//! Pure, like the rest of the crate: no clock, no locale, no store. The English//! strings are English by DESIGN and not by locale — the server imports these//! rules and has no catalog — and every instant arrives as an argument.//!//! ## Where the shared row shapes live//!//! The TypeScript keeps [`MessageMedia`], [`MessageMeta`] and [`GroupEvent`] in//! `packages/core/src/models/message/types.ts`, one file over from the rules//! that read them. Several modules here read them ([`preview`] the media and//! the poll, [`group_event`] the system field, [`apply_message_write`] both), so//! they are declared HERE rather than inside whichever module happened to need//! them first — the same reason the TypeScript gave them their own file.//!//! ## Two things a reader of this tree must know//!//! * **Every cap and every index is in UTF-16 code units.**//! `String.prototype.length` and `.slice` count them, so a 140-character//! preview cut at a code point would be a different string the moment an emoji//! is in it. Ports here use `encode_utf16`, never bytes and never `chars()`,//! and say so at the cap.//! * **Every trim is ECMAScript's whitespace class**//! ([`cotton_store::protocol::js::is_js_whitespace`]), which trims U+FEFF and//! does NOT trim U+0085 — Rust's `str::trim` has it exactly the other way//! round.pubuse cotton_rules::messages::{GroupEvent, MessageLinkPreview, MessageMedia, MessageMediaContact, MessageMeta,MessageMetaAttachment, MessagePoll, MessagePollOption, MessagePollVoter, MessageSource, MessageSystem,};#[allow(unused_imports)]pub(crate) use cotton_rules::messages::{slice_utf16, truthy_number, truthy_str, units_to_string, utf16_len, utf16_units};pubuse cotton_rules::messages::js_trim;/// Re-exported so a caller reads the media kind as the enum the registry/// declares rather than as a bare string.pubusecrate::constants::MessageMediaKindasMediaKind;pubmod app;pubmod apply_message_write;pubmod display;pubmod edit_window;pubmod group_event;pubuse cotton_rules::chat_ids as ids;pubmod limits;pubmod links;pubmod mentions;pubuse cotton_rules::messages::media_only;pubuse cotton_rules::messages::preview;pubmod members;pubmod resolve_contact;pubmod send;pubmod sign_in;pubmod rail;pubmod stream;pubmod ticks;pubmod unread;