diff --git a/README.md b/README.md index fcce70d..66c79e0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,28 @@ Kotlin dialect (**KD**) is a set of tools and rules to write logic in Kotlin for several platforms. -The Kotlin dialect's core is an architecture inspired by Redux. +If you know what Kotlin Multiplatfrom is, you probably wonder what's the fuss. +If you tried Kotlin Multiplatform you surely know how hard it is to set up +correctly for multiple platforms. This project dictates one particular way +to have your code organized to be able to easily have logic in Kotlin +across platforms in **native** apps. -# Klin +This project's core concept is a Redux-like architecture. + +# Building and distributing Klin Klin is a translator that converts YML to Kotlin. +To build and distribute it, run: + $ `./util/run-klin-dbg` +The resulting Node.js application is located in `dist` + +# Running Klin + +$ `node dist/app.js --file=/path/to/kd.yml --out=/path/to/kd.kt` + ## Generation of entity fields | № | YML type | Kotlin type | Default value | YML example | Kotlin example | diff --git a/dist/app.js b/dist/app.js new file mode 100755 index 0000000..1ab4a99 --- /dev/null +++ b/dist/app.js @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +let fs = require("fs"); +let KT = require("./ver-nodejs-app").org.opengamestudio; + +//!<-- API --> + +function appSet(key, value) { + KT.appCtrl().set(key, value); +} + +//!<-- Component --> + +function AppComponent() { + this._construct = function() { + // Effects + let oneliners = [ + "inputFile", (c) => { appReadFile(c.inputFile) }, + "outputFileContents", (c) => { appWriteFile(c.outputFile, c.outputFileContents) }, + ]; + KT.registerOneliners(KT.appCtrl(), oneliners); + + // Defaults. + //appSet("isDbg", true); + appSet("arguments", process.argv); + }; + + this._construct(); +} + +// + +function appReadFile(fileName) { + let contents = fs.readFileSync(fileName, { encoding: "utf8", flag: "r" }); + let lines = contents.split("\n"); + appSet("inputFileLines", lines); +} + +function appWriteFile(fileName, contents) { + fs.writeFileSync(fileName, contents); + appSet("didWriteOutputFile", true); +} + +// + +let cmp = new AppComponent(); + +// + +appSet("didLaunch", true); diff --git a/dist/kotlin-kotlin-stdlib.js b/dist/kotlin-kotlin-stdlib.js new file mode 100644 index 0000000..332b050 --- /dev/null +++ b/dist/kotlin-kotlin-stdlib.js @@ -0,0 +1,5166 @@ +//region block: polyfills +(function () { + if (typeof globalThis === 'object') + return; + Object.defineProperty(Object.prototype, '__magic__', {get: function () { + return this; + }, configurable: true}); + __magic__.globalThis = __magic__; + delete Object.prototype.__magic__; +}()); +if (typeof Math.imul === 'undefined') { + Math.imul = function imul(a, b) { + return (a & 4.29490176E9) * (b & 65535) + (a & 65535) * (b | 0) | 0; + }; +} +if (typeof ArrayBuffer.isView === 'undefined') { + ArrayBuffer.isView = function (a) { + return a != null && a.__proto__ != null && a.__proto__.__proto__ === Int8Array.prototype.__proto__; + }; +} +if (typeof Array.prototype.fill === 'undefined') { + // Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill#Polyfill + Object.defineProperty(Array.prototype, 'fill', {value: function (value) { + // Steps 1-2. + if (this == null) { + throw new TypeError('this is null or not defined'); + } + var O = Object(this); // Steps 3-5. + var len = O.length >>> 0; // Steps 6-7. + var start = arguments[1]; + var relativeStart = start >> 0; // Step 8. + var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len); // Steps 9-10. + var end = arguments[2]; + var relativeEnd = end === undefined ? len : end >> 0; // Step 11. + var finalValue = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len); // Step 12. + while (k < finalValue) { + O[k] = value; + k++; + } + ; // Step 13. + return O; + }}); +} +[Int8Array, Int16Array, Uint16Array, Int32Array, Float32Array, Float64Array].forEach(function (TypedArray) { + if (typeof TypedArray.prototype.fill === 'undefined') { + Object.defineProperty(TypedArray.prototype, 'fill', {value: Array.prototype.fill}); + } +}); +if (typeof Math.clz32 === 'undefined') { + Math.clz32 = function (log, LN2) { + return function (x) { + var asUint = x >>> 0; + if (asUint === 0) { + return 32; + } + return 31 - (log(asUint) / LN2 | 0) | 0; // the "| 0" acts like math.floor + }; + }(Math.log, Math.LN2); +} +if (typeof String.prototype.startsWith === 'undefined') { + Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) { + position = position || 0; + return this.lastIndexOf(searchString, position) === position; + }}); +} +if (typeof String.prototype.endsWith === 'undefined') { + Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) { + var subjectString = this.toString(); + if (position === undefined || position > subjectString.length) { + position = subjectString.length; + } + position -= searchString.length; + var lastIndex = subjectString.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }}); +} +//endregion +(function (factory) { + if (typeof define === 'function' && define.amd) + define(['exports'], factory); + else if (typeof exports === 'object') + factory(module.exports); + else + globalThis['kotlin-kotlin-stdlib'] = factory(typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined' ? {} : globalThis['kotlin-kotlin-stdlib']); +}(function (_) { + 'use strict'; + //region block: imports + var imul = Math.imul; + var isView = ArrayBuffer.isView; + var clz32 = Math.clz32; + //endregion + //region block: pre-declaration + initMetadataForInterface(CharSequence, 'CharSequence'); + initMetadataForInterface(Comparable, 'Comparable'); + initMetadataForClass(Number_0, 'Number'); + initMetadataForClass(asIterable$$inlined$Iterable$1); + initMetadataForClass(Char, 'Char', VOID, VOID, [Comparable]); + initMetadataForInterface(Collection, 'Collection'); + initMetadataForInterface(KtList, 'List', VOID, VOID, [Collection]); + initMetadataForInterface(Entry, 'Entry'); + initMetadataForCompanion(Companion); + function asJsReadonlyMapView() { + return createJsReadonlyMapViewFrom(this); + } + initMetadataForInterface(KtMap, 'Map'); + initMetadataForInterface(KtSet, 'Set', VOID, VOID, [Collection]); + initMetadataForCompanion(Companion_0); + initMetadataForClass(Enum, 'Enum', VOID, VOID, [Comparable]); + initMetadataForCompanion(Companion_1); + initMetadataForClass(Long, 'Long', VOID, Number_0, [Number_0, Comparable]); + initMetadataForInterface(FunctionAdapter, 'FunctionAdapter'); + initMetadataForClass(JsMapView, 'JsMapView', JsMapView, Map); + initMetadataForInterface(Comparator, 'Comparator'); + initMetadataForObject(Unit, 'Unit'); + initMetadataForClass(AbstractCollection, 'AbstractCollection', VOID, VOID, [Collection]); + initMetadataForClass(AbstractMutableCollection, 'AbstractMutableCollection', VOID, AbstractCollection, [AbstractCollection, Collection]); + initMetadataForClass(IteratorImpl, 'IteratorImpl'); + initMetadataForClass(AbstractMutableList, 'AbstractMutableList', VOID, AbstractMutableCollection, [AbstractMutableCollection, Collection, KtList]); + initMetadataForClass(AbstractMap, 'AbstractMap', VOID, VOID, [KtMap]); + initMetadataForClass(AbstractMutableMap, 'AbstractMutableMap', VOID, AbstractMap, [AbstractMap, KtMap]); + initMetadataForClass(AbstractMutableSet, 'AbstractMutableSet', VOID, AbstractMutableCollection, [AbstractMutableCollection, Collection, KtSet]); + initMetadataForCompanion(Companion_2); + initMetadataForClass(ArrayList, 'ArrayList', ArrayList_init_$Create$, AbstractMutableList, [AbstractMutableList, Collection, KtList]); + initMetadataForClass(HashMap, 'HashMap', HashMap_init_$Create$, AbstractMutableMap, [AbstractMutableMap, KtMap]); + initMetadataForClass(HashMapKeys, 'HashMapKeys', VOID, AbstractMutableSet, [Collection, KtSet, AbstractMutableSet]); + initMetadataForClass(HashMapValues, 'HashMapValues', VOID, AbstractMutableCollection, [Collection, AbstractMutableCollection]); + initMetadataForClass(HashMapEntrySetBase, 'HashMapEntrySetBase', VOID, AbstractMutableSet, [Collection, KtSet, AbstractMutableSet]); + initMetadataForClass(HashMapEntrySet, 'HashMapEntrySet', VOID, HashMapEntrySetBase); + initMetadataForClass(HashMapKeysDefault$iterator$1); + initMetadataForClass(HashMapKeysDefault, 'HashMapKeysDefault', VOID, AbstractMutableSet); + initMetadataForClass(HashMapValuesDefault$iterator$1); + initMetadataForClass(HashMapValuesDefault, 'HashMapValuesDefault', VOID, AbstractMutableCollection); + initMetadataForCompanion(Companion_3); + initMetadataForClass(Itr, 'Itr'); + initMetadataForClass(KeysItr, 'KeysItr', VOID, Itr); + initMetadataForClass(ValuesItr, 'ValuesItr', VOID, Itr); + initMetadataForClass(EntriesItr, 'EntriesItr', VOID, Itr); + initMetadataForClass(EntryRef, 'EntryRef', VOID, VOID, [Entry]); + function containsAllEntries(m) { + var tmp$ret$0; + $l$block_0: { + // Inline function 'kotlin.collections.all' call + var tmp; + if (isInterface(m, Collection)) { + tmp = m.j(); + } else { + tmp = false; + } + if (tmp) { + tmp$ret$0 = true; + break $l$block_0; + } + var _iterator__ex2g4s = m.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + var entry = element; + var tmp_0; + if (!(entry == null) ? isInterface(entry, Entry) : false) { + tmp_0 = this.v5(entry); + } else { + tmp_0 = false; + } + if (!tmp_0) { + tmp$ret$0 = false; + break $l$block_0; + } + } + tmp$ret$0 = true; + } + return tmp$ret$0; + } + initMetadataForInterface(InternalMap, 'InternalMap'); + initMetadataForClass(InternalHashMap, 'InternalHashMap', InternalHashMap_init_$Create$, VOID, [InternalMap]); + initMetadataForObject(EmptyHolder, 'EmptyHolder'); + initMetadataForClass(LinkedHashMap, 'LinkedHashMap', LinkedHashMap_init_$Create$, HashMap, [HashMap, KtMap]); + initMetadataForClass(BaseOutput, 'BaseOutput'); + initMetadataForClass(NodeJsOutput, 'NodeJsOutput', VOID, BaseOutput); + initMetadataForClass(BufferedOutput, 'BufferedOutput', BufferedOutput, BaseOutput); + initMetadataForClass(BufferedOutputToConsoleLog, 'BufferedOutputToConsoleLog', BufferedOutputToConsoleLog, BufferedOutput); + initMetadataForClass(Exception, 'Exception', Exception_init_$Create$, Error); + initMetadataForClass(RuntimeException, 'RuntimeException', RuntimeException_init_$Create$, Exception); + initMetadataForClass(IllegalArgumentException, 'IllegalArgumentException', IllegalArgumentException_init_$Create$, RuntimeException); + initMetadataForClass(IllegalStateException, 'IllegalStateException', IllegalStateException_init_$Create$, RuntimeException); + initMetadataForClass(UnsupportedOperationException, 'UnsupportedOperationException', UnsupportedOperationException_init_$Create$, RuntimeException); + initMetadataForClass(NoSuchElementException, 'NoSuchElementException', NoSuchElementException_init_$Create$, RuntimeException); + initMetadataForClass(IndexOutOfBoundsException, 'IndexOutOfBoundsException', IndexOutOfBoundsException_init_$Create$, RuntimeException); + initMetadataForClass(ConcurrentModificationException, 'ConcurrentModificationException', ConcurrentModificationException_init_$Create$, RuntimeException); + initMetadataForClass(NullPointerException, 'NullPointerException', NullPointerException_init_$Create$, RuntimeException); + initMetadataForClass(ClassCastException, 'ClassCastException', ClassCastException_init_$Create$, RuntimeException); + initMetadataForClass(CharacterCodingException, 'CharacterCodingException', CharacterCodingException_init_$Create$, Exception); + initMetadataForClass(StringBuilder, 'StringBuilder', StringBuilder_init_$Create$_0, VOID, [CharSequence]); + initMetadataForCompanion(Companion_4); + initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]); + initMetadataForCompanion(Companion_5); + initMetadataForClass(AbstractMap$keys$1$iterator$1); + initMetadataForClass(AbstractMap$values$1$iterator$1); + initMetadataForCompanion(Companion_6); + initMetadataForClass(AbstractSet, 'AbstractSet', VOID, AbstractCollection, [AbstractCollection, KtSet]); + initMetadataForClass(AbstractMap$keys$1, VOID, VOID, AbstractSet); + initMetadataForClass(AbstractMap$values$1, VOID, VOID, AbstractCollection); + initMetadataForCompanion(Companion_7); + initMetadataForObject(EmptyList, 'EmptyList', VOID, VOID, [KtList]); + initMetadataForObject(EmptyIterator, 'EmptyIterator'); + initMetadataForObject(EmptyMap, 'EmptyMap', VOID, VOID, [KtMap]); + initMetadataForClass(IntIterator, 'IntIterator'); + initMetadataForObject(EmptySet, 'EmptySet', VOID, VOID, [KtSet]); + initMetadataForObject(NaturalOrderComparator, 'NaturalOrderComparator', VOID, VOID, [Comparator]); + initMetadataForClass(PaddingOption, 'PaddingOption', VOID, Enum); + initMetadataForClass(Base64, 'Base64'); + initMetadataForObject(Default, 'Default', VOID, Base64); + initMetadataForCompanion(Companion_8); + initMetadataForClass(IntProgression, 'IntProgression'); + initMetadataForClass(IntRange, 'IntRange', VOID, IntProgression); + initMetadataForClass(IntProgressionIterator, 'IntProgressionIterator', VOID, IntIterator); + initMetadataForCompanion(Companion_9); + initMetadataForClass(DelimitedRangesSequence$iterator$1); + initMetadataForClass(DelimitedRangesSequence, 'DelimitedRangesSequence'); + initMetadataForClass(Pair, 'Pair'); + //endregion + function CharSequence() { + } + function Comparable() { + } + function Number_0() { + } + function last(_this__u8e3s4) { + // Inline function 'kotlin.collections.isEmpty' call + if (_this__u8e3s4.length === 0) + throw NoSuchElementException_init_$Create$_0('Array is empty.'); + return _this__u8e3s4[get_lastIndex(_this__u8e3s4)]; + } + function get_lastIndex(_this__u8e3s4) { + return _this__u8e3s4.length - 1 | 0; + } + function indexOf(_this__u8e3s4, element) { + if (element == null) { + var inductionVariable = 0; + var last = _this__u8e3s4.length - 1 | 0; + if (inductionVariable <= last) + do { + var index = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + if (_this__u8e3s4[index] == null) { + return index; + } + } + while (inductionVariable <= last); + } else { + var inductionVariable_0 = 0; + var last_0 = _this__u8e3s4.length - 1 | 0; + if (inductionVariable_0 <= last_0) + do { + var index_0 = inductionVariable_0; + inductionVariable_0 = inductionVariable_0 + 1 | 0; + if (equals(element, _this__u8e3s4[index_0])) { + return index_0; + } + } + while (inductionVariable_0 <= last_0); + } + return -1; + } + function joinToString(_this__u8e3s4, separator, prefix, postfix, limit, truncated, transform) { + separator = separator === VOID ? ', ' : separator; + prefix = prefix === VOID ? '' : prefix; + postfix = postfix === VOID ? '' : postfix; + limit = limit === VOID ? -1 : limit; + truncated = truncated === VOID ? '...' : truncated; + transform = transform === VOID ? null : transform; + return joinTo(_this__u8e3s4, StringBuilder_init_$Create$_0(), separator, prefix, postfix, limit, truncated, transform).toString(); + } + function joinTo(_this__u8e3s4, buffer, separator, prefix, postfix, limit, truncated, transform) { + separator = separator === VOID ? ', ' : separator; + prefix = prefix === VOID ? '' : prefix; + postfix = postfix === VOID ? '' : postfix; + limit = limit === VOID ? -1 : limit; + truncated = truncated === VOID ? '...' : truncated; + transform = transform === VOID ? null : transform; + buffer.e(prefix); + var count = 0; + var inductionVariable = 0; + var last = _this__u8e3s4.length; + $l$loop: while (inductionVariable < last) { + var element = _this__u8e3s4[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + count = count + 1 | 0; + if (count > 1) { + buffer.e(separator); + } + if (limit < 0 || count <= limit) { + appendElement(buffer, element, transform); + } else + break $l$loop; + } + if (limit >= 0 && count > limit) { + buffer.e(truncated); + } + buffer.e(postfix); + return buffer; + } + function joinToString_0(_this__u8e3s4, separator, prefix, postfix, limit, truncated, transform) { + separator = separator === VOID ? ', ' : separator; + prefix = prefix === VOID ? '' : prefix; + postfix = postfix === VOID ? '' : postfix; + limit = limit === VOID ? -1 : limit; + truncated = truncated === VOID ? '...' : truncated; + transform = transform === VOID ? null : transform; + return joinTo_0(_this__u8e3s4, StringBuilder_init_$Create$_0(), separator, prefix, postfix, limit, truncated, transform).toString(); + } + function joinTo_0(_this__u8e3s4, buffer, separator, prefix, postfix, limit, truncated, transform) { + separator = separator === VOID ? ', ' : separator; + prefix = prefix === VOID ? '' : prefix; + postfix = postfix === VOID ? '' : postfix; + limit = limit === VOID ? -1 : limit; + truncated = truncated === VOID ? '...' : truncated; + transform = transform === VOID ? null : transform; + buffer.e(prefix); + var count = 0; + var _iterator__ex2g4s = _this__u8e3s4.f(); + $l$loop: while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + count = count + 1 | 0; + if (count > 1) { + buffer.e(separator); + } + if (limit < 0 || count <= limit) { + appendElement(buffer, element, transform); + } else + break $l$loop; + } + if (limit >= 0 && count > limit) { + buffer.e(truncated); + } + buffer.e(postfix); + return buffer; + } + function sorted(_this__u8e3s4) { + if (isInterface(_this__u8e3s4, Collection)) { + if (_this__u8e3s4.i() <= 1) + return toList(_this__u8e3s4); + // Inline function 'kotlin.collections.toTypedArray' call + var tmp = copyToArray(_this__u8e3s4); + // Inline function 'kotlin.apply' call + var this_0 = isArray(tmp) ? tmp : THROW_CCE(); + sort(this_0); + return asList(this_0); + } + // Inline function 'kotlin.apply' call + var this_1 = toMutableList(_this__u8e3s4); + sort_0(this_1); + return this_1; + } + function first(_this__u8e3s4) { + if (_this__u8e3s4.j()) + throw NoSuchElementException_init_$Create$_0('List is empty.'); + return _this__u8e3s4.k(0); + } + function last_0(_this__u8e3s4) { + if (_this__u8e3s4.j()) + throw NoSuchElementException_init_$Create$_0('List is empty.'); + return _this__u8e3s4.k(get_lastIndex_0(_this__u8e3s4)); + } + function single(_this__u8e3s4) { + if (isInterface(_this__u8e3s4, KtList)) + return single_0(_this__u8e3s4); + else { + var iterator = _this__u8e3s4.f(); + if (!iterator.g()) + throw NoSuchElementException_init_$Create$_0('Collection is empty.'); + var single = iterator.h(); + if (iterator.g()) + throw IllegalArgumentException_init_$Create$_0('Collection has more than one element.'); + return single; + } + } + function toList(_this__u8e3s4) { + if (isInterface(_this__u8e3s4, Collection)) { + var tmp; + switch (_this__u8e3s4.i()) { + case 0: + tmp = emptyList(); + break; + case 1: + var tmp_0; + if (isInterface(_this__u8e3s4, KtList)) { + tmp_0 = _this__u8e3s4.k(0); + } else { + tmp_0 = _this__u8e3s4.f().h(); + } + + tmp = listOf(tmp_0); + break; + default: + tmp = toMutableList_0(_this__u8e3s4); + break; + } + return tmp; + } + return optimizeReadOnlyList(toMutableList(_this__u8e3s4)); + } + function toMutableList(_this__u8e3s4) { + if (isInterface(_this__u8e3s4, Collection)) + return toMutableList_0(_this__u8e3s4); + return toCollection(_this__u8e3s4, ArrayList_init_$Create$()); + } + function single_0(_this__u8e3s4) { + var tmp; + switch (_this__u8e3s4.i()) { + case 0: + throw NoSuchElementException_init_$Create$_0('List is empty.'); + case 1: + tmp = _this__u8e3s4.k(0); + break; + default: + throw IllegalArgumentException_init_$Create$_0('List has more than one element.'); + } + return tmp; + } + function toMutableList_0(_this__u8e3s4) { + return ArrayList_init_$Create$_1(_this__u8e3s4); + } + function toCollection(_this__u8e3s4, destination) { + var _iterator__ex2g4s = _this__u8e3s4.f(); + while (_iterator__ex2g4s.g()) { + var item = _iterator__ex2g4s.h(); + destination.l(item); + } + return destination; + } + function until(_this__u8e3s4, to) { + if (to <= -2147483648) + return Companion_getInstance_8().m_1; + return numberRangeToNumber(_this__u8e3s4, to - 1 | 0); + } + function coerceAtLeast(_this__u8e3s4, minimumValue) { + return _this__u8e3s4 < minimumValue ? minimumValue : _this__u8e3s4; + } + function coerceAtMost(_this__u8e3s4, maximumValue) { + return _this__u8e3s4 > maximumValue ? maximumValue : _this__u8e3s4; + } + function downTo(_this__u8e3s4, to) { + return Companion_instance_9.n(_this__u8e3s4, to, -1); + } + function coerceIn(_this__u8e3s4, minimumValue, maximumValue) { + if (minimumValue > maximumValue) + throw IllegalArgumentException_init_$Create$_0('Cannot coerce value to an empty range: maximum ' + maximumValue + ' is less than minimum ' + minimumValue + '.'); + if (_this__u8e3s4 < minimumValue) + return minimumValue; + if (_this__u8e3s4 > maximumValue) + return maximumValue; + return _this__u8e3s4; + } + function asIterable(_this__u8e3s4) { + // Inline function 'kotlin.collections.Iterable' call + return new asIterable$$inlined$Iterable$1(_this__u8e3s4); + } + function asIterable$$inlined$Iterable$1($this_asIterable) { + this.o_1 = $this_asIterable; + } + protoOf(asIterable$$inlined$Iterable$1).f = function () { + return this.o_1.f(); + }; + function dropLast(_this__u8e3s4, n) { + // Inline function 'kotlin.require' call + if (!(n >= 0)) { + var message = 'Requested character count ' + n + ' is less than zero.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + return take(_this__u8e3s4, coerceAtLeast(_this__u8e3s4.length - n | 0, 0)); + } + function take(_this__u8e3s4, n) { + // Inline function 'kotlin.require' call + if (!(n >= 0)) { + var message = 'Requested character count ' + n + ' is less than zero.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + return substring(_this__u8e3s4, 0, coerceAtMost(n, _this__u8e3s4.length)); + } + function _Char___init__impl__6a9atx(value) { + return value; + } + function _get_value__a43j40($this) { + return $this; + } + function _Char___init__impl__6a9atx_0(code) { + // Inline function 'kotlin.UShort.toInt' call + var tmp$ret$0 = _UShort___get_data__impl__g0245(code) & 65535; + return _Char___init__impl__6a9atx(tmp$ret$0); + } + function Char__compareTo_impl_ypi4mb($this, other) { + return _get_value__a43j40($this) - _get_value__a43j40(other) | 0; + } + function Char__toInt_impl_vasixd($this) { + return _get_value__a43j40($this); + } + function toString($this) { + // Inline function 'kotlin.js.unsafeCast' call + return String.fromCharCode(_get_value__a43j40($this)); + } + function Char() { + } + function KtList() { + } + function Collection() { + } + function Entry() { + } + protoOf(Companion).fromJsMap = function (map) { + return createMapFrom(map); + }; + function Companion() { + } + var Companion_instance; + function Companion_getInstance() { + return Companion_instance; + } + function KtMap() { + } + function KtSet() { + } + function Companion_0() { + } + var Companion_instance_0; + function Companion_getInstance_0() { + return Companion_instance_0; + } + function Enum(name, ordinal) { + this.z_1 = name; + this.a1_1 = ordinal; + } + protoOf(Enum).b1 = function (other) { + return compareTo(this.a1_1, other.a1_1); + }; + protoOf(Enum).d = function (other) { + return this.b1(other instanceof Enum ? other : THROW_CCE()); + }; + protoOf(Enum).equals = function (other) { + return this === other; + }; + protoOf(Enum).hashCode = function () { + return identityHashCode(this); + }; + protoOf(Enum).toString = function () { + return this.z_1; + }; + function toString_0(_this__u8e3s4) { + var tmp1_elvis_lhs = _this__u8e3s4 == null ? null : toString_1(_this__u8e3s4); + return tmp1_elvis_lhs == null ? 'null' : tmp1_elvis_lhs; + } + function Companion_1() { + Companion_instance_1 = this; + this.c1_1 = new Long(0, -2147483648); + this.d1_1 = new Long(-1, 2147483647); + this.e1_1 = 8; + this.f1_1 = 64; + } + var Companion_instance_1; + function Companion_getInstance_1() { + if (Companion_instance_1 == null) + new Companion_1(); + return Companion_instance_1; + } + function Long(low, high) { + Companion_getInstance_1(); + Number_0.call(this); + this.g1_1 = low; + this.h1_1 = high; + } + protoOf(Long).i1 = function (other) { + return compare(this, other); + }; + protoOf(Long).d = function (other) { + return this.i1(other instanceof Long ? other : THROW_CCE()); + }; + protoOf(Long).j1 = function (other) { + return add(this, other); + }; + protoOf(Long).k1 = function (other) { + return multiply(this, other); + }; + protoOf(Long).l1 = function (other) { + return divide(this, other); + }; + protoOf(Long).m1 = function () { + return this.n1().j1(new Long(1, 0)); + }; + protoOf(Long).n1 = function () { + return new Long(~this.g1_1, ~this.h1_1); + }; + protoOf(Long).o1 = function () { + return this.g1_1; + }; + protoOf(Long).p1 = function () { + return toNumber(this); + }; + protoOf(Long).toString = function () { + return toStringImpl(this, 10); + }; + protoOf(Long).equals = function (other) { + var tmp; + if (other instanceof Long) { + tmp = equalsLong(this, other); + } else { + tmp = false; + } + return tmp; + }; + protoOf(Long).hashCode = function () { + return hashCode_0(this); + }; + protoOf(Long).valueOf = function () { + return this.p1(); + }; + function implement(interfaces) { + var maxSize = 1; + var masks = []; + var inductionVariable = 0; + var last = interfaces.length; + while (inductionVariable < last) { + var i = interfaces[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + var currentSize = maxSize; + var tmp0_elvis_lhs = i.prototype.$imask$; + var imask = tmp0_elvis_lhs == null ? i.$imask$ : tmp0_elvis_lhs; + if (!(imask == null)) { + masks.push(imask); + currentSize = imask.length; + } + var iid = i.$metadata$.iid; + var tmp; + if (iid == null) { + tmp = null; + } else { + // Inline function 'kotlin.let' call + tmp = bitMaskWith(iid); + } + var iidImask = tmp; + if (!(iidImask == null)) { + masks.push(iidImask); + currentSize = Math.max(currentSize, iidImask.length); + } + if (currentSize > maxSize) { + maxSize = currentSize; + } + } + return compositeBitMask(maxSize, masks); + } + function bitMaskWith(activeBit) { + var numberIndex = activeBit >> 5; + var intArray = new Int32Array(numberIndex + 1 | 0); + var positionInNumber = activeBit & 31; + var numberWithSettledBit = 1 << positionInNumber; + intArray[numberIndex] = intArray[numberIndex] | numberWithSettledBit; + return intArray; + } + function compositeBitMask(capacity, masks) { + var tmp = 0; + var tmp_0 = new Int32Array(capacity); + while (tmp < capacity) { + var tmp_1 = tmp; + var result = 0; + var inductionVariable = 0; + var last = masks.length; + while (inductionVariable < last) { + var mask = masks[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + if (tmp_1 < mask.length) { + result = result | mask[tmp_1]; + } + } + tmp_0[tmp_1] = result; + tmp = tmp + 1 | 0; + } + return tmp_0; + } + function isBitSet(_this__u8e3s4, possibleActiveBit) { + var numberIndex = possibleActiveBit >> 5; + if (numberIndex > _this__u8e3s4.length) + return false; + var positionInNumber = possibleActiveBit & 31; + var numberWithSettledBit = 1 << positionInNumber; + return !((_this__u8e3s4[numberIndex] & numberWithSettledBit) === 0); + } + function FunctionAdapter() { + } + function get_buf() { + _init_properties_bitUtils_kt__nfcg4k(); + return buf; + } + var buf; + function get_bufFloat64() { + _init_properties_bitUtils_kt__nfcg4k(); + return bufFloat64; + } + var bufFloat64; + var bufFloat32; + function get_bufInt32() { + _init_properties_bitUtils_kt__nfcg4k(); + return bufInt32; + } + var bufInt32; + function get_lowIndex() { + _init_properties_bitUtils_kt__nfcg4k(); + return lowIndex; + } + var lowIndex; + function get_highIndex() { + _init_properties_bitUtils_kt__nfcg4k(); + return highIndex; + } + var highIndex; + function getNumberHashCode(obj) { + _init_properties_bitUtils_kt__nfcg4k(); + // Inline function 'kotlin.js.jsBitwiseOr' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + if ((obj | 0) === obj) { + return numberToInt(obj); + } + get_bufFloat64()[0] = obj; + return imul(get_bufInt32()[get_highIndex()], 31) + get_bufInt32()[get_lowIndex()] | 0; + } + var properties_initialized_bitUtils_kt_i2bo3e; + function _init_properties_bitUtils_kt__nfcg4k() { + if (!properties_initialized_bitUtils_kt_i2bo3e) { + properties_initialized_bitUtils_kt_i2bo3e = true; + buf = new ArrayBuffer(8); + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + bufFloat64 = new Float64Array(get_buf()); + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + bufFloat32 = new Float32Array(get_buf()); + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + bufInt32 = new Int32Array(get_buf()); + // Inline function 'kotlin.run' call + get_bufFloat64()[0] = -1.0; + lowIndex = !(get_bufInt32()[0] === 0) ? 1 : 0; + highIndex = 1 - get_lowIndex() | 0; + } + } + function charSequenceGet(a, index) { + var tmp; + if (isString(a)) { + tmp = charCodeAt(a, index); + } else { + tmp = a.b(index); + } + return tmp; + } + function isString(a) { + return typeof a === 'string'; + } + function charCodeAt(_this__u8e3s4, index) { + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.charCodeAt(index); + } + function charSequenceLength(a) { + var tmp; + if (isString(a)) { + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + tmp = a.length; + } else { + tmp = a.a(); + } + return tmp; + } + function charSequenceSubSequence(a, startIndex, endIndex) { + var tmp; + if (isString(a)) { + tmp = substring(a, startIndex, endIndex); + } else { + tmp = a.c(startIndex, endIndex); + } + return tmp; + } + function arrayToString(array) { + return joinToString(array, ', ', '[', ']', VOID, VOID, arrayToString$lambda); + } + function arrayToString$lambda(it) { + return toString_1(it); + } + function UNSUPPORTED_OPERATION() { + throw UnsupportedOperationException_init_$Create$(); + } + function createJsReadonlyMapViewFrom(map) { + var tmp = createJsReadonlyMapViewFrom$lambda(map); + var tmp_0 = createJsReadonlyMapViewFrom$lambda_0(map); + var tmp_1 = createJsReadonlyMapViewFrom$lambda_1(map); + // Inline function 'kotlin.js.asDynamic' call + var tmp_2 = UNSUPPORTED_OPERATION$ref(); + // Inline function 'kotlin.js.asDynamic' call + var tmp_3 = UNSUPPORTED_OPERATION$ref_0(); + // Inline function 'kotlin.js.asDynamic' call + var tmp_4 = UNSUPPORTED_OPERATION$ref_1(); + var tmp_5 = createJsReadonlyMapViewFrom$lambda_2(map); + var tmp_6 = createJsReadonlyMapViewFrom$lambda_3(map); + var tmp_7 = createJsReadonlyMapViewFrom$lambda_4(map); + return createJsMapViewWith(tmp, tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, tmp_6, tmp_7, createJsReadonlyMapViewFrom$lambda_5); + } + function createJsMapViewWith(mapSize, mapGet, mapContains, mapPut, mapRemove, mapClear, keysIterator, valuesIterator, entriesIterator, forEach) { + // Inline function 'kotlin.also' call + var this_0 = objectCreate(protoOf(JsMapView)); + this_0[Symbol.iterator] = entriesIterator; + defineProp(this_0, 'size', mapSize, VOID); + var mapView = this_0; + return Object.assign(mapView, {get: mapGet, set: function (key, value) { + mapPut(key, value); + return this; + }, 'delete': mapRemove, clear: mapClear, has: mapContains, keys: keysIterator, values: valuesIterator, entries: entriesIterator, forEach: function (cb, thisArg) { + forEach(cb, mapView, thisArg); + }}); + } + function createJsIteratorFrom(iterator, transform) { + var tmp; + if (transform === VOID) { + tmp = createJsIteratorFrom$lambda; + } else { + tmp = transform; + } + transform = tmp; + var iteratorNext = createJsIteratorFrom$lambda_0(iterator); + var iteratorHasNext = createJsIteratorFrom$lambda_1(iterator); + var jsIterator = {next: function () { + var result = {done: !iteratorHasNext()}; + if (!result.done) + result.value = transform(iteratorNext()); + return result; + }}; + jsIterator[Symbol.iterator] = function () { + return this; + }; + return jsIterator; + } + function forEach(cb, collection, thisArg) { + thisArg = thisArg === VOID ? undefined : thisArg; + var iterator = collection.entries(); + var result = iterator.next(); + while (!result.done) { + var value = result.value; + // Inline function 'kotlin.js.asDynamic' call + cb.call(thisArg, value[1], value[0], collection); + result = iterator.next(); + } + } + function JsMapView() { + Map.call(this); + } + function createMapFrom(map) { + // Inline function 'kotlin.collections.buildMapInternal' call + // Inline function 'kotlin.apply' call + var this_0 = LinkedHashMap_init_$Create$(); + forEach(createMapFrom$lambda(this_0), map); + return this_0.x1(); + } + function createJsReadonlyMapViewFrom$lambda($map) { + return function () { + return $map.i(); + }; + } + function createJsReadonlyMapViewFrom$lambda_0($map) { + return function (k) { + return $map.v(k); + }; + } + function createJsReadonlyMapViewFrom$lambda_1($map) { + return function (k) { + return $map.t(k); + }; + } + function UNSUPPORTED_OPERATION$ref() { + var l = function () { + UNSUPPORTED_OPERATION(); + return Unit_instance; + }; + l.callableName = 'UNSUPPORTED_OPERATION'; + return l; + } + function UNSUPPORTED_OPERATION$ref_0() { + var l = function () { + UNSUPPORTED_OPERATION(); + return Unit_instance; + }; + l.callableName = 'UNSUPPORTED_OPERATION'; + return l; + } + function UNSUPPORTED_OPERATION$ref_1() { + var l = function () { + UNSUPPORTED_OPERATION(); + return Unit_instance; + }; + l.callableName = 'UNSUPPORTED_OPERATION'; + return l; + } + function createJsReadonlyMapViewFrom$lambda_2($map) { + return function () { + return createJsIteratorFrom($map.w().f()); + }; + } + function createJsReadonlyMapViewFrom$lambda_3($map) { + return function () { + return createJsIteratorFrom($map.x().f()); + }; + } + function createJsReadonlyMapViewFrom$lambda$lambda(it) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + return [it.r(), it.s()]; + } + function createJsReadonlyMapViewFrom$lambda_4($map) { + return function () { + var tmp = $map.y().f(); + return createJsIteratorFrom(tmp, createJsReadonlyMapViewFrom$lambda$lambda); + }; + } + function createJsReadonlyMapViewFrom$lambda_5(callback, map, thisArg) { + forEach(callback, map, thisArg); + return Unit_instance; + } + function createJsIteratorFrom$lambda(it) { + return it; + } + function createJsIteratorFrom$lambda_0($iterator) { + return function () { + return $iterator.h(); + }; + } + function createJsIteratorFrom$lambda_1($iterator) { + return function () { + return $iterator.g(); + }; + } + function createMapFrom$lambda($$this$buildMapInternal) { + return function (value, key, _unused_var__etf5q3) { + $$this$buildMapInternal.y1(key, value); + return Unit_instance; + }; + } + function compareTo(a, b) { + var tmp; + switch (typeof a) { + case 'number': + var tmp_0; + if (typeof b === 'number') { + tmp_0 = doubleCompareTo(a, b); + } else { + if (b instanceof Long) { + tmp_0 = doubleCompareTo(a, b.p1()); + } else { + tmp_0 = primitiveCompareTo(a, b); + } + } + + tmp = tmp_0; + break; + case 'string': + case 'boolean': + tmp = primitiveCompareTo(a, b); + break; + default: + tmp = compareToDoNotIntrinsicify(a, b); + break; + } + return tmp; + } + function doubleCompareTo(a, b) { + var tmp; + if (a < b) { + tmp = -1; + } else if (a > b) { + tmp = 1; + } else if (a === b) { + var tmp_0; + if (a !== 0) { + tmp_0 = 0; + } else { + // Inline function 'kotlin.js.asDynamic' call + var ia = 1 / a; + var tmp_1; + // Inline function 'kotlin.js.asDynamic' call + if (ia === 1 / b) { + tmp_1 = 0; + } else { + if (ia < 0) { + tmp_1 = -1; + } else { + tmp_1 = 1; + } + } + tmp_0 = tmp_1; + } + tmp = tmp_0; + } else if (a !== a) { + tmp = b !== b ? 0 : 1; + } else { + tmp = -1; + } + return tmp; + } + function primitiveCompareTo(a, b) { + return a < b ? -1 : a > b ? 1 : 0; + } + function compareToDoNotIntrinsicify(a, b) { + return a.d(b); + } + function identityHashCode(obj) { + return getObjectHashCode(obj); + } + function getObjectHashCode(obj) { + // Inline function 'kotlin.js.jsIn' call + if (!('kotlinHashCodeValue$' in obj)) { + var hash = calculateRandomHash(); + var descriptor = new Object(); + descriptor.value = hash; + descriptor.enumerable = false; + Object.defineProperty(obj, 'kotlinHashCodeValue$', descriptor); + } + // Inline function 'kotlin.js.unsafeCast' call + return obj['kotlinHashCodeValue$']; + } + function calculateRandomHash() { + // Inline function 'kotlin.js.jsBitwiseOr' call + return Math.random() * 4.294967296E9 | 0; + } + function objectCreate(proto) { + proto = proto === VOID ? null : proto; + return Object.create(proto); + } + function defineProp(obj, name, getter, setter) { + return Object.defineProperty(obj, name, {configurable: true, get: getter, set: setter}); + } + function toString_1(o) { + var tmp; + if (o == null) { + tmp = 'null'; + } else if (isArrayish(o)) { + tmp = '[...]'; + } else if (!(typeof o.toString === 'function')) { + tmp = anyToString(o); + } else { + // Inline function 'kotlin.js.unsafeCast' call + tmp = o.toString(); + } + return tmp; + } + function anyToString(o) { + return Object.prototype.toString.call(o); + } + function hashCode(obj) { + if (obj == null) + return 0; + var typeOf = typeof obj; + var tmp; + switch (typeOf) { + case 'object': + tmp = 'function' === typeof obj.hashCode ? obj.hashCode() : getObjectHashCode(obj); + break; + case 'function': + tmp = getObjectHashCode(obj); + break; + case 'number': + tmp = getNumberHashCode(obj); + break; + case 'boolean': + // Inline function 'kotlin.js.unsafeCast' call + + tmp = getBooleanHashCode(obj); + break; + case 'string': + tmp = getStringHashCode(String(obj)); + break; + case 'bigint': + tmp = getBigIntHashCode(obj); + break; + case 'symbol': + tmp = getSymbolHashCode(obj); + break; + default: + tmp = function () { + throw new Error('Unexpected typeof `' + typeOf + '`'); + }(); + break; + } + return tmp; + } + function getBooleanHashCode(value) { + return value ? 1231 : 1237; + } + function getStringHashCode(str) { + var hash = 0; + var length = str.length; + var inductionVariable = 0; + var last = length - 1 | 0; + if (inductionVariable <= last) + do { + var i = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + // Inline function 'kotlin.js.asDynamic' call + var code = str.charCodeAt(i); + hash = imul(hash, 31) + code | 0; + } + while (!(i === last)); + return hash; + } + function getBigIntHashCode(value) { + var shiftNumber = BigInt(32); + var MASK = BigInt(4.294967295E9); + var bigNumber = value < 0 ? -value : value; + var hashCode = 0; + var signum = value < 0 ? -1 : 1; + while (bigNumber != 0) { + // Inline function 'kotlin.js.unsafeCast' call + var chunk = Number(bigNumber & MASK); + hashCode = imul(31, hashCode) + chunk | 0; + bigNumber = bigNumber >> shiftNumber; + } + return imul(hashCode, signum); + } + function getSymbolHashCode(value) { + var hashCodeMap = symbolIsSharable(value) ? getSymbolMap() : getSymbolWeakMap(); + var cachedHashCode = hashCodeMap.get(value); + if (cachedHashCode !== VOID) + return cachedHashCode; + var hash = calculateRandomHash(); + hashCodeMap.set(value, hash); + return hash; + } + function symbolIsSharable(symbol) { + return Symbol.keyFor(symbol) != VOID; + } + function getSymbolMap() { + if (symbolMap === VOID) { + symbolMap = new Map(); + } + return symbolMap; + } + function getSymbolWeakMap() { + if (symbolWeakMap === VOID) { + symbolWeakMap = new WeakMap(); + } + return symbolWeakMap; + } + var symbolMap; + var symbolWeakMap; + function equals(obj1, obj2) { + if (obj1 == null) { + return obj2 == null; + } + if (obj2 == null) { + return false; + } + if (typeof obj1 === 'object' && typeof obj1.equals === 'function') { + return obj1.equals(obj2); + } + if (obj1 !== obj1) { + return obj2 !== obj2; + } + if (typeof obj1 === 'number' && typeof obj2 === 'number') { + var tmp; + if (obj1 === obj2) { + var tmp_0; + if (obj1 !== 0) { + tmp_0 = true; + } else { + // Inline function 'kotlin.js.asDynamic' call + var tmp_1 = 1 / obj1; + // Inline function 'kotlin.js.asDynamic' call + tmp_0 = tmp_1 === 1 / obj2; + } + tmp = tmp_0; + } else { + tmp = false; + } + return tmp; + } + return obj1 === obj2; + } + function unboxIntrinsic(x) { + var message = 'Should be lowered'; + throw IllegalStateException_init_$Create$_0(toString_1(message)); + } + function captureStack(instance, constructorFunction) { + if (Error.captureStackTrace != null) { + Error.captureStackTrace(instance, constructorFunction); + } else { + // Inline function 'kotlin.js.asDynamic' call + instance.stack = (new Error()).stack; + } + } + function protoOf(constructor) { + return constructor.prototype; + } + function defineMessage(message, cause) { + var tmp; + if (isUndefined(message)) { + var tmp_0; + if (isUndefined(cause)) { + tmp_0 = message; + } else { + var tmp1_elvis_lhs = cause == null ? null : cause.toString(); + tmp_0 = tmp1_elvis_lhs == null ? VOID : tmp1_elvis_lhs; + } + tmp = tmp_0; + } else { + tmp = message == null ? VOID : message; + } + return tmp; + } + function isUndefined(value) { + return value === VOID; + } + function extendThrowable(this_, message, cause) { + defineFieldOnInstance(this_, 'message', defineMessage(message, cause)); + defineFieldOnInstance(this_, 'cause', cause); + defineFieldOnInstance(this_, 'name', Object.getPrototypeOf(this_).constructor.name); + } + function defineFieldOnInstance(this_, name, value) { + Object.defineProperty(this_, name, {configurable: true, writable: true, value: value}); + } + function ensureNotNull(v) { + var tmp; + if (v == null) { + THROW_NPE(); + } else { + tmp = v; + } + return tmp; + } + function THROW_NPE() { + throw NullPointerException_init_$Create$(); + } + function THROW_CCE() { + throw ClassCastException_init_$Create$(); + } + function get_ZERO() { + _init_properties_longJs_kt__elc2w5(); + return ZERO; + } + var ZERO; + function get_ONE() { + _init_properties_longJs_kt__elc2w5(); + return ONE; + } + var ONE; + function get_NEG_ONE() { + _init_properties_longJs_kt__elc2w5(); + return NEG_ONE; + } + var NEG_ONE; + function get_MAX_VALUE() { + _init_properties_longJs_kt__elc2w5(); + return MAX_VALUE; + } + var MAX_VALUE; + function get_MIN_VALUE() { + _init_properties_longJs_kt__elc2w5(); + return MIN_VALUE; + } + var MIN_VALUE; + function get_TWO_PWR_24_() { + _init_properties_longJs_kt__elc2w5(); + return TWO_PWR_24_; + } + var TWO_PWR_24_; + function compare(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + if (equalsLong(_this__u8e3s4, other)) { + return 0; + } + var thisNeg = isNegative(_this__u8e3s4); + var otherNeg = isNegative(other); + return thisNeg && !otherNeg ? -1 : !thisNeg && otherNeg ? 1 : isNegative(subtract(_this__u8e3s4, other)) ? -1 : 1; + } + function add(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + var a48 = _this__u8e3s4.h1_1 >>> 16 | 0; + var a32 = _this__u8e3s4.h1_1 & 65535; + var a16 = _this__u8e3s4.g1_1 >>> 16 | 0; + var a00 = _this__u8e3s4.g1_1 & 65535; + var b48 = other.h1_1 >>> 16 | 0; + var b32 = other.h1_1 & 65535; + var b16 = other.g1_1 >>> 16 | 0; + var b00 = other.g1_1 & 65535; + var c48 = 0; + var c32 = 0; + var c16 = 0; + var c00 = 0; + c00 = c00 + (a00 + b00 | 0) | 0; + c16 = c16 + (c00 >>> 16 | 0) | 0; + c00 = c00 & 65535; + c16 = c16 + (a16 + b16 | 0) | 0; + c32 = c32 + (c16 >>> 16 | 0) | 0; + c16 = c16 & 65535; + c32 = c32 + (a32 + b32 | 0) | 0; + c48 = c48 + (c32 >>> 16 | 0) | 0; + c32 = c32 & 65535; + c48 = c48 + (a48 + b48 | 0) | 0; + c48 = c48 & 65535; + return new Long(c16 << 16 | c00, c48 << 16 | c32); + } + function subtract(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + return add(_this__u8e3s4, other.m1()); + } + function multiply(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + if (isZero(_this__u8e3s4)) { + return get_ZERO(); + } else if (isZero(other)) { + return get_ZERO(); + } + if (equalsLong(_this__u8e3s4, get_MIN_VALUE())) { + return isOdd(other) ? get_MIN_VALUE() : get_ZERO(); + } else if (equalsLong(other, get_MIN_VALUE())) { + return isOdd(_this__u8e3s4) ? get_MIN_VALUE() : get_ZERO(); + } + if (isNegative(_this__u8e3s4)) { + var tmp; + if (isNegative(other)) { + tmp = multiply(negate(_this__u8e3s4), negate(other)); + } else { + tmp = negate(multiply(negate(_this__u8e3s4), other)); + } + return tmp; + } else if (isNegative(other)) { + return negate(multiply(_this__u8e3s4, negate(other))); + } + if (lessThan(_this__u8e3s4, get_TWO_PWR_24_()) && lessThan(other, get_TWO_PWR_24_())) { + return fromNumber(toNumber(_this__u8e3s4) * toNumber(other)); + } + var a48 = _this__u8e3s4.h1_1 >>> 16 | 0; + var a32 = _this__u8e3s4.h1_1 & 65535; + var a16 = _this__u8e3s4.g1_1 >>> 16 | 0; + var a00 = _this__u8e3s4.g1_1 & 65535; + var b48 = other.h1_1 >>> 16 | 0; + var b32 = other.h1_1 & 65535; + var b16 = other.g1_1 >>> 16 | 0; + var b00 = other.g1_1 & 65535; + var c48 = 0; + var c32 = 0; + var c16 = 0; + var c00 = 0; + c00 = c00 + imul(a00, b00) | 0; + c16 = c16 + (c00 >>> 16 | 0) | 0; + c00 = c00 & 65535; + c16 = c16 + imul(a16, b00) | 0; + c32 = c32 + (c16 >>> 16 | 0) | 0; + c16 = c16 & 65535; + c16 = c16 + imul(a00, b16) | 0; + c32 = c32 + (c16 >>> 16 | 0) | 0; + c16 = c16 & 65535; + c32 = c32 + imul(a32, b00) | 0; + c48 = c48 + (c32 >>> 16 | 0) | 0; + c32 = c32 & 65535; + c32 = c32 + imul(a16, b16) | 0; + c48 = c48 + (c32 >>> 16 | 0) | 0; + c32 = c32 & 65535; + c32 = c32 + imul(a00, b32) | 0; + c48 = c48 + (c32 >>> 16 | 0) | 0; + c32 = c32 & 65535; + c48 = c48 + (((imul(a48, b00) + imul(a32, b16) | 0) + imul(a16, b32) | 0) + imul(a00, b48) | 0) | 0; + c48 = c48 & 65535; + return new Long(c16 << 16 | c00, c48 << 16 | c32); + } + function divide(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + if (isZero(other)) { + throw Exception_init_$Create$_0('division by zero'); + } else if (isZero(_this__u8e3s4)) { + return get_ZERO(); + } + if (equalsLong(_this__u8e3s4, get_MIN_VALUE())) { + if (equalsLong(other, get_ONE()) || equalsLong(other, get_NEG_ONE())) { + return get_MIN_VALUE(); + } else if (equalsLong(other, get_MIN_VALUE())) { + return get_ONE(); + } else { + var halfThis = shiftRight(_this__u8e3s4, 1); + var approx = shiftLeft(halfThis.l1(other), 1); + if (equalsLong(approx, get_ZERO())) { + return isNegative(other) ? get_ONE() : get_NEG_ONE(); + } else { + var rem = subtract(_this__u8e3s4, multiply(other, approx)); + return add(approx, rem.l1(other)); + } + } + } else if (equalsLong(other, get_MIN_VALUE())) { + return get_ZERO(); + } + if (isNegative(_this__u8e3s4)) { + var tmp; + if (isNegative(other)) { + tmp = negate(_this__u8e3s4).l1(negate(other)); + } else { + tmp = negate(negate(_this__u8e3s4).l1(other)); + } + return tmp; + } else if (isNegative(other)) { + return negate(_this__u8e3s4.l1(negate(other))); + } + var res = get_ZERO(); + var rem_0 = _this__u8e3s4; + while (greaterThanOrEqual(rem_0, other)) { + var approxDouble = toNumber(rem_0) / toNumber(other); + var approx2 = Math.max(1.0, Math.floor(approxDouble)); + var log2 = Math.ceil(Math.log(approx2) / Math.LN2); + var delta = log2 <= 48 ? 1.0 : Math.pow(2.0, log2 - 48); + var approxRes = fromNumber(approx2); + var approxRem = multiply(approxRes, other); + while (isNegative(approxRem) || greaterThan(approxRem, rem_0)) { + approx2 = approx2 - delta; + approxRes = fromNumber(approx2); + approxRem = multiply(approxRes, other); + } + if (isZero(approxRes)) { + approxRes = get_ONE(); + } + res = add(res, approxRes); + rem_0 = subtract(rem_0, approxRem); + } + return res; + } + function shiftLeft(_this__u8e3s4, numBits) { + _init_properties_longJs_kt__elc2w5(); + var numBits_0 = numBits & 63; + if (numBits_0 === 0) { + return _this__u8e3s4; + } else { + if (numBits_0 < 32) { + return new Long(_this__u8e3s4.g1_1 << numBits_0, _this__u8e3s4.h1_1 << numBits_0 | (_this__u8e3s4.g1_1 >>> (32 - numBits_0 | 0) | 0)); + } else { + return new Long(0, _this__u8e3s4.g1_1 << (numBits_0 - 32 | 0)); + } + } + } + function shiftRight(_this__u8e3s4, numBits) { + _init_properties_longJs_kt__elc2w5(); + var numBits_0 = numBits & 63; + if (numBits_0 === 0) { + return _this__u8e3s4; + } else { + if (numBits_0 < 32) { + return new Long(_this__u8e3s4.g1_1 >>> numBits_0 | 0 | _this__u8e3s4.h1_1 << (32 - numBits_0 | 0), _this__u8e3s4.h1_1 >> numBits_0); + } else { + return new Long(_this__u8e3s4.h1_1 >> (numBits_0 - 32 | 0), _this__u8e3s4.h1_1 >= 0 ? 0 : -1); + } + } + } + function toNumber(_this__u8e3s4) { + _init_properties_longJs_kt__elc2w5(); + return _this__u8e3s4.h1_1 * 4.294967296E9 + getLowBitsUnsigned(_this__u8e3s4); + } + function toStringImpl(_this__u8e3s4, radix) { + _init_properties_longJs_kt__elc2w5(); + if (radix < 2 || 36 < radix) { + throw Exception_init_$Create$_0('radix out of range: ' + radix); + } + if (isZero(_this__u8e3s4)) { + return '0'; + } + if (isNegative(_this__u8e3s4)) { + if (equalsLong(_this__u8e3s4, get_MIN_VALUE())) { + var radixLong = fromInt(radix); + var div = _this__u8e3s4.l1(radixLong); + var rem = subtract(multiply(div, radixLong), _this__u8e3s4).o1(); + var tmp = toStringImpl(div, radix); + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + return tmp + rem.toString(radix); + } else { + return '-' + toStringImpl(negate(_this__u8e3s4), radix); + } + } + var digitsPerTime = radix === 2 ? 31 : radix <= 10 ? 9 : radix <= 21 ? 7 : radix <= 35 ? 6 : 5; + var radixToPower = fromNumber(Math.pow(radix, digitsPerTime)); + var rem_0 = _this__u8e3s4; + var result = ''; + while (true) { + var remDiv = rem_0.l1(radixToPower); + var intval = subtract(rem_0, multiply(remDiv, radixToPower)).o1(); + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + var digits = intval.toString(radix); + rem_0 = remDiv; + if (isZero(rem_0)) { + return digits + result; + } else { + while (digits.length < digitsPerTime) { + digits = '0' + digits; + } + result = digits + result; + } + } + } + function equalsLong(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + return _this__u8e3s4.h1_1 === other.h1_1 && _this__u8e3s4.g1_1 === other.g1_1; + } + function hashCode_0(l) { + _init_properties_longJs_kt__elc2w5(); + return l.g1_1 ^ l.h1_1; + } + function fromInt(value) { + _init_properties_longJs_kt__elc2w5(); + return new Long(value, value < 0 ? -1 : 0); + } + function isNegative(_this__u8e3s4) { + _init_properties_longJs_kt__elc2w5(); + return _this__u8e3s4.h1_1 < 0; + } + function isZero(_this__u8e3s4) { + _init_properties_longJs_kt__elc2w5(); + return _this__u8e3s4.h1_1 === 0 && _this__u8e3s4.g1_1 === 0; + } + function isOdd(_this__u8e3s4) { + _init_properties_longJs_kt__elc2w5(); + return (_this__u8e3s4.g1_1 & 1) === 1; + } + function negate(_this__u8e3s4) { + _init_properties_longJs_kt__elc2w5(); + return _this__u8e3s4.m1(); + } + function lessThan(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + return compare(_this__u8e3s4, other) < 0; + } + function fromNumber(value) { + _init_properties_longJs_kt__elc2w5(); + if (isNaN_0(value)) { + return get_ZERO(); + } else if (value <= -9.223372036854776E18) { + return get_MIN_VALUE(); + } else if (value + 1 >= 9.223372036854776E18) { + return get_MAX_VALUE(); + } else if (value < 0) { + return negate(fromNumber(-value)); + } else { + var twoPwr32 = 4.294967296E9; + // Inline function 'kotlin.js.jsBitwiseOr' call + var tmp = value % twoPwr32 | 0; + // Inline function 'kotlin.js.jsBitwiseOr' call + var tmp$ret$1 = value / twoPwr32 | 0; + return new Long(tmp, tmp$ret$1); + } + } + function greaterThan(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + return compare(_this__u8e3s4, other) > 0; + } + function greaterThanOrEqual(_this__u8e3s4, other) { + _init_properties_longJs_kt__elc2w5(); + return compare(_this__u8e3s4, other) >= 0; + } + function getLowBitsUnsigned(_this__u8e3s4) { + _init_properties_longJs_kt__elc2w5(); + return _this__u8e3s4.g1_1 >= 0 ? _this__u8e3s4.g1_1 : 4.294967296E9 + _this__u8e3s4.g1_1; + } + var properties_initialized_longJs_kt_4syf89; + function _init_properties_longJs_kt__elc2w5() { + if (!properties_initialized_longJs_kt_4syf89) { + properties_initialized_longJs_kt_4syf89 = true; + ZERO = fromInt(0); + ONE = fromInt(1); + NEG_ONE = fromInt(-1); + MAX_VALUE = new Long(-1, 2147483647); + MIN_VALUE = new Long(0, -2147483648); + TWO_PWR_24_ = fromInt(16777216); + } + } + function createMetadata(kind, name, defaultConstructor, associatedObjectKey, associatedObjects, suspendArity) { + var undef = VOID; + var iid = kind === 'interface' ? generateInterfaceId() : VOID; + return {kind: kind, simpleName: name, associatedObjectKey: associatedObjectKey, associatedObjects: associatedObjects, suspendArity: suspendArity, $kClass$: undef, defaultConstructor: defaultConstructor, iid: iid}; + } + function generateInterfaceId() { + if (globalInterfaceId === VOID) { + globalInterfaceId = 0; + } + // Inline function 'kotlin.js.unsafeCast' call + globalInterfaceId = globalInterfaceId + 1 | 0; + // Inline function 'kotlin.js.unsafeCast' call + return globalInterfaceId; + } + var globalInterfaceId; + function initMetadataFor(kind, ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects) { + if (!(parent == null)) { + ctor.prototype = Object.create(parent.prototype); + ctor.prototype.constructor = ctor; + } + var metadata = createMetadata(kind, name, defaultConstructor, associatedObjectKey, associatedObjects, suspendArity); + ctor.$metadata$ = metadata; + if (!(interfaces == null)) { + var receiver = !equals(metadata.iid, VOID) ? ctor : ctor.prototype; + receiver.$imask$ = implement(interfaces); + } + } + function initMetadataForClass(ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects) { + var kind = 'class'; + initMetadataFor(kind, ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects); + } + function initMetadataForObject(ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects) { + var kind = 'object'; + initMetadataFor(kind, ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects); + } + function initMetadataForInterface(ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects) { + var kind = 'interface'; + initMetadataFor(kind, ctor, name, defaultConstructor, parent, interfaces, suspendArity, associatedObjectKey, associatedObjects); + } + function initMetadataForLambda(ctor, parent, interfaces, suspendArity) { + initMetadataForClass(ctor, 'Lambda', VOID, parent, interfaces, suspendArity, VOID, VOID); + } + function initMetadataForCoroutine(ctor, parent, interfaces, suspendArity) { + initMetadataForClass(ctor, 'Coroutine', VOID, parent, interfaces, suspendArity, VOID, VOID); + } + function initMetadataForFunctionReference(ctor, parent, interfaces, suspendArity) { + initMetadataForClass(ctor, 'FunctionReference', VOID, parent, interfaces, suspendArity, VOID, VOID); + } + function initMetadataForCompanion(ctor, parent, interfaces, suspendArity) { + initMetadataForObject(ctor, 'Companion', VOID, parent, interfaces, suspendArity, VOID, VOID); + } + function toByte(a) { + // Inline function 'kotlin.js.unsafeCast' call + return a << 24 >> 24; + } + function numberToInt(a) { + var tmp; + if (a instanceof Long) { + tmp = a.o1(); + } else { + tmp = doubleToInt(a); + } + return tmp; + } + function doubleToInt(a) { + var tmp; + if (a > 2147483647) { + tmp = 2147483647; + } else if (a < -2147483648) { + tmp = -2147483648; + } else { + // Inline function 'kotlin.js.jsBitwiseOr' call + tmp = a | 0; + } + return tmp; + } + function toShort(a) { + // Inline function 'kotlin.js.unsafeCast' call + return a << 16 >> 16; + } + function numberToChar(a) { + // Inline function 'kotlin.toUShort' call + var this_0 = numberToInt(a); + var tmp$ret$0 = _UShort___init__impl__jigrne(toShort(this_0)); + return _Char___init__impl__6a9atx_0(tmp$ret$0); + } + function toLong(a) { + return fromInt(a); + } + function numberRangeToNumber(start, endInclusive) { + return new IntRange(start, endInclusive); + } + function isArrayish(o) { + return isJsArray(o) || isView(o); + } + function isJsArray(obj) { + // Inline function 'kotlin.js.unsafeCast' call + return Array.isArray(obj); + } + function isInterface(obj, iface) { + return isInterfaceImpl(obj, iface.$metadata$.iid); + } + function isInterfaceImpl(obj, iface) { + // Inline function 'kotlin.js.unsafeCast' call + var tmp0_elvis_lhs = obj.$imask$; + var tmp; + if (tmp0_elvis_lhs == null) { + return false; + } else { + tmp = tmp0_elvis_lhs; + } + var mask = tmp; + return isBitSet(mask, iface); + } + function isArray(obj) { + var tmp; + if (isJsArray(obj)) { + // Inline function 'kotlin.js.asDynamic' call + tmp = !obj.$type$; + } else { + tmp = false; + } + return tmp; + } + function isNumber(a) { + var tmp; + if (typeof a === 'number') { + tmp = true; + } else { + tmp = a instanceof Long; + } + return tmp; + } + function isComparable(value) { + var type = typeof value; + return type === 'string' || type === 'boolean' || isNumber(value) || isInterface(value, Comparable); + } + function isCharSequence(value) { + return typeof value === 'string' || isInterface(value, CharSequence); + } + function get_VOID() { + _init_properties_void_kt__3zg9as(); + return VOID; + } + var VOID; + var properties_initialized_void_kt_e4ret2; + function _init_properties_void_kt__3zg9as() { + if (!properties_initialized_void_kt_e4ret2) { + properties_initialized_void_kt_e4ret2 = true; + VOID = void 0; + } + } + function fill(_this__u8e3s4, element, fromIndex, toIndex) { + fromIndex = fromIndex === VOID ? 0 : fromIndex; + toIndex = toIndex === VOID ? _this__u8e3s4.length : toIndex; + Companion_instance_5.a2(fromIndex, toIndex, _this__u8e3s4.length); + // Inline function 'kotlin.js.nativeFill' call + // Inline function 'kotlin.js.asDynamic' call + _this__u8e3s4.fill(element, fromIndex, toIndex); + } + function sort(_this__u8e3s4) { + if (_this__u8e3s4.length > 1) { + sortArray(_this__u8e3s4); + } + } + function asList(_this__u8e3s4) { + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + return new ArrayList(_this__u8e3s4); + } + function copyOf(_this__u8e3s4, newSize) { + // Inline function 'kotlin.require' call + if (!(newSize >= 0)) { + var message = 'Invalid new array size: ' + newSize + '.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + return fillFrom(_this__u8e3s4, new Int32Array(newSize)); + } + function copyOf_0(_this__u8e3s4, newSize) { + // Inline function 'kotlin.require' call + if (!(newSize >= 0)) { + var message = 'Invalid new array size: ' + newSize + '.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + return arrayCopyResize(_this__u8e3s4, newSize, null); + } + function Comparator() { + } + function isNaN_0(_this__u8e3s4) { + return !(_this__u8e3s4 === _this__u8e3s4); + } + function takeHighestOneBit(_this__u8e3s4) { + var tmp; + if (_this__u8e3s4 === 0) { + tmp = 0; + } else { + // Inline function 'kotlin.countLeadingZeroBits' call + tmp = 1 << (31 - clz32(_this__u8e3s4) | 0); + } + return tmp; + } + function Unit() { + } + protoOf(Unit).toString = function () { + return 'kotlin.Unit'; + }; + var Unit_instance; + function Unit_getInstance() { + return Unit_instance; + } + function collectionToArray(collection) { + return collectionToArrayCommonImpl(collection); + } + function listOf(element) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + var tmp$ret$2 = [element]; + return new ArrayList(tmp$ret$2); + } + function sort_0(_this__u8e3s4) { + collectionsSort(_this__u8e3s4, naturalOrder()); + } + function copyToArray(collection) { + var tmp; + // Inline function 'kotlin.js.asDynamic' call + if (collection.toArray !== undefined) { + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + tmp = collection.toArray(); + } else { + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + tmp = collectionToArray(collection); + } + return tmp; + } + function collectionsSort(list, comparator) { + if (list.i() <= 1) + return Unit_instance; + var array = copyToArray(list); + sortArrayWith(array, comparator); + var inductionVariable = 0; + var last = array.length; + if (inductionVariable < last) + do { + var i = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + list.b2(i, array[i]); + } + while (inductionVariable < last); + } + function AbstractMutableCollection() { + AbstractCollection.call(this); + } + protoOf(AbstractMutableCollection).toJSON = function () { + return this.toArray(); + }; + protoOf(AbstractMutableCollection).c2 = function () { + }; + function IteratorImpl($outer) { + this.f2_1 = $outer; + this.d2_1 = 0; + this.e2_1 = -1; + } + protoOf(IteratorImpl).g = function () { + return this.d2_1 < this.f2_1.i(); + }; + protoOf(IteratorImpl).h = function () { + if (!this.g()) + throw NoSuchElementException_init_$Create$(); + var tmp = this; + var _unary__edvuaz = this.d2_1; + this.d2_1 = _unary__edvuaz + 1 | 0; + tmp.e2_1 = _unary__edvuaz; + return this.f2_1.k(this.e2_1); + }; + function AbstractMutableList() { + AbstractMutableCollection.call(this); + this.g2_1 = 0; + } + protoOf(AbstractMutableList).l = function (element) { + this.c2(); + this.h2(this.i(), element); + return true; + }; + protoOf(AbstractMutableList).f = function () { + return new IteratorImpl(this); + }; + protoOf(AbstractMutableList).p = function (element) { + return this.j2(element) >= 0; + }; + protoOf(AbstractMutableList).j2 = function (element) { + var tmp$ret$1; + $l$block: { + // Inline function 'kotlin.collections.indexOfFirst' call + var index = 0; + var _iterator__ex2g4s = this.f(); + while (_iterator__ex2g4s.g()) { + var item = _iterator__ex2g4s.h(); + if (equals(item, element)) { + tmp$ret$1 = index; + break $l$block; + } + index = index + 1 | 0; + } + tmp$ret$1 = -1; + } + return tmp$ret$1; + }; + protoOf(AbstractMutableList).equals = function (other) { + if (other === this) + return true; + if (!(!(other == null) ? isInterface(other, KtList) : false)) + return false; + return Companion_instance_5.k2(this, other); + }; + protoOf(AbstractMutableList).hashCode = function () { + return Companion_instance_5.l2(this); + }; + function AbstractMutableMap() { + AbstractMap.call(this); + this.o2_1 = null; + this.p2_1 = null; + } + protoOf(AbstractMutableMap).q2 = function () { + return new HashMapKeysDefault(this); + }; + protoOf(AbstractMutableMap).r2 = function () { + return new HashMapValuesDefault(this); + }; + protoOf(AbstractMutableMap).w = function () { + var tmp0_elvis_lhs = this.o2_1; + var tmp; + if (tmp0_elvis_lhs == null) { + // Inline function 'kotlin.also' call + var this_0 = this.q2(); + this.o2_1 = this_0; + tmp = this_0; + } else { + tmp = tmp0_elvis_lhs; + } + return tmp; + }; + protoOf(AbstractMutableMap).x = function () { + var tmp0_elvis_lhs = this.p2_1; + var tmp; + if (tmp0_elvis_lhs == null) { + // Inline function 'kotlin.also' call + var this_0 = this.r2(); + this.p2_1 = this_0; + tmp = this_0; + } else { + tmp = tmp0_elvis_lhs; + } + return tmp; + }; + function AbstractMutableSet() { + AbstractMutableCollection.call(this); + } + protoOf(AbstractMutableSet).equals = function (other) { + if (other === this) + return true; + if (!(!(other == null) ? isInterface(other, KtSet) : false)) + return false; + return Companion_instance_7.v2(this, other); + }; + protoOf(AbstractMutableSet).hashCode = function () { + return Companion_instance_7.w2(this); + }; + function arrayOfUninitializedElements(capacity) { + // Inline function 'kotlin.require' call + if (!(capacity >= 0)) { + var message = 'capacity must be non-negative.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + // Inline function 'kotlin.arrayOfNulls' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + return Array(capacity); + } + function resetRange(_this__u8e3s4, fromIndex, toIndex) { + // Inline function 'kotlin.js.nativeFill' call + // Inline function 'kotlin.js.asDynamic' call + _this__u8e3s4.fill(null, fromIndex, toIndex); + } + function copyOfUninitializedElements(_this__u8e3s4, newSize) { + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + return copyOf_0(_this__u8e3s4, newSize); + } + function Companion_2() { + Companion_instance_2 = this; + var tmp = this; + // Inline function 'kotlin.also' call + var this_0 = ArrayList_init_$Create$_0(0); + this_0.z2_1 = true; + tmp.a3_1 = this_0; + } + var Companion_instance_2; + function Companion_getInstance_2() { + if (Companion_instance_2 == null) + new Companion_2(); + return Companion_instance_2; + } + function ArrayList_init_$Init$($this) { + // Inline function 'kotlin.emptyArray' call + var tmp$ret$0 = []; + ArrayList.call($this, tmp$ret$0); + return $this; + } + function ArrayList_init_$Create$() { + return ArrayList_init_$Init$(objectCreate(protoOf(ArrayList))); + } + function ArrayList_init_$Init$_0(initialCapacity, $this) { + // Inline function 'kotlin.emptyArray' call + var tmp$ret$0 = []; + ArrayList.call($this, tmp$ret$0); + // Inline function 'kotlin.require' call + if (!(initialCapacity >= 0)) { + var message = 'Negative initial capacity: ' + initialCapacity; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + return $this; + } + function ArrayList_init_$Create$_0(initialCapacity) { + return ArrayList_init_$Init$_0(initialCapacity, objectCreate(protoOf(ArrayList))); + } + function ArrayList_init_$Init$_1(elements, $this) { + // Inline function 'kotlin.collections.toTypedArray' call + var tmp$ret$0 = copyToArray(elements); + ArrayList.call($this, tmp$ret$0); + return $this; + } + function ArrayList_init_$Create$_1(elements) { + return ArrayList_init_$Init$_1(elements, objectCreate(protoOf(ArrayList))); + } + function rangeCheck($this, index) { + // Inline function 'kotlin.apply' call + Companion_instance_5.b3(index, $this.i()); + return index; + } + function insertionRangeCheck($this, index) { + // Inline function 'kotlin.apply' call + Companion_instance_5.c3(index, $this.i()); + return index; + } + function ArrayList(array) { + Companion_getInstance_2(); + AbstractMutableList.call(this); + this.y2_1 = array; + this.z2_1 = false; + } + protoOf(ArrayList).i = function () { + return this.y2_1.length; + }; + protoOf(ArrayList).k = function (index) { + var tmp = this.y2_1[rangeCheck(this, index)]; + return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE(); + }; + protoOf(ArrayList).b2 = function (index, element) { + this.c2(); + rangeCheck(this, index); + // Inline function 'kotlin.apply' call + var this_0 = this.y2_1[index]; + this.y2_1[index] = element; + var tmp = this_0; + return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE(); + }; + protoOf(ArrayList).l = function (element) { + this.c2(); + // Inline function 'kotlin.js.asDynamic' call + this.y2_1.push(element); + this.g2_1 = this.g2_1 + 1 | 0; + return true; + }; + protoOf(ArrayList).h2 = function (index, element) { + this.c2(); + // Inline function 'kotlin.js.asDynamic' call + this.y2_1.splice(insertionRangeCheck(this, index), 0, element); + this.g2_1 = this.g2_1 + 1 | 0; + }; + protoOf(ArrayList).i2 = function (index) { + this.c2(); + rangeCheck(this, index); + this.g2_1 = this.g2_1 + 1 | 0; + var tmp; + if (index === get_lastIndex_0(this)) { + // Inline function 'kotlin.js.asDynamic' call + tmp = this.y2_1.pop(); + } else { + // Inline function 'kotlin.js.asDynamic' call + tmp = this.y2_1.splice(index, 1)[0]; + } + return tmp; + }; + protoOf(ArrayList).j2 = function (element) { + return indexOf(this.y2_1, element); + }; + protoOf(ArrayList).toString = function () { + return arrayToString(this.y2_1); + }; + protoOf(ArrayList).d3 = function () { + return [].slice.call(this.y2_1); + }; + protoOf(ArrayList).toArray = function () { + return this.d3(); + }; + protoOf(ArrayList).c2 = function () { + if (this.z2_1) + throw UnsupportedOperationException_init_$Create$(); + }; + var _stableSortingIsSupported; + function sortArray(array) { + if (getStableSortingIsSupported()) { + var comparison = sortArray$lambda; + // Inline function 'kotlin.js.asDynamic' call + array.sort(comparison); + } else { + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + mergeSort(array, 0, get_lastIndex(array), naturalOrder()); + } + } + function sortArrayWith(array, comparator) { + if (getStableSortingIsSupported()) { + var comparison = sortArrayWith$lambda(comparator); + // Inline function 'kotlin.js.asDynamic' call + array.sort(comparison); + } else { + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + mergeSort(array, 0, get_lastIndex(array), comparator); + } + } + function getStableSortingIsSupported() { + var tmp0_safe_receiver = _stableSortingIsSupported; + if (tmp0_safe_receiver == null) + null; + else { + // Inline function 'kotlin.let' call + return tmp0_safe_receiver; + } + _stableSortingIsSupported = false; + // Inline function 'kotlin.js.unsafeCast' call + var array = []; + var inductionVariable = 0; + if (inductionVariable < 600) + do { + var index = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + // Inline function 'kotlin.js.asDynamic' call + array.push(index); + } + while (inductionVariable < 600); + var comparison = getStableSortingIsSupported$lambda; + // Inline function 'kotlin.js.asDynamic' call + array.sort(comparison); + var inductionVariable_0 = 1; + var last = array.length; + if (inductionVariable_0 < last) + do { + var index_0 = inductionVariable_0; + inductionVariable_0 = inductionVariable_0 + 1 | 0; + var a = array[index_0 - 1 | 0]; + var b = array[index_0]; + if ((a & 3) === (b & 3) && a >= b) + return false; + } + while (inductionVariable_0 < last); + _stableSortingIsSupported = true; + return true; + } + function mergeSort(array, start, endInclusive, comparator) { + // Inline function 'kotlin.arrayOfNulls' call + var size = array.length; + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + var buffer = Array(size); + var result = mergeSort_0(array, buffer, start, endInclusive, comparator); + if (!(result === array)) { + var inductionVariable = start; + if (inductionVariable <= endInclusive) + do { + var i = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + array[i] = result[i]; + } + while (!(i === endInclusive)); + } + } + function mergeSort_0(array, buffer, start, end, comparator) { + if (start === end) { + return array; + } + var median = (start + end | 0) / 2 | 0; + var left = mergeSort_0(array, buffer, start, median, comparator); + var right = mergeSort_0(array, buffer, median + 1 | 0, end, comparator); + var target = left === buffer ? array : buffer; + var leftIndex = start; + var rightIndex = median + 1 | 0; + var inductionVariable = start; + if (inductionVariable <= end) + do { + var i = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + if (leftIndex <= median && rightIndex <= end) { + var leftValue = left[leftIndex]; + var rightValue = right[rightIndex]; + if (comparator.compare(leftValue, rightValue) <= 0) { + target[i] = leftValue; + leftIndex = leftIndex + 1 | 0; + } else { + target[i] = rightValue; + rightIndex = rightIndex + 1 | 0; + } + } else if (leftIndex <= median) { + target[i] = left[leftIndex]; + leftIndex = leftIndex + 1 | 0; + } else { + target[i] = right[rightIndex]; + rightIndex = rightIndex + 1 | 0; + } + } + while (!(i === end)); + return target; + } + function sortArray$lambda(a, b) { + return compareTo(a, b); + } + function sortArrayWith$lambda($comparator) { + return function (a, b) { + return $comparator.compare(a, b); + }; + } + function getStableSortingIsSupported$lambda(a, b) { + return (a & 3) - (b & 3) | 0; + } + function HashMap_init_$Init$(internalMap, $this) { + AbstractMutableMap.call($this); + HashMap.call($this); + $this.i3_1 = internalMap; + return $this; + } + function HashMap_init_$Init$_0($this) { + HashMap_init_$Init$(InternalHashMap_init_$Create$(), $this); + return $this; + } + function HashMap_init_$Create$() { + return HashMap_init_$Init$_0(objectCreate(protoOf(HashMap))); + } + protoOf(HashMap).t = function (key) { + return this.i3_1.k3(key); + }; + protoOf(HashMap).u = function (value) { + return this.i3_1.u(value); + }; + protoOf(HashMap).q2 = function () { + return new HashMapKeys(this.i3_1); + }; + protoOf(HashMap).r2 = function () { + return new HashMapValues(this.i3_1); + }; + protoOf(HashMap).y = function () { + var tmp0_elvis_lhs = this.j3_1; + var tmp; + if (tmp0_elvis_lhs == null) { + // Inline function 'kotlin.also' call + var this_0 = new HashMapEntrySet(this.i3_1); + this.j3_1 = this_0; + tmp = this_0; + } else { + tmp = tmp0_elvis_lhs; + } + return tmp; + }; + protoOf(HashMap).v = function (key) { + return this.i3_1.v(key); + }; + protoOf(HashMap).y1 = function (key, value) { + return this.i3_1.y1(key, value); + }; + protoOf(HashMap).i = function () { + return this.i3_1.i(); + }; + function HashMap() { + this.j3_1 = null; + } + function HashMapKeys(backing) { + AbstractMutableSet.call(this); + this.l3_1 = backing; + } + protoOf(HashMapKeys).i = function () { + return this.l3_1.i(); + }; + protoOf(HashMapKeys).j = function () { + return this.l3_1.i() === 0; + }; + protoOf(HashMapKeys).p = function (element) { + return this.l3_1.k3(element); + }; + protoOf(HashMapKeys).l = function (element) { + throw UnsupportedOperationException_init_$Create$(); + }; + protoOf(HashMapKeys).f = function () { + return this.l3_1.m3(); + }; + function HashMapValues(backing) { + AbstractMutableCollection.call(this); + this.n3_1 = backing; + } + protoOf(HashMapValues).i = function () { + return this.n3_1.i(); + }; + protoOf(HashMapValues).j = function () { + return this.n3_1.i() === 0; + }; + protoOf(HashMapValues).o3 = function (element) { + return this.n3_1.u(element); + }; + protoOf(HashMapValues).p = function (element) { + if (!(element == null ? true : !(element == null))) + return false; + return this.o3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(HashMapValues).p3 = function (element) { + throw UnsupportedOperationException_init_$Create$(); + }; + protoOf(HashMapValues).l = function (element) { + return this.p3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(HashMapValues).f = function () { + return this.n3_1.q3(); + }; + function HashMapEntrySet(backing) { + HashMapEntrySetBase.call(this, backing); + } + protoOf(HashMapEntrySet).f = function () { + return this.s3_1.t3(); + }; + function HashMapEntrySetBase(backing) { + AbstractMutableSet.call(this); + this.s3_1 = backing; + } + protoOf(HashMapEntrySetBase).i = function () { + return this.s3_1.i(); + }; + protoOf(HashMapEntrySetBase).j = function () { + return this.s3_1.i() === 0; + }; + protoOf(HashMapEntrySetBase).u3 = function (element) { + return this.s3_1.w3(element); + }; + protoOf(HashMapEntrySetBase).p = function (element) { + if (!(!(element == null) ? isInterface(element, Entry) : false)) + return false; + return this.u3((!(element == null) ? isInterface(element, Entry) : false) ? element : THROW_CCE()); + }; + protoOf(HashMapEntrySetBase).v3 = function (element) { + throw UnsupportedOperationException_init_$Create$(); + }; + protoOf(HashMapEntrySetBase).l = function (element) { + return this.v3((!(element == null) ? isInterface(element, Entry) : false) ? element : THROW_CCE()); + }; + protoOf(HashMapEntrySetBase).q = function (elements) { + return this.s3_1.x3(elements); + }; + function HashMapKeysDefault$iterator$1($entryIterator) { + this.y3_1 = $entryIterator; + } + protoOf(HashMapKeysDefault$iterator$1).g = function () { + return this.y3_1.g(); + }; + protoOf(HashMapKeysDefault$iterator$1).h = function () { + return this.y3_1.h().r(); + }; + function HashMapKeysDefault(backingMap) { + AbstractMutableSet.call(this); + this.z3_1 = backingMap; + } + protoOf(HashMapKeysDefault).a4 = function (element) { + throw UnsupportedOperationException_init_$Create$_0('Add is not supported on keys'); + }; + protoOf(HashMapKeysDefault).l = function (element) { + return this.a4((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(HashMapKeysDefault).k3 = function (element) { + return this.z3_1.t(element); + }; + protoOf(HashMapKeysDefault).p = function (element) { + if (!(element == null ? true : !(element == null))) + return false; + return this.k3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(HashMapKeysDefault).f = function () { + var entryIterator = this.z3_1.y().f(); + return new HashMapKeysDefault$iterator$1(entryIterator); + }; + protoOf(HashMapKeysDefault).i = function () { + return this.z3_1.i(); + }; + function HashMapValuesDefault$iterator$1($entryIterator) { + this.b4_1 = $entryIterator; + } + protoOf(HashMapValuesDefault$iterator$1).g = function () { + return this.b4_1.g(); + }; + protoOf(HashMapValuesDefault$iterator$1).h = function () { + return this.b4_1.h().s(); + }; + function HashMapValuesDefault(backingMap) { + AbstractMutableCollection.call(this); + this.c4_1 = backingMap; + } + protoOf(HashMapValuesDefault).p3 = function (element) { + throw UnsupportedOperationException_init_$Create$_0('Add is not supported on values'); + }; + protoOf(HashMapValuesDefault).l = function (element) { + return this.p3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(HashMapValuesDefault).o3 = function (element) { + return this.c4_1.u(element); + }; + protoOf(HashMapValuesDefault).p = function (element) { + if (!(element == null ? true : !(element == null))) + return false; + return this.o3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(HashMapValuesDefault).f = function () { + var entryIterator = this.c4_1.y().f(); + return new HashMapValuesDefault$iterator$1(entryIterator); + }; + protoOf(HashMapValuesDefault).i = function () { + return this.c4_1.i(); + }; + function computeHashSize($this, capacity) { + return takeHighestOneBit(imul(coerceAtLeast(capacity, 1), 3)); + } + function computeShift($this, hashSize) { + // Inline function 'kotlin.countLeadingZeroBits' call + return clz32(hashSize) + 1 | 0; + } + function checkForComodification($this) { + if (!($this.n4_1.k4_1 === $this.p4_1)) + throw ConcurrentModificationException_init_$Create$_0('The backing map has been modified after this entry was obtained.'); + } + function InternalHashMap_init_$Init$($this) { + InternalHashMap_init_$Init$_0(8, $this); + return $this; + } + function InternalHashMap_init_$Create$() { + return InternalHashMap_init_$Init$(objectCreate(protoOf(InternalHashMap))); + } + function InternalHashMap_init_$Init$_0(initialCapacity, $this) { + InternalHashMap.call($this, arrayOfUninitializedElements(initialCapacity), null, new Int32Array(initialCapacity), new Int32Array(computeHashSize(Companion_instance_3, initialCapacity)), 2, 0); + return $this; + } + function InternalHashMap_init_$Create$_0(initialCapacity) { + return InternalHashMap_init_$Init$_0(initialCapacity, objectCreate(protoOf(InternalHashMap))); + } + function _get_capacity__a9k9f3($this) { + return $this.d4_1.length; + } + function _get_hashSize__tftcho($this) { + return $this.g4_1.length; + } + function registerModification($this) { + $this.k4_1 = $this.k4_1 + 1 | 0; + } + function ensureExtraCapacity($this, n) { + if (shouldCompact($this, n)) { + compact($this, true); + } else { + ensureCapacity($this, $this.i4_1 + n | 0); + } + } + function shouldCompact($this, extraCapacity) { + var spareCapacity = _get_capacity__a9k9f3($this) - $this.i4_1 | 0; + var gaps = $this.i4_1 - $this.i() | 0; + return spareCapacity < extraCapacity && (gaps + spareCapacity | 0) >= extraCapacity && gaps >= (_get_capacity__a9k9f3($this) / 4 | 0); + } + function ensureCapacity($this, minCapacity) { + if (minCapacity < 0) + throw RuntimeException_init_$Create$_0('too many elements'); + if (minCapacity > _get_capacity__a9k9f3($this)) { + var newSize = Companion_instance_5.q4(_get_capacity__a9k9f3($this), minCapacity); + $this.d4_1 = copyOfUninitializedElements($this.d4_1, newSize); + var tmp = $this; + var tmp0_safe_receiver = $this.e4_1; + tmp.e4_1 = tmp0_safe_receiver == null ? null : copyOfUninitializedElements(tmp0_safe_receiver, newSize); + $this.f4_1 = copyOf($this.f4_1, newSize); + var newHashSize = computeHashSize(Companion_instance_3, newSize); + if (newHashSize > _get_hashSize__tftcho($this)) { + rehash($this, newHashSize); + } + } + } + function allocateValuesArray($this) { + var curValuesArray = $this.e4_1; + if (!(curValuesArray == null)) + return curValuesArray; + var newValuesArray = arrayOfUninitializedElements(_get_capacity__a9k9f3($this)); + $this.e4_1 = newValuesArray; + return newValuesArray; + } + function hash($this, key) { + return key == null ? 0 : imul(hashCode(key), -1640531527) >>> $this.j4_1 | 0; + } + function compact($this, updateHashArray) { + var i = 0; + var j = 0; + var valuesArray = $this.e4_1; + while (i < $this.i4_1) { + var hash = $this.f4_1[i]; + if (hash >= 0) { + $this.d4_1[j] = $this.d4_1[i]; + if (!(valuesArray == null)) { + valuesArray[j] = valuesArray[i]; + } + if (updateHashArray) { + $this.f4_1[j] = hash; + $this.g4_1[hash] = j + 1 | 0; + } + j = j + 1 | 0; + } + i = i + 1 | 0; + } + resetRange($this.d4_1, j, $this.i4_1); + if (valuesArray == null) + null; + else { + resetRange(valuesArray, j, $this.i4_1); + } + $this.i4_1 = j; + } + function rehash($this, newHashSize) { + registerModification($this); + if ($this.i4_1 > $this.l4_1) { + compact($this, false); + } + $this.g4_1 = new Int32Array(newHashSize); + $this.j4_1 = computeShift(Companion_instance_3, newHashSize); + var i = 0; + while (i < $this.i4_1) { + var _unary__edvuaz = i; + i = _unary__edvuaz + 1 | 0; + if (!putRehash($this, _unary__edvuaz)) { + throw IllegalStateException_init_$Create$_0('This cannot happen with fixed magic multiplier and grow-only hash array. Have object hashCodes changed?'); + } + } + } + function putRehash($this, i) { + var hash_0 = hash($this, $this.d4_1[i]); + var probesLeft = $this.h4_1; + while (true) { + var index = $this.g4_1[hash_0]; + if (index === 0) { + $this.g4_1[hash_0] = i + 1 | 0; + $this.f4_1[i] = hash_0; + return true; + } + probesLeft = probesLeft - 1 | 0; + if (probesLeft < 0) + return false; + var _unary__edvuaz = hash_0; + hash_0 = _unary__edvuaz - 1 | 0; + if (_unary__edvuaz === 0) + hash_0 = _get_hashSize__tftcho($this) - 1 | 0; + } + } + function findKey($this, key) { + var hash_0 = hash($this, key); + var probesLeft = $this.h4_1; + while (true) { + var index = $this.g4_1[hash_0]; + if (index === 0) + return -1; + if (index > 0 && equals($this.d4_1[index - 1 | 0], key)) + return index - 1 | 0; + probesLeft = probesLeft - 1 | 0; + if (probesLeft < 0) + return -1; + var _unary__edvuaz = hash_0; + hash_0 = _unary__edvuaz - 1 | 0; + if (_unary__edvuaz === 0) + hash_0 = _get_hashSize__tftcho($this) - 1 | 0; + } + } + function findValue($this, value) { + var i = $this.i4_1; + $l$loop: while (true) { + i = i - 1 | 0; + if (!(i >= 0)) { + break $l$loop; + } + if ($this.f4_1[i] >= 0 && equals(ensureNotNull($this.e4_1)[i], value)) + return i; + } + return -1; + } + function addKey($this, key) { + $this.r4(); + retry: while (true) { + var hash_0 = hash($this, key); + var tentativeMaxProbeDistance = coerceAtMost(imul($this.h4_1, 2), _get_hashSize__tftcho($this) / 2 | 0); + var probeDistance = 0; + while (true) { + var index = $this.g4_1[hash_0]; + if (index <= 0) { + if ($this.i4_1 >= _get_capacity__a9k9f3($this)) { + ensureExtraCapacity($this, 1); + continue retry; + } + var _unary__edvuaz = $this.i4_1; + $this.i4_1 = _unary__edvuaz + 1 | 0; + var putIndex = _unary__edvuaz; + $this.d4_1[putIndex] = key; + $this.f4_1[putIndex] = hash_0; + $this.g4_1[hash_0] = putIndex + 1 | 0; + $this.l4_1 = $this.l4_1 + 1 | 0; + registerModification($this); + if (probeDistance > $this.h4_1) + $this.h4_1 = probeDistance; + return putIndex; + } + if (equals($this.d4_1[index - 1 | 0], key)) { + return -index | 0; + } + probeDistance = probeDistance + 1 | 0; + if (probeDistance > tentativeMaxProbeDistance) { + rehash($this, imul(_get_hashSize__tftcho($this), 2)); + continue retry; + } + var _unary__edvuaz_0 = hash_0; + hash_0 = _unary__edvuaz_0 - 1 | 0; + if (_unary__edvuaz_0 === 0) + hash_0 = _get_hashSize__tftcho($this) - 1 | 0; + } + } + } + function contentEquals($this, other) { + return $this.l4_1 === other.i() && $this.x3(other.y()); + } + function Companion_3() { + this.s4_1 = -1640531527; + this.t4_1 = 8; + this.u4_1 = 2; + this.v4_1 = -1; + } + var Companion_instance_3; + function Companion_getInstance_3() { + return Companion_instance_3; + } + function Itr(map) { + this.w4_1 = map; + this.x4_1 = 0; + this.y4_1 = -1; + this.z4_1 = this.w4_1.k4_1; + this.a5(); + } + protoOf(Itr).a5 = function () { + while (this.x4_1 < this.w4_1.i4_1 && this.w4_1.f4_1[this.x4_1] < 0) { + this.x4_1 = this.x4_1 + 1 | 0; + } + }; + protoOf(Itr).g = function () { + return this.x4_1 < this.w4_1.i4_1; + }; + protoOf(Itr).b5 = function () { + if (!(this.w4_1.k4_1 === this.z4_1)) + throw ConcurrentModificationException_init_$Create$(); + }; + function KeysItr(map) { + Itr.call(this, map); + } + protoOf(KeysItr).h = function () { + this.b5(); + if (this.x4_1 >= this.w4_1.i4_1) + throw NoSuchElementException_init_$Create$(); + var tmp = this; + var _unary__edvuaz = this.x4_1; + this.x4_1 = _unary__edvuaz + 1 | 0; + tmp.y4_1 = _unary__edvuaz; + var result = this.w4_1.d4_1[this.y4_1]; + this.a5(); + return result; + }; + function ValuesItr(map) { + Itr.call(this, map); + } + protoOf(ValuesItr).h = function () { + this.b5(); + if (this.x4_1 >= this.w4_1.i4_1) + throw NoSuchElementException_init_$Create$(); + var tmp = this; + var _unary__edvuaz = this.x4_1; + this.x4_1 = _unary__edvuaz + 1 | 0; + tmp.y4_1 = _unary__edvuaz; + var result = ensureNotNull(this.w4_1.e4_1)[this.y4_1]; + this.a5(); + return result; + }; + function EntriesItr(map) { + Itr.call(this, map); + } + protoOf(EntriesItr).h = function () { + this.b5(); + if (this.x4_1 >= this.w4_1.i4_1) + throw NoSuchElementException_init_$Create$(); + var tmp = this; + var _unary__edvuaz = this.x4_1; + this.x4_1 = _unary__edvuaz + 1 | 0; + tmp.y4_1 = _unary__edvuaz; + var result = new EntryRef(this.w4_1, this.y4_1); + this.a5(); + return result; + }; + protoOf(EntriesItr).o5 = function () { + if (this.x4_1 >= this.w4_1.i4_1) + throw NoSuchElementException_init_$Create$(); + var tmp = this; + var _unary__edvuaz = this.x4_1; + this.x4_1 = _unary__edvuaz + 1 | 0; + tmp.y4_1 = _unary__edvuaz; + // Inline function 'kotlin.hashCode' call + var tmp0_safe_receiver = this.w4_1.d4_1[this.y4_1]; + var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver); + var tmp_0 = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs; + // Inline function 'kotlin.hashCode' call + var tmp0_safe_receiver_0 = ensureNotNull(this.w4_1.e4_1)[this.y4_1]; + var tmp1_elvis_lhs_0 = tmp0_safe_receiver_0 == null ? null : hashCode(tmp0_safe_receiver_0); + var result = tmp_0 ^ (tmp1_elvis_lhs_0 == null ? 0 : tmp1_elvis_lhs_0); + this.a5(); + return result; + }; + protoOf(EntriesItr).p5 = function (sb) { + if (this.x4_1 >= this.w4_1.i4_1) + throw NoSuchElementException_init_$Create$(); + var tmp = this; + var _unary__edvuaz = this.x4_1; + this.x4_1 = _unary__edvuaz + 1 | 0; + tmp.y4_1 = _unary__edvuaz; + var key = this.w4_1.d4_1[this.y4_1]; + if (equals(key, this.w4_1)) + sb.s5('(this Map)'); + else + sb.r5(key); + sb.t5(_Char___init__impl__6a9atx(61)); + var value = ensureNotNull(this.w4_1.e4_1)[this.y4_1]; + if (equals(value, this.w4_1)) + sb.s5('(this Map)'); + else + sb.r5(value); + this.a5(); + }; + function EntryRef(map, index) { + this.n4_1 = map; + this.o4_1 = index; + this.p4_1 = this.n4_1.k4_1; + } + protoOf(EntryRef).r = function () { + checkForComodification(this); + return this.n4_1.d4_1[this.o4_1]; + }; + protoOf(EntryRef).s = function () { + checkForComodification(this); + return ensureNotNull(this.n4_1.e4_1)[this.o4_1]; + }; + protoOf(EntryRef).equals = function (other) { + var tmp; + var tmp_0; + if (!(other == null) ? isInterface(other, Entry) : false) { + tmp_0 = equals(other.r(), this.r()); + } else { + tmp_0 = false; + } + if (tmp_0) { + tmp = equals(other.s(), this.s()); + } else { + tmp = false; + } + return tmp; + }; + protoOf(EntryRef).hashCode = function () { + // Inline function 'kotlin.hashCode' call + var tmp0_safe_receiver = this.r(); + var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver); + var tmp = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs; + // Inline function 'kotlin.hashCode' call + var tmp0_safe_receiver_0 = this.s(); + var tmp1_elvis_lhs_0 = tmp0_safe_receiver_0 == null ? null : hashCode(tmp0_safe_receiver_0); + return tmp ^ (tmp1_elvis_lhs_0 == null ? 0 : tmp1_elvis_lhs_0); + }; + protoOf(EntryRef).toString = function () { + return toString_0(this.r()) + '=' + toString_0(this.s()); + }; + function InternalHashMap(keysArray, valuesArray, presenceArray, hashArray, maxProbeDistance, length) { + this.d4_1 = keysArray; + this.e4_1 = valuesArray; + this.f4_1 = presenceArray; + this.g4_1 = hashArray; + this.h4_1 = maxProbeDistance; + this.i4_1 = length; + this.j4_1 = computeShift(Companion_instance_3, _get_hashSize__tftcho(this)); + this.k4_1 = 0; + this.l4_1 = 0; + this.m4_1 = false; + } + protoOf(InternalHashMap).i = function () { + return this.l4_1; + }; + protoOf(InternalHashMap).u5 = function () { + this.r4(); + this.m4_1 = true; + }; + protoOf(InternalHashMap).u = function (value) { + return findValue(this, value) >= 0; + }; + protoOf(InternalHashMap).v = function (key) { + var index = findKey(this, key); + if (index < 0) + return null; + return ensureNotNull(this.e4_1)[index]; + }; + protoOf(InternalHashMap).k3 = function (key) { + return findKey(this, key) >= 0; + }; + protoOf(InternalHashMap).y1 = function (key, value) { + var index = addKey(this, key); + var valuesArray = allocateValuesArray(this); + if (index < 0) { + var oldValue = valuesArray[(-index | 0) - 1 | 0]; + valuesArray[(-index | 0) - 1 | 0] = value; + return oldValue; + } else { + valuesArray[index] = value; + return null; + } + }; + protoOf(InternalHashMap).equals = function (other) { + var tmp; + if (other === this) { + tmp = true; + } else { + var tmp_0; + if (!(other == null) ? isInterface(other, KtMap) : false) { + tmp_0 = contentEquals(this, other); + } else { + tmp_0 = false; + } + tmp = tmp_0; + } + return tmp; + }; + protoOf(InternalHashMap).hashCode = function () { + var result = 0; + var it = this.t3(); + while (it.g()) { + result = result + it.o5() | 0; + } + return result; + }; + protoOf(InternalHashMap).toString = function () { + var sb = StringBuilder_init_$Create$(2 + imul(this.l4_1, 3) | 0); + sb.s5('{'); + var i = 0; + var it = this.t3(); + while (it.g()) { + if (i > 0) { + sb.s5(', '); + } + it.p5(sb); + i = i + 1 | 0; + } + sb.s5('}'); + return sb.toString(); + }; + protoOf(InternalHashMap).r4 = function () { + if (this.m4_1) + throw UnsupportedOperationException_init_$Create$(); + }; + protoOf(InternalHashMap).w3 = function (entry) { + var index = findKey(this, entry.r()); + if (index < 0) + return false; + return equals(ensureNotNull(this.e4_1)[index], entry.s()); + }; + protoOf(InternalHashMap).v5 = function (entry) { + return this.w3(isInterface(entry, Entry) ? entry : THROW_CCE()); + }; + protoOf(InternalHashMap).m3 = function () { + return new KeysItr(this); + }; + protoOf(InternalHashMap).q3 = function () { + return new ValuesItr(this); + }; + protoOf(InternalHashMap).t3 = function () { + return new EntriesItr(this); + }; + function InternalMap() { + } + function LinkedHashMap_init_$Init$($this) { + HashMap_init_$Init$_0($this); + LinkedHashMap.call($this); + return $this; + } + function LinkedHashMap_init_$Create$() { + return LinkedHashMap_init_$Init$(objectCreate(protoOf(LinkedHashMap))); + } + function LinkedHashMap_init_$Init$_0(internalMap, $this) { + HashMap_init_$Init$(internalMap, $this); + LinkedHashMap.call($this); + return $this; + } + function LinkedHashMap_init_$Create$_0(internalMap) { + return LinkedHashMap_init_$Init$_0(internalMap, objectCreate(protoOf(LinkedHashMap))); + } + function EmptyHolder() { + EmptyHolder_instance = this; + var tmp = this; + // Inline function 'kotlin.also' call + var this_0 = InternalHashMap_init_$Create$_0(0); + this_0.u5(); + tmp.w5_1 = LinkedHashMap_init_$Create$_0(this_0); + } + var EmptyHolder_instance; + function EmptyHolder_getInstance() { + if (EmptyHolder_instance == null) + new EmptyHolder(); + return EmptyHolder_instance; + } + protoOf(LinkedHashMap).x1 = function () { + this.i3_1.u5(); + var tmp; + if (this.i() > 0) { + tmp = this; + } else { + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + tmp = EmptyHolder_getInstance().w5_1; + } + return tmp; + }; + function LinkedHashMap() { + } + function get_output() { + _init_properties_console_kt__rfg7jv(); + return output; + } + var output; + function BaseOutput() { + } + protoOf(BaseOutput).x5 = function () { + this.y5('\n'); + }; + protoOf(BaseOutput).z5 = function (message) { + this.y5(message); + this.x5(); + }; + function NodeJsOutput(outputStream) { + BaseOutput.call(this); + this.a6_1 = outputStream; + } + protoOf(NodeJsOutput).y5 = function (message) { + // Inline function 'kotlin.io.String' call + var tmp1_elvis_lhs = message == null ? null : toString_1(message); + var messageString = tmp1_elvis_lhs == null ? 'null' : tmp1_elvis_lhs; + this.a6_1.write(messageString); + }; + function BufferedOutputToConsoleLog() { + BufferedOutput.call(this); + } + protoOf(BufferedOutputToConsoleLog).y5 = function (message) { + // Inline function 'kotlin.io.String' call + var tmp1_elvis_lhs = message == null ? null : toString_1(message); + var s = tmp1_elvis_lhs == null ? 'null' : tmp1_elvis_lhs; + // Inline function 'kotlin.text.nativeLastIndexOf' call + // Inline function 'kotlin.js.asDynamic' call + var i = s.lastIndexOf('\n', 0); + if (i >= 0) { + this.c6_1 = this.c6_1 + substring(s, 0, i); + this.d6(); + s = substring_0(s, i + 1 | 0); + } + this.c6_1 = this.c6_1 + s; + }; + protoOf(BufferedOutputToConsoleLog).d6 = function () { + console.log(this.c6_1); + this.c6_1 = ''; + }; + function BufferedOutput() { + BaseOutput.call(this); + this.c6_1 = ''; + } + protoOf(BufferedOutput).y5 = function (message) { + var tmp = this; + var tmp_0 = this.c6_1; + // Inline function 'kotlin.io.String' call + var tmp1_elvis_lhs = message == null ? null : toString_1(message); + tmp.c6_1 = tmp_0 + (tmp1_elvis_lhs == null ? 'null' : tmp1_elvis_lhs); + }; + function println(message) { + _init_properties_console_kt__rfg7jv(); + get_output().z5(message); + } + var properties_initialized_console_kt_gll9dl; + function _init_properties_console_kt__rfg7jv() { + if (!properties_initialized_console_kt_gll9dl) { + properties_initialized_console_kt_gll9dl = true; + // Inline function 'kotlin.run' call + var isNode = typeof process !== 'undefined' && process.versions && !!process.versions.node; + output = isNode ? new NodeJsOutput(process.stdout) : new BufferedOutputToConsoleLog(); + } + } + function Exception_init_$Init$($this) { + extendThrowable($this); + Exception.call($this); + return $this; + } + function Exception_init_$Create$() { + var tmp = Exception_init_$Init$(objectCreate(protoOf(Exception))); + captureStack(tmp, Exception_init_$Create$); + return tmp; + } + function Exception_init_$Init$_0(message, $this) { + extendThrowable($this, message); + Exception.call($this); + return $this; + } + function Exception_init_$Create$_0(message) { + var tmp = Exception_init_$Init$_0(message, objectCreate(protoOf(Exception))); + captureStack(tmp, Exception_init_$Create$_0); + return tmp; + } + function Exception() { + captureStack(this, Exception); + } + function IllegalArgumentException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + IllegalArgumentException.call($this); + return $this; + } + function IllegalArgumentException_init_$Create$() { + var tmp = IllegalArgumentException_init_$Init$(objectCreate(protoOf(IllegalArgumentException))); + captureStack(tmp, IllegalArgumentException_init_$Create$); + return tmp; + } + function IllegalArgumentException_init_$Init$_0(message, $this) { + RuntimeException_init_$Init$_0(message, $this); + IllegalArgumentException.call($this); + return $this; + } + function IllegalArgumentException_init_$Create$_0(message) { + var tmp = IllegalArgumentException_init_$Init$_0(message, objectCreate(protoOf(IllegalArgumentException))); + captureStack(tmp, IllegalArgumentException_init_$Create$_0); + return tmp; + } + function IllegalArgumentException() { + captureStack(this, IllegalArgumentException); + } + function IllegalStateException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + IllegalStateException.call($this); + return $this; + } + function IllegalStateException_init_$Create$() { + var tmp = IllegalStateException_init_$Init$(objectCreate(protoOf(IllegalStateException))); + captureStack(tmp, IllegalStateException_init_$Create$); + return tmp; + } + function IllegalStateException_init_$Init$_0(message, $this) { + RuntimeException_init_$Init$_0(message, $this); + IllegalStateException.call($this); + return $this; + } + function IllegalStateException_init_$Create$_0(message) { + var tmp = IllegalStateException_init_$Init$_0(message, objectCreate(protoOf(IllegalStateException))); + captureStack(tmp, IllegalStateException_init_$Create$_0); + return tmp; + } + function IllegalStateException() { + captureStack(this, IllegalStateException); + } + function UnsupportedOperationException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + UnsupportedOperationException.call($this); + return $this; + } + function UnsupportedOperationException_init_$Create$() { + var tmp = UnsupportedOperationException_init_$Init$(objectCreate(protoOf(UnsupportedOperationException))); + captureStack(tmp, UnsupportedOperationException_init_$Create$); + return tmp; + } + function UnsupportedOperationException_init_$Init$_0(message, $this) { + RuntimeException_init_$Init$_0(message, $this); + UnsupportedOperationException.call($this); + return $this; + } + function UnsupportedOperationException_init_$Create$_0(message) { + var tmp = UnsupportedOperationException_init_$Init$_0(message, objectCreate(protoOf(UnsupportedOperationException))); + captureStack(tmp, UnsupportedOperationException_init_$Create$_0); + return tmp; + } + function UnsupportedOperationException() { + captureStack(this, UnsupportedOperationException); + } + function RuntimeException_init_$Init$($this) { + Exception_init_$Init$($this); + RuntimeException.call($this); + return $this; + } + function RuntimeException_init_$Create$() { + var tmp = RuntimeException_init_$Init$(objectCreate(protoOf(RuntimeException))); + captureStack(tmp, RuntimeException_init_$Create$); + return tmp; + } + function RuntimeException_init_$Init$_0(message, $this) { + Exception_init_$Init$_0(message, $this); + RuntimeException.call($this); + return $this; + } + function RuntimeException_init_$Create$_0(message) { + var tmp = RuntimeException_init_$Init$_0(message, objectCreate(protoOf(RuntimeException))); + captureStack(tmp, RuntimeException_init_$Create$_0); + return tmp; + } + function RuntimeException() { + captureStack(this, RuntimeException); + } + function NoSuchElementException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + NoSuchElementException.call($this); + return $this; + } + function NoSuchElementException_init_$Create$() { + var tmp = NoSuchElementException_init_$Init$(objectCreate(protoOf(NoSuchElementException))); + captureStack(tmp, NoSuchElementException_init_$Create$); + return tmp; + } + function NoSuchElementException_init_$Init$_0(message, $this) { + RuntimeException_init_$Init$_0(message, $this); + NoSuchElementException.call($this); + return $this; + } + function NoSuchElementException_init_$Create$_0(message) { + var tmp = NoSuchElementException_init_$Init$_0(message, objectCreate(protoOf(NoSuchElementException))); + captureStack(tmp, NoSuchElementException_init_$Create$_0); + return tmp; + } + function NoSuchElementException() { + captureStack(this, NoSuchElementException); + } + function IndexOutOfBoundsException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + IndexOutOfBoundsException.call($this); + return $this; + } + function IndexOutOfBoundsException_init_$Create$() { + var tmp = IndexOutOfBoundsException_init_$Init$(objectCreate(protoOf(IndexOutOfBoundsException))); + captureStack(tmp, IndexOutOfBoundsException_init_$Create$); + return tmp; + } + function IndexOutOfBoundsException_init_$Init$_0(message, $this) { + RuntimeException_init_$Init$_0(message, $this); + IndexOutOfBoundsException.call($this); + return $this; + } + function IndexOutOfBoundsException_init_$Create$_0(message) { + var tmp = IndexOutOfBoundsException_init_$Init$_0(message, objectCreate(protoOf(IndexOutOfBoundsException))); + captureStack(tmp, IndexOutOfBoundsException_init_$Create$_0); + return tmp; + } + function IndexOutOfBoundsException() { + captureStack(this, IndexOutOfBoundsException); + } + function ConcurrentModificationException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + ConcurrentModificationException.call($this); + return $this; + } + function ConcurrentModificationException_init_$Create$() { + var tmp = ConcurrentModificationException_init_$Init$(objectCreate(protoOf(ConcurrentModificationException))); + captureStack(tmp, ConcurrentModificationException_init_$Create$); + return tmp; + } + function ConcurrentModificationException_init_$Init$_0(message, $this) { + RuntimeException_init_$Init$_0(message, $this); + ConcurrentModificationException.call($this); + return $this; + } + function ConcurrentModificationException_init_$Create$_0(message) { + var tmp = ConcurrentModificationException_init_$Init$_0(message, objectCreate(protoOf(ConcurrentModificationException))); + captureStack(tmp, ConcurrentModificationException_init_$Create$_0); + return tmp; + } + function ConcurrentModificationException() { + captureStack(this, ConcurrentModificationException); + } + function NullPointerException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + NullPointerException.call($this); + return $this; + } + function NullPointerException_init_$Create$() { + var tmp = NullPointerException_init_$Init$(objectCreate(protoOf(NullPointerException))); + captureStack(tmp, NullPointerException_init_$Create$); + return tmp; + } + function NullPointerException() { + captureStack(this, NullPointerException); + } + function ClassCastException_init_$Init$($this) { + RuntimeException_init_$Init$($this); + ClassCastException.call($this); + return $this; + } + function ClassCastException_init_$Create$() { + var tmp = ClassCastException_init_$Init$(objectCreate(protoOf(ClassCastException))); + captureStack(tmp, ClassCastException_init_$Create$); + return tmp; + } + function ClassCastException() { + captureStack(this, ClassCastException); + } + function fillFrom(src, dst) { + var srcLen = src.length; + var dstLen = dst.length; + var index = 0; + // Inline function 'kotlin.js.unsafeCast' call + var arr = dst; + while (index < srcLen && index < dstLen) { + var tmp = index; + var _unary__edvuaz = index; + index = _unary__edvuaz + 1 | 0; + arr[tmp] = src[_unary__edvuaz]; + } + return dst; + } + function arrayCopyResize(source, newSize, defaultValue) { + // Inline function 'kotlin.js.unsafeCast' call + var result = source.slice(0, newSize); + // Inline function 'kotlin.copyArrayType' call + if (source.$type$ !== undefined) { + result.$type$ = source.$type$; + } + var index = source.length; + if (newSize > index) { + // Inline function 'kotlin.js.asDynamic' call + result.length = newSize; + while (index < newSize) { + var _unary__edvuaz = index; + index = _unary__edvuaz + 1 | 0; + result[_unary__edvuaz] = defaultValue; + } + } + return result; + } + function CharacterCodingException_init_$Init$($this) { + CharacterCodingException.call($this, null); + return $this; + } + function CharacterCodingException_init_$Create$() { + var tmp = CharacterCodingException_init_$Init$(objectCreate(protoOf(CharacterCodingException))); + captureStack(tmp, CharacterCodingException_init_$Create$); + return tmp; + } + function CharacterCodingException(message) { + Exception_init_$Init$_0(message, this); + captureStack(this, CharacterCodingException); + } + function StringBuilder_init_$Init$(capacity, $this) { + StringBuilder_init_$Init$_0($this); + return $this; + } + function StringBuilder_init_$Create$(capacity) { + return StringBuilder_init_$Init$(capacity, objectCreate(protoOf(StringBuilder))); + } + function StringBuilder_init_$Init$_0($this) { + StringBuilder.call($this, ''); + return $this; + } + function StringBuilder_init_$Create$_0() { + return StringBuilder_init_$Init$_0(objectCreate(protoOf(StringBuilder))); + } + function StringBuilder(content) { + this.q5_1 = content; + } + protoOf(StringBuilder).a = function () { + // Inline function 'kotlin.js.asDynamic' call + return this.q5_1.length; + }; + protoOf(StringBuilder).b = function (index) { + // Inline function 'kotlin.text.getOrElse' call + var this_0 = this.q5_1; + var tmp; + if (0 <= index ? index <= (charSequenceLength(this_0) - 1 | 0) : false) { + tmp = charSequenceGet(this_0, index); + } else { + throw IndexOutOfBoundsException_init_$Create$_0('index: ' + index + ', length: ' + this.a() + '}'); + } + return tmp; + }; + protoOf(StringBuilder).c = function (startIndex, endIndex) { + return substring(this.q5_1, startIndex, endIndex); + }; + protoOf(StringBuilder).t5 = function (value) { + this.q5_1 = this.q5_1 + toString(value); + return this; + }; + protoOf(StringBuilder).e = function (value) { + this.q5_1 = this.q5_1 + toString_0(value); + return this; + }; + protoOf(StringBuilder).r5 = function (value) { + this.q5_1 = this.q5_1 + toString_0(value); + return this; + }; + protoOf(StringBuilder).s5 = function (value) { + var tmp = this; + var tmp_0 = this.q5_1; + tmp.q5_1 = tmp_0 + (value == null ? 'null' : value); + return this; + }; + protoOf(StringBuilder).toString = function () { + return this.q5_1; + }; + function uppercaseChar(_this__u8e3s4) { + // Inline function 'kotlin.text.uppercase' call + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + var uppercase = toString(_this__u8e3s4).toUpperCase(); + return uppercase.length > 1 ? _this__u8e3s4 : charCodeAt(uppercase, 0); + } + function checkRadix(radix) { + if (!(2 <= radix ? radix <= 36 : false)) { + throw IllegalArgumentException_init_$Create$_0('radix ' + radix + ' was not in valid range 2..36'); + } + return radix; + } + function toString_2(_this__u8e3s4, radix) { + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.toString(checkRadix(radix)); + } + function Companion_4() { + Companion_instance_4 = this; + this.g6_1 = new RegExp('[\\\\^$*+?.()|[\\]{}]', 'g'); + this.h6_1 = new RegExp('[\\\\$]', 'g'); + this.i6_1 = new RegExp('\\$', 'g'); + } + protoOf(Companion_4).j6 = function (literal) { + // Inline function 'kotlin.text.nativeReplace' call + var pattern = this.g6_1; + // Inline function 'kotlin.js.asDynamic' call + return literal.replace(pattern, '\\$&'); + }; + protoOf(Companion_4).k6 = function (literal) { + // Inline function 'kotlin.text.nativeReplace' call + var pattern = this.i6_1; + // Inline function 'kotlin.js.asDynamic' call + return literal.replace(pattern, '$$$$'); + }; + var Companion_instance_4; + function Companion_getInstance_4() { + if (Companion_instance_4 == null) + new Companion_4(); + return Companion_instance_4; + } + var STRING_CASE_INSENSITIVE_ORDER; + function substring(_this__u8e3s4, startIndex, endIndex) { + _init_properties_stringJs_kt__bg7zye(); + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.substring(startIndex, endIndex); + } + function substring_0(_this__u8e3s4, startIndex) { + _init_properties_stringJs_kt__bg7zye(); + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.substring(startIndex); + } + function compareTo_0(_this__u8e3s4, other, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + _init_properties_stringJs_kt__bg7zye(); + if (ignoreCase) { + var n1 = _this__u8e3s4.length; + var n2 = other.length; + // Inline function 'kotlin.comparisons.minOf' call + var min = Math.min(n1, n2); + if (min === 0) + return n1 - n2 | 0; + var inductionVariable = 0; + if (inductionVariable < min) + do { + var index = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + var thisChar = charCodeAt(_this__u8e3s4, index); + var otherChar = charCodeAt(other, index); + if (!(thisChar === otherChar)) { + thisChar = uppercaseChar(thisChar); + otherChar = uppercaseChar(otherChar); + if (!(thisChar === otherChar)) { + // Inline function 'kotlin.text.lowercaseChar' call + // Inline function 'kotlin.text.lowercase' call + var this_0 = thisChar; + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + var tmp$ret$3 = toString(this_0).toLowerCase(); + thisChar = charCodeAt(tmp$ret$3, 0); + // Inline function 'kotlin.text.lowercaseChar' call + // Inline function 'kotlin.text.lowercase' call + var this_1 = otherChar; + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + var tmp$ret$7 = toString(this_1).toLowerCase(); + otherChar = charCodeAt(tmp$ret$7, 0); + if (!(thisChar === otherChar)) { + return Char__compareTo_impl_ypi4mb(thisChar, otherChar); + } + } + } + } + while (inductionVariable < min); + return n1 - n2 | 0; + } else { + return compareTo(_this__u8e3s4, other); + } + } + function decodeToString(_this__u8e3s4) { + _init_properties_stringJs_kt__bg7zye(); + return decodeUtf8(_this__u8e3s4, 0, _this__u8e3s4.length, false); + } + function sam$kotlin_Comparator$0(function_0) { + this.l6_1 = function_0; + } + protoOf(sam$kotlin_Comparator$0).m6 = function (a, b) { + return this.l6_1(a, b); + }; + protoOf(sam$kotlin_Comparator$0).compare = function (a, b) { + return this.m6(a, b); + }; + protoOf(sam$kotlin_Comparator$0).q1 = function () { + return this.l6_1; + }; + protoOf(sam$kotlin_Comparator$0).equals = function (other) { + var tmp; + if (!(other == null) ? isInterface(other, Comparator) : false) { + var tmp_0; + if (!(other == null) ? isInterface(other, FunctionAdapter) : false) { + tmp_0 = equals(this.q1(), other.q1()); + } else { + tmp_0 = false; + } + tmp = tmp_0; + } else { + tmp = false; + } + return tmp; + }; + protoOf(sam$kotlin_Comparator$0).hashCode = function () { + return hashCode(this.q1()); + }; + function STRING_CASE_INSENSITIVE_ORDER$lambda(a, b) { + _init_properties_stringJs_kt__bg7zye(); + return compareTo_0(a, b, true); + } + var properties_initialized_stringJs_kt_nta8o4; + function _init_properties_stringJs_kt__bg7zye() { + if (!properties_initialized_stringJs_kt_nta8o4) { + properties_initialized_stringJs_kt_nta8o4 = true; + var tmp = STRING_CASE_INSENSITIVE_ORDER$lambda; + STRING_CASE_INSENSITIVE_ORDER = new sam$kotlin_Comparator$0(tmp); + } + } + function replace(_this__u8e3s4, oldValue, newValue, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + var tmp2 = new RegExp(Companion_getInstance_4().j6(oldValue), ignoreCase ? 'gui' : 'gu'); + // Inline function 'kotlin.text.nativeReplace' call + var replacement = Companion_getInstance_4().k6(newValue); + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.replace(tmp2, replacement); + } + function startsWith(_this__u8e3s4, prefix, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + if (!ignoreCase) { + // Inline function 'kotlin.text.nativeStartsWith' call + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.startsWith(prefix, 0); + } else + return regionMatches(_this__u8e3s4, 0, prefix, 0, prefix.length, ignoreCase); + } + function endsWith(_this__u8e3s4, suffix, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + if (!ignoreCase) { + // Inline function 'kotlin.text.nativeEndsWith' call + // Inline function 'kotlin.js.asDynamic' call + return _this__u8e3s4.endsWith(suffix); + } else + return regionMatches(_this__u8e3s4, _this__u8e3s4.length - suffix.length | 0, suffix, 0, suffix.length, ignoreCase); + } + function capitalize(_this__u8e3s4) { + var tmp; + // Inline function 'kotlin.text.isNotEmpty' call + if (charSequenceLength(_this__u8e3s4) > 0) { + // Inline function 'kotlin.text.uppercase' call + // Inline function 'kotlin.js.asDynamic' call + tmp = substring(_this__u8e3s4, 0, 1).toUpperCase() + substring_0(_this__u8e3s4, 1); + } else { + tmp = _this__u8e3s4; + } + return tmp; + } + function regionMatches(_this__u8e3s4, thisOffset, other, otherOffset, length, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + return regionMatchesImpl(_this__u8e3s4, thisOffset, other, otherOffset, length, ignoreCase); + } + var REPLACEMENT_BYTE_SEQUENCE; + function decodeUtf8(bytes, startIndex, endIndex, throwOnMalformed) { + _init_properties_utf8Encoding_kt__9thjs4(); + // Inline function 'kotlin.require' call + // Inline function 'kotlin.require' call + if (!(startIndex >= 0 && endIndex <= bytes.length && startIndex <= endIndex)) { + var message = 'Failed requirement.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + var byteIndex = startIndex; + var stringBuilder = StringBuilder_init_$Create$_0(); + while (byteIndex < endIndex) { + var _unary__edvuaz = byteIndex; + byteIndex = _unary__edvuaz + 1 | 0; + var byte = bytes[_unary__edvuaz]; + if (byte >= 0) + stringBuilder.t5(numberToChar(byte)); + else if (byte >> 5 === -2) { + var code = codePointFrom2(bytes, byte, byteIndex, endIndex, throwOnMalformed); + if (code <= 0) { + stringBuilder.t5(_Char___init__impl__6a9atx(65533)); + byteIndex = byteIndex + (-code | 0) | 0; + } else { + stringBuilder.t5(numberToChar(code)); + byteIndex = byteIndex + 1 | 0; + } + } else if (byte >> 4 === -2) { + var code_0 = codePointFrom3(bytes, byte, byteIndex, endIndex, throwOnMalformed); + if (code_0 <= 0) { + stringBuilder.t5(_Char___init__impl__6a9atx(65533)); + byteIndex = byteIndex + (-code_0 | 0) | 0; + } else { + stringBuilder.t5(numberToChar(code_0)); + byteIndex = byteIndex + 2 | 0; + } + } else if (byte >> 3 === -2) { + var code_1 = codePointFrom4(bytes, byte, byteIndex, endIndex, throwOnMalformed); + if (code_1 <= 0) { + stringBuilder.t5(_Char___init__impl__6a9atx(65533)); + byteIndex = byteIndex + (-code_1 | 0) | 0; + } else { + var high = (code_1 - 65536 | 0) >> 10 | 55296; + var low = code_1 & 1023 | 56320; + stringBuilder.t5(numberToChar(high)); + stringBuilder.t5(numberToChar(low)); + byteIndex = byteIndex + 3 | 0; + } + } else { + malformed(0, byteIndex, throwOnMalformed); + stringBuilder.t5(_Char___init__impl__6a9atx(65533)); + } + } + return stringBuilder.toString(); + } + function codePointFrom2(bytes, byte1, index, endIndex, throwOnMalformed) { + _init_properties_utf8Encoding_kt__9thjs4(); + if ((byte1 & 30) === 0 || index >= endIndex) { + return malformed(0, index, throwOnMalformed); + } + var byte2 = bytes[index]; + if (!((byte2 & 192) === 128)) { + return malformed(0, index, throwOnMalformed); + } + return byte1 << 6 ^ byte2 ^ 3968; + } + function codePointFrom3(bytes, byte1, index, endIndex, throwOnMalformed) { + _init_properties_utf8Encoding_kt__9thjs4(); + if (index >= endIndex) { + return malformed(0, index, throwOnMalformed); + } + var byte2 = bytes[index]; + if ((byte1 & 15) === 0) { + if (!((byte2 & 224) === 160)) { + return malformed(0, index, throwOnMalformed); + } + } else if ((byte1 & 15) === 13) { + if (!((byte2 & 224) === 128)) { + return malformed(0, index, throwOnMalformed); + } + } else if (!((byte2 & 192) === 128)) { + return malformed(0, index, throwOnMalformed); + } + if ((index + 1 | 0) === endIndex) { + return malformed(1, index, throwOnMalformed); + } + var byte3 = bytes[index + 1 | 0]; + if (!((byte3 & 192) === 128)) { + return malformed(1, index, throwOnMalformed); + } + return byte1 << 12 ^ byte2 << 6 ^ byte3 ^ -123008; + } + function codePointFrom4(bytes, byte1, index, endIndex, throwOnMalformed) { + _init_properties_utf8Encoding_kt__9thjs4(); + if (index >= endIndex) { + return malformed(0, index, throwOnMalformed); + } + var byte2 = bytes[index]; + if ((byte1 & 15) === 0) { + if ((byte2 & 240) <= 128) { + return malformed(0, index, throwOnMalformed); + } + } else if ((byte1 & 15) === 4) { + if (!((byte2 & 240) === 128)) { + return malformed(0, index, throwOnMalformed); + } + } else if ((byte1 & 15) > 4) { + return malformed(0, index, throwOnMalformed); + } + if (!((byte2 & 192) === 128)) { + return malformed(0, index, throwOnMalformed); + } + if ((index + 1 | 0) === endIndex) { + return malformed(1, index, throwOnMalformed); + } + var byte3 = bytes[index + 1 | 0]; + if (!((byte3 & 192) === 128)) { + return malformed(1, index, throwOnMalformed); + } + if ((index + 2 | 0) === endIndex) { + return malformed(2, index, throwOnMalformed); + } + var byte4 = bytes[index + 2 | 0]; + if (!((byte4 & 192) === 128)) { + return malformed(2, index, throwOnMalformed); + } + return byte1 << 18 ^ byte2 << 12 ^ byte3 << 6 ^ byte4 ^ 3678080; + } + function malformed(size, index, throwOnMalformed) { + _init_properties_utf8Encoding_kt__9thjs4(); + if (throwOnMalformed) + throw new CharacterCodingException('Malformed sequence starting at ' + (index - 1 | 0)); + return -size | 0; + } + var properties_initialized_utf8Encoding_kt_eee1vq; + function _init_properties_utf8Encoding_kt__9thjs4() { + if (!properties_initialized_utf8Encoding_kt_eee1vq) { + properties_initialized_utf8Encoding_kt_eee1vq = true; + // Inline function 'kotlin.byteArrayOf' call + REPLACEMENT_BYTE_SEQUENCE = new Int8Array([-17, -65, -67]); + } + } + function AbstractCollection$toString$lambda(this$0) { + return function (it) { + return it === this$0 ? '(this Collection)' : toString_0(it); + }; + } + function AbstractCollection() { + } + protoOf(AbstractCollection).p = function (element) { + var tmp$ret$0; + $l$block_0: { + // Inline function 'kotlin.collections.any' call + var tmp; + if (isInterface(this, Collection)) { + tmp = this.j(); + } else { + tmp = false; + } + if (tmp) { + tmp$ret$0 = false; + break $l$block_0; + } + var _iterator__ex2g4s = this.f(); + while (_iterator__ex2g4s.g()) { + var element_0 = _iterator__ex2g4s.h(); + if (equals(element_0, element)) { + tmp$ret$0 = true; + break $l$block_0; + } + } + tmp$ret$0 = false; + } + return tmp$ret$0; + }; + protoOf(AbstractCollection).q = function (elements) { + var tmp$ret$0; + $l$block_0: { + // Inline function 'kotlin.collections.all' call + var tmp; + if (isInterface(elements, Collection)) { + tmp = elements.j(); + } else { + tmp = false; + } + if (tmp) { + tmp$ret$0 = true; + break $l$block_0; + } + var _iterator__ex2g4s = elements.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + if (!this.p(element)) { + tmp$ret$0 = false; + break $l$block_0; + } + } + tmp$ret$0 = true; + } + return tmp$ret$0; + }; + protoOf(AbstractCollection).j = function () { + return this.i() === 0; + }; + protoOf(AbstractCollection).toString = function () { + return joinToString_0(this, ', ', '[', ']', VOID, VOID, AbstractCollection$toString$lambda(this)); + }; + protoOf(AbstractCollection).toArray = function () { + return collectionToArray(this); + }; + function Companion_5() { + this.z1_1 = 2147483639; + } + protoOf(Companion_5).b3 = function (index, size) { + if (index < 0 || index >= size) { + throw IndexOutOfBoundsException_init_$Create$_0('index: ' + index + ', size: ' + size); + } + }; + protoOf(Companion_5).c3 = function (index, size) { + if (index < 0 || index > size) { + throw IndexOutOfBoundsException_init_$Create$_0('index: ' + index + ', size: ' + size); + } + }; + protoOf(Companion_5).a2 = function (fromIndex, toIndex, size) { + if (fromIndex < 0 || toIndex > size) { + throw IndexOutOfBoundsException_init_$Create$_0('fromIndex: ' + fromIndex + ', toIndex: ' + toIndex + ', size: ' + size); + } + if (fromIndex > toIndex) { + throw IllegalArgumentException_init_$Create$_0('fromIndex: ' + fromIndex + ' > toIndex: ' + toIndex); + } + }; + protoOf(Companion_5).n6 = function (startIndex, endIndex, size) { + if (startIndex < 0 || endIndex > size) { + throw IndexOutOfBoundsException_init_$Create$_0('startIndex: ' + startIndex + ', endIndex: ' + endIndex + ', size: ' + size); + } + if (startIndex > endIndex) { + throw IllegalArgumentException_init_$Create$_0('startIndex: ' + startIndex + ' > endIndex: ' + endIndex); + } + }; + protoOf(Companion_5).q4 = function (oldCapacity, minCapacity) { + var newCapacity = oldCapacity + (oldCapacity >> 1) | 0; + if ((newCapacity - minCapacity | 0) < 0) + newCapacity = minCapacity; + if ((newCapacity - 2147483639 | 0) > 0) + newCapacity = minCapacity > 2147483639 ? 2147483647 : 2147483639; + return newCapacity; + }; + protoOf(Companion_5).l2 = function (c) { + var hashCode_0 = 1; + var _iterator__ex2g4s = c.f(); + while (_iterator__ex2g4s.g()) { + var e = _iterator__ex2g4s.h(); + var tmp = imul(31, hashCode_0); + var tmp1_elvis_lhs = e == null ? null : hashCode(e); + hashCode_0 = tmp + (tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs) | 0; + } + return hashCode_0; + }; + protoOf(Companion_5).k2 = function (c, other) { + if (!(c.i() === other.i())) + return false; + var otherIterator = other.f(); + var _iterator__ex2g4s = c.f(); + while (_iterator__ex2g4s.g()) { + var elem = _iterator__ex2g4s.h(); + var elemOther = otherIterator.h(); + if (!equals(elem, elemOther)) { + return false; + } + } + return true; + }; + var Companion_instance_5; + function Companion_getInstance_5() { + return Companion_instance_5; + } + function AbstractMap$keys$1$iterator$1($entryIterator) { + this.o6_1 = $entryIterator; + } + protoOf(AbstractMap$keys$1$iterator$1).g = function () { + return this.o6_1.g(); + }; + protoOf(AbstractMap$keys$1$iterator$1).h = function () { + return this.o6_1.h().r(); + }; + function AbstractMap$values$1$iterator$1($entryIterator) { + this.p6_1 = $entryIterator; + } + protoOf(AbstractMap$values$1$iterator$1).g = function () { + return this.p6_1.g(); + }; + protoOf(AbstractMap$values$1$iterator$1).h = function () { + return this.p6_1.h().s(); + }; + function toString_3($this, entry) { + return toString_4($this, entry.r()) + '=' + toString_4($this, entry.s()); + } + function toString_4($this, o) { + return o === $this ? '(this Map)' : toString_0(o); + } + function implFindEntry($this, key) { + var tmp0 = $this.y(); + var tmp$ret$1; + $l$block: { + // Inline function 'kotlin.collections.firstOrNull' call + var _iterator__ex2g4s = tmp0.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + if (equals(element.r(), key)) { + tmp$ret$1 = element; + break $l$block; + } + } + tmp$ret$1 = null; + } + return tmp$ret$1; + } + function Companion_6() { + } + var Companion_instance_6; + function Companion_getInstance_6() { + return Companion_instance_6; + } + function AbstractMap$keys$1(this$0) { + this.q6_1 = this$0; + AbstractSet.call(this); + } + protoOf(AbstractMap$keys$1).k3 = function (element) { + return this.q6_1.t(element); + }; + protoOf(AbstractMap$keys$1).p = function (element) { + if (!(element == null ? true : !(element == null))) + return false; + return this.k3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(AbstractMap$keys$1).f = function () { + var entryIterator = this.q6_1.y().f(); + return new AbstractMap$keys$1$iterator$1(entryIterator); + }; + protoOf(AbstractMap$keys$1).i = function () { + return this.q6_1.i(); + }; + function AbstractMap$toString$lambda(this$0) { + return function (it) { + return toString_3(this$0, it); + }; + } + function AbstractMap$values$1(this$0) { + this.r6_1 = this$0; + AbstractCollection.call(this); + } + protoOf(AbstractMap$values$1).o3 = function (element) { + return this.r6_1.u(element); + }; + protoOf(AbstractMap$values$1).p = function (element) { + if (!(element == null ? true : !(element == null))) + return false; + return this.o3((element == null ? true : !(element == null)) ? element : THROW_CCE()); + }; + protoOf(AbstractMap$values$1).f = function () { + var entryIterator = this.r6_1.y().f(); + return new AbstractMap$values$1$iterator$1(entryIterator); + }; + protoOf(AbstractMap$values$1).i = function () { + return this.r6_1.i(); + }; + function AbstractMap() { + this.s2_1 = null; + this.t2_1 = null; + } + protoOf(AbstractMap).t = function (key) { + return !(implFindEntry(this, key) == null); + }; + protoOf(AbstractMap).u = function (value) { + var tmp0 = this.y(); + var tmp$ret$0; + $l$block_0: { + // Inline function 'kotlin.collections.any' call + var tmp; + if (isInterface(tmp0, Collection)) { + tmp = tmp0.j(); + } else { + tmp = false; + } + if (tmp) { + tmp$ret$0 = false; + break $l$block_0; + } + var _iterator__ex2g4s = tmp0.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + if (equals(element.s(), value)) { + tmp$ret$0 = true; + break $l$block_0; + } + } + tmp$ret$0 = false; + } + return tmp$ret$0; + }; + protoOf(AbstractMap).u2 = function (entry) { + if (!(!(entry == null) ? isInterface(entry, Entry) : false)) + return false; + var key = entry.r(); + var value = entry.s(); + // Inline function 'kotlin.collections.get' call + var ourValue = (isInterface(this, KtMap) ? this : THROW_CCE()).v(key); + if (!equals(value, ourValue)) { + return false; + } + var tmp; + if (ourValue == null) { + // Inline function 'kotlin.collections.containsKey' call + tmp = !(isInterface(this, KtMap) ? this : THROW_CCE()).t(key); + } else { + tmp = false; + } + if (tmp) { + return false; + } + return true; + }; + protoOf(AbstractMap).equals = function (other) { + if (other === this) + return true; + if (!(!(other == null) ? isInterface(other, KtMap) : false)) + return false; + if (!(this.i() === other.i())) + return false; + var tmp0 = other.y(); + var tmp$ret$0; + $l$block_0: { + // Inline function 'kotlin.collections.all' call + var tmp; + if (isInterface(tmp0, Collection)) { + tmp = tmp0.j(); + } else { + tmp = false; + } + if (tmp) { + tmp$ret$0 = true; + break $l$block_0; + } + var _iterator__ex2g4s = tmp0.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + if (!this.u2(element)) { + tmp$ret$0 = false; + break $l$block_0; + } + } + tmp$ret$0 = true; + } + return tmp$ret$0; + }; + protoOf(AbstractMap).v = function (key) { + var tmp0_safe_receiver = implFindEntry(this, key); + return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.s(); + }; + protoOf(AbstractMap).hashCode = function () { + return hashCode(this.y()); + }; + protoOf(AbstractMap).j = function () { + return this.i() === 0; + }; + protoOf(AbstractMap).i = function () { + return this.y().i(); + }; + protoOf(AbstractMap).w = function () { + if (this.s2_1 == null) { + var tmp = this; + tmp.s2_1 = new AbstractMap$keys$1(this); + } + return ensureNotNull(this.s2_1); + }; + protoOf(AbstractMap).toString = function () { + var tmp = this.y(); + return joinToString_0(tmp, ', ', '{', '}', VOID, VOID, AbstractMap$toString$lambda(this)); + }; + protoOf(AbstractMap).x = function () { + if (this.t2_1 == null) { + var tmp = this; + tmp.t2_1 = new AbstractMap$values$1(this); + } + return ensureNotNull(this.t2_1); + }; + function Companion_7() { + } + protoOf(Companion_7).w2 = function (c) { + var hashCode_0 = 0; + var _iterator__ex2g4s = c.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + var tmp = hashCode_0; + var tmp1_elvis_lhs = element == null ? null : hashCode(element); + hashCode_0 = tmp + (tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs) | 0; + } + return hashCode_0; + }; + protoOf(Companion_7).v2 = function (c, other) { + if (!(c.i() === other.i())) + return false; + return c.q(other); + }; + var Companion_instance_7; + function Companion_getInstance_7() { + return Companion_instance_7; + } + function AbstractSet() { + AbstractCollection.call(this); + } + protoOf(AbstractSet).equals = function (other) { + if (other === this) + return true; + if (!(!(other == null) ? isInterface(other, KtSet) : false)) + return false; + return Companion_instance_7.v2(this, other); + }; + protoOf(AbstractSet).hashCode = function () { + return Companion_instance_7.w2(this); + }; + function collectionToArrayCommonImpl(collection) { + if (collection.j()) { + // Inline function 'kotlin.emptyArray' call + return []; + } + // Inline function 'kotlin.arrayOfNulls' call + var size = collection.i(); + var destination = Array(size); + var iterator = collection.f(); + var index = 0; + while (iterator.g()) { + var _unary__edvuaz = index; + index = _unary__edvuaz + 1 | 0; + destination[_unary__edvuaz] = iterator.h(); + } + return destination; + } + function EmptyList() { + EmptyList_instance = this; + this.s6_1 = new Long(-1478467534, -1720727600); + } + protoOf(EmptyList).equals = function (other) { + var tmp; + if (!(other == null) ? isInterface(other, KtList) : false) { + tmp = other.j(); + } else { + tmp = false; + } + return tmp; + }; + protoOf(EmptyList).hashCode = function () { + return 1; + }; + protoOf(EmptyList).toString = function () { + return '[]'; + }; + protoOf(EmptyList).i = function () { + return 0; + }; + protoOf(EmptyList).j = function () { + return true; + }; + protoOf(EmptyList).k = function (index) { + throw IndexOutOfBoundsException_init_$Create$_0("Empty list doesn't contain element at index " + index + '.'); + }; + protoOf(EmptyList).f = function () { + return EmptyIterator_instance; + }; + var EmptyList_instance; + function EmptyList_getInstance() { + if (EmptyList_instance == null) + new EmptyList(); + return EmptyList_instance; + } + function get_lastIndex_0(_this__u8e3s4) { + return _this__u8e3s4.i() - 1 | 0; + } + function emptyList() { + return EmptyList_getInstance(); + } + function optimizeReadOnlyList(_this__u8e3s4) { + switch (_this__u8e3s4.i()) { + case 0: + return emptyList(); + case 1: + return listOf(_this__u8e3s4.k(0)); + default: + return _this__u8e3s4; + } + } + function EmptyIterator() { + } + protoOf(EmptyIterator).g = function () { + return false; + }; + protoOf(EmptyIterator).h = function () { + throw NoSuchElementException_init_$Create$(); + }; + var EmptyIterator_instance; + function EmptyIterator_getInstance() { + return EmptyIterator_instance; + } + function collectionSizeOrDefault(_this__u8e3s4, default_0) { + var tmp; + if (isInterface(_this__u8e3s4, Collection)) { + tmp = _this__u8e3s4.i(); + } else { + tmp = default_0; + } + return tmp; + } + function emptyMap() { + var tmp = EmptyMap_getInstance(); + return isInterface(tmp, KtMap) ? tmp : THROW_CCE(); + } + function EmptyMap() { + EmptyMap_instance = this; + this.t6_1 = new Long(-888910638, 1920087921); + } + protoOf(EmptyMap).equals = function (other) { + var tmp; + if (!(other == null) ? isInterface(other, KtMap) : false) { + tmp = other.j(); + } else { + tmp = false; + } + return tmp; + }; + protoOf(EmptyMap).hashCode = function () { + return 0; + }; + protoOf(EmptyMap).toString = function () { + return '{}'; + }; + protoOf(EmptyMap).i = function () { + return 0; + }; + protoOf(EmptyMap).j = function () { + return true; + }; + protoOf(EmptyMap).u6 = function (key) { + return false; + }; + protoOf(EmptyMap).t = function (key) { + if (!(key == null ? true : !(key == null))) + return false; + return this.u6((key == null ? true : !(key == null)) ? key : THROW_CCE()); + }; + protoOf(EmptyMap).v6 = function (value) { + return false; + }; + protoOf(EmptyMap).u = function (value) { + if (!false) + return false; + var tmp; + if (false) { + tmp = value; + } else { + tmp = THROW_CCE(); + } + return this.v6(tmp); + }; + protoOf(EmptyMap).w6 = function (key) { + return null; + }; + protoOf(EmptyMap).v = function (key) { + if (!(key == null ? true : !(key == null))) + return null; + return this.w6((key == null ? true : !(key == null)) ? key : THROW_CCE()); + }; + protoOf(EmptyMap).y = function () { + return EmptySet_getInstance(); + }; + protoOf(EmptyMap).w = function () { + return EmptySet_getInstance(); + }; + protoOf(EmptyMap).x = function () { + return EmptyList_getInstance(); + }; + var EmptyMap_instance; + function EmptyMap_getInstance() { + if (EmptyMap_instance == null) + new EmptyMap(); + return EmptyMap_instance; + } + function IntIterator() { + } + protoOf(IntIterator).h = function () { + return this.x6(); + }; + function EmptySet() { + EmptySet_instance = this; + this.y6_1 = new Long(1993859828, 793161749); + } + protoOf(EmptySet).equals = function (other) { + var tmp; + if (!(other == null) ? isInterface(other, KtSet) : false) { + tmp = other.j(); + } else { + tmp = false; + } + return tmp; + }; + protoOf(EmptySet).hashCode = function () { + return 0; + }; + protoOf(EmptySet).toString = function () { + return '[]'; + }; + protoOf(EmptySet).i = function () { + return 0; + }; + protoOf(EmptySet).j = function () { + return true; + }; + protoOf(EmptySet).z6 = function (elements) { + return elements.j(); + }; + protoOf(EmptySet).q = function (elements) { + return this.z6(elements); + }; + protoOf(EmptySet).f = function () { + return EmptyIterator_instance; + }; + var EmptySet_instance; + function EmptySet_getInstance() { + if (EmptySet_instance == null) + new EmptySet(); + return EmptySet_instance; + } + function naturalOrder() { + var tmp = NaturalOrderComparator_instance; + return isInterface(tmp, Comparator) ? tmp : THROW_CCE(); + } + function NaturalOrderComparator() { + } + protoOf(NaturalOrderComparator).a7 = function (a, b) { + return compareTo(a, b); + }; + protoOf(NaturalOrderComparator).compare = function (a, b) { + var tmp = (!(a == null) ? isComparable(a) : false) ? a : THROW_CCE(); + return this.a7(tmp, (!(b == null) ? isComparable(b) : false) ? b : THROW_CCE()); + }; + var NaturalOrderComparator_instance; + function NaturalOrderComparator_getInstance() { + return NaturalOrderComparator_instance; + } + function getProgressionLastElement(start, end, step) { + var tmp; + if (step > 0) { + tmp = start >= end ? end : end - differenceModulo(end, start, step) | 0; + } else if (step < 0) { + tmp = start <= end ? end : end + differenceModulo(start, end, -step | 0) | 0; + } else { + throw IllegalArgumentException_init_$Create$_0('Step is zero.'); + } + return tmp; + } + function differenceModulo(a, b, c) { + return mod(mod(a, c) - mod(b, c) | 0, c); + } + function mod(a, b) { + var mod = a % b | 0; + return mod >= 0 ? mod : mod + b | 0; + } + function get_base64EncodeMap() { + _init_properties_Base64_kt__ymmsz3(); + return base64EncodeMap; + } + var base64EncodeMap; + function get_base64DecodeMap() { + _init_properties_Base64_kt__ymmsz3(); + return base64DecodeMap; + } + var base64DecodeMap; + function get_base64UrlEncodeMap() { + _init_properties_Base64_kt__ymmsz3(); + return base64UrlEncodeMap; + } + var base64UrlEncodeMap; + function get_base64UrlDecodeMap() { + _init_properties_Base64_kt__ymmsz3(); + return base64UrlDecodeMap; + } + var base64UrlDecodeMap; + var PaddingOption_PRESENT_instance; + var PaddingOption_ABSENT_instance; + var PaddingOption_PRESENT_OPTIONAL_instance; + var PaddingOption_ABSENT_OPTIONAL_instance; + var PaddingOption_entriesInitialized; + function PaddingOption_initEntries() { + if (PaddingOption_entriesInitialized) + return Unit_instance; + PaddingOption_entriesInitialized = true; + PaddingOption_PRESENT_instance = new PaddingOption('PRESENT', 0); + PaddingOption_ABSENT_instance = new PaddingOption('ABSENT', 1); + PaddingOption_PRESENT_OPTIONAL_instance = new PaddingOption('PRESENT_OPTIONAL', 2); + PaddingOption_ABSENT_OPTIONAL_instance = new PaddingOption('ABSENT_OPTIONAL', 3); + } + function PaddingOption(name, ordinal) { + Enum.call(this, name, ordinal); + } + function decodeImpl($this, source, destination, destinationOffset, startIndex, endIndex) { + var decodeMap = $this.b7_1 ? get_base64UrlDecodeMap() : get_base64DecodeMap(); + var payload = 0; + var byteStart = -8; + var sourceIndex = startIndex; + var destinationIndex = destinationOffset; + var hasPadding = false; + $l$loop_1: while (sourceIndex < endIndex) { + if (byteStart === -8 && (sourceIndex + 3 | 0) < endIndex) { + var _unary__edvuaz = sourceIndex; + sourceIndex = _unary__edvuaz + 1 | 0; + var symbol1 = decodeMap[source[_unary__edvuaz] & 255]; + var _unary__edvuaz_0 = sourceIndex; + sourceIndex = _unary__edvuaz_0 + 1 | 0; + var symbol2 = decodeMap[source[_unary__edvuaz_0] & 255]; + var _unary__edvuaz_1 = sourceIndex; + sourceIndex = _unary__edvuaz_1 + 1 | 0; + var symbol3 = decodeMap[source[_unary__edvuaz_1] & 255]; + var _unary__edvuaz_2 = sourceIndex; + sourceIndex = _unary__edvuaz_2 + 1 | 0; + var symbol4 = decodeMap[source[_unary__edvuaz_2] & 255]; + var bits = symbol1 << 18 | symbol2 << 12 | symbol3 << 6 | symbol4; + if (bits >= 0) { + var _unary__edvuaz_3 = destinationIndex; + destinationIndex = _unary__edvuaz_3 + 1 | 0; + destination[_unary__edvuaz_3] = toByte(bits >> 16); + var _unary__edvuaz_4 = destinationIndex; + destinationIndex = _unary__edvuaz_4 + 1 | 0; + destination[_unary__edvuaz_4] = toByte(bits >> 8); + var _unary__edvuaz_5 = destinationIndex; + destinationIndex = _unary__edvuaz_5 + 1 | 0; + destination[_unary__edvuaz_5] = toByte(bits); + continue $l$loop_1; + } + sourceIndex = sourceIndex - 4 | 0; + } + var symbol = source[sourceIndex] & 255; + var symbolBits = decodeMap[symbol]; + if (symbolBits < 0) { + if (symbolBits === -2) { + hasPadding = true; + sourceIndex = handlePaddingSymbol($this, source, sourceIndex, endIndex, byteStart); + break $l$loop_1; + } else if ($this.c7_1) { + sourceIndex = sourceIndex + 1 | 0; + continue $l$loop_1; + } else { + throw IllegalArgumentException_init_$Create$_0("Invalid symbol '" + toString(numberToChar(symbol)) + "'(" + toString_2(symbol, 8) + ') at index ' + sourceIndex); + } + } else { + sourceIndex = sourceIndex + 1 | 0; + } + payload = payload << 6 | symbolBits; + byteStart = byteStart + 6 | 0; + if (byteStart >= 0) { + var _unary__edvuaz_6 = destinationIndex; + destinationIndex = _unary__edvuaz_6 + 1 | 0; + destination[_unary__edvuaz_6] = toByte(payload >>> byteStart | 0); + payload = payload & ((1 << byteStart) - 1 | 0); + byteStart = byteStart - 8 | 0; + } + } + if (byteStart === -2) { + throw IllegalArgumentException_init_$Create$_0('The last unit of input does not have enough bits'); + } + if (!(byteStart === -8) && !hasPadding && $this.e7_1.equals(PaddingOption_PRESENT_getInstance())) { + throw IllegalArgumentException_init_$Create$_0('The padding option is set to PRESENT, but the input is not properly padded'); + } + if (!(payload === 0)) { + throw IllegalArgumentException_init_$Create$_0('The pad bits must be zeros'); + } + sourceIndex = skipIllegalSymbolsIfMime($this, source, sourceIndex, endIndex); + if (sourceIndex < endIndex) { + var symbol_0 = source[sourceIndex] & 255; + throw IllegalArgumentException_init_$Create$_0("Symbol '" + toString(numberToChar(symbol_0)) + "'(" + toString_2(symbol_0, 8) + ') at index ' + (sourceIndex - 1 | 0) + ' is prohibited after the pad character'); + } + return destinationIndex - destinationOffset | 0; + } + function handlePaddingSymbol($this, source, padIndex, endIndex, byteStart) { + var tmp; + switch (byteStart) { + case -8: + throw IllegalArgumentException_init_$Create$_0('Redundant pad character at index ' + padIndex); + case -2: + tmp = padIndex + 1 | 0; + break; + case -4: + checkPaddingIsAllowed($this, padIndex); + var secondPadIndex = skipIllegalSymbolsIfMime($this, source, padIndex + 1 | 0, endIndex); + if (secondPadIndex === endIndex || !(source[secondPadIndex] === 61)) { + throw IllegalArgumentException_init_$Create$_0('Missing one pad character at index ' + secondPadIndex); + } + + tmp = secondPadIndex + 1 | 0; + break; + case -6: + checkPaddingIsAllowed($this, padIndex); + tmp = padIndex + 1 | 0; + break; + default: + var message = 'Unreachable'; + throw IllegalStateException_init_$Create$_0(toString_1(message)); + } + return tmp; + } + function checkPaddingIsAllowed($this, padIndex) { + if ($this.e7_1.equals(PaddingOption_ABSENT_getInstance())) { + throw IllegalArgumentException_init_$Create$_0('The padding option is set to ABSENT, but the input has a pad character at index ' + padIndex); + } + } + function skipIllegalSymbolsIfMime($this, source, startIndex, endIndex) { + if (!$this.c7_1) { + return startIndex; + } + var sourceIndex = startIndex; + while (sourceIndex < endIndex) { + var symbol = source[sourceIndex] & 255; + if (!(get_base64DecodeMap()[symbol] === -1)) { + return sourceIndex; + } + sourceIndex = sourceIndex + 1 | 0; + } + return sourceIndex; + } + function Default() { + Default_instance = this; + Base64.call(this, false, false, -1, PaddingOption_PRESENT_getInstance()); + this.l7_1 = 8; + this.m7_1 = 6; + this.n7_1 = 3; + this.o7_1 = 4; + this.p7_1 = 61; + this.q7_1 = 76; + this.r7_1 = 64; + var tmp = this; + // Inline function 'kotlin.code' call + var this_0 = _Char___init__impl__6a9atx(13); + var tmp$ret$0 = Char__toInt_impl_vasixd(this_0); + var tmp_0 = toByte(tmp$ret$0); + // Inline function 'kotlin.code' call + var this_1 = _Char___init__impl__6a9atx(10); + var tmp$ret$1 = Char__toInt_impl_vasixd(this_1); + // Inline function 'kotlin.byteArrayOf' call + tmp.s7_1 = new Int8Array([tmp_0, toByte(tmp$ret$1)]); + this.t7_1 = new Base64(true, false, -1, PaddingOption_PRESENT_getInstance()); + this.u7_1 = new Base64(false, true, 76, PaddingOption_PRESENT_getInstance()); + this.v7_1 = new Base64(false, true, 64, PaddingOption_PRESENT_getInstance()); + } + var Default_instance; + function Default_getInstance() { + if (Default_instance == null) + new Default(); + return Default_instance; + } + function PaddingOption_PRESENT_getInstance() { + PaddingOption_initEntries(); + return PaddingOption_PRESENT_instance; + } + function PaddingOption_ABSENT_getInstance() { + PaddingOption_initEntries(); + return PaddingOption_ABSENT_instance; + } + function Base64(isUrlSafe, isMimeScheme, mimeLineLength, paddingOption) { + Default_getInstance(); + this.b7_1 = isUrlSafe; + this.c7_1 = isMimeScheme; + this.d7_1 = mimeLineLength; + this.e7_1 = paddingOption; + // Inline function 'kotlin.require' call + // Inline function 'kotlin.require' call + if (!(!this.b7_1 || !this.c7_1)) { + var message = 'Failed requirement.'; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + this.f7_1 = this.d7_1 / 4 | 0; + } + protoOf(Base64).w7 = function (source, startIndex, endIndex) { + this.c8(source.length, startIndex, endIndex); + var decodeSize = this.a8(source, startIndex, endIndex); + var destination = new Int8Array(decodeSize); + var bytesWritten = decodeImpl(this, source, destination, 0, startIndex, endIndex); + // Inline function 'kotlin.check' call + if (!(bytesWritten === destination.length)) { + throw IllegalStateException_init_$Create$_0('Check failed.'); + } + return destination; + }; + protoOf(Base64).x7 = function (source, startIndex, endIndex, $super) { + startIndex = startIndex === VOID ? 0 : startIndex; + endIndex = endIndex === VOID ? source.length : endIndex; + return $super === VOID ? this.w7(source, startIndex, endIndex) : $super.w7.call(this, source, startIndex, endIndex); + }; + protoOf(Base64).y7 = function (source, startIndex, endIndex) { + // Inline function 'kotlin.io.encoding.platformCharsToBytes' call + var byteSource = this.b8(source, startIndex, endIndex); + return this.x7(byteSource); + }; + protoOf(Base64).z7 = function (source, startIndex, endIndex, $super) { + startIndex = startIndex === VOID ? 0 : startIndex; + endIndex = endIndex === VOID ? charSequenceLength(source) : endIndex; + return $super === VOID ? this.y7(source, startIndex, endIndex) : $super.y7.call(this, source, startIndex, endIndex); + }; + protoOf(Base64).a8 = function (source, startIndex, endIndex) { + var symbols = endIndex - startIndex | 0; + if (symbols === 0) { + return 0; + } + if (symbols === 1) { + throw IllegalArgumentException_init_$Create$_0('Input should have at least 2 symbols for Base64 decoding, startIndex: ' + startIndex + ', endIndex: ' + endIndex); + } + if (this.c7_1) { + var inductionVariable = startIndex; + if (inductionVariable < endIndex) + $l$loop: do { + var index = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + var symbol = source[index] & 255; + var symbolBits = get_base64DecodeMap()[symbol]; + if (symbolBits < 0) { + if (symbolBits === -2) { + symbols = symbols - (endIndex - index | 0) | 0; + break $l$loop; + } + symbols = symbols - 1 | 0; + } + } + while (inductionVariable < endIndex); + } else if (source[endIndex - 1 | 0] === 61) { + symbols = symbols - 1 | 0; + if (source[endIndex - 2 | 0] === 61) { + symbols = symbols - 1 | 0; + } + } + // Inline function 'kotlin.Long.times' call + // Inline function 'kotlin.Long.div' call + return toLong(symbols).k1(toLong(6)).l1(toLong(8)).o1(); + }; + protoOf(Base64).b8 = function (source, startIndex, endIndex) { + this.c8(charSequenceLength(source), startIndex, endIndex); + var byteArray = new Int8Array(endIndex - startIndex | 0); + var length = 0; + var inductionVariable = startIndex; + if (inductionVariable < endIndex) + do { + var index = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + // Inline function 'kotlin.code' call + var this_0 = charSequenceGet(source, index); + var symbol = Char__toInt_impl_vasixd(this_0); + if (symbol <= 255) { + var _unary__edvuaz = length; + length = _unary__edvuaz + 1 | 0; + byteArray[_unary__edvuaz] = toByte(symbol); + } else { + var _unary__edvuaz_0 = length; + length = _unary__edvuaz_0 + 1 | 0; + byteArray[_unary__edvuaz_0] = 63; + } + } + while (inductionVariable < endIndex); + return byteArray; + }; + protoOf(Base64).c8 = function (sourceSize, startIndex, endIndex) { + Companion_instance_5.n6(startIndex, endIndex, sourceSize); + }; + var properties_initialized_Base64_kt_5g824v; + function _init_properties_Base64_kt__ymmsz3() { + if (!properties_initialized_Base64_kt_5g824v) { + properties_initialized_Base64_kt_5g824v = true; + // Inline function 'kotlin.byteArrayOf' call + base64EncodeMap = new Int8Array([65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47]); + // Inline function 'kotlin.apply' call + var this_0 = new Int32Array(256); + fill(this_0, -1); + this_0[61] = -2; + // Inline function 'kotlin.collections.forEachIndexed' call + var index = 0; + var indexedObject = get_base64EncodeMap(); + var inductionVariable = 0; + var last = indexedObject.length; + while (inductionVariable < last) { + var item = indexedObject[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + var _unary__edvuaz = index; + index = _unary__edvuaz + 1 | 0; + this_0[item] = _unary__edvuaz; + } + base64DecodeMap = this_0; + // Inline function 'kotlin.byteArrayOf' call + base64UrlEncodeMap = new Int8Array([65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95]); + // Inline function 'kotlin.apply' call + var this_1 = new Int32Array(256); + fill(this_1, -1); + this_1[61] = -2; + // Inline function 'kotlin.collections.forEachIndexed' call + var index_0 = 0; + var indexedObject_0 = get_base64UrlEncodeMap(); + var inductionVariable_0 = 0; + var last_0 = indexedObject_0.length; + while (inductionVariable_0 < last_0) { + var item_0 = indexedObject_0[inductionVariable_0]; + inductionVariable_0 = inductionVariable_0 + 1 | 0; + var _unary__edvuaz_0 = index_0; + index_0 = _unary__edvuaz_0 + 1 | 0; + this_1[item_0] = _unary__edvuaz_0; + } + base64UrlDecodeMap = this_1; + } + } + function Companion_8() { + Companion_instance_8 = this; + this.m_1 = new IntRange(1, 0); + } + var Companion_instance_8; + function Companion_getInstance_8() { + if (Companion_instance_8 == null) + new Companion_8(); + return Companion_instance_8; + } + function IntRange(start, endInclusive) { + Companion_getInstance_8(); + IntProgression.call(this, start, endInclusive, 1); + } + protoOf(IntRange).g8 = function () { + return this.h8_1; + }; + protoOf(IntRange).k8 = function () { + return this.i8_1; + }; + protoOf(IntRange).j = function () { + return this.h8_1 > this.i8_1; + }; + protoOf(IntRange).equals = function (other) { + var tmp; + if (other instanceof IntRange) { + tmp = this.j() && other.j() || (this.h8_1 === other.h8_1 && this.i8_1 === other.i8_1); + } else { + tmp = false; + } + return tmp; + }; + protoOf(IntRange).hashCode = function () { + return this.j() ? -1 : imul(31, this.h8_1) + this.i8_1 | 0; + }; + protoOf(IntRange).toString = function () { + return '' + this.h8_1 + '..' + this.i8_1; + }; + function IntProgressionIterator(first, last, step) { + IntIterator.call(this); + this.l8_1 = step; + this.m8_1 = last; + this.n8_1 = this.l8_1 > 0 ? first <= last : first >= last; + this.o8_1 = this.n8_1 ? first : this.m8_1; + } + protoOf(IntProgressionIterator).g = function () { + return this.n8_1; + }; + protoOf(IntProgressionIterator).x6 = function () { + var value = this.o8_1; + if (value === this.m8_1) { + if (!this.n8_1) + throw NoSuchElementException_init_$Create$(); + this.n8_1 = false; + } else { + this.o8_1 = this.o8_1 + this.l8_1 | 0; + } + return value; + }; + function Companion_9() { + } + protoOf(Companion_9).n = function (rangeStart, rangeEnd, step) { + return new IntProgression(rangeStart, rangeEnd, step); + }; + var Companion_instance_9; + function Companion_getInstance_9() { + return Companion_instance_9; + } + function IntProgression(start, endInclusive, step) { + if (step === 0) + throw IllegalArgumentException_init_$Create$_0('Step must be non-zero.'); + if (step === -2147483648) + throw IllegalArgumentException_init_$Create$_0('Step must be greater than Int.MIN_VALUE to avoid overflow on negation.'); + this.h8_1 = start; + this.i8_1 = getProgressionLastElement(start, endInclusive, step); + this.j8_1 = step; + } + protoOf(IntProgression).f = function () { + return new IntProgressionIterator(this.h8_1, this.i8_1, this.j8_1); + }; + protoOf(IntProgression).j = function () { + return this.j8_1 > 0 ? this.h8_1 > this.i8_1 : this.h8_1 < this.i8_1; + }; + protoOf(IntProgression).equals = function (other) { + var tmp; + if (other instanceof IntProgression) { + tmp = this.j() && other.j() || (this.h8_1 === other.h8_1 && this.i8_1 === other.i8_1 && this.j8_1 === other.j8_1); + } else { + tmp = false; + } + return tmp; + }; + protoOf(IntProgression).hashCode = function () { + return this.j() ? -1 : imul(31, imul(31, this.h8_1) + this.i8_1 | 0) + this.j8_1 | 0; + }; + protoOf(IntProgression).toString = function () { + return this.j8_1 > 0 ? '' + this.h8_1 + '..' + this.i8_1 + ' step ' + this.j8_1 : '' + this.h8_1 + ' downTo ' + this.i8_1 + ' step ' + (-this.j8_1 | 0); + }; + function appendElement(_this__u8e3s4, element, transform) { + if (!(transform == null)) + _this__u8e3s4.e(transform(element)); + else { + if (element == null ? true : isCharSequence(element)) + _this__u8e3s4.e(element); + else { + if (element instanceof Char) + _this__u8e3s4.t5(element.p8_1); + else { + _this__u8e3s4.e(toString_1(element)); + } + } + } + } + function equals_0(_this__u8e3s4, other, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + if (_this__u8e3s4 === other) + return true; + if (!ignoreCase) + return false; + var thisUpper = uppercaseChar(_this__u8e3s4); + var otherUpper = uppercaseChar(other); + var tmp; + if (thisUpper === otherUpper) { + tmp = true; + } else { + // Inline function 'kotlin.text.lowercaseChar' call + // Inline function 'kotlin.text.lowercase' call + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + var tmp$ret$2 = toString(thisUpper).toLowerCase(); + var tmp_0 = charCodeAt(tmp$ret$2, 0); + // Inline function 'kotlin.text.lowercaseChar' call + // Inline function 'kotlin.text.lowercase' call + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.js.unsafeCast' call + var tmp$ret$6 = toString(otherUpper).toLowerCase(); + tmp = tmp_0 === charCodeAt(tmp$ret$6, 0); + } + return tmp; + } + function contains(_this__u8e3s4, other, ignoreCase) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + var tmp; + if (typeof other === 'string') { + tmp = indexOf_0(_this__u8e3s4, other, VOID, ignoreCase) >= 0; + } else { + tmp = indexOf_1(_this__u8e3s4, other, 0, charSequenceLength(_this__u8e3s4), ignoreCase) >= 0; + } + return tmp; + } + function split(_this__u8e3s4, delimiters, ignoreCase, limit) { + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + limit = limit === VOID ? 0 : limit; + if (delimiters.length === 1) { + var delimiter = delimiters[0]; + // Inline function 'kotlin.text.isEmpty' call + if (!(charSequenceLength(delimiter) === 0)) { + return split_0(_this__u8e3s4, delimiter, ignoreCase, limit); + } + } + // Inline function 'kotlin.collections.map' call + var this_0 = asIterable(rangesDelimitedBy(_this__u8e3s4, delimiters, VOID, ignoreCase, limit)); + // Inline function 'kotlin.collections.mapTo' call + var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); + var _iterator__ex2g4s = this_0.f(); + while (_iterator__ex2g4s.g()) { + var item = _iterator__ex2g4s.h(); + var tmp$ret$1 = substring_1(_this__u8e3s4, item); + destination.l(tmp$ret$1); + } + return destination; + } + function regionMatchesImpl(_this__u8e3s4, thisOffset, other, otherOffset, length, ignoreCase) { + if (otherOffset < 0 || thisOffset < 0 || thisOffset > (charSequenceLength(_this__u8e3s4) - length | 0) || otherOffset > (charSequenceLength(other) - length | 0)) { + return false; + } + var inductionVariable = 0; + if (inductionVariable < length) + do { + var index = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + if (!equals_0(charSequenceGet(_this__u8e3s4, thisOffset + index | 0), charSequenceGet(other, otherOffset + index | 0), ignoreCase)) + return false; + } + while (inductionVariable < length); + return true; + } + function indexOf_0(_this__u8e3s4, string, startIndex, ignoreCase) { + startIndex = startIndex === VOID ? 0 : startIndex; + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + var tmp; + var tmp_0; + if (ignoreCase) { + tmp_0 = true; + } else { + tmp_0 = !(typeof _this__u8e3s4 === 'string'); + } + if (tmp_0) { + tmp = indexOf_1(_this__u8e3s4, string, startIndex, charSequenceLength(_this__u8e3s4), ignoreCase); + } else { + // Inline function 'kotlin.text.nativeIndexOf' call + // Inline function 'kotlin.js.asDynamic' call + tmp = _this__u8e3s4.indexOf(string, startIndex); + } + return tmp; + } + function indexOf_1(_this__u8e3s4, other, startIndex, endIndex, ignoreCase, last) { + last = last === VOID ? false : last; + var indices = !last ? numberRangeToNumber(coerceAtLeast(startIndex, 0), coerceAtMost(endIndex, charSequenceLength(_this__u8e3s4))) : downTo(coerceAtMost(startIndex, get_lastIndex_1(_this__u8e3s4)), coerceAtLeast(endIndex, 0)); + var tmp; + if (typeof _this__u8e3s4 === 'string') { + tmp = typeof other === 'string'; + } else { + tmp = false; + } + if (tmp) { + var inductionVariable = indices.h8_1; + var last_0 = indices.i8_1; + var step = indices.j8_1; + if (step > 0 && inductionVariable <= last_0 || (step < 0 && last_0 <= inductionVariable)) + do { + var index = inductionVariable; + inductionVariable = inductionVariable + step | 0; + if (regionMatches(other, 0, _this__u8e3s4, index, other.length, ignoreCase)) + return index; + } + while (!(index === last_0)); + } else { + var inductionVariable_0 = indices.h8_1; + var last_1 = indices.i8_1; + var step_0 = indices.j8_1; + if (step_0 > 0 && inductionVariable_0 <= last_1 || (step_0 < 0 && last_1 <= inductionVariable_0)) + do { + var index_0 = inductionVariable_0; + inductionVariable_0 = inductionVariable_0 + step_0 | 0; + if (regionMatchesImpl(other, 0, _this__u8e3s4, index_0, charSequenceLength(other), ignoreCase)) + return index_0; + } + while (!(index_0 === last_1)); + } + return -1; + } + function split_0(_this__u8e3s4, delimiter, ignoreCase, limit) { + requireNonNegativeLimit(limit); + var currentOffset = 0; + var nextIndex = indexOf_0(_this__u8e3s4, delimiter, currentOffset, ignoreCase); + if (nextIndex === -1 || limit === 1) { + return listOf(toString_1(_this__u8e3s4)); + } + var isLimited = limit > 0; + var result = ArrayList_init_$Create$_0(isLimited ? coerceAtMost(limit, 10) : 10); + $l$loop: do { + var tmp2 = currentOffset; + // Inline function 'kotlin.text.substring' call + var endIndex = nextIndex; + var tmp$ret$0 = toString_1(charSequenceSubSequence(_this__u8e3s4, tmp2, endIndex)); + result.l(tmp$ret$0); + currentOffset = nextIndex + delimiter.length | 0; + if (isLimited && result.i() === (limit - 1 | 0)) + break $l$loop; + nextIndex = indexOf_0(_this__u8e3s4, delimiter, currentOffset, ignoreCase); + } + while (!(nextIndex === -1)); + var tmp2_0 = currentOffset; + // Inline function 'kotlin.text.substring' call + var endIndex_0 = charSequenceLength(_this__u8e3s4); + var tmp$ret$1 = toString_1(charSequenceSubSequence(_this__u8e3s4, tmp2_0, endIndex_0)); + result.l(tmp$ret$1); + return result; + } + function rangesDelimitedBy(_this__u8e3s4, delimiters, startIndex, ignoreCase, limit) { + startIndex = startIndex === VOID ? 0 : startIndex; + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + limit = limit === VOID ? 0 : limit; + requireNonNegativeLimit(limit); + var delimitersList = asList(delimiters); + return new DelimitedRangesSequence(_this__u8e3s4, startIndex, limit, rangesDelimitedBy$lambda(delimitersList, ignoreCase)); + } + function substring_1(_this__u8e3s4, range) { + return toString_1(charSequenceSubSequence(_this__u8e3s4, range.g8(), range.k8() + 1 | 0)); + } + function get_lastIndex_1(_this__u8e3s4) { + return charSequenceLength(_this__u8e3s4) - 1 | 0; + } + function requireNonNegativeLimit(limit) { + // Inline function 'kotlin.require' call + if (!(limit >= 0)) { + var message = 'Limit must be non-negative, but was ' + limit; + throw IllegalArgumentException_init_$Create$_0(toString_1(message)); + } + return Unit_instance; + } + function calcNext($this) { + if ($this.s8_1 < 0) { + $this.q8_1 = 0; + $this.t8_1 = null; + } else { + var tmp; + var tmp_0; + if ($this.v8_1.y8_1 > 0) { + $this.u8_1 = $this.u8_1 + 1 | 0; + tmp_0 = $this.u8_1 >= $this.v8_1.y8_1; + } else { + tmp_0 = false; + } + if (tmp_0) { + tmp = true; + } else { + tmp = $this.s8_1 > charSequenceLength($this.v8_1.w8_1); + } + if (tmp) { + $this.t8_1 = numberRangeToNumber($this.r8_1, get_lastIndex_1($this.v8_1.w8_1)); + $this.s8_1 = -1; + } else { + var match = $this.v8_1.z8_1($this.v8_1.w8_1, $this.s8_1); + if (match == null) { + $this.t8_1 = numberRangeToNumber($this.r8_1, get_lastIndex_1($this.v8_1.w8_1)); + $this.s8_1 = -1; + } else { + var index = match.c9(); + var length = match.d9(); + $this.t8_1 = until($this.r8_1, index); + $this.r8_1 = index + length | 0; + $this.s8_1 = $this.r8_1 + (length === 0 ? 1 : 0) | 0; + } + } + $this.q8_1 = 1; + } + } + function DelimitedRangesSequence$iterator$1(this$0) { + this.v8_1 = this$0; + this.q8_1 = -1; + this.r8_1 = coerceIn(this$0.x8_1, 0, charSequenceLength(this$0.w8_1)); + this.s8_1 = this.r8_1; + this.t8_1 = null; + this.u8_1 = 0; + } + protoOf(DelimitedRangesSequence$iterator$1).h = function () { + if (this.q8_1 === -1) { + calcNext(this); + } + if (this.q8_1 === 0) + throw NoSuchElementException_init_$Create$(); + var tmp = this.t8_1; + var result = tmp instanceof IntRange ? tmp : THROW_CCE(); + this.t8_1 = null; + this.q8_1 = -1; + return result; + }; + protoOf(DelimitedRangesSequence$iterator$1).g = function () { + if (this.q8_1 === -1) { + calcNext(this); + } + return this.q8_1 === 1; + }; + function DelimitedRangesSequence(input, startIndex, limit, getNextMatch) { + this.w8_1 = input; + this.x8_1 = startIndex; + this.y8_1 = limit; + this.z8_1 = getNextMatch; + } + protoOf(DelimitedRangesSequence).f = function () { + return new DelimitedRangesSequence$iterator$1(this); + }; + function findAnyOf(_this__u8e3s4, strings, startIndex, ignoreCase, last) { + if (!ignoreCase && strings.i() === 1) { + var string = single(strings); + var index = !last ? indexOf_0(_this__u8e3s4, string, startIndex) : lastIndexOf(_this__u8e3s4, string, startIndex); + return index < 0 ? null : to(index, string); + } + var indices = !last ? numberRangeToNumber(coerceAtLeast(startIndex, 0), charSequenceLength(_this__u8e3s4)) : downTo(coerceAtMost(startIndex, get_lastIndex_1(_this__u8e3s4)), 0); + if (typeof _this__u8e3s4 === 'string') { + var inductionVariable = indices.h8_1; + var last_0 = indices.i8_1; + var step = indices.j8_1; + if (step > 0 && inductionVariable <= last_0 || (step < 0 && last_0 <= inductionVariable)) + do { + var index_0 = inductionVariable; + inductionVariable = inductionVariable + step | 0; + var tmp$ret$1; + $l$block: { + // Inline function 'kotlin.collections.firstOrNull' call + var _iterator__ex2g4s = strings.f(); + while (_iterator__ex2g4s.g()) { + var element = _iterator__ex2g4s.h(); + if (regionMatches(element, 0, _this__u8e3s4, index_0, element.length, ignoreCase)) { + tmp$ret$1 = element; + break $l$block; + } + } + tmp$ret$1 = null; + } + var matchingString = tmp$ret$1; + if (!(matchingString == null)) + return to(index_0, matchingString); + } + while (!(index_0 === last_0)); + } else { + var inductionVariable_0 = indices.h8_1; + var last_1 = indices.i8_1; + var step_0 = indices.j8_1; + if (step_0 > 0 && inductionVariable_0 <= last_1 || (step_0 < 0 && last_1 <= inductionVariable_0)) + do { + var index_1 = inductionVariable_0; + inductionVariable_0 = inductionVariable_0 + step_0 | 0; + var tmp$ret$3; + $l$block_0: { + // Inline function 'kotlin.collections.firstOrNull' call + var _iterator__ex2g4s_0 = strings.f(); + while (_iterator__ex2g4s_0.g()) { + var element_0 = _iterator__ex2g4s_0.h(); + if (regionMatchesImpl(element_0, 0, _this__u8e3s4, index_1, element_0.length, ignoreCase)) { + tmp$ret$3 = element_0; + break $l$block_0; + } + } + tmp$ret$3 = null; + } + var matchingString_0 = tmp$ret$3; + if (!(matchingString_0 == null)) + return to(index_1, matchingString_0); + } + while (!(index_1 === last_1)); + } + return null; + } + function lastIndexOf(_this__u8e3s4, string, startIndex, ignoreCase) { + startIndex = startIndex === VOID ? get_lastIndex_1(_this__u8e3s4) : startIndex; + ignoreCase = ignoreCase === VOID ? false : ignoreCase; + var tmp; + var tmp_0; + if (ignoreCase) { + tmp_0 = true; + } else { + tmp_0 = !(typeof _this__u8e3s4 === 'string'); + } + if (tmp_0) { + tmp = indexOf_1(_this__u8e3s4, string, startIndex, 0, ignoreCase, true); + } else { + // Inline function 'kotlin.text.nativeLastIndexOf' call + // Inline function 'kotlin.js.asDynamic' call + tmp = _this__u8e3s4.lastIndexOf(string, startIndex); + } + return tmp; + } + function rangesDelimitedBy$lambda($delimitersList, $ignoreCase) { + return function ($this$DelimitedRangesSequence, currentIndex) { + var tmp0_safe_receiver = findAnyOf($this$DelimitedRangesSequence, $delimitersList, currentIndex, $ignoreCase, false); + var tmp; + if (tmp0_safe_receiver == null) { + tmp = null; + } else { + // Inline function 'kotlin.let' call + tmp = to(tmp0_safe_receiver.a9_1, tmp0_safe_receiver.b9_1.length); + } + return tmp; + }; + } + function Pair(first, second) { + this.a9_1 = first; + this.b9_1 = second; + } + protoOf(Pair).toString = function () { + return '(' + toString_0(this.a9_1) + ', ' + toString_0(this.b9_1) + ')'; + }; + protoOf(Pair).c9 = function () { + return this.a9_1; + }; + protoOf(Pair).d9 = function () { + return this.b9_1; + }; + protoOf(Pair).hashCode = function () { + var result = this.a9_1 == null ? 0 : hashCode(this.a9_1); + result = imul(result, 31) + (this.b9_1 == null ? 0 : hashCode(this.b9_1)) | 0; + return result; + }; + protoOf(Pair).equals = function (other) { + if (this === other) + return true; + if (!(other instanceof Pair)) + return false; + var tmp0_other_with_cast = other instanceof Pair ? other : THROW_CCE(); + if (!equals(this.a9_1, tmp0_other_with_cast.a9_1)) + return false; + if (!equals(this.b9_1, tmp0_other_with_cast.b9_1)) + return false; + return true; + }; + function to(_this__u8e3s4, that) { + return new Pair(_this__u8e3s4, that); + } + function _UShort___init__impl__jigrne(data) { + return data; + } + function _UShort___get_data__impl__g0245($this) { + return $this; + } + //region block: post-declaration + protoOf(AbstractMap).asJsReadonlyMapView = asJsReadonlyMapView; + protoOf(InternalHashMap).x3 = containsAllEntries; + protoOf(EmptyMap).asJsReadonlyMapView = asJsReadonlyMapView; + //endregion + //region block: init + Companion_instance = new Companion(); + Companion_instance_0 = new Companion_0(); + Unit_instance = new Unit(); + _stableSortingIsSupported = null; + Companion_instance_3 = new Companion_3(); + Companion_instance_5 = new Companion_5(); + Companion_instance_6 = new Companion_6(); + Companion_instance_7 = new Companion_7(); + EmptyIterator_instance = new EmptyIterator(); + NaturalOrderComparator_instance = new NaturalOrderComparator(); + Companion_instance_9 = new Companion_9(); + //endregion + //region block: exports + function $jsExportAll$(_) { + var $kotlin = _.kotlin || (_.kotlin = {}); + var $kotlin$collections = $kotlin.collections || ($kotlin.collections = {}); + defineProp($kotlin$collections, 'KtMap', Companion_getInstance); + } + $jsExportAll$(_); + _.$jsExportAll$ = $jsExportAll$; + _.$_$ = _.$_$ || {}; + _.$_$.a = VOID; + _.$_$.b = ArrayList_init_$Create$; + _.$_$.c = LinkedHashMap_init_$Create$; + _.$_$.d = Default_getInstance; + _.$_$.e = Unit_instance; + _.$_$.f = KtMap; + _.$_$.g = copyToArray; + _.$_$.h = emptyMap; + _.$_$.i = first; + _.$_$.j = last_0; + _.$_$.k = last; + _.$_$.l = sorted; + _.$_$.m = sort; + _.$_$.n = println; + _.$_$.o = charSequenceLength; + _.$_$.p = defineProp; + _.$_$.q = equals; + _.$_$.r = getBooleanHashCode; + _.$_$.s = getStringHashCode; + _.$_$.t = hashCode; + _.$_$.u = initMetadataForClass; + _.$_$.v = initMetadataForInterface; + _.$_$.w = initMetadataForObject; + _.$_$.x = isArray; + _.$_$.y = isInterface; + _.$_$.z = protoOf; + _.$_$.a1 = toString_1; + _.$_$.b1 = capitalize; + _.$_$.c1 = contains; + _.$_$.d1 = decodeToString; + _.$_$.e1 = dropLast; + _.$_$.f1 = endsWith; + _.$_$.g1 = replace; + _.$_$.h1 = split; + _.$_$.i1 = startsWith; + _.$_$.j1 = substring_0; + _.$_$.k1 = substring; + _.$_$.l1 = THROW_CCE; + _.$_$.m1 = ensureNotNull; + //endregion + return _; +})); + +//# sourceMappingURL=kotlin-kotlin-stdlib.js.map diff --git a/dist/ver-nodejs-app.js b/dist/ver-nodejs-app.js new file mode 100644 index 0000000..34bfdd7 --- /dev/null +++ b/dist/ver-nodejs-app.js @@ -0,0 +1,1577 @@ +(function (factory) { + if (typeof define === 'function' && define.amd) + define(['exports', './kotlin-kotlin-stdlib.js'], factory); + else if (typeof exports === 'object') + factory(module.exports, require('./kotlin-kotlin-stdlib.js')); + else { + if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') { + throw new Error("Error loading module 'ver-nodejs:app'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'ver-nodejs:app'."); + } + globalThis['ver-nodejs:app'] = factory(typeof globalThis['ver-nodejs:app'] === 'undefined' ? {} : globalThis['ver-nodejs:app'], globalThis['kotlin-kotlin-stdlib']); + } +}(function (_, kotlin_kotlin) { + 'use strict'; + //region block: imports + var imul = Math.imul; + var sort = kotlin_kotlin.$_$.m; + var replace = kotlin_kotlin.$_$.g1; + var THROW_CCE = kotlin_kotlin.$_$.l1; + var Unit_instance = kotlin_kotlin.$_$.e; + var protoOf = kotlin_kotlin.$_$.z; + var initMetadataForObject = kotlin_kotlin.$_$.w; + var charSequenceLength = kotlin_kotlin.$_$.o; + var emptyMap = kotlin_kotlin.$_$.h; + var startsWith = kotlin_kotlin.$_$.i1; + var endsWith = kotlin_kotlin.$_$.f1; + var contains = kotlin_kotlin.$_$.c1; + var sorted = kotlin_kotlin.$_$.l; + var substring = kotlin_kotlin.$_$.k1; + var VOID = kotlin_kotlin.$_$.a; + var split = kotlin_kotlin.$_$.h1; + var first = kotlin_kotlin.$_$.i; + var last = kotlin_kotlin.$_$.j; + var isArray = kotlin_kotlin.$_$.x; + var KtMap = kotlin_kotlin.$_$.f; + var isInterface = kotlin_kotlin.$_$.y; + var toString = kotlin_kotlin.$_$.a1; + var hashCode = kotlin_kotlin.$_$.t; + var getStringHashCode = kotlin_kotlin.$_$.s; + var getBooleanHashCode = kotlin_kotlin.$_$.r; + var equals = kotlin_kotlin.$_$.q; + var defineProp = kotlin_kotlin.$_$.p; + var initMetadataForClass = kotlin_kotlin.$_$.u; + var initMetadataForInterface = kotlin_kotlin.$_$.v; + var ArrayList_init_$Create$ = kotlin_kotlin.$_$.b; + var Default_getInstance = kotlin_kotlin.$_$.d; + var decodeToString = kotlin_kotlin.$_$.d1; + var substring_0 = kotlin_kotlin.$_$.j1; + var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.c; + var copyToArray = kotlin_kotlin.$_$.g; + var ensureNotNull = kotlin_kotlin.$_$.m1; + var println = kotlin_kotlin.$_$.n; + var last_0 = kotlin_kotlin.$_$.k; + var dropLast = kotlin_kotlin.$_$.e1; + var capitalize = kotlin_kotlin.$_$.b1; + //endregion + //region block: pre-declaration + initMetadataForObject(AppProto, 'AppProto'); + function fieldAny(name) { + return this.field(name); + } + initMetadataForInterface(KDContext, 'KDContext'); + initMetadataForClass(AppContext, 'AppContext', AppContext, VOID, [KDContext]); + initMetadataForClass(KDController, 'KDController'); + //endregion + var APP_KD_IMPORT; + var APP_KD_PACKAGE; + function appCtrl() { + return AppProto_getInstance().e9_1; + } + function appShouldCollectEntityComments(c) { + if (c.f9_1 === 'entityNames') { + c.entityComments = parseEntityComments(c.inputFileLines); + c.f9_1 = 'entityComments'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectEntityFieldComments(c) { + if (c.f9_1 === 'entityFields') { + c.entityFieldComments = parseEntityFieldComments(c.inputFileLines); + c.f9_1 = 'entityFieldComments'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectEntityFields(c) { + if (c.f9_1 === 'entityTypes') { + c.entityFields = parseEntityFields(c.inputFileLines); + c.f9_1 = 'entityFields'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectEntityNames(c) { + if (c.f9_1 === 'inputFileLines') { + c.entityNames = parseEntityNames(c.inputFileLines); + c.f9_1 = 'entityNames'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectEntityPrefixesKotlin(c) { + if (c.f9_1 === 'entityComments') { + c.entityPrefixesKotlin = parseEntityPrefixes(c.inputFileLines, ' prefix-kotlin: '); + c.f9_1 = 'entityPrefixesKotlin'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectEntityTypes(c) { + if (c.f9_1 === 'entityComments') { + c.entityTypes = parseEntityTypes(c.inputFileLines); + c.f9_1 = 'entityTypes'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectRawKotlin(c) { + if (c.f9_1 === 'inputFileLines') { + c.rawKotlin = parseRawKotlin(c.inputFileLines); + c.f9_1 = 'rawKotlin'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldGenerateKotlinEntities(c) { + if (c.f9_1 === 'entityFieldComments') { + c.outputEntityContents = genKotlinEntitiesFile(c.entityComments, c.entityFieldComments, c.entityFields, c.entityNames, c.entityPrefixesKotlin, c.entityTypes, c.rawKotlin); + c.f9_1 = 'outputEntityContents'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldParseInputFilePath(c) { + if (c.f9_1 === 'didLaunch' && cliArgumentValue(c.arguments, '--file').length > 0) { + c.inputFile = cliArgumentValue(c.arguments, '--file'); + c.f9_1 = 'inputFile'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldParseOutputFilePath(c) { + if (c.f9_1 === 'didLaunch' && cliArgumentValue(c.arguments, '--out').length > 0) { + c.outputFile = cliArgumentValue(c.arguments, '--out'); + c.f9_1 = 'outputFile'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldPrintToConsole(c) { + var tmp; + if (c.f9_1 === 'didLaunch') { + // Inline function 'kotlin.collections.isEmpty' call + tmp = c.arguments.length === 0; + } else { + tmp = false; + } + if (tmp) { + c.consoleOutput = 'Usage: {bin} --file=/path/to/file.yml --out=/path/to/file.kt'; + c.f9_1 = 'consoleOutput'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldResetOutputFieldContents(c) { + if (c.f9_1 === 'outputKDContents') { + var fields = collectFields(c.entityFields); + // Inline function 'kotlin.collections.plus' call + // Inline function 'kotlin.js.asDynamic' call + var tmp$ret$0 = fields; + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + var tmp$ret$3 = ['none']; + fields = tmp$ret$0.concat(tmp$ret$3); + sort(fields); + c.outputFieldContents = genFObject(fields); + c.f9_1 = 'outputFieldContents'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldResetOutputFileContents(c) { + if (c.f9_1 === 'outputFieldContents') { + c.outputFileContents = c.outputEntityContents + c.outputKDContents + c.outputFieldContents; + c.f9_1 = 'outputFileContents'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldResetOutputKDContents(c) { + if (c.f9_1 === 'outputEntityContents') { + var contents = base64ToString(get_emb64()); + c.outputKDContents = replace(replace(contents, APP_KD_IMPORT, ''), APP_KD_PACKAGE, ''); + c.f9_1 = 'outputKDContents'; + return c; + } + c.f9_1 = 'none'; + return c; + } + function appShouldCollectEntityComments$ref() { + var l = function (p0) { + return appShouldCollectEntityComments(p0); + }; + l.callableName = 'appShouldCollectEntityComments'; + return l; + } + function appShouldCollectEntityFieldComments$ref() { + var l = function (p0) { + return appShouldCollectEntityFieldComments(p0); + }; + l.callableName = 'appShouldCollectEntityFieldComments'; + return l; + } + function appShouldCollectEntityFields$ref() { + var l = function (p0) { + return appShouldCollectEntityFields(p0); + }; + l.callableName = 'appShouldCollectEntityFields'; + return l; + } + function appShouldCollectEntityNames$ref() { + var l = function (p0) { + return appShouldCollectEntityNames(p0); + }; + l.callableName = 'appShouldCollectEntityNames'; + return l; + } + function appShouldCollectEntityPrefixesKotlin$ref() { + var l = function (p0) { + return appShouldCollectEntityPrefixesKotlin(p0); + }; + l.callableName = 'appShouldCollectEntityPrefixesKotlin'; + return l; + } + function appShouldCollectEntityTypes$ref() { + var l = function (p0) { + return appShouldCollectEntityTypes(p0); + }; + l.callableName = 'appShouldCollectEntityTypes'; + return l; + } + function appShouldCollectRawKotlin$ref() { + var l = function (p0) { + return appShouldCollectRawKotlin(p0); + }; + l.callableName = 'appShouldCollectRawKotlin'; + return l; + } + function appShouldGenerateKotlinEntities$ref() { + var l = function (p0) { + return appShouldGenerateKotlinEntities(p0); + }; + l.callableName = 'appShouldGenerateKotlinEntities'; + return l; + } + function appShouldParseInputFilePath$ref() { + var l = function (p0) { + return appShouldParseInputFilePath(p0); + }; + l.callableName = 'appShouldParseInputFilePath'; + return l; + } + function appShouldPrintToConsole$ref() { + var l = function (p0) { + return appShouldPrintToConsole(p0); + }; + l.callableName = 'appShouldPrintToConsole'; + return l; + } + function appShouldParseOutputFilePath$ref() { + var l = function (p0) { + return appShouldParseOutputFilePath(p0); + }; + l.callableName = 'appShouldParseOutputFilePath'; + return l; + } + function appShouldResetOutputFieldContents$ref() { + var l = function (p0) { + return appShouldResetOutputFieldContents(p0); + }; + l.callableName = 'appShouldResetOutputFieldContents'; + return l; + } + function appShouldResetOutputFileContents$ref() { + var l = function (p0) { + return appShouldResetOutputFileContents(p0); + }; + l.callableName = 'appShouldResetOutputFileContents'; + return l; + } + function appShouldResetOutputKDContents$ref() { + var l = function (p0) { + return appShouldResetOutputKDContents(p0); + }; + l.callableName = 'appShouldResetOutputKDContents'; + return l; + } + function AppProto$lambda($f) { + return function (c) { + return $f(c instanceof AppContext ? c : THROW_CCE()); + }; + } + function AppProto() { + AppProto_instance = this; + this.e9_1 = new KDController(new AppContext()); + setupComponentDebugging(this.e9_1, 'App'); + var tmp = appShouldCollectEntityComments$ref(); + var tmp_0 = appShouldCollectEntityFieldComments$ref(); + var tmp_1 = appShouldCollectEntityFields$ref(); + var tmp_2 = appShouldCollectEntityNames$ref(); + var tmp_3 = appShouldCollectEntityPrefixesKotlin$ref(); + var tmp_4 = appShouldCollectEntityTypes$ref(); + var tmp_5 = appShouldCollectRawKotlin$ref(); + var tmp_6 = appShouldGenerateKotlinEntities$ref(); + var tmp_7 = appShouldParseInputFilePath$ref(); + var tmp_8 = appShouldPrintToConsole$ref(); + var tmp_9 = appShouldParseOutputFilePath$ref(); + var tmp_10 = appShouldResetOutputFieldContents$ref(); + var tmp_11 = appShouldResetOutputFileContents$ref(); + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.collections.forEach' call + var indexedObject = [tmp, tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, tmp_6, tmp_7, tmp_8, tmp_9, tmp_10, tmp_11, appShouldResetOutputKDContents$ref()]; + var inductionVariable = 0; + var last = indexedObject.length; + while (inductionVariable < last) { + var element = indexedObject[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + this.e9_1.registerFunction(AppProto$lambda(element)); + } + } + var AppProto_instance; + function AppProto_getInstance() { + if (AppProto_instance == null) + new AppProto(); + return AppProto_instance; + } + function get_emb64() { + return emb64; + } + var emb64; + function genKotlinComment(comment) { + // Inline function 'kotlin.text.isEmpty' call + if (!(charSequenceLength(comment) === 0)) { + return '// ' + comment; + } + return ''; + } + function genKotlinEntitiesFile(entityComments, entityFieldComments, entityFields, entityNames, entityPrefixes, entityTypes, rawKotlin) { + var s = rawKotlin; + var id = 0; + var inductionVariable = 0; + var last = entityNames.length; + while (inductionVariable < last) { + var name = entityNames[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + var tmp0_elvis_lhs = entityComments.v(id); + var comment = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs; + var tmp1_elvis_lhs = entityPrefixes.v(id); + var prefix = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs; + var tmp2_elvis_lhs = entityTypes.v(id); + var type = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs; + var tmp3_elvis_lhs = entityFieldComments.v(id); + var tmp; + if (tmp3_elvis_lhs == null) { + // Inline function 'kotlin.collections.mapOf' call + tmp = emptyMap(); + } else { + tmp = tmp3_elvis_lhs; + } + var fieldComments = tmp; + var tmp4_elvis_lhs = entityFields.v(id); + var tmp_0; + if (tmp4_elvis_lhs == null) { + // Inline function 'kotlin.collections.mapOf' call + tmp_0 = emptyMap(); + } else { + tmp_0 = tmp4_elvis_lhs; + } + var fields = tmp_0; + s = s + genKotlinEntity(comment, fieldComments, fields, name, prefix, type); + id = id + 1 | 0; + } + return s; + } + function genKotlinEntity(comment, fieldComments, fields, name, prefix, type) { + var template = '\n%COMMENT%\n%PREFIX%\ndata class %NAME%(\n%FIELDS%\n) {}\n'; + if (type === 'context') { + template = '\n%COMMENT%\n%PREFIX%\ndata class %NAME%(\n%FIELDS%\n override var recentField: String = "",\n): KDContext {\n override fun field(name: String): T {\n%GETTERS% }\n return "unknown-field-name" as T\n }\n\n override fun selfCopy(): KDContext {\n return this.copy()\n }\n\n override fun setField(\n name: String,\n value: Any?\n ) {\n%SETTERS% }\n }\n}\n'; + } + var genComment = genKotlinComment(comment); + var genFields = genKotlinFields(fieldComments, fields); + var genGetters = genKotlinGetters(fields); + var genSetters = genKotlinSetters(fields); + return replace(replace(replace(replace(replace(replace(template, '%NAME%', name), '%COMMENT%', genComment), '%FIELDS%', genFields), '%GETTERS%', genGetters), '%PREFIX%', prefix), '%SETTERS%', genSetters); + } + function genKotlinField(comment, name, ymlType) { + var contents = ''; + // Inline function 'kotlin.text.isEmpty' call + if (!(charSequenceLength(comment) === 0)) { + contents = contents + (' // ' + comment + '\n'); + } + var default_0 = genKotlinFieldDefault(ymlType); + var type = genKotlinFieldType(ymlType); + contents = contents + replace(replace(replace(' var %NAME%: %TYPE% = %DEFAULT%,', '%NAME%', name), '%TYPE%', type), '%DEFAULT%', default_0); + return contents; + } + function genKotlinFieldDefault(type) { + if (type === 'Bool') { + return 'false'; + } + if (type === 'Double') { + return '0'; + } + if (type === 'Int') { + return '0'; + } + if (type === 'Long') { + return '0'; + } + if (type === 'String') { + return '""'; + } + if (startsWith(type, '[') && endsWith(type, ']') && !contains(type, ': ')) { + return 'arrayOf()'; + } + if (startsWith(type, '[') && endsWith(type, ']') && contains(type, ': ')) { + return 'mapOf()'; + } + return type + '()'; + } + function genKotlinFields(fieldComments, fields) { + var contents = ''; + var sortedFieldNames = sorted(fields.w()); + var _iterator__ex2g4s = sortedFieldNames.f(); + while (_iterator__ex2g4s.g()) { + var name = _iterator__ex2g4s.h(); + // Inline function 'kotlin.text.isEmpty' call + var this_0 = contents; + if (!(charSequenceLength(this_0) === 0)) { + contents = contents + '\n'; + } + var tmp0_elvis_lhs = fieldComments.v(name); + var comment = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs; + var tmp1_elvis_lhs = fields.v(name); + var type = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs; + contents = contents + genKotlinField(comment, name, type); + } + return contents; + } + function genKotlinFieldType(type) { + if (type === 'Bool') { + return 'Boolean'; + } + if (type === 'Double') { + return 'Double'; + } + if (type === 'Long') { + return 'Long'; + } + if (startsWith(type, '[') && endsWith(type, ']') && !contains(type, ': ')) { + var innerString = substring(type, 1, type.length - 1 | 0); + var innerType = genKotlinFieldType(innerString); + return 'Array<' + innerType + '>'; + } + if (startsWith(type, '[') && endsWith(type, ']') && contains(type, ': ')) { + var innerString_0 = substring(type, 1, type.length - 1 | 0); + var parts = split(innerString_0, [': '], VOID, 2); + var innerTypeA = genKotlinFieldType(first(parts)); + var innerTypeB = genKotlinFieldType(last(parts)); + return 'Map<' + innerTypeA + ', ' + innerTypeB + '>'; + } + return type; + } + function genKotlinGetter(isFirst, name) { + var template = ' } else if (name == "%NAME%") {\n return %NAME% as T\n'; + if (isFirst) { + template = ' if (name == "%NAME%") {\n return %NAME% as T\n'; + } + var contents = ''; + contents = contents + replace(template, '%NAME%', name); + return contents; + } + function genKotlinGetters(fields) { + var contents = ''; + var isFirst = true; + var sortedFieldNames = sorted(fields.w()); + var _iterator__ex2g4s = sortedFieldNames.f(); + while (_iterator__ex2g4s.g()) { + var name = _iterator__ex2g4s.h(); + contents = contents + genKotlinGetter(isFirst, name); + isFirst = false; + } + return contents; + } + function genKotlinSetter(isFirst, name, ymlType) { + var template = ' } else if (name == "%NAME%") {\n %NAME% = value as %TYPE%\n'; + if (isFirst) { + template = ' if (name == "%NAME%") {\n %NAME% = value as %TYPE%\n'; + } + var contents = ''; + var type = genKotlinFieldType(ymlType); + contents = contents + replace(replace(template, '%NAME%', name), '%TYPE%', type); + return contents; + } + function genKotlinSetters(fields) { + var contents = ''; + var isFirst = true; + var sortedFieldNames = sorted(fields.w()); + var _iterator__ex2g4s = sortedFieldNames.f(); + while (_iterator__ex2g4s.g()) { + var name = _iterator__ex2g4s.h(); + var tmp0_elvis_lhs = fields.v(name); + var type = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs; + contents = contents + genKotlinSetter(isFirst, name, type); + isFirst = false; + } + return contents; + } + var KD_FIELD_NONE; + function AppContext(arguments_0, consoleOutput, didLaunch, didWriteOutputFile, entityComments, entityFieldComments, entityFields, entityNames, entityPrefixesKotlin, entityTypes, inputFile, inputFileLines, isDbg, outputEntityContents, outputFieldContents, outputFile, outputFileContents, outputKDContents, rawKotlin, recentField) { + var tmp; + if (arguments_0 === VOID) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + tmp = []; + } else { + tmp = arguments_0; + } + arguments_0 = tmp; + consoleOutput = consoleOutput === VOID ? '' : consoleOutput; + didLaunch = didLaunch === VOID ? false : didLaunch; + didWriteOutputFile = didWriteOutputFile === VOID ? false : didWriteOutputFile; + var tmp_0; + if (entityComments === VOID) { + // Inline function 'kotlin.collections.mapOf' call + tmp_0 = emptyMap(); + } else { + tmp_0 = entityComments; + } + entityComments = tmp_0; + var tmp_1; + if (entityFieldComments === VOID) { + // Inline function 'kotlin.collections.mapOf' call + tmp_1 = emptyMap(); + } else { + tmp_1 = entityFieldComments; + } + entityFieldComments = tmp_1; + var tmp_2; + if (entityFields === VOID) { + // Inline function 'kotlin.collections.mapOf' call + tmp_2 = emptyMap(); + } else { + tmp_2 = entityFields; + } + entityFields = tmp_2; + var tmp_3; + if (entityNames === VOID) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + tmp_3 = []; + } else { + tmp_3 = entityNames; + } + entityNames = tmp_3; + var tmp_4; + if (entityPrefixesKotlin === VOID) { + // Inline function 'kotlin.collections.mapOf' call + tmp_4 = emptyMap(); + } else { + tmp_4 = entityPrefixesKotlin; + } + entityPrefixesKotlin = tmp_4; + var tmp_5; + if (entityTypes === VOID) { + // Inline function 'kotlin.collections.mapOf' call + tmp_5 = emptyMap(); + } else { + tmp_5 = entityTypes; + } + entityTypes = tmp_5; + inputFile = inputFile === VOID ? '' : inputFile; + var tmp_6; + if (inputFileLines === VOID) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + tmp_6 = []; + } else { + tmp_6 = inputFileLines; + } + inputFileLines = tmp_6; + isDbg = isDbg === VOID ? false : isDbg; + outputEntityContents = outputEntityContents === VOID ? '' : outputEntityContents; + outputFieldContents = outputFieldContents === VOID ? '' : outputFieldContents; + outputFile = outputFile === VOID ? '' : outputFile; + outputFileContents = outputFileContents === VOID ? '' : outputFileContents; + outputKDContents = outputKDContents === VOID ? '' : outputKDContents; + rawKotlin = rawKotlin === VOID ? '' : rawKotlin; + recentField = recentField === VOID ? '' : recentField; + this.arguments = arguments_0; + this.consoleOutput = consoleOutput; + this.didLaunch = didLaunch; + this.didWriteOutputFile = didWriteOutputFile; + this.entityComments = entityComments; + this.entityFieldComments = entityFieldComments; + this.entityFields = entityFields; + this.entityNames = entityNames; + this.entityPrefixesKotlin = entityPrefixesKotlin; + this.entityTypes = entityTypes; + this.inputFile = inputFile; + this.inputFileLines = inputFileLines; + this.isDbg = isDbg; + this.outputEntityContents = outputEntityContents; + this.outputFieldContents = outputFieldContents; + this.outputFile = outputFile; + this.outputFileContents = outputFileContents; + this.outputKDContents = outputKDContents; + this.rawKotlin = rawKotlin; + this.f9_1 = recentField; + } + protoOf(AppContext).g9 = function (_set____db54di) { + this.arguments = _set____db54di; + }; + protoOf(AppContext).h9 = function () { + return this.arguments; + }; + protoOf(AppContext).i9 = function (_set____db54di) { + this.consoleOutput = _set____db54di; + }; + protoOf(AppContext).j9 = function () { + return this.consoleOutput; + }; + protoOf(AppContext).k9 = function (_set____db54di) { + this.didLaunch = _set____db54di; + }; + protoOf(AppContext).l9 = function () { + return this.didLaunch; + }; + protoOf(AppContext).m9 = function (_set____db54di) { + this.didWriteOutputFile = _set____db54di; + }; + protoOf(AppContext).n9 = function () { + return this.didWriteOutputFile; + }; + protoOf(AppContext).o9 = function (_set____db54di) { + this.entityComments = _set____db54di; + }; + protoOf(AppContext).p9 = function () { + return this.entityComments; + }; + protoOf(AppContext).q9 = function (_set____db54di) { + this.entityFieldComments = _set____db54di; + }; + protoOf(AppContext).r9 = function () { + return this.entityFieldComments; + }; + protoOf(AppContext).s9 = function (_set____db54di) { + this.entityFields = _set____db54di; + }; + protoOf(AppContext).t9 = function () { + return this.entityFields; + }; + protoOf(AppContext).u9 = function (_set____db54di) { + this.entityNames = _set____db54di; + }; + protoOf(AppContext).v9 = function () { + return this.entityNames; + }; + protoOf(AppContext).w9 = function (_set____db54di) { + this.entityPrefixesKotlin = _set____db54di; + }; + protoOf(AppContext).x9 = function () { + return this.entityPrefixesKotlin; + }; + protoOf(AppContext).y9 = function (_set____db54di) { + this.entityTypes = _set____db54di; + }; + protoOf(AppContext).z9 = function () { + return this.entityTypes; + }; + protoOf(AppContext).aa = function (_set____db54di) { + this.inputFile = _set____db54di; + }; + protoOf(AppContext).ba = function () { + return this.inputFile; + }; + protoOf(AppContext).ca = function (_set____db54di) { + this.inputFileLines = _set____db54di; + }; + protoOf(AppContext).da = function () { + return this.inputFileLines; + }; + protoOf(AppContext).ea = function (_set____db54di) { + this.isDbg = _set____db54di; + }; + protoOf(AppContext).fa = function () { + return this.isDbg; + }; + protoOf(AppContext).ga = function (_set____db54di) { + this.outputEntityContents = _set____db54di; + }; + protoOf(AppContext).ha = function () { + return this.outputEntityContents; + }; + protoOf(AppContext).ia = function (_set____db54di) { + this.outputFieldContents = _set____db54di; + }; + protoOf(AppContext).ja = function () { + return this.outputFieldContents; + }; + protoOf(AppContext).ka = function (_set____db54di) { + this.outputFile = _set____db54di; + }; + protoOf(AppContext).la = function () { + return this.outputFile; + }; + protoOf(AppContext).ma = function (_set____db54di) { + this.outputFileContents = _set____db54di; + }; + protoOf(AppContext).na = function () { + return this.outputFileContents; + }; + protoOf(AppContext).oa = function (_set____db54di) { + this.outputKDContents = _set____db54di; + }; + protoOf(AppContext).pa = function () { + return this.outputKDContents; + }; + protoOf(AppContext).qa = function (_set____db54di) { + this.rawKotlin = _set____db54di; + }; + protoOf(AppContext).ra = function () { + return this.rawKotlin; + }; + protoOf(AppContext).sa = function (_set____db54di) { + this.f9_1 = _set____db54di; + }; + protoOf(AppContext).ta = function () { + return this.f9_1; + }; + protoOf(AppContext).field = function (name) { + switch (name) { + case 'arguments': + var tmp = this.arguments; + return !(tmp == null) ? tmp : THROW_CCE(); + case 'consoleOutput': + var tmp_0 = this.consoleOutput; + return !(tmp_0 == null) ? tmp_0 : THROW_CCE(); + case 'didLaunch': + var tmp_1 = this.didLaunch; + return !(tmp_1 == null) ? tmp_1 : THROW_CCE(); + case 'didWriteOutputFile': + var tmp_2 = this.didWriteOutputFile; + return !(tmp_2 == null) ? tmp_2 : THROW_CCE(); + case 'entityComments': + var tmp_3 = this.entityComments; + return !(tmp_3 == null) ? tmp_3 : THROW_CCE(); + case 'entityFieldComments': + var tmp_4 = this.entityFieldComments; + return !(tmp_4 == null) ? tmp_4 : THROW_CCE(); + case 'entityFields': + var tmp_5 = this.entityFields; + return !(tmp_5 == null) ? tmp_5 : THROW_CCE(); + case 'entityNames': + var tmp_6 = this.entityNames; + return !(tmp_6 == null) ? tmp_6 : THROW_CCE(); + case 'entityPrefixesKotlin': + var tmp_7 = this.entityPrefixesKotlin; + return !(tmp_7 == null) ? tmp_7 : THROW_CCE(); + case 'entityTypes': + var tmp_8 = this.entityTypes; + return !(tmp_8 == null) ? tmp_8 : THROW_CCE(); + case 'inputFile': + var tmp_9 = this.inputFile; + return !(tmp_9 == null) ? tmp_9 : THROW_CCE(); + case 'inputFileLines': + var tmp_10 = this.inputFileLines; + return !(tmp_10 == null) ? tmp_10 : THROW_CCE(); + case 'isDbg': + var tmp_11 = this.isDbg; + return !(tmp_11 == null) ? tmp_11 : THROW_CCE(); + case 'outputEntityContents': + var tmp_12 = this.outputEntityContents; + return !(tmp_12 == null) ? tmp_12 : THROW_CCE(); + case 'outputFieldContents': + var tmp_13 = this.outputFieldContents; + return !(tmp_13 == null) ? tmp_13 : THROW_CCE(); + case 'outputFile': + var tmp_14 = this.outputFile; + return !(tmp_14 == null) ? tmp_14 : THROW_CCE(); + case 'outputFileContents': + var tmp_15 = this.outputFileContents; + return !(tmp_15 == null) ? tmp_15 : THROW_CCE(); + case 'outputKDContents': + var tmp_16 = this.outputKDContents; + return !(tmp_16 == null) ? tmp_16 : THROW_CCE(); + case 'rawKotlin': + var tmp_17 = this.rawKotlin; + return !(tmp_17 == null) ? tmp_17 : THROW_CCE(); + } + return !('unknown-field-name' == null) ? 'unknown-field-name' : THROW_CCE(); + }; + protoOf(AppContext).selfCopy = function () { + return this.copy(); + }; + protoOf(AppContext).setField = function (name, value) { + switch (name) { + case 'arguments': + var tmp = this; + tmp.arguments = (!(value == null) ? isArray(value) : false) ? value : THROW_CCE(); + break; + case 'consoleOutput': + var tmp_0 = this; + tmp_0.consoleOutput = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'didLaunch': + var tmp_1 = this; + tmp_1.didLaunch = (!(value == null) ? typeof value === 'boolean' : false) ? value : THROW_CCE(); + break; + case 'didWriteOutputFile': + var tmp_2 = this; + tmp_2.didWriteOutputFile = (!(value == null) ? typeof value === 'boolean' : false) ? value : THROW_CCE(); + break; + case 'entityComments': + var tmp_3 = this; + tmp_3.entityComments = (!(value == null) ? isInterface(value, KtMap) : false) ? value : THROW_CCE(); + break; + case 'entityFieldComments': + var tmp_4 = this; + tmp_4.entityFieldComments = (!(value == null) ? isInterface(value, KtMap) : false) ? value : THROW_CCE(); + break; + case 'entityFields': + var tmp_5 = this; + tmp_5.entityFields = (!(value == null) ? isInterface(value, KtMap) : false) ? value : THROW_CCE(); + break; + case 'entityNames': + var tmp_6 = this; + tmp_6.entityNames = (!(value == null) ? isArray(value) : false) ? value : THROW_CCE(); + break; + case 'entityPrefixesKotlin': + var tmp_7 = this; + tmp_7.entityPrefixesKotlin = (!(value == null) ? isInterface(value, KtMap) : false) ? value : THROW_CCE(); + break; + case 'entityTypes': + var tmp_8 = this; + tmp_8.entityTypes = (!(value == null) ? isInterface(value, KtMap) : false) ? value : THROW_CCE(); + break; + case 'inputFile': + var tmp_9 = this; + tmp_9.inputFile = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'inputFileLines': + var tmp_10 = this; + tmp_10.inputFileLines = (!(value == null) ? isArray(value) : false) ? value : THROW_CCE(); + break; + case 'isDbg': + var tmp_11 = this; + tmp_11.isDbg = (!(value == null) ? typeof value === 'boolean' : false) ? value : THROW_CCE(); + break; + case 'outputEntityContents': + var tmp_12 = this; + tmp_12.outputEntityContents = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'outputFieldContents': + var tmp_13 = this; + tmp_13.outputFieldContents = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'outputFile': + var tmp_14 = this; + tmp_14.outputFile = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'outputFileContents': + var tmp_15 = this; + tmp_15.outputFileContents = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'outputKDContents': + var tmp_16 = this; + tmp_16.outputKDContents = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + case 'rawKotlin': + var tmp_17 = this; + tmp_17.rawKotlin = (!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE(); + break; + } + }; + protoOf(AppContext).c9 = function () { + return this.arguments; + }; + protoOf(AppContext).d9 = function () { + return this.consoleOutput; + }; + protoOf(AppContext).ua = function () { + return this.didLaunch; + }; + protoOf(AppContext).va = function () { + return this.didWriteOutputFile; + }; + protoOf(AppContext).wa = function () { + return this.entityComments; + }; + protoOf(AppContext).xa = function () { + return this.entityFieldComments; + }; + protoOf(AppContext).ya = function () { + return this.entityFields; + }; + protoOf(AppContext).za = function () { + return this.entityNames; + }; + protoOf(AppContext).ab = function () { + return this.entityPrefixesKotlin; + }; + protoOf(AppContext).bb = function () { + return this.entityTypes; + }; + protoOf(AppContext).cb = function () { + return this.inputFile; + }; + protoOf(AppContext).db = function () { + return this.inputFileLines; + }; + protoOf(AppContext).eb = function () { + return this.isDbg; + }; + protoOf(AppContext).fb = function () { + return this.outputEntityContents; + }; + protoOf(AppContext).gb = function () { + return this.outputFieldContents; + }; + protoOf(AppContext).hb = function () { + return this.outputFile; + }; + protoOf(AppContext).ib = function () { + return this.outputFileContents; + }; + protoOf(AppContext).jb = function () { + return this.outputKDContents; + }; + protoOf(AppContext).kb = function () { + return this.rawKotlin; + }; + protoOf(AppContext).lb = function () { + return this.f9_1; + }; + protoOf(AppContext).mb = function (arguments_0, consoleOutput, didLaunch, didWriteOutputFile, entityComments, entityFieldComments, entityFields, entityNames, entityPrefixesKotlin, entityTypes, inputFile, inputFileLines, isDbg, outputEntityContents, outputFieldContents, outputFile, outputFileContents, outputKDContents, rawKotlin, recentField) { + return new AppContext(arguments_0, consoleOutput, didLaunch, didWriteOutputFile, entityComments, entityFieldComments, entityFields, entityNames, entityPrefixesKotlin, entityTypes, inputFile, inputFileLines, isDbg, outputEntityContents, outputFieldContents, outputFile, outputFileContents, outputKDContents, rawKotlin, recentField); + }; + protoOf(AppContext).copy = function (arguments_0, consoleOutput, didLaunch, didWriteOutputFile, entityComments, entityFieldComments, entityFields, entityNames, entityPrefixesKotlin, entityTypes, inputFile, inputFileLines, isDbg, outputEntityContents, outputFieldContents, outputFile, outputFileContents, outputKDContents, rawKotlin, recentField, $super) { + arguments_0 = arguments_0 === VOID ? this.arguments : arguments_0; + consoleOutput = consoleOutput === VOID ? this.consoleOutput : consoleOutput; + didLaunch = didLaunch === VOID ? this.didLaunch : didLaunch; + didWriteOutputFile = didWriteOutputFile === VOID ? this.didWriteOutputFile : didWriteOutputFile; + entityComments = entityComments === VOID ? this.entityComments : entityComments; + entityFieldComments = entityFieldComments === VOID ? this.entityFieldComments : entityFieldComments; + entityFields = entityFields === VOID ? this.entityFields : entityFields; + entityNames = entityNames === VOID ? this.entityNames : entityNames; + entityPrefixesKotlin = entityPrefixesKotlin === VOID ? this.entityPrefixesKotlin : entityPrefixesKotlin; + entityTypes = entityTypes === VOID ? this.entityTypes : entityTypes; + inputFile = inputFile === VOID ? this.inputFile : inputFile; + inputFileLines = inputFileLines === VOID ? this.inputFileLines : inputFileLines; + isDbg = isDbg === VOID ? this.isDbg : isDbg; + outputEntityContents = outputEntityContents === VOID ? this.outputEntityContents : outputEntityContents; + outputFieldContents = outputFieldContents === VOID ? this.outputFieldContents : outputFieldContents; + outputFile = outputFile === VOID ? this.outputFile : outputFile; + outputFileContents = outputFileContents === VOID ? this.outputFileContents : outputFileContents; + outputKDContents = outputKDContents === VOID ? this.outputKDContents : outputKDContents; + rawKotlin = rawKotlin === VOID ? this.rawKotlin : rawKotlin; + recentField = recentField === VOID ? this.f9_1 : recentField; + return $super === VOID ? this.mb(arguments_0, consoleOutput, didLaunch, didWriteOutputFile, entityComments, entityFieldComments, entityFields, entityNames, entityPrefixesKotlin, entityTypes, inputFile, inputFileLines, isDbg, outputEntityContents, outputFieldContents, outputFile, outputFileContents, outputKDContents, rawKotlin, recentField) : $super.mb.call(this, arguments_0, consoleOutput, didLaunch, didWriteOutputFile, entityComments, entityFieldComments, entityFields, entityNames, entityPrefixesKotlin, entityTypes, inputFile, inputFileLines, isDbg, outputEntityContents, outputFieldContents, outputFile, outputFileContents, outputKDContents, rawKotlin, recentField); + }; + protoOf(AppContext).toString = function () { + return 'AppContext(arguments=' + toString(this.arguments) + ', consoleOutput=' + this.consoleOutput + ', didLaunch=' + this.didLaunch + ', didWriteOutputFile=' + this.didWriteOutputFile + ', entityComments=' + toString(this.entityComments) + ', entityFieldComments=' + toString(this.entityFieldComments) + ', entityFields=' + toString(this.entityFields) + ', entityNames=' + toString(this.entityNames) + ', entityPrefixesKotlin=' + toString(this.entityPrefixesKotlin) + ', entityTypes=' + toString(this.entityTypes) + ', inputFile=' + this.inputFile + ', inputFileLines=' + toString(this.inputFileLines) + ', isDbg=' + this.isDbg + ', outputEntityContents=' + this.outputEntityContents + ', outputFieldContents=' + this.outputFieldContents + ', outputFile=' + this.outputFile + ', outputFileContents=' + this.outputFileContents + ', outputKDContents=' + this.outputKDContents + ', rawKotlin=' + this.rawKotlin + ', recentField=' + this.f9_1 + ')'; + }; + protoOf(AppContext).hashCode = function () { + var result = hashCode(this.arguments); + result = imul(result, 31) + getStringHashCode(this.consoleOutput) | 0; + result = imul(result, 31) + getBooleanHashCode(this.didLaunch) | 0; + result = imul(result, 31) + getBooleanHashCode(this.didWriteOutputFile) | 0; + result = imul(result, 31) + hashCode(this.entityComments) | 0; + result = imul(result, 31) + hashCode(this.entityFieldComments) | 0; + result = imul(result, 31) + hashCode(this.entityFields) | 0; + result = imul(result, 31) + hashCode(this.entityNames) | 0; + result = imul(result, 31) + hashCode(this.entityPrefixesKotlin) | 0; + result = imul(result, 31) + hashCode(this.entityTypes) | 0; + result = imul(result, 31) + getStringHashCode(this.inputFile) | 0; + result = imul(result, 31) + hashCode(this.inputFileLines) | 0; + result = imul(result, 31) + getBooleanHashCode(this.isDbg) | 0; + result = imul(result, 31) + getStringHashCode(this.outputEntityContents) | 0; + result = imul(result, 31) + getStringHashCode(this.outputFieldContents) | 0; + result = imul(result, 31) + getStringHashCode(this.outputFile) | 0; + result = imul(result, 31) + getStringHashCode(this.outputFileContents) | 0; + result = imul(result, 31) + getStringHashCode(this.outputKDContents) | 0; + result = imul(result, 31) + getStringHashCode(this.rawKotlin) | 0; + result = imul(result, 31) + getStringHashCode(this.f9_1) | 0; + return result; + }; + protoOf(AppContext).equals = function (other) { + if (this === other) + return true; + if (!(other instanceof AppContext)) + return false; + var tmp0_other_with_cast = other instanceof AppContext ? other : THROW_CCE(); + if (!equals(this.arguments, tmp0_other_with_cast.arguments)) + return false; + if (!(this.consoleOutput === tmp0_other_with_cast.consoleOutput)) + return false; + if (!(this.didLaunch === tmp0_other_with_cast.didLaunch)) + return false; + if (!(this.didWriteOutputFile === tmp0_other_with_cast.didWriteOutputFile)) + return false; + if (!equals(this.entityComments, tmp0_other_with_cast.entityComments)) + return false; + if (!equals(this.entityFieldComments, tmp0_other_with_cast.entityFieldComments)) + return false; + if (!equals(this.entityFields, tmp0_other_with_cast.entityFields)) + return false; + if (!equals(this.entityNames, tmp0_other_with_cast.entityNames)) + return false; + if (!equals(this.entityPrefixesKotlin, tmp0_other_with_cast.entityPrefixesKotlin)) + return false; + if (!equals(this.entityTypes, tmp0_other_with_cast.entityTypes)) + return false; + if (!(this.inputFile === tmp0_other_with_cast.inputFile)) + return false; + if (!equals(this.inputFileLines, tmp0_other_with_cast.inputFileLines)) + return false; + if (!(this.isDbg === tmp0_other_with_cast.isDbg)) + return false; + if (!(this.outputEntityContents === tmp0_other_with_cast.outputEntityContents)) + return false; + if (!(this.outputFieldContents === tmp0_other_with_cast.outputFieldContents)) + return false; + if (!(this.outputFile === tmp0_other_with_cast.outputFile)) + return false; + if (!(this.outputFileContents === tmp0_other_with_cast.outputFileContents)) + return false; + if (!(this.outputKDContents === tmp0_other_with_cast.outputKDContents)) + return false; + if (!(this.rawKotlin === tmp0_other_with_cast.rawKotlin)) + return false; + if (!(this.f9_1 === tmp0_other_with_cast.f9_1)) + return false; + return true; + }; + function KDContext() { + } + function KDController$registerFieldCallback$lambda($fieldName, $cb) { + return function (c) { + var tmp; + if (c.recentField === $fieldName) { + tmp = $cb(c); + } + return Unit_instance; + }; + } + function KDController(context) { + this.context = context; + var tmp = this; + // Inline function 'kotlin.collections.mutableListOf' call + tmp.nb_1 = ArrayList_init_$Create$(); + var tmp_0 = this; + // Inline function 'kotlin.collections.mutableListOf' call + tmp_0.ob_1 = ArrayList_init_$Create$(); + this.isProcessingQueue = false; + var tmp_1 = this; + // Inline function 'kotlin.collections.mutableListOf' call + tmp_1.pb_1 = ArrayList_init_$Create$(); + } + protoOf(KDController).qb = function (_set____db54di) { + this.context = _set____db54di; + }; + protoOf(KDController).rb = function () { + return this.context; + }; + protoOf(KDController).sb = function (_set____db54di) { + this.nb_1 = _set____db54di; + }; + protoOf(KDController).tb = function () { + return this.nb_1; + }; + protoOf(KDController).ub = function (_set____db54di) { + this.ob_1 = _set____db54di; + }; + protoOf(KDController).vb = function () { + return this.ob_1; + }; + protoOf(KDController).wb = function (_set____db54di) { + this.isProcessingQueue = _set____db54di; + }; + protoOf(KDController).xb = function () { + return this.isProcessingQueue; + }; + protoOf(KDController).yb = function (_set____db54di) { + this.pb_1 = _set____db54di; + }; + protoOf(KDController).zb = function () { + return this.pb_1; + }; + protoOf(KDController).executeFunctions = function () { + var c = this.pb_1.i2(0); + this.context.sa(c.recentField); + this.context.setField(c.recentField, c.fieldAny(c.recentField)); + var _iterator__ex2g4s = this.ob_1.f(); + while (_iterator__ex2g4s.g()) { + var f = _iterator__ex2g4s.h(); + var ctx = f(this.context.selfCopy()); + if (!(ctx.recentField === KD_FIELD_NONE)) { + this.pb_1.l(ctx); + } + } + this.reportContext(); + }; + protoOf(KDController).processQueue = function () { + if (this.isProcessingQueue) { + return Unit_instance; + } + this.isProcessingQueue = true; + while (this.pb_1.i() > 0) { + this.executeFunctions(); + } + this.isProcessingQueue = false; + }; + protoOf(KDController).registerCallback = function (cb) { + this.nb_1.l(cb); + }; + protoOf(KDController).registerFieldCallback = function (fieldName, cb) { + var tmp = this.nb_1; + tmp.l(KDController$registerFieldCallback$lambda(fieldName, cb)); + }; + protoOf(KDController).registerFunction = function (f) { + this.ob_1.l(f); + }; + protoOf(KDController).reportContext = function () { + var _iterator__ex2g4s = this.nb_1.f(); + while (_iterator__ex2g4s.g()) { + var cb = _iterator__ex2g4s.h(); + cb(this.context); + } + }; + protoOf(KDController).set = function (fieldName, value) { + var c = this.context.selfCopy(); + c.setField(fieldName, value); + c.sa(fieldName); + this.pb_1.l(c); + this.processQueue(); + }; + function registerOneliners(ctrl, items) { + var halfCount = items.length / 2 | 0; + var inductionVariable = 0; + if (inductionVariable < halfCount) + do { + var i = inductionVariable; + inductionVariable = inductionVariable + 1 | 0; + var tmp = items[imul(i, 2)]; + var field = typeof tmp === 'string' ? tmp : THROW_CCE(); + var tmp_0 = items[imul(i, 2) + 1 | 0]; + var callback = typeof tmp_0 === 'function' ? tmp_0 : THROW_CCE(); + ctrl.registerFieldCallback(field, callback); + } + while (inductionVariable < halfCount); + } + function base64ToString(b64) { + return decodeToString(Default_getInstance().z7(b64)); + } + function cliArgumentValue(args, argument) { + var inductionVariable = 0; + var last = args.length; + while (inductionVariable < last) { + var item = args[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + if (startsWith(item, argument)) { + var prefix = argument + '='; + var value = substring_0(item, prefix.length); + return value; + } + } + return ''; + } + function collectFields(entityFields) { + // Inline function 'kotlin.collections.mutableMapOf' call + var d = LinkedHashMap_init_$Create$(); + var _iterator__ex2g4s = entityFields.x().f(); + while (_iterator__ex2g4s.g()) { + var fields = _iterator__ex2g4s.h(); + var _iterator__ex2g4s_0 = fields.w().f(); + while (_iterator__ex2g4s_0.g()) { + var fieldName = _iterator__ex2g4s_0.h(); + // Inline function 'kotlin.collections.set' call + d.y1(fieldName, true); + } + } + // Inline function 'kotlin.collections.toTypedArray' call + var this_0 = d.w(); + return copyToArray(this_0); + } + function debugString(v) { + if (typeof v === 'string') { + return 'S(' + v.length + ')' + v; + } + if (isArray(v)) { + var out = ''; + var inductionVariable = 0; + var last = v.length; + while (inductionVariable < last) { + var item = v[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + // Inline function 'kotlin.text.isEmpty' call + var this_0 = out; + if (!(charSequenceLength(this_0) === 0)) { + out = out + ','; + } + out = out + debugString(ensureNotNull(item)); + } + return 'A(' + v.length + ')' + out; + } + if (isInterface(v, KtMap)) { + var out_0 = ''; + // Inline function 'kotlin.collections.iterator' call + var _iterator__ex2g4s = v.y().f(); + while (_iterator__ex2g4s.g()) { + var _destruct__k2r9zo = _iterator__ex2g4s.h(); + // Inline function 'kotlin.collections.component1' call + var key = _destruct__k2r9zo.r(); + // Inline function 'kotlin.collections.component2' call + var value = _destruct__k2r9zo.s(); + // Inline function 'kotlin.text.isEmpty' call + var this_1 = out_0; + if (!(charSequenceLength(this_1) === 0)) { + out_0 = out_0 + ','; + } + out_0 = out_0 + (debugString(ensureNotNull(key)) + ':' + debugString(ensureNotNull(value))); + } + return 'D(' + v.i() + ')' + out_0; + } + return toString(v); + } + function genFObject(fieldNames) { + var itemContents = ''; + var inductionVariable = 0; + var last = fieldNames.length; + while (inductionVariable < last) { + var name = fieldNames[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + itemContents = itemContents + replace(' const val %NAME% = "%NAME%"\n', '%NAME%', name); + } + return replace('\nobject F {\n%ITEMS%\n}\n', '%ITEMS%', itemContents); + } + function parseRawKotlin(lines) { + var contents = ''; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + if (startsWith(ln, 'kotlin: ')) { + var prefixLen = 8; + var kotlinCode = substring_0(ln, prefixLen); + contents = contents + (kotlinCode + '\n'); + } + } + return contents; + } + function setupComponentDebugging(ctrl, prefix) { + ctrl.registerCallback(setupComponentDebugging$lambda(prefix)); + } + function setupComponentDebugging$lambda($prefix) { + return function (c) { + var value = debugString(c.fieldAny(c.recentField)); + var tmp; + if (c.field('isDbg')) { + println('\u0418\u0413\u0420 ' + $prefix + " k/v: '" + c.recentField + "'/'" + value + "'"); + tmp = Unit_instance; + } + return Unit_instance; + }; + } + function parseEntityComments(lines) { + // Inline function 'kotlin.collections.mutableMapOf' call + var d = LinkedHashMap_init_$Create$(); + var entityId = 0; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + if (startsWith(ln, '# ')) { + var prefixLen = 2; + var comment = substring_0(ln, prefixLen); + // Inline function 'kotlin.collections.set' call + var key = entityId; + d.y1(key, comment); + } else { + // Inline function 'kotlin.text.isEmpty' call + var this_0 = parseEntityName(ln); + if (!(charSequenceLength(this_0) === 0)) { + entityId = entityId + 1 | 0; + } + } + } + return d; + } + function parseEntityField(ln) { + if (!startsWith(ln, ' ')) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + return []; + } + var prefixLen = 8; + var nameAndValue = substring_0(ln, prefixLen); + var parts = split(nameAndValue, [': '], VOID, 2); + if (!(parts.i() === 2)) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + return []; + } + // Inline function 'kotlin.collections.toTypedArray' call + return copyToArray(parts); + } + function parseEntityFieldComments(lines) { + // Inline function 'kotlin.collections.mutableMapOf' call + var d = LinkedHashMap_init_$Create$(); + var entityId = 0; + // Inline function 'kotlin.collections.mutableMapOf' call + var comments = LinkedHashMap_init_$Create$(); + var isParsingFields = false; + var lastComment = ''; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + var isSectionMarker = ln === ' fields:'; + var isComment = isParsingFields && startsWith(ln, ' # '); + var tmp; + if (isParsingFields) { + // Inline function 'kotlin.collections.isEmpty' call + tmp = !(parseEntityField(ln).length === 0); + } else { + tmp = false; + } + var isField = tmp; + var tmp_0; + if (isParsingFields) { + // Inline function 'kotlin.text.isEmpty' call + tmp_0 = charSequenceLength(ln) === 0; + } else { + tmp_0 = false; + } + var isEntityEndMarker = tmp_0; + var isLastEntityEndMarker = isParsingFields && ln === last_0(lines); + if (isSectionMarker) { + isParsingFields = true; + } + if (isComment) { + var prefixLen = 10; + lastComment = substring_0(ln, prefixLen); + } + var tmp_1; + if (isField) { + // Inline function 'kotlin.text.isEmpty' call + var this_0 = lastComment; + tmp_1 = !(charSequenceLength(this_0) === 0); + } else { + tmp_1 = false; + } + if (tmp_1) { + var parts = parseEntityField(ln); + var name = parts[0]; + var tmp0 = comments; + // Inline function 'kotlin.collections.set' call + var value = lastComment; + tmp0.y1(name, value); + lastComment = ''; + } + if (isEntityEndMarker || isLastEntityEndMarker) { + isParsingFields = false; + var tmp2 = entityId; + // Inline function 'kotlin.collections.set' call + var value_0 = comments; + d.y1(tmp2, value_0); + entityId = entityId + 1 | 0; + // Inline function 'kotlin.collections.mutableMapOf' call + comments = LinkedHashMap_init_$Create$(); + } + } + return d; + } + function parseEntityFields(lines) { + // Inline function 'kotlin.collections.mutableMapOf' call + var d = LinkedHashMap_init_$Create$(); + var entityId = 0; + // Inline function 'kotlin.collections.mutableMapOf' call + var fields = LinkedHashMap_init_$Create$(); + var isParsingFields = false; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var i = inductionVariable; + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + var isSectionMarker = ln === ' fields:'; + var tmp; + if (isParsingFields) { + // Inline function 'kotlin.collections.isEmpty' call + tmp = !(parseEntityField(ln).length === 0); + } else { + tmp = false; + } + var isField = tmp; + var tmp_0; + if (isParsingFields) { + // Inline function 'kotlin.text.isEmpty' call + tmp_0 = charSequenceLength(ln) === 0; + } else { + tmp_0 = false; + } + var isEntityEndMarker = tmp_0; + var isLastEntityEndMarker = isParsingFields && i === (lines.length - 1 | 0); + if (isSectionMarker) { + isParsingFields = true; + } + if (isField) { + var parts = parseEntityField(ln); + var name = parts[0]; + var type = parts[1]; + // Inline function 'kotlin.collections.set' call + fields.y1(name, type); + } + if (isEntityEndMarker || isLastEntityEndMarker) { + isParsingFields = false; + var tmp2 = entityId; + // Inline function 'kotlin.collections.set' call + var value = fields; + d.y1(tmp2, value); + entityId = entityId + 1 | 0; + // Inline function 'kotlin.collections.mutableMapOf' call + fields = LinkedHashMap_init_$Create$(); + } + } + return d; + } + function parseEntityName(ln) { + if (!startsWith(ln, ' ') && !startsWith(ln, '# ') && !(ln === '') && endsWith(ln, ':') && ln === capitalize(ln)) { + var ending = 1; + return dropLast(ln, ending); + } + return ''; + } + function parseEntityNames(lines) { + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + var items = []; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + // Inline function 'kotlin.text.isEmpty' call + var this_0 = parseEntityName(ln); + if (!(charSequenceLength(this_0) === 0)) { + var tmp0 = items; + // Inline function 'kotlin.collections.plus' call + // Inline function 'kotlin.js.asDynamic' call + // Inline function 'kotlin.arrayOf' call + // Inline function 'kotlin.js.unsafeCast' call + // Inline function 'kotlin.js.asDynamic' call + var tmp$ret$7 = [parseEntityName(ln)]; + items = tmp0.concat(tmp$ret$7); + } + } + return items; + } + function parseEntityPrefixes(lines, pre) { + // Inline function 'kotlin.collections.mutableMapOf' call + var d = LinkedHashMap_init_$Create$(); + var entityId = -1; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + if (startsWith(ln, pre)) { + var prefixLen = pre.length; + var value = substring_0(ln, prefixLen); + // Inline function 'kotlin.collections.set' call + var key = entityId; + d.y1(key, value); + } else { + // Inline function 'kotlin.text.isEmpty' call + var this_0 = parseEntityName(ln); + if (!(charSequenceLength(this_0) === 0)) { + entityId = entityId + 1 | 0; + } + } + } + return d; + } + function parseEntityTypes(lines) { + // Inline function 'kotlin.collections.mutableMapOf' call + var d = LinkedHashMap_init_$Create$(); + var entityId = -1; + var inductionVariable = 0; + var last = lines.length; + while (inductionVariable < last) { + var ln = lines[inductionVariable]; + inductionVariable = inductionVariable + 1 | 0; + if (startsWith(ln, ' type: ')) { + var prefixLen = 10; + var type = substring_0(ln, prefixLen); + // Inline function 'kotlin.collections.set' call + var key = entityId; + d.y1(key, type); + } else { + // Inline function 'kotlin.text.isEmpty' call + var this_0 = parseEntityName(ln); + if (!(charSequenceLength(this_0) === 0)) { + entityId = entityId + 1 | 0; + } + } + } + return d; + } + //region block: post-declaration + protoOf(AppContext).fieldAny = fieldAny; + defineProp(protoOf(AppContext), 'recentField', function () { + return this.ta(); + }, function (value) { + this.sa(value); + }); + //endregion + //region block: init + APP_KD_IMPORT = 'import kotlin.js.JsExport'; + APP_KD_PACKAGE = 'package org.opengamestudio'; + emb64 = 'LyoqCiAqIFRoaXMgZmlsZSBpcyBhIHBhcnQgb2YgS290bGluIGRpYWxlY3Q6CiAqICAgICBodHRwczovL2dpdGh1Yi5jb20vT0dTdHVkaW8va290bGluLWRpYWxlY3QKICogTGljZW5zZTogQ0MwCiAqIFZlcnNpb246IDIuMC4wCiAqLwoKcGFja2FnZSBvcmcub3BlbmdhbWVzdHVkaW8KCmltcG9ydCBrb3RsaW4uanMuSnNFeHBvcnQKCkBKc0V4cG9ydAppbnRlcmZhY2UgS0RDb250ZXh0IHsKICAgIC8qKgogICAgICogTmFtZSBvZiB0aGUgZmllbGQgdGhhdCBoYXMganVzdCBiZWVuIGNoYW5nZWQKICAgICAqCiAgICAgKiBBbGxvd3Mgc2hvdWxkLWZ1bmN0aW9ucyAocmVkdWNlcnMpIHRvIHJlYWN0IG9ubHkgdG8KICAgICAqIHJlbGV2YW50IGNoYW5nZXMgYW5kIGlnbm9yZSBvdGhlciBjaGFuZ2VzIG9mIEtEQ29udGV4dAogICAgICovCiAgICB2YXIgcmVjZW50RmllbGQ6IFN0cmluZwoKICAgIC8qKgogICAgICogR2V0IGZpZWxkJ3MgdmFsdWUgYnkgaXRzIG5hbWUKICAgICAqLwogICAgZnVuIDxUPiBmaWVsZChuYW1lOiBTdHJpbmcpOiBUCiAgICAvKioKICAgICAqIEVyYXNlIHR5cGUKICAgICAqCiAgICAgKiBVc2VkIGJ5IEtEQ29udHJvbGxlciB0byBhc3NpZ24gcmVjZW50IGZpZWxkJ3MgdmFsdWUKICAgICAqLwogICAgZnVuIGZpZWxkQW55KG5hbWU6IFN0cmluZyk6IEFueSB7CiAgICAgICAgcmV0dXJuIGZpZWxkKG5hbWUpCiAgICB9CiAgICAvKioKICAgICAqIENyZWF0ZSBhIGNvcHkgb2YgdGhlIEtEQ29udGV4dCBkZXJpdmF0aXZlCiAgICAgKgogICAgICogVXNlZCBieSBLRENvbnRyb2xsZXIgdG8gdHJlYXQgYWxsIGRlcml2ZWQgY29udGV4dHMgYXMgS0RDb250ZXh0CiAgICAgKi8KICAgIGZ1biBzZWxmQ29weSgpOiBLRENvbnRleHQKICAgIC8qKgogICAgICogU2V0IGZpZWxkJ3MgdmFsdWUgYnkgaXRzIG5hbWUKICAgICAqLwogICAgZnVuIHNldEZpZWxkKG5hbWU6IFN0cmluZywgdmFsdWU6IEFueT8pCn0KLyoqCiAqIFRoaXMgZmlsZSBpcyBhIHBhcnQgb2YgS290bGluIGRpYWxlY3Q6CiAqICAgICBodHRwczovL2dpdGh1Yi5jb20vT0dTdHVkaW8va290bGluLWRpYWxlY3QKICogTGljZW5zZTogQ0MwCiAqIFZlcnNpb246IDIuMC4wCiAqLwoKcGFja2FnZSBvcmcub3BlbmdhbWVzdHVkaW8KCmltcG9ydCBrb3RsaW4uanMuSnNFeHBvcnQKCnZhbCBLRF9GSUVMRF9OT05FID0gIm5vbmUiCgpASnNFeHBvcnQKY2xhc3MgS0RDb250cm9sbGVyKAogICAgdmFyIGNvbnRleHQ6IEtEQ29udGV4dAopIHsKICAgIGludGVybmFsIHZhciBjYWxsYmFja3MgPSBtdXRhYmxlTGlzdE9mPChjOiBLRENvbnRleHQpIC0+IFVuaXQ+KCkKICAgIGludGVybmFsIHZhciBmdW5jdGlvbnMgPSBtdXRhYmxlTGlzdE9mPChjOiBLRENvbnRleHQpIC0+IEtEQ29udGV4dD4oKQogICAgdmFyIGlzUHJvY2Vzc2luZ1F1ZXVlID0gZmFsc2UKICAgIGludGVybmFsIHZhciBxdWV1ZSA9IG11dGFibGVMaXN0T2Y8S0RDb250ZXh0PigpCiAKICAgIGZ1biBleGVjdXRlRnVuY3Rpb25zKCkgewogICAgICAgIHZhbCBjID0gcXVldWUucmVtb3ZlQXQoMCkKICAgICAgICBjb250ZXh0LnJlY2VudEZpZWxkID0gYy5yZWNlbnRGaWVsZAogICAgICAgIGNvbnRleHQuc2V0RmllbGQoYy5yZWNlbnRGaWVsZCwgYy5maWVsZEFueShjLnJlY2VudEZpZWxkKSkKICAgICAgIAogICAgICAgIGZvciAoZiBpbiBmdW5jdGlvbnMpIHsKICAgICAgICAgICAgdmFsIGN0eCA9IGYoY29udGV4dC5zZWxmQ29weSgpKQogICAgICAgICAgICBpZiAoY3R4LnJlY2VudEZpZWxkICE9IEtEX0ZJRUxEX05PTkUpIHsKICAgICAgICAgICAgICAgIHF1ZXVlLmFkZChjdHgpCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAKICAgICAgICByZXBvcnRDb250ZXh0KCkKICAgIH0KIAogICAgZnVuIHByb2Nlc3NRdWV1ZSgpIHsKICAgICAgICAvLyBQcmV2ZW50IHJlY3Vyc2lvbi4KICAgICAgICBpZiAoaXNQcm9jZXNzaW5nUXVldWUpIHsKICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgfQogICAgICAgCiAgICAgICAgaXNQcm9jZXNzaW5nUXVldWUgPSB0cnVlCiAgICAgICAKICAgICAgICB3aGlsZSAocXVldWUuc2l6ZSA+IDApIHsKICAgICAgICAgICAgZXhlY3V0ZUZ1bmN0aW9ucygpCiAgICAgICAgfQogICAgICAgCiAgICAgICAgaXNQcm9jZXNzaW5nUXVldWUgPSBmYWxzZQogICAgfQogCiAgICBmdW4gcmVnaXN0ZXJDYWxsYmFjayhjYjogKGM6IEtEQ29udGV4dCkgLT4gVW5pdCkgewogICAgICAgIGNhbGxiYWNrcy5hZGQoY2IpCiAgICB9CiAKICAgIGZ1biByZWdpc3RlckZpZWxkQ2FsbGJhY2soCiAgICAgICAgZmllbGROYW1lOiBTdHJpbmcsCiAgICAgICAgY2I6IChLRENvbnRleHQpIC0+IFVuaXQKICAgICkgewogICAgICAgIGNhbGxiYWNrcy5hZGQoeyBjIC0+CiAgICAgICAgICAgIGlmIChjLnJlY2VudEZpZWxkID09IGZpZWxkTmFtZSkgewogICAgICAgICAgICAgICAgY2IoYykKICAgICAgICAgICAgfQogICAgICAgIH0pCiAgICB9CiAKICAgIGZ1biByZWdpc3RlckZ1bmN0aW9uKGY6IChLRENvbnRleHQpIC0+IEtEQ29udGV4dCkgewogICAgICAgIGZ1bmN0aW9ucy5hZGQoZikKICAgIH0KIAogICAgZnVuIHJlcG9ydENvbnRleHQoKSB7CiAgICAgICAgZm9yIChjYiBpbiBjYWxsYmFja3MpIHsKICAgICAgICAgICAgY2IoY29udGV4dCkKICAgICAgICB9CiAgICB9CiAKICAgIGZ1biBzZXQoZmllbGROYW1lOiBTdHJpbmcsIHZhbHVlOiBBbnkpIHsKICAgICAgICB2YXIgYyA9IGNvbnRleHQuc2VsZkNvcHkoKQogICAgICAgIGMuc2V0RmllbGQoZmllbGROYW1lLCB2YWx1ZSkKICAgICAgICBjLnJlY2VudEZpZWxkID0gZmllbGROYW1lCiAgICAgICAgcXVldWUuYWRkKGMpCiAgICAgICAgcHJvY2Vzc1F1ZXVlKCkKICAgIH0KfQovKioKICogVGhpcyBmaWxlIGlzIGEgcGFydCBvZiBLb3RsaW4gZGlhbGVjdDoKICogICAgIGh0dHBzOi8vZ2l0aHViLmNvbS9PR1N0dWRpby9rb3RsaW4tZGlhbGVjdAogKiBMaWNlbnNlOiBDQzAKICogVmVyc2lvbjogMi4wLjAKICovCgpwYWNrYWdlIG9yZy5vcGVuZ2FtZXN0dWRpbwoKaW1wb3J0IGtvdGxpbi5qcy5Kc0V4cG9ydAoKLy8gUmVnaXN0ZXIgc2V2ZXJhbCBvbmVsaW5lciBjYWxsYmFja3MgdG8gYSBjb250cm9sbGVyCkBKc0V4cG9ydApmdW4gcmVnaXN0ZXJPbmVsaW5lcnMoCiAgICBjdHJsOiBLRENvbnRyb2xsZXIsCiAgICBpdGVtczogQXJyYXk8QW55PgopIHsKICAgIHZhbCBoYWxmQ291bnQgPSBpdGVtcy5zaXplIC8gMgogICAgZm9yIChpIGluIDAuLjxoYWxmQ291bnQpIHsKICAgICAgICB2YWwgZmllbGQgPSBpdGVtc1tpICogMl0gYXMgU3RyaW5nCiAgICAgICAgdmFsIGNhbGxiYWNrID0gaXRlbXNbaSAqIDIgKyAxXSBhcyAoYzogS0RDb250ZXh0KSAtPiBVbml0CiAgICAgICAgY3RybC5yZWdpc3RlckZpZWxkQ2FsbGJhY2soZmllbGQsIGNhbGxiYWNrKTsKICAgIH0KfQo='; + KD_FIELD_NONE = 'none'; + //endregion + //region block: exports + function $jsExportAll$(_) { + var $org = _.org || (_.org = {}); + var $org$opengamestudio = $org.opengamestudio || ($org.opengamestudio = {}); + $org$opengamestudio.appCtrl = appCtrl; + var $org = _.org || (_.org = {}); + var $org$opengamestudio = $org.opengamestudio || ($org.opengamestudio = {}); + $org$opengamestudio.AppContext = AppContext; + $org$opengamestudio.KDController = KDController; + $org$opengamestudio.registerOneliners = registerOneliners; + } + $jsExportAll$(_); + kotlin_kotlin.$jsExportAll$(_); + //endregion + return _; +})); + +//# sourceMappingURL=ver-nodejs-app.js.map diff --git a/klin.yml b/klin/kd.yml similarity index 89% rename from klin.yml rename to klin/kd.yml index beab6c7..e2639c6 100644 --- a/klin.yml +++ b/klin/kd.yml @@ -24,8 +24,12 @@ AppContext: didWriteOutputFile: Bool inputFile: String inputFileLines: [String] + isDbg: Bool + outputEntityContents: String + outputFieldContents: String outputFile: String # Contents to write to output file outputFileContents: String + outputKDContents: String # Kotlin source code to insert as is at the beginning of each generated file rawKotlin: String diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/KDContext.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/KDContext.kt deleted file mode 120000 index cf652ce..0000000 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/KDContext.kt +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../src/KDContext.kt \ No newline at end of file diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/KDController.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/KDController.kt deleted file mode 120000 index 585626d..0000000 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/KDController.kt +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../src/KDController.kt \ No newline at end of file diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appFun.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appFun.kt index 8fff52d..ece5cc9 100644 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appFun.kt +++ b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appFun.kt @@ -7,8 +7,14 @@ package org.opengamestudio +import kotlin.io.encoding.* import kotlin.js.JsExport +// + +val APP_KD_IMPORT = "import kotlin.js.JsExport" +val APP_KD_PACKAGE = "package org.opengamestudio" + // // Collect comments of the entities @@ -16,13 +22,13 @@ import kotlin.js.JsExport // Conditions: // 1. Entity names are available fun appShouldCollectEntityComments(c: AppContext): AppContext { - if (c.recentField == "entityNames") { + if (c.recentField == F.entityNames) { c.entityComments = parseEntityComments(c.inputFileLines) - c.recentField = "entityComments" + c.recentField = F.entityComments return c } - c.recentField = "none" + c.recentField = F.none return c } @@ -126,7 +132,7 @@ fun appShouldCollectRawKotlin(c: AppContext): AppContext { // 1. Entity field comments are available fun appShouldGenerateKotlinEntities(c: AppContext): AppContext { if (c.recentField == "entityFieldComments") { - c.outputFileContents = genKotlinEntitiesFile( + c.outputEntityContents = genKotlinEntitiesFile( c.entityComments, c.entityFieldComments, c.entityFields, @@ -135,7 +141,7 @@ fun appShouldGenerateKotlinEntities(c: AppContext): AppContext { c.entityTypes, c.rawKotlin ) - c.recentField = "outputFileContents" + c.recentField = "outputEntityContents" return c } @@ -198,6 +204,58 @@ fun appShouldPrintToConsole(c: AppContext): AppContext { return c } +// Generate a special structure to reference fields +// +// Conditions: +// 1. Embeddable KD files' content is ready +fun appShouldResetOutputFieldContents(c: AppContext): AppContext { + if (c.recentField == "outputKDContents") { + var fields = collectFields(c.entityFields) + fields += "none" + fields.sort() + c.outputFieldContents = genFObject(fields) + c.recentField = "outputFieldContents" + return c + } + + c.recentField = "none" + return c +} + +// Generate a final text +// +// Conditions: +// 1. F object is ready +fun appShouldResetOutputFileContents(c: AppContext): AppContext { + if (c.recentField == F.outputFieldContents) { + c.outputFileContents = c.outputEntityContents + c.outputKDContents + c.outputFieldContents + c.recentField = F.outputFileContents + return c + } + + c.recentField = "none" + return c +} + +// Generate KDController/Context/registerOneliners/etc. contents +// +// Conditions: +// 1. Output of Kotlin entities' is available +@OptIn(ExperimentalEncodingApi::class) +fun appShouldResetOutputKDContents(c: AppContext): AppContext { + if (c.recentField == "outputEntityContents") { + val contents = base64ToString(emb64) + c.outputKDContents = contents + .replace(APP_KD_IMPORT, "") + .replace(APP_KD_PACKAGE, "") + c.recentField = "outputKDContents" + return c + } + + c.recentField = "none" + return c +} + // @JsExport diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appProto.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appProto.kt index b90a0ba..a7466da 100644 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appProto.kt +++ b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/appProto.kt @@ -12,7 +12,7 @@ object AppProto { init { ctrl = KDController(AppContext()) - //setupComponentDebugging(ctrl, "App") + setupComponentDebugging(ctrl, "App") arrayOf( ::appShouldCollectEntityComments, ::appShouldCollectEntityFieldComments, @@ -25,6 +25,9 @@ object AppProto { ::appShouldParseInputFilePath, ::appShouldPrintToConsole, ::appShouldParseOutputFilePath, + ::appShouldResetOutputFieldContents, + ::appShouldResetOutputFileContents, + ::appShouldResetOutputKDContents, ).forEach { f -> ctrl.registerFunction { c -> f(c as AppContext) } } diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/emb64.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/emb64.kt new file mode 100644 index 0000000..3aa2424 --- /dev/null +++ b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/emb64.kt @@ -0,0 +1,2 @@ +package org.opengamestudio +val emb64="LyoqCiAqIFRoaXMgZmlsZSBpcyBhIHBhcnQgb2YgS290bGluIGRpYWxlY3Q6CiAqICAgICBodHRwczovL2dpdGh1Yi5jb20vT0dTdHVkaW8va290bGluLWRpYWxlY3QKICogTGljZW5zZTogQ0MwCiAqIFZlcnNpb246IDIuMC4wCiAqLwoKcGFja2FnZSBvcmcub3BlbmdhbWVzdHVkaW8KCmltcG9ydCBrb3RsaW4uanMuSnNFeHBvcnQKCkBKc0V4cG9ydAppbnRlcmZhY2UgS0RDb250ZXh0IHsKICAgIC8qKgogICAgICogTmFtZSBvZiB0aGUgZmllbGQgdGhhdCBoYXMganVzdCBiZWVuIGNoYW5nZWQKICAgICAqCiAgICAgKiBBbGxvd3Mgc2hvdWxkLWZ1bmN0aW9ucyAocmVkdWNlcnMpIHRvIHJlYWN0IG9ubHkgdG8KICAgICAqIHJlbGV2YW50IGNoYW5nZXMgYW5kIGlnbm9yZSBvdGhlciBjaGFuZ2VzIG9mIEtEQ29udGV4dAogICAgICovCiAgICB2YXIgcmVjZW50RmllbGQ6IFN0cmluZwoKICAgIC8qKgogICAgICogR2V0IGZpZWxkJ3MgdmFsdWUgYnkgaXRzIG5hbWUKICAgICAqLwogICAgZnVuIDxUPiBmaWVsZChuYW1lOiBTdHJpbmcpOiBUCiAgICAvKioKICAgICAqIEVyYXNlIHR5cGUKICAgICAqCiAgICAgKiBVc2VkIGJ5IEtEQ29udHJvbGxlciB0byBhc3NpZ24gcmVjZW50IGZpZWxkJ3MgdmFsdWUKICAgICAqLwogICAgZnVuIGZpZWxkQW55KG5hbWU6IFN0cmluZyk6IEFueSB7CiAgICAgICAgcmV0dXJuIGZpZWxkKG5hbWUpCiAgICB9CiAgICAvKioKICAgICAqIENyZWF0ZSBhIGNvcHkgb2YgdGhlIEtEQ29udGV4dCBkZXJpdmF0aXZlCiAgICAgKgogICAgICogVXNlZCBieSBLRENvbnRyb2xsZXIgdG8gdHJlYXQgYWxsIGRlcml2ZWQgY29udGV4dHMgYXMgS0RDb250ZXh0CiAgICAgKi8KICAgIGZ1biBzZWxmQ29weSgpOiBLRENvbnRleHQKICAgIC8qKgogICAgICogU2V0IGZpZWxkJ3MgdmFsdWUgYnkgaXRzIG5hbWUKICAgICAqLwogICAgZnVuIHNldEZpZWxkKG5hbWU6IFN0cmluZywgdmFsdWU6IEFueT8pCn0KLyoqCiAqIFRoaXMgZmlsZSBpcyBhIHBhcnQgb2YgS290bGluIGRpYWxlY3Q6CiAqICAgICBodHRwczovL2dpdGh1Yi5jb20vT0dTdHVkaW8va290bGluLWRpYWxlY3QKICogTGljZW5zZTogQ0MwCiAqIFZlcnNpb246IDIuMC4wCiAqLwoKcGFja2FnZSBvcmcub3BlbmdhbWVzdHVkaW8KCmltcG9ydCBrb3RsaW4uanMuSnNFeHBvcnQKCnZhbCBLRF9GSUVMRF9OT05FID0gIm5vbmUiCgpASnNFeHBvcnQKY2xhc3MgS0RDb250cm9sbGVyKAogICAgdmFyIGNvbnRleHQ6IEtEQ29udGV4dAopIHsKICAgIGludGVybmFsIHZhciBjYWxsYmFja3MgPSBtdXRhYmxlTGlzdE9mPChjOiBLRENvbnRleHQpIC0+IFVuaXQ+KCkKICAgIGludGVybmFsIHZhciBmdW5jdGlvbnMgPSBtdXRhYmxlTGlzdE9mPChjOiBLRENvbnRleHQpIC0+IEtEQ29udGV4dD4oKQogICAgdmFyIGlzUHJvY2Vzc2luZ1F1ZXVlID0gZmFsc2UKICAgIGludGVybmFsIHZhciBxdWV1ZSA9IG11dGFibGVMaXN0T2Y8S0RDb250ZXh0PigpCiAKICAgIGZ1biBleGVjdXRlRnVuY3Rpb25zKCkgewogICAgICAgIHZhbCBjID0gcXVldWUucmVtb3ZlQXQoMCkKICAgICAgICBjb250ZXh0LnJlY2VudEZpZWxkID0gYy5yZWNlbnRGaWVsZAogICAgICAgIGNvbnRleHQuc2V0RmllbGQoYy5yZWNlbnRGaWVsZCwgYy5maWVsZEFueShjLnJlY2VudEZpZWxkKSkKICAgICAgIAogICAgICAgIGZvciAoZiBpbiBmdW5jdGlvbnMpIHsKICAgICAgICAgICAgdmFsIGN0eCA9IGYoY29udGV4dC5zZWxmQ29weSgpKQogICAgICAgICAgICBpZiAoY3R4LnJlY2VudEZpZWxkICE9IEtEX0ZJRUxEX05PTkUpIHsKICAgICAgICAgICAgICAgIHF1ZXVlLmFkZChjdHgpCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAKICAgICAgICByZXBvcnRDb250ZXh0KCkKICAgIH0KIAogICAgZnVuIHByb2Nlc3NRdWV1ZSgpIHsKICAgICAgICAvLyBQcmV2ZW50IHJlY3Vyc2lvbi4KICAgICAgICBpZiAoaXNQcm9jZXNzaW5nUXVldWUpIHsKICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgfQogICAgICAgCiAgICAgICAgaXNQcm9jZXNzaW5nUXVldWUgPSB0cnVlCiAgICAgICAKICAgICAgICB3aGlsZSAocXVldWUuc2l6ZSA+IDApIHsKICAgICAgICAgICAgZXhlY3V0ZUZ1bmN0aW9ucygpCiAgICAgICAgfQogICAgICAgCiAgICAgICAgaXNQcm9jZXNzaW5nUXVldWUgPSBmYWxzZQogICAgfQogCiAgICBmdW4gcmVnaXN0ZXJDYWxsYmFjayhjYjogKGM6IEtEQ29udGV4dCkgLT4gVW5pdCkgewogICAgICAgIGNhbGxiYWNrcy5hZGQoY2IpCiAgICB9CiAKICAgIGZ1biByZWdpc3RlckZpZWxkQ2FsbGJhY2soCiAgICAgICAgZmllbGROYW1lOiBTdHJpbmcsCiAgICAgICAgY2I6IChLRENvbnRleHQpIC0+IFVuaXQKICAgICkgewogICAgICAgIGNhbGxiYWNrcy5hZGQoeyBjIC0+CiAgICAgICAgICAgIGlmIChjLnJlY2VudEZpZWxkID09IGZpZWxkTmFtZSkgewogICAgICAgICAgICAgICAgY2IoYykKICAgICAgICAgICAgfQogICAgICAgIH0pCiAgICB9CiAKICAgIGZ1biByZWdpc3RlckZ1bmN0aW9uKGY6IChLRENvbnRleHQpIC0+IEtEQ29udGV4dCkgewogICAgICAgIGZ1bmN0aW9ucy5hZGQoZikKICAgIH0KIAogICAgZnVuIHJlcG9ydENvbnRleHQoKSB7CiAgICAgICAgZm9yIChjYiBpbiBjYWxsYmFja3MpIHsKICAgICAgICAgICAgY2IoY29udGV4dCkKICAgICAgICB9CiAgICB9CiAKICAgIGZ1biBzZXQoZmllbGROYW1lOiBTdHJpbmcsIHZhbHVlOiBBbnkpIHsKICAgICAgICB2YXIgYyA9IGNvbnRleHQuc2VsZkNvcHkoKQogICAgICAgIGMuc2V0RmllbGQoZmllbGROYW1lLCB2YWx1ZSkKICAgICAgICBjLnJlY2VudEZpZWxkID0gZmllbGROYW1lCiAgICAgICAgcXVldWUuYWRkKGMpCiAgICAgICAgcHJvY2Vzc1F1ZXVlKCkKICAgIH0KfQovKioKICogVGhpcyBmaWxlIGlzIGEgcGFydCBvZiBLb3RsaW4gZGlhbGVjdDoKICogICAgIGh0dHBzOi8vZ2l0aHViLmNvbS9PR1N0dWRpby9rb3RsaW4tZGlhbGVjdAogKiBMaWNlbnNlOiBDQzAKICogVmVyc2lvbjogMi4wLjAKICovCgpwYWNrYWdlIG9yZy5vcGVuZ2FtZXN0dWRpbwoKaW1wb3J0IGtvdGxpbi5qcy5Kc0V4cG9ydAoKLy8gUmVnaXN0ZXIgc2V2ZXJhbCBvbmVsaW5lciBjYWxsYmFja3MgdG8gYSBjb250cm9sbGVyCkBKc0V4cG9ydApmdW4gcmVnaXN0ZXJPbmVsaW5lcnMoCiAgICBjdHJsOiBLRENvbnRyb2xsZXIsCiAgICBpdGVtczogQXJyYXk8QW55PgopIHsKICAgIHZhbCBoYWxmQ291bnQgPSBpdGVtcy5zaXplIC8gMgogICAgZm9yIChpIGluIDAuLjxoYWxmQ291bnQpIHsKICAgICAgICB2YWwgZmllbGQgPSBpdGVtc1tpICogMl0gYXMgU3RyaW5nCiAgICAgICAgdmFsIGNhbGxiYWNrID0gaXRlbXNbaSAqIDIgKyAxXSBhcyAoYzogS0RDb250ZXh0KSAtPiBVbml0CiAgICAgICAgY3RybC5yZWdpc3RlckZpZWxkQ2FsbGJhY2soZmllbGQsIGNhbGxiYWNrKTsKICAgIH0KfQo=" diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/kd.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/kd.kt new file mode 100644 index 0000000..c2acb63 --- /dev/null +++ b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/kd.kt @@ -0,0 +1,303 @@ +package org.opengamestudio +import kotlin.js.JsExport + + +@JsExport +data class AppContext( + // Command line arguments + var arguments: Array = arrayOf(), + var consoleOutput: String = "", + var didLaunch: Boolean = false, + var didWriteOutputFile: Boolean = false, + // Entity comments with entities referenced by index + var entityComments: Map = mapOf(), + // Entity id -> Field name -> Field comment + var entityFieldComments: Map> = mapOf(), + // Entity id -> Field name -> Field type + var entityFields: Map> = mapOf(), + // Entity names in the order of appearance + var entityNames: Array = arrayOf(), + var entityPrefixesKotlin: Map = mapOf(), + var entityTypes: Map = mapOf(), + var inputFile: String = "", + var inputFileLines: Array = arrayOf(), + var isDbg: Boolean = false, + var outputEntityContents: String = "", + var outputFieldContents: String = "", + var outputFile: String = "", + // Contents to write to output file + var outputFileContents: String = "", + var outputKDContents: String = "", + // Kotlin source code to insert as is at the beginning of each generated file + var rawKotlin: String = "", + override var recentField: String = "", +): KDContext { + override fun field(name: String): T { + if (name == "arguments") { + return arguments as T + } else if (name == "consoleOutput") { + return consoleOutput as T + } else if (name == "didLaunch") { + return didLaunch as T + } else if (name == "didWriteOutputFile") { + return didWriteOutputFile as T + } else if (name == "entityComments") { + return entityComments as T + } else if (name == "entityFieldComments") { + return entityFieldComments as T + } else if (name == "entityFields") { + return entityFields as T + } else if (name == "entityNames") { + return entityNames as T + } else if (name == "entityPrefixesKotlin") { + return entityPrefixesKotlin as T + } else if (name == "entityTypes") { + return entityTypes as T + } else if (name == "inputFile") { + return inputFile as T + } else if (name == "inputFileLines") { + return inputFileLines as T + } else if (name == "isDbg") { + return isDbg as T + } else if (name == "outputEntityContents") { + return outputEntityContents as T + } else if (name == "outputFieldContents") { + return outputFieldContents as T + } else if (name == "outputFile") { + return outputFile as T + } else if (name == "outputFileContents") { + return outputFileContents as T + } else if (name == "outputKDContents") { + return outputKDContents as T + } else if (name == "rawKotlin") { + return rawKotlin as T + } + return "unknown-field-name" as T + } + + override fun selfCopy(): KDContext { + return this.copy() + } + + override fun setField( + name: String, + value: Any? + ) { + if (name == "arguments") { + arguments = value as Array + } else if (name == "consoleOutput") { + consoleOutput = value as String + } else if (name == "didLaunch") { + didLaunch = value as Boolean + } else if (name == "didWriteOutputFile") { + didWriteOutputFile = value as Boolean + } else if (name == "entityComments") { + entityComments = value as Map + } else if (name == "entityFieldComments") { + entityFieldComments = value as Map> + } else if (name == "entityFields") { + entityFields = value as Map> + } else if (name == "entityNames") { + entityNames = value as Array + } else if (name == "entityPrefixesKotlin") { + entityPrefixesKotlin = value as Map + } else if (name == "entityTypes") { + entityTypes = value as Map + } else if (name == "inputFile") { + inputFile = value as String + } else if (name == "inputFileLines") { + inputFileLines = value as Array + } else if (name == "isDbg") { + isDbg = value as Boolean + } else if (name == "outputEntityContents") { + outputEntityContents = value as String + } else if (name == "outputFieldContents") { + outputFieldContents = value as String + } else if (name == "outputFile") { + outputFile = value as String + } else if (name == "outputFileContents") { + outputFileContents = value as String + } else if (name == "outputKDContents") { + outputKDContents = value as String + } else if (name == "rawKotlin") { + rawKotlin = value as String + } + } +} +/** + * This file is a part of Kotlin dialect: + * https://github.com/OGStudio/kotlin-dialect + * License: CC0 + * Version: 2.0.0 + */ + + + + + +@JsExport +interface KDContext { + /** + * Name of the field that has just been changed + * + * Allows should-functions (reducers) to react only to + * relevant changes and ignore other changes of KDContext + */ + var recentField: String + + /** + * Get field's value by its name + */ + fun field(name: String): T + /** + * Erase type + * + * Used by KDController to assign recent field's value + */ + fun fieldAny(name: String): Any { + return field(name) + } + /** + * Create a copy of the KDContext derivative + * + * Used by KDController to treat all derived contexts as KDContext + */ + fun selfCopy(): KDContext + /** + * Set field's value by its name + */ + fun setField(name: String, value: Any?) +} +/** + * This file is a part of Kotlin dialect: + * https://github.com/OGStudio/kotlin-dialect + * License: CC0 + * Version: 2.0.0 + */ + + + + + +val KD_FIELD_NONE = "none" + +@JsExport +class KDController( + var context: KDContext +) { + internal var callbacks = mutableListOf<(c: KDContext) -> Unit>() + internal var functions = mutableListOf<(c: KDContext) -> KDContext>() + var isProcessingQueue = false + internal var queue = mutableListOf() + + fun executeFunctions() { + val c = queue.removeAt(0) + context.recentField = c.recentField + context.setField(c.recentField, c.fieldAny(c.recentField)) + + for (f in functions) { + val ctx = f(context.selfCopy()) + if (ctx.recentField != KD_FIELD_NONE) { + queue.add(ctx) + } + } + + reportContext() + } + + fun processQueue() { + // Prevent recursion. + if (isProcessingQueue) { + return + } + + isProcessingQueue = true + + while (queue.size > 0) { + executeFunctions() + } + + isProcessingQueue = false + } + + fun registerCallback(cb: (c: KDContext) -> Unit) { + callbacks.add(cb) + } + + fun registerFieldCallback( + fieldName: String, + cb: (KDContext) -> Unit + ) { + callbacks.add({ c -> + if (c.recentField == fieldName) { + cb(c) + } + }) + } + + fun registerFunction(f: (KDContext) -> KDContext) { + functions.add(f) + } + + fun reportContext() { + for (cb in callbacks) { + cb(context) + } + } + + fun set(fieldName: String, value: Any) { + var c = context.selfCopy() + c.setField(fieldName, value) + c.recentField = fieldName + queue.add(c) + processQueue() + } +} +/** + * This file is a part of Kotlin dialect: + * https://github.com/OGStudio/kotlin-dialect + * License: CC0 + * Version: 2.0.0 + */ + + + + + +// Register several oneliner callbacks to a controller +@JsExport +fun registerOneliners( + ctrl: KDController, + items: Array +) { + val halfCount = items.size / 2 + for (i in 0.. Unit + ctrl.registerFieldCallback(field, callback); + } +} + +object F { + const val arguments = "arguments" + const val consoleOutput = "consoleOutput" + const val didLaunch = "didLaunch" + const val didWriteOutputFile = "didWriteOutputFile" + const val entityComments = "entityComments" + const val entityFieldComments = "entityFieldComments" + const val entityFields = "entityFields" + const val entityNames = "entityNames" + const val entityPrefixesKotlin = "entityPrefixesKotlin" + const val entityTypes = "entityTypes" + const val inputFile = "inputFile" + const val inputFileLines = "inputFileLines" + const val isDbg = "isDbg" + const val none = "none" + const val outputEntityContents = "outputEntityContents" + const val outputFieldContents = "outputFieldContents" + const val outputFile = "outputFile" + const val outputFileContents = "outputFileContents" + const val outputKDContents = "outputKDContents" + const val rawKotlin = "rawKotlin" + +} diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/klin.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/klin.kt deleted file mode 120000 index bca3cfb..0000000 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/klin.kt +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../src/klin.kt \ No newline at end of file diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/other.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/other.kt index 8965c8a..89e2242 100644 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/other.kt +++ b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/other.kt @@ -7,6 +7,14 @@ package org.opengamestudio +import kotlin.io.encoding.* + +// Convert Base64 string to a decoded string +@OptIn(ExperimentalEncodingApi::class) +fun base64ToString(b64: String): String { + return Base64.Default.decode(b64).decodeToString() +} + // Extract command line argument value fun cliArgumentValue( args: Array, @@ -35,6 +43,22 @@ fun cliHasArgument( return false } +// Collect fields of all contexts +fun collectFields( + entityFields: Map> +): Array { + // Collect + var d = mutableMapOf() + for (fields in entityFields.values) { + for (fieldName in fields.keys) { + d[fieldName] = true + } + } + + // Only return unique items + return d.keys.toTypedArray() +} + // Debug representation of a value fun debugString(v: Any): String { // Prepend a string with its length @@ -70,6 +94,20 @@ fun debugString(v: Any): String { return "$v" } +// Generate F object +fun genFObject(fieldNames: Array): String { + // Items + var itemContents = "" + for (name in fieldNames) { + itemContents += TEMPLATE_F_OBJECT_ITEM + .replace("%NAME%", name) + } + + // F Object + return TEMPLATE_F_OBJECT + .replace("%ITEMS%", itemContents) +} + // Collect raw Kotlin source code fun parseRawKotlin(lines: Array): String { var contents = "" @@ -89,8 +127,16 @@ fun setupComponentDebugging( prefix: String ) { ctrl.registerCallback { c -> - //val value = "${c.field(c.recentField)}" val value = debugString(c.fieldAny(c.recentField)) - println("ИГР $prefix k/v: '${c.recentField}'/'$value'") + if (c.field("isDbg")) { + println("ИГР $prefix k/v: '${c.recentField}'/'$value'") + } } } + +// Convert string to Base64 string +@OptIn(ExperimentalEncodingApi::class) +fun stringToBase64(txt: String): String { + val arr = txt.encodeToByteArray() + return Base64.Default.encode(arr) +} diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/registerOneliners.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/registerOneliners.kt deleted file mode 120000 index 6a0d6f2..0000000 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/registerOneliners.kt +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../src/registerOneliners.kt \ No newline at end of file diff --git a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/templates.kt b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/templates.kt index 01fb685..0bd7bfa 100644 --- a/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/templates.kt +++ b/klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio/templates.kt @@ -7,6 +7,14 @@ package org.opengamestudio +const val TEMPLATE_F_OBJECT = """ +object F { +%ITEMS% +} +""" +const val TEMPLATE_F_OBJECT_ITEM = """ const val %NAME% = "%NAME%" +""" + const val TEMPLATE_KOTLIN_CONTEXT = """ %COMMENT% %PREFIX% diff --git a/klin/ver-nodejs/app/src/jsMain/resources/app.js b/klin/ver-nodejs/app/src/jsMain/resources/app.js index 7e2a09c..1ab4a99 100755 --- a/klin/ver-nodejs/app/src/jsMain/resources/app.js +++ b/klin/ver-nodejs/app/src/jsMain/resources/app.js @@ -21,6 +21,7 @@ function AppComponent() { KT.registerOneliners(KT.appCtrl(), oneliners); // Defaults. + //appSet("isDbg", true); appSet("arguments", process.argv); }; diff --git a/src/klin.kt b/src/klin.kt deleted file mode 100644 index bd9db47..0000000 --- a/src/klin.kt +++ /dev/null @@ -1,106 +0,0 @@ -package org.opengamestudio -import kotlin.js.JsExport - - -@JsExport -data class AppContext( - // Command line arguments - var arguments: Array = arrayOf(), - var consoleOutput: String = "", - var didLaunch: Boolean = false, - var didWriteOutputFile: Boolean = false, - // Entity comments with entities referenced by index - var entityComments: Map = mapOf(), - // Entity id -> Field name -> Field comment - var entityFieldComments: Map> = mapOf(), - // Entity id -> Field name -> Field type - var entityFields: Map> = mapOf(), - // Entity names in the order of appearance - var entityNames: Array = arrayOf(), - var entityPrefixesKotlin: Map = mapOf(), - var entityTypes: Map = mapOf(), - var inputFile: String = "", - var inputFileLines: Array = arrayOf(), - var outputFile: String = "", - // Contents to write to output file - var outputFileContents: String = "", - // Kotlin source code to insert as is at the beginning of each generated file - var rawKotlin: String = "", - override var recentField: String = "", -): KDContext { - override fun field(name: String): T { - if (name == "arguments") { - return arguments as T - } else if (name == "consoleOutput") { - return consoleOutput as T - } else if (name == "didLaunch") { - return didLaunch as T - } else if (name == "didWriteOutputFile") { - return didWriteOutputFile as T - } else if (name == "entityComments") { - return entityComments as T - } else if (name == "entityFieldComments") { - return entityFieldComments as T - } else if (name == "entityFields") { - return entityFields as T - } else if (name == "entityNames") { - return entityNames as T - } else if (name == "entityPrefixesKotlin") { - return entityPrefixesKotlin as T - } else if (name == "entityTypes") { - return entityTypes as T - } else if (name == "inputFile") { - return inputFile as T - } else if (name == "inputFileLines") { - return inputFileLines as T - } else if (name == "outputFile") { - return outputFile as T - } else if (name == "outputFileContents") { - return outputFileContents as T - } else if (name == "rawKotlin") { - return rawKotlin as T - } - return "unknown-field-name" as T - } - - override fun selfCopy(): KDContext { - return this.copy() - } - - override fun setField( - name: String, - value: Any? - ) { - if (name == "arguments") { - arguments = value as Array - } else if (name == "consoleOutput") { - consoleOutput = value as String - } else if (name == "didLaunch") { - didLaunch = value as Boolean - } else if (name == "didWriteOutputFile") { - didWriteOutputFile = value as Boolean - } else if (name == "entityComments") { - entityComments = value as Map - } else if (name == "entityFieldComments") { - entityFieldComments = value as Map> - } else if (name == "entityFields") { - entityFields = value as Map> - } else if (name == "entityNames") { - entityNames = value as Array - } else if (name == "entityPrefixesKotlin") { - entityPrefixesKotlin = value as Map - } else if (name == "entityTypes") { - entityTypes = value as Map - } else if (name == "inputFile") { - inputFile = value as String - } else if (name == "inputFileLines") { - inputFileLines = value as Array - } else if (name == "outputFile") { - outputFile = value as String - } else if (name == "outputFileContents") { - outputFileContents = value as String - } else if (name == "rawKotlin") { - rawKotlin = value as String - } - } -} diff --git a/test/kd.kt b/test/kd.kt new file mode 100644 index 0000000..4328102 --- /dev/null +++ b/test/kd.kt @@ -0,0 +1,154 @@ +package org.opengamestudio +/** + * This file is a part of Kotlin dialect: + * https://github.com/OGStudio/kotlin-dialect + * License: CC0 + * Version: 2.0.0 + */ + + + + + + +interface KDContext { + /** + * Name of the field that has just been changed + * + * Allows should-functions (reducers) to react only to + * relevant changes and ignore other changes of KDContext + */ + var recentField: String + + /** + * Get field's value by its name + */ + fun field(name: String): T + /** + * Erase type + * + * Used by KDController to assign recent field's value + */ + fun fieldAny(name: String): Any { + return field(name) + } + /** + * Create a copy of the KDContext derivative + * + * Used by KDController to treat all derived contexts as KDContext + */ + fun selfCopy(): KDContext + /** + * Set field's value by its name + */ + fun setField(name: String, value: Any?) +} +/** + * This file is a part of Kotlin dialect: + * https://github.com/OGStudio/kotlin-dialect + * License: CC0 + * Version: 2.0.0 + */ + + + + + +val KD_FIELD_NONE = "none" + + +class KDController( + var context: KDContext +) { + internal var callbacks = mutableListOf<(c: KDContext) -> Unit>() + internal var functions = mutableListOf<(c: KDContext) -> KDContext>() + var isProcessingQueue = false + internal var queue = mutableListOf() + + fun executeFunctions() { + val c = queue.removeAt(0) + context.recentField = c.recentField + context.setField(c.recentField, c.fieldAny(c.recentField)) + + for (f in functions) { + val ctx = f(context.selfCopy()) + if (ctx.recentField != KD_FIELD_NONE) { + queue.add(ctx) + } + } + + reportContext() + } + + fun processQueue() { + // Prevent recursion. + if (isProcessingQueue) { + return + } + + isProcessingQueue = true + + while (queue.size > 0) { + executeFunctions() + } + + isProcessingQueue = false + } + + fun registerCallback(cb: (c: KDContext) -> Unit) { + callbacks.add(cb) + } + + fun registerFieldCallback( + fieldName: String, + cb: (KDContext) -> Unit + ) { + callbacks.add({ c -> + if (c.recentField == fieldName) { + cb(c) + } + }) + } + + fun registerFunction(f: (KDContext) -> KDContext) { + functions.add(f) + } + + fun reportContext() { + for (cb in callbacks) { + cb(context) + } + } + + fun set(fieldName: String, value: Any) { + var c = context.selfCopy() + c.setField(fieldName, value) + c.recentField = fieldName + queue.add(c) + processQueue() + } +} +/** + * This file is a part of Kotlin dialect: + * https://github.com/OGStudio/kotlin-dialect + * License: CC0 + * Version: 2.0.0 + */ + + + + + +// Register several oneliner callbacks to a controller + +fun registerOneliners( + ctrl: KDController, + items: Array +) { + val halfCount = items.size / 2 + for (i in 0.. Unit + ctrl.registerFieldCallback(field, callback); + } +} diff --git a/test/kd.yml b/test/kd.yml new file mode 100644 index 0000000..166d9c7 --- /dev/null +++ b/test/kd.yml @@ -0,0 +1,3 @@ +version: 1 + +kotlin: package org.opengamestudio diff --git a/test/make b/test/make deleted file mode 100755 index 5119b7a..0000000 --- a/test/make +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -e -SDIR=$(cd "$(dirname "$0")" ; pwd -P) - -kotlinc-native \ - $SDIR/../src/KDContext.kt \ - $SDIR/../src/KDController.kt \ - $SDIR/../src/registerOneliners.kt \ - $SDIR/main.kt \ - $SDIR/tests.kt \ - -o $SDIR/do-test - -# Get rid of the weird `kexe` extension on *nix -# JetBrains, seriously, drop this -mv $SDIR/do-test{.kexe,} diff --git a/util/other b/util/other new file mode 100644 index 0000000..db89228 --- /dev/null +++ b/util/other @@ -0,0 +1,17 @@ +#!/bin/bash + +# Reusable +BUILD_DIR=$SDIR/../klin/ver-nodejs/build/js/packages/ver-nodejs-app/kotlin +GRADLE_DIR=$SDIR/../klin/ver-nodejs +KLIN_SRC_DIR=$SDIR/../klin/ver-nodejs/app/src/commonMain/kotlin/org/opengamestudio +SRC_DIR=$SDIR/../src + +# Replace a line in a file +function replace { + file=$1 + was=$2 + now=$3 + cmd="sed -i.backup 's|$was|$now|g' $file" + eval "$cmd" + rm $file.backup +} diff --git a/util/run-klin-dbg b/util/run-klin-dbg index 61ee37b..0a35ed0 100755 --- a/util/run-klin-dbg +++ b/util/run-klin-dbg @@ -1,14 +1,11 @@ #!/bin/bash -e SDIR=$(cd "$(dirname "$0")" ; pwd -P) -BUILD_DIR=$SDIR/../klin/ver-nodejs/build/js/packages/ver-nodejs-app/kotlin -GRADLE_DIR=$SDIR/../klin/ver-nodejs +T=$SDIR/step +source $SDIR/other -cd $GRADLE_DIR -./gradlew kotlinUpgradeYarnLock -./gradlew jsNodeProductionRun - -node $BUILD_DIR/app.js \ - --file=$SDIR/../klin.yml \ - --out=/tmp/klin.kt - #--out=$SDIR/../src/klin.kt +STEP=0 +source $T/embedKDFiles +source $T/buildKlin +source $T/generateKlinKD +source $T/distributeKlin diff --git a/util/run-tests b/util/run-tests new file mode 100755 index 0000000..a53cfde --- /dev/null +++ b/util/run-tests @@ -0,0 +1,15 @@ +#!/bin/bash -e +SDIR=$(cd "$(dirname "$0")" ; pwd -P) + +T=$SDIR/step +source $SDIR/other + +STEP=0 +# Build Klin just in case it wasn't yet built +source $T/buildKlin + +# Proceed with tests +source $T/generateTestKD +source $T/stripTestKDJS +source $T/buildTest +source $T/runTest diff --git a/util/step/buildKlin b/util/step/buildKlin new file mode 100644 index 0000000..801c34c --- /dev/null +++ b/util/step/buildKlin @@ -0,0 +1,7 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Build Klin" +cd $GRADLE_DIR +./gradlew kotlinUpgradeYarnLock +./gradlew jsNodeProductionRun diff --git a/util/step/buildTest b/util/step/buildTest new file mode 100644 index 0000000..9e2cfa4 --- /dev/null +++ b/util/step/buildTest @@ -0,0 +1,14 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Build test" +mkdir -p $SDIR/../test/build +kotlinc-native \ + $SDIR/../test/kd.kt \ + $SDIR/../test/main.kt \ + $SDIR/../test/tests.kt \ + -o $SDIR/../test/build/do-test + +# Get rid of the weird `kexe` extension on *nix +# JetBrains, seriously, drop this +mv $SDIR/../test/build/do-test{.kexe,} diff --git a/util/step/distributeKlin b/util/step/distributeKlin new file mode 100644 index 0000000..9018d76 --- /dev/null +++ b/util/step/distributeKlin @@ -0,0 +1,8 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Distribute Klin" +DIST_DIR=$SDIR/../dist +cp $BUILD_DIR/app.js $DIST_DIR +cp $BUILD_DIR/kotlin-kotlin-stdlib.js $DIST_DIR +cp $BUILD_DIR/ver-nodejs-app.js $DIST_DIR diff --git a/util/step/embedKDFiles b/util/step/embedKDFiles new file mode 100644 index 0000000..8f460e0 --- /dev/null +++ b/util/step/embedKDFiles @@ -0,0 +1,21 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Embed KD files" +TMP=/tmp/kd.tmp +TMP64=/tmp/kd.tmp64 +EMB64=$KLIN_SRC_DIR/emb64.kt + +# Combine files +cat $SRC_DIR/KDContext.kt > $TMP +cat $SRC_DIR/KDController.kt >> $TMP +cat $SRC_DIR/registerOneliners.kt >> $TMP + +# Convert to Base64 +base64 -i $TMP -o $TMP64 + +# Generate source code file +echo "package org.opengamestudio" > $EMB64 +echo -n "val emb64=\"" >> $EMB64 +cat $TMP64 | tr -d '\n' >> $EMB64 +echo "\"" >> $EMB64 diff --git a/util/step/generateKlinKD b/util/step/generateKlinKD new file mode 100644 index 0000000..6dcb92e --- /dev/null +++ b/util/step/generateKlinKD @@ -0,0 +1,8 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Generate KD for Klin" + +node $BUILD_DIR/app.js \ + --file=$SDIR/../klin/kd.yml \ + --out=$KLIN_SRC_DIR/kd.kt diff --git a/util/step/generateTestKD b/util/step/generateTestKD new file mode 100644 index 0000000..2ffdd01 --- /dev/null +++ b/util/step/generateTestKD @@ -0,0 +1,8 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Generate KD for tests" + +node $BUILD_DIR/app.js \ + --file=$SDIR/../test/kd.yml \ + --out=$SDIR/../test/kd.kt diff --git a/util/step/runTest b/util/step/runTest new file mode 100644 index 0000000..ebcd2c5 --- /dev/null +++ b/util/step/runTest @@ -0,0 +1,5 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Run test" +$SDIR/../test/build/do-test diff --git a/util/step/stripTestKDJS b/util/step/stripTestKDJS new file mode 100644 index 0000000..9f5645b --- /dev/null +++ b/util/step/stripTestKDJS @@ -0,0 +1,5 @@ +#!/bin/bash + +STEP=$((STEP+1)) +echo -e "\n> > > > Step №$STEP. Strip JsExport from KD for tests" +replace $SDIR/../test/kd.kt "@JsExport" ""