@attocash/cli 0.2.2 → 0.3.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.
Files changed (137) hide show
  1. package/README.md +157 -5
  2. package/dist/application/app.d.ts +34 -3
  3. package/dist/application/app.js +142 -125
  4. package/dist/application/operations.d.ts +3 -0
  5. package/dist/application/operations.js +30 -8
  6. package/dist/cli/cli.d.ts +1 -0
  7. package/dist/cli/cli.js +101 -13
  8. package/dist/cli/onboarding.d.ts +13 -0
  9. package/dist/cli/onboarding.js +99 -2
  10. package/dist/cli/output.js +18 -2
  11. package/dist/doctor/profile.js +2 -1
  12. package/dist/internal-marketplace.d.ts +25 -0
  13. package/dist/internal-marketplace.js +50 -0
  14. package/dist/marketplace/approval-files.d.ts +3 -0
  15. package/dist/marketplace/approval-files.js +97 -0
  16. package/dist/marketplace/approval-preview.d.ts +2 -0
  17. package/dist/marketplace/approval-preview.js +86 -0
  18. package/dist/marketplace/proof-approval.d.ts +82 -0
  19. package/dist/marketplace/proof-approval.js +671 -0
  20. package/dist/marketplace/topups.d.ts +82 -0
  21. package/dist/marketplace/topups.js +485 -0
  22. package/dist/network/batching.d.ts +2 -0
  23. package/dist/network/batching.js +23 -0
  24. package/dist/network/entry.d.ts +2 -0
  25. package/dist/network/entry.js +35 -0
  26. package/dist/network/reader.d.ts +2 -0
  27. package/dist/network/reader.js +125 -37
  28. package/dist/spending/approval.d.ts +35 -0
  29. package/dist/spending/approval.js +25 -0
  30. package/dist/spending/atto-x402.d.ts +31 -0
  31. package/dist/spending/atto-x402.js +174 -0
  32. package/dist/spending/ledger.d.ts +74 -2
  33. package/dist/spending/ledger.js +298 -7
  34. package/dist/spending/payments.d.ts +105 -5
  35. package/dist/spending/payments.js +795 -11
  36. package/dist/storage/recovery-seed.d.ts +13 -0
  37. package/dist/storage/recovery-seed.js +93 -0
  38. package/dist/storage/state.d.ts +4 -0
  39. package/dist/storage/state.js +32 -2
  40. package/dist/wallet/receive.d.ts +39 -0
  41. package/dist/wallet/receive.js +264 -0
  42. package/dist/wallet/signing.d.ts +1 -0
  43. package/dist/wallet/signing.js +37 -21
  44. package/dist/wallet/types.d.ts +1 -0
  45. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +1922 -1918
  46. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -1
  47. package/node_modules/@attocash/commons-core/README.md +9 -0
  48. package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +10 -0
  49. package/node_modules/@attocash/commons-core/commons-commons-core.mjs +2543 -2434
  50. package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -1
  51. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +4695 -4227
  52. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -1
  53. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
  54. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +60 -60
  55. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
  56. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +651 -631
  57. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
  58. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +2294 -2295
  59. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  60. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
  61. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  62. package/node_modules/@attocash/commons-core/package.json +1 -1
  63. package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +1 -0
  64. package/node_modules/@attocash/commons-node/commons-commons-node.mjs +873 -847
  65. package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -1
  66. package/node_modules/@attocash/commons-node/kotlin-logging.mjs +109 -109
  67. package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -1
  68. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
  69. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  70. package/node_modules/@attocash/commons-node/package.json +3 -3
  71. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +1 -0
  72. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +674 -640
  73. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -1
  74. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +109 -109
  75. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -1
  76. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -1
  77. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -1
  78. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
  79. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  80. package/node_modules/@attocash/commons-node-remote/package.json +4 -4
  81. package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +1 -0
  82. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +52 -51
  83. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -1
  84. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +13 -13
  85. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -1
  86. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -1
  87. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +2639 -2608
  88. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -1
  89. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -1
  90. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
  91. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  92. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +411 -196
  93. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -1
  94. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +2115 -1976
  95. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -1
  96. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +7 -7
  97. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -1
  98. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +385 -384
  99. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -1
  100. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +1261 -1185
  101. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -1
  102. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +668 -656
  103. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -1
  104. package/node_modules/@attocash/commons-transport/ktor-ktor-openapi-schema.mjs +89 -0
  105. package/node_modules/@attocash/commons-transport/ktor-ktor-openapi-schema.mjs.map +1 -0
  106. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +9 -9
  107. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -1
  108. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +120 -128
  109. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -1
  110. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +46 -49
  111. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -1
  112. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -1
  113. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +1041 -985
  114. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -1
  115. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -1
  116. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +530 -455
  117. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -1
  118. package/node_modules/@attocash/commons-transport/package.json +4 -4
  119. package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +1 -0
  120. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +230 -226
  121. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -1
  122. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +109 -109
  123. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -1
  124. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
  125. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  126. package/node_modules/@attocash/commons-worker/package.json +3 -3
  127. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +1 -0
  128. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +91 -86
  129. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -1
  130. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +109 -109
  131. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -1
  132. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -1
  133. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -1
  134. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +1732 -1701
  135. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  136. package/node_modules/@attocash/commons-worker-remote/package.json +4 -4
  137. package/package.json +9 -5
