@celljs/ta-relay 4.21.0 → 4.23.0

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 (88) hide show
  1. package/esm/common/index.d.ts +3 -0
  2. package/esm/common/index.js +3 -0
  3. package/esm/common/relay-blobs.d.ts +36 -2
  4. package/esm/common/relay-blobs.js +33 -5
  5. package/esm/common/relay-chat-store.d.ts +59 -0
  6. package/esm/common/relay-chat-store.js +40 -0
  7. package/esm/common/relay-hub-charter.d.ts +7 -1
  8. package/esm/common/relay-hub-charter.js +6 -0
  9. package/esm/common/relay-hub-log.d.ts +65 -0
  10. package/esm/common/relay-hub-log.js +147 -0
  11. package/esm/common/relay-hub.d.ts +3 -0
  12. package/esm/common/relay-hub.js +18 -0
  13. package/esm/common/relay-hubs-admins.d.ts +1 -0
  14. package/esm/common/relay-hubs-admins.js +10 -6
  15. package/esm/common/relay-hubs-chats.d.ts +66 -0
  16. package/esm/common/relay-hubs-chats.js +342 -0
  17. package/esm/common/relay-hubs-connection.d.ts +3 -1
  18. package/esm/common/relay-hubs-connection.js +7 -0
  19. package/esm/common/relay-hubs-protocol.d.ts +14 -0
  20. package/esm/common/relay-hubs.d.ts +5 -2
  21. package/esm/common/relay-hubs.js +31 -13
  22. package/esm/common/relay-info.d.ts +23 -1
  23. package/esm/common/relay-info.js +25 -2
  24. package/esm/common/relay-protocol.d.ts +60 -1
  25. package/esm/common/relay-protocol.js +15 -0
  26. package/esm/common/relay-room-app.d.ts +106 -0
  27. package/esm/common/relay-room-app.js +171 -0
  28. package/esm/common/relay-room-chat.d.ts +126 -4
  29. package/esm/common/relay-room-chat.js +230 -6
  30. package/esm/guest/guest-i18n.d.ts +5 -0
  31. package/esm/guest/guest-i18n.js +20 -0
  32. package/esm/guest/guest-style.d.ts +1 -1
  33. package/esm/guest/guest-style.js +11 -0
  34. package/esm/guest/guest.js +84 -11
  35. package/esm/node/index.d.ts +1 -0
  36. package/esm/node/index.js +1 -0
  37. package/esm/node/relay-chat-files.d.ts +46 -0
  38. package/esm/node/relay-chat-files.js +199 -0
  39. package/esm/node/relay-hub-files.d.ts +11 -1
  40. package/esm/node/relay-hub-files.js +8 -1
  41. package/esm/node/relay-server.d.ts +7 -1
  42. package/esm/node/relay-server.js +23 -13
  43. package/lib/common/index.d.ts +3 -0
  44. package/lib/common/index.js +3 -0
  45. package/lib/common/relay-blobs.d.ts +36 -2
  46. package/lib/common/relay-blobs.js +34 -6
  47. package/lib/common/relay-chat-store.d.ts +60 -0
  48. package/lib/common/relay-chat-store.js +44 -0
  49. package/lib/common/relay-hub-charter.d.ts +7 -1
  50. package/lib/common/relay-hub-charter.js +7 -1
  51. package/lib/common/relay-hub-log.d.ts +66 -0
  52. package/lib/common/relay-hub-log.js +151 -0
  53. package/lib/common/relay-hub.d.ts +3 -0
  54. package/lib/common/relay-hub.js +18 -0
  55. package/lib/common/relay-hubs-admins.d.ts +1 -0
  56. package/lib/common/relay-hubs-admins.js +9 -5
  57. package/lib/common/relay-hubs-chats.d.ts +67 -0
  58. package/lib/common/relay-hubs-chats.js +346 -0
  59. package/lib/common/relay-hubs-connection.d.ts +3 -1
  60. package/lib/common/relay-hubs-connection.js +7 -0
  61. package/lib/common/relay-hubs-protocol.d.ts +14 -0
  62. package/lib/common/relay-hubs.d.ts +5 -2
  63. package/lib/common/relay-hubs.js +30 -12
  64. package/lib/common/relay-info.d.ts +23 -1
  65. package/lib/common/relay-info.js +26 -3
  66. package/lib/common/relay-protocol.d.ts +60 -1
  67. package/lib/common/relay-protocol.js +16 -1
  68. package/lib/common/relay-room-app.d.ts +107 -0
  69. package/lib/common/relay-room-app.js +176 -0
  70. package/lib/common/relay-room-chat.d.ts +126 -4
  71. package/lib/common/relay-room-chat.js +231 -7
  72. package/lib/guest/guest-i18n.d.ts +5 -0
  73. package/lib/guest/guest-i18n.js +20 -0
  74. package/lib/guest/guest-style.d.ts +1 -1
  75. package/lib/guest/guest-style.js +11 -0
  76. package/lib/guest/guest.js +83 -10
  77. package/lib/node/index.d.ts +1 -0
  78. package/lib/node/index.js +1 -0
  79. package/lib/node/relay-chat-files.d.ts +47 -0
  80. package/lib/node/relay-chat-files.js +203 -0
  81. package/lib/node/relay-hub-files.d.ts +11 -1
  82. package/lib/node/relay-hub-files.js +8 -1
  83. package/lib/node/relay-server.d.ts +7 -1
  84. package/lib/node/relay-server.js +21 -11
  85. package/package.json +3 -3
  86. package/viewer/join.html +17 -6
  87. package/viewer/page.html +10 -10
  88. package/viewer/room.html +26 -15
@@ -4,13 +4,26 @@ export interface RelayRoomChatValue {
4
4
  version: number;
5
5
  by: string;
6
6
  }
7
- /** What a chat reads and sets: RelayHubs, or TaRoomServer of Ta. */
7
+ /**
8
+ * What a chat reads and sets: RelayHubs, or TaRoomServer of Ta. With `readChat` and `say`, what is said is the log of
9
+ * the room, kept on this computer (docs/design/ta-chat-history.md); without them (a Ta service of before), the state.
10
+ */
8
11
  export interface RelayRoomChatRooms {
9
12
  getState(room: string, prefix?: string): Promise<Record<string, RelayRoomChatValue>>;
10
13
  setState(room: string, key: string, value: unknown, version?: number): Promise<{
11
14
  ok: boolean;
12
15
  version: number;
13
16
  }>;
17
+ /** The latest lines kept, before the line `before` (its id) when given, the earliest first: `more` when there are older. */
18
+ readChat?(room: string, options?: {
19
+ before?: string;
20
+ limit?: number;
21
+ }): Promise<{
22
+ lines: RelayChatLine[];
23
+ more: boolean;
24
+ }>;
25
+ /** Says it as this Ta: the line, `pending` till the relay has it. */
26
+ say?(room: string, text: string, extra?: RelayChatLineExtra): Promise<RelayChatLine | undefined>;
14
27
  }
15
28
  /** One thing said in a room. */
