@doordeck/doordeck-headless-sdk 0.193.0 → 0.194.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.
@@ -1,42 +1,146 @@
1
- (function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_ktor_ktor_io, kotlin_org_jetbrains_kotlinx_kotlinx_io_core) {
1
+ (function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_ktor_ktor_utils, kotlin_io_ktor_ktor_io, kotlin_org_jetbrains_kotlinx_kotlinx_io_core, kotlin_org_jetbrains_kotlinx_atomicfu) {
2
2
  'use strict';
3
3
  //region block: imports
4
4
  var imul = Math.imul;
5
- var collectionSizeOrDefault = kotlin_kotlin.$_$.u5;
6
- var mapCapacity = kotlin_kotlin.$_$.l7;
7
- var coerceAtLeast = kotlin_kotlin.$_$.cc;
8
- var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.r;
9
- var Unit_instance = kotlin_kotlin.$_$.z4;
10
- var protoOf = kotlin_kotlin.$_$.vb;
11
- var initMetadataForCompanion = kotlin_kotlin.$_$.za;
12
- var enumEntries = kotlin_kotlin.$_$.j9;
13
- var Enum = kotlin_kotlin.$_$.kf;
14
- var initMetadataForClass = kotlin_kotlin.$_$.ya;
5
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.x5;
6
+ var mapCapacity = kotlin_kotlin.$_$.p7;
7
+ var coerceAtLeast = kotlin_kotlin.$_$.hc;
8
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.t;
9
+ var Unit_instance = kotlin_kotlin.$_$.c5;
10
+ var protoOf = kotlin_kotlin.$_$.zb;
11
+ var initMetadataForCompanion = kotlin_kotlin.$_$.db;
12
+ var enumEntries = kotlin_kotlin.$_$.n9;
13
+ var objectCreate = kotlin_kotlin.$_$.yb;
14
+ var Enum = kotlin_kotlin.$_$.qf;
15
+ var initMetadataForClass = kotlin_kotlin.$_$.cb;
15
16
  var VOID = kotlin_kotlin.$_$.b;
16
- var toString = kotlin_kotlin.$_$.yb;
17
- var getStringHashCode = kotlin_kotlin.$_$.wa;
18
- var DisposableHandle = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c1;
19
- var initMetadataForObject = kotlin_kotlin.$_$.eb;
20
- var compareTo = kotlin_kotlin.$_$.oa;
21
- var ensureNotNull = kotlin_kotlin.$_$.lg;
22
- var objectCreate = kotlin_kotlin.$_$.ub;
23
- var toByteArray = kotlin_io_ktor_ktor_io.$_$.d1;
24
- var Buffer = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.f;
25
- var writeText = kotlin_io_ktor_ktor_io.$_$.f1;
17
+ var toString = kotlin_kotlin.$_$.cc;
18
+ var getStringHashCode = kotlin_kotlin.$_$.ab;
19
+ var initMetadataForInterface = kotlin_kotlin.$_$.gb;
20
+ var isInterface = kotlin_kotlin.$_$.rb;
21
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.p1;
22
+ var Dispatchers_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.q;
23
+ var launch = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a2;
24
+ var CoroutineStart_UNDISPATCHED_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c;
25
+ var ChannelResult = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.u;
26
+ var _ChannelResult___get_isSuccess__impl__odq1z9 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n;
27
+ var CoroutineImpl = kotlin_kotlin.$_$.l9;
28
+ var THROW_CCE = kotlin_kotlin.$_$.zf;
29
+ var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.q1;
30
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.v8;
31
+ var initMetadataForLambda = kotlin_kotlin.$_$.hb;
32
+ var get_isTraceEnabled = kotlin_io_ktor_ktor_utils.$_$.l;
33
+ var BytePacketBuilder = kotlin_io_ktor_ktor_io.$_$.x;
34
+ var writeFully = kotlin_io_ktor_ktor_io.$_$.g1;
35
+ var ensureNotNull = kotlin_kotlin.$_$.rg;
36
+ var build = kotlin_io_ktor_ktor_io.$_$.y;
26
37
  var readByteArray = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.k;
38
+ var cancelConsumed = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b1;
39
+ var ClosedSendChannelException = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.x;
40
+ var CancellationException_init_$Create$ = kotlin_kotlin.$_$.b1;
41
+ var ChannelIOException = kotlin_io_ktor_ktor_utils.$_$.d;
42
+ var CancellationException = kotlin_kotlin.$_$.u8;
43
+ var ClosedReceiveChannelException = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.w;
44
+ var IOException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.c;
45
+ var initMetadataForCoroutine = kotlin_kotlin.$_$.eb;
46
+ var toString_0 = kotlin_kotlin.$_$.ch;
47
+ var get_size = kotlin_io_ktor_ktor_io.$_$.d1;
48
+ var fromInt = kotlin_kotlin.$_$.w9;
49
+ var atomic$ref$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.d;
50
+ var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l1;
51
+ var Job = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.s1;
52
+ var Key_instance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.s;
53
+ var CoroutineName = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o1;
54
+ var Factory_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o;
55
+ var atomic$boolean$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.b;
56
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l;
57
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.t1;
58
+ var joinToString = kotlin_kotlin.$_$.h7;
59
+ var KtorSimpleLogger = kotlin_io_ktor_ktor_utils.$_$.k;
60
+ var Buffer = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.f;
61
+ var readText = kotlin_io_ktor_ktor_io.$_$.b1;
62
+ var DisposableHandle = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r1;
63
+ var initMetadataForObject = kotlin_kotlin.$_$.ib;
64
+ var Exception = kotlin_kotlin.$_$.sf;
65
+ var Exception_init_$Init$ = kotlin_kotlin.$_$.i1;
66
+ var captureStack = kotlin_kotlin.$_$.la;
67
+ var initCauseBridge = kotlin_io_ktor_ktor_utils.$_$.j;
68
+ var defineProp = kotlin_kotlin.$_$.ta;
69
+ var CopyableThrowable = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n1;
70
+ var compareTo = kotlin_kotlin.$_$.sa;
71
+ var Channel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.v;
72
+ var Charsets_getInstance = kotlin_io_ktor_ktor_io.$_$.o;
73
+ var toByteArray = kotlin_io_ktor_ktor_io.$_$.f1;
74
+ var decodeToString = kotlin_kotlin.$_$.fd;
75
+ var getTimeMillis = kotlin_io_ktor_ktor_utils.$_$.h;
76
+ var Random = kotlin_kotlin.$_$.fc;
77
+ var withTimeoutOrNull = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
78
+ var hex = kotlin_io_ktor_ktor_utils.$_$.j1;
79
+ var ClosedByteChannelException = kotlin_io_ktor_ktor_io.$_$.o1;
80
+ var BufferOverflow_SUSPEND_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b;
81
+ var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.o9;
82
+ var BufferOverflow_DROP_OLDEST_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a;
83
+ var _ChannelResult___get_isClosed__impl__mg7kuu = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.m;
84
+ var close$default = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l;
85
+ var cancel$default = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.k;
86
+ var ReceiveChannel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z;
87
+ var SendChannel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a1;
88
+ var RuntimeException = kotlin_kotlin.$_$.yf;
89
+ var RuntimeException_init_$Init$ = kotlin_kotlin.$_$.b2;
90
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.k;
91
+ var split = kotlin_kotlin.$_$.ae;
92
+ var first = kotlin_kotlin.$_$.z6;
93
+ var isCharSequence = kotlin_kotlin.$_$.nb;
94
+ var trim = kotlin_kotlin.$_$.df;
95
+ var drop = kotlin_kotlin.$_$.r6;
96
+ var writeText = kotlin_io_ktor_ktor_io.$_$.h1;
97
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.yg;
27
98
  //endregion
28
99
  //region block: pre-declaration
29
100
  initMetadataForCompanion(Companion);
30
101
  initMetadataForClass(Codes, 'Codes', VOID, Enum);
31
102
  initMetadataForClass(CloseReason, 'CloseReason');
32
- initMetadataForObject(NonDisposableHandle, 'NonDisposableHandle', VOID, VOID, [DisposableHandle]);
103
+ function send(frame, $completion) {
104
+ return this.q3c().y1b(frame, $completion);
105
+ }
106
+ initMetadataForInterface(WebSocketSession, 'WebSocketSession', VOID, VOID, [CoroutineScope], [1, 0]);
107
+ initMetadataForInterface(DefaultWebSocketSession, 'DefaultWebSocketSession', VOID, VOID, [WebSocketSession], [1, 0]);
33
108
  initMetadataForCompanion(Companion_0);
109
+ initMetadataForLambda(DefaultWebSocketSessionImpl$start$slambda, CoroutineImpl, VOID, [1]);
110
+ initMetadataForLambda(DefaultWebSocketSessionImpl$runIncomingProcessor$slambda, CoroutineImpl, VOID, [1]);
111
+ initMetadataForLambda(DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda, CoroutineImpl, VOID, [1]);
112
+ initMetadataForLambda(DefaultWebSocketSessionImpl$runOrCancelPinger$slambda, CoroutineImpl, VOID, [1]);
113
+ initMetadataForCoroutine($outgoingProcessorLoopCOROUTINE$, CoroutineImpl);
114
+ initMetadataForCoroutine($sendCloseSequenceCOROUTINE$, CoroutineImpl);
115
+ initMetadataForCoroutine($checkMaxFrameSizeCOROUTINE$, CoroutineImpl);
116
+ initMetadataForClass(DefaultWebSocketSessionImpl, 'DefaultWebSocketSessionImpl', VOID, VOID, [DefaultWebSocketSession, WebSocketSession], [1, 0, 2]);
117
+ initMetadataForObject(NonDisposableHandle, 'NonDisposableHandle', VOID, VOID, [DisposableHandle]);
118
+ initMetadataForClass(FrameTooBigException, 'FrameTooBigException', VOID, Exception, [Exception, CopyableThrowable]);
119
+ initMetadataForCompanion(Companion_1);
34
120
  initMetadataForClass(FrameType, 'FrameType', VOID, Enum);
121
+ initMetadataForLambda(ponger$slambda, CoroutineImpl, VOID, [1]);
122
+ initMetadataForLambda(pinger$slambda$slambda, CoroutineImpl, VOID, [1]);
123
+ initMetadataForLambda(pinger$slambda$slambda_1, CoroutineImpl, VOID, [1]);
124
+ initMetadataForLambda(pinger$slambda, CoroutineImpl, VOID, [1]);
125
+ initMetadataForCompanion(Companion_2);
126
+ initMetadataForClass(WebSocketChannelsConfig, 'WebSocketChannelsConfig', WebSocketChannelsConfig);
127
+ initMetadataForCompanion(Companion_3);
128
+ initMetadataForClass(ChannelConfig, 'ChannelConfig');
129
+ initMetadataForClass(ChannelOverflow, 'ChannelOverflow', VOID, Enum);
130
+ initMetadataForCompanion(Companion_4);
131
+ initMetadataForClass(BoundedChannel, 'BoundedChannel', VOID, VOID, [ReceiveChannel, SendChannel], [1, 0]);
132
+ initMetadataForClass(ChannelOverflowException, 'ChannelOverflowException', VOID, RuntimeException);
133
+ initMetadataForInterface(WebSocketExtension, 'WebSocketExtension');
134
+ initMetadataForClass(WebSocketExtensionsConfig, 'WebSocketExtensionsConfig', WebSocketExtensionsConfig);
135
+ initMetadataForClass(WebSocketExtensionHeader, 'WebSocketExtensionHeader');
136
+ initMetadataForCoroutine($closeCOROUTINE$, CoroutineImpl);
35
137
  initMetadataForClass(Frame, 'Frame');
36
138
  initMetadataForClass(Binary, 'Binary', VOID, Frame);
37
139
  initMetadataForClass(Text, 'Text', VOID, Frame);
38
140
  initMetadataForClass(Close, 'Close', Close_init_$Create$_0, Frame);
39
- initMetadataForCompanion(Companion_1);
141
+ initMetadataForClass(Ping, 'Ping', VOID, Frame);
142
+ initMetadataForClass(Pong, 'Pong', VOID, Frame);
143
+ initMetadataForCompanion(Companion_5);
40
144
  //endregion
41
145
  var Codes_NORMAL_instance;
42
146
  var Codes_GOING_AWAY_instance;
@@ -61,14 +165,14 @@
61
165
  var _iterator__ex2g4s = this_0.t();
62
166
  while (_iterator__ex2g4s.u()) {
63
167
  var element = _iterator__ex2g4s.v();
64
- var tmp$ret$0 = element.z38_1;
168
+ var tmp$ret$0 = element.f3c_1;
65
169
  destination.y2(tmp$ret$0, element);
66
170
  }
67
- tmp.a39_1 = destination;
68
- this.b39_1 = Codes_INTERNAL_ERROR_getInstance();
171
+ tmp.g3c_1 = destination;
172
+ this.h3c_1 = Codes_INTERNAL_ERROR_getInstance();
69
173
  }
70
- protoOf(Companion).c39 = function (code) {
71
- return this.a39_1.g3(code);
174
+ protoOf(Companion).i3c = function (code) {
175
+ return this.g3c_1.g3(code);
72
176
  };
73
177
  var Companion_instance;
74
178
  function Companion_getInstance() {
@@ -105,9 +209,16 @@
105
209
  Companion_getInstance();
106
210
  }
107
211
  var $ENTRIES;
212
+ function CloseReason_init_$Init$(code, message, $this) {
213
+ CloseReason.call($this, code.f3c_1, message);
214
+ return $this;
215
+ }
216
+ function CloseReason_init_$Create$(code, message) {
217
+ return CloseReason_init_$Init$(code, message, objectCreate(protoOf(CloseReason)));
218
+ }
108
219
  function Codes(name, ordinal, code) {
109
220
  Enum.call(this, name, ordinal);
110
- this.z38_1 = code;
221
+ this.f3c_1 = code;
111
222
  }
112
223
  function Codes_NORMAL_getInstance() {
113
224
  Codes_initEntries();
@@ -158,19 +269,19 @@
158
269
  return Codes_TRY_AGAIN_LATER_instance;
159
270
  }
160
271
  function CloseReason(code, message) {
161
- this.d39_1 = code;
162
- this.e39_1 = message;
272
+ this.j3c_1 = code;
273
+ this.k3c_1 = message;
163
274
  }
164
- protoOf(CloseReason).f39 = function () {
165
- return Companion_getInstance().c39(this.d39_1);
275
+ protoOf(CloseReason).l3c = function () {
276
+ return Companion_getInstance().i3c(this.j3c_1);
166
277
  };
167
278
  protoOf(CloseReason).toString = function () {
168
- var tmp0_elvis_lhs = this.f39();
169
- return 'CloseReason(reason=' + toString(tmp0_elvis_lhs == null ? this.d39_1 : tmp0_elvis_lhs) + ', message=' + this.e39_1 + ')';
279
+ var tmp0_elvis_lhs = this.l3c();
280
+ return 'CloseReason(reason=' + toString(tmp0_elvis_lhs == null ? this.j3c_1 : tmp0_elvis_lhs) + ', message=' + this.k3c_1 + ')';
170
281
  };
171
282
  protoOf(CloseReason).hashCode = function () {
172
- var result = this.d39_1;
173
- result = imul(result, 31) + getStringHashCode(this.e39_1) | 0;
283
+ var result = this.j3c_1;
284
+ result = imul(result, 31) + getStringHashCode(this.k3c_1) | 0;
174
285
  return result;
175
286
  };
176
287
  protoOf(CloseReason).equals = function (other) {
@@ -178,15 +289,1143 @@
178
289
  return true;
179
290
  if (!(other instanceof CloseReason))
180
291
  return false;
181
- if (!(this.d39_1 === other.d39_1))
292
+ if (!(this.j3c_1 === other.j3c_1))
182
293
  return false;
183
- if (!(this.e39_1 === other.e39_1))
294
+ if (!(this.k3c_1 === other.k3c_1))
184
295
  return false;
185
296
  return true;
186
297
  };
298
+ function get_LOGGER() {
299
+ _init_properties_DefaultWebSocketSession_kt__469s0y();
300
+ return LOGGER;
301
+ }
302
+ var LOGGER;
303
+ function get_IncomingProcessorCoroutineName() {
304
+ _init_properties_DefaultWebSocketSession_kt__469s0y();
305
+ return IncomingProcessorCoroutineName;
306
+ }
307
+ var IncomingProcessorCoroutineName;
308
+ function get_OutgoingProcessorCoroutineName() {
309
+ _init_properties_DefaultWebSocketSession_kt__469s0y();
310
+ return OutgoingProcessorCoroutineName;
311
+ }
312
+ var OutgoingProcessorCoroutineName;
313
+ function get_NORMAL_CLOSE() {
314
+ _init_properties_DefaultWebSocketSession_kt__469s0y();
315
+ return NORMAL_CLOSE;
316
+ }
317
+ var NORMAL_CLOSE;
318
+ var OUTGOING_CHANNEL_CONFIG;
319
+ function DefaultWebSocketSession() {
320
+ }
321
+ function DefaultWebSocketSession_0(session, pingIntervalMillis, timeoutMillis, channelsConfig) {
322
+ pingIntervalMillis = pingIntervalMillis === VOID ? 0n : pingIntervalMillis;
323
+ timeoutMillis = timeoutMillis === VOID ? 15000n : timeoutMillis;
324
+ channelsConfig = channelsConfig === VOID ? Companion_getInstance_2().s3c_1 : channelsConfig;
325
+ _init_properties_DefaultWebSocketSession_kt__469s0y();
326
+ // Inline function 'kotlin.require' call
327
+ if (!!isInterface(session, DefaultWebSocketSession)) {
328
+ var message = 'Cannot wrap other DefaultWebSocketSession';
329
+ throw IllegalArgumentException_init_$Create$(toString(message));
330
+ }
331
+ return new DefaultWebSocketSessionImpl(session, pingIntervalMillis, timeoutMillis, channelsConfig.t3c_1, channelsConfig.u3c_1);
332
+ }
333
+ function runIncomingProcessor($this, ponger) {
334
+ var tmp = get_IncomingProcessorCoroutineName().ch(Dispatchers_getInstance().n15_1);
335
+ return launch($this, tmp, VOID, DefaultWebSocketSessionImpl$runIncomingProcessor$slambda_0($this, ponger, null));
336
+ }
337
+ function runOutgoingProcessor($this) {
338
+ var tmp = get_OutgoingProcessorCoroutineName().ch(Dispatchers_getInstance().n15_1);
339
+ var tmp_0 = CoroutineStart_UNDISPATCHED_getInstance();
340
+ return launch($this, tmp, tmp_0, DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda_0($this, null));
341
+ }
342
+ function outgoingProcessorLoop($this, $completion) {
343
+ var tmp = new $outgoingProcessorLoopCOROUTINE$($this, $completion);
344
+ tmp.c9_1 = Unit_instance;
345
+ tmp.d9_1 = null;
346
+ return tmp.i9();
347
+ }
348
+ function sendCloseSequence($this, reason, exception, $completion) {
349
+ var tmp = new $sendCloseSequenceCOROUTINE$($this, reason, exception, $completion);
350
+ tmp.c9_1 = Unit_instance;
351
+ tmp.d9_1 = null;
352
+ return tmp.i9();
353
+ }
354
+ function sendCloseSequence$default($this, reason, exception, $completion, $super) {
355
+ exception = exception === VOID ? null : exception;
356
+ return sendCloseSequence($this, reason, exception, $completion);
357
+ }
358
+ function tryClose($this) {
359
+ return $this.z3d_1.atomicfu$compareAndSet(false, true);
360
+ }
361
+ function runOrCancelPinger($this) {
362
+ var interval = $this.c3e_1;
363
+ var tmp;
364
+ if ($this.z3d_1.kotlinx$atomicfu$value) {
365
+ tmp = null;
366
+ } else if (interval > 0n) {
367
+ var tmp_0 = $this.s3d_1.q3c();
368
+ var tmp_1 = $this.d3e_1;
369
+ tmp = pinger($this, tmp_0, interval, tmp_1, DefaultWebSocketSessionImpl$runOrCancelPinger$slambda_0($this, null));
370
+ } else {
371
+ tmp = null;
372
+ }
373
+ var newPinger = tmp;
374
+ var tmp0_safe_receiver = $this.t3d_1.atomicfu$getAndSet(newPinger);
375
+ if (tmp0_safe_receiver == null)
376
+ null;
377
+ else
378
+ tmp0_safe_receiver.g1c();
379
+ var tmp2_safe_receiver = newPinger == null ? null : new ChannelResult(newPinger.z1b(Companion_getInstance_0().f3e_1));
380
+ if (tmp2_safe_receiver == null)
381
+ null;
382
+ else
383
+ _ChannelResult___get_isSuccess__impl__odq1z9(tmp2_safe_receiver.j1a_1);
384
+ if ($this.z3d_1.kotlinx$atomicfu$value && !(newPinger == null)) {
385
+ runOrCancelPinger($this);
386
+ }
387
+ }
388
+ function checkMaxFrameSize($this, packet, frame, $completion) {
389
+ var tmp = new $checkMaxFrameSizeCOROUTINE$($this, packet, frame, $completion);
390
+ tmp.c9_1 = Unit_instance;
391
+ tmp.d9_1 = null;
392
+ return tmp.i9();
393
+ }
394
+ function processIncomingExtensions($this, frame) {
395
+ // Inline function 'kotlin.collections.fold' call
396
+ var accumulator = frame;
397
+ var _iterator__ex2g4s = $this.s3e().t();
398
+ while (_iterator__ex2g4s.u()) {
399
+ var element = _iterator__ex2g4s.v();
400
+ var current = accumulator;
401
+ accumulator = element.t3e(current);
402
+ }
403
+ return accumulator;
404
+ }
405
+ function processOutgoingExtensions($this, frame) {
406
+ // Inline function 'kotlin.collections.fold' call
407
+ var accumulator = frame;
408
+ var _iterator__ex2g4s = $this.s3e().t();
409
+ while (_iterator__ex2g4s.u()) {
410
+ var element = _iterator__ex2g4s.v();
411
+ var current = accumulator;
412
+ accumulator = element.u3e(current);
413
+ }
414
+ return accumulator;
415
+ }
416
+ function Companion_0() {
417
+ Companion_instance_0 = this;
418
+ this.f3e_1 = new Pong(new Int8Array(0), NonDisposableHandle_instance);
419
+ }
420
+ var Companion_instance_0;
421
+ function Companion_getInstance_0() {
422
+ if (Companion_instance_0 == null)
423
+ new Companion_0();
424
+ return Companion_instance_0;
425
+ }
426
+ function DefaultWebSocketSessionImpl$start$slambda($incomingJob, $outgoingJob, this$0, resultContinuation) {
427
+ this.d3f_1 = $incomingJob;
428
+ this.e3f_1 = $outgoingJob;
429
+ this.f3f_1 = this$0;
430
+ CoroutineImpl.call(this, resultContinuation);
431
+ }
432
+ protoOf(DefaultWebSocketSessionImpl$start$slambda).b1x = function ($this$launch, $completion) {
433
+ var tmp = this.c1x($this$launch, $completion);
434
+ tmp.c9_1 = Unit_instance;
435
+ tmp.d9_1 = null;
436
+ return tmp.i9();
437
+ };
438
+ protoOf(DefaultWebSocketSessionImpl$start$slambda).u9 = function (p1, $completion) {
439
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
440
+ };
441
+ protoOf(DefaultWebSocketSessionImpl$start$slambda).i9 = function () {
442
+ var suspendResult = this.c9_1;
443
+ $sm: do
444
+ try {
445
+ var tmp = this.a9_1;
446
+ switch (tmp) {
447
+ case 0:
448
+ this.b9_1 = 3;
449
+ this.a9_1 = 1;
450
+ suspendResult = this.d3f_1.cu(this);
451
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
452
+ return suspendResult;
453
+ }
454
+
455
+ continue $sm;
456
+ case 1:
457
+ this.a9_1 = 2;
458
+ suspendResult = this.e3f_1.cu(this);
459
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
460
+ return suspendResult;
461
+ }
462
+
463
+ continue $sm;
464
+ case 2:
465
+ this.f3f_1.v3d_1.gu();
466
+ return Unit_instance;
467
+ case 3:
468
+ throw this.d9_1;
469
+ }
470
+ } catch ($p) {
471
+ var e = $p;
472
+ if (this.b9_1 === 3) {
473
+ throw e;
474
+ } else {
475
+ this.a9_1 = this.b9_1;
476
+ this.d9_1 = e;
477
+ }
478
+ }
479
+ while (true);
480
+ };
481
+ protoOf(DefaultWebSocketSessionImpl$start$slambda).c1x = function ($this$launch, completion) {
482
+ var i = new DefaultWebSocketSessionImpl$start$slambda(this.d3f_1, this.e3f_1, this.f3f_1, completion);
483
+ i.g3f_1 = $this$launch;
484
+ return i;
485
+ };
486
+ function DefaultWebSocketSessionImpl$start$slambda_0($incomingJob, $outgoingJob, this$0, resultContinuation) {
487
+ var i = new DefaultWebSocketSessionImpl$start$slambda($incomingJob, $outgoingJob, this$0, resultContinuation);
488
+ var l = function ($this$launch, $completion) {
489
+ return i.b1x($this$launch, $completion);
490
+ };
491
+ l.$arity = 1;
492
+ return l;
493
+ }
494
+ function DefaultWebSocketSessionImpl$runIncomingProcessor$slambda(this$0, $ponger, resultContinuation) {
495
+ this.p3f_1 = this$0;
496
+ this.q3f_1 = $ponger;
497
+ CoroutineImpl.call(this, resultContinuation);
498
+ }
499
+ protoOf(DefaultWebSocketSessionImpl$runIncomingProcessor$slambda).b1x = function ($this$launch, $completion) {
500
+ var tmp = this.c1x($this$launch, $completion);
501
+ tmp.c9_1 = Unit_instance;
502
+ tmp.d9_1 = null;
503
+ return tmp.i9();
504
+ };
505
+ protoOf(DefaultWebSocketSessionImpl$runIncomingProcessor$slambda).u9 = function (p1, $completion) {
506
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
507
+ };
508
+ protoOf(DefaultWebSocketSessionImpl$runIncomingProcessor$slambda).i9 = function () {
509
+ var suspendResult = this.c9_1;
510
+ $sm: do
511
+ try {
512
+ var tmp = this.a9_1;
513
+ switch (tmp) {
514
+ case 0:
515
+ this.b9_1 = 39;
516
+ this.b3g_1 = null;
517
+ this.u3f_1 = null;
518
+ this.t3f_1 = false;
519
+ this.v3f_1 = Unit_instance;
520
+ this.a9_1 = 1;
521
+ continue $sm;
522
+ case 1:
523
+ this.a9_1 = 2;
524
+ continue $sm;
525
+ case 2:
526
+ this.b9_1 = 33;
527
+ this.b9_1 = 32;
528
+ this.f3g_1 = this.p3f_1.s3d_1.p3c();
529
+ this.a9_1 = 3;
530
+ continue $sm;
531
+ case 3:
532
+ this.y3f_1 = this.f3g_1;
533
+ this.x3f_1 = null;
534
+ this.a9_1 = 4;
535
+ continue $sm;
536
+ case 4:
537
+ this.a9_1 = 5;
538
+ continue $sm;
539
+ case 5:
540
+ this.a9_1 = 6;
541
+ continue $sm;
542
+ case 6:
543
+ this.b9_1 = 29;
544
+ this.b9_1 = 28;
545
+ this.e3g_1 = this.y3f_1.t();
546
+ this.a9_1 = 7;
547
+ continue $sm;
548
+ case 7:
549
+ this.a9_1 = 8;
550
+ suspendResult = this.e3g_1.b1a(this);
551
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
552
+ return suspendResult;
553
+ }
554
+
555
+ continue $sm;
556
+ case 8:
557
+ if (!suspendResult) {
558
+ this.a9_1 = 26;
559
+ continue $sm;
560
+ }
561
+
562
+ var e = this.e3g_1.v();
563
+ this.d3g_1 = e;
564
+ this.a9_1 = 9;
565
+ continue $sm;
566
+ case 9:
567
+ this.c3g_1 = this.d3g_1;
568
+ var this_0 = get_LOGGER();
569
+ if (get_isTraceEnabled(this_0)) {
570
+ this_0.r2s('WebSocketSession(' + toString(this.r3f_1) + ') receiving frame ' + this.c3g_1.toString());
571
+ }
572
+
573
+ var tmp0_subject = this.c3g_1;
574
+ if (tmp0_subject instanceof Close) {
575
+ if (!this.p3f_1.q3c().d1a()) {
576
+ this.a9_1 = 18;
577
+ var tmp_0 = this.p3f_1.q3c();
578
+ var tmp1_elvis_lhs = readReason(this.c3g_1);
579
+ suspendResult = tmp_0.y1b(Close_init_$Create$(tmp1_elvis_lhs == null ? get_NORMAL_CLOSE() : tmp1_elvis_lhs), this);
580
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
581
+ return suspendResult;
582
+ }
583
+ continue $sm;
584
+ } else {
585
+ this.a9_1 = 19;
586
+ continue $sm;
587
+ }
588
+ } else {
589
+ if (tmp0_subject instanceof Pong) {
590
+ var tmp2_safe_receiver = this.p3f_1.t3d_1.kotlinx$atomicfu$value;
591
+ if (tmp2_safe_receiver == null) {
592
+ this.a3g_1 = null;
593
+ this.a9_1 = 17;
594
+ continue $sm;
595
+ } else {
596
+ this.a9_1 = 16;
597
+ suspendResult = tmp2_safe_receiver.y1b(this.c3g_1, this);
598
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
599
+ return suspendResult;
600
+ }
601
+ continue $sm;
602
+ }
603
+ } else {
604
+ if (tmp0_subject instanceof Ping) {
605
+ this.a9_1 = 15;
606
+ suspendResult = this.q3f_1.y1b(this.c3g_1, this);
607
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
608
+ return suspendResult;
609
+ }
610
+ continue $sm;
611
+ } else {
612
+ this.a9_1 = 10;
613
+ suspendResult = checkMaxFrameSize(this.p3f_1, this.u3f_1, this.c3g_1, this);
614
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
615
+ return suspendResult;
616
+ }
617
+ continue $sm;
618
+ }
619
+ }
620
+ }
621
+
622
+ case 10:
623
+ if (!this.c3g_1.g3g_1) {
624
+ if (this.b3g_1 == null) {
625
+ this.b3g_1 = this.c3g_1;
626
+ }
627
+ if (this.u3f_1 == null) {
628
+ this.u3f_1 = BytePacketBuilder();
629
+ }
630
+ writeFully(this.u3f_1, this.c3g_1.i3g_1);
631
+ this.a9_1 = 21;
632
+ continue $sm;
633
+ } else {
634
+ this.a9_1 = 11;
635
+ continue $sm;
636
+ }
637
+
638
+ case 11:
639
+ if (this.b3g_1 == null) {
640
+ this.a9_1 = 14;
641
+ suspendResult = this.p3f_1.x3d_1.y1b(processIncomingExtensions(this.p3f_1, this.c3g_1), this);
642
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
643
+ return suspendResult;
644
+ }
645
+ continue $sm;
646
+ } else {
647
+ this.a9_1 = 12;
648
+ continue $sm;
649
+ }
650
+
651
+ case 12:
652
+ writeFully(ensureNotNull(this.u3f_1), this.c3g_1.i3g_1);
653
+ var defragmented = Companion_getInstance_5().o3g(true, this.b3g_1.h3g_1, readByteArray(build(this.u3f_1)), this.b3g_1.k3g_1, this.b3g_1.l3g_1, this.b3g_1.m3g_1);
654
+ this.b3g_1 = null;
655
+ this.a9_1 = 13;
656
+ suspendResult = this.p3f_1.x3d_1.y1b(processIncomingExtensions(this.p3f_1, defragmented), this);
657
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
658
+ return suspendResult;
659
+ }
660
+
661
+ continue $sm;
662
+ case 13:
663
+ var tmp_1 = this;
664
+ tmp_1.z3f_1 = Unit_instance;
665
+ this.a9_1 = 20;
666
+ continue $sm;
667
+ case 14:
668
+ this.a9_1 = 21;
669
+ continue $sm;
670
+ case 15:
671
+ var tmp_2 = this;
672
+ tmp_2.z3f_1 = Unit_instance;
673
+ this.a9_1 = 20;
674
+ continue $sm;
675
+ case 16:
676
+ var tmp_3 = this;
677
+ tmp_3.a3g_1 = Unit_instance;
678
+ this.a9_1 = 17;
679
+ continue $sm;
680
+ case 17:
681
+ this.z3f_1 = this.a3g_1;
682
+ this.a9_1 = 20;
683
+ continue $sm;
684
+ case 18:
685
+ this.a9_1 = 19;
686
+ continue $sm;
687
+ case 19:
688
+ this.t3f_1 = true;
689
+ this.a9_1 = 22;
690
+ var tmp_4 = this;
691
+ continue $sm;
692
+ case 20:
693
+ if (false) {
694
+ this.a9_1 = 9;
695
+ continue $sm;
696
+ }
697
+
698
+ this.a9_1 = 21;
699
+ continue $sm;
700
+ case 21:
701
+ this.a9_1 = 7;
702
+ continue $sm;
703
+ case 22:
704
+ this.b9_1 = 32;
705
+ cancelConsumed(this.y3f_1, this.x3f_1);
706
+ this.b9_1 = 39;
707
+ this.a9_1 = 23;
708
+ continue $sm;
709
+ case 23:
710
+ this.b9_1 = 39;
711
+ this.q3f_1.g1c();
712
+ var tmp0_safe_receiver = this.u3f_1;
713
+ if (tmp0_safe_receiver == null)
714
+ null;
715
+ else {
716
+ tmp0_safe_receiver.l4();
717
+ }
718
+
719
+ this.p3f_1.x3d_1.g1c();
720
+ if (!this.t3f_1) {
721
+ this.a9_1 = 24;
722
+ suspendResult = close(this.p3f_1, CloseReason_init_$Create$(Codes_CLOSED_ABNORMALLY_getInstance(), 'Connection was closed without close frame'), this);
723
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
724
+ return suspendResult;
725
+ }
726
+ continue $sm;
727
+ } else {
728
+ this.a9_1 = 25;
729
+ continue $sm;
730
+ }
731
+
732
+ case 24:
733
+ this.a9_1 = 25;
734
+ continue $sm;
735
+ case 25:
736
+ var tmp_5 = this;
737
+ return Unit_instance;
738
+ case 26:
739
+ this.a9_1 = 27;
740
+ var tmp_6 = this;
741
+ continue $sm;
742
+ case 27:
743
+ this.b9_1 = 32;
744
+ cancelConsumed(this.y3f_1, this.x3f_1);
745
+ this.a9_1 = 31;
746
+ continue $sm;
747
+ case 28:
748
+ this.b9_1 = 29;
749
+ var tmp_7 = this.d9_1;
750
+ if (tmp_7 instanceof Error) {
751
+ var e_0 = this.d9_1;
752
+ var tmp_8 = this;
753
+ this.x3f_1 = e_0;
754
+ throw e_0;
755
+ } else {
756
+ throw this.d9_1;
757
+ }
758
+
759
+ case 29:
760
+ this.b9_1 = 32;
761
+ var t = this.d9_1;
762
+ cancelConsumed(this.y3f_1, this.x3f_1);
763
+ throw t;
764
+ case 30:
765
+ this.b9_1 = 32;
766
+ cancelConsumed(this.y3f_1, this.x3f_1);
767
+ if (false) {
768
+ this.a9_1 = 3;
769
+ continue $sm;
770
+ }
771
+
772
+ this.a9_1 = 31;
773
+ continue $sm;
774
+ case 31:
775
+ this.v3f_1 = Unit_instance;
776
+ this.b9_1 = 39;
777
+ this.a9_1 = 36;
778
+ continue $sm;
779
+ case 32:
780
+ this.b9_1 = 33;
781
+ var tmp_9 = this.d9_1;
782
+ if (tmp_9 instanceof ClosedSendChannelException) {
783
+ var _unused_var__etf5q3 = this.d9_1;
784
+ var tmp_10 = this;
785
+ tmp_10.v3f_1 = Unit_instance;
786
+ this.b9_1 = 39;
787
+ this.a9_1 = 36;
788
+ continue $sm;
789
+ } else {
790
+ var tmp_11 = this.d9_1;
791
+ if (tmp_11 instanceof Error) {
792
+ var cause = this.d9_1;
793
+ var tmp_12 = this;
794
+ this.q3f_1.g1c();
795
+ tmp_12.v3f_1 = this.p3f_1.x3d_1.e1c(cause);
796
+ this.b9_1 = 39;
797
+ this.a9_1 = 36;
798
+ continue $sm;
799
+ } else {
800
+ throw this.d9_1;
801
+ }
802
+ }
803
+
804
+ case 33:
805
+ this.b9_1 = 39;
806
+ this.w3f_1 = this.d9_1;
807
+ this.q3f_1.g1c();
808
+ var tmp0_safe_receiver_0 = this.u3f_1;
809
+ if (tmp0_safe_receiver_0 == null)
810
+ null;
811
+ else {
812
+ tmp0_safe_receiver_0.l4();
813
+ }
814
+
815
+ this.p3f_1.x3d_1.g1c();
816
+ if (!this.t3f_1) {
817
+ this.a9_1 = 34;
818
+ suspendResult = close(this.p3f_1, CloseReason_init_$Create$(Codes_CLOSED_ABNORMALLY_getInstance(), 'Connection was closed without close frame'), this);
819
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
820
+ return suspendResult;
821
+ }
822
+ continue $sm;
823
+ } else {
824
+ this.a9_1 = 35;
825
+ continue $sm;
826
+ }
827
+
828
+ case 34:
829
+ this.a9_1 = 35;
830
+ continue $sm;
831
+ case 35:
832
+ throw this.w3f_1;
833
+ case 36:
834
+ this.s3f_1 = this.v3f_1;
835
+ this.b9_1 = 39;
836
+ this.q3f_1.g1c();
837
+ var tmp0_safe_receiver_1 = this.u3f_1;
838
+ if (tmp0_safe_receiver_1 == null)
839
+ null;
840
+ else {
841
+ tmp0_safe_receiver_1.l4();
842
+ }
843
+
844
+ this.p3f_1.x3d_1.g1c();
845
+ if (!this.t3f_1) {
846
+ this.a9_1 = 37;
847
+ suspendResult = close(this.p3f_1, CloseReason_init_$Create$(Codes_CLOSED_ABNORMALLY_getInstance(), 'Connection was closed without close frame'), this);
848
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
849
+ return suspendResult;
850
+ }
851
+ continue $sm;
852
+ } else {
853
+ this.a9_1 = 38;
854
+ continue $sm;
855
+ }
856
+
857
+ case 37:
858
+ this.a9_1 = 38;
859
+ continue $sm;
860
+ case 38:
861
+ return Unit_instance;
862
+ case 39:
863
+ throw this.d9_1;
864
+ }
865
+ } catch ($p) {
866
+ var e_1 = $p;
867
+ if (this.b9_1 === 39) {
868
+ throw e_1;
869
+ } else {
870
+ this.a9_1 = this.b9_1;
871
+ this.d9_1 = e_1;
872
+ }
873
+ }
874
+ while (true);
875
+ };
876
+ protoOf(DefaultWebSocketSessionImpl$runIncomingProcessor$slambda).c1x = function ($this$launch, completion) {
877
+ var i = new DefaultWebSocketSessionImpl$runIncomingProcessor$slambda(this.p3f_1, this.q3f_1, completion);
878
+ i.r3f_1 = $this$launch;
879
+ return i;
880
+ };
881
+ function DefaultWebSocketSessionImpl$runIncomingProcessor$slambda_0(this$0, $ponger, resultContinuation) {
882
+ var i = new DefaultWebSocketSessionImpl$runIncomingProcessor$slambda(this$0, $ponger, resultContinuation);
883
+ var l = function ($this$launch, $completion) {
884
+ return i.b1x($this$launch, $completion);
885
+ };
886
+ l.$arity = 1;
887
+ return l;
888
+ }
889
+ function DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this$0, resultContinuation) {
890
+ this.x3g_1 = this$0;
891
+ CoroutineImpl.call(this, resultContinuation);
892
+ }
893
+ protoOf(DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda).b1x = function ($this$launch, $completion) {
894
+ var tmp = this.c1x($this$launch, $completion);
895
+ tmp.c9_1 = Unit_instance;
896
+ tmp.d9_1 = null;
897
+ return tmp.i9();
898
+ };
899
+ protoOf(DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda).u9 = function (p1, $completion) {
900
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
901
+ };
902
+ protoOf(DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda).i9 = function () {
903
+ var suspendResult = this.c9_1;
904
+ $sm: do
905
+ try {
906
+ var tmp = this.a9_1;
907
+ switch (tmp) {
908
+ case 0:
909
+ this.b9_1 = 13;
910
+ this.a9_1 = 1;
911
+ continue $sm;
912
+ case 1:
913
+ this.a9_1 = 2;
914
+ continue $sm;
915
+ case 2:
916
+ this.b9_1 = 9;
917
+ this.b9_1 = 4;
918
+ this.a9_1 = 3;
919
+ suspendResult = outgoingProcessorLoop(this.x3g_1, this);
920
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
921
+ return suspendResult;
922
+ }
923
+
924
+ continue $sm;
925
+ case 3:
926
+ this.b9_1 = 13;
927
+ this.a9_1 = 11;
928
+ continue $sm;
929
+ case 4:
930
+ this.b9_1 = 9;
931
+ var tmp_0 = this.d9_1;
932
+ if (tmp_0 instanceof ClosedSendChannelException) {
933
+ var _unused_var__etf5q3 = this.d9_1;
934
+ this.b9_1 = 13;
935
+ this.a9_1 = 11;
936
+ continue $sm;
937
+ } else {
938
+ var tmp_1 = this.d9_1;
939
+ if (tmp_1 instanceof ClosedReceiveChannelException) {
940
+ var _unused_var__etf5q3_0 = this.d9_1;
941
+ this.b9_1 = 13;
942
+ this.a9_1 = 11;
943
+ continue $sm;
944
+ } else {
945
+ var tmp_2 = this.d9_1;
946
+ if (tmp_2 instanceof CancellationException) {
947
+ var _unused_var__etf5q3_1 = this.d9_1;
948
+ this.a9_1 = 5;
949
+ suspendResult = sendCloseSequence$default(this.x3g_1, CloseReason_init_$Create$(Codes_NORMAL_getInstance(), ''), VOID, this);
950
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
951
+ return suspendResult;
952
+ }
953
+ continue $sm;
954
+ } else {
955
+ var tmp_3 = this.d9_1;
956
+ if (tmp_3 instanceof ChannelIOException) {
957
+ var _unused_var__etf5q3_2 = this.d9_1;
958
+ this.b9_1 = 13;
959
+ this.a9_1 = 11;
960
+ continue $sm;
961
+ } else {
962
+ var tmp_4 = this.d9_1;
963
+ if (tmp_4 instanceof Error) {
964
+ var cause = this.d9_1;
965
+ this.x3g_1.y3d_1.fu(CancellationException_init_$Create$('Failed to send frame', cause));
966
+ this.a9_1 = 6;
967
+ suspendResult = closeExceptionally(this.x3g_1.s3d_1, cause, this);
968
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
969
+ return suspendResult;
970
+ }
971
+ continue $sm;
972
+ } else {
973
+ throw this.d9_1;
974
+ }
975
+ }
976
+ }
977
+ }
978
+ }
979
+
980
+ case 5:
981
+ this.b9_1 = 13;
982
+ this.a9_1 = 11;
983
+ continue $sm;
984
+ case 6:
985
+ this.b9_1 = 13;
986
+ this.a9_1 = 7;
987
+ continue $sm;
988
+ case 7:
989
+ this.b9_1 = 13;
990
+ this.x3g_1.y3d_1.i1c();
991
+ this.a9_1 = 8;
992
+ suspendResult = close(this.x3g_1.s3d_1, VOID, this);
993
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
994
+ return suspendResult;
995
+ }
996
+
997
+ continue $sm;
998
+ case 8:
999
+ return Unit_instance;
1000
+ case 9:
1001
+ this.b9_1 = 13;
1002
+ this.z3g_1 = this.d9_1;
1003
+ this.x3g_1.y3d_1.i1c();
1004
+ this.a9_1 = 10;
1005
+ suspendResult = close(this.x3g_1.s3d_1, VOID, this);
1006
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1007
+ return suspendResult;
1008
+ }
1009
+
1010
+ continue $sm;
1011
+ case 10:
1012
+ throw this.z3g_1;
1013
+ case 11:
1014
+ this.b9_1 = 13;
1015
+ this.x3g_1.y3d_1.i1c();
1016
+ this.a9_1 = 12;
1017
+ suspendResult = close(this.x3g_1.s3d_1, VOID, this);
1018
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1019
+ return suspendResult;
1020
+ }
1021
+
1022
+ continue $sm;
1023
+ case 12:
1024
+ return Unit_instance;
1025
+ case 13:
1026
+ throw this.d9_1;
1027
+ }
1028
+ } catch ($p) {
1029
+ var e = $p;
1030
+ if (this.b9_1 === 13) {
1031
+ throw e;
1032
+ } else {
1033
+ this.a9_1 = this.b9_1;
1034
+ this.d9_1 = e;
1035
+ }
1036
+ }
1037
+ while (true);
1038
+ };
1039
+ protoOf(DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda).c1x = function ($this$launch, completion) {
1040
+ var i = new DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this.x3g_1, completion);
1041
+ i.y3g_1 = $this$launch;
1042
+ return i;
1043
+ };
1044
+ function DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda_0(this$0, resultContinuation) {
1045
+ var i = new DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this$0, resultContinuation);
1046
+ var l = function ($this$launch, $completion) {
1047
+ return i.b1x($this$launch, $completion);
1048
+ };
1049
+ l.$arity = 1;
1050
+ return l;
1051
+ }
1052
+ function DefaultWebSocketSessionImpl$runOrCancelPinger$slambda(this$0, resultContinuation) {
1053
+ this.i3h_1 = this$0;
1054
+ CoroutineImpl.call(this, resultContinuation);
1055
+ }
1056
+ protoOf(DefaultWebSocketSessionImpl$runOrCancelPinger$slambda).k3h = function (it, $completion) {
1057
+ var tmp = this.l3h(it, $completion);
1058
+ tmp.c9_1 = Unit_instance;
1059
+ tmp.d9_1 = null;
1060
+ return tmp.i9();
1061
+ };
1062
+ protoOf(DefaultWebSocketSessionImpl$runOrCancelPinger$slambda).u9 = function (p1, $completion) {
1063
+ return this.k3h(p1 instanceof CloseReason ? p1 : THROW_CCE(), $completion);
1064
+ };
1065
+ protoOf(DefaultWebSocketSessionImpl$runOrCancelPinger$slambda).i9 = function () {
1066
+ var suspendResult = this.c9_1;
1067
+ $sm: do
1068
+ try {
1069
+ var tmp = this.a9_1;
1070
+ switch (tmp) {
1071
+ case 0:
1072
+ this.b9_1 = 2;
1073
+ this.a9_1 = 1;
1074
+ suspendResult = sendCloseSequence(this.i3h_1, this.j3h_1, IOException_init_$Create$('Ping timeout'), this);
1075
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1076
+ return suspendResult;
1077
+ }
1078
+
1079
+ continue $sm;
1080
+ case 1:
1081
+ return Unit_instance;
1082
+ case 2:
1083
+ throw this.d9_1;
1084
+ }
1085
+ } catch ($p) {
1086
+ var e = $p;
1087
+ if (this.b9_1 === 2) {
1088
+ throw e;
1089
+ } else {
1090
+ this.a9_1 = this.b9_1;
1091
+ this.d9_1 = e;
1092
+ }
1093
+ }
1094
+ while (true);
1095
+ };
1096
+ protoOf(DefaultWebSocketSessionImpl$runOrCancelPinger$slambda).l3h = function (it, completion) {
1097
+ var i = new DefaultWebSocketSessionImpl$runOrCancelPinger$slambda(this.i3h_1, completion);
1098
+ i.j3h_1 = it;
1099
+ return i;
1100
+ };
1101
+ function DefaultWebSocketSessionImpl$runOrCancelPinger$slambda_0(this$0, resultContinuation) {
1102
+ var i = new DefaultWebSocketSessionImpl$runOrCancelPinger$slambda(this$0, resultContinuation);
1103
+ var l = function (it, $completion) {
1104
+ return i.k3h(it, $completion);
1105
+ };
1106
+ l.$arity = 1;
1107
+ return l;
1108
+ }
1109
+ function $outgoingProcessorLoopCOROUTINE$(_this__u8e3s4, resultContinuation) {
1110
+ CoroutineImpl.call(this, resultContinuation);
1111
+ this.d3d_1 = _this__u8e3s4;
1112
+ }
1113
+ protoOf($outgoingProcessorLoopCOROUTINE$).i9 = function () {
1114
+ var suspendResult = this.c9_1;
1115
+ $sm: do
1116
+ try {
1117
+ var tmp = this.a9_1;
1118
+ switch (tmp) {
1119
+ case 0:
1120
+ this.b9_1 = 7;
1121
+ this.f3d_1 = this.d3d_1.y3d_1.t();
1122
+ this.a9_1 = 1;
1123
+ continue $sm;
1124
+ case 1:
1125
+ this.a9_1 = 2;
1126
+ suspendResult = this.f3d_1.b1a(this);
1127
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1128
+ return suspendResult;
1129
+ }
1130
+
1131
+ continue $sm;
1132
+ case 2:
1133
+ if (!suspendResult) {
1134
+ this.a9_1 = 6;
1135
+ continue $sm;
1136
+ }
1137
+
1138
+ var frame = this.f3d_1.v();
1139
+ var this_0 = get_LOGGER();
1140
+ if (get_isTraceEnabled(this_0)) {
1141
+ this_0.r2s('Sending ' + frame.toString() + ' from session ' + toString(this.d3d_1));
1142
+ }
1143
+
1144
+ if (frame instanceof Close) {
1145
+ this.a9_1 = 3;
1146
+ suspendResult = sendCloseSequence$default(this.d3d_1, readReason(frame), VOID, this);
1147
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1148
+ return suspendResult;
1149
+ }
1150
+ continue $sm;
1151
+ } else {
1152
+ var tmp_0;
1153
+ if (frame instanceof Text) {
1154
+ tmp_0 = true;
1155
+ } else {
1156
+ tmp_0 = frame instanceof Binary;
1157
+ }
1158
+ if (tmp_0) {
1159
+ this.e3d_1 = processOutgoingExtensions(this.d3d_1, frame);
1160
+ this.a9_1 = 4;
1161
+ continue $sm;
1162
+ } else {
1163
+ this.e3d_1 = frame;
1164
+ this.a9_1 = 4;
1165
+ continue $sm;
1166
+ }
1167
+ }
1168
+
1169
+ case 3:
1170
+ this.a9_1 = 6;
1171
+ var tmp_1 = this;
1172
+ continue $sm;
1173
+ case 4:
1174
+ var processedFrame = this.e3d_1;
1175
+ this.a9_1 = 5;
1176
+ suspendResult = this.d3d_1.s3d_1.q3c().y1b(processedFrame, this);
1177
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1178
+ return suspendResult;
1179
+ }
1180
+
1181
+ continue $sm;
1182
+ case 5:
1183
+ this.a9_1 = 1;
1184
+ continue $sm;
1185
+ case 6:
1186
+ return Unit_instance;
1187
+ case 7:
1188
+ throw this.d9_1;
1189
+ }
1190
+ } catch ($p) {
1191
+ var e = $p;
1192
+ if (this.b9_1 === 7) {
1193
+ throw e;
1194
+ } else {
1195
+ this.a9_1 = this.b9_1;
1196
+ this.d9_1 = e;
1197
+ }
1198
+ }
1199
+ while (true);
1200
+ };
1201
+ function $sendCloseSequenceCOROUTINE$(_this__u8e3s4, reason, exception, resultContinuation) {
1202
+ CoroutineImpl.call(this, resultContinuation);
1203
+ this.o3d_1 = _this__u8e3s4;
1204
+ this.p3d_1 = reason;
1205
+ this.q3d_1 = exception;
1206
+ }
1207
+ protoOf($sendCloseSequenceCOROUTINE$).i9 = function () {
1208
+ var suspendResult = this.c9_1;
1209
+ $sm: do
1210
+ try {
1211
+ var tmp = this.a9_1;
1212
+ switch (tmp) {
1213
+ case 0:
1214
+ this.b9_1 = 6;
1215
+ if (!tryClose(this.o3d_1))
1216
+ return Unit_instance;
1217
+ var this_0 = get_LOGGER();
1218
+ if (get_isTraceEnabled(this_0)) {
1219
+ this_0.r2s('Sending Close Sequence for session ' + toString(this.o3d_1) + ' with reason ' + toString_0(this.p3d_1) + ' and exception ' + toString_0(this.q3d_1));
1220
+ }
1221
+
1222
+ this.o3d_1.v3d_1.g11();
1223
+ var tmp_0 = this;
1224
+ var tmp0_elvis_lhs = this.p3d_1;
1225
+ tmp_0.r3d_1 = tmp0_elvis_lhs == null ? CloseReason_init_$Create$(Codes_NORMAL_getInstance(), '') : tmp0_elvis_lhs;
1226
+ this.a9_1 = 1;
1227
+ continue $sm;
1228
+ case 1:
1229
+ this.b9_1 = 5;
1230
+ runOrCancelPinger(this.o3d_1);
1231
+ if (!(this.r3d_1.j3c_1 === Codes_CLOSED_ABNORMALLY_getInstance().f3c_1)) {
1232
+ this.a9_1 = 2;
1233
+ suspendResult = this.o3d_1.s3d_1.q3c().y1b(Close_init_$Create$(this.r3d_1), this);
1234
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1235
+ return suspendResult;
1236
+ }
1237
+ continue $sm;
1238
+ } else {
1239
+ this.a9_1 = 3;
1240
+ continue $sm;
1241
+ }
1242
+
1243
+ case 2:
1244
+ this.a9_1 = 3;
1245
+ continue $sm;
1246
+ case 3:
1247
+ this.b9_1 = 6;
1248
+ this.a9_1 = 4;
1249
+ continue $sm;
1250
+ case 4:
1251
+ this.b9_1 = 6;
1252
+ this.o3d_1.u3d_1.e11(this.r3d_1);
1253
+ if (!(this.q3d_1 == null)) {
1254
+ this.o3d_1.y3d_1.e1c(this.q3d_1);
1255
+ this.o3d_1.x3d_1.e1c(this.q3d_1);
1256
+ }
1257
+
1258
+ return Unit_instance;
1259
+ case 5:
1260
+ this.b9_1 = 6;
1261
+ var t = this.d9_1;
1262
+ this.o3d_1.u3d_1.e11(this.r3d_1);
1263
+ if (!(this.q3d_1 == null)) {
1264
+ this.o3d_1.y3d_1.e1c(this.q3d_1);
1265
+ this.o3d_1.x3d_1.e1c(this.q3d_1);
1266
+ }
1267
+
1268
+ throw t;
1269
+ case 6:
1270
+ throw this.d9_1;
1271
+ }
1272
+ } catch ($p) {
1273
+ var e = $p;
1274
+ if (this.b9_1 === 6) {
1275
+ throw e;
1276
+ } else {
1277
+ this.a9_1 = this.b9_1;
1278
+ this.d9_1 = e;
1279
+ }
1280
+ }
1281
+ while (true);
1282
+ };
1283
+ function $checkMaxFrameSizeCOROUTINE$(_this__u8e3s4, packet, frame, resultContinuation) {
1284
+ CoroutineImpl.call(this, resultContinuation);
1285
+ this.o3e_1 = _this__u8e3s4;
1286
+ this.p3e_1 = packet;
1287
+ this.q3e_1 = frame;
1288
+ }
1289
+ protoOf($checkMaxFrameSizeCOROUTINE$).i9 = function () {
1290
+ var suspendResult = this.c9_1;
1291
+ $sm: do
1292
+ try {
1293
+ var tmp = this.a9_1;
1294
+ switch (tmp) {
1295
+ case 0:
1296
+ this.b9_1 = 3;
1297
+ var tmp_0 = this;
1298
+ var tmp_1 = this.q3e_1.i3g_1.length;
1299
+ var tmp0_safe_receiver = this.p3e_1;
1300
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : get_size(tmp0_safe_receiver);
1301
+ tmp_0.r3e_1 = tmp_1 + (tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs) | 0;
1302
+ if (fromInt(this.r3e_1) > this.o3e_1.o3c()) {
1303
+ var tmp2_safe_receiver = this.p3e_1;
1304
+ if (tmp2_safe_receiver == null)
1305
+ null;
1306
+ else {
1307
+ tmp2_safe_receiver.l4();
1308
+ }
1309
+ this.a9_1 = 2;
1310
+ suspendResult = close(this.o3e_1, CloseReason_init_$Create$(Codes_TOO_BIG_getInstance(), 'Frame is too big: ' + this.r3e_1 + '. Max size is ' + this.o3e_1.o3c().toString()), this);
1311
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1312
+ return suspendResult;
1313
+ }
1314
+ continue $sm;
1315
+ } else {
1316
+ this.a9_1 = 1;
1317
+ continue $sm;
1318
+ }
1319
+
1320
+ case 1:
1321
+ return Unit_instance;
1322
+ case 2:
1323
+ throw new FrameTooBigException(fromInt(this.r3e_1));
1324
+ case 3:
1325
+ throw this.d9_1;
1326
+ }
1327
+ } catch ($p) {
1328
+ var e = $p;
1329
+ if (this.b9_1 === 3) {
1330
+ throw e;
1331
+ } else {
1332
+ this.a9_1 = this.b9_1;
1333
+ this.d9_1 = e;
1334
+ }
1335
+ }
1336
+ while (true);
1337
+ };
1338
+ function DefaultWebSocketSessionImpl(raw, pingIntervalMillis, timeoutMillis, incomingFramesConfig, outgoingFramesConfig) {
1339
+ Companion_getInstance_0();
1340
+ this.s3d_1 = raw;
1341
+ this.t3d_1 = atomic$ref$1(null);
1342
+ this.u3d_1 = CompletableDeferred();
1343
+ this.v3d_1 = Job();
1344
+ this.w3d_1 = this.s3d_1.ws().ah(Key_instance).ch(this.v3d_1).ch(new CoroutineName('ws-default'));
1345
+ this.x3d_1 = from(Factory_getInstance(), incomingFramesConfig);
1346
+ this.y3d_1 = from(Factory_getInstance(), outgoingFramesConfig);
1347
+ this.z3d_1 = atomic$boolean$1(false);
1348
+ var tmp = this;
1349
+ // Inline function 'kotlin.collections.mutableListOf' call
1350
+ tmp.a3e_1 = ArrayList_init_$Create$();
1351
+ this.b3e_1 = atomic$boolean$1(false);
1352
+ this.c3e_1 = pingIntervalMillis;
1353
+ this.d3e_1 = timeoutMillis;
1354
+ this.e3e_1 = this.u3d_1;
1355
+ }
1356
+ protoOf(DefaultWebSocketSessionImpl).ws = function () {
1357
+ return this.w3d_1;
1358
+ };
1359
+ protoOf(DefaultWebSocketSessionImpl).p3c = function () {
1360
+ return this.x3d_1;
1361
+ };
1362
+ protoOf(DefaultWebSocketSessionImpl).q3c = function () {
1363
+ return this.y3d_1;
1364
+ };
1365
+ protoOf(DefaultWebSocketSessionImpl).s3e = function () {
1366
+ return this.a3e_1;
1367
+ };
1368
+ protoOf(DefaultWebSocketSessionImpl).n3c = function (value) {
1369
+ this.s3d_1.n3c(value);
1370
+ };
1371
+ protoOf(DefaultWebSocketSessionImpl).o3c = function () {
1372
+ return this.s3d_1.o3c();
1373
+ };
1374
+ protoOf(DefaultWebSocketSessionImpl).m3c = function (negotiatedExtensions) {
1375
+ if (!this.b3e_1.atomicfu$compareAndSet(false, true)) {
1376
+ // Inline function 'kotlin.error' call
1377
+ var message = 'WebSocket session ' + toString(this) + ' is already started.';
1378
+ throw IllegalStateException_init_$Create$(toString(message));
1379
+ }
1380
+ // Inline function 'io.ktor.util.logging.trace' call
1381
+ var this_0 = get_LOGGER();
1382
+ if (get_isTraceEnabled(this_0)) {
1383
+ var tmp$ret$0 = 'Starting default WebSocketSession(' + toString(this) + ') ' + ('with negotiated extensions: ' + joinToString(negotiatedExtensions));
1384
+ this_0.r2s(tmp$ret$0);
1385
+ }
1386
+ this.a3e_1.n1(negotiatedExtensions);
1387
+ runOrCancelPinger(this);
1388
+ var incomingJob = runIncomingProcessor(this, ponger(this, this.q3c()));
1389
+ var outgoingJob = runOutgoingProcessor(this);
1390
+ launch(this, VOID, VOID, DefaultWebSocketSessionImpl$start$slambda_0(incomingJob, outgoingJob, this, null));
1391
+ };
1392
+ protoOf(DefaultWebSocketSessionImpl).v1n = function ($completion) {
1393
+ return this.s3d_1.v1n($completion);
1394
+ };
1395
+ var properties_initialized_DefaultWebSocketSession_kt_6cjlhc;
1396
+ function _init_properties_DefaultWebSocketSession_kt__469s0y() {
1397
+ if (!properties_initialized_DefaultWebSocketSession_kt_6cjlhc) {
1398
+ properties_initialized_DefaultWebSocketSession_kt_6cjlhc = true;
1399
+ LOGGER = KtorSimpleLogger('io.ktor.websocket.WebSocket');
1400
+ IncomingProcessorCoroutineName = new CoroutineName('ws-incoming-processor');
1401
+ OutgoingProcessorCoroutineName = new CoroutineName('ws-outgoing-processor');
1402
+ NORMAL_CLOSE = CloseReason_init_$Create$(Codes_NORMAL_getInstance(), 'OK');
1403
+ var tmp0_safe_receiver = get_OUTGOING_CHANNEL_CAPACITY();
1404
+ var tmp;
1405
+ if (tmp0_safe_receiver == null) {
1406
+ tmp = null;
1407
+ } else {
1408
+ // Inline function 'kotlin.let' call
1409
+ tmp = new ChannelConfig(tmp0_safe_receiver, ChannelOverflow_SUSPEND_getInstance());
1410
+ }
1411
+ OUTGOING_CHANNEL_CONFIG = tmp;
1412
+ }
1413
+ }
1414
+ function readReason(_this__u8e3s4) {
1415
+ if (_this__u8e3s4.i3g_1.length < 2) {
1416
+ return null;
1417
+ }
1418
+ // Inline function 'io.ktor.utils.io.core.buildPacket' call
1419
+ var builder = new Buffer();
1420
+ writeFully(builder, _this__u8e3s4.i3g_1);
1421
+ var packet = builder;
1422
+ var code = packet.yp();
1423
+ var message = readText(packet);
1424
+ return new CloseReason(code, message);
1425
+ }
187
1426
  function NonDisposableHandle() {
188
1427
  }