@@ -1,22 +1,29 @@
1
1
  import {
2
+ Unit_instance3kz1zqli6gr1r as Unit_instance,
3
+ Companion_instance13way2il9a8jt as Companion_instance,
4
+ VOID3gxj6tk5isa35 as VOID,
2
5
  collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
3
6
  mapCapacity1h45rc3eh9p2l as mapCapacity,
4
7
  coerceAtLeast2bkz8m9ik7hep as coerceAtLeast,
5
8
  LinkedHashMap1zhqxkxv3xnkl as LinkedHashMap,
6
- Unit_instance3vdlo4e4f5ggx as Unit_instance,
7
9
  initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
8
- VOID3gxj6tk5isa35 as VOID,
9
10
  enumEntries20mr21zbe3az4 as enumEntries,
10
11
  Enum3alwj03lh1n41 as Enum,
11
12
  initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
12
13
  createThis2j2avj17cvnv2 as createThis,
14
+ IllegalArgumentException2asla15b5jaob as IllegalArgumentException,
13
15
  toString1pkumu07cwy4m as toString,
14
16
  getStringHashCode26igk1bx568vk as getStringHashCode,
17
+ substringiqarkczpya5m as substring,
18
+ charCodeAt1yspne1d8erbm as charCodeAt,
19
+ Char__toInt_impl_vasixd28v1p2u6jau5g as Char__toInt_impl_vasixd,
20
+ isHighSurrogate11jfjw70ar0zf as isHighSurrogate,
21
+ isLowSurrogateujxcv7hjn4ma as isLowSurrogate,
15
22
  initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
16
23
  isInterface3d6p8outrmvmk as isInterface,
17
- IllegalArgumentException2asla15b5jaob as IllegalArgumentException,
18
24
  toString30pk9tzaqopn as toString_0,
19
25
  fromInt2ii0rejb1w62w as fromInt,
26
+ orPromise1iucc2to2udt2 as orPromise,
20
27
  constructCallableReference23y65rf941mch as constructCallableReference,
21
28
  ensureNotNull1e947j3ixpazm as ensureNotNull,
22
29
  CancellationException3b36o9qz53rgr as CancellationException,
@@ -31,6 +38,7 @@ import {
31
38
  decodeToString1dbzcjd620q25 as decodeToString,
32
39
  Randomei1bbeye8rr8 as Random,
33
40
  toHexString5bhtjxqec7ow as toHexString,
41
+ $3l5vvh8yg0ier as $,
34
42
  throwUninitializedPropertyAccessException14fok093f3k3t as throwUninitializedPropertyAccessException,
35
43
  RuntimeException1r3t0zl97011n as RuntimeException,
36
44
  split2bvyvnrlcifjv as split,
@@ -42,28 +50,28 @@ import {
42
50
  noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
43
51
  } from '@attocash/commons-core/kotlin-kotlin-stdlib.mjs';
44
52
  import {
45
- Dispatchers_getInstance20p7pyqnrepag as Dispatchers_getInstance,
53
+ Dispatchers_getInstance128lm494a5r5s as Dispatchers_getInstance,
46
54
  launch1c91vkjzdi9sd as launch,
47
- CoroutineStart_UNDISPATCHED_getInstance2pq896dvru5v1 as CoroutineStart_UNDISPATCHED_getInstance,
55
+ CoroutineStart_UNDISPATCHED_getInstance36t7e2kqqnuqp as CoroutineStart_UNDISPATCHED_getInstance,
48
56
  ChannelResult2y4k69ac6y3du as ChannelResult,
49
- _ChannelResult___get_isSuccess__impl__odq1z9t6ktwy0g0q0f as _ChannelResult___get_isSuccess__impl__odq1z9,
57
+ _ChannelResult___get_isSuccess__impl__odq1z923tdiqn4dmkwh as _ChannelResult___get_isSuccess__impl__odq1z9,
50
58
  cancelConsumed2i0oizqhmljf6 as cancelConsumed,
51
59
  ClosedSendChannelException29m33prpq9jaw as ClosedSendChannelException,
52
60
  ClosedReceiveChannelException3ofg6gf5f5b38 as ClosedReceiveChannelException,
53
61
  CompletableDeferred2lnqvsbvx74d3 as CompletableDeferred,
54
62
  Job13y4jkazwjho0 as Job,
55
- Key_instancebefxze3q9f64 as Key_instance,
63
+ Key_instancepi2bbb0csu5f as Key_instance,
56
64
  CoroutineName2g5zosw74tf0f as CoroutineName,
57
- Factory_getInstance32nnliw9sj63p as Factory_getInstance,
65
+ Factory_getInstance14vrned6uf29d as Factory_getInstance,
58
66
  DisposableHandle1uzxt8frdchxn as DisposableHandle,
59
67
  CopyableThrowable1mvc99jcyvivf as CopyableThrowable,
60
68
  Channel3r72atmcithql as Channel,
61
- withTimeoutOrNull3qi35nuwr2k8a as withTimeoutOrNull,
62
- BufferOverflow_SUSPEND_getInstanceob833ibjouyy as BufferOverflow_SUSPEND_getInstance,
63
- BufferOverflow_DROP_OLDEST_getInstanceckq6sjfawt4w as BufferOverflow_DROP_OLDEST_getInstance,
64
- _ChannelResult___get_isClosed__impl__mg7kuu3a26on4apn4j4 as _ChannelResult___get_isClosed__impl__mg7kuu,
65
- close$defaultlxi0kykibhye as close$default,
66
- cancel$default2imfx8rp1ubvu as cancel$default,
69
+ withTimeoutOrNull2oszfz61ga8oq as withTimeoutOrNull,
70
+ BufferOverflow_SUSPEND_getInstance1ucmryz5dsuc2 as BufferOverflow_SUSPEND_getInstance,
71
+ BufferOverflow_DROP_OLDEST_getInstance2xuwx7fze5aij as BufferOverflow_DROP_OLDEST_getInstance,
72
+ _ChannelResult___get_isClosed__impl__mg7kuul2jcxqhngcqm as _ChannelResult___get_isClosed__impl__mg7kuu,
73
+ close$default2suggcywjwe8g as close$default,
74
+ cancel$default3v09jht7i082i as cancel$default,
67
75
  SendChannel38sllbxw662ws as SendChannel,
68
76
  ReceiveChannel24wu5e2tj9lbp as ReceiveChannel,
69
77
  } from './kotlinx-coroutines-core.mjs';
@@ -79,7 +87,7 @@ import {
79
87
  writeFully359t6q8kam2g5 as writeFully,
80
88
  buildjygoh729rhy8 as build,
81
89
  readText27783kyxjxi1g as readText,
82
- Charsets_getInstance3jooo7e4x0j2x as Charsets_getInstance,
90
+ Charsets_getInstancezrqwjk0yrlyw as Charsets_getInstance,
83
91
  toByteArray1i3ns5jnoqlv6 as toByteArray,
84
92
  ClosedByteChannelException3il8gfpye60w as ClosedByteChannelException,
85
93
  writeText19qfzm98fbm4l as writeText,
@@ -99,55 +107,62 @@ var imul = Math.imul;
99
107
  //region block: pre-declaration
100
108
  class Companion {
101
109
  constructor() {
102
- Companion_instance = this;
110
+ Companion_instance_0 = this;
103
111
  var tmp = this;
104
112
  // Inline function 'kotlin.collections.associateBy' call
105
113
  var this_0 = get_entries();
106
114
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
107
115
  // Inline function 'kotlin.collections.associateByTo' call
108
- var destination = LinkedHashMap.ic(capacity);
109
- var _iterator__ex2g4s = this_0.l1();
110
- while (_iterator__ex2g4s.m1()) {
111
- var element = _iterator__ex2g4s.n1();
112
- var tmp$ret$2 = element.a4p_1;
113
- destination.g4(tmp$ret$2, element);
116
+ var destination = LinkedHashMap.new_kotlin_collections_LinkedHashMap_31p40q_k$(capacity);
117
+ var _iterator__ex2g4s = this_0.iterator_jk1svi_k$();
118
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
119
+ var element = _iterator__ex2g4s.next_20eer_k$();
120
+ var tmp$ret$2 = element.code_1;
121
+ destination.put_4fpzoq_k$(tmp$ret$2, element);
114
122
  }
115
- tmp.b4p_1 = destination;
116
- this.c4p_1 = Codes_INTERNAL_ERROR_getInstance();
123
+ tmp.byCodeMap_1 = destination;
124
+ this.UNEXPECTED_CONDITION_1 = Codes_INTERNAL_ERROR_getInstance();
117
125
  }
118
- d4p(code) {
119
- return this.b4p_1.o4(code);
126
+ byCode_d9s8a4_k$(code) {
127
+ return this.byCodeMap_1.get_wei43m_k$(code);
120
128
  }
121
129
  }
122
130
  class Codes extends Enum {
123
131
  constructor(name, ordinal, code) {
124
132
  super(name, ordinal);
125
- this.a4p_1 = code;
133
+ this.code_1 = code;
126
134
  }
127
135
  }
136
+ class Companion_0 {}
128
137
  class CloseReason {
129
138
  constructor(code, message) {
130
- return new.target.g4p(code, message);
139
+ return new.target.new_io_ktor_websocket_CloseReason_a5tz4j_k$(code, message);
131
140
  }
132
- static g4p(code, message) {
141
+ static new_io_ktor_websocket_CloseReason_a5tz4j_k$(code, message) {
133
142
  var $this = createThis(this);
134
- $this.e4p_1 = code;
135
- $this.f4p_1 = message;
143
+ $this.code_1 = code;
144
+ $this.message_1 = message;
145
+ var size = utf8Size($this.message_1);
146
+ // Inline function 'kotlin.require' call
147
+ if (!(size <= 123)) {
148
+ var message_0 = 'Close reason message is too long: ' + size + ' bytes, but must not exceed ' + '123 bytes when UTF-8-encoded';
149
+ throw IllegalArgumentException.new_kotlin_IllegalArgumentException_sfqr8_k$(toString(message_0));
150
+ }
136
151
  return $this;
137
152
  }
138
- static h4p(code, message) {
139
- return this.g4p(code.a4p_1, message);
153
+ static new_io_ktor_websocket_CloseReason_al0vxu_k$(code, message) {
154
+ return this.new_io_ktor_websocket_CloseReason_a5tz4j_k$(code.code_1, message);
140
155
  }
141
- i4p() {
142
- return Companion_getInstance().d4p(this.e4p_1);
156
+ get_knownReason_j6teda_k$() {
157
+ return Companion_getInstance().byCode_d9s8a4_k$(this.code_1);
143
158
  }
144
159
  toString() {
145
- var tmp0_elvis_lhs = this.i4p();
146
- return 'CloseReason(reason=' + toString(tmp0_elvis_lhs == null ? this.e4p_1 : tmp0_elvis_lhs) + ', message=' + this.f4p_1 + ')';
160
+ var tmp0_elvis_lhs = this.get_knownReason_j6teda_k$();
161
+ return 'CloseReason(reason=' + toString(tmp0_elvis_lhs == null ? this.code_1 : tmp0_elvis_lhs) + ', message=' + this.message_1 + ')';
147
162
  }
148
163
  hashCode() {
149
- var result = this.e4p_1;
150
- result = imul(result, 31) + getStringHashCode(this.f4p_1) | 0;
164
+ var result = this.code_1;
165
+ result = imul(result, 31) + getStringHashCode(this.message_1) | 0;
151
166
  return result;
152
167
  }
153
168
  equals(other) {
@@ -155,87 +170,87 @@ class CloseReason {
155
170
  return true;
156
171
  if (!(other instanceof CloseReason))
157
172
  return false;
158
- if (!(this.e4p_1 === other.e4p_1))
173
+ if (!(this.code_1 === other.code_1))
159
174
  return false;
160
- if (!(this.f4p_1 === other.f4p_1))
175
+ if (!(this.message_1 === other.message_1))
161
176
  return false;
162
177
  return true;
163
178
  }
164
179
  }
165
180
  class WebSocketSession {}
166
181
  function *send(frame, $completion) {
167
- yield* this.n4p().p36(frame, $completion);
182
+ yield* this.get_outgoing_us7o3v_k$().send_44jogj_k$(frame, $completion);
168
183
  return Unit_instance;
169
184
  }
170
185
  class DefaultWebSocketSession {}
171
- class Companion_0 {
186
+ class Companion_1 {
172
187
  constructor() {
173
- Companion_instance_0 = this;
174
- this.n4q_1 = Pong.j4r(new Int8Array(0), NonDisposableHandle_instance);
188
+ Companion_instance_2 = this;
189
+ this.EmptyPong_1 = Pong.new_io_ktor_websocket_Frame_Pong_hee4xw_k$(new Int8Array(0), NonDisposableHandle_instance);
175
190
  }
176
191
  }
177
192
  class DefaultWebSocketSessionImpl {
178
193
  constructor(raw, pingIntervalMillis, timeoutMillis, incomingFramesConfig, outgoingFramesConfig) {
179
- Companion_getInstance_0();
180
- this.s4p_1 = raw;
181
- this.t4p_1 = atomic$ref$1(null);
182
- this.u4p_1 = CompletableDeferred();
183
- this.v4p_1 = Job();
184
- this.w4p_1 = this.s4p_1.o2r().vl(Key_instance).xl(this.v4p_1).xl(new CoroutineName('ws-default'));
185
- this.x4p_1 = from(Factory_getInstance(), incomingFramesConfig);
186
- this.y4p_1 = from(Factory_getInstance(), outgoingFramesConfig);
187
- this.z4p_1 = atomic$boolean$1(false);
194
+ Companion_getInstance_1();
195
+ this.raw_1 = raw;
196
+ this.pinger_1 = atomic$ref$1(null);
197
+ this.closeReasonRef_1 = CompletableDeferred();
198
+ this.context_1 = Job();
199
+ this.coroutineContext_1 = this.raw_1.get_coroutineContext_115oqo_k$().minusKey_9i5ggf_k$(Key_instance).plus_s13ygv_k$(this.context_1).plus_s13ygv_k$(new CoroutineName('ws-default'));
200
+ this.filtered_1 = from(Factory_getInstance(), incomingFramesConfig);
201
+ this.outgoingToBeProcessed_1 = from(Factory_getInstance(), outgoingFramesConfig);
202
+ this.closed_1 = atomic$boolean$1(false);
188
203
  var tmp = this;
189
204
  // Inline function 'kotlin.collections.mutableListOf' call
190
- tmp.a4q_1 = ArrayList.f2();
191
- this.b4q_1 = atomic$boolean$1(false);
192
- this.c4q_1 = pingIntervalMillis;
193
- this.d4q_1 = timeoutMillis;
194
- this.e4q_1 = this.u4p_1;
205
+ tmp._extensions_1 = ArrayList.new_kotlin_collections_ArrayList_ony0vx_k$();
206
+ this.started_1 = atomic$boolean$1(false);
207
+ this.pingIntervalMillis_1 = pingIntervalMillis;
208
+ this.timeoutMillis_1 = timeoutMillis;
209
+ this.closeReason_1 = this.closeReasonRef_1;
195
210
  }
196
- o2r() {
197
- return this.w4p_1;
211
+ get_coroutineContext_115oqo_k$() {
212
+ return this.coroutineContext_1;
198
213
  }
199
- m4p() {
200
- return this.x4p_1;
214
+ get_incoming_u9os29_k$() {
215
+ return this.filtered_1;
201
216
  }
202
- n4p() {
203
- return this.y4p_1;
217
+ get_outgoing_us7o3v_k$() {
218
+ return this.outgoingToBeProcessed_1;
204
219
  }
205
- z4q() {
206
- return this.a4q_1;
220
+ get_extensions_kxksyl_k$() {
221
+ return this._extensions_1;
207
222
  }
208
- k4p(value) {
209
- this.s4p_1.k4p(value);
223
+ set_maxFrameSize_k27os3_k$(value) {
224
+ this.raw_1.set_maxFrameSize_k27os3_k$(value);
210
225
  }
211
- l4p() {
212
- return this.s4p_1.l4p();
226
+ get_maxFrameSize_9zaht9_k$() {
227
+ return this.raw_1.get_maxFrameSize_9zaht9_k$();
213
228
  }
214
- j4p(negotiatedExtensions) {
215
- if (!this.b4q_1.atomicfu$compareAndSet(false, true)) {
229
+ start_ye6294_k$(negotiatedExtensions) {
230
+ if (!this.started_1.atomicfu$compareAndSet(false, true)) {
216
231
  // Inline function 'kotlin.error' call
217
232
  var message = 'WebSocket session ' + toString(this) + ' is already started.';
218
- throw IllegalStateException.o(toString(message));
233
+ throw IllegalStateException.new_kotlin_IllegalStateException_w47ei6_k$(toString(message));
219
234
  }
220
235
  // Inline function 'io.ktor.util.logging.trace' call
221
236
  var this_0 = get_LOGGER();
222
237
  if (get_isTraceEnabled(this_0)) {
223
238
  var tmp$ret$2 = 'Starting default WebSocketSession(' + toString(this) + ') ' + ('with negotiated extensions: ' + joinToString(negotiatedExtensions));
224
- this_0.k48(tmp$ret$2);
239
+ this_0.trace_fti9bv_k$(tmp$ret$2);
225
240
  }
226
- this.a4q_1.t2(negotiatedExtensions);
241
+ this._extensions_1.addAll_h3ej1q_k$(negotiatedExtensions);
227
242
  runOrCancelPinger(this);
228
- var incomingJob = runIncomingProcessor(this, ponger(this, this.n4p()));
243
+ var incomingJob = runIncomingProcessor(this, ponger(this, this.get_outgoing_us7o3v_k$()));
229
244
  var outgoingJob = runOutgoingProcessor(this);
230
245
  launch(this, VOID, VOID, DefaultWebSocketSessionImpl$start$slambda(incomingJob, outgoingJob, this));
231
246
  }
232
- *u3y($completion) {
233
- yield* this.s4p_1.u3y($completion);
247
+ *flush_4wsz1p_k$($completion) {
248
+ yield* this.raw_1.flush_4wsz1p_k$($completion);
234
249
  return Unit_instance;
235
250
  }
236
251
  }
237
252
  class NonDisposableHandle {
238
- d2v() {
253
+ dispose_3nnxhr_k$() {
239
254
  return Unit_instance;
240
255
  }
241
256
  toString() {
@@ -254,61 +269,61 @@ class NonDisposableHandle {
254
269
  }
255
270
  class FrameTooBigException extends Exception {
256
271
  constructor(frameSize, cause) {
257
- return new.target.y4q(frameSize, cause);
272
+ return new.target.new_io_ktor_websocket_FrameTooBigException_7tb0yi_k$(frameSize, cause);
258
273
  }
259
- static y4q(frameSize, cause) {
274
+ static new_io_ktor_websocket_FrameTooBigException_7tb0yi_k$(frameSize, cause) {
260
275
  cause = cause === VOID ? null : cause;
261
- var $this = this.de(cause);
262
- captureStack($this, $this.x4q_1);
263
- $this.w4q_1 = frameSize;
276
+ var $this = this.new_kotlin_Exception_bock1m_k$(cause);
277
+ captureStack($this, $this.$throwableCtor_2);
278
+ $this.frameSize_1 = frameSize;
264
279
  delete $this.message;
265
280
  return $this;
266
281
  }
267
- r() {
268
- var sizeSuffix = this.w4q_1 >= 0n ? ': ' + this.w4q_1.toString() : '';
282
+ get_message_h23axq_k$() {
283
+ var sizeSuffix = this.frameSize_1 >= 0n ? ': ' + this.frameSize_1.toString() : '';
269
284
  return 'Frame is too big' + sizeSuffix;
270
285
  }
271
- s2y() {
272
- return FrameTooBigException.y4q(this.w4q_1, this);
286
+ createCopy_mmw9ld_k$() {
287
+ return FrameTooBigException.new_io_ktor_websocket_FrameTooBigException_7tb0yi_k$(this.frameSize_1, this);
273
288
  }
274
289
  get message() {
275
- return this.r();
290
+ return this.get_message_h23axq_k$();
276
291
  }
277
292
  }
278
- class Companion_1 {
293
+ class Companion_2 {
279
294
  constructor() {
280
- Companion_instance_1 = this;
295
+ Companion_instance_3 = this;
281
296
  var tmp = this;
282
297
  var tmp0 = get_entries_0();
283
298
  var tmp$ret$0;
284
299
  $l$block_0: {
285
300
  // Inline function 'kotlin.collections.maxByOrNull' call
286
- var iterator = tmp0.l1();
287
- if (!iterator.m1()) {
301
+ var iterator = tmp0.iterator_jk1svi_k$();
302
+ if (!iterator.hasNext_bitz1p_k$()) {
288
303
  tmp$ret$0 = null;
289
304
  break $l$block_0;
290
305
  }
291
- var maxElem = iterator.n1();
292
- if (!iterator.m1()) {
306
+ var maxElem = iterator.next_20eer_k$();
307
+ if (!iterator.hasNext_bitz1p_k$()) {
293
308
  tmp$ret$0 = maxElem;
294
309
  break $l$block_0;
295
310
  }
296
- var maxValue = maxElem.p4r_1;
311
+ var maxValue = maxElem.opcode_1;
297
312
  do {
298
- var e = iterator.n1();
299
- var v = e.p4r_1;
313
+ var e = iterator.next_20eer_k$();
314
+ var v = e.opcode_1;
300
315
  if (compareTo(maxValue, v) < 0) {
301
316
  maxElem = e;
302
317
  maxValue = v;
303
318
  }
304
319
  }
305
- while (iterator.m1());
320
+ while (iterator.hasNext_bitz1p_k$());
306
321
  tmp$ret$0 = maxElem;
307
322
  }
308
- tmp.q4r_1 = ensureNotNull(tmp$ret$0).p4r_1;
323
+ tmp.maxOpcode_1 = ensureNotNull(tmp$ret$0).opcode_1;
309
324
  var tmp_0 = this;
310
325
  var tmp_1 = 0;
311
- var tmp_2 = this.q4r_1 + 1 | 0;
326
+ var tmp_2 = this.maxOpcode_1 + 1 | 0;
312
327
  // Inline function 'kotlin.arrayOfNulls' call
313
328
  var tmp_3 = Array(tmp_2);
314
329
  while (tmp_1 < tmp_2) {
@@ -319,10 +334,10 @@ class Companion_1 {
319
334
  // Inline function 'kotlin.collections.singleOrNull' call
320
335
  var single = null;
321
336
  var found = false;
322
- var _iterator__ex2g4s = tmp0_0.l1();
323
- while (_iterator__ex2g4s.m1()) {
324
- var element = _iterator__ex2g4s.n1();
325
- if (element.p4r_1 === tmp_4) {
337
+ var _iterator__ex2g4s = tmp0_0.iterator_jk1svi_k$();
338
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
339
+ var element = _iterator__ex2g4s.next_20eer_k$();
340
+ if (element.opcode_1 === tmp_4) {
326
341
  if (found) {
327
342
  tmp$ret$5 = null;
328
343
  break $l$block_2;
@@ -340,56 +355,56 @@ class Companion_1 {
340
355
  tmp_3[tmp_4] = tmp$ret$5;
341
356
  tmp_1 = tmp_1 + 1 | 0;
342
357
  }
343
- tmp_0.r4r_1 = tmp_3;
358
+ tmp_0.byOpcodeArray_1 = tmp_3;
344
359
  }
345
360
  }
346
361
  class FrameType extends Enum {
347
362
  constructor(name, ordinal, controlFrame, opcode) {
348
363
  super(name, ordinal);
349
- this.o4r_1 = controlFrame;
350
- this.p4r_1 = opcode;
364
+ this.controlFrame_1 = controlFrame;
365
+ this.opcode_1 = opcode;
351
366
  }
352
367
  }
353
- class Companion_2 {
368
+ class Companion_3 {
354
369
  constructor() {
355
- Companion_instance_2 = this;
370
+ Companion_instance_4 = this;
356
371
  var tmp = this;
357
372
  // Inline function 'kotlin.apply' call
358
373
  var this_0 = new WebSocketChannelsConfig();
359
- this_0.q4p_1 = this_0.a4s();
360
- this_0.r4p_1 = this_0.a4s();
361
- tmp.p4p_1 = this_0;
374
+ this_0.incoming_1 = this_0.unlimited_v80n35_k$();
375
+ this_0.outgoing_1 = this_0.unlimited_v80n35_k$();
376
+ tmp.UNLIMITED_1 = this_0;
362
377
  }
363
378
  }
364
379
  class WebSocketChannelsConfig {
365
380
  constructor() {
366
381
  Companion_getInstance_2();
367
- this.q4p_1 = Companion_getInstance_3().b4s_1;
368
- this.r4p_1 = Companion_getInstance_3().b4s_1;
382
+ this.incoming_1 = Companion_getInstance_3().UNLIMITED_1;
383
+ this.outgoing_1 = Companion_getInstance_3().UNLIMITED_1;
369
384
  }
370
- a4s() {
371
- return Companion_getInstance_3().b4s_1;
385
+ unlimited_v80n35_k$() {
386
+ return Companion_getInstance_3().UNLIMITED_1;
372
387
  }
373
388
  }
374
- class Companion_3 {
389
+ class Companion_4 {
375
390
  constructor() {
376
- Companion_instance_3 = this;
377
- this.b4s_1 = new ChannelConfig(2147483647, ChannelOverflow_SUSPEND_getInstance());
391
+ Companion_instance_5 = this;
392
+ this.UNLIMITED_1 = new ChannelConfig(2147483647, ChannelOverflow_SUSPEND_getInstance());
378
393
  }
379
394
  }
380
395
  class ChannelConfig {
381
396
  constructor(capacity, onOverflow) {
382
397
  Companion_getInstance_3();
383
- this.c4s_1 = capacity;
384
- this.d4s_1 = onOverflow;
398
+ this.capacity_1 = capacity;
399
+ this.onOverflow_1 = onOverflow;
385
400
  }
386
- e4s() {
387
- return this.d4s_1.equals(ChannelOverflow_SUSPEND_getInstance()) && !(this.c4s_1 === 2147483647);
401
+ get_canSuspend_2zrbcb_k$() {
402
+ return this.onOverflow_1.equals(ChannelOverflow_SUSPEND_getInstance()) && !(this.capacity_1 === 2147483647);
388
403
  }
389
404
  }
390
405
  class ChannelOverflow extends Enum {}
391
- class Companion_4 {
392
- j4s(capacity) {
406
+ class Companion_5 {
407
+ createDelegate_n5r3h5_k$(capacity) {
393
408
  var channel = {_v: null};
394
409
  var tmp = BufferOverflow_DROP_OLDEST_getInstance();
395
410
  // Inline function 'kotlin.also' call
@@ -400,52 +415,52 @@ class Companion_4 {
400
415
  }
401
416
  class BoundedChannel {
402
417
  constructor(capacity, delegate) {
403
- delegate = delegate === VOID ? Companion_instance_4.j4s(capacity) : delegate;
404
- this.k4s_1 = delegate;
418
+ delegate = delegate === VOID ? Companion_instance_6.createDelegate_n5r3h5_k$(capacity) : delegate;
419
+ this.delegate_1 = delegate;
405
420
  }
406
- l4s(element) {
407
- var result = this.k4s_1.q36(element);
421
+ trySend_w1juo7_k$(element) {
422
+ var result = this.delegate_1.trySend_62dpg8_k$(element);
408
423
  if (!_ChannelResult___get_isSuccess__impl__odq1z9(result) && !_ChannelResult___get_isClosed__impl__mg7kuu(result)) {
409
- this.z36(ChannelOverflowException.i4s('Channel overflowed'));
424
+ this.close_ukldxa_k$(ChannelOverflowException.new_io_ktor_websocket_ChannelOverflowException_hoqwtd_k$('Channel overflowed'));
410
425
  }
411
426
  return result;
412
427
  }
413
- q36(element) {
414
- return this.l4s(element);
428
+ trySend_62dpg8_k$(element) {
429
+ return this.trySend_w1juo7_k$(element);
415
430
  }
416
- *m4s(element, $completion) {
417
- yield* this.k4s_1.p36(element, $completion);
431
+ *send_7nf3lq_k$(element, $completion) {
432
+ yield* this.delegate_1.send_44jogj_k$(element, $completion);
418
433
  return Unit_instance;
419
434
  }
420
- p36(element, $completion) {
421
- return this.m4s(element, $completion);
435
+ send_44jogj_k$(element, $completion) {
436
+ return this.send_7nf3lq_k$(element, $completion);
422
437
  }
423
- z36(cause) {
424
- return this.k4s_1.z36(cause);
438
+ close_ukldxa_k$(cause) {
439
+ return this.delegate_1.close_ukldxa_k$(cause);
425
440
  }
426
- i36() {
427
- return this.k4s_1.i36();
441
+ get_isClosedForSend_ajczci_k$() {
442
+ return this.delegate_1.get_isClosedForSend_ajczci_k$();
428
443
  }
429
- *n4s($completion) {
430
- return yield* this.k4s_1.s36($completion);
444
+ *receive_cnugsq_k$($completion) {
445
+ return yield* this.delegate_1.receive_awoumx_k$($completion);
431
446
  }
432
- s36($completion) {
433
- return this.n4s($completion);
447
+ receive_awoumx_k$($completion) {
448
+ return this.receive_cnugsq_k$($completion);
434
449
  }
435
- l1() {
436
- return this.k4s_1.l1();
450
+ iterator_jk1svi_k$() {
451
+ return this.delegate_1.iterator_jk1svi_k$();
437
452
  }
438
- y2s(cause) {
439
- this.k4s_1.y2s(cause);
453
+ cancel_hkmm2i_k$(cause) {
454
+ this.delegate_1.cancel_hkmm2i_k$(cause);
440
455
  }
441
456
  }
442
457
  class ChannelOverflowException extends RuntimeException {
443
458
  constructor(message) {
444
- return new.target.i4s(message);
459
+ return new.target.new_io_ktor_websocket_ChannelOverflowException_hoqwtd_k$(message);
445
460
  }
446
- static i4s(message) {
447
- var $this = this.bb(message);
448
- captureStack($this, $this.h4s_1);
461
+ static new_io_ktor_websocket_ChannelOverflowException_hoqwtd_k$(message) {
462
+ var $this = this.new_kotlin_RuntimeException_xu1s8h_k$(message);
463
+ captureStack($this, $this.$throwableCtor_3);
449
464
  return $this;
450
465
  }
451
466
  }
@@ -454,148 +469,149 @@ class WebSocketExtensionsConfig {
454
469
  constructor() {
455
470
  var tmp = this;
456
471
  // Inline function 'kotlin.collections.mutableListOf' call
457
- tmp.q4s_1 = ArrayList.f2();
472
+ tmp.installers_1 = ArrayList.new_kotlin_collections_ArrayList_ony0vx_k$();
458
473
  var tmp_0 = this;
459
474
  // Inline function 'kotlin.arrayOf' call
460
475
  // Inline function 'kotlin.js.unsafeCast' call
461
476
  // Inline function 'kotlin.js.asDynamic' call
462
- tmp_0.r4s_1 = [false, false, false];
477
+ tmp_0.rcv_1 = [false, false, false];
463
478
  }
464
- y1y() {
479
+ build_1k0s4u_k$() {
465
480
  // Inline function 'kotlin.collections.map' call
466
- var this_0 = this.q4s_1;
481
+ var this_0 = this.installers_1;
467
482
  // Inline function 'kotlin.collections.mapTo' call
468
- var destination = ArrayList.d2(collectionSizeOrDefault(this_0, 10));
469
- var _iterator__ex2g4s = this_0.l1();
470
- while (_iterator__ex2g4s.m1()) {
471
- var item = _iterator__ex2g4s.n1();
483
+ var destination = ArrayList.new_kotlin_collections_ArrayList_tdd6ob_k$(collectionSizeOrDefault(this_0, 10));
484
+ var _iterator__ex2g4s = this_0.iterator_jk1svi_k$();
485
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
486
+ var item = _iterator__ex2g4s.next_20eer_k$();
472
487
  var tmp$ret$2 = item();
473
- destination.e2(tmp$ret$2);
488
+ destination.add_utx5q5_k$(tmp$ret$2);
474
489
  }
475
490
  return destination;
476
491
  }
477
492
  }
478
493
  class WebSocketExtensionHeader {
479
494
  constructor(name, parameters) {
480
- this.s4s_1 = name;
481
- this.t4s_1 = parameters;
495
+ this.name_1 = name;
496
+ this.parameters_1 = parameters;
482
497
  }
483
498
  toString() {
484
- return this.s4s_1 + ' ' + parametersToString(this);
499
+ return this.name_1 + ' ' + parametersToString(this);
485
500
  }
486
501
  }
487
502
  class Frame {
488
- static c4t(fin, frameType, data, disposableHandle, rsv1, rsv2, rsv3) {
503
+ static new_io_ktor_websocket_Frame_fjyusq_k$(fin, frameType, data, disposableHandle, rsv1, rsv2, rsv3) {
489
504
  Companion_getInstance_5();
490
505
  disposableHandle = disposableHandle === VOID ? NonDisposableHandle_instance : disposableHandle;
491
506
  rsv1 = rsv1 === VOID ? false : rsv1;
492
507
  rsv2 = rsv2 === VOID ? false : rsv2;
493
508
  rsv3 = rsv3 === VOID ? false : rsv3;
494
509
  var $this = createThis(this);
495
- $this.o4q_1 = fin;
496
- $this.p4q_1 = frameType;
497
- $this.q4q_1 = data;
498
- $this.r4q_1 = disposableHandle;
499
- $this.s4q_1 = rsv1;
500
- $this.t4q_1 = rsv2;
501
- $this.u4q_1 = rsv3;
510
+ $this.fin_1 = fin;
511
+ $this.frameType_1 = frameType;
512
+ $this.data_1 = data;
513
+ $this.disposableHandle_1 = disposableHandle;
514
+ $this.rsv1__1 = rsv1;
515
+ $this.rsv2__1 = rsv2;
516
+ $this.rsv3__1 = rsv3;
517
+ validateSize($this);
502
518
  return $this;
503
519
  }
504
520
  toString() {
505
- return 'Frame ' + this.p4q_1.toString() + ' (fin=' + this.o4q_1 + ', buffer len = ' + this.q4q_1.length + ')';
521
+ return 'Frame ' + this.frameType_1.toString() + ' (fin=' + this.fin_1 + ', buffer len = ' + this.data_1.length + ')';
506
522
  }
507
523
  }
508
524
  class Binary extends Frame {
509
525
  constructor(fin, data, rsv1, rsv2, rsv3) {
510
- return new.target.b4t(fin, data, rsv1, rsv2, rsv3);
526
+ return new.target.new_io_ktor_websocket_Frame_Binary_yf73xr_k$(fin, data, rsv1, rsv2, rsv3);
511
527
  }
512
- static b4t(fin, data, rsv1, rsv2, rsv3) {
528
+ static new_io_ktor_websocket_Frame_Binary_yf73xr_k$(fin, data, rsv1, rsv2, rsv3) {
513
529
  rsv1 = rsv1 === VOID ? false : rsv1;
514
530
  rsv2 = rsv2 === VOID ? false : rsv2;
515
531
  rsv3 = rsv3 === VOID ? false : rsv3;
516
- return this.c4t(fin, FrameType_BINARY_getInstance(), data, NonDisposableHandle_instance, rsv1, rsv2, rsv3);
532
+ return this.new_io_ktor_websocket_Frame_fjyusq_k$(fin, FrameType_BINARY_getInstance(), data, NonDisposableHandle_instance, rsv1, rsv2, rsv3);
517
533
  }
518
- static d4t(fin, data) {
519
- return this.b4t(fin, data, false, false, false);
534
+ static new_io_ktor_websocket_Frame_Binary_dw7hrz_k$(fin, data) {
535
+ return this.new_io_ktor_websocket_Frame_Binary_yf73xr_k$(fin, data, false, false, false);
520
536
  }
521
537
  }
522
538
  class Text extends Frame {
523
539
  constructor(fin, data, rsv1, rsv2, rsv3) {
524
- return new.target.l4t(fin, data, rsv1, rsv2, rsv3);
540
+ return new.target.new_io_ktor_websocket_Frame_Text_sv4r43_k$(fin, data, rsv1, rsv2, rsv3);
525
541
  }
526
- static l4t(fin, data, rsv1, rsv2, rsv3) {
542
+ static new_io_ktor_websocket_Frame_Text_sv4r43_k$(fin, data, rsv1, rsv2, rsv3) {
527
543
  rsv1 = rsv1 === VOID ? false : rsv1;
528
544
  rsv2 = rsv2 === VOID ? false : rsv2;
529
545
  rsv3 = rsv3 === VOID ? false : rsv3;
530
- return this.c4t(fin, FrameType_TEXT_getInstance(), data, NonDisposableHandle_instance, rsv1, rsv2, rsv3);
546
+ return this.new_io_ktor_websocket_Frame_fjyusq_k$(fin, FrameType_TEXT_getInstance(), data, NonDisposableHandle_instance, rsv1, rsv2, rsv3);
531
547
  }
532
- static m4t(fin, data) {
533
- return this.l4t(fin, data, false, false, false);
548
+ static new_io_ktor_websocket_Frame_Text_ejsfdh_k$(fin, data) {
549
+ return this.new_io_ktor_websocket_Frame_Text_sv4r43_k$(fin, data, false, false, false);
534
550
  }
535
- static n4t(text) {
536
- return this.m4t(true, toByteArray(text));
551
+ static new_io_ktor_websocket_Frame_Text_j2nyd2_k$(text) {
552
+ return this.new_io_ktor_websocket_Frame_Text_ejsfdh_k$(true, toByteArray(text));
537
553
  }
538
554
  }
539
555
  class Close extends Frame {
540
556
  constructor(data) {
541
- return new.target.o4t(data);
557
+ return new.target.new_io_ktor_websocket_Frame_Close_1zir9_k$(data);
542
558
  }
543
- static o4t(data) {
544
- return this.c4t(true, FrameType_CLOSE_getInstance(), data, NonDisposableHandle_instance, false, false, false);
559
+ static new_io_ktor_websocket_Frame_Close_1zir9_k$(data) {
560
+ return this.new_io_ktor_websocket_Frame_fjyusq_k$(true, FrameType_CLOSE_getInstance(), data, NonDisposableHandle_instance, false, false, false);
545
561
  }
546
- static m4q(reason) {
562
+ static new_io_ktor_websocket_Frame_Close_zgly5v_k$(reason) {
547
563
  // Inline function 'io.ktor.utils.io.core.buildPacket' call
548
564
  var builder = new Buffer();
549
- builder.l1u(reason.e4p_1);
550
- writeText(builder, reason.f4p_1);
551
- return this.p4t(builder);
565
+ builder.writeShort_vn2jsb_k$(reason.code_1);
566
+ writeText(builder, reason.message_1);
567
+ return this.new_io_ktor_websocket_Frame_Close_dmkrzr_k$(builder);
552
568
  }
553
- static p4t(packet) {
554
- return this.o4t(readByteArray(packet));
569
+ static new_io_ktor_websocket_Frame_Close_dmkrzr_k$(packet) {
570
+ return this.new_io_ktor_websocket_Frame_Close_1zir9_k$(readByteArray(packet));
555
571
  }
556
- static q4t() {
557
- return this.o4t(Companion_getInstance_5().k4r_1);
572
+ static new_io_ktor_websocket_Frame_Close_ddsmnf_k$() {
573
+ return this.new_io_ktor_websocket_Frame_Close_1zir9_k$(Companion_getInstance_5().Empty_1);
558
574
  }
559
575
  }
560
576
  class Ping extends Frame {
561
577
  constructor(data) {
562
- return new.target.z4r(data);
578
+ return new.target.new_io_ktor_websocket_Frame_Ping_eh4ca3_k$(data);
563
579
  }
564
- static z4r(data) {
565
- return this.c4t(true, FrameType_PING_getInstance(), data, NonDisposableHandle_instance, false, false, false);
580
+ static new_io_ktor_websocket_Frame_Ping_eh4ca3_k$(data) {
581
+ return this.new_io_ktor_websocket_Frame_fjyusq_k$(true, FrameType_PING_getInstance(), data, NonDisposableHandle_instance, false, false, false);
566
582
  }
567
583
  }
568
584
  class Pong extends Frame {
569
585
  constructor(data, disposableHandle) {
570
- return new.target.j4r(data, disposableHandle);
586
+ return new.target.new_io_ktor_websocket_Frame_Pong_hee4xw_k$(data, disposableHandle);
571
587
  }
572
- static j4r(data, disposableHandle) {
588
+ static new_io_ktor_websocket_Frame_Pong_hee4xw_k$(data, disposableHandle) {
573
589
  disposableHandle = disposableHandle === VOID ? NonDisposableHandle_instance : disposableHandle;
574
- return this.c4t(true, FrameType_PONG_getInstance(), data, disposableHandle, false, false, false);
590
+ return this.new_io_ktor_websocket_Frame_fjyusq_k$(true, FrameType_PONG_getInstance(), data, disposableHandle, false, false, false);
575
591
  }
576
592
  }
577
- class Companion_5 {
593
+ class Companion_6 {
578
594
  constructor() {
579
- Companion_instance_5 = this;
580
- this.k4r_1 = new Int8Array(0);
595
+ Companion_instance_7 = this;
596
+ this.Empty_1 = new Int8Array(0);
581
597
  }
582
- l4r(fin, frameType, data, rsv1, rsv2, rsv3) {
598
+ byType_2g4m5x_k$(fin, frameType, data, rsv1, rsv2, rsv3) {
583
599
  var tmp;
584
- switch (frameType.s1_1) {
600
+ switch (frameType.ordinal_1) {
585
601
  case 1:
586
- tmp = Binary.b4t(fin, data, rsv1, rsv2, rsv3);
602
+ tmp = Binary.new_io_ktor_websocket_Frame_Binary_yf73xr_k$(fin, data, rsv1, rsv2, rsv3);
587
603
  break;
588
604
  case 0:
589
- tmp = Text.l4t(fin, data, rsv1, rsv2, rsv3);
605
+ tmp = Text.new_io_ktor_websocket_Frame_Text_sv4r43_k$(fin, data, rsv1, rsv2, rsv3);
590
606
  break;
591
607
  case 2:
592
- tmp = Close.o4t(data);
608
+ tmp = Close.new_io_ktor_websocket_Frame_Close_1zir9_k$(data);
593
609
  break;
594
610
  case 3:
595
- tmp = Ping.z4r(data);
611
+ tmp = Ping.new_io_ktor_websocket_Frame_Ping_eh4ca3_k$(data);
596
612
  break;
597
613
  case 4:
598
- tmp = Pong.j4r(data, NonDisposableHandle_instance);
614
+ tmp = Pong.new_io_ktor_websocket_Frame_Pong_hee4xw_k$(data, NonDisposableHandle_instance);
599
615
  break;
600
616
  default:
601
617
  noWhenBranchMatchedException();
@@ -605,6 +621,28 @@ class Companion_5 {
605
621
  }
606
622
  }
607
623
  //endregion
624
+ var static_init_called;
625
+ function static_init() {
626
+ if (static_init_called)
627
+ return Unit_instance;
628
+ static_init_called = true;
629
+ Codes_NORMAL_instance = new Codes('NORMAL', 0, 1000);
630
+ Codes_GOING_AWAY_instance = new Codes('GOING_AWAY', 1, 1001);
631
+ Codes_PROTOCOL_ERROR_instance = new Codes('PROTOCOL_ERROR', 2, 1002);
632
+ Codes_CANNOT_ACCEPT_instance = new Codes('CANNOT_ACCEPT', 3, 1003);
633
+ Codes_CLOSED_ABNORMALLY_instance = new Codes('CLOSED_ABNORMALLY', 4, 1006);
634
+ Codes_NOT_CONSISTENT_instance = new Codes('NOT_CONSISTENT', 5, 1007);
635
+ Codes_VIOLATED_POLICY_instance = new Codes('VIOLATED_POLICY', 6, 1008);
636
+ Codes_TOO_BIG_instance = new Codes('TOO_BIG', 7, 1009);
637
+ Codes_NO_EXTENSION_instance = new Codes('NO_EXTENSION', 8, 1010);
638
+ Codes_INTERNAL_ERROR_instance = new Codes('INTERNAL_ERROR', 9, 1011);
639
+ Codes_SERVICE_RESTART_instance = new Codes('SERVICE_RESTART', 10, 1012);
640
+ Codes_TRY_AGAIN_LATER_instance = new Codes('TRY_AGAIN_LATER', 11, 1013);
641
+ if (Companion_instance_0 === VOID) {
642
+ Companion_instance;
643
+ new Companion();
644
+ }
645
+ }
608
646
  var Codes_NORMAL_instance;
609
647
  var Codes_GOING_AWAY_instance;
610
648
  var Codes_PROTOCOL_ERROR_instance;
@@ -617,89 +655,109 @@ var Codes_NO_EXTENSION_instance;
617
655
  var Codes_INTERNAL_ERROR_instance;
618
656
  var Codes_SERVICE_RESTART_instance;
619
657
  var Codes_TRY_AGAIN_LATER_instance;
620
- var Companion_instance;
658
+ var Companion_instance_0;
621
659
  function Companion_getInstance() {
622
- Codes_initEntries();
623
- if (Companion_instance === VOID)
624
- new Companion();
625
- return Companion_instance;
660
+ static_init();
661
+ return Companion_instance_0;
626
662
  }
627
663
  function values() {
664
+ static_init();
628
665
  return [Codes_NORMAL_getInstance(), Codes_GOING_AWAY_getInstance(), Codes_PROTOCOL_ERROR_getInstance(), Codes_CANNOT_ACCEPT_getInstance(), Codes_CLOSED_ABNORMALLY_getInstance(), Codes_NOT_CONSISTENT_getInstance(), Codes_VIOLATED_POLICY_getInstance(), Codes_TOO_BIG_getInstance(), Codes_NO_EXTENSION_getInstance(), Codes_INTERNAL_ERROR_getInstance(), Codes_SERVICE_RESTART_getInstance(), Codes_TRY_AGAIN_LATER_getInstance()];
629
666
  }
630
667
  function get_entries() {
668
+ static_init();
631
669
  if ($ENTRIES == null)
632
670
  $ENTRIES = enumEntries(values());
633
671
  return $ENTRIES;
634
672
  }
635
- var Codes_entriesInitialized;
636
- function Codes_initEntries() {
637
- if (Codes_entriesInitialized)
638
- return Unit_instance;
639
- Codes_entriesInitialized = true;
640
- Codes_NORMAL_instance = new Codes('NORMAL', 0, 1000);
641
- Codes_GOING_AWAY_instance = new Codes('GOING_AWAY', 1, 1001);
642
- Codes_PROTOCOL_ERROR_instance = new Codes('PROTOCOL_ERROR', 2, 1002);
643
- Codes_CANNOT_ACCEPT_instance = new Codes('CANNOT_ACCEPT', 3, 1003);
644
- Codes_CLOSED_ABNORMALLY_instance = new Codes('CLOSED_ABNORMALLY', 4, 1006);
645
- Codes_NOT_CONSISTENT_instance = new Codes('NOT_CONSISTENT', 5, 1007);
646
- Codes_VIOLATED_POLICY_instance = new Codes('VIOLATED_POLICY', 6, 1008);
647
- Codes_TOO_BIG_instance = new Codes('TOO_BIG', 7, 1009);
648
- Codes_NO_EXTENSION_instance = new Codes('NO_EXTENSION', 8, 1010);
649
- Codes_INTERNAL_ERROR_instance = new Codes('INTERNAL_ERROR', 9, 1011);
650
- Codes_SERVICE_RESTART_instance = new Codes('SERVICE_RESTART', 10, 1012);
651
- Codes_TRY_AGAIN_LATER_instance = new Codes('TRY_AGAIN_LATER', 11, 1013);
652
- Companion_getInstance();
653
- }
654
673
  var $ENTRIES;
674
+ var Companion_instance_1;
675
+ function Companion_getInstance_0() {
676
+ return Companion_instance_1;
677
+ }
655
678
  function Codes_NORMAL_getInstance() {
656
- Codes_initEntries();
679
+ static_init();
657
680
  return Codes_NORMAL_instance;
658
681
  }
659
682
  function Codes_GOING_AWAY_getInstance() {
660
- Codes_initEntries();
683
+ static_init();
661
684
  return Codes_GOING_AWAY_instance;
662
685
  }
663
686
  function Codes_PROTOCOL_ERROR_getInstance() {
664
- Codes_initEntries();
687
+ static_init();
665
688
  return Codes_PROTOCOL_ERROR_instance;
666
689
  }
667
690
  function Codes_CANNOT_ACCEPT_getInstance() {
668
- Codes_initEntries();
691
+ static_init();
669
692
  return Codes_CANNOT_ACCEPT_instance;
670
693
  }
671
694
  function Codes_CLOSED_ABNORMALLY_getInstance() {
672
- Codes_initEntries();
695
+ static_init();
673
696
  return Codes_CLOSED_ABNORMALLY_instance;
674
697
  }
675
698
  function Codes_NOT_CONSISTENT_getInstance() {
676
- Codes_initEntries();
699
+ static_init();
677
700
  return Codes_NOT_CONSISTENT_instance;
678
701
  }
679
702
  function Codes_VIOLATED_POLICY_getInstance() {
680
- Codes_initEntries();
703
+ static_init();
681
704
  return Codes_VIOLATED_POLICY_instance;
682
705
  }
683
706
  function Codes_TOO_BIG_getInstance() {
684
- Codes_initEntries();
707
+ static_init();
685
708
  return Codes_TOO_BIG_instance;
686
709
  }
687
710
  function Codes_NO_EXTENSION_getInstance() {
688
- Codes_initEntries();
711
+ static_init();
689
712
  return Codes_NO_EXTENSION_instance;
690
713
  }
691
714
  function Codes_INTERNAL_ERROR_getInstance() {
692
- Codes_initEntries();
715
+ static_init();
693
716
  return Codes_INTERNAL_ERROR_instance;
694
717
  }
695
718
  function Codes_SERVICE_RESTART_getInstance() {
696
- Codes_initEntries();
719
+ static_init();
697
720
  return Codes_SERVICE_RESTART_instance;
698
721
  }
699
722
  function Codes_TRY_AGAIN_LATER_getInstance() {
700
- Codes_initEntries();
723
+ static_init();
701
724
  return Codes_TRY_AGAIN_LATER_instance;
702
725
  }
726
+ function utf8Size(_this__u8e3s4) {
727
+ var size = 0;
728
+ var index = 0;
729
+ while (index < _this__u8e3s4.length) {
730
+ var bytes = utf8ByteCountAt(_this__u8e3s4, index);
731
+ size = size + bytes | 0;
732
+ index = index + (bytes === 4 ? 2 : 1) | 0;
733
+ }
734
+ return size;
735
+ }
736
+ function utf8Truncate(_this__u8e3s4, maxSize) {
737
+ var size = 0;
738
+ var index = 0;
739
+ $l$loop: while (index < _this__u8e3s4.length) {
740
+ var bytes = utf8ByteCountAt(_this__u8e3s4, index);
741
+ if ((size + bytes | 0) > maxSize)
742
+ break $l$loop;
743
+ size = size + bytes | 0;
744
+ index = index + (bytes === 4 ? 2 : 1) | 0;
745
+ }
746
+ return index === _this__u8e3s4.length ? _this__u8e3s4 : substring(_this__u8e3s4, 0, index);
747
+ }
748
+ function utf8ByteCountAt(_this__u8e3s4, index) {
749
+ // Inline function 'kotlin.code' call
750
+ var this_0 = charCodeAt(_this__u8e3s4, index);
751
+ var code = Char__toInt_impl_vasixd(this_0);
752
+ return code < 128 ? 1 : code < 2048 ? 2 : isHighSurrogate(charCodeAt(_this__u8e3s4, index)) && (index + 1 | 0) < _this__u8e3s4.length && isLowSurrogate(charCodeAt(_this__u8e3s4, index + 1 | 0)) ? 4 : 3;
753
+ }
754
+ function validateSize(_this__u8e3s4) {
755
+ // Inline function 'kotlin.require' call
756
+ if (!(!_this__u8e3s4.frameType_1.controlFrame_1 || _this__u8e3s4.data_1.length <= 125)) {
757
+ var message = 'Control frames must not exceed 125 bytes per RFC 6455, ' + ('but ' + _this__u8e3s4.frameType_1.toString() + ' frame has ' + _this__u8e3s4.data_1.length + ' bytes');
758
+ throw IllegalArgumentException.new_kotlin_IllegalArgumentException_sfqr8_k$(toString(message));
759
+ }
760
+ }
703
761
  function get_LOGGER() {
704
762
  _init_properties_DefaultWebSocketSession_kt__469s0y();
705
763
  return LOGGER;
@@ -724,33 +782,33 @@ var OUTGOING_CHANNEL_CONFIG;
724
782
  function DefaultWebSocketSession_0(session, pingIntervalMillis, timeoutMillis, channelsConfig) {
725
783
  pingIntervalMillis = pingIntervalMillis === VOID ? 0n : pingIntervalMillis;
726
784
  timeoutMillis = timeoutMillis === VOID ? 15000n : timeoutMillis;
727
- channelsConfig = channelsConfig === VOID ? Companion_getInstance_2().p4p_1 : channelsConfig;
785
+ channelsConfig = channelsConfig === VOID ? Companion_getInstance_2().UNLIMITED_1 : channelsConfig;
728
786
  _init_properties_DefaultWebSocketSession_kt__469s0y();
729
787
  // Inline function 'kotlin.require' call
730
788
  if (!!isInterface(session, DefaultWebSocketSession)) {
731
789
  var message = 'Cannot wrap other DefaultWebSocketSession';
732
- throw IllegalArgumentException.n2(toString(message));
790
+ throw IllegalArgumentException.new_kotlin_IllegalArgumentException_sfqr8_k$(toString(message));
733
791
  }
734
- return new DefaultWebSocketSessionImpl(session, pingIntervalMillis, timeoutMillis, channelsConfig.q4p_1, channelsConfig.r4p_1);
792
+ return new DefaultWebSocketSessionImpl(session, pingIntervalMillis, timeoutMillis, channelsConfig.incoming_1, channelsConfig.outgoing_1);
735
793
  }
736
794
  function runIncomingProcessor($this, ponger) {
737
- var tmp = get_IncomingProcessorCoroutineName().xl(Dispatchers_getInstance().r32_1);
795
+ var tmp = get_IncomingProcessorCoroutineName().plus_s13ygv_k$(Dispatchers_getInstance().Unconfined_1);
738
796
  return launch($this, tmp, VOID, DefaultWebSocketSessionImpl$runIncomingProcessor$slambda($this, ponger));
739
797
  }
740
798
  function runOutgoingProcessor($this) {
741
- var tmp = get_OutgoingProcessorCoroutineName().xl(Dispatchers_getInstance().r32_1);
799
+ var tmp = get_OutgoingProcessorCoroutineName().plus_s13ygv_k$(Dispatchers_getInstance().Unconfined_1);
742
800
  var tmp_0 = CoroutineStart_UNDISPATCHED_getInstance();
743
801
  return launch($this, tmp, tmp_0, DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda($this));
744
802
  }
745
803
  function *outgoingProcessorLoop($this, $completion) {
746
- var _iterator__ex2g4s = $this.y4p_1.l1();
747
- $l$loop: while (yield* _iterator__ex2g4s.b36($completion)) {
748
- var frame = _iterator__ex2g4s.n1();
804
+ var _iterator__ex2g4s = $this.outgoingToBeProcessed_1.iterator_jk1svi_k$();
805
+ $l$loop: while (yield* _iterator__ex2g4s.hasNext_nhy1w3_k$($completion)) {
806
+ var frame = _iterator__ex2g4s.next_20eer_k$();
749
807
  // Inline function 'io.ktor.util.logging.trace' call
750
808
  var this_0 = get_LOGGER();
751
809
  if (get_isTraceEnabled(this_0)) {
752
810
  var tmp$ret$1 = 'Sending ' + frame.toString() + ' from session ' + toString($this);
753
- this_0.k48(tmp$ret$1);
811
+ this_0.trace_fti9bv_k$(tmp$ret$1);
754
812
  }
755
813
  var tmp;
756
814
  if (frame instanceof Close) {
@@ -770,7 +828,7 @@ function *outgoingProcessorLoop($this, $completion) {
770
828
  }
771
829
  }
772
830
  var processedFrame = tmp;
773
- yield* $this.s4p_1.n4p().p36(processedFrame, $completion);
831
+ yield* $this.raw_1.get_outgoing_us7o3v_k$().send_44jogj_k$(processedFrame, $completion);
774
832
  }
775
833
  return Unit_instance;
776
834
  }
@@ -782,165 +840,165 @@ function *sendCloseSequence($this, reason, exception, $completion) {
782
840
  var this_0 = get_LOGGER();
783
841
  if (get_isTraceEnabled(this_0)) {
784
842
  var tmp$ret$1 = 'Sending Close Sequence for session ' + toString($this) + ' with reason ' + toString_0(reason) + ' and exception ' + toString_0(exception);
785
- this_0.k48(tmp$ret$1);
843
+ this_0.trace_fti9bv_k$(tmp$ret$1);
786
844
  }
787
- $this.v4p_1.e2y();
788
- var reasonToSend = reason == null ? CloseReason.h4p(Codes_NORMAL_getInstance(), '') : reason;
845
+ $this.context_1.complete_9ww6vb_k$();
846
+ var reasonToSend = reason == null ? CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_NORMAL_getInstance(), '') : reason;
789
847
  try {
790
848
  runOrCancelPinger($this);
791
- if (!(reasonToSend.e4p_1 === Codes_CLOSED_ABNORMALLY_getInstance().a4p_1)) {
792
- yield* $this.s4p_1.n4p().p36(Close.m4q(reasonToSend), $completion);
849
+ if (!(reasonToSend.code_1 === Codes_CLOSED_ABNORMALLY_getInstance().code_1)) {
850
+ yield* $this.raw_1.get_outgoing_us7o3v_k$().send_44jogj_k$(Close.new_io_ktor_websocket_Frame_Close_zgly5v_k$(reasonToSend), $completion);
793
851
  }
794
852
  }finally {
795
- $this.u4p_1.c2y(reasonToSend);
853
+ $this.closeReasonRef_1.complete_ixf84q_k$(reasonToSend);
796
854
  if (!(exception == null)) {
797
- $this.y4p_1.z36(exception);
798
- $this.x4p_1.z36(exception);
855
+ $this.outgoingToBeProcessed_1.close_ukldxa_k$(exception);
856
+ $this.filtered_1.close_ukldxa_k$(exception);
799
857
  }
800
858
  }
801
859
  return Unit_instance;
802
860
  }
803
861
  function tryClose($this) {
804
- return $this.z4p_1.atomicfu$compareAndSet(false, true);
862
+ return $this.closed_1.atomicfu$compareAndSet(false, true);
805
863
  }
806
864
  function runOrCancelPinger($this) {
807
- var interval = $this.c4q_1;
865
+ var interval = $this.pingIntervalMillis_1;
808
866
  var tmp;
809
- if ($this.z4p_1.kotlinx$atomicfu$value) {
867
+ if ($this.closed_1.kotlinx$atomicfu$value) {
810
868
  tmp = null;
811
869
  } else if (interval > 0n) {
812
- var tmp_0 = $this.s4p_1.n4p();
813
- var tmp_1 = $this.d4q_1;
870
+ var tmp_0 = $this.raw_1.get_outgoing_us7o3v_k$();
871
+ var tmp_1 = $this.timeoutMillis_1;
814
872
  tmp = pinger($this, tmp_0, interval, tmp_1, DefaultWebSocketSessionImpl$runOrCancelPinger$slambda($this));
815
873
  } else {
816
874
  tmp = null;
817
875
  }
818
876
  var newPinger = tmp;
819
- var tmp0_safe_receiver = $this.t4p_1.atomicfu$getAndSet(newPinger);
877
+ var tmp0_safe_receiver = $this.pinger_1.atomicfu$getAndSet(newPinger);
820
878
  if (tmp0_safe_receiver == null)
821
879
  null;
822
880
  else
823
- tmp0_safe_receiver.b37();
824
- var tmp2_safe_receiver = newPinger == null ? null : new ChannelResult(newPinger.q36(Companion_getInstance_0().n4q_1));
881
+ tmp0_safe_receiver.close$default_kcbl7u_k$();
882
+ var tmp2_safe_receiver = newPinger == null ? null : new ChannelResult(newPinger.trySend_62dpg8_k$(Companion_getInstance_1().EmptyPong_1));
825
883
  if (tmp2_safe_receiver == null)
826
884
  null;
827
885
  else
828
- _ChannelResult___get_isSuccess__impl__odq1z9(tmp2_safe_receiver.o36_1);
829
- if ($this.z4p_1.kotlinx$atomicfu$value && !(newPinger == null)) {
886
+ _ChannelResult___get_isSuccess__impl__odq1z9(tmp2_safe_receiver.holder_1);
887
+ if ($this.closed_1.kotlinx$atomicfu$value && !(newPinger == null)) {
830
888
  runOrCancelPinger($this);
831
889
  }
832
890
  }
833
891
  function *checkMaxFrameSize($this, packet, frame, $completion) {
834
- var tmp = frame.q4q_1.length;
892
+ var tmp = frame.data_1.length;
835
893
  var tmp1_elvis_lhs = packet == null ? null : get_size(packet);
836
894
  var size = tmp + (tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs) | 0;
837
- if (fromInt(size) > $this.l4p()) {
895
+ if (fromInt(size) > $this.get_maxFrameSize_9zaht9_k$()) {
838
896
  if (packet == null)
839
897
  null;
840
898
  else {
841
- packet.q6();
899
+ packet.close_yn9xrc_k$();
842
900
  }
843
- yield* close($this, CloseReason.h4p(Codes_TOO_BIG_getInstance(), 'Frame is too big: ' + size + '. Max size is ' + $this.l4p().toString()), $completion);
844
- throw FrameTooBigException.y4q(fromInt(size));
901
+ yield* close($this, CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_TOO_BIG_getInstance(), 'Frame is too big: ' + size + '. Max size is ' + $this.get_maxFrameSize_9zaht9_k$().toString()), $completion);
902
+ throw FrameTooBigException.new_io_ktor_websocket_FrameTooBigException_7tb0yi_k$(fromInt(size));
845
903
  }
846
904
  return Unit_instance;
847
905
  }
848
906
  function processIncomingExtensions($this, frame) {
849
907
  // Inline function 'kotlin.collections.fold' call
850
908
  var accumulator = frame;
851
- var _iterator__ex2g4s = $this.z4q().l1();
852
- while (_iterator__ex2g4s.m1()) {
853
- var element = _iterator__ex2g4s.n1();
909
+ var _iterator__ex2g4s = $this.get_extensions_kxksyl_k$().iterator_jk1svi_k$();
910
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
911
+ var element = _iterator__ex2g4s.next_20eer_k$();
854
912
  var current = accumulator;
855
- accumulator = element.a4r(current);
913
+ accumulator = element.processIncomingFrame_lcwqbj_k$(current);
856
914
  }
857
915
  return accumulator;
858
916
  }
859
917
  function processOutgoingExtensions($this, frame) {
860
918
  // Inline function 'kotlin.collections.fold' call
861
919
  var accumulator = frame;
862
- var _iterator__ex2g4s = $this.z4q().l1();
863
- while (_iterator__ex2g4s.m1()) {
864
- var element = _iterator__ex2g4s.n1();
920
+ var _iterator__ex2g4s = $this.get_extensions_kxksyl_k$().iterator_jk1svi_k$();
921
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
922
+ var element = _iterator__ex2g4s.next_20eer_k$();
865
923
  var current = accumulator;
866
- accumulator = element.b4r(current);
924
+ accumulator = element.processOutgoingFrame_8xceij_k$(current);
867
925
  }
868
926
  return accumulator;
869
927
  }
870
- var Companion_instance_0;
871
- function Companion_getInstance_0() {
872
- if (Companion_instance_0 === VOID)
873
- new Companion_0();
874
- return Companion_instance_0;
928
+ var Companion_instance_2;
929
+ function Companion_getInstance_1() {
930
+ if (Companion_instance_2 === VOID)
931
+ new Companion_1();
932
+ return Companion_instance_2;
875
933
  }
876
934
  function DefaultWebSocketSessionImpl$start$slambda($incomingJob, $outgoingJob, this$0) {
877
- return constructCallableReference(function *($this$launch, $completion) {
878
- yield* $incomingJob.v2s($completion);
879
- yield* $outgoingJob.v2s($completion);
880
- this$0.v4p_1.z2s();
935
+ return constructCallableReference(($this$launch, $completion) => orPromise($completion, function *($completion) {
936
+ yield* $incomingJob.join_o20dar_k$($completion);
937
+ yield* $outgoingJob.join_o20dar_k$($completion);
938
+ this$0.context_1.cancel$default_8haxne_k$();
881
939
  return Unit_instance;
882
- }, 1);
940
+ }), 1);
883
941
  }
884
942
  function DefaultWebSocketSessionImpl$runIncomingProcessor$slambda(this$0, $ponger) {
885
- return constructCallableReference(function *($this$launch, $completion) {
943
+ return constructCallableReference(($this$launch, $completion) => orPromise($completion, function *($completion) {
886
944
  var firstFrame = null;
887
945
  var frameBody = null;
888
946
  var closeFramePresented = false;
889
947
  try {
890
948
  // Inline function 'kotlinx.coroutines.channels.consumeEach' call
891
- var tmp0 = this$0.s4p_1.m4p();
949
+ var tmp0 = this$0.raw_1.get_incoming_u9os29_k$();
892
950
  $l$block_1: {
893
951
  // Inline function 'kotlinx.coroutines.channels.consume' call
894
952
  var cause = null;
895
953
  try {
896
- var _iterator__ex2g4s = tmp0.l1();
897
- while (yield* _iterator__ex2g4s.b36($completion)) {
898
- var e = _iterator__ex2g4s.n1();
954
+ var _iterator__ex2g4s = tmp0.iterator_jk1svi_k$();
955
+ while (yield* _iterator__ex2g4s.hasNext_nhy1w3_k$($completion)) {
956
+ var e = _iterator__ex2g4s.next_20eer_k$();
899
957
  $l$block_0: {
900
958
  // Inline function 'io.ktor.util.logging.trace' call
901
959
  var this_0 = get_LOGGER();
902
960
  if (get_isTraceEnabled(this_0)) {
903
961
  var tmp$ret$5 = 'WebSocketSession(' + toString($this$launch) + ') receiving frame ' + e.toString();
904
- this_0.k48(tmp$ret$5);
962
+ this_0.trace_fti9bv_k$(tmp$ret$5);
905
963
  }
906
964
  if (e instanceof Close) {
907
- if (!this$0.n4p().i36()) {
908
- var tmp = this$0.n4p();
965
+ if (!this$0.get_outgoing_us7o3v_k$().get_isClosedForSend_ajczci_k$()) {
966
+ var tmp = this$0.get_outgoing_us7o3v_k$();
909
967
  var tmp1_elvis_lhs = readReason(e);
910
- yield* tmp.p36(Close.m4q(tmp1_elvis_lhs == null ? get_NORMAL_CLOSE() : tmp1_elvis_lhs), $completion);
968
+ yield* tmp.send_44jogj_k$(Close.new_io_ktor_websocket_Frame_Close_zgly5v_k$(tmp1_elvis_lhs == null ? get_NORMAL_CLOSE() : tmp1_elvis_lhs), $completion);
911
969
  }
912
970
  closeFramePresented = true;
913
971
  return Unit_instance;
914
972
  } else {
915
973
  if (e instanceof Pong) {
916
- var tmp2_safe_receiver = this$0.t4p_1.kotlinx$atomicfu$value;
974
+ var tmp2_safe_receiver = this$0.pinger_1.kotlinx$atomicfu$value;
917
975
  if (tmp2_safe_receiver == null)
918
976
  null;
919
977
  else
920
- yield* tmp2_safe_receiver.p36(e, $completion);
978
+ yield* tmp2_safe_receiver.send_44jogj_k$(e, $completion);
921
979
  } else {
922
980
  if (e instanceof Ping)
923
- yield* $ponger.p36(e, $completion);
981
+ yield* $ponger.send_44jogj_k$(e, $completion);
924
982
  else {
925
983
  yield* /*#__NOINLINE__*/checkMaxFrameSize(this$0, frameBody, e, $completion);
926
- if (!e.o4q_1) {
984
+ if (!e.fin_1) {
927
985
  if (firstFrame == null) {
928
986
  firstFrame = e;
929
987
  }
930
988
  if (frameBody == null) {
931
989
  frameBody = BytePacketBuilder();
932
990
  }
933
- writeFully(frameBody, e.q4q_1);
991
+ writeFully(frameBody, e.data_1);
934
992
  break $l$block_0;
935
993
  }
936
994
  if (firstFrame == null) {
937
- yield* this$0.x4p_1.p36(processIncomingExtensions(this$0, e), $completion);
995
+ yield* this$0.filtered_1.send_44jogj_k$(processIncomingExtensions(this$0, e), $completion);
938
996
  break $l$block_0;
939
997
  }
940
- writeFully(ensureNotNull(frameBody), e.q4q_1);
941
- var defragmented = Companion_getInstance_5().l4r(true, firstFrame.p4q_1, readByteArray(build(frameBody)), firstFrame.s4q_1, firstFrame.t4q_1, firstFrame.u4q_1);
998
+ writeFully(ensureNotNull(frameBody), e.data_1);
999
+ var defragmented = Companion_getInstance_5().byType_2g4m5x_k$(true, firstFrame.frameType_1, readByteArray(build(frameBody)), firstFrame.rsv1__1, firstFrame.rsv2__1, firstFrame.rsv3__1);
942
1000
  firstFrame = null;
943
- yield* this$0.x4p_1.p36(processIncomingExtensions(this$0, defragmented), $completion);
1001
+ yield* this$0.filtered_1.send_44jogj_k$(processIncomingExtensions(this$0, defragmented), $completion);
944
1002
  }
945
1003
  }
946
1004
  }
@@ -966,31 +1024,31 @@ function DefaultWebSocketSessionImpl$runIncomingProcessor$slambda(this$0, $ponge
966
1024
  } else {
967
1025
  if ($p_0 instanceof Error) {
968
1026
  var cause_0 = $p_0;
969
- $ponger.b37();
970
- this$0.x4p_1.z36(cause_0);
1027
+ $ponger.close$default_kcbl7u_k$();
1028
+ this$0.filtered_1.close_ukldxa_k$(cause_0);
971
1029
  } else {
972
1030
  throw $p_0;
973
1031
  }
974
1032
  }
975
1033
  }
976
1034
  finally {
977
- $ponger.b37();
1035
+ $ponger.close$default_kcbl7u_k$();
978
1036
  var tmp0_safe_receiver = frameBody;
979
1037
  if (tmp0_safe_receiver == null)
980
1038
  null;
981
1039
  else {
982
- tmp0_safe_receiver.q6();
1040
+ tmp0_safe_receiver.close_yn9xrc_k$();
983
1041
  }
984
- this$0.x4p_1.b37();
1042
+ this$0.filtered_1.close$default_kcbl7u_k$();
985
1043
  if (!closeFramePresented) {
986
- yield* close(this$0, CloseReason.h4p(Codes_CLOSED_ABNORMALLY_getInstance(), 'Connection was closed without close frame'), $completion);
1044
+ yield* close(this$0, CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_CLOSED_ABNORMALLY_getInstance(), 'Connection was closed without close frame'), $completion);
987
1045
  }
988
1046
  }
989
1047
  return Unit_instance;
990
- }, 1);
1048
+ }), 1);
991
1049
  }
992
1050
  function DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this$0) {
993
- return constructCallableReference(function *($this$launch, $completion) {
1051
+ return constructCallableReference(($this$launch, $completion) => orPromise($completion, function *($completion) {
994
1052
  var tmp;
995
1053
  try {
996
1054
  tmp = yield* /*#__NOINLINE__*/outgoingProcessorLoop(this$0, $completion);
@@ -1006,7 +1064,7 @@ function DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this$0) {
1006
1064
  } else {
1007
1065
  if ($p instanceof CancellationException) {
1008
1066
  var _unused_var__etf5q3_1 = $p;
1009
- tmp_0 = yield* /*#__NOINLINE__*/sendCloseSequence(this$0, CloseReason.h4p(Codes_NORMAL_getInstance(), ''), VOID, $completion);
1067
+ tmp_0 = yield* /*#__NOINLINE__*/sendCloseSequence(this$0, CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_NORMAL_getInstance(), ''), VOID, $completion);
1010
1068
  } else {
1011
1069
  if ($p instanceof ChannelIOException) {
1012
1070
  var _unused_var__etf5q3_2 = $p;
@@ -1014,8 +1072,8 @@ function DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this$0) {
1014
1072
  } else {
1015
1073
  if ($p instanceof Error) {
1016
1074
  var cause = $p;
1017
- this$0.y4p_1.y2s(CancellationException.p('Failed to send frame', cause));
1018
- yield* closeExceptionally(this$0.s4p_1, cause, $completion);
1075
+ this$0.outgoingToBeProcessed_1.cancel_hkmm2i_k$(CancellationException.new_kotlin_coroutines_cancellation_CancellationException_cpsifs_k$('Failed to send frame', cause));
1076
+ yield* closeExceptionally(this$0.raw_1, cause, $completion);
1019
1077
  return Unit_instance;
1020
1078
  } else {
1021
1079
  throw $p;
@@ -1027,17 +1085,17 @@ function DefaultWebSocketSessionImpl$runOutgoingProcessor$slambda(this$0) {
1027
1085
  tmp = tmp_0;
1028
1086
  }
1029
1087
  finally {
1030
- this$0.y4p_1.d37();
1031
- yield* close(this$0.s4p_1, VOID, $completion);
1088
+ this$0.outgoingToBeProcessed_1.cancel$default_880p35_k$();
1089
+ yield* close(this$0.raw_1, VOID, $completion);
1032
1090
  }
1033
1091
  return Unit_instance;
1034
- }, 1);
1092
+ }), 1);
1035
1093
  }
1036
1094
  function DefaultWebSocketSessionImpl$runOrCancelPinger$slambda(this$0) {
1037
- return constructCallableReference(function *(it, $completion) {
1038
- yield* /*#__NOINLINE__*/sendCloseSequence(this$0, it, IOException.x1v('Ping timeout'), $completion);
1095
+ return constructCallableReference((it, $completion) => orPromise($completion, function *($completion) {
1096
+ yield* /*#__NOINLINE__*/sendCloseSequence(this$0, it, IOException.new_kotlinx_io_IOException_wvwdyo_k$('Ping timeout'), $completion);
1039
1097
  return Unit_instance;
1040
- }, 1);
1098
+ }), 1);
1041
1099
  }
1042
1100
  var properties_initialized_DefaultWebSocketSession_kt_6cjlhc;
1043
1101
  function _init_properties_DefaultWebSocketSession_kt__469s0y() {
@@ -1046,7 +1104,7 @@ function _init_properties_DefaultWebSocketSession_kt__469s0y() {
1046
1104
  LOGGER = KtorSimpleLogger('io.ktor.websocket.WebSocket');
1047
1105
  IncomingProcessorCoroutineName = new CoroutineName('ws-incoming-processor');
1048
1106
  OutgoingProcessorCoroutineName = new CoroutineName('ws-outgoing-processor');
1049
- NORMAL_CLOSE = CloseReason.h4p(Codes_NORMAL_getInstance(), 'OK');
1107
+ NORMAL_CLOSE = CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_NORMAL_getInstance(), 'OK');
1050
1108
  var tmp0_safe_receiver = get_OUTGOING_CHANNEL_CAPACITY();
1051
1109
  var tmp;
1052
1110
  if (tmp0_safe_receiver == null) {
@@ -1059,72 +1117,71 @@ function _init_properties_DefaultWebSocketSession_kt__469s0y() {
1059
1117
  }
1060
1118
  }
1061
1119
  function readReason(_this__u8e3s4) {
1062
- if (_this__u8e3s4.q4q_1.length < 2) {
1120
+ if (_this__u8e3s4.data_1.length < 2) {
1063
1121
  return null;
1064
1122
  }
1065
1123
  // Inline function 'io.ktor.utils.io.core.buildPacket' call
1066
1124
  var builder = new Buffer();
1067
- writeFully(builder, _this__u8e3s4.q4q_1);
1125
+ writeFully(builder, _this__u8e3s4.data_1);
1068
1126
  var packet = builder;
1069
- var code = packet.a1t();
1127
+ var code = packet.readShort_ilpyey_k$();
1070
1128
  var message = readText(packet);
1071
- return CloseReason.g4p(code, message);
1129
+ return CloseReason.new_io_ktor_websocket_CloseReason_a5tz4j_k$(code, message);
1072
1130
  }
1073
1131
  var NonDisposableHandle_instance;
1074
1132
  function NonDisposableHandle_getInstance() {
1075
1133
  return NonDisposableHandle_instance;
1076
1134
  }
1135
+ var static_init_called_0;
1136
+ function static_init_0() {
1137
+ if (static_init_called_0)
1138
+ return Unit_instance;
1139
+ static_init_called_0 = true;
1140
+ FrameType_TEXT_instance = new FrameType('TEXT', 0, false, 1);
1141
+ FrameType_BINARY_instance = new FrameType('BINARY', 1, false, 2);
1142
+ FrameType_CLOSE_instance = new FrameType('CLOSE', 2, true, 8);
1143
+ FrameType_PING_instance = new FrameType('PING', 3, true, 9);
1144
+ FrameType_PONG_instance = new FrameType('PONG', 4, true, 10);
1145
+ if (Companion_instance_3 === VOID) {
1146
+ Companion_instance;
1147
+ new Companion_2();
1148
+ }
1149
+ }
1077
1150
  var FrameType_TEXT_instance;
1078
1151
  var FrameType_BINARY_instance;
1079
1152
  var FrameType_CLOSE_instance;
1080
1153
  var FrameType_PING_instance;
1081
1154
  var FrameType_PONG_instance;
1082
- var Companion_instance_1;
1083
- function Companion_getInstance_1() {
1084
- FrameType_initEntries();
1085
- if (Companion_instance_1 === VOID)
1086
- new Companion_1();
1087
- return Companion_instance_1;
1088
- }
1155
+ var Companion_instance_3;
1089
1156
  function values_0() {
1157
+ static_init_0();
1090
1158
  return [FrameType_TEXT_getInstance(), FrameType_BINARY_getInstance(), FrameType_CLOSE_getInstance(), FrameType_PING_getInstance(), FrameType_PONG_getInstance()];
1091
1159
  }
1092
1160
  function get_entries_0() {
1161
+ static_init_0();
1093
1162
  if ($ENTRIES_0 == null)
1094
1163
  $ENTRIES_0 = enumEntries(values_0());
1095
1164
  return $ENTRIES_0;
1096
1165
  }
1097
- var FrameType_entriesInitialized;
1098
- function FrameType_initEntries() {
1099
- if (FrameType_entriesInitialized)
1100
- return Unit_instance;
1101
- FrameType_entriesInitialized = true;
1102
- FrameType_TEXT_instance = new FrameType('TEXT', 0, false, 1);
1103
- FrameType_BINARY_instance = new FrameType('BINARY', 1, false, 2);
1104
- FrameType_CLOSE_instance = new FrameType('CLOSE', 2, true, 8);
1105
- FrameType_PING_instance = new FrameType('PING', 3, true, 9);
1106
- FrameType_PONG_instance = new FrameType('PONG', 4, true, 10);
1107
- Companion_getInstance_1();
1108
- }
1109
1166
  var $ENTRIES_0;
1110
1167
  function FrameType_TEXT_getInstance() {
1111
- FrameType_initEntries();
1168
+ static_init_0();
1112
1169
  return FrameType_TEXT_instance;
1113
1170
  }
1114
1171
  function FrameType_BINARY_getInstance() {
1115
- FrameType_initEntries();
1172
+ static_init_0();
1116
1173
  return FrameType_BINARY_instance;
1117
1174
  }
1118
1175
  function FrameType_CLOSE_getInstance() {
1119
- FrameType_initEntries();
1176
+ static_init_0();
1120
1177
  return FrameType_CLOSE_instance;
1121
1178
  }
1122
1179
  function FrameType_PING_getInstance() {
1123
- FrameType_initEntries();
1180
+ static_init_0();
1124
1181
  return FrameType_PING_instance;
1125
1182
  }
1126
1183
  function FrameType_PONG_getInstance() {
1127
- FrameType_initEntries();
1184
+ static_init_0();
1128
1185
  return FrameType_PONG_instance;
1129
1186
  }
1130
1187
  function get_PongerCoroutineName() {
@@ -1148,14 +1205,14 @@ function pinger(_this__u8e3s4, outgoing, periodMillis, timeoutMillis, onTimeout)
1148
1205
  _init_properties_PingPong_kt__9aqxey();
1149
1206
  var actorJob = Job();
1150
1207
  var channel = Channel(2147483647);
1151
- var tmp = actorJob.xl(get_PingerCoroutineName());
1208
+ var tmp = actorJob.plus_s13ygv_k$(get_PingerCoroutineName());
1152
1209
  launch(_this__u8e3s4, tmp, VOID, pinger$slambda(periodMillis, timeoutMillis, onTimeout, channel, outgoing));
1153
- var tmp_0 = ensureNotNull(_this__u8e3s4.o2r().ed(Key_instance));
1154
- tmp_0.r2s(pinger$lambda(actorJob));
1210
+ var tmp_0 = ensureNotNull(_this__u8e3s4.get_coroutineContext_115oqo_k$().get_y2st91_k$(Key_instance));
1211
+ tmp_0.invokeOnCompletion_n6cffu_k$(pinger$lambda(actorJob));
1155
1212
  return channel;
1156
1213
  }
1157
1214
  function ponger$slambda($channel, $outgoing) {
1158
- return constructCallableReference(function *($this$launch, $completion) {
1215
+ return constructCallableReference(($this$launch, $completion) => orPromise($completion, function *($completion) {
1159
1216
  var tmp;
1160
1217
  try {
1161
1218
  // Inline function 'kotlinx.coroutines.channels.consumeEach' call
@@ -1164,11 +1221,11 @@ function ponger$slambda($channel, $outgoing) {
1164
1221
  // Inline function 'kotlinx.coroutines.channels.consume' call
1165
1222
  var cause = null;
1166
1223
  try {
1167
- var _iterator__ex2g4s = tmp0.l1();
1168
- while (yield* _iterator__ex2g4s.b36($completion)) {
1169
- var e = _iterator__ex2g4s.n1();
1170
- get_LOGGER().k48('Received ping message, sending pong message');
1171
- yield* $outgoing.p36(Pong.j4r(e.q4q_1), $completion);
1224
+ var _iterator__ex2g4s = tmp0.iterator_jk1svi_k$();
1225
+ while (yield* _iterator__ex2g4s.hasNext_nhy1w3_k$($completion)) {
1226
+ var e = _iterator__ex2g4s.next_20eer_k$();
1227
+ get_LOGGER().trace_fti9bv_k$('Received ping message, sending pong message');
1228
+ yield* $outgoing.send_44jogj_k$(Pong.new_io_ktor_websocket_Frame_Pong_hee4xw_k$(e.data_1), $completion);
1172
1229
  }
1173
1230
  break $l$block;
1174
1231
  } catch ($p) {
@@ -1196,46 +1253,61 @@ function ponger$slambda($channel, $outgoing) {
1196
1253
  tmp = tmp_0;
1197
1254
  }
1198
1255
  return Unit_instance;
1199
- }, 1);
1256
+ }), 1);
1200
1257
  }
1201
1258
  function pinger$slambda$slambda($channel) {
1202
- return constructCallableReference(function *($this$withTimeoutOrNull, $completion) {
1259
+ return constructCallableReference(($this$withTimeoutOrNull, $completion) => orPromise($completion, function *($completion) {
1203
1260
  while (true) {
1204
- yield* $channel.s36($completion);
1261
+ yield* $channel.receive_awoumx_k$($completion);
1205
1262
  }
1206
1263
  return Unit_instance;
1207
- }, 1);
1264
+ }), 1);
1208
1265
  }
1209
1266
  function pinger$slambda$slambda_0($outgoing, $pingMessage, $channel) {
1210
- return constructCallableReference(function *($this$withTimeoutOrNull, $completion) {
1211
- get_LOGGER().k48('WebSocket Pinger: sending ping frame');
1212
- yield* $outgoing.p36(Ping.z4r(toByteArray($pingMessage, Charsets_getInstance().p40_1)), $completion);
1267
+ return constructCallableReference(($this$withTimeoutOrNull, $completion) => orPromise($completion, function *($completion) {
1268
+ get_LOGGER().trace_fti9bv_k$('WebSocket Pinger: sending ping frame');
1269
+ yield* $outgoing.send_44jogj_k$(Ping.new_io_ktor_websocket_Frame_Ping_eh4ca3_k$(toByteArray($pingMessage, Charsets_getInstance().ISO_8859_1__1)), $completion);
1213
1270
  $l$loop: while (true) {
1214
- var msg = yield* $channel.s36($completion);
1215
- if (decodeToString(msg.q4q_1, 0, 0 + msg.q4q_1.length | 0) === $pingMessage) {
1216
- get_LOGGER().k48('WebSocket Pinger: received valid pong frame ' + msg.toString());
1271
+ var msg = yield* $channel.receive_awoumx_k$($completion);
1272
+ if (decodeToString(msg.data_1, 0, 0 + msg.data_1.length | 0) === $pingMessage) {
1273
+ // Inline function 'io.ktor.util.logging.trace' call
1274
+ var this_0 = get_LOGGER();
1275
+ if (get_isTraceEnabled(this_0)) {
1276
+ var tmp$ret$1 = 'WebSocket Pinger: received valid pong frame ' + msg.toString();
1277
+ this_0.trace_fti9bv_k$(tmp$ret$1);
1278
+ }
1217
1279
  break $l$loop;
1218
1280
  }
1219
- get_LOGGER().k48('WebSocket Pinger: received invalid pong frame ' + msg.toString() + ', continue waiting');
1281
+ // Inline function 'io.ktor.util.logging.trace' call
1282
+ var this_1 = get_LOGGER();
1283
+ if (get_isTraceEnabled(this_1)) {
1284
+ var tmp$ret$3 = 'WebSocket Pinger: received invalid pong frame ' + msg.toString() + ', continue waiting';
1285
+ this_1.trace_fti9bv_k$(tmp$ret$3);
1286
+ }
1220
1287
  }
1221
1288
  return Unit_instance;
1222
- }, 1);
1289
+ }), 1);
1223
1290
  }
1224
1291
  function pinger$slambda($periodMillis, $timeoutMillis, $onTimeout, $channel, $outgoing) {
1225
- return constructCallableReference(function *($this$launch, $completion) {
1226
- get_LOGGER().k48('Starting WebSocket pinger coroutine with period ' + $periodMillis.toString() + ' ms and timeout ' + $timeoutMillis.toString() + ' ms');
1292
+ return constructCallableReference(($this$launch, $completion) => orPromise($completion, function *($completion) {
1293
+ // Inline function 'io.ktor.util.logging.trace' call
1294
+ var this_0 = get_LOGGER();
1295
+ if (get_isTraceEnabled(this_0)) {
1296
+ var tmp$ret$1 = 'Starting WebSocket pinger coroutine with period ' + $periodMillis.toString() + ' ms and timeout ' + $timeoutMillis.toString() + ' ms';
1297
+ this_0.trace_fti9bv_k$(tmp$ret$1);
1298
+ }
1227
1299
  var random = Random(getTimeMillis());
1228
1300
  var pingIdBytes = new Int8Array(32);
1229
1301
  var tmp;
1230
1302
  try {
1231
1303
  $l$loop: while (true) {
1232
1304
  yield* withTimeoutOrNull($periodMillis, pinger$slambda$slambda($channel), $completion);
1233
- random.on(pingIdBytes);
1305
+ random.nextBytes_ln07bs_k$(pingIdBytes);
1234
1306
  var pingMessage = '[ping ' + toHexString(pingIdBytes) + ' ping]';
1235
1307
  var rc = yield* withTimeoutOrNull($timeoutMillis, pinger$slambda$slambda_0($outgoing, pingMessage, $channel), $completion);
1236
1308
  if (rc == null) {
1237
- get_LOGGER().k48('WebSocket pinger has timed out');
1238
- yield* $onTimeout(CloseReason.h4p(Codes_INTERNAL_ERROR_getInstance(), 'Ping timeout'), $completion);
1309
+ get_LOGGER().trace_fti9bv_k$('WebSocket pinger has timed out');
1310
+ yield* $($onTimeout(CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_INTERNAL_ERROR_getInstance(), 'Ping timeout'), $completion), $completion);
1239
1311
  break $l$loop;
1240
1312
  }
1241
1313
  }
@@ -1266,11 +1338,11 @@ function pinger$slambda($periodMillis, $timeoutMillis, $onTimeout, $channel, $ou
1266
1338
  tmp = tmp_0;
1267
1339
  }
1268
1340
  return Unit_instance;
1269
- }, 1);
1341
+ }), 1);
1270
1342
  }
1271
1343
  function pinger$lambda($actorJob) {
1272
1344
  return (it) => {
1273
- $actorJob.z2s();
1345
+ $actorJob.cancel$default_8haxne_k$();
1274
1346
  return Unit_instance;
1275
1347
  };
1276
1348
  }
@@ -1282,44 +1354,44 @@ function _init_properties_PingPong_kt__9aqxey() {
1282
1354
  PingerCoroutineName = new CoroutineName('ws-pinger');
1283
1355
  }
1284
1356
  }
1285
- var Companion_instance_2;
1357
+ var Companion_instance_4;
1286
1358
  function Companion_getInstance_2() {
1287
- if (Companion_instance_2 === VOID)
1288
- new Companion_2();
1289
- return Companion_instance_2;
1359
+ if (Companion_instance_4 === VOID)
1360
+ new Companion_3();
1361
+ return Companion_instance_4;
1290
1362
  }
1291
1363
  function from(_this__u8e3s4, config) {
1292
1364
  // Inline function 'kotlin.with' call
1293
1365
  var tmp;
1294
- if (config.c4s_1 === 2147483647) {
1366
+ if (config.capacity_1 === 2147483647) {
1295
1367
  tmp = Channel(2147483647);
1296
- } else if (config.d4s_1.equals(ChannelOverflow_SUSPEND_getInstance())) {
1297
- tmp = Channel(config.c4s_1, BufferOverflow_SUSPEND_getInstance());
1298
- } else if (config.d4s_1.equals(ChannelOverflow_CLOSE_getInstance())) {
1299
- tmp = new BoundedChannel(config.c4s_1);
1368
+ } else if (config.onOverflow_1.equals(ChannelOverflow_SUSPEND_getInstance())) {
1369
+ tmp = Channel(config.capacity_1, BufferOverflow_SUSPEND_getInstance());
1370
+ } else if (config.onOverflow_1.equals(ChannelOverflow_CLOSE_getInstance())) {
1371
+ tmp = new BoundedChannel(config.capacity_1);
1300
1372
  } else {
1301
1373
  // Inline function 'kotlin.error' call
1302
1374
  var message = 'Unsupported channel config.';
1303
- throw IllegalStateException.o(toString(message));
1375
+ throw IllegalStateException.new_kotlin_IllegalStateException_w47ei6_k$(toString(message));
1304
1376
  }
1305
1377
  return tmp;
1306
1378
  }
1307
- var Companion_instance_3;
1379
+ var Companion_instance_5;
1308
1380
  function Companion_getInstance_3() {
1309
- if (Companion_instance_3 === VOID)
1310
- new Companion_3();
1311
- return Companion_instance_3;
1381
+ if (Companion_instance_5 === VOID)
1382
+ new Companion_4();
1383
+ return Companion_instance_5;
1312
1384
  }
1313
- var ChannelOverflow_SUSPEND_instance;
1314
- var ChannelOverflow_CLOSE_instance;
1315
- var ChannelOverflow_entriesInitialized;
1316
- function ChannelOverflow_initEntries() {
1317
- if (ChannelOverflow_entriesInitialized)
1385
+ var static_init_called_1;
1386
+ function static_init_1() {
1387
+ if (static_init_called_1)
1318
1388
  return Unit_instance;
1319
- ChannelOverflow_entriesInitialized = true;
1389
+ static_init_called_1 = true;
1320
1390
  ChannelOverflow_SUSPEND_instance = new ChannelOverflow('SUSPEND', 0);
1321
1391
  ChannelOverflow_CLOSE_instance = new ChannelOverflow('CLOSE', 1);
1322
1392
  }
1393
+ var ChannelOverflow_SUSPEND_instance;
1394
+ var ChannelOverflow_CLOSE_instance;
1323
1395
  function BoundedChannel$Companion$createDelegate$lambda($channel) {
1324
1396
  return (it) => {
1325
1397
  var tmp;
@@ -1329,42 +1401,42 @@ function BoundedChannel$Companion$createDelegate$lambda($channel) {
1329
1401
  } else {
1330
1402
  tmp_0 = $channel._v;
1331
1403
  }
1332
- if (!tmp_0.i36()) {
1404
+ if (!tmp_0.get_isClosedForSend_ajczci_k$()) {
1333
1405
  var tmp_1;
1334
1406
  if ($channel._v == null) {
1335
1407
  throwUninitializedPropertyAccessException('channel');
1336
1408
  } else {
1337
1409
  tmp_1 = $channel._v;
1338
1410
  }
1339
- tmp_1.z36(ChannelOverflowException.i4s('Channel overflowed'));
1411
+ tmp_1.close_ukldxa_k$(ChannelOverflowException.new_io_ktor_websocket_ChannelOverflowException_hoqwtd_k$('Channel overflowed'));
1340
1412
  tmp = Unit_instance;
1341
1413
  }
1342
1414
  return Unit_instance;
1343
1415
  };
1344
1416
  }
1345
- var Companion_instance_4;
1417
+ var Companion_instance_6;
1346
1418
  function Companion_getInstance_4() {
1347
- return Companion_instance_4;
1419
+ return Companion_instance_6;
1348
1420
  }
1349
1421
  function ChannelOverflow_SUSPEND_getInstance() {
1350
- ChannelOverflow_initEntries();
1422
+ static_init_1();
1351
1423
  return ChannelOverflow_SUSPEND_instance;
1352
1424
  }
1353
1425
  function ChannelOverflow_CLOSE_getInstance() {
1354
- ChannelOverflow_initEntries();
1426
+ static_init_1();
1355
1427
  return ChannelOverflow_CLOSE_instance;
1356
1428
  }
1357
1429
  function parametersToString($this) {
1358
- return $this.t4s_1.j1() ? '' : '; ' + joinToString($this.t4s_1, ';');
1430
+ return $this.parameters_1.isEmpty_y1axqb_k$() ? '' : '; ' + joinToString($this.parameters_1, ';');
1359
1431
  }
1360
1432
  function parseWebSocketExtensions(value) {
1361
1433
  // Inline function 'kotlin.collections.map' call
1362
1434
  var this_0 = split(value, [',']);
1363
1435
  // Inline function 'kotlin.collections.mapTo' call
1364
- var destination = ArrayList.d2(collectionSizeOrDefault(this_0, 10));
1365
- var _iterator__ex2g4s = this_0.l1();
1366
- while (_iterator__ex2g4s.m1()) {
1367
- var item = _iterator__ex2g4s.n1();
1436
+ var destination = ArrayList.new_kotlin_collections_ArrayList_tdd6ob_k$(collectionSizeOrDefault(this_0, 10));
1437
+ var _iterator__ex2g4s = this_0.iterator_jk1svi_k$();
1438
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
1439
+ var item = _iterator__ex2g4s.next_20eer_k$();
1368
1440
  var extension = split(item, [';']);
1369
1441
  // Inline function 'kotlin.text.trim' call
1370
1442
  var this_1 = first(extension);
@@ -1372,25 +1444,25 @@ function parseWebSocketExtensions(value) {
1372
1444
  // Inline function 'kotlin.collections.map' call
1373
1445
  var this_2 = drop(extension, 1);
1374
1446
  // Inline function 'kotlin.collections.mapTo' call
1375
- var destination_0 = ArrayList.d2(collectionSizeOrDefault(this_2, 10));
1376
- var _iterator__ex2g4s_0 = this_2.l1();
1377
- while (_iterator__ex2g4s_0.m1()) {
1378
- var item_0 = _iterator__ex2g4s_0.n1();
1447
+ var destination_0 = ArrayList.new_kotlin_collections_ArrayList_tdd6ob_k$(collectionSizeOrDefault(this_2, 10));
1448
+ var _iterator__ex2g4s_0 = this_2.iterator_jk1svi_k$();
1449
+ while (_iterator__ex2g4s_0.hasNext_bitz1p_k$()) {
1450
+ var item_0 = _iterator__ex2g4s_0.next_20eer_k$();
1379
1451
  // Inline function 'kotlin.text.trim' call
1380
1452
  var tmp$ret$6 = toString(trim(isCharSequence(item_0) ? item_0 : THROW_CCE()));
1381
- destination_0.e2(tmp$ret$6);
1453
+ destination_0.add_utx5q5_k$(tmp$ret$6);
1382
1454
  }
1383
1455
  var parameters = destination_0;
1384
1456
  var tmp$ret$2 = new WebSocketExtensionHeader(name, parameters);
1385
- destination.e2(tmp$ret$2);
1457
+ destination.add_utx5q5_k$(tmp$ret$2);
1386
1458
  }
1387
1459
  return destination;
1388
1460
  }
1389
1461
  function *close(_this__u8e3s4, reason, $completion) {
1390
- reason = reason === VOID ? CloseReason.h4p(Codes_NORMAL_getInstance(), '') : reason;
1462
+ reason = reason === VOID ? CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_NORMAL_getInstance(), '') : reason;
1391
1463
  try {
1392
- yield* _this__u8e3s4.o4p(Close.m4q(reason), $completion);
1393
- yield* _this__u8e3s4.u3y($completion);
1464
+ yield* _this__u8e3s4.send_sburzs_k$(Close.new_io_ktor_websocket_Frame_Close_zgly5v_k$(reason), $completion);
1465
+ yield* _this__u8e3s4.flush_4wsz1p_k$($completion);
1394
1466
  } catch ($p) {
1395
1467
  if ($p instanceof Error) {
1396
1468
  var _unused_var__etf5q3 = $p;
@@ -1403,19 +1475,20 @@ function *close(_this__u8e3s4, reason, $completion) {
1403
1475
  function *closeExceptionally(_this__u8e3s4, cause, $completion) {
1404
1476
  var tmp;
1405
1477
  if (cause instanceof CancellationException) {
1406
- tmp = CloseReason.h4p(Codes_NORMAL_getInstance(), '');
1478
+ tmp = CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_NORMAL_getInstance(), '');
1407
1479
  } else {
1408
- tmp = CloseReason.h4p(Codes_INTERNAL_ERROR_getInstance(), cause.toString());
1480
+ var message = utf8Truncate(cause.toString(), 123);
1481
+ tmp = CloseReason.new_io_ktor_websocket_CloseReason_al0vxu_k$(Codes_INTERNAL_ERROR_getInstance(), message);
1409
1482
  }
1410
1483
  var reason = tmp;
1411
1484
  yield* /*#__NOINLINE__*/close(_this__u8e3s4, reason, $completion);
1412
1485
  return Unit_instance;
1413
1486
  }
1414
- var Companion_instance_5;
1487
+ var Companion_instance_7;
1415
1488
  function Companion_getInstance_5() {
1416
- if (Companion_instance_5 === VOID)
1417
- new Companion_5();
1418
- return Companion_instance_5;
1489
+ if (Companion_instance_7 === VOID)
1490
+ new Companion_6();
1491
+ return Companion_instance_7;
1419
1492
  }
1420
1493
  function get_OUTGOING_CHANNEL_CAPACITY() {
1421
1494
  return OUTGOING_CHANNEL_CAPACITY;
@@ -1424,24 +1497,25 @@ var OUTGOING_CHANNEL_CAPACITY;
1424
1497
  //region block: post-declaration
1425
1498
  initMetadataForCompanion(Companion);
1426
1499
  initMetadataForClass(Codes, 'Codes');
1500
+ initMetadataForCompanion(Companion_0);
1427
1501
  initMetadataForClass(CloseReason, 'CloseReason');
1428
1502
  initMetadataForInterface(WebSocketSession, 'WebSocketSession', VOID, VOID, VOID, [1, 0]);
1429
1503
  initMetadataForInterface(DefaultWebSocketSession, 'DefaultWebSocketSession', VOID, VOID, [WebSocketSession], [1, 0]);
1430
- initMetadataForCompanion(Companion_0);
1431
- protoOf(DefaultWebSocketSessionImpl).o4p = send;
1504
+ initMetadataForCompanion(Companion_1);
1505
+ protoOf(DefaultWebSocketSessionImpl).send_sburzs_k$ = send;
1432
1506
  initMetadataForClass(DefaultWebSocketSessionImpl, 'DefaultWebSocketSessionImpl', VOID, VOID, [DefaultWebSocketSession, WebSocketSession], [1, 0, 2]);
1433
1507
  initMetadataForObject(NonDisposableHandle, 'NonDisposableHandle', VOID, VOID, [DisposableHandle]);
1434
1508
  initMetadataForClass(FrameTooBigException, 'FrameTooBigException', VOID, VOID, [CopyableThrowable]);
1435
- initMetadataForCompanion(Companion_1);
1436
- initMetadataForClass(FrameType, 'FrameType');
1437
1509
  initMetadataForCompanion(Companion_2);
1438
- initMetadataForClass(WebSocketChannelsConfig, 'WebSocketChannelsConfig', WebSocketChannelsConfig);
1510
+ initMetadataForClass(FrameType, 'FrameType');
1439
1511
  initMetadataForCompanion(Companion_3);
1512
+ initMetadataForClass(WebSocketChannelsConfig, 'WebSocketChannelsConfig', WebSocketChannelsConfig);
1513
+ initMetadataForCompanion(Companion_4);
1440
1514
  initMetadataForClass(ChannelConfig, 'ChannelConfig');
1441
1515
  initMetadataForClass(ChannelOverflow, 'ChannelOverflow');
1442
- initMetadataForCompanion(Companion_4);
1443
- protoOf(BoundedChannel).b37 = close$default;
1444
- protoOf(BoundedChannel).d37 = cancel$default;
1516
+ initMetadataForCompanion(Companion_5);
1517
+ protoOf(BoundedChannel).close$default_kcbl7u_k$ = close$default;
1518
+ protoOf(BoundedChannel).cancel$default_880p35_k$ = cancel$default;
1445
1519
  initMetadataForClass(BoundedChannel, 'BoundedChannel', VOID, VOID, [SendChannel, ReceiveChannel], [1, 0]);
1446
1520
  initMetadataForClass(ChannelOverflowException, 'ChannelOverflowException');
1447
1521
  initMetadataForInterface(WebSocketExtension, 'WebSocketExtension');
@@ -1450,23 +1524,24 @@ initMetadataForClass(WebSocketExtensionHeader, 'WebSocketExtensionHeader');
1450
1524
  initMetadataForClass(Frame, 'Frame');
1451
1525
  initMetadataForClass(Binary, 'Binary');
1452
1526
  initMetadataForClass(Text, 'Text');
1453
- initMetadataForClass(Close, 'Close', Close.q4t);
1527
+ initMetadataForClass(Close, 'Close', Close.new_io_ktor_websocket_Frame_Close_ddsmnf_k$);
1454
1528
  initMetadataForClass(Ping, 'Ping');
1455
1529
  initMetadataForClass(Pong, 'Pong');
1456
- initMetadataForCompanion(Companion_5);
1530
+ initMetadataForCompanion(Companion_6);
1457
1531
  //endregion
1458
1532
  //region block: init
1533
+ Companion_instance_1 = new Companion_0();
1459
1534
  NonDisposableHandle_instance = new NonDisposableHandle();
1460
- Companion_instance_4 = new Companion_4();
1535
+ Companion_instance_6 = new Companion_5();
1461
1536
  OUTGOING_CHANNEL_CAPACITY = null;
1462
1537
  //endregion
1463
1538
  //region block: exports
1464
1539
  export {
1465
- Companion_getInstance as Companion_getInstanceo8cazic5dguk,
1466
- Companion_getInstance_2 as Companion_getInstance27kujspvp4jub,
1467
- Codes_CLOSED_ABNORMALLY_getInstance as Codes_CLOSED_ABNORMALLY_getInstance35h8511ldg1ec,
1468
- Codes_NORMAL_getInstance as Codes_NORMAL_getInstance1njykag03saqj,
1469
- send as send3vgnni2smbra3,
1540
+ Codes_CLOSED_ABNORMALLY_getInstance as Codes_CLOSED_ABNORMALLY_getInstance1bzb878jpjbg8,
1541
+ Codes_NORMAL_getInstance as Codes_NORMAL_getInstance3dr9ood98owg7,
1542
+ Companion_getInstance as Companion_getInstance34aryltzqunru,
1543
+ Companion_getInstance_2 as Companion_getInstance1pwau9pkopj,
1544
+ send as send1afreql7wqu1y,
1470
1545
  CloseReason as CloseReason10cphaqpp3ct7,
1471
1546
  DefaultWebSocketSession_0 as DefaultWebSocketSessionmehckluw85jl,
1472
1547
  DefaultWebSocketSession as DefaultWebSocketSession3h8506yqzs5fx,