@earth-app/shovel
Version:
Kotlin Multiplatform Web Scraping Framework
1,312 lines • 79.5 kB
JavaScript
(function (factory) {
if (typeof define === 'function' && define.amd)
define(['exports', './kotlin-kotlin-stdlib.js', './kotlinx-io-kotlinx-io-bytestring.js'], factory);
else if (typeof exports === 'object')
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-io-kotlinx-io-bytestring.js'));
else {
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
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'.");
}
if (typeof globalThis['kotlinx-io-kotlinx-io-bytestring'] === 'undefined') {
throw new Error("Error loading module 'kotlinx-io-kotlinx-io-core'. Its dependency 'kotlinx-io-kotlinx-io-bytestring' was not found. Please, check whether 'kotlinx-io-kotlinx-io-bytestring' is loaded prior to 'kotlinx-io-kotlinx-io-core'.");
}
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'], globalThis['kotlinx-io-kotlinx-io-bytestring']);
}
}(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_io_bytestring) {
'use strict';
//region block: imports
var imul = Math.imul;
var IndexOutOfBoundsException_init_$Create$ = kotlin_kotlin.$_$.v1;
var Long = kotlin_kotlin.$_$.gb;
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.o1;
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.h2;
var charArrayOf = kotlin_kotlin.$_$.t6;
var protoOf = kotlin_kotlin.$_$.z7;
var toString = kotlin_kotlin.$_$.d8;
var Unit_instance = kotlin_kotlin.$_$.a3;
var toShort = kotlin_kotlin.$_$.c8;
var ensureNotNull = kotlin_kotlin.$_$.sb;
var toLong = kotlin_kotlin.$_$.b8;
var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.c1;
var initMetadataForClass = kotlin_kotlin.$_$.i7;
var VOID = kotlin_kotlin.$_$.h;
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.r1;
var UnsafeByteStringOperations_instance = kotlin_org_jetbrains_kotlinx_kotlinx_io_bytestring.$_$.b;
var AutoCloseable = kotlin_kotlin.$_$.va;
var objectCreate = kotlin_kotlin.$_$.y7;
var initMetadataForCompanion = kotlin_kotlin.$_$.j7;
var arrayCopy = kotlin_kotlin.$_$.o3;
var toByte = kotlin_kotlin.$_$.a8;
var IllegalArgumentException_init_$Create$_0 = kotlin_kotlin.$_$.m1;
var initMetadataForObject = kotlin_kotlin.$_$.o7;
var initMetadataForInterface = kotlin_kotlin.$_$.m7;
var charCodeAt = kotlin_kotlin.$_$.v6;
var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.n2;
var charArray = kotlin_kotlin.$_$.u6;
var numberToChar = kotlin_kotlin.$_$.w7;
var concatToString = kotlin_kotlin.$_$.v8;
var Exception_init_$Init$ = kotlin_kotlin.$_$.i1;
var captureStack = kotlin_kotlin.$_$.s6;
var Exception_init_$Init$_0 = kotlin_kotlin.$_$.j1;
var Exception_init_$Init$_1 = kotlin_kotlin.$_$.l1;
var Exception = kotlin_kotlin.$_$.cb;
//endregion
//region block: pre-declaration
initMetadataForInterface(Source, 'Source', VOID, VOID, [AutoCloseable]);
function write$default(source, startIndex, endIndex, $super) {
startIndex = startIndex === VOID ? 0 : startIndex;
endIndex = endIndex === VOID ? source.length : endIndex;
var tmp;
if ($super === VOID) {
this.z17(source, startIndex, endIndex);
tmp = Unit_instance;
} else {
tmp = $super.z17.call(this, source, startIndex, endIndex);
}
return tmp;
}
initMetadataForInterface(Sink, 'Sink', VOID, VOID, [AutoCloseable]);
initMetadataForClass(Buffer, 'Buffer', Buffer, VOID, [Source, Sink]);
initMetadataForClass(PeekSource, 'PeekSource', VOID, VOID, [AutoCloseable]);
initMetadataForClass(RealSource, 'RealSource', VOID, VOID, [Source]);
initMetadataForCompanion(Companion);
initMetadataForClass(Segment, 'Segment');
initMetadataForClass(SegmentCopyTracker, 'SegmentCopyTracker');
initMetadataForObject(AlwaysSharedCopyTracker, 'AlwaysSharedCopyTracker', VOID, SegmentCopyTracker);
initMetadataForObject(UnsafeBufferOperations, 'UnsafeBufferOperations');
initMetadataForClass(SegmentReadContextImpl$1);
initMetadataForClass(SegmentWriteContextImpl$1);
initMetadataForClass(BufferIterationContextImpl$1);
initMetadataForClass(IOException, 'IOException', IOException_init_$Create$, Exception);
initMetadataForClass(EOFException, 'EOFException', EOFException_init_$Create$, IOException);
initMetadataForObject(SegmentPool, 'SegmentPool');
//endregion
function get_HEX_DIGIT_CHARS() {
_init_properties__Util_kt__g8tcl9();
return HEX_DIGIT_CHARS;
}
var HEX_DIGIT_CHARS;
function checkBounds(size, startIndex, endIndex) {
_init_properties__Util_kt__g8tcl9();
if (startIndex.a1(new Long(0, 0)) < 0 || endIndex.a1(size) > 0) {
throw IndexOutOfBoundsException_init_$Create$('startIndex (' + startIndex.toString() + ') and endIndex (' + endIndex.toString() + ') are not within the range [0..size(' + size.toString() + '))');
}
if (startIndex.a1(endIndex) > 0) {
throw IllegalArgumentException_init_$Create$('startIndex (' + startIndex.toString() + ') > endIndex (' + endIndex.toString() + ')');
}
}
function checkOffsetAndCount(size, offset, byteCount) {
_init_properties__Util_kt__g8tcl9();
if (offset.a1(new Long(0, 0)) < 0 || offset.a1(size) > 0 || size.s2(offset).a1(byteCount) < 0 || byteCount.a1(new Long(0, 0)) < 0) {
throw IllegalArgumentException_init_$Create$('offset (' + offset.toString() + ') and byteCount (' + byteCount.toString() + ') are not within the range [0..size(' + size.toString() + '))');
}
}
var properties_initialized__Util_kt_67kc5b;
function _init_properties__Util_kt__g8tcl9() {
if (!properties_initialized__Util_kt_67kc5b) {
properties_initialized__Util_kt_67kc5b = true;
// Inline function 'kotlin.charArrayOf' call
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)]);
}
}
function throwEof($this, byteCount) {
throw EOFException_init_$Create$_0("Buffer doesn't contain required number of bytes (size: " + $this.j().toString() + ', required: ' + byteCount.toString() + ')');
}
function Buffer() {
this.m16_1 = null;
this.n16_1 = null;
this.o16_1 = new Long(0, 0);
}
protoOf(Buffer).j = function () {
return this.o16_1;
};
protoOf(Buffer).p16 = function () {
return this;
};
protoOf(Buffer).q16 = function () {
return this.j().equals(new Long(0, 0));
};
protoOf(Buffer).r16 = function (byteCount) {
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message = 'byteCount: ' + byteCount.toString();
throw IllegalArgumentException_init_$Create$(toString(message));
}
if (this.j().a1(byteCount) < 0) {
throw EOFException_init_$Create$_0("Buffer doesn't contain required number of bytes (size: " + this.j().toString() + ', required: ' + byteCount.toString() + ')');
}
};
protoOf(Buffer).s16 = function (byteCount) {
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message = 'byteCount: ' + byteCount.toString() + ' < 0';
throw IllegalArgumentException_init_$Create$(toString(message));
}
return this.j().a1(byteCount) >= 0;
};
protoOf(Buffer).t16 = function () {
var tmp0_elvis_lhs = this.m16_1;
var tmp;
if (tmp0_elvis_lhs == null) {
throwEof(this, new Long(1, 0));
} else {
tmp = tmp0_elvis_lhs;
}
var segment = tmp;
var segmentSize = segment.j();
if (segmentSize === 0) {
this.b17();
return this.t16();
}
var v = segment.c17();
this.o16_1 = this.o16_1.s2(new Long(1, 0));
if (segmentSize === 1) {
this.b17();
}
return v;
};
protoOf(Buffer).d17 = function () {
var tmp0_elvis_lhs = this.m16_1;
var tmp;
if (tmp0_elvis_lhs == null) {
throwEof(this, new Long(2, 0));
} else {
tmp = tmp0_elvis_lhs;
}
var segment = tmp;
var segmentSize = segment.j();
if (segmentSize < 2) {
this.r16(new Long(2, 0));
if (segmentSize === 0) {
this.b17();
return this.d17();
}
// Inline function 'kotlinx.io.and' call
var tmp_0 = (this.t16() & 255) << 8;
// Inline function 'kotlinx.io.and' call
var tmp$ret$1 = this.t16() & 255;
return toShort(tmp_0 | tmp$ret$1);
}
var v = segment.e17();
this.o16_1 = this.o16_1.s2(new Long(2, 0));
if (segmentSize === 2) {
this.b17();
}
return v;
};
protoOf(Buffer).f17 = function () {
return Unit_instance;
};
protoOf(Buffer).g17 = function (out, startIndex, endIndex) {
checkBounds(this.j(), startIndex, endIndex);
if (startIndex.equals(endIndex))
return Unit_instance;
var currentOffset = startIndex;
var remainingByteCount = endIndex.s2(startIndex);
out.o16_1 = out.o16_1.r2(remainingByteCount);
var s = this.m16_1;
while (currentOffset.a1(toLong(ensureNotNull(s).w16_1 - s.v16_1 | 0)) >= 0) {
currentOffset = currentOffset.s2(toLong(s.w16_1 - s.v16_1 | 0));
s = s.z16_1;
}
while (remainingByteCount.a1(new Long(0, 0)) > 0) {
var copy = ensureNotNull(s).h17();
copy.v16_1 = copy.v16_1 + currentOffset.z() | 0;
var tmp = copy;
var tmp0 = copy.v16_1 + remainingByteCount.z() | 0;
// Inline function 'kotlin.comparisons.minOf' call
var b = copy.w16_1;
tmp.w16_1 = Math.min(tmp0, b);
// Inline function 'kotlinx.io.Buffer.pushSegment' call
if (out.m16_1 == null) {
out.m16_1 = copy;
out.n16_1 = copy;
} else if (false) {
out.n16_1 = ensureNotNull(out.n16_1).i17(copy).j17();
if (ensureNotNull(out.n16_1).a17_1 == null) {
out.m16_1 = out.n16_1;
}
} else {
out.n16_1 = ensureNotNull(out.n16_1).i17(copy);
}
remainingByteCount = remainingByteCount.s2(toLong(copy.w16_1 - copy.v16_1 | 0));
currentOffset = new Long(0, 0);
s = s.z16_1;
}
};
protoOf(Buffer).k17 = function () {
var result = this.j();
if (result.equals(new Long(0, 0)))
return new Long(0, 0);
var tail = ensureNotNull(this.n16_1);
if (tail.w16_1 < 8192 && tail.y16_1) {
result = result.s2(toLong(tail.w16_1 - tail.v16_1 | 0));
}
return result;
};
protoOf(Buffer).l17 = function (position) {
if (position.a1(new Long(0, 0)) < 0 || position.a1(this.j()) >= 0) {
throw IndexOutOfBoundsException_init_$Create$('position (' + position.toString() + ') is not within the range [0..size(' + this.j().toString() + '))');
}
if (position.equals(new Long(0, 0))) {
return ensureNotNull(this.m16_1).m17(0);
}
// Inline function 'kotlinx.io.seek' call
if (this.m16_1 == null) {
var offset = new Long(-1, -1);
return ensureNotNull(null).m17(position.s2(offset).z());
}
if (this.j().s2(position).a1(position) < 0) {
var s = this.n16_1;
var offset_0 = this.j();
$l$loop: while (!(s == null) && offset_0.a1(position) > 0) {
offset_0 = offset_0.s2(toLong(s.w16_1 - s.v16_1 | 0));
if (offset_0.a1(position) <= 0)
break $l$loop;
s = s.a17_1;
}
var tmp0 = s;
var offset_1 = offset_0;
return ensureNotNull(tmp0).m17(position.s2(offset_1).z());
} else {
var s_0 = this.m16_1;
var offset_2 = new Long(0, 0);
$l$loop_0: while (!(s_0 == null)) {
var tmp0_0 = offset_2;
// Inline function 'kotlin.Long.plus' call
var other = s_0.w16_1 - s_0.v16_1 | 0;
var nextOffset = tmp0_0.r2(toLong(other));
if (nextOffset.a1(position) > 0)
break $l$loop_0;
s_0 = s_0.z16_1;
offset_2 = nextOffset;
}
var tmp0_1 = s_0;
var offset_3 = offset_2;
return ensureNotNull(tmp0_1).m17(position.s2(offset_3).z());
}
};
protoOf(Buffer).y1 = function () {
return this.n17(this.j());
};
protoOf(Buffer).n17 = function (byteCount) {
// Inline function 'kotlinx.io.checkByteCount' call
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message = 'byteCount (' + byteCount.toString() + ') < 0';
throw IllegalArgumentException_init_$Create$(toString(message));
}
var remainingByteCount = byteCount;
while (remainingByteCount.a1(new Long(0, 0)) > 0) {
var tmp0_elvis_lhs = this.m16_1;
var tmp;
if (tmp0_elvis_lhs == null) {
throw EOFException_init_$Create$_0('Buffer exhausted before skipping ' + byteCount.toString() + ' bytes.');
} else {
tmp = tmp0_elvis_lhs;
}
var head = tmp;
var tmp0 = remainingByteCount;
// Inline function 'kotlinx.io.minOf' call
var b = head.w16_1 - head.v16_1 | 0;
// Inline function 'kotlin.comparisons.minOf' call
var b_0 = toLong(b);
var toSkip = (tmp0.a1(b_0) <= 0 ? tmp0 : b_0).z();
this.o16_1 = this.o16_1.s2(toLong(toSkip));
remainingByteCount = remainingByteCount.s2(toLong(toSkip));
head.v16_1 = head.v16_1 + toSkip | 0;
if (head.v16_1 === head.w16_1) {
this.b17();
}
}
};
protoOf(Buffer).o17 = function (sink, startIndex, endIndex) {
// Inline function 'kotlinx.io.checkBounds' call
var size = sink.length;
checkBounds(toLong(size), toLong(startIndex), toLong(endIndex));
var tmp0_elvis_lhs = this.m16_1;
var tmp;
if (tmp0_elvis_lhs == null) {
return -1;
} else {
tmp = tmp0_elvis_lhs;
}
var s = tmp;
var tmp0 = endIndex - startIndex | 0;
// Inline function 'kotlin.comparisons.minOf' call
var b = s.j();
var toCopy = Math.min(tmp0, b);
s.p17(sink, startIndex, startIndex + toCopy | 0);
this.o16_1 = this.o16_1.s2(toLong(toCopy));
if (isEmpty(s)) {
this.b17();
}
return toCopy;
};
protoOf(Buffer).q17 = function (sink, byteCount) {
// Inline function 'kotlinx.io.checkByteCount' call
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message = 'byteCount (' + byteCount.toString() + ') < 0';
throw IllegalArgumentException_init_$Create$(toString(message));
}
if (this.j().equals(new Long(0, 0)))
return new Long(-1, -1);
var bytesWritten = byteCount.a1(this.j()) > 0 ? this.j() : byteCount;
sink.r17(this, bytesWritten);
return bytesWritten;
};
protoOf(Buffer).s17 = function (sink, byteCount) {
// Inline function 'kotlinx.io.checkByteCount' call
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message = 'byteCount (' + byteCount.toString() + ') < 0';
throw IllegalArgumentException_init_$Create$(toString(message));
}
if (this.j().a1(byteCount) < 0) {
sink.r17(this, this.j());
throw EOFException_init_$Create$_0('Buffer exhausted before writing ' + byteCount.toString() + ' bytes. Only ' + this.j().toString() + ' bytes were written.');
}
sink.r17(this, byteCount);
};
protoOf(Buffer).t17 = function (sink) {
var byteCount = this.j();
if (byteCount.a1(new Long(0, 0)) > 0) {
sink.r17(this, byteCount);
}
return byteCount;
};
protoOf(Buffer).u17 = function () {
return buffered(new PeekSource(this));
};
protoOf(Buffer).v17 = function (minimumCapacity) {
// Inline function 'kotlin.require' call
if (!(minimumCapacity >= 1 && minimumCapacity <= 8192)) {
var message = 'unexpected capacity (' + minimumCapacity + '), should be in range [1, 8192]';
throw IllegalArgumentException_init_$Create$(toString(message));
}
if (this.n16_1 == null) {
var result = SegmentPool_instance.y17();
this.m16_1 = result;
this.n16_1 = result;
return result;
}
var t = ensureNotNull(this.n16_1);
if ((t.w16_1 + minimumCapacity | 0) > 8192 || !t.y16_1) {
var newTail = t.i17(SegmentPool_instance.y17());
this.n16_1 = newTail;
return newTail;
}
return t;
};
protoOf(Buffer).z17 = function (source, startIndex, endIndex) {
// Inline function 'kotlinx.io.checkBounds' call
var size = source.length;
checkBounds(toLong(size), toLong(startIndex), toLong(endIndex));
var currentOffset = startIndex;
while (currentOffset < endIndex) {
var tail = this.v17(1);
var tmp0 = endIndex - currentOffset | 0;
// Inline function 'kotlin.comparisons.minOf' call
var b = tail.a18();
var toCopy = Math.min(tmp0, b);
tail.b18(source, currentOffset, currentOffset + toCopy | 0);
currentOffset = currentOffset + toCopy | 0;
}
var tmp = this;
var tmp0_0 = this.o16_1;
// Inline function 'kotlin.Long.plus' call
var other = endIndex - startIndex | 0;
tmp.o16_1 = tmp0_0.r2(toLong(other));
};
protoOf(Buffer).r17 = function (source, byteCount) {
// Inline function 'kotlin.require' call
if (!!(source === this)) {
var message = 'source == this';
throw IllegalArgumentException_init_$Create$(toString(message));
}
checkOffsetAndCount(source.o16_1, new Long(0, 0), byteCount);
var remainingByteCount = byteCount;
while (remainingByteCount.a1(new Long(0, 0)) > 0) {
if (remainingByteCount.a1(toLong(ensureNotNull(source.m16_1).j())) < 0) {
var tail = this.n16_1;
var tmp;
if (!(tail == null) && tail.y16_1) {
var tmp0 = remainingByteCount;
// Inline function 'kotlin.Long.plus' call
var other = tail.w16_1;
var tmp0_0 = tmp0.r2(toLong(other));
// Inline function 'kotlin.Long.minus' call
var other_0 = tail.d18() ? 0 : tail.v16_1;
tmp = tmp0_0.s2(toLong(other_0)).a1(new Long(8192, 0)) <= 0;
} else {
tmp = false;
}
if (tmp) {
ensureNotNull(source.m16_1).f18(tail, remainingByteCount.z());
source.o16_1 = source.o16_1.s2(remainingByteCount);
this.o16_1 = this.o16_1.r2(remainingByteCount);
return Unit_instance;
} else {
source.m16_1 = ensureNotNull(source.m16_1).e18(remainingByteCount.z());
}
}
var segmentToMove = ensureNotNull(source.m16_1);
var movedByteCount = toLong(segmentToMove.j());
source.m16_1 = segmentToMove.g18();
if (source.m16_1 == null) {
source.n16_1 = null;
}
// Inline function 'kotlinx.io.Buffer.pushSegment' call
if (this.m16_1 == null) {
this.m16_1 = segmentToMove;
this.n16_1 = segmentToMove;
} else if (true) {
this.n16_1 = ensureNotNull(this.n16_1).i17(segmentToMove).j17();
if (ensureNotNull(this.n16_1).a17_1 == null) {
this.m16_1 = this.n16_1;
}
} else {
this.n16_1 = ensureNotNull(this.n16_1).i17(segmentToMove);
}
source.o16_1 = source.o16_1.s2(movedByteCount);
this.o16_1 = this.o16_1.r2(movedByteCount);
remainingByteCount = remainingByteCount.s2(movedByteCount);
}
};
protoOf(Buffer).h18 = function (source) {
var totalBytesRead = new Long(0, 0);
$l$loop: while (true) {
var readCount = source.q17(this, new Long(8192, 0));
if (readCount.equals(new Long(-1, -1)))
break $l$loop;
totalBytesRead = totalBytesRead.r2(readCount);
}
return totalBytesRead;
};
protoOf(Buffer).i18 = function (byte) {
this.v17(1).j18(byte);
this.o16_1 = this.o16_1.r2(new Long(1, 0));
};
protoOf(Buffer).k18 = function (short) {
this.v17(2).l18(short);
this.o16_1 = this.o16_1.r2(new Long(2, 0));
};
protoOf(Buffer).x3 = function () {
return Unit_instance;
};
protoOf(Buffer).toString = function () {
if (this.j().equals(new Long(0, 0)))
return 'Buffer(size=0)';
var maxPrintableBytes = 64;
// Inline function 'kotlinx.io.minOf' call
var b = this.j();
// Inline function 'kotlin.comparisons.minOf' call
var a = toLong(maxPrintableBytes);
var len = (a.a1(b) <= 0 ? a : b).z();
var builder = StringBuilder_init_$Create$(imul(len, 2) + (this.j().a1(toLong(maxPrintableBytes)) > 0 ? 1 : 0) | 0);
var bytesWritten = 0;
// Inline function 'kotlinx.io.unsafe.UnsafeBufferOperations.forEachSegment' call
var curr = this.m16_1;
while (!(curr == null)) {
var tmp0 = get_SegmentReadContextImpl();
var segment = curr;
var idx = 0;
while (bytesWritten < len && idx < segment.j()) {
var _unary__edvuaz = idx;
idx = _unary__edvuaz + 1 | 0;
var b_0 = tmp0.m18(segment, _unary__edvuaz);
bytesWritten = bytesWritten + 1 | 0;
var tmp = get_HEX_DIGIT_CHARS();
// Inline function 'kotlinx.io.shr' call
var tmp$ret$2 = b_0 >> 4;
var tmp_0 = builder.f8(tmp[tmp$ret$2 & 15]);
var tmp_1 = get_HEX_DIGIT_CHARS();
// Inline function 'kotlinx.io.and' call
var tmp$ret$3 = b_0 & 15;
tmp_0.f8(tmp_1[tmp$ret$3]);
}
curr = curr.z16_1;
}
if (this.j().a1(toLong(maxPrintableBytes)) > 0) {
builder.f8(_Char___init__impl__6a9atx(8230));
}
return 'Buffer(size=' + this.j().toString() + ' hex=' + builder.toString() + ')';
};
protoOf(Buffer).b17 = function () {
var oldHead = ensureNotNull(this.m16_1);
var nextHead = oldHead.z16_1;
this.m16_1 = nextHead;
if (nextHead == null) {
this.n16_1 = null;
} else {
nextHead.a17_1 = null;
}
oldHead.z16_1 = null;
SegmentPool_instance.n18(oldHead);
};
protoOf(Buffer).o18 = function () {
var oldTail = ensureNotNull(this.n16_1);
var newTail = oldTail.a17_1;
this.n16_1 = newTail;
if (newTail == null) {
this.m16_1 = null;
} else {
newTail.z16_1 = null;
}
oldTail.a17_1 = null;
SegmentPool_instance.n18(oldTail);
};
function indexOf(_this__u8e3s4, byte, startIndex, endIndex) {
startIndex = startIndex === VOID ? new Long(0, 0) : startIndex;
endIndex = endIndex === VOID ? _this__u8e3s4.j() : endIndex;
// Inline function 'kotlin.comparisons.minOf' call
var b = _this__u8e3s4.j();
var endOffset = endIndex.a1(b) <= 0 ? endIndex : b;
checkBounds(_this__u8e3s4.j(), startIndex, endOffset);
if (startIndex.equals(endOffset))
return new Long(-1, -1);
// Inline function 'kotlinx.io.seek' call
if (_this__u8e3s4.m16_1 == null) {
var o = new Long(-1, -1);
if (o.equals(new Long(-1, -1))) {
return new Long(-1, -1);
}
var segment = null;
var offset = o;
do {
// Inline function 'kotlin.check' call
if (!(endOffset.a1(offset) > 0)) {
throw IllegalStateException_init_$Create$('Check failed.');
}
ensureNotNull(segment);
var tmp = segment;
// Inline function 'kotlin.comparisons.maxOf' call
var a = startIndex.s2(offset).z();
var tmp_0 = Math.max(a, 0);
var tmp0 = segment.j();
// Inline function 'kotlin.comparisons.minOf' call
var b_0 = endOffset.s2(offset).z();
var tmp$ret$3 = Math.min(tmp0, b_0);
var idx = indexOf_0(tmp, byte, tmp_0, tmp$ret$3);
if (!(idx === -1)) {
return offset.r2(toLong(idx));
}
var tmp0_0 = offset;
// Inline function 'kotlin.Long.plus' call
var other = segment.j();
offset = tmp0_0.r2(toLong(other));
segment = segment.z16_1;
}
while (!(segment == null) && offset.a1(endOffset) < 0);
return new Long(-1, -1);
}
if (_this__u8e3s4.j().s2(startIndex).a1(startIndex) < 0) {
var s = _this__u8e3s4.n16_1;
var offset_0 = _this__u8e3s4.j();
$l$loop: while (!(s == null) && offset_0.a1(startIndex) > 0) {
offset_0 = offset_0.s2(toLong(s.w16_1 - s.v16_1 | 0));
if (offset_0.a1(startIndex) <= 0)
break $l$loop;
s = s.a17_1;
}
var tmp0_1 = s;
var o_0 = offset_0;
if (o_0.equals(new Long(-1, -1))) {
return new Long(-1, -1);
}
var segment_0 = tmp0_1;
var offset_1 = o_0;
do {
// Inline function 'kotlin.check' call
if (!(endOffset.a1(offset_1) > 0)) {
throw IllegalStateException_init_$Create$('Check failed.');
}
ensureNotNull(segment_0);
var tmp_1 = segment_0;
// Inline function 'kotlin.comparisons.maxOf' call
var a_0 = startIndex.s2(offset_1).z();
var tmp_2 = Math.max(a_0, 0);
var tmp0_2 = segment_0.j();
// Inline function 'kotlin.comparisons.minOf' call
var b_1 = endOffset.s2(offset_1).z();
var tmp$ret$8 = Math.min(tmp0_2, b_1);
var idx_0 = indexOf_0(tmp_1, byte, tmp_2, tmp$ret$8);
if (!(idx_0 === -1)) {
return offset_1.r2(toLong(idx_0));
}
var tmp0_3 = offset_1;
// Inline function 'kotlin.Long.plus' call
var other_0 = segment_0.j();
offset_1 = tmp0_3.r2(toLong(other_0));
segment_0 = segment_0.z16_1;
}
while (!(segment_0 == null) && offset_1.a1(endOffset) < 0);
return new Long(-1, -1);
} else {
var s_0 = _this__u8e3s4.m16_1;
var offset_2 = new Long(0, 0);
$l$loop_0: while (!(s_0 == null)) {
var tmp0_4 = offset_2;
// Inline function 'kotlin.Long.plus' call
var other_1 = s_0.w16_1 - s_0.v16_1 | 0;
var nextOffset = tmp0_4.r2(toLong(other_1));
if (nextOffset.a1(startIndex) > 0)
break $l$loop_0;
s_0 = s_0.z16_1;
offset_2 = nextOffset;
}
var tmp0_5 = s_0;
var o_1 = offset_2;
if (o_1.equals(new Long(-1, -1))) {
return new Long(-1, -1);
}
var segment_1 = tmp0_5;
var offset_3 = o_1;
do {
// Inline function 'kotlin.check' call
if (!(endOffset.a1(offset_3) > 0)) {
throw IllegalStateException_init_$Create$('Check failed.');
}
ensureNotNull(segment_1);
var tmp_3 = segment_1;
// Inline function 'kotlin.comparisons.maxOf' call
var a_1 = startIndex.s2(offset_3).z();
var tmp_4 = Math.max(a_1, 0);
var tmp0_6 = segment_1.j();
// Inline function 'kotlin.comparisons.minOf' call
var b_2 = endOffset.s2(offset_3).z();
var tmp$ret$13 = Math.min(tmp0_6, b_2);
var idx_1 = indexOf_0(tmp_3, byte, tmp_4, tmp$ret$13);
if (!(idx_1 === -1)) {
return offset_3.r2(toLong(idx_1));
}
var tmp0_7 = offset_3;
// Inline function 'kotlin.Long.plus' call
var other_2 = segment_1.j();
offset_3 = tmp0_7.r2(toLong(other_2));
segment_1 = segment_1.z16_1;
}
while (!(segment_1 == null) && offset_3.a1(endOffset) < 0);
return new Long(-1, -1);
}
}
function readByteString(_this__u8e3s4, byteCount) {
return UnsafeByteStringOperations_instance.l16(readByteArray_0(_this__u8e3s4, byteCount));
}
function buffered(_this__u8e3s4) {
return new RealSource(_this__u8e3s4);
}
function PeekSource(upstream) {
this.p18_1 = upstream;
this.q18_1 = this.p18_1.p16();
this.r18_1 = this.q18_1.m16_1;
var tmp = this;
var tmp0_safe_receiver = this.q18_1.m16_1;
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.v16_1;
tmp.s18_1 = tmp1_elvis_lhs == null ? -1 : tmp1_elvis_lhs;
this.t18_1 = false;
this.u18_1 = new Long(0, 0);
}
protoOf(PeekSource).q17 = function (sink, byteCount) {
// Inline function 'kotlin.check' call
if (!!this.t18_1) {
var message = 'Source is closed.';
throw IllegalStateException_init_$Create$(toString(message));
}
// Inline function 'kotlinx.io.checkByteCount' call
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message_0 = 'byteCount (' + byteCount.toString() + ') < 0';
throw IllegalArgumentException_init_$Create$(toString(message_0));
}
// Inline function 'kotlin.check' call
if (!(this.r18_1 == null || (this.r18_1 === this.q18_1.m16_1 && this.s18_1 === ensureNotNull(this.q18_1.m16_1).v16_1))) {
var message_1 = 'Peek source is invalid because upstream source was used';
throw IllegalStateException_init_$Create$(toString(message_1));
}
if (byteCount.equals(new Long(0, 0)))
return new Long(0, 0);
// Inline function 'kotlin.Long.plus' call
var tmp$ret$7 = this.u18_1.r2(toLong(1));
if (!this.p18_1.s16(tmp$ret$7))
return new Long(-1, -1);
if (this.r18_1 == null && !(this.q18_1.m16_1 == null)) {
this.r18_1 = this.q18_1.m16_1;
this.s18_1 = ensureNotNull(this.q18_1.m16_1).v16_1;
}
// Inline function 'kotlin.comparisons.minOf' call
var b = this.q18_1.j().s2(this.u18_1);
var toCopy = byteCount.a1(b) <= 0 ? byteCount : b;
this.q18_1.g17(sink, this.u18_1, this.u18_1.r2(toCopy));
this.u18_1 = this.u18_1.r2(toCopy);
return toCopy;
};
protoOf(PeekSource).x3 = function () {
this.t18_1 = true;
};
function RealSource(source) {
this.v18_1 = source;
this.w18_1 = false;
this.x18_1 = new Buffer();
}
protoOf(RealSource).p16 = function () {
return this.x18_1;
};
protoOf(RealSource).q17 = function (sink, byteCount) {
// Inline function 'kotlinx.io.RealSource.checkNotClosed' call
// Inline function 'kotlin.check' call
if (!!this.w18_1) {
var message = 'Source is closed.';
throw IllegalStateException_init_$Create$(toString(message));
}
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message_0 = 'byteCount: ' + byteCount.toString();
throw IllegalArgumentException_init_$Create$(toString(message_0));
}
if (this.x18_1.j().equals(new Long(0, 0))) {
var read = this.v18_1.q17(this.x18_1, new Long(8192, 0));
if (read.equals(new Long(-1, -1)))
return new Long(-1, -1);
}
// Inline function 'kotlin.comparisons.minOf' call
var b = this.x18_1.j();
var toRead = byteCount.a1(b) <= 0 ? byteCount : b;
return this.x18_1.q17(sink, toRead);
};
protoOf(RealSource).q16 = function () {
// Inline function 'kotlinx.io.RealSource.checkNotClosed' call
// Inline function 'kotlin.check' call
if (!!this.w18_1) {
var message = 'Source is closed.';
throw IllegalStateException_init_$Create$(toString(message));
}
return this.x18_1.q16() && this.v18_1.q17(this.x18_1, new Long(8192, 0)).equals(new Long(-1, -1));
};
protoOf(RealSource).r16 = function (byteCount) {
if (!this.s16(byteCount))
throw EOFException_init_$Create$_0("Source doesn't contain required number of bytes (" + byteCount.toString() + ').');
};
protoOf(RealSource).s16 = function (byteCount) {
// Inline function 'kotlinx.io.RealSource.checkNotClosed' call
// Inline function 'kotlin.check' call
if (!!this.w18_1) {
var message = 'Source is closed.';
throw IllegalStateException_init_$Create$(toString(message));
}
// Inline function 'kotlin.require' call
if (!(byteCount.a1(new Long(0, 0)) >= 0)) {
var message_0 = 'byteCount: ' + byteCount.toString();
throw IllegalArgumentException_init_$Create$(toString(message_0));
}
while (this.x18_1.j().a1(byteCount) < 0) {
if (this.v18_1.q17(this.x18_1, new Long(8192, 0)).equals(new Long(-1, -1)))
return false;
}
return true;
};
protoOf(RealSource).t16 = function () {
this.r16(new Long(1, 0));
return this.x18_1.t16();
};
protoOf(RealSource).o17 = function (sink, startIndex, endIndex) {
// Inline function 'kotlinx.io.checkBounds' call
var size = sink.length;
checkBounds(toLong(size), toLong(startIndex), toLong(endIndex));
if (this.x18_1.j().equals(new Long(0, 0))) {
var read = this.v18_1.q17(this.x18_1, new Long(8192, 0));
if (read.equals(new Long(-1, -1)))
return -1;
}
var tmp0 = endIndex - startIndex | 0;
// Inline function 'kotlinx.io.minOf' call
var b = this.x18_1.j();
// Inline function 'kotlin.comparisons.minOf' call
var a = toLong(tmp0);
var toRead = (a.a1(b) <= 0 ? a : b).z();
return this.x18_1.o17(sink, startIndex, startIndex + toRead | 0);
};
protoOf(RealSource).s17 = function (sink, byteCount) {
try {
this.r16(byteCount);
} catch ($p) {
if ($p instanceof EOFException) {
var e = $p;
sink.r17(this.x18_1, this.x18_1.j());
throw e;
} else {
throw $p;
}
}
this.x18_1.s17(sink, byteCount);
};
protoOf(RealSource).t17 = function (sink) {
var totalBytesWritten = new Long(0, 0);
while (!this.v18_1.q17(this.x18_1, new Long(8192, 0)).equals(new Long(-1, -1))) {
var emitByteCount = this.x18_1.k17();
if (emitByteCount.a1(new Long(0, 0)) > 0) {
totalBytesWritten = totalBytesWritten.r2(emitByteCount);
sink.r17(this.x18_1, emitByteCount);
}
}
if (this.x18_1.j().a1(new Long(0, 0)) > 0) {
totalBytesWritten = totalBytesWritten.r2(this.x18_1.j());
sink.r17(this.x18_1, this.x18_1.j());
}
return totalBytesWritten;
};
protoOf(RealSource).d17 = function () {
this.r16(new Long(2, 0));
return this.x18_1.d17();
};
protoOf(RealSource).u17 = function () {
// Inline function 'kotlinx.io.RealSource.checkNotClosed' call
// Inline function 'kotlin.check' call
if (!!this.w18_1) {
var message = 'Source is closed.';
throw IllegalStateException_init_$Create$(toString(message));
}
return buffered(new PeekSource(this));
};
protoOf(RealSource).x3 = function () {
if (this.w18_1)
return Unit_instance;
this.w18_1 = true;
this.v18_1.x3();
this.x18_1.y1();
};
protoOf(RealSource).toString = function () {
return 'buffered(' + toString(this.v18_1) + ')';
};
function Segment_init_$Init$($this) {
Segment.call($this);
$this.u16_1 = new Int8Array(8192);
$this.y16_1 = true;
$this.x16_1 = null;
return $this;
}
function Segment_init_$Create$() {
return Segment_init_$Init$(objectCreate(protoOf(Segment)));
}
function Segment_init_$Init$_0(data, pos, limit, shareToken, owner, $this) {
Segment.call($this);
$this.u16_1 = data;
$this.v16_1 = pos;
$this.w16_1 = limit;
$this.x16_1 = shareToken;
$this.y16_1 = owner;
return $this;
}
function Segment_init_$Create$_0(data, pos, limit, shareToken, owner) {
return Segment_init_$Init$_0(data, pos, limit, shareToken, owner, objectCreate(protoOf(Segment)));
}
function Companion() {
this.y18_1 = 8192;
this.z18_1 = 1024;
}
protoOf(Companion).a19 = function () {
return Segment_init_$Create$();
};
var Companion_instance;
function Companion_getInstance() {
return Companion_instance;
}
protoOf(Segment).d18 = function () {
var tmp0_safe_receiver = this.x16_1;
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.b19();
return tmp1_elvis_lhs == null ? false : tmp1_elvis_lhs;
};
protoOf(Segment).h17 = function () {
var tmp0_elvis_lhs = this.x16_1;
var tmp;
if (tmp0_elvis_lhs == null) {
// Inline function 'kotlin.also' call
var this_0 = SegmentPool_instance.c19();
this.x16_1 = this_0;
tmp = this_0;
} else {
tmp = tmp0_elvis_lhs;
}
var t = tmp;
var tmp_0 = this.v16_1;
var tmp_1 = this.w16_1;
// Inline function 'kotlin.also' call
t.d19();
return Segment_init_$Create$_0(this.u16_1, tmp_0, tmp_1, t, false);
};
protoOf(Segment).g18 = function () {
var result = this.z16_1;
if (!(this.a17_1 == null)) {
ensureNotNull(this.a17_1).z16_1 = this.z16_1;
}
if (!(this.z16_1 == null)) {
ensureNotNull(this.z16_1).a17_1 = this.a17_1;
}
this.z16_1 = null;
this.a17_1 = null;
return result;
};
protoOf(Segment).i17 = function (segment) {
segment.a17_1 = this;
segment.z16_1 = this.z16_1;
if (!(this.z16_1 == null)) {
ensureNotNull(this.z16_1).a17_1 = segment;
}
this.z16_1 = segment;
return segment;
};
protoOf(Segment).e18 = function (byteCount) {
// Inline function 'kotlin.require' call
if (!(byteCount > 0 && byteCount <= (this.w16_1 - this.v16_1 | 0))) {
var message = 'byteCount out of range';
throw IllegalArgumentException_init_$Create$(toString(message));
}
var prefix;
if (byteCount >= 1024) {
prefix = this.h17();
} else {
prefix = SegmentPool_instance.y17();
var tmp0 = this.u16_1;
var tmp2 = prefix.u16_1;
var tmp4 = this.v16_1;
// Inline function 'kotlin.collections.copyInto' call
var endIndex = this.v16_1 + byteCount | 0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
var tmp = tmp0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
arrayCopy(tmp, tmp2, 0, tmp4, endIndex);
}
prefix.w16_1 = prefix.v16_1 + byteCount | 0;
this.v16_1 = this.v16_1 + byteCount | 0;
if (!(this.a17_1 == null)) {
ensureNotNull(this.a17_1).i17(prefix);
} else {
prefix.z16_1 = this;
this.a17_1 = prefix;
}
return prefix;
};
protoOf(Segment).j17 = function () {
// Inline function 'kotlin.check' call
if (!!(this.a17_1 == null)) {
var message = 'cannot compact';
throw IllegalStateException_init_$Create$(toString(message));
}
if (!ensureNotNull(this.a17_1).y16_1)
return this;
var byteCount = this.w16_1 - this.v16_1 | 0;
var availableByteCount = (8192 - ensureNotNull(this.a17_1).w16_1 | 0) + (ensureNotNull(this.a17_1).d18() ? 0 : ensureNotNull(this.a17_1).v16_1) | 0;
if (byteCount > availableByteCount)
return this;
var predecessor = this.a17_1;
this.f18(ensureNotNull(predecessor), byteCount);
var successor = this.g18();
// Inline function 'kotlin.check' call
if (!(successor == null)) {
throw IllegalStateException_init_$Create$('Check failed.');
}
SegmentPool_instance.n18(this);
return predecessor;
};
protoOf(Segment).j18 = function (byte) {
var _unary__edvuaz = this.w16_1;
this.w16_1 = _unary__edvuaz + 1 | 0;
this.u16_1[_unary__edvuaz] = byte;
};
protoOf(Segment).l18 = function (short) {
var data = this.u16_1;
var limit = this.w16_1;
var _unary__edvuaz = limit;
limit = _unary__edvuaz + 1 | 0;
data[_unary__edvuaz] = toByte((short >>> 8 | 0) & 255);
var _unary__edvuaz_0 = limit;
limit = _unary__edvuaz_0 + 1 | 0;
data[_unary__edvuaz_0] = toByte(short & 255);
this.w16_1 = limit;
};
protoOf(Segment).c17 = function () {
var _unary__edvuaz = this.v16_1;
this.v16_1 = _unary__edvuaz + 1 | 0;
return this.u16_1[_unary__edvuaz];
};
protoOf(Segment).e17 = function () {
var data = this.u16_1;
var pos = this.v16_1;
var _unary__edvuaz = pos;
pos = _unary__edvuaz + 1 | 0;
// Inline function 'kotlinx.io.and' call
var tmp = (data[_unary__edvuaz] & 255) << 8;
var _unary__edvuaz_0 = pos;
pos = _unary__edvuaz_0 + 1 | 0;
// Inline function 'kotlinx.io.and' call
var tmp$ret$1 = data[_unary__edvuaz_0] & 255;
var s = toShort(tmp | tmp$ret$1);
this.v16_1 = pos;
return s;
};
protoOf(Segment).f18 = function (sink, byteCount) {
// Inline function 'kotlin.check' call
if (!sink.y16_1) {
var message = 'only owner can write';
throw IllegalStateException_init_$Create$(toString(message));
}
if ((sink.w16_1 + byteCount | 0) > 8192) {
if (sink.d18())
throw IllegalArgumentException_init_$Create$_0();
if (((sink.w16_1 + byteCount | 0) - sink.v16_1 | 0) > 8192)
throw IllegalArgumentException_init_$Create$_0();
var tmp0 = sink.u16_1;
var tmp2 = sink.u16_1;
var tmp4 = sink.v16_1;
// Inline function 'kotlin.collections.copyInto' call
var endIndex = sink.w16_1;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
var tmp = tmp0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
arrayCopy(tmp, tmp2, 0, tmp4, endIndex);
sink.w16_1 = sink.w16_1 - sink.v16_1 | 0;
sink.v16_1 = 0;
}
var tmp0_0 = this.u16_1;
var tmp2_0 = sink.u16_1;
var tmp4_0 = sink.w16_1;
var tmp6 = this.v16_1;
// Inline function 'kotlin.collections.copyInto' call
var endIndex_0 = this.v16_1 + byteCount | 0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
var tmp_0 = tmp0_0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
arrayCopy(tmp_0, tmp2_0, tmp4_0, tmp6, endIndex_0);
sink.w16_1 = sink.w16_1 + byteCount | 0;
this.v16_1 = this.v16_1 + byteCount | 0;
};
protoOf(Segment).p17 = function (dst, dstStartOffset, dstEndOffset) {
var len = dstEndOffset - dstStartOffset | 0;
var tmp0 = this.u16_1;
var tmp6 = this.v16_1;
// Inline function 'kotlin.collections.copyInto' call
var endIndex = this.v16_1 + len | 0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
var tmp = tmp0;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
arrayCopy(tmp, dst, dstStartOffset, tmp6, endIndex);
this.v16_1 = this.v16_1 + len | 0;
};
protoOf(Segment).b18 = function (src, srcStartOffset, srcEndOffset) {
var tmp2 = this.u16_1;
// Inline function 'kotlin.collections.copyInto' call
var destinationOffset = this.w16_1;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
var tmp = src;
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
arrayCopy(tmp, tmp2, destinationOffset, srcStartOffset, srcEndOffset);
this.w16_1 = this.w16_1 + (srcEndOffset - srcStartOffset | 0) | 0;
};
protoOf(Segment).j = function () {
return this.w16_1 - this.v16_1 | 0;
};
protoOf(Segment).a18 = function () {
return this.u16_1.length - this.w16_1 | 0;
};
protoOf(Segment).e19 = function (readOnly) {
return this.u16_1;
};
protoOf(Segment).m17 = function (index) {
return this.u16_1[this.v16_1 + index | 0];
};
protoOf(Segment).f19 = function (index, value) {
this.u16_1[this.w16_1 + index | 0] = value;
};
protoOf(Segment).g19 = function (index, b0, b1) {
var d = this.u16_1;
var l = this.w16_1;
d[l + index | 0] = b0;
d[(l + index | 0) + 1 | 0] = b1;
};
protoOf(Segment).h19 = function (index, b0, b1, b2) {
var d = this.u16_1;
var l = this.w16_1;
d[l + index | 0] = b0;
d[(l + index | 0) + 1 | 0] = b1;
d[(l + index | 0) + 2 | 0] = b2;
};
protoOf(Segment).i19 = function (index, b0, b1, b2, b3) {
var d = this.u16_1;
var l = this.w16_1;
d[l + index | 0] = b0;
d[(l + index | 0) + 1 | 0] = b1;
d[(l + index | 0) + 2 | 0] = b2;
d[(l + index | 0) + 3 | 0] = b3;
};
function Segment() {
this.v16_1 = 0;
this.w16_1 = 0;
this.x16_1 = null;
this.y16_1 = false;
this.z16_1 = null;
this.a17_1 = null;
}
function SegmentCopyTracker() {
}
function isEmpty(_this__u8e3s4) {
return _this__u8e3s4.j() === 0;
}
function AlwaysSharedCopyTracker() {
AlwaysSharedCopyTracker_instance = this;
SegmentCopyTracker.call(this);
}
protoOf(AlwaysSharedCopyTracker).b19 = function () {
return true;
};
protoOf(AlwaysSharedCopyTracker).d19 = function () {
return Unit_instance;
};
var AlwaysSharedCopyTracker_instance;
function AlwaysSharedCopyTracker_getInstance() {
if (AlwaysSharedCopyTracker_instance == null)
new AlwaysSharedCopyTracker();
return AlwaysSharedCopyTracker_instance;
}
function indexOf_0(_this__u8e3s4, byte, startOffset, endOffset) {
// Inline function 'kotlin.require' call
if (!(0 <= startOffset ? startOffset < _this__u8e3s4.j() : false)) {
var message = '' + startOffset;
throw IllegalArgumentException_init_$Create$(toString(message));
}
// Inline function 'kotlin.require' call
if (!(startOffset <= endOffset ? endOffset <= _this__u8e3s4.j() : false)) {
var message_0 = '' + endOffset;
throw IllegalArgumentException_init_$Create$(toString(message_0));
}
var p = _this__u8e3s4.v16_1;
var data = _this__u8e3s4.e19(true);
var inductionVariable = startOffset;
if (inductionVariable < endOffset)
do {
var idx = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
if (data[p + idx | 0] === byte) {
return idx;
}
}
while (inductionVariable < endOffset);
return -1;
}
function Sink() {
}
function Source() {
}
function readByteArray(_this__u8e3s4) {
return readByteArrayImpl(_this__u8e3s4, -1);
}
function readByteArrayImpl(_this__u8e3s4, size) {
var arraySize = size;
if (size === -1) {
var fetchSize = new Long(2147483647, 0);
while (_this__u8e3s4.p16().j().a1(new Long(2147483647, 0)) < 0 && _this__u8e3s4.s16(fetchSize)) {
// Inline function 'kotlin.Long.times' call
fetchSize = fetchSize.t2(toLong(2));
}
// Inline function 'kotlin.check' call
if (!(_this__u8e3s4.p16().j().a1(new Long(2147483647, 0)) < 0)) {
var message = "Can't create an array of size " + _this__u8e3s4.p16().j().toString();
throw IllegalStateException_init_$Create$(toString(message));
}
arraySize = _this__u8e3s4.p16().j().z();
} else {
_this__u8e3s4.r16(toLong(size));
}
var array = new Int8Array(arraySize);
readTo(_this__u8e3s4.p16(), array);
return array;
}
function readTo(_this__u8e3s4, sink, startIndex, endIndex) {
startIndex = startIndex === VOID ? 0 : startIndex;
endIndex = endIndex === VOID ? sink.length : endIndex;
// Inline function 'kotlinx.io.checkBounds' call
var size = sink.length;
checkBounds(toLong(size), toLong(startIndex), toLong(endIndex));
var offset = startIndex;
while (offset < endIndex) {
var bytesRead = _this__u8e3s4.o17(sink, offset, endIndex);
if (bytesRead === -1) {
throw EOFException_init_$Create$_0('Source exhausted before reading ' + (endIndex - startIndex | 0) + ' bytes. ' + ('Only ' + bytesRead + ' bytes were read.'));
}
offset = offset + bytesRead | 0;
}
}
function readByteArray_0(_this__u8e3s4, byteCount) {
// Inline function 'kotlinx.io.checkByteCount' call
var byteCount_0 = toLong(byteCount);
// Inline function 'kotlin.require' call
if (!(byteCount_0.a1(new Long(0, 0)) >= 0)) {
var message = 'byteCount (' + byteCount_0.toString() + ') < 0';
throw IllegalArgumentException_init_$Create$(toString(message));
}
return readByteArrayImpl(_this__u8e3s4, byteCount);
}
function indexOf_1(_this__u8e3s4, byte, startIndex, endIndex) {
startIndex = startIndex === VOID ? new Long(0, 0) : startIndex;
endIndex = endIndex === VOID ? new Long(-1, 2147483647) : endIndex;
// Inline function 'kotlin.require' call
if (!((new Long(0, 0)).a1(startIndex) <= 0 ? startIndex.a1(endIndex) <= 0 : false)) {
var tmp;
if (endIndex.a1(new Long(0, 0)) < 0) {
tmp = 'startIndex (' + startIndex.toString() + ') and endIndex (' + endIndex.toString() + ') should be non negative';
} else {
tmp = 'startIndex (' + startIndex.toString() + ') is not within the range [0..endIndex(' + endIndex.toString() + '))';
}
var message = tmp;
throw IllegalArgumentException_init_$Create$(toString(message));
}
if (startIndex.equals(endIndex))
return new Long(-1, -1);
var offset = startIndex;
$l$loop: while (true) {
var tmp_0;
if (offset.a1(endIndex) < 0) {
// Inline function 'kotlin.Long.plus' call
var tmp$ret$2 = offset.r2(toLong(1));
tmp_0 = _this__u8e3s4.s16(tmp$ret$2);
} else {
tmp_0 = false;
}
if (!tmp_0) {
break $l$loop;
}
var tmp_1 = _this__u8e3s4.p16();
var tmp_2 = offset;
// Inline function 'kotlin.comparisons.minOf' call
var b = _this__u8e3s4.p16().j();
var tmp$ret$3 = endIndex.a1(b) <= 0 ? endIndex : b;
var idx = indexOf(tmp_1, byte, tmp_2, tmp$ret$3);
if (!idx.equals(new Long(-1, -1))) {
return idx;
}
offset = _this__u8e3s4.p16().j();
}
return new Long(-1, -1);
}
function readString(_this__u8e3s4) {
_this__u8e3s4.s16(new Long(-1, 2147483647));
return commonReadUtf8(_this__u8e3s4.p16(), _this__u8e3s4.p16().j());
}
function readString_0(_this__u8e3s4, byteCount) {
_this__u8e3s4.r16(byteCount);
return commonReadUtf8(_this__u8e3s4.p16(), byteCount);
}
function readString_1(_this__u8e3s4) {
return commonReadUtf8(_this__u8e3s4, _this__u8e3s4.j());
}
function