@dcl/protocol 1.0.0-3243753014.commit-161bbc8 → 1.0.0-3244237062.commit-99a88ae

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.
@@ -0,0 +1,771 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+
4
+ export const protobufPackage = "decentraland.kernel.comms.v3";
5
+
6
+ export interface Position {
7
+ time: number;
8
+ positionX: number;
9
+ positionY: number;
10
+ positionZ: number;
11
+ rotationX: number;
12
+ rotationY: number;
13
+ rotationZ: number;
14
+ rotationW: number;
15
+ }
16
+
17
+ export interface Profile {
18
+ time: number;
19
+ profileVersion: string;
20
+ profileType: Profile_ProfileType;
21
+ }
22
+
23
+ export enum Profile_ProfileType {
24
+ PT_LOCAL = 0,
25
+ PT_DEPLOYED = 1,
26
+ UNRECOGNIZED = -1,
27
+ }
28
+
29
+ export function profile_ProfileTypeFromJSON(object: any): Profile_ProfileType {
30
+ switch (object) {
31
+ case 0:
32
+ case "PT_LOCAL":
33
+ return Profile_ProfileType.PT_LOCAL;
34
+ case 1:
35
+ case "PT_DEPLOYED":
36
+ return Profile_ProfileType.PT_DEPLOYED;
37
+ case -1:
38
+ case "UNRECOGNIZED":
39
+ default:
40
+ return Profile_ProfileType.UNRECOGNIZED;
41
+ }
42
+ }
43
+
44
+ export function profile_ProfileTypeToJSON(object: Profile_ProfileType): string {
45
+ switch (object) {
46
+ case Profile_ProfileType.PT_LOCAL:
47
+ return "PT_LOCAL";
48
+ case Profile_ProfileType.PT_DEPLOYED:
49
+ return "PT_DEPLOYED";
50
+ case Profile_ProfileType.UNRECOGNIZED:
51
+ default:
52
+ return "UNRECOGNIZED";
53
+ }
54
+ }
55
+
56
+ export interface ProfileRequest {
57
+ time: number;
58
+ profileVersion: string;
59
+ userId: string;
60
+ }
61
+
62
+ export interface ProfileResponse {
63
+ time: number;
64
+ serializedProfile: string;
65
+ }
66
+
67
+ export interface Chat {
68
+ time: number;
69
+ messageId: string;
70
+ text: string;
71
+ }
72
+
73
+ export interface Scene {
74
+ time: number;
75
+ sceneId: string;
76
+ data: string;
77
+ }
78
+
79
+ export interface Voice {
80
+ encodedSamples: Uint8Array;
81
+ index: number;
82
+ }
83
+
84
+ export interface Data {
85
+ position: Position | undefined;
86
+ profile: Profile | undefined;
87
+ profileRequest: ProfileRequest | undefined;
88
+ profileResponse: ProfileResponse | undefined;
89
+ chat: Chat | undefined;
90
+ scene: Scene | undefined;
91
+ voice: Voice | undefined;
92
+ }
93
+
94
+ function createBasePosition(): Position {
95
+ return { time: 0, positionX: 0, positionY: 0, positionZ: 0, rotationX: 0, rotationY: 0, rotationZ: 0, rotationW: 0 };
96
+ }
97
+
98
+ export const Position = {
99
+ encode(message: Position, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
100
+ if (message.time !== 0) {
101
+ writer.uint32(17).double(message.time);
102
+ }
103
+ if (message.positionX !== 0) {
104
+ writer.uint32(29).float(message.positionX);
105
+ }
106
+ if (message.positionY !== 0) {
107
+ writer.uint32(37).float(message.positionY);
108
+ }
109
+ if (message.positionZ !== 0) {
110
+ writer.uint32(45).float(message.positionZ);
111
+ }
112
+ if (message.rotationX !== 0) {
113
+ writer.uint32(53).float(message.rotationX);
114
+ }
115
+ if (message.rotationY !== 0) {
116
+ writer.uint32(61).float(message.rotationY);
117
+ }
118
+ if (message.rotationZ !== 0) {
119
+ writer.uint32(69).float(message.rotationZ);
120
+ }
121
+ if (message.rotationW !== 0) {
122
+ writer.uint32(77).float(message.rotationW);
123
+ }
124
+ return writer;
125
+ },
126
+
127
+ decode(input: _m0.Reader | Uint8Array, length?: number): Position {
128
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
129
+ let end = length === undefined ? reader.len : reader.pos + length;
130
+ const message = createBasePosition();
131
+ while (reader.pos < end) {
132
+ const tag = reader.uint32();
133
+ switch (tag >>> 3) {
134
+ case 2:
135
+ message.time = reader.double();
136
+ break;
137
+ case 3:
138
+ message.positionX = reader.float();
139
+ break;
140
+ case 4:
141
+ message.positionY = reader.float();
142
+ break;
143
+ case 5:
144
+ message.positionZ = reader.float();
145
+ break;
146
+ case 6:
147
+ message.rotationX = reader.float();
148
+ break;
149
+ case 7:
150
+ message.rotationY = reader.float();
151
+ break;
152
+ case 8:
153
+ message.rotationZ = reader.float();
154
+ break;
155
+ case 9:
156
+ message.rotationW = reader.float();
157
+ break;
158
+ default:
159
+ reader.skipType(tag & 7);
160
+ break;
161
+ }
162
+ }
163
+ return message;
164
+ },
165
+
166
+ fromJSON(object: any): Position {
167
+ return {
168
+ time: isSet(object.time) ? Number(object.time) : 0,
169
+ positionX: isSet(object.positionX) ? Number(object.positionX) : 0,
170
+ positionY: isSet(object.positionY) ? Number(object.positionY) : 0,
171
+ positionZ: isSet(object.positionZ) ? Number(object.positionZ) : 0,
172
+ rotationX: isSet(object.rotationX) ? Number(object.rotationX) : 0,
173
+ rotationY: isSet(object.rotationY) ? Number(object.rotationY) : 0,
174
+ rotationZ: isSet(object.rotationZ) ? Number(object.rotationZ) : 0,
175
+ rotationW: isSet(object.rotationW) ? Number(object.rotationW) : 0,
176
+ };
177
+ },
178
+
179
+ toJSON(message: Position): unknown {
180
+ const obj: any = {};
181
+ message.time !== undefined && (obj.time = message.time);
182
+ message.positionX !== undefined && (obj.positionX = message.positionX);
183
+ message.positionY !== undefined && (obj.positionY = message.positionY);
184
+ message.positionZ !== undefined && (obj.positionZ = message.positionZ);
185
+ message.rotationX !== undefined && (obj.rotationX = message.rotationX);
186
+ message.rotationY !== undefined && (obj.rotationY = message.rotationY);
187
+ message.rotationZ !== undefined && (obj.rotationZ = message.rotationZ);
188
+ message.rotationW !== undefined && (obj.rotationW = message.rotationW);
189
+ return obj;
190
+ },
191
+
192
+ fromPartial<I extends Exact<DeepPartial<Position>, I>>(object: I): Position {
193
+ const message = createBasePosition();
194
+ message.time = object.time ?? 0;
195
+ message.positionX = object.positionX ?? 0;
196
+ message.positionY = object.positionY ?? 0;
197
+ message.positionZ = object.positionZ ?? 0;
198
+ message.rotationX = object.rotationX ?? 0;
199
+ message.rotationY = object.rotationY ?? 0;
200
+ message.rotationZ = object.rotationZ ?? 0;
201
+ message.rotationW = object.rotationW ?? 0;
202
+ return message;
203
+ },
204
+ };
205
+
206
+ function createBaseProfile(): Profile {
207
+ return { time: 0, profileVersion: "", profileType: 0 };
208
+ }
209
+
210
+ export const Profile = {
211
+ encode(message: Profile, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
212
+ if (message.time !== 0) {
213
+ writer.uint32(17).double(message.time);
214
+ }
215
+ if (message.profileVersion !== "") {
216
+ writer.uint32(26).string(message.profileVersion);
217
+ }
218
+ if (message.profileType !== 0) {
219
+ writer.uint32(32).int32(message.profileType);
220
+ }
221
+ return writer;
222
+ },
223
+
224
+ decode(input: _m0.Reader | Uint8Array, length?: number): Profile {
225
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
226
+ let end = length === undefined ? reader.len : reader.pos + length;
227
+ const message = createBaseProfile();
228
+ while (reader.pos < end) {
229
+ const tag = reader.uint32();
230
+ switch (tag >>> 3) {
231
+ case 2:
232
+ message.time = reader.double();
233
+ break;
234
+ case 3:
235
+ message.profileVersion = reader.string();
236
+ break;
237
+ case 4:
238
+ message.profileType = reader.int32() as any;
239
+ break;
240
+ default:
241
+ reader.skipType(tag & 7);
242
+ break;
243
+ }
244
+ }
245
+ return message;
246
+ },
247
+
248
+ fromJSON(object: any): Profile {
249
+ return {
250
+ time: isSet(object.time) ? Number(object.time) : 0,
251
+ profileVersion: isSet(object.profileVersion) ? String(object.profileVersion) : "",
252
+ profileType: isSet(object.profileType) ? profile_ProfileTypeFromJSON(object.profileType) : 0,
253
+ };
254
+ },
255
+
256
+ toJSON(message: Profile): unknown {
257
+ const obj: any = {};
258
+ message.time !== undefined && (obj.time = message.time);
259
+ message.profileVersion !== undefined && (obj.profileVersion = message.profileVersion);
260
+ message.profileType !== undefined && (obj.profileType = profile_ProfileTypeToJSON(message.profileType));
261
+ return obj;
262
+ },
263
+
264
+ fromPartial<I extends Exact<DeepPartial<Profile>, I>>(object: I): Profile {
265
+ const message = createBaseProfile();
266
+ message.time = object.time ?? 0;
267
+ message.profileVersion = object.profileVersion ?? "";
268
+ message.profileType = object.profileType ?? 0;
269
+ return message;
270
+ },
271
+ };
272
+
273
+ function createBaseProfileRequest(): ProfileRequest {
274
+ return { time: 0, profileVersion: "", userId: "" };
275
+ }
276
+
277
+ export const ProfileRequest = {
278
+ encode(message: ProfileRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
279
+ if (message.time !== 0) {
280
+ writer.uint32(17).double(message.time);
281
+ }
282
+ if (message.profileVersion !== "") {
283
+ writer.uint32(26).string(message.profileVersion);
284
+ }
285
+ if (message.userId !== "") {
286
+ writer.uint32(34).string(message.userId);
287
+ }
288
+ return writer;
289
+ },
290
+
291
+ decode(input: _m0.Reader | Uint8Array, length?: number): ProfileRequest {
292
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
293
+ let end = length === undefined ? reader.len : reader.pos + length;
294
+ const message = createBaseProfileRequest();
295
+ while (reader.pos < end) {
296
+ const tag = reader.uint32();
297
+ switch (tag >>> 3) {
298
+ case 2:
299
+ message.time = reader.double();
300
+ break;
301
+ case 3:
302
+ message.profileVersion = reader.string();
303
+ break;
304
+ case 4:
305
+ message.userId = reader.string();
306
+ break;
307
+ default:
308
+ reader.skipType(tag & 7);
309
+ break;
310
+ }
311
+ }
312
+ return message;
313
+ },
314
+
315
+ fromJSON(object: any): ProfileRequest {
316
+ return {
317
+ time: isSet(object.time) ? Number(object.time) : 0,
318
+ profileVersion: isSet(object.profileVersion) ? String(object.profileVersion) : "",
319
+ userId: isSet(object.userId) ? String(object.userId) : "",
320
+ };
321
+ },
322
+
323
+ toJSON(message: ProfileRequest): unknown {
324
+ const obj: any = {};
325
+ message.time !== undefined && (obj.time = message.time);
326
+ message.profileVersion !== undefined && (obj.profileVersion = message.profileVersion);
327
+ message.userId !== undefined && (obj.userId = message.userId);
328
+ return obj;
329
+ },
330
+
331
+ fromPartial<I extends Exact<DeepPartial<ProfileRequest>, I>>(object: I): ProfileRequest {
332
+ const message = createBaseProfileRequest();
333
+ message.time = object.time ?? 0;
334
+ message.profileVersion = object.profileVersion ?? "";
335
+ message.userId = object.userId ?? "";
336
+ return message;
337
+ },
338
+ };
339
+
340
+ function createBaseProfileResponse(): ProfileResponse {
341
+ return { time: 0, serializedProfile: "" };
342
+ }
343
+
344
+ export const ProfileResponse = {
345
+ encode(message: ProfileResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
346
+ if (message.time !== 0) {
347
+ writer.uint32(17).double(message.time);
348
+ }
349
+ if (message.serializedProfile !== "") {
350
+ writer.uint32(26).string(message.serializedProfile);
351
+ }
352
+ return writer;
353
+ },
354
+
355
+ decode(input: _m0.Reader | Uint8Array, length?: number): ProfileResponse {
356
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
357
+ let end = length === undefined ? reader.len : reader.pos + length;
358
+ const message = createBaseProfileResponse();
359
+ while (reader.pos < end) {
360
+ const tag = reader.uint32();
361
+ switch (tag >>> 3) {
362
+ case 2:
363
+ message.time = reader.double();
364
+ break;
365
+ case 3:
366
+ message.serializedProfile = reader.string();
367
+ break;
368
+ default:
369
+ reader.skipType(tag & 7);
370
+ break;
371
+ }
372
+ }
373
+ return message;
374
+ },
375
+
376
+ fromJSON(object: any): ProfileResponse {
377
+ return {
378
+ time: isSet(object.time) ? Number(object.time) : 0,
379
+ serializedProfile: isSet(object.serializedProfile) ? String(object.serializedProfile) : "",
380
+ };
381
+ },
382
+
383
+ toJSON(message: ProfileResponse): unknown {
384
+ const obj: any = {};
385
+ message.time !== undefined && (obj.time = message.time);
386
+ message.serializedProfile !== undefined && (obj.serializedProfile = message.serializedProfile);
387
+ return obj;
388
+ },
389
+
390
+ fromPartial<I extends Exact<DeepPartial<ProfileResponse>, I>>(object: I): ProfileResponse {
391
+ const message = createBaseProfileResponse();
392
+ message.time = object.time ?? 0;
393
+ message.serializedProfile = object.serializedProfile ?? "";
394
+ return message;
395
+ },
396
+ };
397
+
398
+ function createBaseChat(): Chat {
399
+ return { time: 0, messageId: "", text: "" };
400
+ }
401
+
402
+ export const Chat = {
403
+ encode(message: Chat, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
404
+ if (message.time !== 0) {
405
+ writer.uint32(17).double(message.time);
406
+ }
407
+ if (message.messageId !== "") {
408
+ writer.uint32(26).string(message.messageId);
409
+ }
410
+ if (message.text !== "") {
411
+ writer.uint32(34).string(message.text);
412
+ }
413
+ return writer;
414
+ },
415
+
416
+ decode(input: _m0.Reader | Uint8Array, length?: number): Chat {
417
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
418
+ let end = length === undefined ? reader.len : reader.pos + length;
419
+ const message = createBaseChat();
420
+ while (reader.pos < end) {
421
+ const tag = reader.uint32();
422
+ switch (tag >>> 3) {
423
+ case 2:
424
+ message.time = reader.double();
425
+ break;
426
+ case 3:
427
+ message.messageId = reader.string();
428
+ break;
429
+ case 4:
430
+ message.text = reader.string();
431
+ break;
432
+ default:
433
+ reader.skipType(tag & 7);
434
+ break;
435
+ }
436
+ }
437
+ return message;
438
+ },
439
+
440
+ fromJSON(object: any): Chat {
441
+ return {
442
+ time: isSet(object.time) ? Number(object.time) : 0,
443
+ messageId: isSet(object.messageId) ? String(object.messageId) : "",
444
+ text: isSet(object.text) ? String(object.text) : "",
445
+ };
446
+ },
447
+
448
+ toJSON(message: Chat): unknown {
449
+ const obj: any = {};
450
+ message.time !== undefined && (obj.time = message.time);
451
+ message.messageId !== undefined && (obj.messageId = message.messageId);
452
+ message.text !== undefined && (obj.text = message.text);
453
+ return obj;
454
+ },
455
+
456
+ fromPartial<I extends Exact<DeepPartial<Chat>, I>>(object: I): Chat {
457
+ const message = createBaseChat();
458
+ message.time = object.time ?? 0;
459
+ message.messageId = object.messageId ?? "";
460
+ message.text = object.text ?? "";
461
+ return message;
462
+ },
463
+ };
464
+
465
+ function createBaseScene(): Scene {
466
+ return { time: 0, sceneId: "", data: "" };
467
+ }
468
+
469
+ export const Scene = {
470
+ encode(message: Scene, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
471
+ if (message.time !== 0) {
472
+ writer.uint32(17).double(message.time);
473
+ }
474
+ if (message.sceneId !== "") {
475
+ writer.uint32(26).string(message.sceneId);
476
+ }
477
+ if (message.data !== "") {
478
+ writer.uint32(34).string(message.data);
479
+ }
480
+ return writer;
481
+ },
482
+
483
+ decode(input: _m0.Reader | Uint8Array, length?: number): Scene {
484
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
485
+ let end = length === undefined ? reader.len : reader.pos + length;
486
+ const message = createBaseScene();
487
+ while (reader.pos < end) {
488
+ const tag = reader.uint32();
489
+ switch (tag >>> 3) {
490
+ case 2:
491
+ message.time = reader.double();
492
+ break;
493
+ case 3:
494
+ message.sceneId = reader.string();
495
+ break;
496
+ case 4:
497
+ message.data = reader.string();
498
+ break;
499
+ default:
500
+ reader.skipType(tag & 7);
501
+ break;
502
+ }
503
+ }
504
+ return message;
505
+ },
506
+
507
+ fromJSON(object: any): Scene {
508
+ return {
509
+ time: isSet(object.time) ? Number(object.time) : 0,
510
+ sceneId: isSet(object.sceneId) ? String(object.sceneId) : "",
511
+ data: isSet(object.data) ? String(object.data) : "",
512
+ };
513
+ },
514
+
515
+ toJSON(message: Scene): unknown {
516
+ const obj: any = {};
517
+ message.time !== undefined && (obj.time = message.time);
518
+ message.sceneId !== undefined && (obj.sceneId = message.sceneId);
519
+ message.data !== undefined && (obj.data = message.data);
520
+ return obj;
521
+ },
522
+
523
+ fromPartial<I extends Exact<DeepPartial<Scene>, I>>(object: I): Scene {
524
+ const message = createBaseScene();
525
+ message.time = object.time ?? 0;
526
+ message.sceneId = object.sceneId ?? "";
527
+ message.data = object.data ?? "";
528
+ return message;
529
+ },
530
+ };
531
+
532
+ function createBaseVoice(): Voice {
533
+ return { encodedSamples: new Uint8Array(), index: 0 };
534
+ }
535
+
536
+ export const Voice = {
537
+ encode(message: Voice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
538
+ if (message.encodedSamples.length !== 0) {
539
+ writer.uint32(18).bytes(message.encodedSamples);
540
+ }
541
+ if (message.index !== 0) {
542
+ writer.uint32(24).uint32(message.index);
543
+ }
544
+ return writer;
545
+ },
546
+
547
+ decode(input: _m0.Reader | Uint8Array, length?: number): Voice {
548
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
549
+ let end = length === undefined ? reader.len : reader.pos + length;
550
+ const message = createBaseVoice();
551
+ while (reader.pos < end) {
552
+ const tag = reader.uint32();
553
+ switch (tag >>> 3) {
554
+ case 2:
555
+ message.encodedSamples = reader.bytes();
556
+ break;
557
+ case 3:
558
+ message.index = reader.uint32();
559
+ break;
560
+ default:
561
+ reader.skipType(tag & 7);
562
+ break;
563
+ }
564
+ }
565
+ return message;
566
+ },
567
+
568
+ fromJSON(object: any): Voice {
569
+ return {
570
+ encodedSamples: isSet(object.encodedSamples) ? bytesFromBase64(object.encodedSamples) : new Uint8Array(),
571
+ index: isSet(object.index) ? Number(object.index) : 0,
572
+ };
573
+ },
574
+
575
+ toJSON(message: Voice): unknown {
576
+ const obj: any = {};
577
+ message.encodedSamples !== undefined &&
578
+ (obj.encodedSamples = base64FromBytes(
579
+ message.encodedSamples !== undefined ? message.encodedSamples : new Uint8Array(),
580
+ ));
581
+ message.index !== undefined && (obj.index = Math.round(message.index));
582
+ return obj;
583
+ },
584
+
585
+ fromPartial<I extends Exact<DeepPartial<Voice>, I>>(object: I): Voice {
586
+ const message = createBaseVoice();
587
+ message.encodedSamples = object.encodedSamples ?? new Uint8Array();
588
+ message.index = object.index ?? 0;
589
+ return message;
590
+ },
591
+ };
592
+
593
+ function createBaseData(): Data {
594
+ return {
595
+ position: undefined,
596
+ profile: undefined,
597
+ profileRequest: undefined,
598
+ profileResponse: undefined,
599
+ chat: undefined,
600
+ scene: undefined,
601
+ voice: undefined,
602
+ };
603
+ }
604
+
605
+ export const Data = {
606
+ encode(message: Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
607
+ if (message.position !== undefined) {
608
+ Position.encode(message.position, writer.uint32(10).fork()).ldelim();
609
+ }
610
+ if (message.profile !== undefined) {
611
+ Profile.encode(message.profile, writer.uint32(18).fork()).ldelim();
612
+ }
613
+ if (message.profileRequest !== undefined) {
614
+ ProfileRequest.encode(message.profileRequest, writer.uint32(26).fork()).ldelim();
615
+ }
616
+ if (message.profileResponse !== undefined) {
617
+ ProfileResponse.encode(message.profileResponse, writer.uint32(34).fork()).ldelim();
618
+ }
619
+ if (message.chat !== undefined) {
620
+ Chat.encode(message.chat, writer.uint32(42).fork()).ldelim();
621
+ }
622
+ if (message.scene !== undefined) {
623
+ Scene.encode(message.scene, writer.uint32(50).fork()).ldelim();
624
+ }
625
+ if (message.voice !== undefined) {
626
+ Voice.encode(message.voice, writer.uint32(58).fork()).ldelim();
627
+ }
628
+ return writer;
629
+ },
630
+
631
+ decode(input: _m0.Reader | Uint8Array, length?: number): Data {
632
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
633
+ let end = length === undefined ? reader.len : reader.pos + length;
634
+ const message = createBaseData();
635
+ while (reader.pos < end) {
636
+ const tag = reader.uint32();
637
+ switch (tag >>> 3) {
638
+ case 1:
639
+ message.position = Position.decode(reader, reader.uint32());
640
+ break;
641
+ case 2:
642
+ message.profile = Profile.decode(reader, reader.uint32());
643
+ break;
644
+ case 3:
645
+ message.profileRequest = ProfileRequest.decode(reader, reader.uint32());
646
+ break;
647
+ case 4:
648
+ message.profileResponse = ProfileResponse.decode(reader, reader.uint32());
649
+ break;
650
+ case 5:
651
+ message.chat = Chat.decode(reader, reader.uint32());
652
+ break;
653
+ case 6:
654
+ message.scene = Scene.decode(reader, reader.uint32());
655
+ break;
656
+ case 7:
657
+ message.voice = Voice.decode(reader, reader.uint32());
658
+ break;
659
+ default:
660
+ reader.skipType(tag & 7);
661
+ break;
662
+ }
663
+ }
664
+ return message;
665
+ },
666
+
667
+ fromJSON(object: any): Data {
668
+ return {
669
+ position: isSet(object.position) ? Position.fromJSON(object.position) : undefined,
670
+ profile: isSet(object.profile) ? Profile.fromJSON(object.profile) : undefined,
671
+ profileRequest: isSet(object.profileRequest) ? ProfileRequest.fromJSON(object.profileRequest) : undefined,
672
+ profileResponse: isSet(object.profileResponse) ? ProfileResponse.fromJSON(object.profileResponse) : undefined,
673
+ chat: isSet(object.chat) ? Chat.fromJSON(object.chat) : undefined,
674
+ scene: isSet(object.scene) ? Scene.fromJSON(object.scene) : undefined,
675
+ voice: isSet(object.voice) ? Voice.fromJSON(object.voice) : undefined,
676
+ };
677
+ },
678
+
679
+ toJSON(message: Data): unknown {
680
+ const obj: any = {};
681
+ message.position !== undefined && (obj.position = message.position ? Position.toJSON(message.position) : undefined);
682
+ message.profile !== undefined && (obj.profile = message.profile ? Profile.toJSON(message.profile) : undefined);
683
+ message.profileRequest !== undefined &&
684
+ (obj.profileRequest = message.profileRequest ? ProfileRequest.toJSON(message.profileRequest) : undefined);
685
+ message.profileResponse !== undefined &&
686
+ (obj.profileResponse = message.profileResponse ? ProfileResponse.toJSON(message.profileResponse) : undefined);
687
+ message.chat !== undefined && (obj.chat = message.chat ? Chat.toJSON(message.chat) : undefined);
688
+ message.scene !== undefined && (obj.scene = message.scene ? Scene.toJSON(message.scene) : undefined);
689
+ message.voice !== undefined && (obj.voice = message.voice ? Voice.toJSON(message.voice) : undefined);
690
+ return obj;
691
+ },
692
+
693
+ fromPartial<I extends Exact<DeepPartial<Data>, I>>(object: I): Data {
694
+ const message = createBaseData();
695
+ message.position = (object.position !== undefined && object.position !== null)
696
+ ? Position.fromPartial(object.position)
697
+ : undefined;
698
+ message.profile = (object.profile !== undefined && object.profile !== null)
699
+ ? Profile.fromPartial(object.profile)
700
+ : undefined;
701
+ message.profileRequest = (object.profileRequest !== undefined && object.profileRequest !== null)
702
+ ? ProfileRequest.fromPartial(object.profileRequest)
703
+ : undefined;
704
+ message.profileResponse = (object.profileResponse !== undefined && object.profileResponse !== null)
705
+ ? ProfileResponse.fromPartial(object.profileResponse)
706
+ : undefined;
707
+ message.chat = (object.chat !== undefined && object.chat !== null) ? Chat.fromPartial(object.chat) : undefined;
708
+ message.scene = (object.scene !== undefined && object.scene !== null) ? Scene.fromPartial(object.scene) : undefined;
709
+ message.voice = (object.voice !== undefined && object.voice !== null) ? Voice.fromPartial(object.voice) : undefined;
710
+ return message;
711
+ },
712
+ };
713
+
714
+ declare var self: any | undefined;
715
+ declare var window: any | undefined;
716
+ declare var global: any | undefined;
717
+ var globalThis: any = (() => {
718
+ if (typeof globalThis !== "undefined") {
719
+ return globalThis;
720
+ }
721
+ if (typeof self !== "undefined") {
722
+ return self;
723
+ }
724
+ if (typeof window !== "undefined") {
725
+ return window;
726
+ }
727
+ if (typeof global !== "undefined") {
728
+ return global;
729
+ }
730
+ throw "Unable to locate global object";
731
+ })();
732
+
733
+ function bytesFromBase64(b64: string): Uint8Array {
734
+ if (globalThis.Buffer) {
735
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
736
+ } else {
737
+ const bin = globalThis.atob(b64);
738
+ const arr = new Uint8Array(bin.length);
739
+ for (let i = 0; i < bin.length; ++i) {
740
+ arr[i] = bin.charCodeAt(i);
741
+ }
742
+ return arr;
743
+ }
744
+ }
745
+
746
+ function base64FromBytes(arr: Uint8Array): string {
747
+ if (globalThis.Buffer) {
748
+ return globalThis.Buffer.from(arr).toString("base64");
749
+ } else {
750
+ const bin: string[] = [];
751
+ arr.forEach((byte) => {
752
+ bin.push(String.fromCharCode(byte));
753
+ });
754
+ return globalThis.btoa(bin.join(""));
755
+ }
756
+ }
757
+
758
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
759
+
760
+ export type DeepPartial<T> = T extends Builtin ? T
761
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
762
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
763
+ : Partial<T>;
764
+
765
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
766
+ export type Exact<P, I extends P> = P extends Builtin ? P
767
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
768
+
769
+ function isSet(value: any): boolean {
770
+ return value !== null && value !== undefined;
771
+ }