189
- protoOf(NonDisposableHandle).ku = function () {
1428
+ protoOf(NonDisposableHandle).uv = function () {
190
1429
  return Unit_instance;
191
1430
  };
192
1431
  protoOf(NonDisposableHandle).toString = function () {
@@ -206,13 +1445,28 @@
206
1445
  function NonDisposableHandle_getInstance() {
207
1446
  return NonDisposableHandle_instance;
208
1447
  }
1448
+ function FrameTooBigException(frameSize) {
1449
+ Exception_init_$Init$(this);
1450
+ captureStack(this, FrameTooBigException);
1451
+ this.m3h_1 = frameSize;
1452
+ delete this.message;
1453
+ }
1454
+ protoOf(FrameTooBigException).e = function () {
1455
+ return 'Frame is too big: ' + this.m3h_1.toString();
1456
+ };
1457
+ protoOf(FrameTooBigException).p11 = function () {
1458
+ // Inline function 'kotlin.also' call
1459
+ var this_0 = new FrameTooBigException(this.m3h_1);
1460
+ initCauseBridge(this_0, this);
1461
+ return this_0;
1462
+ };
209
1463
  var FrameType_TEXT_instance;
210
1464
  var FrameType_BINARY_instance;
211
1465
  var FrameType_CLOSE_instance;
212
1466
  var FrameType_PING_instance;
213
1467
  var FrameType_PONG_instance;
214
- function Companion_0() {
215
- Companion_instance_0 = this;
1468
+ function Companion_1() {
1469
+ Companion_instance_1 = this;
216
1470
  var tmp = this;
217
1471
  var tmp0 = get_entries_0();
218
1472
  var tmp$ret$0;
@@ -228,10 +1482,10 @@
228
1482
  tmp$ret$0 = maxElem;
229
1483
  break $l$block_0;
230
1484
  }
231
- var maxValue = maxElem.j39_1;
1485
+ var maxValue = maxElem.q3h_1;
232
1486
  do {
233
1487
  var e = iterator.v();
234
- var v = e.j39_1;
1488
+ var v = e.q3h_1;
235
1489
  if (compareTo(maxValue, v) < 0) {
236
1490
  maxElem = e;
237
1491
  maxValue = v;
@@ -240,10 +1494,10 @@
240
1494
  while (iterator.u());
241
1495
  tmp$ret$0 = maxElem;
242
1496
  }
243
- tmp.k39_1 = ensureNotNull(tmp$ret$0).j39_1;
1497
+ tmp.r3h_1 = ensureNotNull(tmp$ret$0).q3h_1;
244
1498
  var tmp_0 = this;
245
1499
  var tmp_1 = 0;
246
- var tmp_2 = this.k39_1 + 1 | 0;
1500
+ var tmp_2 = this.r3h_1 + 1 | 0;
247
1501
  // Inline function 'kotlin.arrayOfNulls' call
248
1502
  var tmp_3 = Array(tmp_2);
249
1503
  while (tmp_1 < tmp_2) {
@@ -257,7 +1511,7 @@
257
1511
  var _iterator__ex2g4s = tmp0_0.t();
258
1512
  while (_iterator__ex2g4s.u()) {
259
1513
  var element = _iterator__ex2g4s.v();
260
- if (element.j39_1 === tmp_4) {
1514
+ if (element.q3h_1 === tmp_4) {
261
1515
  if (found) {
262
1516
  tmp$ret$5 = null;
263
1517
  break $l$block_2;
@@ -275,14 +1529,14 @@
275
1529
  tmp_3[tmp_4] = tmp$ret$5;
276
1530
  tmp_1 = tmp_1 + 1 | 0;
277
1531
  }
278
- tmp_0.l39_1 = tmp_3;
1532
+ tmp_0.s3h_1 = tmp_3;
279
1533
  }
280
- var Companion_instance_0;
281
- function Companion_getInstance_0() {
1534
+ var Companion_instance_1;
1535
+ function Companion_getInstance_1() {
282
1536
  FrameType_initEntries();
283
- if (Companion_instance_0 == null)
284
- new Companion_0();
285
- return Companion_instance_0;
1537
+ if (Companion_instance_1 == null)
1538
+ new Companion_1();
1539
+ return Companion_instance_1;
286
1540
  }
287
1541
  function values_0() {
288
1542
  return [FrameType_TEXT_getInstance(), FrameType_BINARY_getInstance(), FrameType_CLOSE_getInstance(), FrameType_PING_getInstance(), FrameType_PONG_getInstance()];
@@ -302,13 +1556,13 @@
302
1556
  FrameType_CLOSE_instance = new FrameType('CLOSE', 2, true, 8);
303
1557
  FrameType_PING_instance = new FrameType('PING', 3, true, 9);
304
1558
  FrameType_PONG_instance = new FrameType('PONG', 4, true, 10);
305
- Companion_getInstance_0();
1559
+ Companion_getInstance_1();
306
1560
  }
307
1561
  var $ENTRIES_0;
308
1562
  function FrameType(name, ordinal, controlFrame, opcode) {
309
1563
  Enum.call(this, name, ordinal);
310
- this.i39_1 = controlFrame;
311
- this.j39_1 = opcode;
1564
+ this.p3h_1 = controlFrame;
1565
+ this.q3h_1 = opcode;
312
1566
  }
313
1567
  function FrameType_TEXT_getInstance() {
314
1568
  FrameType_initEntries();
@@ -330,6 +1584,793 @@
330
1584
  FrameType_initEntries();
331
1585
  return FrameType_PONG_instance;
332
1586
  }
1587
+ function get_PongerCoroutineName() {
1588
+ _init_properties_PingPong_kt__9aqxey();
1589
+ return PongerCoroutineName;
1590
+ }
1591
+ var PongerCoroutineName;
1592
+ function get_PingerCoroutineName() {
1593
+ _init_properties_PingPong_kt__9aqxey();
1594
+ return PingerCoroutineName;
1595
+ }
1596
+ var PingerCoroutineName;
1597
+ function ponger(_this__u8e3s4, outgoing) {
1598
+ _init_properties_PingPong_kt__9aqxey();
1599
+ var channel = Channel(5);
1600
+ var tmp = get_PongerCoroutineName();
1601
+ launch(_this__u8e3s4, tmp, VOID, ponger$slambda_0(channel, outgoing, null));
1602
+ return channel;
1603
+ }
1604
+ function pinger(_this__u8e3s4, outgoing, periodMillis, timeoutMillis, onTimeout) {
1605
+ _init_properties_PingPong_kt__9aqxey();
1606
+ var actorJob = Job();
1607
+ var channel = Channel(2147483647);
1608
+ var tmp = actorJob.ch(get_PingerCoroutineName());
1609
+ launch(_this__u8e3s4, tmp, VOID, pinger$slambda_0(periodMillis, timeoutMillis, onTimeout, channel, outgoing, null));
1610
+ var tmp_0 = ensureNotNull(_this__u8e3s4.ws().n9(Key_instance));
1611
+ tmp_0.yt(pinger$lambda(actorJob));
1612
+ return channel;
1613
+ }
1614
+ function ponger$slambda($channel, $outgoing, resultContinuation) {
1615
+ this.b3i_1 = $channel;
1616
+ this.c3i_1 = $outgoing;
1617
+ CoroutineImpl.call(this, resultContinuation);
1618
+ }
1619
+ protoOf(ponger$slambda).b1x = function ($this$launch, $completion) {
1620
+ var tmp = this.c1x($this$launch, $completion);
1621
+ tmp.c9_1 = Unit_instance;
1622
+ tmp.d9_1 = null;
1623
+ return tmp.i9();
1624
+ };
1625
+ protoOf(ponger$slambda).u9 = function (p1, $completion) {
1626
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1627
+ };
1628
+ protoOf(ponger$slambda).i9 = function () {
1629
+ var suspendResult = this.c9_1;
1630
+ $sm: do
1631
+ try {
1632
+ var tmp = this.a9_1;
1633
+ switch (tmp) {
1634
+ case 0:
1635
+ this.b9_1 = 14;
1636
+ this.b9_1 = 13;
1637
+ this.h3i_1 = this.b3i_1;
1638
+ this.a9_1 = 1;
1639
+ continue $sm;
1640
+ case 1:
1641
+ this.f3i_1 = this.h3i_1;
1642
+ this.e3i_1 = null;
1643
+ this.a9_1 = 2;
1644
+ continue $sm;
1645
+ case 2:
1646
+ this.a9_1 = 3;
1647
+ continue $sm;
1648
+ case 3:
1649
+ this.b9_1 = 10;
1650
+ this.b9_1 = 9;
1651
+ this.g3i_1 = this.f3i_1.t();
1652
+ this.a9_1 = 4;
1653
+ continue $sm;
1654
+ case 4:
1655
+ this.a9_1 = 5;
1656
+ suspendResult = this.g3i_1.b1a(this);
1657
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1658
+ return suspendResult;
1659
+ }
1660
+
1661
+ continue $sm;
1662
+ case 5:
1663
+ if (!suspendResult) {
1664
+ this.a9_1 = 7;
1665
+ continue $sm;
1666
+ }
1667
+
1668
+ var e = this.g3i_1.v();
1669
+ get_LOGGER().r2s('Received ping message, sending pong message');
1670
+ this.a9_1 = 6;
1671
+ suspendResult = this.c3i_1.y1b(new Pong(e.i3g_1), this);
1672
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1673
+ return suspendResult;
1674
+ }
1675
+
1676
+ continue $sm;
1677
+ case 6:
1678
+ this.a9_1 = 4;
1679
+ continue $sm;
1680
+ case 7:
1681
+ this.a9_1 = 8;
1682
+ var tmp_0 = this;
1683
+ continue $sm;
1684
+ case 8:
1685
+ this.b9_1 = 13;
1686
+ cancelConsumed(this.f3i_1, this.e3i_1);
1687
+ this.a9_1 = 12;
1688
+ continue $sm;
1689
+ case 9:
1690
+ this.b9_1 = 10;
1691
+ var tmp_1 = this.d9_1;
1692
+ if (tmp_1 instanceof Error) {
1693
+ var e_0 = this.d9_1;
1694
+ var tmp_2 = this;
1695
+ this.e3i_1 = e_0;
1696
+ throw e_0;
1697
+ } else {
1698
+ throw this.d9_1;
1699
+ }
1700
+
1701
+ case 10:
1702
+ this.b9_1 = 13;
1703
+ var t = this.d9_1;
1704
+ cancelConsumed(this.f3i_1, this.e3i_1);
1705
+ throw t;
1706
+ case 11:
1707
+ this.b9_1 = 13;
1708
+ cancelConsumed(this.f3i_1, this.e3i_1);
1709
+ if (false) {
1710
+ this.a9_1 = 1;
1711
+ continue $sm;
1712
+ }
1713
+
1714
+ this.a9_1 = 12;
1715
+ continue $sm;
1716
+ case 12:
1717
+ this.b9_1 = 14;
1718
+ this.a9_1 = 15;
1719
+ continue $sm;
1720
+ case 13:
1721
+ this.b9_1 = 14;
1722
+ var tmp_3 = this.d9_1;
1723
+ if (tmp_3 instanceof ClosedSendChannelException) {
1724
+ var _unused_var__etf5q3 = this.d9_1;
1725
+ this.a9_1 = 15;
1726
+ continue $sm;
1727
+ } else {
1728
+ throw this.d9_1;
1729
+ }
1730
+
1731
+ case 14:
1732
+ throw this.d9_1;
1733
+ case 15:
1734
+ this.b9_1 = 14;
1735
+ return Unit_instance;
1736
+ }
1737
+ } catch ($p) {
1738
+ var e_1 = $p;
1739
+ if (this.b9_1 === 14) {
1740
+ throw e_1;
1741
+ } else {
1742
+ this.a9_1 = this.b9_1;
1743
+ this.d9_1 = e_1;
1744
+ }
1745
+ }
1746
+ while (true);
1747
+ };
1748
+ protoOf(ponger$slambda).c1x = function ($this$launch, completion) {
1749
+ var i = new ponger$slambda(this.b3i_1, this.c3i_1, completion);
1750
+ i.d3i_1 = $this$launch;
1751
+ return i;
1752
+ };
1753
+ function ponger$slambda_0($channel, $outgoing, resultContinuation) {
1754
+ var i = new ponger$slambda($channel, $outgoing, resultContinuation);
1755
+ var l = function ($this$launch, $completion) {
1756
+ return i.b1x($this$launch, $completion);
1757
+ };
1758
+ l.$arity = 1;
1759
+ return l;
1760
+ }
1761
+ function pinger$slambda$slambda($channel, resultContinuation) {
1762
+ this.q3i_1 = $channel;
1763
+ CoroutineImpl.call(this, resultContinuation);
1764
+ }
1765
+ protoOf(pinger$slambda$slambda).b1x = function ($this$withTimeoutOrNull, $completion) {
1766
+ var tmp = this.c1x($this$withTimeoutOrNull, $completion);
1767
+ tmp.c9_1 = Unit_instance;
1768
+ tmp.d9_1 = null;
1769
+ return tmp.i9();
1770
+ };
1771
+ protoOf(pinger$slambda$slambda).u9 = function (p1, $completion) {
1772
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1773
+ };
1774
+ protoOf(pinger$slambda$slambda).i9 = function () {
1775
+ var suspendResult = this.c9_1;
1776
+ $sm: do
1777
+ try {
1778
+ var tmp = this.a9_1;
1779
+ switch (tmp) {
1780
+ case 0:
1781
+ this.b9_1 = 3;
1782
+ this.a9_1 = 1;
1783
+ continue $sm;
1784
+ case 1:
1785
+ if (!true) {
1786
+ this.a9_1 = 4;
1787
+ continue $sm;
1788
+ }
1789
+
1790
+ this.a9_1 = 2;
1791
+ suspendResult = this.q3i_1.c1c(this);
1792
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1793
+ return suspendResult;
1794
+ }
1795
+
1796
+ continue $sm;
1797
+ case 2:
1798
+ this.a9_1 = 1;
1799
+ continue $sm;
1800
+ case 3:
1801
+ throw this.d9_1;
1802
+ case 4:
1803
+ return Unit_instance;
1804
+ }
1805
+ } catch ($p) {
1806
+ var e = $p;
1807
+ if (this.b9_1 === 3) {
1808
+ throw e;
1809
+ } else {
1810
+ this.a9_1 = this.b9_1;
1811
+ this.d9_1 = e;
1812
+ }
1813
+ }
1814
+ while (true);
1815
+ };
1816
+ protoOf(pinger$slambda$slambda).c1x = function ($this$withTimeoutOrNull, completion) {
1817
+ var i = new pinger$slambda$slambda(this.q3i_1, completion);
1818
+ i.r3i_1 = $this$withTimeoutOrNull;
1819
+ return i;
1820
+ };
1821
+ function pinger$slambda$slambda_0($channel, resultContinuation) {
1822
+ var i = new pinger$slambda$slambda($channel, resultContinuation);
1823
+ var l = function ($this$withTimeoutOrNull, $completion) {
1824
+ return i.b1x($this$withTimeoutOrNull, $completion);
1825
+ };
1826
+ l.$arity = 1;
1827
+ return l;
1828
+ }
1829
+ function pinger$slambda$slambda_1($outgoing, $pingMessage, $channel, resultContinuation) {
1830
+ this.a3j_1 = $outgoing;
1831
+ this.b3j_1 = $pingMessage;
1832
+ this.c3j_1 = $channel;
1833
+ CoroutineImpl.call(this, resultContinuation);
1834
+ }
1835
+ protoOf(pinger$slambda$slambda_1).b1x = function ($this$withTimeoutOrNull, $completion) {
1836
+ var tmp = this.c1x($this$withTimeoutOrNull, $completion);
1837
+ tmp.c9_1 = Unit_instance;
1838
+ tmp.d9_1 = null;
1839
+ return tmp.i9();
1840
+ };
1841
+ protoOf(pinger$slambda$slambda_1).u9 = function (p1, $completion) {
1842
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1843
+ };
1844
+ protoOf(pinger$slambda$slambda_1).i9 = function () {
1845
+ var suspendResult = this.c9_1;
1846
+ $sm: do
1847
+ try {
1848
+ var tmp = this.a9_1;
1849
+ switch (tmp) {
1850
+ case 0:
1851
+ this.b9_1 = 6;
1852
+ get_LOGGER().r2s('WebSocket Pinger: sending ping frame');
1853
+ this.a9_1 = 1;
1854
+ suspendResult = this.a3j_1.y1b(new Ping(toByteArray(this.b3j_1, Charsets_getInstance().c1y_1)), this);
1855
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1856
+ return suspendResult;
1857
+ }
1858
+
1859
+ continue $sm;
1860
+ case 1:
1861
+ this.a9_1 = 2;
1862
+ continue $sm;
1863
+ case 2:
1864
+ if (!true) {
1865
+ this.a9_1 = 5;
1866
+ continue $sm;
1867
+ }
1868
+
1869
+ this.a9_1 = 3;
1870
+ suspendResult = this.c3j_1.c1c(this);
1871
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1872
+ return suspendResult;
1873
+ }
1874
+
1875
+ continue $sm;
1876
+ case 3:
1877
+ this.e3j_1 = suspendResult;
1878
+ if (decodeToString(this.e3j_1.i3g_1, 0, 0 + this.e3j_1.i3g_1.length | 0) === this.b3j_1) {
1879
+ get_LOGGER().r2s('WebSocket Pinger: received valid pong frame ' + this.e3j_1.toString());
1880
+ this.a9_1 = 5;
1881
+ continue $sm;
1882
+ } else {
1883
+ this.a9_1 = 4;
1884
+ continue $sm;
1885
+ }
1886
+
1887
+ case 4:
1888
+ get_LOGGER().r2s('WebSocket Pinger: received invalid pong frame ' + this.e3j_1.toString() + ', continue waiting');
1889
+ this.a9_1 = 2;
1890
+ continue $sm;
1891
+ case 5:
1892
+ return Unit_instance;
1893
+ case 6:
1894
+ throw this.d9_1;
1895
+ }
1896
+ } catch ($p) {
1897
+ var e = $p;
1898
+ if (this.b9_1 === 6) {
1899
+ throw e;
1900
+ } else {
1901
+ this.a9_1 = this.b9_1;
1902
+ this.d9_1 = e;
1903
+ }
1904
+ }
1905
+ while (true);
1906
+ };
1907
+ protoOf(pinger$slambda$slambda_1).c1x = function ($this$withTimeoutOrNull, completion) {
1908
+ var i = new pinger$slambda$slambda_1(this.a3j_1, this.b3j_1, this.c3j_1, completion);
1909
+ i.d3j_1 = $this$withTimeoutOrNull;
1910
+ return i;
1911
+ };
1912
+ function pinger$slambda$slambda_2($outgoing, $pingMessage, $channel, resultContinuation) {
1913
+ var i = new pinger$slambda$slambda_1($outgoing, $pingMessage, $channel, resultContinuation);
1914
+ var l = function ($this$withTimeoutOrNull, $completion) {
1915
+ return i.b1x($this$withTimeoutOrNull, $completion);
1916
+ };
1917
+ l.$arity = 1;
1918
+ return l;
1919
+ }
1920
+ function pinger$slambda($periodMillis, $timeoutMillis, $onTimeout, $channel, $outgoing, resultContinuation) {
1921
+ this.n3j_1 = $periodMillis;
1922
+ this.o3j_1 = $timeoutMillis;
1923
+ this.p3j_1 = $onTimeout;
1924
+ this.q3j_1 = $channel;
1925
+ this.r3j_1 = $outgoing;
1926
+ CoroutineImpl.call(this, resultContinuation);
1927
+ }
1928
+ protoOf(pinger$slambda).b1x = function ($this$launch, $completion) {
1929
+ var tmp = this.c1x($this$launch, $completion);
1930
+ tmp.c9_1 = Unit_instance;
1931
+ tmp.d9_1 = null;
1932
+ return tmp.i9();
1933
+ };
1934
+ protoOf(pinger$slambda).u9 = function (p1, $completion) {
1935
+ return this.b1x((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1936
+ };
1937
+ protoOf(pinger$slambda).i9 = function () {
1938
+ var suspendResult = this.c9_1;
1939
+ $sm: do
1940
+ try {
1941
+ var tmp = this.a9_1;
1942
+ switch (tmp) {
1943
+ case 0:
1944
+ this.b9_1 = 9;
1945
+ get_LOGGER().r2s('Starting WebSocket pinger coroutine with period ' + this.n3j_1.toString() + ' ms and timeout ' + this.o3j_1.toString() + ' ms');
1946
+ this.u3j_1 = Random(getTimeMillis());
1947
+ this.t3j_1 = new Int8Array(32);
1948
+ this.b9_1 = 7;
1949
+ this.a9_1 = 1;
1950
+ continue $sm;
1951
+ case 1:
1952
+ if (!true) {
1953
+ this.a9_1 = 6;
1954
+ continue $sm;
1955
+ }
1956
+
1957
+ this.a9_1 = 2;
1958
+ suspendResult = withTimeoutOrNull(this.n3j_1, pinger$slambda$slambda_0(this.q3j_1, null), this);
1959
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1960
+ return suspendResult;
1961
+ }
1962
+
1963
+ continue $sm;
1964
+ case 2:
1965
+ this.u3j_1.zi(this.t3j_1);
1966
+ var pingMessage = '[ping ' + hex(this.t3j_1) + ' ping]';
1967
+ this.a9_1 = 3;
1968
+ suspendResult = withTimeoutOrNull(this.o3j_1, pinger$slambda$slambda_2(this.r3j_1, pingMessage, this.q3j_1, null), this);
1969
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1970
+ return suspendResult;
1971
+ }
1972
+
1973
+ continue $sm;
1974
+ case 3:
1975
+ var rc = suspendResult;
1976
+ if (rc == null) {
1977
+ get_LOGGER().r2s('WebSocket pinger has timed out');
1978
+ this.a9_1 = 5;
1979
+ suspendResult = this.p3j_1(CloseReason_init_$Create$(Codes_INTERNAL_ERROR_getInstance(), 'Ping timeout'), this);
1980
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1981
+ return suspendResult;
1982
+ }
1983
+ continue $sm;
1984
+ } else {
1985
+ this.a9_1 = 4;
1986
+ continue $sm;
1987
+ }
1988
+
1989
+ case 4:
1990
+ this.a9_1 = 1;
1991
+ continue $sm;
1992
+ case 5:
1993
+ this.a9_1 = 6;
1994
+ continue $sm;
1995
+ case 6:
1996
+ this.b9_1 = 9;
1997
+ this.a9_1 = 8;
1998
+ continue $sm;
1999
+ case 7:
2000
+ this.b9_1 = 9;
2001
+ var tmp_0 = this.d9_1;
2002
+ if (tmp_0 instanceof CancellationException) {
2003
+ var ignore = this.d9_1;
2004
+ this.a9_1 = 8;
2005
+ continue $sm;
2006
+ } else {
2007
+ var tmp_1 = this.d9_1;
2008
+ if (tmp_1 instanceof ClosedReceiveChannelException) {
2009
+ var ignore_0 = this.d9_1;
2010
+ this.a9_1 = 8;
2011
+ continue $sm;
2012
+ } else {
2013
+ var tmp_2 = this.d9_1;
2014
+ if (tmp_2 instanceof ClosedSendChannelException) {
2015
+ var ignore_1 = this.d9_1;
2016
+ this.a9_1 = 8;
2017
+ continue $sm;
2018
+ } else {
2019
+ var tmp_3 = this.d9_1;
2020
+ if (tmp_3 instanceof ClosedByteChannelException) {
2021
+ var ignore_2 = this.d9_1;
2022
+ this.a9_1 = 8;
2023
+ continue $sm;
2024
+ } else {
2025
+ throw this.d9_1;
2026
+ }
2027
+ }
2028
+ }
2029
+ }
2030
+
2031
+ case 8:
2032
+ this.b9_1 = 9;
2033
+ return Unit_instance;
2034
+ case 9:
2035
+ throw this.d9_1;
2036
+ }
2037
+ } catch ($p) {
2038
+ var e = $p;
2039
+ if (this.b9_1 === 9) {
2040
+ throw e;
2041
+ } else {
2042
+ this.a9_1 = this.b9_1;
2043
+ this.d9_1 = e;
2044
+ }
2045
+ }
2046
+ while (true);
2047
+ };
2048
+ protoOf(pinger$slambda).c1x = function ($this$launch, completion) {
2049
+ var i = new pinger$slambda(this.n3j_1, this.o3j_1, this.p3j_1, this.q3j_1, this.r3j_1, completion);
2050
+ i.s3j_1 = $this$launch;
2051
+ return i;
2052
+ };
2053
+ function pinger$slambda_0($periodMillis, $timeoutMillis, $onTimeout, $channel, $outgoing, resultContinuation) {
2054
+ var i = new pinger$slambda($periodMillis, $timeoutMillis, $onTimeout, $channel, $outgoing, resultContinuation);
2055
+ var l = function ($this$launch, $completion) {
2056
+ return i.b1x($this$launch, $completion);
2057
+ };
2058
+ l.$arity = 1;
2059
+ return l;
2060
+ }
2061
+ function pinger$lambda($actorJob) {
2062
+ return function (it) {
2063
+ $actorJob.gu();
2064
+ return Unit_instance;
2065
+ };
2066
+ }
2067
+ var properties_initialized_PingPong_kt_fbfhmc;
2068
+ function _init_properties_PingPong_kt__9aqxey() {
2069
+ if (!properties_initialized_PingPong_kt_fbfhmc) {
2070
+ properties_initialized_PingPong_kt_fbfhmc = true;
2071
+ PongerCoroutineName = new CoroutineName('ws-ponger');
2072
+ PingerCoroutineName = new CoroutineName('ws-pinger');
2073
+ }
2074
+ }
2075
+ function Companion_2() {
2076
+ Companion_instance_2 = this;
2077
+ var tmp = this;
2078
+ // Inline function 'kotlin.apply' call
2079
+ var this_0 = new WebSocketChannelsConfig();
2080
+ this_0.t3c_1 = this_0.v3j();
2081
+ this_0.u3c_1 = this_0.v3j();
2082
+ tmp.s3c_1 = this_0;
2083
+ }
2084
+ var Companion_instance_2;
2085
+ function Companion_getInstance_2() {
2086
+ if (Companion_instance_2 == null)
2087
+ new Companion_2();
2088
+ return Companion_instance_2;
2089
+ }
2090
+ function WebSocketChannelsConfig() {
2091
+ Companion_getInstance_2();
2092
+ this.t3c_1 = Companion_getInstance_3().w3j_1;
2093
+ this.u3c_1 = Companion_getInstance_3().w3j_1;
2094
+ }
2095
+ protoOf(WebSocketChannelsConfig).v3j = function () {
2096
+ return Companion_getInstance_3().w3j_1;
2097
+ };
2098
+ function from(_this__u8e3s4, config) {
2099
+ // Inline function 'kotlin.with' call
2100
+ var tmp;
2101
+ if (config.x3j_1 === 2147483647) {
2102
+ tmp = Channel(2147483647);
2103
+ } else if (config.y3j_1.equals(ChannelOverflow_SUSPEND_getInstance())) {
2104
+ tmp = Channel(config.x3j_1, BufferOverflow_SUSPEND_getInstance());
2105
+ } else if (config.y3j_1.equals(ChannelOverflow_CLOSE_getInstance())) {
2106
+ tmp = new BoundedChannel(config.x3j_1);
2107
+ } else {
2108
+ var message = 'Unsupported channel config.';
2109
+ throw IllegalStateException_init_$Create$(toString(message));
2110
+ }
2111
+ return tmp;
2112
+ }
2113
+ function Companion_3() {
2114
+ Companion_instance_3 = this;
2115
+ this.w3j_1 = new ChannelConfig(2147483647, ChannelOverflow_SUSPEND_getInstance());
2116
+ }
2117
+ var Companion_instance_3;
2118
+ function Companion_getInstance_3() {
2119
+ if (Companion_instance_3 == null)
2120
+ new Companion_3();
2121
+ return Companion_instance_3;
2122
+ }
2123
+ function ChannelConfig(capacity, onOverflow) {
2124
+ Companion_getInstance_3();
2125
+ this.x3j_1 = capacity;
2126
+ this.y3j_1 = onOverflow;
2127
+ }
2128
+ protoOf(ChannelConfig).z3j = function () {
2129
+ return this.y3j_1.equals(ChannelOverflow_SUSPEND_getInstance()) && !(this.x3j_1 === 2147483647);
2130
+ };
2131
+ var ChannelOverflow_SUSPEND_instance;
2132
+ var ChannelOverflow_CLOSE_instance;
2133
+ var ChannelOverflow_entriesInitialized;
2134
+ function ChannelOverflow_initEntries() {
2135
+ if (ChannelOverflow_entriesInitialized)
2136
+ return Unit_instance;
2137
+ ChannelOverflow_entriesInitialized = true;
2138
+ ChannelOverflow_SUSPEND_instance = new ChannelOverflow('SUSPEND', 0);
2139
+ ChannelOverflow_CLOSE_instance = new ChannelOverflow('CLOSE', 1);
2140
+ }
2141
+ function ChannelOverflow(name, ordinal) {
2142
+ Enum.call(this, name, ordinal);
2143
+ }
2144
+ function BoundedChannel$Companion$createDelegate$lambda($channel) {
2145
+ return function (it) {
2146
+ var tmp;
2147
+ var tmp_0;
2148
+ if ($channel._v == null) {
2149
+ throwUninitializedPropertyAccessException('channel');
2150
+ } else {
2151
+ tmp_0 = $channel._v;
2152
+ }
2153
+ if (!tmp_0.d1a()) {
2154
+ var tmp_1;
2155
+ if ($channel._v == null) {
2156
+ throwUninitializedPropertyAccessException('channel');
2157
+ } else {
2158
+ tmp_1 = $channel._v;
2159
+ }
2160
+ tmp_1.e1c(new ChannelOverflowException('Channel overflowed'));
2161
+ tmp = Unit_instance;
2162
+ }
2163
+ return Unit_instance;
2164
+ };
2165
+ }
2166
+ function Companion_4() {
2167
+ }
2168
+ protoOf(Companion_4).a3k = function (capacity) {
2169
+ var channel = {_v: null};
2170
+ var tmp = BufferOverflow_DROP_OLDEST_getInstance();
2171
+ // Inline function 'kotlin.also' call
2172
+ var this_0 = Channel(capacity, tmp, BoundedChannel$Companion$createDelegate$lambda(channel));
2173
+ channel._v = this_0;
2174
+ return this_0;
2175
+ };
2176
+ var Companion_instance_4;
2177
+ function Companion_getInstance_4() {
2178
+ return Companion_instance_4;
2179
+ }
2180
+ function BoundedChannel(capacity, delegate) {
2181
+ delegate = delegate === VOID ? Companion_instance_4.a3k(capacity) : delegate;
2182
+ this.b3k_1 = delegate;
2183
+ }
2184
+ protoOf(BoundedChannel).c3k = function (element) {
2185
+ var result = this.b3k_1.z1b(element);
2186
+ if (!_ChannelResult___get_isSuccess__impl__odq1z9(result) && !_ChannelResult___get_isClosed__impl__mg7kuu(result)) {
2187
+ this.e1c(new ChannelOverflowException('Channel overflowed'));
2188
+ }
2189
+ return result;
2190
+ };
2191
+ protoOf(BoundedChannel).z1b = function (element) {
2192
+ return this.c3k((element == null ? true : !(element == null)) ? element : THROW_CCE());
2193
+ };
2194
+ protoOf(BoundedChannel).d3k = function (element, $completion) {
2195
+ return this.b3k_1.y1b(element, $completion);
2196
+ };
2197
+ protoOf(BoundedChannel).y1b = function (element, $completion) {
2198
+ return this.d3k((element == null ? true : !(element == null)) ? element : THROW_CCE(), $completion);
2199
+ };
2200
+ protoOf(BoundedChannel).e1c = function (cause) {
2201
+ return this.b3k_1.e1c(cause);
2202
+ };
2203
+ protoOf(BoundedChannel).d1a = function () {
2204
+ return this.b3k_1.d1a();
2205
+ };
2206
+ protoOf(BoundedChannel).e3k = function ($completion) {
2207
+ return this.b3k_1.c1c($completion);
2208
+ };
2209
+ protoOf(BoundedChannel).c1c = function ($completion) {
2210
+ return this.e3k($completion);
2211
+ };
2212
+ protoOf(BoundedChannel).t = function () {
2213
+ return this.b3k_1.t();
2214
+ };
2215
+ protoOf(BoundedChannel).fu = function (cause) {
2216
+ this.b3k_1.fu(cause);
2217
+ };
2218
+ function ChannelOverflowException(message) {
2219
+ RuntimeException_init_$Init$(message, this);
2220
+ captureStack(this, ChannelOverflowException);
2221
+ }
2222
+ function ChannelOverflow_SUSPEND_getInstance() {
2223
+ ChannelOverflow_initEntries();
2224
+ return ChannelOverflow_SUSPEND_instance;
2225
+ }
2226
+ function ChannelOverflow_CLOSE_getInstance() {
2227
+ ChannelOverflow_initEntries();
2228
+ return ChannelOverflow_CLOSE_instance;
2229
+ }
2230
+ function WebSocketExtension() {
2231
+ }
2232
+ function WebSocketExtensionsConfig() {
2233
+ var tmp = this;
2234
+ // Inline function 'kotlin.collections.mutableListOf' call
2235
+ tmp.h3k_1 = ArrayList_init_$Create$();
2236
+ var tmp_0 = this;
2237
+ // Inline function 'kotlin.arrayOf' call
2238
+ // Inline function 'kotlin.js.unsafeCast' call
2239
+ // Inline function 'kotlin.js.asDynamic' call
2240
+ tmp_0.i3k_1 = [false, false, false];
2241
+ }
2242
+ protoOf(WebSocketExtensionsConfig).i2v = function () {
2243
+ // Inline function 'kotlin.collections.map' call
2244
+ var this_0 = this.h3k_1;
2245
+ // Inline function 'kotlin.collections.mapTo' call
2246
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2247
+ var _iterator__ex2g4s = this_0.t();
2248
+ while (_iterator__ex2g4s.u()) {
2249
+ var item = _iterator__ex2g4s.v();
2250
+ var tmp$ret$0 = item();
2251
+ destination.j1(tmp$ret$0);
2252
+ }
2253
+ return destination;
2254
+ };
2255
+ function parametersToString($this) {
2256
+ return $this.k3k_1.r() ? '' : '; ' + joinToString($this.k3k_1, ';');
2257
+ }
2258
+ function WebSocketExtensionHeader(name, parameters) {
2259
+ this.j3k_1 = name;
2260
+ this.k3k_1 = parameters;
2261
+ }
2262
+ protoOf(WebSocketExtensionHeader).toString = function () {
2263
+ return this.j3k_1 + ' ' + parametersToString(this);
2264
+ };
2265
+ function parseWebSocketExtensions(value) {
2266
+ // Inline function 'kotlin.collections.map' call
2267
+ var this_0 = split(value, [',']);
2268
+ // Inline function 'kotlin.collections.mapTo' call
2269
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2270
+ var _iterator__ex2g4s = this_0.t();
2271
+ while (_iterator__ex2g4s.u()) {
2272
+ var item = _iterator__ex2g4s.v();
2273
+ var extension = split(item, [';']);
2274
+ // Inline function 'kotlin.text.trim' call
2275
+ var this_1 = first(extension);
2276
+ var name = toString(trim(isCharSequence(this_1) ? this_1 : THROW_CCE()));
2277
+ // Inline function 'kotlin.collections.map' call
2278
+ var this_2 = drop(extension, 1);
2279
+ // Inline function 'kotlin.collections.mapTo' call
2280
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
2281
+ var _iterator__ex2g4s_0 = this_2.t();
2282
+ while (_iterator__ex2g4s_0.u()) {
2283
+ var item_0 = _iterator__ex2g4s_0.v();
2284
+ // Inline function 'kotlin.text.trim' call
2285
+ var tmp$ret$2 = toString(trim(isCharSequence(item_0) ? item_0 : THROW_CCE()));
2286
+ destination_0.j1(tmp$ret$2);
2287
+ }
2288
+ var parameters = destination_0;
2289
+ var tmp$ret$5 = new WebSocketExtensionHeader(name, parameters);
2290
+ destination.j1(tmp$ret$5);
2291
+ }
2292
+ return destination;
2293
+ }
2294
+ function WebSocketSession() {
2295
+ }
2296
+ function close(_this__u8e3s4, reason, $completion) {
2297
+ reason = reason === VOID ? CloseReason_init_$Create$(Codes_NORMAL_getInstance(), '') : reason;
2298
+ var tmp = new $closeCOROUTINE$(_this__u8e3s4, reason, $completion);
2299
+ tmp.c9_1 = Unit_instance;
2300
+ tmp.d9_1 = null;
2301
+ return tmp.i9();
2302
+ }
2303
+ function closeExceptionally(_this__u8e3s4, cause, $completion) {
2304
+ var tmp;
2305
+ if (cause instanceof CancellationException) {
2306
+ tmp = CloseReason_init_$Create$(Codes_NORMAL_getInstance(), '');
2307
+ } else {
2308
+ tmp = CloseReason_init_$Create$(Codes_INTERNAL_ERROR_getInstance(), cause.toString());
2309
+ }
2310
+ var reason = tmp;
2311
+ return close(_this__u8e3s4, reason, $completion);
2312
+ }
2313
+ function $closeCOROUTINE$(_this__u8e3s4, reason, resultContinuation) {
2314
+ CoroutineImpl.call(this, resultContinuation);
2315
+ this.t3k_1 = _this__u8e3s4;
2316
+ this.u3k_1 = reason;
2317
+ }
2318
+ protoOf($closeCOROUTINE$).i9 = function () {
2319
+ var suspendResult = this.c9_1;
2320
+ $sm: do
2321
+ try {
2322
+ var tmp = this.a9_1;
2323
+ switch (tmp) {
2324
+ case 0:
2325
+ this.b9_1 = 4;
2326
+ this.b9_1 = 3;
2327
+ this.a9_1 = 1;
2328
+ suspendResult = this.t3k_1.r3c(Close_init_$Create$(this.u3k_1), this);
2329
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2330
+ return suspendResult;
2331
+ }
2332
+
2333
+ continue $sm;
2334
+ case 1:
2335
+ this.a9_1 = 2;
2336
+ suspendResult = this.t3k_1.v1n(this);
2337
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2338
+ return suspendResult;
2339
+ }
2340
+
2341
+ continue $sm;
2342
+ case 2:
2343
+ this.b9_1 = 4;
2344
+ this.a9_1 = 5;
2345
+ continue $sm;
2346
+ case 3:
2347
+ this.b9_1 = 4;
2348
+ var tmp_0 = this.d9_1;
2349
+ if (tmp_0 instanceof Error) {
2350
+ var _unused_var__etf5q3 = this.d9_1;
2351
+ this.a9_1 = 5;
2352
+ continue $sm;
2353
+ } else {
2354
+ throw this.d9_1;
2355
+ }
2356
+
2357
+ case 4:
2358
+ throw this.d9_1;
2359
+ case 5:
2360
+ this.b9_1 = 4;
2361
+ return Unit_instance;
2362
+ }
2363
+ } catch ($p) {
2364
+ var e = $p;
2365
+ if (this.b9_1 === 4) {
2366
+ throw e;
2367
+ } else {
2368
+ this.a9_1 = this.b9_1;
2369
+ this.d9_1 = e;
2370
+ }
2371
+ }
2372
+ while (true);
2373
+ };
333
2374
  function Binary_init_$Init$(fin, data, $this) {
334
2375
  Binary.call($this, fin, data, false, false, false);
335
2376
  return $this;
@@ -351,8 +2392,8 @@
351
2392
  function Close_init_$Init$(reason, $this) {
352
2393
  // Inline function 'io.ktor.utils.io.core.buildPacket' call
353
2394
  var builder = new Buffer();
354
- builder.wp(reason.d39_1);
355
- writeText(builder, reason.e39_1);
2395
+ builder.gr(reason.j3c_1);
2396
+ writeText(builder, reason.k3c_1);
356
2397
  Close_init_$Init$_0(builder, $this);
357
2398
  return $this;
358
2399
  }
@@ -364,7 +2405,7 @@
364
2405
  return $this;
365
2406
  }
