k2-im 0.1.30 → 0.1.31

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.
@@ -1,8 +1,8 @@
1
1
  /** 媒体业务类型:实现据此选对象存储逻辑桶;sticker 对应 app-sticker。 */
2
2
  type MediaKind = 'image' | 'video' | 'voice' | 'file' | 'sticker';
3
3
 
4
- /** 会话类型。P0 只用 direct / group。 */
5
- type ConversationType = 'direct' | 'group' | 'channel' | 'supergroup';
4
+ /** 会话类型。P0 只用 direct / group;`robot` 是独立私聊 sibling,不得并入 direct。 */
5
+ type ConversationType = 'direct' | 'group' | 'channel' | 'supergroup' | 'robot';
6
6
  /**
7
7
  * 会话复合身份;`conversationId` 只在对应 `conversationType` 的领域内唯一。
8
8
  *
@@ -39,8 +39,8 @@ interface ConversationDraft$1 {
39
39
  attachments: readonly [];
40
40
  updatedAt: number;
41
41
  }
42
- /** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);robot=机器人卡片(contentType=18);miniProgram=小程序分享卡(contentType=22);redPacket=红包卡(contentType=25);game=小游戏(contentType=27);未知 wire 正文统一归一为 unknown。 */
43
- type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'call' | 'redPacket' | 'mediaAlbum' | 'robot' | 'unknown';
42
+ /** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);gift=礼品/刮刮卡(contentType=17);robot=机器人卡片(contentType=18);miniProgram=小程序分享卡(contentType=22);redPacket=红包卡(contentType=25);game=小游戏(contentType=27);未知 wire 正文统一归一为 unknown。 */
43
+ type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'gift' | 'call' | 'redPacket' | 'mediaAlbum' | 'robot' | 'unknown';
44
44
  /**
45
45
  * 发送态(客户端态):消息从本地创建到服务端确认的生命周期。
46
46
  * `uploading` 仅媒体消息使用:文件上传阶段(uploading→pending→sending→sent);
@@ -109,6 +109,8 @@ type LastMessageSummary = {
109
109
  gameType: ImGameType;
110
110
  } | {
111
111
  kind: 'transfer';
112
+ } | {
113
+ kind: 'gift';
112
114
  } | {
113
115
  kind: 'call';
114
116
  callKind: ImCallKind;
@@ -308,13 +310,14 @@ type ImGameBody = {
308
310
  * - `default`:0,普通可点卡片
309
311
  * - `board-game`:1,棋牌样式且不可点
310
312
  * - `board-game-link`:2,棋牌样式且可点
313
+ * - `game-preview`:3,气泡内嵌游戏预览 WebView
311
314
  * - `unknown`:必须同时保留 `rawShowType`,不得猜成可点/不可点
312
315
  */
313
- type ImMiniProgramShowType = 'default' | 'board-game' | 'board-game-link' | 'unknown';
316
+ type ImMiniProgramShowType = 'default' | 'board-game' | 'board-game-link' | 'game-preview' | 'unknown';
314
317
  /**
315
318
  * 小程序分享卡片正文(contentType==='miniProgram',协议 BMessage.contentType=22)。
316
319
  *
317
- * @remarks 字段来自 iOS `IMMiniProgramMessageBody` / proto 61-67、80-82、90-93。
320
+ * @remarks 字段来自 iOS `IMMiniProgramMessageBody` / proto 61-67、80-82、90-96。
318
321
  * `currencySource` 对应 proto field 90(无 miniProgram 前缀):`xj` 现金公司、`xy` 信用公司。
319
322
  * `subGameName` 保持服务端 JSON 字符串,不在 Core 解析语种表。打开小程序与 X 币/信用 ID 属于宿主,不进本 DTO。
320
323
  */
@@ -338,6 +341,12 @@ interface ImMiniProgramBody {
338
341
  gamePath?: string;
339
342
  /** 多语言子游戏名 JSON 字符串,例如 `{"ch":"...","en":"..."}`。 */
340
343
  subGameName?: string;
344
+ /** 游戏预览页地址(BMessage.miniProgramGamePreviewUrl,showType=3)。 */
345
+ gamePreviewUrl?: string;
346
+ /** 游戏预览设计宽(BMessage.miniProgramGamePreviewWidth)。 */
347
+ gamePreviewWidth?: number;
348
+ /** 游戏预览设计高(BMessage.miniProgramGamePreviewHeight)。 */
349
+ gamePreviewHeight?: number;
341
350
  }
342
351
  /**
343
352
  * 机器人卡片文本模块(wire `section`)。
@@ -416,6 +425,40 @@ interface ImTransferBody {
416
425
  coinName?: string;
417
426
  coinIcon?: string;
418
427
  }
428
+ /** 礼品类型。协议注释为刮刮卡 1 / 奖品 2;Android 当前会把 WelfareGiftType=0 写进消息,入站必须接受 0。 */
429
+ type ImGiftType = 0 | 1 | 2;
430
+ /** 礼品状态。0 待领取 / 1 已收款 / 2 已退还 / 3 已过期(对齐 iOS IMGiftMessageBody)。 */
431
+ type ImGiftStatus = 0 | 1 | 2 | 3;
432
+ /** 礼品会话类型。1 个人 / 2 群(BMessage.sessionType)。 */
433
+ type ImGiftSessionType = 1 | 2;
434
+ /**
435
+ * 礼品卡片正文(contentType==='gift',协议 BMessage.contentType=17)。
436
+ *
437
+ * @remarks 字段来自 iOS `IMGiftMessageBody` / proto 51-59,并复用转账字段族的 fromUid/toUid/serialNumber。
438
+ * 赠卡 HTTP 属于宿主;本 DTO 只承载会话卡片。H5 出站刮刮卡写 giftType=1。
439
+ */
440
+ interface ImGiftBody {
441
+ fromUid: string;
442
+ toUid: string;
443
+ fromUserName?: string;
444
+ toUserName?: string;
445
+ giftType: ImGiftType;
446
+ giftName: string;
447
+ giftIcon?: string;
448
+ explain?: string;
449
+ state: ImGiftStatus;
450
+ serialNumber: string;
451
+ sessionType: ImGiftSessionType;
452
+ initiateTime: number;
453
+ /** 单张金额的十进制字符串;0 或缺省表示未带金额。 */
454
+ amount?: string;
455
+ receiveTime?: number;
456
+ returnTime?: number;
457
+ isRead?: boolean;
458
+ zhangCount?: string;
459
+ benCount?: string;
460
+ fissionNumber?: string;
461
+ }
419
462
  /** 领域通话媒体类型;已从各端 wire 0/1 对调口径归一,宿主禁止再读 raw callType。 */
420
463
  type ImCallKind = 'audio' | 'video';
421
464
  /**
@@ -574,6 +617,8 @@ interface ImMessageBody {
574
617
  game?: ImGameBody;
575
618
  /** contentType==='transfer' 时的转账卡片。 */
576
619
  transfer?: ImTransferBody;
620
+ /** contentType==='gift' 时的礼品/刮刮卡卡片。 */
621
+ gift?: ImGiftBody;
577
622
  /** contentType==='call' 时的单聊通话记录。 */
578
623
  call?: ImCallRecordBody;
579
624
  /** contentType==='redPacket' 时的红包卡片。 */
@@ -962,7 +1007,7 @@ interface OutboxMessage {
962
1007
  resumePolicy?: 'automatic' | 'manual';
963
1008
  }
964
1009
  /** 当前 SDK 已注册发送策略、因此可作为转发目标的会话类型;supergroup 未注册,继续在编译期排除。 */
965
- type ForwardTargetConversationType = Extract<ConversationType, 'direct' | 'group' | 'channel'>;
1010
+ type ForwardTargetConversationType = Extract<ConversationType, 'direct' | 'group' | 'channel' | 'robot'>;
966
1011
  /** 转发目标会话;运行时仍由 SendStrategyRegistry 复核,避免类型声明与实际装配漂移。 */
