openclaw-openagent 1.0.12 → 1.0.14
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.js +2 -0
- package/dist/src/config/config-schema.d.ts +9 -0
- package/dist/src/config/config-schema.js +6 -0
- package/dist/src/messaging/executor.d.ts +2 -3
- package/dist/src/messaging/executor.js +4 -31
- package/dist/src/plugin-ui/assets/openagent-override.js +124 -18
- package/dist/src/proxy/auth-proxy.js +5 -0
- package/dist/src/runtime/update-checker.d.ts +18 -0
- package/dist/src/runtime/update-checker.js +216 -0
- package/index.ts +3 -0
- package/package.json +1 -3
- package/src/app/channel-tools.ts +0 -249
- package/src/app/discovery-tools.ts +0 -273
- package/src/app/download-file-tool.ts +0 -133
- package/src/app/hooks.ts +0 -144
- package/src/app/index.ts +0 -84
- package/src/app/messaging-tools.ts +0 -79
- package/src/app/ops-tools.ts +0 -155
- package/src/app/remote-agent-tool.ts +0 -762
- package/src/app/types.ts +0 -68
- package/src/app/upload-file-tool.ts +0 -411
- package/src/app/verbose-preflight.ts +0 -190
- package/src/auth/config.ts +0 -266
- package/src/auth/credential-manager.ts +0 -146
- package/src/auth/index.ts +0 -24
- package/src/auth/verify.ts +0 -99
- package/src/channel.ts +0 -566
- package/src/compat.ts +0 -94
- package/src/config/config-schema.ts +0 -39
- package/src/messaging/aggregator.ts +0 -120
- package/src/messaging/collector.ts +0 -89
- package/src/messaging/executor.ts +0 -72
- package/src/messaging/inbound.ts +0 -150
- package/src/messaging/index.ts +0 -11
- package/src/messaging/mention-protocol.ts +0 -94
- package/src/messaging/process-c2c-request.ts +0 -564
- package/src/messaging/process-message.ts +0 -373
- package/src/messaging/scheduler.ts +0 -55
- package/src/messaging/types.ts +0 -38
- package/src/plugin-ui/adapters/oc-2026-04.js +0 -103
- package/src/plugin-ui/adapters/oc-2026-05.js +0 -125
- package/src/plugin-ui/adapters/oc-2026-06.js +0 -125
- package/src/plugin-ui/adapters/oc-unknown.js +0 -48
- package/src/plugin-ui/assets/agentbook-icon.svg +0 -5
- package/src/plugin-ui/assets/bg.png +0 -0
- package/src/plugin-ui/assets/icon.png +0 -0
- package/src/plugin-ui/assets/magic.svg +0 -5
- package/src/plugin-ui/assets/openagent-override.js +0 -11156
- package/src/plugin-ui/build.cjs +0 -463
- package/src/plugin-ui/index.ts +0 -18
- package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -570
- package/src/plugin-ui/modules/agent-book/panel/agent-card.js +0 -170
- package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -643
- package/src/plugin-ui/modules/agent-book/panel/inject-ui.js +0 -665
- package/src/plugin-ui/modules/agent-book/panel/mention-state.js +0 -206
- package/src/plugin-ui/modules/agent-book/panel/styles.js +0 -833
- package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +0 -86
- package/src/plugin-ui/modules/agent-book/remote-agent-tool/components-core.js +0 -295
- package/src/plugin-ui/modules/agent-book/remote-agent-tool/thought-chain-card.js +0 -211
- package/src/plugin-ui/modules/agent-book/scanner.js +0 -131
- package/src/plugin-ui/modules/agent-book/travelcard/travel-cards.js +0 -500
- package/src/plugin-ui/modules/agent-book/travelcard/travel-engine.js +0 -652
- package/src/plugin-ui/modules/agent-book/travelcard/travel-styles.js +0 -256
- package/src/plugin-ui/modules/loader/bootstrap.js +0 -38
- package/src/plugin-ui/modules/loader/shared-state.js +0 -838
- package/src/plugin-ui/modules/loader/ws-intercept.js +0 -199
- package/src/plugin-ui/modules/remote-agent/chunk-parser.js +0 -161
- package/src/plugin-ui/modules/remote-agent/execution-card.js +0 -530
- package/src/plugin-ui/modules/remote-agent/markdown-renderer.js +0 -256
- package/src/plugin-ui/modules/remote-agent/media-links.js +0 -151
- package/src/plugin-ui/modules/remote-agent/native-style-adapter.js +0 -134
- package/src/plugin-ui/modules/remote-agent/output-card.js +0 -342
- package/src/plugin-ui/modules/remote-agent/progress-store.js +0 -363
- package/src/plugin-ui/modules/remote-agent/render-hooks.js +0 -1700
- package/src/plugin-ui/modules/remote-agent/styles.js +0 -896
- package/src/plugin-ui/modules/remote-agent/tool-card-model.js +0 -130
- package/src/plugin-ui/postinstall-deploy.cjs +0 -52
- package/src/plugin-ui/ui-extension-loader/backup.ts +0 -92
- package/src/plugin-ui/ui-extension-loader/index.ts +0 -276
- package/src/plugin-ui/ui-extension-loader/locator.ts +0 -152
- package/src/plugin-ui/ui-extension-loader/manifest.ts +0 -57
- package/src/plugin-ui/ui-extension-loader/registry-regex.ts +0 -944
- package/src/plugin-ui/ui-extension-loader/removed-extensions.ts +0 -70
- package/src/plugin-ui/ui-extension-loader/types.ts +0 -72
- package/src/proxy/auth-proxy.ts +0 -409
- package/src/runtime/account.ts +0 -549
- package/src/runtime/index.ts +0 -7
- package/src/runtime/plugin-runtime.ts +0 -94
- package/src/runtime/registry.ts +0 -71
- package/src/sdk/CLASS_MAP.md +0 -143
- package/src/sdk/index.d.ts +0 -126
- package/src/sdk/index.js +0 -23990
- package/src/sdk/modules/cloud-search-module.js +0 -1117
- package/src/sdk/modules/follow-module.js +0 -1069
- package/src/sdk/modules/group-module.js +0 -7397
- package/src/sdk/modules/relationship-module.js +0 -2269
- package/src/sdk/modules/signaling-module.js +0 -1468
- package/src/sdk/modules/tim-upload-plugin.js +0 -730
- package/src/sdk/node-env/http-request.js +0 -90
- package/src/sdk/node-env/index.js +0 -57
- package/src/sdk/node-env/storage.js +0 -114
- package/src/sdk/package.json +0 -10
- package/src/sdk/tsconfig.json +0 -16
- package/src/state/pending-invocation-store.ts +0 -43
- package/src/state/store.ts +0 -756
- package/src/tim/c2c.ts +0 -451
- package/src/tim/channels.ts +0 -364
- package/src/tim/client.ts +0 -330
- package/src/tim/index.ts +0 -18
- package/src/tim/messages.ts +0 -166
- package/src/tim/sdk-logger-init.ts +0 -50
- package/src/tools.ts +0 -10
- package/src/transport/factory.ts +0 -95
- package/src/transport/oasn/index.ts +0 -17
- package/src/transport/oasn/oasn-agent-card.ts +0 -111
- package/src/transport/oasn/oasn-discovery.ts +0 -108
- package/src/transport/oasn/oasn-files.ts +0 -210
- package/src/transport/oasn/oasn-http.ts +0 -529
- package/src/transport/oasn/oasn-invocation.ts +0 -604
- package/src/transport/oasn/oasn-normalize.ts +0 -133
- package/src/transport/oasn/oasn-register.ts +0 -33
- package/src/transport/oasn/oasn-transport.ts +0 -318
- package/src/transport/oasn/oasn-types.ts +0 -404
- package/src/transport/tim/index.ts +0 -8
- package/src/transport/tim/tim-transport.ts +0 -515
- package/src/transport/types.ts +0 -538
- package/src/types/openclaw-plugin-sdk-media-store.d.ts +0 -9
- package/src/types/openclaw.d.ts +0 -97
- package/src/types/tencentcloud-chat.d.ts +0 -15
- package/src/util/http.ts +0 -113
- package/src/util/logger.ts +0 -131
- package/src/util/url-resolver.ts +0 -77
|
@@ -1,1468 +0,0 @@
|
|
|
1
|
-
let t = 2,
|
|
2
|
-
e = 6,
|
|
3
|
-
i = 11,
|
|
4
|
-
n = 12,
|
|
5
|
-
s = 20,
|
|
6
|
-
o = 23,
|
|
7
|
-
a = 27;
|
|
8
|
-
class r {
|
|
9
|
-
constructor(t = 0, e = 0) {
|
|
10
|
-
((this.high = t), (this.low = e));
|
|
11
|
-
}
|
|
12
|
-
equal(t) {
|
|
13
|
-
return null !== t && this.low === t.low && this.high === t.high;
|
|
14
|
-
}
|
|
15
|
-
toString() {
|
|
16
|
-
var t = Number(this.high).toString(16);
|
|
17
|
-
let e = Number(this.low).toString(16);
|
|
18
|
-
if (e.length < 8) {
|
|
19
|
-
let t = 8 - e.length;
|
|
20
|
-
for (; t; ) ((e = "0" + e), t--);
|
|
21
|
-
}
|
|
22
|
-
return t + e;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
let c = {
|
|
26
|
-
TEST: {
|
|
27
|
-
CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
|
|
28
|
-
OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
|
|
29
|
-
SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" },
|
|
30
|
-
KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" },
|
|
31
|
-
GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" },
|
|
32
|
-
IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" },
|
|
33
|
-
JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" },
|
|
34
|
-
USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" },
|
|
35
|
-
INDONESIA: { DEFAULT: "wss://wssidn-dev.im.qcloud.com" },
|
|
36
|
-
},
|
|
37
|
-
PRODUCTION: {
|
|
38
|
-
CHINA: {
|
|
39
|
-
DEFAULT0: "wss://*w4c.my-imcloud.com",
|
|
40
|
-
DEFAULT: "wss://wss.im.qcloud.com",
|
|
41
|
-
IPV6: "wss://wssv6.im.qcloud.com",
|
|
42
|
-
BACKUP: "wss://wss.tim.qq.com",
|
|
43
|
-
BACKUP_WEB: "wss://*w4c.my-cpaas.com",
|
|
44
|
-
BACKUP_CN: "wss://wss.im.tencent.cn",
|
|
45
|
-
STAT: "https://events.im.qcloud.com",
|
|
46
|
-
ANYCAST: "wss://162.14.13.203",
|
|
47
|
-
},
|
|
48
|
-
OVERSEA: {
|
|
49
|
-
DEFAULT0: "wss://*w4c.my-imcloud.com",
|
|
50
|
-
DEFAULT: "wss://wss.im.qcloud.com",
|
|
51
|
-
IPV6: "wss://wssv6.im.qcloud.com",
|
|
52
|
-
BACKUP: "wss://wss.my-imcloud.com",
|
|
53
|
-
BACKUP_WEB: "wss://*w4c.my-cpaas.com",
|
|
54
|
-
BACKUP_CN: "wss://wss.im.tencent.cn",
|
|
55
|
-
STAT: "https://api.my-imcloud.com",
|
|
56
|
-
},
|
|
57
|
-
SINGAPORE: {
|
|
58
|
-
DEFAULT0: "wss://*w4s.my-imcloud.com",
|
|
59
|
-
DEFAULT: "wss://wsssgp.im.qcloud.com",
|
|
60
|
-
IPV6: "wss://wsssgpv6.im.qcloud.com",
|
|
61
|
-
BACKUP: "wss://wsssgp.my-imcloud.com",
|
|
62
|
-
BACKUP_WEB: "wss://*w4s.my-cpaas.com",
|
|
63
|
-
STAT: "https://apisgp.my-imcloud.com",
|
|
64
|
-
ANYCAST: "wss://162.14.19.159",
|
|
65
|
-
},
|
|
66
|
-
KOREA: {
|
|
67
|
-
DEFAULT0: "wss://*w4k.my-imcloud.com",
|
|
68
|
-
DEFAULT: "wss://wsskr.im.qcloud.com",
|
|
69
|
-
IPV6: "wss://wsskrv6.im.qcloud.com",
|
|
70
|
-
BACKUP: "wss://wsskr.my-imcloud.com",
|
|
71
|
-
BACKUP_WEB: "wss://*w4k.my-cpaas.com",
|
|
72
|
-
STAT: "https://apikr.my-imcloud.com",
|
|
73
|
-
ANYCAST: "wss://162.14.13.104",
|
|
74
|
-
},
|
|
75
|
-
GERMANY: {
|
|
76
|
-
DEFAULT0: "wss://*w4g.my-imcloud.com",
|
|
77
|
-
DEFAULT: "wss://wssger.im.qcloud.com",
|
|
78
|
-
IPV6: "wss://wssgerv6.im.qcloud.com",
|
|
79
|
-
BACKUP: "wss://wssger.my-imcloud.com",
|
|
80
|
-
BACKUP_WEB: "wss://*w4g.my-cpaas.com",
|
|
81
|
-
STAT: "https://apiger.my-imcloud.com",
|
|
82
|
-
ANYCAST: "wss://162.14.3.17",
|
|
83
|
-
},
|
|
84
|
-
IND: {
|
|
85
|
-
DEFAULT0: "wss://*w4i.my-imcloud.com",
|
|
86
|
-
DEFAULT: "wss://wssind.my-imcloud.com",
|
|
87
|
-
IPV6: "wss://wssindv6.im.qcloud.com",
|
|
88
|
-
BACKUP: "wss://wssind.im.qcloud.com",
|
|
89
|
-
BACKUP_WEB: "wss://*w4i.my-cpaas.com",
|
|
90
|
-
STAT: "https://apiind.my-imcloud.com",
|
|
91
|
-
ANYCAST: "wss://162.14.19.46",
|
|
92
|
-
},
|
|
93
|
-
JPN: {
|
|
94
|
-
DEFAULT0: "wss://*w4j.my-imcloud.com",
|
|
95
|
-
DEFAULT: "wss://wssjpn.im.qcloud.com",
|
|
96
|
-
IPV6: "wss://wssjpnv6.im.qcloud.com",
|
|
97
|
-
BACKUP: "wss://wssjpn.my-imcloud.com",
|
|
98
|
-
BACKUP_WEB: "wss://*w4j.my-cpaas.com",
|
|
99
|
-
STAT: "https://apijpn.my-imcloud.com",
|
|
100
|
-
ANYCAST: "wss://162.14.13.254",
|
|
101
|
-
},
|
|
102
|
-
USA: {
|
|
103
|
-
DEFAULT0: "wss://*w4u.my-imcloud.com",
|
|
104
|
-
DEFAULT: "wss://wssusa.im.qcloud.com",
|
|
105
|
-
IPV6: "wss://wssusav6.im.qcloud.com",
|
|
106
|
-
BACKUP: "wss://wssusa.my-imcloud.com",
|
|
107
|
-
BACKUP_WEB: "wss://*w4u.my-cpaas.com",
|
|
108
|
-
STAT: "https://apiusa.my-imcloud.com",
|
|
109
|
-
ANYCAST: "wss://162.14.10.42",
|
|
110
|
-
},
|
|
111
|
-
INDONESIA: {
|
|
112
|
-
DEFAULT0: "wss://*w4y.my-imcloud.com",
|
|
113
|
-
DEFAULT: "wss://wssidn.im.qcloud.com",
|
|
114
|
-
IPV6: "wss://wssidnv6.im.qcloud.com",
|
|
115
|
-
BACKUP: "wss://wssidn.my-imcloud.com",
|
|
116
|
-
BACKUP_WEB: "wss://*w4y.my-cpaas.com",
|
|
117
|
-
STAT: "https://apiidn.my-imcloud.com",
|
|
118
|
-
ANYCAST: "wss://43.129.34.169",
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
g = {
|
|
123
|
-
ANDROID: 2,
|
|
124
|
-
IOS: 3,
|
|
125
|
-
MAC: 4,
|
|
126
|
-
WEB: 7,
|
|
127
|
-
WX_MP: 8,
|
|
128
|
-
QQ_MP: 9,
|
|
129
|
-
TT_MP: 10,
|
|
130
|
-
BAIDU_MP: 11,
|
|
131
|
-
ALI_MP: 12,
|
|
132
|
-
IPAD: 13,
|
|
133
|
-
UNI_NATIVE_APP: 15,
|
|
134
|
-
DONUT_NATIVE_APP: 19,
|
|
135
|
-
NS_NATIVE_APP: 20,
|
|
136
|
-
RN_NATIVE_APP: 21,
|
|
137
|
-
},
|
|
138
|
-
l = "CHINA",
|
|
139
|
-
h = {
|
|
140
|
-
HOST: {
|
|
141
|
-
CURRENT: {
|
|
142
|
-
DEFAULT: "wss://wss.im.qcloud.com",
|
|
143
|
-
STAT: "https://events.im.qcloud.com",
|
|
144
|
-
},
|
|
145
|
-
setCurrent(t = l) {
|
|
146
|
-
this.CURRENT = c.PRODUCTION[t];
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
NAME: {
|
|
150
|
-
OPEN_IM: "openim",
|
|
151
|
-
OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc",
|
|
152
|
-
GRP: "group_open_http_svc",
|
|
153
|
-
GRP_AV: "group_open_avchatroom_http_svc",
|
|
154
|
-
GRP_COMMUNITY: "million_group_open_http_svc",
|
|
155
|
-
GRP_ATTR: "group_open_attr_http_svc",
|
|
156
|
-
FD: "sns",
|
|
157
|
-
PROFILE: "profile",
|
|
158
|
-
RECENT_CONTACT: "recentcontact",
|
|
159
|
-
PIC: "openpic",
|
|
160
|
-
BIG_GRP_NO_AUTH: "group_open_http_noauth_svc",
|
|
161
|
-
BIG_GRP_POLLING: "group_open_long_polling_http_svc",
|
|
162
|
-
BIG_GRP_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc",
|
|
163
|
-
IM_OPEN_STAT: "imopenstat",
|
|
164
|
-
WEB_IM: "webim",
|
|
165
|
-
IM_COS_SIGN: "im_cos_sign_svr",
|
|
166
|
-
CUSTOM_UPLOAD: "im_cos_msg",
|
|
167
|
-
HEARTBEAT: "heartbeat",
|
|
168
|
-
IM_OPEN_PUSH: "im_open_push",
|
|
169
|
-
IM_OPEN_STATUS: "im_open_status",
|
|
170
|
-
IM_LONG_MSG: "im_long_msg",
|
|
171
|
-
IM_CONFIG_MANAGER: "im_sdk_config_mgr",
|
|
172
|
-
STAT_SERVICE: "StatSvc",
|
|
173
|
-
OVERLOAD_PUSH: "OverLoadPush",
|
|
174
|
-
IM_MSG_AUDIT_MGR: "im_msg_audit_mgr",
|
|
175
|
-
TUIROOM_SVR: "tui_room_svr",
|
|
176
|
-
IM_OPEN_TRANSLATE: "im_open_translate",
|
|
177
|
-
IM_OPEN_SPEECH: "im_open_speech",
|
|
178
|
-
MSG_SEARCH: "message_search",
|
|
179
|
-
GRP_SEARCH: "group_search",
|
|
180
|
-
GRP_MEMBER_SEARCH: "group_member_search",
|
|
181
|
-
USER_SEARCH: "user_search",
|
|
182
|
-
FOLLOW: "follow",
|
|
183
|
-
OFFLINE_PUSH_REPORT: "offline_push_report",
|
|
184
|
-
IM_MSG_LOGIC: "im_msg_db_logic",
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
u =
|
|
188
|
-
(new r(0, Math.pow(2, 1)).toString(),
|
|
189
|
-
new r(0, Math.pow(2, 2)).toString(),
|
|
190
|
-
new r(0, Math.pow(2, 3)).toString(),
|
|
191
|
-
new r(0, Math.pow(2, 4)).toString(),
|
|
192
|
-
new r(0, Math.pow(2, 6)).toString(),
|
|
193
|
-
new r(0, Math.pow(2, 7)).toString(),
|
|
194
|
-
new r(0, Math.pow(2, 9)).toString(),
|
|
195
|
-
new r(0, Math.pow(2, 10)).toString(),
|
|
196
|
-
new r(0, Math.pow(2, 11)).toString(),
|
|
197
|
-
new r(0, Math.pow(2, 13)).toString(),
|
|
198
|
-
new r(0, Math.pow(2, 15)).toString(),
|
|
199
|
-
new r(Math.pow(2, 6)).toString(),
|
|
200
|
-
new r(Math.pow(2, 7)).toString(),
|
|
201
|
-
new r(Math.pow(2, 8)).toString(),
|
|
202
|
-
new r(Math.pow(2, 9)).toString(),
|
|
203
|
-
new r(Math.pow(2, 10)).toString(),
|
|
204
|
-
new r(Math.pow(2, 16)).toString(),
|
|
205
|
-
new r(Math.pow(2, 20)).toString(),
|
|
206
|
-
h.HOST.setCurrent(l),
|
|
207
|
-
"undefined" != typeof wx &&
|
|
208
|
-
"function" == typeof wx.getSystemInfoSync &&
|
|
209
|
-
("mac" === wx.getSystemInfoSync().platform ||
|
|
210
|
-
"windows" === wx.getSystemInfoSync().platform) &&
|
|
211
|
-
void 0 === wx.getSystemInfoSync().uniPlatform),
|
|
212
|
-
m =
|
|
213
|
-
("undefined" != typeof wx &&
|
|
214
|
-
"function" == typeof wx.getSystemInfoSync &&
|
|
215
|
-
Boolean(wx.getSystemInfoSync().fontSizeSetting)) ||
|
|
216
|
-
u,
|
|
217
|
-
d =
|
|
218
|
-
(m && wx.createGamePortal,
|
|
219
|
-
"undefined" != typeof qq &&
|
|
220
|
-
"function" == typeof qq.getSystemInfoSync &&
|
|
221
|
-
Boolean(qq.getSystemInfoSync().fontSizeSetting)),
|
|
222
|
-
_ =
|
|
223
|
-
"undefined" != typeof tt &&
|
|
224
|
-
"function" == typeof tt.getSystemInfoSync &&
|
|
225
|
-
Boolean(tt.getSystemInfoSync().fontSizeSetting),
|
|
226
|
-
I =
|
|
227
|
-
"undefined" != typeof swan &&
|
|
228
|
-
"function" == typeof swan.getSystemInfoSync &&
|
|
229
|
-
Boolean(swan.getSystemInfoSync().fontSizeSetting),
|
|
230
|
-
f =
|
|
231
|
-
"undefined" != typeof my &&
|
|
232
|
-
"function" == typeof my.getSystemInfoSync &&
|
|
233
|
-
Boolean(my.getSystemInfoSync().fontSizeSetting),
|
|
234
|
-
v = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync,
|
|
235
|
-
p =
|
|
236
|
-
"undefined" != typeof uni &&
|
|
237
|
-
"undefined" == typeof window &&
|
|
238
|
-
"function" == typeof uni.requireNativePlugin,
|
|
239
|
-
D = m && "object" == typeof wx.miniapp,
|
|
240
|
-
w = (_ && tt.enterChat, m || d || _ || I || f || p || v),
|
|
241
|
-
y =
|
|
242
|
-
"undefined" == typeof window &&
|
|
243
|
-
!w &&
|
|
244
|
-
"undefined" != typeof global &&
|
|
245
|
-
void 0 !== global.NativeScriptGlobals,
|
|
246
|
-
S =
|
|
247
|
-
"undefined" != typeof global &&
|
|
248
|
-
(void 0 !== global.nativeModuleProxy || void 0 !== global.ReactNative),
|
|
249
|
-
M = "undefined" != typeof uni ? !w : "undefined" != typeof window && !w && !S,
|
|
250
|
-
C =
|
|
251
|
-
(d ? qq : _ ? tt : I ? swan : f ? my : m ? wx : p ? uni : v && jd,
|
|
252
|
-
(M && window && window.navigator && window.navigator.userAgent) || ""),
|
|
253
|
-
T = /(micromessenger|webbrowser)/i.test(C),
|
|
254
|
-
E = (function () {
|
|
255
|
-
let t = "WEB";
|
|
256
|
-
return (
|
|
257
|
-
T
|
|
258
|
-
? (t = "WEB")
|
|
259
|
-
: d
|
|
260
|
-
? (t = "QQ_MP")
|
|
261
|
-
: _
|
|
262
|
-
? (t = "TT_MP")
|
|
263
|
-
: I
|
|
264
|
-
? (t = "BAIDU_MP")
|
|
265
|
-
: f
|
|
266
|
-
? (t = "ALI_MP")
|
|
267
|
-
: m
|
|
268
|
-
? (t = D ? "DONUT_NATIVE_APP" : "WX_MP")
|
|
269
|
-
: p
|
|
270
|
-
? (t = "UNI_NATIVE_APP")
|
|
271
|
-
: y
|
|
272
|
-
? (t = "NS_NATIVE_APP")
|
|
273
|
-
: S && (t = "RN_NATIVE_APP"),
|
|
274
|
-
g[t]
|
|
275
|
-
);
|
|
276
|
-
})(),
|
|
277
|
-
A =
|
|
278
|
-
(!(function () {
|
|
279
|
-
var t = C.match(/OS (\d+)_/i);
|
|
280
|
-
t && t[1] && t[1];
|
|
281
|
-
})(),
|
|
282
|
-
(function () {
|
|
283
|
-
var t,
|
|
284
|
-
e,
|
|
285
|
-
i = C.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
|
|
286
|
-
i &&
|
|
287
|
-
((t = i[1] && parseFloat(i[1])), (e = i[2] && parseFloat(i[2])), t) &&
|
|
288
|
-
e &&
|
|
289
|
-
parseFloat(i[1] + "." + i[2]);
|
|
290
|
-
})(),
|
|
291
|
-
/MSIE/.test(C) || (-1 < C.indexOf("Trident") && -1 < C.indexOf("rv:11.0"))),
|
|
292
|
-
L,
|
|
293
|
-
P,
|
|
294
|
-
U =
|
|
295
|
-
(!(function () {
|
|
296
|
-
var t = /MSIE\s(\d+)\.\d/.exec(C),
|
|
297
|
-
t = t && parseFloat(t[1]);
|
|
298
|
-
!t && /Trident\/7.0/i.test(C) && /rv:11.0/.test(C);
|
|
299
|
-
})(),
|
|
300
|
-
(L =
|
|
301
|
-
"undefined" != typeof console
|
|
302
|
-
? console
|
|
303
|
-
: "undefined" != typeof global && global.console
|
|
304
|
-
? global.console
|
|
305
|
-
: "undefined" != typeof window && window.console
|
|
306
|
-
? window.console
|
|
307
|
-
: {}),
|
|
308
|
-
function () {}),
|
|
309
|
-
N = [
|
|
310
|
-
"assert",
|
|
311
|
-
"clear",
|
|
312
|
-
"count",
|
|
313
|
-
"debug",
|
|
314
|
-
"dir",
|
|
315
|
-
"dirxml",
|
|
316
|
-
"error",
|
|
317
|
-
"group",
|
|
318
|
-
"groupCollapsed",
|
|
319
|
-
"groupEnd",
|
|
320
|
-
"info",
|
|
321
|
-
"log",
|
|
322
|
-
"profile",
|
|
323
|
-
"profileEnd",
|
|
324
|
-
"table",
|
|
325
|
-
"time",
|
|
326
|
-
"timeEnd",
|
|
327
|
-
"timeStamp",
|
|
328
|
-
"trace",
|
|
329
|
-
"warn",
|
|
330
|
-
],
|
|
331
|
-
O = N.length;
|
|
332
|
-
for (; O--; ) ((P = N[O]), console[P] || (L[P] = U));
|
|
333
|
-
var $ = L;
|
|
334
|
-
let R = "TIMCustomElem",
|
|
335
|
-
H = "High",
|
|
336
|
-
F = "C2C",
|
|
337
|
-
B = "GROUP",
|
|
338
|
-
x = function () {
|
|
339
|
-
return new Date().getTime() + 0;
|
|
340
|
-
},
|
|
341
|
-
b = function () {
|
|
342
|
-
var t = new Date();
|
|
343
|
-
return (t.setTime(x()), t);
|
|
344
|
-
},
|
|
345
|
-
q = function () {
|
|
346
|
-
return Math.floor(x() / 1e3);
|
|
347
|
-
},
|
|
348
|
-
G = Object.prototype.hasOwnProperty;
|
|
349
|
-
function j(t) {
|
|
350
|
-
if (null == t) return !0;
|
|
351
|
-
if ("boolean" == typeof t) return !1;
|
|
352
|
-
if ("number" == typeof t) return 0 === t;
|
|
353
|
-
if ("string" == typeof t) return 0 === t.length;
|
|
354
|
-
if ("function" == typeof t) return 0 === t.length;
|
|
355
|
-
if (Array.isArray(t)) return 0 === t.length;
|
|
356
|
-
if (t instanceof Error) return "" === t.message;
|
|
357
|
-
if (W(t)) {
|
|
358
|
-
for (var e in t) if (G.call(t, e)) return !1;
|
|
359
|
-
return !0;
|
|
360
|
-
}
|
|
361
|
-
return !!(K(t) || V(t) || k(t)) && 0 === t.size;
|
|
362
|
-
}
|
|
363
|
-
let K = function (t) {
|
|
364
|
-
return "map" === z(t);
|
|
365
|
-
},
|
|
366
|
-
V = function (t) {
|
|
367
|
-
return "set" === z(t);
|
|
368
|
-
},
|
|
369
|
-
k = function (t) {
|
|
370
|
-
return "file" === z(t);
|
|
371
|
-
},
|
|
372
|
-
W = function (t) {
|
|
373
|
-
if ("object" != typeof t || null === t) return !1;
|
|
374
|
-
t = Object.getPrototypeOf(t);
|
|
375
|
-
if (null === t) return !0;
|
|
376
|
-
let e = t;
|
|
377
|
-
for (; null !== Object.getPrototypeOf(e); ) e = Object.getPrototypeOf(e);
|
|
378
|
-
return t === e;
|
|
379
|
-
},
|
|
380
|
-
Y = function (t) {
|
|
381
|
-
return void 0 === t;
|
|
382
|
-
},
|
|
383
|
-
J = function (t) {
|
|
384
|
-
return (
|
|
385
|
-
(e = t),
|
|
386
|
-
("function" == typeof Array.isArray
|
|
387
|
-
? Array.isArray(e)
|
|
388
|
-
: "array" === z(e)) ||
|
|
389
|
-
(null !== t && "object" == typeof t)
|
|
390
|
-
);
|
|
391
|
-
var e;
|
|
392
|
-
},
|
|
393
|
-
z = function (t) {
|
|
394
|
-
return Object.prototype.toString
|
|
395
|
-
.call(t)
|
|
396
|
-
.match(/^\[object (.*)\]$/)[1]
|
|
397
|
-
.toLowerCase();
|
|
398
|
-
};
|
|
399
|
-
function X() {
|
|
400
|
-
return !A && !w;
|
|
401
|
-
}
|
|
402
|
-
Date.now ||
|
|
403
|
-
(Date.now = function () {
|
|
404
|
-
return new Date().getTime();
|
|
405
|
-
});
|
|
406
|
-
let Q = 0;
|
|
407
|
-
function Z() {
|
|
408
|
-
return X() ? "%c Chat %c" : "Chat";
|
|
409
|
-
}
|
|
410
|
-
function et() {
|
|
411
|
-
var t = b();
|
|
412
|
-
return (
|
|
413
|
-
t.toLocaleTimeString("en-US", { hour12: !1 }) +
|
|
414
|
-
"." +
|
|
415
|
-
(function (t) {
|
|
416
|
-
let e;
|
|
417
|
-
switch (t.toString().length) {
|
|
418
|
-
case 1:
|
|
419
|
-
e = "00" + t;
|
|
420
|
-
break;
|
|
421
|
-
case 2:
|
|
422
|
-
e = "0" + t;
|
|
423
|
-
break;
|
|
424
|
-
default:
|
|
425
|
-
e = t;
|
|
426
|
-
}
|
|
427
|
-
return e;
|
|
428
|
-
})(t.getMilliseconds())
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
let it = {
|
|
432
|
-
arguments2String(i) {
|
|
433
|
-
let n = "";
|
|
434
|
-
if (1 === i.length) n = i[0];
|
|
435
|
-
else
|
|
436
|
-
for (let t = 0, e = i.length; t < e; t++) {
|
|
437
|
-
if (J(i[t]))
|
|
438
|
-
try {
|
|
439
|
-
n +=
|
|
440
|
-
i[t] instanceof Error
|
|
441
|
-
? JSON.stringify(i[t], ["message", "code"])
|
|
442
|
-
: JSON.stringify(i[t]);
|
|
443
|
-
} catch (t) {
|
|
444
|
-
n += t ? t.message : "";
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
else n += i[t];
|
|
448
|
-
n += " ";
|
|
449
|
-
}
|
|
450
|
-
return n;
|
|
451
|
-
},
|
|
452
|
-
_exec(t, e) {
|
|
453
|
-
X()
|
|
454
|
-
? $[t](
|
|
455
|
-
Z(),
|
|
456
|
-
"background:#0abf5b; padding:1px; border-radius:3px; color: #fff",
|
|
457
|
-
"background:transparent",
|
|
458
|
-
et(),
|
|
459
|
-
e,
|
|
460
|
-
)
|
|
461
|
-
: $[t](`${Z()} ${et()} ` + e);
|
|
462
|
-
},
|
|
463
|
-
d: function () {
|
|
464
|
-
var t;
|
|
465
|
-
Q <= -1 && ((t = this.arguments2String(arguments)), this._exec("debug", t));
|
|
466
|
-
},
|
|
467
|
-
l: function () {
|
|
468
|
-
var t;
|
|
469
|
-
Q <= 0 && ((t = this.arguments2String(arguments)), this._exec("log", t));
|
|
470
|
-
},
|
|
471
|
-
log: function () {
|
|
472
|
-
var t;
|
|
473
|
-
Q <= 0 && ((t = this.arguments2String(arguments)), this._exec("log", t));
|
|
474
|
-
},
|
|
475
|
-
i: function () {
|
|
476
|
-
var t;
|
|
477
|
-
Q <= 1 && ((t = this.arguments2String(arguments)), this._exec("info", t));
|
|
478
|
-
},
|
|
479
|
-
w: function () {
|
|
480
|
-
var t;
|
|
481
|
-
Q <= 2 && ((t = this.arguments2String(arguments)), this._exec("warn", t));
|
|
482
|
-
},
|
|
483
|
-
e: function () {
|
|
484
|
-
var t;
|
|
485
|
-
Q <= 3 && ((t = this.arguments2String(arguments)), this._exec("error", t));
|
|
486
|
-
},
|
|
487
|
-
setLevel: function (t) {
|
|
488
|
-
(t < 4 && this._exec("log", "set level from " + Q + " to " + t), (Q = t));
|
|
489
|
-
},
|
|
490
|
-
getLevel: function () {
|
|
491
|
-
return Q;
|
|
492
|
-
},
|
|
493
|
-
};
|
|
494
|
-
class nt extends Error {
|
|
495
|
-
constructor(t) {
|
|
496
|
-
super();
|
|
497
|
-
var { code: t, message: e, data: i } = t;
|
|
498
|
-
((this.code = t),
|
|
499
|
-
e
|
|
500
|
-
? (this.message = e)
|
|
501
|
-
: this._getErrMsg && (this.message = this._getErrMsg(this.code)),
|
|
502
|
-
(this.data = i || {}));
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
let st = 2903,
|
|
506
|
-
ot = 3122,
|
|
507
|
-
at = 8010,
|
|
508
|
-
rt = 8011,
|
|
509
|
-
ct = 8020,
|
|
510
|
-
gt = "error",
|
|
511
|
-
lt = null,
|
|
512
|
-
ht = function (t, e = !1) {
|
|
513
|
-
if (t instanceof nt)
|
|
514
|
-
return (e && null !== lt && lt.emit(gt, t), Promise.reject(t));
|
|
515
|
-
if (t instanceof Error) {
|
|
516
|
-
let t = new nt({ code: st });
|
|
517
|
-
return (e && null !== lt && lt.emit(gt, t), Promise.reject(t));
|
|
518
|
-
}
|
|
519
|
-
return Y(t) || Y(t.code)
|
|
520
|
-
? Promise.reject(new nt({ code: st }))
|
|
521
|
-
: ((t = new nt(t)),
|
|
522
|
-
e && null !== lt && lt.emit(gt, t),
|
|
523
|
-
Promise.reject(t));
|
|
524
|
-
},
|
|
525
|
-
ut = "newInvitationReceived",
|
|
526
|
-
mt = "ts_invitee_accepted",
|
|
527
|
-
dt = "ts_invitee_rejected",
|
|
528
|
-
_t = "ts_invitation_cancelled",
|
|
529
|
-
It = "ts_invitation_timeout",
|
|
530
|
-
ft = "ts_invitation_modified",
|
|
531
|
-
vt = 1,
|
|
532
|
-
pt = 2,
|
|
533
|
-
Dt = 3,
|
|
534
|
-
wt = 4,
|
|
535
|
-
yt = 5;
|
|
536
|
-
class St {
|
|
537
|
-
constructor(t) {
|
|
538
|
-
((this._n = "RemoteSignalingHandler"), (this._sigM = t));
|
|
539
|
-
}
|
|
540
|
-
onNewMessageList(t) {
|
|
541
|
-
t.forEach((t) => {
|
|
542
|
-
var e = this.getPayloadData(t);
|
|
543
|
-
e && this._handleActionType(e, t);
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
onMessageModified(t) {
|
|
547
|
-
t.forEach((t) => {
|
|
548
|
-
var e = this.getPayloadData(t);
|
|
549
|
-
e && this._onInvitationModified(e, t);
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
getPayloadData(e) {
|
|
553
|
-
var i = this._n + ".getPayloadData",
|
|
554
|
-
e = e.payload["data"];
|
|
555
|
-
try {
|
|
556
|
-
return JSON.parse(e);
|
|
557
|
-
} catch (t) {
|
|
558
|
-
return (it.e(i + " JSON parse error. signalingData:" + e), null);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
_handleActionType(t, e) {
|
|
562
|
-
var i = t["actionType"];
|
|
563
|
-
switch (i) {
|
|
564
|
-
case vt:
|
|
565
|
-
this._onNewInvitationReceived(t, e);
|
|
566
|
-
break;
|
|
567
|
-
case wt:
|
|
568
|
-
this._onInviteeRejected(t);
|
|
569
|
-
break;
|
|
570
|
-
case Dt:
|
|
571
|
-
this._onInviteeAccepted(t);
|
|
572
|
-
break;
|
|
573
|
-
case pt:
|
|
574
|
-
this._onInvitationCancelled(t);
|
|
575
|
-
break;
|
|
576
|
-
case yt:
|
|
577
|
-
this._onInvitationTimeout(t);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
_genBaseEmitData(t) {
|
|
581
|
-
var { inviteID: t, inviter: e, groupID: i, data: n } = t;
|
|
582
|
-
return { inviteID: t, inviter: e, groupID: i, data: n || "" };
|
|
583
|
-
}
|
|
584
|
-
_onNewInvitationReceived(e, i) {
|
|
585
|
-
let t = this._n + "._onNewInvitationReceived",
|
|
586
|
-
{ inviteID: n, inviteeList: s, groupID: o, inviter: a } = e,
|
|
587
|
-
r = this._sigM.getMyUserID(),
|
|
588
|
-
g = s.includes(r),
|
|
589
|
-
l = e.timeout;
|
|
590
|
-
var c = (b().getTime() - 1e3 * i.time) / 1e3,
|
|
591
|
-
h =
|
|
592
|
-
(0 < l && 0 < c && l > c && (l -= c),
|
|
593
|
-
t + ` myselfIncluded:${g} groupID:${o} signalObj:` + JSON.stringify(e));
|
|
594
|
-
if ((it.l(h + ` timeout:${l}s delta:${c}s`), (o && g) || !o)) {
|
|
595
|
-
let t = this._sigM.getInviteInfo(n);
|
|
596
|
-
(t && t === e) ||
|
|
597
|
-
(t || this._sigM.setInviteInfo(n, { ...e, message: i }),
|
|
598
|
-
this._sigM.emitEvent(ut, {
|
|
599
|
-
...this._genBaseEmitData(e),
|
|
600
|
-
inviteeList: s,
|
|
601
|
-
}),
|
|
602
|
-
a !== r && this._sigM.startTimer({ ...e, timeout: l }));
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
_onInviteeRejected(t) {
|
|
606
|
-
var e = this._n + "._onInviteeRejected",
|
|
607
|
-
{ inviteID: i, inviter: n, groupID: s } = t,
|
|
608
|
-
o = this._sigM.hasInviteInfo(i);
|
|
609
|
-
(it.l(e + ` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:` + s),
|
|
610
|
-
o &&
|
|
611
|
-
(this._sigM.updateInviteInfo(t),
|
|
612
|
-
this._sigM.emitEvent(dt, {
|
|
613
|
-
...this._genBaseEmitData(t),
|
|
614
|
-
invitee: t.inviteeList[0],
|
|
615
|
-
})));
|
|
616
|
-
}
|
|
617
|
-
_onInviteeAccepted(t) {
|
|
618
|
-
var e = this._n + "._onInviteeAccepted",
|
|
619
|
-
{ inviteID: i, inviter: n, groupID: s } = t,
|
|
620
|
-
o = this._sigM.hasInviteInfo(i);
|
|
621
|
-
(it.l(e + ` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:` + s),
|
|
622
|
-
o &&
|
|
623
|
-
(this._sigM.updateInviteInfo(t),
|
|
624
|
-
this._sigM.emitEvent(mt, {
|
|
625
|
-
...this._genBaseEmitData(t),
|
|
626
|
-
invitee: t.inviteeList[0],
|
|
627
|
-
})));
|
|
628
|
-
}
|
|
629
|
-
_onInvitationCancelled(t) {
|
|
630
|
-
var e = this._n + "._onInvitationCancelled",
|
|
631
|
-
{ inviteID: i, inviter: n, groupID: s } = t,
|
|
632
|
-
o = this._sigM.hasInviteInfo(i);
|
|
633
|
-
(it.l(e + ` inviteID:${i} hasInviteID:${o} inviter:${n} groupID:` + s),
|
|
634
|
-
o &&
|
|
635
|
-
(this._sigM.deleteInviteInfo(i),
|
|
636
|
-
this._sigM.emitEvent(_t, this._genBaseEmitData(t))));
|
|
637
|
-
}
|
|
638
|
-
_onInvitationTimeout(t) {
|
|
639
|
-
var e = this._n + "._onInvitationTimeout",
|
|
640
|
-
{ inviteID: i, inviter: n, groupID: s, inviteeList: o } = t,
|
|
641
|
-
a = this._sigM.hasInviteInfo(i);
|
|
642
|
-
(it.l(
|
|
643
|
-
e +
|
|
644
|
-
` inviteID:${i} hasInviteID:${a} inviter:${n} groupID:${s} data:` +
|
|
645
|
-
t.data,
|
|
646
|
-
),
|
|
647
|
-
a &&
|
|
648
|
-
(this._sigM.updateInviteInfo(t),
|
|
649
|
-
this._sigM.emitEvent(It, {
|
|
650
|
-
...this._genBaseEmitData(t),
|
|
651
|
-
inviteeList: o,
|
|
652
|
-
isSelfTimeout: !1,
|
|
653
|
-
})));
|
|
654
|
-
}
|
|
655
|
-
_onInvitationModified(t, e) {
|
|
656
|
-
var i = this._n + "._onInvitationModified",
|
|
657
|
-
{ inviteID: n, data: s } = t,
|
|
658
|
-
o = this._sigM.hasInviteInfo(n);
|
|
659
|
-
(it.l(i + ` inviteID:${n} hasInviteID:${o} data:` + s),
|
|
660
|
-
o &&
|
|
661
|
-
(this._sigM.setInviteInfo(n, { ...t, message: e }),
|
|
662
|
-
this._sigM.emitEvent(ft, { inviteID: n, data: s })));
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
let Mt = function (t) {
|
|
666
|
-
var e;
|
|
667
|
-
return t < 0 || 53 < t
|
|
668
|
-
? NaN
|
|
669
|
-
: ((e = 0 | (1073741824 * Math.random())),
|
|
670
|
-
30 < t
|
|
671
|
-
? e + 1073741824 * (0 | (Math.random() * (1 << (t - 30))))
|
|
672
|
-
: e >>> (30 - t));
|
|
673
|
-
},
|
|
674
|
-
Ct = function (t, e) {
|
|
675
|
-
let i = t.toString(16),
|
|
676
|
-
n = e - i.length,
|
|
677
|
-
s = "0";
|
|
678
|
-
for (; 0 < n; n >>>= 1, s += s) 1 & n && (i = s + i);
|
|
679
|
-
return i;
|
|
680
|
-
};
|
|
681
|
-
class Tt {
|
|
682
|
-
constructor(t) {
|
|
683
|
-
((this._n = "LocalSignalingHandler"), (this._sigM = t));
|
|
684
|
-
}
|
|
685
|
-
generateInviteID() {
|
|
686
|
-
t = Mt;
|
|
687
|
-
var t,
|
|
688
|
-
e =
|
|
689
|
-
(e = Ct)(t(32), 8) +
|
|
690
|
-
"-" +
|
|
691
|
-
e(t(16), 4) +
|
|
692
|
-
"-" +
|
|
693
|
-
e(16384 | t(12), 4) +
|
|
694
|
-
"-" +
|
|
695
|
-
e(32768 | t(14), 4) +
|
|
696
|
-
"-" +
|
|
697
|
-
e(t(48), 12);
|
|
698
|
-
return (it.l(this._n + ".generateInviteID inviteID:" + e), e);
|
|
699
|
-
}
|
|
700
|
-
createInviteInfo(t) {
|
|
701
|
-
var e = this.generateInviteID(),
|
|
702
|
-
t = this.createInviteCustomData({ ...t, inviteID: e }),
|
|
703
|
-
{ groupID: i, inviteeList: n } = t,
|
|
704
|
-
i = i || n[0];
|
|
705
|
-
return {
|
|
706
|
-
customData: t,
|
|
707
|
-
message: this._sigM.createSignaling(t, i),
|
|
708
|
-
inviteID: e,
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
_genBaseCustomData(t) {
|
|
712
|
-
var { data: t = "", inviteID: e = "", groupID: i = "" } = t;
|
|
713
|
-
return { businessID: 1, timeout: 0, data: t, inviteID: e, groupID: i };
|
|
714
|
-
}
|
|
715
|
-
createInviteCustomData(t) {
|
|
716
|
-
var { userID: e, timeout: i = 0, groupID: n = "" } = t,
|
|
717
|
-
s = this._sigM.getMyUserID(),
|
|
718
|
-
s = {
|
|
719
|
-
...this._genBaseCustomData(t),
|
|
720
|
-
actionType: vt,
|
|
721
|
-
inviter: s,
|
|
722
|
-
inviteeList: n ? t.inviteeList : [e],
|
|
723
|
-
timeout: i,
|
|
724
|
-
};
|
|
725
|
-
return (it.l(this._n + ".createInviteCustomData customData:", s), s);
|
|
726
|
-
}
|
|
727
|
-
createCancelCustomData(t) {
|
|
728
|
-
var e = this._n + ".createCancelCustomData",
|
|
729
|
-
i = t["inviteID"];
|
|
730
|
-
let n;
|
|
731
|
-
var s = this._sigM.getMyUserID(),
|
|
732
|
-
{ inviteeList: i, groupID: o, inviter: a } = this._sigM.getInviteInfo(i);
|
|
733
|
-
return (
|
|
734
|
-
a === s
|
|
735
|
-
? (n = {
|
|
736
|
-
...this._genBaseCustomData(t),
|
|
737
|
-
actionType: pt,
|
|
738
|
-
groupID: o,
|
|
739
|
-
inviter: s,
|
|
740
|
-
inviteeList: i,
|
|
741
|
-
})
|
|
742
|
-
: it.e(e + ` unmatched inviter:${a} and my userID:` + s),
|
|
743
|
-
it.l(e + " customData:", n),
|
|
744
|
-
n
|
|
745
|
-
);
|
|
746
|
-
}
|
|
747
|
-
createAcceptCustomData(t) {
|
|
748
|
-
var e = this._n + ".createAcceptCustomData",
|
|
749
|
-
i = t["inviteID"];
|
|
750
|
-
let n;
|
|
751
|
-
var s = this._sigM.getMyUserID(),
|
|
752
|
-
{ inviter: o, groupID: a, inviteeList: r } = this._sigM.getInviteInfo(i);
|
|
753
|
-
return (
|
|
754
|
-
r.includes(s)
|
|
755
|
-
? (n = {
|
|
756
|
-
...this._genBaseCustomData(t),
|
|
757
|
-
actionType: Dt,
|
|
758
|
-
groupID: a,
|
|
759
|
-
inviter: o,
|
|
760
|
-
inviteeList: [s],
|
|
761
|
-
})
|
|
762
|
-
: it.e(
|
|
763
|
-
e + ` userID:${s} not in inviteeList. inviteID:${i} groupID:` + a,
|
|
764
|
-
),
|
|
765
|
-
it.l(e + " customData:", n),
|
|
766
|
-
n
|
|
767
|
-
);
|
|
768
|
-
}
|
|
769
|
-
createRejectCustomData(t) {
|
|
770
|
-
var e = this._n + ".createRejectCustomData",
|
|
771
|
-
i = t["inviteID"];
|
|
772
|
-
let n;
|
|
773
|
-
var s = this._sigM.getMyUserID(),
|
|
774
|
-
{ inviter: o, groupID: a, inviteeList: r } = this._sigM.getInviteInfo(i);
|
|
775
|
-
return (
|
|
776
|
-
r.includes(s)
|
|
777
|
-
? (n = {
|
|
778
|
-
...this._genBaseCustomData(t),
|
|
779
|
-
actionType: wt,
|
|
780
|
-
groupID: a,
|
|
781
|
-
inviter: o,
|
|
782
|
-
inviteeList: [s],
|
|
783
|
-
})
|
|
784
|
-
: it.e(
|
|
785
|
-
e + ` userID:${s} not in inviteeList. inviteID:${i} groupID:` + a,
|
|
786
|
-
),
|
|
787
|
-
it.l(e + " customData:", n),
|
|
788
|
-
n
|
|
789
|
-
);
|
|
790
|
-
}
|
|
791
|
-
createTimeoutCustomData(t) {
|
|
792
|
-
var e = this._n + ".createTimeoutCustomData",
|
|
793
|
-
{ inviteeList: i, inviter: n, isInviter: s = !1 } = t,
|
|
794
|
-
o = this._sigM.getMyUserID(),
|
|
795
|
-
t = {
|
|
796
|
-
...this._genBaseCustomData(t),
|
|
797
|
-
actionType: yt,
|
|
798
|
-
inviter: n,
|
|
799
|
-
inviteeList: s ? i : [o],
|
|
800
|
-
};
|
|
801
|
-
return (it.l(e + " customData:", t), t);
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
class Et {
|
|
805
|
-
constructor(t) {
|
|
806
|
-
((this._n = "HistorySignalingHandler"),
|
|
807
|
-
(this._sigM = t),
|
|
808
|
-
(this.COUNT = 20),
|
|
809
|
-
(this.EXPIRED_TIME = 300),
|
|
810
|
-
(this._map = new Map()),
|
|
811
|
-
(this._relatedToMeMap = new Map()));
|
|
812
|
-
}
|
|
813
|
-
setCloudConfig(t = 20, e = 300) {
|
|
814
|
-
((this.COUNT = t),
|
|
815
|
-
(this.EXPIRED_TIME = e),
|
|
816
|
-
it.l(this._n + `.setCloudConfig count:${t}, time:` + e));
|
|
817
|
-
}
|
|
818
|
-
getHistorySignaling() {
|
|
819
|
-
var t = this._sigM.get(i).getLocalConvList();
|
|
820
|
-
j(t) ||
|
|
821
|
-
(this._getC2CSignalingList(),
|
|
822
|
-
(t = this._getValidGroupConvList(t)),
|
|
823
|
-
this._getGroupSignalingList(t).then((t) => {
|
|
824
|
-
this._handleSignalingList(t);
|
|
825
|
-
}));
|
|
826
|
-
}
|
|
827
|
-
_getC2CSignalingList() {
|
|
828
|
-
var t = this._sigM.get(e).getMessageListFromUnreadDB(),
|
|
829
|
-
t = this._sigM.filterMessageList(t);
|
|
830
|
-
this._getRelatedToMeMap(t);
|
|
831
|
-
}
|
|
832
|
-
_getGroupSignalingList(t) {
|
|
833
|
-
t = this._createPromiseList(t);
|
|
834
|
-
return 0 === t.length
|
|
835
|
-
? Promise.resolve(this._sortSignaling(this._relatedToMeMap))
|
|
836
|
-
: this._concurrentGetMessageList(t).then((t) => {
|
|
837
|
-
let e = new Map();
|
|
838
|
-
return (
|
|
839
|
-
t.forEach((t) => {
|
|
840
|
-
((t = t.list), (t = this._getRelatedToMeMap(t)));
|
|
841
|
-
e = new Map([...e, ...t]);
|
|
842
|
-
}),
|
|
843
|
-
this._sortSignaling(e)
|
|
844
|
-
);
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
_handleSignalingList(t) {
|
|
848
|
-
j(t) || this._sigM.onNewMessageList(t);
|
|
849
|
-
}
|
|
850
|
-
_getValidGroupConvList(i) {
|
|
851
|
-
var n = [];
|
|
852
|
-
for (let t = 0, e = i.length; t < e; t++) {
|
|
853
|
-
var { type: s, unreadCount: o, lastMessage: a } = i[t],
|
|
854
|
-
s = s === B,
|
|
855
|
-
a = this._isNotExpired(a);
|
|
856
|
-
s && o && a && n.push(i[t]);
|
|
857
|
-
}
|
|
858
|
-
return n;
|
|
859
|
-
}
|
|
860
|
-
_isNotExpired(t) {
|
|
861
|
-
return !(!t || !t.lastTime) && t.lastTime > q() - this.EXPIRED_TIME;
|
|
862
|
-
}
|
|
863
|
-
_createPromiseList(e) {
|
|
864
|
-
var n = [];
|
|
865
|
-
for (let t = 0; t < e.length; t++) {
|
|
866
|
-
var { conversationID: s, unreadCount: o } = e[t],
|
|
867
|
-
o = o < this.COUNT ? o : this.COUNT,
|
|
868
|
-
o =
|
|
869
|
-
(this._map.set(s, { msgCount: o, list: [] }),
|
|
870
|
-
this._sigM.get(i).getMessageList({ conversationID: s }));
|
|
871
|
-
n.push(o);
|
|
872
|
-
}
|
|
873
|
-
return n;
|
|
874
|
-
}
|
|
875
|
-
_concurrentGetMessageList(t) {
|
|
876
|
-
let s = [];
|
|
877
|
-
return Promise.all(t).then((e) => {
|
|
878
|
-
for (let t = 0; t < e.length; t++) {
|
|
879
|
-
var { code: i, data: n } = e[t];
|
|
880
|
-
0 === i &&
|
|
881
|
-
0 !== n.messageList.length &&
|
|
882
|
-
(this._handleMessageList(n.messageList),
|
|
883
|
-
(i = this._relayGetMessageList(n))) &&
|
|
884
|
-
s.push(i);
|
|
885
|
-
}
|
|
886
|
-
return 0 < s.length ? this._concurrentGetMessageList(s) : this._map;
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
_relayGetMessageList(t) {
|
|
890
|
-
var e,
|
|
891
|
-
{ messageList: t, nextReqMessageID: n, isCompleted: s } = t;
|
|
892
|
-
return 0 === t.length ||
|
|
893
|
-
((t = t[0].conversationID), (e = this._map.get(t).msgCount), 0 === e) ||
|
|
894
|
-
s
|
|
895
|
-
? null
|
|
896
|
-
: this._sigM
|
|
897
|
-
.get(i)
|
|
898
|
-
.getMessageList({ conversationID: t, nextReqMessageID: n, count: e });
|
|
899
|
-
}
|
|
900
|
-
_handleMessageList(t) {
|
|
901
|
-
var e = t.length,
|
|
902
|
-
i = t[0]["conversationID"],
|
|
903
|
-
{ msgCount: n, list: s } = this._map.get(i);
|
|
904
|
-
this._map.set(i, {
|
|
905
|
-
msgCount: 0 < n - e ? n - e : 0,
|
|
906
|
-
list: s.concat(this._sigM.filterMessageList(t)),
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
_getRelatedToMeMap(e) {
|
|
910
|
-
for (let t = 0; t < e.length; t++) {
|
|
911
|
-
var i = e[t];
|
|
912
|
-
this._saveRelatedToMe(i);
|
|
913
|
-
}
|
|
914
|
-
return this._relatedToMeMap;
|
|
915
|
-
}
|
|
916
|
-
_saveRelatedToMe(t) {
|
|
917
|
-
var { actionType: e = "", inviteID: i = "" } =
|
|
918
|
-
this._sigM.getPayloadData(t) || {};
|
|
919
|
-
switch (e) {
|
|
920
|
-
case vt:
|
|
921
|
-
this._setHistoryInvite(t);
|
|
922
|
-
break;
|
|
923
|
-
case wt:
|
|
924
|
-
case Dt:
|
|
925
|
-
this._updateHistoryInvite(t);
|
|
926
|
-
break;
|
|
927
|
-
case pt:
|
|
928
|
-
this._delHistoryInvite(i);
|
|
929
|
-
break;
|
|
930
|
-
case yt:
|
|
931
|
-
this._updateHistoryInvite(t);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
_setHistoryInvite(t) {
|
|
935
|
-
var e = this._sigM.getPayloadData(t) || {},
|
|
936
|
-
{ inviteID: i = "", inviteeList: n = [], timeout: s = 0 } = e,
|
|
937
|
-
o = this._sigM.getMyUserID();
|
|
938
|
-
n.includes(o) &&
|
|
939
|
-
((n = q() - t.time),
|
|
940
|
-
(0 < s && s < n && 0 !== s) ||
|
|
941
|
-
this._relatedToMeMap.set(i, { ...e, messageList: [t] }));
|
|
942
|
-
}
|
|
943
|
-
_delHistoryInvite(t) {
|
|
944
|
-
this._relatedToMeMap.has(t) && this._relatedToMeMap.delete(t);
|
|
945
|
-
}
|
|
946
|
-
_updateHistoryInvite(e) {
|
|
947
|
-
let t = this._sigM.getPayloadData(e) || {},
|
|
948
|
-
{ inviteID: n = "", inviteeList: s = [] } = t;
|
|
949
|
-
if (this._relatedToMeMap.has(n)) {
|
|
950
|
-
let { inviteeList: i, messageList: t } = this._relatedToMeMap.get(n);
|
|
951
|
-
for (let e = 0; e < s.length; e++) {
|
|
952
|
-
let t = s[e];
|
|
953
|
-
i.includes(t) && i.splice(i.indexOf(t), 1);
|
|
954
|
-
}
|
|
955
|
-
0 === i.length ? this._delHistoryInvite(n) : t.push(e);
|
|
956
|
-
} else this._delHistoryInvite(n);
|
|
957
|
-
}
|
|
958
|
-
_sortSignaling(t) {
|
|
959
|
-
let e = [];
|
|
960
|
-
return (
|
|
961
|
-
t.forEach((t) => {
|
|
962
|
-
e = [...e, ...t.messageList];
|
|
963
|
-
}),
|
|
964
|
-
e.sort((t, e) => t.time - e.time)
|
|
965
|
-
);
|
|
966
|
-
}
|
|
967
|
-
reset() {
|
|
968
|
-
(this._map.clear(), this._relatedToMeMap.clear());
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
class At {
|
|
972
|
-
constructor(t, e) {
|
|
973
|
-
((this.businessID = t.businessID || 1),
|
|
974
|
-
(this.inviteID = t.inviteID),
|
|
975
|
-
(this.groupID = t.groupID || ""),
|
|
976
|
-
(this.inviter = t.inviter || ""),
|
|
977
|
-
(this.inviteeList = t.inviteeList || []),
|
|
978
|
-
(this.data = t.data || ""),
|
|
979
|
-
(this.actionType = t.actionType || vt),
|
|
980
|
-
(this.timeout = t.timeout || 0));
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
let Lt = {
|
|
984
|
-
A2KEY_AND_TINYID_UPDATED: "_inner1",
|
|
985
|
-
CLOUD_CONFIG: "_inner2",
|
|
986
|
-
PROFILE_UPDATED: "_inner3",
|
|
987
|
-
CONV_SYNC_COMPLETED: "_inner4",
|
|
988
|
-
C2C_UNREAD_HANDLE_COMPLETED: "_inner5",
|
|
989
|
-
};
|
|
990
|
-
class Pt extends class {
|
|
991
|
-
constructor(t) {
|
|
992
|
-
((this._m = t), (this._n = ""));
|
|
993
|
-
}
|
|
994
|
-
isLoggedIn() {
|
|
995
|
-
return this._m.get(n).isLoggedIn();
|
|
996
|
-
}
|
|
997
|
-
isOversea() {
|
|
998
|
-
return this._m.get(n).isOversea();
|
|
999
|
-
}
|
|
1000
|
-
isPrivateNetWork() {
|
|
1001
|
-
var t = this._m.get(n);
|
|
1002
|
-
return t.isPrivateNetWork() && !t.getFileDownloadProxy();
|
|
1003
|
-
}
|
|
1004
|
-
getFileDownloadProxy() {
|
|
1005
|
-
return this._m.get(n).getFileDownloadProxy();
|
|
1006
|
-
}
|
|
1007
|
-
getDownloadFileAuthKey() {
|
|
1008
|
-
return this._m.get(n).getDownloadFileAuthKey();
|
|
1009
|
-
}
|
|
1010
|
-
getMyUserID() {
|
|
1011
|
-
return this._m.get(n).getUserID();
|
|
1012
|
-
}
|
|
1013
|
-
getMyTinyID() {
|
|
1014
|
-
return this._m.get(n).getTinyID();
|
|
1015
|
-
}
|
|
1016
|
-
getSDKAppID() {
|
|
1017
|
-
return this._m.get(n).getSDKAppID();
|
|
1018
|
-
}
|
|
1019
|
-
isIntl() {
|
|
1020
|
-
return this._m.get(n).isIntl();
|
|
1021
|
-
}
|
|
1022
|
-
isUsingChatCore() {
|
|
1023
|
-
return this._m.get(n).isUsingChatCore();
|
|
1024
|
-
}
|
|
1025
|
-
isDevMode() {
|
|
1026
|
-
return this._m.get(n).isDevMode();
|
|
1027
|
-
}
|
|
1028
|
-
get(t) {
|
|
1029
|
-
return this._m.get(t);
|
|
1030
|
-
}
|
|
1031
|
-
getPlatform() {
|
|
1032
|
-
return E;
|
|
1033
|
-
}
|
|
1034
|
-
getCloudConfig(t) {
|
|
1035
|
-
return this._m.get(o).getCloudConfig(t);
|
|
1036
|
-
}
|
|
1037
|
-
emitOEvt(t, e) {
|
|
1038
|
-
this._m.getOEmitInst().emit(t, e);
|
|
1039
|
-
}
|
|
1040
|
-
emitIEvt(t, e) {
|
|
1041
|
-
this._m.getIEmitInst().emit(t, e);
|
|
1042
|
-
}
|
|
1043
|
-
getIEmitInst() {
|
|
1044
|
-
return this._m.getIEmitInst();
|
|
1045
|
-
}
|
|
1046
|
-
req(t) {
|
|
1047
|
-
return this._m.get(s).req(t);
|
|
1048
|
-
}
|
|
1049
|
-
canIUse(t) {
|
|
1050
|
-
return this._m.get(a).canIUse(t);
|
|
1051
|
-
}
|
|
1052
|
-
getErrMsg(t, e, i) {
|
|
1053
|
-
return this._m.getErrMsg(t, e, i);
|
|
1054
|
-
}
|
|
1055
|
-
warn(t, e, i) {
|
|
1056
|
-
t = this.getErrMsg(t, e, i);
|
|
1057
|
-
t && it.w(t);
|
|
1058
|
-
}
|
|
1059
|
-
noUse(t) {
|
|
1060
|
-
var e = ot;
|
|
1061
|
-
return ht({ code: e, message: this.getErrMsg(e, t) });
|
|
1062
|
-
}
|
|
1063
|
-
} {
|
|
1064
|
-
constructor(t) {
|
|
1065
|
-
(super(t),
|
|
1066
|
-
(this._n = "SignalingModule"),
|
|
1067
|
-
(this._inviteInfoMap = new Map()),
|
|
1068
|
-
(this._canIUseSignaling = !1),
|
|
1069
|
-
(this._isHandling = !1),
|
|
1070
|
-
(this._remoteSignalingHandler = new St(this)),
|
|
1071
|
-
(this._localSignalingHandler = new Tt(this)),
|
|
1072
|
-
(this._historySignalingHandler = new Et(this)),
|
|
1073
|
-
(this._isC2CUnreadHandleCompleted = !1),
|
|
1074
|
-
(this._isConvSyncCompleted = !1),
|
|
1075
|
-
(this._isSyncCompleted = !1),
|
|
1076
|
-
(this._isCloudConfigCompleted = !1));
|
|
1077
|
-
t = this.getIEmitInst();
|
|
1078
|
-
(t.on(
|
|
1079
|
-
Lt.C2C_UNREAD_HANDLE_COMPLETED,
|
|
1080
|
-
this.onC2CUnreadHandleCompleted,
|
|
1081
|
-
this,
|
|
1082
|
-
),
|
|
1083
|
-
t.on(Lt.CONV_SYNC_COMPLETED, this.onConvSyncCompleted, this),
|
|
1084
|
-
t.on(Lt.CLOUD_CONFIG, this.onCloudConfig, this));
|
|
1085
|
-
}
|
|
1086
|
-
onC2CUnreadHandleCompleted() {
|
|
1087
|
-
((this._isC2CUnreadHandleCompleted = !0),
|
|
1088
|
-
this._isCloudConfigCompleted &&
|
|
1089
|
-
this._isConvSyncCompleted &&
|
|
1090
|
-
!this._isSyncCompleted &&
|
|
1091
|
-
this.onReady());
|
|
1092
|
-
}
|
|
1093
|
-
onConvSyncCompleted() {
|
|
1094
|
-
((this._isConvSyncCompleted = !0),
|
|
1095
|
-
this._isC2CUnreadHandleCompleted &&
|
|
1096
|
-
this._isCloudConfigCompleted &&
|
|
1097
|
-
!this._isSyncCompleted &&
|
|
1098
|
-
this.onReady());
|
|
1099
|
-
}
|
|
1100
|
-
onCloudConfig() {
|
|
1101
|
-
this._isCloudConfigCompleted = !0;
|
|
1102
|
-
let t = this.getCloudConfig("history_s_count"),
|
|
1103
|
-
e = this.getCloudConfig("history_s_time");
|
|
1104
|
-
(Y(t) || (t = Number(t)),
|
|
1105
|
-
Y(e) || (e = Number(e)),
|
|
1106
|
-
this._historySignalingHandler.setCloudConfig(t, e),
|
|
1107
|
-
this._isC2CUnreadHandleCompleted &&
|
|
1108
|
-
this._isConvSyncCompleted &&
|
|
1109
|
-
!this._isSyncCompleted &&
|
|
1110
|
-
this.onReady());
|
|
1111
|
-
}
|
|
1112
|
-
_isListenerExisted() {
|
|
1113
|
-
return -1 < this._m.getOEmitInst().eventNames().indexOf(ut);
|
|
1114
|
-
}
|
|
1115
|
-
onReady() {
|
|
1116
|
-
this._isSyncCompleted = !0;
|
|
1117
|
-
var t = this._isListenerExisted();
|
|
1118
|
-
(it.l(this._n + ".onReady. isListenerExisted: " + t),
|
|
1119
|
-
t && this._historySignalingHandler.getHistorySignaling());
|
|
1120
|
-
}
|
|
1121
|
-
onNewMessageList(t) {
|
|
1122
|
-
t = this.filterMessageList(t);
|
|
1123
|
-
if (0 < t.length) return this._remoteSignalingHandler.onNewMessageList(t);
|
|
1124
|
-
}
|
|
1125
|
-
onMessageModified(t) {
|
|
1126
|
-
t = this.filterMessageList(t);
|
|
1127
|
-
if (0 < t.length) return this._remoteSignalingHandler.onMessageModified(t);
|
|
1128
|
-
}
|
|
1129
|
-
hasInviteInfo(t) {
|
|
1130
|
-
return this._inviteInfoMap.has(t);
|
|
1131
|
-
}
|
|
1132
|
-
getInviteInfo(t) {
|
|
1133
|
-
return this._inviteInfoMap.get(t);
|
|
1134
|
-
}
|
|
1135
|
-
setInviteInfo(t, e) {
|
|
1136
|
-
let { message: i, ...n } = e;
|
|
1137
|
-
(it.l(this._n + `.setInviteInfo inviteID:${t} data:`, n),
|
|
1138
|
-
this._inviteInfoMap.set(t, { ...n, message: i }));
|
|
1139
|
-
}
|
|
1140
|
-
deleteInviteInfo(t) {
|
|
1141
|
-
this.hasInviteInfo(t) &&
|
|
1142
|
-
(it.l(this._n + `.deleteInviteInfo inviteID:${t}.`),
|
|
1143
|
-
this._inviteInfoMap.delete(t));
|
|
1144
|
-
}
|
|
1145
|
-
updateInviteInfo(t) {
|
|
1146
|
-
let i = this._n + ".updateInviteInfo",
|
|
1147
|
-
{ inviteID: n, inviter: e, inviteeList: s, groupID: o } = t;
|
|
1148
|
-
if (
|
|
1149
|
-
(it.l(i + ` inviteID:${n} inviter:${e} groupID:` + o),
|
|
1150
|
-
o && this.hasInviteInfo(n))
|
|
1151
|
-
) {
|
|
1152
|
-
let t = s[0],
|
|
1153
|
-
e = this.getInviteInfo(n)["inviteeList"];
|
|
1154
|
-
(e.includes(t) &&
|
|
1155
|
-
(e.splice(e.indexOf(t), 1),
|
|
1156
|
-
it.l(i + ` remove ${t}. localInviteeList.length:` + e.length)),
|
|
1157
|
-
0 === e.length && this.deleteInviteInfo(n));
|
|
1158
|
-
} else this.deleteInviteInfo(n);
|
|
1159
|
-
}
|
|
1160
|
-
canIUseSignaling() {
|
|
1161
|
-
return this._canIUseSignaling;
|
|
1162
|
-
}
|
|
1163
|
-
emitEvent(t, e) {
|
|
1164
|
-
this.emitOEvt(t, e);
|
|
1165
|
-
}
|
|
1166
|
-
addSignalingListener(t, e, i) {
|
|
1167
|
-
(this._canIUseSignaling || (this._canIUseSignaling = !0),
|
|
1168
|
-
this._m.getOEmitInst().on(t, e, i));
|
|
1169
|
-
}
|
|
1170
|
-
removeSignalingListener(t, e, i) {
|
|
1171
|
-
(this._m.getOEmitInst().off(t, e, i),
|
|
1172
|
-
this._isListenerExisted() || (this._canIUseSignaling = !1));
|
|
1173
|
-
}
|
|
1174
|
-
invite(t) {
|
|
1175
|
-
let e = this._n + ".invite",
|
|
1176
|
-
{
|
|
1177
|
-
message: i,
|
|
1178
|
-
customData: n,
|
|
1179
|
-
inviteID: s,
|
|
1180
|
-
} = this._localSignalingHandler.createInviteInfo(t);
|
|
1181
|
-
return (
|
|
1182
|
-
it.l(e + ` options:${JSON.stringify(t)} inviteID:` + s),
|
|
1183
|
-
this.sendSignaling(i, t)
|
|
1184
|
-
.then((t) =>
|
|
1185
|
-
t && 0 === t.code
|
|
1186
|
-
? (this.setInviteInfo(s, { ...n, message: i }),
|
|
1187
|
-
this.startTimer({ ...n, inviteID: s }),
|
|
1188
|
-
{ ...t, inviteID: s })
|
|
1189
|
-
: t,
|
|
1190
|
-
)
|
|
1191
|
-
.catch((t) => ht(t))
|
|
1192
|
-
);
|
|
1193
|
-
}
|
|
1194
|
-
inviteSync(t, e, i) {
|
|
1195
|
-
let n = this._n + ".inviteSync",
|
|
1196
|
-
{
|
|
1197
|
-
message: s,
|
|
1198
|
-
customData: o,
|
|
1199
|
-
inviteID: a,
|
|
1200
|
-
} = this._localSignalingHandler.createInviteInfo(t);
|
|
1201
|
-
return (
|
|
1202
|
-
it.l(n + ` options:${JSON.stringify(t)} inviteID:` + a),
|
|
1203
|
-
this.sendSignaling(s, t)
|
|
1204
|
-
.then((t) => {
|
|
1205
|
-
if (t && 0 === t.code)
|
|
1206
|
-
return (
|
|
1207
|
-
this.setInviteInfo(a, { ...o, message: s }),
|
|
1208
|
-
this.startTimer({ ...o, inviteID: a }),
|
|
1209
|
-
e && e({ inviteID: a }),
|
|
1210
|
-
{ inviteID: a }
|
|
1211
|
-
);
|
|
1212
|
-
i && i(0 === t.code, t.message || "");
|
|
1213
|
-
})
|
|
1214
|
-
.catch((t) => (i && i(t.code, t.message), ht(t))),
|
|
1215
|
-
a
|
|
1216
|
-
);
|
|
1217
|
-
}
|
|
1218
|
-
_handleImResponse(t, e, i) {
|
|
1219
|
-
e &&
|
|
1220
|
-
0 === e.code &&
|
|
1221
|
-
((this._isHandling = !1),
|
|
1222
|
-
i ? this.deleteInviteInfo(t.inviteID) : this.updateInviteInfo(t));
|
|
1223
|
-
}
|
|
1224
|
-
cancel(e) {
|
|
1225
|
-
var t,
|
|
1226
|
-
i = this._n + ".cancel";
|
|
1227
|
-
if (
|
|
1228
|
-
(it.l(i + " options:" + JSON.stringify(e)),
|
|
1229
|
-
!this.hasInviteInfo(e.inviteID) || this._isHandling)
|
|
1230
|
-
)
|
|
1231
|
-
return ht({ code: ct });
|
|
1232
|
-
this._isHandling = !0;
|
|
1233
|
-
let n = this._localSignalingHandler.createCancelCustomData(e);
|
|
1234
|
-
return n
|
|
1235
|
-
? (({ groupID: i, inviteeList: t } = n),
|
|
1236
|
-
(i = i || t[0]),
|
|
1237
|
-
(t = this.createSignaling(n, i)),
|
|
1238
|
-
this.sendSignaling(t, e)
|
|
1239
|
-
.then(
|
|
1240
|
-
(t) => (
|
|
1241
|
-
this._handleImResponse(n, t, !0),
|
|
1242
|
-
0 === t.code ? { ...t, inviteID: e.inviteID } : t
|
|
1243
|
-
),
|
|
1244
|
-
)
|
|
1245
|
-
.catch((t) => ht(t)))
|
|
1246
|
-
: ((this._isHandling = !1), ht({ code: rt }));
|
|
1247
|
-
}
|
|
1248
|
-
accept(e) {
|
|
1249
|
-
var t = this._n + ".accept";
|
|
1250
|
-
if (
|
|
1251
|
-
(it.l(t + " options:" + JSON.stringify(e)),
|
|
1252
|
-
!this.hasInviteInfo(e.inviteID) || this._isHandling)
|
|
1253
|
-
)
|
|
1254
|
-
return ht({ code: at });
|
|
1255
|
-
this._isHandling = !0;
|
|
1256
|
-
let i = this._localSignalingHandler.createAcceptCustomData(e);
|
|
1257
|
-
return i
|
|
1258
|
-
? ((t = this.createSignaling(i)),
|
|
1259
|
-
this.sendSignaling(t, e)
|
|
1260
|
-
.then(
|
|
1261
|
-
(t) => (
|
|
1262
|
-
this._handleImResponse(i, t),
|
|
1263
|
-
0 === t.code ? { ...t, inviteID: e.inviteID } : t
|
|
1264
|
-
),
|
|
1265
|
-
)
|
|
1266
|
-
.catch((t) => ht(t)))
|
|
1267
|
-
: ((this._isHandling = !1), ht({ code: rt }));
|
|
1268
|
-
}
|
|
1269
|
-
reject(e) {
|
|
1270
|
-
var t = this._n + ".reject";
|
|
1271
|
-
if (
|
|
1272
|
-
(it.l(t + " options:" + JSON.stringify(e)),
|
|
1273
|
-
!this.hasInviteInfo(e.inviteID) || this._isHandling)
|
|
1274
|
-
)
|
|
1275
|
-
return ht({ code: at });
|
|
1276
|
-
this._isHandling = !0;
|
|
1277
|
-
let i = this._localSignalingHandler.createRejectCustomData(e);
|
|
1278
|
-
return i
|
|
1279
|
-
? ((t = this.createSignaling(i)),
|
|
1280
|
-
this.sendSignaling(t, e)
|
|
1281
|
-
.then(
|
|
1282
|
-
(t) => (
|
|
1283
|
-
this._handleImResponse(i, t, !0),
|
|
1284
|
-
0 === t.code ? { ...t, inviteID: e.inviteID } : t
|
|
1285
|
-
),
|
|
1286
|
-
)
|
|
1287
|
-
.catch((t) => ht(t)))
|
|
1288
|
-
: ((this._isHandling = !1), ht({ code: rt }));
|
|
1289
|
-
}
|
|
1290
|
-
getSignalingInfo(e) {
|
|
1291
|
-
let t = this._n + ".getSignalingInfo",
|
|
1292
|
-
{ ID: i, from: n, to: s } = e,
|
|
1293
|
-
o = this._filterSignaling(e),
|
|
1294
|
-
a = null;
|
|
1295
|
-
if (o) {
|
|
1296
|
-
let t = this.getPayloadData(e);
|
|
1297
|
-
a = new At(t);
|
|
1298
|
-
}
|
|
1299
|
-
e = o ? "actionType:" + a.actionType : "";
|
|
1300
|
-
return (
|
|
1301
|
-
it.l(t + ` messageID:${i} from:${n} to:${s} ${e} isSignaling:` + o),
|
|
1302
|
-
a
|
|
1303
|
-
);
|
|
1304
|
-
}
|
|
1305
|
-
modifyInvitation(e) {
|
|
1306
|
-
let { inviteID: i, data: n } = e;
|
|
1307
|
-
if (!this.hasInviteInfo(i)) return ht({ code: at });
|
|
1308
|
-
let { message: s, ...o } = this.getInviteInfo(i),
|
|
1309
|
-
a = s.payload.data;
|
|
1310
|
-
return (
|
|
1311
|
-
(o.data = n),
|
|
1312
|
-
(s.payload.data = JSON.stringify(o)),
|
|
1313
|
-
this.get(t)
|
|
1314
|
-
.modifyRemoteMessage(s)
|
|
1315
|
-
.then(
|
|
1316
|
-
(t) => (
|
|
1317
|
-
this.hasInviteInfo(i) &&
|
|
1318
|
-
this.setInviteInfo(i, { ...o, message: s }),
|
|
1319
|
-
t
|
|
1320
|
-
),
|
|
1321
|
-
)
|
|
1322
|
-
.catch((t) => ((s.payload.data = a), ht(t)))
|
|
1323
|
-
);
|
|
1324
|
-
}
|
|
1325
|
-
_genMsgCtrlInfo(t = {}) {
|
|
1326
|
-
var {
|
|
1327
|
-
data: e = "",
|
|
1328
|
-
onlineUserOnly: t,
|
|
1329
|
-
inviteID: i = "",
|
|
1330
|
-
offlinePushInfo: n,
|
|
1331
|
-
actionType: s,
|
|
1332
|
-
} = t;
|
|
1333
|
-
let o = { _onlineOnlyFlag: !1 };
|
|
1334
|
-
i = {
|
|
1335
|
-
onlineUserOnly:
|
|
1336
|
-
(o = i && this.getInviteInfo(i) ? this.getInviteInfo(i).message : o)
|
|
1337
|
-
._onlineOnlyFlag ||
|
|
1338
|
-
t ||
|
|
1339
|
-
!1,
|
|
1340
|
-
offlinePushInfo: n,
|
|
1341
|
-
messageControlInfo: {
|
|
1342
|
-
excludedFromContentModeration: !0,
|
|
1343
|
-
excludedFromUnreadCount: !1,
|
|
1344
|
-
excludedFromLastMessage: !1,
|
|
1345
|
-
},
|
|
1346
|
-
};
|
|
1347
|
-
if (s === yt) {
|
|
1348
|
-
let t = !!e.match(/excludeTimeoutSignalingFromHistoryMessage/);
|
|
1349
|
-
((i.messageControlInfo.excludedFromUnreadCount = t),
|
|
1350
|
-
(i.messageControlInfo.excludedFromLastMessage = t));
|
|
1351
|
-
} else {
|
|
1352
|
-
((t = !!e.match(/excludeFromHistoryMessage/)),
|
|
1353
|
-
(n = !!e.match(/excludeOriginalSignalingFromHistoryMessage/)));
|
|
1354
|
-
((i.messageControlInfo.excludedFromUnreadCount = t || n),
|
|
1355
|
-
(i.messageControlInfo.excludedFromLastMessage = t || n));
|
|
1356
|
-
}
|
|
1357
|
-
return i;
|
|
1358
|
-
}
|
|
1359
|
-
sendSignaling(e, i) {
|
|
1360
|
-
return this.get(t)
|
|
1361
|
-
.sendMessageInstance(e, this._genMsgCtrlInfo(i))
|
|
1362
|
-
.catch((t) => ((this._isHandling = !1), ht(t)));
|
|
1363
|
-
}
|
|
1364
|
-
filterMessageList(t) {
|
|
1365
|
-
return t.filter((t) => this._filterSignaling(t));
|
|
1366
|
-
}
|
|
1367
|
-
getPayloadData(t) {
|
|
1368
|
-
return this._remoteSignalingHandler.getPayloadData(t);
|
|
1369
|
-
}
|
|
1370
|
-
createSignaling(e, i) {
|
|
1371
|
-
var { groupID: n, inviter: s } = e,
|
|
1372
|
-
i = {
|
|
1373
|
-
to: i || n || s,
|
|
1374
|
-
conversationType: n ? B : F,
|
|
1375
|
-
priority: H,
|
|
1376
|
-
payload: { data: JSON.stringify(e) },
|
|
1377
|
-
},
|
|
1378
|
-
s = this.get(t).createCustomMessage(i);
|
|
1379
|
-
return (it.l(this._n + ".createSignaling. message:", s), s);
|
|
1380
|
-
}
|
|
1381
|
-
_filterSignaling(t) {
|
|
1382
|
-
let e = !1;
|
|
1383
|
-
var i, n;
|
|
1384
|
-
return (
|
|
1385
|
-
t.type &&
|
|
1386
|
-
t.type === R &&
|
|
1387
|
-
(({
|
|
1388
|
-
cloudCustomData: t = "",
|
|
1389
|
-
payload: { data: n = "" },
|
|
1390
|
-
} = t),
|
|
1391
|
-
(t = t.match(/"type":"tsignaling"/)),
|
|
1392
|
-
(i = n.match(/inviteID/)),
|
|
1393
|
-
(n = n.match(/actionType/)),
|
|
1394
|
-
(e = t || (i && n))),
|
|
1395
|
-
!!e
|
|
1396
|
-
);
|
|
1397
|
-
}
|
|
1398
|
-
startTimer(s) {
|
|
1399
|
-
let o = this._n + ".startTimer",
|
|
1400
|
-
{ timeout: t, inviteID: a, inviter: e, groupID: i } = s,
|
|
1401
|
-
r = e === this.getMyUserID();
|
|
1402
|
-
if ((it.l(o + ` timeout:${t} isInviter:${r} groupID:` + i), !(t <= 0))) {
|
|
1403
|
-
let e = r ? t + 5 : t,
|
|
1404
|
-
i = 1,
|
|
1405
|
-
n = setInterval(() => {
|
|
1406
|
-
var t = this._hasLocalInviteInfo(s, r);
|
|
1407
|
-
i < e && t
|
|
1408
|
-
? ++i
|
|
1409
|
-
: (t && this._sendTimeoutNotice(a, r),
|
|
1410
|
-
it.l(o + " end."),
|
|
1411
|
-
clearInterval(n));
|
|
1412
|
-
}, 1e3);
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
_hasLocalInviteInfo(t, e) {
|
|
1416
|
-
var i,
|
|
1417
|
-
n,
|
|
1418
|
-
{ inviteID: t, groupID: s } = t;
|
|
1419
|
-
return (
|
|
1420
|
-
!!this.hasInviteInfo(t) &&
|
|
1421
|
-
((i = this._n + "._hasLocalInviteInfo"),
|
|
1422
|
-
(n = this.getInviteInfo(t)["inviteeList"]),
|
|
1423
|
-
it.l(i + ` inviteID:${t} inviteeList:${n} groupID:` + s),
|
|
1424
|
-
!s || (e ? 0 < n.length : 0 < n.length && n.includes(this.getMyUserID())))
|
|
1425
|
-
);
|
|
1426
|
-
}
|
|
1427
|
-
_getReceiver(t, e) {
|
|
1428
|
-
var { groupID: e, inviteeList: i, inviter: n } = e;
|
|
1429
|
-
return t ? e || i[0] : e || n;
|
|
1430
|
-
}
|
|
1431
|
-
_sendTimeoutNotice(s, o) {
|
|
1432
|
-
var t = this.getInviteInfo(s),
|
|
1433
|
-
e = this._getReceiver(o, t);
|
|
1434
|
-
it.l(this._n + `._sendTimeoutNotice inviteID:${s} to:${e} isInviter:` + o);
|
|
1435
|
-
let a = this._localSignalingHandler.createTimeoutCustomData({
|
|
1436
|
-
...t,
|
|
1437
|
-
isInviter: o,
|
|
1438
|
-
}),
|
|
1439
|
-
r = this.createSignaling(a, e);
|
|
1440
|
-
return this.sendSignaling(r, a).then((t) => {
|
|
1441
|
-
if (t && 0 === t.code) {
|
|
1442
|
-
let { data: t, groupID: e, inviteeList: i, inviter: n } = a;
|
|
1443
|
-
(this.emitEvent(It, {
|
|
1444
|
-
data: t,
|
|
1445
|
-
groupID: e,
|
|
1446
|
-
inviteID: s,
|
|
1447
|
-
inviteeList: i,
|
|
1448
|
-
inviter: n,
|
|
1449
|
-
isSelfTimeout: !0,
|
|
1450
|
-
message: r,
|
|
1451
|
-
}),
|
|
1452
|
-
o ? this.deleteInviteInfo(s) : this.updateInviteInfo(a));
|
|
1453
|
-
}
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
reset() {
|
|
1457
|
-
(it.l(this._n + ".reset"),
|
|
1458
|
-
this._inviteInfoMap.clear(),
|
|
1459
|
-
(this._canIUseSignaling = !1),
|
|
1460
|
-
(this._isHandling = !1),
|
|
1461
|
-
this._historySignalingHandler.reset(),
|
|
1462
|
-
(this._isC2CUnreadHandleCompleted = !1),
|
|
1463
|
-
(this._isConvSyncCompleted = !1),
|
|
1464
|
-
(this._isSyncCompleted = !1),
|
|
1465
|
-
(this._isCloudConfigCompleted = !1));
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
export { Pt as default };
|