@inline-chat/hermes-agent-adapter 0.0.17 → 0.0.18-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,22 +4,38 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
22
+ if (mod && typeof mod === "object" || typeof mod === "function") {
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ }
30
+ if (canCache)
31
+ cache.set(mod, to);
16
32
  return to;
17
33
  };
18
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
35
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
20
36
 
21
37
  // node_modules/@protobuf-ts/runtime/build/commonjs/json-typings.js
22
- var require_json_typings = __commonJS((exports) => {
38
+ var require_json_typings = __commonJS(function(exports) {
23
39
  Object.defineProperty(exports, "__esModule", { value: true });
24
40
  exports.isJsonObject = exports.typeofJsonValue = undefined;
25
41
  function typeofJsonValue(value) {
@@ -40,7 +56,7 @@ var require_json_typings = __commonJS((exports) => {
40
56
  });
41
57
 
42
58
  // node_modules/@protobuf-ts/runtime/build/commonjs/base64.js
43
- var require_base64 = __commonJS((exports) => {
59
+ var require_base64 = __commonJS(function(exports) {
44
60
  Object.defineProperty(exports, "__esModule", { value: true });
45
61
  exports.base64encode = exports.base64decode = undefined;
46
62
  var encTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
@@ -132,7 +148,7 @@ var require_base64 = __commonJS((exports) => {
132
148
  });
133
149
 
134
150
  // node_modules/@protobuf-ts/runtime/build/commonjs/protobufjs-utf8.js
135
- var require_protobufjs_utf8 = __commonJS((exports) => {
151
+ var require_protobufjs_utf8 = __commonJS(function(exports) {
136
152
  Object.defineProperty(exports, "__esModule", { value: true });
137
153
  exports.utf8read = undefined;
138
154
  var fromCharCodes = (chunk) => String.fromCharCode.apply(String, chunk);
@@ -169,7 +185,7 @@ var require_protobufjs_utf8 = __commonJS((exports) => {
169
185
  });
170
186
 
171
187
  // node_modules/@protobuf-ts/runtime/build/commonjs/binary-format-contract.js
172
- var require_binary_format_contract = __commonJS((exports) => {
188
+ var require_binary_format_contract = __commonJS(function(exports) {
173
189
  Object.defineProperty(exports, "__esModule", { value: true });
174
190
  exports.WireType = exports.mergeBinaryOptions = exports.UnknownFieldHandler = undefined;
175
191
  var UnknownFieldHandler;
@@ -209,7 +225,7 @@ var require_binary_format_contract = __commonJS((exports) => {
209
225
  });
210
226
 
211
227
  // node_modules/@protobuf-ts/runtime/build/commonjs/goog-varint.js
212
- var require_goog_varint = __commonJS((exports) => {
228
+ var require_goog_varint = __commonJS(function(exports) {
213
229
  Object.defineProperty(exports, "__esModule", { value: true });
214
230
  exports.varint32read = exports.varint32write = exports.int64toString = exports.int64fromString = exports.varint64write = exports.varint64read = undefined;
215
231
  function varint64read() {
@@ -376,7 +392,7 @@ var require_goog_varint = __commonJS((exports) => {
376
392
  });
377
393
 
378
394
  // node_modules/@protobuf-ts/runtime/build/commonjs/pb-long.js
379
- var require_pb_long = __commonJS((exports) => {
395
+ var require_pb_long = __commonJS(function(exports) {
380
396
  Object.defineProperty(exports, "__esModule", { value: true });
381
397
  exports.PbLong = exports.PbULong = exports.detectBi = undefined;
382
398
  var goog_varint_1 = require_goog_varint();
@@ -560,7 +576,7 @@ var require_pb_long = __commonJS((exports) => {
560
576
  });
561
577
 
562
578
  // node_modules/@protobuf-ts/runtime/build/commonjs/binary-reader.js
563
- var require_binary_reader = __commonJS((exports) => {
579
+ var require_binary_reader = __commonJS(function(exports) {
564
580
  Object.defineProperty(exports, "__esModule", { value: true });
565
581
  exports.BinaryReader = exports.binaryReadOptions = undefined;
566
582
  var binary_format_contract_1 = require_binary_format_contract();
@@ -682,7 +698,7 @@ var require_binary_reader = __commonJS((exports) => {
682
698
  });
683
699
 
684
700
  // node_modules/@protobuf-ts/runtime/build/commonjs/assert.js
685
- var require_assert = __commonJS((exports) => {
701
+ var require_assert = __commonJS(function(exports) {
686
702
  Object.defineProperty(exports, "__esModule", { value: true });
687
703
  exports.assertFloat32 = exports.assertUInt32 = exports.assertInt32 = exports.assertNever = exports.assert = undefined;
688
704
  function assert(condition, msg) {
@@ -726,7 +742,7 @@ var require_assert = __commonJS((exports) => {
726
742
  });
727
743
 
728
744
  // node_modules/@protobuf-ts/runtime/build/commonjs/binary-writer.js
729
- var require_binary_writer = __commonJS((exports) => {
745
+ var require_binary_writer = __commonJS(function(exports) {
730
746
  Object.defineProperty(exports, "__esModule", { value: true });
731
747
  exports.BinaryWriter = exports.binaryWriteOptions = undefined;
732
748
  var pb_long_1 = require_pb_long();
@@ -881,7 +897,7 @@ var require_binary_writer = __commonJS((exports) => {
881
897
  });
882
898
 
883
899
  // node_modules/@protobuf-ts/runtime/build/commonjs/json-format-contract.js
884
- var require_json_format_contract = __commonJS((exports) => {
900
+ var require_json_format_contract = __commonJS(function(exports) {
885
901
  Object.defineProperty(exports, "__esModule", { value: true });
886
902
  exports.mergeJsonOptions = exports.jsonWriteOptions = exports.jsonReadOptions = undefined;
887
903
  var defaultsWrite = {
@@ -911,14 +927,14 @@ var require_json_format_contract = __commonJS((exports) => {
911
927
  });
912
928
 
913
929
  // node_modules/@protobuf-ts/runtime/build/commonjs/message-type-contract.js
914
- var require_message_type_contract = __commonJS((exports) => {
930
+ var require_message_type_contract = __commonJS(function(exports) {
915
931
  Object.defineProperty(exports, "__esModule", { value: true });
916
932
  exports.MESSAGE_TYPE = undefined;
917
933
  exports.MESSAGE_TYPE = Symbol.for("protobuf-ts/message-type");
918
934
  });
919
935
 
920
936
  // node_modules/@protobuf-ts/runtime/build/commonjs/lower-camel-case.js
921
- var require_lower_camel_case = __commonJS((exports) => {
937
+ var require_lower_camel_case = __commonJS(function(exports) {
922
938
  Object.defineProperty(exports, "__esModule", { value: true });
923
939
  exports.lowerCamelCase = undefined;
924
940
  function lowerCamelCase(snakeCase) {
@@ -946,7 +962,7 @@ var require_lower_camel_case = __commonJS((exports) => {
946
962
  });
947
963
 
948
964
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-info.js
949
- var require_reflection_info = __commonJS((exports) => {
965
+ var require_reflection_info = __commonJS(function(exports) {
950
966
  Object.defineProperty(exports, "__esModule", { value: true });
951
967
  exports.readMessageOption = exports.readFieldOption = exports.readFieldOptions = exports.normalizeFieldInfo = exports.RepeatType = exports.LongType = exports.ScalarType = undefined;
952
968
  var lower_camel_case_1 = require_lower_camel_case();
@@ -1020,7 +1036,7 @@ var require_reflection_info = __commonJS((exports) => {
1020
1036
  });
1021
1037
 
1022
1038
  // node_modules/@protobuf-ts/runtime/build/commonjs/oneof.js
1023
- var require_oneof = __commonJS((exports) => {
1039
+ var require_oneof = __commonJS(function(exports) {
1024
1040
  Object.defineProperty(exports, "__esModule", { value: true });
1025
1041
  exports.getSelectedOneofValue = exports.clearOneofValue = exports.setUnknownOneofValue = exports.setOneofValue = exports.getOneofValue = exports.isOneofGroup = undefined;
1026
1042
  function isOneofGroup(any) {
@@ -1080,7 +1096,7 @@ var require_oneof = __commonJS((exports) => {
1080
1096
  });
1081
1097
 
1082
1098
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-type-check.js
1083
- var require_reflection_type_check = __commonJS((exports) => {
1099
+ var require_reflection_type_check = __commonJS(function(exports) {
1084
1100
  Object.defineProperty(exports, "__esModule", { value: true });
1085
1101
  exports.ReflectionTypeCheck = undefined;
1086
1102
  var reflection_info_1 = require_reflection_info();
@@ -1281,7 +1297,7 @@ var require_reflection_type_check = __commonJS((exports) => {
1281
1297
  });
1282
1298
 
1283
1299
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-long-convert.js
1284
- var require_reflection_long_convert = __commonJS((exports) => {
1300
+ var require_reflection_long_convert = __commonJS(function(exports) {
1285
1301
  Object.defineProperty(exports, "__esModule", { value: true });
1286
1302
  exports.reflectionLongConvert = undefined;
1287
1303
  var reflection_info_1 = require_reflection_info();
@@ -1299,7 +1315,7 @@ var require_reflection_long_convert = __commonJS((exports) => {
1299
1315
  });
1300
1316
 
1301
1317
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-json-reader.js
1302
- var require_reflection_json_reader = __commonJS((exports) => {
1318
+ var require_reflection_json_reader = __commonJS(function(exports) {
1303
1319
  Object.defineProperty(exports, "__esModule", { value: true });
1304
1320
  exports.ReflectionJsonReader = undefined;
1305
1321
  var json_typings_1 = require_json_typings();
@@ -1573,7 +1589,7 @@ var require_reflection_json_reader = __commonJS((exports) => {
1573
1589
  });
1574
1590
 
1575
1591
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-json-writer.js
1576
- var require_reflection_json_writer = __commonJS((exports) => {
1592
+ var require_reflection_json_writer = __commonJS(function(exports) {
1577
1593
  Object.defineProperty(exports, "__esModule", { value: true });
1578
1594
  exports.ReflectionJsonWriter = undefined;
1579
1595
  var base64_1 = require_base64();
@@ -1776,7 +1792,7 @@ var require_reflection_json_writer = __commonJS((exports) => {
1776
1792
  });
1777
1793
 
1778
1794
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-scalar-default.js
1779
- var require_reflection_scalar_default = __commonJS((exports) => {
1795
+ var require_reflection_scalar_default = __commonJS(function(exports) {
1780
1796
  Object.defineProperty(exports, "__esModule", { value: true });
1781
1797
  exports.reflectionScalarDefault = undefined;
1782
1798
  var reflection_info_1 = require_reflection_info();
@@ -1808,7 +1824,7 @@ var require_reflection_scalar_default = __commonJS((exports) => {
1808
1824
  });
1809
1825
 
1810
1826
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-binary-reader.js
1811
- var require_reflection_binary_reader = __commonJS((exports) => {
1827
+ var require_reflection_binary_reader = __commonJS(function(exports) {
1812
1828
  Object.defineProperty(exports, "__esModule", { value: true });
1813
1829
  exports.ReflectionBinaryReader = undefined;
1814
1830
  var binary_format_contract_1 = require_binary_format_contract();
@@ -1968,7 +1984,7 @@ var require_reflection_binary_reader = __commonJS((exports) => {
1968
1984
  });
1969
1985
 
1970
1986
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-binary-writer.js
1971
- var require_reflection_binary_writer = __commonJS((exports) => {
1987
+ var require_reflection_binary_writer = __commonJS(function(exports) {
1972
1988
  Object.defineProperty(exports, "__esModule", { value: true });
1973
1989
  exports.ReflectionBinaryWriter = undefined;
1974
1990
  var binary_format_contract_1 = require_binary_format_contract();
@@ -2166,7 +2182,7 @@ var require_reflection_binary_writer = __commonJS((exports) => {
2166
2182
  });
2167
2183
 
2168
2184
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-create.js
2169
- var require_reflection_create = __commonJS((exports) => {
2185
+ var require_reflection_create = __commonJS(function(exports) {
2170
2186
  Object.defineProperty(exports, "__esModule", { value: true });
2171
2187
  exports.reflectionCreate = undefined;
2172
2188
  var reflection_scalar_default_1 = require_reflection_scalar_default();
@@ -2200,7 +2216,7 @@ var require_reflection_create = __commonJS((exports) => {
2200
2216
  });
2201
2217
 
2202
2218
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-merge-partial.js
2203
- var require_reflection_merge_partial = __commonJS((exports) => {
2219
+ var require_reflection_merge_partial = __commonJS(function(exports) {
2204
2220
  Object.defineProperty(exports, "__esModule", { value: true });
2205
2221
  exports.reflectionMergePartial = undefined;
2206
2222
  function reflectionMergePartial(info, target, source) {
@@ -2267,7 +2283,7 @@ var require_reflection_merge_partial = __commonJS((exports) => {
2267
2283
  });
2268
2284
 
2269
2285
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-equals.js
2270
- var require_reflection_equals = __commonJS((exports) => {
2286
+ var require_reflection_equals = __commonJS(function(exports) {
2271
2287
  Object.defineProperty(exports, "__esModule", { value: true });
2272
2288
  exports.reflectionEquals = undefined;
2273
2289
  var reflection_info_1 = require_reflection_info();
@@ -2335,7 +2351,7 @@ var require_reflection_equals = __commonJS((exports) => {
2335
2351
  });
2336
2352
 
2337
2353
  // node_modules/@protobuf-ts/runtime/build/commonjs/message-type.js
2338
- var require_message_type = __commonJS((exports) => {
2354
+ var require_message_type = __commonJS(function(exports) {
2339
2355
  Object.defineProperty(exports, "__esModule", { value: true });
2340
2356
  exports.MessageType = undefined;
2341
2357
  var message_type_contract_1 = require_message_type_contract();
@@ -2441,7 +2457,7 @@ var require_message_type = __commonJS((exports) => {
2441
2457
  });
2442
2458
 
2443
2459
  // node_modules/@protobuf-ts/runtime/build/commonjs/reflection-contains-message-type.js
2444
- var require_reflection_contains_message_type = __commonJS((exports) => {
2460
+ var require_reflection_contains_message_type = __commonJS(function(exports) {
2445
2461
  Object.defineProperty(exports, "__esModule", { value: true });
2446
2462
  exports.containsMessageType = undefined;
2447
2463
  var message_type_contract_1 = require_message_type_contract();
@@ -2452,7 +2468,7 @@ var require_reflection_contains_message_type = __commonJS((exports) => {
2452
2468
  });
2453
2469
 
2454
2470
  // node_modules/@protobuf-ts/runtime/build/commonjs/enum-object.js
2455
- var require_enum_object = __commonJS((exports) => {
2471
+ var require_enum_object = __commonJS(function(exports) {
2456
2472
  Object.defineProperty(exports, "__esModule", { value: true });
2457
2473
  exports.listEnumNumbers = exports.listEnumNames = exports.listEnumValues = exports.isEnumObject = undefined;
2458
2474
  function isEnumObject(arg) {
@@ -2504,7 +2520,7 @@ var require_enum_object = __commonJS((exports) => {
2504
2520
  });
2505
2521
 
2506
2522
  // node_modules/@protobuf-ts/runtime/build/commonjs/index.js
2507
- var require_commonjs = __commonJS((exports) => {
2523
+ var require_commonjs = __commonJS(function(exports) {
2508
2524
  Object.defineProperty(exports, "__esModule", { value: true });
2509
2525
  var json_typings_1 = require_json_typings();
2510
2526
  Object.defineProperty(exports, "typeofJsonValue", { enumerable: true, get: function() {
@@ -2687,7 +2703,7 @@ var require_commonjs = __commonJS((exports) => {
2687
2703
  });
2688
2704
 
2689
2705
  // node_modules/ws/lib/constants.js
2690
- var require_constants = __commonJS((exports, module) => {
2706
+ var require_constants = __commonJS(function(exports, module) {
2691
2707
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
2692
2708
  var hasBlob = typeof Blob !== "undefined";
2693
2709
  if (hasBlob)
@@ -2707,7 +2723,7 @@ var require_constants = __commonJS((exports, module) => {
2707
2723
  });
2708
2724
 
2709
2725
  // node_modules/ws/lib/buffer-util.js
2710
- var require_buffer_util = __commonJS((exports, module) => {
2726
+ var require_buffer_util = __commonJS(function(exports, module) {
2711
2727
  var { EMPTY_BUFFER } = require_constants();
2712
2728
  var FastBuffer = Buffer[Symbol.species];
2713
2729
  function concat(list, totalLength) {
@@ -2785,7 +2801,7 @@ var require_buffer_util = __commonJS((exports, module) => {
2785
2801
  });
2786
2802
 
2787
2803
  // node_modules/ws/lib/limiter.js
2788
- var require_limiter = __commonJS((exports, module) => {
2804
+ var require_limiter = __commonJS(function(exports, module) {
2789
2805
  var kDone = Symbol("kDone");
2790
2806
  var kRun = Symbol("kRun");
2791
2807
 
@@ -2817,7 +2833,7 @@ var require_limiter = __commonJS((exports, module) => {
2817
2833
  });
2818
2834
 
2819
2835
  // node_modules/ws/lib/permessage-deflate.js
2820
- var require_permessage_deflate = __commonJS((exports, module) => {
2836
+ var require_permessage_deflate = __commonJS(function(exports, module) {
2821
2837
  var zlib = __require("zlib");
2822
2838
  var bufferUtil = require_buffer_util();
2823
2839
  var Limiter = require_limiter();
@@ -3081,7 +3097,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
3081
3097
  });
3082
3098
 
3083
3099
  // node_modules/ws/lib/validation.js
3084
- var require_validation = __commonJS((exports, module) => {
3100
+ var require_validation = __commonJS(function(exports, module) {
3085
3101
  var { isUtf8 } = __require("buffer");
3086
3102
  var { hasBlob } = require_constants();
3087
3103
  var tokenChars = [
@@ -3268,7 +3284,7 @@ var require_validation = __commonJS((exports, module) => {
3268
3284
  });
3269
3285
 
3270
3286
  // node_modules/ws/lib/receiver.js
3271
- var require_receiver = __commonJS((exports, module) => {
3287
+ var require_receiver = __commonJS(function(exports, module) {
3272
3288
  var { Writable } = __require("stream");
3273
3289
  var PerMessageDeflate = require_permessage_deflate();
3274
3290
  var {
@@ -3662,7 +3678,7 @@ var require_receiver = __commonJS((exports, module) => {
3662
3678
  });
3663
3679
 
3664
3680
  // node_modules/ws/lib/sender.js
3665
- var require_sender = __commonJS((exports, module) => {
3681
+ var require_sender = __commonJS(function(exports, module) {
3666
3682
  var { Duplex } = __require("stream");
3667
3683
  var { randomFillSync } = __require("crypto");
3668
3684
  var {
@@ -4021,7 +4037,7 @@ var require_sender = __commonJS((exports, module) => {
4021
4037
  });
4022
4038
 
4023
4039
  // node_modules/ws/lib/event-target.js
4024
- var require_event_target = __commonJS((exports, module) => {
4040
+ var require_event_target = __commonJS(function(exports, module) {
4025
4041
  var { kForOnEventAttribute, kListener } = require_constants();
4026
4042
  var kCode = Symbol("kCode");
4027
4043
  var kData = Symbol("kData");
@@ -4172,7 +4188,7 @@ var require_event_target = __commonJS((exports, module) => {
4172
4188
  });
4173
4189
 
4174
4190
  // node_modules/ws/lib/extension.js
4175
- var require_extension = __commonJS((exports, module) => {
4191
+ var require_extension = __commonJS(function(exports, module) {
4176
4192
  var { tokenChars } = require_validation();
4177
4193
  function push(dest, name, elem) {
4178
4194
  if (dest[name] === undefined)
@@ -4337,7 +4353,7 @@ var require_extension = __commonJS((exports, module) => {
4337
4353
  });
4338
4354
 
4339
4355
  // node_modules/ws/lib/websocket.js
4340
- var require_websocket = __commonJS((exports, module) => {
4356
+ var require_websocket = __commonJS(function(exports, module) {
4341
4357
  var EventEmitter = __require("events");
4342
4358
  var https = __require("https");
4343
4359
  var http = __require("http");
@@ -5109,7 +5125,7 @@ var require_websocket = __commonJS((exports, module) => {
5109
5125
  });
5110
5126
 
5111
5127
  // node_modules/ws/lib/stream.js
5112
- var require_stream = __commonJS((exports, module) => {
5128
+ var require_stream = __commonJS(function(exports, module) {
5113
5129
  var WebSocket = require_websocket();
5114
5130
  var { Duplex } = __require("stream");
5115
5131
  function emitClose(stream) {
@@ -5212,7 +5228,7 @@ var require_stream = __commonJS((exports, module) => {
5212
5228
  });
5213
5229
 
5214
5230
  // node_modules/ws/lib/subprotocol.js
5215
- var require_subprotocol = __commonJS((exports, module) => {
5231
+ var require_subprotocol = __commonJS(function(exports, module) {
5216
5232
  var { tokenChars } = require_validation();
5217
5233
  function parse(header) {
5218
5234
  const protocols = new Set;
@@ -5257,7 +5273,7 @@ var require_subprotocol = __commonJS((exports, module) => {
5257
5273
  });
5258
5274
 
5259
5275
  // node_modules/ws/lib/websocket-server.js
5260
- var require_websocket_server = __commonJS((exports, module) => {
5276
+ var require_websocket_server = __commonJS(function(exports, module) {
5261
5277
  var EventEmitter = __require("events");
5262
5278
  var http = __require("http");
5263
5279
  var { Duplex } = __require("stream");
@@ -6062,6 +6078,20 @@ var BlockDisclosure_Kind;
6062
6078
  BlockDisclosure_Kind2[BlockDisclosure_Kind2["DEFAULT"] = 0] = "DEFAULT";
6063
6079
  BlockDisclosure_Kind2[BlockDisclosure_Kind2["PROGRESS"] = 1] = "PROGRESS";
6064
6080
  })(BlockDisclosure_Kind || (BlockDisclosure_Kind = {}));
6081
+ var BlockDisclosure_ActivityKind;
6082
+ (function(BlockDisclosure_ActivityKind2) {
6083
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
6084
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["REASONING"] = 1] = "REASONING";
6085
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["EXPLORE"] = 2] = "EXPLORE";
6086
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["READ"] = 3] = "READ";
6087
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["SEARCH"] = 4] = "SEARCH";
6088
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["EDIT"] = 5] = "EDIT";
6089
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["DELETE"] = 6] = "DELETE";
6090
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["MOVE"] = 7] = "MOVE";
6091
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["COMMAND"] = 8] = "COMMAND";
6092
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["WEB"] = 9] = "WEB";
6093
+ BlockDisclosure_ActivityKind2[BlockDisclosure_ActivityKind2["TOOL"] = 10] = "TOOL";
6094
+ })(BlockDisclosure_ActivityKind || (BlockDisclosure_ActivityKind = {}));
6065
6095
  var BlockTable_Alignment;
6066
6096
  (function(BlockTable_Alignment2) {
6067
6097
  BlockTable_Alignment2[BlockTable_Alignment2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
@@ -6260,6 +6290,20 @@ var UploadFailure_Code;
6260
6290
  UploadFailure_Code2[UploadFailure_Code2["UPLOAD_FAILURE_PROCESSING"] = 3] = "UPLOAD_FAILURE_PROCESSING";
6261
6291
  UploadFailure_Code2[UploadFailure_Code2["UPLOAD_FAILURE_STORAGE"] = 4] = "UPLOAD_FAILURE_STORAGE";
6262
6292
  })(UploadFailure_Code || (UploadFailure_Code = {}));
6293
+ var RequestBotFilesystemInput_Operation;
6294
+ (function(RequestBotFilesystemInput_Operation2) {
6295
+ RequestBotFilesystemInput_Operation2[RequestBotFilesystemInput_Operation2["OPERATION_UNSPECIFIED"] = 0] = "OPERATION_UNSPECIFIED";
6296
+ RequestBotFilesystemInput_Operation2[RequestBotFilesystemInput_Operation2["LIST"] = 1] = "LIST";
6297
+ RequestBotFilesystemInput_Operation2[RequestBotFilesystemInput_Operation2["REGISTER_FOLDER"] = 2] = "REGISTER_FOLDER";
6298
+ })(RequestBotFilesystemInput_Operation || (RequestBotFilesystemInput_Operation = {}));
6299
+ var BotFilesystemEntry_Kind;
6300
+ (function(BotFilesystemEntry_Kind2) {
6301
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["KIND_UNSPECIFIED"] = 0] = "KIND_UNSPECIFIED";
6302
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["FILE"] = 1] = "FILE";
6303
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["DIRECTORY"] = 2] = "DIRECTORY";
6304
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["SYMLINK"] = 3] = "SYMLINK";
6305
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["OTHER"] = 4] = "OTHER";
6306
+ })(BotFilesystemEntry_Kind || (BotFilesystemEntry_Kind = {}));
6263
6307
  var DialogFollowMode;
6264
6308
  (function(DialogFollowMode2) {
6265
6309
  DialogFollowMode2[DialogFollowMode2["DIALOG_FOLLOW_MODE_UNSPECIFIED"] = 0] = "DIALOG_FOLLOW_MODE_UNSPECIFIED";
@@ -6458,6 +6502,11 @@ var Method;
6458
6502
  Method2[Method2["GET_USERS"] = 138] = "GET_USERS";
6459
6503
  Method2[Method2["GET_BOT_SKILLS"] = 139] = "GET_BOT_SKILLS";
6460
6504
  Method2[Method2["GET_BOT_CONFIGURATION_CATALOG"] = 140] = "GET_BOT_CONFIGURATION_CATALOG";
6505
+ Method2[Method2["UPDATE_DIALOG_TRANSLATION"] = 141] = "UPDATE_DIALOG_TRANSLATION";
6506
+ Method2[Method2["TRANSCRIBE_VOICE_DRAFT"] = 142] = "TRANSCRIBE_VOICE_DRAFT";
6507
+ Method2[Method2["REQUEST_BOT_FILESYSTEM"] = 143] = "REQUEST_BOT_FILESYSTEM";
6508
+ Method2[Method2["ANSWER_BOT_FILESYSTEM"] = 144] = "ANSWER_BOT_FILESYSTEM";
6509
+ Method2[Method2["SET_SPACE_PHOTO"] = 145] = "SET_SPACE_PHOTO";
6461
6510
  })(Method || (Method = {}));
6462
6511
  var GridConnectionUnavailableReason;
6463
6512
  (function(GridConnectionUnavailableReason2) {
@@ -6926,7 +6975,8 @@ class BotEvent$Type extends import_runtime4.MessageType {
6926
6975
  constructor() {
6927
6976
  super("BotEvent", [
6928
6977
  { no: 1, name: "chat_settings_requested", kind: "message", oneof: "event", T: () => BotChatSettingsRequested },
6929
- { no: 2, name: "chat_settings_item_invoked", kind: "message", oneof: "event", T: () => BotChatSettingsItemInvoked }
6978
+ { no: 2, name: "chat_settings_item_invoked", kind: "message", oneof: "event", T: () => BotChatSettingsItemInvoked },
6979
+ { no: 3, name: "filesystem_requested", kind: "message", oneof: "event", T: () => BotFilesystemRequested }
6930
6980
  ]);
6931
6981
  }
6932
6982
  create(value) {
@@ -6953,6 +7003,12 @@ class BotEvent$Type extends import_runtime4.MessageType {
6953
7003
  chatSettingsItemInvoked: BotChatSettingsItemInvoked.internalBinaryRead(reader, reader.uint32(), options, message.event.chatSettingsItemInvoked)
6954
7004
  };
6955
7005
  break;
7006
+ case 3:
7007
+ message.event = {
7008
+ oneofKind: "filesystemRequested",
7009
+ filesystemRequested: BotFilesystemRequested.internalBinaryRead(reader, reader.uint32(), options, message.event.filesystemRequested)
7010
+ };
7011
+ break;
6956
7012
  default:
6957
7013
  let u = options.readUnknownField;
6958
7014
  if (u === "throw")
@@ -6969,6 +7025,8 @@ class BotEvent$Type extends import_runtime4.MessageType {
6969
7025
  BotChatSettingsRequested.internalBinaryWrite(message.event.chatSettingsRequested, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
6970
7026
  if (message.event.oneofKind === "chatSettingsItemInvoked")
6971
7027
  BotChatSettingsItemInvoked.internalBinaryWrite(message.event.chatSettingsItemInvoked, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
7028
+ if (message.event.oneofKind === "filesystemRequested")
7029
+ BotFilesystemRequested.internalBinaryWrite(message.event.filesystemRequested, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
6972
7030
  let u = options.writeUnknownFields;
6973
7031
  if (u !== false)
6974
7032
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -8125,7 +8183,8 @@ class Dialog$Type extends import_runtime4.MessageType {
8125
8183
  { no: 15, name: "pinned_order", kind: "scalar", opt: true, T: 9 },
8126
8184
  { no: 16, name: "follow_mode", kind: "enum", opt: true, T: () => ["DialogFollowMode", DialogFollowMode] },
8127
8185
  { no: 17, name: "collapsed_max_id", kind: "scalar", opt: true, T: 3, L: 0 },
8128
- { no: 18, name: "folder_id", kind: "scalar", opt: true, T: 3, L: 0 }
8186
+ { no: 18, name: "folder_id", kind: "scalar", opt: true, T: 3, L: 0 },
8187
+ { no: 19, name: "translation_enabled", kind: "scalar", opt: true, T: 8 }
8129
8188
  ]);
8130
8189
  }
8131
8190
  create(value) {
@@ -8193,6 +8252,9 @@ class Dialog$Type extends import_runtime4.MessageType {
8193
8252
  case 18:
8194
8253
  message.folderId = reader.int64().toBigInt();
8195
8254
  break;
8255
+ case 19:
8256
+ message.translationEnabled = reader.bool();
8257
+ break;
8196
8258
  default:
8197
8259
  let u = options.readUnknownField;
8198
8260
  if (u === "throw")
@@ -8241,6 +8303,8 @@ class Dialog$Type extends import_runtime4.MessageType {
8241
8303
  writer.tag(17, import_runtime.WireType.Varint).int64(message.collapsedMaxId);
8242
8304
  if (message.folderId !== undefined)
8243
8305
  writer.tag(18, import_runtime.WireType.Varint).int64(message.folderId);
8306
+ if (message.translationEnabled !== undefined)
8307
+ writer.tag(19, import_runtime.WireType.Varint).bool(message.translationEnabled);
8244
8308
  let u = options.writeUnknownFields;
8245
8309
  if (u !== false)
8246
8310
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -9981,13 +10045,15 @@ class BlockDisclosure$Type extends import_runtime4.MessageType {
9981
10045
  { no: 2, name: "kind", kind: "enum", T: () => ["BlockDisclosure.Kind", BlockDisclosure_Kind, "KIND_"] },
9982
10046
  { no: 3, name: "initially_open", kind: "scalar", opt: true, T: 8 },
9983
10047
  { no: 4, name: "children", kind: "message", repeat: 1, T: () => Block },
9984
- { no: 5, name: "is_rtl", kind: "scalar", opt: true, T: 8 }
10048
+ { no: 5, name: "is_rtl", kind: "scalar", opt: true, T: 8 },
10049
+ { no: 6, name: "activity_kind", kind: "enum", T: () => ["BlockDisclosure.ActivityKind", BlockDisclosure_ActivityKind, "ACTIVITY_KIND_"] }
9985
10050
  ]);
9986
10051
  }
9987
10052
  create(value) {
9988
10053
  const message = globalThis.Object.create(this.messagePrototype);
9989
10054
  message.kind = 0;
9990
10055
  message.children = [];
10056
+ message.activityKind = 0;
9991
10057
  if (value !== undefined)
9992
10058
  import_runtime3.reflectionMergePartial(this, message, value);
9993
10059
  return message;
@@ -10012,6 +10078,9 @@ class BlockDisclosure$Type extends import_runtime4.MessageType {
10012
10078
  case 5:
10013
10079
  message.isRtl = reader.bool();
10014
10080
  break;
10081
+ case 6:
10082
+ message.activityKind = reader.int32();
10083
+ break;
10015
10084
  default:
10016
10085
  let u = options.readUnknownField;
10017
10086
  if (u === "throw")
@@ -10034,6 +10103,8 @@ class BlockDisclosure$Type extends import_runtime4.MessageType {
10034
10103
  Block.internalBinaryWrite(message.children[i], writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
10035
10104
  if (message.isRtl !== undefined)
10036
10105
  writer.tag(5, import_runtime.WireType.Varint).bool(message.isRtl);
10106
+ if (message.activityKind !== 0)
10107
+ writer.tag(6, import_runtime.WireType.Varint).int32(message.activityKind);
10037
10108
  let u = options.writeUnknownFields;
10038
10109
  if (u !== false)
10039
10110
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -11245,7 +11316,10 @@ class Space$Type extends import_runtime4.MessageType {
11245
11316
  { no: 4, name: "date", kind: "scalar", T: 3, L: 0 },
11246
11317
  { no: 5, name: "is_public", kind: "scalar", opt: true, T: 8 },
11247
11318
  { no: 6, name: "handle", kind: "scalar", opt: true, T: 9 },
11248
- { no: 7, name: "seq", kind: "scalar", opt: true, T: 5 }
11319
+ { no: 7, name: "seq", kind: "scalar", opt: true, T: 5 },
11320
+ { no: 8, name: "photo_file_unique_id", kind: "scalar", opt: true, T: 9 },
11321
+ { no: 9, name: "photo_url", kind: "scalar", opt: true, T: 9 },
11322
+ { no: 10, name: "is_pro", kind: "scalar", opt: true, T: 8 }
11249
11323
  ]);
11250
11324
  }
11251
11325
  create(value) {
@@ -11284,6 +11358,15 @@ class Space$Type extends import_runtime4.MessageType {
11284
11358
  case 7:
11285
11359
  message.seq = reader.int32();
11286
11360
  break;
11361
+ case 8:
11362
+ message.photoFileUniqueId = reader.string();
11363
+ break;
11364
+ case 9:
11365
+ message.photoUrl = reader.string();
11366
+ break;
11367
+ case 10:
11368
+ message.isPro = reader.bool();
11369
+ break;
11287
11370
  default:
11288
11371
  let u = options.readUnknownField;
11289
11372
  if (u === "throw")
@@ -11310,6 +11393,12 @@ class Space$Type extends import_runtime4.MessageType {
11310
11393
  writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.handle);
11311
11394
  if (message.seq !== undefined)
11312
11395
  writer.tag(7, import_runtime.WireType.Varint).int32(message.seq);
11396
+ if (message.photoFileUniqueId !== undefined)
11397
+ writer.tag(8, import_runtime.WireType.LengthDelimited).string(message.photoFileUniqueId);
11398
+ if (message.photoUrl !== undefined)
11399
+ writer.tag(9, import_runtime.WireType.LengthDelimited).string(message.photoUrl);
11400
+ if (message.isPro !== undefined)
11401
+ writer.tag(10, import_runtime.WireType.Varint).bool(message.isPro);
11313
11402
  let u = options.writeUnknownFields;
11314
11403
  if (u !== false)
11315
11404
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -14366,7 +14455,12 @@ class RpcCall$Type extends import_runtime4.MessageType {
14366
14455
  { no: 138, name: "acknowledgeMessages", kind: "message", oneof: "input", T: () => AcknowledgeMessagesInput },
14367
14456
  { no: 139, name: "getUsers", kind: "message", oneof: "input", T: () => GetUsersInput },
14368
14457
  { no: 140, name: "getBotSkills", kind: "message", oneof: "input", T: () => GetBotSkillsInput },
14369
- { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "input", T: () => GetBotConfigurationCatalogInput }
14458
+ { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "input", T: () => GetBotConfigurationCatalogInput },
14459
+ { no: 142, name: "updateDialogTranslation", kind: "message", oneof: "input", T: () => UpdateDialogTranslationInput },
14460
+ { no: 143, name: "transcribeVoiceDraft", kind: "message", oneof: "input", T: () => TranscribeVoiceDraftInput },
14461
+ { no: 144, name: "requestBotFilesystem", kind: "message", oneof: "input", T: () => RequestBotFilesystemInput },
14462
+ { no: 145, name: "answerBotFilesystem", kind: "message", oneof: "input", T: () => AnswerBotFilesystemInput },
14463
+ { no: 146, name: "setSpacePhoto", kind: "message", oneof: "input", T: () => SetSpacePhotoInput }
14370
14464
  ]);
14371
14465
  }
14372
14466
  create(value) {
@@ -15219,6 +15313,36 @@ class RpcCall$Type extends import_runtime4.MessageType {
15219
15313
  getBotConfigurationCatalog: GetBotConfigurationCatalogInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getBotConfigurationCatalog)
15220
15314
  };
15221
15315
  break;
15316
+ case 142:
15317
+ message.input = {
15318
+ oneofKind: "updateDialogTranslation",
15319
+ updateDialogTranslation: UpdateDialogTranslationInput.internalBinaryRead(reader, reader.uint32(), options, message.input.updateDialogTranslation)
15320
+ };
15321
+ break;
15322
+ case 143:
15323
+ message.input = {
15324
+ oneofKind: "transcribeVoiceDraft",
15325
+ transcribeVoiceDraft: TranscribeVoiceDraftInput.internalBinaryRead(reader, reader.uint32(), options, message.input.transcribeVoiceDraft)
15326
+ };
15327
+ break;
15328
+ case 144:
15329
+ message.input = {
15330
+ oneofKind: "requestBotFilesystem",
15331
+ requestBotFilesystem: RequestBotFilesystemInput.internalBinaryRead(reader, reader.uint32(), options, message.input.requestBotFilesystem)
15332
+ };
15333
+ break;
15334
+ case 145:
15335
+ message.input = {
15336
+ oneofKind: "answerBotFilesystem",
15337
+ answerBotFilesystem: AnswerBotFilesystemInput.internalBinaryRead(reader, reader.uint32(), options, message.input.answerBotFilesystem)
15338
+ };
15339
+ break;
15340
+ case 146:
15341
+ message.input = {
15342
+ oneofKind: "setSpacePhoto",
15343
+ setSpacePhoto: SetSpacePhotoInput.internalBinaryRead(reader, reader.uint32(), options, message.input.setSpacePhoto)
15344
+ };
15345
+ break;
15222
15346
  default:
15223
15347
  let u = options.readUnknownField;
15224
15348
  if (u === "throw")
@@ -15511,6 +15635,16 @@ class RpcCall$Type extends import_runtime4.MessageType {
15511
15635
  GetBotSkillsInput.internalBinaryWrite(message.input.getBotSkills, writer.tag(140, import_runtime.WireType.LengthDelimited).fork(), options).join();
15512
15636
  if (message.input.oneofKind === "getBotConfigurationCatalog")
15513
15637
  GetBotConfigurationCatalogInput.internalBinaryWrite(message.input.getBotConfigurationCatalog, writer.tag(141, import_runtime.WireType.LengthDelimited).fork(), options).join();
15638
+ if (message.input.oneofKind === "updateDialogTranslation")
15639
+ UpdateDialogTranslationInput.internalBinaryWrite(message.input.updateDialogTranslation, writer.tag(142, import_runtime.WireType.LengthDelimited).fork(), options).join();
15640
+ if (message.input.oneofKind === "transcribeVoiceDraft")
15641
+ TranscribeVoiceDraftInput.internalBinaryWrite(message.input.transcribeVoiceDraft, writer.tag(143, import_runtime.WireType.LengthDelimited).fork(), options).join();
15642
+ if (message.input.oneofKind === "requestBotFilesystem")
15643
+ RequestBotFilesystemInput.internalBinaryWrite(message.input.requestBotFilesystem, writer.tag(144, import_runtime.WireType.LengthDelimited).fork(), options).join();
15644
+ if (message.input.oneofKind === "answerBotFilesystem")
15645
+ AnswerBotFilesystemInput.internalBinaryWrite(message.input.answerBotFilesystem, writer.tag(145, import_runtime.WireType.LengthDelimited).fork(), options).join();
15646
+ if (message.input.oneofKind === "setSpacePhoto")
15647
+ SetSpacePhotoInput.internalBinaryWrite(message.input.setSpacePhoto, writer.tag(146, import_runtime.WireType.LengthDelimited).fork(), options).join();
15514
15648
  let u = options.writeUnknownFields;
15515
15649
  if (u !== false)
15516
15650
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -15661,7 +15795,12 @@ class RpcResult$Type extends import_runtime4.MessageType {
15661
15795
  { no: 138, name: "acknowledgeMessages", kind: "message", oneof: "result", T: () => AcknowledgeMessagesResult },
15662
15796
  { no: 139, name: "getUsers", kind: "message", oneof: "result", T: () => GetUsersResult },
15663
15797
  { no: 140, name: "getBotSkills", kind: "message", oneof: "result", T: () => GetBotSkillsResult },
15664
- { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "result", T: () => GetBotConfigurationCatalogResult }
15798
+ { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "result", T: () => GetBotConfigurationCatalogResult },
15799
+ { no: 142, name: "updateDialogTranslation", kind: "message", oneof: "result", T: () => UpdateDialogTranslationResult },
15800
+ { no: 143, name: "transcribeVoiceDraft", kind: "message", oneof: "result", T: () => TranscribeVoiceDraftResult },
15801
+ { no: 144, name: "requestBotFilesystem", kind: "message", oneof: "result", T: () => RequestBotFilesystemResult },
15802
+ { no: 145, name: "answerBotFilesystem", kind: "message", oneof: "result", T: () => AnswerBotFilesystemResult },
15803
+ { no: 146, name: "setSpacePhoto", kind: "message", oneof: "result", T: () => SetSpacePhotoResult }
15665
15804
  ]);
15666
15805
  }
15667
15806
  create(value) {
@@ -16514,6 +16653,36 @@ class RpcResult$Type extends import_runtime4.MessageType {
16514
16653
  getBotConfigurationCatalog: GetBotConfigurationCatalogResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getBotConfigurationCatalog)
16515
16654
  };
16516
16655
  break;
16656
+ case 142:
16657
+ message.result = {
16658
+ oneofKind: "updateDialogTranslation",
16659
+ updateDialogTranslation: UpdateDialogTranslationResult.internalBinaryRead(reader, reader.uint32(), options, message.result.updateDialogTranslation)
16660
+ };
16661
+ break;
16662
+ case 143:
16663
+ message.result = {
16664
+ oneofKind: "transcribeVoiceDraft",
16665
+ transcribeVoiceDraft: TranscribeVoiceDraftResult.internalBinaryRead(reader, reader.uint32(), options, message.result.transcribeVoiceDraft)
16666
+ };
16667
+ break;
16668
+ case 144:
16669
+ message.result = {
16670
+ oneofKind: "requestBotFilesystem",
16671
+ requestBotFilesystem: RequestBotFilesystemResult.internalBinaryRead(reader, reader.uint32(), options, message.result.requestBotFilesystem)
16672
+ };
16673
+ break;
16674
+ case 145:
16675
+ message.result = {
16676
+ oneofKind: "answerBotFilesystem",
16677
+ answerBotFilesystem: AnswerBotFilesystemResult.internalBinaryRead(reader, reader.uint32(), options, message.result.answerBotFilesystem)
16678
+ };
16679
+ break;
16680
+ case 146:
16681
+ message.result = {
16682
+ oneofKind: "setSpacePhoto",
16683
+ setSpacePhoto: SetSpacePhotoResult.internalBinaryRead(reader, reader.uint32(), options, message.result.setSpacePhoto)
16684
+ };
16685
+ break;
16517
16686
  default:
16518
16687
  let u = options.readUnknownField;
16519
16688
  if (u === "throw")
@@ -16806,6 +16975,16 @@ class RpcResult$Type extends import_runtime4.MessageType {
16806
16975
  GetBotSkillsResult.internalBinaryWrite(message.result.getBotSkills, writer.tag(140, import_runtime.WireType.LengthDelimited).fork(), options).join();
16807
16976
  if (message.result.oneofKind === "getBotConfigurationCatalog")
16808
16977
  GetBotConfigurationCatalogResult.internalBinaryWrite(message.result.getBotConfigurationCatalog, writer.tag(141, import_runtime.WireType.LengthDelimited).fork(), options).join();
16978
+ if (message.result.oneofKind === "updateDialogTranslation")
16979
+ UpdateDialogTranslationResult.internalBinaryWrite(message.result.updateDialogTranslation, writer.tag(142, import_runtime.WireType.LengthDelimited).fork(), options).join();
16980
+ if (message.result.oneofKind === "transcribeVoiceDraft")
16981
+ TranscribeVoiceDraftResult.internalBinaryWrite(message.result.transcribeVoiceDraft, writer.tag(143, import_runtime.WireType.LengthDelimited).fork(), options).join();
16982
+ if (message.result.oneofKind === "requestBotFilesystem")
16983
+ RequestBotFilesystemResult.internalBinaryWrite(message.result.requestBotFilesystem, writer.tag(144, import_runtime.WireType.LengthDelimited).fork(), options).join();
16984
+ if (message.result.oneofKind === "answerBotFilesystem")
16985
+ AnswerBotFilesystemResult.internalBinaryWrite(message.result.answerBotFilesystem, writer.tag(145, import_runtime.WireType.LengthDelimited).fork(), options).join();
16986
+ if (message.result.oneofKind === "setSpacePhoto")
16987
+ SetSpacePhotoResult.internalBinaryWrite(message.result.setSpacePhoto, writer.tag(146, import_runtime.WireType.LengthDelimited).fork(), options).join();
16809
16988
  let u = options.writeUnknownFields;
16810
16989
  if (u !== false)
16811
16990
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -20370,6 +20549,153 @@ class UpdateDialogFollowModeResult$Type extends import_runtime4.MessageType {
20370
20549
  }
20371
20550
  var UpdateDialogFollowModeResult = new UpdateDialogFollowModeResult$Type;
20372
20551
 
20552
+ class UpdateDialogTranslationInput$Type extends import_runtime4.MessageType {
20553
+ constructor() {
20554
+ super("UpdateDialogTranslationInput", [
20555
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
20556
+ { no: 2, name: "enabled", kind: "scalar", opt: true, T: 8 },
20557
+ { no: 3, name: "import_legacy_enabled", kind: "scalar", T: 8 }
20558
+ ]);
20559
+ }
20560
+ create(value) {
20561
+ const message = globalThis.Object.create(this.messagePrototype);
20562
+ message.importLegacyEnabled = false;
20563
+ if (value !== undefined)
20564
+ import_runtime3.reflectionMergePartial(this, message, value);
20565
+ return message;
20566
+ }
20567
+ internalBinaryRead(reader, length, options, target) {
20568
+ let message = target ?? this.create(), end = reader.pos + length;
20569
+ while (reader.pos < end) {
20570
+ let [fieldNo, wireType] = reader.tag();
20571
+ switch (fieldNo) {
20572
+ case 1:
20573
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
20574
+ break;
20575
+ case 2:
20576
+ message.enabled = reader.bool();
20577
+ break;
20578
+ case 3:
20579
+ message.importLegacyEnabled = reader.bool();
20580
+ break;
20581
+ default:
20582
+ let u = options.readUnknownField;
20583
+ if (u === "throw")
20584
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20585
+ let d = reader.skip(wireType);
20586
+ if (u !== false)
20587
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20588
+ }
20589
+ }
20590
+ return message;
20591
+ }
20592
+ internalBinaryWrite(message, writer, options) {
20593
+ if (message.peerId)
20594
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20595
+ if (message.enabled !== undefined)
20596
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.enabled);
20597
+ if (message.importLegacyEnabled !== false)
20598
+ writer.tag(3, import_runtime.WireType.Varint).bool(message.importLegacyEnabled);
20599
+ let u = options.writeUnknownFields;
20600
+ if (u !== false)
20601
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20602
+ return writer;
20603
+ }
20604
+ }
20605
+ var UpdateDialogTranslationInput = new UpdateDialogTranslationInput$Type;
20606
+
20607
+ class UpdateDialogTranslationResult$Type extends import_runtime4.MessageType {
20608
+ constructor() {
20609
+ super("UpdateDialogTranslationResult", [
20610
+ { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
20611
+ ]);
20612
+ }
20613
+ create(value) {
20614
+ const message = globalThis.Object.create(this.messagePrototype);
20615
+ message.updates = [];
20616
+ if (value !== undefined)
20617
+ import_runtime3.reflectionMergePartial(this, message, value);
20618
+ return message;
20619
+ }
20620
+ internalBinaryRead(reader, length, options, target) {
20621
+ let message = target ?? this.create(), end = reader.pos + length;
20622
+ while (reader.pos < end) {
20623
+ let [fieldNo, wireType] = reader.tag();
20624
+ switch (fieldNo) {
20625
+ case 1:
20626
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
20627
+ break;
20628
+ default:
20629
+ let u = options.readUnknownField;
20630
+ if (u === "throw")
20631
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20632
+ let d = reader.skip(wireType);
20633
+ if (u !== false)
20634
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20635
+ }
20636
+ }
20637
+ return message;
20638
+ }
20639
+ internalBinaryWrite(message, writer, options) {
20640
+ for (let i = 0;i < message.updates.length; i++)
20641
+ Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20642
+ let u = options.writeUnknownFields;
20643
+ if (u !== false)
20644
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20645
+ return writer;
20646
+ }
20647
+ }
20648
+ var UpdateDialogTranslationResult = new UpdateDialogTranslationResult$Type;
20649
+
20650
+ class UpdateDialogTranslation$Type extends import_runtime4.MessageType {
20651
+ constructor() {
20652
+ super("UpdateDialogTranslation", [
20653
+ { no: 1, name: "peer_id", kind: "message", T: () => Peer },
20654
+ { no: 2, name: "enabled", kind: "scalar", T: 8 }
20655
+ ]);
20656
+ }
20657
+ create(value) {
20658
+ const message = globalThis.Object.create(this.messagePrototype);
20659
+ message.enabled = false;
20660
+ if (value !== undefined)
20661
+ import_runtime3.reflectionMergePartial(this, message, value);
20662
+ return message;
20663
+ }
20664
+ internalBinaryRead(reader, length, options, target) {
20665
+ let message = target ?? this.create(), end = reader.pos + length;
20666
+ while (reader.pos < end) {
20667
+ let [fieldNo, wireType] = reader.tag();
20668
+ switch (fieldNo) {
20669
+ case 1:
20670
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
20671
+ break;
20672
+ case 2:
20673
+ message.enabled = reader.bool();
20674
+ break;
20675
+ default:
20676
+ let u = options.readUnknownField;
20677
+ if (u === "throw")
20678
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20679
+ let d = reader.skip(wireType);
20680
+ if (u !== false)
20681
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20682
+ }
20683
+ }
20684
+ return message;
20685
+ }
20686
+ internalBinaryWrite(message, writer, options) {
20687
+ if (message.peerId)
20688
+ Peer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20689
+ if (message.enabled !== false)
20690
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.enabled);
20691
+ let u = options.writeUnknownFields;
20692
+ if (u !== false)
20693
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20694
+ return writer;
20695
+ }
20696
+ }
20697
+ var UpdateDialogTranslation = new UpdateDialogTranslation$Type;
20698
+
20373
20699
  class CollapseHistoryInput$Type extends import_runtime4.MessageType {
20374
20700
  constructor() {
20375
20701
  super("CollapseHistoryInput", [
@@ -23853,7 +24179,8 @@ class UserSettings$Type extends import_runtime4.MessageType {
23853
24179
  super("UserSettings", [
23854
24180
  { no: 1, name: "notification_settings", kind: "message", T: () => NotificationSettings },
23855
24181
  { no: 2, name: "privacy_settings", kind: "message", T: () => PrivacySettings },
23856
- { no: 3, name: "compose_settings", kind: "message", T: () => ComposeSettings }
24182
+ { no: 3, name: "compose_settings", kind: "message", T: () => ComposeSettings },
24183
+ { no: 4, name: "message_gesture_settings", kind: "message", T: () => MessageGestureSettings }
23857
24184
  ]);
23858
24185
  }
23859
24186
  create(value) {
@@ -23876,6 +24203,9 @@ class UserSettings$Type extends import_runtime4.MessageType {
23876
24203
  case 3:
23877
24204
  message.composeSettings = ComposeSettings.internalBinaryRead(reader, reader.uint32(), options, message.composeSettings);
23878
24205
  break;
24206
+ case 4:
24207
+ message.messageGestureSettings = MessageGestureSettings.internalBinaryRead(reader, reader.uint32(), options, message.messageGestureSettings);
24208
+ break;
23879
24209
  default:
23880
24210
  let u = options.readUnknownField;
23881
24211
  if (u === "throw")
@@ -23894,6 +24224,8 @@ class UserSettings$Type extends import_runtime4.MessageType {
23894
24224
  PrivacySettings.internalBinaryWrite(message.privacySettings, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
23895
24225
  if (message.composeSettings)
23896
24226
  ComposeSettings.internalBinaryWrite(message.composeSettings, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
24227
+ if (message.messageGestureSettings)
24228
+ MessageGestureSettings.internalBinaryWrite(message.messageGestureSettings, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
23897
24229
  let u = options.writeUnknownFields;
23898
24230
  if (u !== false)
23899
24231
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -23902,6 +24234,60 @@ class UserSettings$Type extends import_runtime4.MessageType {
23902
24234
  }
23903
24235
  var UserSettings = new UserSettings$Type;
23904
24236
 
24237
+ class MessageGestureSettings$Type extends import_runtime4.MessageType {
24238
+ constructor() {
24239
+ super("MessageGestureSettings", [
24240
+ { no: 1, name: "double_tap_action", kind: "scalar", opt: true, T: 9 },
24241
+ { no: 2, name: "hold_action", kind: "scalar", opt: true, T: 9 },
24242
+ { no: 3, name: "swipe_to_reply_direction", kind: "scalar", opt: true, T: 9 }
24243
+ ]);
24244
+ }
24245
+ create(value) {
24246
+ const message = globalThis.Object.create(this.messagePrototype);
24247
+ if (value !== undefined)
24248
+ import_runtime3.reflectionMergePartial(this, message, value);
24249
+ return message;
24250
+ }
24251
+ internalBinaryRead(reader, length, options, target) {
24252
+ let message = target ?? this.create(), end = reader.pos + length;
24253
+ while (reader.pos < end) {
24254
+ let [fieldNo, wireType] = reader.tag();
24255
+ switch (fieldNo) {
24256
+ case 1:
24257
+ message.doubleTapAction = reader.string();
24258
+ break;
24259
+ case 2:
24260
+ message.holdAction = reader.string();
24261
+ break;
24262
+ case 3:
24263
+ message.swipeToReplyDirection = reader.string();
24264
+ break;
24265
+ default:
24266
+ let u = options.readUnknownField;
24267
+ if (u === "throw")
24268
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
24269
+ let d = reader.skip(wireType);
24270
+ if (u !== false)
24271
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
24272
+ }
24273
+ }
24274
+ return message;
24275
+ }
24276
+ internalBinaryWrite(message, writer, options) {
24277
+ if (message.doubleTapAction !== undefined)
24278
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.doubleTapAction);
24279
+ if (message.holdAction !== undefined)
24280
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.holdAction);
24281
+ if (message.swipeToReplyDirection !== undefined)
24282
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.swipeToReplyDirection);
24283
+ let u = options.writeUnknownFields;
24284
+ if (u !== false)
24285
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
24286
+ return writer;
24287
+ }
24288
+ }
24289
+ var MessageGestureSettings = new MessageGestureSettings$Type;
24290
+
23905
24291
  class ComposeSettings$Type extends import_runtime4.MessageType {
23906
24292
  constructor() {
23907
24293
  super("ComposeSettings", [
@@ -28667,7 +29053,8 @@ var CreateExternalTaskResult = new CreateExternalTaskResult$Type;
28667
29053
  class CreateSpaceInput$Type extends import_runtime4.MessageType {
28668
29054
  constructor() {
28669
29055
  super("CreateSpaceInput", [
28670
- { no: 1, name: "name", kind: "scalar", T: 9 }
29056
+ { no: 1, name: "name", kind: "scalar", T: 9 },
29057
+ { no: 2, name: "photo_file_unique_id", kind: "scalar", opt: true, T: 9 }
28671
29058
  ]);
28672
29059
  }
28673
29060
  create(value) {
@@ -28685,6 +29072,9 @@ class CreateSpaceInput$Type extends import_runtime4.MessageType {
28685
29072
  case 1:
28686
29073
  message.name = reader.string();
28687
29074
  break;
29075
+ case 2:
29076
+ message.photoFileUniqueId = reader.string();
29077
+ break;
28688
29078
  default:
28689
29079
  let u = options.readUnknownField;
28690
29080
  if (u === "throw")
@@ -28699,6 +29089,8 @@ class CreateSpaceInput$Type extends import_runtime4.MessageType {
28699
29089
  internalBinaryWrite(message, writer, options) {
28700
29090
  if (message.name !== "")
28701
29091
  writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.name);
29092
+ if (message.photoFileUniqueId !== undefined)
29093
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.photoFileUniqueId);
28702
29094
  let u = options.writeUnknownFields;
28703
29095
  if (u !== false)
28704
29096
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -28707,17 +29099,17 @@ class CreateSpaceInput$Type extends import_runtime4.MessageType {
28707
29099
  }
28708
29100
  var CreateSpaceInput = new CreateSpaceInput$Type;
28709
29101
 
28710
- class CreateSpaceResult$Type extends import_runtime4.MessageType {
29102
+ class SetSpacePhotoInput$Type extends import_runtime4.MessageType {
28711
29103
  constructor() {
28712
- super("CreateSpaceResult", [
28713
- { no: 1, name: "space", kind: "message", T: () => Space },
28714
- { no: 2, name: "member", kind: "message", T: () => Member },
28715
- { no: 3, name: "chat", kind: "message", T: () => Chat },
28716
- { no: 4, name: "dialog", kind: "message", T: () => Dialog }
29104
+ super("SetSpacePhotoInput", [
29105
+ { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 },
29106
+ { no: 2, name: "file_unique_id", kind: "scalar", T: 9 }
28717
29107
  ]);
28718
29108
  }
28719
29109
  create(value) {
28720
29110
  const message = globalThis.Object.create(this.messagePrototype);
29111
+ message.spaceId = 0n;
29112
+ message.fileUniqueId = "";
28721
29113
  if (value !== undefined)
28722
29114
  import_runtime3.reflectionMergePartial(this, message, value);
28723
29115
  return message;
@@ -28728,16 +29120,59 @@ class CreateSpaceResult$Type extends import_runtime4.MessageType {
28728
29120
  let [fieldNo, wireType] = reader.tag();
28729
29121
  switch (fieldNo) {
28730
29122
  case 1:
28731
- message.space = Space.internalBinaryRead(reader, reader.uint32(), options, message.space);
29123
+ message.spaceId = reader.int64().toBigInt();
28732
29124
  break;
28733
29125
  case 2:
28734
- message.member = Member.internalBinaryRead(reader, reader.uint32(), options, message.member);
29126
+ message.fileUniqueId = reader.string();
28735
29127
  break;
28736
- case 3:
28737
- message.chat = Chat.internalBinaryRead(reader, reader.uint32(), options, message.chat);
29128
+ default:
29129
+ let u = options.readUnknownField;
29130
+ if (u === "throw")
29131
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
29132
+ let d = reader.skip(wireType);
29133
+ if (u !== false)
29134
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
29135
+ }
29136
+ }
29137
+ return message;
29138
+ }
29139
+ internalBinaryWrite(message, writer, options) {
29140
+ if (message.spaceId !== 0n)
29141
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
29142
+ if (message.fileUniqueId !== "")
29143
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
29144
+ let u = options.writeUnknownFields;
29145
+ if (u !== false)
29146
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
29147
+ return writer;
29148
+ }
29149
+ }
29150
+ var SetSpacePhotoInput = new SetSpacePhotoInput$Type;
29151
+
29152
+ class SetSpacePhotoResult$Type extends import_runtime4.MessageType {
29153
+ constructor() {
29154
+ super("SetSpacePhotoResult", [
29155
+ { no: 1, name: "space", kind: "message", T: () => Space },
29156
+ { no: 2, name: "updates", kind: "message", repeat: 1, T: () => Update }
29157
+ ]);
29158
+ }
29159
+ create(value) {
29160
+ const message = globalThis.Object.create(this.messagePrototype);
29161
+ message.updates = [];
29162
+ if (value !== undefined)
29163
+ import_runtime3.reflectionMergePartial(this, message, value);
29164
+ return message;
29165
+ }
29166
+ internalBinaryRead(reader, length, options, target) {
29167
+ let message = target ?? this.create(), end = reader.pos + length;
29168
+ while (reader.pos < end) {
29169
+ let [fieldNo, wireType] = reader.tag();
29170
+ switch (fieldNo) {
29171
+ case 1:
29172
+ message.space = Space.internalBinaryRead(reader, reader.uint32(), options, message.space);
28738
29173
  break;
28739
- case 4:
28740
- message.dialog = Dialog.internalBinaryRead(reader, reader.uint32(), options, message.dialog);
29174
+ case 2:
29175
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
28741
29176
  break;
28742
29177
  default:
28743
29178
  let u = options.readUnknownField;
@@ -28753,29 +29188,29 @@ class CreateSpaceResult$Type extends import_runtime4.MessageType {
28753
29188
  internalBinaryWrite(message, writer, options) {
28754
29189
  if (message.space)
28755
29190
  Space.internalBinaryWrite(message.space, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
28756
- if (message.member)
28757
- Member.internalBinaryWrite(message.member, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
28758
- if (message.chat)
28759
- Chat.internalBinaryWrite(message.chat, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
28760
- if (message.dialog)
28761
- Dialog.internalBinaryWrite(message.dialog, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
29191
+ for (let i = 0;i < message.updates.length; i++)
29192
+ Update.internalBinaryWrite(message.updates[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
28762
29193
  let u = options.writeUnknownFields;
28763
29194
  if (u !== false)
28764
29195
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
28765
29196
  return writer;
28766
29197
  }
28767
29198
  }
28768
- var CreateSpaceResult = new CreateSpaceResult$Type;
29199
+ var SetSpacePhotoResult = new SetSpacePhotoResult$Type;
28769
29200
 
28770
- class DeleteSpaceInput$Type extends import_runtime4.MessageType {
29201
+ class UpdateSpaceProfile$Type extends import_runtime4.MessageType {
28771
29202
  constructor() {
28772
- super("DeleteSpaceInput", [
28773
- { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 }
29203
+ super("UpdateSpaceProfile", [
29204
+ { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 },
29205
+ { no: 2, name: "photo_file_unique_id", kind: "scalar", opt: true, T: 9 },
29206
+ { no: 3, name: "photo_url", kind: "scalar", opt: true, T: 9 },
29207
+ { no: 4, name: "is_pro", kind: "scalar", T: 8 }
28774
29208
  ]);
28775
29209
  }
28776
29210
  create(value) {
28777
29211
  const message = globalThis.Object.create(this.messagePrototype);
28778
29212
  message.spaceId = 0n;
29213
+ message.isPro = false;
28779
29214
  if (value !== undefined)
28780
29215
  import_runtime3.reflectionMergePartial(this, message, value);
28781
29216
  return message;
@@ -28788,6 +29223,15 @@ class DeleteSpaceInput$Type extends import_runtime4.MessageType {
28788
29223
  case 1:
28789
29224
  message.spaceId = reader.int64().toBigInt();
28790
29225
  break;
29226
+ case 2:
29227
+ message.photoFileUniqueId = reader.string();
29228
+ break;
29229
+ case 3:
29230
+ message.photoUrl = reader.string();
29231
+ break;
29232
+ case 4:
29233
+ message.isPro = reader.bool();
29234
+ break;
28791
29235
  default:
28792
29236
  let u = options.readUnknownField;
28793
29237
  if (u === "throw")
@@ -28802,17 +29246,28 @@ class DeleteSpaceInput$Type extends import_runtime4.MessageType {
28802
29246
  internalBinaryWrite(message, writer, options) {
28803
29247
  if (message.spaceId !== 0n)
28804
29248
  writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
29249
+ if (message.photoFileUniqueId !== undefined)
29250
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.photoFileUniqueId);
29251
+ if (message.photoUrl !== undefined)
29252
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.photoUrl);
29253
+ if (message.isPro !== false)
29254
+ writer.tag(4, import_runtime.WireType.Varint).bool(message.isPro);
28805
29255
  let u = options.writeUnknownFields;
28806
29256
  if (u !== false)
28807
29257
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
28808
29258
  return writer;
28809
29259
  }
28810
29260
  }
28811
- var DeleteSpaceInput = new DeleteSpaceInput$Type;
29261
+ var UpdateSpaceProfile = new UpdateSpaceProfile$Type;
28812
29262
 
28813
- class DeleteSpaceResult$Type extends import_runtime4.MessageType {
29263
+ class CreateSpaceResult$Type extends import_runtime4.MessageType {
28814
29264
  constructor() {
28815
- super("DeleteSpaceResult", []);
29265
+ super("CreateSpaceResult", [
29266
+ { no: 1, name: "space", kind: "message", T: () => Space },
29267
+ { no: 2, name: "member", kind: "message", T: () => Member },
29268
+ { no: 3, name: "chat", kind: "message", T: () => Chat },
29269
+ { no: 4, name: "dialog", kind: "message", T: () => Dialog }
29270
+ ]);
28816
29271
  }
28817
29272
  create(value) {
28818
29273
  const message = globalThis.Object.create(this.messagePrototype);
@@ -28821,20 +29276,118 @@ class DeleteSpaceResult$Type extends import_runtime4.MessageType {
28821
29276
  return message;
28822
29277
  }
28823
29278
  internalBinaryRead(reader, length, options, target) {
28824
- return target ?? this.create();
29279
+ let message = target ?? this.create(), end = reader.pos + length;
29280
+ while (reader.pos < end) {
29281
+ let [fieldNo, wireType] = reader.tag();
29282
+ switch (fieldNo) {
29283
+ case 1:
29284
+ message.space = Space.internalBinaryRead(reader, reader.uint32(), options, message.space);
29285
+ break;
29286
+ case 2:
29287
+ message.member = Member.internalBinaryRead(reader, reader.uint32(), options, message.member);
29288
+ break;
29289
+ case 3:
29290
+ message.chat = Chat.internalBinaryRead(reader, reader.uint32(), options, message.chat);
29291
+ break;
29292
+ case 4:
29293
+ message.dialog = Dialog.internalBinaryRead(reader, reader.uint32(), options, message.dialog);
29294
+ break;
29295
+ default:
29296
+ let u = options.readUnknownField;
29297
+ if (u === "throw")
29298
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
29299
+ let d = reader.skip(wireType);
29300
+ if (u !== false)
29301
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
29302
+ }
29303
+ }
29304
+ return message;
28825
29305
  }
28826
29306
  internalBinaryWrite(message, writer, options) {
29307
+ if (message.space)
29308
+ Space.internalBinaryWrite(message.space, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
29309
+ if (message.member)
29310
+ Member.internalBinaryWrite(message.member, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
29311
+ if (message.chat)
29312
+ Chat.internalBinaryWrite(message.chat, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
29313
+ if (message.dialog)
29314
+ Dialog.internalBinaryWrite(message.dialog, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
28827
29315
  let u = options.writeUnknownFields;
28828
29316
  if (u !== false)
28829
29317
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
28830
29318
  return writer;
28831
29319
  }
28832
29320
  }
28833
- var DeleteSpaceResult = new DeleteSpaceResult$Type;
29321
+ var CreateSpaceResult = new CreateSpaceResult$Type;
28834
29322
 
28835
- class LeaveSpaceInput$Type extends import_runtime4.MessageType {
29323
+ class DeleteSpaceInput$Type extends import_runtime4.MessageType {
28836
29324
  constructor() {
28837
- super("LeaveSpaceInput", [
29325
+ super("DeleteSpaceInput", [
29326
+ { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 }
29327
+ ]);
29328
+ }
29329
+ create(value) {
29330
+ const message = globalThis.Object.create(this.messagePrototype);
29331
+ message.spaceId = 0n;
29332
+ if (value !== undefined)
29333
+ import_runtime3.reflectionMergePartial(this, message, value);
29334
+ return message;
29335
+ }
29336
+ internalBinaryRead(reader, length, options, target) {
29337
+ let message = target ?? this.create(), end = reader.pos + length;
29338
+ while (reader.pos < end) {
29339
+ let [fieldNo, wireType] = reader.tag();
29340
+ switch (fieldNo) {
29341
+ case 1:
29342
+ message.spaceId = reader.int64().toBigInt();
29343
+ break;
29344
+ default:
29345
+ let u = options.readUnknownField;
29346
+ if (u === "throw")
29347
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
29348
+ let d = reader.skip(wireType);
29349
+ if (u !== false)
29350
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
29351
+ }
29352
+ }
29353
+ return message;
29354
+ }
29355
+ internalBinaryWrite(message, writer, options) {
29356
+ if (message.spaceId !== 0n)
29357
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
29358
+ let u = options.writeUnknownFields;
29359
+ if (u !== false)
29360
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
29361
+ return writer;
29362
+ }
29363
+ }
29364
+ var DeleteSpaceInput = new DeleteSpaceInput$Type;
29365
+
29366
+ class DeleteSpaceResult$Type extends import_runtime4.MessageType {
29367
+ constructor() {
29368
+ super("DeleteSpaceResult", []);
29369
+ }
29370
+ create(value) {
29371
+ const message = globalThis.Object.create(this.messagePrototype);
29372
+ if (value !== undefined)
29373
+ import_runtime3.reflectionMergePartial(this, message, value);
29374
+ return message;
29375
+ }
29376
+ internalBinaryRead(reader, length, options, target) {
29377
+ return target ?? this.create();
29378
+ }
29379
+ internalBinaryWrite(message, writer, options) {
29380
+ let u = options.writeUnknownFields;
29381
+ if (u !== false)
29382
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
29383
+ return writer;
29384
+ }
29385
+ }
29386
+ var DeleteSpaceResult = new DeleteSpaceResult$Type;
29387
+
29388
+ class LeaveSpaceInput$Type extends import_runtime4.MessageType {
29389
+ constructor() {
29390
+ super("LeaveSpaceInput", [
28838
29391
  { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 }
28839
29392
  ]);
28840
29393
  }
@@ -29402,7 +29955,8 @@ class GetSpaceMembersResult$Type extends import_runtime4.MessageType {
29402
29955
  constructor() {
29403
29956
  super("GetSpaceMembersResult", [
29404
29957
  { no: 1, name: "members", kind: "message", repeat: 1, T: () => Member },
29405
- { no: 2, name: "users", kind: "message", repeat: 1, T: () => User }
29958
+ { no: 2, name: "users", kind: "message", repeat: 1, T: () => User },
29959
+ { no: 3, name: "seq", kind: "scalar", opt: true, T: 5 }
29406
29960
  ]);
29407
29961
  }
29408
29962
  create(value) {
@@ -29424,6 +29978,9 @@ class GetSpaceMembersResult$Type extends import_runtime4.MessageType {
29424
29978
  case 2:
29425
29979
  message.users.push(User.internalBinaryRead(reader, reader.uint32(), options));
29426
29980
  break;
29981
+ case 3:
29982
+ message.seq = reader.int32();
29983
+ break;
29427
29984
  default:
29428
29985
  let u = options.readUnknownField;
29429
29986
  if (u === "throw")
@@ -29440,6 +29997,8 @@ class GetSpaceMembersResult$Type extends import_runtime4.MessageType {
29440
29997
  Member.internalBinaryWrite(message.members[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
29441
29998
  for (let i = 0;i < message.users.length; i++)
29442
29999
  User.internalBinaryWrite(message.users[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
30000
+ if (message.seq !== undefined)
30001
+ writer.tag(3, import_runtime.WireType.Varint).int32(message.seq);
29443
30002
  let u = options.writeUnknownFields;
29444
30003
  if (u !== false)
29445
30004
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -29896,7 +30455,10 @@ class Update$Type extends import_runtime4.MessageType {
29896
30455
  { no: 46, name: "dialog_folder", kind: "message", oneof: "update", T: () => UpdateDialogFolder },
29897
30456
  { no: 47, name: "user_added_to_chat", kind: "message", oneof: "update", T: () => UpdateUserAddedToChat },
29898
30457
  { no: 48, name: "user_removed_from_chat", kind: "message", oneof: "update", T: () => UpdateUserRemovedFromChat },
29899
- { no: 49, name: "acknowledgement", kind: "message", oneof: "update", T: () => ChatAcknowledgement }
30458
+ { no: 49, name: "acknowledgement", kind: "message", oneof: "update", T: () => ChatAcknowledgement },
30459
+ { no: 50, name: "dialog_translation", kind: "message", oneof: "update", T: () => UpdateDialogTranslation },
30460
+ { no: 51, name: "space_profile", kind: "message", oneof: "update", T: () => UpdateSpaceProfile },
30461
+ { no: 52, name: "user_has_new_updates", kind: "message", oneof: "update", T: () => UpdateUserHasNewUpdates }
29900
30462
  ]);
29901
30463
  }
29902
30464
  create(value) {
@@ -30193,6 +30755,24 @@ class Update$Type extends import_runtime4.MessageType {
30193
30755
  acknowledgement: ChatAcknowledgement.internalBinaryRead(reader, reader.uint32(), options, message.update.acknowledgement)
30194
30756
  };
30195
30757
  break;
30758
+ case 50:
30759
+ message.update = {
30760
+ oneofKind: "dialogTranslation",
30761
+ dialogTranslation: UpdateDialogTranslation.internalBinaryRead(reader, reader.uint32(), options, message.update.dialogTranslation)
30762
+ };
30763
+ break;
30764
+ case 51:
30765
+ message.update = {
30766
+ oneofKind: "spaceProfile",
30767
+ spaceProfile: UpdateSpaceProfile.internalBinaryRead(reader, reader.uint32(), options, message.update.spaceProfile)
30768
+ };
30769
+ break;
30770
+ case 52:
30771
+ message.update = {
30772
+ oneofKind: "userHasNewUpdates",
30773
+ userHasNewUpdates: UpdateUserHasNewUpdates.internalBinaryRead(reader, reader.uint32(), options, message.update.userHasNewUpdates)
30774
+ };
30775
+ break;
30196
30776
  default:
30197
30777
  let u = options.readUnknownField;
30198
30778
  if (u === "throw")
@@ -30301,6 +30881,12 @@ class Update$Type extends import_runtime4.MessageType {
30301
30881
  UpdateUserRemovedFromChat.internalBinaryWrite(message.update.userRemovedFromChat, writer.tag(48, import_runtime.WireType.LengthDelimited).fork(), options).join();
30302
30882
  if (message.update.oneofKind === "acknowledgement")
30303
30883
  ChatAcknowledgement.internalBinaryWrite(message.update.acknowledgement, writer.tag(49, import_runtime.WireType.LengthDelimited).fork(), options).join();
30884
+ if (message.update.oneofKind === "dialogTranslation")
30885
+ UpdateDialogTranslation.internalBinaryWrite(message.update.dialogTranslation, writer.tag(50, import_runtime.WireType.LengthDelimited).fork(), options).join();
30886
+ if (message.update.oneofKind === "spaceProfile")
30887
+ UpdateSpaceProfile.internalBinaryWrite(message.update.spaceProfile, writer.tag(51, import_runtime.WireType.LengthDelimited).fork(), options).join();
30888
+ if (message.update.oneofKind === "userHasNewUpdates")
30889
+ UpdateUserHasNewUpdates.internalBinaryWrite(message.update.userHasNewUpdates, writer.tag(52, import_runtime.WireType.LengthDelimited).fork(), options).join();
30304
30890
  let u = options.writeUnknownFields;
30305
30891
  if (u !== false)
30306
30892
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -30421,6 +31007,49 @@ class UpdateSpaceHasNewUpdates$Type extends import_runtime4.MessageType {
30421
31007
  }
30422
31008
  var UpdateSpaceHasNewUpdates = new UpdateSpaceHasNewUpdates$Type;
30423
31009
 
31010
+ class UpdateUserHasNewUpdates$Type extends import_runtime4.MessageType {
31011
+ constructor() {
31012
+ super("UpdateUserHasNewUpdates", [
31013
+ { no: 1, name: "update_seq", kind: "scalar", T: 5 }
31014
+ ]);
31015
+ }
31016
+ create(value) {
31017
+ const message = globalThis.Object.create(this.messagePrototype);
31018
+ message.updateSeq = 0;
31019
+ if (value !== undefined)
31020
+ import_runtime3.reflectionMergePartial(this, message, value);
31021
+ return message;
31022
+ }
31023
+ internalBinaryRead(reader, length, options, target) {
31024
+ let message = target ?? this.create(), end = reader.pos + length;
31025
+ while (reader.pos < end) {
31026
+ let [fieldNo, wireType] = reader.tag();
31027
+ switch (fieldNo) {
31028
+ case 1:
31029
+ message.updateSeq = reader.int32();
31030
+ break;
31031
+ default:
31032
+ let u = options.readUnknownField;
31033
+ if (u === "throw")
31034
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
31035
+ let d = reader.skip(wireType);
31036
+ if (u !== false)
31037
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
31038
+ }
31039
+ }
31040
+ return message;
31041
+ }
31042
+ internalBinaryWrite(message, writer, options) {
31043
+ if (message.updateSeq !== 0)
31044
+ writer.tag(1, import_runtime.WireType.Varint).int32(message.updateSeq);
31045
+ let u = options.writeUnknownFields;
31046
+ if (u !== false)
31047
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
31048
+ return writer;
31049
+ }
31050
+ }
31051
+ var UpdateUserHasNewUpdates = new UpdateUserHasNewUpdates$Type;
31052
+
30424
31053
  class UpdateChatHasNewUpdates$Type extends import_runtime4.MessageType {
30425
31054
  constructor() {
30426
31055
  super("UpdateChatHasNewUpdates", [
@@ -31031,7 +31660,8 @@ class UpdateSpaceMemberDelete$Type extends import_runtime4.MessageType {
31031
31660
  constructor() {
31032
31661
  super("UpdateSpaceMemberDelete", [
31033
31662
  { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 },
31034
- { no: 2, name: "user_id", kind: "scalar", T: 3, L: 0 }
31663
+ { no: 2, name: "user_id", kind: "scalar", T: 3, L: 0 },
31664
+ { no: 3, name: "member_id", kind: "scalar", opt: true, T: 3, L: 0 }
31035
31665
  ]);
31036
31666
  }
31037
31667
  create(value) {
@@ -31053,6 +31683,9 @@ class UpdateSpaceMemberDelete$Type extends import_runtime4.MessageType {
31053
31683
  case 2:
31054
31684
  message.userId = reader.int64().toBigInt();
31055
31685
  break;
31686
+ case 3:
31687
+ message.memberId = reader.int64().toBigInt();
31688
+ break;
31056
31689
  default:
31057
31690
  let u = options.readUnknownField;
31058
31691
  if (u === "throw")
@@ -31069,6 +31702,8 @@ class UpdateSpaceMemberDelete$Type extends import_runtime4.MessageType {
31069
31702
  writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
31070
31703
  if (message.userId !== 0n)
31071
31704
  writer.tag(2, import_runtime.WireType.Varint).int64(message.userId);
31705
+ if (message.memberId !== undefined)
31706
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.memberId);
31072
31707
  let u = options.writeUnknownFields;
31073
31708
  if (u !== false)
31074
31709
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -34300,7 +34935,8 @@ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
34300
34935
  constructor() {
34301
34936
  super("AgentProjectCatalog", [
34302
34937
  { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentProjectOption },
34303
- { no: 2, name: "can_select_folder", kind: "scalar", opt: true, T: 8 }
34938
+ { no: 2, name: "can_select_folder", kind: "scalar", opt: true, T: 8 },
34939
+ { no: 3, name: "default_project_id", kind: "scalar", opt: true, T: 9 }
34304
34940
  ]);
34305
34941
  }
34306
34942
  create(value) {
@@ -34321,6 +34957,9 @@ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
34321
34957
  case 2:
34322
34958
  message.canSelectFolder = reader.bool();
34323
34959
  break;
34960
+ case 3:
34961
+ message.defaultProjectId = reader.string();
34962
+ break;
34324
34963
  default:
34325
34964
  let u = options.readUnknownField;
34326
34965
  if (u === "throw")
@@ -34337,6 +34976,8 @@ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
34337
34976
  AgentProjectOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
34338
34977
  if (message.canSelectFolder !== undefined)
34339
34978
  writer.tag(2, import_runtime.WireType.Varint).bool(message.canSelectFolder);
34979
+ if (message.defaultProjectId !== undefined)
34980
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.defaultProjectId);
34340
34981
  let u = options.writeUnknownFields;
34341
34982
  if (u !== false)
34342
34983
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -34450,7 +35091,8 @@ class AgentModelOption$Type extends import_runtime4.MessageType {
34450
35091
  { no: 1, name: "id", kind: "scalar", T: 9 },
34451
35092
  { no: 2, name: "label", kind: "scalar", T: 9 },
34452
35093
  { no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
34453
- { no: 4, name: "reasoning_effort_ids", kind: "scalar", repeat: 2, T: 9 }
35094
+ { no: 4, name: "reasoning_effort_ids", kind: "scalar", repeat: 2, T: 9 },
35095
+ { no: 5, name: "default_reasoning_effort_id", kind: "scalar", opt: true, T: 9 }
34454
35096
  ]);
34455
35097
  }
34456
35098
  create(value) {
@@ -34479,6 +35121,9 @@ class AgentModelOption$Type extends import_runtime4.MessageType {
34479
35121
  case 4:
34480
35122
  message.reasoningEffortIds.push(reader.string());
34481
35123
  break;
35124
+ case 5:
35125
+ message.defaultReasoningEffortId = reader.string();
35126
+ break;
34482
35127
  default:
34483
35128
  let u = options.readUnknownField;
34484
35129
  if (u === "throw")
@@ -34499,6 +35144,8 @@ class AgentModelOption$Type extends import_runtime4.MessageType {
34499
35144
  writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
34500
35145
  for (let i = 0;i < message.reasoningEffortIds.length; i++)
34501
35146
  writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.reasoningEffortIds[i]);
35147
+ if (message.defaultReasoningEffortId !== undefined)
35148
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.defaultReasoningEffortId);
34502
35149
  let u = options.writeUnknownFields;
34503
35150
  if (u !== false)
34504
35151
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -34510,7 +35157,8 @@ var AgentModelOption = new AgentModelOption$Type;
34510
35157
  class AgentModelCatalog$Type extends import_runtime4.MessageType {
34511
35158
  constructor() {
34512
35159
  super("AgentModelCatalog", [
34513
- { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentModelOption }
35160
+ { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentModelOption },
35161
+ { no: 2, name: "default_model_id", kind: "scalar", opt: true, T: 9 }
34514
35162
  ]);
34515
35163
  }
34516
35164
  create(value) {
@@ -34528,6 +35176,9 @@ class AgentModelCatalog$Type extends import_runtime4.MessageType {
34528
35176
  case 1:
34529
35177
  message.options.push(AgentModelOption.internalBinaryRead(reader, reader.uint32(), options));
34530
35178
  break;
35179
+ case 2:
35180
+ message.defaultModelId = reader.string();
35181
+ break;
34531
35182
  default:
34532
35183
  let u = options.readUnknownField;
34533
35184
  if (u === "throw")
@@ -34542,6 +35193,8 @@ class AgentModelCatalog$Type extends import_runtime4.MessageType {
34542
35193
  internalBinaryWrite(message, writer, options) {
34543
35194
  for (let i = 0;i < message.options.length; i++)
34544
35195
  AgentModelOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
35196
+ if (message.defaultModelId !== undefined)
35197
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.defaultModelId);
34545
35198
  let u = options.writeUnknownFields;
34546
35199
  if (u !== false)
34547
35200
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -35428,7 +36081,8 @@ class BotChatSettingsFolder$Type extends import_runtime4.MessageType {
35428
36081
  { no: 4, name: "host_label", kind: "scalar", T: 9 },
35429
36082
  { no: 5, name: "allows_local_picker", kind: "scalar", T: 8 },
35430
36083
  { no: 6, name: "local_picker_port", kind: "scalar", opt: true, T: 13 },
35431
- { no: 7, name: "local_picker_capability", kind: "scalar", opt: true, T: 9 }
36084
+ { no: 7, name: "local_picker_capability", kind: "scalar", opt: true, T: 9 },
36085
+ { no: 8, name: "remote_browser_version", kind: "scalar", opt: true, T: 13 }
35432
36086
  ]);
35433
36087
  }
35434
36088
  create(value) {
@@ -35468,6 +36122,9 @@ class BotChatSettingsFolder$Type extends import_runtime4.MessageType {
35468
36122
  case 7:
35469
36123
  message.localPickerCapability = reader.string();
35470
36124
  break;
36125
+ case 8:
36126
+ message.remoteBrowserVersion = reader.uint32();
36127
+ break;
35471
36128
  default:
35472
36129
  let u = options.readUnknownField;
35473
36130
  if (u === "throw")
@@ -35494,6 +36151,8 @@ class BotChatSettingsFolder$Type extends import_runtime4.MessageType {
35494
36151
  writer.tag(6, import_runtime.WireType.Varint).uint32(message.localPickerPort);
35495
36152
  if (message.localPickerCapability !== undefined)
35496
36153
  writer.tag(7, import_runtime.WireType.LengthDelimited).string(message.localPickerCapability);
36154
+ if (message.remoteBrowserVersion !== undefined)
36155
+ writer.tag(8, import_runtime.WireType.Varint).uint32(message.remoteBrowserVersion);
35497
36156
  let u = options.writeUnknownFields;
35498
36157
  if (u !== false)
35499
36158
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -38738,6 +39397,542 @@ class ChatAcknowledgements$Type extends import_runtime4.MessageType {
38738
39397
  }
38739
39398
  var ChatAcknowledgements = new ChatAcknowledgements$Type;
38740
39399
 
39400
+ class TranscribeVoiceDraftInput$Type extends import_runtime4.MessageType {
39401
+ constructor() {
39402
+ super("TranscribeVoiceDraftInput", [
39403
+ { no: 1, name: "audio", kind: "scalar", T: 12 },
39404
+ { no: 2, name: "mime_type", kind: "scalar", T: 9 },
39405
+ { no: 3, name: "duration", kind: "scalar", T: 13 }
39406
+ ]);
39407
+ }
39408
+ create(value) {
39409
+ const message = globalThis.Object.create(this.messagePrototype);
39410
+ message.audio = new Uint8Array(0);
39411
+ message.mimeType = "";
39412
+ message.duration = 0;
39413
+ if (value !== undefined)
39414
+ import_runtime3.reflectionMergePartial(this, message, value);
39415
+ return message;
39416
+ }
39417
+ internalBinaryRead(reader, length, options, target) {
39418
+ let message = target ?? this.create(), end = reader.pos + length;
39419
+ while (reader.pos < end) {
39420
+ let [fieldNo, wireType] = reader.tag();
39421
+ switch (fieldNo) {
39422
+ case 1:
39423
+ message.audio = reader.bytes();
39424
+ break;
39425
+ case 2:
39426
+ message.mimeType = reader.string();
39427
+ break;
39428
+ case 3:
39429
+ message.duration = reader.uint32();
39430
+ break;
39431
+ default:
39432
+ let u = options.readUnknownField;
39433
+ if (u === "throw")
39434
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39435
+ let d = reader.skip(wireType);
39436
+ if (u !== false)
39437
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39438
+ }
39439
+ }
39440
+ return message;
39441
+ }
39442
+ internalBinaryWrite(message, writer, options) {
39443
+ if (message.audio.length)
39444
+ writer.tag(1, import_runtime.WireType.LengthDelimited).bytes(message.audio);
39445
+ if (message.mimeType !== "")
39446
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.mimeType);
39447
+ if (message.duration !== 0)
39448
+ writer.tag(3, import_runtime.WireType.Varint).uint32(message.duration);
39449
+ let u = options.writeUnknownFields;
39450
+ if (u !== false)
39451
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39452
+ return writer;
39453
+ }
39454
+ }
39455
+ var TranscribeVoiceDraftInput = new TranscribeVoiceDraftInput$Type;
39456
+
39457
+ class TranscribeVoiceDraftResult$Type extends import_runtime4.MessageType {
39458
+ constructor() {
39459
+ super("TranscribeVoiceDraftResult", [
39460
+ { no: 1, name: "text", kind: "scalar", T: 9 }
39461
+ ]);
39462
+ }
39463
+ create(value) {
39464
+ const message = globalThis.Object.create(this.messagePrototype);
39465
+ message.text = "";
39466
+ if (value !== undefined)
39467
+ import_runtime3.reflectionMergePartial(this, message, value);
39468
+ return message;
39469
+ }
39470
+ internalBinaryRead(reader, length, options, target) {
39471
+ let message = target ?? this.create(), end = reader.pos + length;
39472
+ while (reader.pos < end) {
39473
+ let [fieldNo, wireType] = reader.tag();
39474
+ switch (fieldNo) {
39475
+ case 1:
39476
+ message.text = reader.string();
39477
+ break;
39478
+ default:
39479
+ let u = options.readUnknownField;
39480
+ if (u === "throw")
39481
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39482
+ let d = reader.skip(wireType);
39483
+ if (u !== false)
39484
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39485
+ }
39486
+ }
39487
+ return message;
39488
+ }
39489
+ internalBinaryWrite(message, writer, options) {
39490
+ if (message.text !== "")
39491
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.text);
39492
+ let u = options.writeUnknownFields;
39493
+ if (u !== false)
39494
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39495
+ return writer;
39496
+ }
39497
+ }
39498
+ var TranscribeVoiceDraftResult = new TranscribeVoiceDraftResult$Type;
39499
+
39500
+ class RequestBotFilesystemInput$Type extends import_runtime4.MessageType {
39501
+ constructor() {
39502
+ super("RequestBotFilesystemInput", [
39503
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
39504
+ { no: 2, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
39505
+ { no: 3, name: "host_installation_id", kind: "scalar", T: 9 },
39506
+ { no: 4, name: "operation", kind: "enum", T: () => ["RequestBotFilesystemInput.Operation", RequestBotFilesystemInput_Operation] },
39507
+ { no: 5, name: "path", kind: "scalar", T: 9 },
39508
+ { no: 6, name: "after", kind: "scalar", T: 9 }
39509
+ ]);
39510
+ }
39511
+ create(value) {
39512
+ const message = globalThis.Object.create(this.messagePrototype);
39513
+ message.botUserId = 0n;
39514
+ message.hostInstallationId = "";
39515
+ message.operation = 0;
39516
+ message.path = "";
39517
+ message.after = "";
39518
+ if (value !== undefined)
39519
+ import_runtime3.reflectionMergePartial(this, message, value);
39520
+ return message;
39521
+ }
39522
+ internalBinaryRead(reader, length, options, target) {
39523
+ let message = target ?? this.create(), end = reader.pos + length;
39524
+ while (reader.pos < end) {
39525
+ let [fieldNo, wireType] = reader.tag();
39526
+ switch (fieldNo) {
39527
+ case 1:
39528
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
39529
+ break;
39530
+ case 2:
39531
+ message.botUserId = reader.int64().toBigInt();
39532
+ break;
39533
+ case 3:
39534
+ message.hostInstallationId = reader.string();
39535
+ break;
39536
+ case 4:
39537
+ message.operation = reader.int32();
39538
+ break;
39539
+ case 5:
39540
+ message.path = reader.string();
39541
+ break;
39542
+ case 6:
39543
+ message.after = reader.string();
39544
+ break;
39545
+ default:
39546
+ let u = options.readUnknownField;
39547
+ if (u === "throw")
39548
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39549
+ let d = reader.skip(wireType);
39550
+ if (u !== false)
39551
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39552
+ }
39553
+ }
39554
+ return message;
39555
+ }
39556
+ internalBinaryWrite(message, writer, options) {
39557
+ if (message.peerId)
39558
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
39559
+ if (message.botUserId !== 0n)
39560
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.botUserId);
39561
+ if (message.hostInstallationId !== "")
39562
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.hostInstallationId);
39563
+ if (message.operation !== 0)
39564
+ writer.tag(4, import_runtime.WireType.Varint).int32(message.operation);
39565
+ if (message.path !== "")
39566
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.path);
39567
+ if (message.after !== "")
39568
+ writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.after);
39569
+ let u = options.writeUnknownFields;
39570
+ if (u !== false)
39571
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39572
+ return writer;
39573
+ }
39574
+ }
39575
+ var RequestBotFilesystemInput = new RequestBotFilesystemInput$Type;
39576
+
39577
+ class BotFilesystemEntry$Type extends import_runtime4.MessageType {
39578
+ constructor() {
39579
+ super("BotFilesystemEntry", [
39580
+ { no: 1, name: "name", kind: "scalar", T: 9 },
39581
+ { no: 2, name: "kind", kind: "enum", T: () => ["BotFilesystemEntry.Kind", BotFilesystemEntry_Kind] },
39582
+ { no: 3, name: "size", kind: "scalar", T: 4, L: 0 }
39583
+ ]);
39584
+ }
39585
+ create(value) {
39586
+ const message = globalThis.Object.create(this.messagePrototype);
39587
+ message.name = "";
39588
+ message.kind = 0;
39589
+ message.size = 0n;
39590
+ if (value !== undefined)
39591
+ import_runtime3.reflectionMergePartial(this, message, value);
39592
+ return message;
39593
+ }
39594
+ internalBinaryRead(reader, length, options, target) {
39595
+ let message = target ?? this.create(), end = reader.pos + length;
39596
+ while (reader.pos < end) {
39597
+ let [fieldNo, wireType] = reader.tag();
39598
+ switch (fieldNo) {
39599
+ case 1:
39600
+ message.name = reader.string();
39601
+ break;
39602
+ case 2:
39603
+ message.kind = reader.int32();
39604
+ break;
39605
+ case 3:
39606
+ message.size = reader.uint64().toBigInt();
39607
+ break;
39608
+ default:
39609
+ let u = options.readUnknownField;
39610
+ if (u === "throw")
39611
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39612
+ let d = reader.skip(wireType);
39613
+ if (u !== false)
39614
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39615
+ }
39616
+ }
39617
+ return message;
39618
+ }
39619
+ internalBinaryWrite(message, writer, options) {
39620
+ if (message.name !== "")
39621
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.name);
39622
+ if (message.kind !== 0)
39623
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.kind);
39624
+ if (message.size !== 0n)
39625
+ writer.tag(3, import_runtime.WireType.Varint).uint64(message.size);
39626
+ let u = options.writeUnknownFields;
39627
+ if (u !== false)
39628
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39629
+ return writer;
39630
+ }
39631
+ }
39632
+ var BotFilesystemEntry = new BotFilesystemEntry$Type;
39633
+
39634
+ class BotFilesystemListing$Type extends import_runtime4.MessageType {
39635
+ constructor() {
39636
+ super("BotFilesystemListing", [
39637
+ { no: 1, name: "path", kind: "scalar", T: 9 },
39638
+ { no: 2, name: "parent_path", kind: "scalar", opt: true, T: 9 },
39639
+ { no: 3, name: "entries", kind: "message", repeat: 1, T: () => BotFilesystemEntry },
39640
+ { no: 4, name: "next_after", kind: "scalar", opt: true, T: 9 }
39641
+ ]);
39642
+ }
39643
+ create(value) {
39644
+ const message = globalThis.Object.create(this.messagePrototype);
39645
+ message.path = "";
39646
+ message.entries = [];
39647
+ if (value !== undefined)
39648
+ import_runtime3.reflectionMergePartial(this, message, value);
39649
+ return message;
39650
+ }
39651
+ internalBinaryRead(reader, length, options, target) {
39652
+ let message = target ?? this.create(), end = reader.pos + length;
39653
+ while (reader.pos < end) {
39654
+ let [fieldNo, wireType] = reader.tag();
39655
+ switch (fieldNo) {
39656
+ case 1:
39657
+ message.path = reader.string();
39658
+ break;
39659
+ case 2:
39660
+ message.parentPath = reader.string();
39661
+ break;
39662
+ case 3:
39663
+ message.entries.push(BotFilesystemEntry.internalBinaryRead(reader, reader.uint32(), options));
39664
+ break;
39665
+ case 4:
39666
+ message.nextAfter = reader.string();
39667
+ break;
39668
+ default:
39669
+ let u = options.readUnknownField;
39670
+ if (u === "throw")
39671
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39672
+ let d = reader.skip(wireType);
39673
+ if (u !== false)
39674
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39675
+ }
39676
+ }
39677
+ return message;
39678
+ }
39679
+ internalBinaryWrite(message, writer, options) {
39680
+ if (message.path !== "")
39681
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.path);
39682
+ if (message.parentPath !== undefined)
39683
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.parentPath);
39684
+ for (let i = 0;i < message.entries.length; i++)
39685
+ BotFilesystemEntry.internalBinaryWrite(message.entries[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
39686
+ if (message.nextAfter !== undefined)
39687
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.nextAfter);
39688
+ let u = options.writeUnknownFields;
39689
+ if (u !== false)
39690
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39691
+ return writer;
39692
+ }
39693
+ }
39694
+ var BotFilesystemListing = new BotFilesystemListing$Type;
39695
+
39696
+ class BotFilesystemResponse$Type extends import_runtime4.MessageType {
39697
+ constructor() {
39698
+ super("BotFilesystemResponse", [
39699
+ { no: 1, name: "listing", kind: "message", oneof: "result", T: () => BotFilesystemListing },
39700
+ { no: 2, name: "workspace_id", kind: "scalar", oneof: "result", T: 9 },
39701
+ { no: 3, name: "problem", kind: "scalar", oneof: "result", T: 9 }
39702
+ ]);
39703
+ }
39704
+ create(value) {
39705
+ const message = globalThis.Object.create(this.messagePrototype);
39706
+ message.result = { oneofKind: undefined };
39707
+ if (value !== undefined)
39708
+ import_runtime3.reflectionMergePartial(this, message, value);
39709
+ return message;
39710
+ }
39711
+ internalBinaryRead(reader, length, options, target) {
39712
+ let message = target ?? this.create(), end = reader.pos + length;
39713
+ while (reader.pos < end) {
39714
+ let [fieldNo, wireType] = reader.tag();
39715
+ switch (fieldNo) {
39716
+ case 1:
39717
+ message.result = {
39718
+ oneofKind: "listing",
39719
+ listing: BotFilesystemListing.internalBinaryRead(reader, reader.uint32(), options, message.result.listing)
39720
+ };
39721
+ break;
39722
+ case 2:
39723
+ message.result = {
39724
+ oneofKind: "workspaceId",
39725
+ workspaceId: reader.string()
39726
+ };
39727
+ break;
39728
+ case 3:
39729
+ message.result = {
39730
+ oneofKind: "problem",
39731
+ problem: reader.string()
39732
+ };
39733
+ break;
39734
+ default:
39735
+ let u = options.readUnknownField;
39736
+ if (u === "throw")
39737
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39738
+ let d = reader.skip(wireType);
39739
+ if (u !== false)
39740
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39741
+ }
39742
+ }
39743
+ return message;
39744
+ }
39745
+ internalBinaryWrite(message, writer, options) {
39746
+ if (message.result.oneofKind === "listing")
39747
+ BotFilesystemListing.internalBinaryWrite(message.result.listing, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
39748
+ if (message.result.oneofKind === "workspaceId")
39749
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.result.workspaceId);
39750
+ if (message.result.oneofKind === "problem")
39751
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.result.problem);
39752
+ let u = options.writeUnknownFields;
39753
+ if (u !== false)
39754
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39755
+ return writer;
39756
+ }
39757
+ }
39758
+ var BotFilesystemResponse = new BotFilesystemResponse$Type;
39759
+
39760
+ class RequestBotFilesystemResult$Type extends import_runtime4.MessageType {
39761
+ constructor() {
39762
+ super("RequestBotFilesystemResult", [
39763
+ { no: 1, name: "response", kind: "message", T: () => BotFilesystemResponse }
39764
+ ]);
39765
+ }
39766
+ create(value) {
39767
+ const message = globalThis.Object.create(this.messagePrototype);
39768
+ if (value !== undefined)
39769
+ import_runtime3.reflectionMergePartial(this, message, value);
39770
+ return message;
39771
+ }
39772
+ internalBinaryRead(reader, length, options, target) {
39773
+ let message = target ?? this.create(), end = reader.pos + length;
39774
+ while (reader.pos < end) {
39775
+ let [fieldNo, wireType] = reader.tag();
39776
+ switch (fieldNo) {
39777
+ case 1:
39778
+ message.response = BotFilesystemResponse.internalBinaryRead(reader, reader.uint32(), options, message.response);
39779
+ break;
39780
+ default:
39781
+ let u = options.readUnknownField;
39782
+ if (u === "throw")
39783
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39784
+ let d = reader.skip(wireType);
39785
+ if (u !== false)
39786
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39787
+ }
39788
+ }
39789
+ return message;
39790
+ }
39791
+ internalBinaryWrite(message, writer, options) {
39792
+ if (message.response)
39793
+ BotFilesystemResponse.internalBinaryWrite(message.response, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
39794
+ let u = options.writeUnknownFields;
39795
+ if (u !== false)
39796
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39797
+ return writer;
39798
+ }
39799
+ }
39800
+ var RequestBotFilesystemResult = new RequestBotFilesystemResult$Type;
39801
+
39802
+ class BotFilesystemRequested$Type extends import_runtime4.MessageType {
39803
+ constructor() {
39804
+ super("BotFilesystemRequested", [
39805
+ { no: 1, name: "request_id", kind: "scalar", T: 4, L: 0 },
39806
+ { no: 2, name: "actor_user_id", kind: "scalar", T: 3, L: 0 },
39807
+ { no: 3, name: "chat_id", kind: "scalar", T: 3, L: 0 },
39808
+ { no: 4, name: "input", kind: "message", T: () => RequestBotFilesystemInput }
39809
+ ]);
39810
+ }
39811
+ create(value) {
39812
+ const message = globalThis.Object.create(this.messagePrototype);
39813
+ message.requestId = 0n;
39814
+ message.actorUserId = 0n;
39815
+ message.chatId = 0n;
39816
+ if (value !== undefined)
39817
+ import_runtime3.reflectionMergePartial(this, message, value);
39818
+ return message;
39819
+ }
39820
+ internalBinaryRead(reader, length, options, target) {
39821
+ let message = target ?? this.create(), end = reader.pos + length;
39822
+ while (reader.pos < end) {
39823
+ let [fieldNo, wireType] = reader.tag();
39824
+ switch (fieldNo) {
39825
+ case 1:
39826
+ message.requestId = reader.uint64().toBigInt();
39827
+ break;
39828
+ case 2:
39829
+ message.actorUserId = reader.int64().toBigInt();
39830
+ break;
39831
+ case 3:
39832
+ message.chatId = reader.int64().toBigInt();
39833
+ break;
39834
+ case 4:
39835
+ message.input = RequestBotFilesystemInput.internalBinaryRead(reader, reader.uint32(), options, message.input);
39836
+ break;
39837
+ default:
39838
+ let u = options.readUnknownField;
39839
+ if (u === "throw")
39840
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39841
+ let d = reader.skip(wireType);
39842
+ if (u !== false)
39843
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39844
+ }
39845
+ }
39846
+ return message;
39847
+ }
39848
+ internalBinaryWrite(message, writer, options) {
39849
+ if (message.requestId !== 0n)
39850
+ writer.tag(1, import_runtime.WireType.Varint).uint64(message.requestId);
39851
+ if (message.actorUserId !== 0n)
39852
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.actorUserId);
39853
+ if (message.chatId !== 0n)
39854
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.chatId);
39855
+ if (message.input)
39856
+ RequestBotFilesystemInput.internalBinaryWrite(message.input, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
39857
+ let u = options.writeUnknownFields;
39858
+ if (u !== false)
39859
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39860
+ return writer;
39861
+ }
39862
+ }
39863
+ var BotFilesystemRequested = new BotFilesystemRequested$Type;
39864
+
39865
+ class AnswerBotFilesystemInput$Type extends import_runtime4.MessageType {
39866
+ constructor() {
39867
+ super("AnswerBotFilesystemInput", [
39868
+ { no: 1, name: "request_id", kind: "scalar", T: 4, L: 0 },
39869
+ { no: 2, name: "response", kind: "message", T: () => BotFilesystemResponse }
39870
+ ]);
39871
+ }
39872
+ create(value) {
39873
+ const message = globalThis.Object.create(this.messagePrototype);
39874
+ message.requestId = 0n;
39875
+ if (value !== undefined)
39876
+ import_runtime3.reflectionMergePartial(this, message, value);
39877
+ return message;
39878
+ }
39879
+ internalBinaryRead(reader, length, options, target) {
39880
+ let message = target ?? this.create(), end = reader.pos + length;
39881
+ while (reader.pos < end) {
39882
+ let [fieldNo, wireType] = reader.tag();
39883
+ switch (fieldNo) {
39884
+ case 1:
39885
+ message.requestId = reader.uint64().toBigInt();
39886
+ break;
39887
+ case 2:
39888
+ message.response = BotFilesystemResponse.internalBinaryRead(reader, reader.uint32(), options, message.response);
39889
+ break;
39890
+ default:
39891
+ let u = options.readUnknownField;
39892
+ if (u === "throw")
39893
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39894
+ let d = reader.skip(wireType);
39895
+ if (u !== false)
39896
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39897
+ }
39898
+ }
39899
+ return message;
39900
+ }
39901
+ internalBinaryWrite(message, writer, options) {
39902
+ if (message.requestId !== 0n)
39903
+ writer.tag(1, import_runtime.WireType.Varint).uint64(message.requestId);
39904
+ if (message.response)
39905
+ BotFilesystemResponse.internalBinaryWrite(message.response, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
39906
+ let u = options.writeUnknownFields;
39907
+ if (u !== false)
39908
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39909
+ return writer;
39910
+ }
39911
+ }
39912
+ var AnswerBotFilesystemInput = new AnswerBotFilesystemInput$Type;
39913
+
39914
+ class AnswerBotFilesystemResult$Type extends import_runtime4.MessageType {
39915
+ constructor() {
39916
+ super("AnswerBotFilesystemResult", []);
39917
+ }
39918
+ create(value) {
39919
+ const message = globalThis.Object.create(this.messagePrototype);
39920
+ if (value !== undefined)
39921
+ import_runtime3.reflectionMergePartial(this, message, value);
39922
+ return message;
39923
+ }
39924
+ internalBinaryRead(reader, length, options, target) {
39925
+ return target ?? this.create();
39926
+ }
39927
+ internalBinaryWrite(message, writer, options) {
39928
+ let u = options.writeUnknownFields;
39929
+ if (u !== false)
39930
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39931
+ return writer;
39932
+ }
39933
+ }
39934
+ var AnswerBotFilesystemResult = new AnswerBotFilesystemResult$Type;
39935
+
38741
39936
  // node_modules/@noble/hashes/esm/utils.js
38742
39937
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
38743
39938
  function isBytes(a) {
@@ -40807,7 +42002,6 @@ var int64LE = (value) => {
40807
42002
  };
40808
42003
  var readInt32LE = (bytes, offset) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getInt32(offset, true);
40809
42004
  var readInt64LE = (bytes, offset) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getBigInt64(offset, true);
40810
- var bytesToHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
40811
42005
  var hexToBytes = (hex) => {
40812
42006
  if (hex.length % 2 !== 0 || !/^[0-9a-f]*$/i.test(hex))
40813
42007
  throw new RangeError("Invalid hexadecimal bytes");
@@ -41410,39 +42604,11 @@ var BindingConstructor = {
41410
42604
  };
41411
42605
  var keyIdLong = (key) => new DataView(authKeyId(key).buffer).getBigInt64(0, true);
41412
42606
  var encodeBindAuthKeyInner = (value) => concatBytes(uint32LE(BindingConstructor.bindAuthKeyInner), int64LE(value.nonce), int64LE(value.temporaryAuthKeyId), int64LE(value.permanentAuthKeyId), int64LE(value.temporarySessionId), int32LE(value.expiresAt));
41413
- var decodeBindAuthKeyInner = (body) => {
41414
- if (body.length !== 40 || readInt32LE(body, 0) >>> 0 !== BindingConstructor.bindAuthKeyInner) {
41415
- throw new RangeError("Invalid bind_auth_key_inner");
41416
- }
41417
- return {
41418
- nonce: readInt64LE(body, 4),
41419
- temporaryAuthKeyId: readInt64LE(body, 12),
41420
- permanentAuthKeyId: readInt64LE(body, 20),
41421
- temporarySessionId: readInt64LE(body, 28),
41422
- expiresAt: readInt32LE(body, 36)
41423
- };
41424
- };
41425
42607
  var encodeBindTempAuthKey = (value) => {
41426
42608
  if (value.encryptedMessage.length !== 104)
41427
42609
  throw new RangeError("Binding proof must be exactly 104 bytes");
41428
42610
  return concatBytes(uint32LE(BindingConstructor.bindTempAuthKey), int64LE(value.permanentAuthKeyId), int64LE(value.nonce), int32LE(value.expiresAt), encodeTlBytes(value.encryptedMessage));
41429
42611
  };
41430
- var decodeBindTempAuthKey = (body) => {
41431
- if (body.length < 4 || readInt32LE(body, 0) >>> 0 !== BindingConstructor.bindTempAuthKey) {
41432
- throw new RangeError("Invalid auth.bindTempAuthKey");
41433
- }
41434
- const reader = new TlReader(body.slice(4));
41435
- const value = {
41436
- permanentAuthKeyId: reader.readLong(),
41437
- nonce: reader.readLong(),
41438
- expiresAt: reader.readInt(),
41439
- encryptedMessage: reader.readBytes()
41440
- };
41441
- reader.expectEnd();
41442
- if (value.encryptedMessage.length !== 104)
41443
- throw new RangeError("Binding proof must be exactly 104 bytes");
41444
- return value;
41445
- };
41446
42612
  var deriveV1Aes = (authKey, messageKey) => {
41447
42613
  if (authKey.length !== 256 || messageKey.length !== 16)
41448
42614
  throw new RangeError("Invalid binding key material");
@@ -41471,37 +42637,12 @@ var createTemporaryKeyBindingProof = (input) => {
41471
42637
  const { key, iv } = deriveV1Aes(input.permanentAuthKey, messageKey);
41472
42638
  return concatBytes(authKeyId(input.permanentAuthKey), messageKey, aesIgeEncrypt(concatBytes(plaintextWithoutPadding, input.randomPadding), key, iv));
41473
42639
  };
41474
- var verifyTemporaryKeyBindingProof = (input) => {
41475
- if (input.encryptedMessage.length !== 104 || input.permanentAuthKey.length !== 256) {
41476
- throw new RangeError("Invalid temporary-key binding proof");
41477
- }
41478
- const receivedKeyId = input.encryptedMessage.slice(0, 8);
41479
- const messageKey = input.encryptedMessage.slice(8, 24);
41480
- const { key, iv } = deriveV1Aes(input.permanentAuthKey, messageKey);
41481
- const plaintext = aesIgeDecrypt(input.encryptedMessage.slice(24), key, iv);
41482
- const plaintextWithoutPadding = plaintext.slice(0, 72);
41483
- if (!equalBytes(receivedKeyId, authKeyId(input.permanentAuthKey)) || !equalBytes(messageKey, sha1Digest(plaintextWithoutPadding).slice(4, 20))) {
41484
- throw new RangeError("Invalid temporary-key binding confirmation");
41485
- }
41486
- const messageId = readInt64LE(plaintext, 16);
41487
- const sequenceNumber = readInt32LE(plaintext, 24);
41488
- const bodyLength = readInt32LE(plaintext, 28);
41489
- if (sequenceNumber !== 0 || bodyLength !== 40 || plaintext.length !== 80) {
41490
- throw new RangeError("Invalid isolated binding record");
41491
- }
41492
- const inner = decodeBindAuthKeyInner(plaintext.slice(32, 72));
41493
- if (keyIdLong(input.permanentAuthKey) !== input.outerPermanentAuthKeyId || inner.permanentAuthKeyId !== input.outerPermanentAuthKeyId || inner.temporaryAuthKeyId !== input.outerTemporaryAuthKeyId || inner.temporarySessionId !== input.outerTemporarySessionId || inner.nonce !== input.outerNonce || inner.expiresAt !== input.outerExpiresAt || messageId !== input.outerMessageId || input.outerExpiresAt <= input.nowSeconds || input.outerExpiresAt > input.temporaryKeyExpiresAt + 30)
41494
- throw new RangeError("Temporary-key binding mismatch");
41495
- return { inner, messageId };
41496
- };
41497
42640
  // node_modules/@inline-chat/protocol/dist/secure/application.js
41498
42641
  var INLINE_RESULT_CONSTRUCTOR = 2889735252;
41499
42642
  var INLINE_UPDATE_CONSTRUCTOR = 3695258776;
41500
42643
  var INLINE_INVOKE_CONSTRUCTOR = 3950856870;
41501
42644
  var INLINE_REALTIME_LAYER = 3;
41502
42645
  var encodeInlineInvoke = (payload, layer = INLINE_REALTIME_LAYER) => concatBytes(uint32LE(INLINE_INVOKE_CONSTRUCTOR), int32LE(layer), encodeTlBytes(payload));
41503
- var encodeInlineResult = (payload) => concatBytes(uint32LE(INLINE_RESULT_CONSTRUCTOR), encodeTlBytes(payload));
41504
- var encodeInlineUpdate = (payload) => concatBytes(uint32LE(INLINE_UPDATE_CONSTRUCTOR), encodeTlBytes(payload));
41505
42646
  var decodeInlineApplicationObject = (bytes) => {
41506
42647
  if (bytes.length < 8)
41507
42648
  throw new RangeError("Truncated Inline application object");
@@ -41818,13 +42959,6 @@ var fixed = (name, value, length) => {
41818
42959
  return value;
41819
42960
  };
41820
42961
  var encodeReqPqMulti = (nonce) => concatBytes(constructor(HandshakeConstructor.reqPqMulti), fixed("nonce", nonce, 16));
41821
- var decodeReqPqMulti = (body) => {
41822
- const reader = constructorReader(body, HandshakeConstructor.reqPqMulti);
41823
- const nonce = reader.readFixed(16);
41824
- reader.expectEnd();
41825
- return { nonce };
41826
- };
41827
- var encodeResPq = (nonce, serverNonce, pq, fingerprints) => concatBytes(constructor(HandshakeConstructor.resPq), fixed("nonce", nonce, 16), fixed("server_nonce", serverNonce, 16), encodeTlBytes(pq), encodeTlVector(fingerprints.map(int64LE)));
41828
42962
  var decodeResPq = (body) => {
41829
42963
  const reader = constructorReader(body, HandshakeConstructor.resPq);
41830
42964
  const nonce = reader.readFixed(16);
@@ -41835,42 +42969,7 @@ var decodeResPq = (body) => {
41835
42969
  return { nonce, serverNonce, pq, fingerprints };
41836
42970
  };
41837
42971
  var encodePqInnerData = (value) => concatBytes(constructor(value.temporary ? HandshakeConstructor.pQInnerDataTempDc : HandshakeConstructor.pQInnerDataDc), encodeTlBytes(value.pq), encodeTlBytes(value.p), encodeTlBytes(value.q), fixed("nonce", value.nonce, 16), fixed("server_nonce", value.serverNonce, 16), fixed("new_nonce", value.newNonce, 32), int32LE(value.dc), ...value.temporary ? [int32LE(value.expiresIn ?? 0)] : []);
41838
- var decodePqInnerDataPrefix = (padded) => {
41839
- if (padded.length !== 192)
41840
- throw new RangeError("P_Q inner padded data must be 192 bytes");
41841
- const id = readInt32LE(padded, 0) >>> 0;
41842
- const temporary = id === HandshakeConstructor.pQInnerDataTempDc;
41843
- if (!temporary && id !== HandshakeConstructor.pQInnerDataDc)
41844
- throw new RangeError("Unexpected P_Q inner constructor");
41845
- const reader = new TlReader(padded.slice(4));
41846
- const pq = reader.readBytes();
41847
- const p = reader.readBytes();
41848
- const q = reader.readBytes();
41849
- const nonce = reader.readFixed(16);
41850
- const serverNonce = reader.readFixed(16);
41851
- const newNonce = reader.readFixed(32);
41852
- const dc = reader.readInt();
41853
- const expiresIn = temporary ? reader.readInt() : undefined;
41854
- return {
41855
- value: { temporary, pq, p, q, nonce, serverNonce, newNonce, dc, expiresIn },
41856
- consumed: 4 + reader.offset
41857
- };
41858
- };
41859
42972
  var encodeReqDhParams = (value) => concatBytes(constructor(HandshakeConstructor.reqDhParams), fixed("nonce", value.nonce, 16), fixed("server_nonce", value.serverNonce, 16), encodeTlBytes(value.p), encodeTlBytes(value.q), int64LE(value.fingerprint), encodeTlBytes(value.encryptedData));
41860
- var decodeReqDhParams = (body) => {
41861
- const reader = constructorReader(body, HandshakeConstructor.reqDhParams);
41862
- const value = {
41863
- nonce: reader.readFixed(16),
41864
- serverNonce: reader.readFixed(16),
41865
- p: reader.readBytes(),
41866
- q: reader.readBytes(),
41867
- fingerprint: reader.readLong(),
41868
- encryptedData: reader.readBytes()
41869
- };
41870
- reader.expectEnd();
41871
- return value;
41872
- };
41873
- var encodeServerDhParamsOk = (nonce, serverNonce, encryptedAnswer) => concatBytes(constructor(HandshakeConstructor.serverDhParamsOk), fixed("nonce", nonce, 16), fixed("server_nonce", serverNonce, 16), encodeTlBytes(encryptedAnswer));
41874
42973
  var decodeServerDhParamsOk = (body) => {
41875
42974
  const reader = constructorReader(body, HandshakeConstructor.serverDhParamsOk);
41876
42975
  const value = { nonce: reader.readFixed(16), serverNonce: reader.readFixed(16), encryptedAnswer: reader.readBytes() };
@@ -41896,7 +42995,6 @@ var decodeServerDhParams = (body) => {
41896
42995
  }
41897
42996
  throw new RangeError("Unexpected server DH parameters");
41898
42997
  };
41899
- var encodeServerDhInnerData = (value) => concatBytes(constructor(HandshakeConstructor.serverDhInnerData), fixed("nonce", value.nonce, 16), fixed("server_nonce", value.serverNonce, 16), int32LE(value.generator), encodeTlBytes(value.prime), encodeTlBytes(value.gA), int32LE(value.serverTime));
41900
42998
  var decodeServerDhInnerDataPrefix = (plaintext) => {
41901
42999
  const reader = constructorReaderPrefix(plaintext, HandshakeConstructor.serverDhInnerData);
41902
43000
  const value = {
@@ -41910,24 +43008,7 @@ var decodeServerDhInnerDataPrefix = (plaintext) => {
41910
43008
  return { value, consumed: 4 + reader.offset };
41911
43009
  };
41912
43010
  var encodeClientDhInnerData = (value) => concatBytes(constructor(HandshakeConstructor.clientDhInnerData), fixed("nonce", value.nonce, 16), fixed("server_nonce", value.serverNonce, 16), int64LE(value.retryId), encodeTlBytes(value.gB));
41913
- var decodeClientDhInnerDataPrefix = (plaintext) => {
41914
- const reader = constructorReaderPrefix(plaintext, HandshakeConstructor.clientDhInnerData);
41915
- const value = {
41916
- nonce: reader.readFixed(16),
41917
- serverNonce: reader.readFixed(16),
41918
- retryId: reader.readLong(),
41919
- gB: reader.readBytes()
41920
- };
41921
- return { value, consumed: 4 + reader.offset };
41922
- };
41923
43011
  var encodeSetClientDhParams = (nonce, serverNonce, encryptedData) => concatBytes(constructor(HandshakeConstructor.setClientDhParams), fixed("nonce", nonce, 16), fixed("server_nonce", serverNonce, 16), encodeTlBytes(encryptedData));
41924
- var decodeSetClientDhParams = (body) => {
41925
- const reader = constructorReader(body, HandshakeConstructor.setClientDhParams);
41926
- const value = { nonce: reader.readFixed(16), serverNonce: reader.readFixed(16), encryptedData: reader.readBytes() };
41927
- reader.expectEnd();
41928
- return value;
41929
- };
41930
- var encodeDhGen = (kind, nonce, serverNonce, nonceHash) => concatBytes(constructor(kind === "ok" ? HandshakeConstructor.dhGenOk : kind === "retry" ? HandshakeConstructor.dhGenRetry : HandshakeConstructor.dhGenFail), fixed("nonce", nonce, 16), fixed("server_nonce", serverNonce, 16), fixed("new_nonce_hash", nonceHash, 16));
41931
43012
  var decodeDhGen = (body) => {
41932
43013
  if (body.length !== 52)
41933
43014
  throw new RangeError("Invalid DH generation response");
@@ -41963,144 +43044,6 @@ var constructorReaderPrefix = (body, expected) => {
41963
43044
  var PQ = hexToBytes("17ed48941a08f981");
41964
43045
  var P = hexToBytes("494c553b");
41965
43046
  var Q = hexToBytes("53911073");
41966
-
41967
- class InlineHandshakeServer {
41968
- configuration;
41969
- #phase = { kind: "pq" };
41970
- constructor(configuration) {
41971
- this.configuration = configuration;
41972
- if (configuration.rsaKeys.length < 1)
41973
- throw new RangeError("At least one server RSA key is required");
41974
- validateDhParameters(TELEGRAM_DH_PRIME, configuration.generator ?? 3, configuration.randomBytes);
41975
- }
41976
- async receive(body) {
41977
- switch (this.#phase.kind) {
41978
- case "pq":
41979
- return this.#receivePq(body);
41980
- case "dh":
41981
- return this.#receiveDh(body, this.#phase);
41982
- case "client-dh":
41983
- return this.#receiveClientDh(body, this.#phase);
41984
- case "complete":
41985
- throw new RangeError("Authorization-key handshake is already complete");
41986
- }
41987
- }
41988
- #receivePq(body) {
41989
- const { nonce } = decodeReqPqMulti(body);
41990
- const serverNonce = this.configuration.randomBytes(16);
41991
- if (serverNonce.length !== 16)
41992
- throw new RangeError("CSPRNG returned an invalid nonce");
41993
- this.#phase = { kind: "dh", nonce, serverNonce };
41994
- return {
41995
- response: encodeResPq(nonce, serverNonce, PQ, this.configuration.rsaKeys.map((key) => key.fingerprint))
41996
- };
41997
- }
41998
- async#receiveDh(body, phase) {
41999
- const request = decodeReqDhParams(body);
42000
- this.#requireNonceChain(request.nonce, request.serverNonce, phase.nonce, phase.serverNonce);
42001
- if (!equalBytes(request.p, P) || !equalBytes(request.q, Q))
42002
- throw new RangeError("Invalid pq factorization");
42003
- const rsaKey = this.configuration.rsaKeys.find((key) => key.fingerprint === request.fingerprint);
42004
- if (!rsaKey)
42005
- throw new RangeError("Unknown RSA fingerprint");
42006
- const decrypted = await rsaKey.rawDecrypt(request.encryptedData);
42007
- if (decrypted.length !== 256)
42008
- throw new RangeError("Invalid raw RSA result");
42009
- const aesEncrypted = decrypted.slice(32);
42010
- const temporaryKey = xorBytes(decrypted.slice(0, 32), sha256Digest(aesEncrypted));
42011
- const dataWithHash = aesIgeDecrypt(aesEncrypted, temporaryKey, new Uint8Array(32));
42012
- const padded = dataWithHash.slice(0, 192).reverse();
42013
- if (!equalBytes(dataWithHash.slice(192), sha256Digest(temporaryKey, padded))) {
42014
- throw new RangeError("Invalid RSA_PAD confirmation");
42015
- }
42016
- const decoded = decodePqInnerDataPrefix(padded);
42017
- const inner = decoded.value;
42018
- this.#requireNonceChain(inner.nonce, inner.serverNonce, phase.nonce, phase.serverNonce);
42019
- if (!equalBytes(inner.pq, PQ) || !equalBytes(inner.p, P) || !equalBytes(inner.q, Q) || inner.dc !== (this.configuration.dc ?? 1)) {
42020
- throw new RangeError("Invalid P_Q inner binding");
42021
- }
42022
- const now = this.configuration.nowSeconds();
42023
- let expiresAt;
42024
- if (inner.temporary) {
42025
- if (inner.expiresIn !== 86400)
42026
- throw new RangeError("Temporary authorization key must request 24 hours");
42027
- expiresAt = now + inner.expiresIn;
42028
- }
42029
- const exponent = this.configuration.randomBytes(256);
42030
- if (exponent.length !== 256)
42031
- throw new RangeError("CSPRNG returned an invalid DH exponent");
42032
- const generator = this.configuration.generator ?? 3;
42033
- const gA = deriveAuthKey(Uint8Array.of(generator), exponent, TELEGRAM_DH_PRIME);
42034
- validateDhPublicValue(gA, TELEGRAM_DH_PRIME);
42035
- const serialized = encodeServerDhInnerData({
42036
- nonce: phase.nonce,
42037
- serverNonce: phase.serverNonce,
42038
- generator,
42039
- prime: TELEGRAM_DH_PRIME,
42040
- gA,
42041
- serverTime: now
42042
- });
42043
- const paddingLength = (16 - (20 + serialized.length) % 16) % 16;
42044
- const temporary = deriveTemporaryAes(inner.newNonce, phase.serverNonce);
42045
- const encryptedAnswer = aesIgeEncrypt(concatBytes(sha1Digest(serialized), serialized, this.configuration.randomBytes(paddingLength)), temporary.key, temporary.iv);
42046
- this.#phase = {
42047
- kind: "client-dh",
42048
- nonce: phase.nonce,
42049
- serverNonce: phase.serverNonce,
42050
- newNonce: inner.newNonce,
42051
- exponent,
42052
- temporary: inner.temporary,
42053
- expiresAt,
42054
- retries: 0,
42055
- expectedRetryId: 0n
42056
- };
42057
- return { response: encodeServerDhParamsOk(phase.nonce, phase.serverNonce, encryptedAnswer) };
42058
- }
42059
- async#receiveClientDh(body, phase) {
42060
- const request = decodeSetClientDhParams(body);
42061
- this.#requireNonceChain(request.nonce, request.serverNonce, phase.nonce, phase.serverNonce);
42062
- const temporary = deriveTemporaryAes(phase.newNonce, phase.serverNonce);
42063
- const plaintext = aesIgeDecrypt(request.encryptedData, temporary.key, temporary.iv);
42064
- const decoded = decodeClientDhInnerDataPrefix(plaintext.slice(20));
42065
- const paddingLength = plaintext.length - 20 - decoded.consumed;
42066
- if (paddingLength < 0 || paddingLength > 15 || !equalBytes(plaintext.slice(0, 20), sha1Digest(plaintext.slice(20, 20 + decoded.consumed)))) {
42067
- throw new RangeError("Invalid client DH inner confirmation");
42068
- }
42069
- this.#requireNonceChain(decoded.value.nonce, decoded.value.serverNonce, phase.nonce, phase.serverNonce);
42070
- if (decoded.value.retryId !== phase.expectedRetryId) {
42071
- throw new RangeError("Invalid DH retry identifier");
42072
- }
42073
- validateDhPublicValue(decoded.value.gB, TELEGRAM_DH_PRIME);
42074
- const authKey = deriveAuthKey(decoded.value.gB, phase.exponent, TELEGRAM_DH_PRIME);
42075
- const established = {
42076
- key: authKey,
42077
- keyId: authKeyId(authKey),
42078
- temporary: phase.temporary,
42079
- expiresAt: phase.expiresAt,
42080
- serverSalt: initialServerSalt(phase.newNonce, phase.serverNonce)
42081
- };
42082
- const created = await this.configuration.authorizationKeys.create(established);
42083
- if (created === "collision") {
42084
- if (phase.retries >= 4) {
42085
- this.#phase = { kind: "complete" };
42086
- return { response: encodeDhGen("fail", phase.nonce, phase.serverNonce, newNonceHash(phase.newNonce, 3, authKey)) };
42087
- }
42088
- this.#phase = { ...phase, retries: phase.retries + 1, expectedRetryId: bindRetryId(authKey) };
42089
- return { response: encodeDhGen("retry", phase.nonce, phase.serverNonce, newNonceHash(phase.newNonce, 2, authKey)) };
42090
- }
42091
- this.#phase = { kind: "complete" };
42092
- return {
42093
- response: encodeDhGen("ok", phase.nonce, phase.serverNonce, newNonceHash(phase.newNonce, 1, authKey)),
42094
- established
42095
- };
42096
- }
42097
- #requireNonceChain(actualNonce, actualServer, nonce, serverNonce) {
42098
- if (!equalBytes(actualNonce, nonce) || !equalBytes(actualServer, serverNonce)) {
42099
- throw new RangeError("Handshake nonce chain mismatch");
42100
- }
42101
- }
42102
- }
42103
-
42104
43047
  class InlineHandshakeClient {
42105
43048
  configuration;
42106
43049
  #phase = { kind: "idle" };
@@ -42342,54 +43285,6 @@ var decryptRecordWithMetadata = (record, authKey, validation) => {
42342
43285
  };
42343
43286
  var decryptRecord = (record, authKey, validation) => decryptRecordWithMetadata(record, authKey, validation).fields;
42344
43287
  // node_modules/@inline-chat/protocol/dist/secure/session.js
42345
- class ReceiveMessageWindow {
42346
- #capacity;
42347
- #accepted = new Set;
42348
- #highest;
42349
- constructor(capacity = 1000) {
42350
- if (!Number.isSafeInteger(capacity) || capacity < 1)
42351
- throw new RangeError("Receive window capacity must be positive");
42352
- this.#capacity = capacity;
42353
- }
42354
- claim(messageId) {
42355
- if (this.#accepted.has(messageId))
42356
- return false;
42357
- if (this.#highest !== undefined && messageId < this.#highest && this.#accepted.size >= this.#capacity) {
42358
- const minimum = this.minimum;
42359
- if (minimum !== undefined && messageId < minimum)
42360
- return false;
42361
- }
42362
- this.#accepted.add(messageId);
42363
- if (this.#highest === undefined || messageId > this.#highest)
42364
- this.#highest = messageId;
42365
- if (this.#accepted.size > this.#capacity) {
42366
- const ordered = [...this.#accepted].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
42367
- for (let index = 0;index < ordered.length - this.#capacity; index += 1)
42368
- this.#accepted.delete(ordered[index]);
42369
- }
42370
- return true;
42371
- }
42372
- has(messageId) {
42373
- return this.#accepted.has(messageId);
42374
- }
42375
- get minimum() {
42376
- let minimum;
42377
- for (const value of this.#accepted)
42378
- if (minimum === undefined || value < minimum)
42379
- minimum = value;
42380
- return minimum;
42381
- }
42382
- checkpoint() {
42383
- return { accepted: [...this.#accepted], highest: this.#highest };
42384
- }
42385
- restore(checkpoint) {
42386
- this.#accepted.clear();
42387
- for (const messageId of checkpoint.accepted)
42388
- this.#accepted.add(messageId);
42389
- this.#highest = checkpoint.highest;
42390
- }
42391
- }
42392
-
42393
43288
  class MessageIdGenerator {
42394
43289
  #last = 0n;
42395
43290
  next(estimatedServerUnixMillis, randomLowBits, modulo) {
@@ -42449,158 +43344,8 @@ class AuthenticatedServerClock {
42449
43344
  return this.#serverUnixMilliseconds + elapsed;
42450
43345
  }
42451
43346
  }
42452
- var validateInboundMessageId = (messageId, direction, nowSeconds) => {
42453
- if (messageId === 0n || !Number.isFinite(nowSeconds))
42454
- return { kind: "bad", errorCode: 18 };
42455
- const validDirection = direction === "client" ? (messageId & 3n) === 0n && (messageId & 0xffffffffn) !== 0n : (messageId & 1n) === 1n;
42456
- if (!validDirection)
42457
- return { kind: "bad", errorCode: 18 };
42458
- const seconds = Number(messageId >> 32n);
42459
- if (seconds > nowSeconds + 30)
42460
- return { kind: "bad", errorCode: 17 };
42461
- if (seconds < nowSeconds - 300)
42462
- return { kind: "bad", errorCode: 20 };
42463
- return { kind: "valid" };
42464
- };
42465
-
42466
- class ReceiveSequenceValidator {
42467
- #received = [];
42468
- validate(messageId, sequenceNumber, contentRelated) {
42469
- if (!Number.isSafeInteger(sequenceNumber) || sequenceNumber < 0)
42470
- return 32;
42471
- if (contentRelated && sequenceNumber % 2 === 0)
42472
- return 35;
42473
- if (!contentRelated && sequenceNumber % 2 !== 0)
42474
- return 34;
42475
- let insertion = this.#received.findIndex((value) => value.messageId > messageId);
42476
- if (insertion < 0)
42477
- insertion = this.#received.length;
42478
- const previous = this.#received[insertion - 1];
42479
- const next = this.#received[insertion];
42480
- if (previous && previous.sequenceNumber > sequenceNumber)
42481
- return 32;
42482
- if (next && next.sequenceNumber < sequenceNumber)
42483
- return 33;
42484
- this.#received.splice(insertion, 0, { messageId, sequenceNumber });
42485
- if (this.#received.length > 1000)
42486
- this.#received.splice(0, this.#received.length - 1000);
42487
- return;
42488
- }
42489
- checkpoint() {
42490
- return this.#received.map((value) => ({ ...value }));
42491
- }
42492
- restore(checkpoint) {
42493
- this.#received.splice(0, this.#received.length, ...checkpoint.map((value) => ({ ...value })));
42494
- }
42495
- }
42496
-
42497
- class AcknowledgementQueue {
42498
- #pending = new Set;
42499
- add(messageId) {
42500
- if (this.#pending.size >= 8192 && !this.#pending.has(messageId))
42501
- throw new RangeError("Acknowledgement queue is full");
42502
- this.#pending.add(messageId);
42503
- }
42504
- drain(maximum = 8192) {
42505
- if (!Number.isSafeInteger(maximum) || maximum < 1 || maximum > 8192)
42506
- throw new RangeError("Invalid ACK batch size");
42507
- const result = [];
42508
- for (const messageId of this.#pending) {
42509
- result.push(messageId);
42510
- this.#pending.delete(messageId);
42511
- if (result.length === maximum)
42512
- break;
42513
- }
42514
- return result;
42515
- }
42516
- }
42517
-
42518
- class PendingMessageCache {
42519
- capacity;
42520
- byteCapacity;
42521
- #messages = new Map;
42522
- #retainedBytes = 0;
42523
- constructor(capacity = 8192, byteCapacity = 32 * 1024 * 1024) {
42524
- this.capacity = capacity;
42525
- this.byteCapacity = byteCapacity;
42526
- if (!Number.isSafeInteger(capacity) || capacity < 1 || capacity > 8192)
42527
- throw new RangeError("Invalid pending-message capacity");
42528
- if (!Number.isSafeInteger(byteCapacity) || byteCapacity < 1)
42529
- throw new RangeError("Invalid pending-message byte capacity");
42530
- }
42531
- get retainedBytes() {
42532
- return this.#retainedBytes;
42533
- }
42534
- retain(message) {
42535
- if (this.#messages.size >= this.capacity && !this.#messages.has(message.messageId)) {
42536
- throw new RangeError("Pending-message cache is full");
42537
- }
42538
- const previous = this.#messages.get(message.messageId);
42539
- const nextBytes = this.#retainedBytes - (previous?.body.length ?? 0) + message.body.length;
42540
- if (nextBytes > this.byteCapacity)
42541
- throw new RangeError("Pending-message byte capacity exceeded");
42542
- const body = message.body.slice();
42543
- this.#messages.set(message.messageId, { ...message, body });
42544
- this.#retainedBytes = nextBytes;
42545
- }
42546
- acknowledge(messageIds) {
42547
- for (const messageId of messageIds) {
42548
- const message = this.#messages.get(messageId);
42549
- if (!message)
42550
- continue;
42551
- this.#messages.delete(messageId);
42552
- this.#retainedBytes -= message.body.length;
42553
- }
42554
- }
42555
- resend(messageIds) {
42556
- return messageIds.flatMap((messageId) => {
42557
- const message = this.#messages.get(messageId);
42558
- return message ? [{ ...message, body: message.body.slice() }] : [];
42559
- });
42560
- }
42561
- state(messageIds) {
42562
- return Uint8Array.from(messageIds, (messageId) => this.#messages.has(messageId) ? 4 : 1);
42563
- }
42564
- dropRpcResult(requestMessageId) {
42565
- for (const [messageId, message] of this.#messages) {
42566
- if (message.body.length < 12)
42567
- continue;
42568
- const view = new DataView(message.body.buffer, message.body.byteOffset, message.body.byteLength);
42569
- if (view.getUint32(0, true) !== 4082920705 || view.getBigInt64(4, true) !== requestMessageId)
42570
- continue;
42571
- this.#messages.delete(messageId);
42572
- this.#retainedBytes -= message.body.length;
42573
- return { ...message, body: message.body.slice() };
42574
- }
42575
- return;
42576
- }
42577
- }
42578
-
42579
- class BadMessageRecovery {
42580
- #outstanding = new Map;
42581
- add(messageId, sequenceNumber) {
42582
- if (this.#outstanding.size >= 8192 && !this.#outstanding.has(messageId))
42583
- throw new RangeError("Outstanding-message limit reached");
42584
- this.#outstanding.set(messageId, sequenceNumber);
42585
- }
42586
- accept(input) {
42587
- const sequence = this.#outstanding.get(input.badMessageId);
42588
- if (sequence === undefined || sequence !== input.badSequenceNumber)
42589
- return { kind: "fatal" };
42590
- if (input.errorCode === 16 || input.errorCode === 17) {
42591
- if ((input.outerServerMessageId & 1n) !== 1n)
42592
- return { kind: "fatal" };
42593
- return { kind: "time", serverSeconds: Number(input.outerServerMessageId >> 32n) };
42594
- }
42595
- if (input.errorCode === 48)
42596
- return { kind: "salt" };
42597
- return { kind: "fatal" };
42598
- }
42599
- }
42600
43347
  // node_modules/@inline-chat/protocol/dist/secure/service.js
42601
- var MAX_CONTAINER_MESSAGES = 1024;
42602
43348
  var MAX_SERVICE_MESSAGE_IDS = 8192;
42603
- var MAX_GZIP_OUTPUT_BYTES = MAX_PACKET_BYTES;
42604
43349
  var ServiceConstructor = {
42605
43350
  rpcResult: 4082920705,
42606
43351
  rpcError: 558156313,
@@ -42656,61 +43401,6 @@ var decodeMessageIds = (body, expected) => {
42656
43401
  reader.expectEnd();
42657
43402
  return ids;
42658
43403
  };
42659
- var decodeMessageContainer = (body) => {
42660
- const reader = readerFor(body, ServiceConstructor.msgContainer);
42661
- const count = reader.readInt();
42662
- if (count < 1 || count > MAX_CONTAINER_MESSAGES)
42663
- throw new RangeError("Invalid message-container count");
42664
- const messages = [];
42665
- for (let index = 0;index < count; index += 1) {
42666
- const messageId = reader.readLong();
42667
- const sequenceNumber = reader.readInt();
42668
- const bytes = reader.readInt();
42669
- if (bytes < 4 || bytes > MAX_PACKET_BYTES || bytes % 4 !== 0)
42670
- throw new RangeError("Invalid contained body length");
42671
- const child = reader.readFixed(bytes);
42672
- if (readInt32LE(child, 0) >>> 0 === ServiceConstructor.msgContainer) {
42673
- throw new RangeError("Nested message containers are forbidden");
42674
- }
42675
- messages.push({ messageId, sequenceNumber, body: child });
42676
- }
42677
- reader.expectEnd();
42678
- return messages;
42679
- };
42680
- var decodeMsgCopy = (body) => {
42681
- const reader = readerFor(body, ServiceConstructor.msgCopy);
42682
- const messageId = reader.readLong();
42683
- const sequenceNumber = reader.readInt();
42684
- const length = reader.readInt();
42685
- if (length < 4 || length > MAX_PACKET_BYTES || length % 4 !== 0) {
42686
- throw new RangeError("Invalid copied body length");
42687
- }
42688
- const copied = reader.readFixed(length);
42689
- reader.expectEnd();
42690
- if (readInt32LE(copied, 0) >>> 0 === ServiceConstructor.msgContainer) {
42691
- throw new RangeError("A copied message cannot contain a container");
42692
- }
42693
- return { messageId, sequenceNumber, body: copied };
42694
- };
42695
- var decodeInvokeAfter = (body) => {
42696
- const id = serviceConstructor(body);
42697
- const reader = readerFor(body, id);
42698
- let messageIds;
42699
- if (id === ServiceConstructor.invokeAfterMsg) {
42700
- messageIds = [reader.readLong()];
42701
- } else if (id === ServiceConstructor.invokeAfterMsgs) {
42702
- messageIds = reader.readVector((item) => item.readLong(), MAX_SERVICE_MESSAGE_IDS);
42703
- } else {
42704
- throw new RangeError("Unexpected invoke-after constructor");
42705
- }
42706
- const query = reader.readFixed(reader.remaining);
42707
- requireAlignedBody(query);
42708
- return { messageIds, query };
42709
- };
42710
- var encodeRpcResult = (requestMessageId, result) => {
42711
- requireAlignedBody(result);
42712
- return fixedBody(ServiceConstructor.rpcResult, int64LE(requestMessageId), result);
42713
- };
42714
43404
  var decodeRpcResult = (body) => {
42715
43405
  const reader = readerFor(body, ServiceConstructor.rpcResult);
42716
43406
  const requestMessageId = reader.readLong();
@@ -42718,7 +43408,6 @@ var decodeRpcResult = (body) => {
42718
43408
  requireAlignedBody(result);
42719
43409
  return { requestMessageId, result };
42720
43410
  };
42721
- var encodeRpcError = (code, message) => fixedBody(ServiceConstructor.rpcError, int32LE(code), encodeTlBytes(new TextEncoder().encode(message)));
42722
43411
  var decodeRpcError = (body) => {
42723
43412
  const reader = readerFor(body, ServiceConstructor.rpcError);
42724
43413
  const code = reader.readInt();
@@ -42726,54 +43415,8 @@ var decodeRpcError = (body) => {
42726
43415
  reader.expectEnd();
42727
43416
  return { code, message };
42728
43417
  };
42729
- var decodeRpcDropAnswer = (body) => {
42730
- const reader = readerFor(body, ServiceConstructor.rpcDropAnswer);
42731
- const requestMessageId = reader.readLong();
42732
- reader.expectEnd();
42733
- return requestMessageId;
42734
- };
42735
- var encodeRpcDropAnswerResult = (result) => {
42736
- if (result.kind === "unknown")
42737
- return fixedBody(ServiceConstructor.rpcAnswerUnknown);
42738
- if (result.kind === "running")
42739
- return fixedBody(ServiceConstructor.rpcAnswerDroppedRunning);
42740
- if (!Number.isSafeInteger(result.bytes) || result.bytes < 0 || result.bytes > MAX_PACKET_BYTES) {
42741
- throw new RangeError("Invalid dropped-answer byte count");
42742
- }
42743
- return fixedBody(ServiceConstructor.rpcAnswerDropped, int64LE(result.messageId), int32LE(result.sequenceNumber), int32LE(result.bytes));
42744
- };
42745
- var decodeHttpWait = (body) => {
42746
- const reader = readerFor(body, ServiceConstructor.httpWait);
42747
- const result = {
42748
- maximumDelay: reader.readInt(),
42749
- waitAfter: reader.readInt(),
42750
- maximumWait: reader.readInt()
42751
- };
42752
- reader.expectEnd();
42753
- if (Object.values(result).some((value) => value < 0))
42754
- throw new RangeError("Invalid HTTP wait interval");
42755
- return result;
42756
- };
42757
43418
  var encodeMsgsAck = (messageIds) => encodeMessageIds(ServiceConstructor.msgsAck, messageIds);
42758
43419
  var decodeMsgsAck = (body) => decodeMessageIds(body, ServiceConstructor.msgsAck);
42759
- var decodeMsgResendReq = (body) => decodeMessageIds(body, ServiceConstructor.msgResendReq);
42760
- var decodeMsgsStateReq = (body) => decodeMessageIds(body, ServiceConstructor.msgsStateReq);
42761
- var encodeMsgsStateInfo = (requestMessageId, states) => {
42762
- if (states.length > MAX_SERVICE_MESSAGE_IDS)
42763
- throw new RangeError("Too many message states");
42764
- return fixedBody(ServiceConstructor.msgsStateInfo, int64LE(requestMessageId), encodeTlBytes(states));
42765
- };
42766
- var decodeMsgsAllInfo = (body) => {
42767
- const reader = readerFor(body, ServiceConstructor.msgsAllInfo);
42768
- const messageIds = reader.readVector((item) => item.readLong(), MAX_SERVICE_MESSAGE_IDS);
42769
- const states = reader.readBytes();
42770
- reader.expectEnd();
42771
- if (messageIds.length !== states.length)
42772
- throw new RangeError("Message-state cardinality mismatch");
42773
- return { messageIds, states };
42774
- };
42775
- var encodeBadMsgNotification = (badMessageId, badSequenceNumber, errorCode) => fixedBody(ServiceConstructor.badMsgNotification, int64LE(badMessageId), int32LE(badSequenceNumber), int32LE(errorCode));
42776
- var encodeBadServerSalt = (badMessageId, badSequenceNumber, errorCode, newServerSalt) => fixedBody(ServiceConstructor.badServerSalt, int64LE(badMessageId), int32LE(badSequenceNumber), int32LE(errorCode), int64LE(newServerSalt));
42777
43420
  var decodeBadMessageNotification = (body) => {
42778
43421
  if (body.length !== 20 && body.length !== 28)
42779
43422
  throw new RangeError("Invalid bad-message notification");
@@ -42792,46 +43435,6 @@ var decodeBadMessageNotification = (body) => {
42792
43435
  };
42793
43436
  };
42794
43437
  var encodePing = (pingId) => fixedBody(ServiceConstructor.ping, int64LE(pingId));
42795
- var encodePong = (messageId, pingId) => fixedBody(ServiceConstructor.pong, int64LE(messageId), int64LE(pingId));
42796
- var encodeNewSessionCreated = (firstMessageId, uniqueId, serverSalt) => fixedBody(ServiceConstructor.newSessionCreated, int64LE(firstMessageId), int64LE(uniqueId), int64LE(serverSalt));
42797
- var decodeGetFutureSalts = (body) => {
42798
- const reader = readerFor(body, ServiceConstructor.getFutureSalts);
42799
- const count = reader.readInt();
42800
- reader.expectEnd();
42801
- if (count < 1 || count > 64)
42802
- throw new RangeError("Invalid future-salt count");
42803
- return count;
42804
- };
42805
- var encodeFutureSalts = (requestMessageId, now, salts) => {
42806
- if (salts.length < 1 || salts.length > 64)
42807
- throw new RangeError("Invalid future-salt count");
42808
- return fixedBody(ServiceConstructor.futureSalts, int64LE(requestMessageId), int32LE(now), encodeTlVector(salts.map((salt) => {
42809
- if (!Number.isInteger(salt.validSince) || !Number.isInteger(salt.validUntil) || salt.validUntil <= salt.validSince)
42810
- throw new RangeError("Invalid future-salt interval");
42811
- return fixedBody(ServiceConstructor.futureSalt, int32LE(salt.validSince), int32LE(salt.validUntil), int64LE(salt.salt));
42812
- })));
42813
- };
42814
- var decodeDestroySession = (body) => {
42815
- const reader = readerFor(body, ServiceConstructor.destroySession);
42816
- const sessionId = reader.readLong();
42817
- reader.expectEnd();
42818
- return sessionId;
42819
- };
42820
- var encodeDestroySessionResult = (sessionId, found) => fixedBody(found ? ServiceConstructor.destroySessionOk : ServiceConstructor.destroySessionNone, int64LE(sessionId));
42821
- var encodeDestroyAuthKeyResult = (result) => fixedBody(result === "ok" ? ServiceConstructor.destroyAuthKeyOk : result === "none" ? ServiceConstructor.destroyAuthKeyNone : ServiceConstructor.destroyAuthKeyFail);
42822
- var decodeGzipPacked = (body, gunzip, maximumOutputBytes = MAX_GZIP_OUTPUT_BYTES) => {
42823
- if (maximumOutputBytes < 4 || maximumOutputBytes > MAX_GZIP_OUTPUT_BYTES) {
42824
- throw new RangeError("Invalid gzip output limit");
42825
- }
42826
- const reader = readerFor(body, ServiceConstructor.gzipPacked);
42827
- const packed = reader.readBytes();
42828
- reader.expectEnd();
42829
- const unpacked = gunzip(packed, maximumOutputBytes);
42830
- if (unpacked.length < 4 || unpacked.length > maximumOutputBytes || unpacked.length % 4 !== 0) {
42831
- throw new RangeError("Invalid decompressed MTProto object");
42832
- }
42833
- return unpacked;
42834
- };
42835
43438
  var serviceConstructor = (body) => {
42836
43439
  requireAlignedBody(body);
42837
43440
  return readInt32LE(body, 0) >>> 0;
@@ -42843,27 +43446,6 @@ var readerFor = (body, expected) => {
42843
43446
  return new TlReader(body.slice(4));
42844
43447
  };
42845
43448
  // node_modules/@inline-chat/protocol/dist/secure/serverSession.js
42846
- var BOOL_TRUE = 2574415285;
42847
- var MAX_SESSION_OUTPUTS = 2048;
42848
- var MAX_COMPLETED_INCOMING_MESSAGES = 8192;
42849
- var MAX_DEFERRED_INVOKE_AFTER = 1024;
42850
- var MAX_IN_FLIGHT_APPLICATIONS = 64;
42851
- var MAX_INVOKE_AFTER_NESTING = 16;
42852
- var DEFAULT_APPLICATION_TIMEOUT_MS = 30000;
42853
-
42854
- class InlineProtocolAuthorizationInvalidated extends Error {
42855
- constructor() {
42856
- super("Authorization key is no longer active");
42857
- this.name = "InlineProtocolAuthorizationInvalidated";
42858
- }
42859
- }
42860
-
42861
- class InlineProtocolApplicationOutputOverloaded extends Error {
42862
- constructor() {
42863
- super("Inline Protocol application update capacity exceeded");
42864
- this.name = "InlineProtocolApplicationOutputOverloaded";
42865
- }
42866
- }
42867
43449
  var NON_CONTENT_CONSTRUCTORS = new Set([
42868
43450
  ServiceConstructor.msgContainer,
42869
43451
  ServiceConstructor.msgsAck,
@@ -42878,861 +43460,8 @@ var NON_CONTENT_CONSTRUCTORS = new Set([
42878
43460
  ServiceConstructor.pong,
42879
43461
  ServiceConstructor.httpWait
42880
43462
  ]);
42881
-
42882
- class InlineProtocolServerSession {
42883
- options;
42884
- #messageIds = new MessageIdGenerator;
42885
- #sequenceNumbers = new SequenceNumberGenerator;
42886
- #receivedIds = new ReceiveMessageWindow;
42887
- #receivedSequences = new ReceiveSequenceValidator;
42888
- #acknowledgements = new AcknowledgementQueue;
42889
- #pending = new PendingMessageCache;
42890
- #completedIncoming = new Map;
42891
- #deferredInvokeAfter = new Map;
42892
- #inFlightApplications = new Set;
42893
- #droppedApplicationAnswers = new Set;
42894
- #handshake;
42895
- #authorization;
42896
- #sessionId;
42897
- #destroyed = false;
42898
- constructor(options) {
42899
- this.options = options;
42900
- const applicationTimeoutMs = options.applicationTimeoutMs ?? DEFAULT_APPLICATION_TIMEOUT_MS;
42901
- if (!Number.isSafeInteger(applicationTimeoutMs) || applicationTimeoutMs < 1) {
42902
- throw new RangeError("Invalid Inline Protocol application timeout");
42903
- }
42904
- this.#handshake = new InlineHandshakeServer({
42905
- rsaKeys: options.rsaKeys,
42906
- randomBytes: options.randomBytes,
42907
- nowSeconds: () => Math.floor(options.nowMilliseconds() / 1000),
42908
- authorizationKeys: {
42909
- create: (key) => options.authorizationKeys.create(key)
42910
- },
42911
- dc: options.dc
42912
- });
42913
- }
42914
- get destroyed() {
42915
- return this.#destroyed;
42916
- }
42917
- get hasEstablishedAuthorization() {
42918
- return this.#authorization !== undefined;
42919
- }
42920
- async receive(payload, receiveOptions = {}) {
42921
- const accepted = await this.receiveConcurrent(payload, receiveOptions);
42922
- const responses = [...accepted.responses];
42923
- const applicationTasks = [...accepted.applicationTasks];
42924
- while (applicationTasks.length > 0) {
42925
- const task = applicationTasks.shift();
42926
- const completion = await task.dispatch();
42927
- const finalized = await completion.finalize();
42928
- responses.push(...finalized.responses);
42929
- applicationTasks.push(...finalized.applicationTasks);
42930
- if (responses.length > MAX_SESSION_OUTPUTS)
42931
- throw new RangeError("Too many Inline Protocol outputs");
42932
- }
42933
- return responses;
42934
- }
42935
- async receiveConcurrent(payload, receiveOptions = {}) {
42936
- if (this.#destroyed)
42937
- throw new InvalidEncryptedRecord;
42938
- if (payload.length < 8 || payload.length > MAX_PACKET_BYTES)
42939
- throw new InvalidEncryptedRecord;
42940
- if (payload.slice(0, 8).every((byte) => byte === 0)) {
42941
- return { responses: [await this.#receiveHandshake(payload)], applicationTasks: [] };
42942
- }
42943
- return this.#receiveEncrypted(payload, receiveOptions);
42944
- }
42945
- sendApplicationUpdate(payload) {
42946
- if (this.#destroyed)
42947
- throw new InvalidEncryptedRecord;
42948
- return this.#encryptOutgoing(encodeInlineUpdate(payload), true, 3);
42949
- }
42950
- async#receiveHandshake(payload) {
42951
- if (this.#authorization !== undefined)
42952
- throw new InvalidEncryptedRecord;
42953
- const request = decodeUnencryptedRecord(payload);
42954
- const validation = validateInboundMessageId(request.messageId, "client", Math.floor(this.options.nowMilliseconds() / 1000));
42955
- if (validation.kind === "bad")
42956
- throw new InvalidEncryptedRecord;
42957
- const result = await this.#handshake.receive(request.body);
42958
- if (result.established) {
42959
- this.#authorization = {
42960
- ...result.established,
42961
- currentServerSalt: result.established.serverSalt
42962
- };
42963
- }
42964
- return encodeUnencryptedRecord(this.#nextServerMessageId(1), result.response);
42965
- }
42966
- async#receiveEncrypted(payload, receiveOptions) {
42967
- const authKeyId2 = payload.slice(0, 8);
42968
- if (!this.#authorization || bytesToHex(this.#authorization.keyId) !== bytesToHex(authKeyId2)) {
42969
- if (this.#sessionId !== undefined)
42970
- throw new InvalidEncryptedRecord;
42971
- const loaded = await this.options.authorizationKeys.load(authKeyId2);
42972
- if (!loaded)
42973
- throw new InlineProtocolAuthorizationInvalidated;
42974
- this.#authorization = loaded;
42975
- this.#sessionId = undefined;
42976
- }
42977
- const authorization = this.#authorization;
42978
- let fields;
42979
- let quickAckId;
42980
- try {
42981
- const decrypted = decryptRecordWithMetadata(payload, authorization.key, {
42982
- direction: "client-to-server",
42983
- sessionId: this.#sessionId,
42984
- validServerSalts: new Set([
42985
- authorization.currentServerSalt,
42986
- ...authorization.previousServerSalt === undefined ? [] : [authorization.previousServerSalt]
42987
- ]),
42988
- nowSeconds: Math.floor(this.options.nowMilliseconds() / 1000)
42989
- });
42990
- fields = decrypted.fields;
42991
- quickAckId = decrypted.quickAckId;
42992
- } catch (error) {
42993
- if (error instanceof RecoverableEncryptedRecordError && (this.#sessionId === undefined || this.#sessionId === error.fields.sessionId)) {
42994
- this.#sessionId = error.fields.sessionId;
42995
- const recovery = error.errorCode === 48 ? encodeBadServerSalt(error.fields.messageId, error.fields.sequenceNumber, 48, authorization.currentServerSalt) : encodeBadMsgNotification(error.fields.messageId, error.fields.sequenceNumber, error.errorCode);
42996
- return {
42997
- responses: [this.#encryptOutgoing(recovery, false, 1)],
42998
- applicationTasks: []
42999
- };
43000
- }
43001
- throw error;
43002
- }
43003
- const newSession = this.#sessionId === undefined;
43004
- this.#sessionId ??= fields.sessionId;
43005
- if (fields.sessionId !== this.#sessionId)
43006
- throw new InvalidEncryptedRecord;
43007
- const receivedIdsCheckpoint = this.#receivedIds.checkpoint();
43008
- const receivedSequencesCheckpoint = this.#receivedSequences.checkpoint();
43009
- let messages;
43010
- if (serviceConstructor(fields.body) === ServiceConstructor.msgContainer) {
43011
- const outerError = this.#validateLogical(fields, false, true);
43012
- if (outerError !== undefined) {
43013
- this.#receivedIds.restore(receivedIdsCheckpoint);
43014
- this.#receivedSequences.restore(receivedSequencesCheckpoint);
43015
- return {
43016
- responses: [this.#encryptOutgoing(encodeBadMsgNotification(fields.messageId, fields.sequenceNumber, outerError), false, 1)],
43017
- applicationTasks: []
43018
- };
43019
- }
43020
- messages = this.#expandContainer(fields);
43021
- } else {
43022
- messages = [fields];
43023
- }
43024
- const prepared = [];
43025
- for (const message of messages) {
43026
- const originalBody = message.body;
43027
- const unwrapped = this.#unwrapInvokeAfter(originalBody);
43028
- const constructor3 = serviceConstructor(unwrapped.body);
43029
- const contentRelated = unwrapped.wrapped || this.#isContentRelated(constructor3);
43030
- const allowDuplicate = unwrapped.wrapped || constructor3 === BindingConstructor.bindTempAuthKey || constructor3 === ServiceConstructor.gzipPacked || constructor3 === ServiceConstructor.msgCopy || constructor3 === INLINE_INVOKE_CONSTRUCTOR;
43031
- const duplicate = this.#receivedIds.has(message.messageId);
43032
- const validation = this.#validateLogical(message, contentRelated, allowDuplicate);
43033
- if (validation !== undefined) {
43034
- this.#receivedIds.restore(receivedIdsCheckpoint);
43035
- this.#receivedSequences.restore(receivedSequencesCheckpoint);
43036
- return {
43037
- responses: [this.#encryptOutgoing(encodeBadMsgNotification(message.messageId, message.sequenceNumber, validation), false, 1)],
43038
- applicationTasks: []
43039
- };
43040
- }
43041
- prepared.push({
43042
- message: !unwrapped.wrapped ? message : {
43043
- ...message,
43044
- body: unwrapped.body,
43045
- authenticatedBody: message.authenticatedBody ?? originalBody
43046
- },
43047
- constructor: constructor3,
43048
- contentRelated,
43049
- duplicate,
43050
- dependencies: unwrapped.dependencies
43051
- });
43052
- }
43053
- receiveOptions.onQuickAck?.(quickAckId);
43054
- const prefixResponses = [];
43055
- if (newSession) {
43056
- const firstContent = prepared.find((item) => item.contentRelated)?.message;
43057
- if (firstContent) {
43058
- prefixResponses.push(this.#encryptOutgoing(encodeNewSessionCreated(firstContent.messageId, readInt64LE(this.options.randomBytes(8), 0), authorization.currentServerSalt), true, 1));
43059
- }
43060
- }
43061
- const responses = [];
43062
- const applicationTasks = [];
43063
- for (const item of prepared) {
43064
- if (item.contentRelated)
43065
- this.#acknowledgements.add(item.message.messageId);
43066
- if (this.#dependenciesComplete(item.dependencies)) {
43067
- const handled = await this.#completePreparedConcurrent(item);
43068
- responses.push(...handled.responses);
43069
- applicationTasks.push(...handled.applicationTasks);
43070
- const deferred = await this.#drainDeferredConcurrent();
43071
- responses.push(...deferred.responses);
43072
- applicationTasks.push(...deferred.applicationTasks);
43073
- } else {
43074
- this.#defer(item);
43075
- }
43076
- if (prefixResponses.length + responses.length > MAX_SESSION_OUTPUTS) {
43077
- throw new RangeError("Too many Inline Protocol outputs");
43078
- }
43079
- }
43080
- const acknowledgements = this.#acknowledgements.drain();
43081
- const acknowledgementResponses = acknowledgements.length > 0 ? [this.#encryptOutgoing(encodeMsgsAck(acknowledgements), false, 1)] : [];
43082
- return {
43083
- responses: [...prefixResponses, ...acknowledgementResponses, ...responses],
43084
- applicationTasks
43085
- };
43086
- }
43087
- #expandContainer(outer) {
43088
- const children = decodeMessageContainer(outer.body);
43089
- if (children.some((child) => child.messageId >= outer.messageId))
43090
- throw new RangeError("Container ID must exceed child IDs");
43091
- return children;
43092
- }
43093
- #unwrapInvokeAfter(body) {
43094
- const dependencies = [];
43095
- let query = body;
43096
- for (let depth = 0;depth < MAX_INVOKE_AFTER_NESTING; depth += 1) {
43097
- const constructor3 = serviceConstructor(query);
43098
- if (constructor3 !== ServiceConstructor.invokeAfterMsg && constructor3 !== ServiceConstructor.invokeAfterMsgs) {
43099
- return { body: query, dependencies, wrapped: dependencies.length > 0 || query !== body };
43100
- }
43101
- const wrapper = decodeInvokeAfter(query);
43102
- dependencies.push(...wrapper.messageIds);
43103
- if (dependencies.length > 8192)
43104
- throw new RangeError("Too many invoke-after dependencies");
43105
- query = wrapper.query;
43106
- }
43107
- throw new RangeError("Invoke-after nesting exceeds the limit");
43108
- }
43109
- #dependenciesComplete(dependencies) {
43110
- return dependencies.every((messageId) => this.#completedIncoming.has(messageId));
43111
- }
43112
- #defer(item) {
43113
- const existing = this.#deferredInvokeAfter.get(item.message.messageId);
43114
- if (existing) {
43115
- if (!equalBytes(existing.message.authenticatedBody ?? existing.message.body, item.message.authenticatedBody ?? item.message.body))
43116
- throw new RangeError("Conflicting deferred invoke-after replay");
43117
- return;
43118
- }
43119
- if (this.#deferredInvokeAfter.size >= MAX_DEFERRED_INVOKE_AFTER) {
43120
- throw new RangeError("Too many deferred invoke-after queries");
43121
- }
43122
- this.#deferredInvokeAfter.set(item.message.messageId, item);
43123
- }
43124
- async#completePreparedConcurrent(item) {
43125
- const handled = await this.#handleLogicalConcurrent(item.message, item);
43126
- if (handled.completed)
43127
- this.#markCompleted(item.message.messageId);
43128
- return handled.result;
43129
- }
43130
- #markCompleted(messageId) {
43131
- this.#completedIncoming.delete(messageId);
43132
- this.#completedIncoming.set(messageId, true);
43133
- if (this.#completedIncoming.size > MAX_COMPLETED_INCOMING_MESSAGES) {
43134
- const oldest = this.#completedIncoming.keys().next().value;
43135
- if (oldest !== undefined)
43136
- this.#completedIncoming.delete(oldest);
43137
- }
43138
- }
43139
- async#drainDeferredConcurrent() {
43140
- const responses = [];
43141
- const applicationTasks = [];
43142
- let madeProgress = true;
43143
- while (madeProgress) {
43144
- madeProgress = false;
43145
- for (const [messageId, item] of this.#deferredInvokeAfter) {
43146
- if (!this.#dependenciesComplete(item.dependencies))
43147
- continue;
43148
- this.#deferredInvokeAfter.delete(messageId);
43149
- const handled = await this.#completePreparedConcurrent(item);
43150
- responses.push(...handled.responses);
43151
- applicationTasks.push(...handled.applicationTasks);
43152
- if (responses.length > MAX_SESSION_OUTPUTS)
43153
- throw new RangeError("Too many Inline Protocol outputs");
43154
- madeProgress = true;
43155
- }
43156
- }
43157
- return { responses, applicationTasks };
43158
- }
43159
- async#handleLogicalConcurrent(message, prepared, completionMessageIds = [message.messageId]) {
43160
- const constructor3 = prepared?.constructor ?? serviceConstructor(message.body);
43161
- const contentRelated = prepared?.contentRelated ?? this.#isContentRelated(constructor3);
43162
- const allowDuplicate = constructor3 === BindingConstructor.bindTempAuthKey || constructor3 === ServiceConstructor.gzipPacked || constructor3 === ServiceConstructor.msgCopy || constructor3 === INLINE_INVOKE_CONSTRUCTOR;
43163
- const duplicate = prepared?.duplicate ?? this.#receivedIds.has(message.messageId);
43164
- if (!prepared) {
43165
- const validation = this.#validateLogical(message, contentRelated, allowDuplicate);
43166
- if (validation !== undefined) {
43167
- return {
43168
- result: {
43169
- responses: [this.#encryptOutgoing(encodeBadMsgNotification(message.messageId, message.sequenceNumber, validation), false, 1)],
43170
- applicationTasks: []
43171
- },
43172
- completed: true
43173
- };
43174
- }
43175
- if (contentRelated)
43176
- this.#acknowledgements.add(message.messageId);
43177
- }
43178
- if (duplicate && !allowDuplicate) {
43179
- return { result: { responses: [], applicationTasks: [] }, completed: true };
43180
- }
43181
- if (constructor3 === ServiceConstructor.gzipPacked) {
43182
- const unpacked = decodeGzipPacked(message.body, this.options.gunzip);
43183
- const unpackedMessage = {
43184
- ...message,
43185
- body: unpacked,
43186
- authenticatedBody: message.authenticatedBody ?? message.body
43187
- };
43188
- return this.#handleLogicalConcurrent(unpackedMessage, {
43189
- message: unpackedMessage,
43190
- constructor: serviceConstructor(unpacked),
43191
- contentRelated,
43192
- duplicate,
43193
- dependencies: prepared?.dependencies ?? []
43194
- }, completionMessageIds);
43195
- }
43196
- if (constructor3 === ServiceConstructor.msgCopy) {
43197
- const copied = decodeMsgCopy(message.body);
43198
- return this.#handleLogicalConcurrent({
43199
- ...copied,
43200
- authenticatedBody: copied.body
43201
- }, undefined, [...completionMessageIds, copied.messageId]);
43202
- }
43203
- if (constructor3 === INLINE_INVOKE_CONSTRUCTOR) {
43204
- return this.#acceptApplication(message, completionMessageIds);
43205
- }
43206
- return {
43207
- result: {
43208
- responses: await this.#handleLogical(message, prepared),
43209
- applicationTasks: []
43210
- },
43211
- completed: true
43212
- };
43213
- }
43214
- async#handleLogical(message, prepared) {
43215
- const constructor3 = prepared?.constructor ?? serviceConstructor(message.body);
43216
- const contentRelated = prepared?.contentRelated ?? this.#isContentRelated(constructor3);
43217
- const allowDuplicate = constructor3 === BindingConstructor.bindTempAuthKey || constructor3 === ServiceConstructor.gzipPacked || constructor3 === ServiceConstructor.msgCopy || constructor3 === INLINE_INVOKE_CONSTRUCTOR;
43218
- const duplicate = prepared?.duplicate ?? this.#receivedIds.has(message.messageId);
43219
- if (!prepared) {
43220
- const validation = this.#validateLogical(message, contentRelated, allowDuplicate);
43221
- if (validation !== undefined) {
43222
- return [this.#encryptOutgoing(encodeBadMsgNotification(message.messageId, message.sequenceNumber, validation), false, 1)];
43223
- }
43224
- }
43225
- if (contentRelated)
43226
- this.#acknowledgements.add(message.messageId);
43227
- if (duplicate && !allowDuplicate)
43228
- return [];
43229
- switch (constructor3) {
43230
- case ServiceConstructor.msgsAck:
43231
- this.#pending.acknowledge(decodeMsgsAck(message.body));
43232
- return [];
43233
- case ServiceConstructor.msgResendReq: {
43234
- const messageIds = decodeMsgResendReq(message.body);
43235
- const pendingMessages = this.#pending.resend(messageIds);
43236
- if (pendingMessages.length !== messageIds.length) {
43237
- return [this.#encryptOutgoing(encodeMsgsStateInfo(message.messageId, this.#pending.state(messageIds)), false, 1)];
43238
- }
43239
- return pendingMessages.map((pending) => this.#encryptOutgoing(pending.body, pending.sequenceNumber % 2 === 1, 1, pending.messageId, pending.sequenceNumber));
43240
- }
43241
- case ServiceConstructor.msgsStateReq: {
43242
- const ids = decodeMsgsStateReq(message.body);
43243
- const states = Uint8Array.from(ids, (id) => this.#receivedIds.has(id) ? 4 : 1);
43244
- return [this.#encryptOutgoing(encodeMsgsStateInfo(message.messageId, states), false, 1)];
43245
- }
43246
- case ServiceConstructor.msgsAllInfo: {
43247
- const { messageIds, states } = decodeMsgsAllInfo(message.body);
43248
- this.#pending.acknowledge(messageIds.filter((_, index) => {
43249
- const state = states[index];
43250
- return (state & 7) === 4 || (state & 128) !== 0;
43251
- }));
43252
- return [];
43253
- }
43254
- case ServiceConstructor.ping:
43255
- case ServiceConstructor.pingDelayDisconnect: {
43256
- if (message.body.length !== (constructor3 === ServiceConstructor.ping ? 12 : 16))
43257
- throw new RangeError("Invalid ping");
43258
- return [this.#encryptOutgoing(encodePong(message.messageId, readInt64LE(message.body, 4)), false, 1)];
43259
- }
43260
- case ServiceConstructor.httpWait:
43261
- decodeHttpWait(message.body);
43262
- if (this.options.carrierProfile !== "http") {
43263
- throw new RangeError("HTTP wait is invalid outside the HTTP carrier profile");
43264
- }
43265
- return [];
43266
- case ServiceConstructor.rpcDropAnswer: {
43267
- const requestMessageId = decodeRpcDropAnswer(message.body);
43268
- const dropped = this.#pending.dropRpcResult(requestMessageId);
43269
- if (dropped) {
43270
- await this.options.replay.forgetAnswer({
43271
- authKeyId: this.#authorization.keyId,
43272
- sessionId: this.#sessionId,
43273
- messageId: requestMessageId,
43274
- forgottenResultBody: encodeRpcResult(requestMessageId, encodeRpcDropAnswerResult({ kind: "unknown" }))
43275
- });
43276
- }
43277
- const status = dropped ? {
43278
- kind: "dropped",
43279
- messageId: dropped.messageId,
43280
- sequenceNumber: dropped.sequenceNumber,
43281
- bytes: dropped.body.length
43282
- } : await this.options.replay.dropAnswer({
43283
- authKeyId: this.#authorization.keyId,
43284
- sessionId: this.#sessionId,
43285
- messageId: requestMessageId,
43286
- runningResultBody: encodeRpcResult(requestMessageId, encodeRpcDropAnswerResult({ kind: "running" }))
43287
- }) === "running" ? { kind: "running" } : { kind: "unknown" };
43288
- if (status.kind === "running")
43289
- this.#droppedApplicationAnswers.add(requestMessageId);
43290
- return [this.#encryptOutgoing(encodeRpcResult(message.messageId, encodeRpcDropAnswerResult(status)), true, 1)];
43291
- }
43292
- case ServiceConstructor.gzipPacked: {
43293
- const unpacked = decodeGzipPacked(message.body, this.options.gunzip);
43294
- return this.#handleLogical({
43295
- ...message,
43296
- body: unpacked,
43297
- authenticatedBody: message.authenticatedBody ?? message.body
43298
- });
43299
- }
43300
- case ServiceConstructor.msgCopy: {
43301
- const copied = decodeMsgCopy(message.body);
43302
- return this.#handleLogical({
43303
- ...copied,
43304
- authenticatedBody: copied.body
43305
- });
43306
- }
43307
- case ServiceConstructor.getFutureSalts: {
43308
- decodeGetFutureSalts(message.body);
43309
- const now = Math.floor(this.options.nowMilliseconds() / 1000);
43310
- const newSalt = readInt64LE(this.options.randomBytes(8), 0);
43311
- const response = this.#encryptOutgoing(encodeFutureSalts(message.messageId, now, [{
43312
- validSince: now,
43313
- validUntil: now + 30 * 60,
43314
- salt: newSalt
43315
- }]), true, 1);
43316
- if (!await this.options.authorizationKeys.rotateServerSalt(this.#authorization.keyId, newSalt)) {
43317
- throw new RangeError("Authorization key disappeared during salt rotation");
43318
- }
43319
- this.#authorization.previousServerSalt = this.#authorization.currentServerSalt;
43320
- this.#authorization.currentServerSalt = newSalt;
43321
- return [response];
43322
- }
43323
- case ServiceConstructor.destroySession: {
43324
- const target = decodeDestroySession(message.body);
43325
- const found = target === this.#sessionId;
43326
- const response = this.#encryptOutgoing(encodeDestroySessionResult(target, found), true, 1);
43327
- if (found)
43328
- this.#destroyed = true;
43329
- return [response];
43330
- }
43331
- case ServiceConstructor.destroyAuthKey: {
43332
- if (message.body.length !== 4)
43333
- throw new RangeError("Invalid destroy-auth-key request");
43334
- const revoked = await this.options.authorizationKeys.revoke(this.#authorization.keyId);
43335
- const response = this.#encryptOutgoing(encodeDestroyAuthKeyResult(revoked ? "ok" : "none"), true, 1);
43336
- if (revoked)
43337
- this.#destroyed = true;
43338
- return [response];
43339
- }
43340
- case BindingConstructor.bindTempAuthKey:
43341
- return [await this.#bindTemporary(message)];
43342
- default:
43343
- return this.#dispatchApplication(message);
43344
- }
43345
- }
43346
- async#bindTemporary(message) {
43347
- const temporary = this.#authorization;
43348
- if (!temporary?.temporary || temporary.binding || temporary.expiresAt === undefined || this.#sessionId === undefined) {
43349
- throw new RangeError("Temporary-key binding is not allowed");
43350
- }
43351
- const request = decodeBindTempAuthKey(message.body);
43352
- const permanentId = int64LE(request.permanentAuthKeyId);
43353
- const permanent = await this.options.authorizationKeys.load(permanentId);
43354
- if (!permanent || permanent.temporary || !permanent.authorized) {
43355
- this.#destroyed = true;
43356
- throw new InlineProtocolAuthorizationInvalidated;
43357
- }
43358
- verifyTemporaryKeyBindingProof({
43359
- encryptedMessage: request.encryptedMessage,
43360
- permanentAuthKey: permanent.key,
43361
- outerPermanentAuthKeyId: request.permanentAuthKeyId,
43362
- outerTemporaryAuthKeyId: new DataView(temporary.keyId.buffer, temporary.keyId.byteOffset, 8).getBigInt64(0, true),
43363
- outerTemporarySessionId: this.#sessionId,
43364
- outerMessageId: message.messageId,
43365
- outerNonce: request.nonce,
43366
- outerExpiresAt: request.expiresAt,
43367
- temporaryKeyExpiresAt: temporary.expiresAt,
43368
- nowSeconds: Math.floor(this.options.nowMilliseconds() / 1000)
43369
- });
43370
- const result = await this.options.authorizationKeys.bindTemporary({
43371
- temporaryAuthKeyId: temporary.keyId,
43372
- permanentAuthKeyId: permanent.keyId,
43373
- temporarySessionId: this.#sessionId,
43374
- nonce: request.nonce,
43375
- expiresAt: request.expiresAt,
43376
- userId: permanent.authorized.userId,
43377
- accountSessionId: permanent.authorized.accountSessionId
43378
- });
43379
- if (result === "conflict")
43380
- throw new RangeError("Temporary-key binding conflicts");
43381
- temporary.binding = {
43382
- permanentAuthKeyId: permanent.keyId.slice(),
43383
- temporarySessionId: this.#sessionId,
43384
- nonce: request.nonce,
43385
- expiresAt: request.expiresAt,
43386
- userId: permanent.authorized.userId,
43387
- accountSessionId: permanent.authorized.accountSessionId
43388
- };
43389
- return this.#encryptOutgoing(encodeRpcResult(message.messageId, uint32LE(BOOL_TRUE)), true, 1);
43390
- }
43391
- async#acceptApplication(message, completionMessageIds = [message.messageId]) {
43392
- const activeAuthorization = this.#authorization;
43393
- const sessionId = this.#sessionId;
43394
- if (!activeAuthorization || sessionId === undefined)
43395
- throw new InvalidEncryptedRecord;
43396
- const authorization = await this.options.authorizationKeys.load(activeAuthorization.keyId);
43397
- if (!authorization) {
43398
- this.#destroyed = true;
43399
- throw new InlineProtocolAuthorizationInvalidated;
43400
- }
43401
- if (!equalBytes(authorization.keyId, activeAuthorization.keyId) || this.#sessionId !== sessionId) {
43402
- throw new InvalidEncryptedRecord;
43403
- }
43404
- this.#authorization = authorization;
43405
- if (authorization.temporary && !authorization.binding) {
43406
- throw new RangeError("Authorization-key state does not permit application dispatch");
43407
- }
43408
- const application = decodeInlineApplicationObject(message.body);
43409
- if (application.kind !== "invoke" || application.layer !== INLINE_REALTIME_LAYER) {
43410
- throw new RangeError("Invalid Inline application request");
43411
- }
43412
- const replay = await this.options.replay.claim({
43413
- authKeyId: authorization.keyId,
43414
- sessionId,
43415
- messageId: message.messageId,
43416
- authenticatedBody: message.authenticatedBody ?? message.body
43417
- });
43418
- if (replay.kind === "digest_mismatch")
43419
- throw new RangeError("Replay digest mismatch");
43420
- if (replay.kind === "completed") {
43421
- return {
43422
- result: {
43423
- responses: [this.#encryptOutgoing(replay.resultBody, true, 1)],
43424
- applicationTasks: []
43425
- },
43426
- completed: true
43427
- };
43428
- }
43429
- if (replay.kind === "in_flight") {
43430
- return {
43431
- result: {
43432
- responses: [this.#encryptOutgoing(encodeMsgsStateInfo(message.messageId, Uint8Array.of(4)), false, 1)],
43433
- applicationTasks: []
43434
- },
43435
- completed: false
43436
- };
43437
- }
43438
- if (this.#inFlightApplications.size >= MAX_IN_FLIGHT_APPLICATIONS) {
43439
- const resultBody = encodeRpcResult(message.messageId, encodeRpcError(503, "Realtime application capacity exceeded"));
43440
- const completion = await this.options.replay.complete({
43441
- authKeyId: authorization.keyId,
43442
- sessionId,
43443
- messageId: message.messageId,
43444
- resultBody
43445
- });
43446
- return {
43447
- result: {
43448
- responses: [this.#encryptOutgoing(completion.kind === "completed" ? resultBody : completion.resultBody, true, 1)],
43449
- applicationTasks: []
43450
- },
43451
- completed: true
43452
- };
43453
- }
43454
- const applicationAuthorization = {
43455
- authKeyId: authorization.keyId.slice(),
43456
- permanentAuthKeyId: authorization.temporary ? authorization.binding?.permanentAuthKeyId.slice() : authorization.keyId.slice(),
43457
- permanent: !authorization.temporary,
43458
- temporaryBound: authorization.binding !== undefined,
43459
- userId: authorization.temporary ? authorization.binding?.userId : authorization.authorized?.userId,
43460
- accountSessionId: authorization.temporary ? authorization.binding?.accountSessionId : authorization.authorized?.accountSessionId
43461
- };
43462
- this.#inFlightApplications.add(message.messageId);
43463
- let didDispatch = false;
43464
- const task = {
43465
- messageId: message.messageId,
43466
- dispatch: async () => {
43467
- if (didDispatch)
43468
- throw new RangeError("Application task was already dispatched");
43469
- didDispatch = true;
43470
- const updates = [];
43471
- let updateBytes = 0;
43472
- const applicationUpdateReleases = [];
43473
- let acceptingUpdates = true;
43474
- let executionStarted = false;
43475
- const controller = new AbortController;
43476
- let timeout;
43477
- let applicationRelease;
43478
- const makeSettlement = (dispatched, includeResult) => {
43479
- let didFinalize = false;
43480
- return {
43481
- messageId: message.messageId,
43482
- finalize: async () => {
43483
- if (didFinalize)
43484
- throw new RangeError("Application completion was already finalized");
43485
- didFinalize = true;
43486
- return this.#finalizeApplication({
43487
- authKeyId: authorization.keyId.slice(),
43488
- sessionId,
43489
- messageId: message.messageId,
43490
- completionMessageIds,
43491
- dispatched,
43492
- updates,
43493
- includeResult,
43494
- applicationRelease,
43495
- applicationUpdateReleases
43496
- });
43497
- }
43498
- };
43499
- };
43500
- if (this.options.tryAcquireApplication) {
43501
- applicationRelease = this.options.tryAcquireApplication(applicationAuthorization);
43502
- if (!applicationRelease) {
43503
- acceptingUpdates = false;
43504
- return makeSettlement({
43505
- kind: "error",
43506
- code: 503,
43507
- message: "Realtime application capacity exceeded"
43508
- }, true);
43509
- }
43510
- }
43511
- const applicationDispatch = (async () => {
43512
- try {
43513
- const dispatched = await this.options.application.dispatch({
43514
- payload: application.payload.slice(),
43515
- authorization: applicationAuthorization,
43516
- messageId: message.messageId,
43517
- sessionId,
43518
- signal: controller.signal,
43519
- markExecutionStarted: () => {
43520
- executionStarted = true;
43521
- },
43522
- sendUpdate: (payload) => {
43523
- if (!acceptingUpdates)
43524
- return;
43525
- if (updates.length >= MAX_SESSION_OUTPUTS - 1 || updateBytes + payload.length > MAX_PACKET_BYTES) {
43526
- throw new InlineProtocolApplicationOutputOverloaded;
43527
- }
43528
- const updateRelease = this.options.tryReserveApplicationUpdateBytes?.(payload.length);
43529
- if (this.options.tryReserveApplicationUpdateBytes && !updateRelease) {
43530
- throw new InlineProtocolApplicationOutputOverloaded;
43531
- }
43532
- try {
43533
- const copy = payload.slice();
43534
- updates.push(copy);
43535
- updateBytes += copy.length;
43536
- if (updateRelease)
43537
- applicationUpdateReleases.push(updateRelease);
43538
- } catch (error) {
43539
- updateRelease?.();
43540
- throw error;
43541
- }
43542
- }
43543
- });
43544
- return { kind: "settled", dispatched };
43545
- } catch (error) {
43546
- updates.length = 0;
43547
- updateBytes = 0;
43548
- for (const release of applicationUpdateReleases.splice(0))
43549
- release();
43550
- return {
43551
- kind: "settled",
43552
- dispatched: error instanceof InlineProtocolApplicationOutputOverloaded ? {
43553
- kind: "error",
43554
- code: 504,
43555
- message: "Realtime application output capacity exceeded; commit outcome is unknown"
43556
- } : controller.signal.aborted ? {
43557
- kind: "error",
43558
- code: executionStarted ? 504 : 503,
43559
- message: executionStarted ? "Realtime application deadline exceeded; commit outcome is unknown" : "Realtime application deadline exceeded before execution"
43560
- } : { kind: "error", code: 500, message: "Internal server error" }
43561
- };
43562
- }
43563
- })();
43564
- const applicationDeadline = new Promise((resolve) => {
43565
- timeout = setTimeout(() => {
43566
- controller.abort();
43567
- resolve({ kind: "deadline" });
43568
- }, this.options.applicationTimeoutMs ?? DEFAULT_APPLICATION_TIMEOUT_MS);
43569
- });
43570
- const first = await Promise.race([applicationDispatch, applicationDeadline]);
43571
- if (timeout !== undefined)
43572
- clearTimeout(timeout);
43573
- if (first.kind === "settled") {
43574
- acceptingUpdates = false;
43575
- return makeSettlement(first.dispatched, true);
43576
- }
43577
- let didFinalizeDeadline = false;
43578
- return {
43579
- messageId: message.messageId,
43580
- settlement: applicationDispatch.then(({ dispatched }) => {
43581
- acceptingUpdates = false;
43582
- return makeSettlement(dispatched, false);
43583
- }),
43584
- finalize: async () => {
43585
- if (didFinalizeDeadline)
43586
- throw new RangeError("Application deadline was already finalized");
43587
- didFinalizeDeadline = true;
43588
- return this.#finalizeApplicationDeadline({
43589
- authKeyId: authorization.keyId.slice(),
43590
- sessionId,
43591
- messageId: message.messageId,
43592
- executionStarted
43593
- });
43594
- }
43595
- };
43596
- }
43597
- };
43598
- return {
43599
- result: { responses: [], applicationTasks: [task] },
43600
- completed: false
43601
- };
43602
- }
43603
- async#finalizeApplication(input) {
43604
- try {
43605
- const resultObject = input.dispatched.kind === "result" ? encodeInlineResult(input.dispatched.payload) : encodeRpcError(input.dispatched.code, input.dispatched.message);
43606
- const resultBody = encodeRpcResult(input.messageId, resultObject);
43607
- const replayResultBody = input.dispatched.kind === "result" && input.dispatched.replayPayload ? encodeRpcResult(input.messageId, encodeInlineResult(input.dispatched.replayPayload)) : resultBody;
43608
- const completion = await this.options.replay.complete({
43609
- authKeyId: input.authKeyId,
43610
- sessionId: input.sessionId,
43611
- messageId: input.messageId,
43612
- resultBody: replayResultBody
43613
- });
43614
- const terminateAuthorization = input.dispatched.terminateAuthorization === true;
43615
- if (terminateAuthorization) {
43616
- if (this.#destroyed || this.#sessionId !== input.sessionId || !this.#authorization || !equalBytes(this.#authorization.keyId, input.authKeyId)) {
43617
- return { responses: [], applicationTasks: [] };
43618
- }
43619
- const answerDropped2 = this.#droppedApplicationAnswers.delete(input.messageId);
43620
- const responses2 = input.includeResult && !answerDropped2 ? [this.#encryptOutgoing(completion.kind === "completed" ? resultBody : completion.resultBody, true, 1)] : [];
43621
- for (const messageId of new Set(input.completionMessageIds))
43622
- this.#markCompleted(messageId);
43623
- this.#deferredInvokeAfter.clear();
43624
- this.#destroyed = true;
43625
- return { responses: responses2, applicationTasks: [] };
43626
- }
43627
- const refreshed = await this.options.authorizationKeys.load(input.authKeyId);
43628
- if (!refreshed) {
43629
- this.#destroyed = true;
43630
- return { responses: [], applicationTasks: [] };
43631
- }
43632
- if (this.#destroyed || this.#sessionId !== input.sessionId || !this.#authorization || !equalBytes(this.#authorization.keyId, input.authKeyId)) {
43633
- return { responses: [], applicationTasks: [] };
43634
- }
43635
- this.#authorization = refreshed;
43636
- const answerDropped = this.#droppedApplicationAnswers.delete(input.messageId);
43637
- const responses = input.includeResult && !answerDropped ? [this.#encryptOutgoing(completion.kind === "completed" ? resultBody : completion.resultBody, true, 1)] : [];
43638
- if (completion.kind === "completed") {
43639
- for (const update of input.updates)
43640
- responses.push(this.sendApplicationUpdate(update));
43641
- }
43642
- for (const messageId of new Set(input.completionMessageIds))
43643
- this.#markCompleted(messageId);
43644
- const deferred = await this.#drainDeferredConcurrent();
43645
- const acknowledgements = this.#acknowledgements.drain();
43646
- if (acknowledgements.length > 0) {
43647
- responses.push(this.#encryptOutgoing(encodeMsgsAck(acknowledgements), false, 1));
43648
- }
43649
- responses.push(...deferred.responses);
43650
- return { responses, applicationTasks: deferred.applicationTasks };
43651
- } finally {
43652
- this.#droppedApplicationAnswers.delete(input.messageId);
43653
- for (const release of input.applicationUpdateReleases.splice(0))
43654
- release();
43655
- input.applicationRelease?.();
43656
- this.#inFlightApplications.delete(input.messageId);
43657
- }
43658
- }
43659
- async#finalizeApplicationDeadline(input) {
43660
- if (this.#destroyed || this.#sessionId !== input.sessionId || !this.#authorization || !equalBytes(this.#authorization.keyId, input.authKeyId)) {
43661
- return { responses: [], applicationTasks: [] };
43662
- }
43663
- const deadlineResultBody = encodeRpcResult(input.messageId, input.executionStarted ? encodeRpcError(504, "Realtime application deadline exceeded; commit outcome is unknown") : encodeRpcError(503, "Realtime application deadline exceeded before execution"));
43664
- const resultBody = input.executionStarted ? deadlineResultBody : await this.options.replay.complete({
43665
- authKeyId: input.authKeyId,
43666
- sessionId: input.sessionId,
43667
- messageId: input.messageId,
43668
- resultBody: deadlineResultBody
43669
- }).then((completion) => completion.kind === "completed" ? deadlineResultBody : completion.resultBody);
43670
- const answerDropped = this.#droppedApplicationAnswers.delete(input.messageId);
43671
- return {
43672
- responses: answerDropped ? [] : [this.#encryptOutgoing(resultBody, true, 1)],
43673
- applicationTasks: []
43674
- };
43675
- }
43676
- async#dispatchApplication(message) {
43677
- const accepted = await this.#acceptApplication(message);
43678
- const responses = [...accepted.result.responses];
43679
- const tasks = [...accepted.result.applicationTasks];
43680
- while (tasks.length > 0) {
43681
- const completion = await tasks.shift().dispatch();
43682
- const finalized = await completion.finalize();
43683
- responses.push(...finalized.responses);
43684
- tasks.push(...finalized.applicationTasks);
43685
- if (completion.settlement) {
43686
- const settlement = await completion.settlement;
43687
- const settled = await settlement.finalize();
43688
- responses.push(...settled.responses);
43689
- tasks.push(...settled.applicationTasks);
43690
- }
43691
- }
43692
- return responses;
43693
- }
43694
- #validateLogical(message, contentRelated, allowDuplicate = false) {
43695
- const time = validateInboundMessageId(message.messageId, "client", Math.floor(this.options.nowMilliseconds() / 1000));
43696
- if (time.kind === "bad")
43697
- return time.errorCode;
43698
- if (this.#receivedIds.has(message.messageId))
43699
- return allowDuplicate ? undefined : 20;
43700
- if (!this.#receivedIds.claim(message.messageId))
43701
- return 20;
43702
- return this.#receivedSequences.validate(message.messageId, message.sequenceNumber, contentRelated);
43703
- }
43704
- #isContentRelated(constructor3) {
43705
- return !NON_CONTENT_CONSTRUCTORS.has(constructor3);
43706
- }
43707
- #encryptOutgoing(body, contentRelated, modulo, fixedMessageId, fixedSequenceNumber) {
43708
- const authorization = this.#authorization;
43709
- const sessionId = this.#sessionId;
43710
- if (!authorization || sessionId === undefined)
43711
- throw new InvalidEncryptedRecord;
43712
- const messageId = fixedMessageId ?? this.#nextServerMessageId(modulo);
43713
- const sequenceNumber = fixedSequenceNumber ?? (fixedMessageId === undefined ? this.#sequenceNumbers.next(contentRelated) : contentRelated ? 1 : 0);
43714
- const paddingLength = 12 + (16 - (32 + body.length + 12) % 16) % 16;
43715
- const record = encryptRecord(authorization.key, "server-to-client", {
43716
- serverSalt: authorization.currentServerSalt,
43717
- sessionId,
43718
- messageId,
43719
- sequenceNumber,
43720
- body
43721
- }, this.options.randomBytes(paddingLength));
43722
- if (contentRelated && fixedMessageId === undefined)
43723
- this.#pending.retain({ messageId, sequenceNumber, body });
43724
- return record;
43725
- }
43726
- #nextServerMessageId(modulo) {
43727
- const random = this.options.randomBytes(4);
43728
- if (random.length !== 4)
43729
- throw new RangeError("CSPRNG returned invalid message-ID randomness");
43730
- const lowBits = new DataView(random.buffer, random.byteOffset, 4).getUint32(0, true) & 1073741823;
43731
- return this.#messageIds.next(this.options.nowMilliseconds(), lowBits, modulo);
43732
- }
43733
- }
43734
43463
  // node_modules/@inline-chat/realtime-sdk/dist/realtime/v3-connection.js
43735
- var BOOL_TRUE2 = 2574415285;
43464
+ var BOOL_TRUE = 2574415285;
43736
43465
  var CONNECT_TIMEOUT_MS = 30000;
43737
43466
  var REQUEST_TIMEOUT_MS = 60000;
43738
43467
  var SESSION_REVOKED_CLOSE_CODE = 4401;
@@ -44185,7 +43914,7 @@ class InlineProtocolV3Connection {
44185
43914
  });
44186
43915
  let result;
44187
43916
  ({ messageId, result } = await this.#sendPreparedContent(messageId, sequenceNumber, body));
44188
- if (result.length !== 4 || new DataView(result.buffer, result.byteOffset, 4).getUint32(0, true) !== BOOL_TRUE2) {
43917
+ if (result.length !== 4 || new DataView(result.buffer, result.byteOffset, 4).getUint32(0, true) !== BOOL_TRUE) {
44189
43918
  throw new InlineProtocolV3Error("protocol", "Server rejected temporary authorization-key binding");
44190
43919
  }
44191
43920
  }
@@ -45307,6 +45036,7 @@ class InlineSdkClient {
45307
45036
  catchUpInFlightBySpaceId = new Map;
45308
45037
  catchUpRequestedBySpaceId = new Map;
45309
45038
  userCatchUpInFlight = null;
45039
+ userCatchUpRequested = null;
45310
45040
  peerResolutionInFlightByChatId = new Map;
45311
45041
  peerResolutionRequestedByChatId = new Map;
45312
45042
  recoveryReconnectInFlight = null;
@@ -46279,7 +46009,7 @@ class InlineSdkClient {
46279
46009
  if (options?.source === "live" && seq > 0) {
46280
46010
  this.fenceLiveCursor({ kind: "user" });
46281
46011
  this.registerDiscoveryHint({ kind: "user" }, seq);
46282
- this.requestCatchUpUser(true);
46012
+ this.requestCatchUpUser(true, seq);
46283
46013
  return Promise.resolve(true);
46284
46014
  }
46285
46015
  const payload = update.update.userAddedToChat;
@@ -46368,6 +46098,15 @@ class InlineSdkClient {
46368
46098
  });
46369
46099
  return delivery;
46370
46100
  }
46101
+ case "userHasNewUpdates": {
46102
+ const payload = update.update.userHasNewUpdates;
46103
+ if (!Number.isSafeInteger(payload.updateSeq) || payload.updateSeq <= 0) {
46104
+ return Promise.resolve(true);
46105
+ }
46106
+ this.registerDiscoveryHint({ kind: "user" }, payload.updateSeq);
46107
+ this.requestCatchUpUser(true, payload.updateSeq > 0 ? payload.updateSeq : undefined);
46108
+ return Promise.resolve(true);
46109
+ }
46371
46110
  default:
46372
46111
  return null;
46373
46112
  }
@@ -46555,7 +46294,7 @@ class InlineSdkClient {
46555
46294
  this.requestCatchUpSpace({ spaceId: bucket.spaceId, ...updateSeq != null ? { updateSeq } : {} });
46556
46295
  return;
46557
46296
  case "user":
46558
- this.requestCatchUpUser(true);
46297
+ this.requestCatchUpUser(true, updateSeq);
46559
46298
  return;
46560
46299
  }
46561
46300
  }
@@ -46592,8 +46331,8 @@ class InlineSdkClient {
46592
46331
  requestCatchUpForDegradedBucket(bucket) {
46593
46332
  switch (bucket.kind) {
46594
46333
  case "chat": {
46595
- const request = this.catchUpRequestedByChatId.get(bucket.chatId) ?? this.peerResolutionRequestedByChatId.get(bucket.chatId);
46596
- const updateSeq = request && !request.toLatest ? request.endSeq : undefined;
46334
+ const request2 = this.catchUpRequestedByChatId.get(bucket.chatId) ?? this.peerResolutionRequestedByChatId.get(bucket.chatId);
46335
+ const updateSeq = request2 && !request2.toLatest ? request2.endSeq : undefined;
46597
46336
  const peer = bucket.peer ?? this.persistedChatPeer(bucket.chatId);
46598
46337
  if (peer && this.isReliableChatPeer(peer)) {
46599
46338
  this.requestCatchUpChat({ chatId: bucket.chatId, peer, updateSeq });
@@ -46603,15 +46342,16 @@ class InlineSdkClient {
46603
46342
  return;
46604
46343
  }
46605
46344
  case "space": {
46606
- const request = this.catchUpRequestedBySpaceId.get(bucket.spaceId);
46345
+ const request2 = this.catchUpRequestedBySpaceId.get(bucket.spaceId);
46607
46346
  this.requestCatchUpSpace({
46608
46347
  spaceId: bucket.spaceId,
46609
- updateSeq: request && !request.toLatest ? request.endSeq : undefined
46348
+ updateSeq: request2 && !request2.toLatest ? request2.endSeq : undefined
46610
46349
  });
46611
46350
  return;
46612
46351
  }
46613
46352
  case "user":
46614
- this.requestCatchUpUser(true);
46353
+ const request = this.userCatchUpRequested;
46354
+ this.requestCatchUpUser(true, request && !request.toLatest ? request.endSeq : undefined);
46615
46355
  return;
46616
46356
  }
46617
46357
  }
@@ -46632,7 +46372,7 @@ class InlineSdkClient {
46632
46372
  this.requestCatchUpSpace({ spaceId: bucket.spaceId, ...updateSeq != null ? { updateSeq } : {} });
46633
46373
  return;
46634
46374
  case "user":
46635
- this.requestCatchUpUser(true);
46375
+ this.requestCatchUpUser(true, updateSeq);
46636
46376
  return;
46637
46377
  }
46638
46378
  }
@@ -46647,6 +46387,7 @@ class InlineSdkClient {
46647
46387
  case "newMessageNotification":
46648
46388
  case "chatHasNewUpdates":
46649
46389
  case "spaceHasNewUpdates":
46390
+ case "userHasNewUpdates":
46650
46391
  case "botPresence":
46651
46392
  return true;
46652
46393
  case undefined:
@@ -46728,6 +46469,8 @@ class InlineSdkClient {
46728
46469
  }
46729
46470
  case "spaceSettings":
46730
46471
  return [{ kind: "space", spaceId: update.update.spaceSettings.spaceId }];
46472
+ case "spaceProfile":
46473
+ return [{ kind: "space", spaceId: update.update.spaceProfile.spaceId }];
46731
46474
  case "dialogArchived":
46732
46475
  case "joinSpace":
46733
46476
  case "updateReadMaxId":
@@ -46848,32 +46591,76 @@ class InlineSdkClient {
46848
46591
  }
46849
46592
  this.satisfyDiscoveryThroughCursor({ kind: "user" }, seq);
46850
46593
  }
46851
- requestCatchUpUser(forceFromStart = false) {
46594
+ requestCatchUpUser(forceFromStart = false, updateSeq) {
46852
46595
  const lastUserSeq = this.state.lastUserSeq;
46853
46596
  if (lastUserSeq == null && !this.options.catchUpUserFromStart && !forceFromStart) {
46854
46597
  return null;
46855
46598
  }
46599
+ const cursor = lastUserSeq ?? 0;
46600
+ if (updateSeq != null && updateSeq <= cursor)
46601
+ return this.userCatchUpInFlight;
46602
+ const previous = this.userCatchUpRequested;
46603
+ const demandAlreadyCoversHint = updateSeq != null && (previous?.endSeq ?? 0) >= updateSeq;
46604
+ if (!demandAlreadyCoversHint) {
46605
+ this.userCatchUpRequested = {
46606
+ ...updateSeq != null || previous?.endSeq != null ? { endSeq: Math.max(previous?.endSeq ?? 0, updateSeq ?? 0) } : {},
46607
+ toLatest: previous?.toLatest === true || updateSeq == null
46608
+ };
46609
+ }
46856
46610
  if (this.userCatchUpInFlight) {
46857
46611
  return this.userCatchUpInFlight;
46858
46612
  }
46859
46613
  if (this.recoveryRetries.get("user")?.timer)
46860
46614
  return null;
46861
46615
  this.fenceLiveCursor({ kind: "user" });
46862
- this.userCatchUpInFlight = this.doCatchUpUser(lastUserSeq ?? 0).catch((error) => {
46863
- this.recordCatchUpFailure({ kind: "user" }, error);
46616
+ return this.startUserCatchUp();
46617
+ }
46618
+ startUserCatchUp() {
46619
+ const initialDemand = this.userCatchUpRequested;
46620
+ const task = this.drainCatchUpUser().catch((error) => {
46621
+ this.recordCatchUpFailure({ kind: "user" }, error, this.userCatchUpRequested !== initialDemand);
46864
46622
  this.log.warn?.("GET_UPDATES user catch-up failed; bucket remains degraded", {
46865
46623
  error: extractErrorMessage(error)
46866
46624
  });
46867
46625
  }).finally(() => {
46868
46626
  this.userCatchUpInFlight = null;
46627
+ if (this.userCatchUpRequested && !this.degradedUpdateBuckets.has("user")) {
46628
+ this.startUserCatchUp();
46629
+ return;
46630
+ }
46869
46631
  this.scheduleRecoveryRetry({ kind: "user" });
46870
46632
  });
46871
- return this.userCatchUpInFlight;
46633
+ this.userCatchUpInFlight = task;
46634
+ return task;
46872
46635
  }
46873
- async doCatchUpUser(startSeq) {
46874
- let cursor = startSeq;
46636
+ async drainCatchUpUser() {
46875
46637
  while (true) {
46876
- const requestEndSeq = this.catchUpRequestEndSeq(cursor);
46638
+ const request = this.userCatchUpRequested;
46639
+ if (!request)
46640
+ return;
46641
+ const startSeq = this.state.lastUserSeq ?? 0;
46642
+ const endSeq = request.toLatest ? undefined : request.endSeq;
46643
+ if (endSeq != null && endSeq <= startSeq) {
46644
+ this.satisfyDiscoveryThroughCursor({ kind: "user" }, startSeq);
46645
+ this.clearUpdateBucketDegraded({ kind: "user" });
46646
+ this.userCatchUpRequested = null;
46647
+ return;
46648
+ }
46649
+ const stop = await this.doCatchUpUser(startSeq, endSeq);
46650
+ if (stop) {
46651
+ if (this.userCatchUpRequested !== request)
46652
+ continue;
46653
+ if (this.degradedUpdateBuckets.has("user"))
46654
+ return;
46655
+ this.userCatchUpRequested = null;
46656
+ return;
46657
+ }
46658
+ }
46659
+ }
46660
+ async doCatchUpUser(startSeq, endSeq) {
46661
+ let cursor = startSeq;
46662
+ while (endSeq == null || cursor < endSeq) {
46663
+ const requestEndSeq = this.catchUpRequestEndSeq(cursor, endSeq);
46877
46664
  const result = await this.invoke(Method.GET_UPDATES, {
46878
46665
  oneofKind: "getUpdates",
46879
46666
  getUpdates: GetUpdatesInput.create({
@@ -46894,24 +46681,32 @@ class InlineSdkClient {
46894
46681
  if (!Number.isSafeInteger(deliveredSeq)) {
46895
46682
  this.markUpdateBucketDegraded({ kind: "user" });
46896
46683
  this.log.warn?.("GET_UPDATES user catch-up returned non-integer seq; aborting", { deliveredSeq });
46897
- return;
46684
+ return true;
46898
46685
  }
46899
46686
  if (payload.resultType === GetUpdatesResult_ResultType.TOO_LONG) {
46900
- const shouldContinue = this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq);
46687
+ if (endSeq != null && requestEndSeq != null && deliveredSeq !== requestEndSeq) {
46688
+ this.markUpdateBucketDegraded({ kind: "user" });
46689
+ this.log.warn?.("GET_UPDATES TOO_LONG pointer did not cover the requested user target", {
46690
+ requestedEndSeq: requestEndSeq,
46691
+ deliveredSeq
46692
+ });
46693
+ return true;
46694
+ }
46695
+ const shouldContinue = this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq, endSeq);
46901
46696
  const repaired = await this.repairUpdateBucketAuthoritatively({ kind: "user" }, deliveredSeq, payload.date, !shouldContinue);
46902
46697
  if (repaired && shouldContinue) {
46903
46698
  cursor = deliveredSeq;
46904
46699
  continue;
46905
46700
  }
46906
- return;
46701
+ return true;
46907
46702
  }
46908
46703
  const requiresSnapshotRepair = this.validateCatchUpPage(payload, cursor, { kind: "user" });
46909
46704
  if (requiresSnapshotRepair == null)
46910
- return;
46705
+ return true;
46911
46706
  if (requiresSnapshotRepair) {
46912
46707
  if (this.options.repairUpdatesBucket) {
46913
46708
  await this.repairUpdateBucketAuthoritatively({ kind: "user" }, deliveredSeq, payload.date);
46914
- return;
46709
+ return true;
46915
46710
  }
46916
46711
  this.log.warn?.("GET_UPDATES advanced past a snapshot-repair marker without a host snapshot owner", {
46917
46712
  bucket: "user",
@@ -46924,23 +46719,32 @@ class InlineSdkClient {
46924
46719
  cursor,
46925
46720
  deliveredSeq
46926
46721
  });
46927
- return;
46722
+ return true;
46928
46723
  }
46929
46724
  if (!await this.acceptCatchUpUpdates(payload.updates, "user", { kind: "user" }))
46930
- return;
46725
+ return true;
46931
46726
  this.bumpUserSeq(deliveredSeq);
46932
46727
  this.scheduleStateSave();
46933
46728
  if (payload.final) {
46934
- if (this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq)) {
46729
+ if (this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq, endSeq)) {
46935
46730
  cursor = deliveredSeq;
46936
46731
  continue;
46937
46732
  }
46733
+ if (endSeq != null && deliveredSeq < endSeq) {
46734
+ this.markUpdateBucketDegraded({ kind: "user" }, "target_not_reached");
46735
+ this.log.warn?.("GET_UPDATES final user page remained behind the requested target", {
46736
+ requestedEndSeq: endSeq,
46737
+ deliveredSeq
46738
+ });
46739
+ return true;
46740
+ }
46938
46741
  this.satisfyDiscoveryBucket({ kind: "user" }, deliveredSeq);
46939
46742
  this.clearUpdateBucketDegraded({ kind: "user" });
46940
- return;
46743
+ return true;
46941
46744
  }
46942
46745
  cursor = deliveredSeq;
46943
46746
  }
46747
+ return false;
46944
46748
  }
46945
46749
  requestCatchUpChat(params) {
46946
46750
  if (params.peer)
@@ -47985,229 +47789,6 @@ class JsonFileStateStore {
47985
47789
  await rename(tempPath, this.path);
47986
47790
  }
47987
47791
  }
47988
- // node_modules/@inline-chat/realtime-sdk/dist/realtime/v3-client.js
47989
- var cloneAuthorization3 = (value) => ({
47990
- ...value,
47991
- key: value.key.slice(),
47992
- keyId: value.keyId.slice()
47993
- });
47994
- var cloneCredentials2 = (value) => ({
47995
- permanent: cloneAuthorization3(value.permanent),
47996
- ...value.temporary ? { temporary: cloneAuthorization3(value.temporary) } : {}
47997
- });
47998
-
47999
- class InlineRealtimeV3Client {
48000
- #options;
48001
- #login;
48002
- #session;
48003
- #credentials;
48004
- #generation = 0;
48005
- #activeSessionCalls = 0;
48006
- #rotationDueSession;
48007
- #rotationTask;
48008
- #rotationError;
48009
- constructor(options) {
48010
- this.#options = options;
48011
- }
48012
- get credentials() {
48013
- if (!this.#credentials)
48014
- return;
48015
- const credentials = cloneCredentials2(this.#credentials);
48016
- if (this.#session)
48017
- credentials.temporary = this.#session.authorization;
48018
- if (this.#login)
48019
- credentials.permanent = this.#login.authorization;
48020
- return credentials;
48021
- }
48022
- get authenticated() {
48023
- return this.#session !== undefined;
48024
- }
48025
- async beginLogin(request) {
48026
- await this.close();
48027
- this.#login = await InlineProtocolV3Connection.connect(this.#connectionOptions());
48028
- this.#credentials = { permanent: this.#login.authorization };
48029
- return await this.#login.authBegin(request);
48030
- }
48031
- async completeLogin(request) {
48032
- const login = this.#login;
48033
- if (!login || !this.#credentials)
48034
- throw new InlineProtocolV3Error("unauthorized", "Native login has not started");
48035
- const result = await login.authComplete(request);
48036
- this.#credentials.permanent = login.authorization;
48037
- if (result.state.oneofKind === "authorized")
48038
- await this.#replaceAuthenticatedSession();
48039
- return result;
48040
- }
48041
- async connect(credentials) {
48042
- await this.close();
48043
- const generation = this.#generation;
48044
- this.#credentials = cloneCredentials2(credentials);
48045
- const temporary = this.#credentials.temporary;
48046
- if (temporary && temporary.expiresAt !== undefined) {
48047
- const opened = await this.#openTemporarySession(generation, {
48048
- authorization: temporary
48049
- });
48050
- const session2 = opened.session;
48051
- try {
48052
- await session2.probeTemporaryAuthorization();
48053
- if (!session2.temporaryAuthorizationNeedsRotation()) {
48054
- this.#requireCurrent(generation);
48055
- this.#session = session2;
48056
- if (opened.rotationDue)
48057
- this.#handleRotationDue(session2, generation);
48058
- return;
48059
- }
48060
- } catch (error) {
48061
- if (!(error instanceof InlineProtocolV3Error) || error.code !== "unauthorized") {
48062
- await session2.close();
48063
- throw error;
48064
- }
48065
- }
48066
- await session2.close();
48067
- }
48068
- await this.#replaceAuthenticatedSession(generation);
48069
- }
48070
- async reconnect() {
48071
- const credentials = this.credentials;
48072
- if (!credentials)
48073
- throw new InlineProtocolV3Error("unauthorized", "No Inline Protocol credentials are available");
48074
- await this.connect(credentials);
48075
- }
48076
- async callRpc(rpc) {
48077
- return await this.#withSessionCall((session2) => session2.callRpc(rpc));
48078
- }
48079
- async createHttpUpload(request) {
48080
- return await this.#withSessionCall((session2) => session2.createHttpUpload(request));
48081
- }
48082
- async finishHttpUpload(request) {
48083
- return await this.#withSessionCall((session2) => session2.finishHttpUpload(request));
48084
- }
48085
- async close() {
48086
- ++this.#generation;
48087
- const connections = [this.#login, this.#session].filter((value) => value !== undefined);
48088
- const rotationTask = this.#rotationTask;
48089
- this.#login = undefined;
48090
- this.#session = undefined;
48091
- this.#rotationDueSession = undefined;
48092
- this.#rotationError = undefined;
48093
- await Promise.allSettled([
48094
- ...connections.map((connection) => connection.close()),
48095
- ...rotationTask ? [rotationTask] : []
48096
- ]);
48097
- }
48098
- async#replaceAuthenticatedSession(generation = this.#generation, expectedSession) {
48099
- const credentials = this.#credentials;
48100
- if (!credentials)
48101
- throw new InlineProtocolV3Error("unauthorized", "Permanent authorization key is unavailable");
48102
- if (expectedSession && this.#session !== expectedSession)
48103
- return;
48104
- const previousSession = this.#session;
48105
- this.#session = undefined;
48106
- await previousSession?.close();
48107
- this.#requireCurrent(generation);
48108
- const opened = await this.#openTemporarySession(generation, {
48109
- temporary: true
48110
- });
48111
- const session2 = opened.session;
48112
- try {
48113
- await session2.bindTemporary(credentials.permanent);
48114
- this.#requireCurrent(generation);
48115
- const nextCredentials = cloneCredentials2(credentials);
48116
- nextCredentials.temporary = session2.authorization;
48117
- await this.#options.onCredentials?.(cloneCredentials2(nextCredentials));
48118
- this.#requireCurrent(generation);
48119
- this.#credentials = nextCredentials;
48120
- } catch (error) {
48121
- await session2.close();
48122
- throw error;
48123
- }
48124
- this.#session = session2;
48125
- this.#rotationError = undefined;
48126
- if (this.#rotationDueSession === expectedSession)
48127
- this.#rotationDueSession = undefined;
48128
- if (opened.rotationDue)
48129
- this.#handleRotationDue(session2, generation);
48130
- const login = this.#login;
48131
- this.#login = undefined;
48132
- await login?.close();
48133
- }
48134
- async#openTemporarySession(generation, authorization) {
48135
- const owner = { rotationDue: false };
48136
- const session2 = await InlineProtocolV3Connection.connect({
48137
- ...this.#connectionOptions(),
48138
- ...authorization,
48139
- onRotationDue: () => {
48140
- owner.rotationDue = true;
48141
- if (owner.session)
48142
- this.#handleRotationDue(owner.session, generation);
48143
- }
48144
- });
48145
- owner.session = session2;
48146
- return { session: session2, rotationDue: owner.rotationDue };
48147
- }
48148
- #handleRotationDue(session2, generation) {
48149
- if (generation !== this.#generation || this.#session !== session2)
48150
- return;
48151
- this.#rotationDueSession = session2;
48152
- this.#maybeRotate();
48153
- }
48154
- #maybeRotate() {
48155
- const session2 = this.#rotationDueSession;
48156
- if (!session2 || this.#session !== session2 || this.#activeSessionCalls > 0 || this.#rotationTask)
48157
- return;
48158
- const generation = this.#generation;
48159
- const task = this.#replaceAuthenticatedSession(generation, session2);
48160
- this.#rotationTask = task;
48161
- task.catch((error) => {
48162
- if (generation !== this.#generation)
48163
- return;
48164
- this.#rotationError = error instanceof Error ? error : new Error(String(error));
48165
- }).finally(() => {
48166
- if (this.#rotationTask === task)
48167
- this.#rotationTask = undefined;
48168
- if (generation === this.#generation)
48169
- this.#maybeRotate();
48170
- });
48171
- }
48172
- async#withSessionCall(operation) {
48173
- if (this.#rotationTask)
48174
- await this.#rotationTask;
48175
- if (this.#rotationDueSession) {
48176
- this.#maybeRotate();
48177
- if (this.#rotationTask)
48178
- await this.#rotationTask;
48179
- }
48180
- if (this.#rotationError)
48181
- throw this.#rotationError;
48182
- const session2 = this.#requireSession();
48183
- this.#activeSessionCalls += 1;
48184
- try {
48185
- return await operation(session2);
48186
- } finally {
48187
- this.#activeSessionCalls -= 1;
48188
- this.#maybeRotate();
48189
- }
48190
- }
48191
- #requireCurrent(generation) {
48192
- if (generation !== this.#generation) {
48193
- throw new InlineProtocolV3Error("closed", "Inline Protocol client lifecycle changed");
48194
- }
48195
- }
48196
- #requireSession() {
48197
- if (!this.#session)
48198
- throw new InlineProtocolV3Error("unauthorized", "Inline Protocol authenticated session is not connected");
48199
- return this.#session;
48200
- }
48201
- #connectionOptions() {
48202
- return {
48203
- url: this.#options.url,
48204
- rsaPublicKeys: this.#options.rsaPublicKeys,
48205
- connectTimeoutMs: this.#options.connectTimeoutMs,
48206
- requestTimeoutMs: this.#options.requestTimeoutMs,
48207
- onUpdate: this.#options.onUpdate
48208
- };
48209
- }
48210
- }
48211
47792
  // node_modules/@inline-chat/protocol/dist/vectors.js
48212
47793
  var portableCoreV1Vector = {
48213
47794
  authKeyHex: Array.from({ length: 256 }, (_, index) => index.toString(16).padStart(2, "0")).join(""),
@@ -48507,7 +48088,7 @@ function buildHermesTelemetryEvent(operation, error, options = {}) {
48507
48088
  async function resolveRelease() {
48508
48089
  releasePromise ??= (async () => {
48509
48090
  for (const candidate of [
48510
- new URL("../../../package.json", import.meta.url),
48091
+ new URL("../../../../package.json", import.meta.url),
48511
48092
  new URL("../../package.json", import.meta.url)
48512
48093
  ]) {
48513
48094
  try {
@@ -49960,7 +49541,7 @@ function sleep(ms) {
49960
49541
  }
49961
49542
  async function packageVersion() {
49962
49543
  const candidates = [
49963
- new URL("../../../package.json", import.meta.url),
49544
+ new URL("../../../../package.json", import.meta.url),
49964
49545
  new URL("../../package.json", import.meta.url)
49965
49546
  ];
49966
49547
  for (const pkgUrl of candidates) {