raspberry_games_server_game_logic 1.8.248

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 (68) hide show
  1. package/Kosi-Kaverit-kaverit.js +339 -0
  2. package/Kosi-Kaverit-kaverit.js.map +1 -0
  3. package/Kosi-Kodein-kodein-di.js +2389 -0
  4. package/Kosi-Kodein-kodein-di.js.map +1 -0
  5. package/Kotlin-DateTime-library-kotlinx-datetime.js +6215 -0
  6. package/Kotlin-DateTime-library-kotlinx-datetime.js.map +1 -0
  7. package/Logic_Debertz-core.js +6885 -0
  8. package/Logic_Debertz-core.js.map +1 -0
  9. package/Logic_Debertz-engine.js +52055 -0
  10. package/Logic_Debertz-engine.js.map +1 -0
  11. package/Logic_Debertz-game_server.d.ts +1918 -0
  12. package/Logic_Debertz-game_server.js +5140 -0
  13. package/Logic_Debertz-game_server.js.map +1 -0
  14. package/kotlin-kotlin-stdlib.js +15597 -0
  15. package/kotlin-kotlin-stdlib.js.map +1 -0
  16. package/kotlin-kotlinx-atomicfu-runtime.js +15 -0
  17. package/kotlin-kotlinx-atomicfu-runtime.js.map +1 -0
  18. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +15 -0
  19. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js.map +1 -0
  20. package/kotlinx-atomicfu.js +276 -0
  21. package/kotlinx-atomicfu.js.map +1 -0
  22. package/kotlinx-coroutines-core.js +11628 -0
  23. package/kotlinx-coroutines-core.js.map +1 -0
  24. package/kotlinx-io-kotlinx-io-bytestring.js +15 -0
  25. package/kotlinx-io-kotlinx-io-bytestring.js.map +1 -0
  26. package/kotlinx-io-kotlinx-io-core.js +1557 -0
  27. package/kotlinx-io-kotlinx-io-core.js.map +1 -0
  28. package/kotlinx-serialization-kotlinx-serialization-core.js +6315 -0
  29. package/kotlinx-serialization-kotlinx-serialization-core.js.map +1 -0
  30. package/kotlinx-serialization-kotlinx-serialization-json.js +5092 -0
  31. package/kotlinx-serialization-kotlinx-serialization-json.js.map +1 -0
  32. package/ktor-ktor-client-content-negotiation.js +713 -0
  33. package/ktor-ktor-client-content-negotiation.js.map +1 -0
  34. package/ktor-ktor-client-core.js +7235 -0
  35. package/ktor-ktor-client-core.js.map +1 -0
  36. package/ktor-ktor-client-js.js +15 -0
  37. package/ktor-ktor-client-js.js.map +1 -0
  38. package/ktor-ktor-client-logging.js +1530 -0
  39. package/ktor-ktor-client-logging.js.map +1 -0
  40. package/ktor-ktor-events.js +97 -0
  41. package/ktor-ktor-events.js.map +1 -0
  42. package/ktor-ktor-http.js +3285 -0
  43. package/ktor-ktor-http.js.map +1 -0
  44. package/ktor-ktor-io.js +6463 -0
  45. package/ktor-ktor-io.js.map +1 -0
  46. package/ktor-ktor-serialization-kotlinx-json.js +67 -0
  47. package/ktor-ktor-serialization-kotlinx-json.js.map +1 -0
  48. package/ktor-ktor-serialization-kotlinx.js +893 -0
  49. package/ktor-ktor-serialization-kotlinx.js.map +1 -0
  50. package/ktor-ktor-serialization.js +395 -0
  51. package/ktor-ktor-serialization.js.map +1 -0
  52. package/ktor-ktor-utils.js +2659 -0
  53. package/ktor-ktor-utils.js.map +1 -0
  54. package/ktor-ktor-websocket-serialization.js +15 -0
  55. package/ktor-ktor-websocket-serialization.js.map +1 -0
  56. package/ktor-ktor-websockets.js +466 -0
  57. package/ktor-ktor-websockets.js.map +1 -0
  58. package/package.json +13 -0
  59. package/raspberry-cardgame-lib-core.js +1429 -0
  60. package/raspberry-cardgame-lib-core.js.map +1 -0
  61. package/raspberry-cardgame-lib-logger.js +423 -0
  62. package/raspberry-cardgame-lib-logger.js.map +1 -0
  63. package/raspberry-cardgame-lib-random.js +3060 -0
  64. package/raspberry-cardgame-lib-random.js.map +1 -0
  65. package/secure-random-secure-random.js +173 -0
  66. package/secure-random-secure-random.js.map +1 -0
  67. package/uuid.js +163 -0
  68. package/uuid.js.map +1 -0