16
29
  export interface RelayChatLine {
@@ -48,16 +61,85 @@ export interface RelayChatLine {
48
61
  * its own, says how it goes under `tasks:<member>` of the state, and answers with `re` when it ends.
49
62
  */
50
63
  task?: boolean;
64
+ /**
65
+ * Pictures sent with it (docs/design/ta-composer.md 3): what they are, not their bytes, which stay on the computers of
66
+ * the members (the sender's, and each one's that fetched them) and go from one to another through the room, sealed.
67
+ */
68
+ images?: RelayChatImage[];
69
+ /**
70
+ * Files, a voice message or a video sent with it (docs/design/ta-chat-history.md 7): what they are, not their
71
+ * bytes, which go from member to member through the room and are never kept on the relay.
72
+ */
73
+ files?: RelayChatFile[];
74
+ /** Its number in the log of the room; none for a line of before the log, or one not sent yet. */
75
+ seq?: number;
76
+ /** Said here, not yet taken by the relay: it goes once it can. */
77
+ pending?: true;
78
+ /** Said here, refused by the relay (too large): it never went. */
79
+ failed?: true;
80
+ }
81
+ /**
82
+ * A picture of a line (RelayChatLine.images): its id among the pictures of the sender, its type, size and the SHA-256 of
83
+ * its bytes, which whoever fetches it checks; a blurred thumbnail of a few hundred bytes to show until it comes.
84
+ */
85
+ export interface RelayChatImage {
86
+ id: string;
87
+ type: string;
88
+ w: number;
89
+ h: number;
90
+ bytes: number;
91
+ sha: string;
92
+ thumb?: string;
93
+ /**
94
+ * A copy on the relay of the room while it lasts (docs/design/ta-chat-history.md 7), for whoever comes when no
95
+ * member who has it is online: its id there, what reads it and what opens it (AES-256-GCM), till when.
96
+ */
97
+ blob?: RelayChatBlob;
98
+ }
99
+ /** A sealed copy of a picture on the relay (RelayChatImage.blob): the relay reads neither it nor what opens it. */
100
+ export interface RelayChatBlob {
101
+ id: string;
102
+ /** base64url, 32 bytes: the token that reads it (the relay keeps its SHA-256). */
103
+ read: string;
104
+ /** base64url, 32 bytes: the key it is sealed with. */
105
+ key: string;
106
+ until: number;
107
+ }
108
+ /** What a file of a line is: any file, a voice message (`ms` long), a video (`ms` long, `w` × `h`, a blurred frame). */
109
+ export type RelayChatFileKind = 'file' | 'voice' | 'video';
110
+ /**
111
+ * A file of a line (RelayChatLine.files): its id among the files of the sender, its name, type, size and the SHA-256
112
+ * of its bytes, which whoever fetches it checks.
113
+ */
114
+ export interface RelayChatFile {
115
+ id: string;
116
+ kind: RelayChatFileKind;
117
+ name: string;
118
+ type: string;
119
+ bytes: number;
120
+ sha: string;
121
+ ms?: number;
122
+ w?: number;
123
+ h?: number;
124
+ thumb?: string;
51
125
  }
126
+ /** The bytes of a file of each kind at most: what passes between members in a minute or two. */
127
+ export declare const RELAY_CHAT_FILE_BYTES: Record<RelayChatFileKind, number>;
128
+ /** How long a voice message and a video are at most. */
129
+ export declare const RELAY_CHAT_VOICE_MS = 60000;
130
+ export declare const RELAY_CHAT_VIDEO_MS: number;
131
+ /** The files of a line at most. */
132
+ export declare const RELAY_CHAT_FILES = 9;
52
133
  /** An agent of a member's Ta, in a room (RelayChatLine.agent). */
53
134
  export interface RelayChatAgent {
54
135
  id: string;
55
136
  name: string;
56
137
  }
57
138
  /** What a line adds to its text: who said it and to whom (RelayRoomChat.say). */
58
- export type RelayChatLineExtra = Pick<RelayChatLine, 'double' | 'agent' | 'to' | 'person' | 're' | 'task'>;
59
- /** What is kept of a line: `from` is the key's. */
60
- type StoredLine = Omit<RelayChatLine, 'from'>;
139
+ export type RelayChatLineExtra = Pick<RelayChatLine, 'double' | 'agent' | 'to' | 'person' | 're' | 'task' | 'images' | 'files'>;
140
+ /** What is kept of a line, and what a member signs of it in the log: `from` is the key's, or the signer's. */
141
+ export type RelayChatStored = Omit<RelayChatLine, 'from' | 'seq' | 'pending' | 'failed'>;
142
+ type StoredLine = RelayChatStored;
61
143
  /** The keys of what is said, `chat:<member>:<n>`: each member writes only its own, so none can write as another. */
62
144
  export declare const RELAY_CHAT_KEY = "chat:";
63
145
  /** The bytes of JSON of one part at most, well under what the relay takes of a value once sealed. */
@@ -65,6 +147,14 @@ export declare const RELAY_CHAT_PART_BYTES: number;
65
147
  /** The parts of each member kept: the oldest is cleared as a new one starts. */
66
148
  export declare const RELAY_CHAT_PARTS = 6;
67
149
  export declare const RELAY_CHAT_TEXT_MAX = 2000;
150
+ /** The pictures of a line at most, as WeChat sends nine at once. */
151
+ export declare const RELAY_CHAT_IMAGES = 9;
152
+ /** The bytes of a picture at most. */
153
+ export declare const RELAY_CHAT_IMAGE_BYTES: number;
154
+ /** The characters of the data URL of a thumbnail at most. */
155
+ export declare const RELAY_CHAT_THUMB_CHARS = 900;
156
+ /** Lines a chat holds at once: the latest; older ones are read as the page asks (RelayRoomChat.older). */
157
+ export declare const RELAY_CHAT_WINDOW = 500;
68
158
  export declare namespace RelayRoomChatUtil {
69
159
  function key(member: string, part: number): string;
70
160
  function parse(key: string): {
@@ -75,8 +165,16 @@ export declare namespace RelayRoomChatUtil {
75
165
  function lines(member: string, value: unknown, by: string): RelayChatLine[] | undefined;
76
166
  /** What a stored line adds, as far as it is well formed. */
77
167
  function extra(line: Record<string, unknown>): RelayChatLineExtra;
168
+ /** The files of a stored line, as far as each is well formed. */
169
+ function files(value: unknown): Pick<RelayChatLine, 'files'>;
170
+ /** What a line says in a word where only text shows (the list of chats, a notice, a page of guests). */
171
+ function preview(line: Pick<RelayChatLine, 'text' | 'images' | 'files'>, picture: string, words?: Record<RelayChatFileKind, string>): string;
78
172
  function stored(lines: RelayChatLine[]): StoredLine[];
173
+ /** A line of the log, as its member signed it: well formed, or none. */
174
+ function signed(member: string, value: unknown, seq?: number): RelayChatLine | undefined;
79
175
  function bytes(lines: StoredLine[]): number;
176
+ /** An error of a call a Ta service of before does not know (JSON-RPC's method not found, or its words). */
177
+ function unknownMethod(error: unknown): boolean;
80
178
  function id(): string;
81
179
  }
82
180
  interface Part {
@@ -96,11 +194,34 @@ export declare class RelayRoomChat {
96
194
  protected readonly parts: Map<string, Part>;
97
195
  protected readonly listeners: Set<() => void>;
98
196
  protected all: readonly RelayChatLine[];
197
+ /** Older lines are kept than those read (the log, RelayRoomChatRooms.readChat). */
198
+ protected olderKept: boolean;
199
+ /**
200
+ * What is said is the log (RelayRoomChatRooms.readChat): until a Ta service of before, whose proxy names every
201
+ * method all the same, fails it; then the state, as before.
202
+ */
203
+ protected log: boolean;
99
204
  constructor(rooms: RelayRoomChatRooms, room: string);
100
205
  /** All that is said, the earliest first. */
101
206
  get lines(): readonly RelayChatLine[];
102
207
  subscribe(listener: () => void): () => void;
208
+ /** Whether there are older lines than those read: `older` reads them. */
209
+ get more(): boolean;
103
210
  load(): Promise<void>;
211
+ /** Lines before those read, a page of them: how many came. */
212
+ older(limit?: number): Promise<number>;
213
+ /**
214
+ * What happened in the room, as its event tells: a line of the log (`chat`), or a key of the state set (`state`,
215
+ * the chat of a Ta service of before). Whether it was of the chat.
216
+ */
217
+ hear(event: {
218
+ type: string;
219
+ room?: string;
220
+ key?: string;
221
+ line?: RelayChatLine;
222
+ } & Partial<RelayRoomChatValue>): boolean;
223
+ /** A line said or taken: one of the same id is replaced (sent, refused), a new one comes last. */
224
+ heardLine(line: RelayChatLine): void;
104
225
  /** A key of the room set, as its event tells: whether it was of the chat. */
105
226
  heard(key: string, value: RelayRoomChatValue): boolean;
106
227
  /**
@@ -115,6 +236,7 @@ export declare class RelayRoomChat {
115
236
  protected latest(member: string): Part | undefined;
116
237
  protected put(key: string, value: RelayRoomChatValue): void;
117
238
  protected changed(): void;
239
+ protected tell(): void;
118
240
  }
119
241
  export {};
120
242
  //# sourceMappingURL=relay-room-chat.d.ts.map
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelayRoomChat = exports.RelayRoomChatUtil = exports.RELAY_CHAT_TEXT_MAX = exports.RELAY_CHAT_PARTS = exports.RELAY_CHAT_PART_BYTES = exports.RELAY_CHAT_KEY = void 0;
3
+ exports.RelayRoomChat = exports.RelayRoomChatUtil = exports.RELAY_CHAT_WINDOW = exports.RELAY_CHAT_THUMB_CHARS = exports.RELAY_CHAT_IMAGE_BYTES = exports.RELAY_CHAT_IMAGES = exports.RELAY_CHAT_TEXT_MAX = exports.RELAY_CHAT_PARTS = exports.RELAY_CHAT_PART_BYTES = exports.RELAY_CHAT_KEY = exports.RELAY_CHAT_FILES = exports.RELAY_CHAT_VIDEO_MS = exports.RELAY_CHAT_VOICE_MS = exports.RELAY_CHAT_FILE_BYTES = void 0;
4
+ /** The bytes of a file of each kind at most: what passes between members in a minute or two. */
5
+ exports.RELAY_CHAT_FILE_BYTES = { file: 50 * 1024 * 1024, video: 30 * 1024 * 1024, voice: 2 * 1024 * 1024 };
6
+ /** How long a voice message and a video are at most. */
7
+ exports.RELAY_CHAT_VOICE_MS = 60000;
8
+ exports.RELAY_CHAT_VIDEO_MS = 3 * 60000;
9
+ /** The files of a line at most. */
10
+ exports.RELAY_CHAT_FILES = 9;
4
11
  /** The keys of what is said, `chat:<member>:<n>`: each member writes only its own, so none can write as another. */
5
12
  exports.RELAY_CHAT_KEY = 'chat:';
6
13
  /** The bytes of JSON of one part at most, well under what the relay takes of a value once sealed. */
@@ -8,6 +15,15 @@ exports.RELAY_CHAT_PART_BYTES = 8 * 1024;
8
15
  /** The parts of each member kept: the oldest is cleared as a new one starts. */
9
16
  exports.RELAY_CHAT_PARTS = 6;
10
17
  exports.RELAY_CHAT_TEXT_MAX = 2000;
18
+ /** The pictures of a line at most, as WeChat sends nine at once. */
19
+ exports.RELAY_CHAT_IMAGES = 9;
20
+ /** The bytes of a picture at most. */
21
+ exports.RELAY_CHAT_IMAGE_BYTES = 2 * 1024 * 1024;
22
+ /** The characters of the data URL of a thumbnail at most. */
23
+ exports.RELAY_CHAT_THUMB_CHARS = 900;
24
+ const IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
25
+ /** Lines a chat holds at once: the latest; older ones are read as the page asks (RelayRoomChat.older). */
26
+ exports.RELAY_CHAT_WINDOW = 500;
11
27
  const TRIES = 6;
12
28
  var RelayRoomChatUtil;
13
29
  (function (RelayRoomChatUtil) {
@@ -47,17 +63,141 @@ var RelayRoomChatUtil;
47
63
  ...(line.person === true && to.length && line.double !== true && !line.agent ? { person: true } : {}),
48
64
  ...(typeof line.re === 'string' ? { re: line.re } : {}),
49
65
  ...(line.task === true && to.length ? { task: true } : {}),
66
+ ...images(line.images),
67
+ ...files(line.files),
50
68
  };
51
69
  }
52
70
  RelayRoomChatUtil.extra = extra;
71
+ /** The files of a stored line, as far as each is well formed. */
72
+ function files(value) {
73
+ if (!Array.isArray(value)) {
74
+ return {};
75
+ }
76
+ const files = [];
77
+ for (const file of value.slice(0, exports.RELAY_CHAT_FILES)) {
78
+ const kind = file === null || file === void 0 ? void 0 : file.kind;
79
+ if (!file ||
80
+ (kind !== 'file' && kind !== 'voice' && kind !== 'video') ||
81
+ typeof file.id !== 'string' ||
82
+ !/^[a-f0-9]{24}$/.test(file.id) ||
83
+ typeof file.sha !== 'string' ||
84
+ !/^[0-9a-f]{64}$/.test(file.sha) ||
85
+ !Number.isInteger(file.bytes) ||
86
+ file.bytes <= 0 ||
87
+ file.bytes > exports.RELAY_CHAT_FILE_BYTES[kind]) {
88
+ continue;
89
+ }
90
+ const name = [...(typeof file.name === 'string' ? file.name : '')]
91
+ .filter(char => char.charCodeAt(0) >= 32 && char !== '/' && char !== '\\')
92
+ .join('')
93
+ .slice(0, 120) || kind;
94
+ const type = typeof file.type === 'string' && /^[\w.+-]+\/[\w.+-]+$/.test(file.type) ? file.type.slice(0, 100) : 'application/octet-stream';
95
+ const most = kind === 'voice' ? exports.RELAY_CHAT_VOICE_MS : exports.RELAY_CHAT_VIDEO_MS;
96
+ const ms = kind !== 'file' && Number.isFinite(file.ms) ? Math.min(Math.max(Math.round(file.ms), 0), most) : undefined;
97
+ const size = kind === 'video' && Number.isInteger(file.w) && Number.isInteger(file.h) && file.w > 0 && file.h > 0;
98
+ const thumb = kind === 'video' &&
99
+ typeof file.thumb === 'string' &&
100
+ file.thumb.length <= exports.RELAY_CHAT_THUMB_CHARS &&
101
+ /^data:image\/(jpeg|png|webp);base64,/.test(file.thumb)
102
+ ? file.thumb
103
+ : undefined;
104
+ files.push({
105
+ id: file.id,
106
+ kind,
107
+ name,
108
+ type,
109
+ bytes: file.bytes,
110
+ sha: file.sha,
111
+ ...(ms !== undefined ? { ms } : {}),
112
+ ...(size ? { w: file.w, h: file.h } : {}),
113
+ ...(thumb ? { thumb } : {}),
114
+ });
115
+ }
116
+ return files.length ? { files } : {};
117
+ }
118
+ RelayRoomChatUtil.files = files;
119
+ /** The pictures of a stored line, as far as each is well formed. */
120
+ function images(value) {
121
+ if (!Array.isArray(value)) {
122
+ return {};
123
+ }
124
+ const images = [];
125
+ for (const image of value.slice(0, exports.RELAY_CHAT_IMAGES)) {
126
+ if (image &&
127
+ typeof image.id === 'string' &&
128
+ /^[A-Za-z0-9-]{8,64}$/.test(image.id) &&
129
+ typeof image.type === 'string' &&
130
+ IMAGE_TYPES.includes(image.type) &&
131
+ typeof image.sha === 'string' &&
132
+ /^[0-9a-f]{64}$/.test(image.sha) &&
133
+ Number.isInteger(image.w) &&
134
+ Number.isInteger(image.h) &&
135
+ Number.isInteger(image.bytes) &&
136
+ image.w > 0 &&
137
+ image.h > 0 &&
138
+ image.bytes > 0 &&
139
+ image.bytes <= exports.RELAY_CHAT_IMAGE_BYTES) {
140
+ const thumb = typeof image.thumb === 'string' && image.thumb.length <= exports.RELAY_CHAT_THUMB_CHARS && /^data:image\/(jpeg|png|webp);base64,/.test(image.thumb)
141
+ ? image.thumb
142
+ : undefined;
143
+ const blob = image.blob;
144
+ const ok = !!blob &&
145
+ typeof blob.id === 'string' &&
146
+ /^[A-Za-z0-9_-]{16,64}$/.test(blob.id) &&
147
+ typeof blob.read === 'string' &&
148
+ /^[A-Za-z0-9_-]{43}$/.test(blob.read) &&
149
+ typeof blob.key === 'string' &&
150
+ /^[A-Za-z0-9_-]{43}$/.test(blob.key) &&
151
+ Number.isFinite(blob.until);
152
+ images.push({
153
+ id: image.id,
154
+ type: image.type,
155
+ w: image.w,
156
+ h: image.h,
157
+ bytes: image.bytes,
158
+ sha: image.sha,
159
+ ...(thumb ? { thumb } : {}),
160
+ ...(ok && blob ? { blob: { id: blob.id, read: blob.read, key: blob.key, until: blob.until } } : {}),
161
+ });
162
+ }
163
+ }
164
+ return images.length ? { images } : {};
165
+ }
166
+ /** What a line says in a word where only text shows (the list of chats, a notice, a page of guests). */
167
+ function preview(line, picture, words = { file: '[file]', voice: '[voice]', video: '[video]' }) {
168
+ var _a;
169
+ var _b;
170
+ const pictures = ((_a = line.images) === null || _a === void 0 ? void 0 : _a.length) ? (line.images.length > 1 ? `${picture}×${line.images.length}` : picture) : '';
171
+ const files = ((_b = line.files) !== null && _b !== void 0 ? _b : []).map(file => (file.kind === 'file' ? `${words.file} ${file.name}` : words[file.kind]));
172
+ return [pictures, ...files, line.text].filter(Boolean).join(' ');
173
+ }
174
+ RelayRoomChatUtil.preview = preview;
53
175
  function stored(lines) {
54
- return lines.map(({ from: _from, ...line }) => line);
176
+ return lines.map(({ from: _from, seq: _seq, pending: _pending, failed: _failed, ...line }) => line);
55
177
  }
56
178
  RelayRoomChatUtil.stored = stored;
179
+ /** A line of the log, as its member signed it: well formed, or none. */
180
+ function signed(member, value, seq) {
181
+ const line = value;
182
+ if (!line || typeof line.id !== 'string' || typeof line.text !== 'string' || typeof line.at !== 'number') {
183
+ return undefined;
184
+ }
185
+ const name = typeof line.name === 'string' ? line.name.slice(0, 64) : '';
186
+ const text = line.text.slice(0, exports.RELAY_CHAT_TEXT_MAX);
187
+ return { id: line.id.slice(0, 40), from: member, name, text, at: line.at, ...extra(line), ...(seq ? { seq } : {}) };
188
+ }
189
+ RelayRoomChatUtil.signed = signed;
57
190
  function bytes(lines) {
58
191
  return new TextEncoder().encode(JSON.stringify(lines)).length;
59
192
  }
60
193
  RelayRoomChatUtil.bytes = bytes;
194
+ /** An error of a call a Ta service of before does not know (JSON-RPC's method not found, or its words). */
195
+ function unknownMethod(error) {
196
+ var _a;
197
+ const found = error;
198
+ return (found === null || found === void 0 ? void 0 : found.code) === -32601 || /method not found|not a function|unknown method|no such method/i.test(String((_a = found === null || found === void 0 ? void 0 : found.message) !== null && _a !== void 0 ? _a : error));
199
+ }
200
+ RelayRoomChatUtil.unknownMethod = unknownMethod;
61
201
  function id() {
62
202
  return `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
63
203
  }
@@ -75,6 +215,9 @@ class RelayRoomChat {
75
215
  this.parts = new Map();
76
216
  this.listeners = new Set();
77
217
  this.all = [];
218
+ /** Older lines are kept than those read (the log, RelayRoomChatRooms.readChat). */
219
+ this.olderKept = false;
220
+ this.log = typeof rooms.readChat === 'function' && typeof rooms.say === 'function';
78
221
  }
79
222
  /** All that is said, the earliest first. */
80
223
  get lines() {
@@ -84,7 +227,26 @@ class RelayRoomChat {
84
227
  this.listeners.add(listener);
85
228
  return () => this.listeners.delete(listener);
86
229
  }
230
+ /** Whether there are older lines than those read: `older` reads them. */
231
+ get more() {
232
+ return this.olderKept;
233
+ }
87
234
  async load() {
235
+ if (this.log && this.rooms.readChat) {
236
+ const read = await this.rooms.readChat(this.room, { limit: exports.RELAY_CHAT_WINDOW }).catch((error) => {
237
+ if (!RelayRoomChatUtil.unknownMethod(error)) {
238
+ throw error;
239
+ }
240
+ this.log = false;
241
+ return undefined;
242
+ });
243
+ if (read) {
244
+ this.olderKept = read.more;
245
+ this.all = Array.isArray(read.lines) ? read.lines : [];
246
+ this.tell();
247
+ return;
248
+ }
249
+ }
88
250
  const state = await this.rooms.getState(this.room, exports.RELAY_CHAT_KEY);
89
251
  this.parts.clear();
90
252
  for (const [key, value] of Object.entries(state)) {
@@ -92,8 +254,60 @@ class RelayRoomChat {
92
254
  }
93
255
  this.changed();
94
256
  }
257
+ /** Lines before those read, a page of them: how many came. */
258
+ async older(limit = 100) {
259
+ const first = this.all[0];
260
+ if (!this.log || !this.rooms.readChat || !first || !this.olderKept) {
261
+ return 0;
262
+ }
263
+ const read = await this.rooms.readChat(this.room, { before: first.id, limit });
264
+ const known = new Set(this.all.map(line => line.id));
265
+ const lines = read.lines.filter(line => !known.has(line.id));
266
+ this.olderKept = read.more;
267
+ this.all = [...lines, ...this.all];
268
+ this.tell();
269
+ return lines.length;
270
+ }
271
+ /**
272
+ * What happened in the room, as its event tells: a line of the log (`chat`), or a key of the state set (`state`,
273
+ * the chat of a Ta service of before). Whether it was of the chat.
274
+ */
275
+ hear(event) {
276
+ if (event.room !== undefined && event.room !== this.room) {
277
+ return false;
278
+ }
279
+ if (event.type === 'chat' && event.line) {
280
+ this.heardLine(event.line);
281
+ return true;
282
+ }
283
+ return event.type === 'state' && typeof event.key === 'string' && this.heard(event.key, event);
284
+ }
285
+ /** A line said or taken: one of the same id is replaced (sent, refused), a new one comes last. */
286
+ heardLine(line) {
287
+ const index = this.all.findIndex(each => each.id === line.id);
288
+ if (index >= 0) {
289
+ const next = [...this.all];
290
+ next[index] = line;
291
+ this.all = next;
292
+ }
293
+ else {
294
+ const next = [...this.all, line];
295
+ // A line taken while one of this Ta waits goes before it: the pending come last.
296
+ const pending = next.findIndex(each => each.pending);
297
+ if (pending >= 0 && !line.pending) {
298
+ next.splice(next.length - 1, 1);
299
+ next.splice(pending, 0, line);
300
+ }
301
+ this.all = next.length > exports.RELAY_CHAT_WINDOW * 2 ? next.slice(-exports.RELAY_CHAT_WINDOW) : next;
302
+ this.olderKept || (this.olderKept = next.length > this.all.length);
303
+ }
304
+ this.tell();
305
+ }
95
306
  /** A key of the room set, as its event tells: whether it was of the chat. */
96
307
  heard(key, value) {
308
+ if (this.log) {
309
+ return !!RelayRoomChatUtil.parse(key);
310
+ }
97
311
  if (!RelayRoomChatUtil.parse(key)) {
98
312
  return false;
99
313
  }
@@ -110,17 +324,24 @@ class RelayRoomChat {
110
324
  * again on what another client of the same Ta wrote first. The line said, or undefined when there was nothing to say.
111
325
  */
112
326
  async say(text, self, extra = {}) {
113
- var _a;
114
- var _b, _c;
327
+ var _a, _b, _c;
328
+ var _d, _e;
115
329
  const said = text.trim().slice(0, exports.RELAY_CHAT_TEXT_MAX);
116
- if (!said) {
330
+ if (!said && !((_a = extra.images) === null || _a === void 0 ? void 0 : _a.length) && !((_b = extra.files) === null || _b === void 0 ? void 0 : _b.length)) {
117
331
  return undefined;
118
332
  }
333
+ if (this.log && this.rooms.say) {
334
+ const line = await this.rooms.say(this.room, said, RelayRoomChatUtil.extra(extra));
335
+ if (line) {
336
+ this.heardLine(line);
337
+ }
338
+ return line;
339
+ }
119
340
  for (let tries = 0; tries < TRIES; tries++) {
120
341
  const latest = this.latest(self.member);
121
342
  // After what it said last, even within the same millisecond: the lines of a member keep their order.
122
343
  const last = latest === null || latest === void 0 ? void 0 : latest.lines[latest.lines.length - 1];
123
- const at = Math.max(Date.now(), ((_b = last === null || last === void 0 ? void 0 : last.at) !== null && _b !== void 0 ? _b : 0) + 1);
344
+ const at = Math.max(Date.now(), ((_d = last === null || last === void 0 ? void 0 : last.at) !== null && _d !== void 0 ? _d : 0) + 1);
124
345
  const line = {
125
346
  id: RelayRoomChatUtil.id(),
126
347
  from: self.member,
@@ -134,7 +355,7 @@ class RelayRoomChat {
134
355
  const lines = fits && latest ? [...latest.lines, line] : [line];
135
356
  const key = RelayRoomChatUtil.key(self.member, part);
136
357
  const value = RelayRoomChatUtil.stored(lines);
137
- const result = await this.rooms.setState(this.room, key, value, (_c = (_a = this.parts.get(key)) === null || _a === void 0 ? void 0 : _a.version) !== null && _c !== void 0 ? _c : 0);
358
+ const result = await this.rooms.setState(this.room, key, value, (_e = (_c = this.parts.get(key)) === null || _c === void 0 ? void 0 : _c.version) !== null && _e !== void 0 ? _e : 0);
138
359
  if (result.ok) {
139
360
  this.put(key, { value, version: result.version, by: self.member });
140
361
  this.changed();
@@ -173,6 +394,9 @@ class RelayRoomChat {
173
394
  }
174
395
  changed() {
175
396
  this.all = [...this.parts.values()].flatMap(part => part.lines).sort((a, b) => a.at - b.at || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
397
+ this.tell();
398
+ }
399
+ tell() {
176
400
  for (const listener of this.listeners) {
177
401
  listener();
178
402
  }
@@ -10,6 +10,8 @@ declare const zh: {
10
10
  namePlaceholder: string;
11
11
  join: string;
12
12
  joining: string;
13
+ picture: string;
14
+ file: string;
13
15
  keep: string;
14
16
  haveTa: string;
15
17
  waiting: string;
@@ -36,6 +38,9 @@ declare const zh: {
36
38
  rename: string;
37
39
  leave: string;
38
40
  leaveAsk: string;
41
+ boardOpen: string;
42
+ boardDone: string;
43
+ boardFrom: string;
39
44
  game: string;
40
45
  empty: string;
41
46
  placeholder: string;
@@ -13,6 +13,8 @@ const zh = {
13
13
  namePlaceholder: '大家看到的名字',
14
14
  join: '申请加入',
15
15
  joining: '正在申请…',
16
+ picture: '[图片,在 Ta 里看]',
17
+ file: '[文件、语音或视频,在 Ta 里看]',
16
18
  keep: '你的名字和一把只属于这个浏览器的钥匙保存在本机;清除浏览器数据后要重新申请。',
17
19
  haveTa: '装了 Ta?在 Ta 应用里扫码或粘贴这个链接,还能一起玩小镇等游戏。',
18
20
  waiting: '已向{by}申请',
@@ -39,6 +41,9 @@ const zh = {
39
41
  rename: '修改我的名字',
40
42
  leave: '退出群聊',
41
43
  leaveAsk: '退出「{title}」?退出后要有新的邀请才能再进来。',
44
+ boardOpen: '{n} 个处理中',
45
+ boardDone: '{n} 个已完成',
46
+ boardFrom: '来自 {names}',
42
47
  game: '这个群里有 Ta 的游戏,装了 Ta 才能一起玩;在这里可以聊天。',
43
48
  empty: '还没有人说话。只有群里的人能看到,中继保存的是密文。',
44
49
  placeholder: '发消息',
@@ -58,6 +63,8 @@ const zhTw = {
58
63
  namePlaceholder: '大家看到的名字',
59
64
  join: '申請加入',
60
65
  joining: '正在申請…',
66
+ picture: '[圖片,在 Ta 裡看]',
67
+ file: '[檔案、語音或影片,在 Ta 裡看]',
61
68
  keep: '你的名字和一把只屬於這個瀏覽器的鑰匙儲存在本機;清除瀏覽器資料後要重新申請。',
62
69
  haveTa: '裝了 Ta?在 Ta 應用裡掃碼或貼上這個連結,還能一起玩小鎮等遊戲。',
63
70
  waiting: '已向{by}申請',
@@ -84,6 +91,9 @@ const zhTw = {
84
91
  rename: '修改我的名字',
85
92
  leave: '退出群聊',
86
93
  leaveAsk: '退出「{title}」?退出後要有新的邀請才能再進來。',
94
+ boardOpen: '{n} 個處理中',
95
+ boardDone: '{n} 個已完成',
96
+ boardFrom: '來自 {names}',
87
97
  game: '這個群裡有 Ta 的遊戲,裝了 Ta 才能一起玩;在這裡可以聊天。',
88
98
  empty: '還沒有人說話。只有群裡的人能看到,中繼儲存的是密文。',
89
99
  placeholder: '發訊息',
@@ -103,6 +113,8 @@ const en = {
103
113
  namePlaceholder: 'What everyone sees',
104
114
  join: 'Ask to join',
105
115
  joining: 'Asking…',
116
+ picture: '[Picture: see it in Ta]',
117
+ file: '[File, voice or video: see it in Ta]',
106
118
  keep: 'Your name and a key of this browser alone are kept on this device; clear its data and you ask again.',
107
119
  haveTa: 'Have Ta? Scan this link in the Ta app or paste it there, to play the Town and other games together too.',
108
120
  waiting: 'Asked {by}',
@@ -129,6 +141,9 @@ const en = {
129
141
  rename: 'Change my name',
130
142
  leave: 'Leave the group chat',
131
143
  leaveAsk: 'Leave “{title}”? You come back only by a new invitation.',
144
+ boardOpen: '{n} in progress',
145
+ boardDone: '{n} done',
146
+ boardFrom: 'From {names}',
132
147
  game: 'This group chat plays a game of Ta, which takes Ta to play; here you chat.',
133
148
  empty: 'Nothing said yet. Only those in the group chat read it: the relay keeps it sealed.',
134
149
  placeholder: 'Message',
@@ -148,6 +163,8 @@ const ja = {
148
163
  namePlaceholder: 'みんなに見える名前',
149
164
  join: '参加をリクエスト',
150
165
  joining: 'リクエスト中…',
166
+ picture: '[画像:Ta で表示]',
167
+ file: '[ファイル・ボイス・動画:Ta で表示]',
151
168
  keep: 'あなたの名前とこのブラウザ専用のキーはこのデバイスに保存されます。ブラウザデータをクリアすると再度リクエストが必要です。',
152
169
  haveTa: 'Ta をインストール済みですか?Ta アプリでこのリンクをスキャンするかペーストして、タウンなどのゲームも一緒にプレイできます。',
153
170
  waiting: '{by}さんにリクエスト済み',
@@ -174,6 +191,9 @@ const ja = {
174
191
  rename: '名前を変更',
175
192
  leave: 'グループチャットを退出',
176
193
  leaveAsk: '「{title}」を退出しますか?退出後は新しい招待でのみ戻ることができます。',
194
+ boardOpen: '対応中 {n} 件',
195
+ boardDone: '完了 {n} 件',
196
+ boardFrom: '{names} から',
177
197
  game: 'このグループチャットには Ta のゲームがあり、プレイするには Ta が必要です。ここでチャットできます。',
178
198
  empty: 'まだ誰も話していません。グループ内の人だけが見ることができ、リレーは暗号化されて保存されます。',
179
199
  placeholder: 'メッセージ',
@@ -1,2 +1,2 @@
1
- export declare const GUEST_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--mine:#e7f6ec;--mine-fg:#14532d;--code:#f6f6f6;--accent:#16a34a;--red:#dc2626;--radius:16px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#262626;--mine:#1f3a2a;--mine-fg:#d1fae5;--code:#232323;--accent:#4ade80;--red:#f87171}}\n*{box-sizing:border-box}\nhtml,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.6 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}\nbutton{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}\n.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.heading{flex:1;min-width:0;display:flex;flex-direction:column}\n.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.heading b span{color:var(--muted);font-weight:500;margin-left:4px}\n.heading small{font-size:11.5px;line-height:15px;color:var(--accent)}\n.heading small.quiet{color:var(--muted)}\n.icon{flex:none;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:10px;background:none;font-size:20px;line-height:1;color:var(--muted)}\n.icon:hover{background:var(--soft);color:var(--fg)}\n.center{flex:1;display:flex;flex-direction:column;justify-content:center;padding:24px 22px calc(32px + env(safe-area-inset-bottom));max-width:440px;width:100%;margin:0 auto;gap:14px}\n.card-face{align-self:center}\n.lead{margin:0;text-align:center;color:var(--muted);font-size:14px}\n.room-name{margin:0;text-align:center;font-size:21px;font-weight:600;line-height:1.35;word-break:break-word}\n.hint{margin:0;text-align:center;color:var(--muted);font-size:13px}\n.small{margin:0;color:var(--faint);font-size:12px;line-height:1.55;text-align:center}\nlabel.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}\ninput.text{font:inherit;font-size:16px;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:11px 13px;outline:none}\ninput.text:focus{border-color:var(--accent)}\n.primary{border:0;border-radius:12px;padding:12px 16px;background:#16a34a;color:#fff;font-weight:600;font-size:15px}\n.primary:disabled{opacity:.55;cursor:default}\n.plain{border:0;background:none;color:var(--muted);font-size:13.5px;padding:8px}\n.plain:hover{color:var(--fg)}\n.danger{color:var(--red)}\n.error{margin:0;text-align:center;color:var(--red);font-size:13px}\n.spin{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .9s linear infinite;align-self:center}\n@keyframes spin{to{transform:rotate(360deg)}}\n.face{flex:none;display:inline-flex;position:relative;user-select:none}\n.face svg{display:block;overflow:visible}\n.ta-face-eyes{transform-box:fill-box;transform-origin:center;animation:blink 5.2s infinite}\n.face[data-face=\"1\"] .ta-face-eyes,.face[data-face=\"5\"] .ta-face-eyes,.face[data-face=\"9\"] .ta-face-eyes,.face[data-face=\"13\"] .ta-face-eyes{animation-delay:-1.7s}\n.face[data-face=\"2\"] .ta-face-eyes,.face[data-face=\"6\"] .ta-face-eyes,.face[data-face=\"10\"] .ta-face-eyes,.face[data-face=\"14\"] .ta-face-eyes{animation-delay:-3.1s}\n.face[data-face=\"3\"] .ta-face-eyes,.face[data-face=\"7\"] .ta-face-eyes,.face[data-face=\"11\"] .ta-face-eyes,.face[data-face=\"15\"] .ta-face-eyes{animation-delay:-4.4s}\n@keyframes blink{0%,94%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}\n@media (prefers-reduced-motion:reduce){.face *{animation:none!important}}\n@media (prefers-color-scheme:dark){.face[data-face=\"11\"] .ta-face-body>g>circle{fill:#4a4a52}}\n.face i{position:absolute;right:-1px;bottom:-1px;width:28%;height:28%;min-width:7px;min-height:7px;border-radius:50%;border:2px solid var(--bg);background:var(--faint)}\n.face i.on{background:var(--accent)}\n.banner{flex:none;margin:10px 14px 0;padding:8px 12px;border-radius:12px;background:var(--soft);color:var(--muted);font-size:12.5px;line-height:1.5}\n.list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:none;padding:10px 14px 12px;display:flex;flex-direction:column;gap:4px}\n.empty{margin:14vh auto 0;max-width:300px;text-align:center;color:var(--muted);font-size:13px}\n.when{align-self:center;margin:14px 0 6px;color:var(--faint);font-size:11.5px;font-variant-numeric:tabular-nums}\n.msg{display:flex;align-items:flex-start;gap:10px}\n.msg.first{margin-top:10px}\n.msg .slot{width:32px;flex:none;display:flex;justify-content:center}\n.msg .col{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:calc(100% - 84px)}\n.msg .who{display:flex;align-items:center;gap:6px;margin:0 2px 4px;color:var(--muted);font-size:12px;line-height:16px}\n.msg.double .bubble{border:1px dashed var(--soft);background:none}\n.bubble{min-width:0;max-width:100%;padding:8px 13px;border-radius:5px var(--radius) var(--radius) var(--radius);background:var(--bubble);word-break:break-word}\n.mine{display:flex;justify-content:flex-end;margin:6px 0 2px}\n.mine .bubble{max-width:78%;border-radius:var(--radius) 5px var(--radius) var(--radius);background:var(--mine);color:var(--mine-fg)}\n.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}\n.bubble p{margin:0 0 .6em}\n.bubble ul,.bubble ol{margin:0 0 .6em;padding-left:1.3em}\n.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}\n.bubble code{font:13px ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);padding:1px 4px;border-radius:5px}\n.bubble pre{margin:0 0 .6em;padding:8px 10px;background:var(--code);border-radius:10px;overflow-x:auto}\n.bubble pre code{background:none;padding:0}\n.bubble blockquote{margin:0 0 .6em;padding-left:10px;border-left:3px solid var(--line);color:var(--muted)}\n.failed{align-self:flex-end;color:var(--red);font-size:12px;margin:2px 4px 0}\n.box{flex:none;display:flex;align-items:flex-end;gap:8px;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg)}\n.box textarea{flex:1;min-width:0;resize:none;max-height:160px;font:inherit;font-size:16px;line-height:1.45;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:18px;padding:8px 14px;outline:none}\n.box textarea:focus{border-color:var(--accent)}\n.box .primary{flex:none;border-radius:18px;padding:8px 16px;min-height:40px}\n.foot{flex:none;text-align:center;color:var(--faint);font-size:11px;padding:0 0 6px}\n.sheet{position:fixed;inset:0;z-index:5;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.32)}\n.sheet .panel{width:100%;max-width:520px;max-height:80dvh;overflow-y:auto;background:var(--bg);border-radius:18px 18px 0 0;padding:14px 8px calc(14px + env(safe-area-inset-bottom))}\n@media (min-width:700px){.sheet{align-items:center}.sheet .panel{border-radius:18px}}\n.panel h3{margin:4px 14px 8px;font-size:13px;font-weight:500;color:var(--muted)}\n.member{display:flex;align-items:center;gap:10px;padding:8px 12px}\n.member .nm{flex:1;min-width:0;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tag{flex:none;padding:0 6px;border-radius:6px;background:var(--soft);color:var(--muted);font-size:11px;line-height:18px}\n.member .st{font-size:12px;color:var(--muted)}\n.member .st.on{color:var(--accent)}\n.row{display:block;width:100%;text-align:left;border:0;background:none;padding:12px 14px;border-radius:12px;font-size:14.5px}\n.row:hover{background:var(--soft)}\n.sep{height:1px;margin:6px 12px;background:var(--line)}\n";
1
+ export declare const GUEST_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--mine:#e7f6ec;--mine-fg:#14532d;--code:#f6f6f6;--accent:#16a34a;--red:#dc2626;--radius:16px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#262626;--mine:#1f3a2a;--mine-fg:#d1fae5;--code:#232323;--accent:#4ade80;--red:#f87171}}\n*{box-sizing:border-box}\nhtml,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.6 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}\nbutton{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}\n.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.heading{flex:1;min-width:0;display:flex;flex-direction:column}\n.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.heading b span{color:var(--muted);font-weight:500;margin-left:4px}\n.heading small{font-size:11.5px;line-height:15px;color:var(--accent)}\n.heading small.quiet{color:var(--muted)}\n.icon{flex:none;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:10px;background:none;font-size:20px;line-height:1;color:var(--muted)}\n.icon:hover{background:var(--soft);color:var(--fg)}\n.center{flex:1;display:flex;flex-direction:column;justify-content:center;padding:24px 22px calc(32px + env(safe-area-inset-bottom));max-width:440px;width:100%;margin:0 auto;gap:14px}\n.card-face{align-self:center}\n.lead{margin:0;text-align:center;color:var(--muted);font-size:14px}\n.room-name{margin:0;text-align:center;font-size:21px;font-weight:600;line-height:1.35;word-break:break-word}\n.hint{margin:0;text-align:center;color:var(--muted);font-size:13px}\n.small{margin:0;color:var(--faint);font-size:12px;line-height:1.55;text-align:center}\nlabel.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}\ninput.text{font:inherit;font-size:16px;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:11px 13px;outline:none}\ninput.text:focus{border-color:var(--accent)}\n.primary{border:0;border-radius:12px;padding:12px 16px;background:#16a34a;color:#fff;font-weight:600;font-size:15px}\n.primary:disabled{opacity:.55;cursor:default}\n.plain{border:0;background:none;color:var(--muted);font-size:13.5px;padding:8px}\n.plain:hover{color:var(--fg)}\n.danger{color:var(--red)}\n.error{margin:0;text-align:center;color:var(--red);font-size:13px}\n.spin{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .9s linear infinite;align-self:center}\n@keyframes spin{to{transform:rotate(360deg)}}\n.face{flex:none;display:inline-flex;position:relative;user-select:none}\n.face svg{display:block;overflow:visible}\n.ta-face-eyes{transform-box:fill-box;transform-origin:center;animation:blink 5.2s infinite}\n.face[data-face=\"1\"] .ta-face-eyes,.face[data-face=\"5\"] .ta-face-eyes,.face[data-face=\"9\"] .ta-face-eyes,.face[data-face=\"13\"] .ta-face-eyes{animation-delay:-1.7s}\n.face[data-face=\"2\"] .ta-face-eyes,.face[data-face=\"6\"] .ta-face-eyes,.face[data-face=\"10\"] .ta-face-eyes,.face[data-face=\"14\"] .ta-face-eyes{animation-delay:-3.1s}\n.face[data-face=\"3\"] .ta-face-eyes,.face[data-face=\"7\"] .ta-face-eyes,.face[data-face=\"11\"] .ta-face-eyes,.face[data-face=\"15\"] .ta-face-eyes{animation-delay:-4.4s}\n@keyframes blink{0%,94%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}\n@media (prefers-reduced-motion:reduce){.face *{animation:none!important}}\n@media (prefers-color-scheme:dark){.face[data-face=\"11\"] .ta-face-body>g>circle{fill:#4a4a52}}\n.face i{position:absolute;right:-1px;bottom:-1px;width:28%;height:28%;min-width:7px;min-height:7px;border-radius:50%;border:2px solid var(--bg);background:var(--faint)}\n.face i.on{background:var(--accent)}\n.boards{flex:none;display:flex;gap:6px;overflow-x:auto;margin:10px 14px 0;scrollbar-width:none}\n.boards::-webkit-scrollbar{display:none}\n.board{flex:none;display:flex;align-items:center;gap:6px;border:0;padding:7px 12px;border-radius:12px;background:var(--soft);color:var(--fg);font-size:12.5px;line-height:1.4;white-space:nowrap}\n.board .dot{width:6px;height:6px;border-radius:50%;background:var(--accent)}\n.item{display:flex;flex-direction:column;gap:2px;padding:9px 14px}\n.item .hd{display:flex;align-items:center;gap:8px;font-size:14.5px}\n.item .n{color:var(--muted);font-variant-numeric:tabular-nums}\n.item .tt{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.item .lb{flex:none;font-size:12px;color:var(--muted)}\n.item .lb.doing,.item .lb.waiting{color:var(--accent)}\n.item .by{font-size:12px;color:var(--muted);padding-left:2px}\n.banner{flex:none;margin:10px 14px 0;padding:8px 12px;border-radius:12px;background:var(--soft);color:var(--muted);font-size:12.5px;line-height:1.5}\n.list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:none;padding:10px 14px 12px;display:flex;flex-direction:column;gap:4px}\n.empty{margin:14vh auto 0;max-width:300px;text-align:center;color:var(--muted);font-size:13px}\n.when{align-self:center;margin:14px 0 6px;color:var(--faint);font-size:11.5px;font-variant-numeric:tabular-nums}\n.msg{display:flex;align-items:flex-start;gap:10px}\n.msg.first{margin-top:10px}\n.msg .slot{width:32px;flex:none;display:flex;justify-content:center}\n.msg .col{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:calc(100% - 84px)}\n.msg .who{display:flex;align-items:center;gap:6px;margin:0 2px 4px;color:var(--muted);font-size:12px;line-height:16px}\n.msg.double .bubble{border:1px dashed var(--soft);background:none}\n.bubble{min-width:0;max-width:100%;padding:8px 13px;border-radius:5px var(--radius) var(--radius) var(--radius);background:var(--bubble);word-break:break-word}\n.mine{display:flex;justify-content:flex-end;margin:6px 0 2px}\n.mine .bubble{max-width:78%;border-radius:var(--radius) 5px var(--radius) var(--radius);background:var(--mine);color:var(--mine-fg)}\n.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}\n.bubble p{margin:0 0 .6em}\n.bubble ul,.bubble ol{margin:0 0 .6em;padding-left:1.3em}\n.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}\n.bubble code{font:13px ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);padding:1px 4px;border-radius:5px}\n.bubble pre{margin:0 0 .6em;padding:8px 10px;background:var(--code);border-radius:10px;overflow-x:auto}\n.bubble pre code{background:none;padding:0}\n.bubble blockquote{margin:0 0 .6em;padding-left:10px;border-left:3px solid var(--line);color:var(--muted)}\n.failed{align-self:flex-end;color:var(--red);font-size:12px;margin:2px 4px 0}\n.box{flex:none;display:flex;align-items:flex-end;gap:8px;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg)}\n.box textarea{flex:1;min-width:0;resize:none;max-height:160px;font:inherit;font-size:16px;line-height:1.45;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:18px;padding:8px 14px;outline:none}\n.box textarea:focus{border-color:var(--accent)}\n.box .primary{flex:none;border-radius:18px;padding:8px 16px;min-height:40px}\n.foot{flex:none;text-align:center;color:var(--faint);font-size:11px;padding:0 0 6px}\n.sheet{position:fixed;inset:0;z-index:5;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.32)}\n.sheet .panel{width:100%;max-width:520px;max-height:80dvh;overflow-y:auto;background:var(--bg);border-radius:18px 18px 0 0;padding:14px 8px calc(14px + env(safe-area-inset-bottom))}\n@media (min-width:700px){.sheet{align-items:center}.sheet .panel{border-radius:18px}}\n.panel h3{margin:4px 14px 8px;font-size:13px;font-weight:500;color:var(--muted)}\n.member{display:flex;align-items:center;gap:10px;padding:8px 12px}\n.member .nm{flex:1;min-width:0;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tag{flex:none;padding:0 6px;border-radius:6px;background:var(--soft);color:var(--muted);font-size:11px;line-height:18px}\n.member .st{font-size:12px;color:var(--muted)}\n.member .st.on{color:var(--accent)}\n.row{display:block;width:100%;text-align:left;border:0;background:none;padding:12px 14px;border-radius:12px;font-size:14.5px}\n.row:hover{background:var(--soft)}\n.sep{height:1px;margin:6px 12px;background:var(--line)}\n";
2
2
  //# sourceMappingURL=guest-style.d.ts.map