366
2407
  function Close_init_$Init$_1($this) {
367
- Close.call($this, Companion_getInstance_1().m39_1);
2408
+ Close.call($this, Companion_getInstance_5().n3g_1);
368
2409
  return $this;
369
2410
  }
370
2411
  function Close_init_$Create$_0() {
@@ -385,45 +2426,100 @@
385
2426
  function Close(data) {
386
2427
  Frame.call(this, true, FrameType_CLOSE_getInstance(), data, NonDisposableHandle_instance, false, false, false);
387
2428
  }
388
- function Companion_1() {
389
- Companion_instance_1 = this;
390
- this.m39_1 = new Int8Array(0);
2429
+ function Ping(data) {
2430
+ Frame.call(this, true, FrameType_PING_getInstance(), data, NonDisposableHandle_instance, false, false, false);
391
2431
  }
392
- var Companion_instance_1;
393
- function Companion_getInstance_1() {
394
- if (Companion_instance_1 == null)
395
- new Companion_1();
396
- return Companion_instance_1;
2432
+ function Pong(data, disposableHandle) {
2433
+ disposableHandle = disposableHandle === VOID ? NonDisposableHandle_instance : disposableHandle;
2434
+ Frame.call(this, true, FrameType_PONG_getInstance(), data, disposableHandle, false, false, false);
2435
+ }
2436
+ function Companion_5() {
2437
+ Companion_instance_5 = this;
2438
+ this.n3g_1 = new Int8Array(0);
2439
+ }
2440
+ protoOf(Companion_5).o3g = function (fin, frameType, data, rsv1, rsv2, rsv3) {
2441
+ var tmp;
2442
+ switch (frameType.a1_1) {
2443
+ case 1:
2444
+ tmp = new Binary(fin, data, rsv1, rsv2, rsv3);
2445
+ break;
2446
+ case 0:
2447
+ tmp = new Text(fin, data, rsv1, rsv2, rsv3);
2448
+ break;
2449
+ case 2:
2450
+ tmp = new Close(data);
2451
+ break;
2452
+ case 3:
2453
+ tmp = new Ping(data);
2454
+ break;
2455
+ case 4:
2456
+ tmp = new Pong(data, NonDisposableHandle_instance);
2457
+ break;
2458
+ default:
2459
+ noWhenBranchMatchedException();
2460
+ break;
2461
+ }
2462
+ return tmp;
2463
+ };
2464
+ var Companion_instance_5;
2465
+ function Companion_getInstance_5() {
2466
+ if (Companion_instance_5 == null)
2467
+ new Companion_5();
2468
+ return Companion_instance_5;
397
2469
  }
398
2470
  function Frame(fin, frameType, data, disposableHandle, rsv1, rsv2, rsv3) {
399
- Companion_getInstance_1();
2471
+ Companion_getInstance_5();
400
2472
  disposableHandle = disposableHandle === VOID ? NonDisposableHandle_instance : disposableHandle;
401
2473
  rsv1 = rsv1 === VOID ? false : rsv1;
402
2474
  rsv2 = rsv2 === VOID ? false : rsv2;
403
2475
  rsv3 = rsv3 === VOID ? false : rsv3;
404
- this.n39_1 = fin;
405
- this.o39_1 = frameType;
406
- this.p39_1 = data;
407
- this.q39_1 = disposableHandle;
408
- this.r39_1 = rsv1;
409
- this.s39_1 = rsv2;
410
- this.t39_1 = rsv3;
2476
+ this.g3g_1 = fin;
2477
+ this.h3g_1 = frameType;
2478
+ this.i3g_1 = data;
2479
+ this.j3g_1 = disposableHandle;
2480
+ this.k3g_1 = rsv1;
2481
+ this.l3g_1 = rsv2;
2482
+ this.m3g_1 = rsv3;
411
2483
  }
412
2484
  protoOf(Frame).toString = function () {
413
- return 'Frame ' + this.o39_1.toString() + ' (fin=' + this.n39_1 + ', buffer len = ' + this.p39_1.length + ')';
2485
+ return 'Frame ' + this.h3g_1.toString() + ' (fin=' + this.g3g_1 + ', buffer len = ' + this.i3g_1.length + ')';
414
2486
  };
2487
+ function get_OUTGOING_CHANNEL_CAPACITY() {
2488
+ return OUTGOING_CHANNEL_CAPACITY;
2489
+ }
2490
+ var OUTGOING_CHANNEL_CAPACITY;
2491
+ //region block: post-declaration
2492
+ protoOf(DefaultWebSocketSessionImpl).r3c = send;
2493
+ defineProp(protoOf(FrameTooBigException), 'message', function () {
2494
+ return this.e();
2495
+ });
2496
+ protoOf(BoundedChannel).g1c = close$default;
2497
+ protoOf(BoundedChannel).i1c = cancel$default;
2498
+ //endregion
415
2499
  //region block: init
416
2500
  NonDisposableHandle_instance = new NonDisposableHandle();
2501
+ Companion_instance_4 = new Companion_4();
2502
+ OUTGOING_CHANNEL_CAPACITY = null;
417
2503
  //endregion
418
2504
  //region block: exports
419
2505
  _.$_$ = _.$_$ || {};
420
2506
  _.$_$.a = Codes_CLOSED_ABNORMALLY_getInstance;
421
2507
  _.$_$.b = Codes_NORMAL_getInstance;
422
- _.$_$.c = Binary_init_$Create$;
423
- _.$_$.d = Close_init_$Create$;
424
- _.$_$.e = Text_init_$Create$;
425
- _.$_$.f = Companion_getInstance;
426
- _.$_$.g = CloseReason;
2508
+ _.$_$.c = send;
2509
+ _.$_$.d = Binary_init_$Create$;
2510
+ _.$_$.e = Close_init_$Create$;
2511
+ _.$_$.f = Text_init_$Create$;
2512
+ _.$_$.g = Companion_getInstance;
2513
+ _.$_$.h = Companion_getInstance_2;
2514
+ _.$_$.i = CloseReason;
2515
+ _.$_$.j = DefaultWebSocketSession_0;
2516
+ _.$_$.k = DefaultWebSocketSession;
2517
+ _.$_$.l = WebSocketChannelsConfig;
2518
+ _.$_$.m = WebSocketExtensionsConfig;
2519
+ _.$_$.n = WebSocketExtension;
2520
+ _.$_$.o = WebSocketSession;
2521
+ _.$_$.p = from;
2522
+ _.$_$.q = parseWebSocketExtensions;
427
2523
  //endregion
428
2524
  return _;
429
- }(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js'), require('./ktor-ktor-io.js'), require('./kotlinx-io-kotlinx-io-core.js')));
2525
+ }(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js'), require('./ktor-ktor-utils.js'), require('./ktor-ktor-io.js'), require('./kotlinx-io-kotlinx-io-core.js'), require('./kotlinx-atomicfu.js')));