967
1012
  interface ForwardTarget {
968
1013
  conversationId: string;
@@ -1854,8 +1899,11 @@ interface ImSessionFavoritePort {
1854
1899
  * 消息、Reaction 与分页边界必须整页原子保存,只有前台实际消费时才进入正常消息流程。
1855
1900
  */
1856
1901
  interface ImRecentHistoryPage {
1857
- /** 缓存记录格式版本;不认识的版本不能当作有效页使用。 */
1858
- version: 1;
1902
+ /**
1903
+ * 缓存记录格式版本;不认识的版本不能当作有效页使用。
1904
+ * v2:小程序 showType=3 / proto 94-96 进入领域正文,旧页必须重新拉网解析。
1905
+ */
1906
+ version: 2;
1859
1907
  /** 当前账号内的精确 GROUP/CHANNEL 会话;direct 没有此远端最近页能力。 */
1860
1908
  conversation: ConversationRef<'group' | 'channel'>;
1861
1909
  /** 成功获取页面的毫秒时间,用于保留期限和按获取时间淘汰。 */
@@ -3155,6 +3203,10 @@ interface MiniProgramMessageOptions {
3155
3203
  interface TransferMessageOptions {
3156
3204
  replyToMessageId?: string;
3157
3205
  }
3206
+ /** 礼品卡片发送选项;正文必须已含福利中心赠送后的流水号与卡面。 */
3207
+ interface GiftMessageOptions {
3208
+ replyToMessageId?: string;
3209
+ }
3158
3210
  /**
3159
3211
  * 媒体合集里的一项:一张图片或一个视频。
3160
3212
  *
@@ -3575,7 +3627,7 @@ interface ConversationPrefetchOptions {
3575
3627
  * skipped 表示当前类型、权限、存储或预算不允许预取;失败不改变正常打开会话的行为。
3576
3628
  */
3577
3629
  interface ConversationPrefetchResult {
3578
- ref: ConversationRef<'direct' | 'group' | 'channel'>;
3630
+ ref: ConversationRef<'direct' | 'group' | 'channel' | 'robot'>;
3579
3631
  status: 'ready' | 'skipped' | 'failed' | 'cancelled';
3580
3632
  reason?: 'unsupported' | 'unavailable' | 'storage-unavailable' | 'budget' | 'page-too-large' | 'decrypt-failed' | 'invalidated' | 'cancelled';
3581
3633
  error?: ImSdkErrorShape;
@@ -3618,7 +3670,7 @@ interface ConversationDraftApi {
3618
3670
  subscribe: (listener: (draft: ConversationDraft | null) => void) => () => void;
3619
3671
  }
3620
3672
  /**
3621
- * 当前账号的跨组件草稿 API;所有动作都要求 direct/GROUP/CHANNEL 精确复合身份。
3673
+ * 当前账号的跨组件草稿 API;所有动作都要求 direct / GROUP / CHANNEL / robot 精确复合身份。
3622
3674
  *
3623
3675
  * @example
3624
3676
  * ```ts
@@ -3642,11 +3694,11 @@ interface ImDraftsApi {
3642
3694
 
3643
3695
  /**
3644
3696
  * SDK 会话列表内部 sibling 路由与会话级写动作。
3645
- * 置顶、免打扰、已读和本地删除都要求精确 `ConversationRef`,并按 direct/GROUP/CHANNEL 独立协议分流。
3697
+ * 置顶、免打扰、已读和本地删除都要求精确 `ConversationRef`,并按 direct/GROUP/CHANNEL/robot 独立协议分流。
3646
3698
  */
3647
3699
 
3648
3700
  /** 当前兼容门面支持的精确会话 ref。 */
3649
- type ImSupportedConversationRef = ConversationRef<'direct' | 'group' | 'channel'>;
3701
+ type ImSupportedConversationRef = ConversationRef<'direct' | 'group' | 'channel' | 'robot'>;
3650
3702
  /**
3651
3703
  * 会话 API 的迁移期入参。优先传完整 ref;旧 string 仅在当前 session 中唯一命中时可用。
3652
3704
  *
@@ -4045,7 +4097,7 @@ interface ImDirectCallsApi {
4045
4097
  * Blob 只经 storage 持久化。异步读取使用运行时代际防止切会话/切账号晚返回,宿主负责最终渲染与 URL 释放。
4046
4098
  */
4047
4099
 
4048
- type ConversationBackgroundConversationType = 'direct' | 'group' | 'channel';
4100
+ type ConversationBackgroundConversationType = 'direct' | 'group' | 'channel' | 'robot';
4049
4101
  interface ConversationBackgroundPreset {
4050
4102
  id: string;
4051
4103
  url: string;
@@ -4207,7 +4259,7 @@ interface ImChannelProfile {
4207
4259
  */
4208
4260
 
4209
4261
  /** default 会话列表支持的精确类型;`supergroup` 继续受产品 Gate 约束。 */
4210
- type ProductConversationListType = 'direct' | 'group' | 'channel';
4262
+ type ProductConversationListType = 'direct' | 'group' | 'channel' | 'robot';
4211
4263
  /** GROUP 会话限制状态;与 CHANNEL 状态保持独立 sibling。 */
4212
4264
  type ImGroupConversationState = GroupSessionState;
4213
4265
  /**
@@ -4266,6 +4318,8 @@ type ConversationLastMessageSummary = {
4266
4318
  kind: 'robot';
4267
4319
  } | {
4268
4320
  kind: 'transfer';
4321
+ } | {
4322
+ kind: 'gift';
4269
4323
  } | {
4270
4324
  kind: 'redPacket';
4271
4325
  } | {
@@ -4421,6 +4475,12 @@ interface DirectConversationCapabilities {
4421
4475
  canUseMessageActions: CapabilityDecision;
4422
4476
  canManageRelationship: CapabilityDecision;
4423
4477
  }
4478
+ interface RobotConversationCapabilities {
4479
+ canSendMessages: CapabilityDecision;
4480
+ canOpenProfile: CapabilityDecision;
4481
+ canUseMessageActions: CapabilityDecision;
4482
+ canReadHistory: CapabilityDecision;
4483
+ }
4424
4484
  /**
4425
4485
  * 普通群能力快照。
4426
4486
  *
@@ -4487,6 +4547,8 @@ type ConversationCapabilitySnapshot = (ConversationCapabilityBase<'direct'> & {
4487
4547
  value: GroupConversationCapabilities;
4488
4548
  }) | (ConversationCapabilityBase<'channel'> & {
4489
4549
  value: ChannelConversationCapabilities;
4550
+ }) | (ConversationCapabilityBase<'robot'> & {
4551
+ value: RobotConversationCapabilities;
4490
4552
  });
4491
4553
  interface ImConversationCapabilitiesApi {
4492
4554
  /** 只读取 SDK 当前本机真相与已刷新过的资料/关系投影,不隐式联网。 */
@@ -4653,7 +4715,7 @@ interface ImMessagesByIdResult<TMessage> {
4653
4715
  */
4654
4716
 
4655
4717
  /** 当前已接线的产品 handle 会话类型;三者只在无会话语义原子层复用。 */
4656
- type ProductHandleConversationType = 'direct' | 'group' | 'channel';
4718
+ type ProductHandleConversationType = 'direct' | 'group' | 'channel' | 'robot';
4657
4719
  /**
4658
4720
  * 会话 handle 初始打开位置。
4659
4721
  *
@@ -4788,6 +4850,12 @@ interface ConversationMessageApi {
4788
4850
  * @remarks CHANNEL 当前产品入口不发送转账,会返回 unsupported。消息固定明文。
4789
4851
  */
4790
4852
  sendTransfer: (transfer: ImTransferBody, options?: TransferMessageOptions) => Promise<SendMessageResult>;
4853
+ /**
4854
+ * 发送礼品卡片。调用方必须先完成福利中心 HTTP 赠送。
4855
+ *
4856
+ * @remarks CHANNEL 当前产品入口不发送礼物,会返回 unsupported。消息固定明文。
4857
+ */
4858
+ sendGift: (gift: ImGiftBody, options?: GiftMessageOptions) => Promise<SendMessageResult>;
4791
4859
  /** 当前用户已选相同 emoji 时移除,否则添加或替换。emoji 必须是协议 token,例如 `[Great]`。 */
4792
4860
  toggleReaction: (messageId: string, emoji: string) => Promise<ImReactionChangeResult>;
4793
4861
  /** 显式添加/替换或移除,供参与者详情等不能用 toggle 猜动作的产品交互。 */
@@ -5627,6 +5695,57 @@ interface ImRequestError {
5627
5695
  */
5628
5696
  type ImRequestErrorHandler = (issue: ImRequestError) => void | Promise<void>;
5629
5697
 
5698
+ /**
5699
+ * 机器人目录产品分页运行时。
5700
+ * 服务端页码封装为绑定账号 runtime 与查询条件的 opaque token;伪造、跨筛选或已消费 token 显式失败。
5701
+ */
5702
+
5703
+ /**
5704
+ * 机器人目录查询范围。
5705
+ *
5706
+ * `catalog` 对齐通讯录「查找机器人」;`conversation` 对齐群/社群资料添加与输入栏已绑定列表。
5707
+ */
5708
+ type ImRobotDirectoryScope = {
5709
+ kind: 'catalog';
5710
+ } | {
5711
+ kind: 'conversation';
5712
+ conversationType: 'group' | 'channel';
5713
+ conversationId: string;
5714
+ /** `bound` 对齐 iOS 输入栏 `search_type=1`。 */
5715
+ filter?: 'bound';
5716
+ };
5717
+ /** 机器人目录项;只保留打开私聊和列表展示所需字段。 */
5718
+ interface ImRobotDirectoryItem {
5719
+ id: string;
5720
+ displayName: string;
5721
+ username?: string;
5722
+ avatarUrl?: string;
5723
+ bound?: boolean;
5724
+ }
5725
+ /** 把机器人绑定或解绑到普通群/社群。 */
5726
+ interface ImRobotConversationBindInput {
5727
+ robotId: string;
5728
+ conversationType: 'group' | 'channel';
5729
+ conversationId: string;
5730
+ }
5731
+ /** 机器人目录页;服务端页码由 SDK token 封装,UI 只能原样续页。 */
5732
+ interface ImRobotDirectoryPage {
5733
+ items: readonly ImRobotDirectoryItem[];
5734
+ nextPageToken?: ImPageToken;
5735
+ exhausted: boolean;
5736
+ }
5737
+ /** 机器人目录产品分页面。 */
5738
+ interface ImRobotsApi {
5739
+ listFirstPage: (options?: {
5740
+ scope?: ImRobotDirectoryScope;
5741
+ keyword?: string;
5742
+ pageSize?: number;
5743
+ }) => Promise<ImRobotDirectoryPage>;
5744
+ listNextPage: (pageToken: ImPageToken) => Promise<ImRobotDirectoryPage>;
5745
+ bindToConversation: (input: ImRobotConversationBindInput) => Promise<void>;
5746
+ unbindFromConversation: (input: ImRobotConversationBindInput) => Promise<void>;
5747
+ }
5748
+
5630
5749
  /**
5631
5750
  * 当前账号本地会话与消息的分场景产品搜索运行时。
5632
5751
  *
@@ -5689,6 +5808,8 @@ interface ImMessageSearchApi {
5689
5808
  inGroup: (conversation: ConversationRef<'group'>, keyword: string) => Promise<ProductMessageSearchPage<MessageContentType>>;
5690
5809
  /** 搜索 CHANNEL 本地历史;当前不调用未闭合的远端 CHANNEL 搜索/定位协议。 */
5691
5810
  inChannel: (conversation: ConversationRef<'channel'>, keyword: string) => Promise<ProductMessageSearchPage<MessageContentType>>;
5811
+ /** 搜索 robot 本地历史;无远端历史,不得回退 direct。 */
5812
+ inRobot: (conversation: ConversationRef<'robot'>, keyword: string) => Promise<ProductMessageSearchPage<MessageContentType>>;
5692
5813
  /** 只搜索文本消息;关键词必填且不能为空。 */
5693
5814
  texts: (conversation: ConversationRef<ProductHandleConversationType>, keyword: string) => Promise<ProductMessageSearchPage<'text'>>;
5694
5815
  /** 只搜索文件消息;省略或传空白关键词时按文件分类浏览。 */
@@ -6225,7 +6346,7 @@ interface AdvancedConversationsApi extends ImConversationsApi, ImConversationBac
6225
6346
  *
6226
6347
  * @internal
6227
6348
  */
6228
- ensureOpenableConversation: (ref: ConversationRef) => Promise<ConversationRef<'direct' | 'group' | 'channel'>>;
6349
+ ensureOpenableConversation: (ref: ConversationRef) => Promise<ConversationRef<'direct' | 'group' | 'channel' | 'robot'>>;
6229
6350
  }
6230
6351
  /**
6231
6352
  * 普通宿主的真实 default client。
@@ -6249,6 +6370,8 @@ interface ImProductClient {
6249
6370
  readonly conversations: ImConversationListApi;
6250
6371
  /** 当前账号完整联系人、群组和社群目录的统一搜索。 */
6251
6372
  readonly directory: ImDirectorySearchApi;
6373
+ /** 机器人公开目录;通讯录查找与群/社群绑定列表共用分页合同。 */
6374
+ readonly robots: ImRobotsApi;
6252
6375
  readonly contacts: ImContactsApi;
6253
6376
  readonly groups: ImGroupsApi;
6254
6377
  readonly channels: ImChannelsApi;
@@ -6298,6 +6421,7 @@ interface ImClient extends Omit<ImProductClient, 'capabilities' | 'channels' | '
6298
6421
  (ref: ConversationRef<'direct'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'direct'>>;
6299
6422
  (ref: ConversationRef<'group'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'group'>>;
6300
6423
  (ref: ConversationRef<'channel'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'channel'>>;
6424
+ (ref: ConversationRef<'robot'>, options?: ConversationOpenOptions): Promise<ConversationHandle<'robot'>>;
6301
6425
  };
6302
6426
  /** 当前账号草稿产品面;按复合身份持久化,handle.draft 委托同一状态源。 */
6303
6427
  drafts: ImDraftsApi;
@@ -6617,15 +6741,62 @@ type MessageNotificationDecision = {
6617
6741
  /** PC/H5 共用的实时消息提醒规则;离线历史回放不逐条弹通知。 */
6618
6742
  declare function resolveMessageNotificationDecision(input: MessageNotificationInput): MessageNotificationDecision;
6619
6743
 
6744
+ /**
6745
+ * 小程序游戏预览卡(消息 22 且 `showType=game-preview`)的呈现判定。
6746
+ *
6747
+ * 三端契约一致:BMessage proto 94 是一个远程页面地址,95/96 是它的作者尺寸。
6748
+ * 安卓用 WebView、iOS 用 WKWebView 顶层加载它,都不回退 `icon`。Web 宿主用 iframe 对应,
6749
+ * 但多了一个原生没有的问题——同一个字段偶尔指向的是图片资源,iframe 装图片会丢掉缩放控制。
6750
+ * 这个判定因此属于 Chat Kit 而不是某个宿主:两端要给出同一个答案,各写一份必然漂移。
6751
+ */
6752
+ /** proto 95/96 缺失时的源尺寸,与安卓 `bg_default_applet` 的 280×180 一致。 */
6753
+ declare const MINI_PROGRAM_GAME_PREVIEW_FALLBACK_WIDTH = 280;
6754
+ declare const MINI_PROGRAM_GAME_PREVIEW_FALLBACK_HEIGHT = 180;
6755
+ interface MiniProgramGamePreviewInput {
6756
+ gamePreviewUrl?: string;
6757
+ gamePreviewWidth?: number;
6758
+ gamePreviewHeight?: number;
6759
+ /** 宿主已经观察到 `<img>` 加载失败,说明该地址其实是文档,翻回 document。 */
6760
+ imageLoadFailed?: boolean;
6761
+ }
6762
+ interface MiniProgramGamePreviewLayout {
6763
+ /** 去空白后的 proto 94;为空串时 `render` 恒为 `empty`。 */
6764
+ url: string;
6765
+ /** 按源尺寸等比缩放用的作者宽高,永远是正数。 */
6766
+ sourceWidth: number;
6767
+ sourceHeight: number;
6768
+ /**
6769
+ * `document` 顶层加载远程页面(对应原生 WebView);`image` 地址明确是图片资源;
6770
+ * `empty` 无地址,画占位卡——占位本身是合法终态,不是待修复状态。
6771
+ */
6772
+ render: 'document' | 'image' | 'empty';
6773
+ }
6774
+ /**
6775
+ * 默认按 document 处理:线上真实地址形如 `…/p2p-share?lang=zh&banker_order_id=905`,
6776
+ * 既没有 `.html` 后缀也没有图片后缀,按后缀白名单猜 iframe 会把它错判成图片。
6777
+ */
6778
+ declare function resolveMiniProgramGamePreviewLayout(input: MiniProgramGamePreviewInput): MiniProgramGamePreviewLayout;
6779
+
6620
6780
  /**
6621
6781
  * 拼装频道 rel / 消息 22 打开小程序用的地址。
6622
6782
  * 有 host 时按大厅规则拼 suffix;只有 suffix 时只接受完整 URL 或带点的主机名,
6623
6783
  * 不能把 `/path` 当成域名。
6624
6784
  */
6785
+ /** `board-game` / `unknown` 不可点;默认卡、棋牌可点卡、游戏预览卡可以点开。 */
6786
+ declare function isMiniProgramShowTypeOpenable(showType: string): boolean;
6625
6787
  interface MiniProgramOpenUrlInput {
6626
6788
  domain?: string;
6627
6789
  suffixAddress?: string;
6628
6790
  h5Url?: string;
6791
+ /**
6792
+ * 正文字段 92 `miniProgramGamePath`,分享方写入的落地定位参数。
6793
+ *
6794
+ * 原样并进入口地址的 query,与 iOS `mergedSuffixAddressWithHost:suffixAddress:miniProgramGamePath:`
6795
+ * 同形:宿主据此得到的 `suffix_address` 才是 gameserver 认的载体(它从 suffix 里取
6796
+ * `game_params` 覆盖 `req.GameParams`)。值的编码由分享方负责,这里不再编解码,
6797
+ * 否则会多编或少编一层,`buildAppendUrlParams` 只解一次就会解坏。
6798
+ */
6799
+ gamePath?: string;
6629
6800
  }
6630
6801
  declare function resolveMiniProgramOpenUrl(input: MiniProgramOpenUrlInput): string;
6631
6802
  /** 悬浮外链:suffix 已是完整地址或主机名时直接用;只有路径时必须拼到 domain 上。 */
@@ -7029,7 +7200,7 @@ interface ChatRuntime {
7029
7200
  /** 撤销当前账号创建的全部媒体预览地址并释放 Blob 内存,切账号、退出或销毁时调用。 */
7030
7201
  cleanupLocalMediaBlobs: () => void;
7031
7202
  /** 删除会话时释放该会话绑定的本地媒体预览/播放缓存。 */
7032
- cleanupConversationMediaBlobs: (conversation: ConversationRef<'direct' | 'group' | 'channel'>) => void;
7203
+ cleanupConversationMediaBlobs: (conversation: ConversationRef<'direct' | 'group' | 'channel' | 'robot'>) => void;
7033
7204
  }
7034
7205
  /**
7035
7206
  * 创建一个可承载当前及后续登录账号的 IM 运行环境。
@@ -8914,5 +9085,5 @@ declare function resampleWaveform(data: readonly number[], targetCount: number):
8914
9085
  */
8915
9086
  declare function placeholderWaveform(seed: string, count: number): number[];
8916
9087
 
8917
- export { DEFAULT_EMOJI_ASSET_BASE, DEFAULT_LOADING_MINIMUM_VISIBLE_MS, DEFAULT_LOADING_SHOW_DELAY_MS, EMOJI_CATALOG, EMOJI_GAME_DICE_STABLE_KEY, EMOJI_GAME_RPS_STABLE_KEY, EMOJI_TOKEN_RE, MAX_BATCH_FILES, MAX_RECENT_EMOJI_COUNT, MINI_PROGRAM_LANG_NUMBERS, SPIKE_STEP, UNICODE_EMOJI_CATALOG, blockReasonForChannelSession, blockReasonForChannelState, blockReasonForGroupState, blockReasonForSession, calculateMediaBox, canEditMessage, canPinChannelMessage, canPinGroupMessage, canPinMessage, canPromoteMediaPresentationSource, canRecallMessage, canTransmit, canTransmitByType, canTransmitContent, cancelMediaUpload, captureRuntimeClientOperation, captureRuntimeOperation, channelMiniProgramRelKey, classifyGifFile, classifyMediaFile, countUnreadConversations, createChatRuntime, createConversationPrefetchController, createDelayedLoadingIndicator, createEmojiMatcher, createLinkMatcher, createNewMessageBadgeController, createThreadItems, csvIncludes, decideChannelMiniProgramRelOpen, decideConversationAction, decideMemberTargetAction, decideMessageAction, emojiAssetUrl, emojiUrlByCode, fetchConversationFileBatch, fetchConversationImageBatch, fetchConversationMessageBatch, fetchConversationVideoBatch, fetchConversationVoiceBatch, fetchNextConversationSearchBatch, formatChatDateSeparator, formatConversationDisplayTime, formatConversationUnreadBadge, formatFileSize, formatMediaDuration, forward_service as forwardService, getFileExtension, getLocalDayKey, hasEmojiCandidate, hasLinkCandidate, highlightSegments, isGifFile, isMessageLocateScrollProtected, isMessageTailChangeFromOlderWindowTrim, isMessageViewportMeasurable, isMessageVisibleForNewMessageBadge, isPinnedMessageProtected, isVoiceStorageConfigured, loadOlderUntilBoundary, mediaBatchBudgetBytes, media_service as mediaService, message_service as messageService, normalizeLinkHref, parseUnicodeEmojiCode, pinnedMessage_service as pinnedMessageService, placeholderWaveform, prependRecentEmoji, profile_service as profileService, read_service as readService, refreshPrependMessageAnchorPosition, replaceInterruptedMediaFile, requiresConversationEncryption, requiresForwardTypeConfirmation, resampleWaveform, resolveBestMediaPresentationSource, resolveCenteredMessageScrollTop, resolveChannelMemberAvatarUrl, resolveChannelMemberDisplayName, resolveChannelMiniProgramRelIcon, resolveChannelMiniProgramRelName, resolveChannelMiniProgramRelOpenSurface, resolveChannelMiniProgramRelUrl, resolveChannelPinnedGameCopy, resolveConversationListPresentation, resolveDisplayTimestamp, resolveEmojiToken, resolveFriendDisplayName, resolveImProfileAccessDestination, resolveImThreadActiveDate, resolveMediaPresentation, resolveMemberDisplayName, resolveMessageBodyKind, resolveMessageNotificationDecision, resolveMessageTimelineTimestamp, resolveMiniProgramFloatLinkUrl, resolveMiniProgramOpenUrl, resolvePrependMessageAnchor, resolvePrependMessageAnchorAdjustment, resolvePrependMessageAnchorPosition, resolvePublicNickname, resolveQuotedMessagePresentation, resolveSenderAvatarUrl, resolveStandaloneEmojiMessage, resolveSurvivingMessageAnchorAdjustment, resolveUnicodeEmoji, resolveVisibleChannelMiniProgramRels, resolveVisibleMessageAnchorPositions, retryMessage, runMediaSendBatch, sendAsFilesBatch, sendBlockReasonForDecision, sendMediaAlbum, sendMediaFile, sendMediaFilesBatch, sendText, sendVoice, shouldCompleteInitialViewport, shouldFillInitialHistoryViewport, shouldFollowIncomingMessage, shouldLoadNewerHistoryPage, shouldPrefetchOlderHistory, shouldRestoreMessageViewportFocus, shouldShowChatDateSeparator, shouldTrackRemoteMessageForBadge, sortChannelMiniProgramFloatingItems, spikeCountForDuration, supportsConversationMention, unicodeEmojiTextFromCode };
8918
- export type { ApplySessionResult, BrowseMessagesInput, CanPinMessageInput, CenteredMessageScrollInput, ChannelMiniProgramOpenGame, ChannelMiniProgramRelOpenDecision, ChannelMiniProgramRelOpenSurface, ChatMediaMessageRef, ChatProfileAdapter, ChatRuntime, ChatRuntimeCredentials, ChatRuntimeFactories, ChatRuntimeHostDeps, ChatRuntimeOpResult, ConversationCapabilityAction, ConversationListPresentation, ConversationListPresentationLabels, ConversationListPresentationOptions, ConversationListPreviewMediaKind, ConversationListPreviewSegment, ConversationPrefetchController, ConversationPrefetchControllerOptions, ConversationSearchCategory, CreateThreadItemsInput, DelayedLoadingIndicator, DelayedLoadingIndicatorOptions, EmojiEntry, EmojiRecentItem, EmojiSegment, FormatTimeDisplayContext, ForwardCommandHooks, GifFileClassification, HighlightSegment, ImChannelMemberPresentation, ImChannelMentionPresentation, ImChannelProfilePresentation, ImForwardOperationResult, ImGroupMemberPresentation, ImMediaBatchSendResult, ImMessageActionResult, ImMessageBodyKind, ImMessageView, ImPinnedMessageActionResult, ImPinnedMessageSnapshot, ImProfileAccessDestination, ImQuotedMessagePresentation, ImTextResolver, ImThreadActiveDateSnapshot, ImThreadDateMarkerMetric, ImThreadDecoration, ImThreadEncryptionItem, ImThreadIntent, ImThreadItem, ImThreadPresentationAdapter, ImThreadReadActions, ImThreadReadTargetResolver, ImThreadViewportMetrics, IncomingMessageFollowInput, InitialHistoryViewportFillInput, InitialViewportCompletionInput, LinkSegment, MediaBatchBudgetOptions, MediaBatchLimitInfo, MediaFileClassification, MediaLimitItem, MediaObjectUrlLease, MediaPresentationFit, MediaPresentationPolicy, MediaPresentationRule, MediaPresentationSourceCandidate, MediaPresentationSourceQuality, MediaSendBatchResult, MemberTargetCapabilityAction, MemberTargetCapabilityInput, MessageCapabilityAction, MessageCapabilityInput, MessageLocateScrollProtectionInput, MessageNotificationDecision, MessageNotificationInput, MiniProgramHostLocale, MiniProgramOpenUrlInput, NewMessageBadgeController, NewMessageBadgeCountListener, NewMessageBadgeVisibilityInput, NewerHistoryPageTriggerInput, OlderHistoryPrefetchInput, PrependAnchorCandidate, PrependAnchorViewport, PrependMessageAnchorPosition, RemoteMessageBadgeTrackingInput, ResolveMediaPresentationInput, ResolvedMediaPresentation, RichExtraSegment, RuntimeClientOperation, RuntimeOperation, SearchBatchResult, SearchFilesInput, SearchMessagesInput, SearchTextMessagesInput, SendCapabilityMode, SendCommandHooks, SendVoicePayload, SenderProfileEntry, ServiceNoteHooks, StandaloneEmojiMessage, UnicodeEmojiEntry, VisibleChannelMiniProgramRels };
9088
+ export { DEFAULT_EMOJI_ASSET_BASE, DEFAULT_LOADING_MINIMUM_VISIBLE_MS, DEFAULT_LOADING_SHOW_DELAY_MS, EMOJI_CATALOG, EMOJI_GAME_DICE_STABLE_KEY, EMOJI_GAME_RPS_STABLE_KEY, EMOJI_TOKEN_RE, MAX_BATCH_FILES, MAX_RECENT_EMOJI_COUNT, MINI_PROGRAM_GAME_PREVIEW_FALLBACK_HEIGHT, MINI_PROGRAM_GAME_PREVIEW_FALLBACK_WIDTH, MINI_PROGRAM_LANG_NUMBERS, SPIKE_STEP, UNICODE_EMOJI_CATALOG, blockReasonForChannelSession, blockReasonForChannelState, blockReasonForGroupState, blockReasonForSession, calculateMediaBox, canEditMessage, canPinChannelMessage, canPinGroupMessage, canPinMessage, canPromoteMediaPresentationSource, canRecallMessage, canTransmit, canTransmitByType, canTransmitContent, cancelMediaUpload, captureRuntimeClientOperation, captureRuntimeOperation, channelMiniProgramRelKey, classifyGifFile, classifyMediaFile, countUnreadConversations, createChatRuntime, createConversationPrefetchController, createDelayedLoadingIndicator, createEmojiMatcher, createLinkMatcher, createNewMessageBadgeController, createThreadItems, csvIncludes, decideChannelMiniProgramRelOpen, decideConversationAction, decideMemberTargetAction, decideMessageAction, emojiAssetUrl, emojiUrlByCode, fetchConversationFileBatch, fetchConversationImageBatch, fetchConversationMessageBatch, fetchConversationVideoBatch, fetchConversationVoiceBatch, fetchNextConversationSearchBatch, formatChatDateSeparator, formatConversationDisplayTime, formatConversationUnreadBadge, formatFileSize, formatMediaDuration, forward_service as forwardService, getFileExtension, getLocalDayKey, hasEmojiCandidate, hasLinkCandidate, highlightSegments, isGifFile, isMessageLocateScrollProtected, isMessageTailChangeFromOlderWindowTrim, isMessageViewportMeasurable, isMessageVisibleForNewMessageBadge, isMiniProgramShowTypeOpenable, isPinnedMessageProtected, isVoiceStorageConfigured, loadOlderUntilBoundary, mediaBatchBudgetBytes, media_service as mediaService, message_service as messageService, normalizeLinkHref, parseUnicodeEmojiCode, pinnedMessage_service as pinnedMessageService, placeholderWaveform, prependRecentEmoji, profile_service as profileService, read_service as readService, refreshPrependMessageAnchorPosition, replaceInterruptedMediaFile, requiresConversationEncryption, requiresForwardTypeConfirmation, resampleWaveform, resolveBestMediaPresentationSource, resolveCenteredMessageScrollTop, resolveChannelMemberAvatarUrl, resolveChannelMemberDisplayName, resolveChannelMiniProgramRelIcon, resolveChannelMiniProgramRelName, resolveChannelMiniProgramRelOpenSurface, resolveChannelMiniProgramRelUrl, resolveChannelPinnedGameCopy, resolveConversationListPresentation, resolveDisplayTimestamp, resolveEmojiToken, resolveFriendDisplayName, resolveImProfileAccessDestination, resolveImThreadActiveDate, resolveMediaPresentation, resolveMemberDisplayName, resolveMessageBodyKind, resolveMessageNotificationDecision, resolveMessageTimelineTimestamp, resolveMiniProgramFloatLinkUrl, resolveMiniProgramGamePreviewLayout, resolveMiniProgramOpenUrl, resolvePrependMessageAnchor, resolvePrependMessageAnchorAdjustment, resolvePrependMessageAnchorPosition, resolvePublicNickname, resolveQuotedMessagePresentation, resolveSenderAvatarUrl, resolveStandaloneEmojiMessage, resolveSurvivingMessageAnchorAdjustment, resolveUnicodeEmoji, resolveVisibleChannelMiniProgramRels, resolveVisibleMessageAnchorPositions, retryMessage, runMediaSendBatch, sendAsFilesBatch, sendBlockReasonForDecision, sendMediaAlbum, sendMediaFile, sendMediaFilesBatch, sendText, sendVoice, shouldCompleteInitialViewport, shouldFillInitialHistoryViewport, shouldFollowIncomingMessage, shouldLoadNewerHistoryPage, shouldPrefetchOlderHistory, shouldRestoreMessageViewportFocus, shouldShowChatDateSeparator, shouldTrackRemoteMessageForBadge, sortChannelMiniProgramFloatingItems, spikeCountForDuration, supportsConversationMention, unicodeEmojiTextFromCode };
9089
+ export type { ApplySessionResult, BrowseMessagesInput, CanPinMessageInput, CenteredMessageScrollInput, ChannelMiniProgramOpenGame, ChannelMiniProgramRelOpenDecision, ChannelMiniProgramRelOpenSurface, ChatMediaMessageRef, ChatProfileAdapter, ChatRuntime, ChatRuntimeCredentials, ChatRuntimeFactories, ChatRuntimeHostDeps, ChatRuntimeOpResult, ConversationCapabilityAction, ConversationListPresentation, ConversationListPresentationLabels, ConversationListPresentationOptions, ConversationListPreviewMediaKind, ConversationListPreviewSegment, ConversationPrefetchController, ConversationPrefetchControllerOptions, ConversationSearchCategory, CreateThreadItemsInput, DelayedLoadingIndicator, DelayedLoadingIndicatorOptions, EmojiEntry, EmojiRecentItem, EmojiSegment, FormatTimeDisplayContext, ForwardCommandHooks, GifFileClassification, HighlightSegment, ImChannelMemberPresentation, ImChannelMentionPresentation, ImChannelProfilePresentation, ImForwardOperationResult, ImGroupMemberPresentation, ImMediaBatchSendResult, ImMessageActionResult, ImMessageBodyKind, ImMessageView, ImPinnedMessageActionResult, ImPinnedMessageSnapshot, ImProfileAccessDestination, ImQuotedMessagePresentation, ImTextResolver, ImThreadActiveDateSnapshot, ImThreadDateMarkerMetric, ImThreadDecoration, ImThreadEncryptionItem, ImThreadIntent, ImThreadItem, ImThreadPresentationAdapter, ImThreadReadActions, ImThreadReadTargetResolver, ImThreadViewportMetrics, IncomingMessageFollowInput, InitialHistoryViewportFillInput, InitialViewportCompletionInput, LinkSegment, MediaBatchBudgetOptions, MediaBatchLimitInfo, MediaFileClassification, MediaLimitItem, MediaObjectUrlLease, MediaPresentationFit, MediaPresentationPolicy, MediaPresentationRule, MediaPresentationSourceCandidate, MediaPresentationSourceQuality, MediaSendBatchResult, MemberTargetCapabilityAction, MemberTargetCapabilityInput, MessageCapabilityAction, MessageCapabilityInput, MessageLocateScrollProtectionInput, MessageNotificationDecision, MessageNotificationInput, MiniProgramGamePreviewInput, MiniProgramGamePreviewLayout, MiniProgramHostLocale, MiniProgramOpenUrlInput, NewMessageBadgeController, NewMessageBadgeCountListener, NewMessageBadgeVisibilityInput, NewerHistoryPageTriggerInput, OlderHistoryPrefetchInput, PrependAnchorCandidate, PrependAnchorViewport, PrependMessageAnchorPosition, RemoteMessageBadgeTrackingInput, ResolveMediaPresentationInput, ResolvedMediaPresentation, RichExtraSegment, RuntimeClientOperation, RuntimeOperation, SearchBatchResult, SearchFilesInput, SearchMessagesInput, SearchTextMessagesInput, SendCapabilityMode, SendCommandHooks, SendVoicePayload, SenderProfileEntry, ServiceNoteHooks, StandaloneEmojiMessage, UnicodeEmojiEntry, VisibleChannelMiniProgramRels };
package/dist/chat-kit.js CHANGED
@@ -1 +1 @@
1
- export{p as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,o as DEFAULT_LOADING_SHOW_DELAY_MS,d as MINI_PROGRAM_LANG_NUMBERS,I as SPIKE_STEP,E as calculateMediaBox,s as canPromoteMediaPresentationSource,v as captureRuntimeClientOperation,u as captureRuntimeOperation,m as channelMiniProgramRelKey,t as createConversationPrefetchController,q as createDelayedLoadingIndicator,C as createLinkMatcher,e as csvIncludes,c as decideChannelMiniProgramRelOpen,G as formatFileSize,F as formatMediaDuration,H as getFileExtension,B as hasLinkCandidate,z as highlightSegments,w as mediaService,A as normalizeLinkHref,L as placeholderWaveform,x as readService,K as resampleWaveform,r as resolveBestMediaPresentationSource,g as resolveChannelMiniProgramRelIcon,f as resolveChannelMiniProgramRelName,i as resolveChannelMiniProgramRelOpenSurface,h as resolveChannelMiniProgramRelUrl,j as resolveChannelPinnedGameCopy,n as resolveConversationListPresentation,D as resolveMediaPresentation,b as resolveMiniProgramFloatLinkUrl,a as resolveMiniProgramOpenUrl,y as resolveQuotedMessagePresentation,l as resolveVisibleChannelMiniProgramRels,k as sortChannelMiniProgramFloatingItems,J as spikeCountForDuration}from'./chunk-XA4W5PWT.js';export{j as DEFAULT_EMOJI_ASSET_BASE,i as EMOJI_CATALOG,c as EMOJI_GAME_DICE_STABLE_KEY,b as EMOJI_GAME_RPS_STABLE_KEY,m as EMOJI_TOKEN_RE,N as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,M as blockReasonForChannelSession,L as blockReasonForChannelState,T as blockReasonForGroupState,W as blockReasonForSession,G as canEditMessage,w as canPinChannelMessage,v as canPinGroupMessage,x as canPinMessage,F as canRecallMessage,da as cancelMediaUpload,R as classifyGifFile,Q as classifyMediaFile,s as countUnreadConversations,u as createChatRuntime,p as createEmojiMatcher,I as decideConversationAction,K as decideMemberTargetAction,J as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Da as fetchConversationFileBatch,Ea as fetchConversationImageBatch,Ba as fetchConversationMessageBatch,Fa as fetchConversationVideoBatch,Ga as fetchConversationVoiceBatch,Ha as fetchNextConversationSearchBatch,r as formatConversationUnreadBadge,ga as forwardService,o as hasEmojiCandidate,S as isGifFile,y as isPinnedMessageProtected,_ as isVoiceStorageConfigured,O as mediaBatchBudgetBytes,la as messageService,e as parseUnicodeEmojiCode,qa as pinnedMessageService,d as prependRecentEmoji,Aa as profileService,Z as replaceInterruptedMediaFile,U as requiresConversationEncryption,B as resolveChannelMemberAvatarUrl,A as resolveChannelMemberDisplayName,k as resolveEmojiToken,E as resolveFriendDisplayName,ra as resolveImProfileAccessDestination,z as resolveMemberDisplayName,t as resolveMessageNotificationDecision,D as resolvePublicNickname,C as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ea as retryMessage,P as runMediaSendBatch,ca as sendAsFilesBatch,H as sendBlockReasonForDecision,aa as sendMediaAlbum,Y as sendMediaFile,ba as sendMediaFilesBatch,X as sendText,$ as sendVoice,V as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-VRGWQLDM.js';export{C as createNewMessageBadgeController,i as createThreadItems,f as formatChatDateSeparator,e as formatConversationDisplayTime,c as getLocalDayKey,l as isMessageLocateScrollProtected,v as isMessageTailChangeFromOlderWindowTrim,k as isMessageViewportMeasurable,B as isMessageVisibleForNewMessageBadge,x as loadOlderUntilBoundary,p as refreshPrependMessageAnchorPosition,j as resolveCenteredMessageScrollTop,a as resolveDisplayTimestamp,g as resolveImThreadActiveDate,h as resolveMessageBodyKind,b as resolveMessageTimelineTimestamp,n as resolvePrependMessageAnchor,q as resolvePrependMessageAnchorAdjustment,o as resolvePrependMessageAnchorPosition,s as resolveSurvivingMessageAnchorAdjustment,r as resolveVisibleMessageAnchorPositions,t as shouldCompleteInitialViewport,y as shouldFillInitialHistoryViewport,u as shouldFollowIncomingMessage,z as shouldLoadNewerHistoryPage,m as shouldPrefetchOlderHistory,w as shouldRestoreMessageViewportFocus,d as shouldShowChatDateSeparator,A as shouldTrackRemoteMessageForBadge}from'./chunk-SLFKCTEX.js';import'./chunk-37HOEWMF.js';import'./chunk-MNWNUGIV.js';import'./chunk-GHZUH7RB.js';export{ta as canTransmit,ra as canTransmitByType,sa as canTransmitContent,qa as requiresForwardTypeConfirmation}from'./chunk-4KPJTXQN.js';import'./chunk-WOT6VMZA.js';
1
+ export{q as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,p as DEFAULT_LOADING_SHOW_DELAY_MS,v as MINI_PROGRAM_GAME_PREVIEW_FALLBACK_HEIGHT,u as MINI_PROGRAM_GAME_PREVIEW_FALLBACK_WIDTH,e as MINI_PROGRAM_LANG_NUMBERS,M as SPIKE_STEP,I as calculateMediaBox,t as canPromoteMediaPresentationSource,z as captureRuntimeClientOperation,y as captureRuntimeOperation,n as channelMiniProgramRelKey,x as createConversationPrefetchController,r as createDelayedLoadingIndicator,G as createLinkMatcher,f as csvIncludes,d as decideChannelMiniProgramRelOpen,K as formatFileSize,J as formatMediaDuration,L as getFileExtension,F as hasLinkCandidate,D as highlightSegments,a as isMiniProgramShowTypeOpenable,A as mediaService,E as normalizeLinkHref,P as placeholderWaveform,B as readService,O as resampleWaveform,s as resolveBestMediaPresentationSource,h as resolveChannelMiniProgramRelIcon,g as resolveChannelMiniProgramRelName,j as resolveChannelMiniProgramRelOpenSurface,i as resolveChannelMiniProgramRelUrl,k as resolveChannelPinnedGameCopy,o as resolveConversationListPresentation,H as resolveMediaPresentation,c as resolveMiniProgramFloatLinkUrl,w as resolveMiniProgramGamePreviewLayout,b as resolveMiniProgramOpenUrl,C as resolveQuotedMessagePresentation,m as resolveVisibleChannelMiniProgramRels,l as sortChannelMiniProgramFloatingItems,N as spikeCountForDuration}from'./chunk-7463JUEH.js';export{j as DEFAULT_EMOJI_ASSET_BASE,i as EMOJI_CATALOG,c as EMOJI_GAME_DICE_STABLE_KEY,b as EMOJI_GAME_RPS_STABLE_KEY,m as EMOJI_TOKEN_RE,N as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,M as blockReasonForChannelSession,L as blockReasonForChannelState,T as blockReasonForGroupState,W as blockReasonForSession,G as canEditMessage,w as canPinChannelMessage,v as canPinGroupMessage,x as canPinMessage,F as canRecallMessage,da as cancelMediaUpload,R as classifyGifFile,Q as classifyMediaFile,s as countUnreadConversations,u as createChatRuntime,p as createEmojiMatcher,I as decideConversationAction,K as decideMemberTargetAction,J as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Da as fetchConversationFileBatch,Ea as fetchConversationImageBatch,Ba as fetchConversationMessageBatch,Fa as fetchConversationVideoBatch,Ga as fetchConversationVoiceBatch,Ha as fetchNextConversationSearchBatch,r as formatConversationUnreadBadge,ga as forwardService,o as hasEmojiCandidate,S as isGifFile,y as isPinnedMessageProtected,_ as isVoiceStorageConfigured,O as mediaBatchBudgetBytes,la as messageService,e as parseUnicodeEmojiCode,qa as pinnedMessageService,d as prependRecentEmoji,Aa as profileService,Z as replaceInterruptedMediaFile,U as requiresConversationEncryption,B as resolveChannelMemberAvatarUrl,A as resolveChannelMemberDisplayName,k as resolveEmojiToken,E as resolveFriendDisplayName,ra as resolveImProfileAccessDestination,z as resolveMemberDisplayName,t as resolveMessageNotificationDecision,D as resolvePublicNickname,C as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ea as retryMessage,P as runMediaSendBatch,ca as sendAsFilesBatch,H as sendBlockReasonForDecision,aa as sendMediaAlbum,Y as sendMediaFile,ba as sendMediaFilesBatch,X as sendText,$ as sendVoice,V as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-PJVCTNC5.js';export{C as createNewMessageBadgeController,i as createThreadItems,f as formatChatDateSeparator,e as formatConversationDisplayTime,c as getLocalDayKey,l as isMessageLocateScrollProtected,v as isMessageTailChangeFromOlderWindowTrim,k as isMessageViewportMeasurable,B as isMessageVisibleForNewMessageBadge,x as loadOlderUntilBoundary,p as refreshPrependMessageAnchorPosition,j as resolveCenteredMessageScrollTop,a as resolveDisplayTimestamp,g as resolveImThreadActiveDate,h as resolveMessageBodyKind,b as resolveMessageTimelineTimestamp,n as resolvePrependMessageAnchor,q as resolvePrependMessageAnchorAdjustment,o as resolvePrependMessageAnchorPosition,s as resolveSurvivingMessageAnchorAdjustment,r as resolveVisibleMessageAnchorPositions,t as shouldCompleteInitialViewport,y as shouldFillInitialHistoryViewport,u as shouldFollowIncomingMessage,z as shouldLoadNewerHistoryPage,m as shouldPrefetchOlderHistory,w as shouldRestoreMessageViewportFocus,d as shouldShowChatDateSeparator,A as shouldTrackRemoteMessageForBadge}from'./chunk-MKKCUSUP.js';import'./chunk-UFGEIUBV.js';import'./chunk-O23EXDM5.js';import'./chunk-SMWPQSGR.js';export{va as canTransmit,ta as canTransmitByType,ua as canTransmitContent,sa as requiresForwardTypeConfirmation}from'./chunk-CIY4WBFJ.js';import'./chunk-WOT6VMZA.js';
@@ -0,0 +1,2 @@
1
+ import {p}from'./chunk-PJVCTNC5.js';import {e,a as a$1}from'./chunk-MKKCUSUP.js';import {j as j$1,h}from'./chunk-UFGEIUBV.js';import {la}from'./chunk-CIY4WBFJ.js';import {a}from'./chunk-WOT6VMZA.js';function te(e){return e==="default"||e==="board-game-link"||e==="game-preview"}function re(e){return (e??"").trim().replace(/^[?&]+/,"").trim()}function ie(e,t){let n=re(t);return e===""||n===""?e:e+(e.includes("?")?"&":"?")+n}function N(e){return e===""||e.startsWith("/")||e.startsWith("?")||e.startsWith("&")?false:e.includes(".")}function oe(e){return e===""?"":/^https?:\/\//i.test(e)?e:`https://${e}`}function P(e){return ie(ae(e),e.gamePath)}function ae(e){let t=e.domain?.trim()??"",n=e.suffixAddress?.trim()??"",i=e.h5Url?.trim()??"";if(t!==""){if(n==="")return t;if(n.startsWith("/"))return t.replace(/\/$/,"")+n;let r=n.replace(/^&/,""),o=t.includes("?")?"&":n.includes("?")?"":"?";return t+o+r}return /^https?:\/\//i.test(n)?n:N(n)?`https://${n}`:i}function C(e){let t=e.domain?.trim()??"",n=e.suffixAddress?.trim()??"",i=e.h5Url?.trim()??"";return /^https?:\/\//i.test(n)?n:N(n)?`https://${n}`:t!==""?oe(P({domain:t,suffixAddress:n,h5Url:i})):/^https?:\/\//i.test(i)?i:N(i)?`https://${i}`:""}function se(e,t){return {id:e.appId??t,name:t,cover:"",...e.appId===void 0?{}:{appId:e.appId},...e.developerId===void 0?{}:{developerId:e.developerId},...e.domain===void 0?{}:{domain:e.domain},...e.suffixAddress===void 0?{}:{suffixAddress:e.suffixAddress},...e.h5Url===void 0?{}:{h5Url:e.h5Url},...e.isDynamic===void 0?{}:{isDynamic:e.isDynamic},...e.productId===void 0?{}:{productId:e.productId}}}function le(e,t){if(e.configType==="float-link"){let r=C({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url});return r===""?{kind:"refuse"}:{kind:"open-link",url:r}}if(e.configType!=="pinned-game"&&e.configType!=="float-game")return {kind:"refuse"};let n=e.appId?.trim()??"",i=P({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url});return n===""||i===""?{kind:"refuse"}:{kind:"open-game",game:se(e,t.name),currencyType:t.currentCurrencyType??""}}var D={"zh-CN":1,"zh-TW":2,"en-US":3,"vi-VN":4,"th-TH":5};function G(e,t){let n=String(t).trim();return n===""||n==="0"?false:(e??"").split(",").map(i=>i.trim()).filter(i=>i!=="").includes(n)}function V(e){return e in D?e:"en-US"}function W(e,t){let i={"zh-CN":e.nameZhHans,"zh-TW":e.nameZhHant,"en-US":e.nameEn,"vi-VN":e.nameVi,"th-TH":e.nameTh}[V(t)]?.trim()??"";return i!==""?i:[e.nameEn,e.nameZhHans,e.nameZhHant,e.nameVi,e.nameTh].map(r=>r?.trim()??"").find(r=>r!=="")??""}function de(e){return e.icon?.trim()||e.iconSmall?.trim()||e.iconMedium?.trim()||e.iconLarge?.trim()||""}function j(e){return P({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url})}function K(e){return (e.appId?.trim()??"")!==""}function ce(e){return e.configType==="float-game"?K(e)&&j(e)!=="":e.configType==="float-link"?C({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url})!=="":false}function ue(e){return e.configType==="float-game"?"half":"page"}function me(e){let t=W(e.rel,e.locale);return {title:e.channelDescription?.trim()??"",tag:t,name:t}}function $(e){return [...e].sort((t,n)=>t.configType===n.configType?0:t.configType==="float-game"?1:n.configType==="float-game"?-1:0)}function fe(e,t){if(e===void 0)return {pinnedGame:null,floatingItems:[]};let n=D[V(t.locale)],i=e.filter(r=>r.configType!=="unknown"&&G(r.langTypes,n)&&G(r.currencyTypes,t.currencyType??""));return {pinnedGame:i.find(r=>r.configType==="pinned-game"&&K(r))??null,floatingItems:$(i.filter(r=>(r.configType==="float-link"||r.configType==="float-game")&&ce(r)))}}function pe(e,t){return [e,t.configType,t.appId??"",t.suffixAddress??t.h5Url??""].join("|")}var z=p();function ge(e$1,t){let n=t.suppressDraft===true?null:e$1.draft,i=n?.text.trim()??"",r,o="",s="";return n!==null?r=i===""?[]:Me(e$1,i,t.locale):ye(e$1)?r=x(Ie(e$1,t)):e$1.lastMessageSummary?.kind==="channel-moderation-deleted"||e$1.lastMessageDeletedForEveryone!==void 0?r=x(R(e$1,e$1.lastMessageSummary?.kind==="channel-moderation-deleted"?e$1.lastMessageSummary:{kind:"channel-moderation-deleted",by:e$1.lastMessageDeletedForEveryone?.by??""},t)):e$1.lastMessageSummary?.kind==="recalled"||e$1.lastMessageRecalled!==void 0?r=x(R(e$1,e$1.lastMessageSummary?.kind==="recalled"?e$1.lastMessageSummary:{kind:"recalled",by:e$1.lastMessageRecalled?.by??""},t)):(o=Pe(e$1,t),s=e$1.mentionUnreadCount>0?t.labels.mentionBadge:"",r=ve(e$1,t)),{preview:`${s}${o}${r.map(l=>l.text).join("")}`||(n===null?t.labels.emptyPreview:""),previewSegments:r,...he(e$1,n!==null),senderPrefix:o,mentionBadge:s,time:e(a$1(n?.updatedAt,e$1.timestamp),{locale:t.locale,...t.now===void 0?{}:{now:t.now}}),hasDraft:n!==null}}function x(e){return [{kind:"text",text:e}]}function he(e,t){let n=e.lastMessageSummary;if(t||e.lastMessageDeletedForEveryone!==void 0||e.lastMessageRecalled!==void 0||e.lastMessageSystemEvent!==void 0||n===void 0)return {};if(n.kind==="mediaAlbum"){let{imageCount:i,videoCount:r,caption:o,firstItemKind:s}=n;return i<=0&&r<=0?{}:o!==void 0&&o!==""&&s!==void 0?{previewMediaKind:s}:i>0&&r>0?{previewMediaKind:"mediaAlbum"}:{previewMediaKind:r>0?"video":"image"}}return n.kind==="image"||n.kind==="video"||n.kind==="gif"||n.kind==="sticker"?{previewMediaKind:n.kind}:{}}function Q(e){return e.map(t=>t.kind==="emoji"?{kind:"emoji",text:t.text,code:t.code}:{kind:t.kind,text:t.text})}function Me(e,t,n){let i=e.draft?.mentions??[],r=[],o={},s=false;for(let l of i){if(l.userId==="0"){s=true;continue}r.includes(l.userId)||r.push(l.userId),l.displayName.trim()!==""&&(o[l.userId]=l.displayName);}let a=s||r.length>0?{atAll:s,atUserIds:r,...Object.keys(o).length===0?{}:{atUsersName:o}}:void 0;return Q(la(t,{mention:a,resolveName:l=>o[l]??l,atAllDisplay:j$1(n),matchers:[z]}))}function ve(e,t){let n=e.lastMessageSummary;if(n!==void 0&&n.kind!=="text")return x(R(e,n,t));let i=(n?.kind==="text"?n.text:e.lastMessagePreview).trim();if(i==="")return x(t.labels.emptyPreview);let r=e.lastMessageMention?.atUsersName;return Q(la(i,{mention:e.lastMessageMention===void 0?void 0:{...e.lastMessageMention,atUserIds:[...e.lastMessageMention.atUserIds]},resolveName:o=>t.resolveName(e.ref,o,r?.[o]),selfId:t.accountId,atAllDisplay:j$1(t.locale),matchers:[z]}))}function R(e,t,n){return h(Ce(t),{locale:n.locale,selfId:n.accountId,resolveName:i=>n.resolveName(e.ref,i)})}function ye(e){return e.lastMessageSummary?.kind==="system"||e.lastMessageSenderId==="system"||e.lastMessageSystemEvent!==void 0}function Ie(e,t){return e.lastMessageSummary?.kind==="system"?R(e,e.lastMessageSummary,t):e.lastMessageSystemEvent===void 0?e.lastMessagePreview.trim()||t.labels.emptyPreview:R(e,{kind:"system",system:{eventType:e.lastMessageSystemEvent,...e.lastMessageSystemTargetsSelf===true?{targetUserIds:[t.accountId]}:{},...e.lastMessagePreview.trim()===""?{}:{fallbackText:e.lastMessagePreview.trim()}}},t)}function Pe(e,t){let n=e.lastMessageSenderId;return e.ref.conversationType!=="group"&&e.ref.conversationType!=="channel"||n===void 0||n===""||n==="system"?"":`${n===t.accountId?t.labels.selfSender:t.resolveName(e.ref,n)}: `}function Ce(e){return e.kind!=="system"?e:{kind:"system",system:{eventType:e.system.eventType,...e.system.operatorId===void 0?{}:{operatorId:e.system.operatorId},...e.system.targetUserIds===void 0?{}:{targetUserIds:[...e.system.targetUserIds]},...e.system.fallbackText===void 0?{}:{fallbackText:e.system.fallbackText}}}}var xe=160,Re=220;function be(e){let t=Math.max(0,e.showDelayMs??160),n=Math.max(0,e.minimumVisibleMs??220),i=e.now??Date.now,r=e.setTimer??((d,f)=>setTimeout(d,f)),o=e.clearTimer??(d=>clearTimeout(d)),s="",a=false,l=false,c=0,u,g,p=false;function y(){u!==void 0&&o(u),u=void 0;}function h(){g!==void 0&&o(g),g=void 0;}function M(d){l!==d&&(l=d,c=d?i():0,e.onVisibleChange(d));}function m(d){y(),u=r(()=>{u=void 0,!(p||!a||s!==d)&&M(true);},t);}function v(){if(y(),!l)return;let d=n-Math.max(0,i()-c);if(d<=0){M(false);return}h(),g=r(()=>{g=void 0,!(p||a)&&M(false);},d);}return {update(d,f){if(p)return;if(s!==f){s=f,a=d,y(),h(),M(false),d&&m(f);return}if(a=d,d){h(),!l&&u===void 0&&m(f);return}v();},dispose(){p||(p=true,a=false,y(),h(),M(false));}}}var w={placeholder:0,thumbnail:1,local:2,original:3};function Se(e){let t;for(let n of e)n.value!==void 0&&(t===void 0||w[n.quality]>w[t.quality])&&(t=n);return t}function we(e,t){return w[t]>=w[e]}var Ae=280,Le=180;function Te(e){return /^data:image\//i.test(e)?true:/\.(?:png|jpe?g|gif|webp|bmp|avif|heic|heif|svg)(?:[?#]|$)/i.test(e)}function q(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Ee(e){let t=e.gamePreviewUrl?.trim()??"";return t===""?{url:"",sourceWidth:280,sourceHeight:180,render:"empty"}:{url:t,sourceWidth:q(e.gamePreviewWidth,280),sourceHeight:q(e.gamePreviewHeight,180),render:e.imageLoadFailed===true||!Te(t)?"document":"image"}}function A(e){return `${e.conversationType}:${e.conversationId}`}function ke(e,t){let n=t===null?null:A(t),i=new Set;return e.filter(r=>{let o=A(r.ref);return r.ref.conversationType!=="group"&&r.ref.conversationType!=="channel"||o===n||i.has(o)?false:(i.add(o),true)}).map((r,o)=>({item:r,index:o})).sort((r,o)=>Number(o.item.pinned)-Number(r.item.pinned)||+(o.item.unreadCount>0)-+(r.item.unreadCount>0)||r.index-o.index).slice(0,20).map(({item:r})=>({conversationType:r.ref.conversationType,conversationId:r.ref.conversationId}))}function Ue(e){let t=false,n=null,i,r=false,o=0,s=false,a,l=new Set,c;function u(m,v,d){let f=`${m}:${v??""}`;f!==a&&(a=f,e.diagnostics?.record("debug","chat-kit","history","conversation-prefetch-state",()=>({conversation:d,data:{phase:m,reason:v,attemptedCount:l.size}})));}function g(){o+=1,r=false,i?.(),i=void 0;}function p(){g(),c?.controller.abort(),c=void 0,s=false,l.clear(),n=null,a=void 0;}function y(){return ke(e.getCandidates(),e.getActiveRef()).filter(m=>!l.has(A(m)))}async function h(){if(r=false,i=void 0,t)return;if(!e.getRunnable()){u("paused","host-not-ready");return}let m=e.getClient();if(m!==n||m===null){M();return}let v=y()[0];if(c!==void 0)return;if(v===void 0){u("exhausted","no-candidates");return}let d={controller:new AbortController,key:A(v)};c=d,s=false,l.add(d.key),u("running",void 0,v);let f=false;try{let S=await m.conversations.prefetchRecent([v],{signal:d.controller.signal});if(c!==d)return;f=S.some(ne=>ne.status==="cancelled"),f&&l.delete(d.key);}catch(S){c===d&&!d.controller.signal.aborted&&e.onError(S);}finally{c===d&&(d.controller.signal.aborted&&l.delete(d.key),c=void 0,s||!f&&!d.controller.signal.aborted?M():u("paused",d.controller.signal.aborted?"host-cancelled":"sdk-cancelled"));}}function M(){if(t)return;let m=e.getClient();if(m!==n&&(p(),n=m),!e.getRunnable()||n===null){g(),c?.controller.abort(),u("paused",n===null?"client-unavailable":"host-not-ready");return}if(c!==void 0){s=true;return}if(r)return;if(y().length===0){u("exhausted","no-candidates");return}r=true,u("scheduled");let v=++o,d=e.scheduleIdle(()=>{r&&v===o&&h();});r&&(i=d);}return {refresh:M,reset:p,dispose(){t=true,p();}}}function Oe(e){let t=e.getGeneration();return Object.freeze({isCurrent:()=>e.getGeneration()===t})}function F(e){let t=e.getClient();if(t===null)return null;let n=e.getGeneration();return Object.freeze({client:t,isCurrent:()=>e.getGeneration()===n&&e.getClient()===t})}var X={};a(X,{acquireMediaBlob:()=>Ge,detectImageMime:()=>J,detectVideoMime:()=>Y,loadCachedImageObjectUrl:()=>je,loadCachedMediaAlbumItemObjectUrl:()=>Ve,loadCachedVideoObjectUrl:()=>He,loadFileObjectUrl:()=>Ke,loadImageObjectUrl:()=>We,loadMediaAlbumItemObjectUrl:()=>Be,loadVideoObjectUrl:()=>Fe,loadVoiceBytes:()=>De,prepareLocalMediaPreview:()=>Ne});function L(e,t){if(e.conversationType!=="supergroup")return {conversation:{conversationType:e.conversationType,conversationId:e.conversationId},messageId:e.id,...t===void 0?{}:{itemIndex:t}}}async function b(e,t,n,i){let r=e.getClient(),o=L(t,i);if(r===null||o===void 0)throw new Error("media download unavailable");let s=n===void 0?void 0:r.media.subscribe(a=>{let l=a.find(c=>c.direction==="download"&&c.messageId===o.messageId&&c.itemIndex===i&&c.ref.conversationType===o.conversation.conversationType&&c.ref.conversationId===o.conversation.conversationId);l!==void 0&&n(l.percent);});try{return await r.media.download(o)}finally{s?.();}}function _e(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="IM_SDK_MEDIA_DOWNLOAD_CANCELED"}async function Ne(e,t){let n=e.getClient();if(n===null)return null;let i=e.getGeneration(),r=await n.media.prepareLocalPreview(t);return r===null||e.getGeneration()!==i?null:r}function J(e){return e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255?"image/jpeg":e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?"image/png":e.length>=6&&e[0]===71&&e[1]===73&&e[2]===70?"image/gif":e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?"image/webp":null}async function T(e){let t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=J(t);return n===null?null:URL.createObjectURL(e.type===n?e:e.slice(0,e.size,n))}function Y(e){return e.length>=4&&e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163?"video/webm":(e.length>=8&&e[4]===102&&e[5]===116&&e[6]===121&&e[7]===112,"video/mp4")}function Ge(e,t,n){return e.acquireMediaBlob({conversationType:t.conversationType,conversationId:t.conversationId,messageId:t.id,...n===void 0?{}:{itemIndex:n}})}async function De(e,t,n){let i=e.getClient(),r=t.body.voice;if(i===null||r===void 0)return null;let o=e.getSelfVoiceBytes(t.id);if(o!==void 0)return o;let s=e.getGeneration();try{let a=new Uint8Array(await(await b(e,t)).arrayBuffer());return a.length===0?(e.getGeneration()===s&&n.setNote(n.t("media.voiceLoadEmpty")),null):a}catch(a){return e.getGeneration()===s&&n.setNote(n.t("media.voiceLoadFailed",{reason:a instanceof Error?a.message:String(a)})),null}}async function Fe(e,t,n,i){let r=e.getClient(),o=t.body.video;if(r===null||o===void 0)return null;let s=e.getGeneration();try{let a=await b(e,t,i);if(a.size===0)return e.getGeneration()===s&&n.setNote(n.t("media.videoOpenEmpty")),null;let l=URL.createObjectURL(a);return e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch(a){return e.getGeneration()===s&&n.setNote(n.t("media.videoLoadFailed",{reason:a instanceof Error?a.message:String(a)})),null}}async function He(e,t){let n=e.getClient(),i=L(t);if(n===null||i===void 0||t.body.video===void 0)return null;let r=e.getGeneration();try{let o=await n.media.getCached(i);if(o===null||o.size===0||e.getGeneration()!==r)return null;let s=new Uint8Array(await o.slice(0,12).arrayBuffer()),a=o.type||Y(s);return e.getGeneration()!==r?null:URL.createObjectURL(o.type===a?o:o.slice(0,o.size,a))}catch{return null}}async function Be(e,t,n,i,r){let o=e.getClient(),s=t.body.mediaAlbum?.items[n];if(o===null||s===void 0)return null;let a=s.kind==="video",l=e.getGeneration();try{let c=await b(e,t,r,n);if(a&&c.size===0)return e.getGeneration()===l&&i.setNote(i.t("media.videoOpenEmpty")),null;let u=a?URL.createObjectURL(c):await T(c);return u===null?(e.getGeneration()===l&&i.setNote(i.t("media.imageInvalid",{size:c.size})),null):e.getGeneration()!==l?(URL.revokeObjectURL(u),null):u}catch(c){return e.getGeneration()===l&&!_e(c)&&i.setNote(i.t(a?"media.videoLoadFailed":"media.imageLoadFailed",{reason:c instanceof Error?c.message:String(c)})),null}}async function Ve(e,t,n){let i=e.getClient(),r=t.body.mediaAlbum?.items[n],o=L(t,n);if(i===null||o===void 0||r===void 0||!/^https?:\/\//i.test(r.url))return null;let s=e.getGeneration();try{let a=await i.media.getCached(o);if(a===null||a.size===0||e.getGeneration()!==s)return null;let l=r.kind==="video"?URL.createObjectURL(a):await T(a);return l===null?null:e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch{return null}}async function We(e,t,n){let i=e.getClient(),r=t.body.image;if(i===null||r===void 0)return null;let o=e.getGeneration();try{let s=await b(e,t),a=await T(s);return a===null?(e.getGeneration()===o&&n.setNote(n.t("media.imageInvalid",{size:s.size})),null):e.getGeneration()!==o?(URL.revokeObjectURL(a),null):a}catch(s){return e.getGeneration()===o&&n.setNote(n.t("media.imageLoadFailed",{reason:s instanceof Error?s.message:String(s)})),null}}async function je(e,t){let n=e.getClient(),i=L(t);if(n===null||i===void 0||t.body.image===void 0)return null;let r=e.getGeneration();try{let o=await n.media.getCached(i);if(o===null||o.size===0||e.getGeneration()!==r)return null;let s=await T(o);return s===null?null:e.getGeneration()!==r?(URL.revokeObjectURL(s),null):s}catch{return null}}async function Ke(e,t,n,i){let r=e.getClient(),o=t.body.file;if(r===null||o===void 0)return null;let s=e.getGeneration();try{let a=await b(e,t,i);if(a.size===0)return e.getGeneration()===s&&n.setNote(n.t("media.fileDownloadEmpty")),null;let l=URL.createObjectURL(a);return e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch(a){return e.getGeneration()===s&&n.setNote(n.t("media.fileDownloadFailed",{reason:a instanceof Error?a.message:String(a)})),null}}var Z={};a(Z,{markReadUpTo:()=>$e});function $e(e,t,n,i){let r=F(e);if(r===null||t.conversationId===""||n==="")return;let o=r.client.conversations.list().find(a=>a.id===t.conversationId&&a.type===t.conversationType);if(o?.manuallyUnread===true&&o.unreadCount<=0){r.client.conversations.markConversationRead(t).catch(a=>{r.isCurrent()&&e.getDiagnostics().record("warn","chat-kit","conversation","clear-manual-unread-skipped",()=>({conversation:t,error:{message:"\u6E05\u9664\u624B\u5DE5\u672A\u8BFB\u63D0\u9192\u5931\u8D25",data:a}}));});return}if(o?.type==="group"&&o.unreadCount<=0)return;let s=i.getConversationHandle();s===void 0||s.ref.conversationId!==t.conversationId||s.ref.conversationType!==t.conversationType||s.markRead(n).catch(a=>{r.isCurrent()&&i.getConversationHandle()===s&&e.getDiagnostics().record("warn","chat-kit","message","mark-read-skipped",()=>({conversation:t,data:{messageId:n},error:{message:"markRead \u8DF3\u8FC7",data:a}}));});}function ze(e){return e.deletedForEveryone!==void 0?"hidden":e.recalled!==void 0?"recalled":"content"}function Qe(e,t){if(t.length===0)return [{text:e,hit:false}];let n=[],i=0;for(let[r,o]of t)r>i&&n.push({text:e.slice(i,r),hit:false}),n.push({text:e.slice(r,o),hit:true}),i=o;return i<e.length&&n.push({text:e.slice(i),hit:false}),n}var qe=/\b(?:https?:\/\/|www\.)[^\s<>"')】]+/gi,Je=/\b(?:https?:\/\/|www\.)/i,Ye=/[),.!?;:,。!?;:、)】]+$/u;function ee(e){let t=/^www\./i.test(e)?`https://${e}`:e;try{let n=new URL(t);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}function Xe(e){return Je.test(e)}function Ze(){return e=>{let t=[];for(let n of e.matchAll(qe)){if(n.index===void 0)continue;let i=n[0].replace(Ye,"");if(i==="")continue;let r=ee(i);r!==void 0&&t.push({start:n.index,end:n.index+i.length-1,segment:{kind:"link",text:i,href:r}});}return t}}function I(e,t){if(!Number.isFinite(e)||e<=0)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${t} \u5FC5\u987B\u662F\u5927\u4E8E 0 \u7684\u6709\u9650\u6570`)}function en(e){if(I(e.fallbackAspectRatio,"fallbackAspectRatio"),!Array.isArray(e.rules)||e.rules.length===0)throw new Error("\u5A92\u4F53\u5C55\u793A\u7B56\u7565 rules \u4E0D\u80FD\u4E3A\u7A7A");let t=new Set;e.rules.forEach((n,i)=>{let r=`rules[${i}]`;if(n.id.trim()==="")throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.id \u4E0D\u80FD\u4E3A\u7A7A`);if(t.has(n.id))throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565\u89C4\u5219 id \u91CD\u590D\uFF1A${n.id}`);if(t.add(n.id),n.minAspectRatio!==void 0&&(!Number.isFinite(n.minAspectRatio)||n.minAspectRatio<0))throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.minAspectRatio \u5FC5\u987B\u662F\u5927\u4E8E\u7B49\u4E8E 0 \u7684\u6709\u9650\u6570`);if(n.maxAspectRatio!==void 0&&I(n.maxAspectRatio,`${r}.maxAspectRatio`),n.minAspectRatio!==void 0&&n.maxAspectRatio!==void 0&&n.minAspectRatio>=n.maxAspectRatio)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r} \u7684\u5BBD\u9AD8\u6BD4\u4E0B\u754C\u5FC5\u987B\u5C0F\u4E8E\u4E0A\u754C`);if(I(n.preferredWidth,`${r}.preferredWidth`),I(n.minWidth,`${r}.minWidth`),I(n.maxWidth,`${r}.maxWidth`),I(n.minHeight,`${r}.minHeight`),I(n.maxHeight,`${r}.maxHeight`),n.minWidth>n.preferredWidth||n.preferredWidth>n.maxWidth)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.preferredWidth \u5FC5\u987B\u4F4D\u4E8E minWidth \u548C maxWidth \u4E4B\u95F4`);if(n.minHeight>n.maxHeight)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.minHeight \u4E0D\u80FD\u5927\u4E8E maxHeight`);if(typeof n.allowUpscale!="boolean")throw new TypeError(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.allowUpscale \u5FC5\u987B\u662F boolean`);if(n.fit!=="cover"&&n.fit!=="contain")throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.fit \u53EA\u652F\u6301 cover \u6216 contain`)});}function nn(e){let{intrinsicWidth:t,intrinsicHeight:n,availableWidth:i,policy:r}=e;I(i,"availableWidth"),en(r);let o=Number.isFinite(t)&&Number.isFinite(n)&&t>0&&n>0,s=o?t/n:r.fallbackAspectRatio,a=r.rules.find(h=>{let M=h.minAspectRatio===void 0||s>=h.minAspectRatio,m=h.maxAspectRatio===void 0||s<h.maxAspectRatio;return M&&m});if(a===void 0)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565\u6CA1\u6709\u5339\u914D\u5BBD\u9AD8\u6BD4 ${s}`);let l=!a.allowUpscale&&o?Math.min(a.preferredWidth,t):a.preferredWidth,c=Math.min(i,a.maxWidth,Math.max(a.minWidth,l)),u=Math.max(1,Math.round(c)),g=u/s,p=Math.min(a.maxHeight,Math.max(a.minHeight,g)),y=Math.max(1,Math.round(p));return {width:u,height:y,aspectRatio:u/y,sourceAspectRatio:s,ruleId:a.id,fit:a.fit,aspectClamped:p!==g}}function tn(e,t,n,i){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return null;let r=Math.min(n/e,i/t,1);return {width:`${Math.max(1,Math.round(e*r))}px`,aspectRatio:`${e} / ${t}`}}function rn(e){if(!Number.isFinite(e)||e<=0)return "0:00";let t=Math.floor(e),n=Math.floor(t/3600),i=Math.floor(t%3600/60),r=t%60,o=s=>s.toString().padStart(2,"0");return n>0?`${n}:${o(i)}:${o(r)}`:`${i}:${o(r)}`}function on(e){if(!Number.isFinite(e)||e<=0)return "0 B";let t=["B","KB","MB","GB","TB"],n=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024))),i=e/1024**n;return `${n===0?i:Math.round(i*10)/10} ${t[n]}`}function an(e){let t=e.lastIndexOf(".");return t>-1&&t<e.length-1?e.slice(t+1).toLowerCase():""}var sn=4;function ln(e){let t=Math.min(Math.max(e/1e3,0)/10,1);return Math.round(22+24*t)}function dn(e,t){if(e.length===0)return Array.from({length:t},()=>0);let n=[],i=(e.length-1)/Math.max(1,t-1);for(let r=0;r<t;r+=1){let o=r*i,s=Math.round(o),a=e[Math.max(0,s-1)]??0,l=e[Math.min(e.length-1,s)]??0,c=e[Math.min(e.length-1,s+1)]??0;n.push((a+l+c)/3);}return n}function cn(e,t){let n=2166136261;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,16777619);let i=[];for(let r=0;r<t;r+=1)n=Math.imul(n^n>>>15,2246822519)>>>0,i.push(90+n%111);return i}
2
+ export{X as A,Z as B,ze as C,Qe as D,ee as E,Xe as F,Ze as G,nn as H,tn as I,rn as J,on as K,an as L,sn as M,ln as N,dn as O,cn as P,te as a,P as b,C as c,le as d,D as e,G as f,W as g,de as h,j as i,ue as j,me as k,$ as l,fe as m,pe as n,ge as o,xe as p,Re as q,be as r,Se as s,we as t,Ae as u,Le as v,Ee as w,Ue as x,Oe as y,F as z};