@@ -0,0 +1,1557 @@
1
+ (function (factory) {
2
+ if (typeof define === 'function' && define.amd)
3
+ define(['exports', './kotlin-kotlin-stdlib.js'], factory);
4
+ else if (typeof exports === 'object')
5
+ factory(module.exports, require('./kotlin-kotlin-stdlib.js'));
6
+ else {
7
+ if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
8
+ throw new Error("Error loading module 'kotlinx-io-kotlinx-io-core'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'kotlinx-io-kotlinx-io-core'.");
9
+ }
10
+ globalThis['kotlinx-io-kotlinx-io-core'] = factory(typeof globalThis['kotlinx-io-kotlinx-io-core'] === 'undefined' ? {} : globalThis['kotlinx-io-kotlinx-io-core'], globalThis['kotlin-kotlin-stdlib']);
11
+ }
12
+ }(function (_, kotlin_kotlin) {
13
+ 'use strict';
14
+ //region block: imports
15
+ var imul = Math.imul;
16
+ var IndexOutOfBoundsException_init_$Create$ = kotlin_kotlin.$_$.a2;
17
+ var Long = kotlin_kotlin.$_$.mg;
18
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.s1;
19
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.x2;
20
+ var charArrayOf = kotlin_kotlin.$_$.eb;
21
+ var protoOf = kotlin_kotlin.$_$.uc;
22
+ var Unit_instance = kotlin_kotlin.$_$.p5;
23
+ var ensureNotNull = kotlin_kotlin.$_$.ih;
24
+ var toLong = kotlin_kotlin.$_$.wc;
25
+ var toString = kotlin_kotlin.$_$.yc;
26
+ var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.e1;
27
+ var initMetadataForClass = kotlin_kotlin.$_$.tb;
28
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.w1;
29
+ var objectCreate = kotlin_kotlin.$_$.tc;
30
+ var initMetadataForCompanion = kotlin_kotlin.$_$.ub;
31
+ var arrayCopy = kotlin_kotlin.$_$.h6;
32
+ var IllegalArgumentException_init_$Create$_0 = kotlin_kotlin.$_$.q1;
33
+ var initMetadataForObject = kotlin_kotlin.$_$.yb;
34
+ var VOID = kotlin_kotlin.$_$.f;
35
+ var charSequenceGet = kotlin_kotlin.$_$.gb;
36
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.d3;
37
+ var toByte = kotlin_kotlin.$_$.vc;
38
+ var initMetadataForInterface = kotlin_kotlin.$_$.wb;
39
+ var StringBuilder_init_$Create$_0 = kotlin_kotlin.$_$.f1;
40
+ var charSequenceLength = kotlin_kotlin.$_$.hb;
41
+ var endsWith = kotlin_kotlin.$_$.ce;
42
+ var startsWith = kotlin_kotlin.$_$.af;
43
+ var Exception_init_$Init$ = kotlin_kotlin.$_$.k1;
44
+ var captureStack = kotlin_kotlin.$_$.db;
45
+ var Exception_init_$Init$_0 = kotlin_kotlin.$_$.l1;
46
+ var Exception_init_$Init$_1 = kotlin_kotlin.$_$.m1;
47
+ var Exception = kotlin_kotlin.$_$.jg;
48
+ var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.m2;
49
+ var KProperty0 = kotlin_kotlin.$_$.od;
50
+ var getPropertyCallableRef = kotlin_kotlin.$_$.qb;
51
+ var lazy = kotlin_kotlin.$_$.oh;
52
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.n;
53
+ var asReversed = kotlin_kotlin.$_$.j6;
54
+ var contains = kotlin_kotlin.$_$.zd;
55
+ var getStringHashCode = kotlin_kotlin.$_$.rb;
56
+ var Char = kotlin_kotlin.$_$.cg;
57
+ //endregion
58
+ //region block: pre-declaration
59
+ initMetadataForClass(Buffer, 'Buffer', Buffer);
60
+ initMetadataForClass(RealSink, 'RealSink');
61
+ initMetadataForCompanion(Companion);
62
+ initMetadataForClass(Segment, 'Segment');
63
+ initMetadataForClass(SegmentCopyTracker, 'SegmentCopyTracker');
64
+ initMetadataForObject(AlwaysSharedCopyTracker, 'AlwaysSharedCopyTracker', VOID, SegmentCopyTracker);
65
+ function delete$default(path, mustExist, $super) {
66
+ mustExist = mustExist === VOID ? true : mustExist;
67
+ var tmp;
68
+ if ($super === VOID) {
69
+ this.i62(path, mustExist);
70
+ tmp = Unit_instance;
71
+ } else {
72
+ tmp = $super.i62.call(this, path, mustExist);
73
+ }
74
+ return tmp;
75
+ }
76
+ function createDirectories$default(path, mustCreate, $super) {
77
+ mustCreate = mustCreate === VOID ? false : mustCreate;
78
+ var tmp;
79
+ if ($super === VOID) {
80
+ this.k62(path, mustCreate);
81
+ tmp = Unit_instance;
82
+ } else {
83
+ tmp = $super.k62.call(this, path, mustCreate);
84
+ }
85
+ return tmp;
86
+ }
87
+ initMetadataForInterface(FileSystem, 'FileSystem');
88
+ initMetadataForClass(SystemFileSystemImpl, 'SystemFileSystemImpl', VOID, VOID, [FileSystem]);
89
+ initMetadataForClass(FileMetadata, 'FileMetadata', FileMetadata);
90
+ initMetadataForObject(UnsafeBufferOperations, 'UnsafeBufferOperations');
91
+ initMetadataForClass(SegmentReadContextImpl$1);
92
+ initMetadataForClass(SegmentWriteContextImpl$1);
93
+ initMetadataForClass(BufferIterationContextImpl$1);
94
+ initMetadataForClass(IOException, 'IOException', IOException_init_$Create$, Exception);
95
+ initMetadataForClass(EOFException, 'EOFException', EOFException_init_$Create$, IOException);
96
+ initMetadataForObject(SegmentPool, 'SegmentPool');
97
+ initMetadataForClass(FileNotFoundException, 'FileNotFoundException', VOID, IOException);
98
+ initMetadataForClass(SystemFileSystem$1, VOID, VOID, SystemFileSystemImpl);
99
+ initMetadataForClass(Path_0, 'Path');
100
+ initMetadataForClass(FileSink, 'FileSink');
101
+ //endregion
102
+ function get_HEX_DIGIT_CHARS() {
103
+ _init_properties__Util_kt__g8tcl9();
104
+ return HEX_DIGIT_CHARS;
105
+ }
106
+ var HEX_DIGIT_CHARS;
107
+ function checkBounds(size, startIndex, endIndex) {
108
+ _init_properties__Util_kt__g8tcl9();
109
+ if (startIndex.z(new Long(0, 0)) < 0 || endIndex.z(size) > 0) {
110
+ throw IndexOutOfBoundsException_init_$Create$('startIndex (' + startIndex.toString() + ') and endIndex (' + endIndex.toString() + ') are not within the range [0..size(' + size.toString() + '))');
111
+ }
112
+ if (startIndex.z(endIndex) > 0) {
113
+ throw IllegalArgumentException_init_$Create$('startIndex (' + startIndex.toString() + ') > endIndex (' + endIndex.toString() + ')');
114
+ }
115
+ }
116
+ function checkOffsetAndCount(size, offset, byteCount) {
117
+ _init_properties__Util_kt__g8tcl9();
118
+ if (offset.z(new Long(0, 0)) < 0 || offset.z(size) > 0 || size.w2(offset).z(byteCount) < 0 || byteCount.z(new Long(0, 0)) < 0) {
119
+ throw IllegalArgumentException_init_$Create$('offset (' + offset.toString() + ') and byteCount (' + byteCount.toString() + ') are not within the range [0..size(' + size.toString() + '))');
120
+ }
121
+ }
122
+ var properties_initialized__Util_kt_67kc5b;
123
+ function _init_properties__Util_kt__g8tcl9() {
124
+ if (!properties_initialized__Util_kt_67kc5b) {
125
+ properties_initialized__Util_kt_67kc5b = true;
126
+ // Inline function 'kotlin.charArrayOf' call
127
+ HEX_DIGIT_CHARS = charArrayOf([_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(97), _Char___init__impl__6a9atx(98), _Char___init__impl__6a9atx(99), _Char___init__impl__6a9atx(100), _Char___init__impl__6a9atx(101), _Char___init__impl__6a9atx(102)]);
128
+ }
129
+ }
130
+ function Buffer() {
131
+ this.g60_1 = null;
132
+ this.h60_1 = null;
133
+ this.i60_1 = new Long(0, 0);
134
+ }
135
+ protoOf(Buffer).m = function () {
136
+ return this.i60_1;
137
+ };
138
+ protoOf(Buffer).j60 = function () {
139
+ return this;
140
+ };
141
+ protoOf(Buffer).k60 = function () {
142
+ return this.m().equals(new Long(0, 0));
143
+ };
144
+ protoOf(Buffer).l60 = function () {
145
+ return Unit_instance;
146
+ };
147
+ protoOf(Buffer).m60 = function () {
148
+ var result = this.m();
149
+ if (result.equals(new Long(0, 0)))
150
+ return new Long(0, 0);
151
+ var tail = ensureNotNull(this.h60_1);
152
+ if (tail.p60_1 < 8192 && tail.r60_1) {
153
+ result = result.w2(toLong(tail.p60_1 - tail.o60_1 | 0));
154
+ }
155
+ return result;
156
+ };
157
+ protoOf(Buffer).u60 = function (byteCount) {
158
+ // Inline function 'kotlinx.io.checkByteCount' call
159
+ // Inline function 'kotlin.require' call
160
+ // Inline function 'kotlin.contracts.contract' call
161
+ if (!(byteCount.z(new Long(0, 0)) >= 0)) {
162
+ // Inline function 'kotlinx.io.checkByteCount.<anonymous>' call
163
+ var message = 'byteCount (' + byteCount.toString() + ') < 0';
164
+ throw IllegalArgumentException_init_$Create$(toString(message));
165
+ }
166
+ var remainingByteCount = byteCount;
167
+ while (remainingByteCount.z(new Long(0, 0)) > 0) {
168
+ var tmp0_elvis_lhs = this.g60_1;
169
+ var tmp;
170
+ if (tmp0_elvis_lhs == null) {
171
+ throw EOFException_init_$Create$_0('Buffer exhausted before skipping ' + byteCount.toString() + ' bytes.');
172
+ } else {
173
+ tmp = tmp0_elvis_lhs;
174
+ }
175
+ var head = tmp;
176
+ // Inline function 'kotlinx.io.minOf' call
177
+ var a = remainingByteCount;
178
+ var b = head.p60_1 - head.o60_1 | 0;
179
+ // Inline function 'kotlin.comparisons.minOf' call
180
+ var b_0 = toLong(b);
181
+ var toSkip = (a.z(b_0) <= 0 ? a : b_0).e1();
182
+ this.i60_1 = this.i60_1.w2(toLong(toSkip));
183
+ remainingByteCount = remainingByteCount.w2(toLong(toSkip));
184
+ head.o60_1 = head.o60_1 + toSkip | 0;
185
+ if (head.o60_1 === head.p60_1) {
186
+ this.v60();
187
+ }
188
+ }
189
+ };
190
+ protoOf(Buffer).w60 = function (minimumCapacity) {
191
+ // Inline function 'kotlin.require' call
192
+ // Inline function 'kotlin.contracts.contract' call
193
+ if (!(minimumCapacity >= 1 && minimumCapacity <= 8192)) {
194
+ // Inline function 'kotlinx.io.Buffer.writableSegment.<anonymous>' call
195
+ var message = 'unexpected capacity';
196
+ throw IllegalArgumentException_init_$Create$(toString(message));
197
+ }
198
+ if (this.h60_1 == null) {
199
+ var result = SegmentPool_instance.z60();
200
+ this.g60_1 = result;
201
+ this.h60_1 = result;
202
+ return result;
203
+ }
204
+ var t = ensureNotNull(this.h60_1);
205
+ if ((t.p60_1 + minimumCapacity | 0) > 8192 || !t.r60_1) {
206
+ var newTail = t.a61(SegmentPool_instance.z60());
207
+ this.h60_1 = newTail;
208
+ return newTail;
209
+ }
210
+ return t;
211
+ };
212
+ protoOf(Buffer).b61 = function (source, byteCount) {
213
+ // Inline function 'kotlin.require' call
214
+ // Inline function 'kotlin.contracts.contract' call
215
+ if (!!(source === this)) {
216
+ // Inline function 'kotlinx.io.Buffer.write.<anonymous>' call
217
+ var message = 'source == this';
218
+ throw IllegalArgumentException_init_$Create$(toString(message));
219
+ }
220
+ checkOffsetAndCount(source.i60_1, new Long(0, 0), byteCount);
221
+ var remainingByteCount = byteCount;
222
+ while (remainingByteCount.z(new Long(0, 0)) > 0) {
223
+ if (remainingByteCount.z(toLong(ensureNotNull(source.g60_1).f61())) < 0) {
224
+ var tail = this.h60_1;
225
+ var tmp;
226
+ if (!(tail == null) && tail.r60_1) {
227
+ // Inline function 'kotlin.Long.minus' call
228
+ // Inline function 'kotlin.Long.plus' call
229
+ var this_0 = remainingByteCount;
230
+ var other = tail.p60_1;
231
+ var this_1 = this_0.v2(toLong(other));
232
+ var other_0 = tail.c61() ? 0 : tail.o60_1;
233
+ tmp = this_1.w2(toLong(other_0)).z(new Long(8192, 0)) <= 0;
234
+ } else {
235
+ tmp = false;
236
+ }
237
+ if (tmp) {
238
+ ensureNotNull(source.g60_1).e61(tail, remainingByteCount.e1());
239
+ source.i60_1 = source.i60_1.w2(remainingByteCount);
240
+ this.i60_1 = this.i60_1.v2(remainingByteCount);
241
+ return Unit_instance;
242
+ } else {
243
+ source.g60_1 = ensureNotNull(source.g60_1).d61(remainingByteCount.e1());
244
+ }
245
+ }
246
+ var segmentToMove = ensureNotNull(source.g60_1);
247
+ var movedByteCount = toLong(segmentToMove.f61());
248
+ source.g60_1 = segmentToMove.g61();
249
+ if (source.g60_1 == null) {
250
+ source.h60_1 = null;
251
+ }
252
+ // Inline function 'kotlinx.io.Buffer.pushSegment' call
253
+ if (this.g60_1 == null) {
254
+ this.g60_1 = segmentToMove;
255
+ this.h60_1 = segmentToMove;
256
+ } else if (true) {
257
+ this.h60_1 = ensureNotNull(this.h60_1).a61(segmentToMove).h61();
258
+ if (ensureNotNull(this.h60_1).t60_1 == null) {
259
+ this.g60_1 = this.h60_1;
260
+ }
261
+ } else {
262
+ this.h60_1 = ensureNotNull(this.h60_1).a61(segmentToMove);
263
+ }
264
+ source.i60_1 = source.i60_1.w2(movedByteCount);
265
+ this.i60_1 = this.i60_1.v2(movedByteCount);
266
+ remainingByteCount = remainingByteCount.w2(movedByteCount);
267
+ }
268
+ };
269
+ protoOf(Buffer).d1w = function (byte) {
270
+ this.w60(1).i61(byte);
271
+ this.i60_1 = this.i60_1.v2(new Long(1, 0));
272
+ };
273
+ protoOf(Buffer).m1x = function () {
274
+ return Unit_instance;
275
+ };
276
+ protoOf(Buffer).toString = function () {
277
+ if (this.m().equals(new Long(0, 0)))
278
+ return 'Buffer(size=0)';
279
+ var maxPrintableBytes = 64;
280
+ // Inline function 'kotlinx.io.minOf' call
281
+ var b = this.m();
282
+ // Inline function 'kotlin.comparisons.minOf' call
283
+ var a = toLong(maxPrintableBytes);
284
+ var len = (a.z(b) <= 0 ? a : b).e1();
285
+ var builder = StringBuilder_init_$Create$(imul(len, 2) + (this.m().z(toLong(maxPrintableBytes)) > 0 ? 1 : 0) | 0);
286
+ var bytesWritten = 0;
287
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.forEachSegment' call
288
+ var curr = this.g60_1;
289
+ while (!(curr == null)) {
290
+ // Inline function 'kotlinx.io.Buffer.toString.<anonymous>' call
291
+ var ctx = get_SegmentReadContextImpl();
292
+ var segment = curr;
293
+ var idx = 0;
294
+ while (bytesWritten < len && idx < segment.f61()) {
295
+ var _unary__edvuaz = idx;
296
+ idx = _unary__edvuaz + 1 | 0;
297
+ var b_0 = ctx.j61(segment, _unary__edvuaz);
298
+ bytesWritten = bytesWritten + 1 | 0;
299
+ var tmp = get_HEX_DIGIT_CHARS();
300
+ // Inline function 'kotlinx.io.shr' call
301
+ var tmp$ret$2 = b_0 >> 4;
302
+ var tmp_0 = builder.o8(tmp[tmp$ret$2 & 15]);
303
+ var tmp_1 = get_HEX_DIGIT_CHARS();
304
+ // Inline function 'kotlinx.io.and' call
305
+ var tmp$ret$3 = b_0 & 15;
306
+ tmp_0.o8(tmp_1[tmp$ret$3]);
307
+ }
308
+ curr = curr.s60_1;
309
+ }
310
+ if (this.m().z(toLong(maxPrintableBytes)) > 0) {
311
+ builder.o8(_Char___init__impl__6a9atx(8230));
312
+ }
313
+ return 'Buffer(size=' + this.m().toString() + ' hex=' + builder.toString() + ')';
314
+ };
315
+ protoOf(Buffer).v60 = function () {
316
+ var oldHead = ensureNotNull(this.g60_1);
317
+ var nextHead = oldHead.s60_1;
318
+ this.g60_1 = nextHead;
319
+ if (nextHead == null) {
320
+ this.h60_1 = null;
321
+ } else {
322
+ nextHead.t60_1 = null;
323
+ }
324
+ oldHead.s60_1 = null;
325
+ SegmentPool_instance.k61(oldHead);
326
+ };
327
+ protoOf(Buffer).l61 = function () {
328
+ var oldTail = ensureNotNull(this.h60_1);
329
+ var newTail = oldTail.t60_1;
330
+ this.h60_1 = newTail;
331
+ if (newTail == null) {
332
+ this.g60_1 = null;
333
+ } else {
334
+ newTail.s60_1 = null;
335
+ }
336
+ oldTail.t60_1 = null;
337
+ SegmentPool_instance.k61(oldTail);
338
+ };
339
+ function buffered(_this__u8e3s4) {
340
+ return new RealSink(_this__u8e3s4);
341
+ }
342
+ function RealSink(sink) {
343
+ this.m61_1 = sink;
344
+ this.n61_1 = false;
345
+ this.o61_1 = new Buffer();
346
+ }
347
+ protoOf(RealSink).j60 = function () {
348
+ return this.o61_1;
349
+ };
350
+ protoOf(RealSink).b61 = function (source, byteCount) {
351
+ // Inline function 'kotlinx.io.RealSink.checkNotClosed' call
352
+ // Inline function 'kotlin.check' call
353
+ // Inline function 'kotlin.contracts.contract' call
354
+ if (!!this.n61_1) {
355
+ // Inline function 'kotlinx.io.RealSink.checkNotClosed.<anonymous>' call
356
+ var message = 'Sink is closed.';
357
+ throw IllegalStateException_init_$Create$(toString(message));
358
+ }
359
+ // Inline function 'kotlin.require' call
360
+ // Inline function 'kotlin.contracts.contract' call
361
+ if (!(byteCount.z(new Long(0, 0)) >= 0)) {
362
+ // Inline function 'kotlinx.io.RealSink.write.<anonymous>' call
363
+ var message_0 = 'byteCount: ' + byteCount.toString();
364
+ throw IllegalArgumentException_init_$Create$(toString(message_0));
365
+ }
366
+ this.o61_1.b61(source, byteCount);
367
+ this.l60();
368
+ };
369
+ protoOf(RealSink).l60 = function () {
370
+ // Inline function 'kotlinx.io.RealSink.checkNotClosed' call
371
+ // Inline function 'kotlin.check' call
372
+ // Inline function 'kotlin.contracts.contract' call
373
+ if (!!this.n61_1) {
374
+ // Inline function 'kotlinx.io.RealSink.checkNotClosed.<anonymous>' call
375
+ var message = 'Sink is closed.';
376
+ throw IllegalStateException_init_$Create$(toString(message));
377
+ }
378
+ var byteCount = this.o61_1.m60();
379
+ if (byteCount.z(new Long(0, 0)) > 0) {
380
+ this.m61_1.b61(this.o61_1, byteCount);
381
+ }
382
+ };
383
+ protoOf(RealSink).m1x = function () {
384
+ if (this.n61_1)
385
+ return Unit_instance;
386
+ var thrown = null;
387
+ try {
388
+ if (this.o61_1.m().z(new Long(0, 0)) > 0) {
389
+ this.m61_1.b61(this.o61_1, this.o61_1.m());
390
+ }
391
+ } catch ($p) {
392
+ if ($p instanceof Error) {
393
+ var e = $p;
394
+ thrown = e;
395
+ } else {
396
+ throw $p;
397
+ }
398
+ }
399
+ try {
400
+ this.m61_1.m1x();
401
+ } catch ($p) {
402
+ if ($p instanceof Error) {
403
+ var e_0 = $p;
404
+ if (thrown == null)
405
+ thrown = e_0;
406
+ } else {
407
+ throw $p;
408
+ }
409
+ }
410
+ this.n61_1 = true;
411
+ if (!(thrown == null))
412
+ throw thrown;
413
+ };
414
+ protoOf(RealSink).toString = function () {
415
+ return 'buffered(' + toString(this.m61_1) + ')';
416
+ };
417
+ function Segment_init_$Init$($this) {
418
+ Segment.call($this);
419
+ $this.n60_1 = new Int8Array(8192);
420
+ $this.r60_1 = true;
421
+ $this.q60_1 = null;
422
+ return $this;
423
+ }
424
+ function Segment_init_$Create$() {
425
+ return Segment_init_$Init$(objectCreate(protoOf(Segment)));
426
+ }
427
+ function Segment_init_$Init$_0(data, pos, limit, shareToken, owner, $this) {
428
+ Segment.call($this);
429
+ $this.n60_1 = data;
430
+ $this.o60_1 = pos;
431
+ $this.p60_1 = limit;
432
+ $this.q60_1 = shareToken;
433
+ $this.r60_1 = owner;
434
+ return $this;
435
+ }
436
+ function Segment_init_$Create$_0(data, pos, limit, shareToken, owner) {
437
+ return Segment_init_$Init$_0(data, pos, limit, shareToken, owner, objectCreate(protoOf(Segment)));
438
+ }
439
+ function Companion() {
440
+ this.p61_1 = 8192;
441
+ this.q61_1 = 1024;
442
+ }
443
+ protoOf(Companion).r61 = function () {
444
+ return Segment_init_$Create$();
445
+ };
446
+ var Companion_instance;
447
+ function Companion_getInstance() {
448
+ return Companion_instance;
449
+ }
450
+ protoOf(Segment).c61 = function () {
451
+ var tmp1_safe_receiver = this.q60_1;
452
+ var tmp0_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.s61();
453
+ return tmp0_elvis_lhs == null ? false : tmp0_elvis_lhs;
454
+ };
455
+ protoOf(Segment).t61 = function () {
456
+ var tmp0_elvis_lhs = this.q60_1;
457
+ var tmp;
458
+ if (tmp0_elvis_lhs == null) {
459
+ // Inline function 'kotlin.also' call
460
+ var this_0 = SegmentPool_instance.u61();
461
+ // Inline function 'kotlin.contracts.contract' call
462
+ // Inline function 'kotlinx.io.Segment.sharedCopy.<anonymous>' call
463
+ this.q60_1 = this_0;
464
+ tmp = this_0;
465
+ } else {
466
+ tmp = tmp0_elvis_lhs;
467
+ }
468
+ var t = tmp;
469
+ var tmp_0 = this.o60_1;
470
+ var tmp_1 = this.p60_1;
471
+ // Inline function 'kotlin.also' call
472
+ // Inline function 'kotlin.contracts.contract' call
473
+ // Inline function 'kotlinx.io.Segment.sharedCopy.<anonymous>' call
474
+ t.v61();
475
+ return Segment_init_$Create$_0(this.n60_1, tmp_0, tmp_1, t, false);
476
+ };
477
+ protoOf(Segment).g61 = function () {
478
+ var result = this.s60_1;
479
+ if (!(this.t60_1 == null)) {
480
+ ensureNotNull(this.t60_1).s60_1 = this.s60_1;
481
+ }
482
+ if (!(this.s60_1 == null)) {
483
+ ensureNotNull(this.s60_1).t60_1 = this.t60_1;
484
+ }
485
+ this.s60_1 = null;
486
+ this.t60_1 = null;
487
+ return result;
488
+ };
489
+ protoOf(Segment).a61 = function (segment) {
490
+ segment.t60_1 = this;
491
+ segment.s60_1 = this.s60_1;
492
+ if (!(this.s60_1 == null)) {
493
+ ensureNotNull(this.s60_1).t60_1 = segment;
494
+ }
495
+ this.s60_1 = segment;
496
+ return segment;
497
+ };
498
+ protoOf(Segment).d61 = function (byteCount) {
499
+ // Inline function 'kotlin.require' call
500
+ // Inline function 'kotlin.contracts.contract' call
501
+ if (!(byteCount > 0 && byteCount <= (this.p60_1 - this.o60_1 | 0))) {
502
+ // Inline function 'kotlinx.io.Segment.split.<anonymous>' call
503
+ var message = 'byteCount out of range';
504
+ throw IllegalArgumentException_init_$Create$(toString(message));
505
+ }
506
+ var prefix;
507
+ if (byteCount >= 1024) {
508
+ prefix = this.t61();
509
+ } else {
510
+ prefix = SegmentPool_instance.z60();
511
+ // Inline function 'kotlin.collections.copyInto' call
512
+ var this_0 = this.n60_1;
513
+ var destination = prefix.n60_1;
514
+ var startIndex = this.o60_1;
515
+ var endIndex = this.o60_1 + byteCount | 0;
516
+ // Inline function 'kotlin.js.unsafeCast' call
517
+ // Inline function 'kotlin.js.asDynamic' call
518
+ var tmp = this_0;
519
+ // Inline function 'kotlin.js.unsafeCast' call
520
+ // Inline function 'kotlin.js.asDynamic' call
521
+ arrayCopy(tmp, destination, 0, startIndex, endIndex);
522
+ }
523
+ prefix.p60_1 = prefix.o60_1 + byteCount | 0;
524
+ this.o60_1 = this.o60_1 + byteCount | 0;
525
+ if (!(this.t60_1 == null)) {
526
+ ensureNotNull(this.t60_1).a61(prefix);
527
+ } else {
528
+ prefix.s60_1 = this;
529
+ this.t60_1 = prefix;
530
+ }
531
+ return prefix;
532
+ };
533
+ protoOf(Segment).h61 = function () {
534
+ // Inline function 'kotlin.check' call
535
+ // Inline function 'kotlin.contracts.contract' call
536
+ if (!!(this.t60_1 == null)) {
537
+ // Inline function 'kotlinx.io.Segment.compact.<anonymous>' call
538
+ var message = 'cannot compact';
539
+ throw IllegalStateException_init_$Create$(toString(message));
540
+ }
541
+ if (!ensureNotNull(this.t60_1).r60_1)
542
+ return this;
543
+ var byteCount = this.p60_1 - this.o60_1 | 0;
544
+ var availableByteCount = (8192 - ensureNotNull(this.t60_1).p60_1 | 0) + (ensureNotNull(this.t60_1).c61() ? 0 : ensureNotNull(this.t60_1).o60_1) | 0;
545
+ if (byteCount > availableByteCount)
546
+ return this;
547
+ var predecessor = this.t60_1;
548
+ this.e61(ensureNotNull(predecessor), byteCount);
549
+ var successor = this.g61();
550
+ // Inline function 'kotlin.check' call
551
+ // Inline function 'kotlin.contracts.contract' call
552
+ // Inline function 'kotlin.check' call
553
+ // Inline function 'kotlin.contracts.contract' call
554
+ if (!(successor == null)) {
555
+ // Inline function 'kotlin.check.<anonymous>' call
556
+ var message_0 = 'Check failed.';
557
+ throw IllegalStateException_init_$Create$(toString(message_0));
558
+ }
559
+ SegmentPool_instance.k61(this);
560
+ return predecessor;
561
+ };
562
+ protoOf(Segment).i61 = function (byte) {
563
+ var _unary__edvuaz = this.p60_1;
564
+ this.p60_1 = _unary__edvuaz + 1 | 0;
565
+ this.n60_1[_unary__edvuaz] = byte;
566
+ };
567
+ protoOf(Segment).e61 = function (sink, byteCount) {
568
+ // Inline function 'kotlin.check' call
569
+ // Inline function 'kotlin.contracts.contract' call
570
+ if (!sink.r60_1) {
571
+ // Inline function 'kotlinx.io.Segment.writeTo.<anonymous>' call
572
+ var message = 'only owner can write';
573
+ throw IllegalStateException_init_$Create$(toString(message));
574
+ }
575
+ if ((sink.p60_1 + byteCount | 0) > 8192) {
576
+ if (sink.c61())
577
+ throw IllegalArgumentException_init_$Create$_0();
578
+ if (((sink.p60_1 + byteCount | 0) - sink.o60_1 | 0) > 8192)
579
+ throw IllegalArgumentException_init_$Create$_0();
580
+ // Inline function 'kotlin.collections.copyInto' call
581
+ var this_0 = sink.n60_1;
582
+ var destination = sink.n60_1;
583
+ var startIndex = sink.o60_1;
584
+ var endIndex = sink.p60_1;
585
+ // Inline function 'kotlin.js.unsafeCast' call
586
+ // Inline function 'kotlin.js.asDynamic' call
587
+ var tmp = this_0;
588
+ // Inline function 'kotlin.js.unsafeCast' call
589
+ // Inline function 'kotlin.js.asDynamic' call
590
+ arrayCopy(tmp, destination, 0, startIndex, endIndex);
591
+ sink.p60_1 = sink.p60_1 - sink.o60_1 | 0;
592
+ sink.o60_1 = 0;
593
+ }
594
+ // Inline function 'kotlin.collections.copyInto' call
595
+ var this_1 = this.n60_1;
596
+ var destination_0 = sink.n60_1;
597
+ var destinationOffset = sink.p60_1;
598
+ var startIndex_0 = this.o60_1;
599
+ var endIndex_0 = this.o60_1 + byteCount | 0;
600
+ // Inline function 'kotlin.js.unsafeCast' call
601
+ // Inline function 'kotlin.js.asDynamic' call
602
+ var tmp_0 = this_1;
603
+ // Inline function 'kotlin.js.unsafeCast' call
604
+ // Inline function 'kotlin.js.asDynamic' call
605
+ arrayCopy(tmp_0, destination_0, destinationOffset, startIndex_0, endIndex_0);
606
+ sink.p60_1 = sink.p60_1 + byteCount | 0;
607
+ this.o60_1 = this.o60_1 + byteCount | 0;
608
+ };
609
+ protoOf(Segment).f61 = function () {
610
+ return this.p60_1 - this.o60_1 | 0;
611
+ };
612
+ protoOf(Segment).w61 = function () {
613
+ return this.n60_1.length - this.p60_1 | 0;
614
+ };
615
+ protoOf(Segment).x61 = function (readOnly) {
616
+ return this.n60_1;
617
+ };
618
+ protoOf(Segment).y61 = function (index) {
619
+ return this.n60_1[this.o60_1 + index | 0];
620
+ };
621
+ protoOf(Segment).z61 = function (index, value) {
622
+ this.n60_1[this.p60_1 + index | 0] = value;
623
+ };
624
+ protoOf(Segment).a62 = function (index, b0, b1) {
625
+ var d = this.n60_1;
626
+ var l = this.p60_1;
627
+ d[l + index | 0] = b0;
628
+ d[(l + index | 0) + 1 | 0] = b1;
629
+ };
630
+ protoOf(Segment).b62 = function (index, b0, b1, b2) {
631
+ var d = this.n60_1;
632
+ var l = this.p60_1;
633
+ d[l + index | 0] = b0;
634
+ d[(l + index | 0) + 1 | 0] = b1;
635
+ d[(l + index | 0) + 2 | 0] = b2;
636
+ };
637
+ protoOf(Segment).c62 = function (index, b0, b1, b2, b3) {
638
+ var d = this.n60_1;
639
+ var l = this.p60_1;
640
+ d[l + index | 0] = b0;
641
+ d[(l + index | 0) + 1 | 0] = b1;
642
+ d[(l + index | 0) + 2 | 0] = b2;
643
+ d[(l + index | 0) + 3 | 0] = b3;
644
+ };
645
+ function Segment() {
646
+ this.o60_1 = 0;
647
+ this.p60_1 = 0;
648
+ this.q60_1 = null;
649
+ this.r60_1 = false;
650
+ this.s60_1 = null;
651
+ this.t60_1 = null;
652
+ }
653
+ function SegmentCopyTracker() {
654
+ }
655
+ function isEmpty(_this__u8e3s4) {
656
+ return _this__u8e3s4.f61() === 0;
657
+ }
658
+ function AlwaysSharedCopyTracker() {
659
+ AlwaysSharedCopyTracker_instance = this;
660
+ SegmentCopyTracker.call(this);
661
+ }
662
+ protoOf(AlwaysSharedCopyTracker).s61 = function () {
663
+ return true;
664
+ };
665
+ protoOf(AlwaysSharedCopyTracker).v61 = function () {
666
+ return Unit_instance;
667
+ };
668
+ var AlwaysSharedCopyTracker_instance;
669
+ function AlwaysSharedCopyTracker_getInstance() {
670
+ if (AlwaysSharedCopyTracker_instance == null)
671
+ new AlwaysSharedCopyTracker();
672
+ return AlwaysSharedCopyTracker_instance;
673
+ }
674
+ function writeString(_this__u8e3s4, string, startIndex, endIndex) {
675
+ startIndex = startIndex === VOID ? 0 : startIndex;
676
+ endIndex = endIndex === VOID ? string.length : endIndex;
677
+ // Inline function 'kotlinx.io.checkBounds' call
678
+ var size = string.length;
679
+ checkBounds(toLong(size), toLong(startIndex), toLong(endIndex));
680
+ // Inline function 'kotlinx.io.writeToInternalBuffer' call
681
+ // Inline function 'kotlinx.io.writeString.<anonymous>' call
682
+ // Inline function 'kotlinx.io.commonWriteUtf8' call
683
+ var this_0 = _this__u8e3s4.j60();
684
+ var i = startIndex;
685
+ while (i < endIndex) {
686
+ // Inline function 'kotlin.code' call
687
+ var p0 = i;
688
+ var this_1 = charSequenceGet(string, p0);
689
+ var c = Char__toInt_impl_vasixd(this_1);
690
+ if (c < 128) {
691
+ $l$block_0: {
692
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail' call
693
+ var tail = this_0.w60(1);
694
+ // Inline function 'kotlinx.io.commonWriteUtf8.<anonymous>' call
695
+ var ctx = get_SegmentWriteContextImpl();
696
+ var segmentOffset = -i | 0;
697
+ // Inline function 'kotlin.comparisons.minOf' call
698
+ var b = i + tail.w61() | 0;
699
+ var runLimit = Math.min(endIndex, b);
700
+ var _unary__edvuaz = i;
701
+ i = _unary__edvuaz + 1 | 0;
702
+ ctx.g62(tail, segmentOffset + _unary__edvuaz | 0, toByte(c));
703
+ $l$loop: while (i < runLimit) {
704
+ // Inline function 'kotlin.code' call
705
+ var p0_0 = i;
706
+ var this_2 = charSequenceGet(string, p0_0);
707
+ c = Char__toInt_impl_vasixd(this_2);
708
+ if (c >= 128)
709
+ break $l$loop;
710
+ var _unary__edvuaz_0 = i;
711
+ i = _unary__edvuaz_0 + 1 | 0;
712
+ ctx.g62(tail, segmentOffset + _unary__edvuaz_0 | 0, toByte(c));
713
+ }
714
+ var bytesWritten = i + segmentOffset | 0;
715
+ if (bytesWritten === 1) {
716
+ tail.p60_1 = tail.p60_1 + bytesWritten | 0;
717
+ var tmp = this_0;
718
+ // Inline function 'kotlin.Long.plus' call
719
+ tmp.i60_1 = this_0.i60_1.v2(toLong(bytesWritten));
720
+ break $l$block_0;
721
+ }
722
+ // Inline function 'kotlin.check' call
723
+ // Inline function 'kotlin.contracts.contract' call
724
+ if (!(0 <= bytesWritten ? bytesWritten <= tail.w61() : false)) {
725
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail.<anonymous>' call
726
+ var message = 'Invalid number of bytes written: ' + bytesWritten + '. Should be in 0..' + tail.w61();
727
+ throw IllegalStateException_init_$Create$(toString(message));
728
+ }
729
+ if (!(bytesWritten === 0)) {
730
+ tail.p60_1 = tail.p60_1 + bytesWritten | 0;
731
+ var tmp_0 = this_0;
732
+ // Inline function 'kotlin.Long.plus' call
733
+ tmp_0.i60_1 = this_0.i60_1.v2(toLong(bytesWritten));
734
+ break $l$block_0;
735
+ }
736
+ if (isEmpty(tail)) {
737
+ this_0.l61();
738
+ }
739
+ }
740
+ } else if (c < 2048) {
741
+ $l$block_2: {
742
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail' call
743
+ var tail_0 = this_0.w60(2);
744
+ // Inline function 'kotlinx.io.commonWriteUtf8.<anonymous>' call
745
+ get_SegmentWriteContextImpl().f62(tail_0, 0, toByte(c >> 6 | 192), toByte(c & 63 | 128));
746
+ var bytesWritten_0 = 2;
747
+ if (bytesWritten_0 === 2) {
748
+ tail_0.p60_1 = tail_0.p60_1 + bytesWritten_0 | 0;
749
+ var tmp_1 = this_0;
750
+ // Inline function 'kotlin.Long.plus' call
751
+ tmp_1.i60_1 = this_0.i60_1.v2(toLong(bytesWritten_0));
752
+ break $l$block_2;
753
+ }
754
+ // Inline function 'kotlin.check' call
755
+ // Inline function 'kotlin.contracts.contract' call
756
+ if (!(0 <= bytesWritten_0 ? bytesWritten_0 <= tail_0.w61() : false)) {
757
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail.<anonymous>' call
758
+ var message_0 = 'Invalid number of bytes written: ' + bytesWritten_0 + '. Should be in 0..' + tail_0.w61();
759
+ throw IllegalStateException_init_$Create$(toString(message_0));
760
+ }
761
+ if (!(bytesWritten_0 === 0)) {
762
+ tail_0.p60_1 = tail_0.p60_1 + bytesWritten_0 | 0;
763
+ var tmp_2 = this_0;
764
+ // Inline function 'kotlin.Long.plus' call
765
+ tmp_2.i60_1 = this_0.i60_1.v2(toLong(bytesWritten_0));
766
+ break $l$block_2;
767
+ }
768
+ if (isEmpty(tail_0)) {
769
+ this_0.l61();
770
+ }
771
+ }
772
+ i = i + 1 | 0;
773
+ } else if (c < 55296 || c > 57343) {
774
+ $l$block_4: {
775
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail' call
776
+ var tail_1 = this_0.w60(3);
777
+ // Inline function 'kotlinx.io.commonWriteUtf8.<anonymous>' call
778
+ get_SegmentWriteContextImpl().e62(tail_1, 0, toByte(c >> 12 | 224), toByte(c >> 6 & 63 | 128), toByte(c & 63 | 128));
779
+ var bytesWritten_1 = 3;
780
+ if (bytesWritten_1 === 3) {
781
+ tail_1.p60_1 = tail_1.p60_1 + bytesWritten_1 | 0;
782
+ var tmp_3 = this_0;
783
+ // Inline function 'kotlin.Long.plus' call
784
+ tmp_3.i60_1 = this_0.i60_1.v2(toLong(bytesWritten_1));
785
+ break $l$block_4;
786
+ }
787
+ // Inline function 'kotlin.check' call
788
+ // Inline function 'kotlin.contracts.contract' call
789
+ if (!(0 <= bytesWritten_1 ? bytesWritten_1 <= tail_1.w61() : false)) {
790
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail.<anonymous>' call
791
+ var message_1 = 'Invalid number of bytes written: ' + bytesWritten_1 + '. Should be in 0..' + tail_1.w61();
792
+ throw IllegalStateException_init_$Create$(toString(message_1));
793
+ }
794
+ if (!(bytesWritten_1 === 0)) {
795
+ tail_1.p60_1 = tail_1.p60_1 + bytesWritten_1 | 0;
796
+ var tmp_4 = this_0;
797
+ // Inline function 'kotlin.Long.plus' call
798
+ tmp_4.i60_1 = this_0.i60_1.v2(toLong(bytesWritten_1));
799
+ break $l$block_4;
800
+ }
801
+ if (isEmpty(tail_1)) {
802
+ this_0.l61();
803
+ }
804
+ }
805
+ i = i + 1 | 0;
806
+ } else {
807
+ var tmp_5;
808
+ if ((i + 1 | 0) < endIndex) {
809
+ // Inline function 'kotlin.code' call
810
+ var p0_1 = i + 1 | 0;
811
+ var this_3 = charSequenceGet(string, p0_1);
812
+ tmp_5 = Char__toInt_impl_vasixd(this_3);
813
+ } else {
814
+ tmp_5 = 0;
815
+ }
816
+ var low = tmp_5;
817
+ if (c > 56319 || !(56320 <= low ? low <= 57343 : false)) {
818
+ this_0.d1w(63);
819
+ i = i + 1 | 0;
820
+ } else {
821
+ var codePoint = 65536 + ((c & 1023) << 10 | low & 1023) | 0;
822
+ $l$block_6: {
823
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail' call
824
+ var tail_2 = this_0.w60(4);
825
+ // Inline function 'kotlinx.io.commonWriteUtf8.<anonymous>' call
826
+ get_SegmentWriteContextImpl().d62(tail_2, 0, toByte(codePoint >> 18 | 240), toByte(codePoint >> 12 & 63 | 128), toByte(codePoint >> 6 & 63 | 128), toByte(codePoint & 63 | 128));
827
+ var bytesWritten_2 = 4;
828
+ if (bytesWritten_2 === 4) {
829
+ tail_2.p60_1 = tail_2.p60_1 + bytesWritten_2 | 0;
830
+ var tmp_6 = this_0;
831
+ // Inline function 'kotlin.Long.plus' call
832
+ tmp_6.i60_1 = this_0.i60_1.v2(toLong(bytesWritten_2));
833
+ break $l$block_6;
834
+ }
835
+ // Inline function 'kotlin.check' call
836
+ // Inline function 'kotlin.contracts.contract' call
837
+ if (!(0 <= bytesWritten_2 ? bytesWritten_2 <= tail_2.w61() : false)) {
838
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.writeToTail.<anonymous>' call
839
+ var message_2 = 'Invalid number of bytes written: ' + bytesWritten_2 + '. Should be in 0..' + tail_2.w61();
840
+ throw IllegalStateException_init_$Create$(toString(message_2));
841
+ }
842
+ if (!(bytesWritten_2 === 0)) {
843
+ tail_2.p60_1 = tail_2.p60_1 + bytesWritten_2 | 0;
844
+ var tmp_7 = this_0;
845
+ // Inline function 'kotlin.Long.plus' call
846
+ tmp_7.i60_1 = this_0.i60_1.v2(toLong(bytesWritten_2));
847
+ break $l$block_6;
848
+ }
849
+ if (isEmpty(tail_2)) {
850
+ this_0.l61();
851
+ }
852
+ }
853
+ i = i + 2 | 0;
854
+ }
855
+ }
856
+ }
857
+ _this__u8e3s4.l60();
858
+ }
859
+ function FileSystem() {
860
+ }
861
+ function SystemFileSystemImpl() {
862
+ }
863
+ function FileMetadata(isRegularFile, isDirectory, size) {
864
+ isRegularFile = isRegularFile === VOID ? false : isRegularFile;
865
+ isDirectory = isDirectory === VOID ? false : isDirectory;
866
+ size = size === VOID ? new Long(0, 0) : size;
867
+ this.n62_1 = isRegularFile;
868
+ this.o62_1 = isDirectory;
869
+ this.p62_1 = size;
870
+ }
871
+ function removeTrailingSeparators(path, isWindows_) {
872
+ isWindows_ = isWindows_ === VOID ? get_isWindows() : isWindows_;
873
+ if (isWindows_) {
874
+ var tmp;
875
+ if (path.length > 1) {
876
+ var tmp_0;
877
+ if (charSequenceGet(path, 1) === _Char___init__impl__6a9atx(58)) {
878
+ tmp_0 = 3;
879
+ } else if (isUnc(path)) {
880
+ tmp_0 = 2;
881
+ } else {
882
+ tmp_0 = 1;
883
+ }
884
+ tmp = tmp_0;
885
+ } else {
886
+ tmp = 1;
887
+ }
888
+ var limit = tmp;
889
+ return removeTrailingSeparatorsWindows(limit, path);
890
+ }
891
+ return removeTrailingSeparatorsUnix(path);
892
+ }
893
+ function Path(base, parts) {
894
+ // Inline function 'kotlin.text.buildString' call
895
+ // Inline function 'kotlin.contracts.contract' call
896
+ // Inline function 'kotlin.apply' call
897
+ var this_0 = StringBuilder_init_$Create$_0();
898
+ // Inline function 'kotlin.contracts.contract' call
899
+ // Inline function 'kotlinx.io.files.Path.<anonymous>' call
900
+ this_0.n8(base);
901
+ // Inline function 'kotlin.collections.forEach' call
902
+ var inductionVariable = 0;
903
+ var last = parts.length;
904
+ while (inductionVariable < last) {
905
+ var element = parts[inductionVariable];
906
+ inductionVariable = inductionVariable + 1 | 0;
907
+ // Inline function 'kotlinx.io.files.Path.<anonymous>.<anonymous>' call
908
+ var tmp;
909
+ // Inline function 'kotlin.text.isNotEmpty' call
910
+ if (charSequenceLength(this_0) > 0) {
911
+ tmp = !endsWith(this_0, get_SystemPathSeparator());
912
+ } else {
913
+ tmp = false;
914
+ }
915
+ if (tmp) {
916
+ this_0.o8(get_SystemPathSeparator());
917
+ }
918
+ this_0.n8(element);
919
+ }
920
+ var tmp$ret$2 = this_0.toString();
921
+ return Path_1(tmp$ret$2);
922
+ }
923
+ function isUnc(path) {
924
+ if (path.length < 2)
925
+ return false;
926
+ if (startsWith(path, '\\\\'))
927
+ return true;
928
+ if (startsWith(path, '//'))
929
+ return true;
930
+ return false;
931
+ }
932
+ function removeTrailingSeparatorsWindows(suffixLength, path) {
933
+ // Inline function 'kotlin.require' call
934
+ // Inline function 'kotlin.contracts.contract' call
935
+ // Inline function 'kotlin.require' call
936
+ // Inline function 'kotlin.contracts.contract' call
937
+ if (!(suffixLength >= 1)) {
938
+ // Inline function 'kotlin.require.<anonymous>' call
939
+ var message = 'Failed requirement.';
940
+ throw IllegalArgumentException_init_$Create$(toString(message));
941
+ }
942
+ var idx = path.length;
943
+ $l$loop: while (idx > suffixLength) {
944
+ var c = charSequenceGet(path, idx - 1 | 0);
945
+ if (!(c === _Char___init__impl__6a9atx(92)) && !(c === _Char___init__impl__6a9atx(47)))
946
+ break $l$loop;
947
+ idx = idx - 1 | 0;
948
+ }
949
+ // Inline function 'kotlin.text.substring' call
950
+ var endIndex = idx;
951
+ // Inline function 'kotlin.js.asDynamic' call
952
+ return path.substring(0, endIndex);
953
+ }
954
+ function removeTrailingSeparatorsUnix(path) {
955
+ var idx = path.length;
956
+ while (idx > 1 && charSequenceGet(path, idx - 1 | 0) === _Char___init__impl__6a9atx(47)) {
957
+ idx = idx - 1 | 0;
958
+ }
959
+ // Inline function 'kotlin.text.substring' call
960
+ var endIndex = idx;
961
+ // Inline function 'kotlin.js.asDynamic' call
962
+ return path.substring(0, endIndex);
963
+ }
964
+ function get_SegmentReadContextImpl() {
965
+ _init_properties_UnsafeBufferOperations_kt__xw75gy();
966
+ return SegmentReadContextImpl;
967
+ }
968
+ var SegmentReadContextImpl;
969
+ function get_SegmentWriteContextImpl() {
970
+ _init_properties_UnsafeBufferOperations_kt__xw75gy();
971
+ return SegmentWriteContextImpl;
972
+ }
973
+ var SegmentWriteContextImpl;
974
+ var BufferIterationContextImpl;
975
+ function UnsafeBufferOperations() {
976
+ }
977
+ var UnsafeBufferOperations_instance;
978
+ function UnsafeBufferOperations_getInstance() {
979
+ return UnsafeBufferOperations_instance;
980
+ }
981
+ function SegmentReadContextImpl$1() {
982
+ }
983
+ protoOf(SegmentReadContextImpl$1).j61 = function (segment, offset) {
984
+ return segment.y61(offset);
985
+ };
986
+ function SegmentWriteContextImpl$1() {
987
+ }
988
+ protoOf(SegmentWriteContextImpl$1).g62 = function (segment, offset, value) {
989
+ segment.z61(offset, value);
990
+ };
991
+ protoOf(SegmentWriteContextImpl$1).f62 = function (segment, offset, b0, b1) {
992
+ segment.a62(offset, b0, b1);
993
+ };
994
+ protoOf(SegmentWriteContextImpl$1).e62 = function (segment, offset, b0, b1, b2) {
995
+ segment.b62(offset, b0, b1, b2);
996
+ };
997
+ protoOf(SegmentWriteContextImpl$1).d62 = function (segment, offset, b0, b1, b2, b3) {
998
+ segment.c62(offset, b0, b1, b2, b3);
999
+ };
1000
+ function BufferIterationContextImpl$1() {
1001
+ }
1002
+ protoOf(BufferIterationContextImpl$1).j61 = function (segment, offset) {
1003
+ return get_SegmentReadContextImpl().j61(segment, offset);
1004
+ };
1005
+ var properties_initialized_UnsafeBufferOperations_kt_2xfgoc;
1006
+ function _init_properties_UnsafeBufferOperations_kt__xw75gy() {
1007
+ if (!properties_initialized_UnsafeBufferOperations_kt_2xfgoc) {
1008
+ properties_initialized_UnsafeBufferOperations_kt_2xfgoc = true;
1009
+ SegmentReadContextImpl = new SegmentReadContextImpl$1();
1010
+ SegmentWriteContextImpl = new SegmentWriteContextImpl$1();
1011
+ BufferIterationContextImpl = new BufferIterationContextImpl$1();
1012
+ }
1013
+ }
1014
+ function withCaughtException(block) {
1015
+ try {
1016
+ block();
1017
+ return null;
1018
+ } catch ($p) {
1019
+ if ($p instanceof Error) {
1020
+ var t = $p;
1021
+ return t;
1022
+ } else {
1023
+ throw $p;
1024
+ }
1025
+ }
1026
+ }
1027
+ function IOException_init_$Init$($this) {
1028
+ Exception_init_$Init$($this);
1029
+ IOException.call($this);
1030
+ return $this;
1031
+ }
1032
+ function IOException_init_$Create$() {
1033
+ var tmp = IOException_init_$Init$(objectCreate(protoOf(IOException)));
1034
+ captureStack(tmp, IOException_init_$Create$);
1035
+ return tmp;
1036
+ }
1037
+ function IOException_init_$Init$_0(message, $this) {
1038
+ Exception_init_$Init$_0(message, $this);
1039
+ IOException.call($this);
1040
+ return $this;
1041
+ }
1042
+ function IOException_init_$Create$_0(message) {
1043
+ var tmp = IOException_init_$Init$_0(message, objectCreate(protoOf(IOException)));
1044
+ captureStack(tmp, IOException_init_$Create$_0);
1045
+ return tmp;
1046
+ }
1047
+ function IOException_init_$Init$_1(message, cause, $this) {
1048
+ Exception_init_$Init$_1(message, cause, $this);
1049
+ IOException.call($this);
1050
+ return $this;
1051
+ }
1052
+ function IOException_init_$Create$_1(message, cause) {
1053
+ var tmp = IOException_init_$Init$_1(message, cause, objectCreate(protoOf(IOException)));
1054
+ captureStack(tmp, IOException_init_$Create$_1);
1055
+ return tmp;
1056
+ }
1057
+ function IOException() {
1058
+ captureStack(this, IOException);
1059
+ }
1060
+ function EOFException_init_$Init$($this) {
1061
+ IOException_init_$Init$($this);
1062
+ EOFException.call($this);
1063
+ return $this;
1064
+ }
1065
+ function EOFException_init_$Create$() {
1066
+ var tmp = EOFException_init_$Init$(objectCreate(protoOf(EOFException)));
1067
+ captureStack(tmp, EOFException_init_$Create$);
1068
+ return tmp;
1069
+ }
1070
+ function EOFException_init_$Init$_0(message, $this) {
1071
+ IOException_init_$Init$_0(message, $this);
1072
+ EOFException.call($this);
1073
+ return $this;
1074
+ }
1075
+ function EOFException_init_$Create$_0(message) {
1076
+ var tmp = EOFException_init_$Init$_0(message, objectCreate(protoOf(EOFException)));
1077
+ captureStack(tmp, EOFException_init_$Create$_0);
1078
+ return tmp;
1079
+ }
1080
+ function EOFException() {
1081
+ captureStack(this, EOFException);
1082
+ }
1083
+ function SegmentPool() {
1084
+ this.x60_1 = 0;
1085
+ this.y60_1 = 0;
1086
+ }
1087
+ protoOf(SegmentPool).z60 = function () {
1088
+ return Companion_instance.r61();
1089
+ };
1090
+ protoOf(SegmentPool).k61 = function (segment) {
1091
+ };
1092
+ protoOf(SegmentPool).u61 = function () {
1093
+ return AlwaysSharedCopyTracker_getInstance();
1094
+ };
1095
+ var SegmentPool_instance;
1096
+ function SegmentPool_getInstance() {
1097
+ return SegmentPool_instance;
1098
+ }
1099
+ function get_path() {
1100
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1101
+ // Inline function 'kotlin.getValue' call
1102
+ var this_0 = path$delegate;
1103
+ path$factory();
1104
+ return this_0.u();
1105
+ }
1106
+ var path$delegate;
1107
+ function get_fs() {
1108
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1109
+ // Inline function 'kotlin.getValue' call
1110
+ var this_0 = fs$delegate;
1111
+ fs$factory();
1112
+ return this_0.u();
1113
+ }
1114
+ var fs$delegate;
1115
+ function get_os() {
1116
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1117
+ // Inline function 'kotlin.getValue' call
1118
+ var this_0 = os$delegate;
1119
+ os$factory();
1120
+ return this_0.u();
1121
+ }
1122
+ var os$delegate;
1123
+ function get_buffer() {
1124
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1125
+ // Inline function 'kotlin.getValue' call
1126
+ var this_0 = buffer$delegate;
1127
+ buffer$factory();
1128
+ return this_0.u();
1129
+ }
1130
+ var buffer$delegate;
1131
+ function path$delegate$lambda() {
1132
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1133
+ var tmp;
1134
+ try {
1135
+ tmp = eval('require')('path');
1136
+ } catch ($p) {
1137
+ var tmp_0;
1138
+ if ($p instanceof Error) {
1139
+ var e = $p;
1140
+ throw UnsupportedOperationException_init_$Create$("Module 'path' could not be imported", e);
1141
+ } else {
1142
+ throw $p;
1143
+ }
1144
+ }
1145
+ return tmp;
1146
+ }
1147
+ function fs$delegate$lambda() {
1148
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1149
+ var tmp;
1150
+ try {
1151
+ tmp = eval('require')('fs');
1152
+ } catch ($p) {
1153
+ var tmp_0;
1154
+ if ($p instanceof Error) {
1155
+ var e = $p;
1156
+ throw UnsupportedOperationException_init_$Create$("Module 'fs' could not be imported", e);
1157
+ } else {
1158
+ throw $p;
1159
+ }
1160
+ }
1161
+ return tmp;
1162
+ }
1163
+ function os$delegate$lambda() {
1164
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1165
+ var tmp;
1166
+ try {
1167
+ tmp = eval('require')('os');
1168
+ } catch ($p) {
1169
+ var tmp_0;
1170
+ if ($p instanceof Error) {
1171
+ var e = $p;
1172
+ throw UnsupportedOperationException_init_$Create$("Module 'os' could not be imported", e);
1173
+ } else {
1174
+ throw $p;
1175
+ }
1176
+ }
1177
+ return tmp;
1178
+ }
1179
+ function buffer$delegate$lambda() {
1180
+ _init_properties_nodeModulesJs_kt__ngjjzw();
1181
+ var tmp;
1182
+ try {
1183
+ tmp = eval('require')('buffer');
1184
+ } catch ($p) {
1185
+ var tmp_0;
1186
+ if ($p instanceof Error) {
1187
+ var e = $p;
1188
+ throw UnsupportedOperationException_init_$Create$("Module 'buffer' could not be imported", e);
1189
+ } else {
1190
+ throw $p;
1191
+ }
1192
+ }
1193
+ return tmp;
1194
+ }
1195
+ function path$factory() {
1196
+ return getPropertyCallableRef('path', 0, KProperty0, function () {
1197
+ return get_path();
1198
+ }, null);
1199
+ }
1200
+ function fs$factory() {
1201
+ return getPropertyCallableRef('fs', 0, KProperty0, function () {
1202
+ return get_fs();
1203
+ }, null);
1204
+ }
1205
+ function os$factory() {
1206
+ return getPropertyCallableRef('os', 0, KProperty0, function () {
1207
+ return get_os();
1208
+ }, null);
1209
+ }
1210
+ function buffer$factory() {
1211
+ return getPropertyCallableRef('buffer', 0, KProperty0, function () {
1212
+ return get_buffer();
1213
+ }, null);
1214
+ }
1215
+ var properties_initialized_nodeModulesJs_kt_oooz8e;
1216
+ function _init_properties_nodeModulesJs_kt__ngjjzw() {
1217
+ if (!properties_initialized_nodeModulesJs_kt_oooz8e) {
1218
+ properties_initialized_nodeModulesJs_kt_oooz8e = true;
1219
+ path$delegate = lazy(path$delegate$lambda);
1220
+ fs$delegate = lazy(fs$delegate$lambda);
1221
+ os$delegate = lazy(os$delegate$lambda);
1222
+ buffer$delegate = lazy(buffer$delegate$lambda);
1223
+ }
1224
+ }
1225
+ function get_SystemFileSystem() {
1226
+ _init_properties_FileSystemNodeJs_kt__m4c3u();
1227
+ return SystemFileSystem;
1228
+ }
1229
+ var SystemFileSystem;
1230
+ function get_isWindows() {
1231
+ _init_properties_FileSystemNodeJs_kt__m4c3u();
1232
+ return isWindows;
1233
+ }
1234
+ var isWindows;
1235
+ function FileNotFoundException(message) {
1236
+ IOException_init_$Init$_0(message, this);
1237
+ captureStack(this, FileNotFoundException);
1238
+ }
1239
+ function get_SystemTemporaryDirectory() {
1240
+ _init_properties_FileSystemNodeJs_kt__m4c3u();
1241
+ var tmp0_elvis_lhs = get_os().tmpdir();
1242
+ return Path_1(tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs);
1243
+ }
1244
+ function SystemFileSystem$o$delete$lambda($path) {
1245
+ return function () {
1246
+ var tmp0_elvis_lhs = get_fs().statSync($path.q62_1);
1247
+ var tmp;
1248
+ if (tmp0_elvis_lhs == null) {
1249
+ throw new FileNotFoundException('File does not exist: ' + $path.toString());
1250
+ } else {
1251
+ tmp = tmp0_elvis_lhs;
1252
+ }
1253
+ var stats = tmp;
1254
+ var tmp_0;
1255
+ if (stats.isDirectory()) {
1256
+ get_fs().rmdirSync($path.q62_1);
1257
+ tmp_0 = Unit_instance;
1258
+ } else {
1259
+ get_fs().rmSync($path.q62_1);
1260
+ tmp_0 = Unit_instance;
1261
+ }
1262
+ return Unit_instance;
1263
+ };
1264
+ }
1265
+ function SystemFileSystem$o$metadataOrNull$lambda($path, $metadata) {
1266
+ return function () {
1267
+ var tmp0_elvis_lhs = get_fs().statSync($path.q62_1);
1268
+ var tmp;
1269
+ if (tmp0_elvis_lhs == null) {
1270
+ return Unit_instance;
1271
+ } else {
1272
+ tmp = tmp0_elvis_lhs;
1273
+ }
1274
+ var stat = tmp;
1275
+ var mode = stat.mode;
1276
+ var isFile = (mode & get_fs().constants.S_IFMT) === get_fs().constants.S_IFREG;
1277
+ $metadata._v = new FileMetadata(isFile, (mode & get_fs().constants.S_IFMT) === get_fs().constants.S_IFDIR, isFile ? toLong(stat.size) : new Long(-1, -1));
1278
+ return Unit_instance;
1279
+ };
1280
+ }
1281
+ function SystemFileSystem$1() {
1282
+ SystemFileSystemImpl.call(this);
1283
+ }
1284
+ protoOf(SystemFileSystem$1).h62 = function (path) {
1285
+ return get_fs().existsSync(path.q62_1);
1286
+ };
1287
+ protoOf(SystemFileSystem$1).i62 = function (path, mustExist) {
1288
+ if (!this.h62(path)) {
1289
+ if (mustExist) {
1290
+ throw new FileNotFoundException('File does not exist: ' + path.toString());
1291
+ }
1292
+ return Unit_instance;
1293
+ }
1294
+ var tmp0_safe_receiver = withCaughtException(SystemFileSystem$o$delete$lambda(path));
1295
+ if (tmp0_safe_receiver == null)
1296
+ null;
1297
+ else {
1298
+ // Inline function 'kotlin.also' call
1299
+ // Inline function 'kotlin.contracts.contract' call
1300
+ // Inline function 'kotlinx.io.files.<no name provided>.delete.<anonymous>' call
1301
+ throw IOException_init_$Create$_1('Delete failed for ' + path.toString(), tmp0_safe_receiver);
1302
+ }
1303
+ };
1304
+ protoOf(SystemFileSystem$1).k62 = function (path, mustCreate) {
1305
+ var metadata = this.r62(path);
1306
+ if (!(metadata == null)) {
1307
+ if (mustCreate) {
1308
+ throw IOException_init_$Create$_0('Path already exists: ' + path.toString());
1309
+ }
1310
+ if (metadata.n62_1) {
1311
+ throw IOException_init_$Create$_0("Path already exists and it's a file: " + path.toString());
1312
+ }
1313
+ return Unit_instance;
1314
+ }
1315
+ // Inline function 'kotlin.collections.arrayListOf' call
1316
+ var parts = ArrayList_init_$Create$();
1317
+ var p = path;
1318
+ while (!(p == null) && !this.h62(p)) {
1319
+ parts.e(p.toString());
1320
+ p = p.dp();
1321
+ }
1322
+ // Inline function 'kotlin.collections.forEach' call
1323
+ var tmp0_iterator = asReversed(parts).j();
1324
+ while (tmp0_iterator.k()) {
1325
+ var element = tmp0_iterator.l();
1326
+ // Inline function 'kotlinx.io.files.<no name provided>.createDirectories.<anonymous>' call
1327
+ get_fs().mkdirSync(element);
1328
+ }
1329
+ };
1330
+ protoOf(SystemFileSystem$1).r62 = function (path) {
1331
+ if (!this.h62(path))
1332
+ return null;
1333
+ var metadata = {_v: null};
1334
+ var tmp2_safe_receiver = withCaughtException(SystemFileSystem$o$metadataOrNull$lambda(path, metadata));
1335
+ if (tmp2_safe_receiver == null)
1336
+ null;
1337
+ else {
1338
+ // Inline function 'kotlin.also' call
1339
+ // Inline function 'kotlin.contracts.contract' call
1340
+ // Inline function 'kotlinx.io.files.<no name provided>.metadataOrNull.<anonymous>' call
1341
+ throw IOException_init_$Create$_1('Stat failed for ' + path.toString(), tmp2_safe_receiver);
1342
+ }
1343
+ return metadata._v;
1344
+ };
1345
+ protoOf(SystemFileSystem$1).m62 = function (path, append) {
1346
+ return new FileSink(path, append);
1347
+ };
1348
+ var properties_initialized_FileSystemNodeJs_kt_vmmd20;
1349
+ function _init_properties_FileSystemNodeJs_kt__m4c3u() {
1350
+ if (!properties_initialized_FileSystemNodeJs_kt_vmmd20) {
1351
+ properties_initialized_FileSystemNodeJs_kt_vmmd20 = true;
1352
+ SystemFileSystem = new SystemFileSystem$1();
1353
+ isWindows = get_os().platform() === 'win32';
1354
+ }
1355
+ }
1356
+ function get_SystemPathSeparator() {
1357
+ _init_properties_PathsNodeJs_kt__bvvvsp();
1358
+ // Inline function 'kotlin.getValue' call
1359
+ var this_0 = SystemPathSeparator$delegate;
1360
+ SystemPathSeparator$factory();
1361
+ return this_0.u().g1_1;
1362
+ }
1363
+ var SystemPathSeparator$delegate;
1364
+ function Path_0(rawPath, any) {
1365
+ this.q62_1 = removeTrailingSeparators(rawPath);
1366
+ }
1367
+ protoOf(Path_0).dp = function () {
1368
+ // Inline function 'kotlin.text.isEmpty' call
1369
+ var this_0 = this.q62_1;
1370
+ if (charSequenceLength(this_0) === 0)
1371
+ return null;
1372
+ if (get_isWindows()) {
1373
+ if (!contains(this.q62_1, _Char___init__impl__6a9atx(47)) && !contains(this.q62_1, _Char___init__impl__6a9atx(92))) {
1374
+ return null;
1375
+ }
1376
+ } else if (!contains(this.q62_1, get_SystemPathSeparator())) {
1377
+ return null;
1378
+ }
1379
+ var p = get_path().dirname(this.q62_1);
1380
+ var tmp;
1381
+ // Inline function 'kotlin.text.isEmpty' call
1382
+ if (charSequenceLength(p) === 0) {
1383
+ tmp = null;
1384
+ } else {
1385
+ if (p === this.q62_1) {
1386
+ tmp = null;
1387
+ } else {
1388
+ tmp = Path_1(p);
1389
+ }
1390
+ }
1391
+ return tmp;
1392
+ };
1393
+ protoOf(Path_0).toString = function () {
1394
+ return this.q62_1;
1395
+ };
1396
+ protoOf(Path_0).equals = function (other) {
1397
+ if (this === other)
1398
+ return true;
1399
+ if (!(other instanceof Path_0))
1400
+ return false;
1401
+ return this.q62_1 === other.q62_1;
1402
+ };
1403
+ protoOf(Path_0).hashCode = function () {
1404
+ return getStringHashCode(this.q62_1);
1405
+ };
1406
+ function open($this, path, append) {
1407
+ var flags = append ? 'a' : 'w';
1408
+ var fd = {_v: -1};
1409
+ var tmp5_safe_receiver = withCaughtException(FileSink$open$lambda(fd, path, flags));
1410
+ if (tmp5_safe_receiver == null)
1411
+ null;
1412
+ else {
1413
+ // Inline function 'kotlin.also' call
1414
+ // Inline function 'kotlin.contracts.contract' call
1415
+ // Inline function 'kotlinx.io.files.FileSink.open.<anonymous>' call
1416
+ throw IOException_init_$Create$_1('Failed to open a file ' + path.q62_1 + '.', tmp5_safe_receiver);
1417
+ }
1418
+ if (fd._v < 0)
1419
+ throw IOException_init_$Create$_0('Failed to open a file ' + path.q62_1 + '.');
1420
+ return fd._v;
1421
+ }
1422
+ function FileSink$open$lambda($fd, $path, $flags) {
1423
+ return function () {
1424
+ $fd._v = get_fs().openSync($path.q62_1, $flags);
1425
+ return Unit_instance;
1426
+ };
1427
+ }
1428
+ function FileSink$write$lambda(this$0, $buf) {
1429
+ return function () {
1430
+ get_fs().writeFileSync(this$0.t62_1, $buf);
1431
+ return Unit_instance;
1432
+ };
1433
+ }
1434
+ function FileSink(path, append) {
1435
+ this.s62_1 = false;
1436
+ this.t62_1 = open(this, path, append);
1437
+ }
1438
+ protoOf(FileSink).b61 = function (source, byteCount) {
1439
+ // Inline function 'kotlin.check' call
1440
+ // Inline function 'kotlin.contracts.contract' call
1441
+ if (!!this.s62_1) {
1442
+ // Inline function 'kotlinx.io.files.FileSink.write.<anonymous>' call
1443
+ var message = 'Sink is closed.';
1444
+ throw IllegalStateException_init_$Create$(toString(message));
1445
+ }
1446
+ if (byteCount.equals(new Long(0, 0))) {
1447
+ return Unit_instance;
1448
+ }
1449
+ // Inline function 'kotlin.comparisons.minOf' call
1450
+ var b = source.m();
1451
+ var remainingBytes = byteCount.z(b) <= 0 ? byteCount : b;
1452
+ while (remainingBytes.z(new Long(0, 0)) > 0) {
1453
+ var segmentBytes = 0;
1454
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.readFromHead' call
1455
+ // Inline function 'kotlin.require' call
1456
+ // Inline function 'kotlin.contracts.contract' call
1457
+ if (!!source.k60()) {
1458
+ // Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.readFromHead.<anonymous>' call
1459
+ var message_0 = 'Buffer is empty';
1460
+ throw IllegalArgumentException_init_$Create$(toString(message_0));
1461
+ }
1462
+ var head = ensureNotNull(source.g60_1);
1463
+ // Inline function 'kotlinx.io.files.FileSink.write.<anonymous>' call
1464
+ var headData = head.x61(true);
1465
+ var headPos = head.o60_1;
1466
+ segmentBytes = head.p60_1 - headPos | 0;
1467
+ var buf = get_buffer().Buffer.allocUnsafe(segmentBytes);
1468
+ var inductionVariable = 0;
1469
+ var last = segmentBytes;
1470
+ if (inductionVariable < last)
1471
+ do {
1472
+ var offset = inductionVariable;
1473
+ inductionVariable = inductionVariable + 1 | 0;
1474
+ buf.writeInt8(headData[headPos + offset | 0], offset);
1475
+ }
1476
+ while (inductionVariable < last);
1477
+ var tmp6_safe_receiver = withCaughtException(FileSink$write$lambda(this, buf));
1478
+ if (tmp6_safe_receiver == null)
1479
+ null;
1480
+ else {
1481
+ // Inline function 'kotlin.also' call
1482
+ // Inline function 'kotlin.contracts.contract' call
1483
+ // Inline function 'kotlinx.io.files.FileSink.write.<anonymous>.<anonymous>' call
1484
+ throw IOException_init_$Create$_1('Write failed', tmp6_safe_receiver);
1485
+ }
1486
+ var bytesRead = segmentBytes;
1487
+ if (!(bytesRead === 0)) {
1488
+ if (bytesRead < 0)
1489
+ throw IllegalStateException_init_$Create$('Returned negative read bytes count');
1490
+ if (bytesRead > head.f61())
1491
+ throw IllegalStateException_init_$Create$('Returned too many bytes');
1492
+ source.u60(toLong(bytesRead));
1493
+ }
1494
+ // Inline function 'kotlin.Long.minus' call
1495
+ var this_0 = remainingBytes;
1496
+ var other = segmentBytes;
1497
+ remainingBytes = this_0.w2(toLong(other));
1498
+ }
1499
+ };
1500
+ protoOf(FileSink).m1x = function () {
1501
+ if (!this.s62_1) {
1502
+ this.s62_1 = true;
1503
+ get_fs().closeSync(this.t62_1);
1504
+ }
1505
+ };
1506
+ function Path_1(path) {
1507
+ _init_properties_PathsNodeJs_kt__bvvvsp();
1508
+ return new Path_0(path, null);
1509
+ }
1510
+ function SystemPathSeparator$delegate$lambda() {
1511
+ _init_properties_PathsNodeJs_kt__bvvvsp();
1512
+ var sep = get_path().sep;
1513
+ // Inline function 'kotlin.check' call
1514
+ // Inline function 'kotlin.contracts.contract' call
1515
+ // Inline function 'kotlin.check' call
1516
+ // Inline function 'kotlin.contracts.contract' call
1517
+ if (!(sep.length === 1)) {
1518
+ // Inline function 'kotlin.check.<anonymous>' call
1519
+ var message = 'Check failed.';
1520
+ throw IllegalStateException_init_$Create$(toString(message));
1521
+ }
1522
+ return new Char(charSequenceGet(sep, 0));
1523
+ }
1524
+ function SystemPathSeparator$factory() {
1525
+ return getPropertyCallableRef('SystemPathSeparator', 0, KProperty0, function () {
1526
+ return new Char(get_SystemPathSeparator());
1527
+ }, null);
1528
+ }
1529
+ var properties_initialized_PathsNodeJs_kt_2u5gc7;
1530
+ function _init_properties_PathsNodeJs_kt__bvvvsp() {
1531
+ if (!properties_initialized_PathsNodeJs_kt_2u5gc7) {
1532
+ properties_initialized_PathsNodeJs_kt_2u5gc7 = true;
1533
+ SystemPathSeparator$delegate = lazy(SystemPathSeparator$delegate$lambda);
1534
+ }
1535
+ }
1536
+ //region block: post-declaration
1537
+ protoOf(SystemFileSystemImpl).j62 = delete$default;
1538
+ protoOf(SystemFileSystemImpl).l62 = createDirectories$default;
1539
+ //endregion
1540
+ //region block: init
1541
+ Companion_instance = new Companion();
1542
+ UnsafeBufferOperations_instance = new UnsafeBufferOperations();
1543
+ SegmentPool_instance = new SegmentPool();
1544
+ //endregion
1545
+ //region block: exports
1546
+ _.$_$ = _.$_$ || {};
1547
+ _.$_$.a = Path;
1548
+ _.$_$.b = Path_1;
1549
+ _.$_$.c = get_SystemFileSystem;
1550
+ _.$_$.d = get_SystemTemporaryDirectory;
1551
+ _.$_$.e = buffered;
1552
+ _.$_$.f = writeString;
1553
+ //endregion
1554
+ return _;
1555
+ }));
1556
+
1557
+ //# sourceMappingURL=kotlinx-io-kotlinx-io-core.js.map