@honeybbq/teamspeak-client 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/address-BR-5unVo.cjs.map +1 -1
  2. package/dist/address-BfmovVpp.js.map +1 -1
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/client.d.ts +16 -1
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/command/index.cjs +1 -1
  7. package/dist/command/index.mjs +1 -1
  8. package/dist/command/parser.d.ts.map +1 -1
  9. package/dist/{crypt-init2-D70ha4LB.js → crypt-init2-BcGT--df.js} +2 -2
  10. package/dist/{crypt-init2-D70ha4LB.js.map → crypt-init2-BcGT--df.js.map} +1 -1
  11. package/dist/{crypt-init2-DparLekm.cjs → crypt-init2-Bkee1YxV.cjs} +2 -2
  12. package/dist/{crypt-init2-DparLekm.cjs.map → crypt-init2-Bkee1YxV.cjs.map} +1 -1
  13. package/dist/crypto/identity.d.ts +13 -1
  14. package/dist/crypto/identity.d.ts.map +1 -1
  15. package/dist/crypto/index.cjs +1 -1
  16. package/dist/crypto/index.d.ts +2 -1
  17. package/dist/crypto/index.d.ts.map +1 -1
  18. package/dist/crypto/index.mjs +3 -3
  19. package/dist/{crypto-CDlweUL3.cjs → crypto-BfDd9DP6.cjs} +2 -2
  20. package/dist/{crypto-CDlweUL3.cjs.map → crypto-BfDd9DP6.cjs.map} +1 -1
  21. package/dist/{crypto-Bg02m4ZE.js → crypto-DLV3oH5F.js} +12 -12
  22. package/dist/{crypto-Bg02m4ZE.js.map → crypto-DLV3oH5F.js.map} +1 -1
  23. package/dist/{handler-DI_abe9c.js → handler-BpdZFsKo.js} +104 -102
  24. package/dist/handler-BpdZFsKo.js.map +1 -0
  25. package/dist/handler-aywHvv7I.cjs +2 -0
  26. package/dist/handler-aywHvv7I.cjs.map +1 -0
  27. package/dist/handshake/index.cjs +1 -1
  28. package/dist/handshake/index.mjs +1 -1
  29. package/dist/handshake.d.ts +9 -0
  30. package/dist/handshake.d.ts.map +1 -1
  31. package/dist/index.cjs +2 -2
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.mjs +294 -290
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/{parser-DZMv3Jm-.js → parser-BX8NEiBe.js} +4 -4
  36. package/dist/parser-BX8NEiBe.js.map +1 -0
  37. package/dist/parser-BfwYH2fT.cjs +2 -0
  38. package/dist/parser-BfwYH2fT.cjs.map +1 -0
  39. package/dist/{primitives-xIr6Tjk4.js → primitives-CdX74Rgu.js} +194 -190
  40. package/dist/primitives-CdX74Rgu.js.map +1 -0
  41. package/dist/primitives-DkwW7wcP.cjs +2 -0
  42. package/dist/primitives-DkwW7wcP.cjs.map +1 -0
  43. package/dist/transfer.d.ts.map +1 -1
  44. package/dist/transport/handler.d.ts +9 -1
  45. package/dist/transport/handler.d.ts.map +1 -1
  46. package/dist/transport/index.cjs +1 -1
  47. package/dist/transport/index.mjs +1 -1
  48. package/dist/types.d.ts +11 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/package.json +5 -2
  51. package/dist/handler-DI_abe9c.js.map +0 -1
  52. package/dist/handler-DuwoO5RC.cjs +0 -2
  53. package/dist/handler-DuwoO5RC.cjs.map +0 -1
  54. package/dist/parser-CL33R9tr.cjs +0 -2
  55. package/dist/parser-CL33R9tr.cjs.map +0 -1
  56. package/dist/parser-DZMv3Jm-.js.map +0 -1
  57. package/dist/primitives-cNNAeFCo.cjs +0 -2
  58. package/dist/primitives-cNNAeFCo.cjs.map +0 -1
  59. package/dist/primitives-xIr6Tjk4.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { a as e, i as t, o as n } from "./address-BfmovVpp.js";
2
- import { C as r, S as i, _ as a, b as o, d as s, g as c, h as l, l as u, o as d, p as f, r as p, u as m, v as h, w as ee, x as g, y as _ } from "./primitives-xIr6Tjk4.js";
3
- import { t as v } from "./crypto-Bg02m4ZE.js";
4
- import { t as y } from "./resolver-6B8dI9gr.js";
5
- import { a as b, t as x } from "./handler-DI_abe9c.js";
6
- import { i as S, n as C, t as w } from "./command-BLe-C2L2.js";
7
- import { n as te } from "./crypt-handshake-DziOY4Lq.js";
8
- import { t as ne } from "./crypt-init2-D70ha4LB.js";
9
- import { t as T } from "./parser-DZMv3Jm-.js";
10
- import { createHash as E } from "node:crypto";
11
- import { createConnection as D } from "node:net";
2
+ import { C as r, S as i, T as a, _ as o, b as s, d as c, g as l, h as u, l as d, o as f, p, r as m, u as h, v as g, w as _, x as v, y } from "./primitives-CdX74Rgu.js";
3
+ import { t as b } from "./crypto-DLV3oH5F.js";
4
+ import { t as x } from "./resolver-6B8dI9gr.js";
5
+ import { a as S, t as C } from "./handler-BpdZFsKo.js";
6
+ import { i as w, n as T, t as E } from "./command-BLe-C2L2.js";
7
+ import { n as ee } from "./crypt-handshake-DziOY4Lq.js";
8
+ import { t as te } from "./crypt-init2-BcGT--df.js";
9
+ import { t as D } from "./parser-BX8NEiBe.js";
10
+ import { createHash as O } from "node:crypto";
11
+ import { createConnection as k } from "node:net";
12
12
  //#region src/commands.ts
