@shadowob/shared 0.4.0 → 1.1.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.
package/dist/index.cjs ADDED
@@ -0,0 +1,424 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ CAT_AVATAR_COUNT: () => CAT_AVATAR_COUNT,
24
+ CLIENT_EVENTS: () => CLIENT_EVENTS,
25
+ LIMITS: () => LIMITS,
26
+ SERVER_EVENTS: () => SERVER_EVENTS,
27
+ formatDate: () => formatDate,
28
+ generateInviteCode: () => generateInviteCode,
29
+ generateRandomCatConfig: () => generateRandomCatConfig,
30
+ getAllCatAvatars: () => getAllCatAvatars,
31
+ getCatAvatar: () => getCatAvatar,
32
+ getCatAvatarByUserId: () => getCatAvatarByUserId,
33
+ getCatSvgString: () => getCatSvgString,
34
+ isValidEmail: () => isValidEmail,
35
+ renderCatSvg: () => renderCatSvg,
36
+ slugify: () => slugify
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/constants/events.ts
41
+ var CLIENT_EVENTS = {
42
+ CHANNEL_JOIN: "channel:join",
43
+ CHANNEL_LEAVE: "channel:leave",
44
+ MESSAGE_SEND: "message:send",
45
+ MESSAGE_TYPING: "message:typing",
46
+ PRESENCE_UPDATE: "presence:update"
47
+ };
48
+ var SERVER_EVENTS = {
49
+ MESSAGE_NEW: "message:new",
50
+ MESSAGE_UPDATE: "message:update",
51
+ MESSAGE_DELETE: "message:delete",
52
+ MEMBER_TYPING: "member:typing",
53
+ MEMBER_JOIN: "member:join",
54
+ MEMBER_LEAVE: "member:leave",
55
+ PRESENCE_CHANGE: "presence:change",
56
+ REACTION_ADD: "reaction:add",
57
+ REACTION_REMOVE: "reaction:remove",
58
+ NOTIFICATION_NEW: "notification:new",
59
+ DM_MESSAGE_NEW: "dm:message:new"
60
+ };
61
+
62
+ // src/constants/limits.ts
63
+ var LIMITS = {
64
+ /** Max message content length */
65
+ MESSAGE_CONTENT_MAX: 4e3,
66
+ /** Max username length */
67
+ USERNAME_MAX: 32,
68
+ /** Min username length */
69
+ USERNAME_MIN: 3,
70
+ /** Max display name length */
71
+ DISPLAY_NAME_MAX: 64,
72
+ /** Max server name length */
73
+ SERVER_NAME_MAX: 100,
74
+ /** Max channel name length */
75
+ CHANNEL_NAME_MAX: 100,
76
+ /** Max thread name length */
77
+ THREAD_NAME_MAX: 100,
78
+ /** Max file upload size (10MB) */
79
+ FILE_UPLOAD_MAX_SIZE: 10 * 1024 * 1024,
80
+ /** Messages per page (cursor pagination) */
81
+ MESSAGES_PER_PAGE: 50,
82
+ /** Max servers per user */
83
+ SERVERS_PER_USER_MAX: 100,
84
+ /** Max channels per server */
85
+ CHANNELS_PER_SERVER_MAX: 200,
86
+ /** Invite code length */
87
+ INVITE_CODE_LENGTH: 8,
88
+ /** Password min length */
89
+ PASSWORD_MIN: 8,
90
+ /** Max reactions per message per user */
91
+ REACTIONS_PER_MESSAGE_MAX: 20
92
+ };
93
+
94
+ // src/utils/index.ts
95
+ var import_nanoid = require("nanoid");
96
+
97
+ // src/utils/avatar-generator.ts
98
+ var COLORS = {
99
+ bg: [
100
+ "transparent",
101
+ "#1e1f22",
102
+ "#313338",
103
+ "#5865F2",
104
+ "#23a559",
105
+ "#da373c",
106
+ "#f472b6",
107
+ "#3b82f6",
108
+ "#fbbf24",
109
+ "#a855f7",
110
+ "#1abc9c",
111
+ "#f39c12",
112
+ "#e74c3c"
113
+ ],
114
+ body: [
115
+ "#2d2d30",
116
+ "#e8842c",
117
+ "#e8e8e8",
118
+ "#7a7a80",
119
+ "#d4a574",
120
+ "#6b8094",
121
+ "#f472b6",
122
+ "#c8d6e5",
123
+ "#3e2723",
124
+ "#bdc3c7",
125
+ "#ffb8b8"
126
+ ],
127
+ eyes: [
128
+ "#f8e71c",
129
+ "#00f3ff",
130
+ "#4ade80",
131
+ "#60a5fa",
132
+ "#a855f7",
133
+ "#fbbf24",
134
+ "#f87171",
135
+ "#ffc0cb",
136
+ "#1dd1a1",
137
+ "#e056fd"
138
+ ],
139
+ pattern: ["#1a1a1c", "#ffffff", "#5a4a46", "#3d3d40", "#9a9aa0", "#d1ccc0", "#2d3436"]
140
+ };
141
+ function getRandomElement(arr) {
142
+ return arr[Math.floor(Math.random() * arr.length)];
143
+ }
144
+ function generateRandomCatConfig() {
145
+ return {
146
+ bg: getRandomElement(COLORS.bg),
147
+ bgPattern: getRandomElement(["none", "dots", "stripes", "grid", "stars"]),
148
+ body: getRandomElement(COLORS.body),
149
+ pattern: getRandomElement([
150
+ "none",
151
+ "tabby",
152
+ "tuxedo",
153
+ "siamese",
154
+ "calico",
155
+ "bicolor"
156
+ ]),
157
+ patternColor: getRandomElement(COLORS.pattern),
158
+ eyeColor: getRandomElement(COLORS.eyes),
159
+ expression: getRandomElement([
160
+ "smile",
161
+ "open",
162
+ "flat",
163
+ "sad",
164
+ "surprised",
165
+ "kawaii",
166
+ "winking",
167
+ "smirk"
168
+ ]),
169
+ decoration: getRandomElement([
170
+ "none",
171
+ "glasses",
172
+ "blush",
173
+ "scar",
174
+ "flower",
175
+ "fish",
176
+ "headband"
177
+ ])
178
+ };
179
+ }
180
+ function renderCatSvg(config) {
181
+ const { bg, bgPattern, body, pattern, patternColor, eyeColor, expression, decoration } = config;
182
+ const stroke = "#1a1a1c";
183
+ let svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">`;
184
+ if (bg && bg !== "transparent") {
185
+ svg += `<rect width="100" height="100" fill="${bg}" rx="20" />`;
186
+ const pColor = `rgba(255,255,255,0.15)`;
187
+ const cleanBg = bg.replace("#", "");
188
+ if (bgPattern === "dots") {
189
+ svg += `<pattern id="p-${cleanBg}-dots" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="2" fill="${pColor}"/></pattern><rect width="100" height="100" fill="url(#p-${cleanBg}-dots)" rx="20" />`;
190
+ } else if (bgPattern === "stripes") {
191
+ svg += `<pattern id="p-${cleanBg}-str" x="0" y="0" width="12" height="12" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><line x1="0" y1="0" x2="0" y2="12" stroke="${pColor}" stroke-width="4"/></pattern><rect width="100" height="100" fill="url(#p-${cleanBg}-str)" rx="20" />`;
192
+ } else if (bgPattern === "grid") {
193
+ svg += `<pattern id="p-${cleanBg}-grid" width="16" height="16" patternUnits="userSpaceOnUse"><path d="M 16 0 L 0 0 0 16" fill="none" stroke="${pColor}" stroke-width="1"/></pattern><rect width="100" height="100" fill="url(#p-${cleanBg}-grid)" rx="20" />`;
194
+ } else if (bgPattern === "stars") {
195
+ svg += `<pattern id="p-${cleanBg}-star" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M10,2 L12,8 L18,8 L13,12 L15,18 L10,14 L5,18 L7,12 L2,8 L8,8 Z" fill="${pColor}" transform="scale(0.5) translate(5,5)"/></pattern><rect width="100" height="100" fill="url(#p-${cleanBg}-star)" rx="20" />`;
196
+ }
197
+ }
198
+ svg += `<ellipse cx="50" cy="85" rx="30" ry="6" fill="rgba(0,0,0,0.2)"/>`;
199
+ svg += `<path d="M22,45 C15,22 28,18 34,22 C38,25 40,38 40,38" fill="${body}" stroke="${stroke}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>`;
200
+ svg += `<path d="M78,45 C85,22 72,18 66,22 C62,25 60,38 60,38" fill="${body}" stroke="${stroke}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>`;
201
+ svg += `<path d="M26,38 C22,26 29,24 33,26 C35,28 36,34 36,34" fill="#ffb8b8" opacity="0.8"/>`;
202
+ svg += `<path d="M74,38 C78,26 71,24 67,26 C65,28 64,34 64,34" fill="#ffb8b8" opacity="0.8"/>`;
203
+ svg += `<ellipse cx="50" cy="58" rx="38" ry="30" fill="${body}" stroke="${stroke}" stroke-width="2.5"/>`;
204
+ if (pattern === "tabby") {
205
+ svg += `<path d="M50,30 L50,40 M42,32 L46,39 M58,32 L54,39" stroke="${patternColor}" stroke-width="3" stroke-linecap="round" opacity="0.7"/>`;
206
+ svg += `<path d="M18,55 L26,57 M20,62 L27,62" stroke="${patternColor}" stroke-width="2.5" stroke-linecap="round" opacity="0.7"/>`;
207
+ svg += `<path d="M82,55 L74,57 M80,62 L73,62" stroke="${patternColor}" stroke-width="2.5" stroke-linecap="round" opacity="0.7"/>`;
208
+ } else if (pattern === "tuxedo") {
209
+ svg += `<path d="M50,56 C30,68 28,88 50,88 C72,88 70,68 50,56" fill="${patternColor}" opacity="0.95"/>`;
210
+ svg += `<ellipse cx="50" cy="65" rx="16" ry="12" fill="${patternColor}" opacity="0.95"/>`;
211
+ } else if (pattern === "siamese") {
212
+ svg += `<ellipse cx="50" cy="62" rx="20" ry="16" fill="${patternColor}" opacity="0.6"/>`;
213
+ } else if (pattern === "calico") {
214
+ svg += `<path d="M25,40 Q35,30 45,45 Q35,55 25,40" fill="${patternColor}" opacity="0.8"/>`;
215
+ svg += `<path d="M75,45 Q65,60 55,50 Q65,35 75,45" fill="#e8842c" opacity="0.8"/>`;
216
+ } else if (pattern === "bicolor") {
217
+ svg += `<path d="M12,58 Q30,30 50,40 Q60,70 50,88 Q12,88 12,58 Z" fill="${patternColor}" opacity="0.8"/>`;
218
+ }
219
+ if (decoration === "blush") {
220
+ svg += `<ellipse cx="28" cy="62" rx="5" ry="3" fill="#ff7675" opacity="0.7"/>`;
221
+ svg += `<ellipse cx="72" cy="62" rx="5" ry="3" fill="#ff7675" opacity="0.7"/>`;
222
+ }
223
+ if (decoration === "scar") {
224
+ svg += `<path d="M28,42 L40,52 M30,48 L35,43 M34,51 L39,46 M32,53 L37,48" stroke="#d63031" stroke-width="1.5" stroke-linecap="round"/>`;
225
+ }
226
+ const drawEye = (cx, cy, lookDir = 0) => {
227
+ if (expression === "kawaii") {
228
+ return `<path d="M${cx - 8},${cy} Q${cx},${cy - 8} ${cx + 8},${cy} Q${cx},${cy - 3} ${cx - 8},${cy}" fill="${eyeColor}" stroke="${stroke}" stroke-width="1.5"/><circle cx="${cx + lookDir}" cy="${cy - 2}" r="3" fill="white"/><circle cx="${cx - 3 + lookDir}" cy="${cy}" r="1" fill="white"/>`;
229
+ } else if (expression === "winking" && cx > 50) {
230
+ return `<path d="M${cx - 7},${cy + 2} Q${cx},${cy - 4} ${cx + 7},${cy + 2}" fill="none" stroke="${stroke}" stroke-width="2.5" stroke-linecap="round"/>`;
231
+ } else if (expression === "surprised") {
232
+ return `<circle cx="${cx}" cy="${cy}" r="8" fill="white" stroke="${stroke}" stroke-width="1.5"/><circle cx="${cx}" cy="${cy}" r="3" fill="${eyeColor}"/>`;
233
+ } else {
234
+ return `<circle cx="${cx}" cy="${cy}" r="7.5" fill="${eyeColor}" stroke="${stroke}" stroke-width="1.5"/><circle cx="${cx - 2 + lookDir}" cy="${cy - 2}" r="2.5" fill="white"/><circle cx="${cx + 2 + lookDir}" cy="${cy + 1}" r="1" fill="white"/>`;
235
+ }
236
+ };
237
+ if (expression === "smirk") {
238
+ svg += `<path d="M26,50 L42,50" stroke="${stroke}" stroke-width="2.5" stroke-linecap="round"/>`;
239
+ svg += drawEye(66, 52, 2);
240
+ } else {
241
+ svg += drawEye(34, 52, 0);
242
+ svg += drawEye(66, 52, 0);
243
+ }
244
+ if (decoration === "glasses") {
245
+ svg += `<circle cx="34" cy="52" r="11" fill="rgba(255,255,255,0.2)" stroke="#2d3436" stroke-width="2.5"/>`;
246
+ svg += `<circle cx="66" cy="52" r="11" fill="rgba(255,255,255,0.2)" stroke="#2d3436" stroke-width="2.5"/>`;
247
+ svg += `<path d="M45,50 Q50,48 55,50" fill="none" stroke="#2d3436" stroke-width="2.5" stroke-linecap="round"/>`;
248
+ }
249
+ svg += `<path d="M47,62 L53,62 L50,65 Z" fill="#ff9ff3" stroke="${stroke}" stroke-width="1" stroke-linejoin="round"/>`;
250
+ if (expression === "smile" || expression === "kawaii" || expression === "winking") {
251
+ svg += `<path d="M42,67 Q46,72 50,67 M50,67 Q54,72 58,67" fill="none" stroke="${stroke}" stroke-width="2" stroke-linecap="round"/>`;
252
+ } else if (expression === "open") {
253
+ svg += `<path d="M46,67 Q50,75 54,67 Z" fill="#ff7675" stroke="${stroke}" stroke-width="1.5" stroke-linejoin="round"/>`;
254
+ } else if (expression === "flat") {
255
+ svg += `<path d="M47,68 L53,68" stroke="${stroke}" stroke-width="2" stroke-linecap="round"/>`;
256
+ } else if (expression === "sad") {
257
+ svg += `<path d="M43,70 Q50,64 57,70" fill="none" stroke="${stroke}" stroke-width="2" stroke-linecap="round"/>`;
258
+ } else if (expression === "surprised") {
259
+ svg += `<circle cx="50" cy="70" r="3" fill="#1a1a1c"/>`;
260
+ } else if (expression === "smirk") {
261
+ svg += `<path d="M46,67 Q52,69 56,64" fill="none" stroke="${stroke}" stroke-width="2" stroke-linecap="round"/>`;
262
+ }
263
+ svg += `<path d="M28,62 L15,60 M28,65 L14,66" stroke="${stroke}" stroke-width="1.5" stroke-linecap="round" opacity="0.6"/>`;
264
+ svg += `<path d="M72,62 L85,60 M72,65 L86,66" stroke="${stroke}" stroke-width="1.5" stroke-linecap="round" opacity="0.6"/>`;
265
+ if (decoration === "headband") {
266
+ svg += `<path d="M16,35 Q50,20 84,35" fill="none" stroke="#e17055" stroke-width="6" stroke-linecap="round"/>`;
267
+ svg += `<path d="M50,15 L60,25 L50,28 L40,25 Z" fill="#fab1a0" stroke="#e17055" stroke-width="2"/>`;
268
+ } else if (decoration === "flower") {
269
+ svg += `<path d="M75,30 Q80,20 85,30 Q95,25 85,35 Q90,45 80,40 Q70,45 75,35 Q65,25 75,30 Z" fill="#ffeaa7" stroke="#fdcb6e" stroke-width="1.5"/>`;
270
+ svg += `<circle cx="80" cy="33" r="3" fill="#d63031"/>`;
271
+ } else if (decoration === "fish") {
272
+ svg += `<path d="M40,82 Q50,75 60,82 L65,78 L65,86 L60,82 Q50,89 40,82 Z" fill="#81ecec" stroke="${stroke}" stroke-width="1.5"/>`;
273
+ svg += `<circle cx="45" cy="81" r="1" fill="${stroke}"/>`;
274
+ }
275
+ svg += `</svg>`;
276
+ return `data:image/svg+xml,${encodeURIComponent(svg.replace(/\n\s*/g, ""))}`;
277
+ }
278
+
279
+ // src/utils/pixel-cats.ts
280
+ var variants = [
281
+ // 0: Shadow — Black cat (logo style)
282
+ {
283
+ body: "#2d2d30",
284
+ stroke: "#1a1a1c",
285
+ earInner: "#3d3d40",
286
+ eyeL: "#f8e71c",
287
+ eyeR: "#00f3ff",
288
+ nose: "#3a2a26"
289
+ },
290
+ // 1: Mikan — Orange tabby
291
+ {
292
+ body: "#e8842c",
293
+ stroke: "#1a1a1c",
294
+ earInner: "#f5a623",
295
+ eyeL: "#4ade80",
296
+ eyeR: "#4ade80",
297
+ nose: "#d46b1a"
298
+ },
299
+ // 2: Yuki — White cat
300
+ {
301
+ body: "#e8e8e8",
302
+ stroke: "#a0a0a0",
303
+ earInner: "#ffc0cb",
304
+ eyeL: "#60a5fa",
305
+ eyeR: "#60a5fa",
306
+ nose: "#f5a0b0"
307
+ },
308
+ // 3: Haiiro — Gray cat
309
+ {
310
+ body: "#7a7a80",
311
+ stroke: "#4a4a50",
312
+ earInner: "#9a9aa0",
313
+ eyeL: "#fbbf24",
314
+ eyeR: "#fbbf24",
315
+ nose: "#5a4a46"
316
+ },
317
+ // 4: Tuxedo — Black & white accents
318
+ {
319
+ body: "#2d2d30",
320
+ stroke: "#1a1a1c",
321
+ earInner: "#e0e0e0",
322
+ eyeL: "#22c55e",
323
+ eyeR: "#22c55e",
324
+ nose: "#3a2a26"
325
+ },
326
+ // 5: Mocha — Cream/beige
327
+ {
328
+ body: "#d4a574",
329
+ stroke: "#8b6914",
330
+ earInner: "#e8c9a0",
331
+ eyeL: "#d97706",
332
+ eyeR: "#d97706",
333
+ nose: "#a0705a"
334
+ },
335
+ // 6: Blue — Russian blue
336
+ {
337
+ body: "#6b8094",
338
+ stroke: "#3d5060",
339
+ earInner: "#8ba0b4",
340
+ eyeL: "#22c55e",
341
+ eyeR: "#22c55e",
342
+ nose: "#5a6a76"
343
+ },
344
+ // 7: Sakura — Fantasy pink
345
+ {
346
+ body: "#f472b6",
347
+ stroke: "#be185d",
348
+ earInner: "#f9a8d4",
349
+ eyeL: "#a855f7",
350
+ eyeR: "#c084fc",
351
+ nose: "#d44a8c"
352
+ }
353
+ ];
354
+ function makeCatSvg(c) {
355
+ return [
356
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">',
357
+ `<path d="M22,45 Q15,22 28,22 Q34,22 40,38" fill="${c.body}" stroke="${c.stroke}" stroke-width="2.5" stroke-linecap="round"/>`,
358
+ `<path d="M78,45 Q85,22 72,22 Q66,22 60,38" fill="${c.body}" stroke="${c.stroke}" stroke-width="2.5" stroke-linecap="round"/>`,
359
+ `<path d="M26,38 Q22,26 29,26 Q33,26 36,34" fill="${c.earInner}" opacity="0.5"/>`,
360
+ `<path d="M74,38 Q78,26 71,26 Q67,26 64,34" fill="${c.earInner}" opacity="0.5"/>`,
361
+ `<ellipse cx="50" cy="58" rx="36" ry="28" fill="${c.body}" stroke="${c.stroke}" stroke-width="2.5"/>`,
362
+ `<circle cx="35" cy="52" r="7" fill="${c.eyeL}" stroke="${c.stroke}" stroke-width="1.5"/>`,
363
+ `<circle cx="33" cy="49" r="2.5" fill="white"/>`,
364
+ `<circle cx="65" cy="52" r="7" fill="${c.eyeR}" stroke="${c.stroke}" stroke-width="1.5"/>`,
365
+ `<circle cx="63" cy="49" r="2.5" fill="white"/>`,
366
+ `<ellipse cx="50" cy="62" rx="3.5" ry="2.2" fill="${c.nose}"/>`,
367
+ `<path d="M42,67 Q46,72 50,67" fill="none" stroke="${c.stroke}" stroke-width="2" stroke-linecap="round"/>`,
368
+ `<path d="M50,67 Q54,72 58,67" fill="none" stroke="${c.stroke}" stroke-width="2" stroke-linecap="round"/>`,
369
+ "</svg>"
370
+ ].join("");
371
+ }
372
+ var catDataUris = variants.map((v) => {
373
+ const svg = makeCatSvg(v);
374
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
375
+ });
376
+ function getCatAvatar(index) {
377
+ return catDataUris[index % catDataUris.length];
378
+ }
379
+ function getCatAvatarByUserId(userId) {
380
+ let hash = 0;
381
+ for (let i = 0; i < userId.length; i++) {
382
+ hash = (hash << 5) - hash + userId.charCodeAt(i) | 0;
383
+ }
384
+ return getCatAvatar(Math.abs(hash) % catDataUris.length);
385
+ }
386
+ function getAllCatAvatars() {
387
+ const names = ["\u5F71\u5B50", "\u871C\u67D1", "\u5C0F\u96EA", "\u7070\u7070", "\u71D5\u5C3E\u670D", "\u6469\u5361", "\u84DD\u84DD", "\u5C0F\u6A31"];
388
+ return catDataUris.map((uri, i) => ({ index: i, name: names[i], dataUri: uri }));
389
+ }
390
+ function getCatSvgString(index) {
391
+ return makeCatSvg(variants[index % variants.length]);
392
+ }
393
+ var CAT_AVATAR_COUNT = variants.length;
394
+
395
+ // src/utils/index.ts
396
+ var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
397
+ var generateInviteCode = (0, import_nanoid.customAlphabet)(alphabet, 8);
398
+ function formatDate(date) {
399
+ const d = typeof date === "string" ? new Date(date) : date;
400
+ return d.toISOString();
401
+ }
402
+ function isValidEmail(email) {
403
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
404
+ }
405
+ function slugify(text) {
406
+ return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
407
+ }
408
+ // Annotate the CommonJS export names for ESM import in node:
409
+ 0 && (module.exports = {
410
+ CAT_AVATAR_COUNT,
411
+ CLIENT_EVENTS,
412
+ LIMITS,
413
+ SERVER_EVENTS,
414
+ formatDate,
415
+ generateInviteCode,
416
+ generateRandomCatConfig,
417
+ getAllCatAvatars,
418
+ getCatAvatar,
419
+ getCatAvatarByUserId,
420
+ getCatSvgString,
421
+ isValidEmail,
422
+ renderCatSvg,
423
+ slugify
424
+ });
@@ -0,0 +1,3 @@
1
+ export { CLIENT_EVENTS, ClientEvent, LIMITS, SERVER_EVENTS, ServerEvent } from './constants/index.cjs';
2
+ export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, Attachment, AuthResponse, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, DmAttachment, DmChannel, DmMessage, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, Message, Notification, NotificationType, ReactionGroup, RegisterRequest, SendMessageRequest, Server, Thread, UpdateChannelRequest, UpdateDmMessageRequest, UpdateMessageRequest, UpdateServerRequest, User, UserProfile, UserStatus } from './types/index.cjs';
3
+ export { BgPattern, CAT_AVATAR_COUNT, CatConfig, CatDecoration, CatExpression, CatPattern, formatDate, generateInviteCode, generateRandomCatConfig, getAllCatAvatars, getCatAvatar, getCatAvatarByUserId, getCatSvgString, isValidEmail, renderCatSvg, slugify } from './utils/index.cjs';
@@ -0,0 +1,3 @@
1
+ export { CLIENT_EVENTS, ClientEvent, LIMITS, SERVER_EVENTS, ServerEvent } from './constants/index.js';
2
+ export { Agent, AgentCapability, AgentInfo, AgentKernelType, AgentStatus, Attachment, AuthResponse, Channel, ChannelSortBy, ChannelSortDirection, ChannelSortOptions, ChannelType, CreateAgentRequest, CreateChannelRequest, CreateServerRequest, DmAttachment, DmChannel, DmMessage, FriendEntry, FriendSource, Friendship, FriendshipStatus, LoginRequest, Member, MemberRole, Message, Notification, NotificationType, ReactionGroup, RegisterRequest, SendMessageRequest, Server, Thread, UpdateChannelRequest, UpdateDmMessageRequest, UpdateMessageRequest, UpdateServerRequest, User, UserProfile, UserStatus } from './types/index.js';
3
+ export { BgPattern, CAT_AVATAR_COUNT, CatConfig, CatDecoration, CatExpression, CatPattern, formatDate, generateInviteCode, generateRandomCatConfig, getAllCatAvatars, getCatAvatar, getCatAvatarByUserId, getCatSvgString, isValidEmail, renderCatSvg, slugify } from './utils/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ import {
2
+ CLIENT_EVENTS,
3
+ LIMITS,
4
+ SERVER_EVENTS
5
+ } from "./chunk-EMLX23LF.js";
6
+ import "./chunk-6H4LIJZC.js";
7
+ import {
8
+ CAT_AVATAR_COUNT,
9
+ formatDate,
10
+ generateInviteCode,
11
+ generateRandomCatConfig,
12
+ getAllCatAvatars,
13
+ getCatAvatar,
14
+ getCatAvatarByUserId,
15
+ getCatSvgString,
16
+ isValidEmail,
17
+ renderCatSvg,
18
+ slugify
19
+ } from "./chunk-PXKHJSTK.js";
20
+ export {
21
+ CAT_AVATAR_COUNT,
22
+ CLIENT_EVENTS,
23
+ LIMITS,
24
+ SERVER_EVENTS,
25
+ formatDate,
26
+ generateInviteCode,
27
+ generateRandomCatConfig,
28
+ getAllCatAvatars,
29
+ getCatAvatar,
30
+ getCatAvatarByUserId,
31
+ getCatSvgString,
32
+ isValidEmail,
33
+ renderCatSvg,
34
+ slugify
35
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/index.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);