13
- var O = class {
13
+ var A = class {
14
14
  #e = /* @__PURE__ */ new Map();
15
15
  #t = 0;
16
16
  #n = [];
@@ -50,25 +50,84 @@ var O = class {
50
50
  this.#e.clear(), this.#n = [], this.#r = !1, this.#t = 0;
51
51
  }
52
52
  };
53
- function k(e) {
54
- let t = e.id ?? "0", n = e.msg ?? "", i = e.return_code, a = null;
55
- t !== "0" && (a = new r(t, n));
56
- let o = null;
57
- if (i !== void 0 && i !== "") {
58
- let e = parseInt(i, 10);
59
- isNaN(e) || (o = e);
53
+ function j(e) {
54
+ let t = e.id ?? "0", n = e.msg ?? "", r = e.return_code, i = null;
55
+ t !== "0" && (i = new _(t, n));
56
+ let a = null;
57
+ if (r !== void 0 && r !== "") {
58
+ let e = parseInt(r, 10);
59
+ isNaN(e) || (a = e);
60
60
  }
61
61
  return {
62
- err: a,
63
- rc: o
62
+ err: i,
63
+ rc: a
64
64
  };
65
65
  }
66
- function A(e, t) {
66
+ function M(e, t) {
67
67
  return e.includes("return_code=") ? e : `${e} return_code=${t}`;
68
68
  }
69
69
  //#endregion
70
+ //#region src/handshake.ts
71
+ function N(e, t) {
72
+ let n = t.alpha ?? "", r = t.beta ?? "", i = t.omega ?? "";
73
+ e.crypt.initCrypto(n, r, i), e.logger.info("crypto initialized (P-256 path), sending clientinit"), z(e);
74
+ }
75
+ function P(e, t) {
76
+ e.logger.info("received initivexpand2"), e.handler.receivedFinalInitAck();
77
+ let n = t.l ?? "", r = t.omega ?? "", i = t.proof ?? "", a = t.beta ?? "", o = I(e, a);
78
+ te(e.crypt, n, r, i, a, o), z(e);
79
+ }
80
+ function F(e, t) {
81
+ let n = t.aclid ?? t.clid ?? "", r = n ? parseInt(n, 10) : 0;
82
+ r > 0 && (e.clid = r, e.handler.setClientID(r));
83
+ let i = t.virtualserver_version;
84
+ i && (e.uidAlgorithm = u(i)), e.logger.info("connected to server", { selfId: e.clid }), e._markConnected(), setImmediate(() => {
85
+ let t = E("clientupdate", {
86
+ client_input_muted: "0",
87
+ client_output_muted: "0"
88
+ });
89
+ e.sendCommandNoWait(t).catch(() => {});
90
+ });
91
+ }
92
+ function I(e, t) {
93
+ let [n, r] = m(), i = Buffer.from(n).toString("base64"), a = L(e, n, t), o = T("clientek", [["ek", i], ["proof", a]]);
94
+ return e.handler.sendPacket(S.Command, Buffer.from(o), 0), r;
95
+ }
96
+ function L(e, t, n) {
97
+ let r = Buffer.from(n, "base64"), i = /* @__PURE__ */ new Uint8Array(86);
98
+ i.set(t.slice(0, 32)), i.set(r.slice(0, Math.min(54, r.length)), 32);
99
+ let a = f(e.crypt.identity.privateKey, i);
100
+ return Buffer.from(a).toString("base64");
101
+ }
102
+ function R(e) {
103
+ return e === "" ? "" : O("sha1").update(e).digest().toString("base64");
104
+ }
105
+ function z(e) {
106
+ let t = B(e);
107
+ e.handler.sendPacket(S.Command, Buffer.from(t), 0);
108
+ }
109
+ function B(e) {
110
+ let t = e.crypt.identity.publicKeyBase64(), n = e.getClientInitOptions(), r = R(n.defaultChannelPassword), i = R(n.serverPassword), a = O("sha1").update(t).digest().toString("base64");
111
+ return T("clientinit", [
112
+ ["client_nickname", e.nickname],
113
+ ["client_version", "3.?.? [Build: 5680278000]"],
114
+ ["client_platform", "Windows"],
115
+ ["client_input_hardware", "1"],
116
+ ["client_output_hardware", "1"],
117
+ ["client_default_channel", n.defaultChannel],
118
+ ["client_default_channel_password", r],
119
+ ["client_server_password", i],
120
+ ["client_meta_data", ""],
121
+ ["client_version_sign", "DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="],
122
+ ["client_key_offset", String(e.crypt.identity.offset)],
123
+ ["client_nickname_phonetic", ""],
124
+ ["client_default_token", ""],
125
+ ["hwid", a]
126
+ ]);
127
+ }
128
+ //#endregion
70
129
  //#region src/transfer.ts
71
- var j = class {
130
+ var V = class {
72
131
  #e = /* @__PURE__ */ new Map();
73
132
  #t = 0;
74
133
  register() {
@@ -89,127 +148,70 @@ var j = class {
89
148
  this.#e.clear(), this.#t = 0;
90
149
  }
91
150
  };
92
- function M(e, t, n) {
151
+ function H(e, t, n) {
93
152
  return new Promise((r, i) => {
94
- let a = D({
153
+ let a = k({
95
154
  host: e,
96
155
  port: t
97
156
  }, () => {
98
157
  a.write(n, (e) => {
99
- e ? (a.destroy(), i(new o(`failed to send transfer key: ${e.message}`))) : r(a);
158
+ e ? (a.destroy(), i(new v(`failed to send transfer key: ${e.message}`))) : r(a);
100
159
  });
101
160
  });
102
161
  a.setTimeout(1e4), a.once("error", i), a.once("timeout", () => {
103
- a.destroy(), i(new o("connection timeout"));
162
+ a.destroy(), i(new v("connection timeout"));
104
163
  });
105
164
  });
106
165
  }
107
- async function N(e, t, n) {
108
- let r = await M(e, t.port, t.fileTransferKey);
166
+ async function U(e, t, n) {
167
+ let r = await H(e, t.port, t.fileTransferKey);
109
168
  await new Promise((e, t) => {
110
169
  n.pipe(r), r.on("finish", e), r.on("error", t);
111
170
  });
112
171
  }
113
- async function P(e, t, n) {
114
- let r = await M(e, t.port, t.fileTransferKey);
172
+ async function W(e, t, n) {
173
+ let r = await H(e, t.port, t.fileTransferKey);
115
174
  await new Promise((e, t) => {
116
175
  r.pipe(n), n.on("finish", e), r.on("error", t), n.on("error", t);
117
176
  });
118
177
  }
119
- function F(e, t, n, r, i, a) {
178
+ function G(e, t, n, r, i, a) {
120
179
  let o = t.startsWith("/") ? t : `/${t}`;
121
- return w("ftinitupload", {
180
+ return E("ftinitupload", {
122
181
  cid: String(e),
123
182
  name: o,
124
- cpw: n,
183
+ cpw: R(n),
125
184
  size: String(r),
126
185
  clientftfid: String(i),
127
186
  overwrite: a ? "1" : "0",
128
187
  resume: "0"
129
188
  });
130
189
  }
131
- function I(e, t, n, r) {
190
+ function K(e, t, n, r) {
132
191
  let i = t.startsWith("/") ? t : `/${t}`;
133
- return w("ftinitdownload", {
192
+ return E("ftinitdownload", {
134
193
  cid: String(e),
135
194
  name: i,
136
- cpw: n,
195
+ cpw: R(n),
137
196
  clientftfid: String(r),
138
197
  seekpos: "0"
139
198
  });
140
199
  }
141
200
  //#endregion
142
201
  //#region src/events.ts
143
- function L(e, t) {
202
+ function ne(e, t) {
144
203
  let n = t;
145
204
  for (let t = e.length - 1; t >= 0; t--) n = e[t](n);
146
205
  return n;
147
206
  }
148
- function R(e, t) {
207
+ function q(e, t) {
149
208
  let n = t;
150
209
  for (let t = e.length - 1; t >= 0; t--) n = e[t](n);
151
210
  return n;
152
211
  }
153
212
  //#endregion
154
- //#region src/handshake.ts
155
- function z(e, t) {
156
- let n = t.alpha ?? "", r = t.beta ?? "", i = t.omega ?? "";
157
- e.crypt.initCrypto(n, r, i), e.logger.info("crypto initialized (P-256 path), sending clientinit"), G(e);
158
- }
159
- function B(e, t) {
160
- e.logger.info("received initivexpand2"), e.handler.receivedFinalInitAck();
161
- let n = t.l ?? "", r = t.omega ?? "", i = t.proof ?? "", a = t.beta ?? "", o = H(e, a);
162
- ne(e.crypt, n, r, i, a, o), G(e);
163
- }
164
- function V(e, t) {
165
- let n = t.aclid ?? t.clid ?? "", r = n ? parseInt(n, 10) : 0;
166
- r > 0 && (e.clid = r, e.handler.setClientID(r)), e.logger.info("connected to server", { selfId: e.clid }), e._markConnected(), setImmediate(() => {
167
- let t = w("clientupdate", {
168
- client_input_muted: "0",
169
- client_output_muted: "0"
170
- });
171
- e.sendCommandNoWait(t).catch(() => {});
172
- });
173
- }
174
- function H(e, t) {
175
- let [n, r] = p(), i = Buffer.from(n).toString("base64"), a = U(e, n, t), o = C("clientek", [["ek", i], ["proof", a]]);
176
- return e.handler.sendPacket(b.Command, Buffer.from(o), 0), r;
177
- }
178
- function U(e, t, n) {
179
- let r = Buffer.from(n, "base64"), i = /* @__PURE__ */ new Uint8Array(86);
180
- i.set(t.slice(0, 32)), i.set(r.slice(0, Math.min(54, r.length)), 32);
181
- let a = d(e.crypt.identity.privateKey, i);
182
- return Buffer.from(a).toString("base64");
183
- }
184
- function W(e) {
185
- return e === "" ? "" : E("sha1").update(e).digest().toString("base64");
186
- }
187
- function G(e) {
188
- let t = K(e);
189
- e.handler.sendPacket(b.Command, Buffer.from(t), 0);
190
- }
191
- function K(e) {
192
- let t = e.crypt.identity.publicKeyBase64(), n = e.getClientInitOptions(), r = W(n.defaultChannelPassword), i = W(n.serverPassword), a = E("sha1").update(t).digest().toString("base64");
193
- return C("clientinit", [
194
- ["client_nickname", e.nickname],
195
- ["client_version", "3.?.? [Build: 5680278000]"],
196
- ["client_platform", "Windows"],
197
- ["client_input_hardware", "1"],
198
- ["client_output_hardware", "1"],
199
- ["client_default_channel", n.defaultChannel],
200
- ["client_default_channel_password", r],
201
- ["client_server_password", i],
202
- ["client_meta_data", ""],
203
- ["client_version_sign", "DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="],
204
- ["client_key_offset", String(e.crypt.identity.offset)],
205
- ["client_nickname_phonetic", ""],
206
- ["client_default_token", ""],
207
- ["hwid", a]
208
- ]);
209
- }
210
- //#endregion
211
213
  //#region src/helpers.ts
212
- function q(e) {
214
+ function J(e) {
213
215
  if (e === "" || e === void 0) return 0n;
214
216
  try {
215
217
  return BigInt(e);
@@ -217,21 +219,21 @@ function q(e) {
217
219
  return 0n;
218
220
  }
219
221
  }
220
- function J(e) {
222
+ function Y(e) {
221
223
  let t = parseInt(e, 10);
222
224
  return isNaN(t) || t < 0 || t > 65535 ? 0 : t;
223
225
  }
224
- function Y(e) {
226
+ function X(e) {
225
227
  let t = parseInt(e, 10);
226
228
  return isNaN(t) ? 0 : t;
227
229
  }
228
- function X(e, t) {
230
+ function Z(e, t) {
229
231
  if (t === e) return !0;
230
232
  if (!t.startsWith(e)) return !1;
231
233
  let n = t.slice(e.length);
232
234
  return /^\d+$/.test(n);
233
235
  }
234
- function Z(e) {
236
+ function re(e) {
235
237
  let t = e.indexOf(" ");
236
238
  if (t < 0) return [e];
237
239
  let n = e.slice(0, t), r = e.slice(t + 1);
@@ -255,30 +257,30 @@ function Q(e) {
255
257
  }
256
258
  //#endregion
257
259
  //#region src/notifications.ts
258
- function re(e, t, n, r) {
260
+ function ie(e, t, n, r) {
259
261
  switch (e.name) {
260
- case "notifycliententerview": return ie(e, n, r);
261
- case "notifyclientleftview": return ae(e, t, n);
262
- case "notifyclientmoved": return oe(e, n);
263
- case "notifytextmessage": return se(e, n);
264
- case "notifyclientpoke": return de(e);
262
+ case "notifycliententerview": return ae(e, n, r);
263
+ case "notifyclientleftview": return oe(e, t, n);
264
+ case "notifyclientmoved": return se(e, n);
265
+ case "notifytextmessage": return ce(e, n);
266
+ case "notifyclientpoke": return fe(e);
265
267
  case "notifystartupload": return {
266
268
  kind: "startUpload",
267
- info: ce(e)
269
+ info: le(e)
268
270
  };
269
271
  case "notifystartdownload": return {
270
272
  kind: "startDownload",
271
- info: le(e)
273
+ info: ue(e)
272
274
  };
273
275
  case "notifystatusfiletransfer": return {
274
276
  kind: "fileTransferStatus",
275
- info: ue(e)
277
+ info: de(e)
276
278
  };
277
279
  default: return { kind: "unknown" };
278
280
  }
279
281
  }
280
- function ie(e, t, n) {
281
- let r = J(e.params.clid ?? ""), i = q(e.params.ctid ?? ""), a = Y(e.params.client_type ?? ""), o = e.params.client_servergroups ?? "", s = {
282
+ function ae(e, t, n) {
283
+ let r = Y(e.params.clid ?? ""), i = J(e.params.ctid ?? ""), a = X(e.params.client_type ?? ""), o = e.params.client_servergroups ?? "", s = {
282
284
  id: r,
283
285
  nickname: e.params.client_nickname ?? "",
284
286
  uid: e.params.client_unique_identifier ?? "",
@@ -291,21 +293,21 @@ function ie(e, t, n) {
291
293
  info: s
292
294
  };
293
295
  }
294
- function ae(e, t, n) {
295
- let r = J(e.params.clid ?? ""), i = Y(e.params.reasonid ?? ""), a = r === t;
296
+ function oe(e, t, n) {
297
+ let r = Y(e.params.clid ?? ""), i = X(e.params.reasonid ?? ""), a = r === t;
296
298
  return r !== 0 && n.delete(r), {
297
299
  kind: "clientLeave",
298
300
  event: {
299
301
  id: r,
300
302
  reasonID: i,
301
303
  reasonMsg: e.params.reasonmsg ?? "",
302
- targetID: J(e.params.targetid ?? "")
304
+ targetID: Y(e.params.targetid ?? "")
303
305
  },
304
306
  isSelf: a
305
307
  };
306
308
  }
307
- function oe(e, t) {
308
- let n = J(e.params.clid ?? ""), r = q(e.params.ctid ?? "");
309
+ function se(e, t) {
310
+ let n = Y(e.params.clid ?? ""), r = J(e.params.ctid ?? "");
309
311
  if (n !== 0) {
310
312
  let e = t.get(n);
311
313
  e && t.set(n, {
@@ -318,67 +320,67 @@ function oe(e, t) {
318
320
  event: {
319
321
  id: n,
320
322
  targetChannelID: r,
321
- reasonID: Y(e.params.reasonid ?? ""),
322
- invokerID: J(e.params.invokerid ?? ""),
323
+ reasonID: X(e.params.reasonid ?? ""),
324
+ invokerID: Y(e.params.invokerid ?? ""),
323
325
  invokerName: e.params.invokername ?? "",
324
326
  invokerUID: e.params.invokeruid ?? ""
325
327
  }
326
328
  };
327
329
  }
328
- function se(e, t) {
329
- let n = J(e.params.invokerid ?? ""), r = t.get(n);
330
+ function ce(e, t) {
331
+ let n = Y(e.params.invokerid ?? ""), r = t.get(n);
330
332
  return {
331
333
  kind: "textMessage",
332
334
  message: {
333
- targetMode: Y(e.params.targetmode ?? ""),
334
- targetID: q(e.params.target ?? ""),
335
+ targetMode: X(e.params.targetmode ?? ""),
336
+ targetID: J(e.params.target ?? ""),
335
337
  invokerID: n,
336
338
  invokerName: e.params.invokername ?? "",
337
339
  invokerUID: e.params.invokeruid ?? r?.uid ?? "",
338
- message: S(e.params.msg ?? ""),
340
+ message: w(e.params.msg ?? ""),
339
341
  invokerGroups: r?.serverGroups ?? []
340
342
  }
341
343
  };
342
344
  }
343
- function ce(e) {
345
+ function le(e) {
344
346
  return {
345
- clientFileTransferID: J(e.params.clientftfid ?? ""),
346
- serverFileTransferID: J(e.params.serverftfid ?? ""),
347
+ clientFileTransferID: Y(e.params.clientftfid ?? ""),
348
+ serverFileTransferID: Y(e.params.serverftfid ?? ""),
347
349
  fileTransferKey: e.params.ftkey ?? "",
348
- port: J(e.params.port ?? ""),
349
- seekPosition: q(e.params.seekpos ?? "")
350
+ port: Y(e.params.port ?? ""),
351
+ seekPosition: J(e.params.seekpos ?? "")
350
352
  };
351
353
  }
352
- function le(e) {
354
+ function ue(e) {
353
355
  return {
354
- clientFileTransferID: J(e.params.clientftfid ?? ""),
355
- serverFileTransferID: J(e.params.serverftfid ?? ""),
356
+ clientFileTransferID: Y(e.params.clientftfid ?? ""),
357
+ serverFileTransferID: Y(e.params.serverftfid ?? ""),
356
358
  fileTransferKey: e.params.ftkey ?? "",
357
- port: J(e.params.port ?? ""),
358
- size: q(e.params.size ?? "")
359
+ port: Y(e.params.port ?? ""),
360
+ size: J(e.params.size ?? "")
359
361
  };
360
362
  }
361
- function ue(e) {
363
+ function de(e) {
362
364
  return {
363
- clientFileTransferID: J(e.params.clientftfid ?? ""),
364
- status: Y(e.params.status ?? ""),
365
+ clientFileTransferID: Y(e.params.clientftfid ?? ""),
366
+ status: X(e.params.status ?? ""),
365
367
  message: e.params.msg ?? ""
366
368
  };
367
369
  }
368
- function de(e) {
370
+ function fe(e) {
369
371
  return {
370
372
  kind: "poked",
371
373
  event: {
372
- invokerID: J(e.params.invokerid ?? ""),
373
- invokerName: S(e.params.invokername ?? ""),
374
+ invokerID: Y(e.params.invokerid ?? ""),
375
+ invokerName: w(e.params.invokername ?? ""),
374
376
  invokerUID: e.params.invokeruid ?? "",
375
- message: S(e.params.msg ?? "")
377
+ message: w(e.params.msg ?? "")
376
378
  }
377
379
  };
378
380
  }
379
381
  //#endregion
380
382
  //#region src/throttle.ts
381
- var fe = class e {
383
+ var pe = class e {
382
384
  static TOKEN_RATE = 4;
383
385
  static TOKEN_MAX = 8;
384
386
  #e = 5;
@@ -403,31 +405,32 @@ var fe = class e {
403
405
  };
404
406
  //#endregion
405
407
  //#region src/client.ts
406
- function pe(e) {
408
+ function $(e) {
407
409
  return {
408
410
  serverPassword: e.serverPassword ?? "",
409
411
  defaultChannel: e.defaultChannel ?? "",
410
412
  defaultChannelPassword: e.defaultChannelPassword ?? ""
411
413
  };
412
414
  }
413
- var $ = class {
415
+ var me = class {
414
416
  crypt;
415
417
  handler;
416
418
  logger;
417
419
  nickname;
418
420
  clid = 0;
421
+ uidAlgorithm = "sha1";
419
422
  #e;
420
423
  #t;
421
424
  #n;
422
425
  #r;
423
- #i = t.Disconnected;
424
- #a = new fe();
425
- #o = new O();
426
- #s = new j();
427
- #c = /* @__PURE__ */ new Map();
428
- #l = [];
429
- #u = null;
430
- #d = [];
426
+ #i;
427
+ #a = t.Disconnected;
428
+ #o = new pe();
429
+ #s = new A();
430
+ #c = new V();
431
+ #l = /* @__PURE__ */ new Map();
432
+ #u = [];
433
+ #d = null;
431
434
  #f = [];
432
435
  #p = [];
433
436
  #m = [];
@@ -438,35 +441,36 @@ var $ = class {
438
441
  #y = [];
439
442
  #b = [];
440
443
  #x = [];
441
- #S;
444
+ #S = [];
442
445
  #C;
446
+ #w;
443
447
  constructor(t, n, r, i = {}) {
444
- this.#e = t, this.#t = n, this.nickname = r, this.logger = i.logger ?? e, this.#n = i.resolver ?? new y(this.logger), this.#r = pe(i), this.crypt = new v(t), this.handler = new x(this.crypt, this.logger), this.handler.onPacket = (e) => this.#E(e), this.handler.onClosed = (e) => this.#F(e), i.commandMiddleware && this.#b.push(...i.commandMiddleware), i.eventMiddleware && this.#x.push(...i.eventMiddleware), this.#S = this.#L(), this.#C = this.#R();
448
+ this.#e = t, this.#t = n, this.nickname = r, this.logger = i.logger ?? e, this.#n = i.resolver ?? new x(this.logger), this.#r = $(i), this.#i = i.socketFactory, this.crypt = new b(t), this.handler = new C(this.crypt, this.logger, this.#i), this.handler.onPacket = (e) => this.#D(e), this.handler.onClosed = (e) => this.#I(e), i.commandMiddleware && this.#x.push(...i.commandMiddleware), i.eventMiddleware && this.#S.push(...i.eventMiddleware), this.#C = this.#R(), this.#w = this.#z();
445
449
  }
446
450
  get status() {
447
- return this.#i;
451
+ return this.#a;
448
452
  }
449
453
  getClientInitOptions() {
450
454
  return this.#r;
451
455
  }
452
456
  async connect() {
453
- if (this.#i !== t.Disconnected) throw new l();
454
- this.#w(), this.#i = t.Connecting;
455
- let e = await this.#T();
457
+ if (this.#a !== t.Disconnected) throw new l();
458
+ this.#T(), this.#a = t.Connecting;
459
+ let e = await this.#E();
456
460
  this.logger.info("connecting to server", { address: e }), await this.handler.connect(e);
457
461
  }
458
462
  async disconnect() {
459
- if (this.#i === t.Disconnected) return;
460
- let e = this.#i === t.Connected;
461
- if (this.#i = t.Disconnected, this.logger.info("disconnecting from server"), e) try {
463
+ if (this.#a === t.Disconnected) return;
464
+ let e = this.#a === t.Connected;
465
+ if (this.#a = t.Disconnected, this.logger.info("disconnecting from server"), e) try {
462
466
  await this.execCommand("clientdisconnect reasonmsg=Shutdown", 1e3);
463
467
  } catch {}
464
468
  this.handler.close();
465
- let n = this.#v.slice();
469
+ let n = this.#y.slice();
466
470
  for (let e of n) setImmediate(() => e(void 0));
467
471
  }
468
472
  waitConnected(e) {
469
- return this.#i === t.Connected ? Promise.resolve() : this.#u ? Promise.reject(this.#u) : new Promise((t, n) => {
473
+ return this.#a === t.Connected ? Promise.resolve() : this.#d ? Promise.reject(this.#d) : new Promise((t, n) => {
470
474
  let r = {
471
475
  resolve: () => {
472
476
  e?.removeEventListener("abort", i), t();
@@ -475,72 +479,75 @@ var $ = class {
475
479
  e?.removeEventListener("abort", i), n(t);
476
480
  }
477
481
  }, i = () => {
478
- let t = this.#l.indexOf(r);
479
- t >= 0 && this.#l.splice(t, 1);
482
+ let t = this.#u.indexOf(r);
483
+ t >= 0 && this.#u.splice(t, 1);
480
484
  let n = e?.reason;
481
485
  r.reject(n instanceof Error ? n : Error(String(n ?? "Connection wait aborted")));
482
486
  };
483
- this.#l.push(r), e?.aborted ? i() : e?.addEventListener("abort", i, { once: !0 });
487
+ this.#u.push(r), e?.aborted ? i() : e?.addEventListener("abort", i, { once: !0 });
484
488
  });
485
489
  }
486
490
  async sendCommandNoWait(e) {
487
- await this.#a.wait(), await this.#S(e);
491
+ await this.#o.wait(), await this.#C(e);
488
492
  }
489
493
  async execCommand(e, t = 1e4) {
490
494
  await this.execCommandWithResponse(e, t);
491
495
  }
492
496
  async execCommandWithResponse(e, t = 1e4) {
493
- let [n, r] = this.#o.register(), i = A(e, n);
497
+ let [n, r] = this.#s.register(), i = M(e, n);
494
498
  try {
495
- await this.#a.wait(), await this.#S(i);
499
+ await this.#o.wait(), await this.#C(i);
496
500
  } catch (e) {
497
- throw this.#o.unregister(n), e;
501
+ throw this.#s.unregister(n), e;
498
502
  }
499
- let a = await Promise.race([r, new Promise((n, r) => setTimeout(() => r(new c(e)), t))]);
500
- if (this.#o.unregister(n), a.err) throw a.err;
503
+ let a = await Promise.race([r, new Promise((n, r) => setTimeout(() => r(new o(e)), t))]);
504
+ if (this.#s.unregister(n), a.err) throw a.err;
501
505
  return a.data;
502
506
  }
503
507
  on(e, t) {
504
508
  switch (e) {
505
509
  case "textMessage":
506
- this.#d.push(t);
510
+ this.#f.push(t);
507
511
  break;
508
512
  case "clientEnter":
509
- this.#f.push(t);
513
+ this.#p.push(t);
510
514
  break;
511
515
  case "clientLeave":
512
- this.#p.push(t);
516
+ this.#m.push(t);
513
517
  break;
514
518
  case "clientMoved":
515
- this.#m.push(t);
519
+ this.#h.push(t);
516
520
  break;
517
521
  case "poked":
518
- this.#h.push(t);
522
+ this.#g.push(t);
519
523
  break;
520
524
  case "voiceData":
521
- this.#g.push(t);
525
+ this.#_.push(t);
522
526
  break;
523
527
  case "connected":
524
- this.#_.push(t);
528
+ this.#v.push(t);
525
529
  break;
526
530
  case "disconnected":
527
- this.#v.push(t);
531
+ this.#y.push(t);
528
532
  break;
529
- case "kicked": this.#y.push(t);
533
+ case "kicked": this.#b.push(t);
530
534
  }
531
535
  return this;
532
536
  }
533
537
  useCommandMiddleware(...e) {
534
- return this.#b.push(...e), this.#S = this.#L(), this;
538
+ return this.#x.push(...e), this.#C = this.#R(), this;
535
539
  }
536
540
  useEventMiddleware(...e) {
537
- return this.#x.push(...e), this.#C = this.#R(), this;
541
+ return this.#S.push(...e), this.#w = this.#z(), this;
538
542
  }
539
543
  clientID() {
540
544
  return this.clid;
541
545
  }
546
+ uniqueIdentifier() {
547
+ return c(this.#e.publicKeyBase64(), this.uidAlgorithm);
548
+ }
542
549
  channelID() {
543
- return this.#c.get(this.clid)?.channelID ?? 0n;
550
+ return this.#l.get(this.clid)?.channelID ?? 0n;
544
551
  }
545
552
  sendWhisper(e, t, n) {
546
553
  this.handler.sendWhisperPacket(e, t, n);
@@ -548,53 +555,53 @@ var $ = class {
548
555
  sendVoice(e, t) {
549
556
  this.handler.sendVoicePacket(e, t);
550
557
  }
551
- async fileTransferInitUpload(e, t, n, r, i = !1) {
552
- let [a, s] = this.#s.register(), c = F(e, t, n, r, a, i);
558
+ async fileTransferInitUpload(e, t, n, r, a = !1) {
559
+ let [o, s] = this.#c.register(), c = G(e, t, n, r, o, a);
553
560
  try {
554
561
  await this.execCommand(c, 1e4);
555
562
  } catch (e) {
556
- throw this.#s.unregister(a), e;
563
+ throw this.#c.unregister(o), e;
557
564
  }
558
- let l = await Promise.race([s, new Promise((e, t) => setTimeout(() => t(new g()), 1e4))]);
559
- if (this.#s.unregister(a), "size" in l) throw new o("unexpected download response");
565
+ let l = await Promise.race([s, new Promise((e, t) => setTimeout(() => t(new i()), 1e4))]);
566
+ if (this.#c.unregister(o), "size" in l) throw new v("unexpected download response");
560
567
  if ("status" in l) {
561
568
  let e = l;
562
- throw new o(`${e.message} (status=${e.status})`);
569
+ throw new v(`${e.message} (status=${e.status})`);
563
570
  }
564
571
  return l;
565
572
  }
566
573
  async fileTransferInitDownload(e, t, n) {
567
- let [r, i] = this.#s.register(), a = I(e, t, n, r);
574
+ let [r, a] = this.#c.register(), o = K(e, t, n, r);
568
575
  try {
569
- await this.execCommand(a, 1e4);
576
+ await this.execCommand(o, 1e4);
570
577
  } catch (e) {
571
- throw this.#s.unregister(r), e;
578
+ throw this.#c.unregister(r), e;
572
579
  }
573
- let s = await Promise.race([i, new Promise((e, t) => setTimeout(() => t(new g()), 1e4))]);
574
- if (this.#s.unregister(r), "seekPosition" in s) throw new o("unexpected upload response");
580
+ let s = await Promise.race([a, new Promise((e, t) => setTimeout(() => t(new i()), 1e4))]);
581
+ if (this.#c.unregister(r), "seekPosition" in s) throw new v("unexpected upload response");
575
582
  if ("status" in s) {
576
583
  let e = s;
577
- throw new o(`${e.message} (status=${e.status})`);
584
+ throw new v(`${e.message} (status=${e.status})`);
578
585
  }
579
586
  return s;
580
587
  }
581
588
  uploadFileData(e, t, n) {
582
- return N(e, t, n);
589
+ return U(e, t, n);
583
590
  }
584
591
  downloadFileData(e, t, n) {
585
- return P(e, t, n);
592
+ return W(e, t, n);
586
593
  }
587
594
  _markConnected() {
588
- this.#i = t.Connected, this.#u = null;
589
- for (let e of this.#l) e.resolve();
590
- this.#l = [];
591
- let e = this.#_.slice();
595
+ this.#a = t.Connected, this.#d = null;
596
+ for (let e of this.#u) e.resolve();
597
+ this.#u = [];
598
+ let e = this.#v.slice();
592
599
  for (let t of e) setImmediate(() => t());
593
600
  }
594
- #w() {
595
- this.#u = null, this.handler.close(), this.crypt = new v(this.#e), this.handler = new x(this.crypt, this.logger), this.handler.onPacket = (e) => this.#E(e), this.handler.onClosed = (e) => this.#F(e), this.#o.reset(), this.#s.reset(), this.#c.clear(), this.clid = 0, this.#S = this.#L();
601
+ #T() {
602
+ this.#d = null, this.handler.close(), this.crypt = new b(this.#e), this.handler = new C(this.crypt, this.logger, this.#i), this.handler.onPacket = (e) => this.#D(e), this.handler.onClosed = (e) => this.#I(e), this.#s.reset(), this.#c.reset(), this.#l.clear(), this.clid = 0, this.#C = this.#R();
596
603
  }
597
- async #T() {
604
+ async #E() {
598
605
  let e = this.#t.includes(":") ? this.#t : `${this.#t}:9987`;
599
606
  try {
600
607
  return (await this.#n.resolve(this.#t))[0]?.addr ?? e;
@@ -602,24 +609,27 @@ var $ = class {
602
609
  return e;
603
610
  }
604
611
  }
605
- #E(e) {
606
- this.#D(e);
607
- }
608
612
  #D(e) {
613
+ this.#O(e);
614
+ }
615
+ #O(e) {
609
616
  let t = e.typeFlagged & 15;
610
617
  if (t === 8) {
611
- let t = te(this.crypt, e.data);
612
- t && this.handler.sendPacket(b.Init1, t, 0);
618
+ let t = ee(this.crypt, e.data);
619
+ t && this.handler.sendPacket(S.Init1, t, 0);
613
620
  return;
614
621
  }
615
622
  if ((t === 0 || t === 1) && e.data.length > 5) {
616
- this.#O(e.data);
623
+ this.#k(e.data);
617
624
  return;
618
625
  }
619
- (t === 2 || t === 3) && e.data.length > 0 && this.#k(Buffer.from(e.data).toString("utf8"));
626
+ if ((t === 2 || t === 3) && e.data.length > 0) {
627
+ let t = Buffer.from(e.data).toString("utf8");
628
+ process.env.TEAMSPEAK_TRACE_RAW && process.stderr.write(`S2C ${JSON.stringify(t)}\n`), this.#A(t);
629
+ }
620
630
  }
621
- #O(e) {
622
- if (this.#g.length === 0) return;
631
+ #k(e) {
632
+ if (this.#_.length === 0) return;
623
633
  let t = new DataView(e.buffer, e.byteOffset, e.byteLength).getUint16(2, !1);
624
634
  if (t === this.clid) return;
625
635
  let n = {
@@ -627,162 +637,156 @@ var $ = class {
627
637
  codec: e[4],
628
638
  data: e.subarray(5)
629
639
  };
630
- for (let e of this.#g) setImmediate(() => e(n));
640
+ for (let e of this.#_) setImmediate(() => e(n));
631
641
  }
632
- #k(e) {
642
+ #A(e) {
633
643
  if (!e) return;
634
644
  let t = e.split("\0").join("\n").split("\n");
635
645
  for (let e of t) {
636
646
  let t = e.replace(/\r$/, "");
637
- if (t) for (let e of Z(t)) this.#A(e);
647
+ if (t) for (let e of re(t)) this.#j(e);
638
648
  }
639
649
  }
640
- #A(e) {
641
- let t = T(e);
642
- if (t && t.name) {
650
+ #j(e) {
651
+ let t = D(e);
652
+ if (t) {
653
+ if (t.name === "") {
654
+ Object.keys(t.params).length > 0 && this.#s.buffer(t.params);
655
+ return;
656
+ }
657
+ if (t.name === "channellistfinished") {
658
+ this.#s.signalWelcomeComplete();
659
+ return;
660
+ }
643
661
  if (t.name.startsWith("notify")) {
644
- let e = re(t, this.clid, this.#c, this.nickname);
645
- this.#M(e, t.params);
662
+ let e = ie(t, this.clid, this.#l, this.nickname);
663
+ this.#N(e, t.params);
646
664
  return;
647
665
  }
648
666
  switch (t.name) {
649
667
  case "clientinitiv":
650
- z(this, t.params);
668
+ N(this, t.params);
651
669
  break;
652
670
  case "initivexpand2":
653
- B(this, t.params);
671
+ P(this, t.params);
654
672
  break;
655
673
  case "initserver":
656
- V(this, t.params);
674
+ F(this, t.params);
657
675
  break;
658
676
  case "error":
659
- this.#j(t.params);
660
- break;
661
- default: {
662
- let e = t.params;
663
- if (t.name.includes("=")) {
664
- let n = t.name.indexOf("="), r = t.name.slice(0, n), i = t.name.slice(n + 1);
665
- e = {
666
- [r]: i,
667
- ...t.params
668
- };
669
- }
670
- this.#o.buffer(e);
677
+ this.#M(t.params);
671
678
  break;
672
- }
679
+ default: this.#s.buffer(t.params);
673
680
  }
674
681
  }
675
682
  }
676
- #j(e) {
677
- let { err: n, rc: r } = k(e);
678
- if (r === null ? this.#o.discardBuffer() : this.#o.resolve(r, n), n && this.#i !== t.Connected) {
679
- this.#I(n);
683
+ #M(e) {
684
+ let { err: n, rc: r } = j(e);
685
+ if (r === null ? this.#s.discardBuffer() : this.#s.resolve(r, n), n && this.#a !== t.Connected) {
686
+ this.#L(n);
680
687
  return;
681
688
  }
682
689
  (e.id ?? "0") === "3329" && setImmediate(() => this.disconnect().catch(() => {}));
683
690
  }
684
- #M(e, t) {
691
+ #N(e, t) {
685
692
  switch (e.kind) {
686
693
  case "clientEnter": {
687
694
  let t = e.info;
688
- t.id !== 0 && t.id === this.clid ? (this.nickname = t.nickname, this.#o.signalWelcomeComplete()) : t.id !== 0 && this.clid === 0 && X(this.nickname, t.nickname) && (this.clid = t.id, this.handler.setClientID(t.id), this.nickname = t.nickname, this.#o.signalWelcomeComplete()), this.#N("clientEnter", t);
695
+ t.id !== 0 && t.id === this.clid ? this.nickname = t.nickname : t.id !== 0 && this.clid === 0 && Z(this.nickname, t.nickname) && (this.clid = t.id, this.handler.setClientID(t.id), this.nickname = t.nickname), this.#P("clientEnter", t);
689
696
  break;
690
697
  }
691
698
  case "clientLeave":
692
- if (this.#N("clientLeave", e.event), e.isSelf && (e.event.reasonID === 4 || e.event.reasonID === 5)) {
699
+ if (this.#P("clientLeave", e.event), e.isSelf && (e.event.reasonID === 4 || e.event.reasonID === 5)) {
693
700
  let t = e.event.reasonMsg;
694
- for (let e of this.#y) setImmediate(() => e(t));
701
+ for (let e of this.#b) setImmediate(() => e(t));
695
702
  }
696
703
  break;
697
704
  case "clientMoved":
698
- this.#N("clientMoved", e.event);
705
+ this.#P("clientMoved", e.event);
699
706
  break;
700
707
  case "textMessage":
701
- this.#N("textMessage", e.message);
708
+ this.#P("textMessage", e.message);
702
709
  break;
703
710
  case "poked":
704
- this.#N("poked", e.event);
711
+ this.#P("poked", e.event);
705
712
  break;
706
713
  case "startUpload":
707
- this.#s.notify(e.info.clientFileTransferID, e.info);
714
+ this.#c.notify(e.info.clientFileTransferID, e.info);
708
715
  break;
709
716
  case "startDownload":
710
- this.#s.notify(e.info.clientFileTransferID, e.info);
717
+ this.#c.notify(e.info.clientFileTransferID, e.info);
711
718
  break;
712
- case "fileTransferStatus": this.#s.notify(e.info.clientFileTransferID, e.info);
719
+ case "fileTransferStatus": this.#c.notify(e.info.clientFileTransferID, e.info);
713
720
  }
714
721
  }
715
- #N(e, t) {
716
- this.#C(t);
717
- }
718
722
  #P(e, t) {
723
+ this.#w(t);
724
+ }
725
+ #F(e, t) {
719
726
  switch (e) {
720
727
  case "textMessage":
721
- for (let e of this.#d) setImmediate(() => e(t));
728
+ for (let e of this.#f) setImmediate(() => e(t));
722
729
  break;
723
730
  case "clientEnter":
724
- for (let e of this.#f) setImmediate(() => e(t));
731
+ for (let e of this.#p) setImmediate(() => e(t));
725
732
  break;
726
733
  case "clientLeave":
727
- for (let e of this.#p) setImmediate(() => e(t));
734
+ for (let e of this.#m) setImmediate(() => e(t));
728
735
  break;
729
736
  case "clientMoved":
730
- for (let e of this.#m) setImmediate(() => e(t));
737
+ for (let e of this.#h) setImmediate(() => e(t));
731
738
  break;
732
- case "poked": for (let e of this.#h) setImmediate(() => e(t));
739
+ case "poked": for (let e of this.#g) setImmediate(() => e(t));
733
740
  }
734
741
  }
735
- #F(e) {
736
- if (this.#i === t.Disconnected) return;
737
- if (this.#i !== t.Connected) {
738
- this.#I(e ?? /* @__PURE__ */ Error("Connection closed before the TeamSpeak handshake completed"));
742
+ #I(e) {
743
+ if (this.#a === t.Disconnected) return;
744
+ if (this.#a !== t.Connected) {
745
+ this.#L(e ?? /* @__PURE__ */ Error("Connection closed before the TeamSpeak handshake completed"));
739
746
  return;
740
747
  }
741
- this.#i = t.Disconnected;
742
- let n = this.#v.slice();
748
+ this.#a = t.Disconnected;
749
+ let n = this.#y.slice();
743
750
  for (let t of n) setImmediate(() => t(e ?? void 0));
744
751
  }
745
- #I(e) {
746
- this.#u = e;
747
- let n = this.#l.splice(0);
752
+ #L(e) {
753
+ this.#d = e;
754
+ let n = this.#u.splice(0);
748
755
  for (let t of n) t.reject(e);
749
- if (this.#i === t.Disconnected) return;
750
- this.#i = t.Disconnected, this.handler.close();
751
- let r = this.#v.slice();
756
+ if (this.#a === t.Disconnected) return;
757
+ this.#a = t.Disconnected, this.handler.close();
758
+ let r = this.#y.slice();
752
759
  for (let t of r) setImmediate(() => t(e));
753
760
  }
754
- #L() {
755
- return L(this.#b, async (e) => {
756
- this.handler.sendPacket(b.Command, Buffer.from(e), 0);
761
+ #R() {
762
+ return ne(this.#x, async (e) => {
763
+ this.handler.sendPacket(S.Command, Buffer.from(e), 0);
757
764
  });
758
765
  }
759
- #R() {
760
- return R(this.#x, (e) => {
761
- typeof e == "object" && e && "invokerName" in e && "message" in e && "targetMode" in e ? this.#P("textMessage", e) : typeof e == "object" && e && "invokerName" in e && "message" in e && !("targetMode" in e) ? this.#P("poked", e) : typeof e == "object" && e && "id" in e && "uid" in e ? this.#P("clientEnter", e) : typeof e == "object" && e && "id" in e && "reasonID" in e && "targetChannelID" in e ? this.#P("clientMoved", e) : typeof e == "object" && e && "id" in e && "reasonID" in e && this.#P("clientLeave", e);
766
+ #z() {
767
+ return q(this.#S, (e) => {
768
+ typeof e == "object" && e && "invokerName" in e && "message" in e && "targetMode" in e ? this.#F("textMessage", e) : typeof e == "object" && e && "invokerName" in e && "message" in e && !("targetMode" in e) ? this.#F("poked", e) : typeof e == "object" && e && "id" in e && "uid" in e ? this.#F("clientEnter", e) : typeof e == "object" && e && "id" in e && "reasonID" in e && "targetChannelID" in e ? this.#F("clientMoved", e) : typeof e == "object" && e && "id" in e && "reasonID" in e && this.#F("clientLeave", e);
762
769
  });
763
770
  }
764
771
  };
765
772
  //#endregion
766
773
  //#region src/api.ts
767
- async function me(e, t, n, r) {
768
- let i = C("sendtextmessage", [
774
+ async function he(e, t, n, r) {
775
+ let i = T("sendtextmessage", [
769
776
  ["targetmode", String(t)],
770
777
  ["target", String(n)],
771
778
  ["msg", r]
772
779
  ]);
773
780
  await e.sendCommandNoWait(i);
774
781
  }
775
- async function he(e, t, n, r = "") {
782
+ async function ge(e, t, n, r = "") {
776
783
  let i = [["clid", String(t)], ["cid", String(n)]];
777
- r && i.push(["cpw", ge(r)]);
778
- let a = C("clientmove", i);
784
+ r && i.push(["cpw", R(r)]);
785
+ let a = T("clientmove", i);
779
786
  await e.execCommand(a, 1e4);
780
787
  }
781
- function ge(e) {
782
- return E("sha1").update(e).digest("base64");
783
- }
784
788
  async function _e(e, t, n) {
785
- let r = C("clientpoke", [["clid", String(t)], ["msg", n]]);
789
+ let r = T("clientpoke", [["clid", String(t)], ["msg", n]]);
786
790
  await e.execCommand(r, 1e4);
787
791
  }
788
792
  async function ve(e, t) {
@@ -795,7 +799,7 @@ async function ye(e) {
795
799
  id: BigInt(e.cid ?? "0"),
796
800
  parentID: BigInt(e.pid ?? e.cpid ?? "0"),
797
801
  order: BigInt(e.channel_order ?? "0"),
798
- name: S(e.channel_name ?? ""),
802
+ name: w(e.channel_name ?? ""),
799
803
  description: ""
800
804
  }));
801
805
  }
@@ -804,7 +808,7 @@ async function be(e) {
804
808
  let t = e.client_servergroups ?? "";
805
809
  return {
806
810
  id: parseInt(e.clid ?? "0", 10),
807
- nickname: S(e.client_nickname ?? ""),
811
+ nickname: w(e.client_nickname ?? ""),
808
812
  uid: e.client_unique_identifier ?? "",
809
813
  channelID: BigInt(e.cid ?? "0"),
810
814
  type: parseInt(e.client_type ?? "0", 10),
@@ -814,7 +818,7 @@ async function be(e) {
814
818
  }
815
819
  async function xe(e, t, n) {
816
820
  if (n.length === 0) return;
817
- let r = n.join("|"), i = w("ftdeletefile", {
821
+ let r = n.join("|"), i = E("ftdeletefile", {
818
822
  cid: String(t),
819
823
  cpw: "",
820
824
  name: r
@@ -822,6 +826,6 @@ async function xe(e, t, n) {
822
826
  await e.execCommand(i, 1e4);
823
827
  }
824
828
  //#endregion
825
- export { l as AlreadyConnectedError, $ as Client, t as ClientStatus, c as CommandTimeoutError, a as CryptoInitError, h as EAXTagMismatchError, _ as FakeSignatureMismatchError, o as FileTransferError, g as FileTransferTimeoutError, u as Identity, i as InvalidIdentityError, r as ServerError, ee as TeamspeakError, he as clientMove, e as consoleLogger, M as dialFileTransfer, P as downloadFileData, xe as fileTransferDeleteFile, m as generateIdentity, ve as getClientInfo, s as getUidFromPublicKey, f as identityFromString, ye as listChannels, be as listClients, n as noopLogger, _e as poke, me as sendTextMessage, N as uploadFileData };
829
+ export { l as AlreadyConnectedError, me as Client, t as ClientStatus, o as CommandTimeoutError, g as CryptoInitError, y as EAXTagMismatchError, s as FakeSignatureMismatchError, v as FileTransferError, i as FileTransferTimeoutError, d as Identity, r as InvalidIdentityError, _ as ServerError, a as TeamspeakError, ge as clientMove, e as consoleLogger, H as dialFileTransfer, W as downloadFileData, xe as fileTransferDeleteFile, h as generateIdentity, ve as getClientInfo, c as getUidFromPublicKey, p as identityFromString, ye as listChannels, be as listClients, n as noopLogger, _e as poke, he as sendTextMessage, U as uploadFileData };
826
830
 
827
831
  //# sourceMappingURL=index.mjs.map